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: [rfc] Autoselect x86_64 or i386 based on the remote g packet size


>  The operating principle is that a target is free to send back a "short"
>  g packet, but some sizes are plausible and others are not.  So I
>  enhanced the i386 backend to register the sizes of likely register
>  sets: core registers, core + i387, core + i387 + SSE.  The Linux
>  backend adds the %orig_eax and %orig_rax pseudo-"registers" too
>  (which, if I were inventing them today, might be target objects like
>  the sparc WCOOKIE, but are currently in the g packet).
>
>  So if you have a GDB which defaults to i386-linux, and it connects to
>  an amd64 target and gets exactly the right number of bytes to be
>  a 64-bit register set, it'll assume that's what it's got.
>
>  There's deliberately no mechanism to say "more than X bytes must be
>  amd64",
>  because I feel that's unsafe.  The current registered guesses are
>  high-confidence, since e.g the amd64 guesses would be quite odd sizes for
>  an i386 target to return.  For instance, the amd64 non-FP registers cut
>  off between fioff and foseg if interpreted as a 32-bit register set: not
>  very likely.
>
>  All comments welcome!  Tested on x86_64-pc-linux-gnu, using gdbserver for
>  the testsuite and by hand.

Hi Daniel,

I can't say I'm very enthousiastic about this patch.  It feels like a
kludge to avoid adding proper support to the remote protocol that allows
gdb to interrogate the target about this.  A very clever kludge, but still
a kludge.

Mark


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