KEMBAR78
gh-107758: Improvements to lltrace feature by gvanrossum · Pull Request #107757 · python/cpython · GitHub
Skip to content

Conversation

@gvanrossum
Copy link
Member

@gvanrossum gvanrossum commented Aug 8, 2023

  • The dump_stack() method could call a __repr__ method implemented in Python, causing (infinite) recursion.
    I rewrote it to only print out the values for some fundamental types (int, str, etc.);
    for everything else it just prints <type_name @ 0xdeadbeef>.
  • The lltrace-like feature for uops wrote to stderr, while the one in ceval.c writes to stdout; I changed the uops to write to stdout as well.

CC @sweeneyde because you added dump_stack(), @brandtbucher because you mentioned being baffled by the recursion.

- Don't call Python __repr__ in debug_stack(), to avoid recursion
- Remove the comment warning against dump_stack()
- Add lltrace_resume_frame() call when resuming after exception_unwind
- Set lltrace when $PYTHONUOPSDEBUG >= 4
@gvanrossum gvanrossum requested a review from markshannon as a code owner August 8, 2023 02:25
@gvanrossum gvanrossum changed the title Improvements to lltrace feature gh-107758: Improvements to lltrace feature Aug 8, 2023
@sweeneyde
Copy link
Member

I'm on mobile at the moment, but this change makes sense conceptually to make sure the lltrace output isn't causing any issues during debugging (debugging is hard enough already!).

I haven't played around much with the uops yet, so I can't say much about the change to add the lltrace output to the uop tracing.

Also, I think I do remember wanting to print out list-of-primitive or tuple-of-primitive, but I don't remember the context. That could always be added back later if needed.

@gvanrossum
Copy link
Member Author

Also, I think I do remember wanting to print out list-of-primitive or tuple-of-primitive, but I don't remember the context. That could always be added back later if needed.

Yeah, that would be more complicated than I feel like doing ATM (probably requiring a helper function -- and what to do about nesting those).

I'll just merge this, so I can move forward with the PR that depends on it.

@gvanrossum gvanrossum merged commit 328d925 into python:main Aug 8, 2023
@gvanrossum gvanrossum deleted the lltrace-fixes branch August 8, 2023 04:36
@brandtbucher
Copy link
Member

Thanks!

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.

4 participants