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

Don't catch the error of the heap commands when set exception-* on #1270

Merged
merged 3 commits into from
Oct 12, 2022

Conversation

lebr0nli
Copy link
Contributor

Fix the nightmare when debugging the heap commands (#1242 (comment))

@lebr0nli
Copy link
Contributor Author

lebr0nli commented Oct 11, 2022

@CptGibbon, could you verify whether this fix works or not? Thanks!

@@ -276,6 +277,9 @@ def _OnlyWithResolvedHeapSyms(*a, **kw):
e = lambda s: print(message.error(s))
w = lambda s: print(message.warn(s))
if pwndbg.heap.current.can_be_resolved():
# We don't catch the error for developers, only catch for users.
if gdb.parameter("exception-verbose") or gdb.parameter("exception-debugger"):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should:

  • fetch those through pwndbg.config.exception_verbose and pwndbg.config.exception_debugger
  • move this to the exception case and re-raise the err except Exception as err: if ...: raise err

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I'll fix it with your suggestions!

Copy link
Member

@disconnect3d disconnect3d left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see comment

@codecov-commenter
Copy link

Codecov Report

Merging #1270 (9cf06d9) into dev (bfbb2b8) will increase coverage by 0.33%.
The diff coverage is 16.66%.

@@            Coverage Diff             @@
##              dev    #1270      +/-   ##
==========================================
+ Coverage   54.45%   54.79%   +0.33%     
==========================================
  Files         182      182              
  Lines       20214    20236      +22     
  Branches     1865     1872       +7     
==========================================
+ Hits        11008    11088      +80     
+ Misses       8783     8732      -51     
+ Partials      423      416       -7     
Impacted Files Coverage Δ
pwndbg/commands/__init__.py 69.72% <16.66%> (-0.87%) ⬇️
pwndbg/commands/mprotect.py 100.00% <0.00%> (ø)
pwndbg/commands/context.py 63.09% <0.00%> (+0.68%) ⬆️
tests/test_commands_next.py 96.77% <0.00%> (+1.12%) ⬆️
pwndbg/gdblib/proc.py 78.26% <0.00%> (+1.51%) ⬆️
pwndbg/gdblib/regs.py 69.73% <0.00%> (+3.52%) ⬆️
pwndbg/color/disasm.py 84.31% <0.00%> (+3.92%) ⬆️
pwndbg/gdblib/next.py 66.01% <0.00%> (+6.64%) ⬆️
pwndbg/disasm/arch.py 78.94% <0.00%> (+9.77%) ⬆️
pwndbg/arguments.py 70.90% <0.00%> (+11.81%) ⬆️
... and 2 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@CptGibbon
Copy link
Contributor

I'll take a look today, thanks for changing this.

@CptGibbon CptGibbon added the heap label Oct 11, 2022
@CptGibbon
Copy link
Contributor

This does indeed print out a backtrace when set exception-verbose on is used 👍

@disconnect3d disconnect3d merged commit 75ece8e into pwndbg:dev Oct 12, 2022
@lebr0nli lebr0nli deleted the heap-error-handling-fix branch November 15, 2022 14:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

None yet

4 participants