You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2024/10/16 00:01:33 UTC
(nuttx) branch master updated (0bd9c8d7ae -> 7c37a46f69)
This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
from 0bd9c8d7ae Kconfig:Add an option to disable compilation of floating point related files
new a1ff878bed gdbserver:Special processing xtensa architecture
new ddf44def10 gdbserver:fix bug when use arm-a coredump addr mismatch
new 7c37a46f69 gdbserver:skip load symbol if use logfile as input
The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
tools/gdbserver.py | 101 ++++++++++++++++++++++++++++++++---------------------
1 file changed, 62 insertions(+), 39 deletions(-)
(nuttx) 01/03: gdbserver:Special processing xtensa architecture
Posted by xi...@apache.org.
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 a1ff878bed2768ece0ea35b39a5c0e0c62218fd6
Author: anjiahao <an...@xiaomi.com>
AuthorDate: Sat Aug 17 20:05:48 2024 +0800
gdbserver:Special processing xtensa architecture
Signed-off-by: anjiahao <an...@xiaomi.com>
---
tools/gdbserver.py | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/tools/gdbserver.py b/tools/gdbserver.py
index bb326e4c4c..bdf67092a1 100755
--- a/tools/gdbserver.py
+++ b/tools/gdbserver.py
@@ -230,6 +230,9 @@ reg_fix_value = {
},
"riscv": {
"ZERO": 0,
+ "WINDOWBASE": (0, 584),
+ "WINDOWSTART": (1, 585),
+ "PS": (0x40000, 742),
},
}
@@ -653,8 +656,9 @@ class GDBStub:
def put_one_register_packet(regs):
- regval = None
reg = int(pkt[1:].decode("utf8"), 16)
+ regval = None
+
if self.regfix:
for reg_name, reg_vals in reg_fix_value[self.arch].items():
if reg == reg_vals[1]:
@@ -1119,7 +1123,6 @@ def main(args):
else:
logger.error("Architecture unknown, exiting...")
sys.exit(2)
- elf.parse_addr2line(args.arch, args.addr2line, log.stack_data)
raw = RawMemoryFile(args.rawfile)
coredump = CoreDumpFile(args.coredump)
(nuttx) 02/03: gdbserver:fix bug when use arm-a coredump addr mismatch
Posted by xi...@apache.org.
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 ddf44def10470cce5354aec997a55ed8e201f1b4
Author: anjiahao <an...@xiaomi.com>
AuthorDate: Tue Aug 27 21:08:35 2024 +0800
gdbserver:fix bug when use arm-a coredump addr mismatch
Signed-off-by: anjiahao <an...@xiaomi.com>
---
tools/gdbserver.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/gdbserver.py b/tools/gdbserver.py
index bdf67092a1..edffe841fc 100755
--- a/tools/gdbserver.py
+++ b/tools/gdbserver.py
@@ -501,7 +501,7 @@ class CoreDumpFile:
data = f.read(segment["p_filesz"])
self.__memories.append(
pack_memory(
- segment["p_paddr"], segment["p_paddr"] + len(data), data
+ segment["p_vaddr"], segment["p_vaddr"] + len(data), data
)
)
(nuttx) 03/03: gdbserver:skip load symbol if use logfile as input
Posted by xi...@apache.org.
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 7c37a46f69118a2cc4490eb709516f7657b8580d
Author: anjiahao <an...@xiaomi.com>
AuthorDate: Mon Sep 2 12:23:39 2024 +0800
gdbserver:skip load symbol if use logfile as input
Signed-off-by: anjiahao <an...@xiaomi.com>
---
tools/gdbserver.py | 92 +++++++++++++++++++++++++++++++++---------------------
1 file changed, 56 insertions(+), 36 deletions(-)
diff --git a/tools/gdbserver.py b/tools/gdbserver.py
index edffe841fc..7ff5c8ef22 100755
--- a/tools/gdbserver.py
+++ b/tools/gdbserver.py
@@ -30,6 +30,7 @@ import socket
import struct
import subprocess
import sys
+import traceback
import elftools
from elftools.elf.elffile import ELFFile
@@ -263,7 +264,7 @@ class DumpELFFile:
self.__xlen = None
self.__text = 0
- def parse(self):
+ def parse(self, load_symbol: bool):
self.__memories = []
elf = ELFFile.load_from_path(self.elffile)
self.__arch = elf.get_machine_arch().lower().replace("-", "")
@@ -313,26 +314,27 @@ class DumpELFFile:
if segment.header.p_flags & 1 and not self.__text:
self.__text = segment.header.p_vaddr
- symtab = elf.get_section_by_name(".symtab")
- self.symbol = {}
- for symbol in symtab.iter_symbols():
- if symbol["st_info"]["type"] != "STT_OBJECT":
- continue
+ self.load_symbol = load_symbol
+ if load_symbol:
+ symtab = elf.get_section_by_name(".symtab")
+ self.symbol = {}
+ for symbol in symtab.iter_symbols():
+ if symbol["st_info"]["type"] != "STT_OBJECT":
+ continue
- if symbol.name in (
- "g_tcbinfo",
- "g_pidhash",
- "g_npidhash",
- "g_last_regs",
- "g_running_tasks",
- ):
- self.symbol[symbol.name] = symbol
- logger.debug(
- f"name:{symbol.name} size:{symbol['st_size']} value:{hex(symbol['st_value'])}"
- )
+ if symbol.name in (
+ "g_tcbinfo",
+ "g_pidhash",
+ "g_npidhash",
+ "g_last_regs",
+ "g_running_tasks",
+ ):
+ self.symbol[symbol.name] = symbol
+ logger.debug(
+ f"name:{symbol.name} size:{symbol['st_size']} value:{hex(symbol['st_value'])}"
+ )
elf.close()
-
return True
def merge(self, other):
@@ -537,25 +539,30 @@ class GDBStub:
self.threadinfo = []
self.current_thread = 0
- try:
- self.parse_thread()
- logger.debug(f"Have {len(self.threadinfo)} threads to debug.")
- if len(self.threadinfo) == 0:
- logger.critical(
- "Check if your coredump or raw file matches the ELF file"
- )
- sys.exit(1)
+ if elffile.load_symbol:
+ try:
+ self.parse_thread()
+ logger.debug(f"Have {len(self.threadinfo)} threads to debug.")
+ if len(self.threadinfo) == 0:
+ logger.critical(
+ "Check if your coredump or raw file matches the ELF file"
+ )
+ sys.exit(1)
- if arch in reg_fix_value.keys():
- self.regfix = True
- logger.info(f"Current arch is {arch}, need reg index fix.")
+ if arch in reg_fix_value.keys():
+ self.regfix = True
+ logger.info(f"Current arch is {arch}, need reg index fix.")
- except TypeError:
- if not self.registers:
- logger.critical(
- "Logfile, coredump, or rawfile do not contain register. Please check if the files are correct."
- )
- sys.exit(1)
+ except TypeError:
+ if not self.registers:
+ logger.critical(
+ "Logfile, coredump, or rawfile do not contain register,"
+ "Please check if the files are correct."
+ )
+
+ stack_trace = traceback.format_exc()
+ logger.debug(stack_trace)
+ sys.exit(1)
def get_gdb_packet(self):
socket = self.socket
@@ -1017,6 +1024,15 @@ def arg_parser():
help="coredump file, will prase memory in this file",
)
+ parser.add_argument(
+ "-s",
+ "--symbol",
+ action="store_true",
+ help="Analyze the symbol table in the ELF file, use in thread awareness"
+ "if use logfile input, this option will is false by default"
+ "if use rawfile or coredump input, this option will is true by default",
+ )
+
parser.add_argument(
"--debug",
action="store_true",
@@ -1101,7 +1117,11 @@ def main(args):
config_log(args.debug)
elf = DumpELFFile(args.elffile[0])
- elf.parse()
+ if args.symbol is False:
+ if args.rawfile or args.coredump:
+ args.symbol = True
+
+ elf.parse(args.symbol)
elf_texts = [elf.text()]
for name in args.elffile[1:]:
other = DumpELFFile(name)