-
Notifications
You must be signed in to change notification settings - Fork 849
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
Backtrace in context output is missing symbols compared to "backtrace" output #752
Comments
How about replace Since currrent code use If you think this is a good idea, I will make a PR. @disconnect3d |
Just for reference: https://github.com/pwndbg/pwndbg/blob/dev/pwndbg/commands/context.py#L544-L590 Can it be related to symbols being mangled/demangled somewhere and us having incorrect names or something? Also, what does the current backtrace give us over the original one? Maybe it can show symbols if we synchronize pwndbg with ida? Or handle some corrupted stack trace better and display the addresses? I think we could try with your approach, though it would be nice to understand why it is made as it is made in the first place and see if we can fix that somehow. |
Yes, the current backtrace should sync with IDA. |
This is referenced anyway, but just not to loose this: there was an attempt in #754 to fix this. |
This commit adds a fix and tests for #1600 and #752. * #1600 * #752 Generally, for an example like this: ```cpp struct A { void foo(int, int) { }; }; int main() { A a; a.foo(1, 1); } ``` The output for `info symbol <address of A::foo>` returns: ``` 'A::foo(int, int) [clone.isra.0] + 3 in section .text of /root/pwndbg/tests/gdb-tests/tests/binaries/a.out\n' ``` We then used this code to parse this: ```py # Expected format looks like this: # main in section .text of /bin/bash # main + 3 in section .text of /bin/bash # system + 1 in section .text of /lib/x86_64-linux-gnu/libc.so.6 # No symbol matches system-1. a, b, c, _ = result.split(maxsplit=3) if b == "+": return "%s+%s" % (a, c) if b == "in": return a return "" ``` The `result.split(maxsplit=3)` here splitted the string to: ```py ['A::foo(int,', 'int)', '[clone.isra.0] + 3 in section .text of /root/pwndbg/tests/gdb-tests/tests/binaries/a.out\n'] ``` And since `b` was not `"+"` or `"in"` we eventually returned an empty string instead of the `A::foo(int, int)` which would be expected here.
This commit adds a fix and tests for #1600 and #752. * #1600 * #752 Generally, for an example like this: ```cpp struct A { void foo(int, int) { }; }; int main() { A a; a.foo(1, 1); } ``` The output for `info symbol <address of A::foo>` returns: ``` 'A::foo(int, int) [clone.isra.0] + 3 in section .text of /root/pwndbg/tests/gdb-tests/tests/binaries/a.out\n' ``` We then used this code to parse this: ```py # Expected format looks like this: # main in section .text of /bin/bash # main + 3 in section .text of /bin/bash # system + 1 in section .text of /lib/x86_64-linux-gnu/libc.so.6 # No symbol matches system-1. a, b, c, _ = result.split(maxsplit=3) if b == "+": return "%s+%s" % (a, c) if b == "in": return a return "" ``` The `result.split(maxsplit=3)` here splitted the string to: ```py ['A::foo(int,', 'int)', '[clone.isra.0] + 3 in section .text of /root/pwndbg/tests/gdb-tests/tests/binaries/a.out\n'] ``` And since `b` was not `"+"` or `"in"` we eventually returned an empty string instead of the `A::foo(int, int)` which would be expected here.
This commit adds a fix and tests for #1600 and #752. * #1600 * #752 Generally, for an example like this: ```cpp struct A { void foo(int, int) { }; }; int main() { A a; a.foo(1, 1); } ``` The output for `info symbol <address of A::foo>` returns: ``` 'A::foo(int, int) [clone.isra.0] + 3 in section .text of /root/pwndbg/tests/gdb-tests/tests/binaries/a.out\n' ``` We then used this code to parse this: ```py # Expected format looks like this: # main in section .text of /bin/bash # main + 3 in section .text of /bin/bash # system + 1 in section .text of /lib/x86_64-linux-gnu/libc.so.6 # No symbol matches system-1. a, b, c, _ = result.split(maxsplit=3) if b == "+": return "%s+%s" % (a, c) if b == "in": return a return "" ``` The `result.split(maxsplit=3)` here splitted the string to: ```py ['A::foo(int,', 'int)', '[clone.isra.0] + 3 in section .text of /root/pwndbg/tests/gdb-tests/tests/binaries/a.out\n'] ``` And since `b` was not `"+"` or `"in"` we eventually returned an empty string instead of the `A::foo(int, int)` which would be expected here.
This commit adds a fix and tests for #1600 and #752. * #1600 * #752 Generally, for an example like this: ```cpp struct A { void foo(int, int) { }; }; int main() { A a; a.foo(1, 1); } ``` The output for `info symbol <address of A::foo>` returns: ``` 'A::foo(int, int) [clone.isra.0] + 3 in section .text of /root/pwndbg/tests/gdb-tests/tests/binaries/a.out\n' ``` We then used this code to parse this: ```py # Expected format looks like this: # main in section .text of /bin/bash # main + 3 in section .text of /bin/bash # system + 1 in section .text of /lib/x86_64-linux-gnu/libc.so.6 # No symbol matches system-1. a, b, c, _ = result.split(maxsplit=3) if b == "+": return "%s+%s" % (a, c) if b == "in": return a return "" ``` The `result.split(maxsplit=3)` here splitted the string to: ```py ['A::foo(int,', 'int)', '[clone.isra.0] + 3 in section .text of /root/pwndbg/tests/gdb-tests/tests/binaries/a.out\n'] ``` And since `b` was not `"+"` or `"in"` we eventually returned an empty string instead of the `A::foo(int, int)` which would be expected here.
This commit adds a fix and tests for #1600 and #752. * #1600 * #752 Generally, for an example like this: ```cpp struct A { void foo(int, int) { }; }; int main() { A a; a.foo(1, 1); } ``` The output for `info symbol <address of A::foo>` returns: ``` 'A::foo(int, int) [clone.isra.0] + 3 in section .text of /root/pwndbg/tests/gdb-tests/tests/binaries/a.out\n' ``` We then used this code to parse this: ```py # Expected format looks like this: # main in section .text of /bin/bash # main + 3 in section .text of /bin/bash # system + 1 in section .text of /lib/x86_64-linux-gnu/libc.so.6 # No symbol matches system-1. a, b, c, _ = result.split(maxsplit=3) if b == "+": return "%s+%s" % (a, c) if b == "in": return a return "" ``` The `result.split(maxsplit=3)` here splitted the string to: ```py ['A::foo(int,', 'int)', '[clone.isra.0] + 3 in section .text of /root/pwndbg/tests/gdb-tests/tests/binaries/a.out\n'] ``` And since `b` was not `"+"` or `"in"` we eventually returned an empty string instead of the `A::foo(int, int)` which would be expected here.
This commit adds a fix and tests for #1600 and #752. * #1600 * #752 Generally, for an example like this: ```cpp struct A { void foo(int, int) { }; }; int main() { A a; a.foo(1, 1); } ``` The output for `info symbol <address of A::foo>` returns: ``` 'A::foo(int, int) [clone.isra.0] + 3 in section .text of /root/pwndbg/tests/gdb-tests/tests/binaries/a.out\n' ``` We then used this code to parse this: ```py # Expected format looks like this: # main in section .text of /bin/bash # main + 3 in section .text of /bin/bash # system + 1 in section .text of /lib/x86_64-linux-gnu/libc.so.6 # No symbol matches system-1. a, b, c, _ = result.split(maxsplit=3) if b == "+": return "%s+%s" % (a, c) if b == "in": return a return "" ``` The `result.split(maxsplit=3)` here splitted the string to: ```py ['A::foo(int,', 'int)', '[clone.isra.0] + 3 in section .text of /root/pwndbg/tests/gdb-tests/tests/binaries/a.out\n'] ``` And since `b` was not `"+"` or `"in"` we eventually returned an empty string instead of the `A::foo(int, int)` which would be expected here.
This commit adds a fix and tests for #1600 and #752. * #1600 * #752 Generally, for an example like this: ```cpp struct A { void foo(int, int) { }; }; int main() { A a; a.foo(1, 1); } ``` The output for `info symbol <address of A::foo>` returns: ``` 'A::foo(int, int) [clone.isra.0] + 3 in section .text of /root/pwndbg/tests/gdb-tests/tests/binaries/a.out\n' ``` We then used this code to parse this: ```py # Expected format looks like this: # main in section .text of /bin/bash # main + 3 in section .text of /bin/bash # system + 1 in section .text of /lib/x86_64-linux-gnu/libc.so.6 # No symbol matches system-1. a, b, c, _ = result.split(maxsplit=3) if b == "+": return "%s+%s" % (a, c) if b == "in": return a return "" ``` The `result.split(maxsplit=3)` here splitted the string to: ```py ['A::foo(int,', 'int)', '[clone.isra.0] + 3 in section .text of /root/pwndbg/tests/gdb-tests/tests/binaries/a.out\n'] ``` And since `b` was not `"+"` or `"in"` we eventually returned an empty string instead of the `A::foo(int, int)` which would be expected here.
This should be fixed by #1605 |
This commit adds a fix and tests for pwndbg#1600 and pwndbg#752. * pwndbg#1600 * pwndbg#752 Generally, for an example like this: ```cpp struct A { void foo(int, int) { }; }; int main() { A a; a.foo(1, 1); } ``` The output for `info symbol <address of A::foo>` returns: ``` 'A::foo(int, int) [clone.isra.0] + 3 in section .text of /root/pwndbg/tests/gdb-tests/tests/binaries/a.out\n' ``` We then used this code to parse this: ```py # Expected format looks like this: # main in section .text of /bin/bash # main + 3 in section .text of /bin/bash # system + 1 in section .text of /lib/x86_64-linux-gnu/libc.so.6 # No symbol matches system-1. a, b, c, _ = result.split(maxsplit=3) if b == "+": return "%s+%s" % (a, c) if b == "in": return a return "" ``` The `result.split(maxsplit=3)` here splitted the string to: ```py ['A::foo(int,', 'int)', '[clone.isra.0] + 3 in section .text of /root/pwndbg/tests/gdb-tests/tests/binaries/a.out\n'] ``` And since `b` was not `"+"` or `"in"` we eventually returned an empty string instead of the `A::foo(int, int)` which would be expected here.
Description
The backtrace shown in the
context
output isn't showing all the symbol information that's available compared to the output ofbt
. I'd expect the symbols to be shown in thecontext
view as well.Steps to reproduce
I've stumbled upon this while debugging a build with debug symbols enabled. Run with
docker build -t pwn . && docker run --rm -it --cap-add=SYS_PTRACE pwn
and runbt
in the gdb shell. Sorry for the big, slow testcase.My setup
The text was updated successfully, but these errors were encountered: