Eclipse (CDT) not sending commands to GDB when debugging C++ static libraries

831 Views Asked by At

We are trying to debug a C++ application for a remote linux box which contains a main C++ application and some statically linked library projects.

Our problem is the breakpoints which are placed inside the static library are not hit and we are unable to debug directly into the static library. But the breakpoints which are placed inside main application are hit normally. But we can step into the static library code starting from main application breakpoints. So it may not be a problem regarding static libraries not generating debug information.

When we investigate the problem we identified that the breakpoints which are set on the eclipse IDE (double clicking, or using right click menu -> toggle breakpoint) are not generating a log in GDB console. And this is only when we set a breakpoint on a static library code, for the main application it nicely made the log in GDB console. So we went ahead and set a breakpoint in using GDB command line (Using break : ), and the breakpoint set in that way worked perfectly for static libraries. But still the eclipse IDE did not showed a blue circle indicating a breakpoint. So we feel that the breakpoints inside a static library which are set using eclipse IDE are not generating relevant GDB commands. What should we do to get it working.

We are using Eclipse C/C++ Development Tools Version: 8.1.2.201302132326 and Eclipse Platform Version: 3.8.

Initial GDB Log which is generated during start debugging is shown here...

.gdbinit: No such file or directory.
Reading symbols from e:\projects\smcservercode\smc-server\smcserver\debug\SMCServer.elf...done.
917-gdb-set confirm off
917^done
(gdb) 
918-gdb-set width 0
918^done
(gdb) 
919-gdb-set height 0
919^done
(gdb) 
920-interpreter-exec console echo
920^done
(gdb) 
921-gdb-show prompt
921^done,value="(gdb) "
(gdb) 
922-gdb-set target-async 0
922^done
(gdb) 
923-gdb-set auto-solib-add on
923^done
(gdb) 
924-gdb-set stop-on-solib-events 0
924^done
(gdb) 
925-gdb-set stop-on-solib-events 1
925^done
(gdb) 
926-target-select remote 172.28.47.165:1234
=thread-group-started,id="i1",pid="1104"
=thread-created,id="1",group-id="i1"
&"warning: Unable to find dynamic linker breakpoint function.\nGDB will be unable to debug shared library initializers\nand track explicitly loaded dynamic code."
&"\n"
warning: Unable to find dynamic linker breakpoint function.
GDB will be unable to debug shared library initializers
and track explicitly loaded dynamic code.
*stopped,frame={addr="0xb6eeed60",func="??",args=[]},thread-id="1",stopped-threads="all",core="0"
926^connected
(gdb) 
927 info proc
&"info proc\n"
~"process 1104\n"
&"warning: target file /proc/1104/cmdline contained unexpected null characters\n"
~"cmdline = '/mnt/SMC/SMCServer.elf'\n"
&"warning: unable to read link '/proc/1104/cwd'\n"
&"warning: unable to read link '/proc/1104/exe'\n"
927^done
(gdb) 
928-file-symbol-file E:\\Projects\\SMCServerCode\\SMC-Server\\SMCServer\\Debug\\SMCServer.elf
&"Cannot access memory at address 0x0\n"
Cannot access memory at address 0x0
928^done
(gdb) 
929 info threads
&"info threads\n"
&"Cannot access memory at address 0x0\n"
~"  Id   Target Id         Frame \n"
~"* 1    Thread 1104       0xb6eeed60 in ?? ()\n"
929^done
(gdb) 
930-environment-directory
930^done,source-path="$cdir;$cwd"
(gdb) 
931-stack-info-depth
931^done,depth="2"
(gdb) 
932-data-list-register-names
932^done,register-names=["r0","r1","r2","r3","r4","r5","r6","r7","r8","r9","r10","r11","r12","sp","lr","pc","","","","","","","","","","cpsr","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","d10","d11","d12","d13","d14","d15","d16","d17","d18","d19","d20","d21","d22","d23","d24","d25","d26","d27","d28","d29","d30","d31","fpscr","s0","s1","s2","s3","s4","s5","s6","s7","s8","s9","s10","s11","s12","s13","s14","s15","s16","s17","s18","s19","s20","s21","s22","s23","s24","s25","s26","s27","s28","s29","s30","s31","q0","q1","q2","q3","q4","q5","q6","q7","q8","q9","q10","q11","q12","q13","q14","q15"]
(gdb) 
933-stack-list-frames 0 2
933^done,stack=[frame={level="0",addr="0xb6eeed60",func="??"},frame={level="1",addr="0x00000000",func="??"}]
(gdb) 
934-break-insert linuxUserApp.cpp:143
934^done,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0x00042980",func="executeJobThread()",file="../src/linuxUserApp.cpp",fullname="e:\\projects\\smcservercode\\smc-server\\smcserver\\src\\linuxUserApp.cpp",line="143",times="0",original-location="linuxUserApp.cpp:143"}
(gdb) 
935-stack-list-frames 0 2
935^done,stack=[frame={level="0",addr="0xb6eeed60",func="??"},frame={level="1",addr="0x00000000",func="??"}]
(gdb) 
936-data-list-changed-registers
936^done,changed-registers=["0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","25","58","59","60","61","62","63","64","65","66","67","68","69","70","71","72","73","74","75","76","77","78","79","80","81","82","83","84","85","86","87","88","89","90","91","92","93","94","95","96","97","98","99","100","101","102","103","104","105","106","107","108","109","110","111","112","113","114","115","116","117","118","119","120","121","122","123","124","125","126","127","128","129","130","131","132","133","134","135","136","137","138"]
(gdb) 
937-break-insert linuxUserApp.cpp:143
937^done,bkpt={number="2",type="breakpoint",disp="keep",enabled="y",addr="0x00042980",func="executeJobThread()",file="../src/linuxUserApp.cpp",fullname="e:\\projects\\smcservercode\\smc-server\\smcserver\\src\\linuxUserApp.cpp",line="143",times="0",original-location="linuxUserApp.cpp:143"}
(gdb) 
938 info sharedlibrary
&"info sharedlibrary\n"
~"No shared libraries loaded at this time.\n"
938^done
(gdb) 
939-break-insert -t exit
939^done,bkpt={number="3",type="breakpoint",disp="del",enabled="y",addr="0x0000e468",times="0",original-location="exit"}
(gdb) 
940-break-insert linuxUserApp.cpp:143
940^done,bkpt={number="4",type="breakpoint",disp="keep",enabled="y",addr="0x00042980",func="executeJobThread()",file="../src/linuxUserApp.cpp",fullname="e:\\projects\\smcservercode\\smc-server\\smcserver\\src\\linuxUserApp.cpp",line="143",times="0",original-location="linuxUserApp.cpp:143"}
(gdb) 
941-break-insert -t exit
941^done,bkpt={number="5",type="breakpoint",disp="del",enabled="y",addr="0x0000e468",times="0",original-location="exit"}
(gdb) 
942-break-insert linuxUserApp.cpp:143
942^done,bkpt={number="6",type="breakpoint",disp="keep",enabled="y",addr="0x00042980",func="executeJobThread()",file="../src/linuxUserApp.cpp",fullname="e:\\projects\\smcservercode\\smc-server\\smcserver\\src\\linuxUserApp.cpp",line="143",times="0",original-location="linuxUserApp.cpp:143"}
(gdb) 
943-break-insert linuxUserApp.cpp:148
943^done,bkpt={number="7",type="breakpoint",disp="keep",enabled="y",addr="0x000429bc",func="executeJobThread()",file="../src/linuxUserApp.cpp",fullname="e:\\projects\\smcservercode\\smc-server\\smcserver\\src\\linuxUserApp.cpp",line="148",times="0",original-location="linuxUserApp.cpp:148"}
(gdb) 
944-break-insert linuxUserApp.cpp:148
944^done,bkpt={number="8",type="breakpoint",disp="keep",enabled="y",addr="0x000429bc",func="executeJobThread()",file="../src/linuxUserApp.cpp",fullname="e:\\projects\\smcservercode\\smc-server\\smcserver\\src\\linuxUserApp.cpp",line="148",times="0",original-location="linuxUserApp.cpp:148"}
(gdb) 
945-break-insert -t exit
945^done,bkpt={number="9",type="breakpoint",disp="del",enabled="y",addr="0x0000e468",times="0",original-location="exit"}
(gdb) 
946-break-insert -t main
946^done,bkpt={number="10",type="breakpoint",disp="del",enabled="y",addr="0x00010e88",func="main(int, char**)",file="f:\\xilinx\\14.6\\ise_ds\\edk\\gnu\\arm\\nt\\bin\\../lib/gcc/arm-xilinx-linux-gnueabi/4.7.2/../../../../arm-xilinx-linux-gnueabi/include/c++/4.7.2/bits/basic_string.h",fullname="f:\\xilinx\\14.6\\ise_ds\\edk\\gnu\\arm\\nt\\arm-xilinx-linux-gnueabi\\include\\c++\\4.7.2\\bits\\basic_string.h",line="272",times="0",original-location="main"}
(gdb) 
947-exec-continue
947^running
*running,thread-id="all"
(gdb) 
=library-loaded,id="/lib/libpthread.so.0",target-name="/lib/libpthread.so.0",host-name="/lib/libpthread.so.0",low-address="0x0",high-address="0x0",symbols-loaded="0",thread-group="i1"
=library-loaded,id="/lib/librt.so.1",target-name="/lib/librt.so.1",host-name="/lib/librt.so.1",low-address="0x0",high-address="0x0",symbols-loaded="0",thread-group="i1"
=library-loaded,id="/usr/lib/libstdc++.so.6",target-name="/usr/lib/libstdc++.so.6",host-name="/usr/lib/libstdc++.so.6",low-address="0x0",high-address="0x0",symbols-loaded="0",thread-group="i1"
=library-loaded,id="/lib/libm.so.6",target-name="/lib/libm.so.6",host-name="/lib/libm.so.6",low-address="0x0",high-address="0x0",symbols-loaded="0",thread-group="i1"
=library-loaded,id="/lib/libgcc_s.so.1",target-name="/lib/libgcc_s.so.1",host-name="/lib/libgcc_s.so.1",low-address="0x0",high-address="0x0",symbols-loaded="0",thread-group="i1"
=library-loaded,id="/lib/libc.so.6",target-name="/lib/libc.so.6",host-name="/lib/libc.so.6",low-address="0x0",high-address="0x0",symbols-loaded="0",thread-group="i1"
=library-loaded,id="/lib/ld-linux.so.3",target-name="/lib/ld-linux.so.3",host-name="/lib/ld-linux.so.3",low-address="0x0",high-address="0x0",symbols-loaded="0",thread-group="i1"
&"warning: Could not load shared library symbols for 7 libraries, e.g. /lib/libpthread.so.0.\nUse the \"info sharedlibrary\" command to see the complete listing.\nDo you need \"set solib-search-path\" or \"set sysroot\"?"
warning: Could not load shared library symbols for 7 libraries, e.g. /lib/libpthread.so.0.
Use the "info sharedlibrary" command to see the complete listing.
Do you need "set solib-search-path" or "set sysroot"?&"\n"

*stopped,reason="solib-event",added=[library="/lib/libpthread.so.0",library="/lib/librt.so.1",library="/usr/lib/libstdc++.so.6",library="/lib/libm.so.6",library="/lib/libgcc_s.so.1",library="/lib/libc.so.6",library="/lib/ld-linux.so.3"],thread-id="1",stopped-threads="all",core="0"
(gdb) 
948 info sharedlibrary
&"info sharedlibrary\n"
~"From        To          Syms Read   Shared Object Library\n"
~"                        No          /lib/libpthread.so.0\n"
~"                        No          /lib/librt.so.1\n"
~"                        No          /usr/lib/libstdc++.so.6\n"
~"                        No          /lib/libm.so.6\n"
~"                        No          /lib/libgcc_s.so.1\n"
~"                        No          /lib/libc.so.6\n"
~"                        No          /lib/ld-linux.so.3\n"
948^done
(gdb) 
949-exec-continue
949^running
*running,thread-id="1"
(gdb) 
=breakpoint-modified,bkpt={number="10",type="breakpoint",disp="del",enabled="y",addr="0x00010e88",func="main(int, char**)",file="f:\\\\xilinx\\\\14.6\\\\ise_ds\\\\edk\\\\gnu\\\\arm\\\\nt\\\\bin\\\\../lib/gcc/arm-xilinx-linux-gnueabi/4.7.2/../../../../arm-xilinx-linux-gnueabi/include/c++/4.7.2/bits/basic_string.h",fullname="f:\\\\xilinx\\\\14.6\\\\ise_ds\\\\edk\\\\gnu\\\\arm\\\\nt\\\\arm-xilinx-linux-gnueabi\\\\include\\\\c++\\\\4.7.2\\\\bits\\\\basic_string.h",line="272",times="1",original-location="main"}
*stopped,reason="breakpoint-hit",disp="del",bkptno="10",frame={addr="0x00010e88",func="main",args=[{name="argc",value="2"},{name="argv",value="0xbef19de4"}],file="../src/linuxUserApp.cpp",fullname="e:\\projects\\smcservercode\\smc-server\\smcserver\\src\\linuxUserApp.cpp",line="455"},thread-id="1",stopped-threads="all",core="0"
=breakpoint-deleted,id="10"
(gdb) 
950 info threads
&"info threads\n"
~"  Id   Target Id         Frame \n"
~"* 1    Thread 1104       main (argc=2, argv=0xbef19de4) at ../src/linuxUserApp.cpp:455\n"
950^done
(gdb) 
951-stack-info-depth
951^done,depth="1"
(gdb) 
952-stack-list-frames 0 1
952^done,stack=[frame={level="0",addr="0x00010e88",func="main",file="../src/linuxUserApp.cpp",fullname="e:\\projects\\smcservercode\\smc-server\\smcserver\\src\\linuxUserApp.cpp",line="455"}]
(gdb) 
953-data-list-changed-registers
953^done,changed-registers=["0","1","2","4","6","8","10","12","13","14","15","25","58","59","60","61","62","63","64","65","74","75","91","92","93","94","95","96","97","98","99","100","101","102","103","104","105","106","123","124","125","126","131"]
(gdb) 
954 info sharedlibrary
&"info sharedlibrary\n"
~"From        To          Syms Read   Shared Object Library\n"
~"                        No          /lib/libpthread.so.0\n"
~"                        No          /lib/librt.so.1\n"
~"                        No          /usr/lib/libstdc++.so.6\n"
~"                        No          /lib/libm.so.6\n"
~"                        No          /lib/libgcc_s.so.1\n"
~"                        No          /lib/libc.so.6\n"
~"                        No          /lib/ld-linux.so.3\n"
954^done
(gdb) 
0

There are 0 best solutions below