/* Target-dependent code for Atmel AVR, for GDB.
- Copyright (C) 1996-2021 Free Software Foundation, Inc.
+ Copyright (C) 1996-2022 Free Software Foundation, Inc.
This file is part of GDB.
#include "dis-asm.h"
#include "objfiles.h"
#include <algorithm>
+#include "gdbarch.h"
/* AVR Background:
/* Resolve offset (in words) from __prologue_saves__ symbol.
Which is a pushes count in `-mcall-prologues' mode */
- num_pushes = AVR_MAX_PUSHES - (i - BMSYMBOL_VALUE_ADDRESS (msymbol)) / 2;
+ num_pushes = AVR_MAX_PUSHES - (i - msymbol.value_address ()) / 2;
if (num_pushes > AVR_MAX_PUSHES)
{
- fprintf_unfiltered (gdb_stderr, _("Num pushes too large: %d\n"),
- num_pushes);
+ gdb_printf (gdb_stderr, _("Num pushes too large: %d\n"),
+ num_pushes);
num_pushes = 0;
}
/* When arguments must be pushed onto the stack, they go on in reverse
order. The below implements a FILO (stack) to do this. */
-struct stack_item
+struct avr_stack_item
{
int len;
- struct stack_item *prev;
+ struct avr_stack_item *prev;
gdb_byte *data;
};
-static struct stack_item *
-push_stack_item (struct stack_item *prev, const bfd_byte *contents, int len)
+static struct avr_stack_item *
+push_stack_item (struct avr_stack_item *prev, const bfd_byte *contents,
+ int len)
{
- struct stack_item *si;
- si = XNEW (struct stack_item);
+ struct avr_stack_item *si;
+ si = XNEW (struct avr_stack_item);
si->data = (gdb_byte *) xmalloc (len);
si->len = len;
si->prev = prev;
return si;
}
-static struct stack_item *pop_stack_item (struct stack_item *si);
-static struct stack_item *
-pop_stack_item (struct stack_item *si)
+static struct avr_stack_item *
+pop_stack_item (struct avr_stack_item *si)
{
- struct stack_item *dead = si;
+ struct avr_stack_item *dead = si;
si = si->prev;
xfree (dead->data);
xfree (dead);
int call_length = tdep->call_length;
CORE_ADDR return_pc = avr_convert_iaddr_to_raw (bp_addr);
int regnum = AVR_ARGN_REGNUM;
- struct stack_item *si = NULL;
+ struct avr_stack_item *si = NULL;
if (return_method == return_method_struct)
{
if (!buf)
{
- fprintf_unfiltered (gdb_stderr,
- _("ERR: info io_registers NOT supported "
- "by current target\n"));
+ gdb_printf (gdb_stderr,
+ _("ERR: info io_registers NOT supported "
+ "by current target\n"));
return;
}
if (sscanf (bufstr, "%x", &nreg) != 1)
{
- fprintf_unfiltered (gdb_stderr,
- _("Error fetching number of io registers\n"));
+ gdb_printf (gdb_stderr,
+ _("Error fetching number of io registers\n"));
return;
}
- reinitialize_more_filter ();
-
- printf_unfiltered (_("Target has %u io registers:\n\n"), nreg);
+ gdb_printf (_("Target has %u io registers:\n\n"), nreg);
/* only fetch up to 8 registers at a time to keep the buffer small */
int step = 8;
if (!buf)
{
- fprintf_unfiltered (gdb_stderr,
- _("ERR: error reading avr.io_reg:%x,%x\n"),
- i, j);
+ gdb_printf (gdb_stderr,
+ _("ERR: error reading avr.io_reg:%x,%x\n"),
+ i, j);
return;
}
{
if (sscanf (p, "%[^,],%x;", query, &val) == 2)
{
- printf_filtered ("[%02x] %-15s : %02x\n", k, query, val);
+ gdb_printf ("[%02x] %-15s : %02x\n", k, query, val);
while ((*p != ';') && (*p != '\0'))
p++;
p++; /* skip over ';' */