Sysprogs forums › Forums › VisualGDB › GDB debug session fails
- This topic has 9 replies, 2 voices, and was last updated 4 years, 7 months ago by support.
-
AuthorPosts
-
April 7, 2020 at 19:00 #27843dgoetzParticipant
I’ve started using VisualGDB to build and debug applications on a Xilinx Zynq-7000 device and seems to have some issue debugging. I’ve build the linux kernel for the device with gdb/etc to build directly on the device (SLOW!!) since I cannot seem to get VisualGDB using cross-compile on an interm machine to build (missing headers and various issues) and deploy and debug (gdbserver is there though). I imagine there is any number of things I may be missing there, so just to start out I was trying the build/debug on the device.
Everything seems correct until debugging:(gdb begin) --- GDB Session --- VisualGDB is licensed to Dwight Goetz at Troll Systems Corporation =thread-group-added,id="i1" ~"GNU gdb (GDB) 8.2\n" ~"Copyright (C) 2018 Free Software Foundation, Inc.\n" ~"License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\nThis is free software: you are free to change and redistribute it.\nThere is NO WARRANTY, to the extent permitted by law." 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 by law. ~"\nType \"show copying\" and \"show warranty\" for details.\n" ~"This GDB was configured as \"arm-xilinx-linux-gnueabi\".\n" ~"Type \"show configuration\" for configuration details.\n" ~"For bug reporting instructions, please see:\n" ~"<http://www.gnu.org/software/gdb/bugs/>.\n" ~"Find the GDB manual and other documentation resources online at:\n <http://www.gnu.org/software/gdb/documentation/>." Find the GDB manual and other documentation resources online at: <http://www.gnu.org/software/gdb/documentation/>. ~"\n\n" ~"For help, type \"help\".\n" ~"Type \"apropos word\" to search for commands related to \"word\"...\n" ~"Reading symbols from /mnt/TrollSystems/_Applications/ConTroll21_S6K2/ConTroll21_S6K2_Lin.exe..." ~"done.\n" ~"GNU gdb (GDB) 8.2\n" ~"Copyright (C) 2018 Free Software Foundation, Inc.\n" ~"License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\nThis is free software: you are free to change and redistribute it.\nThere is NO WARRANTY, to the extent permitted by law." 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 by law. ~"\nType \"show copying\" and \"show warranty\" for details.\n" ~"This GDB was configured as \"arm-xilinx-linux-gnueabi\".\n" ~"Type \"show configuration\" for configuration details.\n" ~"For bug reporting instructions, please see:\n" ~"<http://www.gnu.org/software/gdb/bugs/>.\n" ~"Find the GDB manual and other documentation resources online at:\n <http://www.gnu.org/software/gdb/documentation/>." Find the GDB manual and other documentation resources online at: <http://www.gnu.org/software/gdb/documentation/>. ~"\n\n" ~"For help, type \"help\".\n" ~"Type \"apropos word\" to search for commands related to \"word\".\n" ^done -list-features ^done,features=["frozen-varobjs","pending-breakpoints","thread-info","data-read-memory-bytes","breakpoint-notifications","ada-task-info","language-option","info-gdb-mi-command","undefined-command-error-code","exec-run-start-option","python"] -gdb-set disassembly-flavor intel ^error,msg="No symbol \"disassembly\" in current context." -gdb-set print demangle off ^done -break-insert -f main ^done,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0x0001241c",func="main(int, char**)",file="../ConTrollGUI/ConTrollApp.cpp",fullname="/var/volatile/tmp/VisualGDB/c/TrollSource/DEV3/#SRC/ConTrollDEV/ConTrollGUI/ConTrollApp.cpp",line="150",thread-groups=["i1"],times="0",original-location="main"} -inferior-tty-set sh: xauth: command not found ^done info target &"info target\n" ~"Symbols from \"/mnt/TrollSystems/_Applications/ConTroll21_S6K2/ConTroll21_S6K2_Lin.exe\".\n" ~"Local exec file:\n" ~"\t /mnt/TrollSystems/_Applications/ConTroll21_S6K2/ConTroll21_S6K2_Lin.exe', file type elf32-littlearm.\n" ~"\tEntry point: 0x122f0\n" ~"\t0x00000154 - 0x0000016d is .interp\n" ~"\t0x00000170 - 0x00000190 is .note.ABI-tag\n" ~"\t0x00000190 - 0x000001b4 is .note.gnu.build-id\n" ~"\t0x000001b4 - 0x000001cc is .gnu.hash\n" ~"\t0x000001cc - 0x000008ec is .dynsym\n" ~"\t0x000008ec - 0x00000eb0 is .dynstr\n" ~"\t0x00000eb0 - 0x00000f94 is .gnu.version\n" ~"\t0x00000f94 - 0x000010a4 is .gnu.version_r\n" ~"\t0x000010a4 - 0x00011a6c is .rel.dyn\n" ~"\t0x00011a6c - 0x00011dc4 is .rel.plt\n" ~"\t0x00011dc4 - 0x00011dd0 is .init\n" ~"\t0x00011dd0 - 0x000122ec is .plt\n" ~"\t0x000122f0 - 0x000489d8 is .text\n" ~"\t0x000489d8 - 0x000489e0 is .fini\n" ~"\t0x000489e0 - 0x00073b49 is .rodata\n" ~"\t0x00073b4c - 0x00073d60 is .ARM.extab\n" ~"\t0x00073d60 - 0x00073f10 is .ARM.exidx\n" ~"\t0x00073f10 - 0x00073f14 is .eh_frame\n" ~"\t0x00084210 - 0x00084214 is .init_array\n" ~"\t0x00084214 - 0x00084218 is .fini_array\n" ~"\t0x00084218 - 0x00096ee0 is .data.rel.ro\n" ~"\t0x00096ee0 - 0x00097000 is .dynamic\n" ~"\t0x00097000 - 0x00097228 is .got\n" ~"\t0x00097228 - 0x00097b94 is .data\n" ~"\t0x00097b98 - 0x005ecc10 is .bss\n" ^done -exec-run &"sh:: No such file or directory.\n" =thread-group-started,id="i1",pid="12419" =thread-created,id="1",group-id="i1" =thread-exited,id="1",group-id="i1" =thread-group-exited,id="i1" ^error,msg="During startup program exited with code 1." --- Extra Output --- /dev/pts/2
I can run gdb on the device and it does work, also can run the app itself standalone and attach to the running app. I’m guessing the “No such file or directory” is a clue but to what it refers is unclear.
I might not care about this if I could get the machine in the middle mode to work, but for rapid start this would be nice to get working.
April 7, 2020 at 20:14 #27847dgoetzParticipantI forgot to mention I also started a new “hello world” project from scratch following the tutorial and it still failed to debug, though the app would run as expected on the device. I assume this rules out issues in regards to our code/lib/specific project.
April 7, 2020 at 21:42 #27848supportKeymasterHi,
Strange. Just to double-check, are you able to run the program under gdb manually? I.e.:
gdb /mnt/TrollSystems/_Applications/ConTroll21_S6K2/ConTroll21_S6K2_Lin.exe b main run
If yes, does it change if you run it as “gdb –interpreter mi <path”> instead of just “gdb <path”> and use the “-exec-run” command instead of “run”?
April 7, 2020 at 22:03 #27849dgoetzParticipantYes, runs (I need the –args to pass some config to the app)
'root@pz7030-fmc2-2019-1:/# gdb --args /mnt/TrollSystems/_Applications/ConTroll21_S6K2/ConTroll21_S6K2_Lin.exe /A /D /C /M="TEST.S6K_ConTroll-01"
GNU gdb (GDB) 8.2
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 by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "arm-xilinx-linux-gnueabi".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /mnt/TrollSystems/_Applications/ConTroll21_S6K2/ConTroll21_S6K2_Lin.exe...done.
(gdb) b main
Breakpoint 1 at 0x1bed4: file ../ConTrollGUI/ConTrollApp.cpp, line 150.
(gdb) run
Starting program: /mnt/TrollSystems/_Applications/ConTroll21_S6K2/ConTroll21_S6K2_Lin.exe /A /D /C /M=TEST.S6K_ConTroll-01
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/libthread_db.so.1".</span></div>
Breakpoint 1, main (argc=5, argv=0xbed8ecf4) at ../ConTrollGUI/ConTrollApp.cpp:150
150 int iRet = 0;
(gdb)'
Then using the other command:
'root@pz7030-fmc2-2019-1:/# gdb -interpreter mi /mnt/TrollSystems/_Applications/ConTroll21_S6K2/ConTroll21_S6K2_Lin.exe
=thread-group-added,id="i1"
~"GNU gdb (GDB) 8.2\n"
~"Copyright (C) 2018 Free Software Foundation, Inc.\n"
~"License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\nThis is free software: you are free to change and redistribute it.\nThere is NO WARRANTY, to the extent permitted by law."
~"\nType \"show copying\" and \"show warranty\" for details.\n"
~"This GDB was configured as \"arm-xilinx-linux-gnueabi\".\n"
~"Type \"show configuration\" for configuration details.\n"
~"For bug reporting instructions, please see:\n"
~"<http://www.gnu.org/software/gdb/bugs/>.\n"
~"Find the GDB manual and other documentation resources online at:\n <http://www.gnu.org/software/gdb/documentation/>."
~"\n\n"
~"For help, type \"help\".\n"
~"Type \"apropos word\" to search for commands related to \"word\"...\n"
~"Reading symbols from /mnt/TrollSystems/_Applications/ConTroll21_S6K2/ConTroll21_S6K2_Lin.exe..."
~"done.\n"
(gdb)
-exec-run
=thread-group-started,id="i1",pid="29165"
=thread-created,id="1",group-id="i1"
=library-loaded,id="/lib/ld-linux-armhf.so.3",target-name="/lib/ld-linux-armhf.so.3",host-name="/lib/ld-linux-armhf.so.3",symbols-loaded="0",thread-group="i1",ranges=[{from="0xb6f90a40",to="0xb6fa3b00"}]
^running
*running,thread-id="all"
(gdb)
=library-loaded,id="/lib/librt.so.1",target-name="/lib/librt.so.1",host-name="/lib/librt.so.1",symbols-loaded="0",thread-group="i1",ranges=[{from="0xb6f7b7b0",to="0xb6f7db00"}]
=library-loaded,id="/lib/libpthread.so.0",target-name="/lib/libpthread.so.0",host-name="/lib/libpthread.so.0",symbols-loaded="0",thread-group="i1",ranges=[{from="0xb6f59770",to="0xb6f64244"}]
=library-loaded,id="/lib/libudev.so.1",target-name="/lib/libudev.so.1",host-name="/lib/libudev.so.1",symbols-loaded="0",thread-group="i1",ranges=[{from="0xb6f31640",to="0xb6f40a54"}]
=library-loaded,id="/lib/libusb-1.0.so.0",target-name="/lib/libusb-1.0.so.0",host-name="/lib/libusb-1.0.so.0",symbols-loaded="0",thread-group="i1",ranges=[{from="0xb6f0fa50",to="0xb6f18f3c"}]
=library-loaded,id="/usr/lib/libstdc++.so.6",target-name="/usr/lib/libstdc++.so.6",host-name="/usr/lib/libstdc++.so.6",symbols-loaded="0",thread-group="i1",ranges=[{from="0xb6e71688",to="0xb6ee2bb8"}]
=library-loaded,id="/lib/libm.so.6",target-name="/lib/libm.so.6",host-name="/lib/libm.so.6",symbols-loaded="0",thread-group="i1",ranges=[{from="0xb6d91210",to="0xb6dbcba0"}]
=library-loaded,id="/lib/libgcc_s.so.1",target-name="/lib/libgcc_s.so.1",host-name="/lib/libgcc_s.so.1",symbols-loaded="0",thread-group="i1",ranges=[{from="0xb6d6e140",to="0xb6d789c0"}]
=library-loaded,id="/lib/libc.so.6",target-name="/lib/libc.so.6",host-name="/lib/libc.so.6",symbols-loaded="0",thread-group="i1",ranges=[{from="0xb6c85040",to="0xb6d2cbf8"}]
~"[Thread debugging using libthread_db enabled]\n"
~"Using host libthread_db library \"/lib/libthread_db.so.1\".\n"
/mnt/TrollSystems/_Applications/ConTroll21_S6K2/ConTroll21_S6K2_Lin.exe
&"[Detaching after fork from child process 29168]\n"
=thread-created,id="2",group-id="i1"
~"[New Thread 0xb6c6d420 (LWP 29169)]\n"
*running,thread-id="2"
g_szWorkingFolderW == /mnt/TrollSystems/TEST/S6K_ConTroll-01/ConTroll21_S6K2
0000 INFO > Launch Params: '/mnt/TrollSystems/_Applications/ConTroll21_S6K2/ConTroll21_S6K2_Lin.exe'.
0001 INFO > Root (/mnt/TrollSystems)
0002 INFO > Customer (TEST)
0003 INFO > Device (S6K_ConTroll-01)
0004 INFO > Application: "ConTroll21_S6K2" (1)
=thread-created,id="3",group-id="i1"
~"[New Thread 0xb02fe420 (LWP 29170)]\n"
*running,thread-id="3"
0005 INFO > Main Thread: 0x00000000000071ED
0006 INFO > Main Process: 0x00000000000071ED
0007 INFO > Host Thread: 0x0000000000000000
0008 INFO > -- System Procs ------------------------
0009 INFO > -- User Procs --------------------------
0010 INFO > -- Validation --------------------------
0011 INFO > SVAR File - Passed Runlength Check! (#TEST_S6K_ConTroll-01.sv) 959 bytes (30ms)
0012 INFO > Ref File 'ConTroll.genmap', Has been Deleted.
0013 INFO > A Referenced File has changed, Invalidating NVRAM
0014 INFO > -- INIT_MEM ----------------------------
0015 INFO > ROM Force required - ROM Procs
0016 INFO > -- INIT_CFG ----------------------------
0017 INFO > -- CFG_LICENSE -------------------------
0018 INFO > Script '!TEST_S6K_ConTroll-01.Cfg' (CFG_LICENSE) processed (0 Errors)
0019 TEMP > #undefine CFG_LICENSE
0020 INFO > -- CFG_DEFINES -------------------------
0021 INFO > Script '!TEST_S6K_ConTroll-01.Cfg' (CFG_DEFINES) processed (0 Errors)
0022 TEMP > #undefine CFG_DEFINES
0023 INFO > -- CFG_PRE_PUBLISH ---------------------
0024 INFO > Script '!TEST_S6K_ConTroll-01.Cfg' (CFG_PRE_PUBLISH) processed (0 Errors)
0025 TEMP > #undefine CFG_PRE_PUBLISH
0026 INFO > -- INIT_POST_CFG -----------------------
0027 INFO > -- INIT_PUBLISH ------------------------
0028 TEMP SYS> SER COM2 INIT - Mapped from /dev/ttyUSB0
0029 TEMP SYS> SER COM3 INIT - Mapped from /dev/ttyUSB1
0030 TEMP SYS> SER COM4 INIT - Mapped from /dev/ttyUSB2
0031 TEMP SYS> SER COM5 INIT - Mapped from /dev/ttyUSB3
0032 TEMP SYS> SER COM6 INIT - Mapped from /dev/ttyACM0
0033 TEMP SYS> SER COM7 INIT - Mapped from /dev/ttyUSB4
0034 INFO > -- CFG_POST_PUBLISH --------------------
0035 INFO > Script '!TEST_S6K_ConTroll-01.Cfg' (CFG_POST_PUBLISH) processed (0 Errors)
0036 INFO > SVAR File - Fully Loaded! (#TEST_S6K_ConTroll-01.sv) 959 bytes (1ms)
0037 TEMP > #undefine CFG_POST_PUBLISH
0038 INFO > Scripts Complete, No Errors
0039 INFO > -- INIT_PROC ---------------------------
0040 INFO MSG> -- SOK ---------------------------------
0041 INFO > Network Up (192.168.1.238)
0042 INFO MSG> Adaptor : 'eth0'
0043 INFO MSG> MAC Address : 00-0A-35-00-1E-53
0044 INFO MSG> Local Host : 192.168.1.238
0045 INFO MSG> Local Mask : 255.255.255.0
0046 INFO MSG> Local Gate : 192.168.1.254
0047 INFO MSG> Machine : pz7030-fmc2-2019-1
0048 INFO > SOK[2]:setsockopt(UDP:IP_ADD_MEMBERSHIP) == OK
0049 INFO MSG> --/SOK ---------------------------------
0050 TEMP MSG> Run
0051 TEMP CMD> COM200 - Port initialized
=thread-created,id="4",group-id="i1"
~"[New Thread 0xafafd420 (LWP 29171)]\n"
*running,thread-id="4"
0052 TEMP CMD> Run
0053 TEMP SLV> Run
0054 TEMP CFG> Run
0055 TEMP CRY> Run
*** FindMyResourceW - Failed to Find 'Missions.Cfg'
0056 TEMP SYS> Run
0057 INFO > -- INIT_RUN ----------------------------
0058 INFO > -- Init Complete -----------------------
=thread-created,id="5",group-id="i1"
~"[New Thread 0xaeeff420 (LWP 29172)]\n"
*running,thread-id="5"
0059 INFO > /mnt/Data/TrollSystems/TEST/S6K_ConTroll-01/ConTroll21_S6K2/000000_000000_1E53.cry Written, 720 bytes (12ms)
=thread-created,id="6",group-id="i1"
~"[New Thread 0xae6fe420 (LWP 29173)]\n"
*running,thread-id="6"
=thread-created,id="7",group-id="i1"
~"[New Thread 0xadefd420 (LWP 29174)]\n"
*running,thread-id="7"
=thread-created,id="8",group-id="i1"
~"[New Thread 0xad6fc420 (LWP 29175)]\n"
*running,thread-id="8"
&"[Detaching after fork from child process 29176]\n"
0060 INFO > Troll Heap Size: 0x06000000 (96.00M)
0061 INFO > Troll Heap Used: 0x02DD24F4 (45.82M) (.7 percent used)
0062 INFO > Troll Heap Remaining: 0x0322DB0C (50.17M)
0063 INFO > MyMalloc Used: 0x00129940 (1.16M)
0064 INFO > Physical Memory: 0x3EE38000 (.98G)
0065 INFO > Free Physical Memory: 0x1B6FB000 (438.98M)
0066 INFO > Total Virtual Memory: 0x10000000 (256.00M)
0067 INFO > Avail Virtual Memory: 0x0007A000 (488.00K)
0068 INFO > Used Virtual Memory: 0x0FF86000 (255.52M) (99.8 percent used)'
April 7, 2020 at 22:12 #27852supportKeymasterThanks for checking this. Most likely, the problem happens because VisualGDB fails to create a temporary terminal (pseudo-tty) to avoid mixing the output from the program with the output from gdb.
The easiest way to work around it would be to use gdbserver on the target (you can configure it by selecting the “gdb stub” mode in the VisualGDB Project Properties -> Debug Settings). This will eliminate the need to create a virtual terminal and should work around the problem.
April 7, 2020 at 23:12 #27853dgoetzParticipantOk, so application running and in debug on the target, figuring out the arguments took a minute.
But follow on question would be why it insists on downloading the source files from the device when they are local on the windows machine? When I insert a breakpoint it jumps to autoloadedsources path files.
April 8, 2020 at 04:30 #27854supportKeymasterGood to know it works. Most likely, the files are downloaded because the paths reported by gdb don’t match the paths expected by VisualGDB. This would happen if the target had symbolic links in some directories.
You can troubleshoot it by checking the GDB Session window for the path reported by GDB and then setting a mapping via VisualGDB Project Properties -> Path Mapping.
April 8, 2020 at 16:59 #27857dgoetzParticipantDo I have to set paths for each file (we have many) or is there a way to enter a generic substitution? I think here because /tmp -> /var/volatile/tmp is as you explained is the issue.
Given file=”../ConTrollGUI/ConTrollApp.cpp”,fullname=”/var/volatile/tmp/VisualGDB/c/TrollSource/DEV3/#SRC/ConTrollDEV/ConTrollGUI/ConTrollApp.cpp”
For this file if I add a specific mapping:
“/var/volatile/tmp/VisualGDB/c/TrollSource/DEV3/#SRC/ConTrollDEV/ConTrollGUI/ConTrollApp.cpp -> c:\TrollSource\DEV3\#SRC\ConTrollGUI\ConTrollApp.cpp” in Path Mappings it works as expected, adding that for each file would be cumbersome and error prone. Is there a way to map “/var/volatile/tmp/VisualGDB/c/TrollSource/DEV3/#SRC/ConTrollDEV/* -> c:\TrollSource\DEV3\#SRC\*” ?
I suppose I could also change the download location on the device?
Thanks
April 8, 2020 at 17:58 #27858dgoetzParticipantSolved – Turns out changing the remote folder from ‘/tmp’ to ‘/var/volatile/tmp’ makes everyone happy
April 9, 2020 at 02:39 #27859supportKeymasterGood to know it works. BTW, you can set mappings for arbitrary path prefixes, e.g. the following mapping should cover all the necessary files:
/var/volatile/tmp/VisualGDB/c/TrollSource => c:\TrollSource
-
AuthorPosts
- You must be logged in to reply to this topic.