我正在尝试跟踪这个名为 lessfs: 的开源程序和适用于 linux 的内联重复数据删除文件系统,但我无法使用 GDB 逐步完成
Lessfs 可以在这里找到:http: //www.lessfs.com/wordpress/
是否有任何其他工具推荐用于跟踪大型开源程序?源代码大约有 3,000 行,包含多个文件,我知道我将处理文件的哪一部分,但是如果有一个程序可以一步一步地向我展示,正在调用哪些方法等等,那就太好了,就像 GDB 一样
目前,我对如何实际实现这一点有疑虑:
由于我并没有真正在 GDB 中运行一个简单的 C 文件,而是一组大型 C 文件,所以我对如何正确运行 GDB 知道有多个文件有点迷茫
以下是我经常使用的命令,可以在本教程中找到:
http://www.linuxjournal.com/content/data-deduplication-linux
常规命令(没有 GDB)
sudo cp etc/lessfs.cfg /etc/
sudo mkdir -p /data/{dta,mta}
///** 以上是先决条件**///
///** 启动lessfs **///
./lessfs
sudo mklessfs -c /etc/lessfs.cfg
sudo lessfs /etc/lessfs.cfg /mnt
///** 测试 **///
df -t fuse.lessfs
ls -a /mnt/
sudo r dd if=/dev/zero of=/mnt/test.dat bs=1M count=100
df -t fuse.lessfs
///** 使用 GDB **///
Now running with GDB (I have found an idea here: https://groups.google.com/forum/#!msg/lessfs/dkXDckXYnqw/ns5NpDegL_YJ)
gdb ./lessfs
set args /etc/lessfs.cfg /fuse -d -o\ hard_remove,negative_timeout=0,entry_timeout=0,attr_timeout=0,use_ino,readdir_ino,default_permissions,allow_other,big_writes,max_read=131072,max_write=131072
(运行它,我做得对吗??)
(gdb) r mklessfs /etc/lessfs.cfg
Starting program: /home/hb2/lessfs/lessfs1/lessfs mklessfs /etc/lessfs.cfg
warning: no loadable sections found in added symbol-file system-supplied DSO at 0x7ffff7ffa000
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[Inferior 1 (process 3621) exited with code 0377]
(gdb) r lessfs /etc/lessfs.cfg /mnt
Starting program: /home/hb2/lessfs/lessfs1/lessfs lessfs /etc/lessfs.cfg /mnt
warning: no loadable sections found in added symbol-file system-supplied DSO at 0x7ffff7ffa000
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[Inferior 1 (process 3633) exited with code 0377]
(gdb) r df -t fuse.lessfs
Starting program: /home/hb2/lessfs/lessfs1/lessfs df -t fuse.lessfs
warning: no loadable sections found in added symbol-file system-supplied DSO at 0x7ffff7ffa000
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Program received signal SIGUSR1, User defined signal 1.
0x00007ffff7386707 in kill () from /lib/x86_64-linux-gnu/libc.so.6
(gdb) r dd if=/dev/zero of=/mnt/test.dat bs=1M count=100
The program being debugged has been started already.
Start it from the beginning? (y or n) y
Starting program: /home/hb2/lessfs/lessfs1/lessfs dd if=/dev/zero of=/mnt/test.dat bs=1M count=100
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Program received signal SIGUSR1, User defined signal 1.
0x00007ffff7386707 in kill () from /lib/x86_64-linux-gnu/libc.so.6
(gdb) next
Single stepping until exit from function kill,
which has no line number information.
Program terminated with signal SIGUSR1, User defined signal 1.
The program no longer exists.
(gdb)
我真正想做的是在文件 lib_commons.c 中有一些打印语句并从那里打印一些数据,但是当这个开源程序中组合了这么多文件时,我该怎么做呢?
感谢您的时间,