+2020-04-02 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
+
+ Remove the 'install_fast_tracepoint_jump_pad' and
+ 'get_min_fast_tracepoint_insn_len' linux target ops to let the
+ concrete linux target define the ops by overriding the declarations
+ of process_stratum_target.
+
+ * linux-low.h (struct linux_target_ops): Remove the ops.
+ (class linux_process_target) <supports_fast_tracepoints>
+ <install_fast_tracepoint_jump_pad>
+ <get_min_fast_tracepoint_insn_len>: Remove.
+ * linux-low.cc (linux_process_target::supports_fast_tracepoints)
+ (linux_process_target::install_fast_tracepoint_jump_pad)
+ (linux_process_target::get_min_fast_tracepoint_insn_len): Remove.
+ * linux-x86-low.cc (class x86_target) <supports_fast_tracepoints>
+ <install_fast_tracepoint_jump_pad>
+ <get_min_fast_tracepoint_insn_len>: Declare.
+ (x86_target::supports_fast_tracepoints): Define.
+ (x86_install_fast_tracepoint_jump_pad): Turn into...
+ (x86_target::install_fast_tracepoint_jump_pad): ...this.
+ (x86_get_min_fast_tracepoint_insn_len): Turn into...
+ (x86_target::get_min_fast_tracepoint_insn_len): ...this.
+ (the_low_target): Remove the op fields.
+ * linux-aarch64-low.cc (class aarch64_target)
+ <supports_fast_tracepoints>
+ <install_fast_tracepoint_jump_pad>
+ <get_min_fast_tracepoint_insn_len>: Declare.
+ (aarch64_target::supports_fast_tracepoints): Define.
+ (aarch64_install_fast_tracepoint_jump_pad): Turn into...
+ (aarch64_target::install_fast_tracepoint_jump_pad): ...this.
+ (aarch64_get_min_fast_tracepoint_insn_len): Turn into...
+ (aarch64_target::get_min_fast_tracepoint_insn_len): ...this.
+ (the_low_target): Remove the op fields.
+ * linux-ppc-low.cc (class ppc_target) <supports_fast_tracepoints>
+ <install_fast_tracepoint_jump_pad>
+ <get_min_fast_tracepoint_insn_len>: Declare.
+ (ppc_target::supports_fast_tracepoints): Define.
+ (ppc_install_fast_tracepoint_jump_pad): Turn into...
+ (ppc_target::install_fast_tracepoint_jump_pad): ...this.
+ (ppc_get_min_fast_tracepoint_insn_len): Turn into...
+ (ppc_target::get_min_fast_tracepoint_insn_len): ...this.
+ (the_low_target): Remove the op fields.
+ * linux-s390-low.cc (class s390_target) <supports_fast_tracepoints>
+ <install_fast_tracepoint_jump_pad>
+ <get_min_fast_tracepoint_insn_len>: Declare.
+ (s390_target::supports_fast_tracepoints): Define.
+ (s390_install_fast_tracepoint_jump_pad): Turn into...
+ (s390_target::install_fast_tracepoint_jump_pad): ...this.
+ (s390_get_min_fast_tracepoint_insn_len): Turn into...
+ (s390_target::get_min_fast_tracepoint_insn_len): ...this.
+ (the_low_target): Remove the op fields.
+ * linux-arm-low.cc (the_low_target): Remove the op fields.
+ * linux-bfin-low.cc (the_low_target): Ditto.
+ * linux-crisv32-low.cc (the_low_target): Ditto.
+ * linux-m32r-low.cc (the_low_target): Ditto.
+ * linux-m68k-low.cc (the_low_target): Ditto.
+ * linux-sh-low.cc (the_low_target): Ditto.
+ * linux-tic6x-low.cc (the_low_target): Ditto.
+ * linux-tile-low.cc (the_low_target): Ditto.
+ * linux-xtensa-low.cc (the_low_target): Ditto.
+
2020-04-02 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Turn the 'get_thread_area' linux target op into a method of
bool supports_tracepoints () override;
+ bool supports_fast_tracepoints () override;
+
+ int install_fast_tracepoint_jump_pad
+ (CORE_ADDR tpoint, CORE_ADDR tpaddr, CORE_ADDR collector,
+ CORE_ADDR lockaddr, ULONGEST orig_size, CORE_ADDR *jump_entry,
+ CORE_ADDR *trampoline, ULONGEST *trampoline_size,
+ unsigned char *jjump_pad_insn, ULONGEST *jjump_pad_insn_size,
+ CORE_ADDR *adjusted_insn_addr, CORE_ADDR *adjusted_insn_addr_end,
+ char *err) override;
+
+ int get_min_fast_tracepoint_insn_len () override;
+
protected:
void low_arch_setup () override;
aarch64_ftrace_insn_reloc_others,
};
-/* Implementation of linux_target_ops method
+bool
+aarch64_target::supports_fast_tracepoints ()
+{
+ return true;
+}
+
+/* Implementation of target ops method
"install_fast_tracepoint_jump_pad". */
-static int
-aarch64_install_fast_tracepoint_jump_pad (CORE_ADDR tpoint,
- CORE_ADDR tpaddr,
- CORE_ADDR collector,
- CORE_ADDR lockaddr,
- ULONGEST orig_size,
- CORE_ADDR *jump_entry,
- CORE_ADDR *trampoline,
- ULONGEST *trampoline_size,
- unsigned char *jjump_pad_insn,
- ULONGEST *jjump_pad_insn_size,
- CORE_ADDR *adjusted_insn_addr,
- CORE_ADDR *adjusted_insn_addr_end,
- char *err)
+int
+aarch64_target::install_fast_tracepoint_jump_pad
+ (CORE_ADDR tpoint, CORE_ADDR tpaddr, CORE_ADDR collector,
+ CORE_ADDR lockaddr, ULONGEST orig_size, CORE_ADDR *jump_entry,
+ CORE_ADDR *trampoline, ULONGEST *trampoline_size,
+ unsigned char *jjump_pad_insn, ULONGEST *jjump_pad_insn_size,
+ CORE_ADDR *adjusted_insn_addr, CORE_ADDR *adjusted_insn_addr_end,
+ char *err)
{
uint32_t buf[256];
uint32_t *p = buf;
return &aarch64_emit_ops_impl;
}
-/* Implementation of linux_target_ops method
+/* Implementation of target ops method
"get_min_fast_tracepoint_insn_len". */
-static int
-aarch64_get_min_fast_tracepoint_insn_len (void)
+int
+aarch64_target::get_min_fast_tracepoint_insn_len ()
{
return 4;
}
struct linux_target_ops the_low_target =
{
- aarch64_install_fast_tracepoint_jump_pad,
aarch64_emit_ops,
- aarch64_get_min_fast_tracepoint_insn_len,
aarch64_supports_range_stepping,
aarch64_supports_hardware_single_step,
aarch64_get_syscall_trapinfo,
}
struct linux_target_ops the_low_target = {
- NULL, /* install_fast_tracepoint_jump_pad */
NULL, /* emit_ops */
- NULL, /* get_min_fast_tracepoint_insn_len */
NULL, /* supports_range_stepping */
arm_supports_hardware_single_step,
arm_get_syscall_trapinfo,
}
struct linux_target_ops the_low_target = {
- NULL, /* install_fast_tracepoint_jump_pad */
NULL, /* emit_ops */
- NULL, /* get_min_fast_tracepoint_insn_len */
NULL, /* supports_range_stepping */
bfin_supports_hardware_single_step,
};
}
struct linux_target_ops the_low_target = {
- NULL, /* install_fast_tracepoint_jump_pad */
NULL, /* emit_ops */
- NULL, /* get_min_fast_tracepoint_insn_len */
NULL, /* supports_range_stepping */
cris_supports_hardware_single_step,
};
target_unpause_all (true);
}
-bool
-linux_process_target::supports_fast_tracepoints ()
-{
- return the_low_target.install_fast_tracepoint_jump_pad != nullptr;
-}
-
-int
-linux_process_target::install_fast_tracepoint_jump_pad
- (CORE_ADDR tpoint, CORE_ADDR tpaddr, CORE_ADDR collector,
- CORE_ADDR lockaddr, ULONGEST orig_size, CORE_ADDR *jump_entry,
- CORE_ADDR *trampoline, ULONGEST *trampoline_size,
- unsigned char *jjump_pad_insn, ULONGEST *jjump_pad_insn_size,
- CORE_ADDR *adjusted_insn_addr, CORE_ADDR *adjusted_insn_addr_end,
- char *err)
-{
- return (*the_low_target.install_fast_tracepoint_jump_pad)
- (tpoint, tpaddr, collector, lockaddr, orig_size,
- jump_entry, trampoline, trampoline_size,
- jjump_pad_insn, jjump_pad_insn_size,
- adjusted_insn_addr, adjusted_insn_addr_end,
- err);
-}
-
emit_ops *
linux_process_target::emit_ops ()
{
return NULL;
}
-int
-linux_process_target::get_min_fast_tracepoint_insn_len ()
-{
- return (*the_low_target.get_min_fast_tracepoint_insn_len) ();
-}
-
/* Extract &phdr and num_phdr in the inferior. Return 0 on success. */
static int
struct linux_target_ops
{
- /* Install a fast tracepoint jump pad. See target.h for
- comments. */
- int (*install_fast_tracepoint_jump_pad) (CORE_ADDR tpoint, CORE_ADDR tpaddr,
- CORE_ADDR collector,
- CORE_ADDR lockaddr,
- ULONGEST orig_size,
- CORE_ADDR *jump_entry,
- CORE_ADDR *trampoline,
- ULONGEST *trampoline_size,
- unsigned char *jjump_pad_insn,
- ULONGEST *jjump_pad_insn_size,
- CORE_ADDR *adjusted_insn_addr,
- CORE_ADDR *adjusted_insn_addr_end,
- char *err);
-
/* Return the bytecode operations vector for the current inferior.
Returns NULL if bytecode compilation is not supported. */
struct emit_ops *(*emit_ops) (void);
- /* Return the minimum length of an instruction that can be safely overwritten
- for use as a fast tracepoint. */
- int (*get_min_fast_tracepoint_insn_len) (void);
-
/* Returns true if the low target supports range stepping. */
int (*supports_range_stepping) (void);
void stabilize_threads () override;
- bool supports_fast_tracepoints () override;
-
- int install_fast_tracepoint_jump_pad (CORE_ADDR tpoint,
- CORE_ADDR tpaddr,
- CORE_ADDR collector,
- CORE_ADDR lockaddr,
- ULONGEST orig_size,
- CORE_ADDR *jump_entry,
- CORE_ADDR *trampoline,
- ULONGEST *trampoline_size,
- unsigned char *jjump_pad_insn,
- ULONGEST *jjump_pad_insn_size,
- CORE_ADDR *adjusted_insn_addr,
- CORE_ADDR *adjusted_insn_addr_end,
- char *err) override;
-
- int get_min_fast_tracepoint_insn_len () override;
-
struct emit_ops *emit_ops () override;
bool supports_disable_randomization () override;
}
struct linux_target_ops the_low_target = {
- NULL, /* install_fast_tracepoint_jump_pad */
NULL, /* emit_ops */
- NULL, /* get_min_fast_tracepoint_insn_len */
NULL, /* supports_range_stepping */
m32r_supports_hardware_single_step,
};
}
struct linux_target_ops the_low_target = {
- NULL, /* install_fast_tracepoint_jump_pad */
NULL, /* emit_ops */
- NULL, /* get_min_fast_tracepoint_insn_len */
NULL, /* supports_range_stepping */
m68k_supports_hardware_single_step,
};
bool supports_tracepoints () override;
+ bool supports_fast_tracepoints () override;
+
+ int install_fast_tracepoint_jump_pad
+ (CORE_ADDR tpoint, CORE_ADDR tpaddr, CORE_ADDR collector,
+ CORE_ADDR lockaddr, ULONGEST orig_size, CORE_ADDR *jump_entry,
+ CORE_ADDR *trampoline, ULONGEST *trampoline_size,
+ unsigned char *jjump_pad_insn, ULONGEST *jjump_pad_insn_size,
+ CORE_ADDR *adjusted_insn_addr, CORE_ADDR *adjusted_insn_addr_end,
+ char *err) override;
+
+ int get_min_fast_tracepoint_insn_len () override;
+
protected:
void low_arch_setup () override;
*to += 4;
}
+bool
+ppc_target::supports_fast_tracepoints ()
+{
+ return true;
+}
+
/* Implement install_fast_tracepoint_jump_pad of target_ops.
See target.h for details. */
-static int
-ppc_install_fast_tracepoint_jump_pad (CORE_ADDR tpoint, CORE_ADDR tpaddr,
- CORE_ADDR collector,
- CORE_ADDR lockaddr,
- ULONGEST orig_size,
- CORE_ADDR *jump_entry,
- CORE_ADDR *trampoline,
- ULONGEST *trampoline_size,
- unsigned char *jjump_pad_insn,
- ULONGEST *jjump_pad_insn_size,
- CORE_ADDR *adjusted_insn_addr,
- CORE_ADDR *adjusted_insn_addr_end,
- char *err)
+int
+ppc_target::install_fast_tracepoint_jump_pad (CORE_ADDR tpoint,
+ CORE_ADDR tpaddr,
+ CORE_ADDR collector,
+ CORE_ADDR lockaddr,
+ ULONGEST orig_size,
+ CORE_ADDR *jump_entry,
+ CORE_ADDR *trampoline,
+ ULONGEST *trampoline_size,
+ unsigned char *jjump_pad_insn,
+ ULONGEST *jjump_pad_insn_size,
+ CORE_ADDR *adjusted_insn_addr,
+ CORE_ADDR *adjusted_insn_addr_end,
+ char *err)
{
uint32_t buf[256];
uint32_t *p = buf;
/* Returns the minimum instruction length for installing a tracepoint. */
-static int
-ppc_get_min_fast_tracepoint_insn_len (void)
+int
+ppc_target::get_min_fast_tracepoint_insn_len ()
{
return 4;
}
}
struct linux_target_ops the_low_target = {
- ppc_install_fast_tracepoint_jump_pad,
ppc_emit_ops,
- ppc_get_min_fast_tracepoint_insn_len,
NULL, /* supports_range_stepping */
ppc_supports_hardware_single_step,
NULL, /* get_syscall_trapinfo */
bool supports_tracepoints () override;
+ bool supports_fast_tracepoints () override;
+
+ int install_fast_tracepoint_jump_pad
+ (CORE_ADDR tpoint, CORE_ADDR tpaddr, CORE_ADDR collector,
+ CORE_ADDR lockaddr, ULONGEST orig_size, CORE_ADDR *jump_entry,
+ CORE_ADDR *trampoline, ULONGEST *trampoline_size,
+ unsigned char *jjump_pad_insn, ULONGEST *jjump_pad_insn_size,
+ CORE_ADDR *adjusted_insn_addr, CORE_ADDR *adjusted_insn_addr_end,
+ char *err) override;
+
+ int get_min_fast_tracepoint_insn_len () override;
+
void low_collect_ptrace_register (regcache *regcache, int regno,
char *buf) override;
return 0;
}
-/* Implementation of linux_target_ops method
+bool
+s390_target::supports_fast_tracepoints ()
+{
+ return true;
+}
+
+/* Implementation of target ops method
"install_fast_tracepoint_jump_pad". */
-static int
-s390_install_fast_tracepoint_jump_pad (CORE_ADDR tpoint,
- CORE_ADDR tpaddr,
- CORE_ADDR collector,
- CORE_ADDR lockaddr,
- ULONGEST orig_size,
- CORE_ADDR *jump_entry,
- CORE_ADDR *trampoline,
- ULONGEST *trampoline_size,
- unsigned char *jjump_pad_insn,
- ULONGEST *jjump_pad_insn_size,
- CORE_ADDR *adjusted_insn_addr,
- CORE_ADDR *adjusted_insn_addr_end,
- char *err)
+int
+s390_target::install_fast_tracepoint_jump_pad
+ (CORE_ADDR tpoint, CORE_ADDR tpaddr, CORE_ADDR collector,
+ CORE_ADDR lockaddr, ULONGEST orig_size, CORE_ADDR *jump_entry,
+ CORE_ADDR *trampoline, ULONGEST *trampoline_size,
+ unsigned char *jjump_pad_insn, ULONGEST *jjump_pad_insn_size,
+ CORE_ADDR *adjusted_insn_addr, CORE_ADDR *adjusted_insn_addr_end,
+ char *err)
{
int i;
int64_t loffset;
return 0;
}
-/* Implementation of linux_target_ops method
+/* Implementation of target ops method
"get_min_fast_tracepoint_insn_len". */
-static int
-s390_get_min_fast_tracepoint_insn_len (void)
+int
+s390_target::get_min_fast_tracepoint_insn_len ()
{
/* We only support using 6-byte jumps to reach the tracepoint code.
If the tracepoint buffer were allocated sufficiently close (64kiB)
}
struct linux_target_ops the_low_target = {
- s390_install_fast_tracepoint_jump_pad,
s390_emit_ops,
- s390_get_min_fast_tracepoint_insn_len,
NULL, /* supports_range_stepping */
s390_supports_hardware_single_step,
NULL, /* get_syscall_trapinfo */
}
struct linux_target_ops the_low_target = {
- NULL, /* install_fast_tracepoint_jump_pad */
NULL, /* emit_ops */
- NULL, /* get_min_fast_tracepoint_insn_len */
NULL, /* supports_range_stepping */
sh_supports_hardware_single_step,
};
}
struct linux_target_ops the_low_target = {
- NULL, /* install_fast_tracepoint_jump_pad */
NULL, /* emit_ops */
- NULL, /* get_min_fast_tracepoint_insn_len */
NULL, /* supports_range_stepping */
tic6x_supports_hardware_single_step,
};
struct linux_target_ops the_low_target =
{
- NULL, /* install_fast_tracepoint_jump_pad */
NULL, /* emit_ops */
- NULL, /* get_min_fast_tracepoint_insn_len */
NULL, /* supports_range_stepping */
tile_supports_hardware_single_step,
};
bool supports_tracepoints () override;
+ bool supports_fast_tracepoints () override;
+
+ int install_fast_tracepoint_jump_pad
+ (CORE_ADDR tpoint, CORE_ADDR tpaddr, CORE_ADDR collector,
+ CORE_ADDR lockaddr, ULONGEST orig_size, CORE_ADDR *jump_entry,
+ CORE_ADDR *trampoline, ULONGEST *trampoline_size,
+ unsigned char *jjump_pad_insn, ULONGEST *jjump_pad_insn_size,
+ CORE_ADDR *adjusted_insn_addr, CORE_ADDR *adjusted_insn_addr_end,
+ char *err) override;
+
+ int get_min_fast_tracepoint_insn_len () override;
+
protected:
void low_arch_setup () override;
return 0;
}
-static int
-x86_install_fast_tracepoint_jump_pad (CORE_ADDR tpoint, CORE_ADDR tpaddr,
- CORE_ADDR collector,
- CORE_ADDR lockaddr,
- ULONGEST orig_size,
- CORE_ADDR *jump_entry,
- CORE_ADDR *trampoline,
- ULONGEST *trampoline_size,
- unsigned char *jjump_pad_insn,
- ULONGEST *jjump_pad_insn_size,
- CORE_ADDR *adjusted_insn_addr,
- CORE_ADDR *adjusted_insn_addr_end,
- char *err)
+bool
+x86_target::supports_fast_tracepoints ()
+{
+ return true;
+}
+
+int
+x86_target::install_fast_tracepoint_jump_pad (CORE_ADDR tpoint,
+ CORE_ADDR tpaddr,
+ CORE_ADDR collector,
+ CORE_ADDR lockaddr,
+ ULONGEST orig_size,
+ CORE_ADDR *jump_entry,
+ CORE_ADDR *trampoline,
+ ULONGEST *trampoline_size,
+ unsigned char *jjump_pad_insn,
+ ULONGEST *jjump_pad_insn_size,
+ CORE_ADDR *adjusted_insn_addr,
+ CORE_ADDR *adjusted_insn_addr_end,
+ char *err)
{
#ifdef __x86_64__
if (is_64bit_tdesc ())
/* Return the minimum instruction length for fast tracepoints on x86/x86-64
architectures. */
-static int
-x86_get_min_fast_tracepoint_insn_len (void)
+int
+x86_target::get_min_fast_tracepoint_insn_len ()
{
static int warned_about_fast_tracepoints = 0;
struct linux_target_ops the_low_target =
{
- x86_install_fast_tracepoint_jump_pad,
x86_emit_ops,
- x86_get_min_fast_tracepoint_insn_len,
x86_supports_range_stepping,
x86_supports_hardware_single_step,
x86_get_syscall_trapinfo,
}
struct linux_target_ops the_low_target = {
- NULL, /* install_fast_tracepoint_jump_pad */
NULL, /* emit_ops */
- NULL, /* get_min_fast_tracepoint_insn_len */
NULL, /* supports_range_stepping */
xtensa_supports_hardware_single_step,
};