LLDB无法显示汇编器源代码

时间:2019-03-01 02:21:17

标签: assembly lldb

我使用 Ubuntu 18.04

clang 的版本为 6.0.1 lldb 的版本为 6.0.0

这是我的代码:

.section .data
output:
        .ascii "The Processor Vendor ID is 'xxxxxxxxxxxx'\n"

.section .text
.globl main
main:
        movl $0, %eax
        cpuid
        movl $output, %edi
        movl %ebx, 28(%edi)
        movl %edx, 32(%edi)
        movl %ecx, 36(%edi)
        movl $4, %eax
        movl $1, %ebx
        movl $output, %ecx
        movl $42, %edx
        int  $0x80
        movl $1, %eax
        movl $0, %ebx
        int  $0x80

我使用以下命令进行编译:

clang -g -c -x assembler cpuid.s
clang -o cpuid cpuid.o

我正在尝试调试正在编写的汇编程序,使用lldb时,该程序可以正常加载,但无法显示源代码。

XXX@SSComputer:~/mywork/temp$ lldb cpuid
(lldb) target create "cpuid"
Current executable set to 'cpuid' (x86_64).
(lldb) l
(lldb) 
(lldb) 
(lldb) run
Process 29361 launched: '/home/XXX/mywork/temp/cpuid' (x86_64)
The Processor Vendor ID is 'GenuineIntel'
Process 29361 exited with status = 0 (0x00000000) 
(lldb) 

但是使用gdb可以正确获取我的代码。

XXX@SSComputer:~/mywork/temp$ gdb cpuid
GNU gdb (Ubuntu 8.1-0ubuntu3) 8.1.0.20180409-git
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from cpuid...done.
(gdb) l
1   .section .data
2   output:
3           .ascii "The Processor Vendor ID is 'xxxxxxxxxxxx'\n"
4   
5   .section .text
6   .globl main
7   main:
8           movl $0, %eax
9           cpuid
10          movl $output, %edi
(gdb) 

为什么会出现这种情况?

非常感谢您的帮助!

0 个答案:

没有答案