diff options
author | Peter Schauer <Peter.Schauer@mytum.de> | 1996-11-09 09:17:34 +0000 |
---|---|---|
committer | Peter Schauer <Peter.Schauer@mytum.de> | 1996-11-09 09:17:34 +0000 |
commit | 074d813d38a8c811d8ca2d346ce0266ac4331cb2 (patch) | |
tree | 7f41fcfdbd80af8381fd70ce13e6c10fbaaa7747 /gdb/cp-valprint.c | |
parent | 849c575f9757b1c2d001dc771d6b1f77d3254003 (diff) | |
download | gdb-074d813d38a8c811d8ca2d346ce0266ac4331cb2.zip gdb-074d813d38a8c811d8ca2d346ce0266ac4331cb2.tar.gz gdb-074d813d38a8c811d8ca2d346ce0266ac4331cb2.tar.bz2 |
* alpha-tdep.c (heuristic_proc_desc): Stop examining the prologue
if we encounter a positive stack adjustment.
(find_proc_desc): If heuristic_fence_post is non-zero, use
heuristic_proc_start to determine the start of a function before
calling heuristic_proc_desc.
* coffread.c (coff_symtab_read): Change minimal symbol types
for C_LABEL symbols from mst_* to mst_file_*.
* config/m68k/sun3os4.mh (MMALLOC_CFLAGS): Define MMCHECK_FORCE to 1.
* configure.in: Handle error message from sun3 native ld when
configuring HLDFLAGS.
* configure: Regenerated with autoconf.
* c-valprint.c (c_value_print): Adjust value address by VALUE_OFFSET.
* cp-valprint.c (cp_print_value): Prevent gdb crashes by making sure
that the virtual base pointer from an user object still points to
accessible memory.
* dbxread.c (dbx_symfile_init): Initialize sym_stab_info to
clear the recently added header_files fields.
(dbx_symfile_finish): Free hfiles[i].vector to avoid storage leak.
Diffstat (limited to 'gdb/cp-valprint.c')
-rw-r--r-- | gdb/cp-valprint.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/gdb/cp-valprint.c b/gdb/cp-valprint.c index b2015c7..a4027ea 100644 --- a/gdb/cp-valprint.c +++ b/gdb/cp-valprint.c @@ -30,6 +30,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "annotate.h" #include "gdb_string.h" #include "c-lang.h" +#include "target.h" int vtblprint; /* Controls printing of vtbl's */ int objectprint; /* Controls looking up an object's derived type @@ -410,6 +411,7 @@ cp_print_value (type, valaddr, address, stream, format, recurse, pretty, int boffset; struct type *baseclass = check_typedef (TYPE_BASECLASS (type, i)); char *basename = TYPE_NAME (baseclass); + char *base_valaddr; if (BASETYPE_VIA_VIRTUAL (type, i)) { @@ -438,10 +440,25 @@ cp_print_value (type, valaddr, address, stream, format, recurse, pretty, baseclass name. */ fputs_filtered (basename ? basename : "", stream); fputs_filtered ("> = ", stream); + + /* The virtual base class pointer might have been clobbered by the + user program. Make sure that it still points to a valid memory + location. */ + + if (boffset != -1 && (boffset < 0 || boffset >= TYPE_LENGTH (type))) + { + base_valaddr = (char *) alloca (TYPE_LENGTH (baseclass)); + if (target_read_memory (address + boffset, base_valaddr, + TYPE_LENGTH (baseclass)) != 0) + boffset = -1; + } + else + base_valaddr = valaddr + boffset; + if (boffset == -1) fprintf_filtered (stream, "<invalid address>"); else - cp_print_value_fields (baseclass, valaddr + boffset, address + boffset, + cp_print_value_fields (baseclass, base_valaddr, address + boffset, stream, format, recurse, pretty, (struct type **) obstack_base (&dont_print_vb_obstack), 0); |