Open GoogleCodeExporter opened 8 years ago
This is my analysis of the problem.
* Location descriptors can take two forms - expressions and lists. The current
code only handles the former. In more detail __init__ for DIE assumes that all
DW_AT_location and DW_AT_data_member_location attributes must be of one of the
"block" forms. Which is true for "expression" location descriptors. But is not
true for "list" location descriptors (they are encoded as a "data" form).
* The opposite problem exists for DW_AT_frame_base. The code currently assumes
that those are all location lists. But DW_AT_frame_base can also be a location
expression.
I've tested fixes for these problems but am unable to share those at this stage
due to internal company restrictions. I will post the diff as soon as I get
approval. But perhaps the above analysis is enough for the official code
maintainers to push out a fix earlier.
Original comment by alan.q...@gmail.com
on 6 Jan 2012 at 12:46
Have you tried the latest version directly from SVN? I made some changes on
this code about a month ago, so it might already work.
Original comment by stefan.h...@gmail.com
on 19 Jan 2012 at 6:15
Yep, the latest code works better and seems to have resolved this problem.
Though I did have to work around this new problem:
$ ./dwarfdump.py
Traceback (most recent call last):
File "./dwarfdump.py", line 20, in <module>
benchmark(dwarfdump, file_path)
File "../bintools/utils/__init__.py", line 90, in benchmark
func(*args, **kargs)
File "./dwarfdump.py", line 10, in dwarfdump
dwarf = DWARF(file_path)
File "../bintools/dwarf/__init__.py", line 35, in __init__
self.info = DebugInfoLoader(self)
File "../bintools/dwarf/info.py", line 162, in __init__
cu = CU(dwarf, overall_offset)
File "../bintools/dwarf/info.py", line 105, in __init__
die = DIE(dwarf, self, abbrevs, level)
File "../bintools/dwarf/info.py", line 59, in __init__
a = Attrib(cu, attrib_form)
File "../bintools/dwarf/info.py", line 17, in __init__
self.value = self.cu.dwarf.read_form(attrib_form.form)
File "../bintools/dwarf/stream.py", line 85, in read_form
return self.read_type(DW_FORM[form])
File "../bintools/dwarf/stream.py", line 81, in read_type
return getattr(self, 'read_'+type_name)()
File "../bintools/dwarf/stream.py", line 94, in read_string
if not c[0]: break
IndexError: string index out of range
Original comment by alan.q...@gmail.com
on 19 Jan 2012 at 11:29
Ups! That was my bad. I'm using Python3, so I forgot to check for Python2
compatibility before commit.
r29 should have that fixed. Please double check that it works for you. Then we
can close this issue. Thanks!
Original comment by stefan.h...@gmail.com
on 21 Jan 2012 at 6:37
Original issue reported on code.google.com by
atc...@gmail.com
on 29 Dec 2010 at 7:39