This is an automated email from the ASF dual-hosted git repository. xiaoxiang pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit c013648617cb82fba0d6353296ce4dcdbc00b930 Author: xuxingliang <[email protected]> AuthorDate: Sat Sep 28 09:47:13 2024 +0800 tools/gdb: improve nxgcore speed Let GDB to read from ELF for readonly data. Disable this feature by nxgcore --no-trust-readonly. Signed-off-by: xuxingliang <[email protected]> --- tools/gdb/nuttxgdb/gcore.py | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/tools/gdb/nuttxgdb/gcore.py b/tools/gdb/nuttxgdb/gcore.py index 532d6da7c1..3a30376287 100644 --- a/tools/gdb/nuttxgdb/gcore.py +++ b/tools/gdb/nuttxgdb/gcore.py @@ -43,6 +43,21 @@ def parse_args(args): help="Select the appropriate architecture for the objcopy tool", type=str, ) + + parser.add_argument( + "--trust-readonly", + help="Trust readonly section from elf, bypass read from device.", + action="store_true", + default=True, + ) + + parser.add_argument( + "--no-trust-readonly", + help="Do not trust readonly section from elf, read from device.", + action="store_false", + dest="trust_readonly", + ) + parser.add_argument( "-r", "--memrange", @@ -129,7 +144,16 @@ class NXGcore(gdb.Command): os.remove(section) gdb.execute(f"file {tmpfile.name}") - gdb.execute(f'gcore "{corefile}"') + + if args.trust_readonly: + gdb.execute("set trust-readonly-sections on") + + gdb.execute(f"gcore {corefile}") + + if args.trust_readonly: + # Restore trust-readonly-sections to default off state + gdb.execute("set trust-readonly-sections off") + gdb.execute(f'file "{elffile}"') tmpfile.close()
