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
cbb7a172
Commit
cbb7a172
authored
Mar 09, 2000
by
Eric Pouech
Committed by
Alexandre Julliard
Mar 09, 2000
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added proc to start debugging process from its command line (by launching it).
parent
29d33a46
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
82 additions
and
30 deletions
+82
-30
winedbg.c
debugger/winedbg.c
+69
-12
main.c
miscemu/main.c
+13
-18
No files found.
debugger/winedbg.c
View file @
cbb7a172
...
...
@@ -263,7 +263,7 @@ static BOOL DEBUG_HandleException( EXCEPTION_RECORD *rec, BOOL first_chance, BOO
DEBUG_CurrThread
->
dbg_exec_mode
,
DEBUG_CurrThread
->
dbg_exec_count
);
#endif
ret
=
DEBUG_Main
(
is_debug
,
force
);
ret
=
DEBUG_Main
(
is_debug
,
force
,
rec
->
ExceptionCode
);
#if 1
fprintf
(
stderr
,
"Exiting debugger PC=%lx EFL=%08lx mode=%d count=%d
\n
"
,
DEBUG_context
.
Eip
,
DEBUG_context
.
EFlags
,
...
...
@@ -273,18 +273,12 @@ static BOOL DEBUG_HandleException( EXCEPTION_RECORD *rec, BOOL first_chance, BOO
return
ret
;
}
static
DWORD
CALLBACK
DEBUG_MainLoop
(
LPVOID
pid
)
static
DWORD
CALLBACK
DEBUG_MainLoop
(
DWORD
pid
)
{
DEBUG_EVENT
de
;
char
buffer
[
256
];
DWORD
cont
;
TRACE
(
"WineDbg started on pid %ld
\n
"
,
(
DWORD
)
pid
);
if
(
!
DebugActiveProcess
((
DWORD
)
pid
))
TRACE
(
"Can't debug process %ld: %ld
\n
"
,
(
DWORD
)
pid
,
GetLastError
());
while
(
WaitForDebugEvent
(
&
de
,
INFINITE
))
{
cont
=
0L
;
...
...
@@ -463,17 +457,80 @@ static DWORD CALLBACK DEBUG_MainLoop(LPVOID pid)
ContinueDebugEvent
(
de
.
dwProcessId
,
de
.
dwThreadId
,
cont
);
}
TRACE
(
"WineDbg terminated on pid %ld
\n
"
,
(
DWORD
)
pid
);
TRACE
(
"WineDbg terminated on pid %ld
\n
"
,
pid
);
return
0L
;
}
#include "thread.h"
#include "process.h"
#include "wingdi.h"
#include "winuser.h"
static
DWORD
CALLBACK
DEBUG_StarterFromPID
(
LPVOID
pid
)
{
TRACE
(
"WineDbg started on pid %ld
\n
"
,
(
DWORD
)
pid
);
void
DEBUG_StartDebugger
(
DWORD
pid
)
if
(
!
DebugActiveProcess
((
DWORD
)
pid
))
{
TRACE
(
"Can't debug process %ld: %ld
\n
"
,
(
DWORD
)
pid
,
GetLastError
());
return
0
;
}
return
DEBUG_MainLoop
((
DWORD
)
pid
);
}
void
DEBUG_Attach
(
DWORD
pid
)
{
if
(
Options
.
debug
)
CreateThread
(
NULL
,
0
,
DEBUG_MainLoop
,
(
LPVOID
)
pid
,
0
,
NULL
);
CreateThread
(
NULL
,
0
,
DEBUG_StarterFromPID
,
(
LPVOID
)
pid
,
0
,
NULL
);
}
struct
dsfcl
{
HANDLE
hEvent
;
LPSTR
lpCmdLine
;
int
showWindow
;
DWORD
error
;
};
static
DWORD
CALLBACK
DEBUG_StarterFromCmdLine
(
LPVOID
p
)
{
PROCESS_INFORMATION
info
;
STARTUPINFOA
startup
;
BOOL
ok
=
TRUE
;
memset
(
&
startup
,
0
,
sizeof
(
startup
));
startup
.
cb
=
sizeof
(
startup
);
startup
.
dwFlags
=
STARTF_USESHOWWINDOW
;
startup
.
wShowWindow
=
((
struct
dsfcl
*
)
p
)
->
showWindow
;
/* any value >= 32 will do, simulate a correct handle value */
((
struct
dsfcl
*
)
p
)
->
error
=
0xFFFFFFFF
;
if
(
!
CreateProcessA
(
NULL
,
((
struct
dsfcl
*
)
p
)
->
lpCmdLine
,
NULL
,
NULL
,
FALSE
,
DEBUG_PROCESS
,
NULL
,
NULL
,
&
startup
,
&
info
))
{
((
struct
dsfcl
*
)
p
)
->
error
=
GetLastError
();
ok
=
FALSE
;
}
SetEvent
(((
struct
dsfcl
*
)
p
)
->
hEvent
);
if
(
ok
)
DEBUG_MainLoop
(
info
.
dwProcessId
);
return
0
;
}
DWORD
DEBUG_WinExec
(
LPSTR
lpCmdLine
,
int
sw
)
{
struct
dsfcl
s
;
BOOL
ret
;
if
((
s
.
hEvent
=
CreateEventA
(
NULL
,
FALSE
,
FALSE
,
NULL
)))
{
s
.
lpCmdLine
=
lpCmdLine
;
s
.
showWindow
=
sw
;
if
(
CreateThread
(
NULL
,
0
,
DEBUG_StarterFromCmdLine
,
(
LPVOID
)
&
s
,
0
,
NULL
))
{
WaitForSingleObject
(
s
.
hEvent
,
INFINITE
);
ret
=
s
.
error
;
}
else
{
ret
=
3
;
/* (dummy) error value for non created thread */
}
CloseHandle
(
s
.
hEvent
);
}
else
{
ret
=
1
;
/* (dummy) error value for non created event */
}
return
ret
;
}
miscemu/main.c
View file @
cbb7a172
...
...
@@ -21,7 +21,7 @@
static
int
MAIN_argc
;
static
char
**
MAIN_argv
;
extern
void
DEBUG_StartDebugger
(
DWORD
);
extern
DWORD
DEBUG_WinExec
(
LPSTR
lpCmdLine
,
int
sw
);
/***********************************************************************
* Main loop of initial task
...
...
@@ -29,6 +29,7 @@ extern void DEBUG_StartDebugger(DWORD);
void
MAIN_EmulatorRun
(
void
)
{
char
startProg
[
256
],
defProg
[
256
];
HINSTANCE
handle
;
int
i
,
tasks
=
0
;
MSG
msg
;
BOOL
err_msg
=
FALSE
;
...
...
@@ -70,31 +71,25 @@ void MAIN_EmulatorRun( void )
/* Load and run executables given on command line */
for
(
i
=
1
;
i
<
MAIN_argc
;
i
++
)
{
PROCESS_INFORMATION
info
;
STARTUPINFOA
startup
;
memset
(
&
startup
,
0
,
sizeof
(
startup
));
startup
.
cb
=
sizeof
(
startup
);
startup
.
dwFlags
=
STARTF_USESHOWWINDOW
;
startup
.
wShowWindow
=
SW_SHOWNORMAL
;
if
(
Options
.
debug
)
{
handle
=
DEBUG_WinExec
(
MAIN_argv
[
i
],
SW_SHOWNORMAL
);
}
else
{
handle
=
WinExec
(
MAIN_argv
[
i
],
SW_SHOWNORMAL
);
}
if
(
!
CreateProcessA
(
NULL
,
MAIN_argv
[
i
],
NULL
,
NULL
,
FALSE
,
0
,
NULL
,
NULL
,
&
startup
,
&
info
))
{
if
(
handle
<
32
)
{
err_msg
=
TRUE
;
MESSAGE
(
"wine: can't exec '%s': "
,
MAIN_argv
[
i
]);
switch
(
GetLastError
()
)
switch
(
handle
)
{
case
2
:
MESSAGE
(
"file not found
\n
"
);
break
;
case
11
:
MESSAGE
(
"invalid exe file
\n
"
);
break
;
default:
MESSAGE
(
"error=%ld
\n
"
,
GetLastError
()
);
break
;
}
default:
MESSAGE
(
"error=%d
\n
"
,
handle
);
break
;
}
else
{
tasks
++
;
/* hack until wine debugger can be moved to a separate process */
DEBUG_StartDebugger
(
info
.
dwProcessId
);
}
else
tasks
++
;
}
if
(
!
tasks
)
...
...
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