improvments to debugging symbols emitted by package.py script

master
Anton Lydike 3 years ago
parent 7894808e09
commit b6d967262a

@ -169,6 +169,7 @@ class MemImageCreator:
print(f" - data {pos:x}:{len(self.data):x}") print(f" - data {pos:x}:{len(self.data):x}")
f.write(self.data[pos : len(self.data)]) f.write(self.data[pos : len(self.data)])
if len(self.data) % SECTOR_SIZE != 0: if len(self.data) % SECTOR_SIZE != 0:
self.dbg_nfo['sections'][len(self.data)] = ':.empty'
print(f" - zeros {len(self.data):x}:{(SECTOR_SIZE - (len(self.data) % SECTOR_SIZE))+len(self.data):x}") print(f" - zeros {len(self.data):x}:{(SECTOR_SIZE - (len(self.data) % SECTOR_SIZE))+len(self.data):x}")
f.write(bytes(SECTOR_SIZE - (len(self.data) % SECTOR_SIZE))) f.write(bytes(SECTOR_SIZE - (len(self.data) % SECTOR_SIZE)))
# done! # done!
@ -186,6 +187,7 @@ def package(kernel: str, binaries: List[str], out: str):
# process kernel # process kernel
img.seek(MEM_START) img.seek(MEM_START)
kernel = Bin(kernel) kernel = Bin(kernel)
kernel.name = 'kernel' # make sure kernel is marked kernel in debug symbols
bin_table_addr = kernel.symtab.get(KERNEL_BINARY_TABLE, 0) - kernel.start + MEM_START bin_table_addr = kernel.symtab.get(KERNEL_BINARY_TABLE, 0) - kernel.start + MEM_START
print(f"kernel binary loaded, binary table located at: {bin_table_addr:x} (symtab addr {kernel.symtab.get(KERNEL_BINARY_TABLE, '??'):x})") print(f"kernel binary loaded, binary table located at: {bin_table_addr:x} (symtab addr {kernel.symtab.get(KERNEL_BINARY_TABLE, '??'):x})")

Loading…
Cancel
Save