Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
e712e077
Commit
e712e077
authored
May 23, 1999
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added debug events support.
parent
3e2be8d7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
208 additions
and
4 deletions
+208
-4
server.h
include/server.h
+115
-2
request.h
include/server/request.h
+12
-0
Makefile.in
server/Makefile.in
+1
-0
debugger.c
server/debugger.c
+0
-0
object.h
server/object.h
+5
-0
process.c
server/process.c
+17
-2
thread.c
server/thread.c
+3
-0
thread.h
server/thread.h
+2
-0
trace.c
server/trace.c
+53
-0
No files found.
include/server.h
View file @
e712e077
...
...
@@ -48,6 +48,7 @@ struct new_process_request
{
int
inherit
;
/* inherit flag */
int
inherit_all
;
/* inherit all handles from parent */
int
create_flags
;
/* creation flags */
int
start_flags
;
/* flags from startup info */
int
hstdin
;
/* handle for stdin */
int
hstdout
;
/* handle for stdout */
...
...
@@ -732,6 +733,119 @@ struct next_process_reply
};
/* Wait for a debug event */
struct
wait_debug_event_request
{
int
timeout
;
/* timeout in ms */
};
struct
wait_debug_event_reply
{
int
code
;
/* event code */
void
*
pid
;
/* process id */
void
*
tid
;
/* thread id */
/* followed by the event data (see below) */
};
/* Send a debug event */
struct
send_debug_event_request
{
int
code
;
/* event code */
/* followed by the event data (see below) */
};
struct
send_debug_event_reply
{
int
status
;
/* event continuation status */
};
/* definitions of the event data depending on the event code */
struct
debug_event_exception
{
int
code
;
/* exception code */
int
flags
;
/* exception flags */
void
*
record
;
/* exception record ptr */
void
*
addr
;
/* exception address */
int
nb_params
;
/* exceptions parameters */
int
params
[
15
];
int
first_chance
;
/* first chance to handle it? */
};
struct
debug_event_create_thread
{
int
handle
;
/* handle to the new thread */
void
*
teb
;
/* thread teb (in debugged process address space) */
void
*
start
;
/* thread startup routine */
};
struct
debug_event_create_process
{
int
file
;
/* handle to the process exe file */
int
process
;
/* handle to the new process */
int
thread
;
/* handle to the new thread */
void
*
base
;
/* base of executable image */
int
dbg_offset
;
/* offset of debug info in file */
int
dbg_size
;
/* size of debug info */
void
*
teb
;
/* thread teb (in debugged process address space) */
void
*
start
;
/* thread startup routine */
void
*
name
;
/* image name (optional) */
int
unicode
;
/* is it Unicode? */
};
struct
debug_event_exit
{
int
exit_code
;
/* thread or process exit code */
};
struct
debug_event_load_dll
{
int
handle
;
/* file handle for the dll */
void
*
base
;
/* base address of the dll */
int
dbg_offset
;
/* offset of debug info in file */
int
dbg_size
;
/* size of debug info */
void
*
name
;
/* image name (optional) */
int
unicode
;
/* is it Unicode? */
};
struct
debug_event_unload_dll
{
void
*
base
;
/* base address of the dll */
};
struct
debug_event_output_string
{
void
*
string
;
/* string to display (in debugged process address space) */
int
unicode
;
/* is it Unicode? */
int
length
;
/* string length */
};
struct
debug_event_rip_info
{
int
error
;
/* ??? */
int
type
;
/* ??? */
};
union
debug_event_data
{
struct
debug_event_exception
exception
;
struct
debug_event_create_thread
create_thread
;
struct
debug_event_create_process
create_process
;
struct
debug_event_exit
exit
;
struct
debug_event_load_dll
load_dll
;
struct
debug_event_unload_dll
unload_dll
;
struct
debug_event_output_string
output_string
;
struct
debug_event_rip_info
rip_info
;
};
/* Continue a debug event */
struct
continue_debug_event_request
{
void
*
pid
;
/* process id to continue */
void
*
tid
;
/* thread id to continue */
int
status
;
/* continuation status */
};
/* Start debugging an existing process */
struct
debug_process_request
{
void
*
pid
;
/* id of the process to debug */
};
/* requests definitions */
#include "server/request.h"
...
...
@@ -740,14 +854,13 @@ struct next_process_reply
#ifndef __WINE_SERVER__
/* client communication functions */
extern
void
CLIENT_ProtocolError
(
const
char
*
err
,
...
);
extern
void
CLIENT_SendRequest
(
enum
request
req
,
int
pass_fd
,
int
n
,
...
/* arg_1, len_1, etc. */
);
extern
unsigned
int
CLIENT_WaitReply
(
int
*
len
,
int
*
passed_fd
,
int
n
,
...
/* arg_1, len_1, etc. */
);
extern
unsigned
int
CLIENT_WaitSimpleReply
(
void
*
reply
,
int
len
,
int
*
passed_fd
);
extern
int
CLIENT_InitServer
(
void
);
struct
_THDB
;
extern
int
CLIENT_SetDebug
(
int
level
);
extern
int
CLIENT_DebuggerRequest
(
int
op
);
extern
int
CLIENT_InitThread
(
void
);
...
...
include/server/request.h
View file @
e712e077
...
...
@@ -63,6 +63,10 @@ enum request
REQ_CREATE_DEVICE
,
REQ_CREATE_SNAPSHOT
,
REQ_NEXT_PROCESS
,
REQ_WAIT_DEBUG_EVENT
,
REQ_SEND_DEBUG_EVENT
,
REQ_CONTINUE_DEBUG_EVENT
,
REQ_DEBUG_PROCESS
,
REQ_NB_REQUESTS
};
...
...
@@ -126,6 +130,10 @@ DECL_HANDLER(get_mapping_info);
DECL_HANDLER
(
create_device
);
DECL_HANDLER
(
create_snapshot
);
DECL_HANDLER
(
next_process
);
DECL_HANDLER
(
wait_debug_event
);
DECL_HANDLER
(
send_debug_event
);
DECL_HANDLER
(
continue_debug_event
);
DECL_HANDLER
(
debug_process
);
static
const
struct
handler
{
void
(
*
handler
)();
...
...
@@ -189,6 +197,10 @@ static const struct handler {
{
(
void
(
*
)())
req_create_device
,
sizeof
(
struct
create_device_request
)
},
{
(
void
(
*
)())
req_create_snapshot
,
sizeof
(
struct
create_snapshot_request
)
},
{
(
void
(
*
)())
req_next_process
,
sizeof
(
struct
next_process_request
)
},
{
(
void
(
*
)())
req_wait_debug_event
,
sizeof
(
struct
wait_debug_event_request
)
},
{
(
void
(
*
)())
req_send_debug_event
,
sizeof
(
struct
send_debug_event_request
)
},
{
(
void
(
*
)())
req_continue_debug_event
,
sizeof
(
struct
continue_debug_event_request
)
},
{
(
void
(
*
)())
req_debug_process
,
sizeof
(
struct
debug_process_request
)
},
};
#endif
/* WANT_REQUEST_HANDLERS */
...
...
server/Makefile.in
View file @
e712e077
...
...
@@ -8,6 +8,7 @@ MODULE = server
C_SRCS
=
\
change.c
\
console.c
\
debugger.c
\
device.c
\
event.c
\
file.c
\
...
...
server/debugger.c
0 → 100644
View file @
e712e077
This diff is collapsed.
Click to expand it.
server/object.h
View file @
e712e077
...
...
@@ -153,6 +153,11 @@ extern void file_set_error(void);
extern
int
create_console
(
int
fd
,
struct
object
*
obj
[
2
]
);
/* debugger functions */
extern
int
debugger_attach
(
struct
process
*
process
,
struct
thread
*
debugger
);
extern
void
debug_exit_thread
(
struct
thread
*
thread
,
int
exit_code
);
extern
int
debug_level
;
#endif
/* __WINE_SERVER_OBJECT_H */
server/process.c
View file @
e712e077
...
...
@@ -109,12 +109,21 @@ static struct process *create_process( struct new_process_request *req )
return
NULL
;
}
init_process
(
process
);
if
(
parent
->
console_in
)
process
->
console_in
=
grab_object
(
parent
->
console_in
);
if
(
parent
->
console_out
)
process
->
console_out
=
grab_object
(
parent
->
console_out
);
if
(
!
(
process
->
info
=
mem_alloc
(
sizeof
(
*
process
->
info
)
)))
goto
error
;
memcpy
(
process
->
info
,
req
,
sizeof
(
*
req
)
);
/* set the process console */
if
(
req
->
create_flags
&
CREATE_NEW_CONSOLE
)
{
if
(
!
alloc_console
(
process
))
goto
error
;
}
else
if
(
!
(
req
->
create_flags
&
DETACHED_PROCESS
))
{
if
(
parent
->
console_in
)
process
->
console_in
=
grab_object
(
parent
->
console_in
);
if
(
parent
->
console_out
)
process
->
console_out
=
grab_object
(
parent
->
console_out
);
}
if
(
!
req
->
inherit_all
&&
!
(
req
->
start_flags
&
STARTF_USESTDHANDLES
))
{
process
->
info
->
hstdin
=
duplicate_handle
(
parent
,
req
->
hstdin
,
process
,
...
...
@@ -125,6 +134,12 @@ static struct process *create_process( struct new_process_request *req )
0
,
TRUE
,
DUPLICATE_SAME_ACCESS
);
}
/* attach to the debugger if requested */
if
(
req
->
create_flags
&
DEBUG_PROCESS
)
debugger_attach
(
process
,
current
);
else
if
(
parent
->
debugger
&&
!
(
req
->
create_flags
&
DEBUG_ONLY_THIS_PROCESS
))
debugger_attach
(
process
,
parent
->
debugger
);
process
->
next
=
first_process
;
first_process
->
prev
=
process
;
first_process
=
process
;
...
...
server/thread.c
View file @
e712e077
...
...
@@ -87,6 +87,7 @@ static void init_thread( struct thread *thread, int fd )
thread
->
mutex
=
NULL
;
thread
->
debug_ctx
=
NULL
;
thread
->
debug_first
=
NULL
;
thread
->
debug_event
=
NULL
;
thread
->
wait
=
NULL
;
thread
->
apc
=
NULL
;
thread
->
apc_count
=
0
;
...
...
@@ -157,6 +158,7 @@ static void destroy_thread( struct object *obj )
struct
thread
*
thread
=
(
struct
thread
*
)
obj
;
assert
(
obj
->
ops
==
&
thread_ops
);
assert
(
!
thread
->
debug_ctx
);
/* cannot still be debugging something */
release_object
(
thread
->
process
);
if
(
thread
->
next
)
thread
->
next
->
prev
=
thread
->
prev
;
if
(
thread
->
prev
)
thread
->
prev
->
next
=
thread
->
next
;
...
...
@@ -522,6 +524,7 @@ void thread_killed( struct thread *thread, int exit_code )
thread
->
state
=
TERMINATED
;
thread
->
exit_code
=
exit_code
;
if
(
thread
->
wait
)
end_wait
(
thread
);
debug_exit_thread
(
thread
,
exit_code
);
abandon_mutexes
(
thread
);
remove_process_thread
(
thread
->
process
,
thread
);
wake_up
(
&
thread
->
obj
,
0
);
...
...
server/thread.h
View file @
e712e077
...
...
@@ -20,6 +20,7 @@ struct thread_wait;
struct
thread_apc
;
struct
mutex
;
struct
debug_ctx
;
struct
debug_event
;
enum
run_state
{
STARTING
,
RUNNING
,
TERMINATED
};
...
...
@@ -34,6 +35,7 @@ struct thread
struct
mutex
*
mutex
;
/* list of currently owned mutexes */
struct
debug_ctx
*
debug_ctx
;
/* debugger context if this thread is a debugger */
struct
process
*
debug_first
;
/* head of debugged processes list */
struct
debug_event
*
debug_event
;
/* pending debug event for this thread */
struct
thread_wait
*
wait
;
/* current wait condition if sleeping */
struct
thread_apc
*
apc
;
/* list of async procedure calls */
int
apc_count
;
/* number of outstanding APCs */
...
...
server/trace.c
View file @
e712e077
...
...
@@ -10,6 +10,7 @@ static int dump_new_process_request( struct new_process_request *req, int len )
{
fprintf
(
stderr
,
" inherit=%d,"
,
req
->
inherit
);
fprintf
(
stderr
,
" inherit_all=%d,"
,
req
->
inherit_all
);
fprintf
(
stderr
,
" create_flags=%d,"
,
req
->
create_flags
);
fprintf
(
stderr
,
" start_flags=%d,"
,
req
->
start_flags
);
fprintf
(
stderr
,
" hstdin=%d,"
,
req
->
hstdin
);
fprintf
(
stderr
,
" hstdout=%d,"
,
req
->
hstdout
);
...
...
@@ -682,6 +683,46 @@ static int dump_next_process_reply( struct next_process_reply *req, int len )
return
(
int
)
sizeof
(
*
req
);
}
static
int
dump_wait_debug_event_request
(
struct
wait_debug_event_request
*
req
,
int
len
)
{
fprintf
(
stderr
,
" timeout=%d"
,
req
->
timeout
);
return
(
int
)
sizeof
(
*
req
);
}
static
int
dump_wait_debug_event_reply
(
struct
wait_debug_event_reply
*
req
,
int
len
)
{
fprintf
(
stderr
,
" code=%d,"
,
req
->
code
);
fprintf
(
stderr
,
" pid=%p,"
,
req
->
pid
);
fprintf
(
stderr
,
" tid=%p"
,
req
->
tid
);
return
(
int
)
sizeof
(
*
req
);
}
static
int
dump_send_debug_event_request
(
struct
send_debug_event_request
*
req
,
int
len
)
{
fprintf
(
stderr
,
" code=%d"
,
req
->
code
);
return
(
int
)
sizeof
(
*
req
);
}
static
int
dump_send_debug_event_reply
(
struct
send_debug_event_reply
*
req
,
int
len
)
{
fprintf
(
stderr
,
" status=%d"
,
req
->
status
);
return
(
int
)
sizeof
(
*
req
);
}
static
int
dump_continue_debug_event_request
(
struct
continue_debug_event_request
*
req
,
int
len
)
{
fprintf
(
stderr
,
" pid=%p,"
,
req
->
pid
);
fprintf
(
stderr
,
" tid=%p,"
,
req
->
tid
);
fprintf
(
stderr
,
" status=%d"
,
req
->
status
);
return
(
int
)
sizeof
(
*
req
);
}
static
int
dump_debug_process_request
(
struct
debug_process_request
*
req
,
int
len
)
{
fprintf
(
stderr
,
" pid=%p"
,
req
->
pid
);
return
(
int
)
sizeof
(
*
req
);
}
struct
dumper
{
int
(
*
dump_req
)(
void
*
data
,
int
len
);
...
...
@@ -806,6 +847,14 @@ static const struct dumper dumpers[REQ_NB_REQUESTS] =
(
void
(
*
)())
dump_create_snapshot_reply
},
{
(
int
(
*
)(
void
*
,
int
))
dump_next_process_request
,
(
void
(
*
)())
dump_next_process_reply
},
{
(
int
(
*
)(
void
*
,
int
))
dump_wait_debug_event_request
,
(
void
(
*
)())
dump_wait_debug_event_reply
},
{
(
int
(
*
)(
void
*
,
int
))
dump_send_debug_event_request
,
(
void
(
*
)())
dump_send_debug_event_reply
},
{
(
int
(
*
)(
void
*
,
int
))
dump_continue_debug_event_request
,
(
void
(
*
)())
0
},
{
(
int
(
*
)(
void
*
,
int
))
dump_debug_process_request
,
(
void
(
*
)())
0
},
};
static
const
char
*
const
req_names
[
REQ_NB_REQUESTS
]
=
...
...
@@ -868,6 +917,10 @@ static const char * const req_names[REQ_NB_REQUESTS] =
"create_device"
,
"create_snapshot"
,
"next_process"
,
"wait_debug_event"
,
"send_debug_event"
,
"continue_debug_event"
,
"debug_process"
,
};
void
trace_request
(
enum
request
req
,
void
*
data
,
int
len
,
int
fd
)
...
...
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