[Ada/tasks] Optimize ATCB lookups
authorJoel Brobecker <brobecker@gnat.com>
Tue, 23 Nov 2010 01:04:54 +0000 (01:04 +0000)
committerJoel Brobecker <brobecker@gnat.com>
Tue, 23 Nov 2010 01:04:54 +0000 (01:04 +0000)
Type symbols that are used to decode the Ada task control block may be
duplicated in any unit that uses a tasking feature; an Ada lookup of
these symbols would collect all the duplicated instances and could
provoke the load of a huge amount of debug symbols in the process.

However, when decoding the task information, we are only interested in
one instance; and we have the full name of the symbol anyway. So use
a C lookup instead of an Ada lookup.

2010-11-05  Jerome Guitton  <guitton@adacore.com>

* ada-tasks.c (get_tcb_types_info): Use C lookups to get
ATCB symbols.

gdb/ChangeLog
gdb/ada-tasks.c

index 15ed81bb52c0842a43480e2ece182a7783243225..1462d74e003e6b81e5996f26f826ccd24d4e68c6 100644 (file)
@@ -1,3 +1,8 @@
+2010-11-22  Jerome Guitton  <guitton@adacore.com>
+
+       * ada-tasks.c (get_tcb_types_info): Use C lookups to get
+       ATCB symbols.
+
 2010-11-22  Joel Brobecker  <brobecker@adacore.com>
 
        * ada-lang.c (ada_check_typedef): Call ada_check_typedef only
index 3cbcc4fe4df35c86ffbe8879ebedc4277b1e705b..90502e8c80b8fba537fa94fa404a2e48f3b73014 100644 (file)
@@ -380,20 +380,29 @@ get_tcb_types_info (struct type **atcb_type,
   const char *private_data_name = "system__task_primitives__private_data";
   const char *entry_call_record_name = "system__tasking__entry_call_record";
 
+  /* ATCB symbols may be found in several compilation units. As we
+     are only interested in one instance, use standard (literal,
+     C-like) lookups to get the first match.  */
+
   struct symbol *atcb_sym =
-    lookup_symbol (atcb_name, NULL, VAR_DOMAIN, NULL);
+    lookup_symbol_in_language (atcb_name, NULL, VAR_DOMAIN,
+                              language_c, NULL);
   const struct symbol *common_atcb_sym =
-    lookup_symbol (common_atcb_name, NULL, VAR_DOMAIN, NULL);
+    lookup_symbol_in_language (common_atcb_name, NULL, VAR_DOMAIN,
+                              language_c, NULL);
   const struct symbol *private_data_sym =
-    lookup_symbol (private_data_name, NULL, VAR_DOMAIN, NULL);
+    lookup_symbol_in_language (private_data_name, NULL, VAR_DOMAIN,
+                              language_c, NULL);
   const struct symbol *entry_call_record_sym =
-    lookup_symbol (entry_call_record_name, NULL, VAR_DOMAIN, NULL);
+    lookup_symbol_in_language (entry_call_record_name, NULL, VAR_DOMAIN,
+                              language_c, NULL);
 
   if (atcb_sym == NULL || atcb_sym->type == NULL)
     {
       /* In Ravenscar run-time libs, the  ATCB does not have a dynamic
          size, so the symbol name differs.  */
-      atcb_sym = lookup_symbol (atcb_name_fixed, NULL, VAR_DOMAIN, NULL);
+      atcb_sym = lookup_symbol_in_language (atcb_name_fixed, NULL, VAR_DOMAIN,
+                                           language_c, NULL);
 
       if (atcb_sym == NULL || atcb_sym->type == NULL)
         error (_("Cannot find Ada_Task_Control_Block type. Aborting"));