Skip to content

Debugging a Segfault

Domenico Rotiroti edited this page Dec 1, 2013 · 2 revisions

If boxfs crash in a reproducible way, you can help me find and fix the bug enabling debugging symbols and reproducing the crash in a debugger. I'll show you how to do it.

Step 1: Compile boxfs with debugging symbols

Go to the sources directory and run

make clean
export CFLAGS=-g
make

Step 2: Run under gdb

When you mount a FUSE filesystem, the library do a fork and exit to terminate the main process, so SEGFAULTs in the initialization code are to be debugged differently from ones in other parts of the code (when the filesystem is mounted).

2.a: The SEGFAULT happens at mount time

  1. Run gdb boxfs, then at the gdb prompt type `run -f <my_conf_file>'.
  2. Make it crash
  3. Type where to get a stack trace
  4. Send me the output

2.b: The SEGFAULT happens after the mount

  1. Run boxfs with your usual args (for instance, boxfs -f <my_conf_file>)
  2. When the filesystem is mounted, run ps axw | grep boxfs and find the PID of the boxfs process
  3. Run gdb boxfs <PID using the PID found at (2)
  4. At the gdb prompt type 'c' to resume boxfs
  5. Make it crash
  6. Type where to get a stack trace
  7. Send me the output

Clone this wiki locally