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

correct parsing in gdb_get_location_from_symbol #1037

Merged
merged 2 commits into from
Jan 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions gef.py
Original file line number Diff line number Diff line change
Expand Up @@ -2021,8 +2021,8 @@ def gdb_get_location_from_symbol(address: int) -> Optional[Tuple[str, int]]:
# gdb outputs symbols with format: "<symbol_name> + <offset> in section <section_name> of <file>",
# here, we are only interested in symbol name and offset.
i = sym.find(" in section ")
sym = sym[:i].split("+")
name, offset = sym[0].strip(), 0
sym = sym[:i].split(" + ")
name, offset = sym[0], 0
if len(sym) == 2 and sym[1].isdigit():
offset = int(sym[1])
return name, offset
Expand Down
6 changes: 3 additions & 3 deletions tests/commands/xinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ def test_cmd_xinfo(self):
self.assertTrue(len(res.splitlines()) >= 7)

def test_cmd_xinfo_on_class(self):
cmd = "xinfo $pc"
cmd = "xinfo $pc+4"
target = debug_target("class")
res = gdb_run_silent_cmd(cmd, target=target, before=["b B<TraitA, TraitB>::Run()"])
res = gdb_run_silent_cmd(cmd, target=target, before=["b *'B<TraitA, TraitB>::Run'"])
self.assertNoException(res)
self.assertIn("Symbol: B<TraitA, TraitB>::Run", res)
self.assertIn("Symbol: B<TraitA, TraitB>::Run()+4", res)
Copy link
Owner

Choose a reason for hiding this comment

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

🔥

Loading