This is the mail archive of the
gdb@sources.redhat.com
mailing list for the GDB project.
New xxx_register gdb-arch function vs pseudo register
- To: gdb at sourceware dot cygnus dot com
- Subject: New xxx_register gdb-arch function vs pseudo register
- From: Stephane Carrez <Stephane dot Carrez at worldnet dot fr>
- Date: Tue, 22 Aug 2000 00:14:06 +0200
Hi!
I'm trying to fix the support for registers in the 68hc11 port. I have reached
a problem or a limitation in GDB. I have several ways to fix that and I want
to have your opinions.
The 68HC11 has only 6 real hard registers but only 3 of them can really be
used by GCC. Since that's too small, GCC uses several soft registers.
Soft registers are in fact memory locations. Gcc, GDB-core and the GDB simulator
do not know that.
I would like to translate the read/write of the soft registers into a
read/write of the corresponding memory location (whose address is obtained
by looking at the symbol table). For this, I have two ways:
1/ Change 'gdb/regcache.c' to be able to override the 'target_fetch_registers()'
and 'target_store_registers()' with a GDB multi-arch function.
In that case, the 68hc11-tdep file is able to override the default,
translate the fetch/store into a memory read/write or call the normal
'target_xxx_registers()'.
Pros: Easy to do, less changes, homogeneous with pseudo register support
Cons: New multi-arch functions.
2/ Try to use the pseudo registers framework.
The problem here is that the soft registers are not aliases to other
registers (nor combination of them). There are several places in GDB-core
where we only take into account the NUM_REGS and not NUM_REGS+PSEUDO_REGS.
For example, the frame structure must handle the saved registers but
it ignores the PSEUDO_REGS. If I want to use the pseudo registers framework,
it will not work because the soft registers can be saved on the stack.
There are a few places like this which must be fixed.
Pros: No new multi-arch function, may be fix some PSEUDO_REGS support (not sure)
Cons: More complex, may change the semantics of PSEUDO_REGS
I've implemented solution 1 in gdb 5.0 (but without multi-arch, just macros).
What do you think?
Thanks,
Stephane
-----------------------------------------------------------------------
Home Office
E-mail: stcarrez@worldnet.fr Stephane.Carrez@sun.com
WWW: http://home.worldnet.fr/stcarrez http://www.sun.com
Mail: 17, rue Foucher Lepelletier 6, avenue Gustave Eiffel
92130 Issy Les Moulineaux 78182 Saint Quentin en Yvelines
France