public inbox for gdb-prs@sourceware.org help / color / mirror / Atom feed
* [Bug symtab/15391] New: DW_OP_GNU_implicit_pointer bug @ 2013-04-23 12:25 jan.kratochvil at redhat dot com 2013-04-23 15:13 ` [Bug symtab/15391] " tromey at redhat dot com ` (2 more replies) 0 siblings, 3 replies; 4+ messages in thread From: jan.kratochvil at redhat dot com @ 2013-04-23 12:25 UTC (permalink / raw) To: gdb-prs http://sourceware.org/bugzilla/show_bug.cgi?id=15391 Bug #: 15391 Summary: DW_OP_GNU_implicit_pointer bug Product: gdb Version: HEAD Status: NEW Severity: normal Priority: P2 Component: symtab AssignedTo: unassigned@sourceware.org ReportedBy: jan.kratochvil@redhat.com CC: tromey@redhat.com Classification: Unclassified Target: x86_64-unknown-linux-gnu struct S { short a; char b, c; }; volatile int v; void foo (int x) { struct S s = { x, x + 2, x + 3 }; char *p = &s.b; s.a++; v++; /* line 8 */ } int main () { foo (1); return 0; } gcc-4.8.0-2.fc19.x86_64 gcc -g -O2 -fno-inline -fno-ipa-cp -o implptr implptr.c -Wall gdb ./implptr -ex 'b 8' -ex r -ex 'p p[-1]' -ex c -ex q -q Actual: $1 = 3 '\003' Expected: $1 = 0 '\000' Bugreported by Jakub Jelinek. Abbrev Number: 7 (DW_TAG_variable) DW_AT_name : s DW_AT_location : (DW_OP_breg5 (rdi): 1; DW_OP_stack_value; DW_OP_piece: 2; DW_OP_breg5 (rdi): 2; DW_OP_stack_value; DW_OP_piece: 1; DW_OP_breg5 (rdi): 3; DW_OP_stack_value; DW_OP_piece: 1) Abbrev Number: 7 (DW_TAG_variable) DW_AT_name : p DW_AT_location : (DW_OP_GNU_implicit_pointer: <0x88> 2) -- Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug. ^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug symtab/15391] DW_OP_GNU_implicit_pointer bug 2013-04-23 12:25 [Bug symtab/15391] New: DW_OP_GNU_implicit_pointer bug jan.kratochvil at redhat dot com @ 2013-04-23 15:13 ` tromey at redhat dot com 2013-06-18 18:11 ` cvs-commit at gcc dot gnu.org 2013-06-18 18:12 ` tromey at redhat dot com 2 siblings, 0 replies; 4+ messages in thread From: tromey at redhat dot com @ 2013-04-23 15:13 UTC (permalink / raw) To: gdb-prs http://sourceware.org/bugzilla/show_bug.cgi?id=15391 Tom Tromey <tromey at redhat dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- AssignedTo|unassigned at sourceware |tromey at redhat dot com |dot org | -- Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug. ^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug symtab/15391] DW_OP_GNU_implicit_pointer bug 2013-04-23 12:25 [Bug symtab/15391] New: DW_OP_GNU_implicit_pointer bug jan.kratochvil at redhat dot com 2013-04-23 15:13 ` [Bug symtab/15391] " tromey at redhat dot com @ 2013-06-18 18:11 ` cvs-commit at gcc dot gnu.org 2013-06-18 18:12 ` tromey at redhat dot com 2 siblings, 0 replies; 4+ messages in thread From: cvs-commit at gcc dot gnu.org @ 2013-06-18 18:11 UTC (permalink / raw) To: gdb-prs http://sourceware.org/bugzilla/show_bug.cgi?id=15391 --- Comment #1 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> --- CVSROOT: /cvs/src Module name: src Changes by: tromey@sourceware.org 2013-06-18 18:11:19 Modified files: gdb : ChangeLog dwarf2loc.c utils.c utils.h gdb/testsuite : ChangeLog gdb/testsuite/gdb.dwarf2: implptrconst.exp gdb/testsuite/lib: dwarf.exp Added files: gdb/testsuite/gdb.dwarf2: implptrpiece.exp Log message: Fix PR symtab/15391 PR symtab/15391 is a failure with the DW_OP_GNU_implicit_pointer feature. I tracked it down to a logic error in read_pieced_value. The code truncates this_size_bits according to the type size and offset too early -- it should do it after taking bits_to_skip into account. This patch fixes the bug. While testing this, I also tripped across a latent bug because indirect_pieced_value does not sign-extend where needed. This patch fixes this bug as well. Finally, Pedro pointed out that a previous version implemented sign extension incorrectly. This version introduces a new gdb_sign_extend function for this. A couple of notes on this function: * It has the gdb_ prefix to avoid clashes with various libraries that felt free to avoid proper namespacing. There is a "sign_extend" function in a Tile GX header, in an SOM-related BFD header (and in sh64-tdep.c and as a macro in arm-wince-tdep.c, but those are ours...) * I looked at all the sign extensions in gdb and didn't see ones that I felt comfortable converting to use this function; in large part because I don't have a good way to test the conversion. Built and regtested on x86-64 Fedora 18. New test cases included; this required a minor addition to the DWARF assembler. Note that the DWARF CU made by implptrpiece.exp uses a funny pointer size in order to show the sign-extension bug on all platforms. * dwarf2loc.c (read_pieced_value): Truncate this_size_bits after taking bits_to_skip into account. Sign extend byte_offset. * utils.h (gdb_sign_extend): Declare. * utils.c (gdb_sign_extend): New function. * gdb.dwarf2/implptrpiece.exp: New file. * gdb.dwarf2/implptrconst.exp (d): New variable. Print d. * lib/dwarf2.exp (Dwarf::_location): Handle DW_OP_piece. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/ChangeLog.diff?cvsroot=src&r1=1.15708&r2=1.15709 http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/dwarf2loc.c.diff?cvsroot=src&r1=1.173&r2=1.174 http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/utils.c.diff?cvsroot=src&r1=1.300&r2=1.301 http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/utils.h.diff?cvsroot=src&r1=1.8&r2=1.9 http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/ChangeLog.diff?cvsroot=src&r1=1.3696&r2=1.3697 http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/gdb.dwarf2/implptrpiece.exp.diff?cvsroot=src&r1=NONE&r2=1.1 http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/gdb.dwarf2/implptrconst.exp.diff?cvsroot=src&r1=1.3&r2=1.4 http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/lib/dwarf.exp.diff?cvsroot=src&r1=1.9&r2=1.10 -- You are receiving this mail because: You are on the CC list for the bug. ^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug symtab/15391] DW_OP_GNU_implicit_pointer bug 2013-04-23 12:25 [Bug symtab/15391] New: DW_OP_GNU_implicit_pointer bug jan.kratochvil at redhat dot com 2013-04-23 15:13 ` [Bug symtab/15391] " tromey at redhat dot com 2013-06-18 18:11 ` cvs-commit at gcc dot gnu.org @ 2013-06-18 18:12 ` tromey at redhat dot com 2 siblings, 0 replies; 4+ messages in thread From: tromey at redhat dot com @ 2013-06-18 18:12 UTC (permalink / raw) To: gdb-prs http://sourceware.org/bugzilla/show_bug.cgi?id=15391 Tom Tromey <tromey at redhat dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution|--- |FIXED Target Milestone|--- |7.7 --- Comment #2 from Tom Tromey <tromey at redhat dot com> --- Fixed. -- You are receiving this mail because: You are on the CC list for the bug. ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-06-18 18:12 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2013-04-23 12:25 [Bug symtab/15391] New: DW_OP_GNU_implicit_pointer bug jan.kratochvil at redhat dot com 2013-04-23 15:13 ` [Bug symtab/15391] " tromey at redhat dot com 2013-06-18 18:11 ` cvs-commit at gcc dot gnu.org 2013-06-18 18:12 ` tromey at redhat dot com
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).