Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: Stephan Rohr <stephan.rohr@intel.com>
Cc: gdb-patches@sourceware.org,  aburgess@redhat.com,  tom@tromey.com
Subject: Re: [PATCH v3 1/1] gdb: Fix assertion in 'value_primitive_field'
Date: Tue, 16 Apr 2024 11:52:59 -0600	[thread overview]
Message-ID: <87a5lt19fo.fsf@tromey.com> (raw)
In-Reply-To: <20240327152208.8321-2-stephan.rohr@intel.com> (Stephan Rohr's message of "Wed, 27 Mar 2024 08:22:08 -0700")

>>>>> Stephan Rohr <stephan.rohr@intel.com> writes:

> From: "Rohr, Stephan" <stephan.rohr@intel.com>
> GDB asserts that the data location of a value's field with a dynamic
> data location is resolved when fetching the field's value in
> 'value_primitive_field'.  This assertion was hit because of bogus DWARF
> generated by the Intel Fortran compiler.  While that compiler should fix
> the DWARF, we prefer GDB to error out here instead, e.g. to allow the
> user to continue debugging other parts of the program.

I have been trying to understand this patch for a while but I really
don't.  Could you explain it in more detail, preferably in the commit
message?

> +	    DW_TAG_variable {
> +		{DW_AT_name var_a_invalid_location}
> +		{DW_AT_type :$struct_label}
> +		{DW_AT_location {
> +		    DW_OP_addr [gdb_target_symbol var_a]
> +		    DW_OP_deref
> +		    DW_OP_stack_value
> +		} SPECIAL_expr}
> +	    }

For example, I don't understand what is invalid about this.
It's weird for sure, but why is gdb's failure to evaluate it anything
other than a bug somewhere else in gdb?

In the "valid" case I see the field type being resolved.  Why doesn't
this happen in the invalid case?

> +	error (_("cannot read %s, expected an already resolved data "
> +		 "location."), arg_type->field (fieldno).name ());

This error shouldn't have a trailing ".", it makes the output look
weird:

$1 = {data = <error reading variable: cannot read data, expected an already resolved data location.>

Tom

      reply	other threads:[~2024-04-16 17:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-27 15:22 [PATCH v3 0/1] " Stephan Rohr
2024-03-27 15:22 ` [PATCH v3 1/1] " Stephan Rohr
2024-04-16 17:52   ` Tom Tromey [this message]

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=87a5lt19fo.fsf@tromey.com \
    --to=tom@tromey.com \
    --cc=aburgess@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=stephan.rohr@intel.com \
    /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