c++ - 无法中断 gdb mingw 中的函数名称

标签 c++ gdb g++ mingw breakpoints

我的程序有多个文件,我用g++ -g编译。
当我尝试在 WinMain 上中断时,它说函数未定义,但当我显示列表时它出现在那里。

(gdb) list Winmain.cpp:237
237     // WinMain
238     int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance
pCmdLine, int nCmdShow) {
239
240             //Debuging mode
(gdb)
241
242             // IO thread  ;;;; in charge of writing stuff to files
reak the mem thread
243             // /var/log/simulator.log
244             freopen ("debug.txt", "w", stdout);
245
246             // Strings
247             static TCHAR szWindowClass[] = TEXT("myWnd"); // std::s
indowClass = "myWnd";
248             static TCHAR szTitle[] = _T("Virtual Map");   // std::s
itle = "Virtual map";
249
250             // Windows Structure
(gdb) b Winmain.cpp:WinMain
Function "WinMain" not defined in "Winmain.cpp".
Make breakpoint pending on future shared library load? (y or [n]) n

我可以用 b Winmain.cpp:238 中断,但为什么它不能按名称工作?

windows7 上的 mingw32
GNU gdb (GDB) 7.6.1

最佳答案

WinMain() 是一个 __stdcall 函数; (该知识通过 WINAPI 限定符传达,带有典型的 Microsoft 混淆)。因此,其公开可见的名称变为合格的 WinMain@16();你应该在这个限定名称上设置你的 gdb 断点。

关于c++ - 无法中断 gdb mingw 中的函数名称,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31152637/

相关文章:

c++ - 如何对数组 int (*&Test)[10] 进行赋值?

c# - 这是三元运算符的合理使用吗?

gdb - Peter 的 GDB 教程

c++ - 指针算法 C++ 的段错误

c++ - 更改 R 包的 exportPattern 以隐藏 Rcpp 函数

c++ - printf() 混淆 - 尝试打印字符串时打印 (null) 并在打印缓冲区时打印正确的值

python - 调试已运行脚本的内存消耗\泄漏

python - 如何使用 GDB 在 C 级别调试 python 脚本。给我一个简单的例子

c++ - lambda 始终返回 '1'

linux - 使用 g++ 链接静态库而不是共享