/* Native support code for PPC AIX, for GDB the GNU debugger.
- Copyright (C) 2006-2019 Free Software Foundation, Inc.
+ Copyright (C) 2006-2021 Free Software Foundation, Inc.
Free Software Foundation, Inc.
#include "solib.h"
#include "solib-aix.h"
#include "target-float.h"
-#include "xml-utils.h"
+#include "gdbsupport/xml-utils.h"
#include "trad-frame.h"
#include "frame-unwind.h"
(*this_cache) = this_trad_cache;
base = get_frame_register_unsigned (this_frame,
- gdbarch_sp_regnum (gdbarch));
+ gdbarch_sp_regnum (gdbarch));
base_orig = base;
if (tdep->wordsize == 4)
if (tdep->wordsize == 4)
trad_frame_set_reg_addr (this_trad_cache, tdep->ppc_lr_regnum,
- base_orig + 0x38 + 52 + 8);
+ base_orig + 0x38 + 52 + 8);
else
trad_frame_set_reg_addr (this_trad_cache, tdep->ppc_lr_regnum,
- base_orig + 0x70 + 320);
+ base_orig + 0x70 + 320);
trad_frame_set_id (this_trad_cache, frame_id_build (base, func));
trad_frame_set_this_base (this_trad_cache, base);
return trad_frame_get_register (this_trad_cache, this_frame, regnum);
}
-int
+static int
aix_sighandle_frame_sniffer (const struct frame_unwind *self,
struct frame_info *this_frame,
void **this_prologue_cache)
type = check_typedef (value_type (arg));
len = TYPE_LENGTH (type);
- if (TYPE_CODE (type) == TYPE_CODE_FLT)
+ if (type->code () == TYPE_CODE_FLT)
{
/* Floating point arguments are passed in fpr's, as well as gpr's.
There are 13 fpr's reserved for passing parameters. At this point
memcpy (word,
((char *) value_contents (arg)) + argbytes,
(len - argbytes) > reg_size
- ? reg_size : len - argbytes);
+ ? reg_size : len - argbytes);
regcache->cooked_write (tdep->ppc_gp0_regnum + 3 + ii, word);
++ii, argbytes += reg_size;
sp -= space;
/* This is another instance we need to be concerned about
- securing our stack space. If we write anything underneath %sp
- (r1), we might conflict with the kernel who thinks he is free
- to use this area. So, update %sp first before doing anything
- else. */
+ securing our stack space. If we write anything underneath %sp
+ (r1), we might conflict with the kernel who thinks he is free
+ to use this area. So, update %sp first before doing anything
+ else. */
regcache_raw_write_signed (regcache,
gdbarch_sp_regnum (gdbarch), sp);
/* If the last argument copied into the registers didn't fit there
- completely, push the rest of it into stack. */
+ completely, push the rest of it into stack. */
if (argbytes)
{
/* Float types should be passed in fpr's, as well as in the
- stack. */
- if (TYPE_CODE (type) == TYPE_CODE_FLT && f_argno < 13)
+ stack. */
+ if (type->code () == TYPE_CODE_FLT && f_argno < 13)
{
gdb_assert (len <= 8);
/* AltiVec extension: Functions that declare a vector data type as a
return value place that return value in VR2. */
- if (TYPE_CODE (valtype) == TYPE_CODE_ARRAY && TYPE_VECTOR (valtype)
+ if (valtype->code () == TYPE_CODE_ARRAY && valtype->is_vector ()
&& TYPE_LENGTH (valtype) == 16)
{
if (readbuf)
allocated buffer into which the callee is assumed to store its
return value. All explicit parameters are appropriately
relabeled. */
- if (TYPE_CODE (valtype) == TYPE_CODE_STRUCT
- || TYPE_CODE (valtype) == TYPE_CODE_UNION
- || TYPE_CODE (valtype) == TYPE_CODE_ARRAY)
+ if (valtype->code () == TYPE_CODE_STRUCT
+ || valtype->code () == TYPE_CODE_UNION
+ || valtype->code () == TYPE_CODE_ARRAY)
return RETURN_VALUE_STRUCT_CONVENTION;
/* Scalar floating-point values are returned in FPR1 for float or
double, and in FPR1:FPR2 for quadword precision. Fortran
complex*8 and complex*16 are returned in FPR1:FPR2, and
complex*32 is returned in FPR1:FPR4. */
- if (TYPE_CODE (valtype) == TYPE_CODE_FLT
+ if (valtype->code () == TYPE_CODE_FLT
&& (TYPE_LENGTH (valtype) == 4 || TYPE_LENGTH (valtype) == 8))
{
struct type *regtype = register_type (gdbarch, tdep->ppc_fp0_regnum);
if (TYPE_LENGTH (valtype) == 8)
{
- gdb_assert (TYPE_CODE (valtype) != TYPE_CODE_FLT);
+ gdb_assert (valtype->code () != TYPE_CODE_FLT);
gdb_assert (tdep->wordsize == 4);
if (readbuf)
CORE_ADDR pc = 0;
struct obj_section *pc_section;
- TRY
- {
- pc = read_memory_unsigned_integer (addr, tdep->wordsize, byte_order);
- }
- CATCH (e, RETURN_MASK_ERROR)
- {
- /* An error occured during reading. Probably a memory error
- due to the section not being loaded yet. This address
- cannot be a function descriptor. */
- return addr;
- }
- END_CATCH
+ try
+ {
+ pc = read_memory_unsigned_integer (addr, tdep->wordsize, byte_order);
+ }
+ catch (const gdb_exception_error &e)
+ {
+ /* An error occured during reading. Probably a memory error
+ due to the section not being loaded yet. This address
+ cannot be a function descriptor. */
+ return addr;
+ }
pc_section = find_pc_section (pc);
if (pc_section && (pc_section->the_bfd_section->flags & SEC_CODE))
- return pc;
+ return pc;
}
return addr;
if (ext_op == 16) /* br conditional register */
{
- dest = regcache_raw_get_unsigned (regcache, tdep->ppc_lr_regnum) & ~3;
+ dest = regcache_raw_get_unsigned (regcache, tdep->ppc_lr_regnum) & ~3;
/* If we are about to return from a signal handler, dest is
something like 0x3c90. The current frame is a signal handler
else if (ext_op == 528) /* br cond to count reg */
{
- dest = regcache_raw_get_unsigned (regcache,
+ dest = regcache_raw_get_unsigned (regcache,
tdep->ppc_ctr_regnum) & ~3;
/* If we are about to execute a system call, dest is something
like 0x22fc or 0x3b00. Upon completion the system call
will return to the address in the link register. */
if (dest < AIX_TEXT_SEGMENT_BASE)
- dest = regcache_raw_get_unsigned (regcache,
+ dest = regcache_raw_get_unsigned (regcache,
tdep->ppc_lr_regnum) & ~3;
}
else
#define pinfo(type,member) \
{ \
struct type ldi = {0}; \
- \
+ \
printf (" {%d, %d},\t/* %s */\n", \
- offsetof (struct type, member), \
- sizeof (ldi.member), \
- #member); \
+ offsetof (struct type, member), \
+ sizeof (ldi.member), \
+ #member); \
} \
while (0)
else
{
if (len > len_avail - offset)
- len = len_avail - offset;
+ len = len_avail - offset;
memcpy (readbuf, buf + offset, len);
}
if (ldinfo_sec == NULL)
error (_("cannot find .ldinfo section from core file: %s"),
bfd_errmsg (bfd_get_error ()));
- ldinfo_size = bfd_get_section_size (ldinfo_sec);
+ ldinfo_size = bfd_section_size (ldinfo_sec);
gdb::byte_vector ldinfo_buf (ldinfo_size);
set_gdbarch_software_single_step (gdbarch, rs6000_software_single_step);
/* Displaced stepping is currently not supported in combination with
- software single-stepping. */
+ software single-stepping. These override the values set by
+ rs6000_gdbarch_init. */
set_gdbarch_displaced_step_copy_insn (gdbarch, NULL);
set_gdbarch_displaced_step_fixup (gdbarch, NULL);
- set_gdbarch_displaced_step_location (gdbarch, NULL);
+ set_gdbarch_displaced_step_prepare (gdbarch, NULL);
+ set_gdbarch_displaced_step_finish (gdbarch, NULL);
set_gdbarch_push_dummy_call (gdbarch, rs6000_push_dummy_call);
set_gdbarch_return_value (gdbarch, rs6000_return_value);
frame_unwind_append_unwinder (gdbarch, &aix_sighandle_frame_unwind);
}
+void _initialize_rs6000_aix_tdep ();
void
-_initialize_rs6000_aix_tdep (void)
+_initialize_rs6000_aix_tdep ()
{
gdbarch_register_osabi_sniffer (bfd_arch_rs6000,
- bfd_target_xcoff_flavour,
- rs6000_aix_osabi_sniffer);
+ bfd_target_xcoff_flavour,
+ rs6000_aix_osabi_sniffer);
gdbarch_register_osabi_sniffer (bfd_arch_powerpc,
- bfd_target_xcoff_flavour,
- rs6000_aix_osabi_sniffer);
+ bfd_target_xcoff_flavour,
+ rs6000_aix_osabi_sniffer);
gdbarch_register_osabi (bfd_arch_rs6000, 0, GDB_OSABI_AIX,
- rs6000_aix_init_osabi);
+ rs6000_aix_init_osabi);
gdbarch_register_osabi (bfd_arch_powerpc, 0, GDB_OSABI_AIX,
- rs6000_aix_init_osabi);
+ rs6000_aix_init_osabi);
}