X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=gdb%2Favr-tdep.c;h=088fe51b4c0ebb77a40ab594e94a031c81185ae9;hb=5eb264df40e1e3ffeb2627456889a1dc5df00f16;hp=4fcae530f51f23edf6562d3cd1f25b18b607235f;hpb=9a3c826307ae6ad4dd6fbd72431e7d9d4947f1dd;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/avr-tdep.c b/gdb/avr-tdep.c index 4fcae530f5..088fe51b4c 100644 --- a/gdb/avr-tdep.c +++ b/gdb/avr-tdep.c @@ -1,6 +1,6 @@ /* Target-dependent code for Atmel AVR, for GDB. - Copyright (C) 1996-2015 Free Software Foundation, Inc. + Copyright (C) 1996-2016 Free Software Foundation, Inc. This file is part of GDB. @@ -111,6 +111,7 @@ enum AVR_ARG1_REGNUM = 24, /* Single byte argument */ AVR_ARGN_REGNUM = 25, /* Multi byte argments */ + AVR_LAST_ARG_REGNUM = 8, /* Last argument register */ AVR_RET1_REGNUM = 24, /* Single byte return value */ AVR_RETN_REGNUM = 25, /* Multi byte return value */ @@ -1198,7 +1199,7 @@ struct stack_item { int len; struct stack_item *prev; - void *data; + gdb_byte *data; }; static struct stack_item * @@ -1206,7 +1207,7 @@ push_stack_item (struct stack_item *prev, const bfd_byte *contents, int len) { struct stack_item *si; si = XNEW (struct stack_item); - si->data = xmalloc (len); + si->data = (gdb_byte *) xmalloc (len); si->len = len; si->prev = prev; memcpy (si->data, contents, len); @@ -1298,23 +1299,24 @@ avr_push_dummy_call (struct gdbarch *gdbarch, struct value *function, const bfd_byte *contents = value_contents (arg); int len = TYPE_LENGTH (type); - /* Calculate the potential last register needed. */ - last_regnum = regnum - (len + (len & 1)); + /* Calculate the potential last register needed. + E.g. For length 2, registers regnum and regnum-1 (say 25 and 24) + shall be used. So, last needed register will be regnum-1(24). */ + last_regnum = regnum - (len + (len & 1)) + 1; /* If there are registers available, use them. Once we start putting stuff on the stack, all subsequent args go on stack. */ - if ((si == NULL) && (last_regnum >= 8)) + if ((si == NULL) && (last_regnum >= AVR_LAST_ARG_REGNUM)) { - ULONGEST val; - /* Skip a register for odd length args. */ if (len & 1) regnum--; - val = extract_unsigned_integer (contents, len, byte_order); + /* Write MSB of argument into register and subsequent bytes in + decreasing register numbers. */ for (j = 0; j < len; j++) regcache_cooked_write_unsigned - (regcache, regnum--, val >> (8 * (len - j - 1))); + (regcache, regnum--, contents[len - j - 1]); } /* No registers available, push the args onto the stack. */ else @@ -1364,9 +1366,6 @@ avr_dwarf_reg_to_regnum (struct gdbarch *gdbarch, int reg) return reg; if (reg == 32) return AVR_SP_REGNUM; - - warning (_("Unmapped DWARF Register #%d encountered."), reg); - return -1; } @@ -1635,7 +1634,6 @@ _initialize_avr_tdep (void) /* FIXME: TRoth/2002-02-18: This should probably be changed to 'info avr io_registers' to signify it is not available on other platforms. */ - add_cmd ("io_registers", class_info, avr_io_reg_read_command, - _("query remote avr target for io space register values"), - &infolist); + add_info ("io_registers", avr_io_reg_read_command, + _("query remote avr target for io space register values")); }