X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=gdbserver%2Flinux-ppc-low.cc;h=22fda3306f29e755ab1b64a43b17d0b592f069fc;hb=d7599cc0826fd7052d3ab52f3a4350d6769c03b5;hp=4aa7f5159b5a993fd697d9ccfd8035cdfb54fd15;hpb=bf9ae9d8c37a4e1dfd192f266c20ea5786fd1bbd;p=deliverable%2Fbinutils-gdb.git diff --git a/gdbserver/linux-ppc-low.cc b/gdbserver/linux-ppc-low.cc index 4aa7f5159b..22fda3306f 100644 --- a/gdbserver/linux-ppc-low.cc +++ b/gdbserver/linux-ppc-low.cc @@ -52,6 +52,16 @@ public: const regs_info *get_regs_info () override; + const gdb_byte *sw_breakpoint_from_kind (int kind, int *size) override; + + bool supports_z_point_type (char z_type) override; + + + void low_collect_ptrace_register (regcache *regcache, int regno, + char *buf) override; + + void low_supply_ptrace_register (regcache *regcache, int regno, + const char *buf) override; protected: void low_arch_setup () override; @@ -65,6 +75,14 @@ protected: CORE_ADDR low_get_pc (regcache *regcache) override; void low_set_pc (regcache *regcache, CORE_ADDR newpc) override; + + bool low_breakpoint_at (CORE_ADDR pc) override; + + int low_insert_point (raw_bkpt_type type, CORE_ADDR addr, + int size, raw_breakpoint *bp) override; + + int low_remove_point (raw_bkpt_type type, CORE_ADDR addr, + int size, raw_breakpoint *bp) override; }; /* The singleton target ops object. */ @@ -196,8 +214,9 @@ ppc_target::low_cannot_fetch_register (int regno) return false; } -static void -ppc_collect_ptrace_register (struct regcache *regcache, int regno, char *buf) +void +ppc_target::low_collect_ptrace_register (regcache *regcache, int regno, + char *buf) { memset (buf, 0, sizeof (long)); @@ -222,9 +241,9 @@ ppc_collect_ptrace_register (struct regcache *regcache, int regno, char *buf) perror_with_name ("Unexpected byte order"); } -static void -ppc_supply_ptrace_register (struct regcache *regcache, - int regno, const char *buf) +void +ppc_target::low_supply_ptrace_register (regcache *regcache, int regno, + const char *buf) { if (__BYTE_ORDER == __LITTLE_ENDIAN) { @@ -296,27 +315,27 @@ static int ppc_regmap_adjusted; static const unsigned int ppc_breakpoint = 0x7d821008; #define ppc_breakpoint_len 4 -/* Implementation of linux_target_ops method "sw_breakpoint_from_kind". */ +/* Implementation of target ops method "sw_breakpoint_from_kind". */ -static const gdb_byte * -ppc_sw_breakpoint_from_kind (int kind, int *size) +const gdb_byte * +ppc_target::sw_breakpoint_from_kind (int kind, int *size) { *size = ppc_breakpoint_len; return (const gdb_byte *) &ppc_breakpoint; } -static int -ppc_breakpoint_at (CORE_ADDR where) +bool +ppc_target::low_breakpoint_at (CORE_ADDR where) { unsigned int insn; - the_target->read_memory (where, (unsigned char *) &insn, 4); + read_memory (where, (unsigned char *) &insn, 4); if (insn == ppc_breakpoint) - return 1; + return true; /* If necessary, recognize more trap instructions here. GDB only uses the one. */ - return 0; + return false; } /* Implement supports_z_point_type target-ops. @@ -325,27 +344,27 @@ ppc_breakpoint_at (CORE_ADDR where) Handling software breakpoint at server side, so tracepoints and breakpoints can be inserted at the same location. */ -static int -ppc_supports_z_point_type (char z_type) +bool +ppc_target::supports_z_point_type (char z_type) { switch (z_type) { case Z_PACKET_SW_BP: - return 1; + return true; case Z_PACKET_HW_BP: case Z_PACKET_WRITE_WP: case Z_PACKET_ACCESS_WP: default: - return 0; + return false; } } -/* Implement insert_point target-ops. +/* Implement the low_insert_point linux target op. Returns 0 on success, -1 on failure and 1 on unsupported. */ -static int -ppc_insert_point (enum raw_bkpt_type type, CORE_ADDR addr, - int size, struct raw_breakpoint *bp) +int +ppc_target::low_insert_point (raw_bkpt_type type, CORE_ADDR addr, + int size, raw_breakpoint *bp) { switch (type) { @@ -361,12 +380,12 @@ ppc_insert_point (enum raw_bkpt_type type, CORE_ADDR addr, } } -/* Implement remove_point target-ops. +/* Implement the low_remove_point linux target op. Returns 0 on success, -1 on failure and 1 on unsupported. */ -static int -ppc_remove_point (enum raw_bkpt_type type, CORE_ADDR addr, - int size, struct raw_breakpoint *bp) +int +ppc_target::low_remove_point (raw_bkpt_type type, CORE_ADDR addr, + int size, raw_breakpoint *bp) { switch (type) { @@ -389,14 +408,19 @@ static void ppc_fill_gregset (struct regcache *regcache, void *buf) { int i; + ppc_target *my_ppc_target = (ppc_target *) the_linux_target; + for (i = 0; i < 32; i++) - ppc_collect_ptrace_register (regcache, i, (char *) buf + ppc_regmap[i]); + my_ppc_target->low_collect_ptrace_register (regcache, i, + (char *) buf + ppc_regmap[i]); for (i = 64; i < 70; i++) - ppc_collect_ptrace_register (regcache, i, (char *) buf + ppc_regmap[i]); + my_ppc_target->low_collect_ptrace_register (regcache, i, + (char *) buf + ppc_regmap[i]); for (i = 71; i < 73; i++) - ppc_collect_ptrace_register (regcache, i, (char *) buf + ppc_regmap[i]); + my_ppc_target->low_collect_ptrace_register (regcache, i, + (char *) buf + ppc_regmap[i]); } /* Program Priority Register regset fill function. */ @@ -3404,25 +3428,6 @@ ppc_get_ipa_tdesc_idx (void) } struct linux_target_ops the_low_target = { - NULL, /* breakpoint_kind_from_pc */ - ppc_sw_breakpoint_from_kind, - NULL, - 0, - ppc_breakpoint_at, - ppc_supports_z_point_type, - ppc_insert_point, - ppc_remove_point, - NULL, - NULL, - ppc_collect_ptrace_register, - ppc_supply_ptrace_register, - NULL, /* siginfo_fixup */ - NULL, /* new_process */ - NULL, /* delete_process */ - NULL, /* new_thread */ - NULL, /* delete_thread */ - NULL, /* new_fork */ - NULL, /* prepare_to_resume */ NULL, /* process_qsupported */ ppc_supports_tracepoints, ppc_get_thread_area, @@ -3430,7 +3435,6 @@ struct linux_target_ops the_low_target = { ppc_emit_ops, ppc_get_min_fast_tracepoint_insn_len, NULL, /* supports_range_stepping */ - NULL, /* breakpoint_kind_from_current_state */ ppc_supports_hardware_single_step, NULL, /* get_syscall_trapinfo */ ppc_get_ipa_tdesc_idx,