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
75792a3e
Commit
75792a3e
authored
Jul 10, 2009
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dbghelp: Grow all arrays by doubling the size.
parent
73d9ffbd
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
83 additions
and
30 deletions
+83
-30
coff.c
dlls/dbghelp/coff.c
+12
-6
dbghelp_private.h
dlls/dbghelp/dbghelp_private.h
+1
-0
minidump.c
dlls/dbghelp/minidump.c
+21
-5
module.c
dlls/dbghelp/module.c
+2
-0
msc.c
dlls/dbghelp/msc.c
+8
-3
source.c
dlls/dbghelp/source.c
+7
-2
stabs.c
dlls/dbghelp/stabs.c
+21
-12
symbol.c
dlls/dbghelp/symbol.c
+11
-2
No files found.
dlls/dbghelp/coff.c
View file @
75792a3e
...
...
@@ -108,13 +108,19 @@ static int coff_add_file(struct CoffFileSet* coff_files, struct module* module,
if
(
coff_files
->
nfiles
+
1
>=
coff_files
->
nfiles_alloc
)
{
coff_files
->
nfiles_alloc
+=
10
;
coff_files
->
files
=
(
coff_files
->
files
)
?
HeapReAlloc
(
GetProcessHeap
(),
0
,
coff_files
->
files
,
coff_files
->
nfiles_alloc
*
sizeof
(
struct
CoffFile
))
:
HeapAlloc
(
GetProcessHeap
(),
0
,
if
(
coff_files
->
files
)
{
coff_files
->
nfiles_alloc
*=
2
;
coff_files
->
files
=
HeapReAlloc
(
GetProcessHeap
(),
0
,
coff_files
->
files
,
coff_files
->
nfiles_alloc
*
sizeof
(
struct
CoffFile
));
}
else
{
coff_files
->
nfiles_alloc
=
16
;
coff_files
->
files
=
HeapAlloc
(
GetProcessHeap
(),
0
,
coff_files
->
nfiles_alloc
*
sizeof
(
struct
CoffFile
));
}
}
file
=
coff_files
->
files
+
coff_files
->
nfiles
;
file
->
startaddr
=
0xffffffff
;
file
->
endaddr
=
0
;
...
...
@@ -132,7 +138,7 @@ static void coff_add_symbol(struct CoffFile* coff_file, struct symt* sym)
{
if
(
coff_file
->
neps
+
1
>=
coff_file
->
neps_alloc
)
{
coff_file
->
neps_alloc
+=
10
;
coff_file
->
neps_alloc
*=
2
;
coff_file
->
entries
=
(
coff_file
->
entries
)
?
HeapReAlloc
(
GetProcessHeap
(),
0
,
coff_file
->
entries
,
coff_file
->
neps_alloc
*
sizeof
(
struct
symt
*
))
:
...
...
dlls/dbghelp/dbghelp_private.h
View file @
75792a3e
...
...
@@ -338,6 +338,7 @@ struct module
int
sortlist_valid
;
unsigned
num_sorttab
;
/* number of symbols with addresses */
unsigned
num_symbols
;
unsigned
sorttab_size
;
struct
symt_ht
**
addr_sorttab
;
struct
hash_table
ht_symbols
;
void
(
*
loc_compute
)(
struct
process
*
pcs
,
...
...
dlls/dbghelp/minidump.c
View file @
75792a3e
...
...
@@ -59,6 +59,7 @@ struct dump_context
/* module information */
struct
dump_module
*
modules
;
unsigned
num_modules
;
unsigned
alloc_modules
;
/* exception information */
/* output information */
MINIDUMP_TYPE
type
;
...
...
@@ -66,6 +67,7 @@ struct dump_context
RVA
rva
;
struct
dump_memory
*
mem
;
unsigned
num_mem
;
unsigned
alloc_mem
;
/* callback information */
MINIDUMP_CALLBACK_INFORMATION
*
cb
;
};
...
...
@@ -253,11 +255,17 @@ static BOOL add_module(struct dump_context* dc, const WCHAR* name,
BOOL
is_elf
)
{
if
(
!
dc
->
modules
)
{
dc
->
alloc_modules
=
32
;
dc
->
modules
=
HeapAlloc
(
GetProcessHeap
(),
0
,
++
dc
->
num_modules
*
sizeof
(
*
dc
->
modules
));
dc
->
alloc_modules
*
sizeof
(
*
dc
->
modules
));
}
else
{
dc
->
alloc_modules
*=
2
;
dc
->
modules
=
HeapReAlloc
(
GetProcessHeap
(),
0
,
dc
->
modules
,
++
dc
->
num_modules
*
sizeof
(
*
dc
->
modules
));
dc
->
alloc_modules
*
sizeof
(
*
dc
->
modules
));
}
if
(
!
dc
->
modules
)
return
FALSE
;
if
(
is_elf
||
!
GetModuleFileNameExW
(
dc
->
hProcess
,
(
HMODULE
)
base
,
...
...
@@ -382,17 +390,23 @@ static void fetch_module_versioninfo(LPCWSTR filename, VS_FIXEDFILEINFO* ffi)
static
void
add_memory_block
(
struct
dump_context
*
dc
,
ULONG64
base
,
ULONG
size
,
ULONG
rva
)
{
if
(
dc
->
mem
)
{
dc
->
alloc_mem
*=
2
;
dc
->
mem
=
HeapReAlloc
(
GetProcessHeap
(),
0
,
dc
->
mem
,
++
dc
->
num_mem
*
sizeof
(
*
dc
->
mem
));
dc
->
alloc_mem
*
sizeof
(
*
dc
->
mem
));
}
else
dc
->
mem
=
HeapAlloc
(
GetProcessHeap
(),
0
,
++
dc
->
num_mem
*
sizeof
(
*
dc
->
mem
));
{
dc
->
alloc_mem
=
32
;
dc
->
mem
=
HeapAlloc
(
GetProcessHeap
(),
0
,
dc
->
alloc_mem
*
sizeof
(
*
dc
->
mem
));
}
if
(
dc
->
mem
)
{
dc
->
mem
[
dc
->
num_mem
-
1
].
base
=
base
;
dc
->
mem
[
dc
->
num_mem
-
1
].
size
=
size
;
dc
->
mem
[
dc
->
num_mem
-
1
].
rva
=
rva
;
}
else
dc
->
num_mem
=
0
;
else
dc
->
num_mem
=
dc
->
alloc_mem
=
0
;
}
/******************************************************************
...
...
@@ -867,10 +881,12 @@ BOOL WINAPI MiniDumpWriteDump(HANDLE hProcess, DWORD pid, HANDLE hFile,
dc
.
pid
=
pid
;
dc
.
modules
=
NULL
;
dc
.
num_modules
=
0
;
dc
.
alloc_modules
=
0
;
dc
.
cb
=
CallbackParam
;
dc
.
type
=
DumpType
;
dc
.
mem
=
NULL
;
dc
.
num_mem
=
0
;
dc
.
alloc_mem
=
0
;
dc
.
rva
=
0
;
if
(
!
fetch_processes_info
(
&
dc
))
return
FALSE
;
...
...
dlls/dbghelp/module.c
View file @
75792a3e
...
...
@@ -168,6 +168,7 @@ struct module* module_new(struct process* pcs, const WCHAR* name,
module
->
type
=
type
;
module
->
is_virtual
=
virtual
?
TRUE
:
FALSE
;
module
->
sortlist_valid
=
FALSE
;
module
->
sorttab_size
=
0
;
module
->
addr_sorttab
=
NULL
;
module
->
num_sorttab
=
0
;
module
->
num_symbols
=
0
;
...
...
@@ -1037,6 +1038,7 @@ DWORD64 WINAPI SymGetModuleBase64(HANDLE hProcess, DWORD64 dwAddr)
void
module_reset_debug_info
(
struct
module
*
module
)
{
module
->
sortlist_valid
=
TRUE
;
module
->
sorttab_size
=
0
;
module
->
addr_sorttab
=
NULL
;
module
->
num_sorttab
=
module
->
num_symbols
=
0
;
hash_table_destroy
(
&
module
->
ht_symbols
);
...
...
dlls/dbghelp/msc.c
View file @
75792a3e
...
...
@@ -486,18 +486,23 @@ static int codeview_add_type(unsigned int typeno, struct symt* dt)
if
((
typeno
>>
24
)
!=
0
)
FIXME
(
"No module index while inserting type-id assumption is wrong %x
\n
"
,
typeno
);
while
(
typeno
-
FIRST_DEFINABLE_TYPE
>=
cv_current_module
->
num_defined_types
)
if
(
typeno
-
FIRST_DEFINABLE_TYPE
>=
cv_current_module
->
num_defined_types
)
{
cv_current_module
->
num_defined_types
+=
0x100
;
if
(
cv_current_module
->
defined_types
)
{
cv_current_module
->
num_defined_types
=
max
(
cv_current_module
->
num_defined_types
*
2
,
typeno
-
FIRST_DEFINABLE_TYPE
+
1
);
cv_current_module
->
defined_types
=
HeapReAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
cv_current_module
->
defined_types
,
cv_current_module
->
num_defined_types
*
sizeof
(
struct
symt
*
));
}
else
{
cv_current_module
->
num_defined_types
=
max
(
256
,
typeno
-
FIRST_DEFINABLE_TYPE
+
1
);
cv_current_module
->
defined_types
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
cv_current_module
->
num_defined_types
*
sizeof
(
struct
symt
*
));
}
if
(
cv_current_module
->
defined_types
==
NULL
)
return
FALSE
;
}
if
(
cv_current_module
->
defined_types
[
typeno
-
FIRST_DEFINABLE_TYPE
])
...
...
dlls/dbghelp/source.c
View file @
75792a3e
...
...
@@ -76,14 +76,19 @@ unsigned source_new(struct module* module, const char* base, const char* name)
int
len
=
strlen
(
full
)
+
1
;
if
(
module
->
sources_used
+
len
+
1
>
module
->
sources_alloc
)
{
/* Alloc by block of 256 bytes */
module
->
sources_alloc
=
(
module
->
sources_used
+
len
+
1
+
255
)
&
~
255
;
if
(
!
module
->
sources
)
{
module
->
sources_alloc
=
(
module
->
sources_used
+
len
+
1
+
255
)
&
~
255
;
module
->
sources
=
HeapAlloc
(
GetProcessHeap
(),
0
,
module
->
sources_alloc
);
}
else
{
module
->
sources_alloc
=
max
(
module
->
sources_alloc
*
2
,
(
module
->
sources_used
+
len
+
1
+
255
)
&
~
255
);
module
->
sources
=
HeapReAlloc
(
GetProcessHeap
(),
0
,
module
->
sources
,
module
->
sources_alloc
);
}
}
ret
=
module
->
sources_used
;
memcpy
(
module
->
sources
+
module
->
sources_used
,
full
,
len
);
module
->
sources_used
+=
len
;
...
...
dlls/dbghelp/stabs.c
View file @
75792a3e
...
...
@@ -180,14 +180,18 @@ static int stabs_new_include(const char* file, unsigned long val)
{
if
(
num_include_def
==
num_alloc_include_def
)
{
num_alloc_include_def
+=
256
;
if
(
!
include_defs
)
include_defs
=
HeapAlloc
(
GetProcessHeap
(),
0
,
{
num_alloc_include_def
=
256
;
include_defs
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
include_defs
[
0
])
*
num_alloc_include_def
);
}
else
include_defs
=
HeapReAlloc
(
GetProcessHeap
(),
0
,
include_defs
,
{
num_alloc_include_def
*=
2
;
include_defs
=
HeapReAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
include_defs
,
sizeof
(
include_defs
[
0
])
*
num_alloc_include_def
);
memset
(
include_defs
+
num_include_def
,
0
,
sizeof
(
include_defs
[
0
])
*
256
);
}
}
include_defs
[
num_include_def
].
name
=
strcpy
(
HeapAlloc
(
GetProcessHeap
(),
0
,
strlen
(
file
)
+
1
),
file
);
include_defs
[
num_include_def
].
value
=
val
;
...
...
@@ -262,13 +266,13 @@ static struct symt** stabs_find_ref(long filenr, long subnr)
{
if
(
cu_nrofentries
<=
subnr
)
{
cu_nrofentries
=
max
(
cu_nrofentries
*
2
,
subnr
+
1
);
if
(
!
cu_vector
)
cu_vector
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
cu_vector
[
0
])
*
(
subnr
+
1
)
);
sizeof
(
cu_vector
[
0
])
*
cu_nrofentries
);
else
cu_vector
=
HeapReAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
cu_vector
,
sizeof
(
cu_vector
[
0
])
*
(
subnr
+
1
));
cu_nrofentries
=
subnr
+
1
;
cu_vector
,
sizeof
(
cu_vector
[
0
])
*
cu_nrofentries
);
}
ret
=
&
cu_vector
[
subnr
];
}
...
...
@@ -281,13 +285,13 @@ static struct symt** stabs_find_ref(long filenr, long subnr)
if
(
idef
->
nrofentries
<=
subnr
)
{
idef
->
nrofentries
=
max
(
idef
->
nrofentries
*
2
,
subnr
+
1
);
if
(
!
idef
->
vector
)
idef
->
vector
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
idef
->
vector
[
0
])
*
(
subnr
+
1
)
);
sizeof
(
idef
->
vector
[
0
])
*
idef
->
nrofentries
);
else
idef
->
vector
=
HeapReAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
idef
->
vector
,
sizeof
(
idef
->
vector
[
0
])
*
(
subnr
+
1
));
idef
->
nrofentries
=
subnr
+
1
;
idef
->
vector
,
sizeof
(
idef
->
vector
[
0
])
*
idef
->
nrofentries
);
}
ret
=
&
idef
->
vector
[
subnr
];
}
...
...
@@ -1154,14 +1158,19 @@ static inline void pending_make_room(struct pending_list* pending)
{
if
(
pending
->
num
==
pending
->
allocated
)
{
pending
->
allocated
+=
8
;
if
(
!
pending
->
objs
)
{
pending
->
allocated
=
8
;
pending
->
objs
=
HeapAlloc
(
GetProcessHeap
(),
0
,
pending
->
allocated
*
sizeof
(
pending
->
objs
[
0
]));
}
else
{
pending
->
allocated
*=
2
;
pending
->
objs
=
HeapReAlloc
(
GetProcessHeap
(),
0
,
pending
->
objs
,
pending
->
allocated
*
sizeof
(
pending
->
objs
[
0
]));
}
}
}
static
inline
void
pending_add_var
(
struct
pending_list
*
pending
,
const
char
*
name
,
...
...
@@ -1311,7 +1320,7 @@ BOOL stabs_parse(struct module* module, unsigned long load_offset,
unsigned
len
=
strlen
(
ptr
);
if
(
strlen
(
stabbuff
)
+
len
>
stabbufflen
)
{
stabbufflen
+=
65536
;
stabbufflen
*=
2
;
stabbuff
=
HeapReAlloc
(
GetProcessHeap
(),
0
,
stabbuff
,
stabbufflen
);
}
strncat
(
stabbuff
,
ptr
,
len
-
1
);
...
...
dlls/dbghelp/symbol.c
View file @
75792a3e
...
...
@@ -70,13 +70,22 @@ int symt_cmp_addr(const void* p1, const void* p2)
static
BOOL
symt_grow_sorttab
(
struct
module
*
module
,
unsigned
sz
)
{
struct
symt_ht
**
new
;
unsigned
int
size
;
if
(
sz
<=
module
->
sorttab_size
)
return
TRUE
;
if
(
module
->
addr_sorttab
)
{
size
=
module
->
sorttab_size
*
2
;
new
=
HeapReAlloc
(
GetProcessHeap
(),
0
,
module
->
addr_sorttab
,
sz
*
sizeof
(
struct
symt_ht
*
));
size
*
sizeof
(
struct
symt_ht
*
));
}
else
new
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sz
*
sizeof
(
struct
symt_ht
*
));
{
size
=
64
;
new
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
*
sizeof
(
struct
symt_ht
*
));
}
if
(
!
new
)
return
FALSE
;
module
->
sorttab_size
=
size
;
module
->
addr_sorttab
=
new
;
return
TRUE
;
}
...
...
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