ldd3 examples下载
/usr/local/curl/bin/curl -O https://resources.oreilly.com/examples/9780596005900/-/archive/master/9780596005900-master.tar.bz2
[tom@suse-tom src]$sudo wget https://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.10.tar.gz
[tom@suse-tom src]$ls
linux-2.6.10.tar.gz packages
[tom@suse-tom src]$pwd
/usr/src
[tom@suse-tom src]$
make

gdb 调试
[root@localhost scull]#chmod +x scull_load
[root@localhost scull]#./scull_load
[root@localhost scull]#zcat /proc/config.gz | grep KGDB
[root@localhost scull]#MOD_ADDR=$(sudo cat /sys/module/scull/sections/.text)
[root@localhost scull]#echo "Module text section: $MOD_ADDR"
Module text section: 0xffffffffa0007000
[root@localhost scull]#sudo gdb /usr/src/linux-2.6.10/vmlinux /proc/kcore
GNU gdb (GDB) CentOS (7.0.1-42.el5.centos.1)
Copyright (C) 2009 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-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /usr/src/linux-2.6.10/vmlinux...(no debugging symbols found)...done.
[New <main task>]
Core was generated by `ro root=LABEL=/ rhgb quiet console=tty0'.
#0 0x0000000000000000 in ?? ()
(gdb) add-symbol-file ./scull.ko 0xffffffffa0007000
add symbol table from file "./scull.ko" at
.text_addr = 0xffffffffa0007000
(y or n) y
Reading symbols from /root/ldd3/scull/scull.ko...done.
(gdb) break scull_open
Breakpoint 1 at 0xffffffffa00073b6: file /root/ldd3/scull/main.c, line 239.
(gdb)

937

被折叠的 条评论
为什么被折叠?



