diff --git a/src/emu/nanos6/event.c b/src/emu/nanos6/event.c index aeb8e55..4d55891 100644 --- a/src/emu/nanos6/event.c +++ b/src/emu/nanos6/event.c @@ -565,6 +565,9 @@ model_nanos6_event(struct emu *emu) static int enabled = 0; if (!enabled) { + struct nanos6_emu *memu = EXT(emu, '6'); + memu->event = 1; + if (model_nanos6_connect(emu) != 0) { err("nanos6_connect failed"); return -1; diff --git a/src/emu/nanos6/nanos6_priv.h b/src/emu/nanos6/nanos6_priv.h index f1be9c5..33bcea2 100644 --- a/src/emu/nanos6/nanos6_priv.h +++ b/src/emu/nanos6/nanos6_priv.h @@ -87,6 +87,8 @@ struct nanos6_proc { }; struct nanos6_emu { + int connected; + int event; struct breakdown_emu brk; }; diff --git a/src/emu/nanos6/setup.c b/src/emu/nanos6/setup.c index ccbf466..b602c0e 100644 --- a/src/emu/nanos6/setup.c +++ b/src/emu/nanos6/setup.c @@ -35,7 +35,7 @@ struct model_spec model_nanos6 = { .name = model_name, .model = model_id, .create = model_nanos6_create, -// .connect = model_nanos6_connect, + .connect = model_nanos6_connect, .event = model_nanos6_event, .probe = model_nanos6_probe, .finish = model_nanos6_finish, @@ -282,6 +282,16 @@ model_nanos6_create(struct emu *emu) int model_nanos6_connect(struct emu *emu) { + struct nanos6_emu *memu = EXT(emu, model_id); + + if (memu->connected) + return 0; + + /* Only skip connection if event not reached and + * breakdown not enabled */ + if (!memu->event && !emu->args.breakdown) + return 0; + if (model_thread_connect(emu, &th_spec) != 0) { err("model_thread_connect failed"); return -1; @@ -314,6 +324,8 @@ model_nanos6_connect(struct emu *emu) mux_set_default(mux, value_int64(ST_WORKER_IDLE)); } + memu->connected = 1; + return 0; }