/* Native support code for PPC AIX, for GDB the GNU debugger.
- Copyright (C) 2006-2016 Free Software Foundation, Inc.
+ Copyright (C) 2006-2018 Free Software Foundation, Inc.
Free Software Foundation, Inc.
#include "xcoffread.h"
#include "solib.h"
#include "solib-aix.h"
+#include "target-float.h"
#include "xml-utils.h"
/* If the kernel has to deliver a signal, it pushes a sigcontext
/* Floating-point registers. */
336, /* f0_offset */
56, /* fpscr_offset */
- 4, /* fpscr_size */
-
- /* AltiVec registers. */
- -1, /* vr0_offset */
- -1, /* vscr_offset */
- -1 /* vrsave_offset */
+ 4 /* fpscr_size */
};
static struct ppc_reg_offsets rs6000_aix64_reg_offsets =
/* Floating-point registers. */
312, /* f0_offset */
296, /* fpscr_offset */
- 4, /* fpscr_size */
-
- /* AltiVec registers. */
- -1, /* vr0_offset */
- -1, /* vscr_offset */
- -1 /* vrsave_offset */
+ 4 /* fpscr_size */
};
Always store the floating point value using the register's
floating-point format. */
const int fp_regnum = tdep->ppc_fp0_regnum + 1 + f_argno;
- gdb_byte reg_val[MAX_REGISTER_SIZE];
+ gdb_byte reg_val[PPC_MAX_REGISTER_SIZE];
struct type *reg_type = register_type (gdbarch, fp_regnum);
gdb_assert (len <= 8);
- convert_typed_floating (value_contents (arg), type,
- reg_val, reg_type);
- regcache_cooked_write (regcache, fp_regnum, reg_val);
+ target_float_convert (value_contents (arg), type, reg_val, reg_type);
+ regcache->cooked_write (fp_regnum, reg_val);
++f_argno;
}
/* Argument takes more than one register. */
while (argbytes < len)
{
- gdb_byte word[MAX_REGISTER_SIZE];
+ gdb_byte word[PPC_MAX_REGISTER_SIZE];
memset (word, 0, reg_size);
memcpy (word,
((char *) value_contents (arg)) + argbytes,
(len - argbytes) > reg_size
? reg_size : len - argbytes);
- regcache_cooked_write (regcache,
- tdep->ppc_gp0_regnum + 3 + ii,
- word);
+ regcache->cooked_write (tdep->ppc_gp0_regnum + 3 + ii, word);
++ii, argbytes += reg_size;
if (ii >= 8)
else
{
/* Argument can fit in one register. No problem. */
- gdb_byte word[MAX_REGISTER_SIZE];
+ gdb_byte word[PPC_MAX_REGISTER_SIZE];
memset (word, 0, reg_size);
memcpy (word, value_contents (arg), len);
- regcache_cooked_write (regcache, tdep->ppc_gp0_regnum + 3 +ii, word);
+ regcache->cooked_write (tdep->ppc_gp0_regnum + 3 +ii, word);
}
++argno;
}
gdb_assert (len <= 8);
- regcache_cooked_write (regcache,
- tdep->ppc_fp0_regnum + 1 + f_argno,
- value_contents (arg));
+ regcache->cooked_write (tdep->ppc_fp0_regnum + 1 + f_argno,
+ value_contents (arg));
++f_argno;
}
&& TYPE_LENGTH (valtype) == 16)
{
if (readbuf)
- regcache_cooked_read (regcache, tdep->ppc_vr0_regnum + 2, readbuf);
+ regcache->cooked_read (tdep->ppc_vr0_regnum + 2, readbuf);
if (writebuf)
- regcache_cooked_write (regcache, tdep->ppc_vr0_regnum + 2, writebuf);
+ regcache->cooked_write (tdep->ppc_vr0_regnum + 2, writebuf);
return RETURN_VALUE_REGISTER_CONVENTION;
}
if (readbuf)
{
- regcache_cooked_read (regcache, tdep->ppc_fp0_regnum + 1, regval);
- convert_typed_floating (regval, regtype, readbuf, valtype);
+ regcache->cooked_read (tdep->ppc_fp0_regnum + 1, regval);
+ target_float_convert (regval, regtype, readbuf, valtype);
}
if (writebuf)
{
- convert_typed_floating (writebuf, valtype, regval, regtype);
- regcache_cooked_write (regcache, tdep->ppc_fp0_regnum + 1, regval);
+ target_float_convert (writebuf, valtype, regval, regtype);
+ regcache->cooked_write (tdep->ppc_fp0_regnum + 1, regval);
}
return RETURN_VALUE_REGISTER_CONVENTION;
{
gdb_byte regval[8];
- regcache_cooked_read (regcache, tdep->ppc_gp0_regnum + 3, regval);
- regcache_cooked_read (regcache, tdep->ppc_gp0_regnum + 4,
- regval + 4);
+ regcache->cooked_read (tdep->ppc_gp0_regnum + 3, regval);
+ regcache->cooked_read (tdep->ppc_gp0_regnum + 4, regval + 4);
memcpy (readbuf, regval, 8);
}
if (writebuf)
{
- regcache_cooked_write (regcache, tdep->ppc_gp0_regnum + 3, writebuf);
- regcache_cooked_write (regcache, tdep->ppc_gp0_regnum + 4,
- writebuf + 4);
+ regcache->cooked_write (tdep->ppc_gp0_regnum + 3, writebuf);
+ regcache->cooked_write (tdep->ppc_gp0_regnum + 4, writebuf + 4);
}
return RETURN_VALUE_REGISTER_CONVENTION;
branch_dest (struct regcache *regcache, int opcode, int instr,
CORE_ADDR pc, CORE_ADDR safety)
{
- struct gdbarch *gdbarch = get_regcache_arch (regcache);
+ struct gdbarch *gdbarch = regcache->arch ();
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
CORE_ADDR dest;
/* AIX does not support PT_STEP. Simulate it. */
-static VEC (CORE_ADDR) *
-rs6000_software_single_step (struct frame_info *frame)
+static std::vector<CORE_ADDR>
+rs6000_software_single_step (struct regcache *regcache)
{
- struct regcache *regcache = get_current_regcache ();
- struct gdbarch *gdbarch = get_regcache_arch (regcache);
+ struct gdbarch *gdbarch = regcache->arch ();
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
int ii, insn;
CORE_ADDR loc;
CORE_ADDR breaks[2];
int opcode;
- VEC (CORE_ADDR) *next_pcs;
loc = regcache_read_pc (regcache);
insn = read_memory_integer (loc, 4, byte_order);
- next_pcs = ppc_deal_with_atomic_sequence (frame);
- if (next_pcs != NULL)
+ std::vector<CORE_ADDR> next_pcs = ppc_deal_with_atomic_sequence (regcache);
+ if (!next_pcs.empty ())
return next_pcs;
breaks[0] = loc + PPC_INSN_SIZE;
/* ignore invalid breakpoint. */
if (breaks[ii] == -1)
continue;
- VEC_safe_push (CORE_ADDR, next_pcs, breaks[ii]);
+
+ next_pcs.push_back (breaks[ii]);
}
errno = 0; /* FIXME, don't ignore errors! */
rs6000_aix_shared_library_to_xml (struct ld_info *ldi,
struct obstack *obstack)
{
- char *p;
-
obstack_grow_str (obstack, "<library name=\"");
- p = xml_escape_text (ldi->filename);
- obstack_grow_str (obstack, p);
- xfree (p);
+ std::string p = xml_escape_text (ldi->filename);
+ obstack_grow_str (obstack, p.c_str ());
obstack_grow_str (obstack, "\"");
if (ldi->member_name[0] != '\0')
{
obstack_grow_str (obstack, " member=\"");
p = xml_escape_text (ldi->member_name);
- obstack_grow_str (obstack, p);
- xfree (p);
+ obstack_grow_str (obstack, p.c_str ());
obstack_grow_str (obstack, "\"");
}
{
struct bfd_section *ldinfo_sec;
int ldinfo_size;
- gdb_byte *ldinfo_buf;
- struct cleanup *cleanup;
- LONGEST result;
ldinfo_sec = bfd_get_section_by_name (core_bfd, ".ldinfo");
if (ldinfo_sec == NULL)
bfd_errmsg (bfd_get_error ()));
ldinfo_size = bfd_get_section_size (ldinfo_sec);
- ldinfo_buf = (gdb_byte *) xmalloc (ldinfo_size);
- cleanup = make_cleanup (xfree, ldinfo_buf);
+ gdb::byte_vector ldinfo_buf (ldinfo_size);
if (! bfd_get_section_contents (core_bfd, ldinfo_sec,
- ldinfo_buf, 0, ldinfo_size))
+ ldinfo_buf.data (), 0, ldinfo_size))
error (_("unable to read .ldinfo section from core file: %s"),
bfd_errmsg (bfd_get_error ()));
- result = rs6000_aix_ld_info_to_xml (gdbarch, ldinfo_buf, readbuf,
- offset, len, 0);
-
- do_cleanups (cleanup);
- return result;
+ return rs6000_aix_ld_info_to_xml (gdbarch, ldinfo_buf.data (), readbuf,
+ offset, len, 0);
}
static void
software single-stepping. */
set_gdbarch_displaced_step_copy_insn (gdbarch, NULL);
set_gdbarch_displaced_step_fixup (gdbarch, NULL);
- set_gdbarch_displaced_step_free_closure (gdbarch, NULL);
set_gdbarch_displaced_step_location (gdbarch, NULL);
set_gdbarch_push_dummy_call (gdbarch, rs6000_push_dummy_call);
else
set_gdbarch_frame_red_zone_size (gdbarch, 0);
+ if (tdep->wordsize == 8)
+ set_gdbarch_wchar_bit (gdbarch, 32);
+ else
+ set_gdbarch_wchar_bit (gdbarch, 16);
+ set_gdbarch_wchar_signed (gdbarch, 0);
set_gdbarch_auto_wide_charset (gdbarch, rs6000_aix_auto_wide_charset);
set_solib_ops (gdbarch, &solib_aix_so_ops);
}
-/* Provide a prototype to silence -Wmissing-prototypes. */
-extern initialize_file_ftype _initialize_rs6000_aix_tdep;
-
void
_initialize_rs6000_aix_tdep (void)
{