gdb/gdb-testsuite-factor-out-proc-linux_kernel_version.patch
Tom de Vries fc4d8845bb - Patches dropped (bsc#1207712):
* gdb-container-rh-pkg.patch
- Patches added (bsc#1207712):
  * gdb-testsuite-add-gdb.suse-debranding.exp.patch
- Patches added (test-case fix):
  * gdb-testsuite-fix-gdb.dwarf2-dw2-dir-file-name.exp-w.patch
- Patches added (fedora patch fixup):
  * fixup-gdb-test-dw2-aranges.patch
- Patches added (master backports):
  * gdb-testsuite-add-xfail-in-gdb.arch-i386-pkru.exp.patch
  * gdb-testsuite-add-xfail-in-gdb.python-py-record-btra.patch
  * gdb-testsuite-factor-out-proc-linux_kernel_version.patch
  * gdb-testsuite-fix-gdb.base-infoline-reloc-main-from-.patch
  * gdb-testsuite-fix-gdb.base-nested-subp-2-3-.exp-with.patch
  * gdb-testsuite-fix-gdb.threads-schedlock.exp-on-fast-.patch
  * gdb-testsuite-handle-missing-.note.gnu-stack.patch
  * gdb-testsuite-simplify-gdb.arch-amd64-disp-step-avx..patch
  * gdb-testsuite-fix-gdb.threads-schedlock.exp-for-gcc-.patch
  * gdb-testsuite-add-xfail-case-in-gdb.python-py-record.patch
  * add-elfcompress_zstd.patch
  * binutils-gdb-support-zstd-compressed-debug-section.patch
  * fix-gdb-build-elf-support-check-lzstd.patch
- Patches removed (dropped by fedora):
  * gdb-test-ivy-bridge.patch
- Disable "BuildRequires: %{gcc}-fortran" for SLE-11.
- Maintenance script qa-local.sh:
  * Add SLE-11 to configs.
  * Build with --no-verify.
- Maintenance script qa.sh:
  * Add -sle11.

OBS-URL: https://build.opensuse.org/package/show/devel:gcc/gdb?expand=0&rev=347
2023-03-01 11:32:26 +00:00

82 lines
2.4 KiB
Diff

From bbf4e4ba2a9bd73384268b0160d54e36edc92a12 Mon Sep 17 00:00:00 2001
From: Tom de Vries <tdevries@suse.de>
Date: Tue, 14 Feb 2023 11:53:54 +0100
Subject: [PATCH 03/11] [gdb/testsuite] Factor out proc linux_kernel_version
Factor out new proc linux_kernel_version from test-case
gdb.arch/i386-pkru.exp.
Tested on x86_64-linux.
---
gdb/testsuite/gdb.arch/i386-pkru.exp | 20 ++++++--------------
gdb/testsuite/lib/gdb.exp | 23 +++++++++++++++++++++++
2 files changed, 29 insertions(+), 14 deletions(-)
diff --git a/gdb/testsuite/gdb.arch/i386-pkru.exp b/gdb/testsuite/gdb.arch/i386-pkru.exp
index 5fe93db9b4b..9bc9f9735e5 100644
--- a/gdb/testsuite/gdb.arch/i386-pkru.exp
+++ b/gdb/testsuite/gdb.arch/i386-pkru.exp
@@ -62,20 +62,12 @@ if { !$supports_pkru } {
# the PKRU using ptrace, see commit 4a804c4f8356 ("x86/fpu: Allow PKRU to be
# (once again) written by ptrace.").
set have_xfail 0
-if { [istarget *-*-linux*] } {
- set res [remote_exec target "uname -r"]
- set status [lindex $res 0]
- set output [lindex $res 1]
-
- set re ^($decimal)\\.($decimal)\\.($decimal)
- if { $status == 0
- && [regexp $re $output dummy v1 v2 v3] == 1 } {
- set v [list $v1 $v2 $v3]
- set have_xfail \
- [expr \
- [version_compare [list 5 14 0] <= $v] \
- && [version_compare $v < [list 6 2 0]]]
- }
+set v [linux_kernel_version]
+if { $v != {} } {
+ set have_xfail \
+ [expr \
+ [version_compare [list 5 14 0] <= $v] \
+ && [version_compare $v < [list 6 2 0]]]
}
# Test pkru register at startup
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 5104835a2a9..069a61038e6 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -8551,5 +8551,28 @@ gdb_caching_proc has_hw_wp_support {
return $has_hw_wp_support
}
+# Detect linux kernel version and return as list of 3 numbers: major, minor,
+# and patchlevel. On failure, return an empty list.
+
+gdb_caching_proc linux_kernel_version {
+ if { ![istarget *-*-linux*] } {
+ return {}
+ }
+
+ set res [remote_exec target "uname -r"]
+ set status [lindex $res 0]
+ set output [lindex $res 1]
+ if { $status != 0 } {
+ return {}
+ }
+
+ set re ^($::decimal)\\.($::decimal)\\.($::decimal)
+ if { [regexp $re $output dummy v1 v2 v3] != 1 } {
+ return {}
+ }
+
+ return [list $v1 $v2 $v3]
+}
+
# Always load compatibility stuff.
load_lib future.exp
--
2.35.3