XuNeo opened a new pull request, #15759:
URL: https://github.com/apache/nuttx/pull/15759

   
   *Note: Please adhere to [Contributing 
Guidelines](https://github.com/apache/nuttx/blob/master/CONTRIBUTING.md).*
   
   ## Summary
   
   GDB release 16.2 recently to fix the incompatibility issue with LLDB. 
   For us, the only change is stub must report it support feature 
'binary-upload' before GDB will use this feature. 
   
   For more information, find bug report and discussion in 
https://sourceware.org/bugzilla/show_bug.cgi?id=32593
   
   Use GDB 16.2, now it works with binary upload.
   ```
     [remote] Sending packet: $x39c,4#a7
     [remote] Received Ack
     [remote] Packet received: b\000\203
   ```
   
   
   ## Impact
   
   Since GDB 16.1 is only alive for a short time, I expect minor impact on 
user. 
   Now they should upgrade to GDB 16.2 if previously using 16.1. Failing to do 
so will have slower memory read just like before 16.1.
   
   ## Testing
   
   You may need to build GDB 16.2 manually. Follow these steps.
   - Requirements
   ```
   apt install gcc build-essential texinfo bison flex libpython3-dev python3 
libgmp-dev libmpfr-dev libreadline-dev
   ```
   - Build GDB
   ```
   ./configure --enable-targets=all --prefix=$HOME/.local --disable-binutils 
--disable-ld --disable-gold --disable-gas --disable-sim --disable-gprof 
--disable-gprofng --disable-gcore --without-guile
   
   make
   make install
   ```
   
   ### Test using QEMU mps3-an547.
   
   #### Compile
   ```
   cmake -Bbuild -GNinja -DBOARD_CONFIG=mps3-an547:gdbstub nuttx
   ninja -C build
   ```
   
   #### Run qemu
   ```
    qemu-system-arm -M mps3-an547 -m 2G -nographic -kernel build/nuttx -gdb 
tcp::1127 -serial mon:stdio -serial pty
   ```
   
   Notice the redirected pts device in log, like `char device redirected to 
/dev/pts/74 (label serial1)`.
   In this case `/dev/pts/74` is the one we are going to use for GDB to connect 
the stub.
   
   #### Connect to GDB stub
   
   Current configuration is only to attach GDB stub to serial device only when 
crash happened by turning off `CONFIG_SERIAL_GDBSTUB_AUTO_ATTACH`.
   
   So trigger a force panic by input `ctrl+/` in nsh.
   ```
   
   NuttShell (NSH) NuttX-12.8.0
   nsh>
   nsh>
   nsh>
   nsh> dump_assert_info: Current Version: NuttX  12.8.0 e2314d3338d Feb  5 
2025 11:47:12 arm
   dump_assert_info: Assertion failed Force panic by user.: at file: 
/drivers/serial/serial.c:2289 task: Idle_Task process: Kernel 0xa8f9
   ```
   
   Input `y` to enter GDB debug mode.
   ```
   uart_gdbstub_panic_callback: Press Y/y key in 10 seconds to enter gdb debug 
mode
   uart_gdbstub_panic_callback: Enter panic gdbstub mode, plase use gdb connect 
to debug
   uart_gdbstub_panic_callback: Please use gdb of the corresponding 
architecture to connect to nuttx
   uart_gdbstub_panic_callback: such as: arm-none-eabi-gdb nuttx -ex "set 
target-charset ASCII" -ex "target remote /dev/ttyUSB0"
   ```
   
   Now connect to GDB stub
   ```
    gdb-multiarch build/nuttx -ex "set debug remote on" -ex "set mem 
inaccessible-by-default on" -ex "set target-charset ASCII" -ex "target remote 
/dev/pts/74"
   ```
   
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to