我的大部分断点都正常,但是我可以打一个不提供调试上下文的断点,所以我没有选择 Step-in、Step-over、查看变量等。我只知道我已经击中它是因为Resume 按钮变为可用,并且“调试器控制台”表示它已命中断点(和 gdb 跟踪控制台)。看起来远程目标上的 gdb 服务器和主机上的 Eclipse 之间的通信不同步,导致 PC 计数器丢失。
我在 youtube 上进行了屏幕录制https://youtu.be/EzadTQZeVAo
这是 gdb 跟踪 -
783,487 =thread-exited,id="101",group-id="i1"
783,488 =thread-created,id="102",group-id="i1"
783,488 ~"[New pid 13856779 tid 36]\n"
783,505 =***breakpoint-modified***,bkpt={number="5",type="breakpoint",disp="keep",enabled="y",addr="0x0000\
00000848597a",func="PageManager::displayEnumeration(IModuleFamilySpec*, unsigned short, IParamSpec*,\
short, VariantClass*, tAccessCode, bool, bool)",file="PageManager.cpp",fullname="C:\\momentics-work\
space\\Controller\\PageManager.cpp",line="2153",thread-groups=["i1"],times="1",original-location=\
"PageManager.cpp:2153"}
783,506 ~"[Switching to pid 13856779 tid 26 name \"webServr\"]\n"
783,538 ~"\n"
783,542 ~"Thread 26 hit Breakpoint 5, PageManager::displayEnumeration (this=0x8e66ce8, anIModuleFami\
lySpecPtr=0x8ad4598, aModuleNo=1, anIParamSpecPtr=0x8c528c8, aParamNumber=0, aValuePtr=0x8f81018, an\
AccessCode=MS_READ_ONLY, anInputBoxFlag=false, aCreateFlag=false) at PageManager.cpp:2153\n"
783,543 ~"2153\tTString PageManager::displayEnumeration(IModuleFamilySpec* anIModuleFamilySpecPtr, t\
ModuleNumber aModuleNo, IParamSpec* anIParamSpecPtr, tParameterArrayIndex aParamNumber, CVariant* aV\
aluePtr, tAccessCode anAccessCode, OMBoolean anInputBoxFlag, OMBoolean aCreateFlag) {\n"
783,544 *stopped,reason="***breakpoint-hit***",disp="keep",bkptno="5",frame={addr="0x000000000848597a",fun\
c="PageManager::displayEnumeration",args=[{name="this",value="0x8e66ce8"},{name="anIModuleFamilySpec\
Ptr",value="0x8ad4598"},{name="aModuleNo",value="1"},{name="anIParamSpecPtr",value="0x8c528c8"},{nam\
e="aParamNumber",value="0"},{name="aValuePtr",value="0x8f81018"},{name="anAccessCode",value="MS_READ\
_ONLY"},{name="anInputBoxFlag",value="false"},{name="aCreateFlag",value="false"}],file="PageManager.\
cpp",fullname="C:\\momentics-workspace\\Controller\\PageManager.cpp",line="2153"},thread-id="26",\
stopped-threads="all"
783,544 (gdb)
783,544 78-thread-info 26
783,558 79-list-thread-groups
783,560 78^done,threads=[{id="26",target-id="pid 13856779 tid 26 name \"webServr\"",details="STOPPED\
",frame={level="0",addr="0x000000000848597a",func="PageManager::displayEnumeration",args=[{name="thi\
s",value="0x8e66ce8"},{name="anIModuleFamilySpecPtr",value="0x8ad4598"},{name="aModuleNo",value="1"}\
,{name="anIParamSpecPtr",value="0x8c528c8"},{name="aParamNumber",value="0"},{name="aValuePtr",value=\
"0x8f81018"},{name="anAccessCode",value="MS_READ_ONLY"},{name="anInputBoxFlag",value="false"},{name=\
"aCreateFlag",value="false"}],file="PageManager.cpp",fullname="C:\\momentics-workspace\\Controlle\
r\\PageManager.cpp",line="2153"},state="stopped"}]
783,560 (gdb)
783,561 79^done,groups=[{id="i1",type="process",pid="13856779",executable="C:\\momentics-workspace\\\
Controller\\QNX"}]
783,561 (gdb)
783,562 80-list-thread-groups i1
783,671 80^error,msg="PC register is not available"
783,671 (gdb)
如果我比较来自工作断点的跟踪,我会注意到这些命令在我的“半工作”断点(没有提到堆栈)中都不存在。
44-stack-list-frames --thread 23
44^done,stack=[frame={level="0",addr="0x000000010004cf57",func="SyncSemWait",from="C:\\Users\
46-stack-info-depth --thread 24 11
47-stack-select-frame --thread 24 0
如果我在调试器控制台中键入print $pc,它就会知道它在哪里。然后 gdb 跟踪说,
389,020 (gdb)
389,132 131^error,msg="PC register is not available"
389,132 (gdb)
427,860 132-interpreter-exec console "print $pc"
427,863 ~"$4 = (void (*)(void)) 0x8485aae <PageManager::displayEnumeration(IModuleFamilySpec*, unsig\
ned short, IParamSpec*, short, VariantClass*, tAccessCode, bool, bool)+396>"
427,863 ~"\n"
427,863 132^done
427,863 (gdb)
这似乎很奇怪。一分钟它说,“PC 寄存器不可用”,然后当我提示时,很高兴打印 pc 寄存器。