Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
wine
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Zsolt Vadász
wine
Commits
c242c3b3
Commit
c242c3b3
authored
18 years ago
by
Alexandre Julliard
Browse files
Options
Downloads
Patches
Plain Diff
server: Fixed get_thread_context for x86_64.
parent
e4d3a721
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
server/ptrace.c
+21
-30
21 additions, 30 deletions
server/ptrace.c
with
21 additions
and
30 deletions
server/ptrace.c
+
21
−
30
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
);
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment