From 2f2a70e585b2c8671b33d61fafd6f038c5bce76c Mon Sep 17 00:00:00 2001 From: Jim Kingdon Date: Wed, 26 May 1993 04:29:38 +0000 Subject: [PATCH] * source.c (line_info): If we don't find a symtab, print more useful output, including the symbolic address. --- gdb/ChangeLog | 3 +++ gdb/source.c | 27 ++++++++++++++++++++------- 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 49cb5c01347..52197a9ed7c 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,8 @@ Tue May 25 20:44:24 1993 Jim Kingdon (kingdon@lioth.cygnus.com) + * source.c (line_info): If we don't find a symtab, print more useful + output, including the symbolic address. + * source.c (line_info): If --fullname, display the source. (identify_source_line), callers: Take pc as argument, rather than assuming innermost frame (emacs doesn't use this, so no one ever diff --git a/gdb/source.c b/gdb/source.c index 682f1e86189..3ea5518e252 100644 --- a/gdb/source.c +++ b/gdb/source.c @@ -1083,10 +1083,7 @@ line_info (arg, from_tty) { sals = decode_line_spec_1 (arg, 0); - /* If this command is repeated with RET, - turn it into the no-arg variant. */ - if (from_tty) - *arg = 0; + dont_repeat (); } /* C++ More than one line may have been specified, as when the user @@ -1096,9 +1093,22 @@ line_info (arg, from_tty) sal = sals.sals[i]; if (sal.symtab == 0) - error ("No source file specified."); - - if (sal.line > 0 + { + printf_filtered ("No line number information available"); + if (sal.pc != 0) + { + /* This is useful for "info line *0x7f34". If we can't tell the + user about a source line, at least let them have the symbolic + address. */ + printf_filtered (" for address "); + wrap_here (" "); + print_address (sal.pc, stdout); + } + else + printf_filtered ("."); + printf_filtered ("\n"); + } + else if (sal.line > 0 && find_line_pc_range (sal.symtab, sal.line, &start_pc, &end_pc)) { if (start_pc == end_pc) @@ -1123,6 +1133,9 @@ line_info (arg, from_tty) identify_source_line (sal.symtab, sal.line, 0, start_pc); } else + /* Is there any case in which we get here, and have an address + which the user would want to see? If we have debugging symbols + and no line numbers? */ printf_filtered ("Line number %d is out of range for \"%s\".\n", sal.line, sal.symtab->filename); } -- 2.30.2