diff options
author | Fred Fish <fnf@specifix.com> | 1993-03-11 01:56:31 +0000 |
---|---|---|
committer | Fred Fish <fnf@specifix.com> | 1993-03-11 01:56:31 +0000 |
commit | f77ad50597b7c74ce8454346940dcfc65aba1dd5 (patch) | |
tree | 44e7ab514f237e231a7dcd3a64ff33fa7ba071a8 /gdb/printcmd.c | |
parent | 6559fbdb527abbf1a64ab4524693bab9daf3e305 (diff) | |
download | gdb-f77ad50597b7c74ce8454346940dcfc65aba1dd5.zip gdb-f77ad50597b7c74ce8454346940dcfc65aba1dd5.tar.gz gdb-f77ad50597b7c74ce8454346940dcfc65aba1dd5.tar.bz2 |
* main.c (source_command): Require an explicit pathname of file
to source, since previous behavior of defaulting to gdb init file
was troublesome and undocumented.
* printcmd.c (disassemble_command): Add missing '{}' pair to
else with two statements. Bug reported by Stephane Tsacas
<slt@isoft.fr>.
* symtab.c (find_pc_line): Don't complain about zero length or
negative length line numbers for the moment, since we may not own
the terminal when called, such as when single stepping. (FIXME)
* language.h (CAST_IS_CONVERSION): True if current language is
C++ as well as C. Fix from Peter Schauer.
* environ.c (get_in_environ, set_in_environ, unset_in_environ):
Use STREQN macro rather than bare '!strncmp()'.
* environ.c (unset_in_environ): Avoid use of memcpy on
overlapping memory regions, as suggested by Paul Eggert
<eggert@twinsun.com>.
* c-exp.y (%union struct): Remove unused ulval as suggested
by Paul Eggert <eggert@twinsun.com>.
Diffstat (limited to 'gdb/printcmd.c')
-rw-r--r-- | gdb/printcmd.c | 43 |
1 files changed, 35 insertions, 8 deletions
diff --git a/gdb/printcmd.c b/gdb/printcmd.c index 3e878a6..a99a6cb 100644 --- a/gdb/printcmd.c +++ b/gdb/printcmd.c @@ -62,8 +62,13 @@ static CORE_ADDR last_examine_address; static value last_examine_value; +/* Largest offset between a symbolic value and an address, that will be + printed as `0x1234 <symbol+offset>'. */ + +static unsigned int max_symbolic_offset = UINT_MAX; + /* Number of auto-display expression currently being displayed. - So that we can deleted it if we get an error or a signal within it. + So that we can disable it if we get an error or a signal within it. -1 when not doing one. */ int current_display_number; @@ -119,7 +124,8 @@ static void printf_command PARAMS ((char *, int)); static void -print_frame_nameless_args PARAMS ((CORE_ADDR, long, int, int, FILE *)); +print_frame_nameless_args PARAMS ((struct frame_info *, long, int, int, + FILE *)); static void display_info PARAMS ((char *, int)); @@ -560,7 +566,7 @@ print_address_symbolic (addr, stream, do_demangle, leadin) int do_demangle; char *leadin; { - int name_location; + CORE_ADDR name_location; register struct minimal_symbol *msymbol = lookup_minimal_symbol_by_pc (addr); /* If nothing comes out, don't print anything symbolic. */ @@ -568,15 +574,27 @@ print_address_symbolic (addr, stream, do_demangle, leadin) if (msymbol == NULL) return; + /* If the nearest symbol is too far away, ditto. */ + + name_location = SYMBOL_VALUE_ADDRESS (msymbol); + + /* For when CORE_ADDR is larger than unsigned int, we do math in + CORE_ADDR. But when we detect unsigned wraparound in the + CORE_ADDR math, we ignore this test and print the offset, + because addr+max_symbolic_offset has wrapped through the end + of the address space back to the beginning, giving bogus comparison. */ + if (addr > name_location + max_symbolic_offset + && name_location + max_symbolic_offset > name_location) + return; + fputs_filtered (leadin, stream); fputs_filtered ("<", stream); if (do_demangle) fputs_filtered (SYMBOL_SOURCE_NAME (msymbol), stream); else fputs_filtered (SYMBOL_LINKAGE_NAME (msymbol), stream); - name_location = SYMBOL_VALUE_ADDRESS (msymbol); - if (addr - name_location) - fprintf_filtered (stream, "+%d>", addr - name_location); + if (addr != name_location) + fprintf_filtered (stream, "+%d>", (int)(addr - name_location)); else fputs_filtered (">", stream); } @@ -1881,8 +1899,10 @@ disassemble_command (arg, from_tty) printf_filtered ("for function %s:\n", name); } else - printf_filtered ("from %s ", local_hex_string(low)); - printf_filtered ("to %s:\n", local_hex_string(high)); + { + printf_filtered ("from %s ", local_hex_string(low)); + printf_filtered ("to %s:\n", local_hex_string(high)); + } /* Dump the specified range. */ for (pc = low; pc < high; ) @@ -2030,4 +2050,11 @@ but no count or size letter (see \"x\" command).", NULL)); add_com ("inspect", class_vars, inspect_command, "Same as \"print\" command, except that if you are running in the epoch\n\ environment, the value is printed in its own window."); + + add_show_from_set ( + add_set_cmd ("max-symbolic-offset", no_class, var_uinteger, + (char *)&max_symbolic_offset, + "Set the largest offset that will be printed in <symbol+1234> form.", + &setprintlist), + &showprintlist); } |