omjavaid added a comment. In D71498#1786341 <https://reviews.llvm.org/D71498#1786341>, @clayborg wrote:
> As I am reading this, I just wanted to send out a note of something else that > can cause crashes in ARM/Thumb code. For anyone working with ARM/Thumb on > systems that don't use the ARM and Thumb BKPT instruction when setting > software breakpoints (like all lldb linux and android flavors IIRC): if you > try to overwrite a 32 bit thumb instruction that is a conditional instruction > in a Thumb IT instruction with a 16 bit trap or illegal instruction you can > crash your program. The issue arises for code like: > > 0x1000: xx xx ITTTEE > 0x1002: 00 11 22 33 32 bit thumb instruction (if condition) > 0x1006: 44 55 66 77 32 bit thumb instruction (if condition) > 0x100a: 88 99 aa bb 32 bit thumb instruction (else condition) > 0x100e: cc dd ee ff 32 bit thumb instruction (else condition) > > > If you try to set a breakpoint at any of the instructions in [0x1002-0x100e) > using a 16 bit trap or illegal instruction (I use "bb bb" below for this trap > for example purposes), you change the size of the instructions and which > instructions are conditional. If we try to write "bb bb" to 0x1002 we now > have: > > 0x1000: xx xx ITTTEE > 0x1002: bb bb (if condition) the first conditional instruction is > now 16 bit instead of 32 bit > 0x1004: 22 33 44 55 (if condition) this has the last half of the previous > instruction > 0x1008: 66 77 88 99 (else condition) this has the last half of the > previous instruction > 0x100c: aa bb (else condition) this has the last half of the > previous instruction > 0x100e: cc dd ee ff 32 bit thumb instruction (NOT conditional anymore) > > > This will work if using the BKPT instruction only. Sorry for the noise if > lldb-server is already using the BKPT instruction. But I just wanted to throw > this out there in case this issue if affecting anyone. I do have this thing on my future agenda but it requires wider testing. When BKPT was implemented in lldb-server back when we were initially adding support for arm/linux, we encountered some unsupported behavior which i dont remember exactly that resulted in sticking with legacy behavior. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D71498/new/ https://reviews.llvm.org/D71498 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits