public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug symtab/13277] New: gdb does not resolve opaque structures in binaries compiled with ICC.
@ 2011-10-09 10:27 toojays at toojays dot net
2011-10-09 10:32 ` [Bug symtab/13277] " toojays at toojays dot net
` (6 more replies)
0 siblings, 7 replies; 8+ messages in thread
From: toojays at toojays dot net @ 2011-10-09 10:27 UTC (permalink / raw)
To: gdb-prs
http://sourceware.org/bugzilla/show_bug.cgi?id=13277
Bug #: 13277
Summary: gdb does not resolve opaque structures in binaries
compiled with ICC.
Product: gdb
Version: 7.3
Status: NEW
Severity: normal
Priority: P2
Component: symtab
AssignedTo: unassigned@sourceware.org
ReportedBy: toojays@toojays.net
Classification: Unclassified
gdb does not resolve opaque structures in binaries compiled with ICC.
An example program using a pointer to an opaque structure looks like:
$ cat opaque.c
#include <stdio.h>
#include <stdlib.h>
struct opaque_t
{
int wrapped_value;
};
struct opaque_t *opaque_create (int initializer)
{
struct opaque_t *opaque = malloc(sizeof(struct opaque_t));
if (opaque != NULL)
opaque->wrapped_value = initializer;
return opaque;
}
void opaque_print (struct opaque_t *p_opaque)
{
printf("value is %d.\n", p_opaque->wrapped_value);
}
void opaque_destroy (struct opaque_t *p_opaque)
{
free(p_opaque);
}
$ cat main.c
#include <stdlib.h>
#include "opaque.h"
int main ()
{
struct opaque_t *p_opaque = opaque_create(1234);
if (p_opaque == NULL)
return 1;
opaque_print(p_opaque);
opaque_destroy(p_opaque);
return 0;
}
If I break this program at line 12 of main.c, and try to print p_opaque, gdb
complains "no data fields":
Breakpoint 1, main () at main.c:12
12 opaque_print(p_opaque);
(gdb) print *p_opaque
$1 = {<No data fields>}
But if I step into a function in opaque.c, gdb *can* see into the structure:
(gdb) step
opaque_print (p_opaque=0xc51e010) at opaque.c:21
21 printf("value is %d.\n", p_opaque->wrapped_value);
(gdb) print *p_opaque
$2 = {wrapped_value = 1234}
This case works fine when the program is compiled with GCC. Does not work with
ICC, even when compiled with "-debug extended".
The problem seems to be that ICC does not set the DW_AT_declaration attribute
on the opaque pointer in main.c.
dwarfdumps of binaries produced with GCC and ICC follow.
This binary was produced with 'CC="gcc -g" make':
jscott@saaz:~/src/random/gdb-icc-opaque$ dwarfdump -S match=opaque_t
opaque-demo
COMPILE_UNIT<header overall offset = 0>:
<0>< 11> DW_TAG_compile_unit
DW_AT_producer GNU C 4.4.5
DW_AT_language DW_LANG_C89
DW_AT_name main.c
DW_AT_comp_dir /home/jscott/src/random/gdb-icc-opaque
DW_AT_low_pc 0x400584
DW_AT_high_pc 0x4005c7
DW_AT_stmt_list 0
LOCAL_SYMBOLS:
<1>< 125> DW_TAG_subprogram
DW_AT_external yes(1)
DW_AT_name main
DW_AT_decl_file 1
/home/jscott/src/random/gdb-icc-opaque/main.c
DW_AT_decl_line 5
DW_AT_type <52>
DW_AT_low_pc 0x400584
DW_AT_high_pc 0x4005c7
DW_AT_frame_base <loclist with 3 entries follows>
[ 0]<lowpc=0x0><highpc=0x1>DW_OP_breg7+8
[ 1]<lowpc=0x1><highpc=0x4>DW_OP_breg7+16
[ 2]<lowpc=0x4><highpc=0x43>DW_OP_breg6+16
DW_AT_sibling <182>
<2>< 161> DW_TAG_structure_type
DW_AT_name opaque_t
DW_AT_declaration yes(1)
COMPILE_UNIT<header overall offset = 189>:
<0>< 11> DW_TAG_compile_unit
DW_AT_producer GNU C 4.4.5
DW_AT_language DW_LANG_C89
DW_AT_name opaque.c
DW_AT_comp_dir /home/jscott/src/random/gdb-icc-opaque
DW_AT_low_pc 0x4005c8
DW_AT_high_pc 0x400639
DW_AT_stmt_list 63
LOCAL_SYMBOLS:
<1>< 125> DW_TAG_structure_type
DW_AT_name opaque_t
DW_AT_byte_size 4
DW_AT_decl_file 1
/home/jscott/src/random/gdb-icc-opaque/opaque.c
DW_AT_decl_line 5
DW_AT_sibling <152>
This binary was produced with 'CC="icc -debug extended" make':
jscott@saaz:~/src/random/gdb-icc-opaque$ dwarfdump -S match=opaque_t
opaque-demo-icc-12.0.4
COMPILE_UNIT<header overall offset = 0>:
<0>< 11> DW_TAG_compile_unit
DW_AT_comp_dir /root/gdb-icc-opaque
DW_AT_low_pc 0x40059c
DW_AT_language DW_LANG_C89
DW_AT_name main.c
DW_AT_producer Intel(R) C Intel(R) 64 Compiler XE for
applications running on Intel(R) 64, Version 12.0.4.191 Build 20110427
Fixes SameLinkageName MemberPointers
DW_AT_stmt_list 0
LOCAL_SYMBOLS:
<1>< 275> DW_TAG_structure_type
DW_AT_decl_line 1
DW_AT_decl_column 8
DW_AT_decl_file 2 /root/gdb-icc-opaque/opaque.h
DW_AT_accessibility DW_ACCESS_public
DW_AT_byte_size 0
DW_AT_name opaque_t
COMPILE_UNIT<header overall offset = 294>:
<0>< 11> DW_TAG_compile_unit
DW_AT_comp_dir /root/gdb-icc-opaque
DW_AT_low_pc 0x4005ec
DW_AT_language DW_LANG_C89
DW_AT_name opaque.c
DW_AT_producer Intel(R) C Intel(R) 64 Compiler XE for
applications running on Intel(R) 64, Version 12.0.4.191 Build 20110427
Fixes SameLinkageName MemberPointers
DW_AT_stmt_list 121
LOCAL_SYMBOLS:
<1>< 209> DW_TAG_structure_type
DW_AT_decl_line 4
DW_AT_decl_column 8
DW_AT_decl_file 1 /root/gdb-icc-opaque/opaque.c
DW_AT_accessibility DW_ACCESS_public
DW_AT_byte_size 4
DW_AT_name opaque_t
--
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] 8+ messages in thread
* [Bug symtab/13277] gdb does not resolve opaque structures in binaries compiled with ICC.
2011-10-09 10:27 [Bug symtab/13277] New: gdb does not resolve opaque structures in binaries compiled with ICC toojays at toojays dot net
@ 2011-10-09 10:32 ` toojays at toojays dot net
2011-10-09 10:40 ` toojays at toojays dot net
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: toojays at toojays dot net @ 2011-10-09 10:32 UTC (permalink / raw)
To: gdb-prs
http://sourceware.org/bugzilla/show_bug.cgi?id=13277
--- Comment #1 from John Steele Scott <toojays at toojays dot net> 2011-10-09 10:32:20 UTC ---
Created attachment 5968
--> http://sourceware.org/bugzilla/attachment.cgi?id=5968
Simple test case which can be used to demonstrate bug 13277.
The attached tarball contains the source code for this testcase. Binaries
produced with ICC and GCC are also included for comparison.
The ICC binary was produced with 'CC="icc -debug extended" make'.
The GCC binary was produced with 'CC="gcc -g" make'.
--
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] 8+ messages in thread
* [Bug symtab/13277] gdb does not resolve opaque structures in binaries compiled with ICC.
2011-10-09 10:27 [Bug symtab/13277] New: gdb does not resolve opaque structures in binaries compiled with ICC toojays at toojays dot net
2011-10-09 10:32 ` [Bug symtab/13277] " toojays at toojays dot net
@ 2011-10-09 10:40 ` toojays at toojays dot net
2011-10-10 19:04 ` tromey at redhat dot com
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: toojays at toojays dot net @ 2011-10-09 10:40 UTC (permalink / raw)
To: gdb-prs
http://sourceware.org/bugzilla/show_bug.cgi?id=13277
--- Comment #2 from John Steele Scott <toojays at toojays dot net> 2011-10-09 10:39:38 UTC ---
Created attachment 5969
--> http://sourceware.org/bugzilla/attachment.cgi?id=5969
Patch against gdb-7.3.1 to resolve opaque types on ICC compiled binaries.
This patch against gdb-7.3.1 sets the "stub" flag on structures with a zero
size attribute, which allows GDB to resolve the opaque structure pointers
produced by ICC.
--
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] 8+ messages in thread
* [Bug symtab/13277] gdb does not resolve opaque structures in binaries compiled with ICC.
2011-10-09 10:27 [Bug symtab/13277] New: gdb does not resolve opaque structures in binaries compiled with ICC toojays at toojays dot net
2011-10-09 10:32 ` [Bug symtab/13277] " toojays at toojays dot net
2011-10-09 10:40 ` toojays at toojays dot net
@ 2011-10-10 19:04 ` tromey at redhat dot com
2011-10-16 21:48 ` toojays at toojays dot net
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: tromey at redhat dot com @ 2011-10-10 19:04 UTC (permalink / raw)
To: gdb-prs
http://sourceware.org/bugzilla/show_bug.cgi?id=13277
Tom Tromey <tromey at redhat dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |tromey at redhat dot com
--- Comment #3 from Tom Tromey <tromey at redhat dot com> 2011-10-10 19:03:58 UTC ---
For the patch, please follow:
http://sourceware.org/gdb/contribute/
--
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] 8+ messages in thread
* [Bug symtab/13277] gdb does not resolve opaque structures in binaries compiled with ICC.
2011-10-09 10:27 [Bug symtab/13277] New: gdb does not resolve opaque structures in binaries compiled with ICC toojays at toojays dot net
` (2 preceding siblings ...)
2011-10-10 19:04 ` tromey at redhat dot com
@ 2011-10-16 21:48 ` toojays at toojays dot net
2011-11-13 9:18 ` toojays at toojays dot net
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: toojays at toojays dot net @ 2011-10-16 21:48 UTC (permalink / raw)
To: gdb-prs
http://sourceware.org/bugzilla/show_bug.cgi?id=13277
--- Comment #4 from John Steele Scott <toojays at toojays dot net> 2011-10-16 21:47:12 UTC ---
Patch submission is at
http://sourceware.org/ml/gdb-patches/2011-10/msg00442.html
--
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] 8+ messages in thread
* [Bug symtab/13277] gdb does not resolve opaque structures in binaries compiled with ICC.
2011-10-09 10:27 [Bug symtab/13277] New: gdb does not resolve opaque structures in binaries compiled with ICC toojays at toojays dot net
` (3 preceding siblings ...)
2011-10-16 21:48 ` toojays at toojays dot net
@ 2011-11-13 9:18 ` toojays at toojays dot net
2012-05-24 22:09 ` cvs-commit at gcc dot gnu.org
2012-05-24 22:28 ` jan.kratochvil at redhat dot com
6 siblings, 0 replies; 8+ messages in thread
From: toojays at toojays dot net @ 2011-11-13 9:18 UTC (permalink / raw)
To: gdb-prs
http://sourceware.org/bugzilla/show_bug.cgi?id=13277
John Steele Scott <toojays at toojays dot net> changed:
What |Removed |Added
----------------------------------------------------------------------------
Attachment #5968|0 |1
is obsolete| |
--- Comment #5 from John Steele Scott <toojays at toojays dot net> 2011-11-13 09:18:20 UTC ---
Created attachment 6055
--> http://sourceware.org/bugzilla/attachment.cgi?id=6055
Simple test case which can be used to demonstrate bug 13277.
I've made a simpler testcase, which I'm attaching here.
The tarball also includes the assembler generated by ICC. I've used that to
construct a test case suitable for committing to the GDB mainline, I'll send
that to gdb-patches shortly.
--
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] 8+ messages in thread
* [Bug symtab/13277] gdb does not resolve opaque structures in binaries compiled with ICC.
2011-10-09 10:27 [Bug symtab/13277] New: gdb does not resolve opaque structures in binaries compiled with ICC toojays at toojays dot net
` (4 preceding siblings ...)
2011-11-13 9:18 ` toojays at toojays dot net
@ 2012-05-24 22:09 ` cvs-commit at gcc dot gnu.org
2012-05-24 22:28 ` jan.kratochvil at redhat dot com
6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2012-05-24 22:09 UTC (permalink / raw)
To: gdb-prs
http://sourceware.org/bugzilla/show_bug.cgi?id=13277
--- Comment #6 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> 2012-05-24 22:09:26 UTC ---
CVSROOT: /cvs/src
Module name: src
Changes by: jkratoch@sourceware.org 2012-05-24 22:09:21
Modified files:
gdb : ChangeLog dwarf2read.c
gdb/testsuite : ChangeLog
Added files:
gdb/testsuite/gdb.dwarf2: dw2-icc-opaque.S dw2-icc-opaque.exp
Log message:
gdb/
PR symtab/13277: Resolving opaque structures in ICC generated binaries.
* dwarf2read.c (struct dwarf2_cu) <producer_is_icc>: New field.
(producer_is_gxx_lt_4_6): Move the checking and caching to...
(check_producer): ... this new function, which also checks for ICC
and caches the result.
(producer_is_icc): New function.
(read_structure_type): Don't set TYPE_STUB_SUPPORTED if the
producer was ICC.
gdb/testsuite/
PR symtab/13277: Resolving opaque structures in ICC generated binaries.
* gdb.dwarf2/dw2-icc-opaque.S: New file.
* gdb.dwarf2/dw2-icc-opaque.exp: New file.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/ChangeLog.diff?cvsroot=src&r1=1.14292&r2=1.14293
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/dwarf2read.c.diff?cvsroot=src&r1=1.655&r2=1.656
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/ChangeLog.diff?cvsroot=src&r1=1.3205&r2=1.3206
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/gdb.dwarf2/dw2-icc-opaque.S.diff?cvsroot=src&r1=NONE&r2=1.1
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/gdb.dwarf2/dw2-icc-opaque.exp.diff?cvsroot=src&r1=NONE&r2=1.1
--
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] 8+ messages in thread
* [Bug symtab/13277] gdb does not resolve opaque structures in binaries compiled with ICC.
2011-10-09 10:27 [Bug symtab/13277] New: gdb does not resolve opaque structures in binaries compiled with ICC toojays at toojays dot net
` (5 preceding siblings ...)
2012-05-24 22:09 ` cvs-commit at gcc dot gnu.org
@ 2012-05-24 22:28 ` jan.kratochvil at redhat dot com
6 siblings, 0 replies; 8+ messages in thread
From: jan.kratochvil at redhat dot com @ 2012-05-24 22:28 UTC (permalink / raw)
To: gdb-prs
http://sourceware.org/bugzilla/show_bug.cgi?id=13277
Jan Kratochvil <jan.kratochvil at redhat dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
CC| |jan.kratochvil at redhat
| |dot com
Resolution| |FIXED
AssignedTo|unassigned at sourceware |toojays at toojays dot net
|dot org |
--- Comment #7 from Jan Kratochvil <jan.kratochvil at redhat dot com> 2012-05-24 22:28:05 UTC ---
Checked in.
--
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] 8+ messages in thread
end of thread, other threads:[~2012-05-24 22:28 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-09 10:27 [Bug symtab/13277] New: gdb does not resolve opaque structures in binaries compiled with ICC toojays at toojays dot net
2011-10-09 10:32 ` [Bug symtab/13277] " toojays at toojays dot net
2011-10-09 10:40 ` toojays at toojays dot net
2011-10-10 19:04 ` tromey at redhat dot com
2011-10-16 21:48 ` toojays at toojays dot net
2011-11-13 9:18 ` toojays at toojays dot net
2012-05-24 22:09 ` cvs-commit at gcc dot gnu.org
2012-05-24 22:28 ` jan.kratochvil 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).