MinGW的GDB不会在SegFault上显示我的堆栈帧

时间:2017-12-22 07:13:51

标签: c segmentation-fault gdb mingw

在MinGW的GDB(7.6.1)中,我有时遇到一个问题,即SegFault不会在堆栈上留下太多有用的信息(参见下面的记录)。

对于脚本中的错误,我知道它发生的原因:我将fseeki64作为文件指针调用了一个错误的值。 fseeki64确实出现在堆栈跟踪中,但我无法看到程序的哪一部分间接调用它。

我不想看到Microsoft符号,我想看到堆栈的一部分属于我的程序(用-g编译)。

由于我不经常遇到SegFaults,我当前的解决方法是一些手动劳动:“下一步”通过主要(垃圾邮件进入)找出哪个顶级功能负责,重启,'步骤'(垃圾邮件进入)通过功能直到段错误。

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)

0 个答案:

没有答案