Convert frame unwinders to use the current frame and

"struct value".

	* frame.c (frame_debug): Make global.
	(get_frame_id): Pass this frame to unwinder routines.
	(frame_pc_unwind): Remove unused unwind->prev_pc support.
	(do_frame_register_read): Do not discard the return value of
	frame_register_read.
	(frame_register_unwind): Remove debug messages.  Use
	frame_unwind_register_value.
	(frame_unwind_register_value, get_frame_register_value): New
	functions.
	(create_new_frame, get_frame_base_address, get_frame_locals_address)
	(get_frame_args_address, get_frame_type): Pass this frame to
	unwinder routines.
	(frame_cleanup_after_sniffer, frame_prepare_for_sniffer): New
	functions.
	* frame.h: Update comments.
	(frame_debug, frame_unwind_register_value, get_frame_register_value)
	(frame_prepare_for_sniffer): Declare.
	* frame-unwind.h: Update comments and parameter names.
	(default_frame_sniffer): Declare.
	(frame_prev_register_ftype): Return a struct value *.
	(struct frame_unwind): Remove prev_pc member.
	(frame_unwind_sniffer_ftype, frame_unwind_append_sniffer): Delete.
	(frame_unwind_append_unwinder, frame_unwind_got_optimized)
	(frame_unwind_got_register, frame_unwind_got_memory)
	(frame_unwind_got_constant, frame_unwind_got_address): Declare.
	* frame-base.h: Update comments and parameter names.
	* valops.c (value_fetch_lazy): Use get_frame_register_value.  Iterate
	if necessary.  Add debugging output.
	* sentinel-frame.c (sentinel_frame_prev_register)
	(sentinel_frame_this_id): Update for new signature.
	(sentinel_frame_prev_pc): Delete.
	(sentinel_frame_unwinder): Remove prev_pc.
	* ia64-tdep.c (ia64_libunwind_frame_unwind): Do not initialize
	prev_pc.
	* libunwind-frame.c (libunwind_frame_unwind): Likewise.
	* frame-unwind.c (struct frame_unwind_table_entry): Remove sniffer.
	(frame_unwind_append_sniffer): Delete.
	(frame_unwind_append_unwinder): New function.
	(frame_unwind_find_by_frame): Take this frame.  Only use sniffers
	from unwinders.  Use frame_prepare_for_sniffer.
	(default_frame_sniffer, frame_unwind_got_optimized)
	(frame_unwind_got_register, frame_unwind_got_memory)
	(frame_unwind_got_constant, frame_unwind_got_address): New functions.
	* dummy-frame.c (dummy_frame_sniffer): Use gdbarch_dummy_id.
	(dummy_frame_prev_register, dummy_frame_this_id): Update for new
	signature.
	* gdbarch.sh: Replace unwind_dummy_id with dummy_id.
	* gdbarch.c, gdbarch.c: Regenerated.
	* frame-base.c (default_frame_base_address)
	(default_frame_locals_address, default_frame_args_address): Update
	for new signature.
	(frame_base_find_by_frame): Pass this frame to unwinder routines.
	* infcall.c (call_function_by_hand): Update comments.
	* Makefile.in (frame-unwind.o): Update dependencies.

	* gdbint.texinfo (Stack Frames): New chapter.
	(Algorithms): Move Frames text to the new chapter.
	(Target Conditionals): Delete SAVE_DUMMY_FRAME_TOS.  Document
	gdbarch_dummy_id instead of gdbarch_unwind_dummy_id.
This commit is contained in:
Daniel Jacobowitz
2008-04-30 21:16:46 +00:00
parent 9214ee5f5f
commit 669fac235d
19 changed files with 687 additions and 321 deletions

View File

@ -162,7 +162,7 @@ struct gdbarch
gdbarch_dwarf2_reg_to_regnum_ftype *dwarf2_reg_to_regnum;
gdbarch_register_name_ftype *register_name;
gdbarch_register_type_ftype *register_type;
gdbarch_unwind_dummy_id_ftype *unwind_dummy_id;
gdbarch_dummy_id_ftype *dummy_id;
int deprecated_fp_regnum;
gdbarch_push_dummy_call_ftype *push_dummy_call;
int call_dummy_location;
@ -284,7 +284,7 @@ struct gdbarch startup_gdbarch =
no_op_reg_to_regnum, /* dwarf2_reg_to_regnum */
0, /* register_name */
0, /* register_type */
0, /* unwind_dummy_id */
0, /* dummy_id */
-1, /* deprecated_fp_regnum */
0, /* push_dummy_call */
0, /* call_dummy_location */
@ -522,7 +522,7 @@ verify_gdbarch (struct gdbarch *gdbarch)
if (gdbarch->register_name == 0)
fprintf_unfiltered (log, "\n\tregister_name");
/* Skip verify of register_type, has predicate */
/* Skip verify of unwind_dummy_id, has predicate */
/* Skip verify of dummy_id, has predicate */
/* Skip verify of deprecated_fp_regnum, invalid_p == 0 */
/* Skip verify of push_dummy_call, has predicate */
/* Skip verify of call_dummy_location, invalid_p == 0 */
@ -714,6 +714,12 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
fprintf_unfiltered (file,
"gdbarch_dump: double_format = %s\n",
pformat (gdbarch->double_format));
fprintf_unfiltered (file,
"gdbarch_dump: gdbarch_dummy_id_p() = %d\n",
gdbarch_dummy_id_p (gdbarch));
fprintf_unfiltered (file,
"gdbarch_dump: dummy_id = <0x%lx>\n",
(long) gdbarch->dummy_id);
fprintf_unfiltered (file,
"gdbarch_dump: dwarf2_reg_to_regnum = <0x%lx>\n",
(long) gdbarch->dwarf2_reg_to_regnum);
@ -978,12 +984,6 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
fprintf_unfiltered (file,
"gdbarch_dump: target_desc = %s\n",
paddr_d ((long) gdbarch->target_desc));
fprintf_unfiltered (file,
"gdbarch_dump: gdbarch_unwind_dummy_id_p() = %d\n",
gdbarch_unwind_dummy_id_p (gdbarch));
fprintf_unfiltered (file,
"gdbarch_dump: unwind_dummy_id = <0x%lx>\n",
(long) gdbarch->unwind_dummy_id);
fprintf_unfiltered (file,
"gdbarch_dump: gdbarch_unwind_pc_p() = %d\n",
gdbarch_unwind_pc_p (gdbarch));
@ -1646,27 +1646,27 @@ set_gdbarch_register_type (struct gdbarch *gdbarch,
}
int
gdbarch_unwind_dummy_id_p (struct gdbarch *gdbarch)
gdbarch_dummy_id_p (struct gdbarch *gdbarch)
{
gdb_assert (gdbarch != NULL);
return gdbarch->unwind_dummy_id != NULL;
return gdbarch->dummy_id != NULL;
}
struct frame_id
gdbarch_unwind_dummy_id (struct gdbarch *gdbarch, struct frame_info *info)
gdbarch_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
{
gdb_assert (gdbarch != NULL);
gdb_assert (gdbarch->unwind_dummy_id != NULL);
gdb_assert (gdbarch->dummy_id != NULL);
if (gdbarch_debug >= 2)
fprintf_unfiltered (gdb_stdlog, "gdbarch_unwind_dummy_id called\n");
return gdbarch->unwind_dummy_id (gdbarch, info);
fprintf_unfiltered (gdb_stdlog, "gdbarch_dummy_id called\n");
return gdbarch->dummy_id (gdbarch, this_frame);
}
void
set_gdbarch_unwind_dummy_id (struct gdbarch *gdbarch,
gdbarch_unwind_dummy_id_ftype unwind_dummy_id)
set_gdbarch_dummy_id (struct gdbarch *gdbarch,
gdbarch_dummy_id_ftype dummy_id)
{
gdbarch->unwind_dummy_id = unwind_dummy_id;
gdbarch->dummy_id = dummy_id;
}
int