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 symtab/30814] New: [gdb/symtab, cc-with-dwz-m] FAIL: gdb.cp/cplusfuncs.exp: info function for "operator\*("
Date: Thu, 31 Aug 2023 10:37:06 +0000	[thread overview]
Message-ID: <bug-30814-4717@http.sourceware.org/bugzilla/> (raw)

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

            Bug ID: 30814
           Summary: [gdb/symtab, cc-with-dwz-m] FAIL:
                    gdb.cp/cplusfuncs.exp: info function for "operator\*("
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: symtab
          Assignee: unassigned at sourceware dot org
          Reporter: vries at gcc dot gnu.org
  Target Milestone: ---

With target board unix we get:
...
(gdb) info function operator\*(^M
All functions matching regular expression "operator\*(":^M
^M
File /data/vries/gdb/src/gdb/testsuite/gdb.cp/cplusfuncs.cc:^M
72:     void foo::operator*(foo&);^M
^M
Non-debugging symbols:^M
0x00007ffff7c22ae0  std::filesystem::directory_iterator::operator*()
const@plt^M
0x00007ffff7c23710  std::filesystem::__cxx11::directory_iterator::operator*()
const@plt^M
0x00007ffff7cf5f10  std::filesystem::__cxx11::directory_iterator::operator*()
const^M
0x00007ffff7cf5fa0 
std::filesystem::__cxx11::recursive_directory_iterator::operator*() const^M
0x00007ffff7d0c680  std::filesystem::directory_iterator::operator*() const^M
0x00007ffff7d0c710  std::filesystem::recursive_directory_iterator::operator*()
const^M
(gdb) PASS: gdb.cp/cplusfuncs.exp: info function for "operator\*("
...
but with target board cc-with-dwz-m:
...
(gdb) PASS: gdb.cp/cplusfuncs.exp: print &hairyfunc7
info function operator\*(^M
All functions matching regular expression "operator\*(":^M
^M
File /usr/lib64/gcc/x86_64-suse-linux/7/include/stddef.h:^M
72:     void foo::operator*(foo&);^M
^M
Non-debugging symbols:^M
0x00007ffff7c22ae0  std::filesystem::directory_iterator::operator*()
const@plt^M
0x00007ffff7c23710  std::filesystem::__cxx11::directory_iterator::operator*()
const@plt^M
0x00007ffff7cf5f10  std::filesystem::__cxx11::directory_iterator::operator*()
const^M
0x00007ffff7cf5fa0 
std::filesystem::__cxx11::recursive_directory_iterator::operator*() const^M
0x00007ffff7d0c680  std::filesystem::directory_iterator::operator*() const^M
0x00007ffff7d0c710  std::filesystem::recursive_directory_iterator::operator*()
const^M
(gdb) FAIL: gdb.cp/cplusfuncs.exp: info function for "operator\*("
...

The problem is that the operator is listed under the wrong file name.  It
should be listed under:
...
File /data/vries/gdb/src/gdb/testsuite/gdb.cp/cplusfuncs.cc:^M
...
but instead it's listed under:
...
File /usr/lib64/gcc/x86_64-suse-linux/7/include/stddef.h:^M
...

The DIE for the operator is:
...
 <2><de>: Abbrev Number: 25 (DW_TAG_subprogram)
    <df>   DW_AT_external    : 1
    <df>   DW_AT_name        : (indirect string, offset: 0x61): operator*
    <e3>   DW_AT_decl_file   : 2
    <e4>   DW_AT_decl_line   : 10
    <e5>   DW_AT_linkage_name: (indirect string, offset: 0x54c): _ZN3foomlERS_
    <e9>   DW_AT_accessibility: 1       (public)
    <ea>   DW_AT_declaration : 1
    <ea>   DW_AT_object_pointer: <0xee>
    <ec>   DW_AT_sibling     : <0xf5>
...
which is part of this CU:
...
 <0><4e>: Abbrev Number: 24 (DW_TAG_partial_unit)
    <4f>   DW_AT_stmt_list   : 0x0
...
which is part file .tmp/cplusfuncs.dwz, so the DW_AT_stmt_list 0x0 corresponds
to this file name table:
...
 The File Name Table (offset 0x64):
  Entry Dir     Time    Size    Name
  1     1       0       0       stddef.h
  2     2       0       0       cplusfuncs.cc
  3     0       0       0       elf-init.c
...
where selecting entry 2 gives us the correct filename.

What seems to be the problem is that instead, entry 2 is picked from the file
name table at 0xe9:
...
 The File Name Table (offset 0x159):
  Entry Dir     Time    Size    Name
  1     1       0       0       cplusfuncs.cc
  2     2       0       0       stddef.h
...
which is the one corresponding to the CU that imports the PU:
...
 <0><af>: Abbrev Number: 11 (DW_TAG_compile_unit)
    <b5>   DW_AT_name        : cplusfuncs.cc
    <c7>   DW_AT_stmt_list   : 0xe9
 <1><d5>: Abbrev Number: 5 (DW_TAG_imported_unit)
    <d6>   DW_AT_import      : <alt 0x4e>
...

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

             reply	other threads:[~2023-08-31 10:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-31 10:37 vries at gcc dot gnu.org [this message]
2023-08-31 10:39 ` [Bug symtab/30814] " 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-30814-4717@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).