gdb debug 程序
file jfbterm
set args -e ls
show args
break fbcommon.c:500
break fbcommon.c:557
break fbcommon.c:566
run
p fb_fix
c
p fb_fix
c
p fb_fix.smem_len
p p->soff
p p->slen
p fb_fix.mmio_len
p p->moff
p p->mlen
root@intrepid:~/jfbterm-0.4.7-dev# gdb
GNU gdb 6.8-debian
Copyright (C) 2008 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".
(gdb) file jfbterm
Reading symbols from /root/jfbterm-0.4.7-dev/jfbterm...done.
(gdb) set args -e ls
(gdb) show args
Argument list to give program being debugged when it is started is "-e ls".
(gdb) break fbcommon.c:500
Breakpoint 1 at 0x40303d: file fbcommon.c, line 500.
(gdb) break fbcommon.c:557
Breakpoint 2 at 0x40327e: file fbcommon.c, line 557.
(gdb) break fbcommon.c:566
Breakpoint 3 at 0x403301: file fbcommon.c, line 566.
(gdb) run
Starting program: /root/jfbterm-0.4.7-dev/jfbterm -e ls
...略...
Breakpoint 1, tfbm_open (p=0x6146e0) at fbcommon.c:501
501 if (fb_var.yres_virtual != fb_var.yres) {
(gdb) p fb_fix
$1 = {id = "▒\204▒▒Q\177\000\000\006\000\000\000\000\000\000", smem_start = 21037808,
smem_len = 4269392626, type = 32593, type_aux = 0, visual = 0,
xpanstep = 65535, ypanstep = 65535, ywrapstep = 65535, line_length = 1, mmio_start = 15,
mmio_len = 21076240, accel = 0, reserved = {53071, 64, 0}}
(gdb) c
Continuing.
...略...
Breakpoint 2, tfbm_open (p=0x6146e0) at fbcommon.c:557
557 p->smem = (u_char*)mmap(NULL, p->slen, PROT_READ|PROT_WRITE,
(gdb) p fb_fix
$2 = {id = "VESA VGA\000\000\000\000\000\000\000", smem_start = 4026531840,
smem_len = 1572864, type = 0, type_aux = 0, visual = 3, xpanstep = 0,
ypanstep = 0, ywrapstep = 0, line_length = 1024, mmio_start = 0,
mmio_len = 0, accel = 0, reserved = {0, 0, 0}}
(gdb) c
Continuing.
Breakpoint 3, tfbm_open (p=0x6146e0) at fbcommon.c:566
566 if(p->mlen == 0)
(gdb) p fb_fix.smem_len
$3 = 1572864
(gdb) p p->soff
$4 = 0
(gdb) p p->slen
$5 = 1572864
(gdb) p fb_fix.mmio_len
$6 = 0
(gdb) p p->moff
$7 = 0
(gdb) p p->mlen
$8 = 0