This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Move initialize_tdesc_mips* calls from mips-linux-nat.c to mips-linux-tdep.c
On Wed, 10 May 2017, John Baldwin wrote:
> > Why? These descriptions are only used in the native case, otherwise
> > gdbserver supplies its own. The current arrangement has worked for some
> > 12 years now.
>
> Target descriptions (in general) might be determined purely by a core dump's
> contents. For example, in my out-of-tree patches for CHERI MIPS I added
> target descriptions for the CHERI capability registers and then use those
> target descriptions instead of the default for FreeBSD/mips core dumps that
> contain a special "capregs" note (this is implemented via a gdbarch
> "core_read_description" method). For native binaries I depend on a working
> ptrace op to determine if the native CPU supports the registers via
> the "read_description" target method.
>
> If core dumps of Linux binaries on processors with DSP registers included
> those registers in process cores then you would need a similar method for
> the Linux MIPS gdbarch that worked similar to mips_linux_read_description
> to select the appropriate target description for process cores.
Your explanation makes sense to me, although as you have also observed a
target description corresponding to a core dump may not necessarily be the
same as one produced for a live target that core dump has been obtained
from, because for various reasons the lists of registers included in each
may be different. For these cases where there is no difference, I see no
sense to duplicate code of course.
But such details would have to be included in the description of a patch
proposed, IMHO.
Maciej