import gdb-8.2-16.el8
This commit is contained in:
parent
0b0e7ac2d9
commit
9803ac7da2
@ -751,3 +751,35 @@ Patch183: gdb-rhbz1905701-DWARF-data_location.patch
|
||||
# Andreas Arnaz (RH BZ 1903374)
|
||||
Patch184: gdb-rhbz1903374-s390x-store-on-condition.patch
|
||||
|
||||
# Fix segfault with nameless fortran modules.
|
||||
# Bernhard Heckel, RH BZ 1943673
|
||||
Patch185: gdb-rhbz1934673-fortran-nameless-modules.patch
|
||||
|
||||
# Backport "Add low_new_clone method to linux_nat_target."
|
||||
# (Pedro Franco de Carvalho, RH BZ 1854784)
|
||||
Patch186: gdb-rhbz1854784-powerpc-remove-region-limit-dawr-1of7.patch
|
||||
|
||||
# Backport "Add linux_get_hwcap"
|
||||
# (Alan Hayward, RH BZ 1854784)
|
||||
Patch187: gdb-rhbz1854784-powerpc-remove-region-limit-dawr-2of7.patch
|
||||
|
||||
# Backport "[PowerPC] Move up some register access routines"
|
||||
# (Pedro Franco de Carvalho, RH BZ 1854784)
|
||||
Patch188: gdb-rhbz1854784-powerpc-remove-region-limit-dawr-3of7.patch
|
||||
|
||||
# Backport "[PowerPC] Fix debug register issues in ppc-linux-nat"
|
||||
# (Pedro Franco de Carvalho, RH BZ 1854784)
|
||||
Patch189: gdb-rhbz1854784-powerpc-remove-region-limit-dawr-4of7.patch
|
||||
|
||||
# Backport "[PowerPC] Use < 0 and >= 0 for watchpoint ptrace calls"
|
||||
# (Pedro Franco de Carvalho, RH BZ 1854784)
|
||||
Patch190: gdb-rhbz1854784-powerpc-remove-region-limit-dawr-5of7.patch
|
||||
|
||||
# Backport "[PowerPC] Always clear watchpoint with PTRACE_SET_DEBUGREG"
|
||||
# (Pedro Franco de Carvalho, RH BZ 1854784)
|
||||
Patch191: gdb-rhbz1854784-powerpc-remove-region-limit-dawr-6of7.patch
|
||||
|
||||
# Backport "PowerPC remove 512 bytes region limit if 2nd DAWR is available."
|
||||
# (Rogerio Alves, RH BZ 1854784)
|
||||
Patch192: gdb-rhbz1854784-powerpc-remove-region-limit-dawr-7of7.patch
|
||||
|
||||
|
@ -182,3 +182,11 @@
|
||||
%patch182 -p1
|
||||
%patch183 -p1
|
||||
%patch184 -p1
|
||||
%patch185 -p1
|
||||
%patch186 -p1
|
||||
%patch187 -p1
|
||||
%patch188 -p1
|
||||
%patch189 -p1
|
||||
%patch190 -p1
|
||||
%patch191 -p1
|
||||
%patch192 -p1
|
||||
|
@ -0,0 +1,49 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Pedro Franco de Carvalho <pedromfc@linux.ibm.com>
|
||||
Date: Wed, 7 Jul 2021 15:44:29 -0400
|
||||
Subject: gdb-rhbz1854784-powerpc-remove-region-limit-dawr-1of7.patch
|
||||
|
||||
;; Backport "Add low_new_clone method to linux_nat_target."
|
||||
;; (Pedro Franco de Carvalho, RH BZ 1854784)
|
||||
|
||||
This patch adds a low_new_clone method to linux_nat_target, called after
|
||||
a PTRACE_EVENT_CLONE is detected, similar to how low_new_fork is called
|
||||
after PTRACE_EVENT_(V)FORK.
|
||||
|
||||
This is useful for targets that need to copy state associated with a
|
||||
thread that is inherited across clones.
|
||||
|
||||
gdb/ChangeLog:
|
||||
2020-03-30 Pedro Franco de Carvalho <pedromfc@linux.ibm.com>
|
||||
|
||||
* linux-nat.h (low_new_clone): New method.
|
||||
* linux-nat.c (linux_handle_extended_wait): Call low_new_clone.
|
||||
|
||||
diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
|
||||
--- a/gdb/linux-nat.c
|
||||
+++ b/gdb/linux-nat.c
|
||||
@@ -2020,6 +2020,10 @@ linux_handle_extended_wait (struct lwp_info *lp, int status)
|
||||
inferior. */
|
||||
linux_target->low_new_fork (lp, new_pid);
|
||||
}
|
||||
+ else if (event == PTRACE_EVENT_CLONE)
|
||||
+ {
|
||||
+ linux_target->low_new_clone (lp, new_pid);
|
||||
+ }
|
||||
|
||||
if (event == PTRACE_EVENT_FORK
|
||||
&& linux_fork_checkpointing_p (lp->ptid.pid ()))
|
||||
diff --git a/gdb/linux-nat.h b/gdb/linux-nat.h
|
||||
--- a/gdb/linux-nat.h
|
||||
+++ b/gdb/linux-nat.h
|
||||
@@ -160,6 +160,10 @@ public:
|
||||
virtual void low_new_fork (struct lwp_info *parent, pid_t child_pid)
|
||||
{}
|
||||
|
||||
+ /* The method to call, if any, when a new clone event is detected. */
|
||||
+ virtual void low_new_clone (struct lwp_info *parent, pid_t child_lwp)
|
||||
+ {}
|
||||
+
|
||||
/* The method to call, if any, when a process is no longer
|
||||
attached. */
|
||||
virtual void low_forget_process (pid_t pid)
|
@ -0,0 +1,311 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Alan Hayward <alan.hayward@arm.com>
|
||||
Date: Wed, 7 Jul 2021 18:13:44 -0400
|
||||
Subject: gdb-rhbz1854784-powerpc-remove-region-limit-dawr-2of7.patch
|
||||
|
||||
;; Backport "Add linux_get_hwcap"
|
||||
;; (Alan Hayward, RH BZ 1854784)
|
||||
|
||||
Tidy up calls to read HWCAP (and HWCAP2) by adding common functions,
|
||||
removing the PPC and AArch64 specific versions.
|
||||
|
||||
The only function difference is in aarch64_linux_core_read_description - if
|
||||
the hwcap read fails it now return a valid description instead of nullptr.
|
||||
|
||||
gdb/ChangeLog:
|
||||
|
||||
2019-03-25 Alan Hayward <alan.hayward@arm.com>
|
||||
|
||||
* aarch64-linux-nat.c (aarch64_linux_nat_target::read_description):
|
||||
Call linux_get_hwcap.
|
||||
* aarch64-linux-tdep.c (aarch64_linux_core_read_description):
|
||||
Likewise.
|
||||
(aarch64_linux_get_hwcap): Remove function.
|
||||
* aarch64-linux-tdep.h (aarch64_linux_get_hwcap): Remove
|
||||
declaration.
|
||||
* arm-linux-nat.c (arm_linux_nat_target::read_description):Call
|
||||
linux_get_hwcap.
|
||||
* arm-linux-tdep.c (arm_linux_core_read_description): Likewise.
|
||||
* linux-tdep.c (linux_get_hwcap): Add function.
|
||||
(linux_get_hwcap2): Likewise.
|
||||
* linux-tdep.h (linux_get_hwcap): Add declaration.
|
||||
(linux_get_hwcap2): Likewise.
|
||||
* ppc-linux-nat.c (ppc_linux_get_hwcap): Remove function.
|
||||
(ppc_linux_get_hwcap2): Likewise.
|
||||
(ppc_linux_nat_target::region_ok_for_hw_watchpoint): Call
|
||||
linux_get_hwcap.
|
||||
(ppc_linux_nat_target::insert_watchpoint): Likewise.
|
||||
(ppc_linux_nat_target::watchpoint_addr_within_range): Likewise.
|
||||
(ppc_linux_nat_target::read_description): Likewise.
|
||||
* ppc-linux-tdep.c (ppc_linux_core_read_description): Likewise.
|
||||
* s390-linux-nat.c: Likewise.
|
||||
* s390-linux-tdep.c (s390_core_read_description): Likewise.
|
||||
|
||||
diff --git a/gdb/aarch64-linux-nat.c b/gdb/aarch64-linux-nat.c
|
||||
--- a/gdb/aarch64-linux-nat.c
|
||||
+++ b/gdb/aarch64-linux-nat.c
|
||||
@@ -42,6 +42,7 @@
|
||||
#include <asm/ptrace.h>
|
||||
|
||||
#include "gregset.h"
|
||||
+#include "linux-tdep.h"
|
||||
|
||||
/* Defines ps_err_e, struct ps_prochandle. */
|
||||
#include "gdb_proc_service.h"
|
||||
@@ -605,8 +606,7 @@ aarch64_linux_nat_target::read_description ()
|
||||
ret = ptrace (PTRACE_GETREGSET, tid, NT_ARM_VFP, &iovec);
|
||||
if (ret == 0)
|
||||
return tdesc_arm_with_neon;
|
||||
- else
|
||||
- return aarch64_read_description (aarch64_sve_get_vq (tid));
|
||||
+ else return aarch64_read_description (aarch64_sve_get_vq (tid));
|
||||
}
|
||||
|
||||
/* Convert a native/host siginfo object, into/from the siginfo in the
|
||||
diff --git a/gdb/aarch64-linux-tdep.c b/gdb/aarch64-linux-tdep.c
|
||||
--- a/gdb/aarch64-linux-tdep.c
|
||||
+++ b/gdb/aarch64-linux-tdep.c
|
||||
@@ -442,10 +442,7 @@ static const struct target_desc *
|
||||
aarch64_linux_core_read_description (struct gdbarch *gdbarch,
|
||||
struct target_ops *target, bfd *abfd)
|
||||
{
|
||||
- CORE_ADDR aarch64_hwcap = 0;
|
||||
-
|
||||
- if (target_auxv_search (target, AT_HWCAP, &aarch64_hwcap) != 1)
|
||||
- return NULL;
|
||||
+ CORE_ADDR hwcap = linux_get_hwcap (target);
|
||||
|
||||
return aarch64_read_description (aarch64_linux_core_read_vq (gdbarch, abfd));
|
||||
}
|
||||
diff --git a/gdb/arm-linux-nat.c b/gdb/arm-linux-nat.c
|
||||
--- a/gdb/arm-linux-nat.c
|
||||
+++ b/gdb/arm-linux-nat.c
|
||||
@@ -533,7 +533,7 @@ ps_get_thread_area (struct ps_prochandle *ph,
|
||||
const struct target_desc *
|
||||
arm_linux_nat_target::read_description ()
|
||||
{
|
||||
- CORE_ADDR arm_hwcap = 0;
|
||||
+ CORE_ADDR arm_hwcap = linux_get_hwcap (this);
|
||||
|
||||
if (have_ptrace_getregset == TRIBOOL_UNKNOWN)
|
||||
{
|
||||
@@ -551,11 +551,6 @@ arm_linux_nat_target::read_description ()
|
||||
have_ptrace_getregset = TRIBOOL_TRUE;
|
||||
}
|
||||
|
||||
- if (target_auxv_search (this, AT_HWCAP, &arm_hwcap) != 1)
|
||||
- {
|
||||
- return this->beneath ()->read_description ();
|
||||
- }
|
||||
-
|
||||
if (arm_hwcap & HWCAP_IWMMXT)
|
||||
return tdesc_arm_with_iwmmxt;
|
||||
|
||||
diff --git a/gdb/arm-linux-tdep.c b/gdb/arm-linux-tdep.c
|
||||
--- a/gdb/arm-linux-tdep.c
|
||||
+++ b/gdb/arm-linux-tdep.c
|
||||
@@ -730,10 +730,7 @@ arm_linux_core_read_description (struct gdbarch *gdbarch,
|
||||
struct target_ops *target,
|
||||
bfd *abfd)
|
||||
{
|
||||
- CORE_ADDR arm_hwcap = 0;
|
||||
-
|
||||
- if (target_auxv_search (target, AT_HWCAP, &arm_hwcap) != 1)
|
||||
- return NULL;
|
||||
+ CORE_ADDR arm_hwcap = linux_get_hwcap (target);
|
||||
|
||||
if (arm_hwcap & HWCAP_VFP)
|
||||
{
|
||||
diff --git a/gdb/linux-tdep.c b/gdb/linux-tdep.c
|
||||
--- a/gdb/linux-tdep.c
|
||||
+++ b/gdb/linux-tdep.c
|
||||
@@ -2567,6 +2567,28 @@ linux_displaced_step_location (struct gdbarch *gdbarch)
|
||||
return addr;
|
||||
}
|
||||
|
||||
+/* See linux-tdep.h. */
|
||||
+
|
||||
+CORE_ADDR
|
||||
+linux_get_hwcap (struct target_ops *target)
|
||||
+{
|
||||
+ CORE_ADDR field;
|
||||
+ if (target_auxv_search (target, AT_HWCAP, &field) != 1)
|
||||
+ return 0;
|
||||
+ return field;
|
||||
+}
|
||||
+
|
||||
+/* See linux-tdep.h. */
|
||||
+
|
||||
+CORE_ADDR
|
||||
+linux_get_hwcap2 (struct target_ops *target)
|
||||
+{
|
||||
+ CORE_ADDR field;
|
||||
+ if (target_auxv_search (target, AT_HWCAP2, &field) != 1)
|
||||
+ return 0;
|
||||
+ return field;
|
||||
+}
|
||||
+
|
||||
/* Display whether the gcore command is using the
|
||||
/proc/PID/coredump_filter file. */
|
||||
|
||||
diff --git a/gdb/linux-tdep.h b/gdb/linux-tdep.h
|
||||
--- a/gdb/linux-tdep.h
|
||||
+++ b/gdb/linux-tdep.h
|
||||
@@ -61,4 +61,12 @@ extern void linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch);
|
||||
|
||||
extern int linux_is_uclinux (void);
|
||||
|
||||
+/* Fetch the AT_HWCAP entry from the auxv vector for the given TARGET. On
|
||||
+ error, 0 is returned. */
|
||||
+extern CORE_ADDR linux_get_hwcap (struct target_ops *target);
|
||||
+
|
||||
+/* Fetch the AT_HWCAP2 entry from the auxv vector for the given TARGET. On
|
||||
+ error, 0 is returned. */
|
||||
+extern CORE_ADDR linux_get_hwcap2 (struct target_ops *target);
|
||||
+
|
||||
#endif /* linux-tdep.h */
|
||||
diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c
|
||||
--- a/gdb/ppc-linux-nat.c
|
||||
+++ b/gdb/ppc-linux-nat.c
|
||||
@@ -50,6 +50,7 @@
|
||||
#include "arch/ppc-linux-common.h"
|
||||
#include "arch/ppc-linux-tdesc.h"
|
||||
#include "nat/ppc-linux.h"
|
||||
+#include "linux-tdep.h"
|
||||
|
||||
/* Similarly for the hardware watchpoint support. These requests are used
|
||||
when the PowerPC HWDEBUG ptrace interface is not available. */
|
||||
@@ -1560,31 +1561,6 @@ store_ppc_registers (const struct regcache *regcache, int tid)
|
||||
function to fail most of the time, so we ignore them. */
|
||||
}
|
||||
|
||||
-/* Fetch the AT_HWCAP entry from the aux vector. */
|
||||
-static CORE_ADDR
|
||||
-ppc_linux_get_hwcap (void)
|
||||
-{
|
||||
- CORE_ADDR field;
|
||||
-
|
||||
- if (target_auxv_search (current_top_target (), AT_HWCAP, &field) != 1)
|
||||
- return 0;
|
||||
-
|
||||
- return field;
|
||||
-}
|
||||
-
|
||||
-/* Fetch the AT_HWCAP2 entry from the aux vector. */
|
||||
-
|
||||
-static CORE_ADDR
|
||||
-ppc_linux_get_hwcap2 (void)
|
||||
-{
|
||||
- CORE_ADDR field;
|
||||
-
|
||||
- if (target_auxv_search (current_top_target (), AT_HWCAP2, &field) != 1)
|
||||
- return 0;
|
||||
-
|
||||
- return field;
|
||||
-}
|
||||
-
|
||||
/* The cached DABR value, to install in new threads.
|
||||
This variable is used when the PowerPC HWDEBUG ptrace
|
||||
interface is not available. */
|
||||
@@ -1741,7 +1717,7 @@ ppc_linux_nat_target::region_ok_for_hw_watchpoint (CORE_ADDR addr, LONGEST len)
|
||||
takes two hardware watchpoints though. */
|
||||
if (len > 1
|
||||
&& hwdebug_info.features & PPC_DEBUG_FEATURE_DATA_BP_RANGE
|
||||
- && ppc_linux_get_hwcap () & PPC_FEATURE_BOOKE)
|
||||
+ && linux_get_hwcap (current_top_target ()) & PPC_FEATURE_BOOKE)
|
||||
return 2;
|
||||
/* Check if the processor provides DAWR interface. */
|
||||
if (hwdebug_info.features & PPC_DEBUG_FEATURE_DATA_BP_DAWR)
|
||||
@@ -1761,7 +1737,7 @@ ppc_linux_nat_target::region_ok_for_hw_watchpoint (CORE_ADDR addr, LONGEST len)
|
||||
ptrace interface, DAC-based processors (i.e., embedded processors) will
|
||||
use addresses aligned to 4-bytes due to the way the read/write flags are
|
||||
passed in the old ptrace interface. */
|
||||
- else if (((ppc_linux_get_hwcap () & PPC_FEATURE_BOOKE)
|
||||
+ else if (((linux_get_hwcap (current_top_target ()) & PPC_FEATURE_BOOKE)
|
||||
&& (addr + len) > (addr & ~3) + 4)
|
||||
|| (addr + len) > (addr & ~7) + 8)
|
||||
return 0;
|
||||
@@ -2303,7 +2279,7 @@ ppc_linux_nat_target::insert_watchpoint (CORE_ADDR addr, int len,
|
||||
long dabr_value;
|
||||
long read_mode, write_mode;
|
||||
|
||||
- if (ppc_linux_get_hwcap () & PPC_FEATURE_BOOKE)
|
||||
+ if (linux_get_hwcap (current_top_target ()) & PPC_FEATURE_BOOKE)
|
||||
{
|
||||
/* PowerPC 440 requires only the read/write flags to be passed
|
||||
to the kernel. */
|
||||
@@ -2506,9 +2482,9 @@ ppc_linux_nat_target::watchpoint_addr_within_range (CORE_ADDR addr,
|
||||
int mask;
|
||||
|
||||
if (have_ptrace_hwdebug_interface ()
|
||||
- && ppc_linux_get_hwcap () & PPC_FEATURE_BOOKE)
|
||||
+ && linux_get_hwcap (current_top_target ()) & PPC_FEATURE_BOOKE)
|
||||
return start <= addr && start + length >= addr;
|
||||
- else if (ppc_linux_get_hwcap () & PPC_FEATURE_BOOKE)
|
||||
+ else if (linux_get_hwcap (current_top_target ()) & PPC_FEATURE_BOOKE)
|
||||
mask = 3;
|
||||
else
|
||||
mask = 7;
|
||||
@@ -2646,8 +2622,8 @@ ppc_linux_nat_target::read_description ()
|
||||
|
||||
features.wordsize = ppc_linux_target_wordsize (tid);
|
||||
|
||||
- CORE_ADDR hwcap = ppc_linux_get_hwcap ();
|
||||
- CORE_ADDR hwcap2 = ppc_linux_get_hwcap2 ();
|
||||
+ CORE_ADDR hwcap = linux_get_hwcap (current_top_target ());
|
||||
+ CORE_ADDR hwcap2 = linux_get_hwcap2 (current_top_target ());
|
||||
|
||||
if (have_ptrace_getsetvsxregs
|
||||
&& (hwcap & PPC_FEATURE_HAS_VSX))
|
||||
diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c
|
||||
--- a/gdb/ppc-linux-tdep.c
|
||||
+++ b/gdb/ppc-linux-tdep.c
|
||||
@@ -1602,10 +1602,7 @@ ppc_linux_core_read_description (struct gdbarch *gdbarch,
|
||||
if (vsx)
|
||||
features.vsx = true;
|
||||
|
||||
- CORE_ADDR hwcap;
|
||||
-
|
||||
- if (target_auxv_search (target, AT_HWCAP, &hwcap) != 1)
|
||||
- hwcap = 0;
|
||||
+ CORE_ADDR hwcap = linux_get_hwcap (target);
|
||||
|
||||
features.isa205 = ppc_linux_has_isa205 (hwcap);
|
||||
|
||||
diff --git a/gdb/s390-linux-nat.c b/gdb/s390-linux-nat.c
|
||||
--- a/gdb/s390-linux-nat.c
|
||||
+++ b/gdb/s390-linux-nat.c
|
||||
@@ -42,6 +42,7 @@
|
||||
#include <elf.h>
|
||||
#include <algorithm>
|
||||
#include "inf-ptrace.h"
|
||||
+#include "linux-tdep.h"
|
||||
|
||||
/* Per-thread arch-specific data. */
|
||||
|
||||
@@ -1018,9 +1019,8 @@ s390_linux_nat_target::read_description ()
|
||||
that mode, report s390 architecture with 64-bit GPRs. */
|
||||
#ifdef __s390x__
|
||||
{
|
||||
- CORE_ADDR hwcap = 0;
|
||||
+ CORE_ADDR hwcap = linux_get_hwcap (current_top_target ());
|
||||
|
||||
- target_auxv_search (current_top_target (), AT_HWCAP, &hwcap);
|
||||
have_regset_tdb = (hwcap & HWCAP_S390_TE)
|
||||
&& check_regset (tid, NT_S390_TDB, s390_sizeof_tdbregset);
|
||||
|
||||
diff --git a/gdb/s390-linux-tdep.c b/gdb/s390-linux-tdep.c
|
||||
--- a/gdb/s390-linux-tdep.c
|
||||
+++ b/gdb/s390-linux-tdep.c
|
||||
@@ -332,10 +332,9 @@ s390_core_read_description (struct gdbarch *gdbarch,
|
||||
struct target_ops *target, bfd *abfd)
|
||||
{
|
||||
asection *section = bfd_get_section_by_name (abfd, ".reg");
|
||||
- CORE_ADDR hwcap = 0;
|
||||
+ CORE_ADDR hwcap = linux_get_hwcap (target);
|
||||
bool high_gprs, v1, v2, te, vx, gs;
|
||||
|
||||
- target_auxv_search (target, AT_HWCAP, &hwcap);
|
||||
if (!section)
|
||||
return NULL;
|
||||
|
@ -0,0 +1,368 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Pedro Franco de Carvalho <pedromfc@linux.ibm.com>
|
||||
Date: Wed, 7 Jul 2021 18:45:37 -0400
|
||||
Subject: gdb-rhbz1854784-powerpc-remove-region-limit-dawr-3of7.patch
|
||||
|
||||
;; Backport "[PowerPC] Move up some register access routines"
|
||||
;; (Pedro Franco de Carvalho, RH BZ 1854784)
|
||||
|
||||
Keep the routines related to register access grouped together.
|
||||
|
||||
gdb/ChangeLog:
|
||||
2020-03-30 Pedro Franco de Carvalho <pedromfc@linux.ibm.com>
|
||||
|
||||
* ppc-linux-nat.c (ppc_linux_nat_target::store_registers)
|
||||
(ppc_linux_nat_target::auxv_parse)
|
||||
(ppc_linux_nat_target::read_description)
|
||||
(supply_gregset, fill_gregset, supply_fpregset, fill_fpregset):
|
||||
Move up.
|
||||
|
||||
diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c
|
||||
--- a/gdb/ppc-linux-nat.c
|
||||
+++ b/gdb/ppc-linux-nat.c
|
||||
@@ -1561,6 +1561,170 @@ store_ppc_registers (const struct regcache *regcache, int tid)
|
||||
function to fail most of the time, so we ignore them. */
|
||||
}
|
||||
|
||||
+void
|
||||
+ppc_linux_nat_target::store_registers (struct regcache *regcache, int regno)
|
||||
+{
|
||||
+ pid_t tid = get_ptrace_pid (regcache->ptid ());
|
||||
+
|
||||
+ if (regno >= 0)
|
||||
+ store_register (regcache, tid, regno);
|
||||
+ else
|
||||
+ store_ppc_registers (regcache, tid);
|
||||
+}
|
||||
+
|
||||
+/* Functions for transferring registers between a gregset_t or fpregset_t
|
||||
+ (see sys/ucontext.h) and gdb's regcache. The word size is that used
|
||||
+ by the ptrace interface, not the current program's ABI. Eg. if a
|
||||
+ powerpc64-linux gdb is being used to debug a powerpc32-linux app, we
|
||||
+ read or write 64-bit gregsets. This is to suit the host libthread_db. */
|
||||
+
|
||||
+void
|
||||
+supply_gregset (struct regcache *regcache, const gdb_gregset_t *gregsetp)
|
||||
+{
|
||||
+ const struct regset *regset = ppc_linux_gregset (sizeof (long));
|
||||
+
|
||||
+ ppc_supply_gregset (regset, regcache, -1, gregsetp, sizeof (*gregsetp));
|
||||
+}
|
||||
+
|
||||
+void
|
||||
+fill_gregset (const struct regcache *regcache,
|
||||
+ gdb_gregset_t *gregsetp, int regno)
|
||||
+{
|
||||
+ const struct regset *regset = ppc_linux_gregset (sizeof (long));
|
||||
+
|
||||
+ if (regno == -1)
|
||||
+ memset (gregsetp, 0, sizeof (*gregsetp));
|
||||
+ ppc_collect_gregset (regset, regcache, regno, gregsetp, sizeof (*gregsetp));
|
||||
+}
|
||||
+
|
||||
+void
|
||||
+supply_fpregset (struct regcache *regcache, const gdb_fpregset_t * fpregsetp)
|
||||
+{
|
||||
+ const struct regset *regset = ppc_linux_fpregset ();
|
||||
+
|
||||
+ ppc_supply_fpregset (regset, regcache, -1,
|
||||
+ fpregsetp, sizeof (*fpregsetp));
|
||||
+}
|
||||
+
|
||||
+void
|
||||
+fill_fpregset (const struct regcache *regcache,
|
||||
+ gdb_fpregset_t *fpregsetp, int regno)
|
||||
+{
|
||||
+ const struct regset *regset = ppc_linux_fpregset ();
|
||||
+
|
||||
+ ppc_collect_fpregset (regset, regcache, regno,
|
||||
+ fpregsetp, sizeof (*fpregsetp));
|
||||
+}
|
||||
+
|
||||
+int
|
||||
+ppc_linux_nat_target::auxv_parse (gdb_byte **readptr,
|
||||
+ gdb_byte *endptr, CORE_ADDR *typep,
|
||||
+ CORE_ADDR *valp)
|
||||
+{
|
||||
+ int tid = inferior_ptid.lwp ();
|
||||
+ if (tid == 0)
|
||||
+ tid = inferior_ptid.pid ();
|
||||
+
|
||||
+ int sizeof_auxv_field = ppc_linux_target_wordsize (tid);
|
||||
+
|
||||
+ enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
|
||||
+ gdb_byte *ptr = *readptr;
|
||||
+
|
||||
+ if (endptr == ptr)
|
||||
+ return 0;
|
||||
+
|
||||
+ if (endptr - ptr < sizeof_auxv_field * 2)
|
||||
+ return -1;
|
||||
+
|
||||
+ *typep = extract_unsigned_integer (ptr, sizeof_auxv_field, byte_order);
|
||||
+ ptr += sizeof_auxv_field;
|
||||
+ *valp = extract_unsigned_integer (ptr, sizeof_auxv_field, byte_order);
|
||||
+ ptr += sizeof_auxv_field;
|
||||
+
|
||||
+ *readptr = ptr;
|
||||
+ return 1;
|
||||
+}
|
||||
+
|
||||
+const struct target_desc *
|
||||
+ppc_linux_nat_target::read_description ()
|
||||
+{
|
||||
+ int tid = inferior_ptid.lwp ();
|
||||
+ if (tid == 0)
|
||||
+ tid = inferior_ptid.pid ();
|
||||
+
|
||||
+ if (have_ptrace_getsetevrregs)
|
||||
+ {
|
||||
+ struct gdb_evrregset_t evrregset;
|
||||
+
|
||||
+ if (ptrace (PTRACE_GETEVRREGS, tid, 0, &evrregset) >= 0)
|
||||
+ return tdesc_powerpc_e500l;
|
||||
+
|
||||
+ /* EIO means that the PTRACE_GETEVRREGS request isn't supported.
|
||||
+ Anything else needs to be reported. */
|
||||
+ else if (errno != EIO)
|
||||
+ perror_with_name (_("Unable to fetch SPE registers"));
|
||||
+ }
|
||||
+
|
||||
+ struct ppc_linux_features features = ppc_linux_no_features;
|
||||
+
|
||||
+ features.wordsize = ppc_linux_target_wordsize (tid);
|
||||
+
|
||||
+ CORE_ADDR hwcap = linux_get_hwcap (current_top_target ());
|
||||
+ CORE_ADDR hwcap2 = linux_get_hwcap2 (current_top_target ());
|
||||
+
|
||||
+ if (have_ptrace_getsetvsxregs
|
||||
+ && (hwcap & PPC_FEATURE_HAS_VSX))
|
||||
+ {
|
||||
+ gdb_vsxregset_t vsxregset;
|
||||
+
|
||||
+ if (ptrace (PTRACE_GETVSXREGS, tid, 0, &vsxregset) >= 0)
|
||||
+ features.vsx = true;
|
||||
+
|
||||
+ /* EIO means that the PTRACE_GETVSXREGS request isn't supported.
|
||||
+ Anything else needs to be reported. */
|
||||
+ else if (errno != EIO)
|
||||
+ perror_with_name (_("Unable to fetch VSX registers"));
|
||||
+ }
|
||||
+
|
||||
+ if (have_ptrace_getvrregs
|
||||
+ && (hwcap & PPC_FEATURE_HAS_ALTIVEC))
|
||||
+ {
|
||||
+ gdb_vrregset_t vrregset;
|
||||
+
|
||||
+ if (ptrace (PTRACE_GETVRREGS, tid, 0, &vrregset) >= 0)
|
||||
+ features.altivec = true;
|
||||
+
|
||||
+ /* EIO means that the PTRACE_GETVRREGS request isn't supported.
|
||||
+ Anything else needs to be reported. */
|
||||
+ else if (errno != EIO)
|
||||
+ perror_with_name (_("Unable to fetch AltiVec registers"));
|
||||
+ }
|
||||
+
|
||||
+ features.isa205 = ppc_linux_has_isa205 (hwcap);
|
||||
+
|
||||
+ if ((hwcap2 & PPC_FEATURE2_DSCR)
|
||||
+ && check_regset (tid, NT_PPC_PPR, PPC_LINUX_SIZEOF_PPRREGSET)
|
||||
+ && check_regset (tid, NT_PPC_DSCR, PPC_LINUX_SIZEOF_DSCRREGSET))
|
||||
+ {
|
||||
+ features.ppr_dscr = true;
|
||||
+ if ((hwcap2 & PPC_FEATURE2_ARCH_2_07)
|
||||
+ && (hwcap2 & PPC_FEATURE2_TAR)
|
||||
+ && (hwcap2 & PPC_FEATURE2_EBB)
|
||||
+ && check_regset (tid, NT_PPC_TAR, PPC_LINUX_SIZEOF_TARREGSET)
|
||||
+ && check_regset (tid, NT_PPC_EBB, PPC_LINUX_SIZEOF_EBBREGSET)
|
||||
+ && check_regset (tid, NT_PPC_PMU, PPC_LINUX_SIZEOF_PMUREGSET))
|
||||
+ {
|
||||
+ features.isa207 = true;
|
||||
+ if ((hwcap2 & PPC_FEATURE2_HTM)
|
||||
+ && check_regset (tid, NT_PPC_TM_SPR,
|
||||
+ PPC_LINUX_SIZEOF_TM_SPRREGSET))
|
||||
+ features.htm = true;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return ppc_linux_match_description (features);
|
||||
+}
|
||||
+
|
||||
/* The cached DABR value, to install in new threads.
|
||||
This variable is used when the PowerPC HWDEBUG ptrace
|
||||
interface is not available. */
|
||||
@@ -2514,173 +2678,7 @@ ppc_linux_nat_target::masked_watch_num_registers (CORE_ADDR addr, CORE_ADDR mask
|
||||
return 2;
|
||||
}
|
||||
|
||||
-void
|
||||
-ppc_linux_nat_target::store_registers (struct regcache *regcache, int regno)
|
||||
-{
|
||||
- pid_t tid = get_ptrace_pid (regcache->ptid ());
|
||||
-
|
||||
- if (regno >= 0)
|
||||
- store_register (regcache, tid, regno);
|
||||
- else
|
||||
- store_ppc_registers (regcache, tid);
|
||||
-}
|
||||
-
|
||||
-/* Functions for transferring registers between a gregset_t or fpregset_t
|
||||
- (see sys/ucontext.h) and gdb's regcache. The word size is that used
|
||||
- by the ptrace interface, not the current program's ABI. Eg. if a
|
||||
- powerpc64-linux gdb is being used to debug a powerpc32-linux app, we
|
||||
- read or write 64-bit gregsets. This is to suit the host libthread_db. */
|
||||
-
|
||||
-void
|
||||
-supply_gregset (struct regcache *regcache, const gdb_gregset_t *gregsetp)
|
||||
-{
|
||||
- const struct regset *regset = ppc_linux_gregset (sizeof (long));
|
||||
-
|
||||
- ppc_supply_gregset (regset, regcache, -1, gregsetp, sizeof (*gregsetp));
|
||||
-}
|
||||
-
|
||||
-void
|
||||
-fill_gregset (const struct regcache *regcache,
|
||||
- gdb_gregset_t *gregsetp, int regno)
|
||||
-{
|
||||
- const struct regset *regset = ppc_linux_gregset (sizeof (long));
|
||||
-
|
||||
- if (regno == -1)
|
||||
- memset (gregsetp, 0, sizeof (*gregsetp));
|
||||
- ppc_collect_gregset (regset, regcache, regno, gregsetp, sizeof (*gregsetp));
|
||||
-}
|
||||
-
|
||||
-void
|
||||
-supply_fpregset (struct regcache *regcache, const gdb_fpregset_t * fpregsetp)
|
||||
-{
|
||||
- const struct regset *regset = ppc_linux_fpregset ();
|
||||
-
|
||||
- ppc_supply_fpregset (regset, regcache, -1,
|
||||
- fpregsetp, sizeof (*fpregsetp));
|
||||
-}
|
||||
-
|
||||
-void
|
||||
-fill_fpregset (const struct regcache *regcache,
|
||||
- gdb_fpregset_t *fpregsetp, int regno)
|
||||
-{
|
||||
- const struct regset *regset = ppc_linux_fpregset ();
|
||||
-
|
||||
- ppc_collect_fpregset (regset, regcache, regno,
|
||||
- fpregsetp, sizeof (*fpregsetp));
|
||||
-}
|
||||
-
|
||||
-int
|
||||
-ppc_linux_nat_target::auxv_parse (gdb_byte **readptr,
|
||||
- gdb_byte *endptr, CORE_ADDR *typep,
|
||||
- CORE_ADDR *valp)
|
||||
-{
|
||||
- int tid = inferior_ptid.lwp ();
|
||||
- if (tid == 0)
|
||||
- tid = inferior_ptid.pid ();
|
||||
-
|
||||
- int sizeof_auxv_field = ppc_linux_target_wordsize (tid);
|
||||
-
|
||||
- enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
|
||||
- gdb_byte *ptr = *readptr;
|
||||
-
|
||||
- if (endptr == ptr)
|
||||
- return 0;
|
||||
-
|
||||
- if (endptr - ptr < sizeof_auxv_field * 2)
|
||||
- return -1;
|
||||
-
|
||||
- *typep = extract_unsigned_integer (ptr, sizeof_auxv_field, byte_order);
|
||||
- ptr += sizeof_auxv_field;
|
||||
- *valp = extract_unsigned_integer (ptr, sizeof_auxv_field, byte_order);
|
||||
- ptr += sizeof_auxv_field;
|
||||
-
|
||||
- *readptr = ptr;
|
||||
- return 1;
|
||||
-}
|
||||
-
|
||||
-const struct target_desc *
|
||||
-ppc_linux_nat_target::read_description ()
|
||||
-{
|
||||
- int tid = inferior_ptid.lwp ();
|
||||
- if (tid == 0)
|
||||
- tid = inferior_ptid.pid ();
|
||||
-
|
||||
- if (have_ptrace_getsetevrregs)
|
||||
- {
|
||||
- struct gdb_evrregset_t evrregset;
|
||||
-
|
||||
- if (ptrace (PTRACE_GETEVRREGS, tid, 0, &evrregset) >= 0)
|
||||
- return tdesc_powerpc_e500l;
|
||||
-
|
||||
- /* EIO means that the PTRACE_GETEVRREGS request isn't supported.
|
||||
- Anything else needs to be reported. */
|
||||
- else if (errno != EIO)
|
||||
- perror_with_name (_("Unable to fetch SPE registers"));
|
||||
- }
|
||||
-
|
||||
- struct ppc_linux_features features = ppc_linux_no_features;
|
||||
-
|
||||
- features.wordsize = ppc_linux_target_wordsize (tid);
|
||||
-
|
||||
- CORE_ADDR hwcap = linux_get_hwcap (current_top_target ());
|
||||
- CORE_ADDR hwcap2 = linux_get_hwcap2 (current_top_target ());
|
||||
-
|
||||
- if (have_ptrace_getsetvsxregs
|
||||
- && (hwcap & PPC_FEATURE_HAS_VSX))
|
||||
- {
|
||||
- gdb_vsxregset_t vsxregset;
|
||||
-
|
||||
- if (ptrace (PTRACE_GETVSXREGS, tid, 0, &vsxregset) >= 0)
|
||||
- features.vsx = true;
|
||||
-
|
||||
- /* EIO means that the PTRACE_GETVSXREGS request isn't supported.
|
||||
- Anything else needs to be reported. */
|
||||
- else if (errno != EIO)
|
||||
- perror_with_name (_("Unable to fetch VSX registers"));
|
||||
- }
|
||||
-
|
||||
- if (have_ptrace_getvrregs
|
||||
- && (hwcap & PPC_FEATURE_HAS_ALTIVEC))
|
||||
- {
|
||||
- gdb_vrregset_t vrregset;
|
||||
-
|
||||
- if (ptrace (PTRACE_GETVRREGS, tid, 0, &vrregset) >= 0)
|
||||
- features.altivec = true;
|
||||
-
|
||||
- /* EIO means that the PTRACE_GETVRREGS request isn't supported.
|
||||
- Anything else needs to be reported. */
|
||||
- else if (errno != EIO)
|
||||
- perror_with_name (_("Unable to fetch AltiVec registers"));
|
||||
- }
|
||||
-
|
||||
- if (hwcap & PPC_FEATURE_CELL)
|
||||
- features.cell = true;
|
||||
-
|
||||
- features.isa205 = ppc_linux_has_isa205 (hwcap);
|
||||
-
|
||||
- if ((hwcap2 & PPC_FEATURE2_DSCR)
|
||||
- && check_regset (tid, NT_PPC_PPR, PPC_LINUX_SIZEOF_PPRREGSET)
|
||||
- && check_regset (tid, NT_PPC_DSCR, PPC_LINUX_SIZEOF_DSCRREGSET))
|
||||
- {
|
||||
- features.ppr_dscr = true;
|
||||
- if ((hwcap2 & PPC_FEATURE2_ARCH_2_07)
|
||||
- && (hwcap2 & PPC_FEATURE2_TAR)
|
||||
- && (hwcap2 & PPC_FEATURE2_EBB)
|
||||
- && check_regset (tid, NT_PPC_TAR, PPC_LINUX_SIZEOF_TARREGSET)
|
||||
- && check_regset (tid, NT_PPC_EBB, PPC_LINUX_SIZEOF_EBBREGSET)
|
||||
- && check_regset (tid, NT_PPC_PMU, PPC_LINUX_SIZEOF_PMUREGSET))
|
||||
- {
|
||||
- features.isa207 = true;
|
||||
- if ((hwcap2 & PPC_FEATURE2_HTM)
|
||||
- && check_regset (tid, NT_PPC_TM_SPR,
|
||||
- PPC_LINUX_SIZEOF_TM_SPRREGSET))
|
||||
- features.htm = true;
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- return ppc_linux_match_description (features);
|
||||
-}
|
||||
-
|
||||
+void _initialize_ppc_linux_nat ();
|
||||
void
|
||||
_initialize_ppc_linux_nat (void)
|
||||
{
|
2312
SOURCES/gdb-rhbz1854784-powerpc-remove-region-limit-dawr-4of7.patch
Normal file
2312
SOURCES/gdb-rhbz1854784-powerpc-remove-region-limit-dawr-4of7.patch
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,58 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Pedro Franco de Carvalho <pedromfc@linux.ibm.com>
|
||||
Date: Wed, 7 Jul 2021 19:03:16 -0400
|
||||
Subject: gdb-rhbz1854784-powerpc-remove-region-limit-dawr-5of7.patch
|
||||
|
||||
;; Backport "[PowerPC] Use < 0 and >= 0 for watchpoint ptrace calls"
|
||||
;; (Pedro Franco de Carvalho, RH BZ 1854784)
|
||||
|
||||
In commit 227c0bf4b3dd0cf65dceb58e729e9da81b38b5a7, which fixed some
|
||||
watchpoint bugs, I compared the return value of some ptrace calls with ==
|
||||
-1 and != -1. Althought this should be correct, since the rest of the
|
||||
file uses < 0 and >= 0, I have modified this for consistency.
|
||||
|
||||
gdb/ChangeLog:
|
||||
|
||||
* ppc-linux-nat.c (ppc_linux_dreg_interface::detect)
|
||||
(ppc_linux_nat_target::low_prepare_to_resume): Use ptrace () < 0
|
||||
and >= to check return value instead of == -1 and != -1.
|
||||
|
||||
diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c
|
||||
--- a/gdb/ppc-linux-nat.c
|
||||
+++ b/gdb/ppc-linux-nat.c
|
||||
@@ -385,7 +385,7 @@ public:
|
||||
bool no_features = false;
|
||||
|
||||
if (ptrace (PPC_PTRACE_GETHWDBGINFO, ptid.lwp (), 0, &m_hwdebug_info)
|
||||
- != -1)
|
||||
+ >= 0)
|
||||
{
|
||||
/* If there are no advertised features, we don't use the
|
||||
HWDEBUG interface and try the DEBUGREG interface instead.
|
||||
@@ -431,7 +431,7 @@ public:
|
||||
{
|
||||
unsigned long wp;
|
||||
|
||||
- if (ptrace (PTRACE_GET_DEBUGREG, ptid.lwp (), 0, &wp) != -1)
|
||||
+ if (ptrace (PTRACE_GET_DEBUGREG, ptid.lwp (), 0, &wp) >= 0)
|
||||
{
|
||||
m_interface.emplace (DEBUGREG);
|
||||
return;
|
||||
@@ -2880,7 +2880,7 @@ ppc_linux_nat_target::low_prepare_to_resume (struct lwp_info *lp)
|
||||
the debug register state when fork and clone events are
|
||||
detected. */
|
||||
if (ptrace (PPC_PTRACE_DELHWDEBUG, lp->ptid.lwp (), 0,
|
||||
- bp_it->first) == -1)
|
||||
+ bp_it->first) < 0)
|
||||
if (errno != ENOENT)
|
||||
perror_with_name (_("Error deleting hardware "
|
||||
"breakpoint or watchpoint"));
|
||||
@@ -2934,7 +2934,7 @@ ppc_linux_nat_target::low_prepare_to_resume (struct lwp_info *lp)
|
||||
long ret = ptrace (PTRACE_SET_DEBUGREG, lp->ptid.lwp (),
|
||||
0, wp);
|
||||
|
||||
- if (ret == -1)
|
||||
+ if (ret < 0)
|
||||
perror_with_name (_("Error setting hardware watchpoint"));
|
||||
}
|
||||
|
@ -0,0 +1,86 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Pedro Franco de Carvalho <pedromfc@linux.ibm.com>
|
||||
Date: Wed, 7 Jul 2021 19:05:04 -0400
|
||||
Subject: gdb-rhbz1854784-powerpc-remove-region-limit-dawr-6of7.patch
|
||||
|
||||
;; Backport "[PowerPC] Always clear watchpoint with PTRACE_SET_DEBUGREG"
|
||||
;; (Pedro Franco de Carvalho, RH BZ 1854784)
|
||||
|
||||
This patches changes low_prepare_to_resume in the ppc linux native target
|
||||
to always clear the watchpoint when the old PTRACE_SET_DEBUGREG interface
|
||||
is used, even if another watchpoint GDB requested to the target is
|
||||
written right after using the same call.
|
||||
|
||||
The reason for this is that there were some older kernel versions for
|
||||
which overwriting a watchpoint with PTRACE_SET_DEBUGREG would not
|
||||
re-activate the watchpoint if it was previouly disabled following a hit.
|
||||
This happened when the kernel was configured with CONFIG_HW_BREAKPOINT on
|
||||
and uses perf events to install watchpoints.
|
||||
|
||||
Previously, the ppc linux native target would immediately remove or
|
||||
insert watchpoints following a request from the upper layers. This was
|
||||
changed in commit 227c0bf4b3dd0cf65dceb58e729e9da81b38b5a7 to fix other
|
||||
issues, which caused watchpoint requests to be applied to the inferior
|
||||
only in low_prepare_to_resume, right before the inferior is resumed.
|
||||
|
||||
Usually, but maybe not always, after a hit, GDB will remove the
|
||||
watchpoint, resume the inferior for a single-step, possibly report the
|
||||
watchpoint hit to the user, and then re-insert the watchpoint before the
|
||||
inferior is next resumed. In this case there would be no problems, but
|
||||
since I can't guarantee that there aren't other paths in GDB that allow
|
||||
the user to set a new watchpoint after the first one hit, and after its
|
||||
deletion by GDB, but before the inferior is resumed, there is a chance
|
||||
that PTRACE_SET_DEBUGREG could be called directly without the watchpoint
|
||||
first having been cleared, which could cause a false negative with the
|
||||
older kernel versions.
|
||||
|
||||
This issue would affect kernel versions starting from this commit:
|
||||
|
||||
5aae8a53708025d4e718f0d2e7c2f766779ddc71
|
||||
|
||||
Up to the fix in this commit:
|
||||
|
||||
a53fd61ac2f411745471c1c877d5e072fbbf0e5c
|
||||
|
||||
gdb/ChangeLog:
|
||||
|
||||
PR breakpoints/26385
|
||||
* ppc-linux-nat.c (ppc_linux_nat_target::low_prepare_to_resume):
|
||||
Always clear watchpoint with PTRACE_SET_DEBUGREG.
|
||||
|
||||
diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c
|
||||
--- a/gdb/ppc-linux-nat.c
|
||||
+++ b/gdb/ppc-linux-nat.c
|
||||
@@ -2922,20 +2922,23 @@ ppc_linux_nat_target::low_prepare_to_resume (struct lwp_info *lp)
|
||||
{
|
||||
gdb_assert (m_dreg_interface.debugreg_p ());
|
||||
|
||||
- /* Passing 0 to PTRACE_SET_DEBUGREG will clear the
|
||||
- watchpoint. */
|
||||
- long wp = 0;
|
||||
+ /* Passing 0 to PTRACE_SET_DEBUGREG will clear the watchpoint. We
|
||||
+ always clear the watchpoint instead of just overwriting it, in
|
||||
+ case there is a request for a new watchpoint, because on some
|
||||
+ older kernel versions and configurations simply overwriting the
|
||||
+ watchpoint after it was hit would not re-enable it. */
|
||||
+ if (ptrace (PTRACE_SET_DEBUGREG, lp->ptid.lwp (), 0, 0) < 0)
|
||||
+ perror_with_name (_("Error clearing hardware watchpoint"));
|
||||
|
||||
/* GDB requested a watchpoint to be installed. */
|
||||
if (process_it != m_process_info.end ()
|
||||
&& process_it->second.requested_wp_val.has_value ())
|
||||
- wp = *(process_it->second.requested_wp_val);
|
||||
-
|
||||
- long ret = ptrace (PTRACE_SET_DEBUGREG, lp->ptid.lwp (),
|
||||
- 0, wp);
|
||||
+ {
|
||||
+ long wp = *(process_it->second.requested_wp_val);
|
||||
|
||||
- if (ret < 0)
|
||||
- perror_with_name (_("Error setting hardware watchpoint"));
|
||||
+ if (ptrace (PTRACE_SET_DEBUGREG, lp->ptid.lwp (), 0, wp) < 0)
|
||||
+ perror_with_name (_("Error setting hardware watchpoint"));
|
||||
+ }
|
||||
}
|
||||
|
||||
lp_arch_info->debug_regs_stale = false;
|
@ -0,0 +1,73 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Rogerio Alves <rcardoso@linux.ibm.com>
|
||||
Date: Wed, 7 Jul 2021 19:06:52 -0400
|
||||
Subject: gdb-rhbz1854784-powerpc-remove-region-limit-dawr-7of7.patch
|
||||
|
||||
;; Backport "PowerPC remove 512 bytes region limit if 2nd DAWR is available."
|
||||
;; (Rogerio Alves, RH BZ 1854784)
|
||||
|
||||
Power 10 introduces the 2nd DAWR (second watchpoint) and also removed
|
||||
a restriction that limit the watch region to 512 bytes.
|
||||
|
||||
2020-11-08 Rogerio A. Cardoso <rcardoso@linux.ibm.com>
|
||||
|
||||
/gdb
|
||||
|
||||
* ppc-linux-nat.c: (PPC_DEBUG_FEATURE_DATA_BP_ARCH_31): New define.
|
||||
(region_ok_for_hw_watchpoint): Check if 2nd DAWR is avaliable before
|
||||
set region.
|
||||
|
||||
diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c
|
||||
--- a/gdb/ppc-linux-nat.c
|
||||
+++ b/gdb/ppc-linux-nat.c
|
||||
@@ -144,6 +144,11 @@ struct ppc_hw_breakpoint
|
||||
#define PPC_DEBUG_FEATURE_DATA_BP_DAWR 0x10
|
||||
#endif /* PPC_DEBUG_FEATURE_DATA_BP_DAWR */
|
||||
|
||||
+/* Feature defined on Linux kernel v5.1: Second watchpoint support. */
|
||||
+#ifndef PPC_DEBUG_FEATURE_DATA_BP_ARCH_31
|
||||
+#define PPC_DEBUG_FEATURE_DATA_BP_ARCH_31 0x20
|
||||
+#endif /* PPC_DEBUG_FEATURE_DATA_BP_ARCH_31 */
|
||||
+
|
||||
/* The version of the PowerPC HWDEBUG kernel interface that we will use, if
|
||||
available. */
|
||||
#define PPC_DEBUG_CURRENT_VERSION 1
|
||||
@@ -2121,9 +2126,10 @@ ppc_linux_nat_target::region_ok_for_hw_watchpoint (CORE_ADDR addr, int len)
|
||||
watchpoints. */
|
||||
if (m_dreg_interface.hwdebug_p ())
|
||||
{
|
||||
- int region_size;
|
||||
const struct ppc_debug_info &hwdebug_info = (m_dreg_interface
|
||||
.hwdebug_info ());
|
||||
+ int region_size = hwdebug_info.data_bp_alignment;
|
||||
+ int region_align = region_size;
|
||||
|
||||
/* Embedded DAC-based processors, like the PowerPC 440 have ranged
|
||||
watchpoints and can watch any access within an arbitrary memory
|
||||
@@ -2135,15 +2141,19 @@ ppc_linux_nat_target::region_ok_for_hw_watchpoint (CORE_ADDR addr, int len)
|
||||
return 2;
|
||||
/* Check if the processor provides DAWR interface. */
|
||||
if (hwdebug_info.features & PPC_DEBUG_FEATURE_DATA_BP_DAWR)
|
||||
- /* DAWR interface allows to watch up to 512 byte wide ranges which
|
||||
- can't cross a 512 byte boundary. */
|
||||
- region_size = 512;
|
||||
- else
|
||||
- region_size = hwdebug_info.data_bp_alignment;
|
||||
+ {
|
||||
+ /* DAWR interface allows to watch up to 512 byte wide ranges. */
|
||||
+ region_size = 512;
|
||||
+ /* DAWR interface allows to watch up to 512 byte wide ranges which
|
||||
+ can't cross a 512 byte bondary on machines that doesn't have a
|
||||
+ second DAWR (P9 or less). */
|
||||
+ if (!(hwdebug_info.features & PPC_DEBUG_FEATURE_DATA_BP_ARCH_31))
|
||||
+ region_align = 512;
|
||||
+ }
|
||||
/* Server processors provide one hardware watchpoint and addr+len should
|
||||
fall in the watchable region provided by the ptrace interface. */
|
||||
- if (region_size
|
||||
- && (addr + len > (addr & ~(region_size - 1)) + region_size))
|
||||
+ if (region_align
|
||||
+ && (addr + len > (addr & ~(region_align - 1)) + region_size))
|
||||
return 0;
|
||||
}
|
||||
/* addr+len must fall in the 8 byte watchable region for DABR-based
|
206
SOURCES/gdb-rhbz1934673-fortran-nameless-modules.patch
Normal file
206
SOURCES/gdb-rhbz1934673-fortran-nameless-modules.patch
Normal file
@ -0,0 +1,206 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Keith Seitz <keiths@redhat.com>
|
||||
Date: Wed, 5 May 2021 13:57:13 -0700
|
||||
Subject: gdb-rhbz1934673-fortran-nameless-modules.patch
|
||||
|
||||
;; Fix segfault with nameless fortran modules.
|
||||
;; Bernhard Heckel, RH BZ 1943673
|
||||
|
||||
Dwarf: Don't add nameless modules to partial symbol table
|
||||
|
||||
A name for BLOCK DATA in Fortran is optional. If no name has been
|
||||
assigned, GDB crashes during read-in of DWARF when BLOCK DATA is
|
||||
represented via DW_TAG_module. BLOCK DATA is used for one-time
|
||||
initialization of non-pointer variables in named common blocks.
|
||||
|
||||
As of now there is no issue when gfortran is used as DW_TAG_module is
|
||||
not emitted. However, with Intel ifort the nameless DW_TAG_module is
|
||||
present and has the following form:
|
||||
|
||||
...
|
||||
<1><dd>: Abbrev Number: 7 (DW_TAG_module)
|
||||
<de> DW_AT_decl_line : 46
|
||||
<df> DW_AT_decl_file : 1
|
||||
<e0> DW_AT_description : (indirect string, offset: 0x110): block
|
||||
data
|
||||
<e4> DW_AT_high_pc : 0x402bb7
|
||||
<ec> DW_AT_low_pc : 0x402bb7
|
||||
...
|
||||
|
||||
The missing name leads to a crash in add_partial_symbol, during length
|
||||
calculation.
|
||||
|
||||
gdb/ChangeLog:
|
||||
2019-06-11 Bernhard Heckel <bernhard.heckel@intel.com>
|
||||
|
||||
* dwarf2read.c (add_partial_symbol): Skip nameless modules.
|
||||
|
||||
gdb/testsuite/Changelog:
|
||||
2019-06-11 Bernhard Heckel <bernhard.heckel@intel.com>
|
||||
|
||||
* gdb.fortran/block-data.f: New.
|
||||
* gdb.fortran/block-data.exp: New.
|
||||
|
||||
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
|
||||
--- a/gdb/dwarf2read.c
|
||||
+++ b/gdb/dwarf2read.c
|
||||
@@ -8936,11 +8936,15 @@ add_partial_symbol (struct partial_die_info *pdi, struct dwarf2_cu *cu)
|
||||
0, cu->language, objfile);
|
||||
break;
|
||||
case DW_TAG_module:
|
||||
- add_psymbol_to_list (actual_name, strlen (actual_name),
|
||||
- built_actual_name != NULL,
|
||||
- MODULE_DOMAIN, LOC_TYPEDEF,
|
||||
- &objfile->global_psymbols,
|
||||
- 0, cu->language, objfile);
|
||||
+ /* With Fortran 77 there might be a "BLOCK DATA" module
|
||||
+ available without any name. If so, we skip the module as it
|
||||
+ doesn't bring any value. */
|
||||
+ if (actual_name != nullptr)
|
||||
+ add_psymbol_to_list (actual_name, strlen (actual_name),
|
||||
+ built_actual_name != NULL,
|
||||
+ MODULE_DOMAIN, LOC_TYPEDEF,
|
||||
+ &objfile->global_psymbols,
|
||||
+ 0, cu->language, objfile);
|
||||
break;
|
||||
case DW_TAG_class_type:
|
||||
case DW_TAG_interface_type:
|
||||
@@ -16777,9 +16781,6 @@ read_module_type (struct die_info *die, struct dwarf2_cu *cu)
|
||||
struct type *type;
|
||||
|
||||
module_name = dwarf2_name (die, cu);
|
||||
- if (!module_name)
|
||||
- complaint (_("DW_TAG_module has no name, offset %s"),
|
||||
- sect_offset_str (die->sect_off));
|
||||
type = init_type (objfile, TYPE_CODE_MODULE, 0, module_name);
|
||||
|
||||
return set_die_type (die, type, cu);
|
||||
diff --git a/gdb/testsuite/gdb.fortran/block-data.exp b/gdb/testsuite/gdb.fortran/block-data.exp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.fortran/block-data.exp
|
||||
@@ -0,0 +1,63 @@
|
||||
+# Copyright 2016-2019 Free Software Foundation, Inc.
|
||||
+#
|
||||
+# This program is free software; you can redistribute it and/or modify
|
||||
+# it under the terms of the GNU General Public License as published by
|
||||
+# the Free Software Foundation; either version 3 of the License, or
|
||||
+# (at your option) any later version.
|
||||
+#
|
||||
+# This program is distributed in the hope that it will be useful,
|
||||
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+# GNU General Public License for more details.
|
||||
+#
|
||||
+# You should have received a copy of the GNU General Public License
|
||||
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
+
|
||||
+# Test anonymous block-data statements.
|
||||
+
|
||||
+# A name for BLOCK DATA in Fortran is optional. BLOCK DATA is used
|
||||
+# for one-time initialization of non-pointer variables in named common
|
||||
+# blocks. GDB used to crash with 'Intel ifort'-generated code, which
|
||||
+# outputs nameless DW_TAG_module, unlike with gfortran which just
|
||||
+# doesn't emit DW_TAG_module in this case.
|
||||
+
|
||||
+if { [skip_fortran_tests] } { return -1 }
|
||||
+
|
||||
+standard_testfile .f
|
||||
+load_lib "fortran.exp"
|
||||
+
|
||||
+if {[prepare_for_testing $testfile.exp $testfile $srcfile {debug f90}]} {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+if ![runto MAIN__] then {
|
||||
+ untested "couldn't run to breakpoint MAIN__"
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+with_test_prefix "default values" {
|
||||
+ gdb_test "print doub1" "= 1\.11\\d+"
|
||||
+ gdb_test "print doub2" "= 2\.22\\d+"
|
||||
+ gdb_test "print char1" "= 'abcdef'"
|
||||
+ gdb_test "print char2" "= 'ghijkl'"
|
||||
+}
|
||||
+
|
||||
+gdb_breakpoint [gdb_get_line_number "! BP_BEFORE_SUB"]
|
||||
+gdb_continue_to_breakpoint "! BP_BEFORE_SUB" ".*! BP_BEFORE_SUB.*"
|
||||
+
|
||||
+with_test_prefix "before sub" {
|
||||
+ gdb_test "print doub1" "= 11\.11\\d+"
|
||||
+ gdb_test "print doub2" "= 22\.22\\d+"
|
||||
+ gdb_test "print char1" "= 'ABCDEF'"
|
||||
+ gdb_test "print char2" "= 'GHIJKL'"
|
||||
+}
|
||||
+
|
||||
+gdb_breakpoint [gdb_get_line_number "! BP_SUB"]
|
||||
+gdb_continue_to_breakpoint "! BP_SUB" ".*! BP_SUB.*"
|
||||
+
|
||||
+with_test_prefix "in sub" {
|
||||
+ gdb_test "print doub1" "= 11\.11\\d+"
|
||||
+ gdb_test "print doub2" "= 22\.22\\d+"
|
||||
+ gdb_test "print char1" "= 'ABCDEF'"
|
||||
+ gdb_test "print char2" "= 'GHIJKL'"
|
||||
+}
|
||||
diff --git a/gdb/testsuite/gdb.fortran/block-data.f b/gdb/testsuite/gdb.fortran/block-data.f
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.fortran/block-data.f
|
||||
@@ -0,0 +1,56 @@
|
||||
+! Copyright 2016-2019 Free Software Foundation, Inc.
|
||||
+!
|
||||
+! This program is free software; you can redistribute it and/or modify
|
||||
+! it under the terms of the GNU General Public License as published by
|
||||
+! the Free Software Foundation; either version 3 of the License, or
|
||||
+! (at your option) any later version.
|
||||
+!
|
||||
+! This program is distributed in the hope that it will be useful,
|
||||
+! but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+! GNU General Public License for more details.
|
||||
+!
|
||||
+! You should have received a copy of the GNU General Public License
|
||||
+! along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
+!
|
||||
+! Check that GDB can handle block data with no global name.
|
||||
+!
|
||||
+! MAIN
|
||||
+ PROGRAM bdata
|
||||
+ DOUBLE PRECISION doub1, doub2
|
||||
+ CHARACTER*6 char1, char2
|
||||
+
|
||||
+ COMMON /BLK1/ doub1, char1
|
||||
+ COMMON /BLK2/ doub2, char2
|
||||
+
|
||||
+ doub1 = 11.111
|
||||
+ doub2 = 22.222
|
||||
+ char1 = 'ABCDEF'
|
||||
+ char2 = 'GHIJKL'
|
||||
+ CALL sub_block_data ! BP_BEFORE_SUB
|
||||
+ STOP
|
||||
+ END
|
||||
+
|
||||
+! BLOCK DATA
|
||||
+ BLOCK DATA
|
||||
+
|
||||
+ DOUBLE PRECISION doub1, doub2
|
||||
+ CHARACTER*6 char1, char2
|
||||
+
|
||||
+ COMMON /BLK1/ doub1, char1
|
||||
+ COMMON /BLK2/ doub2, char2
|
||||
+ DATA doub1, doub2 /1.111, 2.222/
|
||||
+ DATA char1, char2 /'abcdef', 'ghijkl'/
|
||||
+ END
|
||||
+
|
||||
+! SUBROUTINE
|
||||
+ SUBROUTINE sub_block_data
|
||||
+
|
||||
+ DOUBLE PRECISION doub1, doub2
|
||||
+ CHARACTER*6 char1, char2
|
||||
+
|
||||
+ COMMON /BLK1/ doub1, char1
|
||||
+ COMMON /BLK2/ doub2, char2
|
||||
+
|
||||
+ char1 = char2; ! BP_SUB
|
||||
+ END
|
@ -26,7 +26,7 @@ Version: 8.2
|
||||
|
||||
# The release always contains a leading reserved number, start it at 1.
|
||||
# `upstream' is not a part of `name' to stay fully rpm dependencies compatible for the testing.
|
||||
Release: 15%{?dist}
|
||||
Release: 16%{?dist}
|
||||
|
||||
License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ and GPLv2+ with exceptions and GPL+ and LGPLv2+ and LGPLv3+ and BSD and Public Domain and GFDL
|
||||
Group: Development/Debuggers
|
||||
@ -1062,6 +1062,13 @@ fi
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
* Wed Jul 14 2021 Keith Seitz <keiths@redhat.com> - 8.2-16.el8
|
||||
- Backport "Fix segfault with nameless fortran modules."
|
||||
(Bernhard Heckel, RH BZ 1934673)
|
||||
- Backport "PowerPC remove 512 bytes region limit if 2nd DAWR is available"
|
||||
and related patches.
|
||||
(Rogerio Alves et al RH BZ 1854784)
|
||||
|
||||
* Fri Dec 11 2020 Keith Seitz <keiths@redhat.com> - 8.2-15.el8
|
||||
- Backport "Correct recording of 'store on condition' insns"
|
||||
(Andreas Arnaz, RH BZ 1903374)
|
||||
|
Loading…
Reference in New Issue
Block a user