projects
/
pyelftools.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
43e7771
)
Filename in lineprog index fix made DWARF5 aware (#463)
author
Seva Alekseyev
<sevaa@yarxi.ru>
Tue, 21 Mar 2023 00:01:05 +0000
(20:01 -0400)
committer
GitHub
<noreply@github.com>
Tue, 21 Mar 2023 00:01:05 +0000
(17:01 -0700)
examples/dwarf_decode_address.py
patch
|
blob
|
history
diff --git
a/examples/dwarf_decode_address.py
b/examples/dwarf_decode_address.py
index e335d0bb5d9ac48668f31c42fd2b595de275117f..79938e4b6de586b5ff237c093356f719ac519587 100644
(file)
--- a/
examples/dwarf_decode_address.py
+++ b/
examples/dwarf_decode_address.py
@@
-80,6
+80,7
@@
def decode_file_line(dwarfinfo, address):
for CU in dwarfinfo.iter_CUs():
# First, look at line programs to find the file/line for the address
lineprog = dwarfinfo.line_program_for_CU(CU)
for CU in dwarfinfo.iter_CUs():
# First, look at line programs to find the file/line for the address
lineprog = dwarfinfo.line_program_for_CU(CU)
+ delta = 1 if lineprog.header.version < 5 else 0
prevstate = None
for entry in lineprog.get_entries():
# We're interested in those entries where a new state is assigned
prevstate = None
for entry in lineprog.get_entries():
# We're interested in those entries where a new state is assigned
@@
-88,7
+89,7
@@
def decode_file_line(dwarfinfo, address):
# Looking for a range of addresses in two consecutive states that
# contain the required address.
if prevstate and prevstate.address <= address < entry.state.address:
# Looking for a range of addresses in two consecutive states that
# contain the required address.
if prevstate and prevstate.address <= address < entry.state.address:
- filename = lineprog['file_entry'][prevstate.file -
1
].name
+ filename = lineprog['file_entry'][prevstate.file -
delta
].name
line = prevstate.line
return filename, line
if entry.state.end_sequence:
line = prevstate.line
return filename, line
if entry.state.end_sequence: