我在Ubuntu 12.10 64bit上运行。GDB抱怨没有源代码可用
我试图调试GDB一个简单的汇编程序。但是GDB的gui模式(-tui)似乎无法找到我的程序集文件的源代码。我已经在当前目录中重建了该项目,并且无法搜索到谷歌,请在这里帮助我。
我的命令:
nasm -f elf64 -g -F dwarf hello.asm
gcc -g hello.o -o hello
gdb -tui hello
调试信息似乎是装的,我可以设置在主断点(),但上半部分的屏幕仍然说“[没有源代码可用]”。
这里是hello.asm如果你有兴趣:
; hello.asm a first program for nasm for Linux, Intel, gcc
;
; assemble: nasm -f elf -l hello.lst hello.asm
; link: gcc -o hello hello.o
; run: hello
; output is: Hello World
SECTION .data ; data section
msg: db "Hello World",10 ; the string to print, 10=cr
len: equ $-msg ; "$" means "here"
; len is a value, not an address
SECTION .text ; code section
global main ; make label available to linker
main: ; standard gcc entry point
mov edx,len ; arg3, length of string to print
mov ecx,msg ; arg2, pointer to string
mov ebx,1 ; arg1, where to write, screen
mov eax,4 ; write command to int 80 hex
int 0x80 ; interrupt 80 hex, call kernel
mov ebx,0 ; exit code, 0=normal
mov eax,1 ; exit command to kernel
int 0x80 ; interrupt 80 hex, call kernel
删除请参阅下面的答案为理由。 –
汇编程序生成的程序没有调试信息。编译器(例如'gcc -g')正在生成调试信息作为汇编指令或构造。所以你的问题没有真正意义。但是,'gdb'能够一步一步地运行一次机器指令。 –
你有什么解决方案吗? –