moyix / pdbparse

Python code to parse Microsoft PDB files
Other
309 stars 83 forks source link

AttributeError: type_info #17

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hi BDG,

I ran into exceptions parsing this pdb.

My environments:
- python 2.7
- pdbparse from pypi
- construct 2.5.1 from mint 16(ubuntu 13.10) apt-get install.

in my script I called pdbparse like this:
> pdb = pdbparse.parse(pdbFile) 

and exception occurred in tpi.py:
>  File "/usr/local/lib/python2.7/dist-packages/pdbparse/tpi.py", line 940, in 
merge_subcon
>    subcon = getattr(parent, subattr)
>  File 
"/usr/local/lib/python2.7/dist-packages/construct-2.5.1-py2.7.egg/construct/lib/
container.py", line 35, in __getattr__
>    raise AttributeError(name)
> AttributeError: type_info

I took a look into the code and in tpi.py Line 942:
> for a in (k for k in dir(subcon) if not k.startswith("_")):

dir(subcon) returns all methods of subcon, instead of its dict keys.

I tried to change it to "for k in subcon.keys()", and another 
construct.adapters.MappingError popped out:

>  File "./dumpPDB.py", line 159, in dump_types
>    pdb = pdbparse.parse(pdbFile) #call the parse function in __init__ of the 
pdbparse library
>  File "/usr/local/lib/python2.7/dist-packages/pdbparse/__init__.py", line 
439, in parse
>    return PDB7(f, fast_load)
>  File "/usr/local/lib/python2.7/dist-packages/pdbparse/__init__.py", line 
406, in __init__
>    self.read_root(self.root_stream)
>  File "/usr/local/lib/python2.7/dist-packages/pdbparse/__init__.py", line 
363, in read_root
>    parent=self))
>  File "/usr/local/lib/python2.7/dist-packages/pdbparse/__init__.py", line 
106, in __init__
>    else: self.load()
>  File "/usr/local/lib/python2.7/dist-packages/pdbparse/__init__.py", line 
215, in load
>    debug = dbi.parse_stream(self.stream_file)
>  File "/usr/local/lib/python2.7/dist-packages/pdbparse/dbi.py", line 83, in 
parse_stream
>    dbihdr = DBIHeader.parse_stream(stream)
>  File 
"/usr/local/lib/python2.7/dist-packages/construct-2.5.1-py2.7.egg/construct/core
.py", line 197, in parse_stream
>    return self._parse(stream, Container())
>  File 
"/usr/local/lib/python2.7/dist-packages/construct-2.5.1-py2.7.egg/construct/core
.py", line 661, in _parse
>    subobj = sc._parse(stream, context)
>  File 
"/usr/local/lib/python2.7/dist-packages/construct-2.5.1-py2.7.egg/construct/core
.py", line 287, in _parse
>    return self._decode(self.subcon._parse(stream, context), context)
>  File 
"/usr/local/lib/python2.7/dist-packages/construct-2.5.1-py2.7.egg/construct/adap
ters.py", line 99, in _decode
    obj, self.subcon.name))
> construct.adapters.MappingError: no decoding mapping for 0 [Machine]

The Windows_XP.pdb is attached.

Original issue reported on code.google.com by xulai1...@gmail.com on 3 Apr 2014 at 11:47

Attachments:

GoogleCodeExporter commented 9 years ago
The pypi version has gotten quite old at this point and I really need to make a 
new upload for it. The PDB you attached works fine with the current SVN 
version. Let me know if you have any further issues.

Original comment by moo...@gmail.com on 3 Apr 2014 at 8:09

GoogleCodeExporter commented 9 years ago
Hi BDG,

I checked out the latest version(1.1) and it works.

Many thanks!

Original comment by xulai1...@gmail.com on 10 Apr 2014 at 1:29