* alpha-tdep.c (heuristic_proc_desc): Stop examining the prologue
authorPeter Schauer <Peter.Schauer@mytum.de>
Sat, 9 Nov 1996 09:17:34 +0000 (09:17 +0000)
committerPeter Schauer <Peter.Schauer@mytum.de>
Sat, 9 Nov 1996 09:17:34 +0000 (09:17 +0000)
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
gdb/alpha-tdep.c
gdb/c-valprint.c
gdb/configure
gdb/configure.in
gdb/cp-valprint.c

index f297390..d494b62 100644 (file)
@@ -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  <msnyder@cleaver.cygnus.com>
 
        * config/tm-sh.h: Added a missing comma in middle of REGISTER_NAMES list.
index 08cd6d4..e07d75a 100644 (file)
@@ -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 =
index 20dae22..4850180 100644 (file)
@@ -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);
 }
index 7bc071c..79f0b98 100755 (executable)
@@ -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
index ca6b995..cacdff6 100644 (file)
@@ -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
index b2015c7..a4027ea 100644 (file)
@@ -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);