* [RFA] breakpoint/12803
@ 2011-05-24 19:00 Keith Seitz
2011-05-24 20:07 ` Tom Tromey
0 siblings, 1 reply; 3+ messages in thread
From: Keith Seitz @ 2011-05-24 19:00 UTC (permalink / raw)
To: gdb-patches
[-- 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.
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [RFA] breakpoint/12803
2011-05-24 19:00 [RFA] breakpoint/12803 Keith Seitz
@ 2011-05-24 20:07 ` Tom Tromey
2011-05-24 21:02 ` Keith Seitz
0 siblings, 1 reply; 3+ messages in thread
From: Tom Tromey @ 2011-05-24 20:07 UTC (permalink / raw)
To: Keith Seitz; +Cc: gdb-patches
>>>>> "Keith" == Keith Seitz <keiths@redhat.com> writes:
Keith> This patch addresses breakpoint/12803, which deals with C++ minsym
Keith> methods involving "const" and/or "volatile" attributes. keep_name_info
Keith> was being guarded by current_language, and this caused a regression
Keith> against gdb 7.1.
Thanks.
Keith> + while (isspace (*p))
Keith> + ++p;
`p = skip_spaces (p)'
Ok with this change.
Tom
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-05-24 21:02 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-24 19:00 [RFA] breakpoint/12803 Keith Seitz
2011-05-24 20:07 ` Tom Tromey
2011-05-24 21:02 ` Keith Seitz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox