- 论坛徽章:
- 36
|
按照LDD3中的介绍,使用GDB调试一下scull.ko,测试结果如下:
[root@localhost scull]# gdb scull.ko
GNU gdb Red Hat Linux (6.5-37.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 "i386-redhat-linux-gnu"...Using host libthread_db library "/lib/libthread_db.so.1".
(gdb) add-symbol-file scull.ko 0xd0b85000 \
-s .altinstr_replacement 0xd0b86642 \
-s .altinstructions 0xd0b868ec \
-s .bss 0xd0b89a00 \
-s .data 0xd0b88400 \
-s .fixup 0xd0b865f4 \
-s .gnu.linkonce.this_module 0xd0b88800 \
-s .rodata.str1.1 0xd0b86645 \
-s .smp_locks 0xd0b867fc \
-s .strtab 0xd0b87bd0 \
-s .symtab 0xd0b87200 \
-s __ex_table 0xd0b867c4 \
-s __param 0xd0b86860 \
-s __versions 0xd0b86900
add symbol table from file "scull.ko" at
.text_addr = 0xd0b85000
.altinstr_replacement_addr = 0xd0b86642
.altinstructions_addr = 0xd0b868ec
.bss_addr = 0xd0b89a00
.data_addr = 0xd0b88400
.fixup_addr = 0xd0b865f4
.gnu.linkonce.this_module_addr = 0xd0b88800
.rodata.str1.1_addr = 0xd0b86645
.smp_locks_addr = 0xd0b867fc
.strtab_addr = 0xd0b87bd0
.symtab_addr = 0xd0b87200
__ex_table_addr = 0xd0b867c4
__param_addr = 0xd0b86860
__versions_addr = 0xd0b86900
(y or n) y
Reading symbols from /mnt/hgfs/open_source/open_source/ldd3examples/scull/scull.ko...warning: section .strtab not found in /mnt/hgfs/open_source/open_source/ldd3examples/scull/scull.ko
warning: section .symtab not found in /mnt/hgfs/open_source/open_source/ldd3examples/scull/scull.ko
done.
(gdb) gdb scull_qset
Undefined command: "gdb". Try "help".
(gdb) p scull_qset
$1 = 1000
(gdb) p scull_devices[0]
Cannot access memory at address 0x1024748b
测试的情况来看:可以读取普通的变量,如scull_qset。但是对于scull_devices这个数组的成员,只能读取到成员的地址,没法读取内容。
在加载符号的时候,出现了warning,
warning: section .symtab not found in /mnt/hgfs/open_source/open_source/ldd3examples/scull/scull.ko
不大明白是什么意思? |
|