Re: How to catch GDB crash

Dmitry Smirnov
2008-06-26T13:56:52Z

I still have some doubts :-)

Below is a new log of my debug session. I've set the same mi_execute_command and mi_on_resume. Last one prints the value of 'inferior_ptid' when hit. Also, from Eclipse I've issues command 'ni' before 'c'. As you can see, 'inferior_ptid' it is equal to {pid = 42000, lwp = 0, tid = 0} all the time whereas mi_on_resume is called with {pid = -1, lwp = 0, tid = 0} in all cases except last one.

On my mind it indicates that while executing last 'ni', function resume() in file infrun.c goes different way and it assigned 'inferior_ptid' to 'resume_ptid' instead of default RESUME_ALL.

Digging...

Dmitry

GNU gdb 6.3.50_2004-12-28-cvs (cygwin-special)
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 "i686-pc-cygwin".
(gdb) attach 2348
Attaching to process 2348
Reading symbols from /cygdrive/d/Install/GDB/gdb-6.8.50.20080620/gdb-6.8.50.2008
0620/gdb/gdb.exe...done.
[Switching to thread 2348.0x15bc]
(gdb) info b
No breakpoints or watchpoints.
(gdb) b mi_on_resume
Breakpoint 1 at 0x48cf46: file .././gdb/mi/mi-interp.c, line 335.
(gdb) b mi_execute_command
Breakpoint 2 at 0x505537: file .././gdb/mi/mi-main.c, line 1135.
(gdb) commands 1
Type commands for when breakpoint 1 is hit, one per line.
End with a line saying just "end".
>print inferior_ptid
>c
>end
(gdb) commands 2
Type commands for when breakpoint 2 is hit, one per line.
End with a line saying just "end".
>c
>end
(gdb) ni
0x7c9507a8 in ntdll!KiIntSystemCall () from /c/WINDOWS/system32/ntdll.dll
(gdb)
0x7c9507bb in ntdll!KiIntSystemCall () from /c/WINDOWS/system32/ntdll.dll
(gdb)
0x7c9507bf in ntdll!KiIntSystemCall () from /c/WINDOWS/system32/ntdll.dll
(gdb)
0x7c9507c1 in ntdll!KiIntSystemCall () from /c/WINDOWS/system32/ntdll.dll
(gdb)
[Switching to thread 2348.0x740]

Breakpoint 2, mi_execute_command (cmd=0x138f74a0 "303 ni", from_tty=1)
at .././gdb/mi/mi-main.c:1135
1135 {

Breakpoint 1, mi_on_resume (ptid={pid = -1, lwp = 0, tid = 0})
at .././gdb/mi/mi-interp.c:335
335 if (PIDGET (ptid) == -1)
$1 = {pid = 42000, lwp = 0, tid = 0}

Breakpoint 2, mi_execute_command (cmd=0x1393df78 "304 info threads",
from_tty=1) at .././gdb/mi/mi-main.c:1135
1135 {

Breakpoint 2, mi_execute_command (cmd=0x1393dfd0 "305-stack-info-depth",
from_tty=1) at .././gdb/mi/mi-main.c:1135
1135 {

Breakpoint 2, mi_execute_command (cmd=0x1395a678 "306-stack-list-frames 0 1",
from_tty=1) at .././gdb/mi/mi-main.c:1135
1135 {

Breakpoint 2, mi_execute_command (
cmd=0x1395a6d0 "307-data-list-changed-registers", from_tty=1)
at .././gdb/mi/mi-main.c:1135
1135 {

Breakpoint 2, mi_execute_command (cmd=0x13962898 "308 info sharedlibrary",
from_tty=1) at .././gdb/mi/mi-main.c:1135
1135 {

Breakpoint 2, mi_execute_command (
cmd=0x139628f0 "309-stack-list-arguments 0 0 0", from_tty=1)
at .././gdb/mi/mi-main.c:1135
1135 {

Breakpoint 2, mi_execute_command (cmd=0x13927738 "310-stack-list-locals 0",
from_tty=1) at .././gdb/mi/mi-main.c:1135
1135 {

Breakpoint 2, mi_execute_command (
cmd=0x13927790 "311-interpreter-exec console \"info b\"", from_tty=1)
at .././gdb/mi/mi-main.c:1135
1135 {

Breakpoint 2, mi_execute_command (cmd=0x13977ce8 "312 c", from_tty=1)
at .././gdb/mi/mi-main.c:1135
1135 {

Breakpoint 1, mi_on_resume (ptid={pid = -1, lwp = 0, tid = 0})
at .././gdb/mi/mi-interp.c:335
335 if (PIDGET (ptid) == -1)
$2 = {pid = 42000, lwp = 0, tid = 0}

Breakpoint 2, mi_execute_command (cmd=0x13974bd8 "313 info threads",
from_tty=1) at .././gdb/mi/mi-main.c:1135
1135 {

Breakpoint 2, mi_execute_command (cmd=0x13980e98 "314-stack-info-depth",
from_tty=1) at .././gdb/mi/mi-main.c:1135
1135 {

Breakpoint 2, mi_execute_command (
cmd=0x14770128 "315-stack-list-frames 0 11", from_tty=1)
at .././gdb/mi/mi-main.c:1135
1135 {

Breakpoint 2, mi_execute_command (
cmd=0x14770010 "316-data-list-changed-registers", from_tty=1)
at .././gdb/mi/mi-main.c:1135
1135 {

Breakpoint 2, mi_execute_command (cmd=0x10ef8958 "317 info sharedlibrary",
from_tty=1) at .././gdb/mi/mi-main.c:1135
1135 {

Breakpoint 2, mi_execute_command (
cmd=0x10ef89b0 "318-data-disassemble -f /c/p4/views/KSW_S4000_WP_DEV_unknown
/qct/drivers/parb/parb.c -l 333 -n 100 -- 1", from_tty=1)
at .././gdb/mi/mi-main.c:1135
1135 {

Breakpoint 2, mi_execute_command (
cmd=0x1476fe18 "319-data-disassemble -s 0x8c4a8e -e 0x8c4af2 -- 0",
from_tty=1) at .././gdb/mi/mi-main.c:1135
1135 {

Breakpoint 2, mi_execute_command (
cmd=0x1172a8d0 "320-stack-list-arguments 0 0 0", from_tty=1)
at .././gdb/mi/mi-main.c:1135
1135 {

Breakpoint 2, mi_execute_command (cmd=0x11738a00 "321-stack-list-locals 0",
from_tty=1) at .././gdb/mi/mi-main.c:1135
1135 {

Breakpoint 2, mi_execute_command (cmd=0x1174b920 "322 whatis i", from_tty=1)
at .././gdb/mi/mi-main.c:1135
1135 {

Breakpoint 2, mi_execute_command (cmd=0x11758f10 "323 whatis rt_status",
from_tty=1) at .././gdb/mi/mi-main.c:1135
1135 {

Breakpoint 2, mi_execute_command (cmd=0x11761360 "324 whatis __result",
from_tty=1) at .././gdb/mi/mi-main.c:1135
1135 {

Breakpoint 2, mi_execute_command (cmd=0x11761548 "325-var-create - * i",
from_tty=1) at .././gdb/mi/mi-main.c:1135
1135 {

Breakpoint 2, mi_execute_command (
cmd=0x117616e8 "326-var-evaluate-expression var1", from_tty=1)
at .././gdb/mi/mi-main.c:1135
1135 {

Breakpoint 2, mi_execute_command (
cmd=0x117c3978 "327-var-create - * rt_status", from_tty=1)
at .././gdb/mi/mi-main.c:1135
1135 {

Breakpoint 2, mi_execute_command (
cmd=0x11785568 "328-var-evaluate-expression var2", from_tty=1)
at .././gdb/mi/mi-main.c:1135
1135 {

Breakpoint 2, mi_execute_command (
cmd=0x1178b4b8 "329-var-create - * __result", from_tty=1)
at .././gdb/mi/mi-main.c:1135
1135 {

Breakpoint 2, mi_execute_command (
cmd=0x1178b550 "330-var-evaluate-expression var3", from_tty=1)
at .././gdb/mi/mi-main.c:1135
1135 {

Breakpoint 2, mi_execute_command (cmd=0x11795130 "331 ni", from_tty=1)
at .././gdb/mi/mi-main.c:1135
1135 {

Breakpoint 1, mi_on_resume (ptid={pid = 42000, lwp = 0, tid = 0})
at .././gdb/mi/mi-interp.c:335
335 if (PIDGET (ptid) == -1)
$3 = {pid = 42000, lwp = 0, tid = 0}

Program exited with code 037777777777.
(gdb)