Bugfix: Perform proper process shutdown on 'quit' and error.
This commit is contained in:
parent
c6ad2b6fc3
commit
3723c2c8e9
@ -123,7 +123,7 @@ line: command
|
|||||||
| error tEOL { yyerrok; }
|
| error tEOL { yyerrok; }
|
||||||
|
|
||||||
command:
|
command:
|
||||||
tQUIT tEOL { exit(0); }
|
tQUIT tEOL { DEBUG_Exit(0); }
|
||||||
| tHELP tEOL { DEBUG_Help(); }
|
| tHELP tEOL { DEBUG_Help(); }
|
||||||
| tHELP tINFO tEOL { DEBUG_HelpInfo(); }
|
| tHELP tINFO tEOL { DEBUG_HelpInfo(); }
|
||||||
| tCONT tEOL { dbg_exec_count = 1;
|
| tCONT tEOL { dbg_exec_count = 1;
|
||||||
@ -431,6 +431,41 @@ void mode_command(int newmode)
|
|||||||
else fprintf(stderr,"Invalid mode (use 16 or 32)\n");
|
else fprintf(stderr,"Invalid mode (use 16 or 32)\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* DEBUG_Freeze
|
||||||
|
*/
|
||||||
|
static void DEBUG_Freeze( BOOL freeze )
|
||||||
|
{
|
||||||
|
static BOOL frozen = FALSE;
|
||||||
|
|
||||||
|
if ( freeze && !frozen )
|
||||||
|
{
|
||||||
|
/* Don't freeze thread currently holding the X crst! */
|
||||||
|
EnterCriticalSection( &X11DRV_CritSection );
|
||||||
|
CLIENT_DebuggerRequest( DEBUGGER_FREEZE_ALL );
|
||||||
|
LeaveCriticalSection( &X11DRV_CritSection );
|
||||||
|
frozen = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( !freeze && frozen )
|
||||||
|
{
|
||||||
|
CLIENT_DebuggerRequest( DEBUGGER_UNFREEZE_ALL );
|
||||||
|
frozen = FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* DEBUG_Exit
|
||||||
|
*
|
||||||
|
* Kill current process.
|
||||||
|
*/
|
||||||
|
void DEBUG_Exit( DWORD exit_code )
|
||||||
|
{
|
||||||
|
DEBUG_Freeze( FALSE );
|
||||||
|
|
||||||
|
TASK_KillTask( 0 ); /* FIXME: should not be necessary */
|
||||||
|
TerminateProcess( GetCurrentProcess(), exit_code );
|
||||||
|
}
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* DEBUG_Main
|
* DEBUG_Main
|
||||||
@ -440,7 +475,6 @@ void mode_command(int newmode)
|
|||||||
static void DEBUG_Main( BOOL is_debug )
|
static void DEBUG_Main( BOOL is_debug )
|
||||||
{
|
{
|
||||||
static int loaded_symbols = 0;
|
static int loaded_symbols = 0;
|
||||||
static BOOL frozen = FALSE;
|
|
||||||
static BOOL in_debugger = FALSE;
|
static BOOL in_debugger = FALSE;
|
||||||
char SymbolTableFile[256];
|
char SymbolTableFile[256];
|
||||||
int newmode;
|
int newmode;
|
||||||
@ -452,7 +486,7 @@ static void DEBUG_Main( BOOL is_debug )
|
|||||||
if (in_debugger)
|
if (in_debugger)
|
||||||
{
|
{
|
||||||
fprintf( stderr, " inside debugger, exiting.\n" );
|
fprintf( stderr, " inside debugger, exiting.\n" );
|
||||||
exit(1);
|
DEBUG_Exit(1);
|
||||||
}
|
}
|
||||||
in_debugger = TRUE;
|
in_debugger = TRUE;
|
||||||
yyin = stdin;
|
yyin = stdin;
|
||||||
@ -472,14 +506,7 @@ static void DEBUG_Main( BOOL is_debug )
|
|||||||
{
|
{
|
||||||
loaded_symbols++;
|
loaded_symbols++;
|
||||||
|
|
||||||
if ( !frozen )
|
DEBUG_Freeze( TRUE );
|
||||||
{
|
|
||||||
/* Don't freeze thread currently holding the X crst! */
|
|
||||||
EnterCriticalSection( &X11DRV_CritSection );
|
|
||||||
CLIENT_DebuggerRequest( DEBUGGER_FREEZE_ALL );
|
|
||||||
LeaveCriticalSection( &X11DRV_CritSection );
|
|
||||||
frozen = TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef DBG_need_heap
|
#ifdef DBG_need_heap
|
||||||
/*
|
/*
|
||||||
@ -540,14 +567,7 @@ static void DEBUG_Main( BOOL is_debug )
|
|||||||
|
|
||||||
GlobalUnlock16( GetCurrentTask() );
|
GlobalUnlock16( GetCurrentTask() );
|
||||||
|
|
||||||
if ( !frozen )
|
DEBUG_Freeze( TRUE );
|
||||||
{
|
|
||||||
/* Don't freeze thread currently holding the X crst! */
|
|
||||||
EnterCriticalSection( &X11DRV_CritSection );
|
|
||||||
CLIENT_DebuggerRequest( DEBUGGER_FREEZE_ALL );
|
|
||||||
LeaveCriticalSection( &X11DRV_CritSection );
|
|
||||||
frozen = TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Put the display in a correct state */
|
/* Put the display in a correct state */
|
||||||
USER_Driver->pBeginDebugging();
|
USER_Driver->pBeginDebugging();
|
||||||
@ -619,11 +639,7 @@ static void DEBUG_Main( BOOL is_debug )
|
|||||||
{
|
{
|
||||||
dbg_exec_count = 0;
|
dbg_exec_count = 0;
|
||||||
|
|
||||||
if ( frozen )
|
DEBUG_Freeze( FALSE );
|
||||||
{
|
|
||||||
CLIENT_DebuggerRequest( DEBUGGER_UNFREEZE_ALL );
|
|
||||||
frozen = FALSE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
in_debugger = FALSE;
|
in_debugger = FALSE;
|
||||||
@ -645,7 +661,7 @@ DWORD wine_debugger( EXCEPTION_RECORD *rec, CONTEXT *context, BOOL first_chance
|
|||||||
is_debug = TRUE;
|
is_debug = TRUE;
|
||||||
break;
|
break;
|
||||||
case CONTROL_C_EXIT:
|
case CONTROL_C_EXIT:
|
||||||
if (!Options.debug) exit(0);
|
if (!Options.debug) DEBUG_Exit(0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -239,7 +239,7 @@ static int dbg_read(char * buf, int size)
|
|||||||
if (!line)
|
if (!line)
|
||||||
{
|
{
|
||||||
fprintf( stderr, "\n" );
|
fprintf( stderr, "\n" );
|
||||||
exit(0);
|
DEBUG_Exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Remove leading and trailing whitespace from the line */
|
/* Remove leading and trailing whitespace from the line */
|
||||||
@ -264,7 +264,7 @@ static int dbg_read(char * buf, int size)
|
|||||||
if (size < len + 1)
|
if (size < len + 1)
|
||||||
{
|
{
|
||||||
fprintf(stderr,"Fatal readline goof.\n");
|
fprintf(stderr,"Fatal readline goof.\n");
|
||||||
exit(0);
|
DEBUG_Exit(0);
|
||||||
}
|
}
|
||||||
strcpy(buf, line);
|
strcpy(buf, line);
|
||||||
buf[len] = '\n';
|
buf[len] = '\n';
|
||||||
|
@ -634,7 +634,7 @@ DEBUG_EvalExpr(struct expr * exp)
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
fprintf(stderr,"Unexpected expression.\n");
|
fprintf(stderr,"Unexpected expression.\n");
|
||||||
exit(123);
|
DEBUG_Exit(123);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -794,7 +794,7 @@ DEBUG_DisplayExpr(struct expr * exp)
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
fprintf(stderr,"Unexpected expression.\n");
|
fprintf(stderr,"Unexpected expression.\n");
|
||||||
exit(123);
|
DEBUG_Exit(123);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -855,7 +855,7 @@ DEBUG_CloneExpr(struct expr * exp)
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
fprintf(stderr,"Unexpected expression.\n");
|
fprintf(stderr,"Unexpected expression.\n");
|
||||||
exit(123);
|
DEBUG_Exit(123);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -912,7 +912,7 @@ DEBUG_FreeExpr(struct expr * exp)
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
fprintf(stderr,"Unexpected expression.\n");
|
fprintf(stderr,"Unexpected expression.\n");
|
||||||
exit(123);
|
DEBUG_Exit(123);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -317,6 +317,7 @@ extern void DEBUG_Disassemble( const DBG_ADDR *, const DBG_ADDR*, int offset );
|
|||||||
|
|
||||||
/* debugger/dbg.y */
|
/* debugger/dbg.y */
|
||||||
extern DWORD wine_debugger( EXCEPTION_RECORD *rec, CONTEXT *context, BOOL first_chance );
|
extern DWORD wine_debugger( EXCEPTION_RECORD *rec, CONTEXT *context, BOOL first_chance );
|
||||||
|
extern void DEBUG_Exit( DWORD exit_code );
|
||||||
|
|
||||||
/* Choose your allocator! */
|
/* Choose your allocator! */
|
||||||
#if 1
|
#if 1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user