Open williamleecn opened 4 years ago
This is a bug in MC
, not in lldb
, for what it's worth. you might want too provide a small example where this reproduces (showing that objdump -d
is incorrect is probably the best option).
I upload and shared the file: https://drive.google.com/open?id=1hZ-B3iWnbxNpREem2nauFuI01C3vDYIq
function offset : .text:00003BA8
If we assemble those instructions with MC it says it requires Thumb2, which makes sense.
$ ./llvm-mc --triple thumb --assemble <<< "push.w{r4-r11, lr}; sub.w sp, sp, #900"
.text
<stdin>:1:1: error: instruction requires: thumb2
push.w{r4-r11, lr}; sub.w sp, sp, #900
^
<stdin>:1:21: error: instruction requires: thumb2
push.w{r4-r11, lr}; sub.w sp, sp, #900
^
You can use "--triple thumbv8" and it will succeed, presumably that enables Thumb2. So somewhere along the way from lldb to MC Thumb2 is not being enabled.
First guess is that lldb passes "thumb-2" directly to MC which doesn't actually enable Thumb2 it seems (indeed, you can use a triple of "thumb-foo" and it doesn't reject it either). I'd have to find the source for the "dis" command, I'm not very familiar with lldb's layout.
llvm-mc understands triple of thumb/thumbeb or thumbv[0-9]. I found that thumbv7 is where it enabled Thumb2.
@williamleecn could you see if this works for you?
(lldb) dis -b -A thumbv7
@DavidSpickett It's work, but it's still wrong to display it when pause by single step, and set break point in the thumb2 code occur error: signal SIGSEGV: address access protected
My uneducated guess is that lldb is either using incorrect arguments to MC, or it's not been told specifically what the target is and so is using a default. (maybe from the program file?)
I see from the .ARM.attributes it's built for cortex-a8 which is v7 and has Thumb2. (I don't know if anything here is paying attention to that though)
For clarity can you tell us:
@llvm/issue-subscribers-lldb
Author: None (williamleecn)
The correct should be