Hi Alex, I managed to include all of your feedback except for the one on this patch:
You shouldn't need empty functions if you are not using them. Moreover you should use the inheritance feature and have something like: static void gdb_debug_class_init(ObjectClass *klass, void *data) { DebugClass *dc = DEBUG_CLASS(klass); dc->set_stop_cpu = gdb_set_stop_cpu; }; static const TypeInfo debug_info[] = { { .name = TYPE_DEBUG, .parent = TYPE_OBJECT, .instance_size = sizeof(DebugState), .class_size = sizeof(DebugClass), .abstract = true, }, { .name = TYPE_GDB_DEBUG, .parent = TYPE_DEBUG, .class_init = gdb_debug_class_init, }, }; DEFINE_TYPES(debug_info)
My approach was to delete debug/common/debug.c and put the above code into debug/gdbstub/system.c and an analog version for MCD in debug/mcdstub/mcdstub.c. However, I don't know when to store the DebugClass to the MachineState (MachineState *ms = MACHINE(qdev_get_machine()); ms->debug_class = dc;). It doesn't seem to work when inside of gdb_debug_class_init().
I still lack an understanding of when/how exactly gdb_debug_class_init() is called.
Was my approach wrong and when should I store the DebugClass? Best regards, Nicolas