mirror of
https://github.com/apache/nuttx.git
synced 2026-05-27 11:26:12 +08:00
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 <xuxingliang@xiaomi.com>
This commit is contained in:
@@ -43,6 +43,21 @@ def parse_args(args):
|
|||||||
help="Select the appropriate architecture for the objcopy tool",
|
help="Select the appropriate architecture for the objcopy tool",
|
||||||
type=str,
|
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(
|
parser.add_argument(
|
||||||
"-r",
|
"-r",
|
||||||
"--memrange",
|
"--memrange",
|
||||||
@@ -129,7 +144,16 @@ class NXGcore(gdb.Command):
|
|||||||
os.remove(section)
|
os.remove(section)
|
||||||
|
|
||||||
gdb.execute(f"file {tmpfile.name}")
|
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}"')
|
gdb.execute(f'file "{elffile}"')
|
||||||
tmpfile.close()
|
tmpfile.close()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user