I'm attempting to use the Arduino IDE to connect to a Segger J-Link Mini, which is connected to an Adafruit Feather RP2040 via an SWD header that I soldered on. I am able to use the Segger tools to connect the Feather, so I'm reasonably sure the soldering is fine.
When I try to debug a simple sketch in the Arduino IDE, I get this:
undefined: GDB Server Quit Unexpectedly. See gdb-server output for more details.
When I look at the gdb-server tab, I get this:
[2023-05-03T13:48:10.314Z] SERVER CONSOLE DEBUG: onBackendConnect: gdb-server session connected. You can switch to "DEBUG CONSOLE" to see GDB interactions.
/Applications/SEGGER/JLink/JLinkGDBServer -singlerun -nogui -if SWD -port 50000 -swoport 50001 -telnetport 50002 -device RP2040_M0_0
SEGGER J-Link GDB Server V7.88 Command Line Version
JLinkARM.dll V7.88 (DLL compiled Apr 28 2023 08:32:06)
Command line: -singlerun -nogui -if SWD -port 50000 -swoport 50001 -telnetport 50002 -device RP2040_M0_0
-----GDB Server start settings-----
GDBInit file: none
GDB Server Listening port: 50000
SWO raw output listening port: 50001
Terminal I/O port: 50002
Accept remote connection: yes
Generate logfile: off
Verify download: off
Init regs on start: off
Silent mode: off
Single run mode: on
Target connection timeout: 0 ms
------J-Link related settings------
J-Link Host interface: USB
J-Link script: none
J-Link settings file: none
------Target related settings------
Target device: RP2040_M0_0
Target device parameters: none
Target interface: SWD
Target interface speed: 4000kHz
Target endian: little
Connecting to J-Link...
J-Link is connected.
Firmware: J-Link EDU Mini V1 compiled Mar 28 2023 17:01:59
Hardware: V1.00
S/N: 801042942
Feature(s): FlashBP, GDB
Checking target voltage...
Target voltage: 3.28 V
Listening on TCP/IP port 50000
Connecting to target...
Halting core...
Connected to target
Waiting for GDB connection...Restoring target state and closing J-Link connection...
Shutting down...
[2023-05-03T13:48:11.369Z] SERVER CONSOLE DEBUG: onBackendConnect: gdb-server session closed
GDB server session ended. This terminal will be reused, waiting for next session to start...
I tried attaching LLDB to GDB to see what was wrong (yo dawg, I heard you like debuggers):
(lldb) process attach --name arm-none-eabi-gdb --waitfor
Process 72415 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
frame #0: 0x00007ff812870d6e libsystem_kernel.dylib`fstat$INODE64 + 10
libsystem_kernel.dylib`fstat$INODE64:
-> 0x7ff812870d6e <+10>: jae 0x7ff812870d78 ; <+20>
0x7ff812870d70 <+12>: movq %rax, %rdi
0x7ff812870d73 <+15>: jmp 0x7ff812870cdb ; cerror_nocancel
0x7ff812870d78 <+20>: retq
Target 0: (arm-none-eabi-gdb) stopped.
Executable module set to "/Users/igeek/Library/Arduino15/packages/rp2040/tools/pqt-gcc/1.5.0-b-c7bab52/bin/arm-none-eabi-gdb".
Architecture set to: x86_64-apple-macosx-.
(lldb) c
Process 72415 resuming
Process 72415 exited with status = 6 (0x00000006) Terminated due to signal 6
So something is calling abort(), but I can't tell what. I can launch the same instance of gdb directly and it works fine:
~/Library/Arduino15/packages/rp2040/tools/pqt-gcc/1.5.0-b-c7bab52/bin/arm-none-eabi-gdb
GNU gdb (GDB) 8.2.50.20190202-git
Copyright (C) 2019 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 "--host=x86_64-apple-darwin14 --target=arm-none-eabi".
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".