39#include "gdbsupport/xml-utils.h"
57#define SIG_FRAME_PC_OFFSET 96
58#define SIG_FRAME_LR_OFFSET 108
60#define SIG_FRAME_FP_OFFSET 284
64#define SIG_FRAME_LR_OFFSET64 424
66#define SIG_FRAME_FP_OFFSET64 168
69#define AIX_TEXT_SEGMENT_BASE 0x10000000
106 int regnum,
const void *vrregs,
size_t len)
126 (
const gdb_byte *) vrregs, offsets->
vscr_offset, 4);
139 (
const gdb_byte *) vrregs, offset, 4);
145 int regnum,
const void *vsxregs,
size_t len)
157 + 32; i++, offset += 8)
169 int regnum,
void *vsxregs,
size_t len)
181 + 32; i++, offset += 8)
193 int regnum,
void *vrregs,
size_t len)
227 (gdb_byte *) vrregs, offset, 4);
247 CORE_ADDR base, base_orig,
func;
253 if ((*this_cache) != NULL)
257 (*this_cache) = this_trad_cache;
269 tdep->
wordsize, byte_order, &backchain);
270 base = (CORE_ADDR)backchain;
278 tdep->
wordsize, byte_order, &backchain);
279 base = (CORE_ADDR)backchain;
287 base_orig + 0x38 + 52 + 8);
290 base_orig + 0x70 + 320);
295 return this_trad_cache;
300 void **this_prologue_cache,
310 void **this_prologue_cache,
int regnum)
320 void **this_prologue_cache)
332 "rs6000 aix sighandle",
391 const void *gregs,
size_t len)
405 void *gregs,
size_t len)
459 asection *altivec = bfd_get_section_by_name (abfd,
".aix-vmx");
460 asection *vsx = bfd_get_section_by_name (abfd,
".aix-vsx");
461 asection *section = bfd_get_section_by_name (abfd,
".reg");
473 else if (vsx && !arch64)
475 else if (altivec && arch64)
477 else if (altivec && !arch64)
502 int nargs,
struct value **args, CORE_ADDR sp,
504 CORE_ADDR struct_addr)
512 gdb_byte tmp_buffer[50];
517 struct value *arg = 0;
559 for (argno = 0, argbytes = 0; argno < nargs && ii < 8; ++ii)
579 gdb_assert (len <= 8);
591 while (argbytes < len)
594 memset (word, 0, reg_size);
596 ((
char *) arg->
contents ().data ()) + argbytes,
597 (len - argbytes) > reg_size
598 ? reg_size : len - argbytes);
600 ++ii, argbytes += reg_size;
603 goto ran_out_of_registers_for_arguments;
613 memset (word, 0, reg_size);
622 memcpy (word, arg->
contents ().data (), len);
628ran_out_of_registers_for_arguments:
646 if ((argno < nargs) || argbytes)
652 space += ((len - argbytes + wordsize -1) & -wordsize);
658 for (; jj < nargs; ++jj)
660 struct value *val = args[jj];
661 space += ((val->
type ()->
length () + wordsize -1) & -wordsize);
665 space = (space + 15) & -16;
683 arg->
contents ().data () + argbytes,
686 ii += ((len - argbytes + wordsize - 1) & -wordsize) / wordsize;
690 for (; argno < nargs; ++argno)
700 if (
type->
code () == TYPE_CODE_FLT && f_argno < 13)
703 gdb_assert (len <= 8);
713 ||
type->
code () == TYPE_CODE_CHAR )
723 ii += ((len + wordsize -1) & -wordsize) / wordsize;
754 gdb_byte *readbuf,
const gdb_byte *writebuf)
766 if (valtype->
code () == TYPE_CODE_ARRAY && valtype->
is_vector ()
767 && valtype->
length () == 16)
782 if (valtype->
code () == TYPE_CODE_STRUCT
783 || valtype->
code () == TYPE_CODE_UNION
784 || valtype->
code () == TYPE_CODE_ARRAY)
791 if (valtype->
code () == TYPE_CODE_FLT
792 && (valtype->
length () == 4 || valtype->
length () == 8))
845 if (valtype->
length () == 8)
847 gdb_assert (valtype->
code () != TYPE_CODE_FLT);
856 memcpy (readbuf, regval, 8);
913 catch (
const gdb_exception_error &e)
935 CORE_ADDR pc, CORE_ADDR safety)
945 absolute = (int) ((instr >> 1) & 1);
950 immediate = ((instr & ~3) << 6) >> 6;
954 dest = pc + immediate;
958 immediate = ((instr & ~3) << 16) >> 16;
962 dest = pc + immediate;
966 ext_op = (instr >> 1) & 0x3ff;
986 else if (ext_op == 528)
988 dest = regcache_raw_get_unsigned (
regcache,
995 dest = regcache_raw_get_unsigned (
regcache,
1010static std::vector<CORE_ADDR>
1017 CORE_ADDR breaks[2];
1025 if (!next_pcs.empty ())
1029 if ((insn & 0xfc000000) == 1 << 26)
1033 opcode = insn >> 26;
1037 if (breaks[1] == breaks[0])
1040 for (ii = 0; ii < 2; ++ii)
1043 if (breaks[ii] == -1)
1046 next_pcs.push_back (breaks[ii]);
1072 gdb_assert (bfd_get_flavour (abfd) == bfd_target_xcoff_flavour);
1114#define __LDINFO_PTRACE32__
1115#define __LDINFO_PTRACE64__
1118#define pinfo(type,member) \
1120 struct type ldi = {0}; \
1122 printf (" {%d, %d},\t/* %s */\n", \
1123 offsetof (struct type, member), \
1124 sizeof (ldi.member), \
1132 printf (
"static const struct ld_info_desc ld_info32_desc =\n{\n");
1133 pinfo (__ld_info32, ldinfo_next);
1134 pinfo (__ld_info32, ldinfo_fd);
1135 pinfo (__ld_info32, ldinfo_textorg);
1136 pinfo (__ld_info32, ldinfo_textsize);
1137 pinfo (__ld_info32, ldinfo_dataorg);
1138 pinfo (__ld_info32, ldinfo_datasize);
1139 pinfo (__ld_info32, ldinfo_filename);
1144 printf (
"static const struct ld_info_desc ld_info64_desc =\n{\n");
1145 pinfo (__ld_info64, ldinfo_next);
1146 pinfo (__ld_info64, ldinfo_fd);
1147 pinfo (__ld_info64, ldinfo_textorg);
1148 pinfo (__ld_info64, ldinfo_textsize);
1149 pinfo (__ld_info64, ldinfo_dataorg);
1150 pinfo (__ld_info64, ldinfo_datasize);
1151 pinfo (__ld_info64, ldinfo_filename);
1208 const gdb_byte *ldi_buf)
1236 info.member_name = info.filename + strlen (info.filename) + 1;
1247 struct obstack *obstack)
1249 obstack_grow_str (obstack,
"<library name=\"");
1250 std::string p = xml_escape_text (ldi->
filename);
1251 obstack_grow_str (obstack, p.c_str ());
1252 obstack_grow_str (obstack,
"\"");
1256 obstack_grow_str (obstack,
" member=\"");
1258 obstack_grow_str (obstack, p.c_str ());
1259 obstack_grow_str (obstack,
"\"");
1262 obstack_grow_str (obstack,
" text_addr=\"");
1263 obstack_grow_str (obstack, core_addr_to_string (ldi->
textorg));
1264 obstack_grow_str (obstack,
"\"");
1266 obstack_grow_str (obstack,
" text_size=\"");
1267 obstack_grow_str (obstack, pulongest (ldi->
textsize));
1268 obstack_grow_str (obstack,
"\"");
1270 obstack_grow_str (obstack,
" data_addr=\"");
1271 obstack_grow_str (obstack, core_addr_to_string (ldi->
dataorg));
1272 obstack_grow_str (obstack,
"\"");
1274 obstack_grow_str (obstack,
" data_size=\"");
1275 obstack_grow_str (obstack, pulongest (ldi->
datasize));
1276 obstack_grow_str (obstack,
"\"");
1278 obstack_grow_str (obstack,
"></library>");
1298 gdb_byte *readbuf, ULONGEST offset, ULONGEST len,
1299 int close_ldinfo_fd)
1301 struct obstack obstack;
1305 obstack_init (&obstack);
1306 obstack_grow_str (&obstack,
"<library-list-aix version=\"1.0\">\n");
1313 if (close_ldinfo_fd)
1318 ldi_buf = ldi_buf + ldi.
next;
1321 obstack_grow_str0 (&obstack,
"</library-list-aix>\n");
1323 buf = (
const char *) obstack_finish (&obstack);
1324 len_avail = strlen (buf);
1325 if (offset >= len_avail)
1329 if (len > len_avail - offset)
1330 len = len_avail - offset;
1331 memcpy (readbuf, buf + offset, len);
1334 obstack_free (&obstack, NULL);
1346 struct bfd_section *ldinfo_sec;
1349 ldinfo_sec = bfd_get_section_by_name (
core_bfd,
".ldinfo");
1350 if (ldinfo_sec == NULL)
1351 error (_(
"cannot find .ldinfo section from core file: %s"),
1352 bfd_errmsg (bfd_get_error ()));
1353 ldinfo_size = bfd_section_size (ldinfo_sec);
1355 gdb::byte_vector ldinfo_buf (ldinfo_size);
1357 if (! bfd_get_section_contents (
core_bfd, ldinfo_sec,
1358 ldinfo_buf.data (), 0, ldinfo_size))
1359 error (_(
"unable to read .ldinfo section from core file: %s"),
1360 bfd_errmsg (bfd_get_error ()));
1430 bfd_target_xcoff_flavour,
1433 bfd_target_xcoff_flavour,
enum register_status cooked_read(int regnum, gdb_byte *buf)
void cooked_write(int regnum, const gdb_byte *buf)
void write_memory(CORE_ADDR memaddr, const bfd_byte *myaddr, ssize_t len)
ULONGEST read_memory_unsigned_integer(CORE_ADDR memaddr, int len, enum bfd_endian byte_order)
int safe_read_memory_integer(CORE_ADDR memaddr, int len, enum bfd_endian byte_order, LONGEST *return_value)
LONGEST read_memory_integer(CORE_ADDR memaddr, int len, enum bfd_endian byte_order)
static void store_unsigned_integer(gdb_byte *addr, int len, enum bfd_endian byte_order, ULONGEST val)
CORE_ADDR extract_typed_address(const gdb_byte *buf, struct type *type)
static LONGEST extract_signed_integer(gdb::array_view< const gdb_byte > buf, enum bfd_endian byte_order)
static ULONGEST extract_unsigned_integer(gdb::array_view< const gdb_byte > buf, enum bfd_endian byte_order)
@ RETURN_VALUE_REGISTER_CONVENTION
@ RETURN_VALUE_STRUCT_CONVENTION
enum unwind_stop_reason default_frame_unwind_stop_reason(frame_info_ptr this_frame, void **this_cache)
void frame_unwind_append_unwinder(struct gdbarch *gdbarch, const struct frame_unwind *unwinder)
ULONGEST get_frame_register_unsigned(frame_info_ptr frame, int regnum)
CORE_ADDR get_frame_pc(frame_info_ptr frame)
struct frame_id frame_id_build(CORE_ADDR stack_addr, CORE_ADDR code_addr)
struct gdbarch * get_frame_arch(frame_info_ptr this_frame)
frame_info_ptr get_current_frame(void)
CORE_ADDR get_frame_base(frame_info_ptr fi)
int gdbarch_pc_regnum(struct gdbarch *gdbarch)
void set_gdbarch_auto_wide_charset(struct gdbarch *gdbarch, gdbarch_auto_wide_charset_ftype *auto_wide_charset)
void set_gdbarch_convert_from_func_ptr_addr(struct gdbarch *gdbarch, gdbarch_convert_from_func_ptr_addr_ftype *convert_from_func_ptr_addr)
enum bfd_endian gdbarch_byte_order(struct gdbarch *gdbarch)
void set_gdbarch_software_single_step(struct gdbarch *gdbarch, gdbarch_software_single_step_ftype *software_single_step)
void set_gdbarch_displaced_step_finish(struct gdbarch *gdbarch, gdbarch_displaced_step_finish_ftype *displaced_step_finish)
void set_gdbarch_displaced_step_prepare(struct gdbarch *gdbarch, gdbarch_displaced_step_prepare_ftype *displaced_step_prepare)
void set_gdbarch_core_read_description(struct gdbarch *gdbarch, gdbarch_core_read_description_ftype *core_read_description)
void set_gdbarch_core_xfer_shared_libraries_aix(struct gdbarch *gdbarch, gdbarch_core_xfer_shared_libraries_aix_ftype *core_xfer_shared_libraries_aix)
void set_gdbarch_wchar_bit(struct gdbarch *gdbarch, int wchar_bit)
void set_gdbarch_return_value(struct gdbarch *gdbarch, gdbarch_return_value_ftype *return_value)
void set_gdbarch_wchar_signed(struct gdbarch *gdbarch, int wchar_signed)
void set_gdbarch_displaced_step_copy_insn(struct gdbarch *gdbarch, gdbarch_displaced_step_copy_insn_ftype *displaced_step_copy_insn)
int gdbarch_sp_regnum(struct gdbarch *gdbarch)
void set_gdbarch_frame_red_zone_size(struct gdbarch *gdbarch, int frame_red_zone_size)
void set_gdbarch_displaced_step_fixup(struct gdbarch *gdbarch, gdbarch_displaced_step_fixup_ftype *displaced_step_fixup)
void set_gdbarch_long_double_bit(struct gdbarch *gdbarch, int long_double_bit)
void set_gdbarch_so_ops(struct gdbarch *gdbarch, const struct target_so_ops *so_ops)
void set_gdbarch_push_dummy_call(struct gdbarch *gdbarch, gdbarch_push_dummy_call_ftype *push_dummy_call)
void set_gdbarch_iterate_over_regset_sections(struct gdbarch *gdbarch, gdbarch_iterate_over_regset_sections_ftype *iterate_over_regset_sections)
void iterate_over_regset_sections_cb(const char *sect_name, int supply_size, int collect_size, const struct regset *regset, const char *human_name, void *cb_data)
function_call_return_method
const struct builtin_type * builtin_type(struct gdbarch *gdbarch)
struct type * check_typedef(struct type *type)
CORE_ADDR find_function_addr(struct value *function, struct type **retval_type, struct type **function_type)
struct obj_section * find_pc_section(CORE_ADDR pc)
void gdbarch_register_osabi(enum bfd_architecture arch, unsigned long machine, enum gdb_osabi osabi, void(*init_osabi)(struct gdbarch_info, struct gdbarch *))
void gdbarch_register_osabi_sniffer(enum bfd_architecture arch, enum bfd_flavour flavour, enum gdb_osabi(*sniffer_fn)(bfd *))
const struct target_desc * tdesc_powerpc_altivec32
const struct target_desc * tdesc_powerpc_altivec64
const struct target_desc * tdesc_powerpc_vsx32
const struct target_desc * tdesc_powerpc_vsx64
void ppc_collect_gregset(const struct regset *regset, const struct regcache *regcache, int regnum, void *gregs, size_t len)
void ppc_supply_fpregset(const struct regset *regset, struct regcache *regcache, int regnum, const void *fpregs, size_t len)
std::vector< CORE_ADDR > ppc_deal_with_atomic_sequence(struct regcache *regcache)
#define PPC_MAX_REGISTER_SIZE
void ppc_collect_reg(const struct regcache *regcache, int regnum, gdb_byte *regs, size_t offset, int regsize)
int ppc_floating_point_unit_p(struct gdbarch *gdbarch)
void ppc_supply_reg(struct regcache *regcache, int regnum, const gdb_byte *regs, size_t offset, int regsize)
void ppc_supply_gregset(const struct regset *regset, struct regcache *regcache, int regnum, const void *gregs, size_t len)
void ppc_collect_fpregset(const struct regset *regset, const struct regcache *regcache, int regnum, void *fpregs, size_t len)
CORE_ADDR regcache_read_pc(struct regcache *regcache)
void regcache_raw_write_signed(struct regcache *regcache, int regnum, LONGEST val)
int register_size(struct gdbarch *gdbarch, int regnum)
enum register_status regcache_cooked_read_unsigned(struct regcache *regcache, int regnum, ULONGEST *val)
void regcache_raw_write_unsigned(struct regcache *regcache, int regnum, ULONGEST val)
void regcache_cooked_write_unsigned(struct regcache *regcache, int regnum, ULONGEST val)
struct type * register_type(struct gdbarch *gdbarch, int regnum)
void(* func)(remote_target *remote, char *)
static const struct regset rs6000_aix_vsxregset
static const struct regset rs6000_aix32_regset
static enum gdb_osabi rs6000_aix_osabi_sniffer(bfd *abfd)
static const struct ld_info_desc ld_info32_desc
static struct trad_frame_cache * aix_sighandle_frame_cache(frame_info_ptr this_frame, void **this_cache)
#define SIG_FRAME_FP_OFFSET64
static const char * rs6000_aix_auto_wide_charset(void)
ULONGEST rs6000_aix_ld_info_to_xml(struct gdbarch *gdbarch, const gdb_byte *ldi_buf, gdb_byte *readbuf, ULONGEST offset, ULONGEST len, int close_ldinfo_fd)
static void rs6000_aix_supply_vrregset(const struct regset *regset, struct regcache *regcache, int regnum, const void *vrregs, size_t len)
static int aix_sighandle_frame_sniffer(const struct frame_unwind *self, frame_info_ptr this_frame, void **this_prologue_cache)
static void rs6000_aix_collect_regset(const struct regset *regset, const struct regcache *regcache, int regnum, void *gregs, size_t len)
static const struct regset rs6000_aix_vrregset
void _initialize_rs6000_aix_tdep()
static const struct ld_info_desc ld_info64_desc
static CORE_ADDR rs6000_push_dummy_call(struct gdbarch *gdbarch, struct value *function, struct regcache *regcache, CORE_ADDR bp_addr, int nargs, struct value **args, CORE_ADDR sp, function_call_return_method return_method, CORE_ADDR struct_addr)
#define SIG_FRAME_PC_OFFSET
static void rs6000_aix_iterate_over_regset_sections(struct gdbarch *gdbarch, iterate_over_regset_sections_cb *cb, void *cb_data, const struct regcache *regcache)
static int rs6000_aix_get_vrreg_offset(ppc_gdbarch_tdep *tdep, const struct rs6000_aix_reg_vrreg_offset *offsets, int regnum)
static const struct target_desc * ppc_aix_core_read_description(struct gdbarch *gdbarch, struct target_ops *target, bfd *abfd)
static struct value * aix_sighandle_frame_prev_register(frame_info_ptr this_frame, void **this_prologue_cache, int regnum)
static struct rs6000_aix_reg_vrreg_offset rs6000_aix_vrreg_offset
static void rs6000_aix_init_osabi(struct gdbarch_info info, struct gdbarch *gdbarch)
static void rs6000_aix_collect_vsxregset(const struct regset *regset, const struct regcache *regcache, int regnum, void *vsxregs, size_t len)
static void rs6000_aix_supply_vsxregset(const struct regset *regset, struct regcache *regcache, int regnum, const void *vsxregs, size_t len)
static void aix_sighandle_frame_this_id(frame_info_ptr this_frame, void **this_prologue_cache, struct frame_id *this_id)
static void rs6000_aix_shared_library_to_xml(struct ld_info *ldi, struct obstack *obstack)
#define SIG_FRAME_FP_OFFSET
static struct ppc_reg_offsets rs6000_aix32_reg_offsets
static CORE_ADDR branch_dest(struct regcache *regcache, int opcode, int instr, CORE_ADDR pc, CORE_ADDR safety)
#define AIX_TEXT_SEGMENT_BASE
static ULONGEST rs6000_aix_core_xfer_shared_libraries_aix(struct gdbarch *gdbarch, gdb_byte *readbuf, ULONGEST offset, ULONGEST len)
static const struct regset rs6000_aix64_regset
static struct ppc_reg_offsets rs6000_aix64_reg_offsets
static void rs6000_aix_supply_regset(const struct regset *regset, struct regcache *regcache, int regnum, const void *gregs, size_t len)
static std::vector< CORE_ADDR > rs6000_software_single_step(struct regcache *regcache)
static CORE_ADDR rs6000_convert_from_func_ptr_addr(struct gdbarch *gdbarch, CORE_ADDR addr, struct target_ops *targ)
#define SIG_FRAME_LR_OFFSET64
static struct ld_info rs6000_aix_extract_ld_info(struct gdbarch *gdbarch, const gdb_byte *ldi_buf)
static enum return_value_convention rs6000_return_value(struct gdbarch *gdbarch, struct value *function, struct type *valtype, struct regcache *regcache, gdb_byte *readbuf, const gdb_byte *writebuf)
static const struct frame_unwind aix_sighandle_frame_unwind
static void rs6000_aix_collect_vrregset(const struct regset *regset, const struct regcache *regcache, int regnum, void *vrregs, size_t len)
const struct target_so_ops solib_aix_so_ops
CORE_ADDR solib_aix_get_toc_value(CORE_ADDR pc)
struct type * builtin_data_ptr
struct ldinfo_field ldinfo_textsize
struct ldinfo_field ldinfo_textorg
struct ldinfo_field ldinfo_next
struct ldinfo_field ldinfo_datasize
struct ldinfo_field ldinfo_dataorg
struct ldinfo_field ldinfo_fd
struct ldinfo_field ldinfo_filename
struct bfd_section * the_bfd_section
int ppc_vsr0_upper_regnum
frame_info_ptr this_frame
gdb::array_view< const gdb_byte > contents()
struct type * type() const
void target_float_convert(const gdb_byte *from, const struct type *from_type, gdb_byte *to, const struct type *to_type)
void target_store_registers(struct regcache *regcache, int regno)
struct trad_frame_cache * trad_frame_cache_zalloc(frame_info_ptr this_frame)
void trad_frame_set_reg_addr(struct trad_frame_cache *this_trad_cache, int regnum, CORE_ADDR addr)
void trad_frame_get_id(struct trad_frame_cache *this_trad_cache, struct frame_id *this_id)
void trad_frame_set_id(struct trad_frame_cache *this_trad_cache, struct frame_id this_id)
void trad_frame_set_this_base(struct trad_frame_cache *this_trad_cache, CORE_ADDR this_base)
void trad_frame_set_reg_value(struct trad_frame_cache *this_trad_cache, int regnum, LONGEST val)
struct value * trad_frame_get_register(struct trad_frame_cache *this_trad_cache, frame_info_ptr this_frame, int regnum)
LONGEST unpack_long(struct type *type, const gdb_byte *valaddr)
int xcoff_get_n_import_files(bfd *abfd)