Commit Graph

11 Commits

Author SHA1 Message Date
anjiahao fb176c02ca gdb/thread.py:Remove dependence on g_current_regs
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2024-10-08 23:55:59 +08:00
wangmingrong1 b5c5e4b850 gdb plugin: Encapsulate the gdb native command gcore as nxgcore
Modify elf with nxgcore and call gcore:
(gdb) nxgcore --help
usage: [-h] [-o OUTPUT] [-t OBJCOPY] [-r MEMRANGE]

options:
  -h, --help            show this help message and exit
  -o OUTPUT, --output OUTPUT
                        Gcore output file
  -t OBJCOPY, --objcopy OBJCOPY
                        Select the appropriate architecture for the objcopy
                        tool
  -r MEMRANGE, --memrange MEMRANGE

examples:
	(gdb) nxgcore -t arm-none-eabi-objcopy -r 0x40200000,0x48000000,0x07

Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2024-09-20 22:07:29 +08:00
Alin Jerpelea c9eef2d697 tools: migrate to SPDX identifier
Most tools used for compliance and SBOM generation use SPDX identifiers
This change brings us a step closer to an easy SBOM generation.

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2024-09-10 23:11:11 +08:00
anjiahao 9eadf61e90 toos/gdb:sync mempool memdump method
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2024-08-21 18:01:24 +08:00
anjiahao 9478f5b6d4 tools/gdb:add get_symbol_value api
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2024-08-21 18:01:24 +08:00
wangmingrong 52a349ab13 memdump: Enhance memdump
The method of passing in parameters to memdump is modified and the
incoming address is added. After traversing the node to which the
address belongs, the memdump command will end.

Signed-off-by: wangmingrong <wangmingrong@xiaomi.com>
2024-03-15 17:46:48 +08:00
anjiahao 749655d785 tcbinfo:remove total_num form tcbinfo.
total_num is not required
test:

make -f tools/Makefile.host
cp tools/jlink-nuttx /opt/SEGGER/JLink_V786a/libnuttxplugin.so
JLinkGDBServer -if SWD -speed 5000 -device STM32F429ZI -NoGui 1 -rtos libnuttxplugin

can run normally

Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2023-11-21 21:52:24 -08:00
Bowen Wang 320b73818b tools/gdb/memdump.py: fix the wrap line output indentation
1. always output the wrap line when dump main heap memory node;
2. format the memdump.py;

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2023-09-21 13:49:43 +08:00
chenxiaoyi 917764857a gdb/thread.py: fix typo
Signed-off-by: chenxiaoyi <chenxiaoyi@xiaomi.com>
2023-09-19 09:35:55 +08:00
anjiahao d63a36e0f3 toos/gdb/thread: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'

Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2023-07-23 21:59:35 -07:00
anjiahao adc5c8b5ac Debug:support python script auto debug nuttx kernel
This patch add an example and pyhton base modules:
1.add memdump.py is an example to analyze memory
usage by python script.
2.add The most basic data structure analysis, like list, etc.

future ideas:
Maybe we can add modules related to "sched, drivers, arch, fs.." to
automatically analyze scripts to debug some problems

References:
linux kernel (https://github.com/torvalds/linux/tree/master/scripts/gdb)
The official manual of gdb (https://sourceware.org/gdb/onlinedocs/gdb/Python-API.html)

Change-Id: Ib9025a0a141cb89f3813526f7c55dcb28de31ed9
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2023-06-25 18:17:30 +08:00