Debugging FUSE Filesystem.
Collect some tip/tricks for debugging FUSE.
Program options
-f
: Run foreground-s
: Disable multiple threading
- Enable debugging
- Compiling with debugging symbols enabled(
-g
to gcc) - enable core dumps:
ulimit -c unlimited
- If program crashes, it will have core dump in current directory
- load the core file: `gdb
- Compiling with debugging symbols enabled(
Tools
Valgrind: Valgrind is an instrumentation framework for building dynamic analysis tools.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
if (RUNNING_ON_VALGRIND) {
fprintf(stderr,
"******** Valgrind has been detected by %s\n"
"******** If you have difficulties getting %s to work under"
" Valgrind,\n"
"******** see the following thread:\n"
"******** http://www.nabble.com/valgrind-and-fuse-file-systems"
"-td13112112.html\n"
"******** Sleeping for 5 seconds so this doesn't fly by ....",
progname, progname);
sleep(5);
fprintf(stderr, "\n");
}Reference: Code from Tim Post