diff options
author | Jan Kratochvil <jan.kratochvil@redhat.com> | 2012-05-24 22:09:21 +0000 |
---|---|---|
committer | Jan Kratochvil <jan.kratochvil@redhat.com> | 2012-05-24 22:09:21 +0000 |
commit | 685b110556624dff5bd9614edb016bad9b0642fc (patch) | |
tree | 64d053f31f925106a6e718c3dde77d56d850c704 /gdb/dwarf2read.c | |
parent | 2c1fa544e14e0fa78b842c50c03b49dcfd3f6e02 (diff) | |
download | gdb-685b110556624dff5bd9614edb016bad9b0642fc.zip gdb-685b110556624dff5bd9614edb016bad9b0642fc.tar.gz gdb-685b110556624dff5bd9614edb016bad9b0642fc.tar.bz2 |
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.
Diffstat (limited to 'gdb/dwarf2read.c')
-rw-r--r-- | gdb/dwarf2read.c | 80 |
1 files changed, 52 insertions, 28 deletions
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index b590134..53100c5 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -429,12 +429,13 @@ struct dwarf2_cu 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 @@ dwarf2_record_block_ranges (struct die_info *die, struct block *block, } } -/* 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 @@ producer_is_gxx_lt_4_6 (struct dwarf2_cu *cu) 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 @@ producer_is_gxx_lt_4_6 (struct dwarf2_cu *cu) /* 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 @@ quirk_gcc_member_function_pointer (struct type *type, struct objfile *objfile) 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 @@ read_structure_type (struct die_info *die, struct dwarf2_cu *cu) 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 |