Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-/* Contributed by Theodore A. Roth, troth@verinet.com */
+/* Contributed by Theodore A. Roth, troth@openavr.org */
/* Portions of this file were taken from the original gdb-4.18 patch developed
by Denis Chertykov, denisc@overta.ru */
fprintf_unfiltered (gdb_stderr, "CODE_SPACE ---->> ptr->addr: 0x%lx\n",
addr);
fprintf_unfiltered (gdb_stderr,
- "+++ If you see this, please send me an email <troth@verinet.com>\n");
+ "+++ If you see this, please send me an email <troth@openavr.org>\n");
}
/* Is it a code address? */
pointer? */
static void
-avr_remote_translate_xfer_address (CORE_ADDR memaddr, int nr_bytes,
+avr_remote_translate_xfer_address (struct gdbarch *gdbarch,
+ struct regcache *regcache,
+ CORE_ADDR memaddr, int nr_bytes,
CORE_ADDR *targ_addr, int *targ_len)
{
long out_addr;
return addr * 2;
}
-/* avr_scan_prologue is also used as the frame_init_saved_regs().
+/* avr_scan_prologue is also used as the
+ deprecated_frame_init_saved_regs().
Put here the code to store, into fi->saved_regs, the addresses of
the saved registers of frame described by FRAME_INFO. This
int reg;
if (get_next_frame (fi))
- deprecated_update_frame_pc_hack (fi, FRAME_SAVED_PC (get_next_frame (fi)));
+ deprecated_update_frame_pc_hack (fi, DEPRECATED_FRAME_SAVED_PC (get_next_frame (fi)));
frame_extra_info_zalloc (fi, sizeof (struct frame_extra_info));
frame_saved_regs_zalloc (fi);
if (DEPRECATED_PC_IN_CALL_DUMMY (get_frame_pc (fi), get_frame_base (fi),
get_frame_base (fi)))
{
- /* We need to setup fi->frame here because run_stack_dummy gets it wrong
- by assuming it's always FP. */
+ /* We need to setup fi->frame here because call_function_by_hand
+ gets it wrong by assuming it's always FP. */
deprecated_update_frame_base_hack (fi, deprecated_read_register_dummy (get_frame_pc (fi), get_frame_base (fi),
AVR_PC_REGNUM));
}
return (m2 | (m1 << 8)) * 2;
}
-/* Figure out where in REGBUF the called function has left its return value.
- Copy that into VALBUF. */
-
-static void
-avr_extract_return_value (struct type *type, char *regbuf, char *valbuf)
-{
- int wordsize, len;
-
- wordsize = 2;
-
- len = TYPE_LENGTH (type);
-
- switch (len)
- {
- case 1: /* (char) */
- case 2: /* (short), (int) */
- memcpy (valbuf, regbuf + REGISTER_BYTE (24), 2);
- break;
- case 4: /* (long), (float) */
- memcpy (valbuf, regbuf + REGISTER_BYTE (22), 4);
- break;
- case 8: /* (double) (doesn't seem to happen, which is good,
- because this almost certainly isn't right. */
- error ("I don't know how a double is returned.");
- break;
- }
-}
-
/* Returns the return address for a dummy. */
static CORE_ADDR
return entry_point_address ();
}
-/* Place the appropriate value in the appropriate registers.
- Primarily used by the RETURN command. */
-
-static void
-avr_store_return_value (struct type *type, char *valbuf)
-{
- int wordsize, len, regval;
-
- wordsize = 2;
-
- len = TYPE_LENGTH (type);
- switch (len)
- {
- case 1: /* char */
- case 2: /* short, int */
- regval = extract_address (valbuf, len);
- write_register (0, regval);
- break;
- case 4: /* long, float */
- regval = extract_address (valbuf, len);
- write_register (0, regval >> 16);
- write_register (1, regval & 0xffff);
- break;
- case 8: /* presumeably double, but doesn't seem to happen */
- error ("I don't know how to return a double.");
- break;
- }
-}
-
/* Setup the return address for a dummy frame, as called by
call_function_by_hand. Only necessary when you are using an empty
CALL_DUMMY. */
/* Given a GDB frame, determine the address of the calling function's
frame. This will be used to create a new GDB frame struct, and
- then INIT_EXTRA_FRAME_INFO and DEPRECATED_INIT_FRAME_PC will be
- called for the new frame.
+ then DEPRECATED_INIT_EXTRA_FRAME_INFO and DEPRECATED_INIT_FRAME_PC
+ will be called for the new frame.
For us, the frame address is its stack pointer value, so we look up
the function prologue to determine the caller's sp value, and return it. */
write_register (0, addr);
}
-/* Extract from an array REGBUF containing the (raw) register state
- the address in which a function should return its structure value,
- as a CORE_ADDR (or an expression that can be used as one). */
-
-static CORE_ADDR
-avr_extract_struct_value_address (char *regbuf)
-{
- return (extract_address ((regbuf) + REGISTER_BYTE (0),
- REGISTER_RAW_SIZE (0)) | AVR_SMEM_START);
-}
-
/* Setup the function arguments for calling a function in the inferior.
On the AVR architecture, there are 18 registers (R25 to R8) which are
set_gdbarch_read_pc (gdbarch, avr_read_pc);
set_gdbarch_write_pc (gdbarch, avr_write_pc);
- set_gdbarch_read_fp (gdbarch, avr_read_fp);
+ set_gdbarch_deprecated_target_read_fp (gdbarch, avr_read_fp);
set_gdbarch_read_sp (gdbarch, avr_read_sp);
- set_gdbarch_write_sp (gdbarch, avr_write_sp);
+ set_gdbarch_deprecated_dummy_write_sp (gdbarch, avr_write_sp);
set_gdbarch_num_regs (gdbarch, AVR_NUM_REGS);
set_gdbarch_sp_regnum (gdbarch, AVR_SP_REGNUM);
- set_gdbarch_fp_regnum (gdbarch, AVR_FP_REGNUM);
+ set_gdbarch_deprecated_fp_regnum (gdbarch, AVR_FP_REGNUM);
set_gdbarch_pc_regnum (gdbarch, AVR_PC_REGNUM);
set_gdbarch_register_name (gdbarch, avr_register_name);
- set_gdbarch_register_size (gdbarch, 1);
+ set_gdbarch_deprecated_register_size (gdbarch, 1);
set_gdbarch_register_bytes (gdbarch, AVR_NUM_REG_BYTES);
set_gdbarch_register_byte (gdbarch, avr_register_byte);
set_gdbarch_register_raw_size (gdbarch, avr_register_raw_size);
- set_gdbarch_max_register_raw_size (gdbarch, 4);
+ set_gdbarch_deprecated_max_register_raw_size (gdbarch, 4);
set_gdbarch_register_virtual_size (gdbarch, avr_register_virtual_size);
- set_gdbarch_max_register_virtual_size (gdbarch, 4);
+ set_gdbarch_deprecated_max_register_virtual_size (gdbarch, 4);
set_gdbarch_register_virtual_type (gdbarch, avr_register_virtual_type);
set_gdbarch_print_insn (gdbarch, print_insn_avr);
set_gdbarch_call_dummy_address (gdbarch, avr_call_dummy_address);
- set_gdbarch_call_dummy_start_offset (gdbarch, 0);
- set_gdbarch_call_dummy_breakpoint_offset_p (gdbarch, 1);
- set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 0);
- set_gdbarch_call_dummy_length (gdbarch, 0);
- set_gdbarch_call_dummy_p (gdbarch, 1);
- set_gdbarch_call_dummy_words (gdbarch, avr_call_dummy_words);
- set_gdbarch_call_dummy_stack_adjust_p (gdbarch, 0);
- set_gdbarch_fix_call_dummy (gdbarch, generic_fix_call_dummy);
+ set_gdbarch_deprecated_call_dummy_words (gdbarch, avr_call_dummy_words);
/* set_gdbarch_believe_pcc_promotion (gdbarch, 1); // TRoth: should this be set? */
set_gdbarch_address_to_pointer (gdbarch, avr_address_to_pointer);
set_gdbarch_pointer_to_address (gdbarch, avr_pointer_to_address);
- set_gdbarch_deprecated_extract_return_value (gdbarch, avr_extract_return_value);
- set_gdbarch_push_arguments (gdbarch, avr_push_arguments);
- set_gdbarch_push_dummy_frame (gdbarch, generic_push_dummy_frame);
- set_gdbarch_push_return_address (gdbarch, avr_push_return_address);
- set_gdbarch_pop_frame (gdbarch, avr_pop_frame);
-
- set_gdbarch_deprecated_store_return_value (gdbarch, avr_store_return_value);
+ set_gdbarch_deprecated_push_arguments (gdbarch, avr_push_arguments);
+ set_gdbarch_deprecated_push_return_address (gdbarch, avr_push_return_address);
+ set_gdbarch_deprecated_pop_frame (gdbarch, avr_pop_frame);
set_gdbarch_use_struct_convention (gdbarch, generic_use_struct_convention);
- set_gdbarch_store_struct_return (gdbarch, avr_store_struct_return);
- set_gdbarch_deprecated_extract_struct_value_address
- (gdbarch, avr_extract_struct_value_address);
+ set_gdbarch_deprecated_store_struct_return (gdbarch, avr_store_struct_return);
- set_gdbarch_frame_init_saved_regs (gdbarch, avr_scan_prologue);
- set_gdbarch_init_extra_frame_info (gdbarch, avr_init_extra_frame_info);
+ set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, avr_scan_prologue);
+ set_gdbarch_deprecated_init_extra_frame_info (gdbarch, avr_init_extra_frame_info);
set_gdbarch_skip_prologue (gdbarch, avr_skip_prologue);
-/* set_gdbarch_prologue_frameless_p (gdbarch, avr_prologue_frameless_p); */
set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
set_gdbarch_decr_pc_after_break (gdbarch, 0);
avr_remote_translate_xfer_address);
set_gdbarch_frame_args_skip (gdbarch, 0);
set_gdbarch_frameless_function_invocation (gdbarch, frameless_look_for_prologue); /* ??? */
- set_gdbarch_frame_chain (gdbarch, avr_frame_chain);
- set_gdbarch_frame_saved_pc (gdbarch, avr_frame_saved_pc);
+ set_gdbarch_deprecated_frame_chain (gdbarch, avr_frame_chain);
+ set_gdbarch_deprecated_frame_saved_pc (gdbarch, avr_frame_saved_pc);
set_gdbarch_frame_args_address (gdbarch, avr_frame_address);
set_gdbarch_frame_locals_address (gdbarch, avr_frame_address);
- set_gdbarch_saved_pc_after_call (gdbarch, avr_saved_pc_after_call);
+ set_gdbarch_deprecated_saved_pc_after_call (gdbarch, avr_saved_pc_after_call);
set_gdbarch_frame_num_args (gdbarch, frame_num_args_unknown);
set_gdbarch_convert_from_func_ptr_addr (gdbarch,
for (i = 0; i < nreg; i += step)
{
- j = step - (nreg % step); /* how many registers this round? */
+ /* how many registers this round? */
+ j = step;
+ if ((i+j) >= nreg)
+ j = nreg - i; /* last block is less than 8 registers */
snprintf (query, sizeof (query) - 1, "avr.io_reg:%x,%x", i, j);
target_query ((int) 'R', query, buf, &bufsiz);