llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
27.92k stars 11.52k forks source link

LLDB does not support armvXl, armvXb, armvXlhf, armvXbhf, armvXhf, aarch64l and aarch64b #39488

Open llvmbot opened 5 years ago

llvmbot commented 5 years ago
Bugzilla Link 40141
Version unspecified
OS All
Attachments Patch for 5.0.2, Patch for 6.0.1
Reporter LLVM Bugzilla Contributor

Extended Description

I tried to debug an application on armv7l-linux but it did not work. I applied the below patch, but the result was the same. https://github.com/hpux735/swift-lldb/commit/e3e023f54c69512a77a87dfc328b3a8e75a9e185

The behavior of current LLDB + above patch: I set a breakpoint at line 6, but not worked after line 16. LLDB changed arch arm-*-linux-eabihf to armv7l-unknown-unknown at line 8-12. I was not able to set breakpoint at line 13.

1 (lldb) file ~/a.out 2 Current executable set to '~/a.out' (arm). 3 (lldb) target list 4 Current targets: 5 target #​0: /home/common/a.out ( arch=arm--linux-eabihf, platform=host ) 6 (lldb) b main 7 Breakpoint 1: where = a.out`main, address = 0x000103f4 8 (lldb) process launch --stop-at-entry 9 Process 5659 launched: '/home/common/a.out' (arm) 10 (lldb) target list 11 Current targets: 12 * target #​0: ( arch=armv7l-unknown-unknown, platform=host, pid=5659, state=stopped ) 13 (lldb) b main 14 Breakpoint 2: no locations (pending). 15 WARNING: Unable to resolve breakpoint to any actual locations. 16 (lldb) c 17 Process 5659 resuming 18 hello 19 Process 5659 exited with status = 0 (0x00000000) 20 (lldb)

I am using Digilent Zybo, but same problem will probably occur in RaspberryPi.

I think there is a bug in ArchSpec::MergeFrom. LLDB loses vendor and OS name by calling ArchSpec::CoreUpdated(true) to set SubArch. I think this problem is caused by the fact that SubArch can only be set by the constructor of llvm::Triple. LLDB worked fine by saving those information.

I judged that the FindCoreDefinition should be modified to support cores other than armv7 and little-endian, so the above patch is not good. I have created a patch. Are there any arm users who can try this? I used 5.0.2 and 6.0.1 because libcxxabi of 7.0.0 failed in build on arm.

llvmbot commented 5 years ago

I built trunk.

r350053 -> Process launch failed (Because it does not support armv7l)

Zybo-Z7-10:/work/llvm+lldb_trunk/obj$ bin/lldb (lldb) file ~/a.out Current executable set to '~/a.out' (arm). (lldb) b main Breakpoint 1: where = a.out`main, address = 0x000103f4 (lldb) target list Current targets:

r350053 + patch_for_r350053_without_modify_ArchSpec::MergeFrom.patch -> Breakpoint does not work

(lldb) file ~/a.out Current executable set to '~/a.out' (arm). (lldb) b main Breakpoint 1: where = a.out`main, address = 0x000103f4 (lldb) target list Current targets:

r350053 + patch_for_r350053.patch -> Breakpoint works correctly

(lldb) file ~/a.out Current executable set to '~/a.out' (arm). (lldb) b main Breakpoint 1: where = a.out`main, address = 0x000103f4 (lldb) target list Current targets:

llvmbot commented 5 years ago

Patch for trunk r350053

llvmbot commented 5 years ago

Patch for trunk r350053 without modify ArchSpec::MergeFrom

llvmbot commented 5 years ago

I just started to build r350053 without libcxx and libcxxabi. I think it will take several days to complete without a problem. The arm processor is very slow.

llvmbot commented 5 years ago

Can you try with trunk (top-of-tree)? Thanks.

llvmbot commented 1 year ago

Hi!

This issue may be a good introductory issue for people new to working on LLVM. If you would like to work on this issue, your first steps are:

1) Assign the issue to you. 2) Fix the issue locally. 3) Run the test suite locally. 3.1) Remember that the subdirectories under test/ create fine-grained testing targets, so you can e.g. use make check-clang-ast to only run Clang's AST tests. 4) Create a git commit 5) Run git clang-format HEAD~1 to format your changes. 6) Submit the patch to Phabricator. 6.1) Detailed instructions can be found here

For more instructions on how to submit a patch to LLVM, see our documentation.

If you have any further questions about this issue, don't hesitate to ask via a comment on this Github issue.

@llvm/issue-subscribers-good-first-issue