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
dd977e4a
Commit
dd977e4a
authored
Jul 29, 2022
by
Eric Pouech
Committed by
Alexandre Julliard
Jul 29, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winedbg: Store result of types_get_info(TI_GET_TYPE) in dbg_type.
Signed-off-by:
Eric Pouech
<
eric.pouech@gmail.com
>
parent
d909f275
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
31 deletions
+37
-31
expr.c
programs/winedbg/expr.c
+5
-5
types.c
programs/winedbg/types.c
+32
-26
No files found.
programs/winedbg/expr.c
View file @
dd977e4a
...
...
@@ -443,7 +443,7 @@ struct dbg_lvalue expr_eval(struct expr* exp)
init_lvalue_in_debugger
(
&
rtn
,
0
,
dbg_itype_none
,
&
exp
->
un
.
call
.
result
);
/* get return type from function signature type */
/* FIXME rtn.type.module should be set to function's module... */
types_get_info
(
&
rtn
.
type
,
TI_GET_TYPE
,
&
rtn
.
type
.
id
);
types_get_info
(
&
rtn
.
type
,
TI_GET_TYPE
,
&
rtn
.
type
);
break
;
case
EXPR_TYPE_INTVAR
:
if
(
!
(
div
=
dbg_get_internal_var
(
exp
->
un
.
intvar
.
name
)))
...
...
@@ -463,11 +463,11 @@ struct dbg_lvalue expr_eval(struct expr* exp)
case
EXP_OP_ADD
:
if
(
!
types_get_info
(
&
exp1
.
type
,
TI_GET_SYMTAG
,
&
tag
)
||
tag
!=
SymTagPointerType
||
!
types_get_info
(
&
exp1
.
type
,
TI_GET_TYPE
,
&
type1
.
id
))
!
types_get_info
(
&
exp1
.
type
,
TI_GET_TYPE
,
&
type1
))
type1
.
id
=
dbg_itype_none
;
if
(
!
types_get_info
(
&
exp2
.
type
,
TI_GET_SYMTAG
,
&
tag
)
||
tag
!=
SymTagPointerType
||
!
types_get_info
(
&
exp2
.
type
,
TI_GET_TYPE
,
&
type2
.
id
))
!
types_get_info
(
&
exp2
.
type
,
TI_GET_TYPE
,
&
type2
))
type2
.
id
=
dbg_itype_none
;
scale1
=
1
;
scale2
=
1
;
...
...
@@ -489,11 +489,11 @@ struct dbg_lvalue expr_eval(struct expr* exp)
case
EXP_OP_SUB
:
if
(
!
types_get_info
(
&
exp1
.
type
,
TI_GET_SYMTAG
,
&
tag
)
||
tag
!=
SymTagPointerType
||
!
types_get_info
(
&
exp1
.
type
,
TI_GET_TYPE
,
&
type1
.
id
))
!
types_get_info
(
&
exp1
.
type
,
TI_GET_TYPE
,
&
type1
))
type1
.
id
=
dbg_itype_none
;
if
(
!
types_get_info
(
&
exp2
.
type
,
TI_GET_SYMTAG
,
&
tag
)
||
tag
!=
SymTagPointerType
||
!
types_get_info
(
&
exp2
.
type
,
TI_GET_TYPE
,
&
type2
.
id
))
!
types_get_info
(
&
exp2
.
type
,
TI_GET_TYPE
,
&
type2
))
type2
.
id
=
dbg_itype_none
;
scale1
=
1
;
scale2
=
1
;
...
...
programs/winedbg/types.c
View file @
dd977e4a
...
...
@@ -42,7 +42,7 @@ BOOL types_get_real_type(struct dbg_type* type, DWORD* tag)
if
(
!
types_get_info
(
type
,
TI_GET_SYMTAG
,
tag
))
return
FALSE
;
if
(
*
tag
!=
SymTagTypedef
)
return
TRUE
;
}
while
(
types_get_info
(
type
,
TI_GET_TYPE
,
&
type
->
id
));
}
while
(
types_get_info
(
type
,
TI_GET_TYPE
,
type
));
return
FALSE
;
}
...
...
@@ -199,8 +199,7 @@ static BOOL types_get_udt_element_lvalue(struct dbg_lvalue* lvalue, const struct
DWORD
offset
,
bitoffset
;
DWORD64
length
;
types_get_info
(
type
,
TI_GET_TYPE
,
&
lvalue
->
type
.
id
);
lvalue
->
type
.
module
=
type
->
module
;
types_get_info
(
type
,
TI_GET_TYPE
,
&
lvalue
->
type
);
if
(
!
types_get_info
(
type
,
TI_GET_OFFSET
,
&
offset
))
return
FALSE
;
lvalue
->
addr
.
Offset
+=
offset
;
...
...
@@ -306,8 +305,7 @@ BOOL types_array_index(const struct dbg_lvalue* lvalue, int index, struct dbg_lv
/*
* Get the base type, so we know how much to index by.
*/
if
(
!
types_get_info
(
&
type
,
TI_GET_TYPE
,
&
result
->
type
.
id
))
return
FALSE
;
result
->
type
.
module
=
type
.
module
;
if
(
!
types_get_info
(
&
type
,
TI_GET_TYPE
,
&
result
->
type
))
return
FALSE
;
if
(
index
)
{
DWORD64
length
;
...
...
@@ -342,8 +340,7 @@ static BOOL CALLBACK types_cb(PSYMBOL_INFO sym, ULONG size, void* _user)
{
struct
type_find_t
*
user
=
_user
;
BOOL
ret
=
TRUE
;
struct
dbg_type
type
;
DWORD
type_id
;
struct
dbg_type
type
,
type_id
;
if
(
sym
->
Tag
==
user
->
tag
)
{
...
...
@@ -359,7 +356,7 @@ static BOOL CALLBACK types_cb(PSYMBOL_INFO sym, ULONG size, void* _user)
case
SymTagPointerType
:
type
.
module
=
sym
->
ModBase
;
type
.
id
=
sym
->
TypeIndex
;
if
(
types_get_info
(
&
type
,
TI_GET_TYPE
,
&
type_id
)
&&
type_id
==
user
->
ptr_typeid
)
if
(
types_get_info
(
&
type
,
TI_GET_TYPE
,
&
type_id
)
&&
type_id
.
id
==
user
->
ptr_typeid
)
{
user
->
type
=
type
;
ret
=
FALSE
;
...
...
@@ -508,7 +505,7 @@ void print_value(const struct dbg_lvalue* lvalue, char format, int level)
types_get_info
(
&
type
,
TI_GET_COUNT
,
&
count
);
types_get_info
(
&
type
,
TI_GET_LENGTH
,
&
size
);
lvalue_field
=
*
lvalue
;
types_get_info
(
&
lvalue_field
.
type
,
TI_GET_TYPE
,
&
lvalue_field
.
type
.
id
);
types_get_info
(
&
lvalue_field
.
type
,
TI_GET_TYPE
,
&
lvalue_field
.
type
);
types_get_real_type
(
&
lvalue_field
.
type
,
&
tag
);
if
(
size
==
count
&&
tag
==
SymTagBaseType
)
...
...
@@ -546,7 +543,7 @@ void print_value(const struct dbg_lvalue* lvalue, char format, int level)
break
;
case
SymTagTypedef
:
lvalue_field
=
*
lvalue
;
types_get_info
(
&
lvalue
->
type
,
TI_GET_TYPE
,
&
lvalue_field
.
type
.
id
);
types_get_info
(
&
lvalue
->
type
,
TI_GET_TYPE
,
&
lvalue_field
.
type
);
print_value
(
&
lvalue_field
,
format
,
level
);
break
;
default:
...
...
@@ -615,8 +612,7 @@ BOOL types_print_type(const struct dbg_type* type, BOOL details)
}
break
;
case
SymTagPointerType
:
types_get_info
(
type
,
TI_GET_TYPE
,
&
subtype
.
id
);
subtype
.
module
=
type
->
module
;
types_get_info
(
type
,
TI_GET_TYPE
,
&
subtype
);
types_print_type
(
&
subtype
,
FALSE
);
dbg_printf
(
"*"
);
break
;
...
...
@@ -653,7 +649,7 @@ BOOL types_print_type(const struct dbg_type* type, BOOL details)
if
(
!
types_get_info
(
&
type_elt
,
TI_GET_BITPOSITION
,
&
bitoffset
)
||
!
types_get_info
(
&
type_elt
,
TI_GET_LENGTH
,
&
bitlen
))
bitlen
=
~
(
DWORD64
)
0
;
if
(
types_get_info
(
&
type_elt
,
TI_GET_TYPE
,
&
type_elt
.
id
))
if
(
types_get_info
(
&
type_elt
,
TI_GET_TYPE
,
&
type_elt
))
{
/* print details of embedded UDT:s */
types_print_type
(
&
type_elt
,
types_get_info
(
&
type_elt
,
TI_GET_UDTKIND
,
&
udt
));
...
...
@@ -674,8 +670,7 @@ BOOL types_print_type(const struct dbg_type* type, BOOL details)
}
break
;
case
SymTagArrayType
:
types_get_info
(
type
,
TI_GET_TYPE
,
&
subtype
.
id
);
subtype
.
module
=
type
->
module
;
types_get_info
(
type
,
TI_GET_TYPE
,
&
subtype
);
types_print_type
(
&
subtype
,
FALSE
);
if
(
types_get_info
(
type
,
TI_GET_COUNT
,
&
count
))
dbg_printf
(
" %ls[%ld]"
,
name
,
count
);
...
...
@@ -731,11 +726,10 @@ BOOL types_print_type(const struct dbg_type* type, BOOL details)
}
break
;
case
SymTagFunctionType
:
types_get_info
(
type
,
TI_GET_TYPE
,
&
subtype
.
id
);
types_get_info
(
type
,
TI_GET_TYPE
,
&
subtype
);
/* is the returned type the same object as function sig itself ? */
if
(
subtype
.
id
!=
type
->
id
)
{
subtype
.
module
=
type
->
module
;
types_print_type
(
&
subtype
,
FALSE
);
}
else
...
...
@@ -760,7 +754,7 @@ BOOL types_print_type(const struct dbg_type* type, BOOL details)
for
(
i
=
0
;
i
<
min
(
fcp
->
Count
,
count
);
i
++
)
{
subtype
.
id
=
fcp
->
ChildId
[
i
];
types_get_info
(
&
subtype
,
TI_GET_TYPE
,
&
subtype
.
id
);
types_get_info
(
&
subtype
,
TI_GET_TYPE
,
&
subtype
);
types_print_type
(
&
subtype
,
FALSE
);
if
(
i
<
min
(
fcp
->
Count
,
count
)
-
1
||
count
>
256
)
dbg_printf
(
", "
);
}
...
...
@@ -772,10 +766,9 @@ BOOL types_print_type(const struct dbg_type* type, BOOL details)
dbg_printf
(
")"
);
break
;
case
SymTagTypedef
:
if
(
details
&&
types_get_info
(
type
,
TI_GET_TYPE
,
&
subtype
.
id
))
if
(
details
&&
types_get_info
(
type
,
TI_GET_TYPE
,
&
subtype
))
{
dbg_printf
(
"typedef %ls => "
,
name
);
subtype
.
module
=
type
->
module
;
types_print_type
(
&
subtype
,
FALSE
);
}
else
dbg_printf
(
"%ls"
,
name
);
...
...
@@ -1044,6 +1037,11 @@ static BOOL lookup_base_type_in_data_model(DWORD64 module, unsigned bt, unsigned
/* helper to typecast pInfo to its expected type (_t) */
#define X(_t) (*((_t*)pInfo))
/* Wrapper around SymGetTypeInfo
* - module & type id on input are in dbg_type structure
* - for TI_GET_TYPE a pointer to a dbg_type is expected for pInfo
* (instead of DWORD* for SymGetTypeInfo)
*/
BOOL
types_get_info
(
const
struct
dbg_type
*
type
,
IMAGEHLP_SYMBOL_TYPE_INFO
ti
,
void
*
pInfo
)
{
if
(
type
->
id
==
dbg_itype_none
)
return
FALSE
;
...
...
@@ -1065,6 +1063,14 @@ BOOL types_get_info(const struct dbg_type* type, IMAGEHLP_SYMBOL_TYPE_INFO ti, v
return
TRUE
;
}
}
else
if
(
ti
==
TI_GET_TYPE
)
{
struct
dbg_type
*
dt
=
(
struct
dbg_type
*
)
pInfo
;
if
(
!
SymGetTypeInfo
(
dbg_curr_process
->
handle
,
type
->
module
,
type
->
id
,
ti
,
&
dt
->
id
))
return
FALSE
;
dt
->
module
=
type
->
module
;
return
TRUE
;
}
return
SymGetTypeInfo
(
dbg_curr_process
->
handle
,
type
->
module
,
type
->
id
,
ti
,
pInfo
);
}
...
...
@@ -1108,7 +1114,7 @@ BOOL types_get_info(const struct dbg_type* type, IMAGEHLP_SYMBOL_TYPE_INFO ti, v
{
case
TI_GET_SYMTAG
:
X
(
DWORD
)
=
SymTagPointerType
;
break
;
case
TI_GET_LENGTH
:
X
(
DWORD64
)
=
ADDRSIZE
;
break
;
case
TI_GET_TYPE
:
X
(
DWORD
)
=
dbg_itype_char
;
break
;
case
TI_GET_TYPE
:
{
struct
dbg_type
*
dt
=
pInfo
;
dt
->
id
=
dbg_itype_char
;
dt
->
module
=
type
->
module
;
break
;
}
default:
WINE_FIXME
(
"unsupported %u for a string
\n
"
,
ti
);
return
FALSE
;
}
break
;
...
...
@@ -1130,7 +1136,7 @@ BOOL types_get_info(const struct dbg_type* type, IMAGEHLP_SYMBOL_TYPE_INFO ti, v
default:
WINE_FIXME
(
"unsupported %u for XMM register
\n
"
,
ti
);
return
FALSE
;
}
break
;
default:
WINE_FIXME
(
"unsupported type id 0x%lx
\n
"
,
type
->
id
);
default:
WINE_FIXME
(
"unsupported type id 0x%lx
\n
"
,
type
->
id
);
return
FALSE
;
}
#undef X
...
...
@@ -1184,8 +1190,8 @@ static BOOL types_compare_children(struct dbg_type type1, struct dbg_type type2,
if
(
ret
&&
*
equal
)
{
/* compare type of member */
ret
=
types_get_info
(
&
type1
,
TI_GET_TYPE
,
&
type1
.
id
)
&&
types_get_info
(
&
type2
,
TI_GET_TYPE
,
&
type2
.
id
);
ret
=
types_get_info
(
&
type1
,
TI_GET_TYPE
,
&
type1
)
&&
types_get_info
(
&
type2
,
TI_GET_TYPE
,
&
type2
);
if
(
ret
)
ret
=
types_compare
(
type1
,
type2
,
equal
);
/* FIXME should compare bitfield info when present */
}
...
...
@@ -1273,8 +1279,8 @@ BOOL types_compare(struct dbg_type type1, struct dbg_type type2, BOOL* equal)
dbg_printf
(
"Unsupported yet tag %ld
\n
"
,
tag1
);
return
FALSE
;
}
}
while
(
types_get_info
(
&
type1
,
TI_GET_TYPE
,
&
type1
.
id
)
&&
types_get_info
(
&
type2
,
TI_GET_TYPE
,
&
type2
.
id
));
}
while
(
types_get_info
(
&
type1
,
TI_GET_TYPE
,
&
type1
)
&&
types_get_info
(
&
type2
,
TI_GET_TYPE
,
&
type2
));
return
FALSE
;
}
...
...
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