You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ac...@apache.org on 2023/07/24 11:06:06 UTC

[nuttx] branch master updated: Documentation:add gdb python script documentation

This is an automated email from the ASF dual-hosted git repository.

acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new 4745ab64c3 Documentation:add gdb python script documentation
4745ab64c3 is described below

commit 4745ab64c39f5e69e490e0b90c91688760cf5d62
Author: anjiahao <an...@xiaomi.com>
AuthorDate: Mon Jul 24 18:23:21 2023 +0800

    Documentation:add gdb python script documentation
    
    Signed-off-by: anjiahao <an...@xiaomi.com>
---
 Documentation/quickstart/debugging.rst | 34 ++++++++++++++++++----------------
 1 file changed, 18 insertions(+), 16 deletions(-)

diff --git a/Documentation/quickstart/debugging.rst b/Documentation/quickstart/debugging.rst
index a95d0da2e9..751f9578b4 100644
--- a/Documentation/quickstart/debugging.rst
+++ b/Documentation/quickstart/debugging.rst
@@ -242,27 +242,29 @@ With gdb
 You can also do NuttX aware debugging using ``gdb`` scripting support.
 The benefit is that it works also for the sim build where ``openocd`` is
 not applicable. For this to work, you will need to enable PROC filesystem support
-which will expose required task information (``CONFIG_FS_PROCFS=y``). 
+which will expose required task information (``CONFIG_FS_PROCFS=y CONFIG_DEBUG_TCBINFO=y``). 
 
-To use this approach, you can load the ``nuttx/tools/nuttx-gdbinit`` file. An
-easy way to do this is to create a symbolic link:
+To use this approach, you can load the ``nuttx/tools/gdb/__init__.py`` file. An
+easy way to do this is to  add an extra command:
 
 .. code-block:: console
 
-  $ cd $HOME
-  $ ln -s nuttx/tools/nuttx-gdbinit .gdbinit
-  
-This way whenever gdb is started it will run the appropriate commands. To inspect
-the threads you can now use the following ``gdb`` command:
+  $ gdb nuttx -ex "nuttx/tools/gdb/__init__.py"
+
+gdb can need to set the current elf support architecture, for example,
+the prefix is arm-ebai-none-.
 
 .. code-block::
 
-  (gdb) info_nxthreads
-  target examined 
-  _target_arch.name=armv7e-m
-  $_target_has_fpu : 0 
-  $_target_has_smp : 0 
-  saved current_tcb (pid=0) 
-  * 0 Thread 0x20000308  (Name: Idle Task, State: Running, Priority: 0) 0xdc in __start()
-    1 Thread 0x20001480  (Name: init, State: Waiting,Semaphore, Priority: 100) 0x7e08 in arm_switchcontext()
+  (gdb) info threads
+  Id   Thread                Info                                                                             Frame
+  *0   Thread 0x20000398     (Name: Idle Task, State: Running, Priority: 0, Stack: 1000)                      0x80001ac __start() at chip/stm32_start.c:111
+  1    Thread 0x10000188     (Name: nsh_main, State: Waiting,Semaphore, Priority: 100, Stack: 2000)           0x800aa06 sys_call2() at /home/ajh/work/vela_all/nuttx/include/arch/syscall.h:187
+
+The python script has extended many commands like ``thread <id>`` ,
+``thread apply <all|id list> cmd``, ``nxsetargs`` etc.
+You can use ``help <command>`` to get help.
 
+Note that if you need to continue debugging after using the thread command,
+please use ``c`` instead of ``continue``, because thread will force the register to be set,
+and the `c` command will restore the register before conitune.