/* 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.
#include "target.h" /* for target_has_stack */
#include "inferior.h" /* for read_pc */
#include "annotate.h"
+#include "regcache.h"
/* Prototypes for exported functions. */
{
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 =
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);
{
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);
}
/* 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
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);
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
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
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.