From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: John Steele Scott <toojays@toojays.net>
Cc: Tom Tromey <tromey@redhat.com>,
gdb-patches@sourceware.org,
Joel Brobecker <brobecker@adacore.com>
Subject: [commit] [patch] PR symtab/13277: Resolving opaque structures in ICC generated binaries.
Date: Thu, 24 May 2012 22:13:00 -0000 [thread overview]
Message-ID: <20120524221219.GB516@host2.jankratochvil.net> (raw)
In-Reply-To: <87ipfmxyro.fsf@quantum.com>
On Thu, 24 May 2012 01:28:59 +0200, John Steele Scott wrote:
> Two tests in gdb.base/type-opaque effectively changed polarity: previously
> "opaque {struct,union} type resolving" failed, now those pass and "empty
> {struct,union} type resolving" fail. As previously discussed, this is the
> lesser of the two evils as far as I'm concerned.
This is a bug of ICC, GDB cannot do anything with it. To be absolutely
correct the testfile should check the output is generated by ICC and XFAIL (X
= that it depends on environment = compiler) such testcase. Personally I care
only about XFAILs/KFAILs for GCC.
main.c - where GDB searches from:
struct struct_libtype_empty {};
lib.c:
struct struct_libtype_empty { int libfield_empty; };
ptype pointer_struct_empty
type = volatile struct struct_libtype_empty {
- <no data fields>
+ int libfield_empty;
} *
-(gdb) PASS: gdb.base/type-opaque.exp: empty struct type resolving
+(gdb) FAIL: gdb.base/type-opaque.exp: empty struct type resolving
> The patch at http://sourceware.org/ml/gdb-patches/2012-05/msg00739.html is
> still required to fix my non-trivial case, I hope that (or something like it)
> can be committed soon.
Going to commit it now.
> +static int
> +producer_is_gxx_lt_4_6 (struct dwarf2_cu *cu)
> +{
> + if (!cu->checked_producer)
> + check_producer(cu);
Missing space:
check_producer (cu);
> +
> + return cu->producer_is_gxx_lt_4_6;
> }
[...]
> +static int
> +producer_is_icc (struct dwarf2_cu *cu)
> +{
> + if (!cu->checked_producer)
> + check_producer(cu);
Missing space:
check_producer (cu);
> +
> + return cu->producer_is_icc;
> +}
Checked in.
Thanks,
Jan
http://sourceware.org/ml/gdb-cvs/2012-05/msg00186.html
- the code part:
--- src/gdb/ChangeLog 2012/05/24 17:03:20 1.14292
+++ src/gdb/ChangeLog 2012/05/24 22:09:18 1.14293
@@ -1,3 +1,14 @@
+2012-05-24 John Steele Scott <toojays@toojays.net>
+
+ 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.
+
2012-05-24 Pedro Alves <palves@redhat.com>
PR gdb/7205
--- src/gdb/dwarf2read.c 2012/05/22 18:45:22 1.655
+++ src/gdb/dwarf2read.c 2012/05/24 22:09:20 1.656
@@ -429,12 +429,13 @@
unoptimized code. For a future better test see GCC PR other/32998. */
unsigned int has_loclist : 1;
- /* These cache the results of producer_is_gxx_lt_4_6.
- CHECKED_PRODUCER is set if PRODUCER_IS_GXX_LT_4_6 is valid. This
- information is cached because profiling CU expansion showed
- excessive time spent in producer_is_gxx_lt_4_6. */
+ /* These cache the results for producer_is_gxx_lt_4_6 and producer_is_icc.
+ CHECKED_PRODUCER is set if both PRODUCER_IS_GXX_LT_4_6 and PRODUCER_IS_ICC
+ are valid. This information is cached because profiling CU expansion
+ showed excessive time spent in producer_is_gxx_lt_4_6. */
unsigned int checked_producer : 1;
unsigned int producer_is_gxx_lt_4_6 : 1;
+ unsigned int producer_is_icc : 1;
/* Non-zero if DW_AT_addr_base was found.
Used when processing DWO files. */
@@ -8271,16 +8272,14 @@
}
}
-/* Check for GCC PR debug/45124 fix which is not present in any G++ version up
- to 4.5.any while it is present already in G++ 4.6.0 - the PR has been fixed
- during 4.6.0 experimental. */
+/* Check whether the producer field indicates either of GCC < 4.6, or the
+ Intel C/C++ compiler, and cache the result in CU. */
-static int
-producer_is_gxx_lt_4_6 (struct dwarf2_cu *cu)
+static void
+check_producer (struct dwarf2_cu *cu)
{
const char *cs;
int major, minor, release;
- int result = 0;
if (cu->producer == NULL)
{
@@ -8292,22 +8291,11 @@
for their space efficiency GDB cannot workaround gcc-4.5.x -gdwarf-4
combination. gcc-4.5.x -gdwarf-4 binaries have DW_AT_accessibility
interpreted incorrectly by GDB now - GCC PR debug/48229. */
-
- return 0;
- }
-
- if (cu->checked_producer)
- return cu->producer_is_gxx_lt_4_6;
-
- /* Skip any identifier after "GNU " - such as "C++" or "Java". */
-
- if (strncmp (cu->producer, "GNU ", strlen ("GNU ")) != 0)
- {
- /* For non-GCC compilers expect their behavior is DWARF version
- compliant. */
}
- else
+ else if (strncmp (cu->producer, "GNU ", strlen ("GNU ")) == 0)
{
+ /* Skip any identifier after "GNU " - such as "C++" or "Java". */
+
cs = &cu->producer[strlen ("GNU ")];
while (*cs && !isdigit (*cs))
cs++;
@@ -8316,13 +8304,30 @@
/* Not recognized as GCC. */
}
else
- result = major < 4 || (major == 4 && minor < 6);
+ cu->producer_is_gxx_lt_4_6 = major < 4 || (major == 4 && minor < 6);
+ }
+ else if (strncmp (cu->producer, "Intel(R) C", strlen ("Intel(R) C")) == 0)
+ cu->producer_is_icc = 1;
+ else
+ {
+ /* For other non-GCC compilers, expect their behavior is DWARF version
+ compliant. */
}
cu->checked_producer = 1;
- cu->producer_is_gxx_lt_4_6 = result;
+}
- return result;
+/* Check for GCC PR debug/45124 fix which is not present in any G++ version up
+ to 4.5.any while it is present already in G++ 4.6.0 - the PR has been fixed
+ during 4.6.0 experimental. */
+
+static int
+producer_is_gxx_lt_4_6 (struct dwarf2_cu *cu)
+{
+ if (!cu->checked_producer)
+ check_producer (cu);
+
+ return cu->producer_is_gxx_lt_4_6;
}
/* Return the default accessibility type if it is not overriden by
@@ -9005,6 +9010,18 @@
smash_to_methodptr_type (type, new_type);
}
+/* Return non-zero if the CU's PRODUCER string matches the Intel C/C++ compiler
+ (icc). */
+
+static int
+producer_is_icc (struct dwarf2_cu *cu)
+{
+ if (!cu->checked_producer)
+ check_producer (cu);
+
+ return cu->producer_is_icc;
+}
+
/* Called when we find the DIE that starts a structure or union scope
(definition) to create a type for the structure or union. Fill in
the type's name and general properties; the members will not be
@@ -9107,7 +9124,14 @@
TYPE_LENGTH (type) = 0;
}
- TYPE_STUB_SUPPORTED (type) = 1;
+ if (producer_is_icc (cu))
+ {
+ /* ICC does not output the required DW_AT_declaration
+ on incomplete types, but gives them a size of zero. */
+ }
+ else
+ TYPE_STUB_SUPPORTED (type) = 1;
+
if (die_is_declaration (die, cu))
TYPE_STUB (type) = 1;
else if (attr == NULL && die->child == NULL
next prev parent reply other threads:[~2012-05-24 22:13 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-16 8:03 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
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 ` Jan Kratochvil [this message]
2012-05-24 23:05 ` [commit] " 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=20120524221219.GB516@host2.jankratochvil.net \
--to=jan.kratochvil@redhat.com \
--cc=brobecker@adacore.com \
--cc=gdb-patches@sourceware.org \
--cc=toojays@toojays.net \
--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