Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: Andrew Burgess <aburgess@broadcom.com>
Cc: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: Re: PATCH: error reading variable: value has been optimized out
Date: Wed, 05 Sep 2012 18:54:00 -0000	[thread overview]
Message-ID: <20120905185349.GA13463@host2.jankratochvil.net> (raw)
In-Reply-To: <50463305.2080802@broadcom.com>

On Tue, 04 Sep 2012 18:57:41 +0200, Andrew Burgess wrote:
> On 03/09/2012 4:16 PM, Jan Kratochvil wrote:
> > ABI registers order: rdi rsi rdx rcx r8 r9
> > ==amd64_dummy_call_integer_regs
> 
> You're correct that what I originally wrote was not correct, but I think the
> register ordering used for what was test2, which is the
> extend-into-next-register behaviour, is actually just using the gdb register
> number, so this would be from the enum amd64_regnum.

In my text above I was only following the ABI standard
	http://www.x86-64.org/documentation/abi.pdf
specifically:
	2. If the class is INTEGER, the next available register of the
	sequence %rdi, %rsi, %rdx, %rcx, %r8 and %r9 is used13 .
IIUC this does not mean this hack of register numbers flowing should be used,
it just specifies which registers should be put in DWARF for DW_OP_piece.

In the case the hack of register numbers flowing is used:

For i386 there is:
	i386_register_to_value -> i386_next_regnum
so i386 does not follow GDB numbering but its own one.  During my testcase GDB
(correctly for GCC) composed HIGH(%edx==gdb reg. #2) | LOW(%eax==gdb reg. #0).
as i386_next_regnum (%eax==gdb reg. #0) == %edx==gdb reg. #2.

For amd64 the target code does not do anything specific so it is processed in
read_frame_register_value and it really follows the GDB registers numbering.
But that seems wrong to me as it violates the ABI specification above.
Still it is not being used for anything in real world I think.  An assertion
there does not trigger on GDB testsuite at all.  It would trigger on the AVR
target it was written for
	[RFA/RFC] Restore old handling of multi-register variables
	http://sourceware.org/ml/gdb-patches/2011-10/msg00052.html
but I think that should have been written only to avr-tdep.c with some AVR
registers numbering on mind.

I was unable to produce any such DWARF output (using register numbers flowing)
from any i386/x86_64 GCC compiler here, like FSF 3.4.6, Red Hat 4.1 or FSF
4.4. So I do not think it is of any much concern how multi-register values
behave in read_frame_register_value, except for that AVR compatibility.  It is
also not exploited by your 'bad-bt' testcase. It is exploited by
'struct_param_single_reg_loc' from your new testcase but specifying gdb
numbers of registers there is rather a compatibility with current - assumed
buggy - GDB behavior.


> Any more feedback, or is this ok to commit ?

I am fine with that stating there like:
	This gdb register numbers usage exposed to external DWARF data is more
	a GDB bug and it should be move to target dependent code (such as AVR)
	as a workaround of existing broken DWARF.

Best to keep it here for a week for comments before commit.


Thanks,
Jan


  reply	other threads:[~2012-09-05 18:54 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-24 12:11 Andrew Burgess
2012-08-26 18:22 ` Jan Kratochvil
2012-08-27 15:46   ` Tom Tromey
2012-08-31  9:59     ` Eli Zaretskii
2012-09-03 15:07     ` Jan Kratochvil
2012-08-31 10:33   ` Andrew Burgess
2012-09-01  8:17     ` Eli Zaretskii
2012-09-03  8:32       ` Andrew Burgess
2012-09-03 11:24       ` Jan Kratochvil
2012-09-03 15:38         ` Eli Zaretskii
2012-09-03 15:17     ` Jan Kratochvil
2012-09-04 16:58       ` Andrew Burgess
2012-09-05 18:54         ` Jan Kratochvil [this message]
2012-09-12 17:30     ` Tom Tromey
2012-09-13 12:34       ` Andrew Burgess
2012-09-14 19:02         ` Tom Tromey
2012-09-14 21:39           ` Andrew Burgess
2012-09-17 16:57             ` Jan Kratochvil
2012-09-19 14:29               ` Andrew Burgess
2012-09-20 13:28                 ` Jan Kratochvil
2012-09-21 17:19                   ` Andrew Burgess

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120905185349.GA13463@host2.jankratochvil.net \
    --to=jan.kratochvil@redhat.com \
    --cc=aburgess@broadcom.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox