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
9f3e8a51
Commit
9f3e8a51
authored
Nov 08, 2021
by
Eric Pouech
Committed by
Alexandre Julliard
Nov 08, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dbghelp: Use cpu from debuggee's modules rather than debugger's.
Signed-off-by:
Eric Pouech
<
eric.pouech@gmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
e8b19532
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
27 deletions
+33
-27
dwarf.c
dlls/dbghelp/dwarf.c
+28
-22
module.c
dlls/dbghelp/module.c
+3
-3
stabs.c
dlls/dbghelp/stabs.c
+2
-2
No files found.
dlls/dbghelp/dwarf.c
View file @
9f3e8a51
...
...
@@ -812,7 +812,7 @@ static unsigned dwarf2_map_register(int regno, const struct module* module)
FIXME
(
"What the heck map reg 0x%x
\n
"
,
regno
);
return
0
;
}
return
dbghelp_current_
cpu
->
map_dwarf_register
(
regno
,
module
,
FALSE
);
return
module
->
cpu
->
map_dwarf_register
(
regno
,
module
,
FALSE
);
}
static
enum
location_error
...
...
@@ -847,8 +847,8 @@ compute_location(const struct module *module, const dwarf2_cuhead_t* head,
DWORD
cvreg
=
dwarf2_map_register
(
op
-
DW_OP_reg0
,
module
);
if
(
loc
->
reg
!=
Wine_DW_no_register
)
FIXME
(
"Only supporting one reg (%s/%d -> %s/%d)
\n
"
,
dbghelp_current_
cpu
->
fetch_regname
(
loc
->
reg
),
loc
->
reg
,
dbghelp_current_
cpu
->
fetch_regname
(
cvreg
),
cvreg
);
module
->
cpu
->
fetch_regname
(
loc
->
reg
),
loc
->
reg
,
module
->
cpu
->
fetch_regname
(
cvreg
),
cvreg
);
loc
->
reg
=
cvreg
;
}
loc
->
kind
=
loc_register
;
...
...
@@ -864,8 +864,8 @@ compute_location(const struct module *module, const dwarf2_cuhead_t* head,
DWORD
cvreg
=
dwarf2_map_register
(
op
-
DW_OP_breg0
,
module
);
if
(
loc
->
reg
!=
Wine_DW_no_register
)
FIXME
(
"Only supporting one breg (%s/%d -> %s/%d)
\n
"
,
dbghelp_current_
cpu
->
fetch_regname
(
loc
->
reg
),
loc
->
reg
,
dbghelp_current_
cpu
->
fetch_regname
(
cvreg
),
cvreg
);
module
->
cpu
->
fetch_regname
(
loc
->
reg
),
loc
->
reg
,
module
->
cpu
->
fetch_regname
(
cvreg
),
cvreg
);
loc
->
reg
=
cvreg
;
}
stack
[
++
stk
]
=
dwarf2_leb128_as_signed
(
ctx
);
...
...
@@ -938,7 +938,7 @@ compute_location(const struct module *module, const dwarf2_cuhead_t* head,
case
DW_OP_fbreg
:
if
(
loc
->
reg
!=
Wine_DW_no_register
)
FIXME
(
"Only supporting one reg (%s/%d -> -2)
\n
"
,
dbghelp_current_
cpu
->
fetch_regname
(
loc
->
reg
),
loc
->
reg
);
module
->
cpu
->
fetch_regname
(
loc
->
reg
),
loc
->
reg
);
if
(
frame
&&
frame
->
kind
==
loc_register
)
{
loc
->
kind
=
loc_regrel
;
...
...
@@ -2284,7 +2284,7 @@ static struct symt* dwarf2_parse_subprogram(dwarf2_debug_info_t* di)
{
/* on stack !! */
subpgm
.
frame
.
kind
=
loc_regrel
;
subpgm
.
frame
.
reg
=
d
bghelp_current_
cpu
->
frame_regno
;
subpgm
.
frame
.
reg
=
d
i
->
unit_ctx
->
module_ctx
->
module
->
cpu
->
frame_regno
;
subpgm
.
frame
.
offset
=
0
;
}
subpgm
.
non_computed_variable
=
FALSE
;
...
...
@@ -3256,7 +3256,7 @@ static void execute_cfa_instructions(struct module* module, dwarf2_traverse_cont
if
(
!
valid_reg
(
reg
))
break
;
TRACE
(
"%lx: DW_CFA_offset %s, %ld
\n
"
,
info
->
ip
,
dbghelp_current_cpu
->
fetch_regname
(
dbghelp_current_
cpu
->
map_dwarf_register
(
reg
,
module
,
TRUE
)),
module
->
cpu
->
fetch_regname
(
module
->
cpu
->
map_dwarf_register
(
reg
,
module
,
TRUE
)),
offset
);
info
->
state
.
regs
[
reg
]
=
offset
;
info
->
state
.
rules
[
reg
]
=
RULE_CFA_OFFSET
;
...
...
@@ -3268,7 +3268,7 @@ static void execute_cfa_instructions(struct module* module, dwarf2_traverse_cont
if
(
!
valid_reg
(
reg
))
break
;
TRACE
(
"%lx: DW_CFA_restore %s
\n
"
,
info
->
ip
,
dbghelp_current_cpu
->
fetch_regname
(
dbghelp_current_
cpu
->
map_dwarf_register
(
reg
,
module
,
TRUE
)));
module
->
cpu
->
fetch_regname
(
module
->
cpu
->
map_dwarf_register
(
reg
,
module
,
TRUE
)));
info
->
state
.
rules
[
reg
]
=
RULE_UNSET
;
break
;
}
...
...
@@ -3316,7 +3316,7 @@ static void execute_cfa_instructions(struct module* module, dwarf2_traverse_cont
if
(
!
valid_reg
(
reg
))
break
;
TRACE
(
"%lx: DW_CFA_offset_extended %s, %ld
\n
"
,
info
->
ip
,
dbghelp_current_cpu
->
fetch_regname
(
dbghelp_current_
cpu
->
map_dwarf_register
(
reg
,
module
,
TRUE
)),
module
->
cpu
->
fetch_regname
(
module
->
cpu
->
map_dwarf_register
(
reg
,
module
,
TRUE
)),
offset
);
info
->
state
.
regs
[
reg
]
=
offset
;
info
->
state
.
rules
[
reg
]
=
RULE_CFA_OFFSET
;
...
...
@@ -3328,7 +3328,7 @@ static void execute_cfa_instructions(struct module* module, dwarf2_traverse_cont
if
(
!
valid_reg
(
reg
))
break
;
TRACE
(
"%lx: DW_CFA_restore_extended %s
\n
"
,
info
->
ip
,
dbghelp_current_cpu
->
fetch_regname
(
dbghelp_current_
cpu
->
map_dwarf_register
(
reg
,
module
,
TRUE
)));
module
->
cpu
->
fetch_regname
(
module
->
cpu
->
map_dwarf_register
(
reg
,
module
,
TRUE
)));
info
->
state
.
rules
[
reg
]
=
RULE_UNSET
;
break
;
}
...
...
@@ -3338,7 +3338,7 @@ static void execute_cfa_instructions(struct module* module, dwarf2_traverse_cont
if
(
!
valid_reg
(
reg
))
break
;
TRACE
(
"%lx: DW_CFA_undefined %s
\n
"
,
info
->
ip
,
dbghelp_current_cpu
->
fetch_regname
(
dbghelp_current_
cpu
->
map_dwarf_register
(
reg
,
module
,
TRUE
)));
module
->
cpu
->
fetch_regname
(
module
->
cpu
->
map_dwarf_register
(
reg
,
module
,
TRUE
)));
info
->
state
.
rules
[
reg
]
=
RULE_UNDEFINED
;
break
;
}
...
...
@@ -3348,7 +3348,7 @@ static void execute_cfa_instructions(struct module* module, dwarf2_traverse_cont
if
(
!
valid_reg
(
reg
))
break
;
TRACE
(
"%lx: DW_CFA_same_value %s
\n
"
,
info
->
ip
,
dbghelp_current_cpu
->
fetch_regname
(
dbghelp_current_
cpu
->
map_dwarf_register
(
reg
,
module
,
TRUE
)));
module
->
cpu
->
fetch_regname
(
module
->
cpu
->
map_dwarf_register
(
reg
,
module
,
TRUE
)));
info
->
state
.
regs
[
reg
]
=
reg
;
info
->
state
.
rules
[
reg
]
=
RULE_SAME
;
break
;
...
...
@@ -3360,8 +3360,8 @@ static void execute_cfa_instructions(struct module* module, dwarf2_traverse_cont
if
(
!
valid_reg
(
reg
)
||
!
valid_reg
(
reg2
))
break
;
TRACE
(
"%lx: DW_CFA_register %s == %s
\n
"
,
info
->
ip
,
dbghelp_current_cpu
->
fetch_regname
(
dbghelp_current_
cpu
->
map_dwarf_register
(
reg
,
module
,
TRUE
)),
dbghelp_current_cpu
->
fetch_regname
(
dbghelp_current_
cpu
->
map_dwarf_register
(
reg2
,
module
,
TRUE
)));
module
->
cpu
->
fetch_regname
(
module
->
cpu
->
map_dwarf_register
(
reg
,
module
,
TRUE
)),
module
->
cpu
->
fetch_regname
(
module
->
cpu
->
map_dwarf_register
(
reg2
,
module
,
TRUE
)));
info
->
state
.
regs
[
reg
]
=
reg2
;
info
->
state
.
rules
[
reg
]
=
RULE_OTHER_REG
;
break
;
...
...
@@ -3389,7 +3389,7 @@ static void execute_cfa_instructions(struct module* module, dwarf2_traverse_cont
if
(
!
valid_reg
(
reg
))
break
;
TRACE
(
"%lx: DW_CFA_def_cfa %s, %ld
\n
"
,
info
->
ip
,
dbghelp_current_cpu
->
fetch_regname
(
dbghelp_current_
cpu
->
map_dwarf_register
(
reg
,
module
,
TRUE
)),
module
->
cpu
->
fetch_regname
(
module
->
cpu
->
map_dwarf_register
(
reg
,
module
,
TRUE
)),
offset
);
info
->
state
.
cfa_reg
=
reg
;
info
->
state
.
cfa_offset
=
offset
;
...
...
@@ -3402,7 +3402,7 @@ static void execute_cfa_instructions(struct module* module, dwarf2_traverse_cont
if
(
!
valid_reg
(
reg
))
break
;
TRACE
(
"%lx: DW_CFA_def_cfa_register %s
\n
"
,
info
->
ip
,
dbghelp_current_cpu
->
fetch_regname
(
dbghelp_current_
cpu
->
map_dwarf_register
(
reg
,
module
,
TRUE
)));
module
->
cpu
->
fetch_regname
(
module
->
cpu
->
map_dwarf_register
(
reg
,
module
,
TRUE
)));
info
->
state
.
cfa_reg
=
reg
;
info
->
state
.
cfa_rule
=
RULE_CFA_OFFSET
;
break
;
...
...
@@ -3436,7 +3436,7 @@ static void execute_cfa_instructions(struct module* module, dwarf2_traverse_cont
if
(
!
valid_reg
(
reg
))
break
;
TRACE
(
"%lx: DW_CFA_%sexpression %s %lx-%lx
\n
"
,
info
->
ip
,
(
op
==
DW_CFA_expression
)
?
""
:
"val_"
,
dbghelp_current_cpu
->
fetch_regname
(
dbghelp_current_
cpu
->
map_dwarf_register
(
reg
,
module
,
TRUE
)),
module
->
cpu
->
fetch_regname
(
module
->
cpu
->
map_dwarf_register
(
reg
,
module
,
TRUE
)),
expr
,
expr
+
len
);
info
->
state
.
regs
[
reg
]
=
expr
;
info
->
state
.
rules
[
reg
]
=
(
op
==
DW_CFA_expression
)
?
RULE_EXPRESSION
:
RULE_VAL_EXPRESSION
;
...
...
@@ -3465,6 +3465,7 @@ static DWORD64 get_context_reg(const struct module* module, struct cpu_stack_wal
unsigned
regno
=
csw
->
cpu
->
map_dwarf_register
(
dw_reg
,
module
,
TRUE
),
sz
;
void
*
ptr
=
csw
->
cpu
->
fetch_context_reg
(
context
,
regno
,
&
sz
);
if
(
csw
->
cpu
!=
module
->
cpu
)
FIXME
(
"mismatch in cpu
\n
"
);
if
(
sz
==
8
)
return
*
(
DWORD64
*
)
ptr
;
else
if
(
sz
==
4
)
...
...
@@ -3481,6 +3482,7 @@ static void set_context_reg(const struct module* module, struct cpu_stack_walk*
unsigned
regno
=
csw
->
cpu
->
map_dwarf_register
(
dw_reg
,
module
,
TRUE
),
sz
;
ULONG_PTR
*
ptr
=
csw
->
cpu
->
fetch_context_reg
(
context
,
regno
,
&
sz
);
if
(
csw
->
cpu
!=
module
->
cpu
)
FIXME
(
"mismatch in cpu
\n
"
);
if
(
isdebuggee
)
{
char
tmp
[
16
];
...
...
@@ -3518,6 +3520,7 @@ static void copy_context_reg(const struct module* module, struct cpu_stack_walk
ULONG_PTR
*
ptrdst
=
csw
->
cpu
->
fetch_context_reg
(
dstcontext
,
regdstno
,
&
szdst
);
ULONG_PTR
*
ptrsrc
=
csw
->
cpu
->
fetch_context_reg
(
srccontext
,
regsrcno
,
&
szsrc
);
if
(
csw
->
cpu
!=
module
->
cpu
)
FIXME
(
"mismatch in cpu
\n
"
);
if
(
szdst
!=
szsrc
)
{
FIXME
(
"Cannot copy register %lu/%u => %lu/%u because of size mismatch (%u => %u)
\n
"
,
...
...
@@ -3536,6 +3539,7 @@ static ULONG_PTR eval_expression(const struct module* module, struct cpu_stack_w
int
sp
=
-
1
;
ULONG_PTR
len
;
if
(
csw
->
cpu
!=
module
->
cpu
)
FIXME
(
"mismatch in cpu
\n
"
);
ctx
.
data
=
zp
;
ctx
.
end_data
=
zp
+
4
;
len
=
dwarf2_leb128_as_unsigned
(
&
ctx
);
...
...
@@ -3647,6 +3651,7 @@ static void apply_frame_state(const struct module* module, struct cpu_stack_walk
ULONG_PTR
value
;
union
ctx
new_context
=
*
context
;
if
(
csw
->
cpu
!=
module
->
cpu
)
FIXME
(
"mismatch in cpu
\n
"
);
switch
(
state
->
cfa_rule
)
{
case
RULE_EXPRESSION
:
...
...
@@ -3756,6 +3761,7 @@ BOOL dwarf2_virtual_unwind(struct cpu_stack_walk *csw, ULONG_PTR ip,
struct
frame_info
info
;
if
(
!
module_init_pair
(
&
pair
,
csw
->
hProcess
,
ip
))
return
FALSE
;
if
(
csw
->
cpu
!=
pair
.
effective
->
cpu
)
FIXME
(
"mismatch in cpu
\n
"
);
if
(
!
dwarf2_fetch_frame_info
(
pair
.
effective
,
csw
->
cpu
,
ip
,
&
info
))
return
FALSE
;
/* if at very beginning of function, return and use default unwinder */
...
...
@@ -3773,15 +3779,15 @@ static BOOL compute_call_frame_cfa(struct module* module, ULONG_PTR ip, struct l
{
struct
frame_info
info
;
if
(
!
dwarf2_fetch_frame_info
(
module
,
dbghelp_current_
cpu
,
ip
,
&
info
))
return
FALSE
;
if
(
!
dwarf2_fetch_frame_info
(
module
,
module
->
cpu
,
ip
,
&
info
))
return
FALSE
;
/* beginning of function, or no available dwarf information ? */
if
(
ip
==
info
.
ip
||
info
.
state
.
rules
[
info
.
retaddr_reg
]
==
RULE_UNSET
)
{
/* fake the default unwinder */
frame
->
kind
=
loc_regrel
;
frame
->
reg
=
dbghelp_current_
cpu
->
frame_regno
;
frame
->
offset
=
dbghelp_current_
cpu
->
word_size
;
/* FIXME stack direction */
frame
->
reg
=
module
->
cpu
->
frame_regno
;
frame
->
offset
=
module
->
cpu
->
word_size
;
/* FIXME stack direction */
}
else
{
...
...
@@ -3798,7 +3804,7 @@ static BOOL compute_call_frame_cfa(struct module* module, ULONG_PTR ip, struct l
return
FALSE
;
default:
frame
->
kind
=
loc_regrel
;
frame
->
reg
=
dbghelp_current_
cpu
->
map_dwarf_register
(
info
.
state
.
cfa_reg
,
module
,
TRUE
);
frame
->
reg
=
module
->
cpu
->
map_dwarf_register
(
info
.
state
.
cfa_reg
,
module
,
TRUE
);
frame
->
offset
=
info
.
state
.
cfa_offset
;
break
;
}
...
...
dlls/dbghelp/module.c
View file @
9f3e8a51
...
...
@@ -1480,11 +1480,11 @@ PVOID WINAPI SymFunctionTableAccess64(HANDLE hProcess, DWORD64 AddrBase)
struct
process
*
pcs
=
process_find_by_handle
(
hProcess
);
struct
module
*
module
;
if
(
!
pcs
||
!
dbghelp_current_cpu
->
find_runtime_function
)
return
NULL
;
if
(
!
pcs
)
return
NULL
;
module
=
module_find_by_addr
(
pcs
,
AddrBase
,
DMT_UNKNOWN
);
if
(
!
module
)
return
NULL
;
if
(
!
module
||
!
module
->
cpu
->
find_runtime_function
)
return
NULL
;
return
dbghelp_current_
cpu
->
find_runtime_function
(
module
,
AddrBase
);
return
module
->
cpu
->
find_runtime_function
(
module
,
AddrBase
);
}
static
BOOL
native_synchronize_module_list
(
struct
process
*
pcs
)
...
...
dlls/dbghelp/stabs.c
View file @
9f3e8a51
...
...
@@ -1396,7 +1396,7 @@ BOOL stabs_parse(struct module* module, ULONG_PTR load_offset,
continue
;
}
loc
.
kind
=
loc_regrel
;
loc
.
reg
=
dbghelp_current_
cpu
->
frame_regno
;
loc
.
reg
=
module
->
cpu
->
frame_regno
;
loc
.
offset
=
n_value
;
symt_add_func_local
(
module
,
curr_func
,
(
int
)
n_value
>=
0
?
DataIsParam
:
DataIsLocal
,
...
...
@@ -1476,7 +1476,7 @@ BOOL stabs_parse(struct module* module, ULONG_PTR load_offset,
case
N_LSYM
:
/* These are local variables */
loc
.
kind
=
loc_regrel
;
loc
.
reg
=
dbghelp_current_
cpu
->
frame_regno
;
loc
.
reg
=
module
->
cpu
->
frame_regno
;
loc
.
offset
=
n_value
;
if
(
curr_func
!=
NULL
)
pending_add_var
(
&
pending_block
,
ptr
,
DataIsLocal
,
&
loc
);
break
;
...
...
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