[INTERPRETER]

* BUG: Forbid continuing and stay in debugger when an unhandled error is raised. This prevent crashes when an error occurs during variable initialization.


git-svn-id: svn://localhost/gambas/trunk@8031 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
Benoît Minisini 2016-12-31 12:02:58 +00:00
parent 4e887b93b3
commit c4d22f9d24
4 changed files with 16 additions and 13 deletions

View File

@ -1014,24 +1014,33 @@ void EXEC_function_loop()
if (EXEC_debug && !STACK_has_error_handler()) if (EXEC_debug && !STACK_has_error_handler())
{ {
ERROR_hook(); ERROR_hook();
DEBUG.Main(TRUE); for(;;)
DEBUG.Main(TRUE);
if (TP && TC) /*if (TP && TC)
{ {
ERROR_lock(); ERROR_lock();
while (BP > TP) while (BP > TP)
{ {
EXEC_leave_drop(); EXEC_leave_drop();
if (!PC) if (!PC)
STACK_pop_frame(&EXEC_current); break;
} }
while (SP > TP) while (SP > TP)
POP();
if (!PC)
{
ERROR_unlock();
STACK_pop_frame(&EXEC_current);
PROPAGATE();
}
POP();
PC = TC; PC = TC;
ERROR_unlock(); ERROR_unlock();
} }
retry = TRUE; retry = TRUE;*/
} }
else else
{ {

View File

@ -139,10 +139,6 @@ extern EXEC_GLOBAL EXEC;
#define EC EXEC_current.ec #define EC EXEC_current.ec
// Save register for TRY // Save register for TRY
#define ET EXEC_current.et #define ET EXEC_current.et
// Last break in the function
#define TC EXEC_current.tc
// Stack at the last break in the function
#define TP EXEC_current.tp
// GoSub stack // GoSub stack
#define GP EXEC_current.gp #define GP EXEC_current.gp

View File

@ -3748,8 +3748,8 @@ static void _break(ushort code)
{ {
if (EXEC_debug) if (EXEC_debug)
{ {
TC = PC + 1; /*TC = PC + 1;
TP = SP; TP = SP;*/
//fprintf(stderr, "%s\n", DEBUG_get_current_position()); //fprintf(stderr, "%s\n", DEBUG_get_current_position());

View File

@ -49,8 +49,6 @@ typedef
PCODE *pc; // instruction PCODE *pc; // instruction
PCODE *ec; // instruction if error PCODE *ec; // instruction if error
PCODE *et; // TRY save PCODE *et; // TRY save
PCODE *tc; // Last break in the function
VALUE *tp; // Stack at the last break in the function
VALUE *gp; // GOSUB stack pointer VALUE *gp; // GOSUB stack pointer
} }
STACK_CONTEXT; STACK_CONTEXT;