gdb 6.1.1 (PPC) crash (long)

Fabian Cenedese
2004-09-01T09:01:06Z

Hi

First apologies for the long mail. I just thought I tell you exactly what happened :)

I get a crash when trying to lookup a symbol with my cross compiled gdb. It's
just this one symbol (so far), others I can lookup with no problems.
Here's what happens:

N:\IMD\Bin\Gnu32>gdb
GNU gdb 6.1.1
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "--host=i686-pc-cygwin --target=powerpc-eabi".

(gdb) file n:/temp/throwaway/psism2/psism.x
Reading symbols from n:/temp/throwaway/psism2/psism.x...done.

(gdb) target remote 127.0.0.1:10372
Remote debugging using 127.0.0.1:10372
0x000b9d04 in CMainTask::Action (this=0x125018)
at N:\Temp\ThrowAway\psism2\os\inos\Src\Inos.cpp:1924
1924 Suspend();
warning: no shared library support for this OS / ABI
Current language: auto; currently c++

(gdb) bt
#0 0x000b9d04 in CMainTask::Action (this=0x125018)
at N:\Temp\ThrowAway\psism2\os\inos\Src\Inos.cpp:1924
#1 0x0010e348 in _guard_stack ()
#2 0x00118fdc in CINOSScheduler::DoInitialisation (this=0x125018)
at N:\Temp\ThrowAway\psism2\os\inos\Src\Inos.cpp:546
#3 0x0011881c in inos_main ()
at N:\Temp\ThrowAway\psism2\os\inos\Src\Inos.cpp:368
#4 0x0008d660 in resTb ()

(gdb) ptype this
type = class CMainTask : public CINOSTask {
public:
CMainTask & operator=(CMainTask const &);
virtual ~CMainTask(void);
2 [main] gdb 2100 handle_exceptions: Exception: STATUS_ACCESS_VIOLATION
329 [main] gdb 2100 open_stackdumpfile: Dumping stack trace to gdb.exe.stack
dump

This is the written stack dump. Though I worked with the unstripped gdb.exe there
are no symbols in the dump:

Exception: STATUS_ACCESS_VIOLATION at eip=0048A102
eax=00000000 ebx=00000000 ecx=00000002 edx=0048A0F0 esi=00000000 edi=0A2B5D08
ebp=0022E718 esp=0022E700 program=N:\IMD\Bin\Gnu32\gdb.exe, pid 2100, thread main
cs=001B ds=0023 es=0023 fs=003B gs=0000 ss=0023
Stack trace:
Frame Function Args
0022E718 0048A102 (00000000, 0A29CE18, 0022E7B8, 004DDA6C)
0022E728 00488BF8 (00000000, 0A2B5DA8, 00000000, FFFFFFFF)
0022E7B8 004DDA6C (0A2B5BE8, 0A083C68, 00000001, 00000000)
0022E7E8 004DC816 (0A2B5BE8, 00716C4D, 0A083C68, 00000001)
0022E808 004945AF (0A2B5BE8, 00716C4D, 0A083C68, 00000001)
0022E848 004946BE (0A0513DE, 00000001, 0022E888, 6105C355)
0022E878 00494869 (0A0513DE, 00000001, 0022E8A8, 0042921C)
0022E888 00427339 (0A078A60, 0A0513DE, 00000001, 00415C7A)
0022E8A8 0042921C (0A078A60, 0A0513DE, 00000001, 00000000)
0022E8E8 0040285D (0A0513E1, 00000001, 0022E918, 0067C914)
0022E918 004247E9 (0A0513D8, 0A087BA0, 0022E940, 0068C0BF)
0022E958 00424C35 (0A2886A8, 0A2886A8, 0022F140, 0A2886A8)
0022E978 0068ACA5 (0022E938, 0A075F68, 0022E998, 004246CD)
0022E988 004240EB (00000000, 0000000C, 0022E9B8, 0047F34E)
0022E998 004246CD (00000000, 00000000, 00000000, 0040A7D9)
0022E9B8 0047F34E (00000000, 00000001, 00000000, 00000000)
End of stack trace (more stack frames may be present)

I then tried to debug my gdb with the normal gdb, but this doesn't work either:

GNU gdb 2003-09-20-cvs (cygwin-special)
Copyright 2003 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "i686-pc-cygwin".

(gdb) file gdb.exe
Reading symbols from gdb.exe...done.

(gdb) run
Starting program: /cygdrive/n/imd/bin/gnu32/gdb.exe
GNU gdb 6.1.1
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "--host=i686-pc-cygwin --target=powerpc-eabi".

(gdb) file N:/temp/throwaway/psism2/psism.x
Reading symbols from N:/temp/throwaway/psism2/psism.x...done.

(gdb) target remote 127.0.0.1:10372

Program received signal SIGSEGV, Segmentation fault.
0x77e95e30 in KERNEL32!IsBadWritePtr ()
from /cygdrive/c/WINNT/system32/kernel32.dll

(gdb) bt
#0 0x77e95e30 in KERNEL32!IsBadWritePtr ()
from /cygdrive/c/WINNT/system32/kernel32.dll
#1 0x610a92ed in cygwin1!__getreent ()
from /cygdrive/n/imd/bin/gnu32/cygwin1.dll
#2 0x00000008 in ?? ()
#3 0x0022d0d8 in ?? ()
#4 0x610a9387 in cygwin1!__getreent ()
from /cygdrive/n/imd/bin/gnu32/cygwin1.dll
(gdb)

They both use the same new cygwin1.dll (1.5.10) so that shouldn't be
a problem.

How can I find out what gdb doesn't like about my symbols? The file
was made with an old gcc 2.95.2 (also cross compiled for PPC).
The stripped bin file is working in my target so at most there could
be something wrong with the debug info. I found that even simply
loading the file and doing a ptype CMainTask make both gdb crash.

Now the same again without doing remote communication:

N:\IMD\Bin\Gnu32>c:/cygwinnew/bin/gdb
GNU gdb 2003-09-20-cvs (cygwin-special)
Copyright 2003 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "i686-pc-cygwin".

(gdb) file gdb.exe
Reading symbols from gdb.exe...done.

(gdb) run
Starting program: /cygdrive/n/IMD/Bin/Gnu32/gdb.exe
GNU gdb 6.1.1
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "--host=i686-pc-cygwin --target=powerpc-eabi".

(gdb) file n:/temp/throwaway/psism2/psism.x
Reading symbols from n:/temp/throwaway/psism2/psism.x...done.

(gdb) ptype CMainTask
type = class CMainTask : public CINOSTask {
public:
CMainTask & operator=(CMainTask const &);
virtual ~CMainTask(void);

Program received signal SIGSEGV, Segmentation fault.
gnuv2_is_constructor_name (name=0x0) at ../../gdb-6.1.1/gdb/gnu-v2-abi.c:56
56 if ((name[0] == '_' && name[1] == '_'

(gdb) bt
#0 gnuv2_is_constructor_name (name=0x0)
at ../../gdb-6.1.1/gdb/gnu-v2-abi.c:56
#1 0x00488bf8 in is_constructor_name (name=0x0)
at ../../gdb-6.1.1/gdb/cp-abi.c:44
#2 0x004dda6c in c_type_print_base (type=0xa2b4b68, stream=0xa084088,
show=1, level=0) at ../../gdb-6.1.1/gdb/c-typeprint.c:952
#3 0x004dc816 in c_print_type (type=0xa2b4b68, varstring=0x716c4d "",
stream=0xa084088, show=1, level=0) at ../../gdb-6.1.1/gdb/c-typeprint.c:75
#4 0x004945af in type_print (type=0xa2b4b68, varstring=0x716c4d "",
stream=0xa084088, show=1) at ../../gdb-6.1.1/gdb/typeprint.c:109
#5 0x0049482a in ptype_command (typename=0xa05180e "CMainTask", from_tty=1)
at ../../gdb-6.1.1/gdb/typeprint.c:223
#6 0x00427339 in do_cfunc (c=0xa078e88, args=0xa05180e "CMainTask",
from_tty=1) at ../../gdb-6.1.1/gdb/cli/cli-decode.c:57
#7 0x0042921c in cmd_func (cmd=0xa078e88, args=0xa05180e "CMainTask",
from_tty=1) at ../../gdb-6.1.1/gdb/cli/cli-decode.c:1541
#8 0x0040285d in execute_command (p=0xa051816 "k", from_tty=1)
at ../../gdb-6.1.1/gdb/top.c:743
#9 0x004247e9 in command_handler (command=0xa051808 "ptype CMainTask")
at ../../gdb-6.1.1/gdb/event-top.c:500
#10 0x00424c35 in command_line_handler (rl=0xa0880d8 "ptype CMainTask")
at ../../gdb-6.1.1/gdb/event-top.c:793
#11 0x0068aca5 in rl_callback_read_char ()
at ../../gdb-6.1.1/readline/callback.c:123
#12 0x004240eb in rl_callback_read_char_wrapper (client_data=0x0)
at ../../gdb-6.1.1/gdb/event-top.c:166
#13 0x004246cd in stdin_event_handler (error=0, client_data=0x0)
at ../../gdb-6.1.1/gdb/event-top.c:416
#14 0x0047f34e in handle_file_event (event_file_desc=0)
at ../../gdb-6.1.1/gdb/event-loop.c:721
#15 0x0047edb9 in process_event () at ../../gdb-6.1.1/gdb/event-loop.c:334
#16 0x0047ee18 in gdb_do_one_event (data=0x0)
at ../../gdb-6.1.1/gdb/event-loop.c:371
#17 0x004024b1 in do_catch_errors (uiout=0xa07cbb8, data=0x22eb50)
at ../../gdb-6.1.1/gdb/top.c:523
#18 0x00402325 in catcher (func=0x4024a0 <do_catch_errors>,
func_uiout=0xa07cbb8, func_args=0x22eb50, func_val=0x22eb48,
func_caught=0x22eb4c, errstring=0x710a9c "", gdberrmsg=0x0, mask=6)
at ../../gdb-6.1.1/gdb/top.c:430
#19 0x00402510 in catch_errors (func=0x47ede0 <gdb_do_one_event>,
func_args=0x0, errstring=0x710a9c "", mask=6)
at ../../gdb-6.1.1/gdb/top.c:535
#20 0x0047ee54 in start_event_loop () at ../../gdb-6.1.1/gdb/event-loop.c:397
#21 0x004010cb in captured_command_loop (data=0x0)
at ../../gdb-6.1.1/gdb/main.c:97
#22 0x004024b1 in do_catch_errors (uiout=0xa07cbb8, data=0x22ed00)
at ../../gdb-6.1.1/gdb/top.c:523
#23 0x00402325 in catcher (func=0x4024a0 <do_catch_errors>,
func_uiout=0xa07cbb8, func_args=0x22ed00, func_val=0x22ecf8,
func_caught=0x22ecfc, errstring=0x6da0ec "", gdberrmsg=0x0, mask=6)
at ../../gdb-6.1.1/gdb/top.c:430
#24 0x00402510 in catch_errors (func=0x4010c0 <captured_command_loop>,
func_args=0x0, errstring=0x6da0ec "", mask=6)
at ../../gdb-6.1.1/gdb/top.c:535
#25 0x00401a64 in captured_main (data=0x22f030)
at ../../gdb-6.1.1/gdb/main.c:805
#26 0x004024b1 in do_catch_errors (uiout=0x6ad4f0, data=0x22eff0)
at ../../gdb-6.1.1/gdb/top.c:523
#27 0x00402325 in catcher (func=0x4024a0 <do_catch_errors>,
func_uiout=0x6ad4f0, func_args=0x22eff0, func_val=0x22efe8,
func_caught=0x22efec, errstring=0x6da0ec "", gdberrmsg=0x0, mask=6)
at ../../gdb-6.1.1/gdb/top.c:430
#28 0x00402510 in catch_errors (func=0x401110 <captured_main>,
func_args=0x22f030, errstring=0x6da0ec "", mask=6)
at ../../gdb-6.1.1/gdb/top.c:535
#29 0x00401f03 in gdb_main (args=0x22f030) at ../../gdb-6.1.1/gdb/main.c:814
#30 0x004010aa in main (argc=1, argv=0xa0516e8)
at ../../gdb-6.1.1/gdb/gdb.c:35

Thanks for any help. If this is fixed in gdb 6.2 please tell me the patch. Compiling
6.2 didn't work for some reason (don't remember now). But I can apply any changes
to my gdb as I need to compile it anyway.

bye Fabi