From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16519 invoked by alias); 9 Oct 2011 10:27:54 -0000 Received: (qmail 16492 invoked by uid 22791); 9 Oct 2011 10:27:53 -0000 X-SWARE-Spam-Status: No, hits=-2.8 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,TW_TM X-Spam-Check-By: sourceware.org Received: from localhost (HELO sourceware.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 09 Oct 2011 10:27:40 +0000 From: "toojays at toojays dot net" To: gdb-prs@sourceware.org Subject: [Bug symtab/13277] New: gdb does not resolve opaque structures in binaries compiled with ICC. Date: Sun, 09 Oct 2011 10:27:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: symtab X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: toojays at toojays dot net X-Bugzilla-Status: NEW X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact gdb-prs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-prs-owner@sourceware.org X-SW-Source: 2011-q4/txt/msg00039.txt.bz2 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 #include 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 #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 = {} 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
: <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 [ 0]DW_OP_breg7+8 [ 1]DW_OP_breg7+16 [ 2]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
: <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
: <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
: <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.