0

I am hitting most of my breakpoints OK, but I can hit one which offers no debug context so I don't get the options to Step-in, Step-over, see Variables, etc. I only know I've hit it because the Resume button becomes available and the "Debugger Console" says it has hit the Breakpoint (and the gdb trace console). It appears like the communication between the gdb server on the remote target and Eclipse on the host has got out-of-sync, resulting in the loss of the PC Counter.

I have made a screen recording on youtube here https://youtu.be/EzadTQZeVAo

Here is the gdb trace -

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) 

If I compare the trace from a working breakpoint I notice these commands which are all absent from my "half-working" breakpoint (which has no mention of stack).

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

And if I type print $pc in the debugger console it knows where it is. The gdb trace then says,

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)

which seems strange. One minute it says, "PC register is not available", then when I prompt, it is happy to print the pc register.

shanz
  • 53
  • 1
  • 6

1 Answers1

0

I've worked out a workaround and I have a hypothesis as to why Eclipse (Momentics) is behaving as it is.

When the breakpoint is half hit as determined by the Debugger Console tab, I can explicitly type, "thread 25" to switch to the thread that Eclipse already has an asterisk (*) against. Then I can see the list of threads in the Debug View. I can select Thread 25 and then my debug context is restored. I can single step and continue as normal.

A potential explanation for this odd breakpoint behaviour is that my program kills a thread and Eclipse doesn't get time to switch threads properly before the thread is deleted. So my workaround is just ensuring that Eclipse finishes switching to the current thread properly. That make any sense? Is there a bug in gdb or Eclipse somewhere?

I've uploaded another screen recording to youtube showing my workaround actions here - https://youtu.be/d7_kPlRtB2M

If I type "thread 25" before refreshing my webpage to trigger the susceptible breakpoint, Eclipse works perfectly. But obviously I shouldn't need to preempt the breakpoint by manually telling gdb to switch to a particular thread.

shanz
  • 53
  • 1
  • 6