[qwaq] Handle key events differently when running

Pressing F8 (or n) while the debug target was running would cause it to
stop at that point. While it's certainly desirable to stop a runaway
target on demand, that should be with a different input. Now, commands
that start the target running are ignored while the target is running.
No commands for when the target is running have been implemented yet,
but the provision is there.
This commit is contained in:
Bill Currie 2020-07-03 21:41:51 +09:00
parent 98795bf604
commit 1910941426
2 changed files with 19 additions and 3 deletions

View file

@ -28,6 +28,7 @@
int onExit;
} sub_cond;
SEL traceHandler;
int running;
Window *source_window;
ScrollBar *source_scrollbar;

View file

@ -127,7 +127,7 @@
}
static int
proxy_event (Debugger *self, id proxy, qwaq_event_t *event)
proxy_event_stopped (Debugger *self, id proxy, qwaq_event_t *event)
{
if (event.what == qe_mouseclick && !(event.mouse.buttons & 0x78)) {
if (proxy == self.current_file) {
@ -142,6 +142,7 @@ proxy_event (Debugger *self, id proxy, qwaq_event_t *event)
self.traceHandler = @selector(traceStep);
qdb_set_trace (self.target, 1);
self.trace_cond.state = qdb_get_state (self.target);
self.running = 1;
qdb_continue (self.target);
return 1;
case QFK_F8:
@ -150,6 +151,7 @@ proxy_event (Debugger *self, id proxy, qwaq_event_t *event)
qdb_set_trace (self.target, 1);
self.trace_cond.state = qdb_get_state (self.target);
self.trace_cond.depth = qdb_get_stack_depth (self.target);
self.running = 1;
qdb_continue (self.target);
return 1;
}
@ -157,15 +159,28 @@ proxy_event (Debugger *self, id proxy, qwaq_event_t *event)
return 0;
}
static int
proxy_event_running (Debugger *self, id proxy, qwaq_event_t *event)
{
return 0;
}
-(void)proxy_event:(id)proxy :(qwaq_event_t *)event
{
if (proxy_event (self, proxy, event)) {
event.what = qe_none;
if (running) {
if (proxy_event_running (self, proxy, event)) {
event.what = qe_none;
}
} else {
if (proxy_event_stopped (self, proxy, event)) {
event.what = qe_none;
}
}
}
-stop:(prdebug_t)reason
{
running = 0;
if (!file_proxy) {
[self setup];
}