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

Add c++ symbol support in xinfo. #1028

Merged
merged 4 commits into from Dec 21, 2023
Merged

Conversation

r12f
Copy link
Contributor

@r12f r12f commented Dec 20, 2023

Description

This change adds c++ symbol support in xinfo.

Currently, when using xinfo to get the symbol information in C++ programs, we might get incomplete data as below:

image

This is because the gdb_get_location_from_symbol function could not handle space in the symbol name.

image

This change updates the gdb_get_location_from_symbol, so we can handle the space. It makes xinfo produces expected result.

Here is the screenshot that demos the output after the change:
image

  • My code follows the code style of this project.
  • [N/A] My change includes a change to the documentation, if required.
  • If my change adds new code, adequate tests have been added.
  • I have read and agree to the CONTRIBUTING document.

@r12f
Copy link
Contributor Author

r12f commented Dec 20, 2023

More example symbol names in C++:

typeinfo name for std::istream in section .rodata of /lib/x86_64-linux-gnu/libstdc++.so.6
vtable for B + 16 in section .data.rel.ro of /home/r12f/data/code/test/test

Copy link
Owner

@hugsy hugsy left a comment

Choose a reason for hiding this comment

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

yet another great PR, with simple explicit tests! thanks!

@r12f
Copy link
Contributor Author

r12f commented Dec 20, 2023

thank-you for reviewing the PR!

gef.py Outdated Show resolved Hide resolved
gef.py Show resolved Hide resolved
tests/commands/xinfo.py Show resolved Hide resolved
@r12f
Copy link
Contributor Author

r12f commented Dec 21, 2023

updated and addressed comments.

@Grazfather Grazfather merged commit 023b1a9 into hugsy:main Dec 21, 2023
4 of 5 checks passed
@r12f r12f deleted the user/r12f/xinfo branch December 21, 2023 02:20
@hugsy hugsy added this to the 2024.01 milestone Dec 22, 2023
Grazfather pushed a commit that referenced this pull request Dec 22, 2023
This change renames the tests.utils._target function to
tests.utils.debug_target

Currently, many tests are required to access the `_target` function in
test_utils for building proper test cases. Hence, it is better to remove
the _ prefix for this function, give it a more proper name, really make
it public.

This requirement comes from the discussion here:
#1028 (comment).
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.

None yet

3 participants