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
c242c3b3
Commit
c242c3b3
authored
Jul 11, 2006
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
server: Fixed get_thread_context for x86_64.
parent
e4d3a721
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
30 deletions
+21
-30
ptrace.c
server/ptrace.c
+21
-30
No files found.
server/ptrace.c
View file @
c242c3b3
...
...
@@ -29,9 +29,6 @@
#ifdef HAVE_SYS_PTRACE_H
# include <sys/ptrace.h>
#endif
#ifdef HAVE_SYS_REG_H
#include <sys/reg.h>
#endif
#ifdef HAVE_SYS_PARAM_H
# include <sys/param.h>
#endif
...
...
@@ -468,44 +465,38 @@ void get_selector_entry( struct thread *thread, int entry, unsigned int *base,
#endif
/* debug register offset in struct user */
#define DR_OFFSET(dr) ((int)((((struct user *)0)->u_debugreg) + (dr)))
/* retrieve a debug register */
static
inline
int
get_debug_reg
(
int
pid
,
int
num
,
DWORD
*
data
)
{
int
res
;
errno
=
0
;
res
=
ptrace
(
PTRACE_PEEKUSER
,
pid
,
DR_OFFSET
(
num
),
0
);
if
((
res
==
-
1
)
&&
errno
)
{
file_set_error
();
return
-
1
;
}
*
data
=
res
;
return
0
;
}
#define DR_OFFSET(dr) ((((struct user *)0)->u_debugreg) + (dr))
/* retrieve the thread x86 registers */
void
get_thread_context
(
struct
thread
*
thread
,
CONTEXT
*
context
,
unsigned
int
flags
)
{
int
pid
=
get_ptrace_pid
(
thread
);
int
i
,
pid
=
get_ptrace_pid
(
thread
);
long
data
[
8
];
/* all other regs are handled on the client side */
assert
(
(
flags
|
CONTEXT_i386
)
==
CONTEXT_DEBUG_REGISTERS
);
if
(
!
suspend_for_ptrace
(
thread
))
return
;
if
(
get_debug_reg
(
pid
,
0
,
&
context
->
Dr0
)
==
-
1
)
goto
error
;
if
(
get_debug_reg
(
pid
,
1
,
&
context
->
Dr1
)
==
-
1
)
goto
error
;
if
(
get_debug_reg
(
pid
,
2
,
&
context
->
Dr2
)
==
-
1
)
goto
error
;
if
(
get_debug_reg
(
pid
,
3
,
&
context
->
Dr3
)
==
-
1
)
goto
error
;
if
(
get_debug_reg
(
pid
,
6
,
&
context
->
Dr6
)
==
-
1
)
goto
error
;
if
(
get_debug_reg
(
pid
,
7
,
&
context
->
Dr7
)
==
-
1
)
goto
error
;
for
(
i
=
0
;
i
<
8
;
i
++
)
{
if
(
i
==
4
||
i
==
5
)
continue
;
errno
=
0
;
data
[
i
]
=
ptrace
(
PTRACE_PEEKUSER
,
pid
,
DR_OFFSET
(
i
),
0
);
if
((
data
[
i
]
==
-
1
)
&&
errno
)
{
file_set_error
();
goto
done
;
}
}
context
->
Dr0
=
data
[
0
];
context
->
Dr1
=
data
[
1
];
context
->
Dr2
=
data
[
2
];
context
->
Dr3
=
data
[
3
];
context
->
Dr6
=
data
[
6
];
context
->
Dr7
=
data
[
7
];
context
->
ContextFlags
|=
CONTEXT_DEBUG_REGISTERS
;
resume_after_ptrace
(
thread
);
return
;
error:
file_set_error
();
done:
resume_after_ptrace
(
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