This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug breakpoints/15826] Slow symbol lookups during conditional breakpoints


https://sourceware.org/bugzilla/show_bug.cgi?id=15826

--- Comment #5 from Mark Wielaard <mjw at redhat dot com> ---
It does seem the boolean standard type is "extra special":

struct type *
language_bool_type (const struct language_defn *la,
                    struct gdbarch *gdbarch)
{
  struct language_gdbarch *ld = gdbarch_data (gdbarch,
                                              language_gdbarch_data);

  if (ld->arch_info[la->la_language].bool_type_symbol)
    {
      struct symbol *sym;

      sym = lookup_symbol (ld->arch_info[la->la_language].bool_type_symbol,
                           NULL, VAR_DOMAIN, NULL);
      if (sym)
        {
          struct type *type = SYMBOL_TYPE (sym);

          if (type && TYPE_CODE (type) == TYPE_CODE_BOOL)
            return type;
        }
    }

  return ld->arch_info[la->la_language].bool_type_default;
}

The above is why "bool" is always looked up.
Other standard types don't have this extra lookup to override the default.

cplus_language_arch_info () does set bool_type_symbol = "bool". But is that
really correct? You cannot override bool in C++ since it is a built-in type.

So, possible, untested, "fix":

diff --git a/gdb/c-lang.c b/gdb/c-lang.c
index 48a1fb0..e2201b4 100644
--- a/gdb/c-lang.c
+++ b/gdb/c-lang.c
@@ -931,7 +931,7 @@ cplus_language_arch_info (struct gdbarch *gdbarch,
   lai->primitive_type_vector [cplus_primitive_type_declong]
     = builtin->builtin_declong;

-  lai->bool_type_symbol = "bool";
+  lai->bool_type_symbol = NULL; // "bool" is always a built-in type.
   lai->bool_type_default = builtin->builtin_bool;
 }

-- 
You are receiving this mail because:
You are on the CC list for the bug.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]