aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2012-03-09 20:17:32 +0000
committerTom Tromey <tromey@redhat.com>2012-03-09 20:17:32 +0000
commitba919b5861d042cba5fe228faa71505370937df4 (patch)
tree16e30e466eca543dcb599f20d5d8048e61ecfb9b
parenta48e046c37f9e3914710a4726db12ded2b9c939f (diff)
downloadgdb-ba919b5861d042cba5fe228faa71505370937df4.zip
gdb-ba919b5861d042cba5fe228faa71505370937df4.tar.gz
gdb-ba919b5861d042cba5fe228faa71505370937df4.tar.bz2
* dwarf2read.c (struct dwarf2_cu) <checked_producer,
producer_is_gxx_lt_4_6>: New fields. (producer_is_gxx_lt_4_6): Use and update producer cache fields.
-rw-r--r--gdb/ChangeLog6
-rw-r--r--gdb/dwarf2read.c35
2 files changed, 31 insertions, 10 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index d458636..e25d5dd 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,11 @@
2012-03-09 Tom Tromey <tromey@redhat.com>
+ * dwarf2read.c (struct dwarf2_cu) <checked_producer,
+ producer_is_gxx_lt_4_6>: New fields.
+ (producer_is_gxx_lt_4_6): Use and update producer cache fields.
+
+2012-03-09 Tom Tromey <tromey@redhat.com>
+
* dwarf2read.c (dwarf2_attr): Avoid tail-recursive call.
2012-03-08 Joel Brobecker <brobecker@adacore.com>
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 9133178..ebe855b 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -383,6 +383,13 @@ struct dwarf2_cu
any location list and still facing inlining issues if handled as
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. */
+ unsigned int checked_producer : 1;
+ unsigned int producer_is_gxx_lt_4_6 : 1;
};
/* Persistent data held for a compilation unit, even when not
@@ -6826,6 +6833,7 @@ producer_is_gxx_lt_4_6 (struct dwarf2_cu *cu)
{
const char *cs;
int major, minor, release;
+ int result = 0;
if (cu->producer == NULL)
{
@@ -6841,26 +6849,33 @@ producer_is_gxx_lt_4_6 (struct dwarf2_cu *cu)
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. */
-
- return 0;
}
- cs = &cu->producer[strlen ("GNU ")];
- while (*cs && !isdigit (*cs))
- cs++;
- if (sscanf (cs, "%d.%d.%d", &major, &minor, &release) != 3)
+ else
{
- /* Not recognized as GCC. */
-
- return 0;
+ cs = &cu->producer[strlen ("GNU ")];
+ while (*cs && !isdigit (*cs))
+ cs++;
+ if (sscanf (cs, "%d.%d.%d", &major, &minor, &release) != 3)
+ {
+ /* Not recognized as GCC. */
+ }
+ else
+ result = major < 4 || (major == 4 && minor < 6);
}
- return major < 4 || (major == 4 && minor < 6);
+ cu->checked_producer = 1;
+ cu->producer_is_gxx_lt_4_6 = result;
+
+ return result;
}
/* Return the default accessibility type if it is not overriden by