Browse files

Add various debug helpers.

Build with -g, start fuse in the foreground with tracing output,
document MALLOC_CHECK_ .
  • Loading branch information...
1 parent ba6dde1 commit 79e3d2e11c4cf134181deb8ff5e5c9bc5b39aed6 @g2p committed Feb 20, 2011
Showing with 19 additions and 6 deletions.
  1. +5 −0 OMakefile
  2. +6 −0 README
  3. 0 debug/.keep
  4. +8 −6 src/git_fs.ml
View
5 OMakefile
@@ -5,6 +5,11 @@ section
vmount(-l, src, build)
.SUBDIRS: build
+section
+ vmount(-l, src, debug)
+ OCAMLOPTFLAGS += -g
+ .SUBDIRS: debug
+
if false
section
View
6 README
@@ -84,4 +84,10 @@ Or use a few special commands
git fs umount
git fs help
+Debugging
+---------
+
+ MALLOC_CHECK_=3 debug/git-fs debug 2>&1 |tee -a debug.log
+
+
View
0 debug/.keep
No changes.
View
14 src/git_fs.ml
@@ -861,7 +861,7 @@ let is_mounted () =
git_dir_quoted = fsname)
(mtab_lines ())
-let cmd_mount () =
+let cmd_mount ?(debug=false) () =
let lazy mountpoint = mountpoint_lazy in
let lazy fsname = fsname_lazy in
(*log fsname;*)
@@ -872,15 +872,16 @@ let cmd_mount () =
begin try Unix.mkdir mountpoint 0o755
with Unix.Unix_error (Unix.EEXIST, _, _) -> () end;
prerr_endline (Printf.sprintf "Mounting on %S" mountpoint);
- let fuse_args = [|
- fs_subtype; (*"-f";*)
+ let fuse_args = [
"-o"; "ro";
(* fuse doesn't guess the subtype anymore, if we give it fsname *)
"-osubtype=" ^ fs_subtype;
"-ofsname=" ^ fsname;
mountpoint;
- |] in
- Fuse.main fuse_args fuse_ops
+ ] in
+ let fuse_args = if debug then "-s"::"-d"::fuse_args else fuse_args in
+ let fuse_args = fs_subtype::fuse_args in
+ Fuse.main (Array.of_list fuse_args) fuse_ops
end
let cmd_umount () =
@@ -915,7 +916,8 @@ let cmd_fuse_help () =
let _ =
match Sys.argv with
|[| _ |] -> cmd_mount ()
- |[| _; "mount" |] -> cmd_mount ()
+ |[| _; "mount" |] -> cmd_mount ~debug:false ()
+ |[| _; "debug" |] -> cmd_mount ~debug:true ()
|[| _; "umount" |] -> cmd_umount ()
|[| _; "show-mountpoint" |] -> cmd_show_mountpoint ()
|[| _; "is-mounted" |] -> cmd_is_mounted ()

0 comments on commit 79e3d2e

Please sign in to comment.