aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--backend.c6
-rw-r--r--makefile1
-rw-r--r--midimonster.c3
3 files changed, 10 insertions, 0 deletions
diff --git a/backend.c b/backend.c
index eeb789d..38abc7f 100644
--- a/backend.c
+++ b/backend.c
@@ -26,6 +26,7 @@ int backends_handle(size_t nfds, managed_fd* fds){
}
}
+ DBGPF("Notifying backend %s of %zu waiting FDs\n", backends[u].name, n);
rv |= backends[u].process(n, fds);
}
return rv;
@@ -55,6 +56,7 @@ int backends_notify(size_t nev, channel** c, channel_value* v){
}
}
+ DBGPF("Calling handler for instance %s with %zu events\n", instances[u]->name, n);
rv |= instances[u]->backend->handle(instances[u], n, c, v);
}
@@ -65,14 +67,17 @@ channel* mm_channel(instance* i, uint64_t ident, uint8_t create){
size_t u;
for(u = 0; u < nchannels; u++){
if(channels[u]->instance == i && channels[u]->ident == ident){
+ DBGPF("Requested channel %zu on instance %s already exists, reusing\n", ident, i->name);
return channels[u];
}
}
if(!create){
+ DBGPF("Requested unknown channel %zu on instance %s\n", ident, i->name);
return NULL;
}
+ DBGPF("Creating previously unknown channel %zu on instance %s\n", ident, i->name);
channel** new_chan = realloc(channels, (nchannels + 1) * sizeof(channel*));
if(!new_chan){
fprintf(stderr, "Failed to allocate memory\n");
@@ -169,6 +174,7 @@ void instances_free(){
void channels_free(){
size_t u;
for(u = 0; u < nchannels; u++){
+ DBGPF("Destroying channel %zu on instance %s\n", channels[u]->ident, channels[u]->instance->name);
if(channels[u]->impl){
channels[u]->instance->backend->channel_free(channels[u]);
}
diff --git a/makefile b/makefile
index 2101e96..f87005e 100644
--- a/makefile
+++ b/makefile
@@ -4,6 +4,7 @@ OBJS = config.o backend.o plugin.o
PLUGINDIR = "\"./\""
CFLAGS ?= -g -Wall
+#CFLAGS += -DDEBUG
%.so: CFLAGS += -fPIC
%.so: LDFLAGS += -shared
diff --git a/midimonster.c b/midimonster.c
index 8f30686..c8a0109 100644
--- a/midimonster.c
+++ b/midimonster.c
@@ -248,6 +248,7 @@ int main(int argc, char** argv){
}
//create initial fd set
+ DBGPF("Building selector set from %zu FDs registered to core\n", fds);
FD_ZERO(&all_fds);
for(u = 0; u < fds; u++){
if(fd[u].fd >= 0){
@@ -277,6 +278,7 @@ int main(int argc, char** argv){
}
//run backend processing, collect events
+ DBGPF("%zu backend FDs signaled\n", n);
if(backends_handle(n, signaled_fds)){
fprintf(stderr, "Backends failed to handle input\n");
goto bail;
@@ -284,6 +286,7 @@ int main(int argc, char** argv){
while(primary->n){
//swap primary and secondary event collectors
+ DBGPF("Swapping event collectors, %zu events in primary\n", primary->n);
for(u = 0; u < sizeof(event_pool)/sizeof(event_collection); u++){
if(primary != event_pool + u){
secondary = primary;