mstorsjo added a comment.

In D109777#3001429 <https://reviews.llvm.org/D109777#3001429>, @DavidSpickett 
wrote:

> https://docs.microsoft.com/en-us/cpp/intrinsics/debugbreak?view=msvc-160 
> confirms the AArch64 breakpoint instruction, were you able to find a source 
> for the Arm/Thumb one?

I don't have a formal source for that one, but compiling a `__debugbreak()` 
with MSVC produces that opcode. As Windows is thumb-only, we can always do a 
breakpoint with that single opcode (even if the targeted instruction happens to 
be a wide thumb2 instruction) without needing to detect betwen arm/thumb mode.

> Otherwise the logic seems fine. It would be good to dedupe these switches, in 
> a file in `Plugins/Process/Windows/Common/`?
> Or move some of this into the register context? Assuming you have access to a 
> register context in all of these places. It's a bit weird to put it there 
> since the only register related thing is the single step bit but that's the 
> only per architecture class at the moment.

You mean the duplication between the "native" and regular versions of the 
classes - or the arch specific switches in otherwise seemingly arch-independent 
code?

(In case it's not familiar to all - the former duplication is because lldb can 
operate in two modes - either with lldb directly controlling the debugged 
process (which is the case without the "native" prefix) or with lldb spawning 
lldb-server which then owns the debugged process (the classes with the "native" 
prefix).)

For the former, I'm not quite familiar enough the how the architecture of these 
things work in practice, but I think those two class hiearchies/families don't 
have much in common, so there's no immediate common place to put shared code 
between the two.

For the latter - I guess it'd maybe be possible to add some extra locally 
defined (not overriding a virtual method from the base classes) methods in the 
register contexts that return the breakpoint opcodes, their sizes and the right 
flag bits...

> (also all the Windows code being in `Windows/Common` is odd but ok not a 
> thing for now)

Yeah that's a bit odd indeed. There's also a few other oddities in the lldb 
tree, like some directiories being capitalized while others aren't, I guess 
it's one of the many cases where it's just not worth the churn to change it.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109777

_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to