debug: symtab: rename start_addr to first_addr

`start_addr` is the address of the first symbol, rename it to
`first_addr` instead as it seems more intuitive and relatable
to the comments.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
This commit is contained in:
Yong Cong Sin 2024-05-27 17:25:39 +08:00 committed by David Leach
commit 043f595279
3 changed files with 6 additions and 6 deletions

View file

@ -24,7 +24,7 @@ struct z_symtab_entry {
struct symtab_info {
/* Absolute address of the first symbol */
const uintptr_t start_addr;
const uintptr_t first_addr;
/* Number of symbol entries */
const uint32_t length;
/* Symbol entries */

View file

@ -65,7 +65,7 @@ class symtab_entry:
return self.addr == other.addr
start_addr = 0
first_addr = 0
symtab_list = []
@ -109,11 +109,11 @@ def main():
symtab_list.sort(key=lambda x: x.addr, reverse=False)
# Get the address of the first symbol
start_addr = symtab_list[0].addr
first_addr = symtab_list[0].addr
for i, entry in enumerate(symtab_list):
# Offset is calculated here
entry.offset = entry.addr - start_addr
entry.offset = entry.addr - first_addr
# Debug print
log.debug('%6d: %s %s %.25s' % (
@ -146,7 +146,7 @@ def main():
print(f"}};\n", file=wf)
print(f"const struct symtab_info z_symtab = {{", file=wf)
print(f"\t.start_addr = {hex(start_addr)},", file=wf)
print(f"\t.first_addr = {hex(first_addr)},", file=wf)
print(f"\t.length = {len(symtab_list)},", file=wf)
print(f"\t.entries = z_symtab_entries,", file=wf)
print(f"}};\n", file=wf)

View file

@ -19,7 +19,7 @@ const struct symtab_info *const symtab_get(void)
const char *const symtab_find_symbol_name(uintptr_t addr, uint32_t *offset)
{
const struct symtab_info *const symtab = symtab_get();
const uint32_t symbol_offset = addr - symtab->start_addr;
const uint32_t symbol_offset = addr - symtab->first_addr;
uint32_t left = 0, right = symtab->length;
uint32_t ret_offset = 0;
const char *ret_name = "?";