On Tue, 17 Oct 2023 19:07:45 GMT, Chris Plummer <cjplum...@openjdk.org> wrote:
> I'm also wondering if we shouldn't just export cbException() and call it > directly rather than mimic a lot of what it is doing, although probably what > would be easier is a new API that handles the event described in the > EventInfo passed to it. Maybe cbEI(). This would resolve the handlerID issue > I point out (the event would not be sent if there is no request for it, and > if there is a request it will be sent with the correct handlerID, not 0). Maybe in a follow-up in a PR? This is not directly related to the exception value and could potentially change the behavior of the `onthrow` feature, therefore needing more tests. > src/jdk.jdwp.agent/share/native/libjdwp/debugInit.c line 730: > >> 728: if (opt_info != NULL) { >> 729: info = *opt_info; >> 730: } > > Try the following code here. I don't think I changed anything outside this > area, but since I also have your diffs present I can't reacall for sure. I > also cleaned this section up a bit. It looks like it only has to deal with > EI_EXCEPTION and opt_info is always set. > > > /* > * TO DO: Kludgy way of getting the triggering event to the > * just-attached debugger. It would be nice to make this a little > * cleaner. There is also a race condition where other events > * can get in the queue (from other not-yet-suspended threads) > * before this one does. (Also need to handle allocation error below?) > */ > struct bag *initEventBag; > LOG_MISC(("triggering_ei == EI_EXCEPTION")); > JDI_ASSERT(triggering_ei == EI_EXCEPTION); > JDI_ASSERT(opt_info != NULL); > initEventBag = eventHelper_createEventBag(); > threadControl_onEventHandlerEntry(currentSessionID, opt_info, NULL); > eventHelper_recordEvent(opt_info, 0, suspendPolicy, initEventBag); > (void)eventHelper_reportEvents(currentSessionID, initEventBag); > bagDestroyBag(initEventBag); Looks good, I'm running it locally. ------------- PR Comment: https://git.openjdk.org/jdk/pull/16145#issuecomment-1767039725 PR Review Comment: https://git.openjdk.org/jdk/pull/16145#discussion_r1362654959