Re: [rfa] gdbserver overhaul

Andrew Cagney
2001-10-16T21:09:00Z

> I'd like to commit the attached. It's just the first stage in what will
> probably change a few more times; among other highlights it removes the
> gdbserver dependency on "defs.h" (we still use a few other GDB headers, like
> terminal.h, but those will be easy to deal with down the lines). We lose
> the xm-/tm-/nm- files at the same time, so to know what the target registers
> are we have to hard-code them. This also makes us independent (at last) of
> the GDB register cache layout. GDB does not yet have a corresponding
> independence, but now that the protocols are clearly and compactly described
> in gdbserver, that too can come soon.

Dan, if I'm reading this right there are two changes involved.

Break low-linux.c down into separate files.
Introduce and use regdef.[hc].

With regard to breaking down low-linux.c into CPU specific files. The
actual process doesn't worry me (probably a good move). You would need
to do the other platforms at the same time so that gdbserver doesn't end
up with two different schema. My one concern is the file name choice, I
would definitly use linux in preference to lnx since the former is used
every else in GDB. I'd also consider adding a suffix/prefix - there is
low-* already. (Unless you're proposing we change the other files to lnx.)

Regarding regdef:

> +struct reg arm_regs[] = {
> + R4("r0"), R4("r1"), R4("r2"), R4("r3"),
> + R4("r4"), R4("r5"), R4("r6"), R4("r7"),
> + R4("r8"), R4("r9"), R4("r10"), R4("r11"),
> + R4("r12"), R4("sp"), R4("lr"), R4("pc"),
> + R12("f0"), R12("f1"), R12("f2"), R12("f3"),
> + R12("f4"), R12("f5"), R12("f6"), R12("f7"),
> + R4("fps"), R4("cpsr"),

Have you thought about using something like a colon delimited file:

4:r0
8:r1

to generate these? A definition for a textual form will be needed
eventually. While crude it would allow the sharing of this information
between GDB and gdbserver.

Andrew

> I've added preprocessor gunk to make this compile on other non-Linux
> gdbserver targets, since I only had the Linux ones available to test on. I
> tested on Linux/{ARM,i386,mips,ppc,sh}; the SH bits require some patches
> available from the SH community but not yet in mainstream GDB, but I'm
> including the gdbserver parts anyway. I'm fairly sure that ia64 and m68k
> will continue to work if they did beforehand. Note that the "compile" at the
> beginning of this paragraph is really "compile iff it already did". I tried
> to find a non-Linux target to test; I tried mips64vr5000-unknown-elf
> (low-sim.c) and sparc-sun-solaris2.8 (low-solaris.c). Neither built. It
> would be nice if someone tried, say, the NetBSD port before I committed
> this, but I'm not really insisting on it. I'd rather that every time
> someone notices that such a port is broken, we convert it to the new scheme.
>
>