>> Then the code from shnbsd can be moved to sh-tdep.c and the only >> remaining bit is to initialize the array appropriately in shbnsd-tdep >> and sh-linux-tdep. > > I believe this patch should do what you suggest. You definitely got the idea, but the implementation does not work in the case of multi-arch debugging. This is because you are introducing a global variable. The solution is to rely on the gdbarch_tdep structure. Here is a patch that should provide you with a quick sketch of how you can implement this: - I created a gdbarch_tdep structure for SH, since it didn't need one before; I populated it with a simple regmap being an array of integers, but it appears that this may not be sufficient, since registers might not be stored in the same order as GDB register numbers. So your slightly more complex structure might be required - Move the core-file support from shnbsd-tdep to sh-tdep, did some renaming - hopefully I didn't miss much - Initialized support for core-file in sh-tdep knowing that the routine that checks core file section names will only return non-NULL if such support is available (detected by looking at the gdbarch_tdep structure). Hopefully, once this is in place, the only thing you should have left to do is to create the offset maps in sh-linux-tdep and set the tdep maps during the sh/linux gdbarch initialization. Does this make sense to you? -- Joel