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:40:36 +0000	[thread overview]
Message-ID: <bug-26910-4717-TLABDFY1vB@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 #1 from Tom de Vries <vries at gcc dot gnu.org> ---
The parameter s in function f:
...
 <2><1ed>: Abbrev Number: 13 (DW_TAG_formal_parameter)
    <1ee>   DW_AT_name        : s
    <1f2>   DW_AT_type        : <0x25a>
...
has type:
...
 <1><25a>: Abbrev Number: 17 (DW_TAG_string_type)
    <25b>   DW_AT_string_length: 0xbf (location list)
    <25f>   DW_AT_byte_size   : 4
    <260>   DW_AT_sibling     : <0x26e>
...
matching with location list:
...
    000000bf 0000000000400730 0000000000400764 (DW_OP_reg4 (rsi))
    000000d2 0000000000400764 0000000000400783 (DW_OP_reg6 (rbp))
    000000e5 0000000000400783 0000000000400784 (DW_OP_GNU_entry_value:
(DW_OP_reg4 (rsi)); DW_OP_stack_value)
...

Doing a print of pc at the breakpoint:
...
4         print *, s
(gdb) info registers pc
pc             0x400734            0x400734 <f+4>
...
tells us that the string length can be found in register rsi, which contains:
...
(gdb) info registers rsi
rsi            0x3                 3
...

So, the information seems to be there.  Why doesn't gdb use it?

We find the answer by stepping through read_tag_string_type.  We hit:
...
(gdb) 
17837         if (!attr_to_dynamic_prop (attr, die, cu, &prop, prop_type))
(gdb) 
17838           length = 1;
...
and that's the reason why the length is one.

So, why don't we manage to convert the attribute to a dynamic prop?

Stepping through attr_to_dynamic_prop shows why:
...
(gdb) 
18590     if (attr->form_is_block ())
(gdb) 
18613     else if (attr->form_is_ref ())
(gdb) 
18676     else if (attr->form_is_constant ())
(gdb) 
18680         dwarf2_invalid_attrib_class_complaint (dwarf_form_name
(attr->form),
(gdb) 
18682         return 0;
...

The actual form is:
...
(gdb) p attr.form
$2 = DW_FORM_sec_offset
...
and that's not handled in attr_to_dynamic_prop.

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

  reply	other threads:[~2020-11-17 13:40 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 ` vries at gcc dot gnu.org [this message]
2020-11-17 13:43 ` [Bug fortran/26910] " vries at gcc dot gnu.org
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-TLABDFY1vB@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).