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
dda17c68
Commit
dda17c68
authored
Apr 25, 1999
by
Ove Kaaven
Committed by
Alexandre Julliard
Apr 25, 1999
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added a possibility to let the internal debugger use a separate
heap. Not enabled by default, change #if in include/debugger.h to use this (the heap allocator is very slow).
parent
658191ee
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
141 additions
and
107 deletions
+141
-107
dbg.y
debugger/dbg.y
+14
-0
debug.l
debugger/debug.l
+8
-3
display.c
debugger/display.c
+0
-1
editline.c
debugger/editline.c
+8
-7
expr.c
debugger/expr.c
+10
-11
hash.c
debugger/hash.c
+9
-10
msc.c
debugger/msc.c
+29
-30
source.c
debugger/source.c
+10
-11
stabs.c
debugger/stabs.c
+17
-18
stack.c
debugger/stack.c
+6
-7
types.c
debugger/types.c
+8
-9
debugger.h
include/debugger.h
+22
-0
No files found.
debugger/dbg.y
View file @
dda17c68
...
...
@@ -32,6 +32,7 @@
extern FILE * yyin;
unsigned int dbg_mode = 0;
HANDLE dbg_heap = 0;
int curr_frame = 0;
static enum exec_mode dbg_exec_mode = EXEC_CONT;
...
...
@@ -43,6 +44,12 @@ void flush_symbols(void);
int yylex(void);
int yyerror(char *);
#ifdef DBG_need_heap
#define malloc(x) DBG_alloc(x)
#define realloc(x,y) DBG_realloc(x,y)
#define free(x) DBG_free(x)
#endif
extern void VIRTUAL_Dump(void); /* memory/virtual.c */
%}
...
...
@@ -452,6 +459,13 @@ static void DEBUG_Main( int signal )
frozen = TRUE;
}
#ifdef DBG_need_heap
/*
* Initialize the debugger heap.
*/
dbg_heap = HeapCreate(HEAP_NO_SERIALIZE, 0x1000, 0x8000000); /* 128MB */
#endif
/*
* Initialize the type handling stuff.
*/
...
...
debugger/debug.l
View file @
dda17c68
...
...
@@ -9,9 +9,14 @@
#include <stdlib.h>
#include <string.h>
#include "debugger.h"
#include "xmalloc.h"
#include "y.tab.h"
#ifdef DBG_need_heap
#define malloc(x) DBG_alloc(x)
#define realloc(x,y) DBG_realloc(x,y)
#define free(x) DBG_free(x)
#endif
#ifndef DONT_USE_READLINE
#undef YY_INPUT
#define YY_INPUT(buf,result,max_size) \
...
...
@@ -270,12 +275,12 @@ static char *local_symbols[30];
static int next_symbol;
char * make_symbol(char * symbol){
return local_symbols[next_symbol++] =
x
strdup(symbol);
return local_symbols[next_symbol++] =
DBG_
strdup(symbol);
}
void flush_symbols()
{
while(--next_symbol>= 0) free(local_symbols[next_symbol]);
while(--next_symbol>= 0)
DBG_
free(local_symbols[next_symbol]);
next_symbol = 0;
}
...
...
debugger/display.c
View file @
dda17c68
...
...
@@ -14,7 +14,6 @@
#include "module.h"
#include "selectors.h"
#include "debugger.h"
#include "xmalloc.h"
#include <stdarg.h>
...
...
debugger/editline.c
View file @
dda17c68
...
...
@@ -34,6 +34,7 @@
#include <sys/stat.h>
#include "windef.h"
#include "debugger.h"
/*
** Manifest constants.
...
...
@@ -55,11 +56,11 @@
#define MEM_INC 64
#define SCREEN_INC 256
#define DISPOSE(p) free((char *)(p))
#define DISPOSE(p)
DBG_
free((char *)(p))
#define NEW(T, c) \
((T *)
m
alloc((unsigned int)(sizeof (T) * (c))))
((T *)
DBG_
alloc((unsigned int)(sizeof (T) * (c))))
#define RENEW(p, T, c) \
(p = (T *)realloc((char *)(p), (unsigned int)(sizeof (T) * (c))))
(p = (T *)
DBG_
realloc((char *)(p), (unsigned int)(sizeof (T) * (c))))
#define COPYFROMTO(new, p, len) \
(void)memcpy((char *)(new), (char *)(p), (int)(len))
...
...
@@ -664,7 +665,7 @@ search_hist(search, move)
if
(
search
&&
*
search
)
{
if
(
old_search
)
DISPOSE
(
old_search
);
old_search
=
(
CHAR
*
)
strdup
((
char
*
)
search
);
old_search
=
(
CHAR
*
)
DBG_
strdup
((
char
*
)
search
);
}
else
{
if
(
old_search
==
NULL
||
*
old_search
==
'\0'
)
...
...
@@ -1014,7 +1015,7 @@ hist_add(p)
{
int
i
;
if
((
p
=
(
CHAR
*
)
strdup
((
char
*
)
p
))
==
NULL
)
if
((
p
=
(
CHAR
*
)
DBG_
strdup
((
char
*
)
p
))
==
NULL
)
return
;
if
(
H
.
Size
<
HIST_SIZE
)
H
.
Lines
[
H
.
Size
++
]
=
p
;
...
...
@@ -1047,7 +1048,7 @@ readline(prompt)
Prompt
=
prompt
?
prompt
:
(
char
*
)
NIL
;
TTYputs
((
CHAR
*
)
Prompt
);
if
((
line
=
editinput
())
!=
NULL
)
{
line
=
(
CHAR
*
)
strdup
((
char
*
)
line
);
line
=
(
CHAR
*
)
DBG_
strdup
((
char
*
)
line
);
TTYputs
((
CHAR
*
)
NEWLINE
);
TTYflush
();
}
...
...
@@ -1318,7 +1319,7 @@ last_argument()
if
(
H
.
Size
==
1
||
(
p
=
H
.
Lines
[
H
.
Size
-
2
])
==
NULL
)
return
ring_bell
();
if
((
p
=
(
CHAR
*
)
strdup
((
char
*
)
p
))
==
NULL
)
if
((
p
=
(
CHAR
*
)
DBG_
strdup
((
char
*
)
p
))
==
NULL
)
return
CSstay
;
ac
=
argify
(
p
,
&
av
);
...
...
debugger/expr.c
View file @
dda17c68
...
...
@@ -17,7 +17,6 @@
#include "task.h"
#include "selectors.h"
#include "debugger.h"
#include "xmalloc.h"
#include "expr.h"
...
...
@@ -811,7 +810,7 @@ DEBUG_CloneExpr(struct expr * exp)
int
i
;
struct
expr
*
rtn
;
rtn
=
(
struct
expr
*
)
xm
alloc
(
sizeof
(
struct
expr
));
rtn
=
(
struct
expr
*
)
DBG_
alloc
(
sizeof
(
struct
expr
));
/*
* First copy the contents of the expression itself.
...
...
@@ -829,15 +828,15 @@ DEBUG_CloneExpr(struct expr * exp)
case
EXPR_TYPE_CONST
:
break
;
case
EXPR_TYPE_STRING
:
rtn
->
un
.
string
.
str
=
x
strdup
(
exp
->
un
.
string
.
str
);
rtn
->
un
.
string
.
str
=
DBG_
strdup
(
exp
->
un
.
string
.
str
);
break
;
case
EXPR_TYPE_SYMBOL
:
rtn
->
un
.
symbol
.
name
=
x
strdup
(
exp
->
un
.
symbol
.
name
);
rtn
->
un
.
symbol
.
name
=
DBG_
strdup
(
exp
->
un
.
symbol
.
name
);
break
;
case
EXPR_TYPE_PSTRUCT
:
case
EXPR_TYPE_STRUCT
:
rtn
->
un
.
structure
.
exp1
=
DEBUG_CloneExpr
(
exp
->
un
.
structure
.
exp1
);
rtn
->
un
.
structure
.
element_name
=
x
strdup
(
exp
->
un
.
structure
.
element_name
);
rtn
->
un
.
structure
.
element_name
=
DBG_
strdup
(
exp
->
un
.
structure
.
element_name
);
break
;
case
EXPR_TYPE_CALL
:
/*
...
...
@@ -848,7 +847,7 @@ DEBUG_CloneExpr(struct expr * exp)
{
rtn
->
un
.
call
.
arg
[
i
]
=
DEBUG_CloneExpr
(
exp
->
un
.
call
.
arg
[
i
]);
}
rtn
->
un
.
call
.
funcname
=
x
strdup
(
exp
->
un
.
call
.
funcname
);
rtn
->
un
.
call
.
funcname
=
DBG_
strdup
(
exp
->
un
.
call
.
funcname
);
break
;
case
EXPR_TYPE_BINOP
:
rtn
->
un
.
binop
.
exp1
=
DEBUG_CloneExpr
(
exp
->
un
.
binop
.
exp1
);
...
...
@@ -886,15 +885,15 @@ DEBUG_FreeExpr(struct expr * exp)
case
EXPR_TYPE_CONST
:
break
;
case
EXPR_TYPE_STRING
:
free
((
char
*
)
exp
->
un
.
string
.
str
);
DBG_
free
((
char
*
)
exp
->
un
.
string
.
str
);
break
;
case
EXPR_TYPE_SYMBOL
:
free
((
char
*
)
exp
->
un
.
symbol
.
name
);
DBG_
free
((
char
*
)
exp
->
un
.
symbol
.
name
);
break
;
case
EXPR_TYPE_PSTRUCT
:
case
EXPR_TYPE_STRUCT
:
DEBUG_FreeExpr
(
exp
->
un
.
structure
.
exp1
);
free
((
char
*
)
exp
->
un
.
structure
.
element_name
);
DBG_
free
((
char
*
)
exp
->
un
.
structure
.
element_name
);
break
;
case
EXPR_TYPE_CALL
:
/*
...
...
@@ -905,7 +904,7 @@ DEBUG_FreeExpr(struct expr * exp)
{
DEBUG_FreeExpr
(
exp
->
un
.
call
.
arg
[
i
]);
}
free
((
char
*
)
exp
->
un
.
call
.
funcname
);
DBG_
free
((
char
*
)
exp
->
un
.
call
.
funcname
);
break
;
case
EXPR_TYPE_BINOP
:
DEBUG_FreeExpr
(
exp
->
un
.
binop
.
exp1
);
...
...
@@ -920,6 +919,6 @@ DEBUG_FreeExpr(struct expr * exp)
break
;
}
free
(
exp
);
DBG_
free
(
exp
);
return
TRUE
;
}
debugger/hash.c
View file @
dda17c68
...
...
@@ -17,7 +17,6 @@
#include "selectors.h"
#include "debugger.h"
#include "toolhelp.h"
#include "xmalloc.h"
#define NR_NAME_HASH 16384
#ifndef PATH_MAX
...
...
@@ -154,7 +153,7 @@ DEBUG_ResortSymbols()
return
;
}
addr_sorttab
=
(
struct
name_hash
**
)
x
realloc
(
addr_sorttab
,
addr_sorttab
=
(
struct
name_hash
**
)
DBG_
realloc
(
addr_sorttab
,
nsym
*
sizeof
(
struct
name_hash
*
));
nsym
=
0
;
...
...
@@ -215,9 +214,9 @@ DEBUG_AddSymbol( const char * name, const DBG_ADDR *addr, const char * source,
* return it, so we don't end up with duplicates.
*/
new
=
(
struct
name_hash
*
)
xm
alloc
(
sizeof
(
struct
name_hash
));
new
=
(
struct
name_hash
*
)
DBG_
alloc
(
sizeof
(
struct
name_hash
));
new
->
addr
=
*
addr
;
new
->
name
=
x
strdup
(
name
);
new
->
name
=
DBG_
strdup
(
name
);
if
(
source
!=
NULL
)
{
...
...
@@ -233,7 +232,7 @@ DEBUG_AddSymbol( const char * name, const DBG_ADDR *addr, const char * source,
else
{
strcpy
(
prev_source
,
source
);
prev_duped_source
=
new
->
sourcefile
=
x
strdup
(
source
);
prev_duped_source
=
new
->
sourcefile
=
DBG_
strdup
(
source
);
}
}
else
...
...
@@ -301,14 +300,14 @@ BOOL DEBUG_Normalize(struct name_hash * nh )
if
(
nh
->
n_locals
!=
nh
->
locals_alloc
)
{
nh
->
locals_alloc
=
nh
->
n_locals
;
nh
->
local_vars
=
x
realloc
(
nh
->
local_vars
,
nh
->
local_vars
=
DBG_
realloc
(
nh
->
local_vars
,
nh
->
locals_alloc
*
sizeof
(
WineLocals
));
}
if
(
nh
->
n_lines
!=
nh
->
lines_alloc
)
{
nh
->
lines_alloc
=
nh
->
n_lines
;
nh
->
linetab
=
x
realloc
(
nh
->
linetab
,
nh
->
linetab
=
DBG_
realloc
(
nh
->
linetab
,
nh
->
lines_alloc
*
sizeof
(
WineLineNo
));
}
...
...
@@ -928,7 +927,7 @@ DEBUG_AddLineNumber( struct name_hash * func, int line_num,
if
(
func
->
n_lines
+
1
>=
func
->
lines_alloc
)
{
func
->
lines_alloc
+=
64
;
func
->
linetab
=
x
realloc
(
func
->
linetab
,
func
->
linetab
=
DBG_
realloc
(
func
->
linetab
,
func
->
lines_alloc
*
sizeof
(
WineLineNo
));
}
...
...
@@ -955,7 +954,7 @@ DEBUG_AddLocal( struct name_hash * func, int regno,
if
(
func
->
n_locals
+
1
>=
func
->
locals_alloc
)
{
func
->
locals_alloc
+=
32
;
func
->
local_vars
=
x
realloc
(
func
->
local_vars
,
func
->
local_vars
=
DBG_
realloc
(
func
->
local_vars
,
func
->
locals_alloc
*
sizeof
(
WineLocals
));
}
...
...
@@ -963,7 +962,7 @@ DEBUG_AddLocal( struct name_hash * func, int regno,
func
->
local_vars
[
func
->
n_locals
].
offset
=
offset
;
func
->
local_vars
[
func
->
n_locals
].
pc_start
=
pc_start
;
func
->
local_vars
[
func
->
n_locals
].
pc_end
=
pc_end
;
func
->
local_vars
[
func
->
n_locals
].
name
=
x
strdup
(
name
);
func
->
local_vars
[
func
->
n_locals
].
name
=
DBG_
strdup
(
name
);
func
->
local_vars
[
func
->
n_locals
].
type
=
NULL
;
func
->
n_locals
++
;
...
...
debugger/msc.c
View file @
dda17c68
...
...
@@ -31,7 +31,6 @@
#include "debugger.h"
#include "neexe.h"
#include "peexe.h"
#include "xmalloc.h"
#include "file.h"
/*
...
...
@@ -39,8 +38,8 @@
*/
static
void
LocateDebugInfoFile
(
char
*
filename
,
char
*
dbg_filename
)
{
char
*
str1
=
xm
alloc
(
MAX_PATHNAME_LEN
*
10
);
char
*
str2
=
xm
alloc
(
MAX_PATHNAME_LEN
);
char
*
str1
=
DBG_
alloc
(
MAX_PATHNAME_LEN
*
10
);
char
*
str2
=
DBG_
alloc
(
MAX_PATHNAME_LEN
);
char
*
file
;
char
*
name_part
;
DOS_FULL_NAME
fullname
;
...
...
@@ -60,8 +59,8 @@ static void LocateDebugInfoFile(char *filename, char *dbg_filename)
{
quit:
memcpy
(
dbg_filename
,
filename
,
MAX_PATHNAME_LEN
);
free
(
str1
);
free
(
str2
);
DBG_
free
(
str1
);
DBG_
free
(
str2
);
return
;
}
ok:
...
...
@@ -69,8 +68,8 @@ ok:
memcpy
(
dbg_filename
,
fullname
.
long_name
,
MAX_PATHNAME_LEN
);
else
goto
quit
;
free
(
str1
);
free
(
str2
);
DBG_
free
(
str1
);
DBG_
free
(
str2
);
return
;
}
/*
...
...
@@ -627,7 +626,7 @@ DEBUG_ParseTypeTable(char * table, int len)
if
(
curr_type
-
0x1000
>=
num_cv_defined_types
)
{
num_cv_defined_types
+=
0x100
;
cv_defined_types
=
(
struct
datatype
**
)
realloc
(
cv_defined_types
,
cv_defined_types
=
(
struct
datatype
**
)
DBG_
realloc
(
cv_defined_types
,
num_cv_defined_types
*
sizeof
(
struct
datatype
*
));
memset
(
cv_defined_types
+
num_cv_defined_types
-
0x100
,
0
,
...
...
@@ -987,7 +986,7 @@ DEBUG_RegisterDebugInfo( HMODULE hModule, const char *module_name)
char
fn
[
PATH_MAX
];
int
fd
=
-
1
;
DOS_FULL_NAME
full_name
;
struct
deferred_debug_info
*
deefer
=
(
struct
deferred_debug_info
*
)
xm
alloc
(
sizeof
(
*
deefer
));
struct
deferred_debug_info
*
deefer
=
(
struct
deferred_debug_info
*
)
DBG_
alloc
(
sizeof
(
*
deefer
));
deefer
->
module
=
hModule
;
deefer
->
load_addr
=
(
char
*
)
hModule
;
...
...
@@ -1011,13 +1010,13 @@ DEBUG_RegisterDebugInfo( HMODULE hModule, const char *module_name)
close
(
fd
);
if
(
deefer
->
dbg_info
==
(
char
*
)
0xffffffff
)
{
free
(
deefer
);
DBG_
free
(
deefer
);
break
;
}
}
else
{
free
(
deefer
);
DBG_
free
(
deefer
);
fprintf
(
stderr
,
" (not mapped: fn=%s, lfn=%s, fd=%d)"
,
fn
,
full_name
.
long_name
,
fd
);
break
;
}
...
...
@@ -1026,7 +1025,7 @@ DEBUG_RegisterDebugInfo( HMODULE hModule, const char *module_name)
deefer
->
next
=
dbglist
;
deefer
->
loaded
=
FALSE
;
deefer
->
dbg_index
=
DEBUG_next_index
;
deefer
->
module_name
=
x
strdup
(
module_name
);
deefer
->
module_name
=
DBG_
strdup
(
module_name
);
deefer
->
sectp
=
PE_SECTIONS
(
hModule
);
deefer
->
nsect
=
PE_HEADER
(
hModule
)
->
FileHeader
.
NumberOfSections
;
...
...
@@ -1077,7 +1076,7 @@ DEBUG_RegisterELFDebugInfo(int load_addr, u_long size, char * name)
{
struct
deferred_debug_info
*
deefer
;
deefer
=
(
struct
deferred_debug_info
*
)
xm
alloc
(
sizeof
(
*
deefer
));
deefer
=
(
struct
deferred_debug_info
*
)
DBG_
alloc
(
sizeof
(
*
deefer
));
deefer
->
module
=
0
;
/*
...
...
@@ -1093,7 +1092,7 @@ DEBUG_RegisterELFDebugInfo(int load_addr, u_long size, char * name)
deefer
->
next
=
dbglist
;
deefer
->
loaded
=
TRUE
;
deefer
->
dbg_index
=
DEBUG_next_index
;
deefer
->
module_name
=
x
strdup
(
name
);
deefer
->
module_name
=
DBG_
strdup
(
name
);
dbglist
=
deefer
;
DEBUG_next_index
++
;
...
...
@@ -1162,7 +1161,7 @@ DEBUG_ProcessCoff(struct deferred_debug_info * deefer)
if
(
nfiles
+
1
>=
nfiles_alloc
)
{
nfiles_alloc
+=
10
;
coff_files
=
(
struct
CoffFiles
*
)
realloc
(
coff_files
,
coff_files
=
(
struct
CoffFiles
*
)
DBG_realloc
(
coff_files
,
nfiles_alloc
*
sizeof
(
struct
CoffFiles
));
}
curr_file
=
coff_files
+
nfiles
;
...
...
@@ -1224,7 +1223,7 @@ DEBUG_ProcessCoff(struct deferred_debug_info * deefer)
if
(
nfiles
+
1
>=
nfiles_alloc
)
{
nfiles_alloc
+=
10
;
coff_files
=
(
struct
CoffFiles
*
)
realloc
(
coff_files
,
coff_files
=
(
struct
CoffFiles
*
)
DBG_realloc
(
coff_files
,
nfiles_alloc
*
sizeof
(
struct
CoffFiles
));
}
curr_file
=
coff_files
+
nfiles
;
...
...
@@ -1304,7 +1303,7 @@ DEBUG_ProcessCoff(struct deferred_debug_info * deefer)
{
curr_file
->
neps_alloc
+=
10
;
curr_file
->
entries
=
(
struct
name_hash
**
)
realloc
(
curr_file
->
entries
,
DBG_realloc
(
curr_file
->
entries
,
curr_file
->
neps_alloc
*
sizeof
(
struct
name_hash
*
));
}
#if 0
...
...
@@ -1363,7 +1362,7 @@ DEBUG_ProcessCoff(struct deferred_debug_info * deefer)
{
coff_files
[
j
].
neps_alloc
+=
10
;
coff_files
[
j
].
entries
=
(
struct
name_hash
**
)
realloc
(
coff_files
[
j
].
entries
,
DBG_realloc
(
coff_files
[
j
].
entries
,
coff_files
[
j
].
neps_alloc
*
sizeof
(
struct
name_hash
*
));
}
coff_files
[
j
].
entries
[
coff_files
[
j
].
neps
++
]
=
...
...
@@ -1509,10 +1508,10 @@ DEBUG_ProcessCoff(struct deferred_debug_info * deefer)
{
if
(
coff_files
[
j
].
entries
!=
NULL
)
{
free
(
coff_files
[
j
].
entries
);
DBG_
free
(
coff_files
[
j
].
entries
);
}
}
free
(
coff_files
);
DBG_
free
(
coff_files
);
}
return
(
rtn
);
...
...
@@ -1568,7 +1567,7 @@ DEBUG_SnarfLinetab(char * linetab,
* and pull bits as required.
*/
lt_hdr
=
(
struct
codeview_linetab_hdr
*
)
xm
alloc
((
nseg
+
1
)
*
sizeof
(
*
lt_hdr
));
DBG_
alloc
((
nseg
+
1
)
*
sizeof
(
*
lt_hdr
));
if
(
lt_hdr
==
NULL
)
{
goto
leave
;
...
...
@@ -1602,7 +1601,7 @@ DEBUG_SnarfLinetab(char * linetab,
fn
=
(
unsigned
char
*
)
(
start
+
file_segcount
);
memset
(
filename
,
0
,
sizeof
(
filename
));
memcpy
(
filename
,
fn
+
1
,
*
fn
);
fn
=
strdup
(
filename
);
fn
=
DBG_
strdup
(
filename
);
for
(
k
=
0
;
k
<
file_segcount
;
k
++
,
this_seg
++
)
{
...
...
@@ -1825,7 +1824,7 @@ DEBUG_SnarfCodeView( struct deferred_debug_info * deefer,
if
(
linetab
!=
NULL
)
{
free
(
linetab
);
DBG_
free
(
linetab
);
}
return
TRUE
;
...
...
@@ -1926,7 +1925,7 @@ DEBUG_ProcessPDBFile(struct deferred_debug_info * deefer, char * full_filename)
* extents from the file to form the TOC.
*/
toc_blocks
=
(
pdbhdr
->
toc_len
+
blocksize
-
1
)
/
blocksize
;
toc
=
(
char
*
)
xm
alloc
(
toc_blocks
*
blocksize
);
toc
=
(
char
*
)
DBG_
alloc
(
toc_blocks
*
blocksize
);
table
=
pdbhdr
->
toc_ext
;
for
(
i
=
0
;
i
<
toc_blocks
;
i
++
)
{
...
...
@@ -1955,7 +1954,7 @@ DEBUG_ProcessPDBFile(struct deferred_debug_info * deefer, char * full_filename)
goto
leave
;
}
filelist
=
(
struct
file_list
*
)
xm
alloc
(
npair
*
sizeof
(
*
filelist
));
filelist
=
(
struct
file_list
*
)
DBG_
alloc
(
npair
*
sizeof
(
*
filelist
));
if
(
filelist
==
NULL
)
{
goto
leave
;
...
...
@@ -1996,7 +1995,7 @@ DEBUG_ProcessPDBFile(struct deferred_debug_info * deefer, char * full_filename)
if
(
bufflen
<
filelist
[
i
].
nextents
*
blocksize
)
{
bufflen
=
filelist
[
i
].
nextents
*
blocksize
;
buffer
=
(
char
*
)
realloc
(
buffer
,
bufflen
);
buffer
=
(
char
*
)
DBG_
realloc
(
buffer
,
bufflen
);
}
/*
...
...
@@ -2056,7 +2055,7 @@ DEBUG_ProcessPDBFile(struct deferred_debug_info * deefer, char * full_filename)
hd
=
(
struct
filetab_hdr
*
)
buffer
;
gsym_record
=
hd
->
gsym_file
;
gsymtab
=
(
char
*
)
xmalloc
(
filelist
[
gsym_record
].
nextents
gsymtab
=
(
char
*
)
DBG_alloc
(
filelist
[
gsym_record
].
nextents
*
blocksize
);
memset
(
gsymtab
,
0
,
filelist
[
gsym_record
].
nextents
*
blocksize
);
...
...
@@ -2162,18 +2161,18 @@ leave:
if
(
gsymtab
!=
NULL
)
{
free
(
gsymtab
);
DBG_
free
(
gsymtab
);
gsymtab
=
NULL
;
}
if
(
buffer
!=
NULL
)
{
free
(
buffer
);
DBG_
free
(
buffer
);
}
if
(
filelist
!=
NULL
)
{
free
(
filelist
);
DBG_
free
(
filelist
);
}
if
(
addr
!=
(
char
*
)
0xffffffff
)
...
...
debugger/source.c
View file @
dda17c68
...
...
@@ -26,7 +26,6 @@
#include "debugger.h"
#include "peexe.h"
#include "task.h"
#include "xmalloc.h"
struct
searchlist
{
...
...
@@ -70,14 +69,14 @@ DEBUG_AddPath(const char * path)
{
struct
searchlist
*
sl
;
sl
=
(
struct
searchlist
*
)
xm
alloc
(
sizeof
(
struct
searchlist
));
sl
=
(
struct
searchlist
*
)
DBG_
alloc
(
sizeof
(
struct
searchlist
));
if
(
sl
==
NULL
)
{
return
;
}
sl
->
next
=
listhead
;
sl
->
path
=
x
strdup
(
path
);
sl
->
path
=
DBG_
strdup
(
path
);
listhead
=
sl
;
}
...
...
@@ -90,8 +89,8 @@ DEBUG_NukePath()
for
(
sl
=
listhead
;
sl
;
sl
=
nxt
)
{
nxt
=
sl
->
next
;
free
(
sl
->
path
);
free
(
sl
);
DBG_
free
(
sl
->
path
);
DBG_
free
(
sl
);
}
listhead
=
NULL
;
...
...
@@ -215,8 +214,8 @@ DEBUG_DisplaySource(char * sourcefile, int start, int end)
* OK, I guess the user doesn't really want to see it
* after all.
*/
ol
=
(
struct
open_filelist
*
)
xm
alloc
(
sizeof
(
*
ol
));
ol
->
path
=
x
strdup
(
sourcefile
);
ol
=
(
struct
open_filelist
*
)
DBG_
alloc
(
sizeof
(
*
ol
));
ol
->
path
=
DBG_
strdup
(
sourcefile
);
ol
->
real_path
=
NULL
;
ol
->
next
=
ofiles
;
ol
->
nlines
=
0
;
...
...
@@ -230,9 +229,9 @@ DEBUG_DisplaySource(char * sourcefile, int start, int end)
/*
* Create header for file.
*/
ol
=
(
struct
open_filelist
*
)
xm
alloc
(
sizeof
(
*
ol
));
ol
->
path
=
x
strdup
(
sourcefile
);
ol
->
real_path
=
x
strdup
(
tmppath
);
ol
=
(
struct
open_filelist
*
)
DBG_
alloc
(
sizeof
(
*
ol
));
ol
->
path
=
DBG_
strdup
(
sourcefile
);
ol
->
real_path
=
DBG_
strdup
(
tmppath
);
ol
->
next
=
ofiles
;
ol
->
nlines
=
0
;
ol
->
linelist
=
NULL
;
...
...
@@ -268,7 +267,7 @@ DEBUG_DisplaySource(char * sourcefile, int start, int end)
}
ol
->
nlines
++
;
ol
->
linelist
=
(
unsigned
int
*
)
xmalloc
(
ol
->
nlines
*
sizeof
(
unsigned
int
)
);
ol
->
linelist
=
(
unsigned
int
*
)
DBG_alloc
(
ol
->
nlines
*
sizeof
(
unsigned
int
)
);
nlines
=
0
;
pnt
=
addr
;
...
...
debugger/stabs.c
View file @
dda17c68
...
...
@@ -20,7 +20,6 @@
#endif
#include "debugger.h"
#include "xmalloc.h"
#ifdef __svr4__
#define __ELF__
...
...
@@ -146,14 +145,14 @@ static
int
DEBUG_FileSubNr2StabEnum
(
int
filenr
,
int
subnr
)
{
if
(
nrofnroftypenums
<=
filenr
)
{
nroftypenums
=
x
realloc
(
nroftypenums
,
sizeof
(
nroftypenums
[
0
])
*
(
filenr
+
1
));
nroftypenums
=
DBG_
realloc
(
nroftypenums
,
sizeof
(
nroftypenums
[
0
])
*
(
filenr
+
1
));
memset
(
nroftypenums
+
nrofnroftypenums
,
0
,(
filenr
+
1
-
nrofnroftypenums
)
*
sizeof
(
nroftypenums
[
0
]));
typenums
=
x
realloc
(
typenums
,
sizeof
(
typenums
[
0
])
*
(
filenr
+
1
));
typenums
=
DBG_
realloc
(
typenums
,
sizeof
(
typenums
[
0
])
*
(
filenr
+
1
));
memset
(
typenums
+
nrofnroftypenums
,
0
,
sizeof
(
typenums
[
0
])
*
(
filenr
+
1
-
nrofnroftypenums
));
nrofnroftypenums
=
filenr
+
1
;
}
if
(
nroftypenums
[
filenr
]
<=
subnr
)
{
typenums
[
filenr
]
=
x
realloc
(
typenums
[
filenr
],
sizeof
(
typenums
[
0
][
0
])
*
(
subnr
+
1
));
typenums
[
filenr
]
=
DBG_
realloc
(
typenums
[
filenr
],
sizeof
(
typenums
[
0
][
0
])
*
(
subnr
+
1
));
memset
(
typenums
[
filenr
]
+
nroftypenums
[
filenr
],
0
,
sizeof
(
typenums
[
0
][
0
])
*
(
subnr
+
1
-
nroftypenums
[
filenr
]));
nroftypenums
[
filenr
]
=
subnr
+
1
;
}
...
...
@@ -162,7 +161,7 @@ DEBUG_FileSubNr2StabEnum(int filenr,int subnr) {
if
(
num_stab_types
<=
curtypenum
)
{
num_stab_types
=
curtypenum
+
256
;
stab_types
=
(
struct
datatype
**
)
x
realloc
(
stab_types
,
stab_types
=
(
struct
datatype
**
)
DBG_
realloc
(
stab_types
,
num_stab_types
*
sizeof
(
struct
datatype
*
)
);
memset
(
stab_types
+
curtypenum
,
0
,
sizeof
(
struct
datatype
*
)
*
(
num_stab_types
-
curtypenum
)
);
...
...
@@ -221,12 +220,12 @@ DEBUG_RegisterTypedef(const char * name, struct datatype ** types, int ndef)
if
(
ndef
==
1
)
return
TRUE
;
ktd
=
(
struct
known_typedef
*
)
xm
alloc
(
sizeof
(
struct
known_typedef
)
ktd
=
(
struct
known_typedef
*
)
DBG_
alloc
(
sizeof
(
struct
known_typedef
)
+
ndef
*
sizeof
(
struct
datatype
*
));
hash
=
stab_hash
(
name
);
ktd
->
name
=
x
strdup
(
name
);
ktd
->
name
=
DBG_
strdup
(
name
);
ktd
->
ndefs
=
ndef
;
memcpy
(
&
ktd
->
types
[
0
],
types
,
ndef
*
sizeof
(
struct
datatype
*
));
ktd
->
next
=
ktd_head
[
hash
];
...
...
@@ -333,8 +332,8 @@ static int DEBUG_FreeRegisteredTypedefs()
{
count
++
;
next
=
ktd
->
next
;
free
(
ktd
->
name
);
free
(
ktd
);
DBG_
free
(
ktd
->
name
);
DBG_
free
(
ktd
);
}
ktd_head
[
j
]
=
NULL
;
}
...
...
@@ -654,7 +653,7 @@ DEBUG_ParseStabs(char * addr, unsigned int load_offset,
* where the stab is continued over multiple lines.
*/
stabbufflen
=
65536
;
stabbuff
=
(
char
*
)
xm
alloc
(
stabbufflen
);
stabbuff
=
(
char
*
)
DBG_
alloc
(
stabbufflen
);
strtabinc
=
0
;
stabbuff
[
0
]
=
'\0'
;
...
...
@@ -672,7 +671,7 @@ DEBUG_ParseStabs(char * addr, unsigned int load_offset,
if
(
strlen
(
stabbuff
)
+
len
>
stabbufflen
)
{
stabbufflen
+=
65536
;
stabbuff
=
(
char
*
)
x
realloc
(
stabbuff
,
stabbufflen
);
stabbuff
=
(
char
*
)
DBG_
realloc
(
stabbuff
,
stabbufflen
);
}
strncat
(
stabbuff
,
ptr
,
len
-
1
);
continue
;
...
...
@@ -935,7 +934,7 @@ DEBUG_ParseStabs(char * addr, unsigned int load_offset,
if
(
stab_types
!=
NULL
)
{
free
(
stab_types
);
DBG_
free
(
stab_types
);
stab_types
=
NULL
;
num_stab_types
=
0
;
}
...
...
@@ -1063,25 +1062,25 @@ DEBUG_ProcessElfObject(char * filename, unsigned int load_offset)
char
*
s
,
*
t
,
*
fn
,
*
paths
;
if
(
strchr
(
filename
,
'/'
))
goto
leave
;
paths
=
x
strdup
(
getenv
(
"PATH"
));
paths
=
DBG_
strdup
(
getenv
(
"PATH"
));
s
=
paths
;
while
(
s
&&
*
s
)
{
t
=
strchr
(
s
,
':'
);
if
(
t
)
*
t
=
'\0'
;
fn
=
(
char
*
)
xm
alloc
(
strlen
(
filename
)
+
1
+
strlen
(
s
)
+
1
);
fn
=
(
char
*
)
DBG_
alloc
(
strlen
(
filename
)
+
1
+
strlen
(
s
)
+
1
);
strcpy
(
fn
,
s
);
strcat
(
fn
,
"/"
);
strcat
(
fn
,
filename
);
if
((
rtn
=
DEBUG_ProcessElfObject
(
fn
,
load_offset
)))
{
free
(
fn
);
free
(
paths
);
DBG_
free
(
fn
);
DBG_
free
(
paths
);
goto
leave
;
}
free
(
fn
);
DBG_
free
(
fn
);
if
(
t
)
s
=
t
+
1
;
else
break
;
}
if
(
!
s
||
!*
s
)
fprintf
(
stderr
,
" not found"
);
free
(
paths
);
DBG_
free
(
paths
);
goto
leave
;
}
...
...
debugger/stack.c
View file @
dda17c68
...
...
@@ -8,7 +8,6 @@
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include "xmalloc.h"
#include "debugger.h"
...
...
@@ -85,8 +84,8 @@ void DEBUG_BackTrace(void)
if
(
IS_SELECTOR_SYSTEM
(
SS_reg
(
&
DEBUG_context
)))
/* system stack */
{
nframe
=
1
;
if
(
frames
)
free
(
frames
);
frames
=
(
struct
bt_info
*
)
xm
alloc
(
sizeof
(
struct
bt_info
)
);
if
(
frames
)
DBG_
free
(
frames
);
frames
=
(
struct
bt_info
*
)
DBG_
alloc
(
sizeof
(
struct
bt_info
)
);
fprintf
(
stderr
,
"%s%d "
,(
curr_frame
==
0
?
"=>"
:
" "
),
frameno
++
);
addr
.
seg
=
0
;
...
...
@@ -102,7 +101,7 @@ void DEBUG_BackTrace(void)
if
(
!
DBG_CHECK_READ_PTR
(
&
addr
,
sizeof
(
FRAME32
)
))
return
;
if
(
!
frame
->
ip
)
break
;
nframe
++
;
frames
=
(
struct
bt_info
*
)
x
realloc
(
frames
,
frames
=
(
struct
bt_info
*
)
DBG_
realloc
(
frames
,
nframe
*
sizeof
(
struct
bt_info
));
fprintf
(
stderr
,
"%s%d "
,
(
frameno
==
curr_frame
?
"=>"
:
" "
),
frameno
);
...
...
@@ -161,8 +160,8 @@ void DEBUG_SilentBackTrace(void)
int
frameno
=
0
;
nframe
=
1
;
if
(
frames
)
free
(
frames
);
frames
=
(
struct
bt_info
*
)
xm
alloc
(
sizeof
(
struct
bt_info
)
);
if
(
frames
)
DBG_
free
(
frames
);
frames
=
(
struct
bt_info
*
)
DBG_
alloc
(
sizeof
(
struct
bt_info
)
);
if
(
IS_SELECTOR_SYSTEM
(
SS_reg
(
&
DEBUG_context
)))
/* system stack */
{
addr
.
seg
=
0
;
...
...
@@ -179,7 +178,7 @@ void DEBUG_SilentBackTrace(void)
if
(
!
DBG_CHECK_READ_PTR
(
&
addr
,
sizeof
(
FRAME32
)
))
return
;
if
(
!
frame
->
ip
)
break
;
nframe
++
;
frames
=
(
struct
bt_info
*
)
x
realloc
(
frames
,
frames
=
(
struct
bt_info
*
)
DBG_
realloc
(
frames
,
nframe
*
sizeof
(
struct
bt_info
));
addr
.
off
=
frame
->
ip
;
frames
[
frameno
].
eip
=
addr
.
off
;
...
...
debugger/types.c
View file @
dda17c68
...
...
@@ -23,7 +23,6 @@
#include "peexe.h"
#include "debugger.h"
#include "peexe.h"
#include "xmalloc.h"
#define NR_TYPE_HASH 521
...
...
@@ -153,7 +152,7 @@ DEBUG_InitBasic(int type, char * name, int size, int b_signed,
int
hash
;
struct
datatype
*
dt
;
dt
=
(
struct
datatype
*
)
xm
alloc
(
sizeof
(
struct
datatype
));
dt
=
(
struct
datatype
*
)
DBG_
alloc
(
sizeof
(
struct
datatype
));
if
(
dt
!=
NULL
)
{
...
...
@@ -227,7 +226,7 @@ DEBUG_NewDataType(enum debug_type xtype, const char * typename)
if
(
dt
==
NULL
)
{
dt
=
(
struct
datatype
*
)
xm
alloc
(
sizeof
(
struct
datatype
));
dt
=
(
struct
datatype
*
)
DBG_
alloc
(
sizeof
(
struct
datatype
));
if
(
dt
!=
NULL
)
{
...
...
@@ -236,7 +235,7 @@ DEBUG_NewDataType(enum debug_type xtype, const char * typename)
dt
->
type
=
xtype
;
if
(
typename
!=
NULL
)
{
dt
->
name
=
x
strdup
(
typename
);
dt
->
name
=
DBG_
strdup
(
typename
);
}
else
{
...
...
@@ -281,7 +280,7 @@ DEBUG_FindOrMakePointerType(struct datatype * reftype)
if
(
dt
==
NULL
)
{
dt
=
(
struct
datatype
*
)
xm
alloc
(
sizeof
(
struct
datatype
));
dt
=
(
struct
datatype
*
)
DBG_
alloc
(
sizeof
(
struct
datatype
));
if
(
dt
!=
NULL
)
{
...
...
@@ -571,13 +570,13 @@ DEBUG_AddStructElement(struct datatype * dt, char * name, struct datatype * type
break
;
}
}
m
=
(
struct
member
*
)
xm
alloc
(
sizeof
(
struct
member
));
m
=
(
struct
member
*
)
DBG_
alloc
(
sizeof
(
struct
member
));
if
(
m
==
FALSE
)
{
return
FALSE
;
}
m
->
name
=
x
strdup
(
name
);
m
->
name
=
DBG_
strdup
(
name
);
m
->
type
=
type
;
m
->
offset
=
offset
;
m
->
size
=
size
;
...
...
@@ -604,13 +603,13 @@ DEBUG_AddStructElement(struct datatype * dt, char * name, struct datatype * type
}
else
if
(
dt
->
type
==
DT_ENUM
)
{
e
=
(
struct
en_values
*
)
xm
alloc
(
sizeof
(
struct
en_values
));
e
=
(
struct
en_values
*
)
DBG_
alloc
(
sizeof
(
struct
en_values
));
if
(
e
==
FALSE
)
{
return
FALSE
;
}
e
->
name
=
x
strdup
(
name
);
e
->
name
=
DBG_
strdup
(
name
);
e
->
value
=
offset
;
e
->
next
=
dt
->
un
.
enumeration
.
members
;
dt
->
un
.
enumeration
.
members
=
e
;
...
...
include/debugger.h
View file @
dda17c68
...
...
@@ -143,6 +143,7 @@ enum exec_mode
extern
CONTEXT
DEBUG_context
;
/* debugger/registers.c */
extern
unsigned
int
dbg_mode
;
extern
HANDLE
dbg_heap
;
/* debugger/break.c */
extern
void
DEBUG_SetBreakpoints
(
BOOL
set
);
...
...
@@ -328,5 +329,26 @@ extern void (*fnWINE_Debugger)(int,SIGCONTEXT*);
extern
void
(
*
ctx_debug_call
)(
int
,
CONTEXT
*
);
extern
BOOL
(
*
fnINSTR_EmulateInstruction
)(
SIGCONTEXT
*
);
/* Choose your allocator! */
#if 1
/* this one is libc's fast one */
#include "xmalloc.h"
#define DBG_alloc(x) xmalloc(x)
#define DBG_realloc(x,y) xrealloc(x,y)
#define DBG_free(x) free(x)
#define DBG_strdup(x) xstrdup(x)
#else
/* this one is slow (takes 5 minutes to load the debugger on my machine),
but is pretty crash-proof (can step through malloc() without problems,
malloc() arena (and other heaps) can be totally wasted and it'll still
work, etc... if someone could make optimized routines so it wouldn't
take so long to load, it could be made default) */
#include "heap.h"
#define DBG_alloc(x) HEAP_xalloc(dbg_heap,0,x)
#define DBG_realloc(x,y) HEAP_xrealloc(dbg_heap,0,x,y)
#define DBG_free(x) HeapFree(dbg_heap,0,x)
#define DBG_strdup(x) HEAP_strdupA(dbg_heap,0,x)
#define DBG_need_heap
#endif
#endif
/* __WINE_DEBUGGER_H */
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