Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: John Steele Scott <toojays@toojays.net>
To: Joel Brobecker <brobecker@adacore.com>
Cc: Tom Tromey <tromey@redhat.com>,
	Jan Kratochvil <jan.kratochvil@redhat.com>,
	gdb-patches@sourceware.org
Subject: Re: [patch] PR symtab/13277: Resolving opaque structures in ICC generated binaries. (testcase)
Date: Sat, 12 May 2012 09:00:00 -0000	[thread overview]
Message-ID: <87wr4h4vvd.fsf@quantum.com> (raw)
In-Reply-To: <20120505151557.GU15555@adacore.com>

Joel Brobecker <brobecker@adacore.com> writes:

>> Wow, I knew it would take a while, but it seems the papers got stuck
>> in limbo for several months.
>
> :-(. That is just not right. If I had known, I'd have pinged the FSF.
>
>> 2012-05-05  John Steele Scott  <toojays@toojays.net>
>> 
>> 	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.
>
> The only issue I spotted with this patch is the copyright year, which
> needs to include 2012 as well, now. And while we are touching this,
> why not add a '(C)' as well. I know we're very inconsistent with this,
> but the the GNU Coding Standard shows it in all their example, and I
> have a feeling that they would rather we did. So:
>
>   Copyright (C) 2011-2012 Free etc.

Updated patch is below.

> Not sure about the use of .asciz or not. We seem to have been using
> .ascii exclusively so far. Jan might know better whether that's ok.

I left the .asciz in; there is already a use of it in
testsuite/gdb.python/py-section-script.c.

For reference: the patch at
http://sourceware.org/ml/gdb-patches/2012-05/msg00144.html is required
for gdb to pass this test.

cheers,

John

2012-05-12  John Steele Scott  <toojays@toojays.net>

	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.

diff --git a/gdb/testsuite/gdb.dwarf2/dw2-icc-opaque.S b/gdb/testsuite/gdb.dwarf2/dw2-icc-opaque.S
new file mode 100644
index 0000000..4fc6512
--- /dev/null
+++ b/gdb/testsuite/gdb.dwarf2/dw2-icc-opaque.S
@@ -0,0 +1,192 @@
+/* Copyright (C) 2011-2012 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+	.file "opaque-pointer.c"
+	.data
+	.comm p_struct,8,8
+	.global p_struct#
+
+	.section .debug_info
+	.align 1
+debug_info_seg1:
+	.4byte debug_info_seg1_end - 1f	/* Length of compilation unit info. */
+1:
+	.2byte 0x0002			/* DWARF version number. */
+	.4byte .debug_abbrev_seg1	/* Points to abbrev section for this unit. */
+	.byte 0x08			/* Target address size. */
+
+	.byte 0x01			/* DIE 1: DW_TAG_compile_unit. */
+	.byte 0x01			/* DW_AT_language = DW_LANG_C89. */
+	.ascii "Intel(R) C Intel(R) 64 Compiler XE "	/* DW_AT_producer. */
+	.ascii "for applications running on Intel(R) 64, "
+	.ascii "Version 12.0.4.191 Build 20110427\n "
+	.asciz "Fixes SameLinkageName MemberPointers"
+
+	.byte 0x02			/* DIE 2: DW_TAG_variable. */
+	.byte 0x01			/* DW_AT_accessibility. */
+	.asciz "p_struct"		/* DW_AT_name. */
+	.4byte 3f - debug_info_seg1	/* DW_AT_type. */
+	.2byte 0x0309			/* DW_AT_location: 9 bytes, DW_OP_addr */
+	.8byte p_struct			/* followed by the address of p_struct. */
+	.byte 0x01			/* DW_AT_external. */
+
+3:
+	.byte 0x03			/* DIE 3: DW_TAG_pointer_type. */
+	.4byte 4f - debug_info_seg1	/* DW_AT_type. */
+
+4:
+	.byte 0x04			/* DIE 4: DW_TAG_structure_type. */
+	.byte 0x01			/* DW_AT_accessibility. */
+	.byte 0x00			/* DW_AT_byte_size. */
+	.asciz "opaque_struct_t"	/* DW_AT_name. */
+	.byte 0x00
+	.byte 0x00
+	.byte 0x00
+	.byte 0x00
+debug_info_seg1_end:
+
+	.section .debug_abbrev
+.debug_abbrev_seg1:
+	.align 1
+	.byte 0x01	/* Abbrev 1. */
+	.byte 0x11	/* DW_TAG_compile_unit. */
+	.byte 0x01	/* DW_CHILDREN_yes. */
+	.byte 0x13	/* DW_AT_language. */
+	.byte 0x0b	/* DW_FORM_data1. */
+	.byte 0x25	/* DW_AT_producer. */
+	.byte 0x08	/* DW_AT_string. */
+	.2byte 0x0000	/* End abbrev. */
+
+	.byte 0x02	/* Abbrev 2. */
+	.byte 0x34	/* DW_TAG_variable. */
+	.byte 0x00	/* DW_CHILDREN_no. */
+	.byte 0x32	/* DW_AT_accessibility. */
+	.byte 0x0b	/* DW_FORM_data1. */
+	.byte 0x03	/* DW_AT_name. */
+	.byte 0x08	/* DW_FORM_string. */
+	.byte 0x49	/* DW_AT_type. */
+	.byte 0x13	/* DW_FORM_ref4. */
+	.byte 0x02	/* DW_AT_location. */
+	.byte 0x0a	/* DW_FORM_block1. */
+	.byte 0x3f	/* DW_AT_external. */
+	.byte 0x0c	/* DW_FORM_flag. */
+	.2byte 0x0000	/* End abbrev. */
+
+	.byte 0x03	/* Abbrev 3. */
+	.byte 0x0f	/* DW_TAG_pointer_type. */
+	.byte 0x00	/* DW_CHILDREN_no. */
+	.byte 0x49	/* DW_AT_type. */
+	.byte 0x13	/* DW_FORM_ref4. */
+	.2byte 0x0000	/* End abbrev. */
+
+	.byte 0x04	/* Abbrev 4. */
+	.byte 0x13	/* DW_TAG_structure_type. */
+	.byte 0x00	/* DW_CHILDREN_no. */
+	.byte 0x32	/* DW_AT_accessibility. */
+	.byte 0x0b	/* DW_FORM_data1. */
+	.byte 0x0b	/* DW_AT_byte_size. */
+	.byte 0x0b	/* DW_FORM_data1. */
+	.byte 0x03	/* DW_AT_name. */
+	.byte 0x08	/* DW_FORM_string. */
+	.2byte 0x0000	/* End abbrev. */
+	.byte 0x00	/* End abbrev table. */
+
+
+	.file "opaque-struct.c"
+	.section .debug_info
+	.align 1
+debug_info_seg2:
+	.4byte debug_info_seg2_end - 1f	/* Length of compilation unit info. */
+1:
+	.2byte 0x0002			/* DWARF version number. */
+	.4byte .debug_abbrev_seg2	/* Points to abbrev section for this unit. */
+	.byte 0x08			/* Target address size. */
+
+	.byte 0x01			/* DIE 1: DW_TAG_compile_unit. */
+	.byte 0x01			/* DW_AT_language = DW_LANG_C89. */
+	.ascii "Intel(R) C Intel(R) 64 Compiler XE "	/* DW_AT_producer. */
+	.ascii "for applications running on Intel(R) 64, "
+	.ascii "Version 12.0.4.191 Build 20110427\n "
+	.asciz "Fixes SameLinkageName MemberPointers"
+
+	.byte 0x02			/* DIE 2: DW_TAG_structure_type. */
+	.byte 0x01			/* DW_AT_accessibility. */
+	.byte 0x04			/* DW_AT_byte_size. */
+	.asciz "opaque_struct_t"	/* DW_AT_name. */
+
+
+	.byte 0x03			/* DIE 3: DW_TAG_member. */
+	.2byte 0x2302			/* DW_AT_data_member_location, 2 bytes, */
+	.byte 0x00			/* DW_OP_plus_uconst followed by zero. */
+	.asciz "wrapped_value"		/* DW_AT_name. */
+	.4byte 4f - debug_info_seg2	/* DW_AT_type. */
+	.byte 0x00
+
+4:
+	.byte 0x04			/* DIE 4: DW_TAG_base_type. */
+	.byte 0x04			/* DW_AT_byte_size. */
+	.byte 0x05			/* DW_AT_encoding. */
+	.asciz "int"			/* DW_AT_name. */
+	.byte 0x00
+	.byte 0x00
+	.byte 0x00
+	.byte 0x00
+debug_info_seg2_end:
+
+	.section .debug_abbrev
+.debug_abbrev_seg2:
+	.align 1
+	.byte 0x01	/* Abbrev 1. */
+	.byte 0x11	/* DW_TAG_compile_unit. */
+	.byte 0x01	/* DW_CHILDREN_yes. */
+	.byte 0x13	/* DW_AT_language. */
+	.byte 0x0b	/* DW_FORM_data1. */
+	.byte 0x25	/* DW_AT_producer. */
+	.byte 0x08	/* DW_FORM_string. */
+	.2byte 0x0000	/* End abbrev. */
+
+	.byte 0x02	/* Abbrev 2. */
+	.byte 0x13	/* DW_TAG_structure_type. */
+	.byte 0x01	/* DW_CHILDREN_yes. */
+	.byte 0x32	/* DW_AT_accessibility. */
+	.byte 0x0b	/* DW_FORM_data1. */
+	.byte 0x0b	/* DW_AT_byte_size. */
+	.byte 0x0b	/* DW_FORM_data1. */
+	.byte 0x03	/* DW_AT_name. */
+	.byte 0x08	/* DW_FORM_string. */
+	.2byte 0x0000	/* End abbrev. */
+
+	.byte 0x03	/* Abbrev 3. */
+	.byte 0x0d	/* DW_TAG_member. */
+	.byte 0x00	/* DW_CHILDREN_no. */
+	.byte 0x38	/* DW_AT_data_member_location. */
+	.byte 0x0a	/* DW_FORM_block1. */
+	.byte 0x03	/* DW_AT_name. */
+	.byte 0x08	/* DW_FORM_string. */
+	.byte 0x49	/* DW_AT_type. */
+	.byte 0x13	/* DW_FORM_ref4. */
+	.2byte 0x0000	/* End abbrev. */
+
+	.byte 0x04	/* Abbrev 4. */
+	.byte 0x24	/* DW_TAG_base_type. */
+	.byte 0x00	/* DW_CHILDREN_no. */
+	.byte 0x0b	/* DW_AT_byte_size. */
+	.byte 0x0b	/* DW_FORM_data1. */
+	.byte 0x3e	/* DW_AT_encoding. */
+	.byte 0x0b	/* DW_FORM_data1. */
+	.byte 0x03	/* DW_AT_name. */
+	.byte 0x08	/* DW_FORM_string. */
+	.2byte 0x0000	/* End abbrev. */
+	.byte 0x00	/* End abbrev table. */
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-icc-opaque.exp b/gdb/testsuite/gdb.dwarf2/dw2-icc-opaque.exp
new file mode 100644
index 0000000..53db400
--- /dev/null
+++ b/gdb/testsuite/gdb.dwarf2/dw2-icc-opaque.exp
@@ -0,0 +1,37 @@
+# Copyright (C) 2011-2012 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+load_lib dwarf.exp
+
+# This test can only be run on targets which support DWARF-2 and use gas.
+if {![dwarf2_support]} {
+    return 0
+}
+
+set testfile "dw2-icc-opaque"
+set srcfile ${testfile}.S
+set executable ${testfile}.x
+set binfile ${objdir}/${subdir}/${executable}
+
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" object {}] != "" } {
+    return -1
+}
+
+clean_restart $executable
+
+# Before PR 13277 was fixed, this would output:
+# type = struct opaque_struct_t {
+#     <no data fields>
+# } *
+gdb_test "ptype p_struct" "type = struct opaque_struct_t {\r\n *int wrapped_value;\r\n} \\*"


  parent reply	other threads:[~2012-05-12  9:00 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-16  8:03 [patch] PR symtab/13277: Resolving opaque structures in ICC generated binaries John Steele Scott
2011-10-19  9:01 ` Jan Kratochvil
2011-10-19 13:54   ` Jan Kratochvil
2011-10-23 18:29     ` John Steele Scott
2011-10-24  0:13       ` Joel Brobecker
2011-10-27 19:57       ` Tom Tromey
2011-10-23 10:26   ` John Steele Scott
2011-10-26 23:09     ` Jan Kratochvil
2011-11-13 11:38       ` [patch] PR symtab/13277: Resolving opaque structures in ICC generated binaries. (testcase) John Steele Scott
2011-11-15 17:04         ` Tom Tromey
2012-05-05  2:40           ` John Steele Scott
2012-05-05 15:16             ` Joel Brobecker
2012-05-05 15:36               ` Jan Kratochvil
2012-05-12  9:00               ` John Steele Scott [this message]
2012-05-12 18:38                 ` Jan Kratochvil
2012-05-12 19:09                   ` Joel Brobecker
2012-05-21 12:05                   ` John Steele Scott
2012-05-21 12:08                     ` John Steele Scott
2012-05-24 23:06                       ` [commit] " Jan Kratochvil
2012-05-21 12:17                     ` Jan Kratochvil
2011-11-13 12:13       ` [patch] PR symtab/13277: Resolving opaque structures in ICC generated binaries John Steele Scott
2011-11-15 17:19         ` Tom Tromey
2011-11-15 23:58           ` Jan Kratochvil
2012-05-05  2:32           ` John Steele Scott
2012-05-12 18:37             ` Jan Kratochvil
2012-05-14 13:55               ` John Steele Scott
     [not found]                 ` <20120518144642.GA19690@host2.jankratochvil.net>
2012-05-20 12:34                   ` John Steele Scott
     [not found]                     ` <20120520130919.GA6990@host2.jankratochvil.net>
2012-05-20 13:17                       ` Jan Kratochvil
2012-05-20 13:44                         ` John Steele Scott
2012-05-23 23:29                         ` John Steele Scott
2012-05-24 15:16                           ` Pedro Alves
2012-05-24 22:13                           ` [commit] " Jan Kratochvil
2012-05-24 23:05                             ` John Steele Scott
2012-05-24 22:16                         ` [commit TYPE_OPAQUE] " Jan Kratochvil
2012-05-21  0:12                     ` Doug Evans
2012-05-20 13:17                   ` Jan Kratochvil

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87wr4h4vvd.fsf@quantum.com \
    --to=toojays@toojays.net \
    --cc=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    --cc=jan.kratochvil@redhat.com \
    --cc=tromey@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox