You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2020/11/23 19:07:57 UTC

[GitHub] [incubator-nuttx] v01d opened a new pull request #2390: Documentation: improve debugging section

v01d opened a new pull request #2390:
URL: https://github.com/apache/incubator-nuttx/pull/2390


   ## Summary
   
   I've improved the debugging section by describing the procedure of using openocd and gdb to have nuttx aware debugging.
   Also, I removed the section about JTAG which I think is unnecessary as it describes a very specific tool and does not add much
   to the documentation (also, it could be done via openocd).
   
   ## Impact
   
   Documentation
   
   ## Testing
   
   Local build
   


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

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



[GitHub] [incubator-nuttx] v01d commented on pull request #2390: Documentation: improve debugging section

Posted by GitBox <gi...@apache.org>.
v01d commented on pull request #2390:
URL: https://github.com/apache/incubator-nuttx/pull/2390#issuecomment-732419759


   > I was referring to the part where we retrieve the offsets. Loading the symbols should come after connecting to OpenOCD.
   > Something like:
   > 
   > ```
   > > gdb 
   > (gdb) target remote :3333
   > (gdb) symbol-file nuttx
   > ```
   
   When you do `gdb nuttx` and then `target remote :3333`, it will load the file and connect. The documentation states the following:
   
   ```
   Since openocd also needs to know the memory layout of certain datastructures, you need to have gdb run the following commands once the nuttx binary is loaded:
   
   eval "monitor nuttx.pid_offset %d", &((struct tcb_s *)(0))->pid
   eval "monitor nuttx.xcpreg_offset %d", &((struct tcb_s *)(0))->xcp.regs
   eval "monitor nuttx.state_offset %d", &((struct tcb_s *)(0))->task_state
   eval "monitor nuttx.name_offset %d", &((struct tcb_s *)(0))->name
   eval "monitor nuttx.name_size %d", sizeof(((struct tcb_s *)(0))->name)
   
   One way to do this is to define a gdb hook function that will be called when running file command:
   
   define hookpost-file
     eval "monitor nuttx.pid_offset %d", &((struct tcb_s *)(0))->pid
     eval "monitor nuttx.xcpreg_offset %d", &((struct tcb_s *)(0))->xcp.regs
     eval "monitor nuttx.state_offset %d", &((struct tcb_s *)(0))->task_state
     eval "monitor nuttx.name_offset %d", &((struct tcb_s *)(0))->name
     eval "monitor nuttx.name_size %d", sizeof(((struct tcb_s *)(0))->name)
   end
   ```
   
   Since the example demonstrates loading the file with the procedure I mentioned, there's no explicit "symbol loading" step. As to how to run these commands to load offsets, it is left to the user to decide how to run them.


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

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



[GitHub] [incubator-nuttx] Ouss4 commented on pull request #2390: Documentation: improve debugging section

Posted by GitBox <gi...@apache.org>.
Ouss4 commented on pull request #2390:
URL: https://github.com/apache/incubator-nuttx/pull/2390#issuecomment-732416539


   I was referring to the part where we retrieve the offsets.  Loading the symbols should come after connecting to OpenOCD.
   Something like:
   ```
   > gdb 
   (gdb) target remote :3333
   (gdb) symbol-file nuttx
   ```


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

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



[GitHub] [incubator-nuttx] Ouss4 merged pull request #2390: Documentation: improve debugging section

Posted by GitBox <gi...@apache.org>.
Ouss4 merged pull request #2390:
URL: https://github.com/apache/incubator-nuttx/pull/2390


   


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

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



[GitHub] [incubator-nuttx] v01d commented on pull request #2390: Documentation: improve debugging section

Posted by GitBox <gi...@apache.org>.
v01d commented on pull request #2390:
URL: https://github.com/apache/incubator-nuttx/pull/2390#issuecomment-732375206


   I justed added the requirement of PROCFS when using gdb approach. I forgot about that.


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

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



[GitHub] [incubator-nuttx] v01d commented on pull request #2390: Documentation: improve debugging section

Posted by GitBox <gi...@apache.org>.
v01d commented on pull request #2390:
URL: https://github.com/apache/incubator-nuttx/pull/2390#issuecomment-732372283


   When you run gdb passing the file it already loads the symbols, as in ```gdb nuttx```. My IDE does this directly.
   I'm not sure if file hook is called in this case as well. I added the gdb commands to my IDE also.
   


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

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