我在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'能夠一步一步地運行一次機器指令。 –
你有什麼解決方案嗎? –