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
7bec5c16
Commit
7bec5c16
authored
May 25, 2002
by
Eric Pouech
Committed by
Alexandre Julliard
May 25, 2002
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Hacked unicode printing feature (x /u).
Made the type casts a bit more robust.
parent
ca96de34
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
108 additions
and
59 deletions
+108
-59
dbg.y
debugger/dbg.y
+3
-6
debugger.h
debugger/debugger.h
+4
-1
expr.c
debugger/expr.c
+5
-0
info.c
debugger/info.c
+29
-19
memory.c
debugger/memory.c
+53
-24
types.c
debugger/types.c
+2
-7
winedbg.c
debugger/winedbg.c
+12
-2
No files found.
debugger/dbg.y
View file @
7bec5c16
...
...
@@ -86,7 +86,7 @@ int yyerror(char *);
%nonassoc ':'
%type <expression> expr lval lvalue
%type <type> type_
cast type_
expr
%type <type> type_expr
%type <value> expr_addr lval_addr
%type <integer> expr_value
%type <string> pathname identifier
...
...
@@ -266,11 +266,8 @@ noprocess_state:
| tNOPROCESS tSTRING tEOL { DEBUG_Printf(DBG_CHN_MESG, "No process loaded, cannot execute '%s'\n", $2); }
;
type_cast: '(' type_expr ')' { $$ = $2; }
;
type_expr:
type_expr '*' { $$ =
DEBUG_FindOrMakePointerType($1)
; }
type_expr '*' { $$ =
$1 ? DEBUG_FindOrMakePointerType($1) : NULL
; }
| tINT { $$ = DEBUG_GetBasicType(DT_BASIC_INT); }
| tCHAR { $$ = DEBUG_GetBasicType(DT_BASIC_CHAR); }
| tLONG tINT { $$ = DEBUG_GetBasicType(DT_BASIC_LONGINT); }
...
...
@@ -344,7 +341,7 @@ expr:
| '(' expr ')' { $$ = $2; }
| '*' expr %prec OP_DEREF { $$ = DEBUG_UnopExpr(EXP_OP_DEREF, $2); }
| '&' expr %prec OP_DEREF { $$ = DEBUG_UnopExpr(EXP_OP_ADDR, $2); }
|
type_cast expr %prec OP_DEREF { $$ = DEBUG_TypeCastExpr($1, $2
); }
|
'(' type_expr ')' expr %prec OP_DEREF { $$ = DEBUG_TypeCastExpr($2, $4
); }
;
/*
...
...
debugger/debugger.h
View file @
7bec5c16
...
...
@@ -419,6 +419,8 @@ extern enum dbg_mode DEBUG_GetSelectorType( WORD sel );
extern
void
DEBUG_FixAddress
(
DBG_ADDR
*
address
,
DWORD
def
);
extern
int
DEBUG_IsSelectorSystem
(
WORD
sel
);
#endif
extern
int
DEBUG_PrintStringA
(
int
chnl
,
const
DBG_ADDR
*
address
,
int
len
);
extern
int
DEBUG_PrintStringW
(
int
chnl
,
const
DBG_ADDR
*
address
,
int
len
);
/* debugger/module.c */
extern
int
DEBUG_LoadEntryPoints
(
const
char
*
prefix
);
...
...
@@ -513,7 +515,8 @@ extern struct datatype * DEBUG_GetBasicType(enum debug_type_basic);
#define DBG_CHN_WARN 4
#define DBG_CHN_FIXME 8
#define DBG_CHN_TRACE 16
extern
void
DEBUG_Output
(
int
chn
,
const
char
*
buffer
,
int
len
);
extern
void
DEBUG_OutputA
(
int
chn
,
const
char
*
buffer
,
int
len
);
extern
void
DEBUG_OutputW
(
int
chn
,
const
WCHAR
*
buffer
,
int
len
);
#ifdef __GNUC__
extern
int
DEBUG_Printf
(
int
chn
,
const
char
*
format
,
...)
__attribute__
((
format
(
printf
,
2
,
3
)));
#else
...
...
debugger/expr.c
View file @
7bec5c16
...
...
@@ -323,6 +323,11 @@ DBG_VALUE DEBUG_EvalExpr(struct expr * exp)
case
EXPR_TYPE_CAST
:
rtn
=
DEBUG_EvalExpr
(
exp
->
un
.
cast
.
expr
);
rtn
.
type
=
exp
->
un
.
cast
.
cast
;
if
(
!
rtn
.
type
)
{
DEBUG_Printf
(
DBG_CHN_MESG
,
"Can't cast to unknown type
\n
"
);
RaiseException
(
DEBUG_STATUS_BAD_TYPE
,
0
,
0
,
NULL
);
}
if
(
DEBUG_GetType
(
rtn
.
type
)
==
DT_POINTER
)
rtn
.
cookie
=
DV_TARGET
;
break
;
...
...
debugger/info.c
View file @
7bec5c16
...
...
@@ -40,7 +40,7 @@ void DEBUG_PrintBasic( const DBG_VALUE* value, int count, char format )
long
long
int
res
;
assert
(
value
->
cookie
==
DV_TARGET
||
value
->
cookie
==
DV_HOST
);
if
(
value
->
type
==
NULL
)
if
(
value
->
type
==
NULL
)
{
DEBUG_Printf
(
DBG_CHN_MESG
,
"Unable to evaluate expression
\n
"
);
return
;
...
...
@@ -49,35 +49,44 @@ void DEBUG_PrintBasic( const DBG_VALUE* value, int count, char format )
default_format
=
NULL
;
res
=
DEBUG_GetExprValue
(
value
,
&
default_format
);
switch
(
format
)
switch
(
format
)
{
case
'x'
:
if
(
value
->
addr
.
seg
)
{
DEBUG_nchar
+=
DEBUG_Printf
(
DBG_CHN_MESG
,
"0x%04lx"
,
(
long
unsigned
int
)
res
);
DEBUG_nchar
+=
DEBUG_Printf
(
DBG_CHN_MESG
,
"0x%04lx"
,
(
long
unsigned
int
)
res
);
}
else
{
DEBUG_nchar
+=
DEBUG_Printf
(
DBG_CHN_MESG
,
"0x%08lx"
,
(
long
unsigned
int
)
res
);
DEBUG_nchar
+=
DEBUG_Printf
(
DBG_CHN_MESG
,
"0x%08lx"
,
(
long
unsigned
int
)
res
);
}
break
;
case
'd'
:
DEBUG_nchar
+=
DEBUG_Printf
(
DBG_CHN_MESG
,
"%ld
\n
"
,
(
long
int
)
res
);
DEBUG_nchar
+=
DEBUG_Printf
(
DBG_CHN_MESG
,
"%ld
\n
"
,
(
long
int
)
res
);
break
;
case
'c'
:
DEBUG_nchar
+=
DEBUG_Printf
(
DBG_CHN_MESG
,
"%d = '%c'"
,
(
char
)(
res
&
0xff
),
(
char
)(
res
&
0xff
)
);
DEBUG_nchar
+=
DEBUG_Printf
(
DBG_CHN_MESG
,
"%d = '%c'"
,
(
char
)(
res
&
0xff
),
(
char
)(
res
&
0xff
));
break
;
case
'u'
:
{
WCHAR
wch
=
(
WCHAR
)(
res
&
0xFFFF
);
DEBUG_nchar
+=
DEBUG_Printf
(
DBG_CHN_MESG
,
"%d = '"
,
(
unsigned
)(
res
&
0xffff
));
DEBUG_OutputW
(
DBG_CHN_MESG
,
&
wch
,
1
);
DEBUG_Printf
(
DBG_CHN_MESG
,
"'"
);
}
break
;
case
'i'
:
case
's'
:
case
'w'
:
case
'b'
:
DEBUG_Printf
(
DBG_CHN_MESG
,
"Format specifier '%c' is meaningless in 'print' command
\n
"
,
format
);
DEBUG_Printf
(
DBG_CHN_MESG
,
"Format specifier '%c' is meaningless in 'print' command
\n
"
,
format
);
case
0
:
if
(
default_format
!=
NULL
)
if
(
default_format
!=
NULL
)
{
if
(
strstr
(
default_format
,
"%S"
)
!=
NULL
)
{
...
...
@@ -89,18 +98,19 @@ void DEBUG_PrintBasic( const DBG_VALUE* value, int count, char format )
*/
for
(
ptr
=
default_format
;
*
ptr
;
ptr
++
)
{
if
(
*
ptr
==
'%'
)
state
++
;
if
(
*
ptr
==
'%'
)
{
state
++
;
}
else
if
(
state
==
1
)
{
if
(
*
ptr
==
'S'
)
{
char
ch
;
char
*
str
=
(
char
*
)(
long
)
res
;
DBG_ADDR
addr
;
for
(;
DEBUG_READ_MEM
(
str
,
&
ch
,
1
)
&&
ch
;
str
++
)
{
DEBUG_Output
(
DBG_CHN_MESG
,
&
ch
,
1
);
DEBUG_nchar
++
;
}
addr
.
seg
=
0
;
addr
.
off
=
(
long
)
res
;
DEBUG_nchar
+=
DEBUG_PrintStringA
(
DBG_CHN_MESG
,
&
addr
,
-
1
);
}
else
{
...
...
@@ -112,18 +122,18 @@ void DEBUG_PrintBasic( const DBG_VALUE* value, int count, char format )
}
else
{
DEBUG_Output
(
DBG_CHN_MESG
,
ptr
,
1
);
DEBUG_OutputA
(
DBG_CHN_MESG
,
ptr
,
1
);
DEBUG_nchar
++
;
}
}
}
else
if
(
strcmp
(
default_format
,
"%B"
)
==
0
)
{
DEBUG_nchar
+=
DEBUG_Printf
(
DBG_CHN_MESG
,
"%s"
,
res
?
"true"
:
"false"
);
DEBUG_nchar
+=
DEBUG_Printf
(
DBG_CHN_MESG
,
"%s"
,
res
?
"true"
:
"false"
);
}
else
{
DEBUG_nchar
+=
DEBUG_Printf
(
DBG_CHN_MESG
,
default_format
,
res
);
DEBUG_nchar
+=
DEBUG_Printf
(
DBG_CHN_MESG
,
default_format
,
res
);
}
}
break
;
...
...
debugger/memory.c
View file @
7bec5c16
...
...
@@ -276,33 +276,15 @@ void DEBUG_ExamineMemory( const DBG_VALUE *_value, int count, char format )
switch
(
format
)
{
case
'u'
:
{
WCHAR
wch
;
case
'u'
:
if
(
count
==
1
)
count
=
256
;
while
(
count
--
)
{
if
(
!
DEBUG_READ_MEM_VERBOSE
(
pnt
,
&
wch
,
sizeof
(
wch
))
||
!
wch
)
break
;
pnt
+=
sizeof
(
wch
);
DEBUG_Printf
(
DBG_CHN_MESG
,
"%c"
,
(
char
)
wch
);
}
DEBUG_Printf
(
DBG_CHN_MESG
,
"
\n
"
);
DEBUG_nchar
+=
DEBUG_PrintStringW
(
DBG_CHN_MESG
,
&
value
.
addr
,
count
);
DEBUG_Printf
(
DBG_CHN_MESG
,
"
\n
"
);
return
;
}
case
's'
:
{
char
ch
;
if
(
count
==
1
)
count
=
256
;
while
(
count
--
)
{
if
(
!
DEBUG_READ_MEM_VERBOSE
(
pnt
,
&
ch
,
sizeof
(
ch
))
||
!
ch
)
break
;
pnt
++
;
DEBUG_Output
(
DBG_CHN_MESG
,
&
ch
,
1
);
}
DEBUG_Printf
(
DBG_CHN_MESG
,
"
\n
"
);
case
's'
:
DEBUG_nchar
+=
DEBUG_PrintStringA
(
DBG_CHN_MESG
,
&
value
.
addr
,
count
);
DEBUG_Printf
(
DBG_CHN_MESG
,
"
\n
"
);
return
;
}
case
'i'
:
while
(
count
--
&&
DEBUG_DisassembleInstruction
(
&
value
.
addr
));
return
;
...
...
@@ -330,3 +312,50 @@ void DEBUG_ExamineMemory( const DBG_VALUE *_value, int count, char format )
case
'b'
:
DO_DUMP2
(
char
,
16
,
" %02x"
,
(
_v
)
&
0xff
);
}
}
/******************************************************************
* DEBUG_PrintStringA
*
* Prints on channel chnl, the string starting at address in target
* address space. The string stops when either len chars (if <> -1)
* have been printed, or the '\0' char is printed
*/
int
DEBUG_PrintStringA
(
int
chnl
,
const
DBG_ADDR
*
address
,
int
len
)
{
char
*
lin
=
(
void
*
)
DEBUG_ToLinear
(
address
);
char
ach
[
16
+
1
];
int
i
,
l
;
if
(
len
==
-
1
)
len
=
32767
;
/* should be big enough */
/* so that the ach is always terminated */
ach
[
sizeof
(
ach
)
-
1
]
=
'\0'
;
for
(
i
=
len
;
i
>=
0
;
i
-=
sizeof
(
ach
)
-
1
)
{
l
=
min
(
sizeof
(
ach
)
-
1
,
i
);
DEBUG_READ_MEM_VERBOSE
(
lin
,
ach
,
l
);
l
=
strlen
(
ach
);
DEBUG_OutputA
(
chnl
,
ach
,
l
);
lin
+=
l
;
if
(
l
<
sizeof
(
ach
)
-
1
)
break
;
}
return
len
-
i
;
/* number of actually written chars */
}
int
DEBUG_PrintStringW
(
int
chnl
,
const
DBG_ADDR
*
address
,
int
len
)
{
char
*
lin
=
(
void
*
)
DEBUG_ToLinear
(
address
);
WCHAR
wch
;
int
ret
=
0
;
if
(
len
==
-
1
)
len
=
32767
;
/* should be big enough */
while
(
len
--
)
{
if
(
!
DEBUG_READ_MEM_VERBOSE
(
lin
,
&
wch
,
sizeof
(
wch
))
||
!
wch
)
break
;
lin
+=
sizeof
(
wch
);
DEBUG_OutputW
(
chnl
,
&
wch
,
1
);
ret
++
;
}
return
ret
;
}
debugger/types.c
View file @
7bec5c16
...
...
@@ -875,7 +875,6 @@ DEBUG_Print( const DBG_VALUE *value, int count, char format, int level )
size
=
DEBUG_GetObjectSize
(
value
->
type
->
un
.
array
.
basictype
);
if
(
size
==
1
)
{
char
ach
[
16
];
int
len
,
clen
;
/*
...
...
@@ -890,14 +889,10 @@ DEBUG_Print( const DBG_VALUE *value, int count, char format, int level )
switch
(
value
->
cookie
)
{
case
DV_TARGET
:
for
(
i
=
clen
;
i
>
0
;
i
-=
sizeof
(
ach
))
{
DEBUG_READ_MEM
(
pnt
,
ach
,
min
(
sizeof
(
ach
),
i
));
DEBUG_Output
(
DBG_CHN_MESG
,
ach
,
min
(
sizeof
(
ach
),
i
));
}
clen
=
DEBUG_PrintStringA
(
DBG_CHN_MESG
,
&
value
->
addr
,
clen
);
break
;
case
DV_HOST
:
DEBUG_Output
(
DBG_CHN_MESG
,
pnt
,
clen
);
DEBUG_Output
A
(
DBG_CHN_MESG
,
pnt
,
clen
);
break
;
default:
assert
(
0
);
}
...
...
debugger/winedbg.c
View file @
7bec5c16
...
...
@@ -48,7 +48,7 @@ static DBG_PROCESS* DEBUG_ProcessList = NULL;
static
int
automatic_mode
;
DBG_INTVAR
DEBUG_IntVars
[
DBG_IV_LAST
];
void
DEBUG_Output
(
int
chn
,
const
char
*
buffer
,
int
len
)
void
DEBUG_Output
A
(
int
chn
,
const
char
*
buffer
,
int
len
)
{
if
(
DBG_IVAR
(
ConChannelMask
)
&
chn
)
WriteFile
(
GetStdHandle
(
STD_OUTPUT_HANDLE
),
buffer
,
len
,
NULL
,
NULL
);
...
...
@@ -56,6 +56,16 @@ void DEBUG_Output(int chn, const char* buffer, int len)
fwrite
(
buffer
,
len
,
1
,
stderr
);
}
void
DEBUG_OutputW
(
int
chn
,
const
WCHAR
*
buffer
,
int
len
)
{
/* FIXME: this won't work is std output isn't attached to a console */
if
(
DBG_IVAR
(
ConChannelMask
)
&
chn
)
WriteConsoleW
(
GetStdHandle
(
STD_OUTPUT_HANDLE
),
buffer
,
len
,
NULL
,
NULL
);
/* simplistic Unicode to ANSI conversion */
if
(
DBG_IVAR
(
StdChannelMask
)
&
chn
)
while
(
len
--
)
fputc
((
char
)
*
buffer
++
,
stderr
);
}
int
DEBUG_Printf
(
int
chn
,
const
char
*
format
,
...)
{
static
char
buf
[
4
*
1024
];
...
...
@@ -71,7 +81,7 @@ static char buf[4*1024];
buf
[
len
]
=
0
;
buf
[
len
-
1
]
=
buf
[
len
-
2
]
=
buf
[
len
-
3
]
=
'.'
;
}
DEBUG_Output
(
chn
,
buf
,
len
);
DEBUG_Output
A
(
chn
,
buf
,
len
);
return
len
;
}
...
...
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