On 25 September 2013 01:46, Fabien Chouteau <chout...@adacore.com> wrote: > --- a/monitor.c > +++ b/monitor.c > @@ -3351,6 +3351,23 @@ static const MonitorDef monitor_defs[] = { > { "cleanwin", offsetof(CPUSPARCState, cleanwin) }, > { "fprs", offsetof(CPUSPARCState, fprs) }, > #endif > +#elif defined(TARGET_ARM) > + { "r0", offsetof(CPUARMState, regs[0]) }, > + { "r1", offsetof(CPUARMState, regs[1]) }, > + { "r2", offsetof(CPUARMState, regs[2]) }, > + { "r3", offsetof(CPUARMState, regs[3]) }, > + { "r4", offsetof(CPUARMState, regs[4]) }, > + { "r5", offsetof(CPUARMState, regs[5]) }, > + { "r6", offsetof(CPUARMState, regs[6]) }, > + { "r7", offsetof(CPUARMState, regs[7]) }, > + { "r8", offsetof(CPUARMState, regs[8]) }, > + { "r9", offsetof(CPUARMState, regs[9]) }, > + { "r10", offsetof(CPUARMState, regs[10]) }, > + { "r11", offsetof(CPUARMState, regs[11]) }, > + { "r12", offsetof(CPUARMState, regs[12]) }, > + { "r13|sp", offsetof(CPUARMState, regs[13]) }, > + { "r14|lr", offsetof(CPUARMState, regs[14]) }, > + { "r15|pc", offsetof(CPUARMState, regs[15]) }, > #endif
No, I really don't want to see another target #ifdef ladder, please. Put a 'static const MonitorDef *monitor_defs;' into CPUClass, and initialize it in each target's class init function, please. (You'll need to move the appropriate sections of the current static array in monitor.c plus the per-target functions that it references into target-*/cpu.c.) Look at gdb_num_core_regs as an example of where we made this kind of abstraction. -- PMM