gdb/
authorDaniel Jacobowitz <drow@false.org>
Tue, 16 Feb 2010 20:51:51 +0000 (20:51 +0000)
committerDaniel Jacobowitz <drow@false.org>
Tue, 16 Feb 2010 20:51:51 +0000 (20:51 +0000)
* linespec.c (decode_line_1): Handle FILE:FUNCTION even if
FUNCTION contains parentheses.  Improve removal of a trailing
single quote.

gdb/testsuite/
* gdb.base/list.exp (test_list_filename_and_function): Add test
with single quotes.
* gdb.cp/overload.cc (intToChar): Rewrite onto one line for easy
matching.
* gdb.cp/overload.exp: Add tests with filename, function, and quotes.
Add KFAIL'd tests for PR gdb/11289.

gdb/ChangeLog
gdb/linespec.c
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.base/list.exp
gdb/testsuite/gdb.cp/overload.cc
gdb/testsuite/gdb.cp/overload.exp

index 564983b2a57a507a72eeae377428ed83d0e0f734..d7d71fde5704c4a5c0480ab8ee9f9aaaca8364b7 100644 (file)
@@ -1,3 +1,9 @@
+2010-02-16  Daniel Jacobowitz  <dan@codesourcery.com>
+
+       * linespec.c (decode_line_1): Handle FILE:FUNCTION even if
+       FUNCTION contains parentheses.  Improve removal of a trailing
+       single quote.
+
 2010-02-16  Daniel Jacobowitz  <dan@codesourcery.com>
 
        * gcore.c (do_bfd_delete_cleanup): New function.
index 74902b6f9d714e872122d7a01baf763cfc4827be..60d761124034da5e180bf84d48f20aef6d8a2c6c 100644 (file)
@@ -698,6 +698,8 @@ decode_line_1 (char **argptr, int funfirstline, struct symtab *default_symtab,
   int is_quote_enclosed;
   int is_objc_method = 0;
   char *saved_arg = *argptr;
+  /* If IS_QUOTED, the end of the quoted bit.  */
+  char *end_quote = NULL;
 
   if (not_found_ptr)
     *not_found_ptr = 0;
@@ -717,6 +719,8 @@ decode_line_1 (char **argptr, int funfirstline, struct symtab *default_symtab,
   */
 
   set_flags (*argptr, &is_quoted, &paren_pointer);
+  if (is_quoted)
+    end_quote = skip_quoted (*argptr);
 
   /* Check to see if it's a multipart linespec (with colons or
      periods).  */
@@ -747,13 +751,13 @@ decode_line_1 (char **argptr, int funfirstline, struct symtab *default_symtab,
       return values;
   }
 
+  if (is_quoted)
+    *argptr = *argptr + 1;
+
   /* Does it look like there actually were two parts?  */
 
-  if ((p[0] == ':' || p[0] == '.') && paren_pointer == NULL)
+  if (p[0] == ':' || p[0] == '.')
     {
-      if (is_quoted)
-       *argptr = *argptr + 1;
-      
       /* Is it a C++ or Java compound data structure?
         The check on p[1] == ':' is capturing the case of "::",
         since p[0]==':' was checked above.  
@@ -762,14 +766,30 @@ decode_line_1 (char **argptr, int funfirstline, struct symtab *default_symtab,
         can return now. */
        
       if (p[0] == '.' || p[1] == ':')
-       return decode_compound (argptr, funfirstline, canonical,
-                               saved_arg, p, not_found_ptr);
+       {
+         if (paren_pointer == NULL)
+           return decode_compound (argptr, funfirstline, canonical,
+                                   saved_arg, p, not_found_ptr);
+         /* Otherwise, fall through to decode_variable below.  */
+       }
+      else
+       {
+         /* No, the first part is a filename; set file_symtab to be that file's
+            symtab.  Also, move argptr past the filename.  */
 
-      /* No, the first part is a filename; set file_symtab to be that file's
-        symtab.  Also, move argptr past the filename.  */
+         file_symtab = symtab_from_filename (argptr, p, is_quote_enclosed,
+                                             not_found_ptr);
 
-      file_symtab = symtab_from_filename (argptr, p, is_quote_enclosed, 
-                                         not_found_ptr);
+         /* Check for single quotes on the non-filename part.  */
+         if (!is_quoted)
+           {
+             is_quoted = (**argptr
+                          && strchr (get_gdb_completer_quote_characters (),
+                                     **argptr) != NULL);
+             if (is_quoted)
+               end_quote = skip_quoted (*argptr);
+           }
+       }
     }
 #if 0
   /* No one really seems to know why this was added. It certainly
@@ -829,7 +849,7 @@ decode_line_1 (char **argptr, int funfirstline, struct symtab *default_symtab,
     p = skip_quoted (*argptr + (((*argptr)[1] == '$') ? 2 : 1));
   else if (is_quoted)
     {
-      p = skip_quoted (*argptr);
+      p = end_quote;
       if (p[-1] != '\'')
        error (_("Unmatched single quote."));
     }
@@ -862,6 +882,8 @@ decode_line_1 (char **argptr, int funfirstline, struct symtab *default_symtab,
       copy[p - *argptr - 1] = '\0';
       copy++;
     }
+  else if (is_quoted)
+    copy[p - *argptr - 1] = '\0';
   while (*p == ' ' || *p == '\t')
     p++;
   *argptr = p;
index 3f1096579f45d5d41776339d18a3b92ab03543b8..2d857f96c49e80a1eaaa7e857ea38f807f1dd730 100644 (file)
@@ -1,3 +1,12 @@
+2010-02-16  Daniel Jacobowitz  <dan@codesourcery.com>
+
+       * gdb.base/list.exp (test_list_filename_and_function): Add test
+       with single quotes.
+       * gdb.cp/overload.cc (intToChar): Rewrite onto one line for easy
+       matching.
+       * gdb.cp/overload.exp: Add tests with filename, function, and quotes.
+       Add KFAIL'd tests for PR gdb/11289.
+
 2010-02-16  Daniel Jacobowitz  <dan@codesourcery.com>
 
        * gdb.cp/cpcompletion.exp: Specify source file name explicitly.
index ba3e63772b33a559996174b3a580de338f9448b8..11804c834f268f961f04dedda3e0819aea5843f0 100644 (file)
@@ -473,6 +473,9 @@ proc test_list_filename_and_function {} {
 
     pass "list filename:function ($testcnt tests)"
 
+    # Test with quoting.
+    gdb_test "list 'list0.c:main'" "int main.*"
+
     # Test some invalid specs
     # The following test takes the FIXME result on most systems using
     # DWARF.  It fails to notice that main() is not in the file requested.
index e643d4cdfde16247a9491c8573c04afff17893dc..78fae1455fc596d311c4ca504b2115f95df809d6 100644 (file)
@@ -56,10 +56,7 @@ namespace N {
   int nsoverload (int x, int y) { return x + y; }
 };
 
-int intToChar (char c)
-{
-  return 297;
-}
+int intToChar (char c) { return 297; }
 
 void marker1()
 {}
index 317cbc5eb6977e04aef159744c7443214ba38a77..101be4a5d82bf419ae539a884d2a152584907807 100644 (file)
@@ -293,6 +293,21 @@ gdb_test "list \"foo::overloadfnarg(int, int (*)(int))\"" \
    "int foo::overloadfnarg.*\\(int arg, int \\(\\*foo\\) \\(int\\)\\).*" \
    "list overloaded function with function ptr args - quotes around argument"
 
+# Test list with filename.
+
+gdb_test "list ${srcfile}:intToChar" "int intToChar.*"
+gdb_test "list ${srcfile}:intToChar(char)" "int intToChar.*"
+gdb_test "list ${srcfile}:'intToChar(char)'" "int intToChar.*"
+gdb_test "list '${srcfile}:intToChar(char)'" "int intToChar.*"
+
+# And with filename and namespace... which does not work.
+
+setup_kfail *-*-* gdb/11289
+gdb_test "list ${srcfile}:foo::overloadfnarg(int)" "int foo::overloadfnarg"
+
+setup_kfail *-*-* gdb/11289
+gdb_test "list ${srcfile}:'foo::overloadfnarg(int)'" "int foo::overloadfnarg"
+
 # Now some tests to see how overloading and namespaces interact.
 
 gdb_test "print overloadNamespace(1)" ".\[0-9\]* = 1"
This page took 0.057457 seconds and 4 git commands to generate.