Mail Archives: djgpp/2002/11/11/14:05:09
> 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 -