Skip to content
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

Localsplus and details #4

Merged
merged 10 commits into from
Jan 14, 2021
Merged

Conversation

radoering
Copy link
Contributor

@SeanCline: At first, thank you for the great tool! We have been using it for some years and it really simplifies the analysis of Python dumps a lot!

In the last few weeks, I implemented some enhancements to make it even more comfortable to analyse Python dumps:

  1. When using !pyobj, there is a new section "Details" at the end. There, names and values of attributes (slots and dict) of the object are displayed. This is especially useful for objects of user defined classes.

  2. When calling repr() with pretty=true, the representation of PyObjects contains a link to the PyObject. This is especially useful for dicts containing objects of user defined classes and thus for investigating an attribute of an object in more detail.

  3. When using !pystack, there is a link to each PyFrameObject. In the "details" of the frame, the names and values of localsplus (local, cell and free variables) are displayed.

With these enhancements, it is often sufficient to call !pystack and then just click on links to navigate to the object of interest.

I also wrote some tests for the new features (tested locally with Python 2.7, 3.3, 3.4, 3.5, 3.6, 3.7, 3.8).

Maybe you like the enhancements and want to merge them?

@SeanCline
Copy link
Owner

Wow, this is amazing work! I'm glad you've found PyExt useful.

This pull request looks good enough to accept as-is. There are a few things I might end up touching up later. For example, I'll probably go back to the v141 toolchain. Microsoft's EngExtCpp has trouble building on newer versions of v142 for me, so I'm playing it safe for now.

There are a couple warnings (signed/unsigned mismatch, narrowing conversion) that I'll have to look at. Also, I'm not sure how I feel about repr() returning a DML string, but I can't put my finger on why that feels weird.

Thanks for spending so much time working on this, and contributing your changes!

@radoering
Copy link
Contributor Author

Thanks for the feedback!

Actually, repr() returning a DML string felt strange to me, too. However, I could not come up with a better solution:

  • I thought about just including addresses and replacing them by links later. But then, there would be the danger of inserting links by mistake (e.g. in the representation of strings that contain something that looks like an address).
  • I thought about including some (kind of) distinguishable marker but that seemed like having the disadvantages of both alternatives (there is something weird in the repr and you have to replace it later).
  • I thought about introducing a new method but then I probably would have replaced each call of repr(true) by the new method.

@sparrowt
Copy link
Contributor

Just wanted to say thank you @radoering - clicking through [Frame] and then following locals is a brilliant addition to this already-awesome tool and just helped me debug a hang. Awesome stuff ❤

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants