Eric Pouech : winedbg: Extend auto mode with minidump.
Alexandre Julliard
julliard at wine.codeweavers.com
Tue Feb 28 06:08:04 CST 2006
Module: wine
Branch: refs/heads/master
Commit: 4202c752d30dbca633839a59ad40cdfaf69276af
URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=4202c752d30dbca633839a59ad40cdfaf69276af
Author: Eric Pouech <eric.pouech at wanadoo.fr>
Date: Mon Feb 27 21:50:39 2006 +0100
winedbg: Extend auto mode with minidump.
- added -minidump and -minidump <file> options to command line
Those options are to be used in remplacement of --auto to create a minidump
In the form --minidump <file>, the minidump will be created in <file>,
otherwise the filename will be automatically generated.
---
programs/winedbg/tgt_active.c | 68 +++++++++++++++++++++++++++++++++++++----
programs/winedbg/winedbg.c | 4 +-
2 files changed, 62 insertions(+), 10 deletions(-)
diff --git a/programs/winedbg/tgt_active.c b/programs/winedbg/tgt_active.c
index ac2faaa..406c551 100644
--- a/programs/winedbg/tgt_active.c
+++ b/programs/winedbg/tgt_active.c
@@ -864,13 +864,67 @@ enum dbg_start dbg_active_auto(int argc,
HANDLE hFile;
enum dbg_start ds = start_error_parse;
- argc--; argv++;
- hFile = parser_generate_command_file("echo Modules:", "info share",
- "echo Threads:", "info threads",
- NULL);
- if (hFile == INVALID_HANDLE_VALUE ||
- (ds = dbg_active_attach(argc, argv)) != start_ok)
- return ds;
+ if (!strcmp(argv[0], "--auto"))
+ {
+ /* auto mode */
+ argc--; argv++;
+ ds = dbg_active_attach(argc, argv);
+ if (ds != start_ok) return ds;
+ hFile = parser_generate_command_file("echo Modules:", "info share",
+ "echo Threads:", "info threads",
+ NULL);
+ }
+ else if (!strcmp(argv[0], "--minidump"))
+ {
+ const char* file = NULL;
+ char tmp[8 + 1 + MAX_PATH]; /* minidump <file> */
+
+ argc--; argv++;
+ /* hard stuff now ; we can get things like:
+ * --minidump <pid> 1 arg
+ * --minidump <pid> <evt> 2 args
+ * --minidump <file> <pid> 2 args
+ * --minidump <file> <pid> <evt> 3 args
+ */
+ switch (argc)
+ {
+ case 1:
+ ds = dbg_active_attach(argc, argv);
+ break;
+ case 2:
+ if ((ds = dbg_active_attach(argc, argv)) != start_ok)
+ {
+ file = argv[0];
+ ds = dbg_active_attach(argc - 1, argv + 1);
+ }
+ break;
+ case 3:
+ file = argv[0];
+ ds = dbg_active_attach(argc - 1, argv + 1);
+ break;
+ default:
+ return start_error_parse;
+ }
+ if (ds != start_ok) return ds;
+ memcpy(tmp, "minidump \"", 10);
+ if (!file)
+ {
+ char path[MAX_PATH];
+
+ GetTempPath(sizeof(path), path);
+ GetTempFileName(path, "WD", 0, tmp + 10);
+ }
+ else strcpy(tmp + 10, file);
+ strcat(tmp, "\"");
+ if (!file)
+ {
+ /* FIXME: should generate unix name as well */
+ dbg_printf("Capturing program state in %s\n", tmp + 9);
+ }
+ hFile = parser_generate_command_file(tmp, NULL);
+ }
+ else return start_error_parse;
+ if (hFile == INVALID_HANDLE_VALUE) return start_error_parse;
dbg_main_loop(hFile);
return start_ok;
}
diff --git a/programs/winedbg/winedbg.c b/programs/winedbg/winedbg.c
index 40eee6c..7cd7695 100644
--- a/programs/winedbg/winedbg.c
+++ b/programs/winedbg/winedbg.c
@@ -34,8 +34,6 @@
/* TODO list:
*
* - minidump
- * + allow winedbg in automatic mode to create a minidump (or add another option
- * for that)
* + set a mode where winedbg would start (postmortem debugging) from a minidump
* - CPU adherence
* + we always assume the stack grows as on i386 (ie downwards)
@@ -495,7 +493,7 @@ int main(int argc, char** argv)
SymSetOptions((SymGetOptions() & ~(SYMOPT_UNDNAME)) |
SYMOPT_LOAD_LINES | SYMOPT_DEFERRED_LOADS | SYMOPT_AUTO_PUBLICS);
- if (argc && !strcmp(argv[0], "--auto"))
+ if (argc && (!strcmp(argv[0], "--auto") || !strcmp(argv[0], "--minidump")))
{
/* force some internal variables */
DBG_IVAR(BreakOnDllLoad) = 0;
More information about the wine-cvs
mailing list