mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-03-21 18:01:15 +00:00
Add a breakpoint flag to opcodes
The progs execution code will call a breakpoint handler just before executing an instruction with the flag set. This means there's no need for the breakpoint handler to mess with execution state or even the instruction in order to continue past the breakpoint. The flag being set in a progs file is invalid.
This commit is contained in:
parent
d60291a73e
commit
aa02069dd1
3 changed files with 12 additions and 1 deletions
|
@ -396,6 +396,7 @@ typedef enum {
|
|||
OP_MOD_F,
|
||||
OP_MOD_D,
|
||||
} pr_opcode_e;
|
||||
#define OP_BREAK 0x8000
|
||||
|
||||
typedef struct opcode_s {
|
||||
const char *name;
|
||||
|
|
|
@ -1776,6 +1776,7 @@ struct progs_s {
|
|||
/// \name debugging
|
||||
///@{
|
||||
struct prdeb_resources_s *pr_debug_resources;
|
||||
void (*breakpoint_handler) (progs_t *pr);
|
||||
pr_type_t *watch;
|
||||
int wp_conditional;
|
||||
pr_type_t wp_val;
|
||||
|
|
|
@ -440,7 +440,16 @@ PR_ExecuteProgram (progs_t *pr, func_t fnum)
|
|||
if (pr->pr_trace)
|
||||
PR_PrintStatement (pr, st, 1);
|
||||
|
||||
switch (st->op) {
|
||||
if (st->op & OP_BREAK) {
|
||||
if (pr->breakpoint_handler) {
|
||||
pr->breakpoint_handler (pr);
|
||||
} else {
|
||||
PR_RunError (pr, "breakpoint hit");
|
||||
}
|
||||
}
|
||||
|
||||
pr_opcode_e op = st->op & ~OP_BREAK;
|
||||
switch (op) {
|
||||
case OP_ADD_D:
|
||||
OPC_double_var = OPA_double_var + OPB_double_var;
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue