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:
parent
29423eb17e
commit
043f595279
3 changed files with 6 additions and 6 deletions
|
@ -24,7 +24,7 @@ struct z_symtab_entry {
|
||||||
|
|
||||||
struct symtab_info {
|
struct symtab_info {
|
||||||
/* Absolute address of the first symbol */
|
/* Absolute address of the first symbol */
|
||||||
const uintptr_t start_addr;
|
const uintptr_t first_addr;
|
||||||
/* Number of symbol entries */
|
/* Number of symbol entries */
|
||||||
const uint32_t length;
|
const uint32_t length;
|
||||||
/* Symbol entries */
|
/* Symbol entries */
|
||||||
|
|
|
@ -65,7 +65,7 @@ class symtab_entry:
|
||||||
return self.addr == other.addr
|
return self.addr == other.addr
|
||||||
|
|
||||||
|
|
||||||
start_addr = 0
|
first_addr = 0
|
||||||
symtab_list = []
|
symtab_list = []
|
||||||
|
|
||||||
|
|
||||||
|
@ -109,11 +109,11 @@ def main():
|
||||||
symtab_list.sort(key=lambda x: x.addr, reverse=False)
|
symtab_list.sort(key=lambda x: x.addr, reverse=False)
|
||||||
|
|
||||||
# Get the address of the first symbol
|
# 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):
|
for i, entry in enumerate(symtab_list):
|
||||||
# Offset is calculated here
|
# Offset is calculated here
|
||||||
entry.offset = entry.addr - start_addr
|
entry.offset = entry.addr - first_addr
|
||||||
|
|
||||||
# Debug print
|
# Debug print
|
||||||
log.debug('%6d: %s %s %.25s' % (
|
log.debug('%6d: %s %s %.25s' % (
|
||||||
|
@ -146,7 +146,7 @@ def main():
|
||||||
print(f"}};\n", file=wf)
|
print(f"}};\n", file=wf)
|
||||||
|
|
||||||
print(f"const struct symtab_info z_symtab = {{", 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.length = {len(symtab_list)},", file=wf)
|
||||||
print(f"\t.entries = z_symtab_entries,", file=wf)
|
print(f"\t.entries = z_symtab_entries,", file=wf)
|
||||||
print(f"}};\n", file=wf)
|
print(f"}};\n", file=wf)
|
||||||
|
|
|
@ -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 char *const symtab_find_symbol_name(uintptr_t addr, uint32_t *offset)
|
||||||
{
|
{
|
||||||
const struct symtab_info *const symtab = symtab_get();
|
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 left = 0, right = symtab->length;
|
||||||
uint32_t ret_offset = 0;
|
uint32_t ret_offset = 0;
|
||||||
const char *ret_name = "?";
|
const char *ret_name = "?";
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue