public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "mjw at redhat dot com" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug breakpoints/15826] Slow symbol lookups during conditional breakpoints
Date: Sat, 31 Aug 2013 21:43:00 -0000	[thread overview]
Message-ID: <bug-15826-4717-rXMA8M4aSI@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-15826-4717@http.sourceware.org/bugzilla/>

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.


  parent reply	other threads:[~2013-08-31 21:43 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-08 21:10 [Bug breakpoints/15826] New: " mjw at redhat dot com
2013-08-08 21:17 ` [Bug breakpoints/15826] " mjw at redhat dot com
2013-08-15 17:29 ` dje at google dot com
2013-08-15 18:34 ` mjw at redhat dot com
2013-08-15 18:42 ` dje at google dot com
2013-08-31 21:43 ` mjw at redhat dot com [this message]
2013-09-01 10:23 ` mjw at redhat dot com
2013-09-01 20:40 ` mjw at redhat dot com
2013-09-05 21:13 ` mjw at redhat dot com
2014-02-17 16:00 ` markus.mohrhard at googlemail dot com
2014-05-29 21:53 ` [Bug symtab/15826] " dje at google dot com
2014-06-03  9:35 ` mjw at redhat dot com
2023-03-06 23:33 ` tromey at sourceware dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-15826-4717-rXMA8M4aSI@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).