2.1w+
社区成员
[root@cv0005759d1 stack]# vim love.s
#gas command test
.section .data
value:
.int 1, 2, 3, 4, 5, 6
valu:
.quad 1, 2, 3, 4, 5, 6
.section .bss
.lcomm buffer, 100
.section .text
.equ LINUX, 5
.global _start
_start:
nop
pushw $0
call exit
~
"love.s" 15L, 206C written
[root@cv0005759d1 stack]# as -gstabs love.s -o love.o
[root@cv0005759d1 stack]# ld -dynamic-linker /lib/ld-linux.so.2 -lc love.o -o love
[root@cv0005759d1 stack]# gdb ./love
GNU gdb Red Hat Linux (6.5-25.el5rh)
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu"...Using host libthread_db library "/lib64/libthread_db.so.1".
(gdb) l
1 #gas command test
2 .section .data
3 value:
4 .int 1, 2, 3, 4, 5, 6
5 valu:
6 .quad 1, 2, 3, 4, 5, 6
7 .section .bss
8 .lcomm buffer, 100
9 .section .text
10 .equ LINUX, 5
(gdb) l
11 .global _start
12 _start:
13 nop
14 pushw $0
15 call exit
(gdb) b 14
Breakpoint 1 at 0x400231: file love.s, line 14.
(gdb) r
Starting program: /home/stack/love
/bin/bash: /home/stack/love: Accessing a corrupted shared library
/bin/bash: /home/stack/love: Success
Program exited with code 01.
You can't do that without a process to debug.
(gdb) x/6gd &valu
0x6003b8 <valu>: 1 2
0x6003c8 <valu+16>: 3 4
0x6003d8 <valu+32>: 5 6
(gdb)