Builder imported itself#637
Merged
kristoff3r merged 1 commit intoGallopsled:masterfrom Jul 3, 2016
Merged
Conversation
Kyle-Kyle
pushed a commit
to Kyle-Kyle/pwntools
that referenced
this pull request
Apr 25, 2021
…led#637) TLDR: 1. We read registers from `newest_frame` instead of `selected_frame` for GDB>=7.9. 2. We have two ways to fetch registers - `regs.__getitem__` and `regs.__getattr__` - one of them didn't invalidate cache and so after fixing 1st, we still shown the old register after switching frames.
Kyle-Kyle
pushed a commit
to Kyle-Kyle/pwntools
that referenced
this pull request
Apr 25, 2021
* Fix source code display Fixes and simplifies source code display in `context code`. The reasoning below. --- It turns out that we determine the source code line for known code in a tricky and buggy way. It is wrong when we are deep inside many calls and we go to upper frame via e.g. `up` and then display the `context code`. And this also occurs after applying the PR Gallopsled#637 before/after this fix. We also do `except` all exceptions happening in the source code retrieval which makes it hard to spot potential bugs in this code path. This commit removes the `except` path and checks for particular edge cases where we wouldn't have sources available. --- Also note the `FileNotFoundError` path - in this case the debug symbols have a source file path there, but it hasn't been found by us. It might be because the program (or anything else) removed it OR maybe we debug remotely etc (not sure if this is the case). This being said, we could potentially inform the users about that BUT... GDB already does that by itself - maybe in a bit vague way, as it does it before us displaying the context e.g.: ``` pwndbg> r Starting program: /home/dc/pwndbg/a.out Program received signal SIGSEGV, Segmentation fault. 0x000055555555460a in foo () at ./a.c:2 2 ./a.c: No such file or directory. LEGEND: STACK | HEAP | CODE | DATA | RWX | RODATA // (the rest of the context here) ``` But I am fine with that for now - and I am not sure if we could even suppress this warning (oh, maybe this string comes to us into prompt hook/event? I don't know) * Fix wrong code line if source startswith newlines For some reason the `pygments.hightlight` remove newlines at start. We need to preserve them in order to keep proper code lines. * Use lexer's stripnl=False
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.