-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtable.py
More file actions
24 lines (20 loc) · 713 Bytes
/
table.py
File metadata and controls
24 lines (20 loc) · 713 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
base = 0x7c00 # same as [ORG addr] in the bootloader' code
with open("./symbols.table", "r") as f:
flag = False
for line in f.readlines():
if not flag and line == 'SYMBOL TABLE:\n':
flag = True
continue
if flag:
line = line[:len(line)-1] # remove \n
parts = line.split()
if len(parts) > 0:
addri = 0
symi = 4
if len(parts) == 6:
symi = 5
offset = parts[addri]
sym = parts[symi]
la = int(offset, 16) + base
gdb_cmd = f"break *{hex(la)}"
print(f"{offset} :: {sym}\t\t{gdb_cmd}")