public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/30296] New: GDB showing <synthetic pointer> for struct members that are clearly not.
@ 2023-03-31 16:27 hluaw at connect dot ust.hk
  2023-03-31 16:56 ` [Bug gdb/30296] " tromey at sourceware dot org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: hluaw at connect dot ust.hk @ 2023-03-31 16:27 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 30296
           Summary: GDB showing <synthetic pointer> for struct members
                    that are clearly not.
           Product: gdb
           Version: HEAD
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: gdb
          Assignee: unassigned at sourceware dot org
          Reporter: hluaw at connect dot ust.hk
  Target Milestone: ---

Code:
#include "stdint.h"
int a, b;
volatile int c;
int16_t func_3();
int16_t func_3() {
  int64_t l_126[4] = {0x5C253C716A15F506LL, 0x5C253C716A15F506LL,
                      0x5C253C716A15F506LL, 0x5C253C716A15F506LL};
  b = l_126[0];
  return c;
}
int main() { func_3(); }


Compile:
$ clang -O1 -g r.c
$ clang -v
  clang version 15.0.7
  Target: x86_64-pc-linux-gnu
  Thread model: posix
  InstalledDir: /usr/lib/llvm/15/bin
  Configuration file: /etc/clang/clang.cfg
  System configuration file directory: /etc/clang
  Selected GCC installation: /usr/lib/gcc/x86_64-pc-linux-gnu/11
  Candidate multilib: .;@m64
  Candidate multilib: 32;@m32
  Selected multilib: .;@m64

GDB Behavior:
(gdb) b func_3
Breakpoint 1 at 0x1130: func_3. (2 locations)
(gdb) r
Starting program: /home/john/documents/debugger-bugs/struct_syn/reduce/a.out
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".

Breakpoint 1, func_3 () at r.c:8
8         b = l_126[0];
(gdb) p l_126
$1 = {6639779683436459270, <synthetic pointer>, <synthetic pointer>, <synthetic
pointer>}
(gdb) info addr l_126
Symbol "l_126" is a complex DWARF expression:
     0: DW_OP_constu 6639779683436459270
    10: DW_OP_stack_value
    [8-byte piece].

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug gdb/30296] GDB showing <synthetic pointer> for struct members that are clearly not.
  2023-03-31 16:27 [Bug gdb/30296] New: GDB showing <synthetic pointer> for struct members that are clearly not hluaw at connect dot ust.hk
@ 2023-03-31 16:56 ` tromey at sourceware dot org
  2023-03-31 17:03 ` tromey at sourceware dot org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: tromey at sourceware dot org @ 2023-03-31 16:56 UTC (permalink / raw)
  To: gdb-prs

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

Tom Tromey <tromey at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tromey at sourceware dot org
   Last reconfirmed|                            |2023-03-31
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
             Blocks|                            |26909


Referenced Bugs:

https://sourceware.org/bugzilla/show_bug.cgi?id=26909
[Bug 26909] [meta] Debug Clang-built code
-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug gdb/30296] GDB showing <synthetic pointer> for struct members that are clearly not.
  2023-03-31 16:27 [Bug gdb/30296] New: GDB showing <synthetic pointer> for struct members that are clearly not hluaw at connect dot ust.hk
  2023-03-31 16:56 ` [Bug gdb/30296] " tromey at sourceware dot org
@ 2023-03-31 17:03 ` tromey at sourceware dot org
  2023-04-20 22:23 ` tromey at sourceware dot org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: tromey at sourceware dot org @ 2023-03-31 17:03 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #1 from Tom Tromey <tromey at sourceware dot org> ---
check_pieced_synthetic_pointer looks fishy:

      if (p->location != DWARF_VALUE_IMPLICIT_POINTER)
        return false;

Seems like it should require a positive match here.

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug gdb/30296] GDB showing <synthetic pointer> for struct members that are clearly not.
  2023-03-31 16:27 [Bug gdb/30296] New: GDB showing <synthetic pointer> for struct members that are clearly not hluaw at connect dot ust.hk
  2023-03-31 16:56 ` [Bug gdb/30296] " tromey at sourceware dot org
  2023-03-31 17:03 ` tromey at sourceware dot org
@ 2023-04-20 22:23 ` tromey at sourceware dot org
  2023-04-21  0:33 ` tromey at sourceware dot org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: tromey at sourceware dot org @ 2023-04-20 22:23 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #2 from Tom Tromey <tromey at sourceware dot org> ---
I wrote a test case using the DWARF assembler but I get a
different failure mode:

(gdb) print noptr
$1 = {6639779683436459270, 0, 0, 33}

I think those last 3 values should be <optimized out>.
Possibly the difference is that in my test, the variable
is a global -- not sure though.

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug gdb/30296] GDB showing <synthetic pointer> for struct members that are clearly not.
  2023-03-31 16:27 [Bug gdb/30296] New: GDB showing <synthetic pointer> for struct members that are clearly not hluaw at connect dot ust.hk
                   ` (2 preceding siblings ...)
  2023-04-20 22:23 ` tromey at sourceware dot org
@ 2023-04-21  0:33 ` tromey at sourceware dot org
  2023-04-21 12:20 ` tromey at sourceware dot org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: tromey at sourceware dot org @ 2023-04-21  0:33 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #3 from Tom Tromey <tromey at sourceware dot org> ---
>     [8-byte piece].

Aha, this means DW_OP_piece in that output -- I didn't realize.
With this I can reproduce it.

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug gdb/30296] GDB showing <synthetic pointer> for struct members that are clearly not.
  2023-03-31 16:27 [Bug gdb/30296] New: GDB showing <synthetic pointer> for struct members that are clearly not hluaw at connect dot ust.hk
                   ` (3 preceding siblings ...)
  2023-04-21  0:33 ` tromey at sourceware dot org
@ 2023-04-21 12:20 ` tromey at sourceware dot org
  2023-04-21 23:28 ` tromey at sourceware dot org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: tromey at sourceware dot org @ 2023-04-21 12:20 UTC (permalink / raw)
  To: gdb-prs

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

Tom Tromey <tromey at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at sourceware dot org   |tromey at sourceware dot org

--- Comment #4 from Tom Tromey <tromey at sourceware dot org> ---
I have a patch.

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug gdb/30296] GDB showing <synthetic pointer> for struct members that are clearly not.
  2023-03-31 16:27 [Bug gdb/30296] New: GDB showing <synthetic pointer> for struct members that are clearly not hluaw at connect dot ust.hk
                   ` (4 preceding siblings ...)
  2023-04-21 12:20 ` tromey at sourceware dot org
@ 2023-04-21 23:28 ` tromey at sourceware dot org
  2023-05-11 21:48 ` cvs-commit at gcc dot gnu.org
  2023-05-11 21:49 ` tromey at sourceware dot org
  7 siblings, 0 replies; 9+ messages in thread
From: tromey at sourceware dot org @ 2023-04-21 23:28 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #5 from Tom Tromey <tromey at sourceware dot org> ---
https://sourceware.org/pipermail/gdb-patches/2023-April/199003.html

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug gdb/30296] GDB showing <synthetic pointer> for struct members that are clearly not.
  2023-03-31 16:27 [Bug gdb/30296] New: GDB showing <synthetic pointer> for struct members that are clearly not hluaw at connect dot ust.hk
                   ` (5 preceding siblings ...)
  2023-04-21 23:28 ` tromey at sourceware dot org
@ 2023-05-11 21:48 ` cvs-commit at gcc dot gnu.org
  2023-05-11 21:49 ` tromey at sourceware dot org
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-05-11 21:48 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #6 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Tom Tromey <tromey@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=245f9db1fa8a355e9b18d0966fe20d6341e36813

commit 245f9db1fa8a355e9b18d0966fe20d6341e36813
Author: Tom Tromey <tom@tromey.com>
Date:   Thu Apr 20 15:47:41 2023 -0600

    Do not print <synthetic pointer> when piece is optimized out

    A user reported a bug where printing a certain array of integer types
    would result in the nonsensical:

    (gdb) p l_126
    $1 = {6639779683436459270, <synthetic pointer>, <synthetic pointer>,
<synthetic pointer>}

    I tracked this down to some issues in the DWARF expression code.
    First, check_pieced_synthetic_pointer did not account for the
    situation where a location expression does not describe all the bits
    of a value -- in this case it returned true, meaning there is a
    synthetic pointer, but in fact these bits are optimized out.  (It
    turns out this incorrect output had already been erroneously tested
    for as well.)

    Next, rw_pieced_value did not mark these bits as optimized-out,
    either.

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

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug gdb/30296] GDB showing <synthetic pointer> for struct members that are clearly not.
  2023-03-31 16:27 [Bug gdb/30296] New: GDB showing <synthetic pointer> for struct members that are clearly not hluaw at connect dot ust.hk
                   ` (6 preceding siblings ...)
  2023-05-11 21:48 ` cvs-commit at gcc dot gnu.org
@ 2023-05-11 21:49 ` tromey at sourceware dot org
  7 siblings, 0 replies; 9+ messages in thread
From: tromey at sourceware dot org @ 2023-05-11 21:49 UTC (permalink / raw)
  To: gdb-prs

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

Tom Tromey <tromey at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
   Target Milestone|---                         |14.1
         Resolution|---                         |FIXED

--- Comment #7 from Tom Tromey <tromey at sourceware dot org> ---
Fixed.

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2023-05-11 21:49 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-31 16:27 [Bug gdb/30296] New: GDB showing <synthetic pointer> for struct members that are clearly not hluaw at connect dot ust.hk
2023-03-31 16:56 ` [Bug gdb/30296] " tromey at sourceware dot org
2023-03-31 17:03 ` tromey at sourceware dot org
2023-04-20 22:23 ` tromey at sourceware dot org
2023-04-21  0:33 ` tromey at sourceware dot org
2023-04-21 12:20 ` tromey at sourceware dot org
2023-04-21 23:28 ` tromey at sourceware dot org
2023-05-11 21:48 ` cvs-commit at gcc dot gnu.org
2023-05-11 21:49 ` tromey at sourceware dot org

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).