[INTERPRETER]
* BUG: Add a small reserved area in the stack for the Eval() function, so that the debugger can return the contents of a variable after a stack overflow without raising a new stack overflow error and then crashing. git-svn-id: svn://localhost/gambas/trunk@6276 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
parent
123baa9b6f
commit
224bb2aed0
main/gbx
@ -104,6 +104,8 @@ bool EVAL_expression(EXPRESSION *expr, EVAL_FUNCTION func)
|
||||
fprintf(stderr, "EVAL: %s\n", EVAL->source);
|
||||
#endif
|
||||
|
||||
STACK_enable_for_eval();
|
||||
|
||||
nvar = EVAL->nvar;
|
||||
|
||||
STACK_check(nvar);
|
||||
@ -139,6 +141,7 @@ bool EVAL_expression(EXPRESSION *expr, EVAL_FUNCTION func)
|
||||
}
|
||||
END_TRY
|
||||
|
||||
STACK_disable_for_eval();
|
||||
EXEC_debug = debug;
|
||||
return error;
|
||||
}
|
||||
|
@ -68,9 +68,10 @@ void STACK_init(void)
|
||||
|
||||
STACK_process_stack_limit = (uintptr_t)&stack - max + 65536;
|
||||
|
||||
STACK_limit = (STACK_base + STACK_size);
|
||||
STACK_limit = STACK_base + STACK_size;
|
||||
STACK_frame = (STACK_CONTEXT *)STACK_limit;
|
||||
STACK_frame_count = 0;
|
||||
STACK_limit -= STACK_FOR_EVAL * sizeof(VALUE);
|
||||
|
||||
SP = (VALUE *)STACK_base;
|
||||
}
|
||||
|
@ -69,6 +69,8 @@ EXTERN uintptr_t STACK_process_stack_limit;
|
||||
|
||||
#endif
|
||||
|
||||
#define STACK_FOR_EVAL 16
|
||||
|
||||
void STACK_init(void);
|
||||
void STACK_exit(void);
|
||||
|
||||
@ -119,7 +121,7 @@ STACK_CONTEXT *STACK_get_frame(int frame);
|
||||
STACK_copy(STACK_frame, _context); \
|
||||
\
|
||||
STACK_frame_count++; \
|
||||
STACK_limit = (char *)STACK_frame; \
|
||||
STACK_limit -= sizeof(STACK_CONTEXT); \
|
||||
})
|
||||
|
||||
#define STACK_pop_frame(_context) \
|
||||
@ -127,7 +129,10 @@ STACK_CONTEXT *STACK_get_frame(int frame);
|
||||
STACK_copy(_context, STACK_frame); \
|
||||
STACK_frame++; \
|
||||
STACK_frame_count--; \
|
||||
STACK_limit = (char *)STACK_frame; \
|
||||
STACK_limit += sizeof(STACK_CONTEXT); \
|
||||
})
|
||||
|
||||
#define STACK_enable_for_eval() STACK_limit += STACK_FOR_EVAL * sizeof(VALUE)
|
||||
#define STACK_disable_for_eval() STACK_limit -= STACK_FOR_EVAL * sizeof(VALUE)
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user