diff options
author | Peter Schauer <Peter.Schauer@mytum.de> | 1993-05-27 13:19:26 +0000 |
---|---|---|
committer | Peter Schauer <Peter.Schauer@mytum.de> | 1993-05-27 13:19:26 +0000 |
commit | b7ccd8e069d9a07a2125cda24cb3c62bf401fe99 (patch) | |
tree | 06b9a323795906e1b45e61c40a89c230a789b70e /gdb | |
parent | 87756e15db9426efa646df410eed1de8533174ac (diff) | |
download | gdb-b7ccd8e069d9a07a2125cda24cb3c62bf401fe99.zip gdb-b7ccd8e069d9a07a2125cda24cb3c62bf401fe99.tar.gz gdb-b7ccd8e069d9a07a2125cda24cb3c62bf401fe99.tar.bz2 |
* printcmd.c (print_address_symbolic): Append source filename and
linenumber of the symbol if print symbol-filename is on.
(initialize_printcmd): `set print symbol-filename'.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 6 | ||||
-rw-r--r-- | gdb/printcmd.c | 23 |
2 files changed, 26 insertions, 3 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 754d3c3..41d3434 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +Thu May 27 06:16:56 1993 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) + + * printcmd.c (print_address_symbolic): Append source filename and + linenumber of the symbol if print symbol-filename is on. + (initialize_printcmd): `set print symbol-filename'. + Wed May 26 13:46:16 1993 Stu Grossman (grossman@cygnus.com) * configure.in: Add config for Lynx target. Configure gdbserver diff --git a/gdb/printcmd.c b/gdb/printcmd.c index b5bf3d8..6aca2f5 100644 --- a/gdb/printcmd.c +++ b/gdb/printcmd.c @@ -73,6 +73,10 @@ static value last_examine_value; static unsigned int max_symbolic_offset = UINT_MAX; +/* Append the source filename and linenumber of the symbol when + printing a symbolic value as `<symbol at filename:linenum>' if set. */ +static int print_symbol_filename = 0; + /* Number of auto-display expression currently being displayed. So that we can disable it if we get an error or a signal within it. -1 when not doing one. */ @@ -582,9 +586,16 @@ print_address_symbolic (addr, stream, do_demangle, leadin) fputs_filtered ("<", stream); fputs_filtered (name, stream); if (addr != name_location) - fprintf_filtered (stream, "+%u>", (unsigned int)(addr - name_location)); - else - fputs_filtered (">", stream); + fprintf_filtered (stream, "+%u", (unsigned int)(addr - name_location)); + + /* Append source filename and line number if desired. */ + if (symbol && print_symbol_filename) + { + struct symtab_and_line sal = find_pc_line (addr, 0); + if (sal.symtab) + fprintf_filtered (stream, " at %s:%d", sal.symtab->filename, sal.line); + } + fputs_filtered (">", stream); } /* Print address ADDR symbolically on STREAM. @@ -2070,4 +2081,10 @@ environment, the value is printed in its own window."); "Set the largest offset that will be printed in <symbol+1234> form.", &setprintlist), &showprintlist); + add_show_from_set ( + add_set_cmd ("symbol-filename", no_class, var_boolean, + (char *)&print_symbol_filename, + "Set printing of source filename and line number with <symbol>.", + &setprintlist), + &showprintlist); } |