Bug 597848

Summary: gdb issues with DW_OP_*piece
Product: Red Hat Enterprise Linux 6 Reporter: Jan Kratochvil <jan.kratochvil>
Component: gdbAssignee: Jan Kratochvil <jan.kratochvil>
Status: CLOSED CURRENTRELEASE QA Contact: Petr Muller <pmuller>
Severity: medium Docs Contact:
Priority: low    
Version: 6.0CC: cagney, ebachalo, ohudlick, pmuller, tromey
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: gdb-7.1-24.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 589467 Environment:
Last Closed: 2010-11-10 20:26:43 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 589467    
Bug Blocks:    

Description Jan Kratochvil 2010-05-30 18:21:36 UTC
+++ This bug was initially created as a clone of Bug #589467 +++

Created an attachment (id=411878)
sra-1.c

On the attached testcase:

(gdb) b 20
(gdb) b 31
(gdb) b 42
(gdb) r

(gdb) p a
$1 = {i = 4, j = 14}
(gdb) p a.i
$2 = 4
(gdb) p a.j
$3 = 4
(gdb) c

$3 is wrong, should have been 14.  The debug info looks correct and, after all,
p a printed it correctly too.

(gdb) p a
$4 = {4, 14}
(gdb) p a[0]
Can't take address of "a" which isn't an lvalue.
(gdb) p a[1]
Can't take address of "a" which isn't an lvalue.
(gdb) c

When p a is able to print it, so should IMHO p a[0] or p a[1].
(gdb) p a
Unhandled dwarf expression opcode 0x9d
(gdb) p a.i
Unhandled dwarf expression opcode 0x9d
(gdb) p a.j
Unhandled dwarf expression opcode 0x9d

And here DW_OP_bit_piece is unsupported.

--- Additional comment from jakub on 2010-05-06 04:55:33 EDT ---

This is with http://gcc.gnu.org/PR43983 #c5 patch.

--- Additional comment from jakub on 2010-05-06 04:56:23 EDT ---

Created an attachment (id=411881)
sra-1.s

gcc -g -O2 -dA generated x86-64 assembly.

--- Additional comment from jakub on 2010-05-06 04:59:26 EDT ---

Created an attachment (id=411883)
sra-1.s

gcc -g -O2 -dA generated x86-64 assembly.

--- Additional comment from tromey on 2010-05-21 17:19:33 EDT ---

I've checked in 4 patches to upstream gdb that should fix these problems.
The unavailable piece patch is not really complete (it warns and fills in
zeroes), but it is better than not getting any results at all.

--- Additional comment from jan.kratochvil on 2010-05-30 14:19:37 EDT ---

gdb-bz589467-pieces1of4.patch
 = http://sourceware.org/ml/gdb-cvs/2010-05/msg00186.html
gdb-bz589467-pieces2of4.patch
 = http://sourceware.org/ml/gdb-cvs/2010-05/msg00188.html
 = http://sourceware.org/ml/gdb-cvs/2010-05/msg00189.html
gdb-bz589467-pieces3of4.patch 
 = http://sourceware.org/ml/gdb-cvs/2010-05/msg00190.html
gdb-bz589467-pieces4of4.patch 
 = http://sourceware.org/ml/gdb-cvs/2010-05/msg00191.html


qa_ack:
+Running gdb/testsuite/gdb.dwarf2/pieces.exp ...
+PASS: gdb.dwarf2/pieces.exp: set f1 breakpoint for pieces
+PASS: gdb.dwarf2/pieces.exp: continue to breakpoint: continue to f1 breakpoint for pieces
+PASS: gdb.dwarf2/pieces.exp: print a in pieces:f1
+PASS: gdb.dwarf2/pieces.exp: print a.j in pieces:f1
+PASS: gdb.dwarf2/pieces.exp: set f2 breakpoint for pieces
+PASS: gdb.dwarf2/pieces.exp: continue to breakpoint: continue to f2 breakpoint for pieces
+PASS: gdb.dwarf2/pieces.exp: print a in pieces:f2
+PASS: gdb.dwarf2/pieces.exp: print a[0] in pieces:f2
+PASS: gdb.dwarf2/pieces.exp: print a[1] in pieces:f2
+PASS: gdb.dwarf2/pieces.exp: set f3 breakpoint for pieces
+PASS: gdb.dwarf2/pieces.exp: continue to breakpoint: continue to f3 breakpoint for pieces
+PASS: gdb.dwarf2/pieces.exp: print a.i in pieces:f3
+PASS: gdb.dwarf2/pieces.exp: print a.j in pieces:f3
+KFAIL: gdb.dwarf2/pieces.exp: set a.i in pieces:f3 (PRMS: no bug yet)
+PASS: gdb.dwarf2/pieces.exp: print new a.i in pieces:f3
+PASS: gdb.dwarf2/pieces.exp: set f6 breakpoint for pieces
+PASS: gdb.dwarf2/pieces.exp: continue to breakpoint: continue to f6 breakpoint for pieces
+PASS: gdb.dwarf2/pieces.exp: print a with optimized out piece
+PASS: gdb.dwarf2/pieces.exp: print a.i with optimized out piece

Comment 1 RHEL Program Management 2010-05-30 18:35:41 UTC
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux major release.  Product Management has requested further
review of this request by Red Hat Engineering, for potential inclusion in a Red
Hat Enterprise Linux Major release.  This request is not yet committed for
inclusion.

Comment 3 Petr Muller 2010-08-03 15:18:51 UTC
# runtest --tool=gdb gdb.dwarf2/pieces.exp
(...)
# of expected passes            18
# of known failures             1

Comment 4 releng-rhel@redhat.com 2010-11-10 20:26:43 UTC
Red Hat Enterprise Linux 6.0 is now available and should resolve
the problem described in this bug report. This report is therefore being closed
with a resolution of CURRENTRELEASE. You may reopen this bug report if the
solution does not work for you.