delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2001/01/23/12:56:33

Date: Tue, 23 Jan 2001 19:55:16 +0200
From: "Eli Zaretskii" <eliz AT is DOT elta DOT co DOT il>
Sender: halo1 AT zahav DOT net DOT il
To: Martin Str|mberg <ams AT ludd DOT luth DOT se>
Message-Id: <8011-Tue23Jan2001195515+0200-eliz@is.elta.co.il>
X-Mailer: Emacs 20.6 (via feedmail 8.3.emacs20_6 I) and Blat ver 1.8.6
CC: djgpp-workers AT delorie DOT com
In-reply-to: <200101231735.SAA21377@father.ludd.luth.se> (message from Martin
Str|mberg on Tue, 23 Jan 2001 18:35:52 +0100 (MET))
Subject: Re: Debugging on 386
References: <200101231735 DOT SAA21377 AT father DOT ludd DOT luth DOT se>
Reply-To: djgpp-workers AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp-workers AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

> From: Martin Str|mberg <ams AT ludd DOT luth DOT se>
> Date: Tue, 23 Jan 2001 18:35:52 +0100 (MET)
> 
> According to Eli Zaretskii:
> > > -> c
> > > Breakpoint 1, main (argc=1, argv=0x905d4) at analyse_ints.c:129
> > > 129       if( argc != 2)
> > > -> bt
> > > #0  main (argc=1, argv=0x905d4) at analyse_ints.c:129
> > > #1  0x3368 in __crt1_startup ()
> > > -> n
> > > Exiting due to signal SIGFPE
> > 
> > This one is not.  What does "disassemble analyse_ints" print near the
> > EIP of the breakpoint (0x1a64)?  Do you see any FP instructions
> > anywhere around that?
> 
> Here's the disassembly (-> disass main):
> Dump of assembler code for function main:
> 0x1a58 <main>:  push   %ebp
> 0x1a59 <main+1>:        mov    %esp,%ebp
> 0x1a5b <main+3>:        sub    $0x7c,%esp
> 0x1a5e <main+6>:        push   %edi
> 0x1a5f <main+7>:        push   %esi
> 0x1a60 <main+8>:        push   %ebx
> 0x1a61 <main+9>:        mov    0xc(%ebp),%edx
> 0x1a64 <main+12>:       cmpl   $0x2,0x8(%ebp)
> 0x1a68 <main+16>:       je     0x1a84 <main+44>
> 0x1a6a <main+18>:       mov    (%edx),%eax
> 0x1a6c <main+20>:       add    $0xfffffff8,%esp
> 0x1a6f <main+23>:       push   %eax
> 0x1a70 <main+24>:       push   $0x1810
> 0x1a75 <main+29>:       call   0x3800 <printf>
> 0x1a7a <main+34>:       add    $0xfffffff4,%esp
> 
> As you can see no floating point instructions anywhere.

Yep.

What happens if you say "c" instead of "n" at that point?  Does the
program run normally then?

> > > Coprocessor Error at eip=00001a64, x87 status=
> > > Program received signal SIGEMT, Emulation trap.
> > > 0x9611 in _status87 ()
> > > -> bt
> > > #0  0x9611 in _status87 ()
> > > #1  0x47da in do_faulting_finish_message ()
> > > #2  0x4d13 in __djgpp_traceback_exit ()
> > > #3  0x4da0 in raise ()
> > > #4  0x2c3a in nofpsig ()
> > > #5  0x4daa in raise ()
> > > #6  0x4e07 in __djgpp_exception_processor ()
> > > #7  0x1 in ?? ()
> > > #8  0x3368 in __crt1_startup ()
> > 
> > This is expected: the code which prints the traceback calls
> > _status87.  But what is that 0x1 on the stack?
> 
> I can't explain it but it seems to be the value of argc (or a copy of
> it) because if I try to run the program with "r a" it becomes 0x2 and
> with "r 2 b" it becomes 0x3.

Yes, it looks like that.  Seems like someone is not adjusting the
stack somewhere.  Hm...

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019