-
-
Notifications
You must be signed in to change notification settings - Fork 746
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
bp_prefix not set on breakpoints declared with function name instead of hex_address ( #1039
Comments
Yeah that is not good. We could try to resolve the |
For breakpoints = gdb.execute("info breakpoints", to_string=True)
bp_locations = re.findall(r'0x[0-9a-f]+', breakpoints) For parsing if GDB_VERSION >= (13, 1):
bp_locations = [location.address for b in breakpoints for location in b.locations if location is not None]
else:
bp_locations = [self.parse_location(b.location) for b in breakpoints if b.location is not None]
@lru_cache()
def parse_location(self, location: str) -> int:
exact = False
if location.startswith("*"):
location = location[1:].strip() # Remove leading spaces
if location.startswith("0x"):
return int(location, 16)
elif location.isdigit():
return int(location)
exact = True
location = location.split("+") # Can a symbol have a
if len(location) == 2:
symbol, offset = map(lambda x: x.strip(), location)
else:
symbol, offset = location[0], 0
base_address = self.parse_symbol(symbol, exact=exact)
def parse_symbol(self, symbol: str, exact=True) -> int:
#TODO |
So that you can For registers, that is tough, since the register value basically becomes irrelevant immediately after it's set. I think that we should use What is your part with |
I didn't think about these cases. Okay 👍
I'm still on version 12.1 so I was looking for a docker to test it and for now I only sketched it based on the documentation. "Variable: Breakpoint.locations. Get the most current list of breakpoint locations that are inserted for this breakpoint". You may end up with a breakpoint in multiple locations if you set it on a line of the source code. Regarding what to do now, I looked at the performances of |
Thank you for testing the speed. I say we add just the hasattr, and basically behave better if we can. |
gef/gef.py
Line 7571 in deeab2f
gef/gef.py
Lines 7578 to 7579 in deeab2f
gef/gef.py
Line 7589 in deeab2f
gef/gef.py
Line 7593 in deeab2f
gef/gef.py
Lines 7568 to 7569 in deeab2f
b.location
is just the string used by the user to set the breakpoint not its address, so the current code relies on the user using an hexadecimal address and doesn't handle breakpoints set on a function.Would it be worth it to parse
info breakpoints
to extract all the addresses instead of ignoring some breakpoints ?I also considered parsing
b.location
and look for the address from the symbol name, but I still have troubles with that part of the API and we would have to handle ourselves the differences between declarations such asb <fun>
,b *<fun>
andb *'<fun>'+<offset>
.GDB 13.1 did introduce
Breakpoint.locations
that can return the exact address, but I don't think it's an option since it relies on a recent version of gdb.The text was updated successfully, but these errors were encountered: