From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 18EE43858024; Fri, 10 Dec 2021 17:02:55 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 18EE43858024 From: "simark at simark dot ca" To: gdb-prs@sourceware.org Subject: [Bug gdb/28681] New: Wrong pretty-printed unique_ptr value when using "finish" Date: Fri, 10 Dec 2021 17:02:54 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: gdb X-Bugzilla-Version: HEAD X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: simark at simark dot ca X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gdb-prs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-prs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Dec 2021 17:02:55 -0000 https://sourceware.org/bugzilla/show_bug.cgi?id=3D28681 Bug ID: 28681 Summary: Wrong pretty-printed unique_ptr value when using "finish" Product: gdb Version: HEAD Status: NEW Severity: normal Priority: P2 Component: gdb Assignee: unassigned at sourceware dot org Reporter: simark at simark dot ca Target Milestone: --- With this program: --- #include std::unique_ptr foo() { int *p =3D new int (0x1234); printf("In foo: %p\n", p); return std::unique_ptr (p); } int main() { auto ptr =3D foo (); printf("In main: %p\n", ptr.get()); return 0; } --- $ ./gdb -q -iex "add-auto-load-safe-path /usr/share/gdb/auto-load" -iex "add-auto-load-scripts-directory /usr/share/gdb/auto-load" -nx --data-directory=3Ddata-directory a.out Reading symbols from a.out... (gdb) b foo Breakpoint 1 at 0x11d9: file test.cpp, line 5. (gdb) r Starting program: /home/smarchi/build/binutils-gdb/gdb/a.out=20 Breakpoint 1, foo () at test.cpp:5 5 int *p =3D new int (0x1234); (gdb) finish Run till exit from #0 foo () at test.cpp:5 In foo: 0x55555556aeb0 main () at test.cpp:13 13 printf("In main: %p\n", ptr.get()); Value returned is $1 =3D std::unique_ptr =3D {get() =3D 0x7fffffffe130} (gdb) n In main: 0x55555556aeb0 14 return 0; (gdb) p ptr $2 =3D std::unique_ptr =3D {get() =3D 0x55555556aeb0} Notice how the value printed by finish doesn't match all other three printed values. --=20 You are receiving this mail because: You are on the CC list for the bug.=