diff options
Diffstat (limited to 'gdb/source.c')
-rw-r--r-- | gdb/source.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/gdb/source.c b/gdb/source.c index e456ac0..3bff89b 100644 --- a/gdb/source.c +++ b/gdb/source.c @@ -245,7 +245,7 @@ select_source_symtab (struct symtab *s) if one exists. */ if (lookup_symbol (main_name (), 0, VAR_DOMAIN, 0)) { - sals = decode_line_spec (main_name (), 1); + sals = decode_line_spec (main_name (), DECODE_LINE_FUNFIRSTLINE); sal = sals.sals[0]; xfree (sals.sals); current_source_pspace = sal.pspace; @@ -1415,12 +1415,14 @@ line_info (char *arg, int from_tty) struct symtab_and_line sal; CORE_ADDR start_pc, end_pc; int i; + struct cleanup *cleanups; init_sal (&sal); /* initialize to zeroes */ if (arg == 0) { sal.symtab = current_source_symtab; + sal.pspace = current_program_space; sal.line = last_line_listed; sals.nelts = 1; sals.sals = (struct symtab_and_line *) @@ -1429,16 +1431,20 @@ line_info (char *arg, int from_tty) } else { - sals = decode_line_spec_1 (arg, 0); + sals = decode_line_spec_1 (arg, DECODE_LINE_LIST_MODE); dont_repeat (); } + cleanups = make_cleanup (xfree, sals.sals); + /* C++ More than one line may have been specified, as when the user specifies an overloaded function name. Print info on them all. */ for (i = 0; i < sals.nelts; i++) { sal = sals.sals[i]; + if (sal.pspace != current_program_space) + continue; if (sal.symtab == 0) { @@ -1504,7 +1510,7 @@ line_info (char *arg, int from_tty) printf_filtered (_("Line number %d is out of range for \"%s\".\n"), sal.line, sal.symtab->filename); } - xfree (sals.sals); + do_cleanups (cleanups); } /* Commands to search the source file for a regexp. */ |