From 074d813d38a8c811d8ca2d346ce0266ac4331cb2 Mon Sep 17 00:00:00 2001 From: Peter Schauer Date: Sat, 9 Nov 1996 09:17:34 +0000 Subject: [PATCH] * 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. --- gdb/ChangeLog | 26 ++++++++++++++++++++++++++ gdb/alpha-tdep.c | 20 +++++++++++++++++--- gdb/c-valprint.c | 7 ++++--- gdb/configure | 2 ++ gdb/configure.in | 2 ++ gdb/cp-valprint.c | 19 ++++++++++++++++++- 6 files changed, 69 insertions(+), 7 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index f2973908f2e..d494b620c49 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,29 @@ +Sat Nov 9 01:05:10 1996 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) + + * 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. + Fri Nov 8 14:30:23 1996 Michael Snyder * config/tm-sh.h: Added a missing comma in middle of REGISTER_NAMES list. diff --git a/gdb/alpha-tdep.c b/gdb/alpha-tdep.c index 08cd6d4594a..e07d75a9717 100644 --- a/gdb/alpha-tdep.c +++ b/gdb/alpha-tdep.c @@ -1,5 +1,5 @@ /* Target-dependent code for the ALPHA architecture, for GDB, the GNU Debugger. - Copyright 1993, 1994, 1995 Free Software Foundation, Inc. + Copyright 1993, 1994, 1995, 1996 Free Software Foundation, Inc. This file is part of GDB. @@ -489,7 +489,15 @@ heuristic_proc_desc(start_pc, limit_pc, next_frame) word = extract_unsigned_integer (buf, 4); if ((word & 0xffff0000) == 0x23de0000) /* lda $sp,n($sp) */ - frame_size += (-word) & 0xffff; + { + if (word & 0x8000) + frame_size += (-word) & 0xffff; + else + /* Exit loop if a positive stack adjustment is found, which + usually means that the stack cleanup code in the function + epilogue is reached. */ + break; + } else if ((word & 0xfc1f0000) == 0xb41e0000 /* stq reg,n($sp) */ && (word & 0xffff0000) != 0xb7fe0000) /* reg != $zero */ { @@ -728,7 +736,13 @@ find_proc_desc (pc, next_frame) if (offset >= 0) return push_sigtramp_desc (pc - offset); - if (startaddr == 0) + /* If heuristic_fence_post is non-zero, determine the procedure + start address by examining the instructions. + This allows us to find the start address of static functions which + have no symbolic information, as startaddr would have been set to + the preceding global function start address by the + find_pc_partial_function call above. */ + if (startaddr == 0 || heuristic_fence_post != 0) startaddr = heuristic_proc_start (pc); proc_desc = diff --git a/gdb/c-valprint.c b/gdb/c-valprint.c index 20dae22f2a7..485018054e5 100644 --- a/gdb/c-valprint.c +++ b/gdb/c-valprint.c @@ -1,5 +1,5 @@ /* Support for printing C values for GDB, the GNU debugger. - Copyright 1986, 1988, 1989, 1991, 1992, 1993, 1994, 1995 + Copyright 1986, 1988, 1989, 1991, 1992, 1993, 1994, 1995, 1996 Free Software Foundation, Inc. This file is part of GDB. @@ -465,6 +465,7 @@ c_value_print (val, stream, format, pretty) fprintf_filtered (stream, ") "); } } - return (val_print (type, VALUE_CONTENTS (val), - VALUE_ADDRESS (val), stream, format, 1, 0, pretty)); + return val_print (type, VALUE_CONTENTS (val), + VALUE_ADDRESS (val) + VALUE_OFFSET (val), + stream, format, 1, 0, pretty); } diff --git a/gdb/configure b/gdb/configure index 7bc071cb407..79f0b9896fb 100755 --- a/gdb/configure +++ b/gdb/configure @@ -2688,6 +2688,8 @@ case "${host}" in : elif grep 'do not mix' conftest.t >/dev/null 2>&1; then : + elif grep 'some text already loaded' conftest.t >/dev/null 2>&1; then + : elif test "${shared}" = "true"; then HLDFLAGS='-Wl,-rpath=$(libdir)' else diff --git a/gdb/configure.in b/gdb/configure.in index ca6b9954d16..cacdff6e180 100644 --- a/gdb/configure.in +++ b/gdb/configure.in @@ -334,6 +334,8 @@ case "${host}" in : elif grep 'do not mix' conftest.t >/dev/null 2>&1; then : + elif grep 'some text already loaded' conftest.t >/dev/null 2>&1; then + : elif test "${shared}" = "true"; then HLDFLAGS='-Wl,-rpath=$(libdir)' else diff --git a/gdb/cp-valprint.c b/gdb/cp-valprint.c index b2015c7a304..a4027eacf42 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, ""); 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); -- 2.30.2