At least on Sam440, I want to program debug registers and receive interrupts. The first point is done but I need help for the second one, if it is possible.
1/ My first approach is to call AddIntServer(). I see there is a trap TRAPNUM_INST_BREAKPOINT that is certainly what I want. In the include "exec/interrupts.h", it is said "These are used with AddIntServer/SetIntVector to install global trap handler". But this trapnum is rejected by AddIntServer.
In the include, an interrupt INTB_NMI is declared as a "fake INT definition, used only for AddIntServer and the like" but with no more information, I don't know what to do except register it with AddIntServer but I can't get interrupts and specify the wanted type of interrupts.
In addition to that, INT_NMI has the same value than INT_SETCLR in "hardware/intbits.h", I don't know if that hurts.
Should I use TRAPNUM_INST_BREAKPOINT with SetIntVector only, and not AddIntServer ?
2/ The second approach would be to use AddDebugHook, thinking I will be notified with the DBHMT_EXCEPTION case. It seems to be more high-level but do I still have to program the debug registers myself ?
It is maybe the best option.
3/ On PowerPC G3 and G4, all that should rely on the performance monitor. There is an API for that but I've never obtained the minimal result. There is a function called SetInterruptVector that seems to work by itself but again, I can't get the performance monitor working.
4/ Still in the performance monitor resource, there is a function called SetBreakpoint, on instruction or data. That sounds like the TRAPNUM_[INST|DATA]_BREAKPOINT and it is said that a handler can be set via SetTaskTrap ... But about TrapNums in "exec/interrupts.h", it was written that SetTaskTrap was "to install local task traps".
There are many questions but several points must be clarified, some parts in autodocs and includes are really confusing.