diff options
author | Jan Kratochvil <jan.kratochvil@redhat.com> | 2012-12-09 17:35:42 +0000 |
---|---|---|
committer | Jan Kratochvil <jan.kratochvil@redhat.com> | 2012-12-09 17:35:42 +0000 |
commit | 1b80a9fa753094ce0a6a4b3aa133c9b55e3c12ce (patch) | |
tree | 27b3c5b81fc21543d68f5afe7d2fd9cff85555c6 /gdb/dwarf2read.c | |
parent | 8f072179955ab72e58da4790823b638e1709c89d (diff) | |
download | gdb-1b80a9fa753094ce0a6a4b3aa133c9b55e3c12ce.zip gdb-1b80a9fa753094ce0a6a4b3aa133c9b55e3c12ce.tar.gz gdb-1b80a9fa753094ce0a6a4b3aa133c9b55e3c12ce.tar.bz2 |
gdb/
* dwarf2read.c (struct dwarf2_cu): New field producer_is_gcc_lt_4_3.
Update the comment for checked_producer.
(check_producer): New forward declaration.
(producer_is_gcc_lt_4_3): New function.
(find_file_and_directory): Simulate *COMP_DIR only for gcc < 4.3.
(check_producer): Initialize also PRODUCER_IS_GCC_LT_4_3.
gdb/testsuite/
* gdb.dwarf2/dw2-compdir-oldgcc.S: New file.
* gdb.dwarf2/dw2-compdir-oldgcc.exp: New file.
Diffstat (limited to 'gdb/dwarf2read.c')
-rw-r--r-- | gdb/dwarf2read.c | 32 |
1 files changed, 26 insertions, 6 deletions
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index cd81eed..35e9bb4 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -495,12 +495,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 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. */ + /* These cache the results for producer_is_* fields. CHECKED_PRODUCER is set + if all the producer_is_* fields 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_gcc_lt_4_3 : 1; unsigned int producer_is_icc : 1; }; @@ -1713,6 +1714,8 @@ static void free_dwo_file_cleanup (void *); static void process_cu_includes (void); +static void check_producer (struct dwarf2_cu *cu); + #if WORDS_BIGENDIAN /* Convert VALUE between big- and little-endian. */ @@ -7805,6 +7808,19 @@ free_cu_line_header (void *arg) cu->line_header = NULL; } +/* Check for possibly missing DW_AT_comp_dir with relative .debug_line + directory paths. GCC SVN r127613 (new option -fdebug-prefix-map) fixed + this, it was first present in GCC release 4.3.0. */ + +static int +producer_is_gcc_lt_4_3 (struct dwarf2_cu *cu) +{ + if (!cu->checked_producer) + check_producer (cu); + + return cu->producer_is_gcc_lt_4_3; +} + static void find_file_and_directory (struct die_info *die, struct dwarf2_cu *cu, char **name, char **comp_dir) @@ -7825,7 +7841,8 @@ find_file_and_directory (struct die_info *die, struct dwarf2_cu *cu, attr = dwarf2_attr (die, DW_AT_comp_dir, cu); if (attr) *comp_dir = DW_STRING (attr); - else if (*name != NULL && IS_ABSOLUTE_PATH (*name)) + else if (producer_is_gcc_lt_4_3 (cu) && *name != NULL + && IS_ABSOLUTE_PATH (*name)) { *comp_dir = ldirname (*name); if (*comp_dir != NULL) @@ -10359,7 +10376,10 @@ check_producer (struct dwarf2_cu *cu) /* Not recognized as GCC. */ } else - cu->producer_is_gxx_lt_4_6 = major < 4 || (major == 4 && minor < 6); + { + cu->producer_is_gxx_lt_4_6 = major < 4 || (major == 4 && minor < 6); + cu->producer_is_gcc_lt_4_3 = major < 4 || (major == 4 && minor < 3); + } } else if (strncmp (cu->producer, "Intel(R) C", strlen ("Intel(R) C")) == 0) cu->producer_is_icc = 1; |