Skip to content
This repository was archived by the owner on Feb 4, 2026. It is now read-only.

Commit 48d4bfe

Browse files
committed
fix cmd_file: compatible with sting symbols
1 parent 09baf2c commit 48d4bfe

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

XSPdb/cmd/cmd_elf.py

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,11 @@ def api_get_elf_symbol_dict(self, elf_file, search_dirs=["./ready-to-run"]):
3232
lines = output.decode().splitlines()
3333
symbol_value_dict = {}
3434
symbol_name_dict = {}
35+
symbol_type_dict = {}
36+
symbol_gnored = {}
3537
for line in lines[1:]:
3638
parts = line.split()
37-
if len(parts) < 8:
39+
if len(parts) != 8:
3840
continue
3941
if parts[1].lower() == "value":
4042
continue
@@ -46,13 +48,25 @@ def api_get_elf_symbol_dict(self, elf_file, search_dirs=["./ready-to-run"]):
4648
"ndx": parts[6],
4749
"name": parts[7],
4850
}
49-
if value["ndx"] not in ("1", "2", ".text", ".data"):
50-
continue
51+
if value["type"] in ("NOTYPE", "FILE"):
52+
if value["ndx"] not in ("1", "2", ".text", ".data"):
53+
if value["type"] not in symbol_gnored:
54+
symbol_gnored[value["type"]] = 1
55+
else:
56+
symbol_gnored[value["type"]] += 1
57+
continue
5158
symbol_name_dict[value["name"]] = value
59+
if value["type"] not in symbol_type_dict:
60+
symbol_type_dict[value["type"]] = 1
61+
else:
62+
symbol_type_dict[value["type"]] += 1
5263
if symbol_value_dict.get(value["addr"]) is None:
5364
symbol_value_dict[value["addr"]] = [value]
5465
else:
5566
symbol_value_dict[value["addr"]].append(value)
67+
info("Find symbol: %s" % symbol_type_dict)
68+
if len(symbol_gnored) > 0:
69+
warn("Ignored symbol: %s" % symbol_gnored)
5670
return {"addr": symbol_value_dict,
5771
"name": symbol_name_dict,
5872
"sorted_addr": sorted(symbol_value_dict.keys()),

0 commit comments

Comments
 (0)