我试图跟踪这个开源程序lessfs:和linux内联重复数据删除文件系统,但我一步一步地使用GDB
Lessfs可以在这里find: http : //www.lessfs.com/wordpress/
有没有其他工具build议追踪大型开源软件? 源代码大约有三千行和多个文件,我知道我将要处理的文件中的哪一部分,但是如果有一个程序向我展示了一步一步的方法,哪些方法正在被调用,就像GDB一样
目前,我在如何实际执行这个问题上遇到了一些困难:
由于我没有真正将一个简单的C文件运行到GDB中,而是运行一组大的C文件,所以我知道如何正确运行GDB知道有多个文件
这里是我经常使用的命令,可以在这里find这个教程:
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
/// **testing** ///
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中有一些打印语句,并从那里打印出一些数据,但是当这个开源程序中有这么多的文件合并时,我该怎么做?
感谢您的时间,