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
820c5927
Commit
820c5927
authored
Apr 10, 2006
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
server: Removed the thread attached flag, since we always detach now.
parent
5cc97c4e
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
5 additions
and
66 deletions
+5
-66
debugger.c
server/debugger.c
+1
-2
ptrace.c
server/ptrace.c
+4
-60
thread.c
server/thread.c
+0
-1
thread.h
server/thread.h
+0
-3
No files found.
server/debugger.c
View file @
820c5927
...
...
@@ -428,7 +428,7 @@ static int debugger_attach( struct process *process, struct thread *debugger )
goto
error
;
suspend_process
(
process
);
if
(
!
attach_process
(
process
)
||
!
set_process_debugger
(
process
,
debugger
))
if
(
!
set_process_debugger
(
process
,
debugger
))
{
resume_process
(
process
);
return
0
;
...
...
@@ -485,7 +485,6 @@ int debugger_detach( struct process *process, struct thread *debugger )
/* remove relationships between process and its debugger */
process
->
debugger
=
NULL
;
if
(
!
set_process_debug_flag
(
process
,
0
))
clear_error
();
/* ignore error */
detach_process
(
process
);
/* from this function */
resume_process
(
process
);
...
...
server/ptrace.c
View file @
820c5927
...
...
@@ -90,7 +90,6 @@ static int handle_child_status( struct thread *thread, int pid, int status, int
}
if
(
thread
&&
(
WIFSIGNALED
(
status
)
||
WIFEXITED
(
status
)))
{
thread
->
attached
=
0
;
thread
->
unix_pid
=
-
1
;
thread
->
unix_tid
=
-
1
;
if
(
debug_level
)
...
...
@@ -155,7 +154,6 @@ static int wait4_thread( struct thread *thread, int signal )
{
thread
->
unix_pid
=
-
1
;
thread
->
unix_tid
=
-
1
;
thread
->
attached
=
0
;
}
else
perror
(
"wait4"
);
stop_watchdog
();
...
...
@@ -193,52 +191,11 @@ int send_thread_signal( struct thread *thread, int sig )
{
thread
->
unix_pid
=
-
1
;
thread
->
unix_tid
=
-
1
;
thread
->
attached
=
0
;
}
}
return
(
ret
!=
-
1
);
}
/* attach to a Unix process with ptrace */
int
attach_process
(
struct
process
*
process
)
{
struct
thread
*
thread
;
int
ret
=
1
;
if
(
list_empty
(
&
process
->
thread_list
))
/* need at least one running thread */
{
set_error
(
STATUS_ACCESS_DENIED
);
return
0
;
}
LIST_FOR_EACH_ENTRY
(
thread
,
&
process
->
thread_list
,
struct
thread
,
proc_entry
)
{
if
(
thread
->
attached
)
continue
;
if
(
suspend_for_ptrace
(
thread
))
resume_after_ptrace
(
thread
);
else
ret
=
0
;
}
return
ret
;
}
/* detach from a ptraced Unix process */
void
detach_process
(
struct
process
*
process
)
{
struct
thread
*
thread
;
LIST_FOR_EACH_ENTRY
(
thread
,
&
process
->
thread_list
,
struct
thread
,
proc_entry
)
{
if
(
thread
->
attached
)
{
/* make sure it is stopped */
suspend_for_ptrace
(
thread
);
if
(
thread
->
unix_pid
==
-
1
)
return
;
if
(
debug_level
)
fprintf
(
stderr
,
"%04x: *detached*
\n
"
,
thread
->
id
);
ptrace
(
PTRACE_DETACH
,
get_ptrace_pid
(
thread
),
(
caddr_t
)
1
,
0
);
thread
->
attached
=
0
;
}
}
}
/* suspend a thread to allow using ptrace on it */
/* you must do a resume_after_ptrace when finished with the thread */
int
suspend_for_ptrace
(
struct
thread
*
thread
)
...
...
@@ -246,21 +203,11 @@ int suspend_for_ptrace( struct thread *thread )
/* can't stop a thread while initialisation is in progress */
if
(
thread
->
unix_pid
==
-
1
||
!
is_process_init_done
(
thread
->
process
))
goto
error
;
if
(
thread
->
attached
)
{
if
(
!
send_thread_signal
(
thread
,
SIGSTOP
))
goto
error
;
}
else
/* this may fail if the client is already being debugged */
if
(
ptrace
(
PTRACE_ATTACH
,
get_ptrace_pid
(
thread
),
0
,
0
)
==
-
1
)
{
/* this may fail if the client is already being debugged */
if
(
!
use_ptrace
)
goto
error
;
if
(
ptrace
(
PTRACE_ATTACH
,
get_ptrace_pid
(
thread
),
0
,
0
)
==
-
1
)
{
if
(
errno
==
ESRCH
)
thread
->
unix_pid
=
thread
->
unix_tid
=
-
1
;
/* thread got killed */
goto
error
;
}
if
(
debug_level
)
fprintf
(
stderr
,
"%04x: *attached*
\n
"
,
thread
->
id
);
thread
->
attached
=
1
;
if
(
errno
==
ESRCH
)
thread
->
unix_pid
=
thread
->
unix_tid
=
-
1
;
/* thread got killed */
goto
error
;
}
if
(
wait4_thread
(
thread
,
SIGSTOP
))
return
1
;
resume_after_ptrace
(
thread
);
...
...
@@ -273,13 +220,10 @@ int suspend_for_ptrace( struct thread *thread )
void
resume_after_ptrace
(
struct
thread
*
thread
)
{
if
(
thread
->
unix_pid
==
-
1
)
return
;
assert
(
thread
->
attached
);
if
(
ptrace
(
PTRACE_DETACH
,
get_ptrace_pid
(
thread
),
(
caddr_t
)
1
,
0
)
==
-
1
)
{
if
(
errno
==
ESRCH
)
thread
->
unix_pid
=
thread
->
unix_tid
=
-
1
;
/* thread got killed */
}
if
(
debug_level
)
fprintf
(
stderr
,
"%04x: *detached*
\n
"
,
thread
->
id
);
thread
->
attached
=
0
;
}
/* read an int from a thread address space */
...
...
server/thread.c
View file @
820c5927
...
...
@@ -139,7 +139,6 @@ inline static void init_thread_structure( struct thread *thread )
thread
->
reply_fd
=
NULL
;
thread
->
wait_fd
=
NULL
;
thread
->
state
=
RUNNING
;
thread
->
attached
=
0
;
thread
->
exit_code
=
0
;
thread
->
priority
=
THREAD_PRIORITY_NORMAL
;
thread
->
affinity
=
1
;
...
...
server/thread.h
View file @
820c5927
...
...
@@ -72,7 +72,6 @@ struct thread
struct
fd
*
reply_fd
;
/* fd to send a reply to a client */
struct
fd
*
wait_fd
;
/* fd to use to wake a sleeping client */
enum
run_state
state
;
/* running state */
int
attached
;
/* is thread attached with ptrace? */
int
exit_code
;
/* thread exit code */
int
unix_pid
;
/* Unix pid of client */
int
unix_tid
;
/* Unix tid of client */
...
...
@@ -122,8 +121,6 @@ extern struct token *thread_get_impersonation_token( struct thread *thread );
extern
void
sigchld_callback
(
void
);
extern
int
get_ptrace_pid
(
struct
thread
*
thread
);
extern
int
attach_process
(
struct
process
*
process
);
extern
void
detach_process
(
struct
process
*
process
);
extern
int
suspend_for_ptrace
(
struct
thread
*
thread
);
extern
void
resume_after_ptrace
(
struct
thread
*
thread
);
extern
void
*
get_thread_ip
(
struct
thread
*
thread
);
...
...
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