From 4f440c510475663bc3d90477050ffed40f133052 Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Date: Wed, 8 Mar 2023 16:19:59 +0100 Subject: [PATCH] Add some debug messages --- src/emu/bay.c | 2 +- src/emu/cpu.c | 5 +++++ src/emu/thread.c | 5 +++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/emu/bay.c b/src/emu/bay.c index 1f5a400..3a26856 100644 --- a/src/emu/bay.c +++ b/src/emu/bay.c @@ -172,7 +172,7 @@ propagate_chan(struct bay_chan *bchan, enum bay_cb_type type) DL_FOREACH(bchan->cb[type], cur) { dbg("calling cb %p", cur->func); if (cur->func(bchan->chan, cur->arg) != 0) { - err("callback failed"); + err("callback failed for %s", bchan->chan->name); return -1; } } diff --git a/src/emu/cpu.c b/src/emu/cpu.c index e2cab19..71c8989 100644 --- a/src/emu/cpu.c +++ b/src/emu/cpu.c @@ -1,6 +1,8 @@ /* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC) * SPDX-License-Identifier: GPL-3.0-or-later */ +//#define ENABLE_DEBUG + #include "cpu.h" #include #include @@ -248,6 +250,9 @@ cpu_update(struct cpu *cpu) err("chan_set pid failed"); return -1; } + char buf[128]; + dbg("cpu%ld sets th_running to %s", + cpu->gindex, value_str(gid_running, buf)); if (chan_set(&cpu->chan[CPU_CHAN_THRUN], gid_running) != 0) { err("chan_set gid_running failed"); return -1; diff --git a/src/emu/thread.c b/src/emu/thread.c index 1fdeff3..1ca5a66 100644 --- a/src/emu/thread.c +++ b/src/emu/thread.c @@ -1,6 +1,8 @@ /* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC) * SPDX-License-Identifier: GPL-3.0-or-later */ +//#define ENABLE_DEBUG + #include "thread.h" #include #include @@ -387,6 +389,7 @@ thread_set_cpu(struct thread *th, struct cpu *cpu) return -1; } + dbg("thread%ld sets cpu%ld", th->gindex, cpu->gindex); th->cpu = cpu; /* Update cpu channel */ @@ -407,6 +410,7 @@ thread_unset_cpu(struct thread *th) return -1; } + dbg("thread%ld unsets cpu", th->gindex); th->cpu = NULL; struct chan *c = &th->chan[TH_CHAN_CPU]; @@ -426,6 +430,7 @@ thread_migrate_cpu(struct thread *th, struct cpu *cpu) return -1; } + dbg("thread%ld migrates to cpu%d", th->gindex, cpu->gindex); th->cpu = cpu; struct chan *c = &th->chan[TH_CHAN_CPU];