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

   ## Summary
   Support thread command on nuttx
   
   support arch:
     sim x86
     sim x86_64
     arm32 all series
   
     If we need to support more architectures in the future,
     just add the 'g_tcbinfo' of the corresponding architecture
   
   support thread command:
     1. thread <id>
       switch thread
     2. info thread
       list all thread info
     3. thread apply [all | id list] command
       like this:
         thread apply all bt
         thread apply all bt full
         thread apply 1 2 4 bt
         thread apply all info r
     4. nxsetregs
         Set registers to the specified values.
         Usage: nxsetregs [regs]
   
         Etc: nxsetregs
              nxsetregs g_current_regs[0]
              nxsetregs tcb->xcp.regs
              Nxsetregs g_pidhash[0].tcb->xcp.regs
   
         Default regs is g_current_regs[0],if regs is NULL,
         it will not set registers.
   
       Because NuttX enters exception_common during a crash,
       this assembly function manipulates the stack pointer (sp),
       causing GDB to be unable to trace back to the first context of the crash.
       Instead, it shows the context of the interrupt stack. By using nxsetregs,
       it is possible to forcefully set the first context to
       the one before the interrupt occurred.
   
   Notice:
     Switching threads is achieved by setting registers,
     so registers need to be restored before continue,
     please use 'c' to continue instead of 'continue'
   
   ## Impact
   gdb debug
   ## Testing
   sim32
   sim64
   stm32f429i-disco with jlink
   
   
   ##Usage:
    CONFIG_DEBUG_TCBINFO=y
   
   add '-ex "souce tools/gdb/__init__.py"' in gdb command or 'souce 
tools/gdb/__init__.py' in gdb shell
   


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