[PATCH 8/8] [WineDbg]: bring usage() and .man up to date

Eric Pouech eric.pouech at wanadoo.fr
Mon Feb 27 14:50:57 CST 2006


- rewrote dbg_winedbg_usage() to match latest changes
- ditto for winedbg.man.in

A+
---

 programs/winedbg/winedbg.c      |   31 ++++++++++++++++----
 programs/winedbg/winedbg.man.in |   62 ++++++++++++++++++++++++++++++---------
 2 files changed, 72 insertions(+), 21 deletions(-)

diff --git a/programs/winedbg/winedbg.c b/programs/winedbg/winedbg.c
index 99f04ef..6f2fdea 100644
--- a/programs/winedbg/winedbg.c
+++ b/programs/winedbg/winedbg.c
@@ -450,9 +450,25 @@ static void dbg_init_console(void)
     SetConsoleTitle("Wine Debugger");
 }
 
-static int dbg_winedbg_usage(void)
+static int dbg_winedbg_usage(BOOL advanced)
 {
-    dbg_printf("Usage: winedbg [--command cmd|--file file|--auto] [--gdb [--no-start] [--with-xterm]] cmdline\n");
+    if (advanced)
+    {
+    dbg_printf("Usage:\n"
+               "   winedbg cmdline         launch process 'cmdline' (as if you were starting\n"
+               "                           it with wine) and run WineDbg on it\n"
+               "   winedbg <num>           attach to running process of pid <num> and run\n"
+               "                           WineDbg on it\n"
+               "   winedbg --gdb cmdline   launch process 'cmdline' (as if you were starting\n"
+               "                           wine) and run gdb (proxied) on it\n"
+               "   winedbg --gdb <num>     attach to running process of pid <num> and run\n"
+               "                           gdb (proxied) on it\n"
+               "   winedbg file.mdmp       reload the minidump file.mdmp into memory and run\n"
+               "                           WineDbg on it\n"
+               "   winedbg --help          prints advanced options\n");
+    }
+    else
+        dbg_printf("Usage:\n\twinedbg [ [ --gdb ] [ prog-name [ prog-args ] | <num> | file.mdmp | --help ]\n");
     return -1;
 }
 
@@ -491,10 +507,13 @@ int main(int argc, char** argv)
     /* as we don't care about exec name */
     argc--; argv++;
 
+    if (argc && !strcmp(argv[0], "--help"))
+        return dbg_winedbg_usage(TRUE);
+
     if (argc && !strcmp(argv[0], "--gdb"))
     {
         retv = gdb_main(argc, argv);
-        if (retv == -1) dbg_winedbg_usage();
+        if (retv == -1) dbg_winedbg_usage(FALSE);
         return retv;
     }
     dbg_init_console();
@@ -510,7 +529,7 @@ int main(int argc, char** argv)
         switch (dbg_active_auto(argc, argv))
         {
         case start_ok:          return 0;
-        case start_error_parse: return dbg_winedbg_usage();
+        case start_error_parse: return dbg_winedbg_usage(FALSE);
         case start_error_init:  return -1;
         }
     }
@@ -547,7 +566,7 @@ int main(int argc, char** argv)
             argc--; argv++;
             break;
         }
-        return dbg_winedbg_usage();
+        return dbg_winedbg_usage(FALSE);
     }
     if (!argc) ds = start_ok;
     else if ((ds = dbg_active_attach(argc, argv)) == start_error_parse &&
@@ -556,7 +575,7 @@ int main(int argc, char** argv)
     switch (ds)
     {
     case start_ok:              break;
-    case start_error_parse:     return dbg_winedbg_usage();
+    case start_error_parse:     return dbg_winedbg_usage(FALSE);
     case start_error_init:      return -1;
     }
 
diff --git a/programs/winedbg/winedbg.man.in b/programs/winedbg/winedbg.man.in
index 9934547..a634995 100644
--- a/programs/winedbg/winedbg.man.in
+++ b/programs/winedbg/winedbg.man.in
@@ -3,17 +3,32 @@
 .SH NAME
 winedbg \- Wine's debugger
 .SH SYNOPSIS
-.BR "winedbg ["
-.RI "[ " " options " "]"
-.BR "| --auto |"
+.BR "winedbg "
+.RI "[" " options " "] ["
+.BI "program name"
+.RI "[ program arguments ] |"
+.BI "pid"
+.RI "]"
+.PP
+.BR "winedbg "
 .BI "--gdb"
-.RI "[" " options " "] ] ["
+.RI "[" " options " "] ["
 .BI "program name"
-.RI "["
-.BI "program arguments"
-.RI "] |"
+.RI "[ program arguments ] |"
 .BI "pid"
 .RI "]"
+.PP
+.BR "winedbg "
+.BI "--auto "
+.BI "pid"
+.PP
+.BR "winedbg "
+.BI "--minidump "
+.RI "[ file.mdmp ]"
+.BI "pid"
+.PP
+.BR "winedbg"
+.BI "file.mdmp"
 .SH DESCRIPTION
 .B winedbg
 is a debugger for Wine. It allows:
@@ -27,21 +42,32 @@ is a debugger for Wine. It allows:
 .PP
 
 .SH MODES
-\fBwinedbg\fR can be used in three modes.  The first argument to the
+\fBwinedbg\fR can be used in five modes.  The first argument to the
 program determines the mode winedbg will run in.
 .IP \fBdefault\fR
 Without any explicit mode, this is standard \fBwinedbg\fR operating
 mode. \fBwinedbg\fR will act as the front end for the user.
+.IP \fB--gdb\fR
+\fBwinedbg\fR will be used as a proxy for \fBgdb\fR. \fBgdb\fR will be
+the front end for command handling, and \fBwinedbg\fR will proxy all
+debugging requests from \fBgdb\fR to the Win32 APIs.
 .IP \fB--auto\fR
-This mode is used when \fBwinedbg\fR is setup in \fIAeDebug\fR
+This mode is used when \fBwinedbg\fR is set up in \fIAeDebug\fR
 registry entry as the default debugger. \fBwinedbg\fR will then
 display basic information about a crash. This is useful for users
 who don't want to debug a crash, but rather gather relevant
 information about the crash to be sent to developers.
-.IP \fB--gdb\fR
-\fBwinedbg\fR will be used as a proxy for \fBgdb\fR. \fBgdb\fR will be
-the front end for command handling, and \fBwinedbg\fR will proxy all
-debugging requests from \fBgdb\fR to the Win32 APIs.
+.IP \fB--minidump\fR
+This mode is similar to the \fB--auto\fR one, except that instead of
+printing the information on the screen (as \fB--auto\fR does), it's
+saved into a minidump file. The name of the file is either passed on
+the command line, or generated by \fBWineDbg\fR when none is given.
+This file could later on be reloaded into \fBwinedbg\fR for further
+examination.
+.IP \fBfile.mdmp\fR
+This mode allows to reload into \fBwinedbg\fR the state of a debuggee
+which has been saved into a minidump file. See either the \fBminidump\fR
+command below, or the \fB--minidump mode\fR.
 
 .SH OPTIONS
 When in \fBdefault\fR mode, the following options are available:
@@ -82,7 +108,7 @@ If nothing is specified, you will enter 
 nor attached process. You'll have to do the job yourself.
 
 .SH COMMANDS
-.SS Default mode:
+.SS Default mode, and while reloading a minidump file:
 .PP
 Most of commands used in \fBwinedbg\fR are similar to the ones from
 \fBgdb\fR. Please refer to the \fBgdb\fR documentations for some more
@@ -303,6 +329,12 @@ When specifying an identifier \fB<id>\fR
 this name exist, the debugger will prompt for the symbol you want to
 use. Pick up the one you want from its number.
 .PP
+\fIMisc.\fR
+.PP
+.IP \fBminidump\ file.mdmp\fR
+saves the debugging context of the debuggee into a minidump file called 
+file.mdmp
+.PP
 \fIInformation on Wine's internals\fR
 .IP \fBinfo\ class\fR
 Lists all Windows' class registered in Wine
@@ -360,7 +392,7 @@ Lists all processes in the Wine session
 .IP \fBmonitor mem \fR
 Displays memory mapping of debugged process
 .PP
-.SS Auto mode:
+.SS Auto and minidump modes:
 .PP
 Since no user input is possible, no commands are available.
 





More information about the wine-patches mailing list