aboutsummaryrefslogtreecommitdiff
path: root/gdb/linespec.c
diff options
context:
space:
mode:
authorDoug Evans <dje@google.com>2012-06-29 22:46:46 +0000
committerDoug Evans <dje@google.com>2012-06-29 22:46:46 +0000
commit39cf75f7e02e5d3e0080a7862cde324e378c69ea (patch)
tree697a7c162edb5232330ca08193e6d3ff9d11e29a /gdb/linespec.c
parenta040981f6272e74d8157108e1677bc4d13425cd0 (diff)
downloadfsf-binutils-gdb-39cf75f7e02e5d3e0080a7862cde324e378c69ea.zip
fsf-binutils-gdb-39cf75f7e02e5d3e0080a7862cde324e378c69ea.tar.gz
fsf-binutils-gdb-39cf75f7e02e5d3e0080a7862cde324e378c69ea.tar.bz2
* 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".
Diffstat (limited to 'gdb/linespec.c')
-rw-r--r--gdb/linespec.c48
1 files changed, 48 insertions, 0 deletions
diff --git a/gdb/linespec.c b/gdb/linespec.c
index ccafe59..4156694 100644
--- a/gdb/linespec.c
+++ b/gdb/linespec.c
@@ -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;
+}
+
/* First, some functions to initialize stuff at the beggining of the