MinGW's GDB does not show my stackframes on SegFault

0

On MinGW's GDB (7.6.1) I sometimes run into the problem that a SegFault does not leave much useful information on the stacks (see transcript below).

For the error in the transcript I know why it occured: I called fseeki64 with a bad value as file-pointer. The fseeki64 does appear in the stack-trace but I cant see which part of my program indirectly called it.

I dont want to see the Microsoft symbols, I want to see the part of the stack that belongs to my program (which was compiled with -g).

Since I dont run into SegFaults often, my current workaround is some manual labor: 'next' through main (spamming enter) to find out which top-level function was responsible, restart, 'step' (spamming enter) through that function until the segfault.

GNU gdb (GDB) 7.6.1
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "mingw32".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from A:\prj\lib\fileBuffer\test.exe...done.
(gdb) r
Starting program: A:\prj\lib\fileBuffer/test.exe
[New Thread 3408.0x4094]
[New Thread 3408.0x3e40]
[New Thread 3408.0x4c14]
[New Thread 3408.0x5754]

Program received signal SIGSEGV, Segmentation fault.
0x77e2b2e3 in ?? ()
(gdb) info thr
  Id   Target Id         Frame
  4    Thread 3408.0x5754 0x77e5396c in ?? ()
  3    Thread 3408.0x4c14 0x77e5396c in ?? ()
  2    Thread 3408.0x3e40 0x77e5396c in ?? ()
* 1    Thread 3408.0x4094 0x77e2b2e3 in ?? ()
(gdb) where
#0  0x77e2b2e3 in ?? ()
#1  0x74d38384 in msvcrt!__p__iob () from C:\WINDOWS\SysWOW64\msvcrt.dll
#2  0x000000f4 in ?? ()
#3  0x000000d4 in ?? ()
#4  0x0063fd88 in ?? ()
#5  0x74d43175 in msvcrt!_fseeki64 () from C:\WINDOWS\SysWOW64\msvcrt.dll
#6  0x000000d4 in ?? ()
#7  0x0ab2d946 in ?? ()
#8  0x00000000 in ?? ()
(gdb) thr 2
[Switching to thread 2 (Thread 3408.0x3e40)]
#0  0x77e5396c in ?? ()
(gdb) where
#0  0x77e5396c in ?? ()
#1  0x75588744 in KERNEL32!BaseThreadInitThunk () from C:\WINDOWS\SysWOW64\kernel32.dll
#2  0x77e4582d in ?? ()
#3  0x77e457fd in ?? ()
#4  0x00000000 in ?? ()
(gdb) thr 3
[Switching to thread 3 (Thread 3408.0x4c14)]
#0  0x77e5396c in ?? ()
(gdb) where
#0  0x77e5396c in ?? ()
#1  0x75588744 in KERNEL32!BaseThreadInitThunk () from C:\WINDOWS\SysWOW64\kernel32.dll
#2  0x77e4582d in ?? ()
#3  0x77e457fd in ?? ()
#4  0x00000000 in ?? ()
(gdb) thr 4
[Switching to thread 4 (Thread 3408.0x5754)]
#0  0x77e5396c in ?? ()
(gdb) where
#0  0x77e5396c in ?? ()
#1  0x75588744 in KERNEL32!BaseThreadInitThunk () from C:\WINDOWS\SysWOW64\kernel32.dll
#2  0x77e4582d in ?? ()
#3  0x77e457fd in ?? ()
#4  0x00000000 in ?? ()
(gdb)
c
segmentation-fault
gdb
mingw
asked on Stack Overflow Dec 22, 2017 by Bernd Elkemann

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0