Question: Currently I am developing an application using FUSE filesystem module in Linux (2.6 Kernel) in C language. Due to some programming error, the application crashes after mounting the filesystem. Since I am a novice developer in Linux/C environment. Could you please let me tell me possible options to debug such programs?

Answer: 
You can use [Valgrind](http://valgrind.org/) with FUSE, however [read this first](http://www.nabble.com/valgrind-and-fuse-file-systems) to learn about a setuid work-around. I actually do the following as a convenience for others who might need to debug my file system:

```
#include <valgrind/valgrind.h>

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");
}

```

I work on FUSE a lot .. and 90% of the time my crashes are due to a leak which causes the OOM killer to take action, dereferencing a bad pointer, double free(), etc. Valgrind is a great tool to catch that. GDB is helpful, but I've found Valgrind to be indispensable.
UML is very good for debugging generic parts of linux kernel like filesystem, scheduling but not the hardware platform or drivers specific part of kernel.

<http://www.csee.wvu.edu/~katta/uml/x475.html>

<http://valerieaurora.org/uml_tips.html>

And looking at the diagram carefully:

![Image result for FUSE filesystem](https://upload.wikimedia.org/wikipedia/commons/thumb/0/08/FUSE_structure.svg/2000px-FUSE_structure.svg.png)

You will see the application "hello" which is implementing all the FUSE callback handlers. So majority of debugging is in userspace program, as the FUSE kernel module (and libfuse) is generically meant to be used by ALL FUSE filesystem.