Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Keith Seitz <keiths@redhat.com>
To: gdb-patches@sourceware.org
Subject: [RFA] breakpoint/12803
Date: Tue, 24 May 2011 19:00:00 -0000	[thread overview]
Message-ID: <4DDC0053.1020202@redhat.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 664 bytes --]

Hi,

This patch addresses breakpoint/12803, which deals with C++ minsym 
methods involving "const" and/or "volatile" attributes. keep_name_info 
was being guarded by current_language, and this caused a regression 
against gdb 7.1.

Keith

ChangeLog
2011-05-24  Keith Seitz  <keiths@redhat.com>

	PR breakpoint/12803
	* linespec.c (keep_name_info): Add handling for "volatile" keyword.
	(decode_compound): Unconditionally call	keep_name_info.

testsuite/ChangeLog
2011-05-24  Keith Seitz  <keiths@redhat.com>

	PR breakpoint/12803
	* gdb.cp/cmpd-minsyms.cc (a): New method.
	(b): New method.
	(c): New method.
	* gdb.cp/cmpd-minsyms.exp: Add tests for new methods.

[-- Attachment #2: 12803.patch --]
[-- Type: text/plain, Size: 2963 bytes --]

diff --git a/gdb/linespec.c b/gdb/linespec.c
index 871d37d..e8eaf59 100644
--- a/gdb/linespec.c
+++ b/gdb/linespec.c
@@ -731,12 +731,22 @@ keep_name_info (char *ptr)
     return remove_trailing_whitespace (start, ptr);
 
   /* Keep important keywords.  */  
-  while (isspace (*p))
-    ++p;
-  if (strncmp (p, "const", 5) == 0
-      && (isspace (p[5]) || p[5] == '\0'
-	  || strchr (get_gdb_completer_quote_characters (), p[5]) != NULL))
-    ptr = p = p + 5;
+  while (1)
+    {
+      char *quotes = get_gdb_completer_quote_characters ();
+      while (isspace (*p))
+	++p;
+      if (strncmp (p, "const", 5) == 0
+	  && (isspace (p[5]) || p[5] == '\0'
+	      || strchr (quotes, p[5]) != NULL))
+	ptr = p = p + 5;
+      else if (strncmp (p, "volatile", 8) == 0
+	       && (isspace (p[8]) || p[8] == '\0'
+		   || strchr (quotes, p[8]) != NULL))
+	ptr = p = p + 8;
+      else
+	break;
+    }
 
   return remove_trailing_whitespace (start, ptr);
 }
@@ -1574,9 +1584,7 @@ decode_compound (char **argptr, int funfirstline,
   /* We couldn't find a class, so we're in case 2 above.  We check the
      entire name as a symbol instead.  */
 
-  if (current_language->la_language == language_cplus
-      || current_language->la_language == language_java)
-    p = keep_name_info (p);
+  p = keep_name_info (p);
 
   copy = (char *) alloca (p - saved_arg2 + 1);
   memcpy (copy, saved_arg2, p - saved_arg2);
diff --git a/gdb/testsuite/gdb.cp/cmpd-minsyms.cc b/gdb/testsuite/gdb.cp/cmpd-minsyms.cc
index 21d5c4e..fa66786 100644
--- a/gdb/testsuite/gdb.cp/cmpd-minsyms.cc
+++ b/gdb/testsuite/gdb.cp/cmpd-minsyms.cc
@@ -25,11 +25,17 @@ class GDB
    static X even_harder (T a) { return static_cast<X> (a); }
    int operator == (GDB const& other)
    { return 1; }
+  void a (void) const { }
+  void b (void) volatile { }
+  void c (void) const volatile { }
 };
 
 int main(int argc, char **argv)
 {
    GDB<int> a, b;
+   a.a ();
+   a.b ();
+   a.c ();
    if (a == b)
      return GDB<char>::harder('a') + GDB<int>::harder(3)
 	+ GDB<char>::even_harder<int> ('a');
diff --git a/gdb/testsuite/gdb.cp/cmpd-minsyms.exp b/gdb/testsuite/gdb.cp/cmpd-minsyms.exp
index 36176fc..696022e 100644
--- a/gdb/testsuite/gdb.cp/cmpd-minsyms.exp
+++ b/gdb/testsuite/gdb.cp/cmpd-minsyms.exp
@@ -19,13 +19,26 @@
 
 if {[skip_cplus_tests]} { continue }
 
-# Test for c++/12273
+# Tests for c++/12273, breakpoint/12803
 set testfile "cmpd-minsyms"
 # Do NOT compile with debug flag.
 if {[prepare_for_testing $testfile $testfile $testfile.cc {c++}]} {
     return -1
 }
 
+# Before setting the language, try to set a few simple breakpoints
+set min_syms [list \
+		  "GDB<int>::a() const" \
+		  "GDB<int>::b() volatile" \
+		  "GDB<int>::c() const volatile"]
+foreach sym $min_syms {
+    set tst "setting breakpoint at '$sym'"
+    if {[gdb_breakpoint "'$sym'"]} {
+	pass $tst
+    }    
+}
+
+
 gdb_test_no_output "set language c++"
 
 # A list of minimal symbol names to check.

             reply	other threads:[~2011-05-24 19:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-24 19:00 Keith Seitz [this message]
2011-05-24 20:07 ` Tom Tromey
2011-05-24 21:02   ` Keith Seitz

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=4DDC0053.1020202@redhat.com \
    --to=keiths@redhat.com \
    --cc=gdb-patches@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