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>
1. use _atomic as wrapper because if _Atomic empty, may affects the compilation of other files:
https://builder95.pt.miui.com/job/vela_test_task/792878/
2. for clang builtin function, it donot accept param with keyword "_Atomic"
Signed-off-by: zhangyu117 <zhangyu117@xiaomi.com>
1. use DW_AT_linkage_name find function, if die have "DW_AT_linkage_name".
2. Check die have parent to skip Rust lib function.
3. Update find file path.
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
nuttx/include/arch/chip/chip.h:55:2: error: #error CONFIG_ARM64_GIC_VERSION should be 2, 3 or 4
55 | #error CONFIG_ARM64_GIC_VERSION should be 2, 3 or 4
Signed-off-by: v-tangmeng <v-tangmeng@xiaomi.com>
So GDB will load readonly data from elf directly, instead of gdbserver.
It can also bypass the issue that some dump file includes wrong text section data
Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
nxgdbmcp contains some legacy code. This is because in its earliest
design, nxgdbmcp had the ability to actively launch a GDB child process
to hijack its stdio interaction, thus performing more complex actions.
However, now it can only interact with GDB through gdbrpc, so some
actions should be assumed to have been performed by the user.
We found that adapting for each command results in significant token consumption for users.
Firstly, the native command support for GDB can be removed.
Secondly, regarding the nxgdb part, we need the nxgdb developers to write better help information so that the model can accurately understand it.
Signed-off-by: guoshengyuan1 <guoshengyuan1@xiaomi.com>
Refactor binder debugging module with better separation of concerns
and improved code quality.
Major changes:
1. Architecture improvements:
- Separate data retrieval logic (module-level functions) from
presentation layer (BinderDump class methods)
- Add reusable helper functions: get_servicemanager(),
get_binder_device(), get_process_self(), get_services(),
get_proc_list()
- Remove private method naming (leading underscores) for public API
2. Enhanced service listing:
- get_services() now returns complete service information including
binder pointer, isolation permission, dump priority, and PID
- Improved output formatting with aligned columns
3. Iterator pattern for thread frame traversal:
- Convert get_thread_frames() to generator using yield
- Support flexible argument types: gdb.InferiorThread, int, or gdb.Value
- Cleaner iteration without manual list accumulation
4. Code quality improvements:
- Remove unnecessary try-except blocks
- Add get_proc_list() to eliminate code duplication
- Fix variable naming conflicts in dump_driver()
- Improve type annotations (list[dict] instead of list[tuple])
5. Enhanced filesystem filtering:
- fstype_filter() now supports both mountpoint filesystem types
and inode types (e.g., "DRIVER", "BLOCK")
Signed-off-by: cuiziwei <cuiziwei@xiaomi.com>
Add cycle detection mechanism to NxList iterator to prevent
infinite loops when traversing corrupted linked lists.
When memory corruption causes a cycle in the list, the iterator
now tracks visited node addresses and stops iteration with a
warning message instead of hanging indefinitely.
Changes:
- Add _visited set to track traversed node addresses
- Check for cycles in __next__ before processing each node
- Print warning when cycle is detected and raise StopIteration
This fix applies to NxList, NxSQueue, and NxDQueue through
inheritance.
E.g.:
(gdb) wdog
Warning: cycle detected in list at node 0x42034678
WDog@0x42034b38: tick: 3896988 0x40270a71 <nxsig_timeout> arg: 0x42034ae0
WDog@0x41d32658: tick: 3897074 0x40269a59 <nxsem_timeout> arg: 0x41d32600
Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
- Create parseregs.py with parse_registers() function to parse register
values from string format (e.g., 'PC: 0x1234 SP: 5678')
- Enhance setregs command with -s/--string flag to support parsing
registers from string instead of loading from memory
- Make colon separator optional to support space-separated format
(e.g., 'PC 0x1234 SP 5678') in addition to colon format
Usage: setregs -s "PC: 0x1234 SP 5678 LR: 0xABC"
setregs tcb->xcp.regs
Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
When the target doesn't support the 'cont' operation (continuing execution),
the GDB stub should return an error packet to GDB instead of indicating
the operation is unsupported. This allows GDB to properly handle the error
condition rather than treating it as an unsupported feature.
Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
Add colon separator after address in stack dump output to improve
readability and distinguish the address field from stack values.
Update the nxstub parser regex to handle flexible whitespace before
the address, ensuring it correctly parses the updated stack dump
format.
Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
When file name contains '-a', e.g. arm-v7a/nuttx, it's misjudged as arch parameter.
Use ' -a ' instead can fix it.
Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
So setregs command can try to set all registers even if some failed.
This may happen when for example setting arm CPSR failed.
Optimize setregs command to access any type of GDB value as argument.
Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
Because the data copy generated by tasking does not conform to the ELF standard,
we will not use the original ELF phdr. Instead, we will generate the corresponding phdr based on the section.
[.section.symbol] is used to record the PhysAddr of the section. It needs to be copied to the
address of the .section; this address will be used as the VirtAddr. If there are sections that can be merged, we will merge them.
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
Linking twice: the first time yields the actual size,
allowing the second link to find the correct starting position.
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
Use pythons' built-in bytes.find instead of re since the it treats value as string representation.
This fixed the issue of
memfind 0x3c452838
Searching for pattern b'3828453c' in memory
Error: missing ), unterminated subpattern at position 1
Traceback (most recent call last):
File "/home/neo/.local/lib/python3.10/site-packages/nxgdb/utils.py", line 361, in wrapper
func(self, args, from_tty)
File "/home/neo/.local/lib/python3.10/site-packages/nxgdb/memdump.py", line 1088, in invoke
pattern = re.compile(re.escape(value))
File "/usr/lib/python3.10/re.py", line 251, in compile
return _compile(pattern, flags)
File "/usr/lib/python3.10/re.py", line 303, in _compile
p = sre_compile.compile(pattern, flags)
File "/usr/lib/python3.10/sre_compile.py", line 788, in compile
p = sre_parse.parse(p, flags)
File "/usr/lib/python3.10/sre_parse.py", line 955, in parse
p = _parse_sub(source, state, flags & SRE_FLAG_VERBOSE, 0)
File "/usr/lib/python3.10/sre_parse.py", line 444, in _parse_sub
itemsappend(_parse(source, state, verbose, nested + 1,
File "/usr/lib/python3.10/sre_parse.py", line 843, in _parse
raise source.error("missing ), unterminated subpattern",
re.error: missing ), unterminated subpattern at position 1
Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
Sometimes AI confuses thread and nxthread.
So perhaps we need to encourage users to use gdbserver as much as possible.
Signed-off-by: guoshengyuan1 <guoshengyuan1@xiaomi.com>
Because sometimes, after receiving a decimal integer, AI will start
performing operations such as reading memory.
Signed-off-by: guoshengyuan1 <guoshengyuan1@xiaomi.com>
We found that AI may be using incorrect types of parameters when calling some tools with
Therefore, we should add some comments, which were previously considered
unnecessary.
Signed-off-by: guoshengyuan1 <guoshengyuan1@xiaomi.com>
register_libcxx_printer_loader only monitor event of new_objfile to register the printers, thus it's not registered if we firstly load objfile, then source gdbinit.py.
This patch manually register LibcxxPrettyPrinter anyway.
Signed-off-by: cuiziwei <cuiziwei@xiaomi.com>
- CMake added board Raspberry Pi Pico
- Added the entry:
CMake,raspberrypi-pico:bmp280
to the file arm-06.dat.
- Moved the search for the Python 3 interpreter to the
root CMakefile to avoid unnecessary repetition.
Signed-off-by: simbit18 <simbit18@gmail.com>
In newer GDB versions (>= 14.1), gdb.Thread is available as a subclass
of threading.Thread that automatically blocks signals. For older versions,
we implement GdbThread ourselves that uses gdb.blocked_signals() when
available (GDB >= 13.1) or falls back to regular threading.
This ensures the gdbrpc server works correctly across different GDB versions.
Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
setuptools_scm will generate it by commit information.
1. If the commit be marked as pynuttx-0.1.0, it will use 0.1.1
2. If the commit is a regular commit, it will look up the major version number and use .dev.number.commit hash as a version number suffix.
Signed-off-by: guoshengyuan1 <guoshengyuan1@xiaomi.com>
To use this feature, enable CONFIG_OTHER_SERIAL_CONSOLE and open CONFIG_SERIAL_T32TERM_CONSOLE. Then, run the t32term.cmm script in the trace32 software to achieve serial terminal interaction based on trace32.
Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>