]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
* linespec.c: #include "stack.h".
authorDoug Evans <dje@google.com>
Fri, 29 Jun 2012 22:46:46 +0000 (22:46 +0000)
committerDoug Evans <dje@google.com>
Fri, 29 Jun 2012 22:46:46 +0000 (22:46 +0000)
(decode_line_with_current_source): Moved here from symtab.c and
renamed from decode_line_spec.  All callers updated.
(decode_line_with_last_displayed): Moved here from breakpoint.c and
renamed from decode_line_spec_1.  All callers updated.
* linespec.h (decode_line_with_current_source): Move declaration here
from symtab.h and renamed from decode_line_spec.
(decode_line_with_last_displayed): Move declaration here from symtab.h
and renamed from decode_line_spec_1.
* macrocmd.c: #include "linespec.h".
* symtab.c: Remove #include "linespec.h".

12 files changed:
gdb/ChangeLog
gdb/breakpoint.c
gdb/infcmd.c
gdb/linespec.c
gdb/linespec.h
gdb/macrocmd.c
gdb/mi/mi-main.c
gdb/source.c
gdb/stack.c
gdb/symtab.c
gdb/symtab.h
gdb/tracepoint.c

index b9e1f626d13c548720fc71efb8520cf2c43fafba..4ab87071ca23403afab141fc9d2af9de11543779 100644 (file)
@@ -1,3 +1,17 @@
+2012-06-29  Doug Evans  <dje@google.com>
+
+       * linespec.c: #include "stack.h".
+       (decode_line_with_current_source): Moved here from symtab.c and
+       renamed from decode_line_spec.  All callers updated.
+       (decode_line_with_last_displayed): Moved here from breakpoint.c and
+       renamed from decode_line_spec_1.  All callers updated.
+       * linespec.h (decode_line_with_current_source): Move declaration here
+       from symtab.h and renamed from decode_line_spec.
+       (decode_line_with_last_displayed): Move declaration here from symtab.h
+       and renamed from decode_line_spec_1.
+       * macrocmd.c: #include "linespec.h".
+       * symtab.c: Remove #include "linespec.h".
+
 2012-06-28  Doug Evans  <dje@google.com>
 
        * dwarf2read.c (get_cu_length): New function.
index 71a5e193969dec1113a1544014e229c0dd4f9209..896c1229035213b6f84cf5d5f54c64c2d55f594d 100644 (file)
@@ -11532,8 +11532,9 @@ clear_command (char *arg, int from_tty)
 
   if (arg)
     {
-      sals = decode_line_spec (arg, (DECODE_LINE_FUNFIRSTLINE
-                                    | DECODE_LINE_LIST_MODE));
+      sals = decode_line_with_current_source (arg,
+                                             (DECODE_LINE_FUNFIRSTLINE
+                                              | DECODE_LINE_LIST_MODE));
       default_match = 0;
     }
   else
@@ -14494,27 +14495,6 @@ invalidate_bp_value_on_memory_change (CORE_ADDR addr, int len,
       }
 }
 
-/* Use the last displayed codepoint's values, or nothing
-   if they aren't valid.  */
-
-struct symtabs_and_lines
-decode_line_spec_1 (char *string, int flags)
-{
-  struct symtabs_and_lines sals;
-
-  if (string == 0)
-    error (_("Empty line specification."));
-  if (last_displayed_sal_is_valid ())
-    sals = decode_line_1 (&string, flags,
-                         get_last_displayed_symtab (),
-                         get_last_displayed_line ());
-  else
-    sals = decode_line_1 (&string, flags, (struct symtab *) NULL, 0);
-  if (*string)
-    error (_("Junk at end of line specification: %s"), string);
-  return sals;
-}
-
 /* Create and insert a raw software breakpoint at PC.  Return an
    identifier, which should be used to remove the breakpoint later.
    In general, places which call this should be using something on the
index b7770ccfb90d4e278653b20b27ca7d017e067696..475ac90e1cc4ac3393b26749d31a31db59fd0115 100644 (file)
@@ -1140,7 +1140,7 @@ jump_command (char *arg, int from_tty)
   if (!arg)
     error_no_arg (_("starting address"));
 
-  sals = decode_line_spec_1 (arg, DECODE_LINE_FUNFIRSTLINE);
+  sals = decode_line_with_last_displayed (arg, DECODE_LINE_FUNFIRSTLINE);
   if (sals.nelts != 1)
     {
       error (_("Unreasonable jump request"));
index ccafe59c9e90d34b7dc6a60e7a34f97eb24eaaf3..4156694bc4fb23f7871d2afc454252be308c6645 100644 (file)
@@ -43,6 +43,7 @@
 #include "cli/cli-utils.h"
 #include "filenames.h"
 #include "ada-lang.h"
+#include "stack.h"
 
 typedef struct symtab *symtab_p;
 DEF_VEC_P (symtab_p);
@@ -2325,6 +2326,8 @@ decode_line_full (char **argptr, int flags,
   do_cleanups (cleanups);
 }
 
+/* See linespec.h.  */
+
 struct symtabs_and_lines
 decode_line_1 (char **argptr, int flags,
               struct symtab *default_symtab,
@@ -2345,6 +2348,51 @@ decode_line_1 (char **argptr, int flags,
   return result;
 }
 
+/* See linespec.h.  */
+
+struct symtabs_and_lines
+decode_line_with_current_source (char *string, int flags)
+{
+  struct symtabs_and_lines sals;
+  struct symtab_and_line cursal;
+
+  if (string == 0)
+    error (_("Empty line specification."));
+
+  /* We use whatever is set as the current source line.  We do not try
+     and get a default source symtab+line or it will recursively call us!  */
+  cursal = get_current_source_symtab_and_line ();
+
+  sals = decode_line_1 (&string, flags,
+                       cursal.symtab, cursal.line);
+
+  if (*string)
+    error (_("Junk at end of line specification: %s"), string);
+  return sals;
+}
+
+/* See linespec.h.  */
+
+struct symtabs_and_lines
+decode_line_with_last_displayed (char *string, int flags)
+{
+  struct symtabs_and_lines sals;
+
+  if (string == 0)
+    error (_("Empty line specification."));
+
+  if (last_displayed_sal_is_valid ())
+    sals = decode_line_1 (&string, flags,
+                         get_last_displayed_symtab (),
+                         get_last_displayed_line ());
+  else
+    sals = decode_line_1 (&string, flags, (struct symtab *) NULL, 0);
+
+  if (*string)
+    error (_("Junk at end of line specification: %s"), string);
+  return sals;
+}
+
 \f
 
 /* First, some functions to initialize stuff at the beggining of the
index ed8174fb7a624abc1e989ab27b036eff0ff1b1af..0310bb4a4e64c24af65c2386235aa5594ed6d386 100644 (file)
@@ -93,6 +93,8 @@ extern void destroy_linespec_result (struct linespec_result *);
 extern struct cleanup *
         make_cleanup_destroy_linespec_result (struct linespec_result *);
 
+/* Decode a linespec using the provided default symtab and line.  */
+
 extern struct symtabs_and_lines
        decode_line_1 (char **argptr, int flags,
                       struct symtab *default_symtab, int default_line);
@@ -139,4 +141,15 @@ extern void decode_line_full (char **argptr, int flags,
                              const char *select_mode,
                              const char *filter);
 
+/* Given a string, return the line specified by it, using the current
+   source symtab and line as defaults.
+   This is for commands like "list" and "breakpoint".  */
+
+extern struct symtabs_and_lines decode_line_with_current_source (char *, int);
+
+/* Given a string, return the line specified by it, using the last displayed
+   codepoint's values as defaults, or nothing if they aren't valid.  */
+
+extern struct symtabs_and_lines decode_line_with_last_displayed (char *, int);
+
 #endif /* defined (LINESPEC_H) */
index 367f211d06b7b58fcf5c6837ccc761f4060c34b3..a327cade4c9e4d1c7e01d306a1be952d58f8deca 100644 (file)
@@ -26,6 +26,7 @@
 #include "command.h"
 #include "gdbcmd.h"
 #include "gdb_string.h"
+#include "linespec.h"
 
 \f
 /* The `macro' prefix command.  */
@@ -282,7 +283,8 @@ info_macros_command (char *args, int from_tty)
     ms = default_macro_scope ();
   else
     {
-      struct symtabs_and_lines sals = decode_line_spec (args, 0);
+      struct symtabs_and_lines sals =
+       decode_line_with_current_source (args, 0);
 
       if (sals.nelts)
         ms = sal_macro_scope (sals.sals[0]);
index d39573127804ca92f2ef66b002d1a6088814a1c0..dfb489243cbe4a569e43a6f2f8681494bbac76da 100644 (file)
@@ -2436,7 +2436,8 @@ mi_cmd_trace_find (char *command, char **argv, int argc)
       if (argc != 2)
        error (_("Line is required"));
 
-      sals = decode_line_spec (argv[1], DECODE_LINE_FUNFIRSTLINE);
+      sals = decode_line_with_current_source (argv[1],
+                                             DECODE_LINE_FUNFIRSTLINE);
       back_to = make_cleanup (xfree, sals.sals);
 
       sal = sals.sals[0];
index 7de86b4925161652aac2dd708dfc925cc14917d6..0ff0782d453a67d39c7436c3e313dcc31d6e3357 100644 (file)
@@ -243,7 +243,8 @@ select_source_symtab (struct symtab *s)
      if one exists.  */
   if (lookup_symbol (main_name (), 0, VAR_DOMAIN, 0))
     {
-      sals = decode_line_spec (main_name (), DECODE_LINE_FUNFIRSTLINE);
+      sals = decode_line_with_current_source (main_name (),
+                                             DECODE_LINE_FUNFIRSTLINE);
       sal = sals.sals[0];
       xfree (sals.sals);
       current_source_pspace = sal.pspace;
@@ -1405,7 +1406,7 @@ line_info (char *arg, int from_tty)
     }
   else
     {
-      sals = decode_line_spec_1 (arg, DECODE_LINE_LIST_MODE);
+      sals = decode_line_with_last_displayed (arg, DECODE_LINE_LIST_MODE);
 
       dont_repeat ();
     }
index 02e36ca2e004dfe01ce7cf6c92f56932f0da33d3..2520e2c36db0804a8aa7797aa0e25c15fa492b7a 100644 (file)
@@ -2373,7 +2373,7 @@ func_command (char *arg, int from_tty)
     return;
 
   frame = parse_frame_specification ("0");
-  sals = decode_line_spec (arg, DECODE_LINE_FUNFIRSTLINE);
+  sals = decode_line_with_current_source (arg, DECODE_LINE_FUNFIRSTLINE);
   cleanups = make_cleanup (xfree, sals.sals);
   func_bounds = (struct function_bounds *) xmalloc (
                              sizeof (struct function_bounds) * sals.nelts);
index 46d119a5239a46952cabd25a0896be934ec3105c..d83f518fa7ee07ae8429a28739aa6190fdf956e1 100644 (file)
@@ -33,7 +33,6 @@
 #include "language.h"
 #include "demangle.h"
 #include "inferior.h"
-#include "linespec.h"
 #include "source.h"
 #include "filenames.h"         /* for FILENAME_CMP */
 #include "objc-lang.h"
@@ -4821,27 +4820,6 @@ skip_prologue_using_sal (struct gdbarch *gdbarch, CORE_ADDR func_addr)
     return prologue_sal.pc;
 }
 \f
-struct symtabs_and_lines
-decode_line_spec (char *string, int flags)
-{
-  struct symtabs_and_lines sals;
-  struct symtab_and_line cursal;
-
-  if (string == 0)
-    error (_("Empty line specification."));
-
-  /* We use whatever is set as the current source line.  We do not try
-     and get a default  or it will recursively call us!  */
-  cursal = get_current_source_symtab_and_line ();
-
-  sals = decode_line_1 (&string, flags,
-                       cursal.symtab, cursal.line);
-
-  if (*string)
-    error (_("Junk at end of line specification: %s"), string);
-  return sals;
-}
-
 /* Track MAIN */
 static char *name_of_main;
 enum language language_of_main = language_unknown;
index 57f618d0f19a61fb8b3906b41e53886dbbff89f4..76120a37a93ad14a9dc7d90949e73f486b4451b3 100644 (file)
@@ -1113,13 +1113,6 @@ extern int find_line_pc_range (struct symtab_and_line, CORE_ADDR *,
 
 extern void resolve_sal_pc (struct symtab_and_line *);
 
-/* Given a string, return the line specified by it.  For commands like "list"
-   and "breakpoint".  */
-
-extern struct symtabs_and_lines decode_line_spec (char *, int);
-
-extern struct symtabs_and_lines decode_line_spec_1 (char *, int);
-
 /* Symmisc.c */
 
 void maintenance_print_symbols (char *, int);
index e4fd2d3810d807d06af8d94f8599b7568005aeba..0fc4ea4bae25587149096916f6e0980a86139b77 100644 (file)
@@ -2494,7 +2494,7 @@ trace_find_line_command (char *args, int from_tty)
     }
   else
     {
-      sals = decode_line_spec (args, DECODE_LINE_FUNFIRSTLINE);
+      sals = decode_line_with_current_source (args, DECODE_LINE_FUNFIRSTLINE);
       sal = sals.sals[0];
     }