public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: Stephan Rohr <stephan.rohr@intel.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH 1/1] gdb: Fix assertion in 'value_primitive_field'
Date: Mon, 12 Feb 2024 10:27:47 -0700	[thread overview]
Message-ID: <87r0hh7fu4.fsf@tromey.com> (raw)
In-Reply-To: <20240212124740.2734613-2-stephan.rohr@intel.com> (Stephan Rohr's message of "Mon, 12 Feb 2024 04:47:40 -0800")

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

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

It's hard to be sure in this code, but normally if there's an assert, it
means that there's a requirement that the caller do something.  So maybe
this is a bug somewhere else?

The code does seem self-contradictory though:

      /* We expect an already resolved data location.  */
      gdb_assert (TYPE_DATA_LOCATION (type)->is_constant ());
      /* For dynamic data types defer memory allocation
	 until we actual access the value.  */
      v = value::allocate_lazy (type);

Like how would it be resolved but also possibly dynamic.

But since this is allocating a lazy value, why does is_constant even matter?
What happens if you just remove that assert entirely?

I think some kind of test case here would be good.

Tom

  reply	other threads:[~2024-02-12 17:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-12 12:47 [PATCH 0/1] " Stephan Rohr
2024-02-12 12:47 ` [PATCH 1/1] gdb: " Stephan Rohr
2024-02-12 17:27   ` Tom Tromey [this message]
2024-02-13  7:44     ` Rohr, Stephan

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=87r0hh7fu4.fsf@tromey.com \
    --to=tom@tromey.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).