+2020-04-02 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
+
+ Turn the 'siginfo_fixup' linux target op into a method of
+ linux_process_target.
+
+ * linux-low.h (struct linux_target_ops): Remove the op.
+ (class linux_process_target) <siginfo_fixup>
+ <low_siginfo_fixup>: Declare.
+ * linux-low.cc (siginfo_fixup): Turn into...
+ (linux_process_target::siginfo_fixup): ...this.
+ (linux_process_target::low_siginfo_fixup): Define.
+ * linux-x86-low.cc (class x86_target) <low_siginfo_fixup>: Declare.
+ (x86_siginfo_fixup): Turn into...
+ (x86_target::low_siginfo_fixup): ...this.
+ (the_low_target): Remove the op field.
+ * linux-aarch64-low.cc (class aarch64_target):
+ <low_siginfo_fixup>: Declare.
+ (aarch64_linux_siginfo_fixup): Turn into...
+ (aarch64_target::low_siginfo_fixup): ...this.
+ (the_low_target): Remove the op field.
+ * linux-arm-low.cc (the_low_target): Remove the op field.
+ * 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-mips-low.cc (the_low_target): Ditto.
+ * linux-ppc-low.cc (the_low_target): Ditto.
+ * linux-s390-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 'collect_ptrace_register' and 'supply_ptrace_register'
bool low_stopped_by_watchpoint () override;
CORE_ADDR low_stopped_data_address () override;
+
+ bool low_siginfo_fixup (siginfo_t *native, gdb_byte *inf,
+ int direction) override;
};
/* The singleton target ops object. */
is_64bit_tdesc ());
}
-/* Implementation of linux_target_ops method "siginfo_fixup". */
+/* Implementation of linux target ops method "low_siginfo_fixup". */
-static int
-aarch64_linux_siginfo_fixup (siginfo_t *native, gdb_byte *inf, int direction)
+bool
+aarch64_target::low_siginfo_fixup (siginfo_t *native, gdb_byte *inf,
+ int direction)
{
/* Is the inferior 32-bit? If so, then fixup the siginfo object. */
if (!is_64bit_tdesc ())
aarch64_siginfo_from_compat_siginfo (native,
(struct compat_siginfo *) inf);
- return 1;
+ return true;
}
- return 0;
+ return false;
}
/* Implementation of linux_target_ops method "new_process". */
struct linux_target_ops the_low_target =
{
- aarch64_linux_siginfo_fixup,
aarch64_linux_new_process,
aarch64_linux_delete_process,
aarch64_linux_new_thread,
}
struct linux_target_ops the_low_target = {
- NULL, /* siginfo_fixup */
arm_new_process,
arm_delete_process,
arm_new_thread,
}
struct linux_target_ops the_low_target = {
- NULL, /* siginfo_fixup */
NULL, /* new_process */
NULL, /* delete_process */
NULL, /* new_thread */
}
struct linux_target_ops the_low_target = {
- NULL, /* siginfo_fixup */
NULL, /* new_process */
NULL, /* delete_process */
NULL, /* new_thread */
return linux_common_xfer_osdata (annex, readbuf, offset, len);
}
-/* Convert a native/host siginfo object, into/from the siginfo in the
- layout of the inferiors' architecture. */
-
-static void
-siginfo_fixup (siginfo_t *siginfo, gdb_byte *inf_siginfo, int direction)
+void
+linux_process_target::siginfo_fixup (siginfo_t *siginfo,
+ gdb_byte *inf_siginfo, int direction)
{
- int done = 0;
-
- if (the_low_target.siginfo_fixup != NULL)
- done = the_low_target.siginfo_fixup (siginfo, inf_siginfo, direction);
+ bool done = low_siginfo_fixup (siginfo, inf_siginfo, direction);
/* If there was no callback, or the callback didn't do anything,
then just do a straight memcpy. */
}
}
+bool
+linux_process_target::low_siginfo_fixup (siginfo_t *native, gdb_byte *inf,
+ int direction)
+{
+ return false;
+}
+
bool
linux_process_target::supports_qxfer_siginfo ()
{
struct linux_target_ops
{
- /* Hook to convert from target format to ptrace format and back.
- Returns true if any conversion was done; false otherwise.
- If DIRECTION is 1, then copy from INF to NATIVE.
- If DIRECTION is 0, copy from NATIVE to INF. */
- int (*siginfo_fixup) (siginfo_t *native, gdb_byte *inf, int direction);
-
/* Hook to call when a new process is created or attached to.
If extra per-process architecture-specific data is needed,
allocate it here. */
registers meanwhile, we have the cached data we can rely on. */
bool check_stopped_by_watchpoint (lwp_info *child);
+ /* Convert a native/host siginfo object, into/from the siginfo in the
+ layout of the inferiors' architecture. */
+ void siginfo_fixup (siginfo_t *siginfo, gdb_byte *inf_siginfo,
+ int direction);
+
protected:
/* The architecture-specific "low" methods are listed below. */
virtual void low_supply_ptrace_register (regcache *regcache, int regno,
const char *buf);
+ /* Hook to convert from target format to ptrace format and back.
+ Returns true if any conversion was done; false otherwise.
+ If DIRECTION is 1, then copy from INF to NATIVE.
+ If DIRECTION is 0, copy from NATIVE to INF. */
+ virtual bool low_siginfo_fixup (siginfo_t *native, gdb_byte *inf,
+ int direction);
+
/* How many bytes the PC should be decremented after a break. */
virtual int low_decr_pc_after_break ();
};
}
struct linux_target_ops the_low_target = {
- NULL, /* siginfo_fixup */
NULL, /* new_process */
NULL, /* delete_process */
NULL, /* new_thread */
}
struct linux_target_ops the_low_target = {
- NULL, /* siginfo_fixup */
NULL, /* new_process */
NULL, /* delete_process */
NULL, /* new_thread */
}
struct linux_target_ops the_low_target = {
- NULL, /* siginfo_fixup */
mips_linux_new_process,
mips_linux_delete_process,
mips_linux_new_thread,
}
struct linux_target_ops the_low_target = {
- NULL, /* siginfo_fixup */
NULL, /* new_process */
NULL, /* delete_process */
NULL, /* new_thread */
}
struct linux_target_ops the_low_target = {
- NULL, /* siginfo_fixup */
NULL, /* new_process */
NULL, /* delete_process */
NULL, /* new_thread */
}
struct linux_target_ops the_low_target = {
- NULL, /* siginfo_fixup */
NULL, /* new_process */
NULL, /* delete_process */
NULL, /* new_thread */
}
struct linux_target_ops the_low_target = {
- NULL, /* siginfo_fixup */
NULL, /* new_process */
NULL, /* delete_process */
NULL, /* new_thread */
struct linux_target_ops the_low_target =
{
- NULL, /* siginfo_fixup */
NULL, /* new_process */
NULL, /* delete_process */
NULL, /* new_thread */
/* collect_ptrace_register/supply_ptrace_register are not needed in the
native i386 case (no registers smaller than an xfer unit), and are not
used in the biarch case (HAVE_LINUX_USRREGS is not defined). */
+
+ /* Need to fix up i386 siginfo if host is amd64. */
+ bool low_siginfo_fixup (siginfo_t *native, gdb_byte *inf,
+ int direction) override;
};
/* The singleton target ops object. */
from INF to PTRACE. If DIRECTION is 0, copy from PTRACE to
INF. */
-static int
-x86_siginfo_fixup (siginfo_t *ptrace, gdb_byte *inf, int direction)
+bool
+x86_target::low_siginfo_fixup (siginfo_t *ptrace, gdb_byte *inf, int direction)
{
#ifdef __x86_64__
unsigned int machine;
FIXUP_X32);
#endif
- return 0;
+ return false;
}
\f
static int use_xml;
struct linux_target_ops the_low_target =
{
- /* need to fix up i386 siginfo if host is amd64 */
- x86_siginfo_fixup,
x86_linux_new_process,
x86_linux_delete_process,
x86_linux_new_thread,
}
struct linux_target_ops the_low_target = {
- NULL, /* siginfo_fixup */
NULL, /* new_process */
NULL, /* delete_process */
NULL, /* new_thread */