Hi - In commit:
> From 9446130d629d04ffa9505dd613ad54cb291806fd Mon Sep 17 00:00:00 2001 > From: Christopher Koch <[email protected]> > Date: Mon, 22 Aug 2016 19:55:52 -0700 > Subject: parlib/debug: adding initialization message. > diff --git a/user/parlib/debug.c b/user/parlib/debug.c > @@ -341,7 +350,9 @@ int d9s_notify_hit_breakpoint(uint64_t tid, uint64_t > address) > struct d9_thitbreakpoint thb = > D9_INIT_HDR(sizeof(struct d9_thitbreakpoint), D9_THITBREAKPOINT); > > - if (debug_fd == -1) > + atomic_swap(&last_breakpoint_tid, tid); What does GDB expect if multiple threads hit a breakpoint at the same time? > +static int d9s_tinit(struct d9_header *hdr) > +{ > + uint64_t tid; > + struct uthread *t; > + struct d9_rinit resp = D9_INIT_HDR(sizeof(struct d9_rinit), D9_RINIT); > + > + if (!atomic_cas(&debugged, 0, 1)) > + return debug_send_error(EBADF /* TODO */); I'm a little skeptical of this sync. When does it get turned off? > + uthread_apply_all(notify_thread); > + > + if ((tid = atomic_read(&last_breakpoint_tid)) > 0) { >From checkpatch: ERROR: do not use assignment in if condition #102: FILE: user/parlib/debug.c:395: + if ((tid = atomic_read(&last_breakpoint_tid)) > 0) { Also, is this why you have the thread IDs start at 1? If so, just use negative 1 for the initial value. (See below). > + t = uthread_get_thread_by_id(tid); > + d9s_notify_hit_breakpoint(tid, get_user_ctx_pc(&t->u_ctx)); > + uthread_put_thread(t); What's going on here, overall? We were sent an initialization message, but then we look at the last thread to have hit a breakpoint? Didn't that thread just keep going when it saw debugged == 0? > diff --git a/user/parlib/uthread.c b/user/parlib/uthread.c > index 653283365471..bd164d51ebc8 100644 > --- a/user/parlib/uthread.c > +++ b/user/parlib/uthread.c > @@ -296,7 +296,7 @@ void __attribute__((noreturn)) uthread_vcore_entry(void) > * Warning: this will reuse numbers eventually. */ > static uint64_t __get_next_tid(void) > { > - static uint64_t next_tid; > + static uint64_t next_tid = 1; > > return next_tid++; > } Does GDB have a requirement on the thread numbering? If possible, I'd like to call thread0 "0". That doesn't affect this hunk that much, since thread0 probably shouldn't have its ID set with this function (as mentioned in an earlier comment). Thanks, Barret -- You received this message because you are subscribed to the Google Groups "Akaros" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. For more options, visit https://groups.google.com/d/optout.
