I use the Ubuntu 18.04
The version of clang is 6.0.1 and the version of lldb is 6.0.0
This is my code:
.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
I compile with the following command:
clang -g -c -x assembler cpuid.s
clang -o cpuid cpuid.o
I am trying to debug a assembler program I am writing,When using lldb
, the program can load normally but the source code cannot be displayed.
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)
But using gdb
can get my code correctly.
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)
Why is there such a situation?
Thank you very much for your help!
User contributions licensed under CC BY-SA 3.0