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
053a7e22
Commit
053a7e22
authored
Jul 12, 2018
by
Michael Stefaniuc
Committed by
Alexandre Julliard
Jul 13, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dbghelp: Use the ARRAY_SIZE() macro.
Signed-off-by:
Michael Stefaniuc
<
mstefani@winehq.org
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
7022afb3
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
25 additions
and
30 deletions
+25
-30
cpu_i386.c
dlls/dbghelp/cpu_i386.c
+2
-2
dbghelp.c
dlls/dbghelp/dbghelp.c
+2
-3
elf_module.c
dlls/dbghelp/elf_module.c
+6
-8
macho_module.c
dlls/dbghelp/macho_module.c
+1
-1
minidump.c
dlls/dbghelp/minidump.c
+2
-2
module.c
dlls/dbghelp/module.c
+7
-9
msc.c
dlls/dbghelp/msc.c
+1
-1
stabs.c
dlls/dbghelp/stabs.c
+3
-3
symbol.c
dlls/dbghelp/symbol.c
+1
-1
No files found.
dlls/dbghelp/cpu_i386.c
View file @
053a7e22
...
...
@@ -449,7 +449,7 @@ static BOOL i386_stack_walk(struct cpu_stack_walk* csw, LPSTACKFRAME64 frame, CO
* work if the parameter is in fact bigger than 16bit, but
* there's no way to know that here
*/
for
(
i
=
0
;
i
<
sizeof
(
frame
->
Params
)
/
sizeof
(
frame
->
Params
[
0
]
);
i
++
)
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
frame
->
Params
);
i
++
)
{
sw_read_mem
(
csw
,
p
+
(
2
+
i
)
*
sizeof
(
WORD
),
&
val16
,
sizeof
(
val16
));
frame
->
Params
[
i
]
=
val16
;
...
...
@@ -482,7 +482,7 @@ static BOOL i386_stack_walk(struct cpu_stack_walk* csw, LPSTACKFRAME64 frame, CO
frame
->
AddrReturn
.
Mode
=
AddrModeFlat
;
frame
->
AddrReturn
.
Offset
=
newctx
.
Eip
;
#endif
for
(
i
=
0
;
i
<
sizeof
(
frame
->
Params
)
/
sizeof
(
frame
->
Params
[
0
]
);
i
++
)
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
frame
->
Params
);
i
++
)
{
sw_read_mem
(
csw
,
frame
->
AddrFrame
.
Offset
+
(
2
+
i
)
*
sizeof
(
DWORD
),
&
val32
,
sizeof
(
val32
));
frame
->
Params
[
i
]
=
val32
;
...
...
dlls/dbghelp/dbghelp.c
View file @
053a7e22
...
...
@@ -245,9 +245,8 @@ static BOOL WINAPI process_invade_cb(PCWSTR name, ULONG64 base, ULONG size, PVOI
WCHAR
tmp
[
MAX_PATH
];
HANDLE
hProcess
=
user
;
if
(
!
GetModuleFileNameExW
(
hProcess
,
(
HMODULE
)(
DWORD_PTR
)
base
,
tmp
,
sizeof
(
tmp
)
/
sizeof
(
WCHAR
)))
lstrcpynW
(
tmp
,
name
,
sizeof
(
tmp
)
/
sizeof
(
WCHAR
));
if
(
!
GetModuleFileNameExW
(
hProcess
,
(
HMODULE
)(
DWORD_PTR
)
base
,
tmp
,
ARRAY_SIZE
(
tmp
)))
lstrcpynW
(
tmp
,
name
,
ARRAY_SIZE
(
tmp
));
SymLoadModuleExW
(
hProcess
,
0
,
tmp
,
name
,
base
,
size
,
NULL
,
0
);
return
TRUE
;
...
...
dlls/dbghelp/elf_module.c
View file @
053a7e22
...
...
@@ -974,7 +974,7 @@ static BOOL elf_locate_debug_link(struct image_file_map* fmap, const char* filen
{
static
const
WCHAR
globalDebugDirW
[]
=
{
'/'
,
'u'
,
's'
,
'r'
,
'/'
,
'l'
,
'i'
,
'b'
,
'/'
,
'd'
,
'e'
,
'b'
,
'u'
,
'g'
,
'/'
};
static
const
WCHAR
dotDebugW
[]
=
{
'.'
,
'd'
,
'e'
,
'b'
,
'u'
,
'g'
,
'/'
};
const
size_t
globalDebugDirLen
=
sizeof
(
globalDebugDirW
)
/
sizeof
(
WCHAR
);
const
size_t
globalDebugDirLen
=
ARRAY_SIZE
(
globalDebugDirW
);
size_t
filename_len
;
WCHAR
*
p
=
NULL
;
WCHAR
*
slash
;
...
...
@@ -999,7 +999,7 @@ static BOOL elf_locate_debug_link(struct image_file_map* fmap, const char* filen
/* testing execdir/.debug/filename */
memcpy
(
slash
,
dotDebugW
,
sizeof
(
dotDebugW
));
MultiByteToWideChar
(
CP_UNIXCP
,
0
,
filename
,
-
1
,
slash
+
sizeof
(
dotDebugW
)
/
sizeof
(
WCHAR
),
filename_len
);
MultiByteToWideChar
(
CP_UNIXCP
,
0
,
filename
,
-
1
,
slash
+
ARRAY_SIZE
(
dotDebugW
),
filename_len
);
if
(
elf_check_debug_link
(
p
,
fmap_link
,
crc
))
goto
found
;
/* testing globaldebugdir/execdir/filename */
...
...
@@ -1049,9 +1049,9 @@ static BOOL elf_locate_build_id_target(struct image_file_map* fmap, const BYTE*
(
idlen
*
2
+
1
)
*
sizeof
(
WCHAR
)
+
sizeof
(
dotDebug0W
));
z
=
p
;
memcpy
(
z
,
globalDebugDirW
,
sizeof
(
globalDebugDirW
));
z
+=
sizeof
(
globalDebugDirW
)
/
sizeof
(
WCHAR
);
z
+=
ARRAY_SIZE
(
globalDebugDirW
);
memcpy
(
z
,
buildidW
,
sizeof
(
buildidW
));
z
+=
sizeof
(
buildidW
)
/
sizeof
(
WCHAR
);
z
+=
ARRAY_SIZE
(
buildidW
);
if
(
id
<
idend
)
{
...
...
@@ -1694,8 +1694,7 @@ static BOOL elf_enum_modules_internal(const struct process* pcs,
ReadProcessMemory
(
pcs
->
handle
,
lm
.
l_name
,
bufstr
,
sizeof
(
bufstr
),
NULL
))
{
bufstr
[
sizeof
(
bufstr
)
-
1
]
=
'\0'
;
MultiByteToWideChar
(
CP_UNIXCP
,
0
,
bufstr
,
-
1
,
bufstrW
,
sizeof
(
bufstrW
)
/
sizeof
(
WCHAR
));
MultiByteToWideChar
(
CP_UNIXCP
,
0
,
bufstr
,
-
1
,
bufstrW
,
ARRAY_SIZE
(
bufstrW
));
if
(
main_name
&&
!
bufstrW
[
0
])
strcpyW
(
bufstrW
,
main_name
);
if
(
!
cb
(
bufstrW
,
(
unsigned
long
)
lm
.
l_addr
,
(
unsigned
long
)
lm
.
l_ld
,
FALSE
,
user
))
break
;
...
...
@@ -1729,8 +1728,7 @@ static BOOL elf_enum_modules_internal(const struct process* pcs,
bufstr
,
sizeof
(
bufstr
),
NULL
))
{
bufstr
[
sizeof
(
bufstr
)
-
1
]
=
'\0'
;
MultiByteToWideChar
(
CP_UNIXCP
,
0
,
bufstr
,
-
1
,
bufstrW
,
sizeof
(
bufstrW
)
/
sizeof
(
WCHAR
));
MultiByteToWideChar
(
CP_UNIXCP
,
0
,
bufstr
,
-
1
,
bufstrW
,
ARRAY_SIZE
(
bufstrW
));
if
(
main_name
&&
!
bufstrW
[
0
])
strcpyW
(
bufstrW
,
main_name
);
if
(
!
cb
(
bufstrW
,
(
unsigned
long
)
lm
.
l_addr
,
(
unsigned
long
)
lm
.
l_ld
,
FALSE
,
user
))
break
;
...
...
dlls/dbghelp/macho_module.c
View file @
053a7e22
...
...
@@ -1672,7 +1672,7 @@ static BOOL macho_enum_modules_internal(const struct process* pcs,
{
bufstr
[
sizeof
(
bufstr
)
-
1
]
=
'\0'
;
TRACE
(
"[%d] image file %s
\n
"
,
i
,
debugstr_a
(
bufstr
));
MultiByteToWideChar
(
CP_UNIXCP
,
0
,
bufstr
,
-
1
,
bufstrW
,
sizeof
(
bufstrW
)
/
sizeof
(
WCHAR
));
MultiByteToWideChar
(
CP_UNIXCP
,
0
,
bufstr
,
-
1
,
bufstrW
,
ARRAY_SIZE
(
bufstrW
));
if
(
main_name
&&
!
bufstrW
[
0
])
strcpyW
(
bufstrW
,
main_name
);
if
(
!
cb
(
bufstrW
,
(
unsigned
long
)
info_array
[
i
].
imageLoadAddress
,
user
))
break
;
}
...
...
dlls/dbghelp/minidump.c
View file @
053a7e22
...
...
@@ -215,9 +215,9 @@ static BOOL add_module(struct dump_context* dc, const WCHAR* name,
if
(
is_elf
||
!
GetModuleFileNameExW
(
dc
->
hProcess
,
(
HMODULE
)(
DWORD_PTR
)
base
,
dc
->
modules
[
dc
->
num_modules
].
name
,
sizeof
(
dc
->
modules
[
dc
->
num_modules
].
name
)
/
sizeof
(
WCHAR
)))
ARRAY_SIZE
(
dc
->
modules
[
dc
->
num_modules
].
name
)))
lstrcpynW
(
dc
->
modules
[
dc
->
num_modules
].
name
,
name
,
sizeof
(
dc
->
modules
[
dc
->
num_modules
].
name
)
/
sizeof
(
WCHAR
));
ARRAY_SIZE
(
dc
->
modules
[
dc
->
num_modules
].
name
));
dc
->
modules
[
dc
->
num_modules
].
base
=
base
;
dc
->
modules
[
dc
->
num_modules
].
size
=
size
;
dc
->
modules
[
dc
->
num_modules
].
timestamp
=
timestamp
;
...
...
dlls/dbghelp/module.c
View file @
053a7e22
...
...
@@ -134,9 +134,8 @@ static void module_fill_module(const WCHAR* in, WCHAR* out, size_t size)
void
module_set_module
(
struct
module
*
module
,
const
WCHAR
*
name
)
{
module_fill_module
(
name
,
module
->
module
.
ModuleName
,
sizeof
(
module
->
module
.
ModuleName
)
/
sizeof
(
module
->
module
.
ModuleName
[
0
]));
module_fill_module
(
name
,
module
->
modulename
,
sizeof
(
module
->
modulename
)
/
sizeof
(
module
->
modulename
[
0
]));
module_fill_module
(
name
,
module
->
module
.
ModuleName
,
ARRAY_SIZE
(
module
->
module
.
ModuleName
));
module_fill_module
(
name
,
module
->
modulename
,
ARRAY_SIZE
(
module
->
modulename
));
}
/* Returned string must be freed by caller */
...
...
@@ -215,7 +214,7 @@ struct module* module_new(struct process* pcs, const WCHAR* name,
module
->
module
.
ImageSize
=
size
;
module_set_module
(
module
,
name
);
module
->
module
.
ImageName
[
0
]
=
'\0'
;
lstrcpynW
(
module
->
module
.
LoadedImageName
,
name
,
sizeof
(
module
->
module
.
LoadedImageName
)
/
sizeof
(
WCHAR
));
lstrcpynW
(
module
->
module
.
LoadedImageName
,
name
,
ARRAY_SIZE
(
module
->
module
.
LoadedImageName
));
module
->
module
.
SymType
=
SymNone
;
module
->
module
.
NumSyms
=
0
;
module
->
module
.
TimeDateStamp
=
stamp
;
...
...
@@ -281,7 +280,7 @@ struct module* module_find_by_nameA(const struct process* pcs, const char* name)
{
WCHAR
wname
[
MAX_PATH
];
MultiByteToWideChar
(
CP_ACP
,
0
,
name
,
-
1
,
wname
,
sizeof
(
wname
)
/
sizeof
(
WCHAR
));
MultiByteToWideChar
(
CP_ACP
,
0
,
name
,
-
1
,
wname
,
ARRAY_SIZE
(
wname
));
return
module_find_by_nameW
(
pcs
,
wname
);
}
...
...
@@ -671,8 +670,7 @@ DWORD64 WINAPI SymLoadModuleExW(HANDLE hProcess, HANDLE hFile, PCWSTR wImageNam
if
(
wModuleName
)
module_set_module
(
module
,
wModuleName
);
if
(
wImageName
)
lstrcpynW
(
module
->
module
.
ImageName
,
wImageName
,
sizeof
(
module
->
module
.
ImageName
)
/
sizeof
(
WCHAR
));
lstrcpynW
(
module
->
module
.
ImageName
,
wImageName
,
ARRAY_SIZE
(
module
->
module
.
ImageName
));
return
module
->
module
.
BaseOfImage
;
}
...
...
@@ -935,9 +933,9 @@ BOOL WINAPI EnumerateLoadedModulesW64(HANDLE hProcess,
for
(
i
=
0
;
i
<
sz
;
i
++
)
{
if
(
!
GetModuleInformation
(
hProcess
,
hMods
[
i
],
&
mi
,
sizeof
(
mi
))
||
!
GetModuleBaseNameW
(
hProcess
,
hMods
[
i
],
baseW
,
sizeof
(
baseW
)
/
sizeof
(
WCHAR
)))
!
GetModuleBaseNameW
(
hProcess
,
hMods
[
i
],
baseW
,
ARRAY_SIZE
(
baseW
)))
continue
;
module_fill_module
(
baseW
,
modW
,
sizeof
(
modW
)
/
sizeof
(
modW
[
0
]
));
module_fill_module
(
baseW
,
modW
,
ARRAY_SIZE
(
modW
));
EnumLoadedModulesCallback
(
modW
,
(
DWORD_PTR
)
mi
.
lpBaseOfDll
,
mi
.
SizeOfImage
,
UserContext
);
}
...
...
dlls/dbghelp/msc.c
View file @
053a7e22
...
...
@@ -2893,7 +2893,7 @@ static BOOL pdb_process_file(const struct process* pcs,
msc_dbg
->
module
->
module
.
PdbAge
=
pdb_info
->
pdb_files
[
0
].
age
;
MultiByteToWideChar
(
CP_ACP
,
0
,
pdb_lookup
->
filename
,
-
1
,
msc_dbg
->
module
->
module
.
LoadedPdbName
,
sizeof
(
msc_dbg
->
module
->
module
.
LoadedPdbName
)
/
sizeof
(
WCHAR
));
ARRAY_SIZE
(
msc_dbg
->
module
->
module
.
LoadedPdbName
));
/* FIXME: we could have a finer grain here */
msc_dbg
->
module
->
module
.
LineNumbers
=
TRUE
;
msc_dbg
->
module
->
module
.
GlobalSymbols
=
TRUE
;
...
...
dlls/dbghelp/stabs.c
View file @
053a7e22
...
...
@@ -337,7 +337,7 @@ struct ParseTypedefData
#ifdef PTS_DEBUG
static
void
stabs_pts_push
(
struct
ParseTypedefData
*
ptd
,
unsigned
line
)
{
assert
(
ptd
->
err_idx
<
sizeof
(
ptd
->
errors
)
/
sizeof
(
ptd
->
errors
[
0
]
));
assert
(
ptd
->
err_idx
<
ARRAY_SIZE
(
ptd
->
errors
));
ptd
->
errors
[
ptd
->
err_idx
].
line
=
line
;
ptd
->
errors
[
ptd
->
err_idx
].
ptr
=
ptd
->
ptr
;
ptd
->
err_idx
++
;
...
...
@@ -349,7 +349,7 @@ static void stabs_pts_push(struct ParseTypedefData* ptd, unsigned line)
static
int
stabs_get_basic
(
struct
ParseTypedefData
*
ptd
,
unsigned
basic
,
struct
symt
**
symt
)
{
PTS_ABORTIF
(
ptd
,
basic
>=
sizeof
(
stabs_basic
)
/
sizeof
(
stabs_basic
[
0
]
));
PTS_ABORTIF
(
ptd
,
basic
>=
ARRAY_SIZE
(
stabs_basic
));
if
(
!
stabs_basic
[
basic
])
{
...
...
@@ -1617,7 +1617,7 @@ BOOL stabs_parse(struct module* module, unsigned long load_offset,
break
;
case
N_BINCL
:
stabs_add_include
(
stabs_new_include
(
ptr
,
n_value
));
assert
(
incl_stk
<
(
int
)
(
sizeof
(
incl
)
/
sizeof
(
incl
[
0
])
)
-
1
);
assert
(
incl_stk
<
(
int
)
ARRAY_SIZE
(
incl
)
-
1
);
incl
[
++
incl_stk
]
=
source_idx
;
source_idx
=
source_new
(
module
,
NULL
,
ptr
);
break
;
...
...
dlls/dbghelp/symbol.c
View file @
053a7e22
...
...
@@ -2077,7 +2077,7 @@ BOOL WINAPI SymAddSymbol(HANDLE hProcess, ULONG64 BaseOfDll, PCSTR name,
{
WCHAR
nameW
[
MAX_SYM_NAME
];
MultiByteToWideChar
(
CP_ACP
,
0
,
name
,
-
1
,
nameW
,
sizeof
(
nameW
)
/
sizeof
(
WCHAR
));
MultiByteToWideChar
(
CP_ACP
,
0
,
name
,
-
1
,
nameW
,
ARRAY_SIZE
(
nameW
));
return
SymAddSymbolW
(
hProcess
,
BaseOfDll
,
nameW
,
addr
,
size
,
flags
);
}
...
...
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