aboutsummaryrefslogtreecommitdiff
path: root/gdb/linespec.c
diff options
context:
space:
mode:
authorFernando Nasser <fnasser@redhat.com>2002-09-20 14:58:59 +0000
committerFernando Nasser <fnasser@redhat.com>2002-09-20 14:58:59 +0000
commit0378c3323148fbb291d1035d9959de9d9c3a0f7b (patch)
tree7a24175361aea3a17223b0a3cea75e08f2c97eb4 /gdb/linespec.c
parent7cf108933bd1b2e94d4bd531583060262abd543c (diff)
downloadgdb-0378c3323148fbb291d1035d9959de9d9c3a0f7b.zip
gdb-0378c3323148fbb291d1035d9959de9d9c3a0f7b.tar.gz
gdb-0378c3323148fbb291d1035d9959de9d9c3a0f7b.tar.bz2
* source.c: Make global variables current_source_symtab and
current_source_line static. (list_command): Moved to cli/cli-cmds.c. (ambiguous_line_spec): Moved to cli/cli-cmds.c. (get_first_line_listed): New accessor function. (get_lines_to_list): New accessor function. (get_current_source_symtab_and_line): New function. Retrieves the position in the source code that we consider current. (get_current_or_default_source_symtab_and_line): New function. Like the above but attempts to determine a default position if one is not currently defined. (set_current_source_symtab_and_line): New function. Sets the source code position considered current and returns the previously set one. (clear_current_source_symtab_and_line): Reset stored information about a current source line. (_initialize_source): Remove registration for the "list" command and its alias. * source.h: Add declarations for the new functions above. * symtab.h: Remove declarations for the global variables mentioned above. * breakpoint.c (parse_breakpoint_sals): Use accessor functions to obtain current source line. * linespec.c (decode_line_1): Ditto. * macroscope.c (default_macro_scope): Ditto. * scm-lang.c (scm_unpac): Ditto. * stack.c (print_frame_info_base): Ditto. * symfile.c (clear_symtab_users): Ditto. * symtab.c (decode_line_spec): Ditto. * cli/cli-cmds.c (list_command): Moved here from source.c. (ambiguous_line_spec): Moved here from source.c. (_init_cli_cmds): Add definition for "list" and its alias. * Makefile.in: Update dependencies.
Diffstat (limited to 'gdb/linespec.c')
-rw-r--r--gdb/linespec.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/gdb/linespec.c b/gdb/linespec.c
index 8e51021..d1bb4e3 100644
--- a/gdb/linespec.c
+++ b/gdb/linespec.c
@@ -26,6 +26,7 @@
#include "command.h"
#include "symfile.h"
#include "objfiles.h"
+#include "source.h"
#include "demangle.h"
#include "value.h"
#include "completer.h"
@@ -545,8 +546,14 @@ decode_line_1 (char **argptr, int funfirstline, struct symtab *default_symtab,
if (default_symtab == 0)
{
- default_symtab = current_source_symtab;
- default_line = current_source_line;
+ /* Use whatever we have for the default source line. We don't use
+ get_current_or_default_symtab_and_line as it can recurse and call
+ us back! */
+ struct symtab_and_line cursal =
+ get_current_source_symtab_and_line ();
+
+ default_symtab = cursal.symtab;
+ default_line = cursal.line;
}
/* See if arg is *PC */
@@ -1020,13 +1027,16 @@ decode_line_1 (char **argptr, int funfirstline, struct symtab *default_symtab,
/* This is where we need to make sure that we have good defaults.
We must guarantee that this section of code is never executed
when we are called with just a function name, since
- select_source_symtab calls us with such an argument */
+ get_current_or_default_source_symtab_and_line uses
+ select_source_symtab that calls us with such an argument */
if (s == 0 && default_symtab == 0)
{
- select_source_symtab (0);
- default_symtab = current_source_symtab;
- default_line = current_source_line;
+ struct symtab_and_line cursal =
+ get_current_or_default_source_symtab_and_line ();
+
+ default_symtab = cursal.symtab;
+ default_line = cursal.line;
}
if (**argptr == '+')