当前位置: 技术问答>linux和unix
哪位高手帮我看看这个linux下汇编程序的调试问题,谢谢。
来源: 互联网 发布时间:2016-11-08
本文导语: 为什么这个程序没办法单步调试,我设置的断点是8,可我一运行他的结果就立马跑出来了,没法单步执行,那位高手帮我解决下吧,谢谢。 (gdb) list 1 #cpuid.s Sample program to extract the processor Vendor ID 2 .section .data ...
为什么这个程序没办法单步调试,我设置的断点是8,可我一运行他的结果就立马跑出来了,没法单步执行,那位高手帮我解决下吧,谢谢。
(gdb) list
1 #cpuid.s Sample program to extract the processor Vendor ID
2 .section .data
3 output:
4 .ascii "The processor Vendor ID is 'xxxxxxxxxxxx'n"
5 .section .text
6 .globl _start
7 _start:
8 movl $0, %eax
9 cpuid
10 movl $output, %edi
(gdb)
11 movl %ebx, 28(%edi)
12 movl %edx, 32(%edi)
13 movl %ecx, 36(%edi)
14 movl $4, %eax
15 movl $1, %ebx
16 movl $output, %ecx
17 movl $42, %edx
18 int $0x80
19 movl $1, %eax
20 movl $0, %ebx
(gdb)
21 int $0x80
(gdb)
Line number 22 out of range; cpuid.s has 21 lines.
(gdb) break 8
Breakpoint 1 at 0x8048074: file cpuid.s, line 8.
(gdb) run
Starting program: /home/heiying/testing/cpu
The processor Vendor ID is 'GenuineIntel'
Program exited normally.
(gdb)
(gdb) list
1 #cpuid.s Sample program to extract the processor Vendor ID
2 .section .data
3 output:
4 .ascii "The processor Vendor ID is 'xxxxxxxxxxxx'n"
5 .section .text
6 .globl _start
7 _start:
8 movl $0, %eax
9 cpuid
10 movl $output, %edi
(gdb)
11 movl %ebx, 28(%edi)
12 movl %edx, 32(%edi)
13 movl %ecx, 36(%edi)
14 movl $4, %eax
15 movl $1, %ebx
16 movl $output, %ecx
17 movl $42, %edx
18 int $0x80
19 movl $1, %eax
20 movl $0, %ebx
(gdb)
21 int $0x80
(gdb)
Line number 22 out of range; cpuid.s has 21 lines.
(gdb) break 8
Breakpoint 1 at 0x8048074: file cpuid.s, line 8.
(gdb) run
Starting program: /home/heiying/testing/cpu
The processor Vendor ID is 'GenuineIntel'
Program exited normally.
(gdb)
|
_start:下面加个nop,然后 break *_start+1,书上不是说了么