2003-01-09 Andrew Cagney <ac131313@redhat.com>

* frame.h (frame_obstack_zalloc): Replace frame_obstack_alloc.
	Update comments.
	* frame.c (frame_obstack_zalloc): Replace frame_obstack_alloc.
	(frame_saved_regs_zalloc): Update.
	(frame_saved_regs_register_unwind): Update.
	(create_new_frame): Update.
	(get_prev_frame): Update.
	(frame_extra_info_zalloc): Update.
	(deprecated_get_frame_saved_regs): Update.
	* dwarf2cfi.c (cfi_init_extra_frame_info): Update.
	* cris-tdep.c: Update comment.
This commit is contained in:
Andrew Cagney
2003-01-09 18:53:21 +00:00
parent 696d5a5b84
commit 479ab5a00d
5 changed files with 33 additions and 27 deletions

View File

@ -1,5 +1,17 @@
2003-01-09 Andrew Cagney <ac131313@redhat.com> 2003-01-09 Andrew Cagney <ac131313@redhat.com>
* frame.h (frame_obstack_zalloc): Replace frame_obstack_alloc.
Update comments.
* frame.c (frame_obstack_zalloc): Replace frame_obstack_alloc.
(frame_saved_regs_zalloc): Update.
(frame_saved_regs_register_unwind): Update.
(create_new_frame): Update.
(get_prev_frame): Update.
(frame_extra_info_zalloc): Update.
(deprecated_get_frame_saved_regs): Update.
* dwarf2cfi.c (cfi_init_extra_frame_info): Update.
* cris-tdep.c: Update comment.
* somsolib.h: Fix function indentation. * somsolib.h: Fix function indentation.
* disasm.c, buildsym.c, buildsym.h: Eliminate PTR. * disasm.c, buildsym.c, buildsym.h: Eliminate PTR.
* gnu-v2-abi.c, f-typeprint.c, x86-64-linux-tdep.c: Eliminate STREQ. * gnu-v2-abi.c, f-typeprint.c, x86-64-linux-tdep.c: Eliminate STREQ.

View File

@ -1148,8 +1148,7 @@ cris_frameless_function_invocation (struct frame_info *fi)
/* See frame.h. Determines the address of all registers in the current stack /* See frame.h. Determines the address of all registers in the current stack
frame storing each in frame->saved_regs. Space for frame->saved_regs shall frame storing each in frame->saved_regs. Space for frame->saved_regs shall
be allocated by FRAME_INIT_SAVED_REGS using either frame_saved_regs_zalloc be allocated by FRAME_INIT_SAVED_REGS using frame_saved_regs_zalloc. */
or frame_obstack_alloc. */
void void
cris_frame_init_saved_regs (struct frame_info *fi) cris_frame_init_saved_regs (struct frame_info *fi)

View File

@ -1770,9 +1770,9 @@ cfi_init_extra_frame_info (int fromleaf, struct frame_info *fi)
unwind_tmp_obstack_init (); unwind_tmp_obstack_init ();
fs = frame_state_alloc (); fs = frame_state_alloc ();
deprecated_set_frame_context (fi, frame_obstack_alloc (sizeof (struct context))); deprecated_set_frame_context (fi, frame_obstack_zalloc (sizeof (struct context)));
UNWIND_CONTEXT (fi)->reg = UNWIND_CONTEXT (fi)->reg =
frame_obstack_alloc (sizeof (struct context_reg) * NUM_REGS); frame_obstack_zalloc (sizeof (struct context_reg) * NUM_REGS);
memset (UNWIND_CONTEXT (fi)->reg, 0, memset (UNWIND_CONTEXT (fi)->reg, 0,
sizeof (struct context_reg) * NUM_REGS); sizeof (struct context_reg) * NUM_REGS);

View File

@ -456,17 +456,18 @@ static struct frame_info *current_frame;
static struct obstack frame_cache_obstack; static struct obstack frame_cache_obstack;
void * void *
frame_obstack_alloc (unsigned long size) frame_obstack_zalloc (unsigned long size)
{ {
return obstack_alloc (&frame_cache_obstack, size); void *data = obstack_alloc (&frame_cache_obstack, size);
memset (data, 0, size);
return data;
} }
CORE_ADDR * CORE_ADDR *
frame_saved_regs_zalloc (struct frame_info *fi) frame_saved_regs_zalloc (struct frame_info *fi)
{ {
fi->saved_regs = (CORE_ADDR *) fi->saved_regs = (CORE_ADDR *)
frame_obstack_alloc (SIZEOF_FRAME_SAVED_REGS); frame_obstack_zalloc (SIZEOF_FRAME_SAVED_REGS);
memset (fi->saved_regs, 0, SIZEOF_FRAME_SAVED_REGS);
return fi->saved_regs; return fi->saved_regs;
} }
@ -605,14 +606,13 @@ frame_saved_regs_register_unwind (struct frame_info *frame, void **cache,
{ {
int sizeof_cache = ((NUM_REGS + NUM_PSEUDO_REGS) int sizeof_cache = ((NUM_REGS + NUM_PSEUDO_REGS)
* sizeof (void *)); * sizeof (void *));
regs = frame_obstack_alloc (sizeof_cache); regs = frame_obstack_zalloc (sizeof_cache);
memset (regs, 0, sizeof_cache);
(*cache) = regs; (*cache) = regs;
} }
if (regs[regnum] == NULL) if (regs[regnum] == NULL)
{ {
regs[regnum] regs[regnum]
= frame_obstack_alloc (REGISTER_RAW_SIZE (regnum)); = frame_obstack_zalloc (REGISTER_RAW_SIZE (regnum));
read_memory (frame->saved_regs[regnum], regs[regnum], read_memory (frame->saved_regs[regnum], regs[regnum],
REGISTER_RAW_SIZE (regnum)); REGISTER_RAW_SIZE (regnum));
} }
@ -847,12 +847,7 @@ create_new_frame (CORE_ADDR addr, CORE_ADDR pc)
struct frame_info *fi; struct frame_info *fi;
enum frame_type type; enum frame_type type;
fi = (struct frame_info *) fi = frame_obstack_zalloc (sizeof (struct frame_info));
obstack_alloc (&frame_cache_obstack,
sizeof (struct frame_info));
/* Zero all fields by default. */
memset (fi, 0, sizeof (struct frame_info));
fi->frame = addr; fi->frame = addr;
fi->pc = pc; fi->pc = pc;
@ -1018,10 +1013,7 @@ get_prev_frame (struct frame_info *next_frame)
return 0; return 0;
/* Create an initially zero previous frame. */ /* Create an initially zero previous frame. */
prev = (struct frame_info *) prev = frame_obstack_zalloc (sizeof (struct frame_info));
obstack_alloc (&frame_cache_obstack,
sizeof (struct frame_info));
memset (prev, 0, sizeof (struct frame_info));
/* Link it in. */ /* Link it in. */
next_frame->prev = prev; next_frame->prev = prev;
@ -1250,7 +1242,7 @@ deprecated_get_frame_saved_regs (struct frame_info *frame,
if (frame->saved_regs == NULL) if (frame->saved_regs == NULL)
{ {
frame->saved_regs = (CORE_ADDR *) frame->saved_regs = (CORE_ADDR *)
frame_obstack_alloc (SIZEOF_FRAME_SAVED_REGS); frame_obstack_zalloc (SIZEOF_FRAME_SAVED_REGS);
} }
if (saved_regs_addr == NULL) if (saved_regs_addr == NULL)
{ {
@ -1275,8 +1267,7 @@ get_frame_extra_info (struct frame_info *fi)
struct frame_extra_info * struct frame_extra_info *
frame_extra_info_zalloc (struct frame_info *fi, long size) frame_extra_info_zalloc (struct frame_info *fi, long size)
{ {
fi->extra_info = frame_obstack_alloc (size); fi->extra_info = frame_obstack_zalloc (size);
memset (fi->extra_info, 0, size);
return fi->extra_info; return fi->extra_info;
} }

View File

@ -310,7 +310,7 @@ extern struct frame_id frame_id_unwind (struct frame_info *frame);
UNWIND_CACHE is provided as mechanism for implementing a per-frame UNWIND_CACHE is provided as mechanism for implementing a per-frame
local cache. It's initial value being NULL. Memory for that cache local cache. It's initial value being NULL. Memory for that cache
should be allocated using frame_obstack_alloc(). should be allocated using frame_obstack_zalloc().
Register window architectures (eg SPARC) should note that REGNUM Register window architectures (eg SPARC) should note that REGNUM
identifies the register for the previous frame. For instance, a identifies the register for the previous frame. For instance, a
@ -413,7 +413,7 @@ struct frame_info
/* Anything extra for this structure that may have been defined /* Anything extra for this structure that may have been defined
in the machine dependent files. */ in the machine dependent files. */
/* Allocated by frame_obstack_alloc () which is called / /* Allocated by frame_extra_info_zalloc () which is called /
initialized by INIT_EXTRA_FRAME_INFO */ initialized by INIT_EXTRA_FRAME_INFO */
struct frame_extra_info *extra_info; struct frame_extra_info *extra_info;
@ -472,7 +472,11 @@ enum print_what
#define SIZEOF_FRAME_SAVED_REGS \ #define SIZEOF_FRAME_SAVED_REGS \
(sizeof (CORE_ADDR) * (NUM_REGS+NUM_PSEUDO_REGS)) (sizeof (CORE_ADDR) * (NUM_REGS+NUM_PSEUDO_REGS))
extern void *frame_obstack_alloc (unsigned long size); /* Allocate zero initialized memory from the frame cache obstack.
Appendices to the frame info (such as the unwind cache) should
allocate memory using this method. */
extern void *frame_obstack_zalloc (unsigned long size);
/* If FRAME_CHAIN_VALID returns zero it means that the given frame /* If FRAME_CHAIN_VALID returns zero it means that the given frame
is the outermost one and has no caller. */ is the outermost one and has no caller. */