From 23364f9a0dabb1ce26e8e258f84296fce5a07bc9 Mon Sep 17 00:00:00 2001 From: Chunmei Xu Date: Sun, 30 Jan 2022 16:49:17 +0800 Subject: [PATCH] Fix ARMv8.4 for hw watchpoint and breakpoint Signed-off-by: Chunmei Xu --- ...8.4-for-hw-watchpoint-and-breakpoint.patch | 52 +++++++++++++++++++ _gdb.spec.Patch.include | 2 + _gdb.spec.patch.include | 2 + gdb.spec | 5 +- 4 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 1001-gdb-anolis-Fix-ARMv8.4-for-hw-watchpoint-and-breakpoint.patch diff --git a/1001-gdb-anolis-Fix-ARMv8.4-for-hw-watchpoint-and-breakpoint.patch b/1001-gdb-anolis-Fix-ARMv8.4-for-hw-watchpoint-and-breakpoint.patch new file mode 100644 index 0000000..aad69e6 --- /dev/null +++ b/1001-gdb-anolis-Fix-ARMv8.4-for-hw-watchpoint-and-breakpoint.patch @@ -0,0 +1,52 @@ +From add3db9182348555b80ec850b58a6f423b0e6bc5 Mon Sep 17 00:00:00 2001 +From: Andrew Pinski +Date: Thu, 21 Oct 2021 17:02:44 +0000 +Subject: [PATCH] Fix ARMv8.4 for hw watchpoint and breakpoint + +Just like my previoius patch for ARMv8.1 and v8.2 (49ecef2a7da2ee9df4), +this adds ARMv8.4 debug arch as being compatible for hw watchpoint +and breakpoints. +--- + gdb/nat/aarch64-linux-hw-point.c | 6 ++++-- + gdb/nat/aarch64-linux-hw-point.h | 1 + + 2 files changed, 5 insertions(+), 2 deletions(-) + +diff --git a/gdb/nat/aarch64-linux-hw-point.c b/gdb/nat/aarch64-linux-hw-point.c +index 7e1bb5c..69ade43 100644 +--- a/gdb/nat/aarch64-linux-hw-point.c ++++ b/gdb/nat/aarch64-linux-hw-point.c +@@ -778,7 +778,8 @@ aarch64_linux_get_debug_reg_capacity (int tid) + if (ptrace (PTRACE_GETREGSET, tid, NT_ARM_HW_WATCH, &iov) == 0 + && (AARCH64_DEBUG_ARCH (dreg_state.dbg_info) == AARCH64_DEBUG_ARCH_V8 + || AARCH64_DEBUG_ARCH (dreg_state.dbg_info) == AARCH64_DEBUG_ARCH_V8_1 +- || AARCH64_DEBUG_ARCH (dreg_state.dbg_info) == AARCH64_DEBUG_ARCH_V8_2)) ++ || AARCH64_DEBUG_ARCH (dreg_state.dbg_info) == AARCH64_DEBUG_ARCH_V8_2 ++ || AARCH64_DEBUG_ARCH (dreg_state.dbg_info) == AARCH64_DEBUG_ARCH_V8_4)) + { + aarch64_num_wp_regs = AARCH64_DEBUG_NUM_SLOTS (dreg_state.dbg_info); + if (aarch64_num_wp_regs > AARCH64_HWP_MAX_NUM) +@@ -800,7 +801,8 @@ aarch64_linux_get_debug_reg_capacity (int tid) + if (ptrace (PTRACE_GETREGSET, tid, NT_ARM_HW_BREAK, &iov) == 0 + && (AARCH64_DEBUG_ARCH (dreg_state.dbg_info) == AARCH64_DEBUG_ARCH_V8 + || AARCH64_DEBUG_ARCH (dreg_state.dbg_info) == AARCH64_DEBUG_ARCH_V8_1 +- || AARCH64_DEBUG_ARCH (dreg_state.dbg_info) == AARCH64_DEBUG_ARCH_V8_2)) ++ || AARCH64_DEBUG_ARCH (dreg_state.dbg_info) == AARCH64_DEBUG_ARCH_V8_2 ++ || AARCH64_DEBUG_ARCH (dreg_state.dbg_info) == AARCH64_DEBUG_ARCH_V8_4)) + { + aarch64_num_bp_regs = AARCH64_DEBUG_NUM_SLOTS (dreg_state.dbg_info); + if (aarch64_num_bp_regs > AARCH64_HBP_MAX_NUM) +diff --git a/gdb/nat/aarch64-linux-hw-point.h b/gdb/nat/aarch64-linux-hw-point.h +index 3458a1a..75d33c5 100644 +--- a/gdb/nat/aarch64-linux-hw-point.h ++++ b/gdb/nat/aarch64-linux-hw-point.h +@@ -72,6 +72,7 @@ + #define AARCH64_DEBUG_ARCH_V8 0x6 + #define AARCH64_DEBUG_ARCH_V8_1 0x7 + #define AARCH64_DEBUG_ARCH_V8_2 0x8 ++#define AARCH64_DEBUG_ARCH_V8_4 0x9 + + /* ptrace expects control registers to be formatted as follows: + +-- +2.27.0 + diff --git a/_gdb.spec.Patch.include b/_gdb.spec.Patch.include index 24289d3..c762541 100644 --- a/_gdb.spec.Patch.include +++ b/_gdb.spec.Patch.include @@ -415,3 +415,5 @@ Patch102: gdb-rhbz1838777-debuginfod.patch # Backport patches fixing abort when working directory is deleted. Patch103: gdb-rhbz1869484-deleted-working-directory +# Backport to fix armv8.4 hw watchpoint and breakpoint +Patch1001: 1001-gdb-anolis-Fix-ARMv8.4-for-hw-watchpoint-and-breakpoint.patch diff --git a/_gdb.spec.patch.include b/_gdb.spec.patch.include index 0557da6..d0878e1 100644 --- a/_gdb.spec.patch.include +++ b/_gdb.spec.patch.include @@ -101,3 +101,5 @@ %patch101 -p1 %patch102 -p1 %patch103 -p1 + +%patch1001 -p1 diff --git a/gdb.spec b/gdb.spec index 062473e..681be6a 100644 --- a/gdb.spec +++ b/gdb.spec @@ -1,4 +1,4 @@ -%define anolis_release .0.1 +%define anolis_release .0.2 # rpmbuild parameters: # --with testsuite: Run the testsuite (biarch if possible). Default is without. # --with buildisa: Use %%{?_isa} for BuildRequires @@ -1191,6 +1191,9 @@ fi %endif %changelog +* Sun Jan 30 2022 Chunmei Xu - 9.2-7.0.2 +- Fix ARMv8.4 for hw watchpoint and breakpoint + * Mon Dec 13 2021 Weitao Zhou - 9.2-7.0.1 - Fix gdb build with boost1660 -- Gitee