delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2002/11/11/14:05:09

Date: Mon, 11 Nov 2002 21:05:35 +0300
From: "Eli Zaretskii" <eliz AT is DOT elta DOT co DOT il>
Sender: halo1 AT zahav DOT net DOT il
To: Charles Wilkins <chas AT pcscs DOT com>
Message-Id: <9003-Mon11Nov2002210535+0200-eliz@is.elta.co.il>
X-Mailer: emacs 21.3.50 (via feedmail 8 I) and Blat ver 1.8.9
CC: djgpp AT delorie DOT com
In-reply-to: <6g7vsu05b8d02ebonniuaqolche7npbe7m@4ax.com> (message from
Charles Wilkins on Mon, 11 Nov 2002 07:56:20 -0500)
Subject: Re: i686-pc-msdosdjgpp-g++ problems (long)
References: <85ctsu00ta2hiln51cm74ug0589tk0rp86 AT 4ax DOT com> <Pine DOT SUN DOT 3 DOT 91 DOT 1021111074205 DOT 748A-100000 AT is> <6g7vsu05b8d02ebonniuaqolche7npbe7m AT 4ax DOT com>
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

> From: Charles Wilkins <chas AT pcscs DOT com>
> Newsgroups: comp.os.msdos.djgpp
> Date: Mon, 11 Nov 2002 07:56:20 -0500
> 
> (gdb) br *0x0001e1df
> Breakpoint 1 at 0x1e1df
> (gdb) run
> Starting program: c:/Archives/RIP2/DJGPP/bin/wel-g.exe
> 
> Breakpoint 1, 0x0001e1df in
> std::ostream::sentry::sentry(std::ostream&) ()
> (gdb) disass 0x0001e1df

This is much more useful, thanks.

> Dump of assembler code for function _ZNSo6sentryC1ERSo:
> 0x1e1d0 <_ZNSo6sentryC1ERSo>:        push   %ebp
> 0x1e1d1 <_ZNSo6sentryC1ERSo+1>:        mov    %esp,%ebp
> 0x1e1d3 <_ZNSo6sentryC1ERSo+3>:        push   %ebx
> 0x1e1d4 <_ZNSo6sentryC1ERSo+4>:        mov    0xc(%ebp),%ecx
> 0x1e1d7 <_ZNSo6sentryC1ERSo+7>:        mov    0x8(%ebp),%edx
> 0x1e1da <_ZNSo6sentryC1ERSo+10>:        mov    (%ecx),%eax
> 0x1e1dc <_ZNSo6sentryC1ERSo+12>:        mov    %ecx,0x4(%edx)
> 0x1e1df <_ZNSo6sentryC1ERSo+15>:        mov    0xfffffff4(%eax),%ebx

It crashes here, and EAX holds a NULL pointer:

> Exiting due to signal SIGSEGV
> General Protection Fault at eip=0001e1df
> eax=00000000 ebx=00043b58 ecx=00043b58 edx=000c7f60 esi=00000054 edi=00001630
      ^^^^^^^^

So evidently, it tries to dereference a NULL pointer in
0xfffffff4(%eax).

Can you show the corresponding source code from libstdc++ sources?
That could give some ideas as to where to look next.

> I am able to simply link against against libstdc++.a without getting
> the SIGSEGV.  It is only when I include a libstdc++ header such as
> <iostream> that I get the SIGSEGV.

Does that mean that the exact same program works or does not work
depending on whether you include <iostream> or not?  Or do you have
to make other changes, like delete some code, when you don't include
that header?  If the latter, the program which works simply doesn't
pull some of the library functions due to code changes.

- Raw text -


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