Commit 10464c8e authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

Added $regs as a variable for displaying all registers.

parent 93a6444b
......@@ -230,7 +230,7 @@ info_command:
| tINFO tSHARE tEOL { DEBUG_InfoShare(); }
| tINFO tMODULE expr_value tEOL { DEBUG_DumpModule( $3 ); DEBUG_FreeExprMem(); }
| tINFO tQUEUE expr_value tEOL { DEBUG_DumpQueue( $3 ); DEBUG_FreeExprMem(); }
| tINFO tREGS tEOL { DEBUG_InfoRegisters(); }
| tINFO tREGS tEOL { DEBUG_InfoRegisters(&DEBUG_context); }
| tINFO tSEGMENTS expr_value tEOL { DEBUG_InfoSegments( $3, 1 ); DEBUG_FreeExprMem(); }
| tINFO tSEGMENTS tEOL { DEBUG_InfoSegments( 0, -1 ); }
| tINFO tSTACK tEOL { DEBUG_InfoStack(); }
......
......@@ -56,6 +56,8 @@ enum debug_type_basic {DT_BASIC_INT = 1, DT_BASIC_CHAR, DT_BASIC_LONGINT, DT_
DT_BASIC_STRING,
/* this is for historical reasons... should take care of it RSN */
DT_BASIC_CONST_INT,
/* not so basic, but handy */
DT_BASIC_CONTEXT,
/* to be kept as last... sentinel entry... do not use */
DT_BASIC_LAST};
......@@ -456,7 +458,7 @@ extern enum DbgInfoLoad DEBUG_RegisterStabsDebugInfo(DBG_MODULE* module,
extern void DEBUG_InitCVDataTypes(void);
/* debugger/registers.c */
extern void DEBUG_InfoRegisters(void);
extern void DEBUG_InfoRegisters(const CONTEXT* ctx);
extern BOOL DEBUG_ValidateRegisters(void);
/* debugger/source.c */
......
......@@ -86,56 +86,63 @@ void DEBUG_PrintBasic( const DBG_VALUE* value, int count, char format )
case 'b':
DEBUG_Printf(DBG_CHN_MESG, "Format specifier '%c' is meaningless in 'print' command\n", format);
case 0:
if (default_format != NULL)
{
if (strstr(default_format, "%S") != NULL)
{
char* ptr;
int state = 0;
if (default_format == NULL) break;
if (strstr(default_format, "%S") != NULL)
{
char* ptr;
int state = 0;
/* FIXME: simplistic implementation for default_format being
* foo%Sbar => will print foo, then string then bar
*/
for (ptr = default_format; *ptr; ptr++)
/* FIXME: simplistic implementation for default_format being
* foo%Sbar => will print foo, then string then bar
*/
for (ptr = default_format; *ptr; ptr++)
{
if (*ptr == '%')
{
state++;
}
else if (state == 1)
{
if (*ptr == '%')
if (*ptr == 'S')
{
state++;
DBG_ADDR addr;
addr.seg = 0;
addr.off = (long)res;
DEBUG_nchar += DEBUG_PrintStringA(DBG_CHN_MESG, &addr, -1);
}
else if (state == 1)
{
if (*ptr == 'S')
{
DBG_ADDR addr;
addr.seg = 0;
addr.off = (long)res;
DEBUG_nchar += DEBUG_PrintStringA(DBG_CHN_MESG, &addr, -1);
}
else
{
/* shouldn't happen */
DEBUG_Printf(DBG_CHN_MESG, "%%%c", *ptr);
DEBUG_nchar += 2;
}
state = 0;
}
else
{
DEBUG_OutputA(DBG_CHN_MESG, ptr, 1);
DEBUG_nchar++;
}
{
/* shouldn't happen */
DEBUG_Printf(DBG_CHN_MESG, "%%%c", *ptr);
DEBUG_nchar += 2;
}
state = 0;
}
else
{
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");
}
}
else if (strcmp(default_format, "%B") == 0)
{
DEBUG_nchar += DEBUG_Printf(DBG_CHN_MESG, "%s", res ? "true" : "false");
}
else if (strcmp(default_format, "%R") == 0)
{
if (value->cookie == DV_HOST)
DEBUG_InfoRegisters((CONTEXT*)value->addr.off);
else
{
DEBUG_nchar += DEBUG_Printf(DBG_CHN_MESG, default_format, res);
}
}
DEBUG_Printf(DBG_CHN_MESG, "NIY: info on register struct in debuggee address space\n");
DEBUG_nchar = 0;
}
else
{
DEBUG_nchar += DEBUG_Printf(DBG_CHN_MESG, default_format, res);
}
break;
}
}
......@@ -661,7 +668,7 @@ void DEBUG_DbgChannel(BOOL turn_on, const char* chnl, const char* name)
else if (!strcmp(chnl, "warn")) mask = 4;
else if (!strcmp(chnl, "trace")) mask = 8;
else { DEBUG_Printf(DBG_CHN_MESG, "Unknown channel %s\n", chnl); return; }
bAll = !strcmp("all", name);
while (addr && DEBUG_READ_MEM(addr, &dol, sizeof(dol)))
{
......@@ -670,7 +677,7 @@ void DEBUG_DbgChannel(BOOL turn_on, const char* chnl, const char* name)
if (DEBUG_READ_MEM((void*)(dol.channels + i), &str, sizeof(str)) &&
DEBUG_READ_MEM(str, buffer, sizeof(buffer)) &&
(!strcmp(buffer + 1, name) || bAll))
{
{
if (turn_on) buffer[0] |= mask; else buffer[0] &= ~mask;
if (DEBUG_WRITE_MEM(str, buffer, 1)) done++;
}
......@@ -680,4 +687,3 @@ void DEBUG_DbgChannel(BOOL turn_on, const char* chnl, const char* name)
if (!done) DEBUG_Printf(DBG_CHN_MESG, "Unable to find debug channel %s\n", name);
else DEBUG_Printf(DBG_CHN_TRACE, "Changed %d channel instances\n", done);
}
......@@ -70,4 +70,6 @@ INTERNAL_VAR(cs, 0, &DEBUG_context.SegCs, DT_BASIC_CONST_INT)
INTERNAL_VAR(ss, 0, &DEBUG_context.SegSs, DT_BASIC_CONST_INT)
INTERNAL_VAR(fs, 0, &DEBUG_context.SegFs, DT_BASIC_CONST_INT)
INTERNAL_VAR(gs, 0, &DEBUG_context.SegGs, DT_BASIC_CONST_INT)
INTERNAL_VAR(regs, 0, (DWORD*)&DEBUG_context, DT_BASIC_CONTEXT)
#endif
......@@ -27,7 +27,7 @@
*
* Return Flag String.
*/
char *DEBUG_Flags( DWORD flag, char *buf )
static char *DEBUG_Flags( DWORD flag, char *buf )
{
#ifdef __i386__
char *pt;
......@@ -86,42 +86,42 @@ char *DEBUG_Flags( DWORD flag, char *buf )
*
* Display registers information.
*/
void DEBUG_InfoRegisters(void)
void DEBUG_InfoRegisters(const CONTEXT* ctx)
{
DEBUG_Printf(DBG_CHN_MESG,"Register dump:\n");
#ifdef __i386__
/* First get the segment registers out of the way */
DEBUG_Printf( DBG_CHN_MESG," CS:%04x SS:%04x DS:%04x ES:%04x FS:%04x GS:%04x",
(WORD)DEBUG_context.SegCs, (WORD)DEBUG_context.SegSs,
(WORD)DEBUG_context.SegDs, (WORD)DEBUG_context.SegEs,
(WORD)DEBUG_context.SegFs, (WORD)DEBUG_context.SegGs );
(WORD)ctx->SegCs, (WORD)ctx->SegSs,
(WORD)ctx->SegDs, (WORD)ctx->SegEs,
(WORD)ctx->SegFs, (WORD)ctx->SegGs );
if (DEBUG_CurrThread->dbg_mode != MODE_32)
{
char flag[33];
DEBUG_Printf( DBG_CHN_MESG,"\n IP:%04x SP:%04x BP:%04x FLAGS:%04x(%s)\n",
LOWORD(DEBUG_context.Eip), LOWORD(DEBUG_context.Esp),
LOWORD(DEBUG_context.Ebp), LOWORD(DEBUG_context.EFlags),
DEBUG_Flags(LOWORD(DEBUG_context.EFlags), flag));
LOWORD(ctx->Eip), LOWORD(ctx->Esp),
LOWORD(ctx->Ebp), LOWORD(ctx->EFlags),
DEBUG_Flags(LOWORD(ctx->EFlags), flag));
DEBUG_Printf( DBG_CHN_MESG," AX:%04x BX:%04x CX:%04x DX:%04x SI:%04x DI:%04x\n",
LOWORD(DEBUG_context.Eax), LOWORD(DEBUG_context.Ebx),
LOWORD(DEBUG_context.Ecx), LOWORD(DEBUG_context.Edx),
LOWORD(DEBUG_context.Esi), LOWORD(DEBUG_context.Edi) );
LOWORD(ctx->Eax), LOWORD(ctx->Ebx),
LOWORD(ctx->Ecx), LOWORD(ctx->Edx),
LOWORD(ctx->Esi), LOWORD(ctx->Edi) );
}
else /* 32-bit mode */
{
char flag[33];
DEBUG_Printf( DBG_CHN_MESG, "\n EIP:%08lx ESP:%08lx EBP:%08lx EFLAGS:%08lx(%s)\n",
DEBUG_context.Eip, DEBUG_context.Esp,
DEBUG_context.Ebp, DEBUG_context.EFlags,
DEBUG_Flags(DEBUG_context.EFlags, flag));
ctx->Eip, ctx->Esp,
ctx->Ebp, ctx->EFlags,
DEBUG_Flags(ctx->EFlags, flag));
DEBUG_Printf( DBG_CHN_MESG, " EAX:%08lx EBX:%08lx ECX:%08lx EDX:%08lx\n",
DEBUG_context.Eax, DEBUG_context.Ebx,
DEBUG_context.Ecx, DEBUG_context.Edx );
ctx->Eax, ctx->Ebx,
ctx->Ecx, ctx->Edx );
DEBUG_Printf( DBG_CHN_MESG, " ESI:%08lx EDI:%08lx\n",
DEBUG_context.Esi, DEBUG_context.Edi );
ctx->Esi, ctx->Edi );
}
#endif
}
......
......@@ -340,6 +340,7 @@ DEBUG_InitTypes(void)
*/
DEBUG_InitCVDataTypes();
DEBUG_InitBasic(DT_BASIC_CONTEXT,NULL,4,0,"%R");
}
long long int
......@@ -1103,4 +1104,3 @@ int DEBUG_PrintType( const DBG_VALUE *value )
DEBUG_Printf(DBG_CHN_MESG, "\n");
return TRUE;
}
......@@ -389,7 +389,7 @@ static BOOL DEBUG_ExceptionProlog(BOOL is_debug, BOOL force, DWORD code)
DEBUG_BackTrace(DEBUG_CurrTid, FALSE);
} else {
/* This is a real crash, dump some info */
DEBUG_InfoRegisters();
DEBUG_InfoRegisters(&DEBUG_context);
DEBUG_InfoStack();
#ifdef __i386__
if (DEBUG_CurrThread->dbg_mode == MODE_16) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment