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

   ## Summary
   
   1. tools/nuttx-gdbinit: improve experience of gdb backend scripts
   
   Redefine built-in command (info thread/thread/c) to compatible with 
developer habits
   
   Test board:
   ```bash
   ./tools/configure.sh -E lm3s6965-ek:qemu-flat
   ```
   1> start qemu:
   ```bash
   qemu-system-arm   -M lm3s6965evb   -device loader,file=nuttx   -serial 
mon:stdio   -nographic  -s
   ```
   2> gdb attach:
   ```bash
   gdb-multiarch -ix tools/nuttx-gdbinit nuttx -ex "target extended-remote 
localhost:1234"
   ```
   3> show thread info and callstack:
   
   ```bash
   | (gdb) info thread
   | * 0 Thread 0x20001548  (Name: Idle Task, State: Running, Priority: 0, 
Stack: 1000) PC: 0x9eee in up_idle()
   |   1 Thread 0x20005058  (Name: hpwork, State: Waiting,Semaphore, Priority: 
224, Stack: 1992) PC: 0xa124 in up_switch_context()
   |   2 Thread 0x20005c20  (Name: nsh_main, State: Waiting,Semaphore, 
Priority: 100, Stack: 2000) PC: 0xa124 in up_switch_context()
   |   3 Thread 0x20006b30  (Name: NTP daemon, State: Waiting,Semaphore, 
Priority: 100, Stack: 1952) PC: 0xa124 in up_switch_context()
   |   4 Thread 0x200086f0  (Name: telnetd, State: Waiting,Semaphore, Priority: 
100, Stack: 2008) PC: 0xa124 in up_switch_context()
   | (gdb) bt
   | #0  0x00009eee in up_idle () at chip/common/tiva_idle.c:62
   | #1  0x00003dd2 in nx_start () at init/nx_start.c:698
   | #2  0x00000190 in __start () at chip/common/lmxx_tm4c_start.c:177
   | (gdb) thread 4
   |   4 Thread 0x200086f0  (Name: telnetd, State: Waiting,Semaphore, Priority: 
100, Stack: 2008) PC: 0xa124 in up_switch_context()
   | (gdb) bt
   | #0  up_switch_context (tcb=0x20001548 <g_idletcb>, 
rtcb=rtcb@entry=0x200086f0) at common/arm_switchcontext.c:95
   | #1  0x0000453a in nxsem_wait (sem=sem@entry=0x2000916c) at 
semaphore/sem_wait.c:176
   | #2  0x0000197e in _net_timedwait (sem=sem@entry=0x2000916c, 
interruptible=interruptible@entry=true, timeout=timeout@entry=4294967295) at 
utils/net_lock.c:101
   | #3  0x0000198e in net_sem_timedwait (sem=sem@entry=0x2000916c, 
timeout=timeout@entry=4294967295) at utils/net_lock.c:242
   | #4  0x00001996 in net_sem_wait (sem=sem@entry=0x2000916c) at 
utils/net_lock.c:330
   | #5  0x00025f84 in psock_tcp_accept (psock=<optimized out>, addr=<optimized 
out>, addrlen=<optimized out>, newconn=newconn@entry=0x2000956c) at 
tcp/tcp_accept.c:274
   | #6  0x00025432 in inet_accept (psock=<optimized out>, addr=<optimized 
out>, addrlen=<optimized out>, newsock=0x20009568, flags=0) at 
inet/inet_sockif.c:1443
   | #7  0x00027a10 in psock_accept (psock=0x200044b8, 
addr=addr@entry=0x2000921c, addrlen=addrlen@entry=0x2000920c, 
newsock=newsock@entry=0x20009568, flags=flags@entry=0) at socket/accept.c:149
   | #8  0x00027a8c in accept4 (sockfd=sockfd@entry=3, 
addr=addr@entry=0x2000921c, addrlen=addrlen@entry=0x2000920c, 
flags=flags@entry=0) at socket/accept.c:280
   | #9  0x0002a256 in accept (sockfd=sockfd@entry=3, 
addr=addr@entry=0x2000921c, addrlen=addrlen@entry=0x2000920c) at 
net/lib_accept.c:50
   | #10 0x0001efaa in telnetd_daemon (config=config@entry=0x20009290) at 
telnetd_daemon.c:200
   | #11 0x0001e508 in telnetd_main (argc=1, argv=0x20008af8) at telnetd.c:98
   | #12 0x00008486 in nxtask_startup (entrypt=0x1e4bd <telnetd_main>, 
entrypt@entry=0x1 <up_putc>, argc=1, argv=0x20008af8) at sched/task_startup.c:70
   | #13 0x000056d2 in nxtask_start () at task/task_start.c:134
   | #14 0x00000000 in ?? ()
   | (gdb) c
   ```
   
   Signed-off-by: chao an <[email protected]>
   
   
   2. tools/nuttx-gdbinit: remove unsafed function call from script
   
   Some time nuttx will receive SIGSEGV while executing the function:
   
   ```bash
   | Thread 1 "nuttx" received signal SIGSEGV, Segmentation fault.
   | 0xf7bab4a0 in __sanitizer::common_flags_dont_use () from 
/lib/i386-linux-gnu/libasan.so.6
   | The program being debugged was signaled while in a function called from 
GDB.
   | GDB has restored the context to what it was before the call.
   | Evaluation of the expression containing the function
   | (up_check_tcbstack) will be abandoned.
   ```
   
   Signed-off-by: chao an <[email protected]>
   
   
   3. tools/nuttx-gdbinit: correct xcp context size
   
   Fix issue: https://github.com/apache/nuttx/issues/8616
   
   Signed-off-by: chao an <[email protected]>
   
   
   ## Impact
   
   N/A
   
   ## Testing
   
   ./tools/configure.sh -E lm3s6965-ek:qemu-flat


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to