Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
dea7ced7
Commit
dea7ced7
authored
Jan 16, 2012
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winedbg: Split minidump option handling to a separate function.
parent
adad80f4
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
94 additions
and
66 deletions
+94
-66
debugger.h
programs/winedbg/debugger.h
+2
-0
tgt_active.c
programs/winedbg/tgt_active.c
+81
-61
winedbg.c
programs/winedbg/winedbg.c
+11
-5
No files found.
programs/winedbg/debugger.h
View file @
dea7ced7
...
...
@@ -255,6 +255,7 @@ extern struct dbg_thread* dbg_curr_thread;
extern
DWORD_PTR
dbg_curr_tid
;
extern
CONTEXT
dbg_context
;
extern
BOOL
dbg_interactiveP
;
extern
HANDLE
dbg_houtput
;
struct
dbg_internal_var
{
...
...
@@ -419,6 +420,7 @@ extern void dbg_wait_next_exception(DWORD cont, int count, int mode)
extern
enum
dbg_start
dbg_active_attach
(
int
argc
,
char
*
argv
[]);
extern
enum
dbg_start
dbg_active_launch
(
int
argc
,
char
*
argv
[]);
extern
enum
dbg_start
dbg_active_auto
(
int
argc
,
char
*
argv
[]);
extern
enum
dbg_start
dbg_active_minidump
(
int
argc
,
char
*
argv
[]);
extern
void
dbg_active_wait_for_first_exception
(
void
);
extern
BOOL
dbg_attach_debuggee
(
DWORD
pid
,
BOOL
cofe
);
...
...
programs/winedbg/tgt_active.c
View file @
dea7ced7
...
...
@@ -757,75 +757,95 @@ enum dbg_start dbg_active_auto(int argc, char* argv[])
HANDLE
hFile
;
enum
dbg_start
ds
=
start_error_parse
;
if
(
!
strcmp
(
argv
[
0
],
"--auto"
))
{
/* auto mode */
argc
--
;
argv
++
;
ds
=
dbg_active_attach
(
argc
,
argv
);
if
(
ds
!=
start_ok
)
{
msgbox_res_id
(
NULL
,
IDS_INVALID_PARAMS
,
IDS_AUTO_CAPTION
,
MB_OK
);
return
ds
;
}
if
(
!
display_crash_dialog
())
{
dbg_init_console
();
dbg_start_interactive
(
INVALID_HANDLE_VALUE
);
return
start_ok
;
}
hFile
=
parser_generate_command_file
(
"echo Modules:"
,
"info share"
,
"echo Threads:"
,
"info threads"
,
"kill"
,
NULL
);
DBG_IVAR
(
BreakOnDllLoad
)
=
0
;
/* auto mode */
argc
--
;
argv
++
;
ds
=
dbg_active_attach
(
argc
,
argv
);
if
(
ds
!=
start_ok
)
{
msgbox_res_id
(
NULL
,
IDS_INVALID_PARAMS
,
IDS_AUTO_CAPTION
,
MB_OK
);
return
ds
;
}
if
(
!
display_crash_dialog
())
{
dbg_init_console
();
dbg_start_interactive
(
INVALID_HANDLE_VALUE
);
return
start_ok
;
}
else
if
(
!
strcmp
(
argv
[
0
],
"--minidump"
))
hFile
=
parser_generate_command_file
(
"echo Modules:"
,
"info share"
,
"echo Threads:"
,
"info threads"
,
"kill"
,
NULL
);
if
(
hFile
==
INVALID_HANDLE_VALUE
)
return
start_error_parse
;
dbg_houtput
=
GetStdHandle
(
STD_ERROR_HANDLE
);
if
(
dbg_curr_process
->
active_debuggee
)
dbg_active_wait_for_first_exception
();
dbg_interactiveP
=
TRUE
;
parser_handle
(
hFile
);
return
start_ok
;
}
/******************************************************************
* dbg_active_minidump
*
* Starts (<pid> or <pid> <evt>) in minidump mode
*/
enum
dbg_start
dbg_active_minidump
(
int
argc
,
char
*
argv
[])
{
HANDLE
hFile
;
enum
dbg_start
ds
=
start_error_parse
;
const
char
*
file
=
NULL
;
char
tmp
[
8
+
1
+
MAX_PATH
];
/* minidump <file> */
dbg_houtput
=
GetStdHandle
(
STD_ERROR_HANDLE
);
DBG_IVAR
(
BreakOnDllLoad
)
=
0
;
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
)
{
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
)
{
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
];
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
];
GetTempPathA
(
sizeof
(
path
),
path
);
GetTempFileNameA
(
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
,
"detach"
,
NULL
);
GetTempPathA
(
sizeof
(
path
),
path
);
GetTempFileNameA
(
path
,
"WD"
,
0
,
tmp
+
10
);
}
else
return
start_error_parse
;
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
,
"detach"
,
NULL
);
if
(
hFile
==
INVALID_HANDLE_VALUE
)
return
start_error_parse
;
if
(
dbg_curr_process
->
active_debuggee
)
...
...
programs/winedbg/winedbg.c
View file @
dea7ced7
...
...
@@ -89,11 +89,11 @@ DWORD_PTR dbg_curr_tid = 0;
DWORD_PTR
dbg_curr_pid
=
0
;
CONTEXT
dbg_context
;
BOOL
dbg_interactiveP
=
FALSE
;
HANDLE
dbg_houtput
=
0
;
static
struct
list
dbg_process_list
=
LIST_INIT
(
dbg_process_list
);
struct
dbg_internal_var
dbg_internal_vars
[
DBG_IV_LAST
];
static
HANDLE
dbg_houtput
;
static
void
dbg_outputA
(
const
char
*
buffer
,
int
len
)
{
...
...
@@ -668,11 +668,8 @@ 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"
)
||
!
strcmp
(
argv
[
0
],
"--minidump"
)
))
if
(
argc
&&
!
strcmp
(
argv
[
0
],
"--auto"
))
{
/* force some internal variables */
DBG_IVAR
(
BreakOnDllLoad
)
=
0
;
dbg_houtput
=
GetStdHandle
(
STD_ERROR_HANDLE
);
switch
(
dbg_active_auto
(
argc
,
argv
))
{
case
start_ok
:
return
0
;
...
...
@@ -680,6 +677,15 @@ int main(int argc, char** argv)
case
start_error_init
:
return
-
1
;
}
}
if
(
argc
&&
!
strcmp
(
argv
[
0
],
"--minidump"
))
{
switch
(
dbg_active_minidump
(
argc
,
argv
))
{
case
start_ok
:
return
0
;
case
start_error_parse
:
return
dbg_winedbg_usage
(
FALSE
);
case
start_error_init
:
return
-
1
;
}
}
/* parse options */
while
(
argc
>
0
&&
argv
[
0
][
0
]
==
'-'
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment