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

   *Note: Please adhere to [Contributing 
Guidelines](https://github.com/apache/nuttx/blob/master/CONTRIBUTING.md).*
   
   ## Summary
   
   1. For diagnose command, we catch any gdb error happened and report it in 
the final message.
   2. Fix thread command not working on come circumstances.
   
   `thread` is a GDB prefix command. Use `define` can only change it to a
   user prefix command. In this case, `thread 3` is unable to pass
   the argument 3 to python.
   
   Use python code to register command to overwrite this behavior. It may
   not work with future GDB, but all is good for now.
   3. Optimize `memleak` command by caching the global variables information 
parsed from elf file. This can save seconds when run the command for multiple 
times.
   
   
   ## Impact
   
   *Update this section, where applicable, on how change affects users,
    build process, hardware, documentation, security, compatibility, etc.*
   
   ## Testing
   
   Tested with qemu arm64.
   The thread command can work correctly.
   
   ```
   (gdb) info threads
   Index Tid  Pid  Cpu  Thread                Info                              
                                               Frame
   *0    0    0    0 '\000' Thread 0x404345e0     (Name: CPU0 IDLE, State: 
Running, Priority: 0, Stack: 16368) 0x402b1bcc  pl011_rxavailable() at 
/home/neo/projects/nuttx/nuttx/drivers/serial/uart_pl011.c:697
   *1    1    0    1 '\001' Thread 0x40434738     (Name: CPU1 IDLE, State: 
Running, Priority: 0, Stack: 16368) 0x402b1bcc  pl011_rxavailable() at 
/home/neo/projects/nuttx/nuttx/drivers/serial/uart_pl011.c:697
    2    2    0    0 '\000' Thread 0x4044a000     (Name: hpwork, State: 
Waiting,Semaphore, Priority: 192, Stack: 16304) 0x402c32c0 nxsem_wait() at 
/home/neo/projects/nuttx/nuttx/sched/semaphore/sem_wait.c:213
    3    3    3    1 '\001' Thread 0x4044e210     (Name: nsh_main, State: 
Waiting,Semaphore, Priority: 100, Stack: 16336) 0x402c32c0       nxsem_wait() 
at /home/neo/projects/nuttx/nuttx/sched/semaphore/sem_wait.c:213
   (gdb) info nxt
   Index Tid  Pid  Cpu  Thread                Info                              
                                               Frame
   *0    0    0    0 '\000' Thread 0x404345e0     (Name: CPU0 IDLE, State: 
Running, Priority: 0, Stack: 16368) 0x402b1bcc  pl011_rxavailable() at 
/home/neo/projects/nuttx/nuttx/drivers/serial/uart_pl011.c:697
   *1    1    0    1 '\001' Thread 0x40434738     (Name: CPU1 IDLE, State: 
Running, Priority: 0, Stack: 16368) 0x402b1bcc  pl011_rxavailable() at 
/home/neo/projects/nuttx/nuttx/drivers/serial/uart_pl011.c:697
    2    2    0    0 '\000' Thread 0x4044a000     (Name: hpwork, State: 
Waiting,Semaphore, Priority: 192, Stack: 16304) 0x402c32c0 nxsem_wait() at 
/home/neo/projects/nuttx/nuttx/sched/semaphore/sem_wait.c:213
    3    3    3    1 '\001' Thread 0x4044e210     (Name: nsh_main, State: 
Waiting,Semaphore, Priority: 100, Stack: 16336) 0x402c32c0       nxsem_wait() 
at /home/neo/projects/nuttx/nuttx/sched/semaphore/sem_wait.c:213
   (gdb) t 3
   (gdb) bt
   #0  nxsem_wait (sem=sem@entry=0x40428588 <g_uart1port+40>) at 
/home/neo/projects/nuttx/nuttx/sched/semaphore/sem_wait.c:213
   #1  0x00000000402b2f40 in uart_read (filep=0x4044e708, buffer=0x404527af "", 
buflen=1) at 
   ...
   Backtrace stopped: previous frame identical to this frame (corrupt stack?)
   (gdb) t 2
   (gdb) bt
   #0  nxsem_wait (sem=sem@entry=0x40428a90 <g_hpwork+16>) at 
/home/neo/projects/nuttx/nuttx/sched/semaphore/sem_wait.c:213
   #1  0x00000000402c3340 in nxsem_wait_uninterruptible 
(sem=sem@entry=0x40428a90 <g_hpwork+16>) at 
/home/neo/projects/nuttx/nuttx/sched/semaphore/sem_wait.c:252
   #2  0x00000000402c52e0 in work_thread (argc=<optimized out>, argv=<optimized 
out>) at /home/neo/projects/nuttx/nuttx/sched/wqueue/kwork_thread.c:214
   #3  0x00000000402c8904 in nxtask_start () at 
/home/neo/projects/nuttx/nuttx/sched/task/task_start.c:111
   #4  0x0000000000000000 in ?? ()
   Backtrace
   ```
   
   


-- 
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