Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion cle/backends/elf/elf.py
Original file line number Diff line number Diff line change
Expand Up @@ -938,7 +938,7 @@ def _load_die_lex_block(
if sub_block is not None:
block.child_blocks.append(sub_block)
elif sub_die.tag == "DW_TAG_inlined_subroutine":
subr = InlinedFunction(sub_die.offset)
subr = InlinedFunction(sub_die.offset, _die_depth(sub_die))
low_pc, high_pc = self._load_low_high_pc_form_die(sub_die)
if "DW_AT_entry_pc" in sub_die.attributes:
subr.entry = sub_die.attributes["DW_AT_entry_pc"].value
Expand Down Expand Up @@ -1663,4 +1663,12 @@ def _get_compatible_pcode_languages(reader):
return languages


def _die_depth(die: DIE | None) -> int:
result = 0
while die is not None:
die = die.get_parent()
result += 1
return result


register_backend("elf", ELF)
1 change: 1 addition & 0 deletions cle/backends/inlined_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class InlinedFunction:
"""

dwoffset: int
depth: int
name: str | None = None
ranges: list[tuple[int, int]] = field(default_factory=list)
extern: bool = False
Expand Down
Loading