C GDB:Lessfs;如何追踪
我正在尝试跟踪这个名为lessfs:的开源程序和linux的内联重复数据消除文件系统,但我在使用GDB一步一步地进行跟踪时遇到了困难 LESSF可在此处找到: 有没有其他工具被推荐用于跟踪大型开源程序?源代码大约有3000行,包含多个文件,我知道我将处理文件的哪一部分,但是如果有一个程序能一步一步地告诉我调用了哪些方法,那就太好了,就像GDB那样 目前,我对如何实际实施这一点感到困惑: 因为我并不是在GDB中运行一个简单的C文件,而是一组大型C文件,我对如何正确运行GDB有点迷茫,因为我知道有多个文件 以下是我经常使用的命令,可以在本教程中找到: 常规命令(不带GDB) ///**以上是先决条件**// ///**启动lessfs**///C GDB:Lessfs;如何追踪,c,linux,gdb,trace,deduplication,C,Linux,Gdb,Trace,Deduplication,我正在尝试跟踪这个名为lessfs:的开源程序和linux的内联重复数据消除文件系统,但我在使用GDB一步一步地进行跟踪时遇到了困难 LESSF可在此处找到: 有没有其他工具被推荐用于跟踪大型开源程序?源代码大约有3000行,包含多个文件,我知道我将处理文件的哪一部分,但是如果有一个程序能一步一步地告诉我调用了哪些方法,那就太好了,就像GDB那样 目前,我对如何实际实施这一点感到困惑: 因为我并不是在GDB中运行一个简单的C文件,而是一组大型C文件,我对如何正确运行GDB有点迷茫,因为我知道有多
./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
(运行它,我是否正确地运行了它??)
我真正想做的是,在lib_commons.c文件中有一些print语句,并从中打印出一些数据,但是在这个开源程序中合并了这么多文件的情况下,我该怎么做呢
谢谢您抽出时间,您想做什么?你有源代码。我正在努力理解源代码,我知道我必须处理的具体行,但是源代码太大了,我想一步一步地看一遍,如果可能的话。例如,我如何在一个有3000行和一堆.h文件的源代码中添加一个简单的printf语句?我必须运行程序才能看到它吗?或者我必须编译那个特定的C文件,然后运行它吗?
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)