X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=gdb%2Fmn10300-tdep.c;h=5e3a5f82bd3dc3a8016464540e014e0de21d5c6e;hb=36710c632ceea0a828b1084bb5faaa224910f22f;hp=1820b1dd2e779803997666189eaeeef474577c87;hpb=1b1d37945b97f73da1c3f1bf0548aa476eca3b4f;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/mn10300-tdep.c b/gdb/mn10300-tdep.c index 1820b1dd2e..5e3a5f82bd 100644 --- a/gdb/mn10300-tdep.c +++ b/gdb/mn10300-tdep.c @@ -1,7 +1,7 @@ /* Target-dependent code for the Matsushita MN10300 for GDB, the GNU debugger. - Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software - Foundation, Inc. + Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free + Software Foundation, Inc. This file is part of GDB. @@ -28,7 +28,7 @@ #include "bfd.h" #include "gdb_string.h" #include "gdbcore.h" -#include "symfile.h" +#include "objfiles.h" #include "regcache.h" #include "arch-utils.h" #include "gdb_assert.h" @@ -130,13 +130,6 @@ mn10300_extract_return_value (struct type *type, char *regbuf, char *valbuf) memcpy (valbuf, regbuf + DEPRECATED_REGISTER_BYTE (0), TYPE_LENGTH (type)); } -static CORE_ADDR -mn10300_extract_struct_value_address (char *regbuf) -{ - return extract_unsigned_integer (regbuf + DEPRECATED_REGISTER_BYTE (4), - REGISTER_RAW_SIZE (4)); -} - static void mn10300_store_return_value (struct type *type, char *valbuf) { @@ -152,25 +145,16 @@ static struct frame_info *analyze_dummy_frame (CORE_ADDR, CORE_ADDR); static struct frame_info * analyze_dummy_frame (CORE_ADDR pc, CORE_ADDR frame) { - static struct frame_info *dummy = NULL; - if (dummy == NULL) - { - struct frame_extra_info *extra_info; - CORE_ADDR *saved_regs; - dummy = deprecated_frame_xmalloc (); - saved_regs = xmalloc (SIZEOF_FRAME_SAVED_REGS); - deprecated_set_frame_saved_regs_hack (dummy, saved_regs); - extra_info = XMALLOC (struct frame_extra_info); - deprecated_set_frame_extra_info_hack (dummy, extra_info); - } - deprecated_set_frame_next_hack (dummy, NULL); - deprecated_set_frame_prev_hack (dummy, NULL); + struct cleanup *old_chain = make_cleanup (null_cleanup, NULL); + struct frame_info *dummy + = deprecated_frame_xmalloc_with_cleanup (SIZEOF_FRAME_SAVED_REGS, + sizeof (struct frame_extra_info)); deprecated_update_frame_pc_hack (dummy, pc); deprecated_update_frame_base_hack (dummy, frame); get_frame_extra_info (dummy)->status = 0; get_frame_extra_info (dummy)->stack_size = 0; - memset (deprecated_get_frame_saved_regs (dummy), '\000', SIZEOF_FRAME_SAVED_REGS); mn10300_analyze_prologue (dummy, pc); + do_cleanups (old_chain); return dummy; } @@ -749,7 +733,7 @@ mn10300_pop_frame_regular (struct frame_info *frame) ULONGEST value; value = read_memory_unsigned_integer (deprecated_get_frame_saved_regs (frame)[regnum], - REGISTER_RAW_SIZE (regnum)); + DEPRECATED_REGISTER_RAW_SIZE (regnum)); write_register (regnum, value); } @@ -765,10 +749,13 @@ mn10300_pop_frame_regular (struct frame_info *frame) static void mn10300_pop_frame (void) { - /* This function checks for and handles generic dummy frames, and - calls back to our function for ordinary frames. */ - generic_pop_current_frame (mn10300_pop_frame_regular); - + struct frame_info *frame = get_current_frame (); + if (get_frame_type (frame) == DUMMY_FRAME) + /* NOTE: cagney/2002-22-23: Does this ever occure? Surely a dummy + frame will have already been poped by the "infrun.c" code. */ + deprecated_pop_dummy_frame (); + else + mn10300_pop_frame_regular (frame); /* Throw away any cached frame information. */ flush_cached_frames (); } @@ -1039,14 +1026,14 @@ mn10300_print_register (const char *name, int regnum, int reg_width) int byte; if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) { - for (byte = REGISTER_RAW_SIZE (regnum) - REGISTER_VIRTUAL_SIZE (regnum); - byte < REGISTER_RAW_SIZE (regnum); + for (byte = DEPRECATED_REGISTER_RAW_SIZE (regnum) - DEPRECATED_REGISTER_VIRTUAL_SIZE (regnum); + byte < DEPRECATED_REGISTER_RAW_SIZE (regnum); byte++) printf_filtered ("%02x", (unsigned char) raw_buffer[byte]); } else { - for (byte = REGISTER_VIRTUAL_SIZE (regnum) - 1; + for (byte = DEPRECATED_REGISTER_VIRTUAL_SIZE (regnum) - 1; byte >= 0; byte--) printf_filtered ("%02x", (unsigned char) raw_buffer[byte]); @@ -1182,8 +1169,6 @@ mn10300_gdbarch_init (struct gdbarch_info info, /* Breakpoints. */ set_gdbarch_breakpoint_from_pc (gdbarch, mn10300_breakpoint_from_pc); - set_gdbarch_function_start_offset (gdbarch, 0); - set_gdbarch_decr_pc_after_break (gdbarch, 0); /* Stack unwinding. */ set_gdbarch_inner_than (gdbarch, core_addr_lessthan); @@ -1193,20 +1178,16 @@ mn10300_gdbarch_init (struct gdbarch_info info, set_gdbarch_deprecated_frame_chain (gdbarch, mn10300_frame_chain); set_gdbarch_deprecated_frame_saved_pc (gdbarch, mn10300_frame_saved_pc); set_gdbarch_deprecated_extract_return_value (gdbarch, mn10300_extract_return_value); - set_gdbarch_deprecated_extract_struct_value_address - (gdbarch, mn10300_extract_struct_value_address); set_gdbarch_deprecated_store_return_value (gdbarch, mn10300_store_return_value); set_gdbarch_deprecated_store_struct_return (gdbarch, mn10300_store_struct_return); set_gdbarch_deprecated_pop_frame (gdbarch, mn10300_pop_frame); set_gdbarch_skip_prologue (gdbarch, mn10300_skip_prologue); - set_gdbarch_frame_args_skip (gdbarch, 0); /* That's right, we're using the stack pointer as our frame pointer. */ set_gdbarch_deprecated_target_read_fp (gdbarch, mn10300_read_fp); /* Calling functions in the inferior from GDB. */ set_gdbarch_deprecated_call_dummy_words (gdbarch, mn10300_call_dummy_words); set_gdbarch_deprecated_sizeof_call_dummy_words (gdbarch, sizeof (mn10300_call_dummy_words)); - set_gdbarch_deprecated_pc_in_call_dummy (gdbarch, deprecated_pc_in_call_dummy_at_entry_point); set_gdbarch_deprecated_push_arguments (gdbarch, mn10300_push_arguments); set_gdbarch_deprecated_reg_struct_has_addr (gdbarch, mn10300_reg_struct_has_addr); @@ -1228,6 +1209,5 @@ void _initialize_mn10300_tdep (void) { /* printf("_initialize_mn10300_tdep\n"); */ - - register_gdbarch_init (bfd_arch_mn10300, mn10300_gdbarch_init); + gdbarch_register (bfd_arch_mn10300, mn10300_gdbarch_init, mn10300_dump_tdep); }