New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pr python3 #35

Merged
merged 22 commits into from Jul 21, 2017

Conversation

Projects
None yet
3 participants
@lucasg
Contributor

lucasg commented Jul 17, 2017

Hi,

I've ported your library over Python3 (believe it or not, people still preferentially use pdbparse when working with PDB). Sorry for the massive code changes, but it's not possible to do it incrementally.

I've tested it on:

  • Linux with python 2.7.6 and 3.4.3
  • Windows with python 2.7.6 and 3.5.2

There is probably still some kinks to iron out, even though I tried to be thorough (I even had to do some software archeology to get my hands on a pre-WinXP dll and pdb) :

coverage

(I've ignored undecorate.py, undname.py and postfix_eval.py which not actually used by the library)

Anyway, I'm at your disposal if you have any questions or suggestions about this PR.

L.

lucasg added some commits Jul 10, 2017

Remove xrange
xrange is deprecated in Python3. builtins.range is the correct
compatilibity layer for range functionality
Fix RSDS/NB10 header parsing for Py2/3
As usual, some bytes/str incompatibilities.
Define main functions for script entry points
Doing so allow us to import example scripts as modules.
Make PDB2RootStream return a Py3 compatible stream list
That was done for PDB7RootStream but not for PDB2 (which is understandable
since that PDB format is deprecated for 20 years)
Fix PadAlign predicate
PadAlign rely on ctx._pad. However this attribute may not be defined since
_pad is a construct.Peek(Something) and Peek return None if the sub
construct raise an Error (end of stream for example).

It may be better to use an Adapter instead
Update base_types with thoses in github.com/Microsoft/microsoft-pdb/c…
…vinfo.h

Microsoft is nice enough to finally provide documentation for pdb, we
might as well use it.
Update Enum leaf types values
Same as for basic types, leaf types enum is now public.
@moyix

This comment has been minimized.

Show comment
Hide comment
@moyix

moyix Jul 18, 2017

Owner

Wow, this is awesome! Thanks so much for putting this together! I'm going to run this by the Volatility folks since I believe pdbparse is still in their critical path, but it should be OK to merge after they verify it doesn't break their workflow :)

Owner

moyix commented Jul 18, 2017

Wow, this is awesome! Thanks so much for putting this together! I'm going to run this by the Volatility folks since I believe pdbparse is still in their critical path, but it should be OK to merge after they verify it doesn't break their workflow :)

@lucasg

This comment has been minimized.

Show comment
Hide comment
@lucasg

lucasg Jul 20, 2017

Contributor

I just realized my PR fixes those issues :

Contributor

lucasg commented Jul 20, 2017

I just realized my PR fixes those issues :

@moyix

This comment has been minimized.

Show comment
Hide comment
@moyix

moyix Jul 21, 2017

Owner

I haven't heard back definitively from the Volatility folks, but they tell me that they will be switching to an LLVM-based parser from version 3, so I don't see any harm in merging this now. Thanks again for the PR!

Owner

moyix commented Jul 21, 2017

I haven't heard back definitively from the Volatility folks, but they tell me that they will be switching to an LLVM-based parser from version 3, so I don't see any harm in merging this now. Thanks again for the PR!

@moyix moyix merged commit cc38267 into moyix:master Jul 21, 2017

@lucasg

This comment has been minimized.

Show comment
Hide comment
@lucasg

lucasg Jul 21, 2017

Contributor

Whoops I've just noticed I haven't upstreamed the modifications on the undame C module for the support of Python3 compilation. I'll create another pull request right away.

Contributor

lucasg commented Jul 21, 2017

Whoops I've just noticed I haven't upstreamed the modifications on the undame C module for the support of Python3 compilation. I'll create another pull request right away.

@lucasg lucasg deleted the lucasg:PR_Python3 branch Jul 21, 2017

@@ -1099,16 +1100,16 @@ def enum_pretty_str(enum):
structs = topological_sort(dep_graph)
structs.reverse()
print "/******* Enumerations *******/"
print ("/******* Enumerations *******/")

This comment has been minimized.

@alanhamlett

alanhamlett Jul 27, 2017

There shouldn't be a space between print and (.

@alanhamlett

alanhamlett Jul 27, 2017

There shouldn't be a space between print and (.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment