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
5f258c68
Commit
5f258c68
authored
Jul 14, 2001
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Backed out the suspend_process_for_ptrace change.
Fixed a couple of races in ptrace code.
parent
c7b4ed77
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
14 additions
and
26 deletions
+14
-26
debugger.c
server/debugger.c
+1
-1
file.c
server/file.c
+1
-0
process.c
server/process.c
+0
-15
process.h
server/process.h
+0
-1
ptrace.c
server/ptrace.c
+12
-9
No files found.
server/debugger.c
View file @
5f258c68
...
...
@@ -411,7 +411,7 @@ static int debugger_attach( struct process *process, struct thread *debugger )
for
(
thread
=
debugger
;
thread
;
thread
=
thread
->
process
->
debugger
)
if
(
thread
->
process
==
process
)
goto
error
;
suspend_process
_for_ptrace
(
process
);
suspend_process
(
process
);
/* we must have been able to attach all threads */
for
(
thread
=
process
->
thread_list
;
thread
;
thread
=
thread
->
proc_next
)
...
...
server/file.c
View file @
5f258c68
...
...
@@ -319,6 +319,7 @@ void file_set_error(void)
case
EBADF
:
set_error
(
STATUS_INVALID_HANDLE
);
break
;
case
ENOSPC
:
set_error
(
STATUS_DISK_FULL
);
break
;
case
EACCES
:
case
ESRCH
:
case
EPERM
:
set_error
(
STATUS_ACCESS_DENIED
);
break
;
case
EROFS
:
set_error
(
STATUS_MEDIA_WRITE_PROTECTED
);
break
;
case
EBUSY
:
set_error
(
STATUS_FILE_LOCK_CONFLICT
);
break
;
...
...
server/process.c
View file @
5f258c68
...
...
@@ -491,21 +491,6 @@ void suspend_process( struct process *process )
}
}
/* suspend all the threads of a process to allow using ptrace on it*/
void
suspend_process_for_ptrace
(
struct
process
*
process
)
{
if
(
!
process
->
suspend
++
)
{
struct
thread
*
thread
=
process
->
thread_list
;
for
(;
thread
;
thread
=
thread
->
proc_next
)
{
if
(
thread
->
suspend
)
continue
;
if
(
suspend_for_ptrace
(
thread
))
thread
->
suspend
--
;
/* since the process is suspended, not the thread */
}
}
}
/* resume all the threads of a process */
void
resume_process
(
struct
process
*
process
)
{
...
...
server/process.h
View file @
5f258c68
...
...
@@ -81,7 +81,6 @@ extern void add_process_thread( struct process *process,
extern
void
remove_process_thread
(
struct
process
*
process
,
struct
thread
*
thread
);
extern
void
suspend_process
(
struct
process
*
process
);
extern
void
suspend_process_for_ptrace
(
struct
process
*
process
);
extern
void
resume_process
(
struct
process
*
process
);
extern
void
kill_process
(
struct
process
*
process
,
struct
thread
*
skip
,
int
exit_code
);
extern
void
kill_debugged_processes
(
struct
thread
*
debugger
,
int
exit_code
);
...
...
server/ptrace.c
View file @
5f258c68
...
...
@@ -42,20 +42,17 @@
#define PTRACE_POKEDATA PT_WRITE_D
#endif
#ifdef HAVE_SYS_PTRACE_H
static
const
int
use_ptrace
=
1
;
/* set to 0 to disable ptrace */
#else
static
const
int
use_ptrace
=
0
;
#ifndef HAVE_SYS_PTRACE_H
#define PT_CONTINUE 0
#define PT_ATTACH 1
#define PT_DETACH 2
#define PT_READ_D 3
#define PT_WRITE_D 4
#define PT_STEP 5
inline
static
int
ptrace
(
int
req
,
...)
{
errno
=
EPERM
;
return
-
1
;
/*FAIL*/
}
#endif
/* HAVE_SYS_PTRACE_H */
static
int
ptrace
(
int
req
,
...)
{
return
-
1
;
/*FAIL*/
}
#endif
static
const
int
use_ptrace
=
1
;
/* set to 0 to disable ptrace */
/* handle a status returned by wait4 */
static
int
handle_child_status
(
struct
thread
*
thread
,
int
pid
,
int
status
)
...
...
@@ -129,7 +126,12 @@ void wait4_thread( struct thread *thread, int signal )
static
int
attach_thread
(
struct
thread
*
thread
)
{
/* this may fail if the client is already being debugged */
if
(
!
use_ptrace
||
(
ptrace
(
PTRACE_ATTACH
,
thread
->
unix_pid
,
0
,
0
)
==
-
1
))
return
0
;
if
(
!
use_ptrace
)
return
0
;
if
(
ptrace
(
PTRACE_ATTACH
,
thread
->
unix_pid
,
0
,
0
)
==
-
1
)
{
if
(
errno
==
ESRCH
)
thread
->
unix_pid
=
0
;
/* process got killed */
return
0
;
}
if
(
debug_level
)
fprintf
(
stderr
,
"%08x: *attached*
\n
"
,
(
unsigned
int
)
thread
);
thread
->
attached
=
1
;
wait4_thread
(
thread
,
SIGSTOP
);
...
...
@@ -143,10 +145,11 @@ void detach_thread( struct thread *thread, int sig )
if
(
thread
->
attached
)
{
/* make sure it is stopped */
if
(
!
(
thread
->
suspend
+
thread
->
process
->
suspend
))
stop_thread
(
thread
);
suspend_thread
(
thread
,
0
);
if
(
sig
)
kill
(
thread
->
unix_pid
,
sig
);
if
(
debug_level
)
fprintf
(
stderr
,
"%08x: *detached*
\n
"
,
(
unsigned
int
)
thread
);
ptrace
(
PTRACE_DETACH
,
thread
->
unix_pid
,
(
caddr_t
)
1
,
sig
);
thread
->
suspend
=
0
;
/* detach makes it continue */
thread
->
attached
=
0
;
}
else
...
...
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