我用brew安装了gdb 8.1.
我有codeign gdb和.gdbinit如下:
set startup-with-shell off.
我已禁用SIP功能:
$ csrutil status
System Integrity Protection status: disabled.
Run Code Online (Sandbox Code Playgroud)
但是gdb仍然不起作用:
#include <iostream>
using namespace std;
int main() {
cout << "hello world!" << endl;
return 0;
}
Run Code Online (Sandbox Code Playgroud)
编译命令:
g++ -g test.cpp
Run Code Online (Sandbox Code Playgroud)
gdb输出:
GNU gdb (GDB) 8.1
Copyright (C) 2018 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 …Run Code Online (Sandbox Code Playgroud) 我正在为STM32嵌入式系统调试这个软件.在其中一个函数中,我的程序一直在遇到某种断点:
SIGTRAP,跟踪/断点陷阱
但是,在GDB中,当info breakpoints我得到时No breakpoints or watchpoints.断点实际上对应于我在很久以前设置的断点,在另一个版本的可执行文件中.当我设置断点时,GDB告诉我automatically using a hardware breakpoint on read-only memory(或类似的消息).
我认为硬件断点仍然在我的芯片上,尽管已经加载了新版本的软件.如果确实存在虚假断点,我该如何找到并删除它?
我做了一个非常简单的程序,它为我自动化了一些东西.我用c ++编写它,它在Windows上运行.在Codeblocks IDE内部使用GDB进行调试时,我无处可获得许多断点.我不知道可能导致这个问题的原因.断点似乎与内存问题有关...因为当我修复了我检测到的内存泄漏时,断点数量明显减少了.
gdb告诉我的确切事情是:
Program received signal SIGTRAP, Trace/breakpoint trap.
In ntdll!TpWaitForAlpcCompletion () (C:\Windows\system32\ntdll.dll)
Run Code Online (Sandbox Code Playgroud)
我在程序中多次得到这个.我认为我可能会做一些非常错误的事情,即使程序看起来运行得很好并且它完成了我想要它做的事情.任何人都可以告诉我这是什么问题,因为我不知道在哪里看?如果它不是问题,那么有没有人知道如何禁用它,因为这阻止我进入我自己设置的断点?
提前致谢!
编辑:(添加GDB的输出where命令):我在哪里可以检查每个函数的作用,所以我可以看到我做错了什么?
#0 0x76fefadd in ntdll!TpWaitForAlpcCompletion () from C:\Windows\system32\ntdll.dll
#1 0x0028e894 in ?? ()
#2 0x76fb272c in ntdll!RtlCreateUserStack () from C:\Windows\system32\ntdll.dll
#3 0x00657fb8 in ?? ()
#4 0x00657fb8 in ?? ()
#5 0x76f4b76a in ntdll!RtlDowncaseUnicodeChar () from C:\Windows\system32\ntdll.dll
#6 0x02070005 in ?? ()
#7 0x00000b10 in ?? ()
#8 0x0028e8dc in ?? ()
#9 0x76ff0b37 in ntdll!TpQueryPoolStackInformation () from C:\Windows\system32\ntdll.dll
#10 0x038b0000 in ?? () …Run Code Online (Sandbox Code Playgroud)