Мы пытаемся отладить приложение C ++ для удаленного Linux-бокса, который содержит основное приложение C ++ и некоторые статически связанные библиотечные проекты.
Наша проблема в том, что точки останова, которые размещаются внутри статической библиотеки, не попадают, и мы не можем отладить напрямую в статическую библиотеку. Но точки останова, которые размещаются внутри основного приложения, попадают нормально. Но мы можем перейти к статическому библиотечному коду, начиная с основных точек останова приложения. Таким образом, это может не быть проблемой, если статические библиотеки не генерируют отладочную информацию.
Когда мы исследовали проблему, мы определили, что точки останова, которые установлены в IDE eclipse (двойной щелчок или использование меню правого клика -> переключить точку останова), не генерируют журнал в консоли GDB. И это только тогда, когда мы устанавливаем точку останова для статического библиотечного кода, для основного приложения он хорошо ведет журнал в консоли GDB. Поэтому мы пошли дальше и установили точку останова при использовании командной строки GDB (используя break:), и точка останова, установленная таким образом, отлично работала для статических библиотек. Но все же в IDE затмения не было синего круга, указывающего точку останова.
Таким образом, мы считаем, что точки останова внутри статической библиотеки, которые устанавливаются с помощью IDE eclipse, не генерируют соответствующие команды GDB. Что мы должны сделать, чтобы это заработало.
Мы используем Eclipse C / C ++ Development Tools Версия: 8.1.2.201302132326 и Eclipse Platform Версия: 3.8.
Начальный журнал GDB, который генерируется во время начальной отладки, показан здесь …
.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)
Задача ещё не решена.