GDB Exits before I can do any debugging

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

GDB Exits before I can do any debugging

1,092 Views
plee_witekio
Contributor I

I'm using MCUXpressos v11.4.0 on a board with an NXP RT1021 via a SEGGER JLink. Host OS is Ubuntu 20.04. Program uses Amazon FreeRTOS.

I've got a program but I'm unable to use the debugger from within the IDE as it never seems to hit the startup breakpoint, and on further investigation it looks as though GDB is being shutdown?

 

Why is this? On an identical setup elsewhere, this appears to work just fine. But for me it does not.

It appears as though I am able to debug OK when I start the JLink GDB server from a command prompt and then run a GDB session and connect to the server. So there is hope it should work!

I've investigated and it looks like the IDE talks to GDB via a PTS and it looks like the IDE tells GDB to shutdown. Why is it doing this? I haven't even started yet!

Here is the GDB traces window from the IDE:

255,908 2-list-thread-groups
255,908 2^done,groups=[{id="i1",type="process"}]
255,909 (gdb)
255,909 3-gdb-version
255,909 ~"GNU gdb (GNU Arm Embedded Toolchain 10-2020-q4-major) 10.1.90.20201028-git\n"
255,909 ~"Copyright (C) 2020 Free Software Foundation, Inc.\n"
255,909 ~"License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\nThis is fre\
e software: you are free to change and redistribute it.\nThere is NO WARRANTY, to the extent permitt\
ed by law."
255,909 ~"\nType \"show copying\" and \"show warranty\" for details.\n"
255,909 ~"This GDB was configured as \"--host=x86_64-linux-gnu --target=arm-none-eabi\".\n"
255,909 ~"Type \"show configuration\" for configuration details.\n"
255,909 ~"For bug reporting instructions, please see:\n"
255,909 ~"<https://www.gnu.org/software/gdb/bugs/>.\n"
255,909 ~"Find the GDB manual and other documentation resources online at:\n <http://www.gnu.org/\
software/gdb/documentation/>."
255,909 ~"\n\n"
255,909 ~"For help, type \"help\".\n"
255,909 ~"Type \"apropos word\" to search for commands related to \"word\".\n"
255,909 3^done
255,909 (gdb)
255,910 4-environment-cd /home/hoppy/projects/G1335/repos/mod485
255,910 4^done
255,910 (gdb)
255,910 5-gdb-set breakpoint pending on
255,910 5^done
255,910 (gdb)
255,911 6-enable-pretty-printing
255,911 6^done
255,911 (gdb)
255,911 7-gdb-set python print-stack none
255,911 7^done
255,911 (gdb)
255,914 8-gdb-set print object on
255,914 8^done
255,914 (gdb)
255,914 9-gdb-set print sevenbit-strings on
255,914 9^done
255,914 (gdb)
255,915 10-gdb-set charset ISO-8859-1
255,915 10^done
255,915 (gdb)
255,915 11-gdb-set dprintf-style gdb
255,916 11^done
255,916 (gdb)
255,916 12-gdb-set target-async on
255,917 12^done
255,917 (gdb)
255,917 13-gdb-set auto-solib-add on
255,918 13^done
255,918 (gdb)
255,919 14symbol-file /home/hoppy/projects/G1335/repos/mod485/Debug/mod485.axf

255,920 &"symbol-file /home/hoppy/projects/G1335/repos/mod485/Debug/mod485.axf\n"
255,921 ~"Reading symbols from /home/hoppy/projects/G1335/repos/mod485/Debug/mod485.axf...\n"
255,929 14^done
255,929 (gdb)
255,929 &"\n"
255,929 ^done
255,929 (gdb)
255,929 15-target-select remote localhost:2331

256,044 =thread-group-started,id="i1",pid="42000"
256,044 &"warning: No executable has been specified and target does not support\ndetermining executa\
ble automatically. Try using the \"file\" command."
256,044 &"\n"
256,044 =thread-created,id="1",group-id="i1"
256,046 16-list-thread-groups
256,057 ~"0x60415db4 in vListInsert (pxList=0x6043c8b0 <xDelayedTaskList1>, pxNewListItem=0x6042e47c\
<ucHeap+44184>) at ../amazon-freertos/freertos_kernel/list.c:158\n"
256,057 ~"158\t\tpxNewListItem->pxNext->pxPrevious = pxNewListItem;\n"
256,057 *stopped,frame={addr="0x60415db4",func="vListInsert",args=[{name="pxList",value="0x6043c8b0 \
<xDelayedTaskList1>"},{name="pxNewListItem",value="0x6042e47c <ucHeap+44184>"}],file="../amazon-free\
rtos/freertos_kernel/list.c",fullname="/home/hoppy/projects/G1335/repos/mod485/amazon-freertos/freer\
tos_kernel/list.c",line="158",arch="arm"},thread-id="1",stopped-threads="all"
256,058 15^connected
256,058 (gdb)
256,058 &"\n"
256,058 ^done
256,058 (gdb)
256,059 16^done,groups=[{id="i1",type="process",pid="42000"}]
256,059 (gdb)
256,059 17monitor reset
256,059 &"monitor reset\n"
256,203 @"Resetting target\r\n"
256,203 17^done
256,203 (gdb)
256,205 18load /home/hoppy/projects/G1335/repos/mod485/Debug/mod485.axf

256,211 19-list-thread-groups i1

And then it exits. (There's one last command not showing, but all is reavealed when you change the GDB command to an "strace -f -o foo.txt gdb ...). So here's the final stages of an strace of a similar session. You can see that after the list-thread-groups command, gdb is told to quit and then shuts down the GDB server.

Why is the IDE doing this? How can I make it work properly so that I can debug?

340883 read(11, "17load /home/hoppy/projects/G133"..., 1024) = 64
340883 read(11, "\n\n", 1024) = 2
340883 lseek(11, -1, SEEK_CUR) = -1 ESPIPE (Illegal seek)
340883 lseek(11, -1, SEEK_CUR) = -1 ESPIPE (Illegal seek)
340883 stat("/home/hoppy/projects/G1335/repos/mod485/Debug/mod485.axf", {st_mode=S_IFREG|0775, st_size=2164044, ...}) = 0
340883 openat(AT_FDCWD, "/home/hoppy/projects/G1335/repos/mod485/Debug/mod485.axf", O_RDONLY|O_CLOEXEC) = 14
340883 fstat(14, {st_mode=S_IFREG|0775, st_size=2164044, ...}) = 0
340883 close(14) = 0
340883 lseek(13, 65536, SEEK_SET) = 65536
340883 read(13, "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\0\1\7\377\377\377\377\377\377\377\377\377\377\377\377\377"..., 4096) = 4096
340883 mmap(NULL, 139264, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f521165a000
340883 read(13, "C\354\20+0`\337\347\0\0\0\0\0\0\0\0p\265U\354\20K\6F\0\"\20\356\20\n\0#"..., 135168) = 135168
340883 read(13, "\0\0\0\35\0\0\22\0\36\0\0\24\0\23\0\0\16\1\7\0\0\7\0\6\0\0\26\0\25\0\377\377"..., 4096) = 4096
340883 lseek(13, 270336, SEEK_SET) = 270336
340883 read(13, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0) = 1 ([{fd=11, revents=POLLIN}])
340919 ioctl(11, TCGETS, {B38400 opost isig icanon -echo ...}) = 0
340919 read(11, "19-gdb-exit\n", 1024) = 12
340919 write(11, "19^exit\n", = 8
340919 ioctl(0, TCGETS, {B38400 opost isig -icanon -echo ...}) = 0
340919 ioctl(0, SNDCTL_TMR_STOP or TCSETSW, {B38400 opost isig icanon echo ...}) = 0
340919 ioctl(0, TCGETS, {B38400 opost isig icanon echo ...}) = 0
340919 sendto(12, "$vKill;a410#33", 14, 0, NULL, 0) = 14
340919 select(13, [7 12], NULL, [12], {tv_sec=1, tv_usec=0}) = 1 (in [12], left {tv_sec=0, tv_usec=999991})
340919 recvfrom(12, "$#00", 8192, 0, NULL, NULL) = 4
340919 sendto(12, "$k#6b", 5, 0, NULL, 0) = 5
340919 close(12) = 0
340919 write(11, "=thread-exited,id=\"1\",group-id=\""..., 36) = 36
340919 write(11, "=thread-group-exited,id=\"i1\"\n", 29) = 29
340919 close(13) = 0
340919 munmap(0x7f8434748000, 176128) = 0
340919 exit_group(0) = ?
340919 +++ exited with 0 +++
SPIPE (Illegal seek)
340883 lseek(11, -1, SEEK_CUR) = -1 ESPIPE (Illegal seek)
340883 lseek(11, -1, SEEK_CUR) = -1 ESPIPE (Illegal seek)
340883 lseek(11, -1, SEEK_CUR) = -1 ESPIPE (Illegal seek)
340883 sendto(12, "$X60400100,3e60:\0\0p`\335\3@`e\4@`AGA`"..., 16373, 0, NULL, 0) = 16373
340883 select(13, [7 12], NULL, [12], {tv_sec=1, tv_usec=0}) = 1 (in [12], left {tv_sec=0, tv_usec=890346})
340883 recvfrom(12, "$OK#9a", 8192, 0, NULL, NULL) = 6
340883 lseek(11, -1, SEEK_CUR) = -1 ESPIPE (Illegal seek)
340883 lseek(11, -1, SEEK_CUR) = -1 ESPIPE (Illegal seek)
340883 sendto(12, "$X60403f60,3ef0:\274\204A`\21_@`\310\204A`\200\264\203\260"..., 16371, 0, NULL, 0) = 16371
340883 select(13, [7 12], NULL, [12], {tv_sec=1, tv_usec=0}) = 1 (in [12], left {tv_sec=0, tv_usec=888563})
340883 recvfrom(12, "$OK#9a", 8192, 0, NULL, NULL) = 6
340883 sendto(12, "$X60407e50,3ed0:\0\200\16@}\4/B`\200\265\0\257\6!\20"..., 16383, 0, NULL, 0) = 16383
340883 select(13, [7 12], NULL, [12], {tv_sec=1, tv_usec=0}) = 1 (in [12], left {tv_sec=0, tv_usec=889774})
340883 recvfrom(12, "$OK#9a", 8192, 0, NULL, NULL) = 6
340883 sendto(12, "$X6040bd20,3e40:Zq{h\0\"\232q{h\0\"\332q{h"..., 16370, 0, NULL, 0) = 16370
340883 select(13, [7 12], NULL, [12], {tv_sec=1, tv_usec=0}) = 1 (in [12], left {tv_sec=0, tv_usec=890291})
340883 recvfrom(12, "$OK#9a", 8192, 0, NULL, NULL) = 6
340883 sendto(12, "$X6040fb60,3ef0:@C\23`\377\367f\377\1\360v\372\377\3676\377"..., 16372, 0, NULL, 0) = 16372
340883 select(13, [7 12], NULL, [12], {tv_sec=1, tv_usec=0}) = 1 (in [12], left {tv_sec=0, tv_usec=887749})
340883 recvfrom(12, "$OK#9a", 8192, 0, NULL, NULL) = 6
340883 lseek(11, -1, SEEK_CUR) = -1 ESPIPE (Illegal seek)
340883 lseek(11, -1, SEEK_CUR) = -1 ESPIPE (Illegal seek)
340883 sendto(12, "$X60413a50,3ef0:{j\0013{b{j,\340;h\372j\262\373"..., 16383, 0, NULL, 0) = 16383
340883 select(13, [7 12], NULL, [12], {tv_sec=1, tv_usec=0}) = 1 (in [12], left {tv_sec=0, tv_usec=888482})
340883 recvfrom(12, "$OK#9a", 8192, 0, NULL, NULL) = 6
340883 sendto(12, "$X60417940,3fe0:read flash_page("..., 16383, 0, NULL, 0) = 16383
340883 select(13, [7 12], NULL, [12], {tv_sec=1, tv_usec=0}) = 1 (in [12], left {tv_sec=0, tv_usec=886292})
340883 recvfrom(12, "$OK#9a", 8192, 0, NULL, NULL) = 6
340883 sendto(12, "$X6041b920,3ed0:manager.c:795 : "..., 16372, 0, NULL, 0) = 16372
340883 select(13, [7 12], NULL, [12], {tv_sec=1, tv_usec=0}) = 1 (in [12], left {tv_sec=0, tv_usec=888498})
340883 recvfrom(12, "$OK#9a", 8192, 0, NULL, NULL) = 6
340883 sendto(12, "$X6041f7f0,289c:\3`E`\204`\0/F\3210`\36\340\0 "..., 10486, 0, NULL, 0) = 10486
340883 select(13, [7 12], NULL, [12], {tv_sec=1, tv_usec=0}) = 1 (in [12], left {tv_sec=0, tv_usec=926423})
340883 recvfrom(12, "$OK#9a", 8192, 0, NULL, NULL) = 6
340883 lseek(11, -1, SEEK_CUR) = -1 ESPIPE (Illegal seek)
340883 lseek(11, -1, SEEK_CUR) = -1 ESPIPE (Illegal seek)
340883 sendto(12, "$X6042208c,310:\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 802, 0, NULL, 0) = 802
340883 select(13, [7 12], NULL, [12], {tv_sec=1, tv_usec=0}) = 1 (in [12], left {tv_sec=0, tv_usec=993434})
340883 recvfrom(12, "$OK#9a", 8192, 0, NULL, NULL) = 6
340883 lseek(11, -1, SEEK_CUR) = -1 ESPIPE (Illegal seek)
340883 lseek(11, -1, SEEK_CUR) = -1 ESPIPE (Illegal seek)
340883 lseek(11, -1, SEEK_CUR) = -1 ESPIPE (Illegal seek)
340883 lseek(11, -1, SEEK_CUR) = -1 ESPIPE (Illegal seek)
340883 sendto(12, "$X6042239c,6a0:\1\0\3\0\1\0\0\0H\312C`\3\1\0\0\0"..., 1719, 0, NULL, 0) = 1719
340883 select(13, [7 12], NULL, [12], {tv_sec=1, tv_usec=0}) = 1 (in [12], left {tv_sec=0, tv_usec=987113})
340883 recvfrom(12, "$OK#9a", 8192, 0, NULL, NULL) = 6
340883 lseek(11, -1, SEEK_CUR) = -1 ESPIPE (Illegal seek)
340883 lseek(11, -1, SEEK_CUR) = -1 ESPIPE (Illegal seek)
340883 lseek(11, -1, SEEK_CUR) = -1 ESPIPE (Illegal seek)
340883 lseek(11, -1, SEEK_CUR) = -1 ESPIPE (Illegal seek)
340883 sendto(12, "$Pf=dc034060#e7", 15, 0, NULL, 0) = 15
340883 select(13, [7 12], NULL, [12], {tv_sec=1, tv_usec=0}) = 1 (in [12], left {tv_sec=0, tv_usec=999779})
340883 recvfrom(12, "$OK#9a", 8192, 0, NULL, NULL) = 6
340883 lseek(11, -1, SEEK_CUR) = -1 ESPIPE (Illegal seek)
340883 lseek(11, -1, SEEK_CUR) = -1 ESPIPE (Illegal seek)
340883 munmap(0x7f521165a000, 139264) = 0
340883 lseek(11, -1, SEEK_CUR) = -1 ESPIPE (Illegal seek)
340883 lseek(11, -1, SEEK_CUR) = -1 ESPIPE (Illegal seek)
340883 lseek(11, -1, SEEK_CUR) = -1 ESPIPE (Illegal seek)
340883 read(5, 0x7ffec296947f, 1) = -1 EAGAIN (Resource temporarily unavailable)
340883 poll([{fd=3, events=POLLIN}, {fd=5, events=POLLIN}, {fd=9, events=POLLIN}, {fd=0, events=POLLIN}, {fd=11, events=POLLIN}], 5, 0) = 1 ([{fd=11, revents=POLLIN}])
340883 ioctl(11, TCGETS, {B38400 opost isig icanon -echo ...}) = 0
340883 lseek(11, -1, SEEK_CUR) = -1 ESPIPE (Illegal seek)
340883 ioctl(0, TCGETS, {B38400 opost isig -icanon -echo ...}) = 0
340883 ioctl(0, SNDCTL_TMR_STOP or TCSETSW, {B38400 opost isig icanon echo ...}) = 0
340883 ioctl(0, TCGETS, {B38400 opost isig icanon echo ...}) = 0
340883 sendto(12, "$vKill;a410#33", 14, 0, NULL, 0) = 14
340883 select(13, [7 12], NULL, [12], {tv_sec=1, tv_usec=0}) = 1 (in [12], left {tv_sec=0, tv_usec=999960})
340883 recvfrom(12, "$#00", 8192, 0, NULL, NULL) = 4
340883 sendto(12, "$k#6b", 5, 0, NULL, 0) = 5
340883 close(12) = 0
340883 lseek(11, -1, SEEK_CUR) = -1 ESPIPE (Illegal seek)
340883 lseek(11, -1, SEEK_CUR) = -1 ESPIPE (Illegal seek)
340883 lseek(11, -1, SEEK_CUR) = -1 ESPIPE (Illegal seek)
340883 lseek(11, -1, SEEK_CUR) = -1 ESPIPE (Illegal seek)
340883 close(13) = 0
340883 munmap(0x7f521167c000, 176128) = 0
340883 lseek(11, -1, SEEK_CUR) = -1 ESPIPE (Illegal seek)
340883 lseek(11, -1, SEEK_CUR) = -1 ESPIPE (Illegal seek)
340883 exit_group(0) = ?
340883 +++ exited with 0 +++

0 Kudos
Reply
0 Replies