This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Move initialize_tdesc_mips* calls from mips-linux-nat.c to mips-linux-tdep.c


On Wednesday, May 10, 2017 12:51:59 PM Maciej W. Rozycki wrote:
> On Tue, 9 May 2017, Yao Qi wrote:
> 
> > Target description initialization should be called in -tdep.c, instead of
> > -nat.c.  Rebuild mips-linux native GDB.  Regression test is not run.
> 
>  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.

Another example of target descriptions used this way is on i386/amd64 for
both Linux and FreeBSD which use the register note with XSAVE registers
(and it's embedded value of %xcr0) to decide which target description to
use for plain SSE vs AVX vs MPX, etc.  Again, these checks are performed
both in the native target "read_description" method for live processes and
in the gdbarch "core_read_description" method for cores.

My guess is that Yao is just fixing this to follow the general rule that
target descriptions belong to the 'tdep' layer so that they can be used
by gdbarch "core_read_description" methods.

-- 
John Baldwin


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]