public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "vries at gcc dot gnu.org" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug fortran/26910] [fortran] Printing dynamic string with DW_AT_string_length of class loclistpr fails
Date: Tue, 17 Nov 2020 13:43:34 +0000	[thread overview]
Message-ID: <bug-26910-4717-ZhKFJ1gqXs@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-26910-4717@http.sourceware.org/bugzilla/>

https://sourceware.org/bugzilla/show_bug.cgi?id=26910

--- Comment #2 from Tom de Vries <vries at gcc dot gnu.org> ---
Tentative patch:
...
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index 3c598262913..151ba1faae2 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -18675,14 +18675,30 @@ attr_to_dynamic_prop (const struct attribute *attr,
struct die_in
fo *die,
     }
   else if (attr->form_is_constant ())
     prop->set_const_val (attr->constant_value (0));
-  else
+  else if (attr->form_is_section_offset ())
     {
-      dwarf2_invalid_attrib_class_complaint (dwarf_form_name (attr->form),
-                                            dwarf2_name (die, cu));
-      return 0;
+      switch (attr->name)
+       {
+       case DW_AT_string_length:
+         baton = XOBNEW (obstack, struct dwarf2_property_baton);
+         baton->property_type = default_type;
+         fill_in_loclist_baton (cu, &baton->loclist, attr);
+         prop->set_loclist (baton);
+         gdb_assert (prop->baton () != NULL);
+         break;
+       default:
+         goto invalid;
+       }
     }
+  else
+    goto invalid;

   return 1;
+
+ invalid:
+  dwarf2_invalid_attrib_class_complaint (dwarf_form_name (attr->form),
+                                        dwarf2_name (die, cu));
+  return 0;
 }

 /* See read.h.  */
...

and we have:
...
$ gdb -batch ./outputs/gdb.opt/fortran-string/fortran-string \
    -ex "b 4" \
    -ex r \
    -ex "ptype s"
Breakpoint 1 at 0x400734: file fortran-string.f90, line 4.

Breakpoint 1, f (s=..., _s=_s@entry=3) at fortran-string.f90:4
4         print *, s
type = character (3)
...

-- 
You are receiving this mail because:
You are on the CC list for the bug.

  parent reply	other threads:[~2020-11-17 13:43 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-17 13:37 [Bug fortran/26910] New: " vries at gcc dot gnu.org
2020-11-17 13:40 ` [Bug fortran/26910] " vries at gcc dot gnu.org
2020-11-17 13:43 ` vries at gcc dot gnu.org [this message]
2021-10-14 19:59 ` vries at gcc dot gnu.org
2021-10-15  5:23 ` [Bug symtab/26910] " vries at gcc dot gnu.org
2021-10-28  8:54 ` vries at gcc dot gnu.org

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=bug-26910-4717-ZhKFJ1gqXs@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).