From 2001-07-23 Andreas Schwab <schwab@suse.de>:
[deliverable/binutils-gdb.git] / gdb / blockframe.c
index 730c651c0ab32bc21e115a789e0a3cba32b47fef..c88649e19d36aa02f478d7f2376d9e7113c6fbbf 100644 (file)
@@ -1,7 +1,7 @@
 /* Get info from stack frames;
    convert between frames, blocks, functions and pc values.
-   Copyright 1986, 87, 88, 89, 91, 94, 95, 96, 97, 1998
-   Free Software Foundation, Inc.
+   Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995,
+   1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -31,6 +31,7 @@
 #include "target.h"            /* for target_has_stack */
 #include "inferior.h"          /* for read_pc */
 #include "annotate.h"
+#include "regcache.h"
 
 /* Prototypes for exported functions. */
 
@@ -119,7 +120,7 @@ inside_main_func (CORE_ADDR pc)
     {
       struct symbol *mainsym;
 
-      mainsym = lookup_symbol ("main", NULL, VAR_NAMESPACE, NULL, NULL);
+      mainsym = lookup_symbol (main_name (), NULL, VAR_NAMESPACE, NULL, NULL);
       if (mainsym && SYMBOL_CLASS (mainsym) == LOC_BLOCK)
        {
          symfile_objfile->ei.main_func_lowpc =
@@ -218,10 +219,9 @@ create_new_frame (CORE_ADDR addr, CORE_ADDR pc)
     obstack_alloc (&frame_cache_obstack,
                   sizeof (struct frame_info));
 
-  /* Arbitrary frame */
-  fi->saved_regs = NULL;
-  fi->next = NULL;
-  fi->prev = NULL;
+  /* Zero all fields by default.  */
+  memset (fi, 0, sizeof (struct frame_info));
+
   fi->frame = addr;
   fi->pc = pc;
   find_pc_partial_function (pc, &name, (CORE_ADDR *) NULL, (CORE_ADDR *) NULL);
@@ -264,8 +264,8 @@ reinit_frame_cache (void)
 {
   flush_cached_frames ();
 
-  /* FIXME: The inferior_pid test is wrong if there is a corefile.  */
-  if (inferior_pid != 0)
+  /* FIXME: The inferior_ptid test is wrong if there is a corefile.  */
+  if (PIDGET (inferior_ptid) != 0)
     {
       select_frame (get_current_frame (), 0);
     }
@@ -304,12 +304,6 @@ frameless_look_for_prologue (struct frame_info *frame)
 
 /* Default a few macros that people seldom redefine.  */
 
-#if !defined (INIT_FRAME_PC)
-#define INIT_FRAME_PC(fromleaf, prev) \
-  prev->pc = (fromleaf ? SAVED_PC_AFTER_CALL (prev->next) : \
-             prev->next ? FRAME_SAVED_PC (prev->next) : read_pc ());
-#endif
-
 #ifndef FRAME_CHAIN_COMBINE
 #define        FRAME_CHAIN_COMBINE(chain, thisframe) (chain)
 #endif
@@ -394,7 +388,7 @@ get_prev_frame (struct frame_info *next_frame)
                   sizeof (struct frame_info));
 
   /* Zero all fields by default.  */
-  memset (prev, 0, sizeof (struct frame_info);
+  memset (prev, 0, sizeof (struct frame_info));
 
   if (next_frame)
     next_frame->prev = prev;
@@ -442,9 +436,7 @@ get_prev_frame (struct frame_info *next_frame)
    Some machines won't use it.
    kingdon@cygnus.com, 13Apr93, 31Jan94, 14Dec94.  */
 
-#ifdef INIT_FRAME_PC_FIRST
   INIT_FRAME_PC_FIRST (fromleaf, prev);
-#endif
 
 #ifdef INIT_EXTRA_FRAME_INFO
   INIT_EXTRA_FRAME_INFO (fromleaf, prev);
@@ -1137,8 +1129,8 @@ generic_push_dummy_frame (void)
     if (INNER_THAN (dummy_frame->fp, fp))      /* stale -- destroy! */
       {
        dummy_frame_stack = dummy_frame->next;
-       free (dummy_frame->registers);
-       free (dummy_frame);
+       xfree (dummy_frame->registers);
+       xfree (dummy_frame);
        dummy_frame = dummy_frame_stack;
       }
     else
@@ -1193,8 +1185,8 @@ generic_pop_dummy_frame (void)
   write_register_bytes (0, dummy_frame->registers, REGISTER_BYTES);
   flush_cached_frames ();
 
-  free (dummy_frame->registers);
-  free (dummy_frame);
+  xfree (dummy_frame->registers);
+  xfree (dummy_frame);
 }
 
 /* Function: frame_chain_valid 
@@ -1249,7 +1241,7 @@ generic_fix_call_dummy (char *dummy, CORE_ADDR pc, CORE_ADDR fun, int nargs,
    calculated rather than fetched).  We will use not_lval for values
    fetched from generic dummy frames.
 
-   Set *ADDRP to the address, either in memory on as a REGISTER_BYTE
+   Set *ADDRP to the address, either in memory or as a REGISTER_BYTE
    offset into the registers array.  If the value is stored in a dummy
    frame, set *ADDRP to zero.
 
This page took 0.025939 seconds and 4 git commands to generate.