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
890e3baa
Commit
890e3baa
authored
Jul 20, 2022
by
Eric Pouech
Committed by
Alexandre Julliard
Jul 25, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winedbg: Use CRT allocation functions.
Signed-off-by:
Eric Pouech
<
eric.pouech@gmail.com
>
parent
674ef559
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
79 additions
and
93 deletions
+79
-93
break.c
programs/winedbg/break.c
+5
-5
crashdlg.c
programs/winedbg/crashdlg.c
+3
-7
dbg.y
programs/winedbg/dbg.y
+7
-7
debug.l
programs/winedbg/debug.l
+3
-3
debugger.h
programs/winedbg/debugger.h
+0
-6
display.c
programs/winedbg/display.c
+6
-6
expr.c
programs/winedbg/expr.c
+12
-12
gdbproxy.c
programs/winedbg/gdbproxy.c
+2
-2
info.c
programs/winedbg/info.c
+8
-8
memory.c
programs/winedbg/memory.c
+4
-4
source.c
programs/winedbg/source.c
+7
-7
stack.c
programs/winedbg/stack.c
+3
-3
tgt_active.c
programs/winedbg/tgt_active.c
+4
-4
tgt_minidump.c
programs/winedbg/tgt_minidump.c
+2
-2
tgt_module.c
programs/winedbg/tgt_module.c
+2
-2
winedbg.c
programs/winedbg/winedbg.c
+11
-15
No files found.
programs/winedbg/break.c
View file @
890e3baa
...
...
@@ -216,8 +216,8 @@ BOOL break_add_break_from_lvalue(const struct dbg_lvalue* lvalue, BOOL swbp)
return
FALSE
;
}
dbg_printf
(
"Unable to add breakpoint, will check again any time a new DLL is loaded
\n
"
);
new
=
dbg_heap_
realloc
(
dbg_curr_process
->
delayed_bp
,
sizeof
(
struct
dbg_delayed_bp
)
*
(
dbg_curr_process
->
num_delayed_bp
+
1
));
new
=
realloc
(
dbg_curr_process
->
delayed_bp
,
sizeof
(
struct
dbg_delayed_bp
)
*
(
dbg_curr_process
->
num_delayed_bp
+
1
));
if
(
!
new
)
return
FALSE
;
dbg_curr_process
->
delayed_bp
=
new
;
...
...
@@ -260,13 +260,13 @@ void break_add_break_from_id(const char *name, int lineno, BOOL swbp)
lineno
==
dbg_curr_process
->
delayed_bp
[
i
].
u
.
symbol
.
lineno
)
return
;
}
new
=
dbg_heap_
realloc
(
dbg_curr_process
->
delayed_bp
,
sizeof
(
struct
dbg_delayed_bp
)
*
(
dbg_curr_process
->
num_delayed_bp
+
1
));
new
=
realloc
(
dbg_curr_process
->
delayed_bp
,
sizeof
(
struct
dbg_delayed_bp
)
*
(
dbg_curr_process
->
num_delayed_bp
+
1
));
if
(
!
new
)
return
;
dbg_curr_process
->
delayed_bp
=
new
;
dbg_curr_process
->
delayed_bp
[
dbg_curr_process
->
num_delayed_bp
].
is_symbol
=
TRUE
;
dbg_curr_process
->
delayed_bp
[
dbg_curr_process
->
num_delayed_bp
].
software_bp
=
swbp
;
dbg_curr_process
->
delayed_bp
[
dbg_curr_process
->
num_delayed_bp
].
u
.
symbol
.
name
=
str
cpy
(
HeapAlloc
(
GetProcessHeap
(),
0
,
strlen
(
name
)
+
1
),
name
);
dbg_curr_process
->
delayed_bp
[
dbg_curr_process
->
num_delayed_bp
].
u
.
symbol
.
name
=
str
dup
(
name
);
dbg_curr_process
->
delayed_bp
[
dbg_curr_process
->
num_delayed_bp
].
u
.
symbol
.
lineno
=
lineno
;
dbg_curr_process
->
num_delayed_bp
++
;
}
...
...
programs/winedbg/crashdlg.c
View file @
890e3baa
...
...
@@ -64,7 +64,6 @@ static WCHAR *get_program_name(HANDLE hProcess)
{
WCHAR
image_name
[
MAX_PATH
];
WCHAR
*
programname
;
WCHAR
*
output
;
/* GetProcessImageFileNameW gives no way to query the correct buffer size,
* but programs with a path longer than MAX_PATH can't be started by the
...
...
@@ -95,10 +94,7 @@ static WCHAR *get_program_name(HANDLE hProcess)
programname
[
MAX_PROGRAM_NAME_LENGTH
-
1
]
=
0
;
}
output
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
WCHAR
)
*
(
lstrlenW
(
programname
)
+
1
));
lstrcpyW
(
output
,
programname
);
return
output
;
return
wcsdup
(
programname
);
}
static
LPWSTR
g_ProgramName
;
...
...
@@ -142,12 +138,12 @@ static void load_crash_log( HANDLE file )
{
DWORD
len
,
pos
=
0
,
size
=
65536
;
crash_log
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
crash_log
=
malloc
(
size
);
SetFilePointer
(
file
,
0
,
NULL
,
FILE_BEGIN
);
while
(
ReadFile
(
file
,
crash_log
+
pos
,
size
-
pos
-
1
,
&
len
,
NULL
)
&&
len
)
{
pos
+=
len
;
if
(
pos
==
size
-
1
)
crash_log
=
HeapReAlloc
(
GetProcessHeap
(),
0
,
crash_log
,
size
*=
2
);
if
(
pos
==
size
-
1
)
crash_log
=
realloc
(
crash_log
,
size
*=
2
);
}
crash_log
[
pos
]
=
0
;
}
...
...
programs/winedbg/dbg.y
View file @
890e3baa
...
...
@@ -499,7 +499,7 @@ static int input_fetch_entire_line(const char* pfx, char** line)
*/
WriteFile(dbg_parser.output, pfx, strlen(pfx), &nread, NULL);
buffer =
HeapAlloc(GetProcessHeap(), 0,
alloc = 16);
buffer =
malloc(
alloc = 16);
assert(buffer != NULL);
dbg_parser.line_no++;
...
...
@@ -508,7 +508,7 @@ static int input_fetch_entire_line(const char* pfx, char** line)
{
if (!ReadFile(dbg_parser.input, &ch, 1, &nread, NULL) || nread == 0)
{
HeapFree(GetProcessHeap(), 0,
buffer);
free(
buffer);
return -1;
}
...
...
@@ -516,9 +516,9 @@ static int input_fetch_entire_line(const char* pfx, char** line)
{
char* new;
while (len + 2 > alloc) alloc *= 2;
if (!(new =
dbg_heap_
realloc(buffer, alloc)))
if (!(new = realloc(buffer, alloc)))
{
HeapFree(GetProcessHeap(), 0,
buffer);
free(
buffer);
return -1;
}
buffer = new;
...
...
@@ -557,11 +557,11 @@ size_t input_lex_read_buffer(char* buf, int size)
if (dbg_parser.last_line && (len == 0 || (len == 1 && tmp[0] == '\n')) &&
dbg_parser.output != INVALID_HANDLE_VALUE)
{
HeapFree(GetProcessHeap(), 0,
tmp);
free(
tmp);
}
else
{
HeapFree(GetProcessHeap(), 0,
dbg_parser.last_line);
free(
dbg_parser.last_line);
dbg_parser.last_line = tmp;
}
}
...
...
@@ -585,7 +585,7 @@ int input_read_line(const char* pfx, char* buf, int size)
len = min(size - 1, len);
memcpy(buf, line, len);
buf[len] = '\0';
HeapFree(GetProcessHeap(), 0,
line);
free(
line);
return 1;
}
...
...
programs/winedbg/debug.l
View file @
890e3baa
...
...
@@ -42,10 +42,10 @@ char* lexeme_alloc_size(int size)
if (next_lexeme >= alloc_lexeme)
{
alloc_lexeme += 32;
local_lexemes =
dbg_heap_
realloc(local_lexemes, alloc_lexeme * sizeof(local_lexemes[0]));
local_lexemes = realloc(local_lexemes, alloc_lexeme * sizeof(local_lexemes[0]));
assert(local_lexemes);
}
return local_lexemes[next_lexeme++] =
HeapAlloc(GetProcessHeap(), 0,
size + 1);
return local_lexemes[next_lexeme++] =
malloc(
size + 1);
}
static char* lexeme_alloc(const char* lexeme)
...
...
@@ -68,7 +68,7 @@ static char* lexeme_alloc_if(const char* lexeme, unsigned sz)
void lexeme_flush(void)
{
while (--next_lexeme >= 0)
HeapFree(GetProcessHeap(), 0,
local_lexemes[next_lexeme]);
while (--next_lexeme >= 0)
free(
local_lexemes[next_lexeme]);
next_lexeme = 0;
}
...
...
programs/winedbg/debugger.h
View file @
890e3baa
...
...
@@ -537,12 +537,6 @@ static inline BOOL dbg_write_memory(void* addr, const void* buffer, size_t len)
return
dbg_curr_process
->
process_io
->
write
(
dbg_curr_process
->
handle
,
addr
,
buffer
,
len
,
&
wlen
)
&&
len
==
wlen
;
}
static
inline
void
*
dbg_heap_realloc
(
void
*
buffer
,
size_t
size
)
{
return
(
buffer
)
?
HeapReAlloc
(
GetProcessHeap
(),
0
,
buffer
,
size
)
:
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
}
struct
data_model
{
enum
dbg_internal_types
itype
;
...
...
programs/winedbg/display.c
View file @
890e3baa
...
...
@@ -65,8 +65,8 @@ BOOL display_add(struct expr *exp, int count, char format)
{
struct
display
*
new
;
/* no space left - expand */
new
=
dbg_heap_
realloc
(
displaypoints
,
(
maxdisplays
+
DISPTAB_DELTA
)
*
sizeof
(
*
displaypoints
));
new
=
realloc
(
displaypoints
,
(
maxdisplays
+
DISPTAB_DELTA
)
*
sizeof
(
*
displaypoints
));
if
(
!
new
)
return
FALSE
;
displaypoints
=
new
;
maxdisplays
+=
DISPTAB_DELTA
;
...
...
@@ -208,8 +208,8 @@ BOOL display_delete(int displaynum)
}
}
maxdisplays
=
DISPTAB_DELTA
;
displaypoints
=
dbg_heap_
realloc
(
displaypoints
,
(
maxdisplays
=
DISPTAB_DELTA
)
*
sizeof
(
*
displaypoints
));
displaypoints
=
realloc
(
displaypoints
,
(
maxdisplays
=
DISPTAB_DELTA
)
*
sizeof
(
*
displaypoints
));
ndisplays
=
0
;
}
else
if
(
displaypoints
[
--
displaynum
].
exp
!=
NULL
)
...
...
@@ -225,8 +225,8 @@ BOOL display_delete(int displaynum)
{
/* MARK */
maxdisplays
=
(
ndisplays
+
DISPTAB_DELTA
-
1
)
&
~
(
DISPTAB_DELTA
-
1
);
displaypoints
=
dbg_heap_
realloc
(
displaypoints
,
maxdisplays
*
sizeof
(
*
displaypoints
));
displaypoints
=
realloc
(
displaypoints
,
maxdisplays
*
sizeof
(
*
displaypoints
));
}
}
return
TRUE
;
...
...
programs/winedbg/expr.c
View file @
890e3baa
...
...
@@ -721,7 +721,7 @@ struct expr* expr_clone(const struct expr* exp, BOOL *local_binding)
int
i
;
struct
expr
*
rtn
;
rtn
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
struct
expr
));
rtn
=
malloc
(
sizeof
(
struct
expr
));
/*
* First copy the contents of the expression itself.
...
...
@@ -734,30 +734,30 @@ struct expr* expr_clone(const struct expr* exp, BOOL *local_binding)
rtn
->
un
.
cast
.
expr
=
expr_clone
(
exp
->
un
.
cast
.
expr
,
local_binding
);
break
;
case
EXPR_TYPE_INTVAR
:
rtn
->
un
.
intvar
.
name
=
str
cpy
(
HeapAlloc
(
GetProcessHeap
(),
0
,
strlen
(
exp
->
un
.
intvar
.
name
)
+
1
),
exp
->
un
.
intvar
.
name
);
rtn
->
un
.
intvar
.
name
=
str
dup
(
exp
->
un
.
intvar
.
name
);
break
;
case
EXPR_TYPE_U_CONST
:
case
EXPR_TYPE_S_CONST
:
break
;
case
EXPR_TYPE_STRING
:
rtn
->
un
.
string
.
str
=
str
cpy
(
HeapAlloc
(
GetProcessHeap
(),
0
,
strlen
(
exp
->
un
.
string
.
str
)
+
1
),
exp
->
un
.
string
.
str
);
rtn
->
un
.
string
.
str
=
str
dup
(
exp
->
un
.
string
.
str
);
break
;
case
EXPR_TYPE_SYMBOL
:
rtn
->
un
.
symbol
.
name
=
str
cpy
(
HeapAlloc
(
GetProcessHeap
(),
0
,
strlen
(
exp
->
un
.
symbol
.
name
)
+
1
),
exp
->
un
.
symbol
.
name
);
rtn
->
un
.
symbol
.
name
=
str
dup
(
exp
->
un
.
symbol
.
name
);
if
(
local_binding
&&
symbol_is_local
(
exp
->
un
.
symbol
.
name
))
*
local_binding
=
TRUE
;
break
;
case
EXPR_TYPE_PSTRUCT
:
case
EXPR_TYPE_STRUCT
:
rtn
->
un
.
structure
.
exp1
=
expr_clone
(
exp
->
un
.
structure
.
exp1
,
local_binding
);
rtn
->
un
.
structure
.
element_name
=
str
cpy
(
HeapAlloc
(
GetProcessHeap
(),
0
,
strlen
(
exp
->
un
.
structure
.
element_name
)
+
1
),
exp
->
un
.
structure
.
element_name
);
rtn
->
un
.
structure
.
element_name
=
str
dup
(
exp
->
un
.
structure
.
element_name
);
break
;
case
EXPR_TYPE_CALL
:
for
(
i
=
0
;
i
<
exp
->
un
.
call
.
nargs
;
i
++
)
{
rtn
->
un
.
call
.
arg
[
i
]
=
expr_clone
(
exp
->
un
.
call
.
arg
[
i
],
local_binding
);
}
rtn
->
un
.
call
.
funcname
=
str
cpy
(
HeapAlloc
(
GetProcessHeap
(),
0
,
strlen
(
exp
->
un
.
call
.
funcname
)
+
1
),
exp
->
un
.
call
.
funcname
);
rtn
->
un
.
call
.
funcname
=
str
dup
(
exp
->
un
.
call
.
funcname
);
break
;
case
EXPR_TYPE_BINOP
:
rtn
->
un
.
binop
.
exp1
=
expr_clone
(
exp
->
un
.
binop
.
exp1
,
local_binding
);
...
...
@@ -790,28 +790,28 @@ BOOL expr_free(struct expr* exp)
expr_free
(
exp
->
un
.
cast
.
expr
);
break
;
case
EXPR_TYPE_INTVAR
:
HeapFree
(
GetProcessHeap
(),
0
,
(
char
*
)
exp
->
un
.
intvar
.
name
);
free
(
(
char
*
)
exp
->
un
.
intvar
.
name
);
break
;
case
EXPR_TYPE_U_CONST
:
case
EXPR_TYPE_S_CONST
:
break
;
case
EXPR_TYPE_STRING
:
HeapFree
(
GetProcessHeap
(),
0
,
(
char
*
)
exp
->
un
.
string
.
str
);
free
(
(
char
*
)
exp
->
un
.
string
.
str
);
break
;
case
EXPR_TYPE_SYMBOL
:
HeapFree
(
GetProcessHeap
(),
0
,
(
char
*
)
exp
->
un
.
symbol
.
name
);
free
(
(
char
*
)
exp
->
un
.
symbol
.
name
);
break
;
case
EXPR_TYPE_PSTRUCT
:
case
EXPR_TYPE_STRUCT
:
expr_free
(
exp
->
un
.
structure
.
exp1
);
HeapFree
(
GetProcessHeap
(),
0
,
(
char
*
)
exp
->
un
.
structure
.
element_name
);
free
(
(
char
*
)
exp
->
un
.
structure
.
element_name
);
break
;
case
EXPR_TYPE_CALL
:
for
(
i
=
0
;
i
<
exp
->
un
.
call
.
nargs
;
i
++
)
{
expr_free
(
exp
->
un
.
call
.
arg
[
i
]);
}
HeapFree
(
GetProcessHeap
(),
0
,
(
char
*
)
exp
->
un
.
call
.
funcname
);
free
(
(
char
*
)
exp
->
un
.
call
.
funcname
);
break
;
case
EXPR_TYPE_BINOP
:
expr_free
(
exp
->
un
.
binop
.
exp1
);
...
...
@@ -826,6 +826,6 @@ BOOL expr_free(struct expr* exp)
break
;
}
HeapFree
(
GetProcessHeap
(),
0
,
exp
);
free
(
exp
);
return
TRUE
;
}
programs/winedbg/gdbproxy.c
View file @
890e3baa
...
...
@@ -129,7 +129,7 @@ static void gdbctx_delete_xpoint(struct gdb_context *gdbctx, struct dbg_thread *
ERR
(
"%04lx:%04lx: Couldn't remove breakpoint at:%p/%x type:%d
\n
"
,
process
->
pid
,
thread
?
thread
->
tid
:
~
0
,
x
->
addr
,
x
->
size
,
x
->
type
);
list_remove
(
&
x
->
entry
);
HeapFree
(
GetProcessHeap
(),
0
,
x
);
free
(
x
);
}
static
void
gdbctx_insert_xpoint
(
struct
gdb_context
*
gdbctx
,
struct
dbg_thread
*
thread
,
...
...
@@ -146,7 +146,7 @@ static void gdbctx_insert_xpoint(struct gdb_context *gdbctx, struct dbg_thread *
return
;
}
if
(
!
(
x
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
struct
gdb_xpoint
))))
if
(
!
(
x
=
malloc
(
sizeof
(
struct
gdb_xpoint
))))
{
ERR
(
"%04lx:%04lx: Couldn't allocate memory for breakpoint at:%p/%x type:%d
\n
"
,
process
->
pid
,
thread
->
tid
,
addr
,
size
,
type
);
return
;
...
...
programs/winedbg/info.c
View file @
890e3baa
...
...
@@ -199,7 +199,7 @@ static BOOL CALLBACK info_mod_cb(PCSTR mod_name, DWORD64 base, PVOID ctx)
if
(
im
->
num_used
+
1
>
im
->
num_alloc
)
{
struct
info_module
*
new
=
dbg_heap_
realloc
(
im
->
modules
,
(
im
->
num_alloc
+
16
)
*
sizeof
(
*
im
->
modules
));
struct
info_module
*
new
=
realloc
(
im
->
modules
,
(
im
->
num_alloc
+
16
)
*
sizeof
(
*
im
->
modules
));
if
(
!
new
)
return
FALSE
;
/* stop enumeration in case of OOM */
im
->
num_alloc
+=
16
;
im
->
modules
=
new
;
...
...
@@ -283,7 +283,7 @@ void info_win32_module(DWORD64 base)
}
num_printed
++
;
}
HeapFree
(
GetProcessHeap
(),
0
,
im
.
modules
);
free
(
im
.
modules
);
if
(
base
&&
!
num_printed
)
dbg_printf
(
"'0x%0*I64x' is not a valid module address
\n
"
,
ADDRWIDTH
,
base
);
...
...
@@ -317,7 +317,7 @@ static void class_walker(HWND hWnd, struct class_walker* cw)
{
if
(
cw
->
used
>=
cw
->
alloc
)
{
ATOM
*
new
=
dbg_heap_
realloc
(
cw
->
table
,
(
cw
->
alloc
+
16
)
*
sizeof
(
ATOM
));
ATOM
*
new
=
realloc
(
cw
->
table
,
(
cw
->
alloc
+
16
)
*
sizeof
(
ATOM
));
if
(
!
new
)
return
;
cw
->
alloc
+=
16
;
cw
->
table
=
new
;
...
...
@@ -344,7 +344,7 @@ void info_win32_class(HWND hWnd, const char* name)
cw
.
table
=
NULL
;
cw
.
used
=
cw
.
alloc
=
0
;
class_walker
(
GetDesktopWindow
(),
&
cw
);
HeapFree
(
GetProcessHeap
(),
0
,
cw
.
table
);
free
(
cw
.
table
);
return
;
}
...
...
@@ -536,7 +536,7 @@ void info_win32_processes(void)
dp
.
count
=
0
;
dp
.
alloc
=
16
;
dp
.
entries
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
*
dp
.
entries
)
*
dp
.
alloc
);
dp
.
entries
=
malloc
(
sizeof
(
*
dp
.
entries
)
*
dp
.
alloc
);
if
(
!
dp
.
entries
)
{
CloseHandle
(
snap
);
...
...
@@ -551,11 +551,11 @@ void info_win32_processes(void)
dp
.
entries
[
dp
.
count
++
].
children
=
-
1
;
if
(
dp
.
count
>=
dp
.
alloc
)
{
struct
dump_proc_entry
*
new
=
HeapReAlloc
(
GetProcessHeap
(),
0
,
dp
.
entries
,
sizeof
(
*
dp
.
entries
)
*
(
dp
.
alloc
*
2
));
struct
dump_proc_entry
*
new
=
realloc
(
dp
.
entries
,
sizeof
(
*
dp
.
entries
)
*
(
dp
.
alloc
*
2
));
if
(
!
new
)
{
CloseHandle
(
snap
);
HeapFree
(
GetProcessHeap
(),
0
,
dp
.
entries
);
free
(
dp
.
entries
);
return
;
}
dp
.
alloc
*=
2
;
...
...
@@ -575,7 +575,7 @@ void info_win32_processes(void)
}
dbg_printf
(
" %-8.8s %-8.8s %s (all id:s are in hex)
\n
"
,
"pid"
,
"threads"
,
"executable"
);
dump_proc_info
(
&
dp
,
first
,
0
);
HeapFree
(
GetProcessHeap
(),
0
,
dp
.
entries
);
free
(
dp
.
entries
);
}
}
...
...
programs/winedbg/memory.c
View file @
890e3baa
...
...
@@ -386,11 +386,11 @@ BOOL memory_get_string(struct dbg_process* pcs, void* addr, BOOL in_debuggee,
if
(
!
unicode
)
ret
=
pcs
->
process_io
->
read
(
pcs
->
handle
,
addr
,
buffer
,
size
,
&
sz
);
else
{
buffW
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
*
sizeof
(
WCHAR
));
buffW
=
malloc
(
size
*
sizeof
(
WCHAR
));
ret
=
pcs
->
process_io
->
read
(
pcs
->
handle
,
addr
,
buffW
,
size
*
sizeof
(
WCHAR
),
&
sz
);
WideCharToMultiByte
(
CP_ACP
,
0
,
buffW
,
sz
/
sizeof
(
WCHAR
),
buffer
,
size
,
NULL
,
NULL
);
HeapFree
(
GetProcessHeap
(),
0
,
buffW
);
free
(
buffW
);
}
if
(
size
)
buffer
[
size
-
1
]
=
0
;
return
ret
;
...
...
@@ -418,11 +418,11 @@ BOOL memory_get_string_indirect(struct dbg_process* pcs, void* addr, BOOL unicod
ret
=
pcs
->
process_io
->
read
(
pcs
->
handle
,
ad
,
buffer
,
size
*
sizeof
(
WCHAR
),
&
sz
)
&&
sz
!=
0
;
else
{
if
((
buff
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
)))
if
((
buff
=
malloc
(
size
)))
{
ret
=
pcs
->
process_io
->
read
(
pcs
->
handle
,
ad
,
buff
,
size
,
&
sz
)
&&
sz
!=
0
;
MultiByteToWideChar
(
CP_ACP
,
0
,
buff
,
sz
,
buffer
,
size
);
HeapFree
(
GetProcessHeap
(),
0
,
buff
);
free
(
buff
);
}
else
ret
=
FALSE
;
}
...
...
programs/winedbg/source.c
View file @
890e3baa
...
...
@@ -59,14 +59,14 @@ void source_add_path(const char* path)
if
(
dbg_curr_process
->
search_path
)
{
unsigned
pos
=
strlen
(
dbg_curr_process
->
search_path
)
+
1
;
new
=
HeapReAlloc
(
GetProcessHeap
(),
0
,
dbg_curr_process
->
search_path
,
pos
+
size
);
new
=
realloc
(
dbg_curr_process
->
search_path
,
pos
+
size
);
if
(
!
new
)
return
;
new
[
pos
-
1
]
=
';'
;
strcpy
(
&
new
[
pos
],
path
);
}
else
{
new
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
new
=
malloc
(
size
);
if
(
!
new
)
return
;
strcpy
(
new
,
path
);
}
...
...
@@ -75,7 +75,7 @@ void source_add_path(const char* path)
void
source_nuke_path
(
struct
dbg_process
*
p
)
{
HeapFree
(
GetProcessHeap
(),
0
,
p
->
search_path
);
free
(
p
->
search_path
);
p
->
search_path
=
NULL
;
}
...
...
@@ -146,7 +146,7 @@ static struct open_file_list* source_add_file(const char* name, const char* real
sz
=
sizeof
(
*
ol
);
nlen
=
strlen
(
name
)
+
1
;
if
(
realpath
)
sz
+=
strlen
(
realpath
)
+
1
;
ol
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sz
+
nlen
);
ol
=
malloc
(
sz
+
nlen
);
if
(
!
ol
)
return
NULL
;
strcpy
(
ol
->
path
=
(
char
*
)(
ol
+
1
),
name
);
if
(
realpath
)
...
...
@@ -255,7 +255,7 @@ static int source_display(const char* sourcefile, int start, int end)
}
ol
->
nlines
++
;
ol
->
linelist
=
HeapAlloc
(
GetProcessHeap
(),
0
,
ol
->
nlines
*
sizeof
(
unsigned
int
));
ol
->
linelist
=
malloc
(
ol
->
nlines
*
sizeof
(
unsigned
int
));
nlines
=
0
;
pnt
=
addr
;
...
...
@@ -379,7 +379,7 @@ void source_free_files(struct dbg_process* p)
for
(
ofile
=
p
->
source_ofiles
;
ofile
;
ofile
=
ofile_next
)
{
ofile_next
=
ofile
->
next
;
HeapFree
(
GetProcessHeap
(),
0
,
ofile
->
linelist
);
HeapFree
(
GetProcessHeap
(),
0
,
ofile
);
free
(
ofile
->
linelist
);
free
(
ofile
);
}
}
programs/winedbg/stack.c
View file @
890e3baa
...
...
@@ -182,7 +182,7 @@ unsigned stack_fetch_frames(const dbg_ctx_t* _ctx)
dbg_ctx_t
ctx
=
*
_ctx
;
BOOL
ret
;
HeapFree
(
GetProcessHeap
(),
0
,
dbg_curr_thread
->
frames
);
free
(
dbg_curr_thread
->
frames
);
dbg_curr_thread
->
frames
=
NULL
;
memset
(
&
sf
,
0
,
sizeof
(
sf
));
...
...
@@ -204,8 +204,8 @@ unsigned stack_fetch_frames(const dbg_ctx_t* _ctx)
SymFunctionTableAccess64
,
SymGetModuleBase64
,
NULL
,
SYM_STKWALK_DEFAULT
))
||
nf
==
0
)
/* we always register first frame information */
{
struct
dbg_frame
*
new
=
dbg_heap_
realloc
(
dbg_curr_thread
->
frames
,
(
nf
+
1
)
*
sizeof
(
dbg_curr_thread
->
frames
[
0
]));
struct
dbg_frame
*
new
=
realloc
(
dbg_curr_thread
->
frames
,
(
nf
+
1
)
*
sizeof
(
dbg_curr_thread
->
frames
[
0
]));
if
(
!
new
)
break
;
dbg_curr_thread
->
frames
=
new
;
...
...
programs/winedbg/tgt_active.c
View file @
890e3baa
...
...
@@ -197,10 +197,10 @@ static BOOL dbg_exception_prolog(BOOL is_debug, const EXCEPTION_RECORD* rec)
if
((
!
last_name
||
strcmp
(
last_name
,
si
->
Name
))
||
(
!
last_file
||
strcmp
(
last_file
,
il
.
FileName
)))
{
HeapFree
(
GetProcessHeap
(),
0
,
last_name
);
HeapFree
(
GetProcessHeap
(),
0
,
last_file
);
last_name
=
str
cpy
(
HeapAlloc
(
GetProcessHeap
(),
0
,
strlen
(
si
->
Name
)
+
1
),
si
->
Name
);
last_file
=
str
cpy
(
HeapAlloc
(
GetProcessHeap
(),
0
,
strlen
(
il
.
FileName
)
+
1
),
il
.
FileName
);
free
(
last_name
);
free
(
last_file
);
last_name
=
str
dup
(
si
->
Name
);
last_file
=
str
dup
(
il
.
FileName
);
dbg_printf
(
"%s () at %s:%lu
\n
"
,
last_name
,
last_file
,
il
.
LineNumber
);
}
}
...
...
programs/winedbg/tgt_minidump.c
View file @
890e3baa
...
...
@@ -497,7 +497,7 @@ static void cleanup(struct tgt_process_minidump_data* data)
if
(
data
->
mapping
)
UnmapViewOfFile
(
data
->
mapping
);
if
(
data
->
hMap
)
CloseHandle
(
data
->
hMap
);
if
(
data
->
hFile
!=
INVALID_HANDLE_VALUE
)
CloseHandle
(
data
->
hFile
);
HeapFree
(
GetProcessHeap
(),
0
,
data
);
free
(
data
);
}
static
struct
be_process_io
be_process_minidump_io
;
...
...
@@ -512,7 +512,7 @@ enum dbg_start minidump_reload(int argc, char* argv[])
WINE_TRACE
(
"Processing Minidump file %s
\n
"
,
argv
[
0
]);
data
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
struct
tgt_process_minidump_data
));
data
=
malloc
(
sizeof
(
struct
tgt_process_minidump_data
));
if
(
!
data
)
return
start_error_init
;
data
->
mapping
=
NULL
;
data
->
hMap
=
NULL
;
...
...
programs/winedbg/tgt_module.c
View file @
890e3baa
...
...
@@ -55,7 +55,7 @@ enum dbg_start tgt_module_load(const char* name, BOOL keep)
if
(
!
dbg_init
(
hDummy
,
NULL
,
FALSE
))
return
start_error_init
;
len
=
MultiByteToWideChar
(
CP_ACP
,
0
,
name
,
-
1
,
NULL
,
0
);
nameW
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
WCHAR
));
nameW
=
malloc
(
len
*
sizeof
(
WCHAR
));
if
(
!
nameW
)
{
ret
=
start_error_init
;
...
...
@@ -69,7 +69,7 @@ enum dbg_start tgt_module_load(const char* name, BOOL keep)
ret
=
start_error_init
;
keep
=
FALSE
;
}
HeapFree
(
GetProcessHeap
(),
0
,
nameW
);
free
(
nameW
);
}
if
(
keep
)
...
...
programs/winedbg/winedbg.c
View file @
890e3baa
...
...
@@ -266,7 +266,7 @@ struct dbg_process* dbg_add_process(const struct be_process_io* pio, DWORD pid,
if
(
!
h
)
h
=
OpenProcess
(
PROCESS_ALL_ACCESS
,
FALSE
,
pid
);
if
(
!
(
p
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
struct
dbg_process
))))
return
NULL
;
if
(
!
(
p
=
malloc
(
sizeof
(
struct
dbg_process
))))
return
NULL
;
p
->
handle
=
h
;
p
->
pid
=
pid
;
p
->
process_io
=
pio
;
...
...
@@ -307,11 +307,7 @@ struct dbg_process* dbg_add_process(const struct be_process_io* pio, DWORD pid,
void
dbg_set_process_name
(
struct
dbg_process
*
p
,
const
WCHAR
*
imageName
)
{
assert
(
p
->
imageName
==
NULL
);
if
(
imageName
)
{
WCHAR
*
tmp
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
lstrlenW
(
imageName
)
+
1
)
*
sizeof
(
WCHAR
));
if
(
tmp
)
p
->
imageName
=
lstrcpyW
(
tmp
,
imageName
);
}
if
(
imageName
)
p
->
imageName
=
wcsdup
(
imageName
);
}
void
dbg_del_process
(
struct
dbg_process
*
p
)
...
...
@@ -325,16 +321,16 @@ void dbg_del_process(struct dbg_process* p)
for
(
i
=
0
;
i
<
p
->
num_delayed_bp
;
i
++
)
if
(
p
->
delayed_bp
[
i
].
is_symbol
)
HeapFree
(
GetProcessHeap
(),
0
,
p
->
delayed_bp
[
i
].
u
.
symbol
.
name
);
free
(
p
->
delayed_bp
[
i
].
u
.
symbol
.
name
);
HeapFree
(
GetProcessHeap
(),
0
,
p
->
delayed_bp
);
free
(
p
->
delayed_bp
);
source_nuke_path
(
p
);
source_free_files
(
p
);
list_remove
(
&
p
->
entry
);
if
(
p
==
dbg_curr_process
)
dbg_curr_process
=
NULL
;
if
(
p
->
event_on_first_exception
)
CloseHandle
(
p
->
event_on_first_exception
);
HeapFree
(
GetProcessHeap
(),
0
,
(
char
*
)
p
->
imageName
);
HeapFree
(
GetProcessHeap
(),
0
,
p
);
free
(
(
char
*
)
p
->
imageName
);
free
(
p
);
}
/******************************************************************
...
...
@@ -357,7 +353,7 @@ BOOL dbg_init(HANDLE hProc, const WCHAR* in, BOOL invade)
if
(
*
last
==
'/'
||
*
last
==
'\\'
)
{
WCHAR
*
tmp
;
tmp
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
1024
+
1
+
(
last
-
in
)
+
1
)
*
sizeof
(
WCHAR
));
tmp
=
malloc
(
(
1024
+
1
+
(
last
-
in
)
+
1
)
*
sizeof
(
WCHAR
));
if
(
tmp
&&
SymGetSearchPathW
(
hProc
,
tmp
,
1024
))
{
WCHAR
*
x
=
tmp
+
lstrlenW
(
tmp
);
...
...
@@ -368,7 +364,7 @@ BOOL dbg_init(HANDLE hProc, const WCHAR* in, BOOL invade)
ret
=
SymSetSearchPathW
(
hProc
,
tmp
);
}
else
ret
=
FALSE
;
HeapFree
(
GetProcessHeap
(),
0
,
tmp
);
free
(
tmp
);
break
;
}
}
...
...
@@ -402,7 +398,7 @@ struct dbg_thread* dbg_get_thread(struct dbg_process* p, DWORD tid)
struct
dbg_thread
*
dbg_add_thread
(
struct
dbg_process
*
p
,
DWORD
tid
,
HANDLE
h
,
void
*
teb
)
{
struct
dbg_thread
*
t
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
struct
dbg_thread
));
struct
dbg_thread
*
t
=
malloc
(
sizeof
(
struct
dbg_thread
));
if
(
!
t
)
return
NULL
;
...
...
@@ -431,10 +427,10 @@ struct dbg_thread* dbg_add_thread(struct dbg_process* p, DWORD tid,
void
dbg_del_thread
(
struct
dbg_thread
*
t
)
{
HeapFree
(
GetProcessHeap
(),
0
,
t
->
frames
);
free
(
t
->
frames
);
list_remove
(
&
t
->
entry
);
if
(
t
==
dbg_curr_thread
)
dbg_curr_thread
=
NULL
;
HeapFree
(
GetProcessHeap
(),
0
,
t
);
free
(
t
);
}
void
dbg_set_option
(
const
char
*
option
,
const
char
*
val
)
...
...
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