-
Notifications
You must be signed in to change notification settings - Fork 850
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
nearpc
fails to show the symbol name after demangling
#1600
Labels
Comments
Shorter example - compile as struct A {
void foo(int, int) { };
};
int main() {
A a;
a.foo(1, 1);
} |
Heh, the output of |
To give another example: for the symbol above GDB's
And since we split this by 3 spaces we end up with the following split:
And we end up returning an empty string here: # 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 "" |
disconnect3d
added a commit
that referenced
this issue
Mar 5, 2023
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.
disconnect3d
added a commit
that referenced
this issue
Mar 5, 2023
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.
disconnect3d
added a commit
that referenced
this issue
Mar 5, 2023
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.
disconnect3d
added a commit
that referenced
this issue
Mar 5, 2023
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.
disconnect3d
added a commit
that referenced
this issue
Mar 5, 2023
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.
disconnect3d
added a commit
that referenced
this issue
Mar 6, 2023
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.
alufers
pushed a commit
to alufers/pwndbg
that referenced
this issue
Apr 14, 2023
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.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When I learning OOP for C++, I found out this:
As you can see,
nearpc
failed to show the symbol name of the copy constructor(at 0x55f188f6028e) and the assignment operator(at 0x55f188f6034c).It's because the symbol of them after demangling contains spaces and break our logic at here:
pwndbg/pwndbg/gdblib/symbol.py
Lines 92 to 99 in e642461
The text was updated successfully, but these errors were encountered: