2003-04-01 Andrew Cagney <cagney@redhat.com>

Add frame debug info addresses:
	* frame-base.c: New file.
	* frame-base.h: New file.
	* frame.h (struct frame_base): Add opaque declaration.
	(get_frame_base): Update comment.
	(get_frame_base_address): Declare.
	(get_frame_locals_address): Declare.
	(get_frame_args_address): Declare.
	(struct frame_info): Add "base" and "base_cache".  Update
	comments on the unwinder.
	* frame.c: Include "frame-base.h".
	(get_frame_locals_address): New function.
	(get_frame_base_address): New function.
	(get_frame_args_address): New function.
	* findvar.c (read_var_value): Use get_frame_locals_address and
	get_frame_args_address.
	* stack.c (frame_info): Use get_frame_locals_address and
	get_frame_args_address.
	(FRAME_ARGS_ADDRESS_CORRECT): Delete conditionally defined macro,
	moved to "frame-base.c".
	* printcmd.c (print_frame_nameless_args): Ditto.
	* symtab.h (address_class): Update comments.
	* dwarf2loc.c (dwarf_expr_frame_base): Add note about
	get_frame_base_address.
	* dwarf2expr.c (execute_stack_op): Ditto.
	* Makefile.in (frame_base_h): Define.
	(frame.o): Update dependencies.
	(frame-base.o): Add dependencies.
	(SFILES): Add frame-base.c.
	(COMMON_OBS): Add frame-base.o.
This commit is contained in:
Andrew Cagney
2003-04-01 19:11:01 +00:00
parent 3d30e9c264
commit da62e63311
11 changed files with 400 additions and 61 deletions

View File

@@ -36,6 +36,7 @@
#include "annotate.h"
#include "language.h"
#include "frame-unwind.h"
#include "frame-base.h"
#include "command.h"
#include "gdbcmd.h"
@@ -1630,6 +1631,58 @@ get_frame_base (struct frame_info *fi)
return fi->frame;
}
/* High-level offsets into the frame. Used by the debug info. */
CORE_ADDR
get_frame_base_address (struct frame_info *fi)
{
if (fi->type != NORMAL_FRAME)
return 0;
if (fi->base == NULL)
fi->base = frame_base_find_by_pc (current_gdbarch, get_frame_pc (fi));
/* Sneaky: If the low-level unwind and high-level base code share a
common unwinder, let them share the prologue cache. */
if (fi->base->unwind == fi->unwind)
return fi->base->this_base (fi->next, &fi->prologue_cache);
return fi->base->this_base (fi->next, &fi->base_cache);
}
CORE_ADDR
get_frame_locals_address (struct frame_info *fi)
{
void **cache;
if (fi->type != NORMAL_FRAME)
return 0;
/* If there isn't a frame address method, find it. */
if (fi->base == NULL)
fi->base = frame_base_find_by_pc (current_gdbarch, get_frame_pc (fi));
/* Sneaky: If the low-level unwind and high-level base code share a
common unwinder, let them share the prologue cache. */
if (fi->base->unwind == fi->unwind)
cache = &fi->prologue_cache;
else
cache = &fi->base_cache;
return fi->base->this_locals (fi->next, cache);
}
CORE_ADDR
get_frame_args_address (struct frame_info *fi)
{
void **cache;
if (fi->type != NORMAL_FRAME)
return 0;
/* If there isn't a frame address method, find it. */
if (fi->base == NULL)
fi->base = frame_base_find_by_pc (current_gdbarch, get_frame_pc (fi));
/* Sneaky: If the low-level unwind and high-level base code share a
common unwinder, let them share the prologue cache. */
if (fi->base->unwind == fi->unwind)
cache = &fi->prologue_cache;
else
cache = &fi->base_cache;
return fi->base->this_args (fi->next, cache);
}
/* Level of the selected frame: 0 for innermost, 1 for its caller, ...
or -1 for a NULL frame. */