[Lldb-commits] [PATCH] D136938: [LLDB] Fix code breakpoints on tagged addresses

Jason Molenda via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Dec 19 09:14:53 PST 2022


jasonmolenda added a comment.

In D136938#4005138 <https://reviews.llvm.org/D136938#4005138>, @DavidSpickett wrote:

>> What do you think about locating this change in ToAddress instead of Target::GetBreakableLoadAddress? It looks like the one caller to GetBreakableLoadAddress is Target::CreateBreakpoint(addr_t addr) - which is probably called by an SBTarget method if we want to think of the most general purpose use case. I think stripping non-addressable bits in OptionArgParser::ToAddress is the right thing to do - but I don't have an opinion about whether it should be done in Target::GetBreakableLoadAddress or not.
>
> I had not checked the other lookup commands, so yeah this sounds good to me. Doing this fixing in fewer places is always better. Put up your change and I'll check the test from this patch against it.

OK sounds good, I'll put up a phab.  I can't test it on macOS platforms because the bots won't be able to build & run arm64e (ARMv8.3 w/ ptrauth) binaries. :/

>> One thing to note is that I also have an SBValue method that needs to be upstreamed, SBValue::GetValueAsAddress(). So if someone has an SBValue of a function pointer and they want to take the value of that func ptr and call SBTarget::CreateBreakpoint on it, I would say "well yes, you need to use GetValueAsAddress before you pass that to CreateBreakpoint".
>
> If I understand correctly, this would effectively run FixCodeAddress on the value? One thing that I found doing the SB API for MTE (which was shelved, but besides the point) is that there was no way to fix addresses via the API (or get access to the ABI plugin in general). I ended up just adding FixDataAddress to SBProcess as a temporary thing. So something like ValueAsAddress could be very useful.

Yeah my SBValue::GetValueAsAddress() simply passed it through FixCodeAddress which was correct enough for our current environment, but SBValue may have access to type information so maybe it could pick the correct Fix method to call given that information?

I've had some scripting people who also want methods to clear non-addressable bits in SBProcess, as they handle signed pointers in their own scripts, it's something I've been meaning to do for them -- or give them a way to get the address fixing bitmasks.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D136938/new/

https://reviews.llvm.org/D136938



More information about the lldb-commits mailing list