diff --git a/README.qa b/README.qa new file mode 100644 index 0000000..293a973 --- /dev/null +++ b/README.qa @@ -0,0 +1,117 @@ +I. LOCAL QA. + + +0. Notes. + +Note that the configs are hardcoded in the script. F.i. atm SLE-11 is not +included, because the config is unresolvable on devel:gcc/gdb. Also Leap +15.2 is not included because of 'remote error: unknown repository type +UNDEFINED"'. + +The script tries to keep disk usage low by removing the buildroot after each +build, but that requires sudo rights, so the first thing the script does is +ask for sudo authentication. + + +1. Cleanup. + +Do: +... +$ bash qa-local.sh 1 +... + + +2. Build. + +Do: +... +$ bash qa-local.sh 2 +... + +This builds gdb for each x86_64 config, without running the testsuite. + +I did a timing run on my laptop (with 6 configs) and got: +... +real 66m17.689s +user 149m31.925s +sys 12m25.359s +... +so for a dual-core/4-SMT CPU, it's ~1h5m. + + +3. Build & test. + +Do: +... +$ bash qa-local.sh 3 +... + +This builds gdb and produces test results for each x86_64 config. + +I did a timing run on my laptop (with 6 configs) and got: +... +real 285m9.679s +user 683m16.769s +sys 133m58.287s +... +so for a dual-core/4-SMT CPU, it's ~4h45m. + +The resulting testlogs (with 6 configs) is 1.4GB. + + +4. Verify. + +Do: +... +$ bash qa-local.sh 4 +... + +This verifies the test results for each x86_64 config, using the qa.sh script. + + +5. Cleanup. + +Do: +... +$ rm -Rf tmp-qa-local +... +l + + +I. REMOTE QA. + + +1. Cleanup. + +Do: +... +$ bash qa-remote.sh 1 +... + + +2. Get test results. + +Do: +... +$ bash qa-remote.sh 2 +... + +This downloads the remote test results. + + +3. Verify. + +Do: +... +$ bash qa-remote.sh 3 +... +with m running from 1 to 5. + +This verifies the test results, using the qa.sh script. + +4. Cleanup. + +Do: +... +$ rm -Rf tmp-qa-remote +... diff --git a/aarch64-make-gdbserver-register-set-selection-dynamic.patch b/aarch64-make-gdbserver-register-set-selection-dynamic.patch deleted file mode 100644 index adb2528..0000000 --- a/aarch64-make-gdbserver-register-set-selection-dynamic.patch +++ /dev/null @@ -1,314 +0,0 @@ -[AArch64] Make gdbserver register set selection dynamic - -The current register set selection mechanism for AArch64 is static, based -on a pre-populated array of register sets. - -This means that we might potentially probe register sets that are not -available. This is OK if the kernel errors out during ptrace, but probing the -tag_ctl register, for example, does not result in a ptrace error if the kernel -supports the tagged address ABI but not MTE (PR 28355). - -Making the register set selection dynamic, based on feature checks, solves -this and simplifies the code a bit. It allows us to list all of the register -sets only once, and pick and choose based on HWCAP/HWCAP2 or other properties. - -gdb/ChangeLog: - -2021-11-03 Luis Machado - - PR gdb/28355 - - * arch/aarch64.h (struct aarch64_features): New struct. - -gdbserver/ChangeLog: - -2021-11-03 Luis Machado - - PR gdb/28355 - - * linux-aarch64-low.cc (is_sve_tdesc): Remove. - (aarch64_target::low_arch_setup): Rework to adjust the register sets. - (aarch64_regsets): Update to list all register sets. - (aarch64_regsets_info, regs_info_aarch64): Replace NULL with nullptr. - (aarch64_sve_regsets, aarch64_sve_regsets_info) - (regs_info_aarch64_sve): Remove. - (aarch64_adjust_register_sets): New. - (aarch64_target::get_regs_info): Remove references to removed structs. - (initialize_low_arch): Likewise. - ---- - gdb/ChangeLog | 6 ++ - gdb/arch/aarch64.h | 9 ++ - gdbserver/ChangeLog | 14 ++++ - gdbserver/linux-aarch64-low.cc | 186 ++++++++++++++++++++++------------------- - 4 files changed, 130 insertions(+), 85 deletions(-) - -diff --git a/gdb/arch/aarch64.h b/gdb/arch/aarch64.h -index 0eb702c5b5e..95edb664b55 100644 ---- a/gdb/arch/aarch64.h -+++ b/gdb/arch/aarch64.h -@@ -22,6 +22,15 @@ - - #include "gdbsupport/tdesc.h" - -+/* Holds information on what architectural features are available. This is -+ used to select register sets. */ -+struct aarch64_features -+{ -+ bool sve = false; -+ bool pauth = false; -+ bool mte = false; -+}; -+ - /* Create the aarch64 target description. A non zero VQ value indicates both - the presence of SVE and the Vector Quotient - the number of 128bit chunks in - an SVE Z register. HAS_PAUTH_P indicates the presence of the PAUTH -diff --git a/gdbserver/linux-aarch64-low.cc b/gdbserver/linux-aarch64-low.cc -index daccfef746e..9a8cb4169a7 100644 ---- a/gdbserver/linux-aarch64-low.cc -+++ b/gdbserver/linux-aarch64-low.cc -@@ -196,16 +196,6 @@ is_64bit_tdesc (void) - return register_size (regcache->tdesc, 0) == 8; - } - --/* Return true if the regcache contains the number of SVE registers. */ -- --static bool --is_sve_tdesc (void) --{ -- struct regcache *regcache = get_thread_regcache (current_thread, 0); -- -- return tdesc_contains_feature (regcache->tdesc, "org.gnu.gdb.aarch64.sve"); --} -- - static void - aarch64_fill_gregset (struct regcache *regcache, void *buf) - { -@@ -680,40 +670,6 @@ aarch64_target::low_new_fork (process_info *parent, - *child->priv->arch_private = *parent->priv->arch_private; - } - --/* Matches HWCAP_PACA in kernel header arch/arm64/include/uapi/asm/hwcap.h. */ --#define AARCH64_HWCAP_PACA (1 << 30) -- --/* Implementation of linux target ops method "low_arch_setup". */ -- --void --aarch64_target::low_arch_setup () --{ -- unsigned int machine; -- int is_elf64; -- int tid; -- -- tid = lwpid_of (current_thread); -- -- is_elf64 = linux_pid_exe_is_elf_64_file (tid, &machine); -- -- if (is_elf64) -- { -- uint64_t vq = aarch64_sve_get_vq (tid); -- unsigned long hwcap = linux_get_hwcap (8); -- unsigned long hwcap2 = linux_get_hwcap2 (8); -- bool pauth_p = hwcap & AARCH64_HWCAP_PACA; -- /* MTE is AArch64-only. */ -- bool mte_p = hwcap2 & HWCAP2_MTE; -- -- current_process ()->tdesc -- = aarch64_linux_read_description (vq, pauth_p, mte_p); -- } -- else -- current_process ()->tdesc = aarch32_linux_read_description (); -- -- aarch64_linux_get_debug_reg_capacity (lwpid_of (current_thread)); --} -- - /* Wrapper for aarch64_sve_regs_copy_to_reg_buf. */ - - static void -@@ -730,21 +686,36 @@ aarch64_sve_regs_copy_from_regcache (struct regcache *regcache, void *buf) - return aarch64_sve_regs_copy_from_reg_buf (regcache, buf); - } - -+/* Array containing all the possible register sets for AArch64/Linux. During -+ architecture setup, these will be checked against the HWCAP/HWCAP2 bits for -+ validity and enabled/disabled accordingly. -+ -+ Their sizes are set to 0 here, but they will be adjusted later depending -+ on whether each register set is available or not. */ - static struct regset_info aarch64_regsets[] = - { -+ /* GPR registers. */ - { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_PRSTATUS, -- sizeof (struct user_pt_regs), GENERAL_REGS, -+ 0, GENERAL_REGS, - aarch64_fill_gregset, aarch64_store_gregset }, -+ /* Floating Point (FPU) registers. */ - { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_FPREGSET, -- sizeof (struct user_fpsimd_state), FP_REGS, -+ 0, FP_REGS, - aarch64_fill_fpregset, aarch64_store_fpregset - }, -+ /* Scalable Vector Extension (SVE) registers. */ -+ { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_ARM_SVE, -+ 0, EXTENDED_REGS, -+ aarch64_sve_regs_copy_from_regcache, aarch64_sve_regs_copy_to_regcache -+ }, -+ /* PAC registers. */ - { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_ARM_PAC_MASK, -- AARCH64_PAUTH_REGS_SIZE, OPTIONAL_REGS, -- NULL, aarch64_store_pauthregset }, -+ 0, OPTIONAL_REGS, -+ nullptr, aarch64_store_pauthregset }, -+ /* Tagged address control / MTE registers. */ - { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_ARM_TAGGED_ADDR_CTRL, -- AARCH64_LINUX_SIZEOF_MTE, OPTIONAL_REGS, aarch64_fill_mteregset, -- aarch64_store_mteregset }, -+ 0, OPTIONAL_REGS, -+ aarch64_fill_mteregset, aarch64_store_mteregset }, - NULL_REGSET - }; - -@@ -752,47 +723,95 @@ static struct regsets_info aarch64_regsets_info = - { - aarch64_regsets, /* regsets */ - 0, /* num_regsets */ -- NULL, /* disabled_regsets */ -+ nullptr, /* disabled_regsets */ - }; - - static struct regs_info regs_info_aarch64 = - { -- NULL, /* regset_bitmap */ -- NULL, /* usrregs */ -+ nullptr, /* regset_bitmap */ -+ nullptr, /* usrregs */ - &aarch64_regsets_info, - }; - --static struct regset_info aarch64_sve_regsets[] = -+/* Given FEATURES, adjust the available register sets by setting their -+ sizes. A size of 0 means the register set is disabled and won't be -+ used. */ -+ -+static void -+aarch64_adjust_register_sets (const struct aarch64_features &features) - { -- { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_PRSTATUS, -- sizeof (struct user_pt_regs), GENERAL_REGS, -- aarch64_fill_gregset, aarch64_store_gregset }, -- { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_ARM_SVE, -- SVE_PT_SIZE (AARCH64_MAX_SVE_VQ, SVE_PT_REGS_SVE), EXTENDED_REGS, -- aarch64_sve_regs_copy_from_regcache, aarch64_sve_regs_copy_to_regcache -- }, -- { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_ARM_PAC_MASK, -- AARCH64_PAUTH_REGS_SIZE, OPTIONAL_REGS, -- NULL, aarch64_store_pauthregset }, -- { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_ARM_TAGGED_ADDR_CTRL, -- AARCH64_LINUX_SIZEOF_MTE, OPTIONAL_REGS, aarch64_fill_mteregset, -- aarch64_store_mteregset }, -- NULL_REGSET --}; -+ struct regset_info *regset; - --static struct regsets_info aarch64_sve_regsets_info = -- { -- aarch64_sve_regsets, /* regsets. */ -- 0, /* num_regsets. */ -- NULL, /* disabled_regsets. */ -- }; -+ for (regset = aarch64_regsets; regset->size >= 0; regset++) -+ { -+ switch (regset->nt_type) -+ { -+ case NT_PRSTATUS: -+ /* General purpose registers are always present. */ -+ regset->size = sizeof (struct user_pt_regs); -+ break; -+ case NT_FPREGSET: -+ /* This is unavailable when SVE is present. */ -+ if (!features.sve) -+ regset->size = sizeof (struct user_fpsimd_state); -+ break; -+ case NT_ARM_SVE: -+ if (features.sve) -+ regset->size = SVE_PT_SIZE (AARCH64_MAX_SVE_VQ, SVE_PT_REGS_SVE); -+ break; -+ case NT_ARM_PAC_MASK: -+ if (features.pauth) -+ regset->size = AARCH64_PAUTH_REGS_SIZE; -+ break; -+ case NT_ARM_TAGGED_ADDR_CTRL: -+ if (features.mte) -+ regset->size = AARCH64_LINUX_SIZEOF_MTE; -+ break; -+ default: -+ gdb_assert_not_reached ("Unknown register set found."); -+ } -+ } -+} - --static struct regs_info regs_info_aarch64_sve = -- { -- NULL, /* regset_bitmap. */ -- NULL, /* usrregs. */ -- &aarch64_sve_regsets_info, -- }; -+/* Matches HWCAP_PACA in kernel header arch/arm64/include/uapi/asm/hwcap.h. */ -+#define AARCH64_HWCAP_PACA (1 << 30) -+ -+/* Implementation of linux target ops method "low_arch_setup". */ -+ -+void -+aarch64_target::low_arch_setup () -+{ -+ unsigned int machine; -+ int is_elf64; -+ int tid; -+ -+ tid = lwpid_of (current_thread); -+ -+ is_elf64 = linux_pid_exe_is_elf_64_file (tid, &machine); -+ -+ if (is_elf64) -+ { -+ struct aarch64_features features; -+ -+ uint64_t vq = aarch64_sve_get_vq (tid); -+ features.sve = (vq > 0); -+ /* A-profile PAC is 64-bit only. */ -+ features.pauth = linux_get_hwcap (8) & AARCH64_HWCAP_PACA; -+ /* A-profile MTE is 64-bit only. */ -+ features.mte = linux_get_hwcap2 (8) & HWCAP2_MTE; -+ -+ current_process ()->tdesc -+ = aarch64_linux_read_description (vq, features.pauth, features.mte); -+ -+ /* Adjust the register sets we should use for this particular set of -+ features. */ -+ aarch64_adjust_register_sets (features); -+ } -+ else -+ current_process ()->tdesc = aarch32_linux_read_description (); -+ -+ aarch64_linux_get_debug_reg_capacity (lwpid_of (current_thread)); -+} - - /* Implementation of linux target ops method "get_regs_info". */ - -@@ -802,9 +821,7 @@ aarch64_target::get_regs_info () - if (!is_64bit_tdesc ()) - return ®s_info_aarch32; - -- if (is_sve_tdesc ()) -- return ®s_info_aarch64_sve; -- -+ /* AArch64 64-bit registers. */ - return ®s_info_aarch64; - } - -@@ -3294,5 +3311,4 @@ initialize_low_arch (void) - initialize_low_arch_aarch32 (); - - initialize_regsets_info (&aarch64_regsets_info); -- initialize_regsets_info (&aarch64_sve_regsets_info); - } diff --git a/fix-build-with-current-gcc-el_explicit-location-always-non-null.patch b/fix-build-with-current-gcc-el_explicit-location-always-non-null.patch deleted file mode 100644 index 362c7f5..0000000 --- a/fix-build-with-current-gcc-el_explicit-location-always-non-null.patch +++ /dev/null @@ -1,49 +0,0 @@ -Fix build with current GCC: EL_EXPLICIT(location) always non-NULL - -Compiling GDB with current GCC (1b4a63593b) runs into this: - - src/gdb/location.c: In function 'int event_location_empty_p(const event_location*)': - src/gdb/location.c:963:38: error: the address of 'event_location::::explicit_loc' will never be NULL [-Werror=address] - 963 | return (EL_EXPLICIT (location) == NULL - | ^ - src/gdb/location.c:57:30: note: 'event_location::::explicit_loc' declared here - 57 | struct explicit_location explicit_loc; - | ^~~~~~~~~~~~ - -GCC is right, EL_EXPLICIT is defined as returning the address of an -union field: - - /* An explicit location. */ - struct explicit_location explicit_loc; - #define EL_EXPLICIT(P) (&((P)->u.explicit_loc)) - -and thus must always be non-NULL. - -Change-Id: Ie74fee7834495a93affcefce03c06e4d83ad8191 - ---- - gdb/location.c | 11 +++++------ - 1 file changed, 5 insertions(+), 6 deletions(-) - -diff --git a/gdb/location.c b/gdb/location.c -index 827294e106a..1ee20069313 100644 ---- a/gdb/location.c -+++ b/gdb/location.c -@@ -960,12 +960,11 @@ event_location_empty_p (const struct event_location *location) - return 0; - - case EXPLICIT_LOCATION: -- return (EL_EXPLICIT (location) == NULL -- || (EL_EXPLICIT (location)->source_filename == NULL -- && EL_EXPLICIT (location)->function_name == NULL -- && EL_EXPLICIT (location)->label_name == NULL -- && (EL_EXPLICIT (location)->line_offset.sign -- == LINE_OFFSET_UNKNOWN))); -+ return (EL_EXPLICIT (location)->source_filename == NULL -+ && EL_EXPLICIT (location)->function_name == NULL -+ && EL_EXPLICIT (location)->label_name == NULL -+ && (EL_EXPLICIT (location)->line_offset.sign -+ == LINE_OFFSET_UNKNOWN)); - - case PROBE_LOCATION: - return EL_PROBE (location) == NULL; diff --git a/fix-comparison-of-unsigned-long-int-to-int-in-record_linux_system_call.patch b/fix-comparison-of-unsigned-long-int-to-int-in-record_linux_system_call.patch new file mode 100644 index 0000000..1136477 --- /dev/null +++ b/fix-comparison-of-unsigned-long-int-to-int-in-record_linux_system_call.patch @@ -0,0 +1,270 @@ +Fix comparison of unsigned long int to int in record_linux_system_call. + +The if statement in case gdb_sys_ioctl in function +record_linux_system_call in file gdb/linux-record.c is as follows: + + if (tmpulongest == tdep->ioctl_FIOCLEX + || tmpulongest == tdep->ioctl_FIONCLEX + .... + || tmpulongest == tdep->ioctl_TCSETSW + ... + } + +The PowerPC ioctl value for ioctl_TCSETW is 0x802c7415. The variable +ioctl_TCSETW is defined in gdb/linux-record.h as an int. The TCSETW value +has the MSB set to one so it is a negative integer. The comparison of the +unsigned long value tmpulongest to a negative integer value for +ioctl_TCSETSW fails. + +This patch changes the declarations for the ioctl_* values in struct +linux_record_tdep to unsigned long to fix the comparisons between +tmpulongest and the tdep->ioctl_* values. + +An additional test gdb.reverse/test_ioctl_TCSETSW.exp is added to verify +the gdb record_linux_system_call() if statement for the ioctl TCSETSW +succeeds. + +This patch has been tested on Power 10 and Intel with no test failures. + +--- + gdb/linux-record.h | 130 +++++++++++------------ + gdb/testsuite/gdb.reverse/test_ioctl_TCSETSW.c | 38 +++++++ + gdb/testsuite/gdb.reverse/test_ioctl_TCSETSW.exp | 45 ++++++++ + 3 files changed, 148 insertions(+), 65 deletions(-) + +diff --git a/gdb/linux-record.h b/gdb/linux-record.h +index 219c67f888d..39d7d4b54d0 100644 +--- a/gdb/linux-record.h ++++ b/gdb/linux-record.h +@@ -92,71 +92,71 @@ struct linux_record_tdep + int size_time_t; + + /* The values of the second argument of system call "sys_ioctl". */ +- int ioctl_TCGETS; +- int ioctl_TCSETS; +- int ioctl_TCSETSW; +- int ioctl_TCSETSF; +- int ioctl_TCGETA; +- int ioctl_TCSETA; +- int ioctl_TCSETAW; +- int ioctl_TCSETAF; +- int ioctl_TCSBRK; +- int ioctl_TCXONC; +- int ioctl_TCFLSH; +- int ioctl_TIOCEXCL; +- int ioctl_TIOCNXCL; +- int ioctl_TIOCSCTTY; +- int ioctl_TIOCGPGRP; +- int ioctl_TIOCSPGRP; +- int ioctl_TIOCOUTQ; +- int ioctl_TIOCSTI; +- int ioctl_TIOCGWINSZ; +- int ioctl_TIOCSWINSZ; +- int ioctl_TIOCMGET; +- int ioctl_TIOCMBIS; +- int ioctl_TIOCMBIC; +- int ioctl_TIOCMSET; +- int ioctl_TIOCGSOFTCAR; +- int ioctl_TIOCSSOFTCAR; +- int ioctl_FIONREAD; +- int ioctl_TIOCINQ; +- int ioctl_TIOCLINUX; +- int ioctl_TIOCCONS; +- int ioctl_TIOCGSERIAL; +- int ioctl_TIOCSSERIAL; +- int ioctl_TIOCPKT; +- int ioctl_FIONBIO; +- int ioctl_TIOCNOTTY; +- int ioctl_TIOCSETD; +- int ioctl_TIOCGETD; +- int ioctl_TCSBRKP; +- int ioctl_TIOCTTYGSTRUCT; +- int ioctl_TIOCSBRK; +- int ioctl_TIOCCBRK; +- int ioctl_TIOCGSID; +- int ioctl_TCGETS2; +- int ioctl_TCSETS2; +- int ioctl_TCSETSW2; +- int ioctl_TCSETSF2; +- int ioctl_TIOCGPTN; +- int ioctl_TIOCSPTLCK; +- int ioctl_FIONCLEX; +- int ioctl_FIOCLEX; +- int ioctl_FIOASYNC; +- int ioctl_TIOCSERCONFIG; +- int ioctl_TIOCSERGWILD; +- int ioctl_TIOCSERSWILD; +- int ioctl_TIOCGLCKTRMIOS; +- int ioctl_TIOCSLCKTRMIOS; +- int ioctl_TIOCSERGSTRUCT; +- int ioctl_TIOCSERGETLSR; +- int ioctl_TIOCSERGETMULTI; +- int ioctl_TIOCSERSETMULTI; +- int ioctl_TIOCMIWAIT; +- int ioctl_TIOCGICOUNT; +- int ioctl_TIOCGHAYESESP; +- int ioctl_TIOCSHAYESESP; +- int ioctl_FIOQSIZE; ++ ULONGEST ioctl_TCGETS; ++ ULONGEST ioctl_TCSETS; ++ ULONGEST ioctl_TCSETSW; ++ ULONGEST ioctl_TCSETSF; ++ ULONGEST ioctl_TCGETA; ++ ULONGEST ioctl_TCSETA; ++ ULONGEST ioctl_TCSETAW; ++ ULONGEST ioctl_TCSETAF; ++ ULONGEST ioctl_TCSBRK; ++ ULONGEST ioctl_TCXONC; ++ ULONGEST ioctl_TCFLSH; ++ ULONGEST ioctl_TIOCEXCL; ++ ULONGEST ioctl_TIOCNXCL; ++ ULONGEST ioctl_TIOCSCTTY; ++ ULONGEST ioctl_TIOCGPGRP; ++ ULONGEST ioctl_TIOCSPGRP; ++ ULONGEST ioctl_TIOCOUTQ; ++ ULONGEST ioctl_TIOCSTI; ++ ULONGEST ioctl_TIOCGWINSZ; ++ ULONGEST ioctl_TIOCSWINSZ; ++ ULONGEST ioctl_TIOCMGET; ++ ULONGEST ioctl_TIOCMBIS; ++ ULONGEST ioctl_TIOCMBIC; ++ ULONGEST ioctl_TIOCMSET; ++ ULONGEST ioctl_TIOCGSOFTCAR; ++ ULONGEST ioctl_TIOCSSOFTCAR; ++ ULONGEST ioctl_FIONREAD; ++ ULONGEST ioctl_TIOCINQ; ++ ULONGEST ioctl_TIOCLINUX; ++ ULONGEST ioctl_TIOCCONS; ++ ULONGEST ioctl_TIOCGSERIAL; ++ ULONGEST ioctl_TIOCSSERIAL; ++ ULONGEST ioctl_TIOCPKT; ++ ULONGEST ioctl_FIONBIO; ++ ULONGEST ioctl_TIOCNOTTY; ++ ULONGEST ioctl_TIOCSETD; ++ ULONGEST ioctl_TIOCGETD; ++ ULONGEST ioctl_TCSBRKP; ++ ULONGEST ioctl_TIOCTTYGSTRUCT; ++ ULONGEST ioctl_TIOCSBRK; ++ ULONGEST ioctl_TIOCCBRK; ++ ULONGEST ioctl_TIOCGSID; ++ ULONGEST ioctl_TCGETS2; ++ ULONGEST ioctl_TCSETS2; ++ ULONGEST ioctl_TCSETSW2; ++ ULONGEST ioctl_TCSETSF2; ++ ULONGEST ioctl_TIOCGPTN; ++ ULONGEST ioctl_TIOCSPTLCK; ++ ULONGEST ioctl_FIONCLEX; ++ ULONGEST ioctl_FIOCLEX; ++ ULONGEST ioctl_FIOASYNC; ++ ULONGEST ioctl_TIOCSERCONFIG; ++ ULONGEST ioctl_TIOCSERGWILD; ++ ULONGEST ioctl_TIOCSERSWILD; ++ ULONGEST ioctl_TIOCGLCKTRMIOS; ++ ULONGEST ioctl_TIOCSLCKTRMIOS; ++ ULONGEST ioctl_TIOCSERGSTRUCT; ++ ULONGEST ioctl_TIOCSERGETLSR; ++ ULONGEST ioctl_TIOCSERGETMULTI; ++ ULONGEST ioctl_TIOCSERSETMULTI; ++ ULONGEST ioctl_TIOCMIWAIT; ++ ULONGEST ioctl_TIOCGICOUNT; ++ ULONGEST ioctl_TIOCGHAYESESP; ++ ULONGEST ioctl_TIOCSHAYESESP; ++ ULONGEST ioctl_FIOQSIZE; + + /* The values of the second argument of system call "sys_fcntl" + and "sys_fcntl64". */ +diff --git a/gdb/testsuite/gdb.reverse/test_ioctl_TCSETSW.c b/gdb/testsuite/gdb.reverse/test_ioctl_TCSETSW.c +new file mode 100644 +index 00000000000..6365f968b30 +--- /dev/null ++++ b/gdb/testsuite/gdb.reverse/test_ioctl_TCSETSW.c +@@ -0,0 +1,38 @@ ++/* This testcase is part of GDB, the GNU debugger. ++ ++ Copyright 2012-2022 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 . */ ++ ++#include ++#include ++#include ++ ++/* The purpose of this test is to verify gdb record_linux_system_call() ++ recognizes the call for ioctl TCSETSW. */ ++ ++int ++main(void) ++{ ++ ++ struct termios term; ++ int result; ++ int fd = 0; ++ ++ /* The test just needs to generate an ioctl call for TCSETSW to see if gdb ++ record detected it or not. Success or failure of the ioctl call is ++ irrelevant. */ ++ result = tcsetattr(fd, TCSADRAIN, &term); /* TCSETSW call */ ++ result = 0; /* TCSETSW called */ ++} +diff --git a/gdb/testsuite/gdb.reverse/test_ioctl_TCSETSW.exp b/gdb/testsuite/gdb.reverse/test_ioctl_TCSETSW.exp +new file mode 100644 +index 00000000000..86a62ebe5e5 +--- /dev/null ++++ b/gdb/testsuite/gdb.reverse/test_ioctl_TCSETSW.exp +@@ -0,0 +1,45 @@ ++# Copyright 2008-2022 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 . ++# ++# Test ioctl TCSETSW record for PowerPC. ++# ++ ++standard_testfile .c ++ ++if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } { ++ return -1 ++} ++ ++if ![runto_main] then { ++ untested "could not run to main" ++ continue ++} ++ ++# Recording of ioctls calls requires record full ++gdb_test_no_output "record full" ++ ++set stop [gdb_get_line_number "TCSETSW call"] ++gdb_test "break $stop" ".*Breakpoint .*" "stop at TCSETSW" ++gdb_test "continue" ".*Breakpoint .*" "at TCSETSW call" ++ ++set test "handle TCSETSW" ++gdb_test_multiple "step" $test { ++ -re "Process record and replay target doesn't support ioctl request 0x.*$gdb_prompt $" { ++ fail $test ++ } ++ -re ".*result = 0.*$gdb_prompt $" { ++ pass $test ++ } ++} diff --git a/fix-core-file-detach-crash-corefiles-29275.patch b/fix-core-file-detach-crash-corefiles-29275.patch new file mode 100644 index 0000000..496a6a2 --- /dev/null +++ b/fix-core-file-detach-crash-corefiles-29275.patch @@ -0,0 +1,161 @@ +Fix core-file -> detach -> crash (corefiles/29275) + +After loading a core file, you're supposed to be able to use "detach" +to unload the core file. That unfortunately regressed starting with +GDB 11, with these commits: + + 1192f124a308 - gdb: generalize commit_resume, avoid commit-resuming when threads have pending statuses + 408f66864a1a - detach in all-stop with threads running + +resulting in a GDB crash: + + ... + Thread 1 "gdb" received signal SIGSEGV, Segmentation fault. + 0x0000555555e842bf in maybe_set_commit_resumed_all_targets () at ../../src/gdb/infrun.c:2899 + 2899 if (proc_target->commit_resumed_state) + (top-gdb) bt + #0 0x0000555555e842bf in maybe_set_commit_resumed_all_targets () at ../../src/gdb/infrun.c:2899 + #1 0x0000555555e848bf in scoped_disable_commit_resumed::reset (this=0x7fffffffd440) at ../../src/gdb/infrun.c:3023 + #2 0x0000555555e84a0c in scoped_disable_commit_resumed::reset_and_commit (this=0x7fffffffd440) at ../../src/gdb/infrun.c:3049 + #3 0x0000555555e739cd in detach_command (args=0x0, from_tty=1) at ../../src/gdb/infcmd.c:2791 + #4 0x0000555555c0ba46 in do_simple_func (args=0x0, from_tty=1, c=0x55555662a600) at ../../src/gdb/cli/cli-decode.c:95 + #5 0x0000555555c112b0 in cmd_func (cmd=0x55555662a600, args=0x0, from_tty=1) at ../../src/gdb/cli/cli-decode.c:2514 + #6 0x0000555556173b1f in execute_command (p=0x5555565c5916 "", from_tty=1) at ../../src/gdb/top.c:699 + +The code that crashes looks like: + + static void + maybe_set_commit_resumed_all_targets () + { + scoped_restore_current_thread restore_thread; + + for (inferior *inf : all_non_exited_inferiors ()) + { + process_stratum_target *proc_target = inf->process_target (); + + if (proc_target->commit_resumed_state) + ^^^^^^^^^^^ + +With 'proc_target' above being null. all_non_exited_inferiors filters +out inferiors that have pid==0. We get here at the end of +detach_command, after core_target::detach has already run, at which +point the inferior _should_ have pid==0 and no process target. It is +clear it no longer has a process target, but, it still has a pid!=0 +somehow. + +The reason the inferior still has pid!=0, is that core_target::detach +just unpushes, and relies on core_target::close to actually do the +getting rid of the core and exiting the inferior. The problem with +that is that detach_command grabs an extra strong reference to the +process stratum target, so the unpush_target inside +core_target::detach doesn't actually result in a call to +core_target::close. + +Fix this my moving the cleaning up the core inferior to a shared +routine called by both core_target::close and core_target::detach. We +still need to cleanup the inferior from within core_file::close +because there are paths to it that want to get rid of the core without +going through detach. E.g., "core-file" -> "run". + +This commit includes a new test added to gdb.base/corefile.exp to +cover the "core-file core" -> "detach" scenario. + +Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29275 + +Change-Id: Ic42bdd03182166b19f598428b0dbc2ce6f67c893 + +--- + gdb/corelow.c | 27 +++++++++++++++++++++------ + gdb/testsuite/gdb.base/corefile.exp | 12 ++++++++++++ + 2 files changed, 33 insertions(+), 6 deletions(-) + +diff --git a/gdb/corelow.c b/gdb/corelow.c +index 001c4f147fc..bdd7ddc59c2 100644 +--- a/gdb/corelow.c ++++ b/gdb/corelow.c +@@ -120,6 +120,9 @@ class core_target final : public process_stratum_target + + private: /* per-core data */ + ++ /* Get rid of the core inferior. */ ++ void clear_core (); ++ + /* The core's section table. Note that these target sections are + *not* mapped in the current address spaces' set of target + sections --- those should come only from pure executable or +@@ -290,10 +293,8 @@ core_target::build_file_mappings () + /* An arbitrary identifier for the core inferior. */ + #define CORELOW_PID 1 + +-/* Close the core target. */ +- + void +-core_target::close () ++core_target::clear_core () + { + if (core_bfd) + { +@@ -307,6 +308,14 @@ core_target::close () + + current_program_space->cbfd.reset (nullptr); + } ++} ++ ++/* Close the core target. */ ++ ++void ++core_target::close () ++{ ++ clear_core (); + + /* Core targets are heap-allocated (see core_target_open), so here + we delete ourselves. */ +@@ -592,9 +601,15 @@ core_target_open (const char *arg, int from_tty) + void + core_target::detach (inferior *inf, int from_tty) + { +- /* Note that 'this' is dangling after this call. unpush_target +- closes the target, and our close implementation deletes +- 'this'. */ ++ /* Get rid of the core. Don't rely on core_target::close doing it, ++ because target_detach may be called with core_target's refcount > 1, ++ meaning core_target::close may not be called yet by the ++ unpush_target call below. */ ++ clear_core (); ++ ++ /* Note that 'this' may be dangling after this call. unpush_target ++ closes the target if the refcount reaches 0, and our close ++ implementation deletes 'this'. */ + inf->unpush_target (this); + + /* Clear the register cache and the frame cache. */ +diff --git a/gdb/testsuite/gdb.base/corefile.exp b/gdb/testsuite/gdb.base/corefile.exp +index 4ed92a02955..7f3d2efe3a2 100644 +--- a/gdb/testsuite/gdb.base/corefile.exp ++++ b/gdb/testsuite/gdb.base/corefile.exp +@@ -207,6 +207,16 @@ gdb_test "up" "#\[0-9\]* *\[0-9xa-fH'\]* in .* \\(.*\\).*" "up in corefile.exp ( + + gdb_test "core" "No core file now." + ++# Test that we can unload the core with the "detach" command. ++ ++proc_with_prefix corefile_detach {} { ++ clean_restart $::binfile ++ ++ gdb_test "core-file $::corefile" "Core was generated by .*" "load core" ++ gdb_test "detach" "No core file now\\." "detach core" ++} ++ ++corefile_detach + + # Test a run (start) command will clear any loaded core file. + +@@ -222,6 +232,8 @@ proc corefile_test_run {} { + return + } + ++ clean_restart $::binfile ++ + gdb_test "core-file $corefile" "Core was generated by .*" "run: load core again" + gdb_test "info files" "\r\nLocal core dump file:\r\n.*" "run: sanity check we see the core file" + diff --git a/fix-for-gdb.base-solib-search.exp-test.patch b/fix-for-gdb.base-solib-search.exp-test.patch new file mode 100644 index 0000000..b2b2e54 --- /dev/null +++ b/fix-for-gdb.base-solib-search.exp-test.patch @@ -0,0 +1,140 @@ +Fix for gdb.base/solib-search.exp test. + +The variable right_lib_flags is not being set correctly to define RIGHT. +The value RIGHT is needed to force the address of the library functions +lib1_func3 and lib2_func4 to occur at different address in the wrong and +right libraries. + +With RIGHT defined correctly, functions lib1_func3 and lib2_func4 occur +at different addresses the test runs correctly on Powerpc. + +The test needs the lib2 addresses to be different in the right and +wrong cases. That is the point of introducing function lib2_spacer +with the ifdef RIGHT compiler directive. + +On Intel, the ARRAY_SIZE of 1 versus 8192 is sufficient to get the +dynamic linker to move the addresses of the library. You can also get +the same effect on PowerPC but you must use a value much larger than +8192. + +The key thing is that the test was not properly setting RIGHT to +defined to get the lib2_spacer function on Intel and Powerpc. + +Without the patch, we have the Intel backtrace for the bad libraries: + +backtrace +#0 break_here () at /home/ ... /gdb/testsuite/gdb.base/solib-search.c:30 +#1 0x00007ffff7fae156 in ?? () +#2 0x00007fffffffc150 in ?? () +#3 0x00007ffff7fbb156 in ?? () +#4 0x00007fffffffc160 in ?? () +#5 0x00007ffff7fae146 in ?? () +#6 0x00007fffffffc170 in ?? () +#7 0x00007ffff7fbb146 in ?? () +#8 0x00007fffffffc180 in ?? () +#9 0x0000555555555156 in main () at /home/ ... /binutils-gdb/gdb/testsuite/gdb.base/solib-search.c:23 +Backtrace stopped: previous frame inner to this frame (corrupt stack?) +(gdb) PASS: gdb.base/solib-search.exp: backtrace (with wrong libs) (data collection) + +The backtrace on Intel with the good libraries is: + +backtrace +#0 break_here () at /.../binutils-gdb/gdb/testsuite/gdb.base/solib-search.c:30 +#1 0x00007ffff7fae156 in lib2_func4 () at /.../binutils-gdb/gdb/testsuite/gdb.base/solib-search-lib2.c:49 +#2 0x00007ffff7fbb156 in lib1_func3 () at /.../gdb.base/solib-search-lib1.c:49 +#3 0x00007ffff7fae146 in lib2_func2 () at /.../testsuite/gdb.base/solib-search-lib2.c:30 +#4 0x00007ffff7fbb146 in lib1_func1 () at /.../gdb.base/solib-search-lib1.c:30 +#5 0x0000555555555156 in main () at /...solib-search.c:23 +(gdb) PASS: gdb.base/solib-search.exp: backtrace (with right libs) (data collection) +PASS: gdb.base/solib-search.exp: backtrace (with right libs) + +In one case the backtrace is correct and the other it +is wrong on Intel. This is due to the fact that the ARRAY_SIZE caused +the dynamic linker to move the library function addresses around. I +believe it has to do with the default size of the data and code +sections used by the dynamic linker. + +So without the patch the backtrace on PowerPC looks like: + + backtrace +#0 break_here () at /.../solib-search.c:30 +#1 0x00007ffff7f007f4 in lib2_func4 () at /.../solib-search-lib2.c:49 +#2 0x00007ffff7f307f4 in lib1_func3 () at /.../solib-search-lib1.c:49 +#3 0x00007ffff7f007ac in lib2_func2 () at /.../solib-search-lib2.c:30 +#4 0x00007ffff7f307ac in lib1_func1 () at /.../solib-search-lib1.c:30 +#5 0x000000001000074c in main () at /.../solib-search.c:23 + +for both the good and bad libraries. + +The patch fixes defining RIGHT in solib-search-lib1.c and solib-search- +lib2.c. Note, without the patch the lib1_spacer and lib2_spacer +functions do not show up in the object dump of the Intel or Powerpc +libraries as it should. The patch fixes that by making sure RIGHT gets +defined. + +Now with the patch the backtrace for the bad library on PowerPC looks +like: + +backtrace +#0 break_here () at /.../solib-search.c:30 +#1 0x00007ffff7f0083c in __glink_PLTresolve () from /.../solib-search-lib2.so +Backtrace stopped: frame did not save the PC + +And the backtrace for the good libraries on PowerPC looks like: + +backtrace +#0 break_here () at /.../solib-search.c:30 +#1 0x00007ffff7f0083c in lib2_func4 () at /.../solib-search-lib2.c:49 +#2 0x00007ffff7f3083c in lib1_func3 () at /.../solib-search-lib1.c:49 +#3 0x00007ffff7f007cc in lib2_func2 () at /.../solib-search-lib2.c:30 +#4 0x00007ffff7f307cc in lib1_func1 () at /.../solib-search-lib1.c:30 +#5 0x000000001000074c in main () at /.../solib-search.c:23 +(gdb) PASS: gdb.base/solib-search.exp: backtrace (with right libs) (data collection) +PASS: gdb.base/solib-search.exp: backtrace (with right libs) + +The issue then is on Power where the ARRAY_SIZE of 1 versus 8192 is not +sufficient to cause the dymanic linker to allocate the libraries at +different addresses. I don't claim to understand the specifics of how +the dynamic linker works and what the default size is for the data and +code sections are. My guess is by default PowerPC allocates a larger +data size by default, which is large enough to hold array[8192]. The +default size of the data section allocated by the dynamic linker on +Intel is not large enough to hold array[8192] thus causing the code +section on Intel to have to move when the large array is defined. + +Note on PowerPC, if you make ARRAY_SIZE big enough, then you will cause +the library addresses to occur at different addresses as the larger +data section forces the code section to a different address. That was +actually my original fix for the program until I spoke with Doug Evans +who originally wrote the test. Doug noticed that RIGHT was not getting +defined as he originally intended in the test. + +With the patch to fix the definition of RIGHT, PowerPC has a bad and a +good backtrace because the address of lib1_func3 and lib2_func4 both +move because lib1_spacer and lib2_spacer are now defined +before lib1_func3 and lib2_func4. + +Without the patch, the lib1_spacer and lib2_spacer function doesn't show +up in the binary for the correct or incorrect library on Intel or PowerPC. +With the patch, RIGHT gets defined as originally intended for the test on +both architectures and lib1_spacer and lib2_spacer function show up in the +binaries on both architectures changing the other function addresses as +intended thus causing the test work as intended on PowerPC. + +--- + gdb/testsuite/gdb.base/solib-search.exp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/gdb/testsuite/gdb.base/solib-search.exp b/gdb/testsuite/gdb.base/solib-search.exp +index eaabe508bf0..202e79d85de 100644 +--- a/gdb/testsuite/gdb.base/solib-search.exp ++++ b/gdb/testsuite/gdb.base/solib-search.exp +@@ -54,7 +54,7 @@ set binfile2_lib [standard_output_file ${libname2}.so] + + set lib_flags [list debug ldflags=-Wl,-Bsymbolic] + set wrong_lib_flags "$lib_flags additional_flags=-DARRAY_SIZE=1" +-set right_lib_flags "$lib_flags additional_flags=-DARRAY_SIZE=8192 -DRIGHT" ++set right_lib_flags "$lib_flags additional_flags=-DARRAY_SIZE=8192 additional_flags=-DRIGHT" + + # Binary file. + standard_testfile .c diff --git a/fix-gdb.base-sigstep.exp-test-for-ppc.patch b/fix-gdb.base-sigstep.exp-test-for-ppc.patch deleted file mode 100644 index 5fd0319..0000000 --- a/fix-gdb.base-sigstep.exp-test-for-ppc.patch +++ /dev/null @@ -1,58 +0,0 @@ -Fix gdb.base/sigstep.exp test for ppc - -The test stops at which is the call to the handler -rather than in the handler as intended. This patch replaces the -gdb_test "$enter_cmd to handler" with a gdb_test_multiple test. The multiple -test looks for the stop at . If found, the command -is issued again. The test passes if gdb stops in the handler as expected. - -(gdb) PASS: gdb.base/sigstep.exp: stepi to handler, nothing in handler, step -from handler: continue to signal -stepi - -1: x/i $pc -=> 0x7ffff7f80440 <__kernel_start_sigtramp_rt64>: bctrl -(gdb) stepi -handler (sig=551) at sigstep.c:32 -32 { -1: x/i $pc -=> 0x10000097c : addis r2,r12,2 -(gdb) PASS: gdb.base/sigstep.exp: stepi to handler, nothing in handler, -step from handler: stepi to handler - -Patch has been tested on x86_64-linux and ppc64le-linux with no test failures. - ---- - gdb/testsuite/gdb.base/sigstep.exp | 12 +++++++++++- - 1 file changed, 11 insertions(+), 1 deletion(-) - -diff --git a/gdb/testsuite/gdb.base/sigstep.exp b/gdb/testsuite/gdb.base/sigstep.exp -index ea254af5297..176918b67d6 100644 ---- a/gdb/testsuite/gdb.base/sigstep.exp -+++ b/gdb/testsuite/gdb.base/sigstep.exp -@@ -79,6 +79,7 @@ validate_backtrace - proc advance { enter_cmd in_handler_prefix in_handler exit_cmd } { - global gdb_prompt inferior_exited_re - global clear_done other_handler_location -+ global decimal - - set prefix "$enter_cmd to handler, $in_handler_prefix in handler, $exit_cmd from handler" - -@@ -93,7 +94,16 @@ proc advance { enter_cmd in_handler_prefix in_handler exit_cmd } { - gdb_test "handle SIGVTALRM print pass stop" - gdb_test "continue" "Program received signal.*" "continue to signal" - } -- gdb_test "$enter_cmd" ".*handler .*" "$enter_cmd to handler" -+ -+ gdb_test_multiple "$enter_cmd" "$enter_cmd to handler" { -+ -re -wrap "\r\n.*" { -+ send_gdb "$enter_cmd\n" -+ exp_continue -+ } -+ -re -wrap "\r\n(Breakpoint $decimal, )?handler \\(sig=.*" { -+ pass $gdb_test_name -+ } -+ } - - delete_breakpoints - diff --git a/fix-gdb.multi-multi-term-settings.exp-race.patch b/fix-gdb.multi-multi-term-settings.exp-race.patch deleted file mode 100644 index 7d5d43e..0000000 --- a/fix-gdb.multi-multi-term-settings.exp-race.patch +++ /dev/null @@ -1,182 +0,0 @@ -Fix gdb.multi/multi-term-settings.exp race - -The gdb.multi/multi-term-settings.exp testcase sometimes fails like so: - - Running /home/pedro/gdb/mygit/src/gdb/testsuite/gdb.multi/multi-term-settings.exp ... - FAIL: gdb.multi/multi-term-settings.exp: inf1_how=attach: inf2_how=attach: stop with control-c (SIGINT) - -It's easier to reproduce if you stress the machine at the same time, like e.g.: - - $ stress -c 24 - -Looking at gdb.log, we see: - - (gdb) attach 60422 - Attaching to program: build/gdb/testsuite/outputs/gdb.multi/multi-term-settings/multi-term-settings, process 60422 - [New Thread 60422.60422] - Reading symbols from /lib/x86_64-linux-gnu/libc.so.6... - Reading symbols from /usr/lib/debug//lib/x86_64-linux-gnu/libc-2.31.so... - Reading symbols from /lib64/ld-linux-x86-64.so.2... - (No debugging symbols found in /lib64/ld-linux-x86-64.so.2) - 0x00007f2fc2485334 in __GI___clock_nanosleep (clock_id=, clock_id@entry =0, flags=flags@entry =0, req=req@entry =0x7ffe23126940, rem=rem@entry =0x0) at ../sysdeps/unix/sysv/linux/clock_nanosleep.c:78 - 78 ../sysdeps/unix/sysv/linux/clock_nanosleep.c: No such file or directory. - (gdb) PASS: gdb.multi/multi-term-settings.exp: inf1_how=attach: inf2_how=attach: inf2: attach - set schedule-multiple on - (gdb) PASS: gdb.multi/multi-term-settings.exp: inf1_how=attach: inf2_how=attach: set schedule-multiple on - info inferiors - Num Description Connection Executable - 1 process 60404 1 (extended-remote localhost:2349) build/gdb/testsuite/outputs/gdb.multi/multi-term-settings/multi-term-settings - * 2 process 60422 1 (extended-remote localhost:2349) build/gdb/testsuite/outputs/gdb.multi/multi-term-settings/multi-term-settings - (gdb) PASS: gdb.multi/multi-term-settings.exp: inf1_how=attach: inf2_how=attach: info inferiors - pid=60422, count=46 - pid=60422, count=47 - pid=60422, count=48 - pid=60422, count=49 - pid=60422, count=50 - pid=60422, count=51 - pid=60422, count=52 - pid=60422, count=53 - pid=60422, count=54 - pid=60422, count=55 - pid=60422, count=56 - pid=60422, count=57 - pid=60422, count=58 - pid=60422, count=59 - pid=60422, count=60 - pid=60422, count=61 - pid=60422, count=62 - pid=60422, count=63 - pid=60422, count=64 - pid=60422, count=65 - pid=60422, count=66 - pid=60422, count=67 - pid=60422, count=68 - pid=60422, count=69 - pid=60404, count=54 - pid=60404, count=55 - pid=60404, count=56 - pid=60404, count=57 - pid=60404, count=58 - PASS: gdb.multi/multi-term-settings.exp: inf1_how=attach: inf2_how=attach: continue - Quit - (gdb) FAIL: gdb.multi/multi-term-settings.exp: inf1_how=attach: inf2_how=attach: stop with control-c (SIGINT) - -If you look at the testcase's sources, you'll see that the intention -is to resumes the program with "continue", wait to see a few of those -"pid=..., count=..." lines, and then interrupt the program with -Ctrl-C. But somehow, that resulted in GDB printing "Quit", instead of -the Ctrl-C stopping the program with SIGINT. - -Here's what is happening: - - #1 - those "pid=..., count=..." lines we see above weren't actually - output by the inferior after it has been continued (see #1). - Note that "inf1_how" and "inf2_how" are "attach". What happened - is that those "pid=..., count=..." lines were output by the - inferiors _before_ they were attached to. We see them at that - point instead of earlier, because that's where the testcase - reads from the inferiors' spawn_ids. - - #2 - The testcase mistakenly thinks those "pid=..., count=..." lines - happened after the continue was processed by GDB, meaning it has - waited enough, and so sends the Ctrl-C. GDB hasn't yet passed - the terminal to the inferior, so the Ctrl-C results in that - Quit. - -The fix here is twofold: - - #1 - flush inferior output right after attaching - - #2 - consume the "Continuing" printed by "continue", indicating the - inferior has the terminal. This is the same as done throughout - the testsuite to handle this exact problem of sending Ctrl-C too - soon. - -gdb/testsuite/ChangeLog: -yyyy-mm-dd Pedro Alves > - - * gdb.multi/multi-term-settings.exp (create_inferior): Flush - inferior output. - (coretest): Use $gdb_test_name. After issuing "continue", wait - for "Continuing". - -Change-Id: Iba7671dfe1eee6b98d29cfdb05a1b9aa2f9defb9 - ---- - gdb/testsuite/gdb.multi/multi-term-settings.exp | 40 +++++++++++++++++++++---- - 1 file changed, 34 insertions(+), 6 deletions(-) - -diff --git a/gdb/testsuite/gdb.multi/multi-term-settings.exp b/gdb/testsuite/gdb.multi/multi-term-settings.exp -index 20ec03d94b3..dcc6f2ece0f 100644 ---- a/gdb/testsuite/gdb.multi/multi-term-settings.exp -+++ b/gdb/testsuite/gdb.multi/multi-term-settings.exp -@@ -95,6 +95,22 @@ proc create_inferior {which_inf inf_how} { - if {[gdb_test "attach $testpid" \ - "Attaching to program: .*, process $testpid.*(in|at).*" \ - "attach"] == 0} { -+ -+ # The program is now stopped, but if testing against -+ # gdbserver, then the inferior's output emmitted before it -+ # stopped isn't flushed unless we explicitly do so, -+ # because it is on a different spawn_id. Do it now, to -+ # avoid confusing tests further below. -+ gdb_test_multiple "" "flush inferior output" { -+ -timeout 1 -+ -i $test_spawn_id -re "pid=" { -+ exp_continue -+ } -+ timeout { -+ pass $gdb_test_name -+ } -+ } -+ - return $test_spawn_id - } - } else { -@@ -179,9 +195,9 @@ proc coretest {inf1_how inf2_how} { - uplevel 1 { - if {$count1 >= 3 && $count2 >= 3} { - if $expect_ttou { -- fail "$test (expected SIGTTOU)" -+ fail "$gdb_test_name (expected SIGTTOU)" - } else { -- pass $test -+ pass $gdb_test_name - } - } else { - exp_continue -@@ -195,8 +211,20 @@ proc coretest {inf1_how inf2_how} { - set count1 0 - set count2 0 - -- set test "continue" -- gdb_test_multiple $test $test { -+ # We're going to interrupt with Ctrl-C. For this to work we must -+ # be sure to consume the "Continuing." message first, or GDB may -+ # still own the terminal. Also, note that in the attach case, we -+ # flushed inferior output right after attaching, so that we're -+ # sure that the "pid=" lines we see are emitted by the inferior -+ # after it is continued, instead of having been emitted before it -+ # was attached to. -+ gdb_test_multiple "continue" "continue, hand over terminal" { -+ -re "Continuing" { -+ pass $gdb_test_name -+ } -+ } -+ -+ gdb_test_multiple "" "continue" { - -i $infs_spawn_ids -re "pid=$pid1, count=" { - incr count1 - pass_or_exp_continue -@@ -207,9 +235,9 @@ proc coretest {inf1_how inf2_how} { - } - -i $gdb_spawn_id -re "received signal SIGTTOU.*$gdb_prompt " { - if $expect_ttou { -- pass "$test (expected SIGTTOU)" -+ pass "$gdb_test_name (expected SIGTTOU)" - } else { -- fail "$test (SIGTTOU)" -+ fail "$gdb_test_name (SIGTTOU)" - } - } - } diff --git a/fixup-2-gdb-6.6-buildid-locate.patch b/fixup-2-gdb-6.6-buildid-locate.patch deleted file mode 100644 index f42561c..0000000 --- a/fixup-2-gdb-6.6-buildid-locate.patch +++ /dev/null @@ -1,20 +0,0 @@ -fixup-2-gdb-6.6-buildid-locate.patch - ---- - gdb/testsuite/lib/gdb.exp | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp -index e2ce31cc553..2b94f79d132 100644 ---- a/gdb/testsuite/lib/gdb.exp -+++ b/gdb/testsuite/lib/gdb.exp -@@ -131,7 +131,8 @@ if ![info exists INTERNAL_GDBFLAGS] { - "-nx" \ - "-data-directory $BUILD_DATA_DIRECTORY" \ - {-iex "set height 0"} \ -- {-iex "set width 0"}]] -+ {-iex "set width 0"} \ -+ {-iex "set build-id-verbose 0"}]] - } - - # The variable gdb_prompt is a regexp which matches the gdb prompt. diff --git a/fixup-2-gdb-rhbz1553104-s390x-arch12-test.patch b/fixup-2-gdb-rhbz1553104-s390x-arch12-test.patch new file mode 100644 index 0000000..896b0e2 --- /dev/null +++ b/fixup-2-gdb-rhbz1553104-s390x-arch12-test.patch @@ -0,0 +1,29 @@ +fixup-2-gdb-rhbz1553104-s390x-arch12-test + +--- + gdb/testsuite/gdb.arch/s390x-arch12.exp | 14 ++++++++++++++ + 1 file changed, 14 insertions(+) + +diff --git a/gdb/testsuite/gdb.arch/s390x-arch12.exp b/gdb/testsuite/gdb.arch/s390x-arch12.exp +index 246c1e1c69a..7939a2d6932 100644 +--- a/gdb/testsuite/gdb.arch/s390x-arch12.exp ++++ b/gdb/testsuite/gdb.arch/s390x-arch12.exp +@@ -31,4 +31,18 @@ gdb_exit + gdb_start + gdb_load $ofile + ++set supported 0 ++gdb_test_multiple "show arch" "" { ++ -re -wrap "\"s390:64-bit\".*" { ++ set supported 1 ++ } ++ -re -wrap "" { ++ } ++} ++ ++if { ! $supported } { ++ unsupported "No s390x support" ++ return -1 ++} ++ + gdb_test "disas load_guarded" " <\\+28>:\tlgg\t%r1,0\\(%r1\\)\r\n\[^\r\n\]* <\\+34>:\tstg\t%r1,168\\(%r11\\)\r\n.*" diff --git a/fixup-gdb-6.6-buildid-locate.patch b/fixup-gdb-6.6-buildid-locate.patch deleted file mode 100644 index 3627111..0000000 --- a/fixup-gdb-6.6-buildid-locate.patch +++ /dev/null @@ -1,23 +0,0 @@ -fixup-gdb-6.6-buildid-locate.patch - ---- - gdb/build-id.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/gdb/build-id.c b/gdb/build-id.c -index 830098688d5..a1920ab5a09 100644 ---- a/gdb/build-id.c -+++ b/gdb/build-id.c -@@ -1314,10 +1314,10 @@ find_separate_debug_file_by_buildid (struct objfile *objfile, - return std::string (); - } - --extern void _initialize_build_id (void); -+void _initialize_build_id (); - - void --_initialize_build_id (void) -+_initialize_build_id () - { - add_setshow_zinteger_cmd ("build-id-verbose", no_class, &build_id_verbose, - _("\ diff --git a/fixup-gdb-test-bt-cfi-without-die.patch b/fixup-gdb-test-bt-cfi-without-die.patch new file mode 100644 index 0000000..f68da30 --- /dev/null +++ b/fixup-gdb-test-bt-cfi-without-die.patch @@ -0,0 +1,38 @@ +fixup-gdb-test-bt-cfi-without-die.patch + +--- + gdb/testsuite/gdb.base/cfi-without-die.exp | 13 ++++++++----- + 1 file changed, 8 insertions(+), 5 deletions(-) + +diff --git a/gdb/testsuite/gdb.base/cfi-without-die.exp b/gdb/testsuite/gdb.base/cfi-without-die.exp +index 5880d46f6d2..db1726646f8 100644 +--- a/gdb/testsuite/gdb.base/cfi-without-die.exp ++++ b/gdb/testsuite/gdb.base/cfi-without-die.exp +@@ -37,19 +37,22 @@ if ![runto callback] then { + fail "verify unwinding: Can't run to callback" + return 0 + } +-set test "verify unwinding breaks without CFI" +-gdb_test_multiple "bt" $test { ++ ++set as_expected 1 ++gdb_test_multiple "bt" "" { + -re " in \[?\]\[?\] .*\r\n$gdb_prompt $" { + # It may backtrace through some random frames even to main(). +- pass $test + } + -re " in main .*\r\n$gdb_prompt $" { +- fail $test ++ set as_expected 0 + } + -re "\r\n$gdb_prompt $" { +- pass $test + } + } ++if { ! $as_expected } { ++ untested ${testfile}.exp ++ return -1 ++} + + if { [gdb_compile "${srcdir}/${subdir}/${srccallerfile}" ${objcallerfile} \ + object [list {additional_flags=-fomit-frame-pointer -funwind-tables -fasynchronous-unwind-tables}]] != "" diff --git a/gdb-11.1.tar.bz2 b/gdb-11.1.tar.bz2 deleted file mode 100644 index fd4b7e1..0000000 --- a/gdb-11.1.tar.bz2 +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:fe14d640ad78b741f6b2751612aa9e40f752daaf0b6459cd01a4133379413d6e -size 29356796 diff --git a/gdb-12.1.tar.bz2 b/gdb-12.1.tar.bz2 new file mode 100644 index 0000000..f8450e4 --- /dev/null +++ b/gdb-12.1.tar.bz2 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c8ad7cb193a9d7bad7966da1e7f25d57cc369e835416965719fbda266fb13a44 +size 29842337 diff --git a/gdb-6.3-gstack-20050411.patch b/gdb-6.3-gstack-20050411.patch index 945db5e..6379177 100644 --- a/gdb-6.3-gstack-20050411.patch +++ b/gdb-6.3-gstack-20050411.patch @@ -16,7 +16,7 @@ Subject: gdb-6.3-gstack-20050411.patch diff --git a/gdb/Makefile.in b/gdb/Makefile.in --- a/gdb/Makefile.in +++ b/gdb/Makefile.in -@@ -1753,7 +1753,7 @@ info install-info clean-info dvi pdf install-pdf html install-html: force +@@ -1767,7 +1767,7 @@ info install-info clean-info dvi pdf install-pdf html install-html: force install: all @$(MAKE) $(FLAGS_TO_PASS) install-only @@ -25,7 +25,7 @@ diff --git a/gdb/Makefile.in b/gdb/Makefile.in transformed_name=`t='$(program_transform_name)'; \ echo gdb | sed -e "$$t"` ; \ if test "x$$transformed_name" = x; then \ -@@ -1802,7 +1802,25 @@ install-guile: +@@ -1816,7 +1816,25 @@ install-guile: install-python: $(SHELL) $(srcdir)/../mkinstalldirs $(DESTDIR)$(GDB_DATADIR)/python/gdb @@ -52,8 +52,8 @@ diff --git a/gdb/Makefile.in b/gdb/Makefile.in transformed_name=`t='$(program_transform_name)'; \ echo gdb | sed -e $$t` ; \ if test "x$$transformed_name" = x; then \ -@@ -1825,6 +1843,18 @@ uninstall: force $(CONFIG_UNINSTALL) - fi +@@ -1847,6 +1865,18 @@ uninstall: force $(CONFIG_UNINSTALL) + rm -f $(DESTDIR)$(bindir)/$$transformed_name @$(MAKE) DO=uninstall "DODIRS=$(SUBDIRS)" $(FLAGS_TO_PASS) subdir_do +.PHONY: uninstall-gstack diff --git a/gdb-6.3-inferior-notification-20050721.patch b/gdb-6.3-inferior-notification-20050721.patch deleted file mode 100644 index 9ee912c..0000000 --- a/gdb-6.3-inferior-notification-20050721.patch +++ /dev/null @@ -1,324 +0,0 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Jeff Johnston -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-6.3-inferior-notification-20050721.patch - -;; Notify observers that the inferior has been created -;;=fedoratest - -2005-07-21 Jeff Johnston - - * gdb.base/attach-32.exp: New test for attaching in 32-bit - mode on 64-bit systems. - * gdb.base/attach-32.c: Ditto. - * gdb.base/attach-32b.c: Ditto. - -2007-12-26 Jan Kratochvil - - * gdb.base/attach-32.exp: Fix forgotten $GDBFLAGS as set. - -diff --git a/gdb/testsuite/gdb.base/attach-32.c b/gdb/testsuite/gdb.base/attach-32.c -new file mode 100644 ---- /dev/null -+++ b/gdb/testsuite/gdb.base/attach-32.c -@@ -0,0 +1,20 @@ -+/* This program is intended to be started outside of gdb, and then -+ attached to by gdb. Thus, it simply spins in a loop. The loop -+ is exited when & if the variable 'should_exit' is non-zero. (It -+ is initialized to zero in this program, so the loop will never -+ exit unless/until gdb sets the variable to non-zero.) -+ */ -+#include -+ -+int should_exit = 0; -+ -+int main () -+{ -+ int local_i = 0; -+ -+ while (! should_exit) -+ { -+ local_i++; -+ } -+ return 0; -+} -diff --git a/gdb/testsuite/gdb.base/attach-32.exp b/gdb/testsuite/gdb.base/attach-32.exp -new file mode 100644 ---- /dev/null -+++ b/gdb/testsuite/gdb.base/attach-32.exp -@@ -0,0 +1,246 @@ -+# Copyright 2005 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 2 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, write to the Free Software -+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -+# -+# This test was based on attach.exp and modified for 32/64 bit Linux systems. */ -+ -+# On HP-UX 11.0, this test is causing a process running the program -+# "attach" to be left around spinning. Until we figure out why, I am -+# commenting out the test to avoid polluting tiamat (our 11.0 nightly -+# test machine) with these processes. RT -+# -+# Setting the magic bit in the target app should work. I added a -+# "kill", and also a test for the R3 register warning. JB -+if { ![istarget "x86_64*-*linux*"] -+ && ![istarget "powerpc64*-*linux*"]} { -+ return 0 -+} -+ -+# are we on a target board -+if {[use_gdb_stub]} { -+ untested "skipping test because of use_gdb_stub" -+ return -1 -+} -+ -+set testfile "attach-32" -+set srcfile ${testfile}.c -+set srcfile2 ${testfile}b.c -+set binfile [standard_output_file ${testfile}] -+set binfile2 [standard_output_file ${testfile}b] -+set escapedbinfile [string_to_regexp [standard_output_file ${testfile}]] -+ -+#execute_anywhere "rm -f ${binfile} ${binfile2}" -+remote_exec build "rm -f ${binfile} ${binfile2}" -+# For debugging this test -+# -+#log_user 1 -+ -+# build the first test case -+# -+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug "additional_flags=-m32"]] != "" } { -+ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." -+} -+ -+# Build the in-system-call test -+ -+if { [gdb_compile "${srcdir}/${subdir}/${srcfile2}" "${binfile2}" executable [list debug "additional_flags=-m32"]] != "" } { -+ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." -+} -+ -+if [get_compiler_info ${binfile}] { -+ return -1 -+} -+ -+proc do_attach_tests {} { -+ global gdb_prompt -+ global binfile -+ global escapedbinfile -+ global srcfile -+ global testfile -+ global objdir -+ global subdir -+ global timeout -+ global testpid -+ -+ # Verify that we can "see" the variable "should_exit" in the -+ # program, and that it is zero. -+ -+ gdb_test "print should_exit" " = 0" "after attach-32, print should_exit" -+ -+ # Verify that we can modify the variable "should_exit" in the -+ # program. -+ -+ gdb_test "set should_exit=1" "" "after attach-32, set should_exit" -+ -+ # Verify that the modification really happened. -+ -+ send_gdb "tbreak 19\n" -+ gdb_expect { -+ -re "reakpoint .*at.*$srcfile, line 19.*$gdb_prompt $" { -+ pass "after attach-32, set tbreak postloop" -+ } -+ -re "$gdb_prompt $" { -+ fail "after attach-32, set tbreak postloop" -+ } -+ timeout { -+ fail "(timeout) after attach-32, set tbreak postloop" -+ } -+ } -+ send_gdb "continue\n" -+ gdb_expect { -+ -re "main.*at.*$srcfile:19.*$gdb_prompt $" { -+ pass "after attach-32, reach tbreak postloop" -+ } -+ -re "$gdb_prompt $" { -+ fail "after attach-32, reach tbreak postloop" -+ } -+ timeout { -+ fail "(timeout) after attach-32, reach tbreak postloop" -+ } -+ } -+ -+ # Allow the test process to exit, to cleanup after ourselves. -+ -+ gdb_test "continue" {\[Inferior .* exited normally\]} "after attach-32, exit" -+ -+ # Make sure we don't leave a process around to confuse -+ # the next test run (and prevent the compile by keeping -+ # the text file busy), in case the "set should_exit" didn't -+ # work. -+ -+ remote_exec build "kill -9 ${testpid}" -+ -+ # Start the program running and then wait for a bit, to be sure -+ # that it can be attached to. -+ -+ set testpid [eval exec $binfile &] -+ exec sleep 2 -+ if { [istarget "*-*-cygwin*"] } { -+ # testpid is the Cygwin PID, GDB uses the Windows PID, which might be -+ # different due to the way fork/exec works. -+ set testpid [ exec ps -e | gawk "{ if (\$1 == $testpid) print \$4; }" ] -+ } -+ -+ # Verify that we can attach to the process, and find its a.out -+ # when we're cd'd to some directory that doesn't contain the -+ # a.out. (We use the source path set by the "dir" command.) -+ -+ gdb_test "dir ${objdir}/${subdir}" "Source directories searched: .*" \ -+ "set source path" -+ -+ gdb_test "cd /tmp" "Working directory /tmp." \ -+ "cd away from process working directory" -+ -+ # Explicitly flush out any knowledge of the previous attachment. -+ -+ set test "before attach-32-3, flush symbols" -+ gdb_test_multiple "symbol" "$test" { -+ -re "Discard symbol table from.*y or n. $" { -+ gdb_test "y" "No symbol file now." \ -+ "$test" -+ } -+ -re "No symbol file now.*$gdb_prompt $" { -+ pass "$test" -+ } -+ } -+ -+ gdb_test "exec" "No executable file now." \ -+ "before attach-32-3, flush exec" -+ -+ gdb_test "attach $testpid" \ -+ "Attaching to process $testpid.*Reading symbols from $escapedbinfile.*main.*at .*" \ -+ "attach-32 when process' a.out not in cwd" -+ -+ set test "after attach-32-3, exit" -+ gdb_test_multiple "kill" "$test" { -+ -re "Kill the program being debugged.*y or n. $" { -+ gdb_test "y" "" "$test" -+ } -+ } -+ -+ # Another "don't leave a process around" -+ remote_exec build "kill -9 ${testpid}" -+} -+ -+proc do_call_attach_tests {} { -+ global gdb_prompt -+ global binfile2 -+ global testpid -+ -+ # See if other registers are problems -+ -+ set test "info other register" -+ gdb_test_multiple "i r r3" "$test" { -+ -re "warning: reading register.*$gdb_prompt $" { -+ fail "$test" -+ } -+ -re "r3.*$gdb_prompt $" { -+ pass "$test" -+ } -+ } -+ -+ # Get rid of the process -+ -+ gdb_test "p should_exit = 1" -+ gdb_test "c" {\[Inferior .* exited normally\]} -+ -+ # Be paranoid -+ -+ remote_exec build "kill -9 ${testpid}" -+} -+ -+ -+# Start with a fresh gdb -+ -+gdb_exit -+set testpid [eval exec $binfile &] -+exec sleep 3 -+if { [istarget "*-*-cygwin*"] } { -+ # testpid is the Cygwin PID, GDB uses the Windows PID, which might be -+ # different due to the way fork/exec works. -+ set testpid [ exec ps -e | gawk "{ if (\$1 == $testpid) print \$4; }" ] -+} -+ -+set GDBFLAGS_orig $GDBFLAGS -+set GDBFLAGS "-iex \"set height 0\" --pid=$testpid" -+gdb_start -+set GDBFLAGS $GDBFLAGS_orig -+ -+gdb_reinitialize_dir $srcdir/$subdir -+ -+# This is a test of gdb's ability to attach to a running process. -+ -+do_attach_tests -+ -+# Test attaching when the target is inside a system call -+ -+gdb_exit -+set testpid [eval exec $binfile2 &] -+exec sleep 3 -+if { [istarget "*-*-cygwin*"] } { -+ # testpid is the Cygwin PID, GDB uses the Windows PID, which might be -+ # different due to the way fork/exec works. -+ set testpid [ exec ps -e | gawk "{ if (\$1 == $testpid) print \$4; }" ] -+} -+ -+set GDBFLAGS_orig $GDBFLAGS -+set GDBFLAGS "-iex \"set height 0\" --pid=$testpid" -+gdb_start -+set GDBFLAGS $GDBFLAGS_orig -+ -+gdb_reinitialize_dir $srcdir/$subdir -+do_call_attach_tests -+ -+return 0 -diff --git a/gdb/testsuite/gdb.base/attach-32b.c b/gdb/testsuite/gdb.base/attach-32b.c -new file mode 100644 ---- /dev/null -+++ b/gdb/testsuite/gdb.base/attach-32b.c -@@ -0,0 +1,24 @@ -+/* This program is intended to be started outside of gdb, and then -+ attached to by gdb. Thus, it simply spins in a loop. The loop -+ is exited when & if the variable 'should_exit' is non-zero. (It -+ is initialized to zero in this program, so the loop will never -+ exit unless/until gdb sets the variable to non-zero.) -+ */ -+#include -+#include -+#include -+ -+int should_exit = 0; -+ -+int main () -+{ -+ int local_i = 0; -+ -+ sleep( 10 ); /* System call causes register fetch to fail */ -+ /* This is a known HPUX "feature" */ -+ while (! should_exit) -+ { -+ local_i++; -+ } -+ return (0); -+} diff --git a/gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch b/gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch index 722c5e9..f5da0e9 100644 --- a/gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch +++ b/gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch @@ -44,7 +44,7 @@ glibc-debuginfo-2.7-2.x86_64: /usr/lib/debug/lib64/libc.so.6.debug: diff --git a/gdb/printcmd.c b/gdb/printcmd.c --- a/gdb/printcmd.c +++ b/gdb/printcmd.c -@@ -1306,6 +1306,10 @@ process_print_command_args (const char *args, value_print_options *print_opts, +@@ -1301,6 +1301,10 @@ process_print_command_args (const char *args, value_print_options *print_opts, if (exp != nullptr && *exp) { diff --git a/gdb-6.5-readline-long-line-crash-test.patch b/gdb-6.5-readline-long-line-crash-test.patch deleted file mode 100644 index 880006c..0000000 --- a/gdb-6.5-readline-long-line-crash-test.patch +++ /dev/null @@ -1,111 +0,0 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Fedora GDB patches -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-6.5-readline-long-line-crash-test.patch - -;; Fix readline segfault on excessively long hand-typed lines. -;;=fedoratest - -https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=214196 - -diff --git a/gdb/testsuite/gdb.base/readline-overflow.exp b/gdb/testsuite/gdb.base/readline-overflow.exp -new file mode 100644 ---- /dev/null -+++ b/gdb/testsuite/gdb.base/readline-overflow.exp -@@ -0,0 +1,96 @@ -+# Copyright 2006 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 2 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, write to the Free Software -+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -+ -+# Please email any bugs, comments, and/or additions to this file to: -+# bug-gdb@prep.ai.mit.edu -+ -+# This file was written by Jan Kratochvil -+ -+# This file is part of the gdb testsuite. -+ -+# -+# Tests for readline buffer overflow. -+# -+ -+if $tracelevel { -+ strace $tracelevel -+} -+ -+global env -+ -+save_vars { env(GDBHISTFILE) env(HISTSIZE) TERM timeout } { -+ # The arrow key test relies on the standard VT100 bindings, so -+ # make sure that an appropriate terminal is selected. The same -+ # bug doesn't show up if we use ^P / ^N instead. -+ setenv TERM vt100 -+ -+ set timeout 600 -+ -+ set env(GDBHISTFILE) "${srcdir}/${subdir}/gdb_history" -+ set env(HISTSIZE) "10" -+ -+ gdb_exit -+ gdb_start -+ gdb_reinitialize_dir $srcdir/$subdir -+ -+ -+ set width 11 -+ gdb_test "set width $width" \ -+ "" \ -+ "Setting width to $width." -+ #gdb_test "set height 1" \ -+ # "" \ -+ # "Setting height to 1." -+ send_gdb "run X" -+ set i 0 -+ # It crashes using `set width 7' on `set total 3560'. -+ # Sometimes it corrupts screen on `set width 7'. -+ # Bugreport used `set total 130001': -+ # https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=214196 -+ # Check also `timeout' above. -+ set total 4200 -+ gdb_expect { -+ -re X { -+ incr i -+ if {$i <= $total} { -+ send_gdb "X" -+ exp_continue -+ } -+ } -+ -re "\[ \b\r\n\]" { -+ exp_continue -+ } -+ eof { -+ fail "gdb sending total $total characters" -+ note "Failed after sending $i characters, reason: EOF" -+ gdb_clear_suppressed -+ } -+ timeout { -+ fail "gdb sending total $total characters" -+ note "Failed after sending $i characters (timeout $timeout), reason: TIMEOUT" -+ gdb_clear_suppressed -+ } -+ default { -+ fail "gdb sending total $total characters" -+ note "Failed after sending $i characters, reason: 0=\[$expect_out(0,string)\] buffer=\[$expect_out(buffer)\]" -+ gdb_clear_suppressed -+ } -+ } -+ send_gdb "\r" -+ gdb_test "" \ -+ "No executable file specified..*" \ -+ "All the characters transferred" -+} diff --git a/gdb-6.6-buildid-locate-rpm-librpm-workaround.patch b/gdb-6.6-buildid-locate-rpm-librpm-workaround.patch index 06b4d57..52bf236 100644 --- a/gdb-6.6-buildid-locate-rpm-librpm-workaround.patch +++ b/gdb-6.6-buildid-locate-rpm-librpm-workaround.patch @@ -6,29 +6,6 @@ Subject: gdb-6.6-buildid-locate-rpm-librpm-workaround.patch ;; Workaround librpm BZ 643031 due to its unexpected exit() calls (BZ 642879). ;;=push+jan -diff --git a/gdb/build-id.c b/gdb/build-id.c ---- a/gdb/build-id.c -+++ b/gdb/build-id.c -@@ -708,6 +708,19 @@ build_id_to_filename (const struct bfd_build_id *build_id, char **link_return) - #include - #endif - -+/* Workarodun https://bugzilla.redhat.com/show_bug.cgi?id=643031 -+ librpm must not exit() an application on SIGINT -+ -+ Enable or disable a signal handler. SIGNUM: signal to enable (or disable -+ if negative). HANDLER: sa_sigaction handler (or NULL to use -+ rpmsqHandler()). Returns: no. of refs, -1 on error. */ -+extern int rpmsqEnable (int signum, /* rpmsqAction_t handler */ void *handler); -+int -+rpmsqEnable (int signum, /* rpmsqAction_t handler */ void *handler) -+{ -+ return 0; -+} -+ - /* This MISSING_RPM_HASH tracker is used to collect all the missing rpm files - and avoid their duplicities during a single inferior run. */ - diff --git a/gdb/proc-service.list b/gdb/proc-service.list --- a/gdb/proc-service.list +++ b/gdb/proc-service.list diff --git a/gdb-6.6-buildid-locate-rpm-scl.patch b/gdb-6.6-buildid-locate-rpm-scl.patch index 6cf86d9..5591809 100644 --- a/gdb-6.6-buildid-locate-rpm-scl.patch +++ b/gdb-6.6-buildid-locate-rpm-scl.patch @@ -9,96 +9,10 @@ Subject: gdb-6.6-buildid-locate-rpm-scl.patch warning: Skipping deprecated .gdb_index section https://bugzilla.redhat.com/show_bug.cgi?id=953585 -diff --git a/gdb/build-id.c b/gdb/build-id.c ---- a/gdb/build-id.c -+++ b/gdb/build-id.c -@@ -742,7 +742,11 @@ static int missing_rpm_list_entries; - /* Returns the count of newly added rpms. */ - - static int -+#ifndef GDB_INDEX_VERIFY_VENDOR - missing_rpm_enlist (const char *filename) -+#else -+missing_rpm_enlist_1 (const char *filename, int verify_vendor) -+#endif - { - static int rpm_init_done = 0; - rpmts ts; -@@ -849,7 +853,11 @@ missing_rpm_enlist (const char *filename) - mi = rpmtsInitIterator_p (ts, RPMTAG_BASENAMES, filename, 0); - if (mi != NULL) - { -+#ifndef GDB_INDEX_VERIFY_VENDOR - for (;;) -+#else -+ if (!verify_vendor) for (;;) -+#endif - { - Header h; - char *debuginfo, **slot, *s, *s2; -@@ -967,6 +975,37 @@ missing_rpm_enlist (const char *filename) - xfree (debuginfo); - count++; - } -+#ifdef GDB_INDEX_VERIFY_VENDOR -+ else /* verify_vendor */ -+ { -+ int vendor_pass = 0, vendor_fail = 0; -+ -+ for (;;) -+ { -+ Header h; -+ errmsg_t err; -+ char *vendor; -+ -+ h = rpmdbNextIterator_p (mi); -+ if (h == NULL) -+ break; -+ -+ vendor = headerFormat_p (h, "%{vendor}", &err); -+ if (!vendor) -+ { -+ warning (_("Error querying the rpm file `%s': %s"), filename, -+ err); -+ continue; -+ } -+ if (strcmp (vendor, "Red Hat, Inc.") == 0) -+ vendor_pass = 1; -+ else -+ vendor_fail = 1; -+ xfree (vendor); -+ } -+ count = vendor_pass != 0 && vendor_fail == 0; -+ } -+#endif - - rpmdbFreeIterator_p (mi); - } -@@ -976,6 +1015,20 @@ missing_rpm_enlist (const char *filename) - return count; - } - -+#ifdef GDB_INDEX_VERIFY_VENDOR -+missing_rpm_enlist (const char *filename) -+{ -+ return missing_rpm_enlist_1 (filename, 0); -+} -+ -+extern int rpm_verify_vendor (const char *filename); -+int -+rpm_verify_vendor (const char *filename) -+{ -+ return missing_rpm_enlist_1 (filename, 1); -+} -+#endif -+ - static bool - missing_rpm_list_compar (const char *ap, const char *bp) - { diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c -@@ -2801,6 +2801,16 @@ read_gdb_index_from_buffer (const char *filename, +@@ -2797,6 +2797,16 @@ read_gdb_index_from_buffer (const char *filename, "set use-deprecated-index-sections on". */ if (version < 6 && !deprecated_ok) { @@ -115,7 +29,7 @@ diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c static int warning_printed = 0; if (!warning_printed) { -@@ -2812,6 +2822,10 @@ to use the section anyway."), +@@ -2808,6 +2818,10 @@ to use the section anyway."), warning_printed = 1; } return 0; diff --git a/gdb-6.6-buildid-locate-rpm.patch b/gdb-6.6-buildid-locate-rpm.patch index e425b97..1a82b8e 100644 --- a/gdb-6.6-buildid-locate-rpm.patch +++ b/gdb-6.6-buildid-locate-rpm.patch @@ -232,457 +232,6 @@ diff --git a/gdb/aclocal.m4 b/gdb/aclocal.m4 # AM_AUX_DIR_EXPAND -*- Autoconf -*- # Copyright (C) 2001-2017 Free Software Foundation, Inc. -diff --git a/gdb/build-id.c b/gdb/build-id.c ---- a/gdb/build-id.c -+++ b/gdb/build-id.c -@@ -33,6 +33,7 @@ - #include "gdb_bfd.h" - #include "gdbcmd.h" - #include "gdbcore.h" -+#include "inferior.h" - #include "objfiles.h" - #include "observable.h" - #include "symfile.h" -@@ -697,8 +698,374 @@ build_id_to_filename (const struct bfd_build_id *build_id, char **link_return) - return result; - } - -+#ifdef HAVE_LIBRPM -+ -+#include -+#include -+#include -+#include -+#ifdef DLOPEN_LIBRPM -+#include -+#endif -+ -+/* This MISSING_RPM_HASH tracker is used to collect all the missing rpm files -+ and avoid their duplicities during a single inferior run. */ -+ -+static struct htab *missing_rpm_hash; -+ -+/* This MISSING_RPM_LIST tracker is used to collect and print as a single line -+ all the rpms right before the nearest GDB prompt. It gets cleared after -+ each such print (it is questionable if we should clear it after the print). -+ */ -+ -+struct missing_rpm -+ { -+ struct missing_rpm *next; -+ char rpm[1]; -+ }; -+static struct missing_rpm *missing_rpm_list; -+static int missing_rpm_list_entries; -+ -+/* Returns the count of newly added rpms. */ -+ -+static int -+missing_rpm_enlist (const char *filename) -+{ -+ static int rpm_init_done = 0; -+ rpmts ts; -+ rpmdbMatchIterator mi; -+ int count = 0; -+ -+#ifdef DLOPEN_LIBRPM -+ /* Duplicate here the declarations to verify they match. The same sanity -+ check is present also in `configure.ac'. */ -+ extern char * headerFormat(Header h, const char * fmt, errmsg_t * errmsg); -+ static char *(*headerFormat_p) (Header h, const char * fmt, errmsg_t *errmsg); -+ extern int rpmReadConfigFiles(const char * file, const char * target); -+ static int (*rpmReadConfigFiles_p) (const char * file, const char * target); -+ extern rpmdbMatchIterator rpmdbFreeIterator(rpmdbMatchIterator mi); -+ static rpmdbMatchIterator (*rpmdbFreeIterator_p) (rpmdbMatchIterator mi); -+ extern Header rpmdbNextIterator(rpmdbMatchIterator mi); -+ static Header (*rpmdbNextIterator_p) (rpmdbMatchIterator mi); -+ extern rpmts rpmtsCreate(void); -+ static rpmts (*rpmtsCreate_p) (void); -+ extern rpmts rpmtsFree(rpmts ts); -+ static rpmts (*rpmtsFree_p) (rpmts ts); -+ extern rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmTag rpmtag, -+ const void * keyp, size_t keylen); -+ static rpmdbMatchIterator (*rpmtsInitIterator_p) (const rpmts ts, -+ rpmTag rpmtag, -+ const void *keyp, -+ size_t keylen); -+#else /* !DLOPEN_LIBRPM */ -+# define headerFormat_p headerFormat -+# define rpmReadConfigFiles_p rpmReadConfigFiles -+# define rpmdbFreeIterator_p rpmdbFreeIterator -+# define rpmdbNextIterator_p rpmdbNextIterator -+# define rpmtsCreate_p rpmtsCreate -+# define rpmtsFree_p rpmtsFree -+# define rpmtsInitIterator_p rpmtsInitIterator -+#endif /* !DLOPEN_LIBRPM */ -+ -+ gdb_assert (filename != NULL); -+ -+ if (strcmp (filename, BUILD_ID_MAIN_EXECUTABLE_FILENAME) == 0) -+ return 0; -+ -+ if (is_target_filename (filename)) -+ return 0; -+ -+ if (filename[0] != '/') -+ { -+ warning (_("Ignoring non-absolute filename: <%s>"), filename); -+ return 0; -+ } -+ -+ if (!rpm_init_done) -+ { -+ static int init_tried; -+ -+ /* Already failed the initialization before? */ -+ if (init_tried) -+ return 0; -+ init_tried = 1; -+ -+#ifdef DLOPEN_LIBRPM -+ { -+ void *h; -+ -+ h = dlopen (DLOPEN_LIBRPM, RTLD_LAZY); -+ if (!h) -+ { -+ warning (_("Unable to open \"%s\" (%s), " -+ "missing debuginfos notifications will not be displayed"), -+ DLOPEN_LIBRPM, dlerror ()); -+ return 0; -+ } -+ -+ if (!((headerFormat_p = (char *(*) (Header h, const char * fmt, errmsg_t *errmsg)) dlsym (h, "headerFormat")) -+ && (rpmReadConfigFiles_p = (int (*) (const char * file, const char * target)) dlsym (h, "rpmReadConfigFiles")) -+ && (rpmdbFreeIterator_p = (rpmdbMatchIterator (*) (rpmdbMatchIterator mi)) dlsym (h, "rpmdbFreeIterator")) -+ && (rpmdbNextIterator_p = (Header (*) (rpmdbMatchIterator mi)) dlsym (h, "rpmdbNextIterator")) -+ && (rpmtsCreate_p = (rpmts (*) (void)) dlsym (h, "rpmtsCreate")) -+ && (rpmtsFree_p = (rpmts (*) (rpmts ts)) dlsym (h, "rpmtsFree")) -+ && (rpmtsInitIterator_p = (rpmdbMatchIterator (*) (const rpmts ts, rpmTag rpmtag, const void *keyp, size_t keylen)) dlsym (h, "rpmtsInitIterator")))) -+ { -+ warning (_("Opened library \"%s\" is incompatible (%s), " -+ "missing debuginfos notifications will not be displayed"), -+ DLOPEN_LIBRPM, dlerror ()); -+ if (dlclose (h)) -+ warning (_("Error closing library \"%s\": %s\n"), DLOPEN_LIBRPM, -+ dlerror ()); -+ return 0; -+ } -+ } -+#endif /* DLOPEN_LIBRPM */ -+ -+ if (rpmReadConfigFiles_p (NULL, NULL) != 0) -+ { -+ warning (_("Error reading the rpm configuration files")); -+ return 0; -+ } -+ -+ rpm_init_done = 1; -+ } -+ -+ ts = rpmtsCreate_p (); -+ -+ mi = rpmtsInitIterator_p (ts, RPMTAG_BASENAMES, filename, 0); -+ if (mi != NULL) -+ { -+ for (;;) -+ { -+ Header h; -+ char *debuginfo, **slot, *s, *s2; -+ errmsg_t err; -+ size_t srcrpmlen = sizeof (".src.rpm") - 1; -+ size_t debuginfolen = sizeof ("-debuginfo") - 1; -+ rpmdbMatchIterator mi_debuginfo; -+ -+ h = rpmdbNextIterator_p (mi); -+ if (h == NULL) -+ break; -+ -+ /* Verify the debuginfo file is not already installed. */ -+ -+ debuginfo = headerFormat_p (h, "%{sourcerpm}-debuginfo.%{arch}", -+ &err); -+ if (!debuginfo) -+ { -+ warning (_("Error querying the rpm file `%s': %s"), filename, -+ err); -+ continue; -+ } -+ /* s = `.src.rpm-debuginfo.%{arch}' */ -+ s = strrchr (debuginfo, '-') - srcrpmlen; -+ s2 = NULL; -+ if (s > debuginfo && memcmp (s, ".src.rpm", srcrpmlen) == 0) -+ { -+ /* s2 = `-%{release}.src.rpm-debuginfo.%{arch}' */ -+ s2 = (char *) memrchr (debuginfo, '-', s - debuginfo); -+ } -+ if (s2) -+ { -+ /* s2 = `-%{version}-%{release}.src.rpm-debuginfo.%{arch}' */ -+ s2 = (char *) memrchr (debuginfo, '-', s2 - debuginfo); -+ } -+ if (!s2) -+ { -+ warning (_("Error querying the rpm file `%s': %s"), filename, -+ debuginfo); -+ xfree (debuginfo); -+ continue; -+ } -+ /* s = `.src.rpm-debuginfo.%{arch}' */ -+ /* s2 = `-%{version}-%{release}.src.rpm-debuginfo.%{arch}' */ -+ memmove (s2 + debuginfolen, s2, s - s2); -+ memcpy (s2, "-debuginfo", debuginfolen); -+ /* s = `XXXX.%{arch}' */ -+ /* strlen ("XXXX") == srcrpmlen + debuginfolen */ -+ /* s2 = `-debuginfo-%{version}-%{release}XX.%{arch}' */ -+ /* strlen ("XX") == srcrpmlen */ -+ memmove (s + debuginfolen, s + srcrpmlen + debuginfolen, -+ strlen (s + srcrpmlen + debuginfolen) + 1); -+ /* s = `-debuginfo-%{version}-%{release}.%{arch}' */ -+ -+ /* RPMDBI_PACKAGES requires keylen == sizeof (int). */ -+ /* RPMDBI_LABEL is an interface for NVR-based dbiFindByLabel(). */ -+ mi_debuginfo = rpmtsInitIterator_p (ts, (rpmTag) RPMDBI_LABEL, debuginfo, 0); -+ xfree (debuginfo); -+ if (mi_debuginfo) -+ { -+ rpmdbFreeIterator_p (mi_debuginfo); -+ count = 0; -+ break; -+ } -+ -+ /* The allocated memory gets utilized below for MISSING_RPM_HASH. */ -+ debuginfo = headerFormat_p (h, -+ "%{name}-%{version}-%{release}.%{arch}", -+ &err); -+ if (!debuginfo) -+ { -+ warning (_("Error querying the rpm file `%s': %s"), filename, -+ err); -+ continue; -+ } -+ -+ /* Base package name for `debuginfo-install'. We do not use the -+ `yum' command directly as the line -+ yum --enablerepo='*debug*' install NAME-debuginfo.ARCH -+ would be more complicated than just: -+ debuginfo-install NAME-VERSION-RELEASE.ARCH -+ Do not supply the rpm base name (derived from .src.rpm name) as -+ debuginfo-install is unable to install the debuginfo package if -+ the base name PKG binary rpm is not installed while for example -+ PKG-libs would be installed (RH Bug 467901). -+ FUTURE: After multiple debuginfo versions simultaneously installed -+ get supported the support for the VERSION-RELEASE tags handling -+ may need an update. */ -+ -+ if (missing_rpm_hash == NULL) -+ { -+ /* DEL_F is passed NULL as MISSING_RPM_LIST's HTAB_DELETE -+ should not deallocate the entries. */ -+ -+ missing_rpm_hash = htab_create_alloc (64, htab_hash_string, -+ (int (*) (const void *, const void *)) streq, -+ NULL, xcalloc, xfree); -+ } -+ slot = (char **) htab_find_slot (missing_rpm_hash, debuginfo, INSERT); -+ /* XCALLOC never returns NULL. */ -+ gdb_assert (slot != NULL); -+ if (*slot == NULL) -+ { -+ struct missing_rpm *missing_rpm; -+ -+ *slot = debuginfo; -+ -+ missing_rpm = (struct missing_rpm *) xmalloc (sizeof (*missing_rpm) + strlen (debuginfo)); -+ strcpy (missing_rpm->rpm, debuginfo); -+ missing_rpm->next = missing_rpm_list; -+ missing_rpm_list = missing_rpm; -+ missing_rpm_list_entries++; -+ } -+ else -+ xfree (debuginfo); -+ count++; -+ } -+ -+ rpmdbFreeIterator_p (mi); -+ } -+ -+ rpmtsFree_p (ts); -+ -+ return count; -+} -+ -+static bool -+missing_rpm_list_compar (const char *ap, const char *bp) -+{ -+ return strcoll (ap, bp) < 0; -+} -+ -+/* It returns a NULL-terminated array of strings needing to be FREEd. It may -+ also return only NULL. */ -+ -+static void -+missing_rpm_list_print (void) -+{ -+ struct missing_rpm *list_iter; -+ -+ if (missing_rpm_list_entries == 0) -+ return; -+ -+ std::vector array (missing_rpm_list_entries); -+ size_t idx = 0; -+ -+ for (list_iter = missing_rpm_list; list_iter != NULL; -+ list_iter = list_iter->next) -+ { -+ array[idx++] = list_iter->rpm; -+ } -+ gdb_assert (idx == missing_rpm_list_entries); -+ -+ std::sort (array.begin (), array.end (), missing_rpm_list_compar); -+ -+ /* We zero out the number of missing RPMs here because of a nasty -+ bug (see RHBZ 1801974). -+ -+ When we call 'puts_unfiltered' below, if pagination is on and if -+ the number of missing RPMs is big enough to trigger pagination, -+ we will end up in an infinite recursion. The call chain looks -+ like this: -+ -+ missing_rpm_list_print -> puts_unfiltered -> fputs_maybe_filtered -+ -> prompt_for_continue -> display_gdb_prompt -> -+ debug_flush_missing -> missing_rpm_list_print ... -+ -+ For this reason, we make sure MISSING_RPM_LIST_ENTRIES is zero -+ *before* calling any print function. */ -+ missing_rpm_list_entries = 0; -+ -+ printf_unfiltered (_("Missing separate debuginfos, use: %s"), -+#ifdef DNF_DEBUGINFO_INSTALL -+ "dnf " -+#endif -+ "debuginfo-install"); -+ for (const char *el : array) -+ { -+ puts_unfiltered (" "); -+ puts_unfiltered (el); -+ } -+ puts_unfiltered ("\n"); -+ -+ while (missing_rpm_list != NULL) -+ { -+ list_iter = missing_rpm_list; -+ missing_rpm_list = list_iter->next; -+ xfree (list_iter); -+ } -+} -+ -+static void -+missing_rpm_change (void) -+{ -+ debug_flush_missing (); -+ -+ gdb_assert (missing_rpm_list == NULL); -+ if (missing_rpm_hash != NULL) -+ { -+ htab_delete (missing_rpm_hash); -+ missing_rpm_hash = NULL; -+ } -+} -+ -+enum missing_exec -+ { -+ /* Init state. EXEC_BFD also still could be NULL. */ -+ MISSING_EXEC_NOT_TRIED, -+ /* We saw a non-NULL EXEC_BFD but RPM has no info about it. */ -+ MISSING_EXEC_NOT_FOUND, -+ /* We found EXEC_BFD by RPM and we either have its symbols (either embedded -+ or separate) or the main executable's RPM is now contained in -+ MISSING_RPM_HASH. */ -+ MISSING_EXEC_ENLISTED -+ }; -+static enum missing_exec missing_exec = MISSING_EXEC_NOT_TRIED; -+ -+#endif /* HAVE_LIBRPM */ -+ -+void -+debug_flush_missing (void) -+{ -+#ifdef HAVE_LIBRPM -+ missing_rpm_list_print (); -+#endif -+} -+ - /* This MISSING_FILEPAIR_HASH tracker is used only for the duplicite messages -- Try to install the hash file ... -+ yum --enablerepo='*debug*' install ... - avoidance. */ - - struct missing_filepair -@@ -752,11 +1119,17 @@ missing_filepair_change (void) - /* All their memory came just from missing_filepair_OBSTACK. */ - missing_filepair_hash = NULL; - } -+#ifdef HAVE_LIBRPM -+ missing_exec = MISSING_EXEC_NOT_TRIED; -+#endif - } - - static void - debug_print_executable_changed (void) - { -+#ifdef HAVE_LIBRPM -+ missing_rpm_change (); -+#endif - missing_filepair_change (); - } - -@@ -823,14 +1196,38 @@ debug_print_missing (const char *binary, const char *debug) - - *slot = missing_filepair; - -- /* We do not collect and flush these messages as each such message -- already requires its own separate lines. */ -+#ifdef HAVE_LIBRPM -+ if (missing_exec == MISSING_EXEC_NOT_TRIED) -+ { -+ const char *execfilename = get_exec_file (0); - -- fprintf_unfiltered (gdb_stdlog, -- _("Missing separate debuginfo for %s\n"), binary); -- if (debug != NULL) -- fprintf_unfiltered (gdb_stdlog, _("Try to install the hash file %s\n"), -- debug); -+ if (execfilename != NULL) -+ { -+ if (missing_rpm_enlist (execfilename) == 0) -+ missing_exec = MISSING_EXEC_NOT_FOUND; -+ else -+ missing_exec = MISSING_EXEC_ENLISTED; -+ } -+ } -+ if (missing_exec != MISSING_EXEC_ENLISTED) -+ if ((binary[0] == 0 || missing_rpm_enlist (binary) == 0) -+ && (debug == NULL || missing_rpm_enlist (debug) == 0)) -+#endif /* HAVE_LIBRPM */ -+ { -+ /* We do not collect and flush these messages as each such message -+ already requires its own separate lines. */ -+ -+ fprintf_unfiltered (gdb_stdlog, -+ _("Missing separate debuginfo for %s\n"), binary); -+ if (debug != NULL) -+ fprintf_unfiltered (gdb_stdlog, _("Try: %s %s\n"), -+#ifdef DNF_DEBUGINFO_INSTALL -+ "dnf" -+#else -+ "yum" -+#endif -+ " --enablerepo='*debug*' install", debug); -+ } - } - - /* See build-id.h. */ diff --git a/gdb/config.in b/gdb/config.in --- a/gdb/config.in +++ b/gdb/config.in @@ -696,7 +245,7 @@ diff --git a/gdb/config.in b/gdb/config.in /* Define to 1 if translation of program messages to the user's native language is requested. */ #undef ENABLE_NLS -@@ -246,6 +249,9 @@ +@@ -259,6 +262,9 @@ /* Define if you have the mpfr library. */ #undef HAVE_LIBMPFR @@ -709,9 +258,9 @@ diff --git a/gdb/config.in b/gdb/config.in diff --git a/gdb/configure b/gdb/configure --- a/gdb/configure +++ b/gdb/configure -@@ -771,6 +771,11 @@ PKG_CONFIG - HAVE_NATIVE_GCORE_TARGET - TARGET_OBS +@@ -775,6 +775,11 @@ TARGET_OBS + ENABLE_BFD_64_BIT_FALSE + ENABLE_BFD_64_BIT_TRUE subdirs +RPM_LIBS +RPM_CFLAGS @@ -721,7 +270,7 @@ diff --git a/gdb/configure b/gdb/configure GDB_DATADIR DEBUGDIR MAKEINFO_EXTRA_FLAGS -@@ -876,6 +881,7 @@ with_gdb_datadir +@@ -880,6 +885,7 @@ with_gdb_datadir with_relocated_sources with_auto_load_dir with_auto_load_safe_path @@ -729,7 +278,7 @@ diff --git a/gdb/configure b/gdb/configure enable_targets enable_64_bit_bfd enable_gdbmi -@@ -953,6 +959,8 @@ PKG_CONFIG_PATH +@@ -959,6 +965,8 @@ PKG_CONFIG_PATH PKG_CONFIG_LIBDIR DEBUGINFOD_CFLAGS DEBUGINFOD_LIBS @@ -738,7 +287,7 @@ diff --git a/gdb/configure b/gdb/configure YACC YFLAGS XMKMF' -@@ -1625,6 +1633,8 @@ Optional Packages: +@@ -1635,6 +1643,8 @@ Optional Packages: do not restrict auto-loaded files locations --with-debuginfod Enable debuginfo lookups with debuginfod (auto/yes/no) @@ -747,7 +296,7 @@ diff --git a/gdb/configure b/gdb/configure --with-libunwind-ia64 use libunwind frame unwinding for ia64 targets --with-curses use the curses library instead of the termcap library -@@ -1705,6 +1715,8 @@ Some influential environment variables: +@@ -1715,6 +1725,8 @@ Some influential environment variables: C compiler flags for DEBUGINFOD, overriding pkg-config DEBUGINFOD_LIBS linker flags for DEBUGINFOD, overriding pkg-config @@ -756,7 +305,7 @@ diff --git a/gdb/configure b/gdb/configure YACC The `Yet Another Compiler Compiler' implementation to use. Defaults to the first program found out of: `bison -y', `byacc', `yacc'. -@@ -6616,6 +6628,494 @@ _ACEOF +@@ -6634,6 +6646,494 @@ _ACEOF { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_auto_load_safe_path" >&5 $as_echo "$with_auto_load_safe_path" >&6; } @@ -1457,15 +1006,15 @@ diff --git a/gdb/configure.ac b/gdb/configure.ac diff --git a/gdb/event-top.c b/gdb/event-top.c --- a/gdb/event-top.c +++ b/gdb/event-top.c -@@ -41,6 +41,7 @@ - #include "gdbsupport/gdb_select.h" +@@ -42,6 +42,7 @@ #include "gdbsupport/gdb-sigmask.h" #include "async-event.h" + #include "bt-utils.h" +#include "symfile.h" /* readline include files. */ #include "readline/readline.h" -@@ -363,6 +364,8 @@ display_gdb_prompt (const char *new_prompt) +@@ -374,6 +375,8 @@ display_gdb_prompt (const char *new_prompt) /* Reset the nesting depth used when trace-commands is set. */ reset_command_nest_depth (); @@ -1474,7 +1023,7 @@ diff --git a/gdb/event-top.c b/gdb/event-top.c /* Do not call the python hook on an explicit prompt change as passed to this function, as this forms a secondary/local prompt, IE, displayed but not set. */ -@@ -773,7 +776,10 @@ command_line_handler (gdb::unique_xmalloc_ptr &&rl) +@@ -800,7 +803,10 @@ command_line_handler (gdb::unique_xmalloc_ptr &&rl) command_handler (cmd); if (ui->prompt_state != PROMPTED) diff --git a/gdb-6.6-buildid-locate-solib-missing-ids.patch b/gdb-6.6-buildid-locate-solib-missing-ids.patch index 0c80173..f357444 100644 --- a/gdb-6.6-buildid-locate-solib-missing-ids.patch +++ b/gdb-6.6-buildid-locate-solib-missing-ids.patch @@ -14,7 +14,7 @@ https://bugzilla.redhat.com/show_bug.cgi?id=1339862 diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c --- a/gdb/solib-svr4.c +++ b/gdb/solib-svr4.c -@@ -1350,14 +1350,28 @@ svr4_read_so_list (svr4_info *info, CORE_ADDR lm, CORE_ADDR prev_lm, +@@ -1250,14 +1250,28 @@ svr4_read_so_list (svr4_info *info, CORE_ADDR lm, CORE_ADDR prev_lm, } { @@ -45,7 +45,7 @@ diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c if (build_id != NULL) { char *name, *build_id_filename; -@@ -1372,23 +1386,7 @@ svr4_read_so_list (svr4_info *info, CORE_ADDR lm, CORE_ADDR prev_lm, +@@ -1272,23 +1286,7 @@ svr4_read_so_list (svr4_info *info, CORE_ADDR lm, CORE_ADDR prev_lm, xfree (name); } else diff --git a/gdb-6.6-buildid-locate.patch b/gdb-6.6-buildid-locate.patch index a96c372..8b516a8 100644 --- a/gdb-6.6-buildid-locate.patch +++ b/gdb-6.6-buildid-locate.patch @@ -33,7 +33,7 @@ diff --git a/bfd/libbfd.h b/bfd/libbfd.h diff --git a/gdb/build-id.c b/gdb/build-id.c --- a/gdb/build-id.c +++ b/gdb/build-id.c -@@ -24,13 +24,70 @@ +@@ -24,13 +24,71 @@ #include "gdbsupport/gdb_vecs.h" #include "symfile.h" #include "objfiles.h" @@ -46,6 +46,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c +#include "gdb_bfd.h" +#include "gdbcmd.h" #include "gdbcore.h" ++#include "inferior.h" +#include "objfiles.h" +#include "observable.h" +#include "symfile.h" @@ -105,7 +106,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c { if (!bfd_check_format (abfd, bfd_object) && !bfd_check_format (abfd, bfd_core)) -@@ -43,6 +100,348 @@ build_id_bfd_get (bfd *abfd) +@@ -43,6 +101,348 @@ build_id_bfd_get (bfd *abfd) return NULL; } @@ -454,7 +455,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c /* See build-id.h. */ int -@@ -51,7 +450,7 @@ build_id_verify (bfd *abfd, size_t check_len, const bfd_byte *check) +@@ -51,7 +451,7 @@ build_id_verify (bfd *abfd, size_t check_len, const bfd_byte *check) const struct bfd_build_id *found; int retval = 0; @@ -463,14 +464,15 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c if (found == NULL) warning (_("File \"%s\" has no build-id, file skipped"), -@@ -66,56 +465,159 @@ build_id_verify (bfd *abfd, size_t check_len, const bfd_byte *check) +@@ -66,63 +466,166 @@ build_id_verify (bfd *abfd, size_t check_len, const bfd_byte *check) return retval; } +static char * +link_resolve (const char *symlink, int level) +{ -+ char buf[PATH_MAX + 1], *target, *retval; ++ char buf[PATH_MAX + 1], *retval; ++ gdb::unique_xmalloc_ptr target; + ssize_t got; + + if (level > 10) @@ -482,7 +484,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c + buf[got] = '\0'; + + if (IS_ABSOLUTE_PATH (buf)) -+ target = xstrdup (buf); ++ target = make_unique_xstrdup (buf); + else + { + const std::string dir (ldirname (symlink)); @@ -496,8 +498,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c + "%s", dir.c_str(), buf); + } + -+ retval = link_resolve (target, level + 1); -+ xfree (target); ++ retval = link_resolve (target.get (), level + 1); + return retval; +} + @@ -516,42 +517,49 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c + if (separate_debug_file_debug) { -- printf_unfiltered (_(" Trying %s..."), link.c_str ()); -+ printf_unfiltered (_(" Trying %s..."), orig_link.c_str ()); - gdb_flush (gdb_stdout); +- fprintf_unfiltered (gdb_stdlog, _(" Trying %s..."), link.c_str ()); +- gdb_flush (gdb_stdlog); ++ fprintf_unfiltered (gdb_stdlog, _(" Trying %s..."), orig_link.c_str ()); ++ gdb_flush (gdb_stdout); } - /* lrealpath() is expensive even for the usually non-existent files. */ -- gdb::unique_xmalloc_ptr filename; -- if (access (link.c_str (), F_OK) == 0) -- filename.reset (lrealpath (link.c_str ())); -- -- if (filename == NULL) +- gdb::unique_xmalloc_ptr filename_holder; +- const char *filename = nullptr; +- if (startswith (link, TARGET_SYSROOT_PREFIX)) +- filename = link.c_str (); +- else if (access (link.c_str (), F_OK) == 0) + for (unsigned seqno = 0;; seqno++) { -- if (separate_debug_file_debug) -- printf_unfiltered (_(" no, unable to compute real path\n")); +- filename_holder.reset (lrealpath (link.c_str ())); +- filename = filename_holder.get (); +- } + std::string link = orig_link; -- return {}; -- } +- if (filename == NULL) +- { +- if (separate_debug_file_debug) +- fprintf_unfiltered (gdb_stdlog, +- _(" no, unable to compute real path\n")); + if (seqno > 0) + { + /* There can be multiple build-id symlinks pointing to real files + with the same build-id (such as hard links). Some of the real + files may not be installed. */ -+ + +- return {}; +- } + string_appendf (link, ".%u", seqno); + } - /* We expect to be silent on the non-existing files. */ -- gdb_bfd_ref_ptr debug_bfd = gdb_bfd_open (filename.get (), gnutarget); +- gdb_bfd_ref_ptr debug_bfd = gdb_bfd_open (filename, gnutarget); + ret_link = link; - if (debug_bfd == NULL) - { - if (separate_debug_file_debug) -- printf_unfiltered (_(" no, unable to open.\n")); +- fprintf_unfiltered (gdb_stdlog, _(" no, unable to open.\n")); + struct stat statbuf_trash; + + /* `access' automatically dereferences LINK. */ @@ -562,35 +570,42 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c + } + + /* lrealpath() is expensive even for the usually non-existent files. */ -+ gdb::unique_xmalloc_ptr filename; -+ -+ if (access (link.c_str (), F_OK) == 0) -+ filename.reset (lrealpath (link.c_str ())); ++ gdb::unique_xmalloc_ptr filename_holder; ++ const char *filename = nullptr; ++ if (startswith (link, TARGET_SYSROOT_PREFIX)) ++ filename = link.c_str (); ++ else if (access (link.c_str (), F_OK) == 0) ++ { ++ filename_holder.reset (lrealpath (link.c_str ())); ++ filename = filename_holder.get (); ++ } + + if (filename == NULL) + { + if (separate_debug_file_debug) -+ printf_unfiltered (_(" no, unable to compute real path\n")); ++ fprintf_unfiltered (gdb_stdlog, ++ _(" no, unable to compute real path\n")); + + continue; + } + + /* We expect to be silent on the non-existing files. */ -+ gdb_bfd_ref_ptr debug_bfd = gdb_bfd_open (filename.get (), gnutarget, -1); - -- return {}; ++ gdb_bfd_ref_ptr debug_bfd = gdb_bfd_open (filename, gnutarget); ++ + if (debug_bfd == NULL) + { + if (separate_debug_file_debug) -+ printf_unfiltered (_(" no, unable to open.\n")); -+ ++ fprintf_unfiltered (gdb_stdlog, _(" no, unable to open.\n")); + +- return {}; + continue; + } + + if (!build_id_verify (debug_bfd.get(), build_id_len, build_id)) + { + if (separate_debug_file_debug) -+ printf_unfiltered (_(" no, build-id does not match.\n")); ++ fprintf_unfiltered (gdb_stdlog, ++ _(" no, build-id does not match.\n")); + + continue; + } @@ -605,17 +620,16 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c + if (ret_bfd != NULL) { if (separate_debug_file_debug) -- printf_unfiltered (_(" no, build-id does not match.\n")); -- -- return {}; -+ printf_unfiltered (_(" yes!\n")); +- fprintf_unfiltered (gdb_stdlog, _(" no, build-id does not match.\n")); ++ fprintf_unfiltered (gdb_stdlog, _(" yes!\n")); + } + else + { + /* If none of the real files is found report as missing file + always the non-.%u-suffixed file. */ + std::string link0 = orig_link; -+ + +- return {}; + /* If the symlink has target request to install the target. + BASE-debuginfo.rpm contains the symlink but BASE.rpm may be missing. + https://bugzilla.redhat.com/show_bug.cgi?id=981154 */ @@ -632,7 +646,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c } - if (separate_debug_file_debug) -- printf_unfiltered (_(" yes!\n")); +- fprintf_unfiltered (gdb_stdlog, _(" yes!\n")); + if (link_return != NULL) + { + if (ret_bfd != NULL) @@ -650,7 +664,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c } /* Common code for finding BFDs of a given build-id. This function -@@ -124,7 +626,7 @@ build_id_to_debug_bfd_1 (const std::string &link, size_t build_id_len, +@@ -131,7 +634,7 @@ build_id_to_debug_bfd_1 (const std::string &link, size_t build_id_len, static gdb_bfd_ref_ptr build_id_to_bfd_suffix (size_t build_id_len, const bfd_byte *build_id, @@ -659,7 +673,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c { /* Keep backward compatibility so that DEBUG_FILE_DIRECTORY being "" will cause "/.build-id/..." lookups. */ -@@ -147,16 +649,17 @@ build_id_to_bfd_suffix (size_t build_id_len, const bfd_byte *build_id, +@@ -154,16 +657,17 @@ build_id_to_bfd_suffix (size_t build_id_len, const bfd_byte *build_id, if (size > 0) { size--; @@ -680,8 +694,8 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c if (debug_bfd != NULL) return debug_bfd; -@@ -170,7 +673,8 @@ build_id_to_bfd_suffix (size_t build_id_len, const bfd_byte *build_id, - if (strcmp (gdb_sysroot, TARGET_SYSROOT_PREFIX) != 0) +@@ -174,7 +678,8 @@ build_id_to_bfd_suffix (size_t build_id_len, const bfd_byte *build_id, + if (!gdb_sysroot.empty ()) { link = gdb_sysroot + link; - debug_bfd = build_id_to_debug_bfd_1 (link, build_id_len, build_id); @@ -690,7 +704,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c if (debug_bfd != NULL) return debug_bfd; } -@@ -179,38 +683,208 @@ build_id_to_bfd_suffix (size_t build_id_len, const bfd_byte *build_id, +@@ -183,30 +688,649 @@ build_id_to_bfd_suffix (size_t build_id_len, const bfd_byte *build_id, return {}; } @@ -708,8 +722,440 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c + return result; +} + ++#ifdef HAVE_LIBRPM ++ ++#include ++#include ++#include ++#include ++#ifdef DLOPEN_LIBRPM ++#include ++#endif ++ ++/* Workarodun https://bugzilla.redhat.com/show_bug.cgi?id=643031 ++ librpm must not exit() an application on SIGINT ++ ++ Enable or disable a signal handler. SIGNUM: signal to enable (or disable ++ if negative). HANDLER: sa_sigaction handler (or NULL to use ++ rpmsqHandler()). Returns: no. of refs, -1 on error. */ ++extern int rpmsqEnable (int signum, /* rpmsqAction_t handler */ void *handler); ++int ++rpmsqEnable (int signum, /* rpmsqAction_t handler */ void *handler) ++{ ++ return 0; ++} ++ ++/* This MISSING_RPM_HASH tracker is used to collect all the missing rpm files ++ and avoid their duplicities during a single inferior run. */ ++ ++static struct htab *missing_rpm_hash; ++ ++/* This MISSING_RPM_LIST tracker is used to collect and print as a single line ++ all the rpms right before the nearest GDB prompt. It gets cleared after ++ each such print (it is questionable if we should clear it after the print). ++ */ ++ ++struct missing_rpm ++ { ++ struct missing_rpm *next; ++ char rpm[1]; ++ }; ++static struct missing_rpm *missing_rpm_list; ++static int missing_rpm_list_entries; ++ ++/* Returns the count of newly added rpms. */ ++ ++static int ++#ifndef GDB_INDEX_VERIFY_VENDOR ++missing_rpm_enlist (const char *filename) ++#else ++missing_rpm_enlist_1 (const char *filename, int verify_vendor) ++#endif ++{ ++ static int rpm_init_done = 0; ++ rpmts ts; ++ rpmdbMatchIterator mi; ++ int count = 0; ++ ++#ifdef DLOPEN_LIBRPM ++ /* Duplicate here the declarations to verify they match. The same sanity ++ check is present also in `configure.ac'. */ ++ extern char * headerFormat(Header h, const char * fmt, errmsg_t * errmsg); ++ static char *(*headerFormat_p) (Header h, const char * fmt, errmsg_t *errmsg); ++ extern int rpmReadConfigFiles(const char * file, const char * target); ++ static int (*rpmReadConfigFiles_p) (const char * file, const char * target); ++ extern rpmdbMatchIterator rpmdbFreeIterator(rpmdbMatchIterator mi); ++ static rpmdbMatchIterator (*rpmdbFreeIterator_p) (rpmdbMatchIterator mi); ++ extern Header rpmdbNextIterator(rpmdbMatchIterator mi); ++ static Header (*rpmdbNextIterator_p) (rpmdbMatchIterator mi); ++ extern rpmts rpmtsCreate(void); ++ static rpmts (*rpmtsCreate_p) (void); ++ extern rpmts rpmtsFree(rpmts ts); ++ static rpmts (*rpmtsFree_p) (rpmts ts); ++ extern rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmTag rpmtag, ++ const void * keyp, size_t keylen); ++ static rpmdbMatchIterator (*rpmtsInitIterator_p) (const rpmts ts, ++ rpmTag rpmtag, ++ const void *keyp, ++ size_t keylen); ++#else /* !DLOPEN_LIBRPM */ ++# define headerFormat_p headerFormat ++# define rpmReadConfigFiles_p rpmReadConfigFiles ++# define rpmdbFreeIterator_p rpmdbFreeIterator ++# define rpmdbNextIterator_p rpmdbNextIterator ++# define rpmtsCreate_p rpmtsCreate ++# define rpmtsFree_p rpmtsFree ++# define rpmtsInitIterator_p rpmtsInitIterator ++#endif /* !DLOPEN_LIBRPM */ ++ ++ gdb_assert (filename != NULL); ++ ++ if (strcmp (filename, BUILD_ID_MAIN_EXECUTABLE_FILENAME) == 0) ++ return 0; ++ ++ if (is_target_filename (filename)) ++ return 0; ++ ++ if (filename[0] != '/') ++ { ++ warning (_("Ignoring non-absolute filename: <%s>"), filename); ++ return 0; ++ } ++ ++ if (!rpm_init_done) ++ { ++ static int init_tried; ++ ++ /* Already failed the initialization before? */ ++ if (init_tried) ++ return 0; ++ init_tried = 1; ++ ++#ifdef DLOPEN_LIBRPM ++ { ++ void *h; ++ ++ h = dlopen (DLOPEN_LIBRPM, RTLD_LAZY); ++ if (!h) ++ { ++ warning (_("Unable to open \"%s\" (%s), " ++ "missing debuginfos notifications will not be displayed"), ++ DLOPEN_LIBRPM, dlerror ()); ++ return 0; ++ } ++ ++ if (!((headerFormat_p = (char *(*) (Header h, const char * fmt, errmsg_t *errmsg)) dlsym (h, "headerFormat")) ++ && (rpmReadConfigFiles_p = (int (*) (const char * file, const char * target)) dlsym (h, "rpmReadConfigFiles")) ++ && (rpmdbFreeIterator_p = (rpmdbMatchIterator (*) (rpmdbMatchIterator mi)) dlsym (h, "rpmdbFreeIterator")) ++ && (rpmdbNextIterator_p = (Header (*) (rpmdbMatchIterator mi)) dlsym (h, "rpmdbNextIterator")) ++ && (rpmtsCreate_p = (rpmts (*) (void)) dlsym (h, "rpmtsCreate")) ++ && (rpmtsFree_p = (rpmts (*) (rpmts ts)) dlsym (h, "rpmtsFree")) ++ && (rpmtsInitIterator_p = (rpmdbMatchIterator (*) (const rpmts ts, rpmTag rpmtag, const void *keyp, size_t keylen)) dlsym (h, "rpmtsInitIterator")))) ++ { ++ warning (_("Opened library \"%s\" is incompatible (%s), " ++ "missing debuginfos notifications will not be displayed"), ++ DLOPEN_LIBRPM, dlerror ()); ++ if (dlclose (h)) ++ warning (_("Error closing library \"%s\": %s\n"), DLOPEN_LIBRPM, ++ dlerror ()); ++ return 0; ++ } ++ } ++#endif /* DLOPEN_LIBRPM */ ++ ++ if (rpmReadConfigFiles_p (NULL, NULL) != 0) ++ { ++ warning (_("Error reading the rpm configuration files")); ++ return 0; ++ } ++ ++ rpm_init_done = 1; ++ } ++ ++ ts = rpmtsCreate_p (); ++ ++ mi = rpmtsInitIterator_p (ts, RPMTAG_BASENAMES, filename, 0); ++ if (mi != NULL) ++ { ++#ifndef GDB_INDEX_VERIFY_VENDOR ++ for (;;) ++#else ++ if (!verify_vendor) for (;;) ++#endif ++ { ++ Header h; ++ char *debuginfo, **slot, *s, *s2; ++ errmsg_t err; ++ size_t srcrpmlen = sizeof (".src.rpm") - 1; ++ size_t debuginfolen = sizeof ("-debuginfo") - 1; ++ rpmdbMatchIterator mi_debuginfo; ++ ++ h = rpmdbNextIterator_p (mi); ++ if (h == NULL) ++ break; ++ ++ /* Verify the debuginfo file is not already installed. */ ++ ++ debuginfo = headerFormat_p (h, "%{sourcerpm}-debuginfo.%{arch}", ++ &err); ++ if (!debuginfo) ++ { ++ warning (_("Error querying the rpm file `%s': %s"), filename, ++ err); ++ continue; ++ } ++ /* s = `.src.rpm-debuginfo.%{arch}' */ ++ s = strrchr (debuginfo, '-') - srcrpmlen; ++ s2 = NULL; ++ if (s > debuginfo && memcmp (s, ".src.rpm", srcrpmlen) == 0) ++ { ++ /* s2 = `-%{release}.src.rpm-debuginfo.%{arch}' */ ++ s2 = (char *) memrchr (debuginfo, '-', s - debuginfo); ++ } ++ if (s2) ++ { ++ /* s2 = `-%{version}-%{release}.src.rpm-debuginfo.%{arch}' */ ++ s2 = (char *) memrchr (debuginfo, '-', s2 - debuginfo); ++ } ++ if (!s2) ++ { ++ warning (_("Error querying the rpm file `%s': %s"), filename, ++ debuginfo); ++ xfree (debuginfo); ++ continue; ++ } ++ /* s = `.src.rpm-debuginfo.%{arch}' */ ++ /* s2 = `-%{version}-%{release}.src.rpm-debuginfo.%{arch}' */ ++ memmove (s2 + debuginfolen, s2, s - s2); ++ memcpy (s2, "-debuginfo", debuginfolen); ++ /* s = `XXXX.%{arch}' */ ++ /* strlen ("XXXX") == srcrpmlen + debuginfolen */ ++ /* s2 = `-debuginfo-%{version}-%{release}XX.%{arch}' */ ++ /* strlen ("XX") == srcrpmlen */ ++ memmove (s + debuginfolen, s + srcrpmlen + debuginfolen, ++ strlen (s + srcrpmlen + debuginfolen) + 1); ++ /* s = `-debuginfo-%{version}-%{release}.%{arch}' */ ++ ++ /* RPMDBI_PACKAGES requires keylen == sizeof (int). */ ++ /* RPMDBI_LABEL is an interface for NVR-based dbiFindByLabel(). */ ++ mi_debuginfo = rpmtsInitIterator_p (ts, (rpmTag) RPMDBI_LABEL, debuginfo, 0); ++ xfree (debuginfo); ++ if (mi_debuginfo) ++ { ++ rpmdbFreeIterator_p (mi_debuginfo); ++ count = 0; ++ break; ++ } ++ ++ /* The allocated memory gets utilized below for MISSING_RPM_HASH. */ ++ debuginfo = headerFormat_p (h, ++ "%{name}-%{version}-%{release}.%{arch}", ++ &err); ++ if (!debuginfo) ++ { ++ warning (_("Error querying the rpm file `%s': %s"), filename, ++ err); ++ continue; ++ } ++ ++ /* Base package name for `debuginfo-install'. We do not use the ++ `yum' command directly as the line ++ yum --enablerepo='*debug*' install NAME-debuginfo.ARCH ++ would be more complicated than just: ++ debuginfo-install NAME-VERSION-RELEASE.ARCH ++ Do not supply the rpm base name (derived from .src.rpm name) as ++ debuginfo-install is unable to install the debuginfo package if ++ the base name PKG binary rpm is not installed while for example ++ PKG-libs would be installed (RH Bug 467901). ++ FUTURE: After multiple debuginfo versions simultaneously installed ++ get supported the support for the VERSION-RELEASE tags handling ++ may need an update. */ ++ ++ if (missing_rpm_hash == NULL) ++ { ++ /* DEL_F is passed NULL as MISSING_RPM_LIST's HTAB_DELETE ++ should not deallocate the entries. */ ++ ++ missing_rpm_hash = htab_create_alloc (64, htab_hash_string, ++ (int (*) (const void *, const void *)) streq, ++ NULL, xcalloc, xfree); ++ } ++ slot = (char **) htab_find_slot (missing_rpm_hash, debuginfo, INSERT); ++ /* XCALLOC never returns NULL. */ ++ gdb_assert (slot != NULL); ++ if (*slot == NULL) ++ { ++ struct missing_rpm *missing_rpm; ++ ++ *slot = debuginfo; ++ ++ missing_rpm = (struct missing_rpm *) xmalloc (sizeof (*missing_rpm) + strlen (debuginfo)); ++ strcpy (missing_rpm->rpm, debuginfo); ++ missing_rpm->next = missing_rpm_list; ++ missing_rpm_list = missing_rpm; ++ missing_rpm_list_entries++; ++ } ++ else ++ xfree (debuginfo); ++ count++; ++ } ++#ifdef GDB_INDEX_VERIFY_VENDOR ++ else /* verify_vendor */ ++ { ++ int vendor_pass = 0, vendor_fail = 0; ++ ++ for (;;) ++ { ++ Header h; ++ errmsg_t err; ++ char *vendor; ++ ++ h = rpmdbNextIterator_p (mi); ++ if (h == NULL) ++ break; ++ ++ vendor = headerFormat_p (h, "%{vendor}", &err); ++ if (!vendor) ++ { ++ warning (_("Error querying the rpm file `%s': %s"), filename, ++ err); ++ continue; ++ } ++ if (strcmp (vendor, "Red Hat, Inc.") == 0) ++ vendor_pass = 1; ++ else ++ vendor_fail = 1; ++ xfree (vendor); ++ } ++ count = vendor_pass != 0 && vendor_fail == 0; ++ } ++#endif ++ ++ rpmdbFreeIterator_p (mi); ++ } ++ ++ rpmtsFree_p (ts); ++ ++ return count; ++} ++ ++#ifdef GDB_INDEX_VERIFY_VENDOR ++missing_rpm_enlist (const char *filename) ++{ ++ return missing_rpm_enlist_1 (filename, 0); ++} ++ ++extern int rpm_verify_vendor (const char *filename); ++int ++rpm_verify_vendor (const char *filename) ++{ ++ return missing_rpm_enlist_1 (filename, 1); ++} ++#endif ++ ++static bool ++missing_rpm_list_compar (const char *ap, const char *bp) ++{ ++ return strcoll (ap, bp) < 0; ++} ++ ++/* It returns a NULL-terminated array of strings needing to be FREEd. It may ++ also return only NULL. */ ++ ++static void ++missing_rpm_list_print (void) ++{ ++ struct missing_rpm *list_iter; ++ ++ if (missing_rpm_list_entries == 0) ++ return; ++ ++ std::vector array (missing_rpm_list_entries); ++ size_t idx = 0; ++ ++ for (list_iter = missing_rpm_list; list_iter != NULL; ++ list_iter = list_iter->next) ++ { ++ array[idx++] = list_iter->rpm; ++ } ++ gdb_assert (idx == missing_rpm_list_entries); ++ ++ std::sort (array.begin (), array.end (), missing_rpm_list_compar); ++ ++ /* We zero out the number of missing RPMs here because of a nasty ++ bug (see RHBZ 1801974). ++ ++ When we call 'puts_unfiltered' below, if pagination is on and if ++ the number of missing RPMs is big enough to trigger pagination, ++ we will end up in an infinite recursion. The call chain looks ++ like this: ++ ++ missing_rpm_list_print -> puts_unfiltered -> fputs_maybe_filtered ++ -> prompt_for_continue -> display_gdb_prompt -> ++ debug_flush_missing -> missing_rpm_list_print ... ++ ++ For this reason, we make sure MISSING_RPM_LIST_ENTRIES is zero ++ *before* calling any print function. */ ++ missing_rpm_list_entries = 0; ++ ++ printf_unfiltered (_("Missing separate debuginfos, use: %s"), ++#ifdef DNF_DEBUGINFO_INSTALL ++ "dnf " ++#endif ++ "debuginfo-install"); ++ for (const char *el : array) ++ { ++ puts_unfiltered (" "); ++ puts_unfiltered (el); ++ } ++ puts_unfiltered ("\n"); ++ ++ while (missing_rpm_list != NULL) ++ { ++ list_iter = missing_rpm_list; ++ missing_rpm_list = list_iter->next; ++ xfree (list_iter); ++ } ++} ++ ++static void ++missing_rpm_change (void) ++{ ++ debug_flush_missing (); ++ ++ gdb_assert (missing_rpm_list == NULL); ++ if (missing_rpm_hash != NULL) ++ { ++ htab_delete (missing_rpm_hash); ++ missing_rpm_hash = NULL; ++ } ++} ++ ++enum missing_exec ++ { ++ /* Init state. EXEC_BFD also still could be NULL. */ ++ MISSING_EXEC_NOT_TRIED, ++ /* We saw a non-NULL EXEC_BFD but RPM has no info about it. */ ++ MISSING_EXEC_NOT_FOUND, ++ /* We found EXEC_BFD by RPM and we either have its symbols (either embedded ++ or separate) or the main executable's RPM is now contained in ++ MISSING_RPM_HASH. */ ++ MISSING_EXEC_ENLISTED ++ }; ++static enum missing_exec missing_exec = MISSING_EXEC_NOT_TRIED; ++ ++#endif /* HAVE_LIBRPM */ ++ ++void ++debug_flush_missing (void) ++{ ++#ifdef HAVE_LIBRPM ++ missing_rpm_list_print (); ++#endif ++} ++ +/* This MISSING_FILEPAIR_HASH tracker is used only for the duplicite messages -+ Try to install the hash file ... ++ yum --enablerepo='*debug*' install ... + avoidance. */ + +struct missing_filepair @@ -763,11 +1209,17 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c + /* All their memory came just from missing_filepair_OBSTACK. */ + missing_filepair_hash = NULL; + } ++#ifdef HAVE_LIBRPM ++ missing_exec = MISSING_EXEC_NOT_TRIED; ++#endif +} + +static void +debug_print_executable_changed (void) +{ ++#ifdef HAVE_LIBRPM ++ missing_rpm_change (); ++#endif + missing_filepair_change (); +} + @@ -834,14 +1286,38 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c + + *slot = missing_filepair; + -+ /* We do not collect and flush these messages as each such message -+ already requires its own separate lines. */ ++#ifdef HAVE_LIBRPM ++ if (missing_exec == MISSING_EXEC_NOT_TRIED) ++ { ++ const char *execfilename = get_exec_file (0); + -+ fprintf_unfiltered (gdb_stdlog, -+ _("Missing separate debuginfo for %s\n"), binary); -+ if (debug != NULL) -+ fprintf_unfiltered (gdb_stdlog, _("Try to install the hash file %s\n"), -+ debug); ++ if (execfilename != NULL) ++ { ++ if (missing_rpm_enlist (execfilename) == 0) ++ missing_exec = MISSING_EXEC_NOT_FOUND; ++ else ++ missing_exec = MISSING_EXEC_ENLISTED; ++ } ++ } ++ if (missing_exec != MISSING_EXEC_ENLISTED) ++ if ((binary[0] == 0 || missing_rpm_enlist (binary) == 0) ++ && (debug == NULL || missing_rpm_enlist (debug) == 0)) ++#endif /* HAVE_LIBRPM */ ++ { ++ /* We do not collect and flush these messages as each such message ++ already requires its own separate lines. */ ++ ++ fprintf_unfiltered (gdb_stdlog, ++ _("Missing separate debuginfo for %s\n"), binary); ++ if (debug != NULL) ++ fprintf_unfiltered (gdb_stdlog, _("Try: %s %s\n"), ++#ifdef DNF_DEBUGINFO_INSTALL ++ "dnf" ++#else ++ "yum" ++#endif ++ " --enablerepo='*debug*' install", debug); ++ } +} + /* See build-id.h. */ @@ -884,8 +1360,9 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c if (build_id != NULL) { if (separate_debug_file_debug) - printf_unfiltered (_("\nLooking for separate debug info (build-id) for " - "%s\n"), objfile_name (objfile)); +@@ -214,8 +1338,21 @@ find_separate_debug_file_by_buildid (struct objfile *objfile) + _("\nLooking for separate debug info (build-id) for " + "%s\n"), objfile_name (objfile)); + char *build_id_filename_cstr = NULL; gdb_bfd_ref_ptr abfd (build_id_to_debug_bfd (build_id->size, @@ -906,15 +1383,15 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c /* Prevent looping on a stripped .debug file. */ if (abfd != NULL && filename_cmp (bfd_get_filename (abfd.get ()), -@@ -223,3 +897,22 @@ find_separate_debug_file_by_buildid (struct objfile *objfile) +@@ -228,3 +1365,22 @@ find_separate_debug_file_by_buildid (struct objfile *objfile) return std::string (); } + -+extern void _initialize_build_id (void); ++void _initialize_build_id (); + +void -+_initialize_build_id (void) ++_initialize_build_id () +{ + add_setshow_zinteger_cmd ("build-id-verbose", no_class, &build_id_verbose, + _("\ @@ -1056,7 +1533,7 @@ diff --git a/gdb/corelow.c b/gdb/corelow.c diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo -@@ -21415,6 +21415,27 @@ information files. +@@ -21524,6 +21524,27 @@ information files. @end table @@ -1087,7 +1564,7 @@ diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo diff --git a/gdb/dwarf2/index-cache.c b/gdb/dwarf2/index-cache.c --- a/gdb/dwarf2/index-cache.c +++ b/gdb/dwarf2/index-cache.c -@@ -95,7 +95,7 @@ index_cache::store (dwarf2_per_objfile *per_objfile) +@@ -97,7 +97,7 @@ index_cache::store (dwarf2_per_objfile *per_objfile) return; /* Get build id of objfile. */ @@ -1095,8 +1572,8 @@ diff --git a/gdb/dwarf2/index-cache.c b/gdb/dwarf2/index-cache.c + const bfd_build_id *build_id = build_id_bfd_shdr_get (obj->obfd); if (build_id == nullptr) { - if (debug_index_cache) -@@ -113,7 +113,8 @@ index_cache::store (dwarf2_per_objfile *per_objfile) + index_cache_debug ("objfile %s has no build id", +@@ -114,7 +114,8 @@ index_cache::store (dwarf2_per_objfile *per_objfile) if (dwz != nullptr) { @@ -1109,7 +1586,7 @@ diff --git a/gdb/dwarf2/index-cache.c b/gdb/dwarf2/index-cache.c diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c -@@ -5447,7 +5447,7 @@ get_gdb_index_contents_from_section (objfile *obj, T *section_owner) +@@ -5476,7 +5476,7 @@ get_gdb_index_contents_from_section (objfile *obj, T *section_owner) static gdb::array_view get_gdb_index_contents_from_cache (objfile *obj, dwarf2_per_bfd *dwarf2_per_bfd) { @@ -1118,7 +1595,7 @@ diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c if (build_id == nullptr) return {}; -@@ -5460,7 +5460,7 @@ get_gdb_index_contents_from_cache (objfile *obj, dwarf2_per_bfd *dwarf2_per_bfd) +@@ -5489,7 +5489,7 @@ get_gdb_index_contents_from_cache (objfile *obj, dwarf2_per_bfd *dwarf2_per_bfd) static gdb::array_view get_gdb_index_contents_from_cache_dwz (objfile *obj, dwz_file *dwz) { @@ -1130,7 +1607,7 @@ diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c diff --git a/gdb/elfread.c b/gdb/elfread.c --- a/gdb/elfread.c +++ b/gdb/elfread.c -@@ -1272,7 +1272,9 @@ elf_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags) +@@ -1270,7 +1270,9 @@ elf_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags) && objfile->separate_debug_objfile == NULL && objfile->separate_debug_objfile_backlink == NULL) { @@ -1141,7 +1618,7 @@ diff --git a/gdb/elfread.c b/gdb/elfread.c if (debugfile.empty ()) debugfile = find_separate_debug_file_by_debuglink (objfile); -@@ -1287,7 +1289,7 @@ elf_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags) +@@ -1285,7 +1287,7 @@ elf_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags) else { has_dwarf2 = false; @@ -1150,7 +1627,7 @@ diff --git a/gdb/elfread.c b/gdb/elfread.c if (build_id != nullptr) { -@@ -1312,6 +1314,10 @@ elf_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags) +@@ -1310,6 +1312,10 @@ elf_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags) has_dwarf2 = true; } } @@ -1164,7 +1641,7 @@ diff --git a/gdb/elfread.c b/gdb/elfread.c diff --git a/gdb/exec.c b/gdb/exec.c --- a/gdb/exec.c +++ b/gdb/exec.c -@@ -237,7 +237,7 @@ validate_exec_file (int from_tty) +@@ -238,7 +238,7 @@ validate_exec_file (int from_tty) current_exec_file = get_exec_file (0); const bfd_build_id *exec_file_build_id @@ -1173,7 +1650,7 @@ diff --git a/gdb/exec.c b/gdb/exec.c if (exec_file_build_id != nullptr) { /* Prepend the target prefix, to force gdb_bfd_open to open the -@@ -250,7 +250,7 @@ validate_exec_file (int from_tty) +@@ -251,7 +251,7 @@ validate_exec_file (int from_tty) if (abfd != nullptr) { const bfd_build_id *target_exec_file_build_id @@ -1185,7 +1662,7 @@ diff --git a/gdb/exec.c b/gdb/exec.c diff --git a/gdb/objfiles.h b/gdb/objfiles.h --- a/gdb/objfiles.h +++ b/gdb/objfiles.h -@@ -812,6 +812,10 @@ struct objfile +@@ -769,6 +769,10 @@ struct objfile bool skip_jit_symbol_lookup = false; }; @@ -1228,7 +1705,7 @@ diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c static struct link_map_offsets *svr4_fetch_link_map_offsets (void); static int svr4_have_link_map_offsets (void); -@@ -1348,9 +1349,51 @@ svr4_read_so_list (svr4_info *info, CORE_ADDR lm, CORE_ADDR prev_lm, +@@ -1248,9 +1249,51 @@ svr4_read_so_list (svr4_info *info, CORE_ADDR lm, CORE_ADDR prev_lm, continue; } @@ -1286,7 +1763,7 @@ diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c diff --git a/gdb/source.c b/gdb/source.c --- a/gdb/source.c +++ b/gdb/source.c -@@ -1178,7 +1178,7 @@ open_source_file (struct symtab *s) +@@ -1199,7 +1199,7 @@ open_source_file (struct symtab *s) srcpath += s->filename; } @@ -1381,7 +1858,17 @@ diff --git a/gdb/testsuite/gdb.base/new-ui-pending-input.exp b/gdb/testsuite/gdb diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp -@@ -2130,6 +2130,17 @@ proc default_gdb_start { } { +@@ -141,7 +141,8 @@ if ![info exists INTERNAL_GDBFLAGS] { + "-nx" \ + "-data-directory $BUILD_DATA_DIRECTORY" \ + {-iex "set height 0"} \ +- {-iex "set width 0"}]] ++ {-iex "set width 0"} \ ++ {-iex "set build-id-verbose 0"}]] + } + + # The variable gdb_prompt is a regexp which matches the gdb prompt. +@@ -2200,6 +2201,17 @@ proc default_gdb_start { } { } } diff --git a/gdb-6.7-ppc-clobbered-registers-O2-test.patch b/gdb-6.7-ppc-clobbered-registers-O2-test.patch deleted file mode 100644 index 99143d4..0000000 --- a/gdb-6.7-ppc-clobbered-registers-O2-test.patch +++ /dev/null @@ -1,108 +0,0 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Jan Kratochvil -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-6.7-ppc-clobbered-registers-O2-test.patch - -;; Test PPC hiding of call-volatile parameter register. -;;=fedoratest - -2007-11-04 Jan Kratochvil - - * gdb.arch/ppc-clobbered-registers-O2.exp: `powerpc64' changed to - `powerpc*'. - -Testcase for: - -http://sourceware.org/ml/gdb-patches/2007-09/msg00228.html - -2007-10-21 Luis Machado - - * rs6000-tdep.c (ppc_dwarf2_frame_init_reg): New function. - * (rs6000_gdbarch_init): Install ppc_dwarf2_frame_init_reg as - default dwarf2_frame_set_init_reg function. - -diff --git a/gdb/testsuite/gdb.arch/ppc-clobbered-registers-O2.c b/gdb/testsuite/gdb.arch/ppc-clobbered-registers-O2.c -new file mode 100644 ---- /dev/null -+++ b/gdb/testsuite/gdb.arch/ppc-clobbered-registers-O2.c -@@ -0,0 +1,21 @@ -+ -+unsigned * __attribute__((noinline)) -+start_sequence (unsigned * x, unsigned * y) -+{ -+ return (unsigned *)0xdeadbeef; -+}; -+ -+unsigned __attribute__((noinline)) -+gen_movsd (unsigned * operand0, unsigned * operand1) -+{ -+ return *start_sequence(operand0, operand1); -+} -+ -+int main(void) -+{ -+ unsigned x, y; -+ -+ x = 13; -+ y = 14; -+ return (int)gen_movsd (&x, &y); -+} -diff --git a/gdb/testsuite/gdb.arch/ppc-clobbered-registers-O2.exp b/gdb/testsuite/gdb.arch/ppc-clobbered-registers-O2.exp -new file mode 100644 ---- /dev/null -+++ b/gdb/testsuite/gdb.arch/ppc-clobbered-registers-O2.exp -@@ -0,0 +1,54 @@ -+# Copyright 2006 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 2 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, write to the Free Software -+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -+# -+# This file is part of the gdb testsuite. -+ -+# Test displaying call clobbered registers in optimized binaries for ppc. -+# GDB should not show incorrect values. -+ -+if ![istarget "powerpc*-*"] then { -+ verbose "Skipping powerpc* call clobbered registers testing." -+ return -+} -+ -+set testfile "ppc-clobbered-registers-O2" -+set srcfile ${testfile}.c -+set binfile [standard_output_file ${testfile}] -+set compile_flags "debug additional_flags=-O2" -+ -+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable ${compile_flags}] != "" } { -+ unsupported "Testcase compile failed." -+ return -1 -+} -+ -+gdb_exit -+gdb_start -+gdb_reinitialize_dir $srcdir/$subdir -+gdb_load ${binfile} -+ -+if ![runto_main] then { -+ perror "Couldn't run to breakpoint" -+ continue -+} -+ -+gdb_test "b start_sequence" ".*Breakpoint 2 at.*line 6.*" \ -+ "Insert breakpoint at problematic function" -+ -+gdb_test continue ".*Breakpoint 2.*in start_sequence.*" \ -+ "Run until problematic function" -+ -+gdb_test backtrace ".*operand0=.*operand1=.*" \ -+ "Check value of call clobbered registers" diff --git a/gdb-ada-fix-assert-in-ada_is_unconstrained_packed_array_type.patch b/gdb-ada-fix-assert-in-ada_is_unconstrained_packed_array_type.patch deleted file mode 100644 index da9e9ea..0000000 --- a/gdb-ada-fix-assert-in-ada_is_unconstrained_packed_array_type.patch +++ /dev/null @@ -1,48 +0,0 @@ -[gdb/ada] Fix assert in ada_is_unconstrained_packed_array_type - -On openSUSE Leap 42.3, with system compiler gcc 4.8.5 I run into: -... -(gdb) print u_one_two_three^M -src/gdb/gdbtypes.h:1050: internal-error: field: \ - Assertion `idx >= 0 && idx < num_fields ()' failed.^M -... - -We run into trouble while doing this in -ada_is_unconstrained_packed_array_type: -... -1953 return TYPE_FIELD_BITSIZE (type, 0) > 0; -... -which tries to get field 0 from a type without fields: -... -(gdb) p type->num_fields () -$6 = 0 -... -which is the case because the type is a typedef: -... -(gdb) p type->code () -$7 = TYPE_CODE_TYPEDEF -... - -Fix this by using the type referenced by the typedef instead. - -Tested on x86_64-linux. - -Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28323 - ---- - gdb/ada-lang.c | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c -index b098991612d..9341c7b3677 100644 ---- a/gdb/ada-lang.c -+++ b/gdb/ada-lang.c -@@ -1927,6 +1927,8 @@ ada_is_unconstrained_packed_array_type (struct type *type) - /* The structure's first field is a pointer to an array, so this - fetches the array type. */ - type = TYPE_TARGET_TYPE (type->field (0).type ()); -+ if (type->code () == TYPE_CODE_TYPEDEF) -+ type = ada_typedef_target_type (type); - /* Now we can see if the array elements are packed. */ - return TYPE_FIELD_BITSIZE (type, 0) > 0; - } diff --git a/gdb-build-add-cxx_dialect-to-cxx.patch b/gdb-build-add-cxx_dialect-to-cxx.patch deleted file mode 100644 index b58ae9b..0000000 --- a/gdb-build-add-cxx_dialect-to-cxx.patch +++ /dev/null @@ -1,193 +0,0 @@ -[gdb/build] Add CXX_DIALECT to CXX - -Say we use a gcc version that (while supporting c++11) does not support c++11 -by default, and needs an -std setting to enable it. - -If gdb would use the default AX_CXX_COMPILE_STDCXX from autoconf-archive, then -we'd have: -... -CXX="g++ -std=gnu++11" -... - -That mechanism however has the following problem (quoting from commit -0bcda685399): -... -the top level Makefile passes CXX down to subdirs, and that overrides whatever -gdb/Makefile may set CXX to. The result would be that a make invocation from -the build/gdb/ directory would use "g++ -std=gnu++11" as expected, while a -make invocation at the top level would not. -... - -Commit 0bcda685399 fixes this by using a custom AX_CXX_COMPILE_STDCXX which -does: -... -CXX=g++ -CXX_DIALECT=-std=gnu++11 -... - -The problem reported in PR28318 is that using the custom instead of the -default AX_CXX_COMPILE_STDCXX makes the configure test for std::thread -support fail. - -We could simply add $CXX_DIALECT to the test for std::thread support, but -that would have to be repeated for each added c++ support test. - -Instead, fix this by doing: -... -CXX="g++ -std=gnu++11" -CXX_DIALECT=-std=gnu++11 -... - -This is somewhat awkward, since it results in -std=gnu++11 occuring twice in -some situations: -... -$ touch src/gdb/dwarf2/read.c -$ ( cd build/gdb; make V=1 dwarf2/read.o ) -g++-4.8 -std=gnu++11 -x c++ -std=gnu++11 ... -... - -However, both settings are needed: - - the switch in CXX for the std::thread tests (and other tests) - - the switch in CXX_DIALECT so it can be appended in Makefiles, to - counteract the fact that the top-level Makefile overrides CXX - -The code added in gdb/ax_cxx_compile_stdcxx.m4 is copied from the default -AX_CXX_COMPILE_STDCXX from autoconf-archive. - -Tested on x86_64-linux. - -Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28318 - -gdb/ChangeLog: - -2021-10-04 Tom de Vries - - PR build/28318 - * ax_cxx_compile_stdcxx.m4: Add CXX_DIALECT to CXX. - * configure: Regenerate. - -gdbserver/ChangeLog: - -2021-10-04 Tom de Vries - - PR build/28318 - * configure: Regenerate. - -gdbsupport/ChangeLog: - -2021-10-04 Tom de Vries - - PR build/28318 - * configure: Regenerate. - ---- - gdb/ax_cxx_compile_stdcxx.m4 | 8 ++++++++ - gdb/configure | 8 ++++++++ - gdbserver/configure | 8 ++++++++ - gdbsupport/configure | 8 ++++++++ - 7 files changed, 48 insertions(+) - -diff --git a/gdb/ax_cxx_compile_stdcxx.m4 b/gdb/ax_cxx_compile_stdcxx.m4 -index 413755a2e88..29d8e10bcc4 100644 ---- a/gdb/ax_cxx_compile_stdcxx.m4 -+++ b/gdb/ax_cxx_compile_stdcxx.m4 -@@ -94,6 +94,10 @@ AC_DEFUN([AX_CXX_COMPILE_STDCXX], [dnl - CXX="$ac_save_CXX"]) - if eval test x\$$cachevar = xyes; then - CXX_DIALECT="$switch" -+ CXX="$CXX $switch" -+ if test -n "$CXXCPP" ; then -+ CXXCPP="$CXXCPP $switch" -+ fi - ac_success=yes - break - fi -@@ -118,6 +122,10 @@ AC_DEFUN([AX_CXX_COMPILE_STDCXX], [dnl - CXX="$ac_save_CXX"]) - if eval test x\$$cachevar = xyes; then - CXX_DIALECT="$switch" -+ CXX="$CXX $switch" -+ if test -n "$CXXCPP" ; then -+ CXXCPP="$CXXCPP $switch" -+ fi - ac_success=yes - break - fi -diff --git a/gdb/configure b/gdb/configure -index 5d89635c043..6d4c2b17ed2 100755 ---- a/gdb/configure -+++ b/gdb/configure -@@ -5841,6 +5841,10 @@ eval ac_res=\$$cachevar - $as_echo "$ac_res" >&6; } - if eval test x\$$cachevar = xyes; then - CXX_DIALECT="$switch" -+ CXX="$CXX $switch" -+ if test -n "$CXXCPP" ; then -+ CXXCPP="$CXXCPP $switch" -+ fi - ac_success=yes - break - fi -@@ -6160,6 +6164,10 @@ eval ac_res=\$$cachevar - $as_echo "$ac_res" >&6; } - if eval test x\$$cachevar = xyes; then - CXX_DIALECT="$switch" -+ CXX="$CXX $switch" -+ if test -n "$CXXCPP" ; then -+ CXXCPP="$CXXCPP $switch" -+ fi - ac_success=yes - break - fi -diff --git a/gdbserver/configure b/gdbserver/configure -index b227167e270..f05c1a9b976 100755 ---- a/gdbserver/configure -+++ b/gdbserver/configure -@@ -5625,6 +5625,10 @@ eval ac_res=\$$cachevar - $as_echo "$ac_res" >&6; } - if eval test x\$$cachevar = xyes; then - CXX_DIALECT="$switch" -+ CXX="$CXX $switch" -+ if test -n "$CXXCPP" ; then -+ CXXCPP="$CXXCPP $switch" -+ fi - ac_success=yes - break - fi -@@ -5944,6 +5948,10 @@ eval ac_res=\$$cachevar - $as_echo "$ac_res" >&6; } - if eval test x\$$cachevar = xyes; then - CXX_DIALECT="$switch" -+ CXX="$CXX $switch" -+ if test -n "$CXXCPP" ; then -+ CXXCPP="$CXXCPP $switch" -+ fi - ac_success=yes - break - fi -diff --git a/gdbsupport/configure b/gdbsupport/configure -index a9dd02c5b72..ae6047865ae 100755 ---- a/gdbsupport/configure -+++ b/gdbsupport/configure -@@ -6520,6 +6520,10 @@ eval ac_res=\$$cachevar - $as_echo "$ac_res" >&6; } - if eval test x\$$cachevar = xyes; then - CXX_DIALECT="$switch" -+ CXX="$CXX $switch" -+ if test -n "$CXXCPP" ; then -+ CXXCPP="$CXXCPP $switch" -+ fi - ac_success=yes - break - fi -@@ -6839,6 +6843,10 @@ eval ac_res=\$$cachevar - $as_echo "$ac_res" >&6; } - if eval test x\$$cachevar = xyes; then - CXX_DIALECT="$switch" -+ CXX="$CXX $switch" -+ if test -n "$CXXCPP" ; then -+ CXXCPP="$CXXCPP $switch" -+ fi - ac_success=yes - break - fi diff --git a/gdb-build-make-c-exp.y-work-with-bison-3.8.patch b/gdb-build-make-c-exp.y-work-with-bison-3.8.patch deleted file mode 100644 index b01f471..0000000 --- a/gdb-build-make-c-exp.y-work-with-bison-3.8.patch +++ /dev/null @@ -1,37 +0,0 @@ -Make c-exp.y work with Bison 3.8+ - -When using Bison 3.8, we get this error: - ../../gdb/c-exp.y:3455:1: error: ‘void c_print_token(FILE*, int, YYSTYPE)’ defined but not used [-Werror=unused-function] - -That's because bison 3.8 removed YYPRINT support: -https://savannah.gnu.org/forum/forum.php?forum_id=10047 - -Accordingly, this patch only defines that function for Bison < 3.8. - ---- - gdb/c-exp.y | 5 +++-- - 1 file changed, 3 insertions(+), 2 deletions(-) - -diff --git a/gdb/c-exp.y b/gdb/c-exp.y -index 93b10f05b7d..9b4b88accfe 100644 ---- a/gdb/c-exp.y -+++ b/gdb/c-exp.y -@@ -167,7 +167,7 @@ static struct stoken operator_stoken (const char *); - static struct stoken typename_stoken (const char *); - static void check_parameter_typelist (std::vector *); - --#ifdef YYBISON -+#if defined(YYBISON) && YYBISON < 30800 - static void c_print_token (FILE *file, int type, YYSTYPE value); - #define YYPRINT(FILE, TYPE, VALUE) c_print_token (FILE, TYPE, VALUE) - #endif -@@ -3446,7 +3446,8 @@ c_parse (struct parser_state *par_state) - return result; - } - --#ifdef YYBISON -+#if defined(YYBISON) && YYBISON < 30800 -+ - - /* This is called via the YYPRINT macro when parser debugging is - enabled. It prints a token's value. */ diff --git a/gdb-cli-add-ignore-errors-command.patch b/gdb-cli-add-ignore-errors-command.patch index 0a554f5..df60085 100644 --- a/gdb-cli-add-ignore-errors-command.patch +++ b/gdb-cli-add-ignore-errors-command.patch @@ -69,7 +69,7 @@ gdb/testsuite/ChangeLog: 4 files changed, 68 insertions(+), 1 deletion(-) diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c -index 56ae12a0c19..ce8af45a925 100644 +index 31d398cb13b..4eff591b3df 100644 --- a/gdb/cli/cli-cmds.c +++ b/gdb/cli/cli-cmds.c @@ -39,6 +39,7 @@ @@ -80,8 +80,8 @@ index 56ae12a0c19..ce8af45a925 100644 #include "ui-out.h" #include "interps.h" -@@ -2249,6 +2250,34 @@ gdb_maint_setting_str_internal_fn (struct gdbarch *gdbarch, - gdbarch); +@@ -2399,6 +2400,34 @@ gdb_maint_setting_str_internal_fn (struct gdbarch *gdbarch, + return str_value_from_setting (*show_cmd->var, gdbarch); } +/* Completer for "ignore-errors". */ @@ -115,7 +115,7 @@ index 56ae12a0c19..ce8af45a925 100644 void _initialize_cli_cmds (); void _initialize_cli_cmds () -@@ -2625,4 +2654,10 @@ when GDB is started."), GDBINIT); +@@ -2786,4 +2815,10 @@ when GDB is started."), GDBINIT).release (); c = add_cmd ("source", class_support, source_command, source_help_text, &cmdlist); set_cmd_completer (c, filename_completer); @@ -127,10 +127,10 @@ index 56ae12a0c19..ce8af45a925 100644 + set_cmd_completer (c, ignore_errors_command_completer); } diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo -index 025d6bec42a..1700b0305c5 100644 +index 1cf3550885e..68e11585942 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo -@@ -27508,7 +27508,8 @@ The lines in a command file are generally executed sequentially, +@@ -27680,7 +27680,8 @@ The lines in a command file are generally executed sequentially, unless the order of execution is changed by one of the @emph{flow-control commands} described below. The commands are not printed as they are executed. An error in any command terminates @@ -140,7 +140,7 @@ index 025d6bec42a..1700b0305c5 100644 @value{GDBN} first searches for @var{filename} in the current directory. If the file is not found there, and @var{filename} does not specify a -@@ -27603,6 +27604,11 @@ the controlling expression. +@@ -27775,6 +27776,11 @@ the controlling expression. @item end Terminate the block of commands that are the body of @code{if}, @code{else}, or @code{while} flow-control commands. diff --git a/gdb-container-rh-pkg.patch b/gdb-container-rh-pkg.patch index 31f516c..ab56a5b 100644 --- a/gdb-container-rh-pkg.patch +++ b/gdb-container-rh-pkg.patch @@ -9,7 +9,7 @@ Subject: gdb-container-rh-pkg.patch diff --git a/gdb/remote.c b/gdb/remote.c --- a/gdb/remote.c +++ b/gdb/remote.c -@@ -14290,7 +14290,17 @@ remote_target::pid_to_exec_file (int pid) +@@ -14343,7 +14343,17 @@ remote_target::pid_to_exec_file (int pid) char *annex = NULL; if (packet_support (PACKET_qXfer_exec_file) != PACKET_ENABLE) diff --git a/gdb-core-open-vdso-warning.patch b/gdb-core-open-vdso-warning.patch index fefe951..257250c 100644 --- a/gdb-core-open-vdso-warning.patch +++ b/gdb-core-open-vdso-warning.patch @@ -27,7 +27,7 @@ diff --git a/gdb/testsuite/gdb.base/solib-symbol.exp b/gdb/testsuite/gdb.base/so if [get_compiler_info] { return -1 -@@ -71,8 +72,26 @@ gdb_test "br foo2" \ +@@ -70,8 +71,26 @@ gdb_test "br foo2" \ "Breakpoint.*: foo2. .2 locations..*" \ "foo2 in mdlib" diff --git a/gdb-doc-fix-print-inferior-events-default.patch b/gdb-doc-fix-print-inferior-events-default.patch deleted file mode 100644 index c545cb2..0000000 --- a/gdb-doc-fix-print-inferior-events-default.patch +++ /dev/null @@ -1,29 +0,0 @@ -[gdb/doc] Fix print inferior-events default - -In the docs about print inferior-events we read: -... -By default, these messages will not be printed. -... - -That used to be the case, but is no longer so since commit f67c0c91715 "Enable -'set print inferior-events' and improve detach/fork/kill/exit messages". - -Fix this by updating the docs. - ---- - gdb/doc/gdb.texinfo | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo -index 1700b0305c5..d53c9a03704 100644 ---- a/gdb/doc/gdb.texinfo -+++ b/gdb/doc/gdb.texinfo -@@ -3395,7 +3395,7 @@ control use @w{@code{set print inferior-events}}: - The @code{set print inferior-events} command allows you to enable or - disable printing of messages when @value{GDBN} notices that new - inferiors have started or that inferiors have exited or have been --detached. By default, these messages will not be printed. -+detached. By default, these messages will be printed. - - @kindex show print inferior-events - @item show print inferior-events diff --git a/gdb-exp-improve-error-reading-variable-message.patch b/gdb-exp-improve-error-reading-variable-message.patch deleted file mode 100644 index 2ded8da..0000000 --- a/gdb-exp-improve-error-reading-variable-message.patch +++ /dev/null @@ -1,138 +0,0 @@ -[gdb/exp] Improve message - -When printing a variable x in a subroutine foo: -... -subroutine foo (x) - integer(4) :: x (*) - x(3) = 1 -end subroutine foo -... -where x is an array with unknown bounds, we get: -... -$ gdb -q -batch outputs/gdb.fortran/array-no-bounds/array-no-bounds \ - -ex "break foo" \ - -ex run \ - -ex "print x" -Breakpoint 1 at 0x4005cf: file array-no-bounds.f90, line 18. - -Breakpoint 1, foo (x=...) at array-no-bounds.f90:18 -18 x(3) = 1 -$1 = -... - -Improve the error message by printing the details of the error, such that we -have instead: -... -$1 = -... - -This is a change in gdb/valprint.c, and grepping through the sources reveals -that this is a common pattern. - -Tested on x86_64-linux. - ---- - gdb/testsuite/gdb.fortran/array-no-bounds.exp | 44 +++++++++++++++++++++++++++ - gdb/testsuite/gdb.fortran/array-no-bounds.f90 | 30 ++++++++++++++++++ - gdb/valprint.c | 2 +- - 3 files changed, 75 insertions(+), 1 deletion(-) - -diff --git a/gdb/testsuite/gdb.fortran/array-no-bounds.exp b/gdb/testsuite/gdb.fortran/array-no-bounds.exp -new file mode 100644 -index 00000000000..a686232cb0e ---- /dev/null -+++ b/gdb/testsuite/gdb.fortran/array-no-bounds.exp -@@ -0,0 +1,44 @@ -+# Copyright 2021 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 . -+ -+# This file is part of the gdb testsuite. It contains test to ensure that -+# array bounds accept LONGEST. -+ -+if { [skip_fortran_tests] } { return -1 } -+ -+standard_testfile .f90 -+load_lib fortran.exp -+ -+if { [prepare_for_testing "failed to prepare" $testfile $srcfile \ -+ {f90 debug}] } { -+ return -1 -+} -+ -+if { ![fortran_runto_main] } { -+ perror "Could not run to main." -+ continue -+} -+ -+# Go to foo. -+gdb_breakpoint foo -+gdb_continue_to_breakpoint "foo" -+ -+# Print x, and check that we get a useful error message. -+gdb_test "p x" \ -+ " = " -+ -+# Print x using @ syntax. -+gdb_test "p x(1)@5" \ -+ " = \\(0, 0, 0, 0, 0\\)" -diff --git a/gdb/testsuite/gdb.fortran/array-no-bounds.f90 b/gdb/testsuite/gdb.fortran/array-no-bounds.f90 -new file mode 100644 -index 00000000000..7b9ca998fff ---- /dev/null -+++ b/gdb/testsuite/gdb.fortran/array-no-bounds.f90 -@@ -0,0 +1,30 @@ -+! Copyright 2021 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 . -+ -+subroutine foo (x) -+ integer(4) :: x (*) -+ x(3) = 1 -+end subroutine foo -+ -+program test -+ interface -+ subroutine foo (x) -+ integer(4) :: x (*) -+ end subroutine -+ end interface -+ integer(4) :: x (5) -+ x(:) = 0 -+ call foo (x) -+end program -diff --git a/gdb/valprint.c b/gdb/valprint.c -index 324055da93f..05740c838ad 100644 ---- a/gdb/valprint.c -+++ b/gdb/valprint.c -@@ -1050,7 +1050,7 @@ do_val_print (struct value *value, struct ui_file *stream, int recurse, - catch (const gdb_exception_error &except) - { - fprintf_styled (stream, metadata_style.style (), -- _("")); -+ _(""), except.what ()); - } - } - diff --git a/gdb-fedora-libncursesw.patch b/gdb-fedora-libncursesw.patch index 2351103..00f4b96 100644 --- a/gdb-fedora-libncursesw.patch +++ b/gdb-fedora-libncursesw.patch @@ -12,7 +12,7 @@ https://bugzilla.redhat.com/show_bug.cgi?id=1270534 diff --git a/gdb/configure b/gdb/configure --- a/gdb/configure +++ b/gdb/configure -@@ -9544,6 +9544,7 @@ if test x"$prefer_curses" = xyes; then +@@ -9567,6 +9567,7 @@ if test x"$prefer_curses" = xyes; then # search /usr/local/include, if ncurses is installed in /usr/local. A # default installation of ncurses on alpha*-dec-osf* will lead to such # a situation. @@ -20,7 +20,7 @@ diff --git a/gdb/configure b/gdb/configure { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing waddstr" >&5 $as_echo_n "checking for library containing waddstr... " >&6; } if ${ac_cv_search_waddstr+:} false; then : -@@ -9568,7 +9569,7 @@ return waddstr (); +@@ -9591,7 +9592,7 @@ return waddstr (); return 0; } _ACEOF @@ -29,7 +29,7 @@ diff --git a/gdb/configure b/gdb/configure if test -z "$ac_lib"; then ac_res="none required" else -@@ -9642,6 +9643,7 @@ case $host_os in +@@ -9665,6 +9666,7 @@ case $host_os in esac # These are the libraries checked by Readline. @@ -37,7 +37,7 @@ diff --git a/gdb/configure b/gdb/configure { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing tgetent" >&5 $as_echo_n "checking for library containing tgetent... " >&6; } if ${ac_cv_search_tgetent+:} false; then : -@@ -9666,7 +9668,7 @@ return tgetent (); +@@ -9689,7 +9691,7 @@ return tgetent (); return 0; } _ACEOF @@ -49,7 +49,7 @@ diff --git a/gdb/configure b/gdb/configure diff --git a/gdb/configure.ac b/gdb/configure.ac --- a/gdb/configure.ac +++ b/gdb/configure.ac -@@ -736,7 +736,8 @@ if test x"$prefer_curses" = xyes; then +@@ -713,7 +713,8 @@ if test x"$prefer_curses" = xyes; then # search /usr/local/include, if ncurses is installed in /usr/local. A # default installation of ncurses on alpha*-dec-osf* will lead to such # a situation. @@ -59,7 +59,7 @@ diff --git a/gdb/configure.ac b/gdb/configure.ac if test "$ac_cv_search_waddstr" != no; then curses_found=yes -@@ -778,7 +779,8 @@ case $host_os in +@@ -755,7 +756,8 @@ case $host_os in esac # These are the libraries checked by Readline. diff --git a/gdb-fix-for-gdb.base-eof-exit.exp-test-failures.patch b/gdb-fix-for-gdb.base-eof-exit.exp-test-failures.patch new file mode 100644 index 0000000..9d2ff1f --- /dev/null +++ b/gdb-fix-for-gdb.base-eof-exit.exp-test-failures.patch @@ -0,0 +1,64 @@ +gdb: fix for gdb.base/eof-exit.exp test failures + +This fix relates to PR gdb/29032, this makes the test more stable by +ensuring that the Ctrl-D is only sent once the prompt has been +displayed. This issue was also discussed on the mailing list here: + + https://sourceware.org/pipermail/gdb-patches/2022-April/187670.html + +The problem identified in the bug report is that sometimes the Ctrl-D +(that the test sends to GDB) arrives while GDB is processing a +command. When this happens the Ctrl-D is handled differently than if +the Ctrl-D is sent while GDB is waiting for input at a prompt. + +The original intent of the test was that the Ctrl-D be sent while GDB +was waiting at a prompt, and that is the case the occurs most often, +but, when the Ctrl-D arrives during command processing, then GDB will +ignore the Ctrl-D, and the test will fail. + +This commit ensures the Ctrl-D is always sent while GDB is waiting at +a prompt, which makes this test stable. + +But, that still leaves an open question, what should happen when the +Ctrl-D arrives while GDB is processing a command? This commit doesn't +attempt to answer that question, which is while bug PR gdb/29032 will +not be closed once this commit is merged. + +Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29032 + +--- + gdb/testsuite/gdb.base/eof-exit.exp | 18 ++++++++++++++++++ + 1 file changed, 18 insertions(+) + +diff --git a/gdb/testsuite/gdb.base/eof-exit.exp b/gdb/testsuite/gdb.base/eof-exit.exp +index d604d029974..53a3b56dce8 100644 +--- a/gdb/testsuite/gdb.base/eof-exit.exp ++++ b/gdb/testsuite/gdb.base/eof-exit.exp +@@ -25,9 +25,27 @@ proc run_test {} { + # + # Send a newline character, which will cause GDB to redisplay the + # prompt. ++ # ++ # We then consume the newline characters, and then make use of ++ # expect's -notransfer option to ensure that the prompt has been ++ # displayed, but to leave the prompt in expect's internal buffer. ++ # This is important as the following test wants to check how GDB ++ # displays the 'quit' message relative to the prompt, this is much ++ # easier to do if the prompt is still in expect's buffers. ++ # ++ # The other special thing we do here is avoid printing a 'PASS' ++ # result. The reason for this is so that the GDB output in the ++ # log file will match what a user should see, this makes it much ++ # easier to debug issues. Obviously we could print a 'PASS' here ++ # as the text printed by expect is not considered part of GDB's ++ # output, so the pattern matching will work just fine... but, the ++ # log file becomes much harder to read. + send_gdb "\n" + gdb_test_multiple "" "discard newline" { + -re "^\r\n" { ++ exp_continue ++ } ++ -notransfer -re "^\[^\n\]*$::gdb_prompt $" { + } + } + diff --git a/gdb-fix-watchpoints-triggered.patch b/gdb-fix-watchpoints-triggered.patch new file mode 100644 index 0000000..830aa36 --- /dev/null +++ b/gdb-fix-watchpoints-triggered.patch @@ -0,0 +1,47 @@ +diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c +index 1e524b5942f..459bc13f398 100644 +--- a/gdb/breakpoint.c ++++ b/gdb/breakpoint.c +@@ -4916,6 +4916,7 @@ watchpoints_triggered (const target_waitstatus &ws) + affected by this data address as triggered, and all others as not + triggered. */ + ++ size_t triggered_cnt = 0; + for (breakpoint *b : all_breakpoints ()) + if (is_hardware_watchpoint (b)) + { +@@ -4932,6 +4933,7 @@ watchpoints_triggered (const target_waitstatus &ws) + if (newaddr == start) + { + w->watchpoint_triggered = watch_triggered_yes; ++ triggered_cnt++; + break; + } + } +@@ -4941,11 +4943,26 @@ watchpoints_triggered (const target_waitstatus &ws) + loc->length)) + { + w->watchpoint_triggered = watch_triggered_yes; ++ triggered_cnt++; + break; + } + } + } + ++ if (triggered_cnt == 0) ++ { ++ /* The target could report the data address. But none of the ++ watchpoints was affected by this data address, so mark all ++ watchpoints as unknown. */ ++ for (breakpoint *b : all_breakpoints ()) ++ if (is_hardware_watchpoint (b)) ++ { ++ struct watchpoint *w = (struct watchpoint *) b; ++ ++ w->watchpoint_triggered = watch_triggered_unknown; ++ } ++ } ++ + return 1; + } + diff --git a/gdb-fortran-handle-dw-at-string-length-with-loclistptr.patch b/gdb-fortran-handle-dw-at-string-length-with-loclistptr.patch deleted file mode 100644 index 990d5c0..0000000 --- a/gdb-fortran-handle-dw-at-string-length-with-loclistptr.patch +++ /dev/null @@ -1,50 +0,0 @@ -[gdb/fortran] Handle DW_AT_string_length with loclistptr - -Fixes PR26910 - "[fortran] Printing dynamic string with DW_AT_string_length -of class loclistpr fails". - -https://sourceware.org/bugzilla/show_bug.cgi?id=26910 - ---- - gdb/dwarf2/read.c | 24 ++++++++++++++++++++---- - 1 file changed, 20 insertions(+), 4 deletions(-) - -diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c -index 05a50515ce4..798585dd380 100644 ---- a/gdb/dwarf2/read.c -+++ b/gdb/dwarf2/read.c -@@ -18175,14 +18175,30 @@ attr_to_dynamic_prop (const struct attribute *attr, struct die_info *die, - } - else if (attr->form_is_constant ()) - prop->set_const_val (attr->constant_value (0)); -- else -+ else if (attr->form_is_section_offset ()) - { -- dwarf2_invalid_attrib_class_complaint (dwarf_form_name (attr->form), -- dwarf2_name (die, cu)); -- return 0; -+ switch (attr->name) -+ { -+ case DW_AT_string_length: -+ baton = XOBNEW (obstack, struct dwarf2_property_baton); -+ baton->property_type = default_type; -+ fill_in_loclist_baton (cu, &baton->loclist, attr); -+ prop->set_loclist (baton); -+ gdb_assert (prop->baton () != NULL); -+ break; -+ default: -+ goto invalid; -+ } - } -+ else -+ goto invalid; - - return 1; -+ -+ invalid: -+ dwarf2_invalid_attrib_class_complaint (dwarf_form_name (attr->form), -+ dwarf2_name (die, cu)); -+ return 0; - } - - /* See read.h. */ diff --git a/gdb-gcore-bash.patch b/gdb-gcore-bash.patch index d4e9378..0d6019e 100644 --- a/gdb-gcore-bash.patch +++ b/gdb-gcore-bash.patch @@ -6,5 +6,5 @@ index b9770ea415..3149f6e1fe 100644 -#!/usr/bin/env bash +#!/bin/bash - # Copyright (C) 2003-2021 Free Software Foundation, Inc. + # Copyright (C) 2003-2022 Free Software Foundation, Inc. diff --git a/gdb-improved-eof-handling-when-using-readline-7.patch b/gdb-improved-eof-handling-when-using-readline-7.patch new file mode 100644 index 0000000..8790c00 --- /dev/null +++ b/gdb-improved-eof-handling-when-using-readline-7.patch @@ -0,0 +1,85 @@ +gdb: improved EOF handling when using readline 7 + +In this commit: + + commit a6b413d24ccc5d76179bab866834e11fd6fec294 + Date: Fri Mar 11 14:44:03 2022 +0000 + + gdb: work around prompt corruption caused by bracketed-paste-mode + +a change was made to GDB to work around bug PR gdb/28833. The +consequence of this work around is that, when bracketed paste mode is +enabled in readline, and GDB is quit by sending EOF, then the output +will look like this: + + (gdb) + quit + +The ideal output, which is what we get when bracketed paste mode is +off, is this: + + (gdb) quit + +The reason we need to make this change is explained in the original +commit referenced above. What isn't mentioned in the above commit, is +that the change that motivated this work around was only added in +readline 8, older versions of readline don't require the change. + +In later commits in this series I will add a fix to GDB's in-tree copy +of readline (this fix is back-ported from upstream readline), and then +I will change GDB so that, when using the (patched) in-tree readline, +we can have the ideal output in all cases. + +However, GDB can be built against the system readline. When this is +done, and the system readline is version 8, then we will still have to +use the work around (two line) style output. + +But, if GDB is built against the system readline, and the system +readline is an older version 7 readline, then there's no reason why we +can't have the ideal output, after all, readline 7 doesn't include the +change that we need to work around. + +This commit changes GDB so that, when using readline 7 we get the +ideal output in all cases. This change is trivial (a simple check +against the readline version number) so I think this should be fine to +include. + +For testing this commit, you need to configure GDB including the +'--with-system-readline' flag, and build GDB on a system that uses +readline 7, for example 'Ubuntu 18.04'. Then run the test +'gdb.base/eof-exit.exp', you should expect everything to PASS. + +Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28833 + +--- + gdb/event-top.c | 3 ++- + gdb/testsuite/gdb.base/eof-exit.exp | 2 +- + 2 files changed, 3 insertions(+), 2 deletions(-) + +diff --git a/gdb/event-top.c b/gdb/event-top.c +index c1a95a4b748..7ddb3e8aee6 100644 +--- a/gdb/event-top.c ++++ b/gdb/event-top.c +@@ -783,7 +783,8 @@ command_line_handler (gdb::unique_xmalloc_ptr &&rl) + we first print '\n' to move to the next line, and then print the + quit. This isn't ideal, but avoids corrupting the prompt. */ + const char *value = rl_variable_value ("enable-bracketed-paste"); +- if (value != nullptr && strcmp (value, "on") == 0) ++ if (value != nullptr && strcmp (value, "on") == 0 ++ && ((rl_readline_version >> 8) & 0xff) > 0x07) + printf_unfiltered ("\n"); + printf_unfiltered ("quit\n"); + execute_command ("quit", 1); +diff --git a/gdb/testsuite/gdb.base/eof-exit.exp b/gdb/testsuite/gdb.base/eof-exit.exp +index c88aced9f35..e04c38bf8d7 100644 +--- a/gdb/testsuite/gdb.base/eof-exit.exp ++++ b/gdb/testsuite/gdb.base/eof-exit.exp +@@ -67,7 +67,7 @@ proc run_test {} { + # line after the 'quit', this catches that case. + fail $gdb_test_name + } +- -re "$::gdb_prompt quit\[^\n\]*\r\n\[^\n\]*$" { ++ -re "$::gdb_prompt \[^\n\r\]*quit\[^\n\]*\r\n\[^\n\]*$" { + pass $gdb_test_name + } + eof { diff --git a/gdb-linux_perf-bundle.patch b/gdb-linux_perf-bundle.patch index 4ab07ba..7cbe96e 100644 --- a/gdb-linux_perf-bundle.patch +++ b/gdb-linux_perf-bundle.patch @@ -213,7 +213,7 @@ diff --git a/gdb/nat/linux-btrace.h b/gdb/nat/linux-btrace.h diff --git a/gdbsupport/common.m4 b/gdbsupport/common.m4 --- a/gdbsupport/common.m4 +++ b/gdbsupport/common.m4 -@@ -135,7 +135,7 @@ AC_DEFUN([GDB_AC_COMMON], [ +@@ -156,7 +156,7 @@ AC_DEFUN([GDB_AC_COMMON], [ AC_PREPROC_IFELSE([AC_LANG_SOURCE([[ #include #ifndef PERF_ATTR_SIZE_VER5 diff --git a/gdb-r_version-check.patch b/gdb-r_version-check.patch deleted file mode 100644 index 8c629fb..0000000 --- a/gdb-r_version-check.patch +++ /dev/null @@ -1,547 +0,0 @@ -From c0154a4a21a3aed01ef53877af05cf0109a0b124 Mon Sep 17 00:00:00 2001 -From: "H.J. Lu" -Date: Mon, 16 Aug 2021 16:17:25 -0700 -Subject: [PATCH] gdb: Don't assume r_ldsomap when r_version > 1 on Linux - -The r_ldsomap field is specific to Solaris (part of librtld_db), and -should never be accessed for Linux. glibc is planning to add a field -to support multiple namespaces. But there will be no r_ldsomap when -r_version is bumped to 2. Add linux_[ilp32|lp64]_fetch_link_map_offsets -to set r_ldsomap_offset to -1 and use them for Linux targets. - -Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28236 ---- - gdb/aarch64-linux-tdep.c | 2 +- - gdb/alpha-linux-tdep.c | 2 +- - gdb/amd64-linux-tdep.c | 4 +-- - gdb/arc-linux-tdep.c | 2 +- - gdb/arm-linux-tdep.c | 2 +- - gdb/cris-linux-tdep.c | 2 +- - gdb/csky-linux-tdep.c | 2 +- - gdb/hppa-linux-tdep.c | 2 +- - gdb/i386-linux-tdep.c | 2 +- - gdb/ia64-linux-tdep.c | 2 +- - gdb/linux-tdep.c | 60 +++++++++++++++++++++++++++++++++++++ - gdb/linux-tdep.h | 5 ++++ - gdb/m32r-linux-tdep.c | 2 +- - gdb/m68k-linux-tdep.c | 2 +- - gdb/microblaze-linux-tdep.c | 2 +- - gdb/mips-linux-tdep.c | 6 ++-- - gdb/mn10300-linux-tdep.c | 2 +- - gdb/nios2-linux-tdep.c | 2 +- - gdb/or1k-linux-tdep.c | 2 +- - gdb/ppc-linux-tdep.c | 4 +-- - gdb/riscv-linux-tdep.c | 4 +-- - gdb/s390-linux-tdep.c | 4 +-- - gdb/sh-linux-tdep.c | 2 +- - gdb/sparc-linux-tdep.c | 2 +- - gdb/sparc64-linux-tdep.c | 2 +- - gdb/tilegx-linux-tdep.c | 4 +-- - gdb/xtensa-linux-tdep.c | 2 +- - 27 files changed, 97 insertions(+), 32 deletions(-) - -diff --git a/gdb/aarch64-linux-tdep.c b/gdb/aarch64-linux-tdep.c -index 63c200b47f7..b1225438d9d 100644 ---- a/gdb/aarch64-linux-tdep.c -+++ b/gdb/aarch64-linux-tdep.c -@@ -1795,7 +1795,7 @@ aarch64_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) - linux_init_abi (info, gdbarch, 1); - - set_solib_svr4_fetch_link_map_offsets (gdbarch, -- svr4_lp64_fetch_link_map_offsets); -+ linux_lp64_fetch_link_map_offsets); - - /* Enable TLS support. */ - set_gdbarch_fetch_tls_load_module_address (gdbarch, -diff --git a/gdb/alpha-linux-tdep.c b/gdb/alpha-linux-tdep.c -index c2cffc13c20..0a00fc1f310 100644 ---- a/gdb/alpha-linux-tdep.c -+++ b/gdb/alpha-linux-tdep.c -@@ -374,7 +374,7 @@ alpha_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) - set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target); - - set_solib_svr4_fetch_link_map_offsets -- (gdbarch, svr4_lp64_fetch_link_map_offsets); -+ (gdbarch, linux_lp64_fetch_link_map_offsets); - - /* Enable TLS support. */ - set_gdbarch_fetch_tls_load_module_address (gdbarch, -diff --git a/gdb/amd64-linux-tdep.c b/gdb/amd64-linux-tdep.c -index ac6843c1fdd..715add8a7b0 100644 ---- a/gdb/amd64-linux-tdep.c -+++ b/gdb/amd64-linux-tdep.c -@@ -2042,7 +2042,7 @@ amd64_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) - - /* GNU/Linux uses SVR4-style shared libraries. */ - set_solib_svr4_fetch_link_map_offsets -- (gdbarch, svr4_lp64_fetch_link_map_offsets); -+ (gdbarch, linux_lp64_fetch_link_map_offsets); - - /* Register DTrace handlers. */ - set_gdbarch_dtrace_parse_probe_argument (gdbarch, amd64_dtrace_parse_probe_argument); -@@ -2256,7 +2256,7 @@ amd64_x32_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) - - /* GNU/Linux uses SVR4-style shared libraries. */ - set_solib_svr4_fetch_link_map_offsets -- (gdbarch, svr4_ilp32_fetch_link_map_offsets); -+ (gdbarch, linux_ilp32_fetch_link_map_offsets); - } - - void _initialize_amd64_linux_tdep (); -diff --git a/gdb/arc-linux-tdep.c b/gdb/arc-linux-tdep.c -index cf18b8d6b03..448fa370a36 100644 ---- a/gdb/arc-linux-tdep.c -+++ b/gdb/arc-linux-tdep.c -@@ -732,7 +732,7 @@ arc_linux_init_osabi (struct gdbarch_info info, struct gdbarch *gdbarch) - /* GNU/Linux uses SVR4-style shared libraries, with 32-bit ints, longs - and pointers (ILP32). */ - set_solib_svr4_fetch_link_map_offsets (gdbarch, -- svr4_ilp32_fetch_link_map_offsets); -+ linux_ilp32_fetch_link_map_offsets); - } - - /* Suppress warning from -Wmissing-prototypes. */ -diff --git a/gdb/arm-linux-tdep.c b/gdb/arm-linux-tdep.c -index 773a93384f7..c0dfc5fcf3e 100644 ---- a/gdb/arm-linux-tdep.c -+++ b/gdb/arm-linux-tdep.c -@@ -1763,7 +1763,7 @@ arm_linux_init_abi (struct gdbarch_info info, - tdep->jb_elt_size = ARM_LINUX_JB_ELEMENT_SIZE; - - set_solib_svr4_fetch_link_map_offsets -- (gdbarch, svr4_ilp32_fetch_link_map_offsets); -+ (gdbarch, linux_ilp32_fetch_link_map_offsets); - - /* Single stepping. */ - set_gdbarch_software_single_step (gdbarch, arm_linux_software_single_step); -diff --git a/gdb/cris-linux-tdep.c b/gdb/cris-linux-tdep.c -index 4c1a4529986..68a12dbe0e9 100644 ---- a/gdb/cris-linux-tdep.c -+++ b/gdb/cris-linux-tdep.c -@@ -43,7 +43,7 @@ cris_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) - svr4_fetch_objfile_link_map); - - set_solib_svr4_fetch_link_map_offsets (gdbarch, -- svr4_ilp32_fetch_link_map_offsets); -+ linux_ilp32_fetch_link_map_offsets); - - } - -diff --git a/gdb/csky-linux-tdep.c b/gdb/csky-linux-tdep.c -index e38ec652561..3a52a87b647 100644 ---- a/gdb/csky-linux-tdep.c -+++ b/gdb/csky-linux-tdep.c -@@ -239,7 +239,7 @@ csky_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) - set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target); - set_gdbarch_skip_solib_resolver (gdbarch, glibc_skip_solib_resolver); - set_solib_svr4_fetch_link_map_offsets (gdbarch, -- svr4_ilp32_fetch_link_map_offsets); -+ linux_ilp32_fetch_link_map_offsets); - - /* Enable TLS support. */ - set_gdbarch_fetch_tls_load_module_address (gdbarch, -diff --git a/gdb/hppa-linux-tdep.c b/gdb/hppa-linux-tdep.c -index 4bdaa1dfaee..52c642f0c7f 100644 ---- a/gdb/hppa-linux-tdep.c -+++ b/gdb/hppa-linux-tdep.c -@@ -501,7 +501,7 @@ hppa_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) - - /* GNU/Linux uses SVR4-style shared libraries. */ - set_solib_svr4_fetch_link_map_offsets -- (gdbarch, svr4_ilp32_fetch_link_map_offsets); -+ (gdbarch, linux_ilp32_fetch_link_map_offsets); - - tdep->in_solib_call_trampoline = hppa_in_solib_call_trampoline; - set_gdbarch_skip_trampoline_code (gdbarch, hppa_skip_trampoline_code); -diff --git a/gdb/i386-linux-tdep.c b/gdb/i386-linux-tdep.c -index c0df916ce6d..1c065eecb4d 100644 ---- a/gdb/i386-linux-tdep.c -+++ b/gdb/i386-linux-tdep.c -@@ -1044,7 +1044,7 @@ i386_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) - /* GNU/Linux uses SVR4-style shared libraries. */ - set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target); - set_solib_svr4_fetch_link_map_offsets -- (gdbarch, svr4_ilp32_fetch_link_map_offsets); -+ (gdbarch, linux_ilp32_fetch_link_map_offsets); - - /* GNU/Linux uses the dynamic linker included in the GNU C Library. */ - set_gdbarch_skip_solib_resolver (gdbarch, glibc_skip_solib_resolver); -diff --git a/gdb/ia64-linux-tdep.c b/gdb/ia64-linux-tdep.c -index a17ec590002..71767ddf83e 100644 ---- a/gdb/ia64-linux-tdep.c -+++ b/gdb/ia64-linux-tdep.c -@@ -237,7 +237,7 @@ ia64_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) - set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target); - - set_solib_svr4_fetch_link_map_offsets -- (gdbarch, svr4_lp64_fetch_link_map_offsets); -+ (gdbarch, linux_lp64_fetch_link_map_offsets); - - /* Enable TLS support. */ - set_gdbarch_fetch_tls_load_module_address (gdbarch, -diff --git a/gdb/linux-tdep.c b/gdb/linux-tdep.c -index 637d3d36a0b..ae2f7c14f6d 100644 ---- a/gdb/linux-tdep.c -+++ b/gdb/linux-tdep.c -@@ -41,6 +41,7 @@ - #include "gdbsupport/gdb_optional.h" - #include "gcore.h" - #include "gcore-elf.h" -+#include "solib-svr4.h" - - #include - -@@ -2724,3 +2725,62 @@ more information about this file, refer to the manpage of proc(5) and core(5).") - NULL, show_dump_excluded_mappings, - &setlist, &showlist); - } -+ -+/* Fetch (and possibly build) an appropriate `link_map_offsets' for -+ ILP32/LP64 Linux systems which don't have the r_ldsomap field. */ -+ -+link_map_offsets * -+linux_ilp32_fetch_link_map_offsets () -+{ -+ static link_map_offsets lmo; -+ static link_map_offsets *lmp = nullptr; -+ -+ if (lmp == nullptr) -+ { -+ lmp = &lmo; -+ -+ lmo.r_version_offset = 0; -+ lmo.r_version_size = 4; -+ lmo.r_map_offset = 4; -+ lmo.r_brk_offset = 8; -+ lmo.r_ldsomap_offset = -1; -+ -+ /* Everything we need is in the first 20 bytes. */ -+ lmo.link_map_size = 20; -+ lmo.l_addr_offset = 0; -+ lmo.l_name_offset = 4; -+ lmo.l_ld_offset = 8; -+ lmo.l_next_offset = 12; -+ lmo.l_prev_offset = 16; -+ } -+ -+ return lmp; -+} -+ -+link_map_offsets * -+linux_lp64_fetch_link_map_offsets () -+{ -+ static link_map_offsets lmo; -+ static link_map_offsets *lmp = nullptr; -+ -+ if (lmp == nullptr) -+ { -+ lmp = &lmo; -+ -+ lmo.r_version_offset = 0; -+ lmo.r_version_size = 4; -+ lmo.r_map_offset = 8; -+ lmo.r_brk_offset = 16; -+ lmo.r_ldsomap_offset = -1; -+ -+ /* Everything we need is in the first 40 bytes. */ -+ lmo.link_map_size = 40; -+ lmo.l_addr_offset = 0; -+ lmo.l_name_offset = 8; -+ lmo.l_ld_offset = 16; -+ lmo.l_next_offset = 24; -+ lmo.l_prev_offset = 32; -+ } -+ -+ return lmp; -+} -diff --git a/gdb/linux-tdep.h b/gdb/linux-tdep.h -index 28b60e46579..b5c1184bb09 100644 ---- a/gdb/linux-tdep.h -+++ b/gdb/linux-tdep.h -@@ -98,4 +98,9 @@ extern CORE_ADDR linux_get_hwcap (struct target_ops *target); - error, 0 is returned. */ - extern CORE_ADDR linux_get_hwcap2 (struct target_ops *target); - -+/* Fetch (and possibly build) an appropriate `struct link_map_offsets' -+ for ILP32 and LP64 Linux systems. */ -+extern struct link_map_offsets *linux_ilp32_fetch_link_map_offsets (); -+extern struct link_map_offsets *linux_lp64_fetch_link_map_offsets (); -+ - #endif /* linux-tdep.h */ -diff --git a/gdb/m32r-linux-tdep.c b/gdb/m32r-linux-tdep.c -index 24807de0b2b..af0b5c01d04 100644 ---- a/gdb/m32r-linux-tdep.c -+++ b/gdb/m32r-linux-tdep.c -@@ -461,7 +461,7 @@ m32r_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) - /* GNU/Linux uses SVR4-style shared libraries. */ - set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target); - set_solib_svr4_fetch_link_map_offsets -- (gdbarch, svr4_ilp32_fetch_link_map_offsets); -+ (gdbarch, linux_ilp32_fetch_link_map_offsets); - - /* Core file support. */ - set_gdbarch_iterate_over_regset_sections -diff --git a/gdb/m68k-linux-tdep.c b/gdb/m68k-linux-tdep.c -index 7543a35e611..ad4d75adb4d 100644 ---- a/gdb/m68k-linux-tdep.c -+++ b/gdb/m68k-linux-tdep.c -@@ -408,7 +408,7 @@ m68k_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) - - /* GNU/Linux uses SVR4-style shared libraries. */ - set_solib_svr4_fetch_link_map_offsets (gdbarch, -- svr4_ilp32_fetch_link_map_offsets); -+ linux_ilp32_fetch_link_map_offsets); - - /* GNU/Linux uses the dynamic linker included in the GNU C Library. */ - set_gdbarch_skip_solib_resolver (gdbarch, glibc_skip_solib_resolver); -diff --git a/gdb/microblaze-linux-tdep.c b/gdb/microblaze-linux-tdep.c -index 17cdc2516d4..e9ce7cd7fe0 100644 ---- a/gdb/microblaze-linux-tdep.c -+++ b/gdb/microblaze-linux-tdep.c -@@ -124,7 +124,7 @@ microblaze_linux_init_abi (struct gdbarch_info info, - - /* Shared library handling. */ - set_solib_svr4_fetch_link_map_offsets (gdbarch, -- svr4_ilp32_fetch_link_map_offsets); -+ linux_ilp32_fetch_link_map_offsets); - - /* Trampolines. */ - tramp_frame_prepend_unwinder (gdbarch, -diff --git a/gdb/mips-linux-tdep.c b/gdb/mips-linux-tdep.c -index 1ceed5250fe..ce287f6a354 100644 ---- a/gdb/mips-linux-tdep.c -+++ b/gdb/mips-linux-tdep.c -@@ -1542,7 +1542,7 @@ mips_linux_init_abi (struct gdbarch_info info, - set_gdbarch_get_longjmp_target (gdbarch, - mips_linux_get_longjmp_target); - set_solib_svr4_fetch_link_map_offsets -- (gdbarch, svr4_ilp32_fetch_link_map_offsets); -+ (gdbarch, linux_ilp32_fetch_link_map_offsets); - tramp_frame_prepend_unwinder (gdbarch, µmips_linux_o32_sigframe); - tramp_frame_prepend_unwinder (gdbarch, - µmips_linux_o32_rt_sigframe); -@@ -1554,7 +1554,7 @@ mips_linux_init_abi (struct gdbarch_info info, - set_gdbarch_get_longjmp_target (gdbarch, - mips_linux_get_longjmp_target); - set_solib_svr4_fetch_link_map_offsets -- (gdbarch, svr4_ilp32_fetch_link_map_offsets); -+ (gdbarch, linux_ilp32_fetch_link_map_offsets); - set_gdbarch_long_double_bit (gdbarch, 128); - /* These floatformats should probably be renamed. MIPS uses - the same 128-bit IEEE floating point format that IA-64 uses, -@@ -1570,7 +1570,7 @@ mips_linux_init_abi (struct gdbarch_info info, - set_gdbarch_get_longjmp_target (gdbarch, - mips64_linux_get_longjmp_target); - set_solib_svr4_fetch_link_map_offsets -- (gdbarch, svr4_lp64_fetch_link_map_offsets); -+ (gdbarch, linux_lp64_fetch_link_map_offsets); - set_gdbarch_long_double_bit (gdbarch, 128); - /* These floatformats should probably be renamed. MIPS uses - the same 128-bit IEEE floating point format that IA-64 uses, -diff --git a/gdb/mn10300-linux-tdep.c b/gdb/mn10300-linux-tdep.c -index 1a2e0493118..7c68d1116c5 100644 ---- a/gdb/mn10300-linux-tdep.c -+++ b/gdb/mn10300-linux-tdep.c -@@ -709,7 +709,7 @@ am33_linux_init_osabi (struct gdbarch_info info, struct gdbarch *gdbarch) - set_gdbarch_iterate_over_regset_sections - (gdbarch, am33_iterate_over_regset_sections); - set_solib_svr4_fetch_link_map_offsets -- (gdbarch, svr4_ilp32_fetch_link_map_offsets); -+ (gdbarch, linux_ilp32_fetch_link_map_offsets); - - tramp_frame_prepend_unwinder (gdbarch, &am33_linux_sigframe); - tramp_frame_prepend_unwinder (gdbarch, &am33_linux_rt_sigframe); -diff --git a/gdb/nios2-linux-tdep.c b/gdb/nios2-linux-tdep.c -index 661c8b38f72..bd86146c878 100644 ---- a/gdb/nios2-linux-tdep.c -+++ b/gdb/nios2-linux-tdep.c -@@ -226,7 +226,7 @@ nios2_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) - set_gdbarch_skip_solib_resolver (gdbarch, glibc_skip_solib_resolver); - - set_solib_svr4_fetch_link_map_offsets (gdbarch, -- svr4_ilp32_fetch_link_map_offsets); -+ linux_ilp32_fetch_link_map_offsets); - /* Enable TLS support. */ - set_gdbarch_fetch_tls_load_module_address (gdbarch, - svr4_fetch_objfile_link_map); -diff --git a/gdb/or1k-linux-tdep.c b/gdb/or1k-linux-tdep.c -index 1c3f8db7492..2ad55f0d9ec 100644 ---- a/gdb/or1k-linux-tdep.c -+++ b/gdb/or1k-linux-tdep.c -@@ -143,7 +143,7 @@ or1k_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) - linux_init_abi (info, gdbarch, 0); - - set_solib_svr4_fetch_link_map_offsets (gdbarch, -- svr4_ilp32_fetch_link_map_offsets); -+ linux_ilp32_fetch_link_map_offsets); - - /* GNU/Linux uses SVR4-style shared libraries. */ - set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target); -diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c -index 1e94922f25a..e62f45a35d8 100644 ---- a/gdb/ppc-linux-tdep.c -+++ b/gdb/ppc-linux-tdep.c -@@ -2035,7 +2035,7 @@ ppc_linux_init_abi (struct gdbarch_info info, - /* Shared library handling. */ - set_gdbarch_skip_trampoline_code (gdbarch, ppc_skip_trampoline_code); - set_solib_svr4_fetch_link_map_offsets -- (gdbarch, svr4_ilp32_fetch_link_map_offsets); -+ (gdbarch, linux_ilp32_fetch_link_map_offsets); - - /* Setting the correct XML syscall filename. */ - set_xml_syscall_file_name (gdbarch, XML_SYSCALL_FILENAME_PPC); -@@ -2087,7 +2087,7 @@ ppc_linux_init_abi (struct gdbarch_info info, - /* Shared library handling. */ - set_gdbarch_skip_trampoline_code (gdbarch, ppc64_skip_trampoline_code); - set_solib_svr4_fetch_link_map_offsets -- (gdbarch, svr4_lp64_fetch_link_map_offsets); -+ (gdbarch, linux_lp64_fetch_link_map_offsets); - - /* Setting the correct XML syscall filename. */ - set_xml_syscall_file_name (gdbarch, XML_SYSCALL_FILENAME_PPC64); -diff --git a/gdb/riscv-linux-tdep.c b/gdb/riscv-linux-tdep.c -index 49dc75bb618..7351e1901d6 100644 ---- a/gdb/riscv-linux-tdep.c -+++ b/gdb/riscv-linux-tdep.c -@@ -187,8 +187,8 @@ riscv_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) - - set_solib_svr4_fetch_link_map_offsets (gdbarch, - (riscv_isa_xlen (gdbarch) == 4 -- ? svr4_ilp32_fetch_link_map_offsets -- : svr4_lp64_fetch_link_map_offsets)); -+ ? linux_ilp32_fetch_link_map_offsets -+ : linux_lp64_fetch_link_map_offsets)); - - /* GNU/Linux uses SVR4-style shared libraries. */ - set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target); -diff --git a/gdb/s390-linux-tdep.c b/gdb/s390-linux-tdep.c -index 1f40e10e3d3..04e3fc640d2 100644 ---- a/gdb/s390-linux-tdep.c -+++ b/gdb/s390-linux-tdep.c -@@ -1158,7 +1158,7 @@ s390_linux_init_abi_31 (struct gdbarch_info info, struct gdbarch *gdbarch) - s390_linux_init_abi_any (info, gdbarch); - - set_solib_svr4_fetch_link_map_offsets (gdbarch, -- svr4_ilp32_fetch_link_map_offsets); -+ linux_ilp32_fetch_link_map_offsets); - set_xml_syscall_file_name (gdbarch, XML_SYSCALL_FILENAME_S390); - } - -@@ -1174,7 +1174,7 @@ s390_linux_init_abi_64 (struct gdbarch_info info, struct gdbarch *gdbarch) - s390_linux_init_abi_any (info, gdbarch); - - set_solib_svr4_fetch_link_map_offsets (gdbarch, -- svr4_lp64_fetch_link_map_offsets); -+ linux_lp64_fetch_link_map_offsets); - set_xml_syscall_file_name (gdbarch, XML_SYSCALL_FILENAME_S390X); - } - -diff --git a/gdb/sh-linux-tdep.c b/gdb/sh-linux-tdep.c -index 700df35bc3b..8315d46fddf 100644 ---- a/gdb/sh-linux-tdep.c -+++ b/gdb/sh-linux-tdep.c -@@ -189,7 +189,7 @@ sh_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) - /* GNU/Linux uses SVR4-style shared libraries. */ - set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target); - set_solib_svr4_fetch_link_map_offsets -- (gdbarch, svr4_ilp32_fetch_link_map_offsets); -+ (gdbarch, linux_ilp32_fetch_link_map_offsets); - set_gdbarch_skip_solib_resolver (gdbarch, glibc_skip_solib_resolver); - - set_gdbarch_fetch_tls_load_module_address (gdbarch, -diff --git a/gdb/sparc-linux-tdep.c b/gdb/sparc-linux-tdep.c -index 8d8efb49911..4ad77e24d82 100644 ---- a/gdb/sparc-linux-tdep.c -+++ b/gdb/sparc-linux-tdep.c -@@ -436,7 +436,7 @@ sparc32_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) - /* GNU/Linux has SVR4-style shared libraries... */ - set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target); - set_solib_svr4_fetch_link_map_offsets -- (gdbarch, svr4_ilp32_fetch_link_map_offsets); -+ (gdbarch, linux_ilp32_fetch_link_map_offsets); - - /* ...which means that we need some special handling when doing - prologue analysis. */ -diff --git a/gdb/sparc64-linux-tdep.c b/gdb/sparc64-linux-tdep.c -index ea692ac00ef..e63fa87c69b 100644 ---- a/gdb/sparc64-linux-tdep.c -+++ b/gdb/sparc64-linux-tdep.c -@@ -383,7 +383,7 @@ sparc64_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) - /* GNU/Linux has SVR4-style shared libraries... */ - set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target); - set_solib_svr4_fetch_link_map_offsets -- (gdbarch, svr4_lp64_fetch_link_map_offsets); -+ (gdbarch, linux_lp64_fetch_link_map_offsets); - - /* ...which means that we need some special handling when doing - prologue analysis. */ -diff --git a/gdb/tilegx-linux-tdep.c b/gdb/tilegx-linux-tdep.c -index 382e7f6d908..353497a3434 100644 ---- a/gdb/tilegx-linux-tdep.c -+++ b/gdb/tilegx-linux-tdep.c -@@ -121,10 +121,10 @@ tilegx_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) - /* GNU/Linux uses SVR4-style shared libraries. */ - if (arch_size == 32) - set_solib_svr4_fetch_link_map_offsets (gdbarch, -- svr4_ilp32_fetch_link_map_offsets); -+ linux_ilp32_fetch_link_map_offsets); - else - set_solib_svr4_fetch_link_map_offsets (gdbarch, -- svr4_lp64_fetch_link_map_offsets); -+ linux_lp64_fetch_link_map_offsets); - - /* Enable TLS support. */ - set_gdbarch_fetch_tls_load_module_address (gdbarch, -diff --git a/gdb/xtensa-linux-tdep.c b/gdb/xtensa-linux-tdep.c -index 2eba9aaa21d..c9e2519b1e7 100644 ---- a/gdb/xtensa-linux-tdep.c -+++ b/gdb/xtensa-linux-tdep.c -@@ -113,7 +113,7 @@ xtensa_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) - linux_init_abi (info, gdbarch, 0); - - set_solib_svr4_fetch_link_map_offsets -- (gdbarch, svr4_ilp32_fetch_link_map_offsets); -+ (gdbarch, linux_ilp32_fetch_link_map_offsets); - - set_gdbarch_gdb_signal_from_target (gdbarch, - xtensa_linux_gdb_signal_from_target); --- -2.34.1 - -From 4eb629d50d449a079d3f5e22f26f45855939164f Mon Sep 17 00:00:00 2001 -From: "H.J. Lu" -Date: Mon, 16 Aug 2021 08:18:18 -0700 -Subject: [PATCH] gdbserver: Check r_version < 1 for Linux debugger interface - -Update gdbserver to check r_version < 1 instead of r_version != 1 so -that r_version can be bumped for a new field in the glibc debugger -interface to support multiple namespaces. Since so far, the gdbserver -only reads fields defined for r_version == 1, it is compatible with -r_version >= 1. - -All future glibc debugger interface changes will be backward compatible. -If there is ever the need for backward incompatible change to the glibc -debugger interface, a new DT_XXX element will be provided to access the -new incompatible interface. - -Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=11839 ---- - gdbserver/linux-low.cc | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/gdbserver/linux-low.cc b/gdbserver/linux-low.cc -index 5c6191d941c..fc7a995351d 100644 ---- a/gdbserver/linux-low.cc -+++ b/gdbserver/linux-low.cc -@@ -6845,7 +6845,7 @@ linux_process_target::qxfer_libraries_svr4 (const char *annex, - if (linux_read_memory (priv->r_debug + lmo->r_version_offset, - (unsigned char *) &r_version, - sizeof (r_version)) != 0 -- || r_version != 1) -+ || r_version < 1) - { - warning ("unexpected r_debug version %d", r_version); - } --- -2.34.1 - diff --git a/gdb-record-handle-statx-system-call.patch b/gdb-record-handle-statx-system-call.patch index e74898a..648095e 100644 --- a/gdb-record-handle-statx-system-call.patch +++ b/gdb-record-handle-statx-system-call.patch @@ -41,10 +41,10 @@ Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28461 2 files changed, 7 insertions(+) diff --git a/gdb/linux-record.c b/gdb/linux-record.c -index 4dfd3cfa599..9dc25284642 100644 +index 0a84bad6983..0af1ef2a9e0 100644 --- a/gdb/linux-record.c +++ b/gdb/linux-record.c -@@ -1043,6 +1043,12 @@ Do you want to stop the program?"), +@@ -1046,6 +1046,12 @@ Do you want to stop the program?"), return -1; break; @@ -58,14 +58,14 @@ index 4dfd3cfa599..9dc25284642 100644 if (record_mem_at_reg (regcache, tdep->arg1, tdep->size_old_utsname)) diff --git a/gdb/linux-record.h b/gdb/linux-record.h -index f2e6bdc6e42..35225071a95 100644 +index 07f0c5a2604..219c67f888d 100644 --- a/gdb/linux-record.h +++ b/gdb/linux-record.h -@@ -509,6 +509,7 @@ enum gdb_syscall { - gdb_sys_epoll_create1 = 329, +@@ -510,6 +510,7 @@ enum gdb_syscall { gdb_sys_dup3 = 330, gdb_sys_pipe2 = 331, -+ gdb_sys_statx = 383, gdb_sys_inotify_init1 = 332, ++ gdb_sys_statx = 383, gdb_sys_socket = 500, gdb_sys_connect = 501, + gdb_sys_accept = 502, diff --git a/gdb-rhbz1976887-field-location-kind.patch b/gdb-rhbz1976887-field-location-kind.patch deleted file mode 100644 index 7293ff6..0000000 --- a/gdb-rhbz1976887-field-location-kind.patch +++ /dev/null @@ -1,30 +0,0 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Alexandra=20H=C3=A1jkov=C3=A1?= -Date: Wed, 29 Sep 2021 10:58:50 +0200 -Subject: gdb-rhbz1976887-field-location-kind.patch - -;;Backport upstream patch which fixes internal-error: Unexpected -;;type field location kind (RHBZ 1976887). - -gdbtypes.c: Add the case for FIELD_LOC_KIND_DWARF_BLOCK - -The case for FIELD_LOC_KIND_DWARF_BLOCK was missing for -switch TYPE_FIELD_LOC_KIND. Thas caused an internal-error -under some circumstances. - -Fixes bug 28030. - -diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c ---- a/gdb/gdbtypes.c -+++ b/gdb/gdbtypes.c -@@ -5571,6 +5571,10 @@ copy_type_recursive (struct objfile *objfile, - xstrdup (TYPE_FIELD_STATIC_PHYSNAME (type, - i))); - break; -+ case FIELD_LOC_KIND_DWARF_BLOCK: -+ SET_FIELD_DWARF_BLOCK (new_type->field (i), -+ TYPE_FIELD_DWARF_BLOCK (type, i)); -+ break; - default: - internal_error (__FILE__, __LINE__, - _("Unexpected type field location kind: %d"), diff --git a/gdb-rhbz2012976-paper-over-fortran-lex-problems.patch b/gdb-rhbz2012976-paper-over-fortran-lex-problems.patch deleted file mode 100644 index 7f21dd7..0000000 --- a/gdb-rhbz2012976-paper-over-fortran-lex-problems.patch +++ /dev/null @@ -1,185 +0,0 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Kevin Buettner -Date: Mon, 11 Oct 2021 11:22:04 -0700 -Subject: gdb-rhbz2012976-paper-over-fortran-lex-problems.patch - -;; Backport gdb.fortran testsuite changes in order to avoid Fortran -;; lexical analyzer bug. - -[gdb/testsuite] Fix FAIL in gdb.mi/mi-var-child-f.exp - -When running test-case gdb.mi/mi-var-child-f.exp on openSUSE Tumbleweed -(with glibc 2.34) I run into: -... -(gdb) ^M -PASS: gdb.mi/mi-var-child-f.exp: mi runto prog_array -Expecting: ^(-var-create array \* array[^M -]+)?(\^done,name="array",numchild="[0-9]+",value=".*",type=.*,has_more="0"[^M -]+[(]gdb[)] ^M -[ ]*) --var-create array * array^M -&"Attempt to use a type name as an expression.\n"^M -^error,msg="-var-create: unable to create variable object"^M -(gdb) ^M -FAIL: gdb.mi/mi-var-child-f.exp: create local variable array (unexpected output) -... - -The problem is that the name array is used both: -- as the name for a local variable -- as the name of a type in glibc, in file malloc/dynarray-skeleton.c, as included - by nss/nss_files/files-hosts.c. - -Fix this by ignoring the shared lib symbols. - -Likewise in a couple of other fortran tests. - -Tested on x86_64-linux. - -diff --git a/gdb/testsuite/gdb.fortran/allocated.exp b/gdb/testsuite/gdb.fortran/allocated.exp ---- a/gdb/testsuite/gdb.fortran/allocated.exp -+++ b/gdb/testsuite/gdb.fortran/allocated.exp -@@ -25,11 +25,17 @@ if {[prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \ - return -1 - } - -+# Avoid shared lib symbols. -+gdb_test_no_output "set auto-solib-add off" -+ - if ![fortran_runto_main] { - untested "could not run to main" - return -1 - } - -+# Avoid libc symbols, in particular the 'array' type. -+gdb_test_no_output "nosharedlibrary" -+ - # Set all the breakpoints. - for { set i 1 } { $i < 6 } { incr i } { - gdb_breakpoint [gdb_get_line_number "Breakpoint $i"] -diff --git a/gdb/testsuite/gdb.fortran/array-slices-bad.exp b/gdb/testsuite/gdb.fortran/array-slices-bad.exp ---- a/gdb/testsuite/gdb.fortran/array-slices-bad.exp -+++ b/gdb/testsuite/gdb.fortran/array-slices-bad.exp -@@ -25,11 +25,17 @@ if {[prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \ - return -1 - } - -+# Avoid shared lib symbols. -+gdb_test_no_output "set auto-solib-add off" -+ - if ![fortran_runto_main] { - untested "could not run to main" - return -1 - } - -+# Avoid libc symbols, in particular the 'array' type. -+gdb_test_no_output "nosharedlibrary" -+ - # gdb_breakpoint [gdb_get_line_number "Display Message Breakpoint"] - gdb_breakpoint [gdb_get_line_number "First Breakpoint"] - gdb_breakpoint [gdb_get_line_number "Second Breakpoint"] -diff --git a/gdb/testsuite/gdb.fortran/array-slices-sub-slices.exp b/gdb/testsuite/gdb.fortran/array-slices-sub-slices.exp ---- a/gdb/testsuite/gdb.fortran/array-slices-sub-slices.exp -+++ b/gdb/testsuite/gdb.fortran/array-slices-sub-slices.exp -@@ -25,11 +25,17 @@ if {[prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \ - return -1 - } - -+# Avoid shared lib symbols. -+gdb_test_no_output "set auto-solib-add off" -+ - if ![fortran_runto_main] { - untested "could not run to main" - return -1 - } - -+# Avoid libc symbols, in particular the 'array' type. -+gdb_test_no_output "nosharedlibrary" -+ - # gdb_breakpoint [gdb_get_line_number "Display Message Breakpoint"] - gdb_breakpoint [gdb_get_line_number "Stop Here"] - gdb_breakpoint [gdb_get_line_number "Final Breakpoint"] -diff --git a/gdb/testsuite/gdb.fortran/array-slices.exp b/gdb/testsuite/gdb.fortran/array-slices.exp ---- a/gdb/testsuite/gdb.fortran/array-slices.exp -+++ b/gdb/testsuite/gdb.fortran/array-slices.exp -@@ -55,11 +55,17 @@ proc run_test { repack } { - - clean_restart ${binfile} - -+ # Avoid shared lib symbols. -+ gdb_test_no_output "set auto-solib-add off" -+ - if ![fortran_runto_main] { - untested "could not run to main" - return -1 - } - -+ # Avoid libc symbols, in particular the 'array' type. -+ gdb_test_no_output "nosharedlibrary" -+ - gdb_test_no_output "set fortran repack-array-slices $repack" - - # gdb_breakpoint [gdb_get_line_number "Display Message Breakpoint"] -diff --git a/gdb/testsuite/gdb.fortran/lbound-ubound.exp b/gdb/testsuite/gdb.fortran/lbound-ubound.exp ---- a/gdb/testsuite/gdb.fortran/lbound-ubound.exp -+++ b/gdb/testsuite/gdb.fortran/lbound-ubound.exp -@@ -25,12 +25,17 @@ if {[prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \ - return -1 - } - -+# Avoid shared lib symbols. -+gdb_test_no_output "set auto-solib-add off" - - if ![fortran_runto_main] { - untested "could not run to main" - return -1 - } - -+# Avoid libc symbols, in particular the 'array' type. -+gdb_test_no_output "nosharedlibrary" -+ - gdb_breakpoint [gdb_get_line_number "Test Breakpoint"] - gdb_breakpoint [gdb_get_line_number "Final Breakpoint"] - -diff --git a/gdb/testsuite/gdb.fortran/subarray.exp b/gdb/testsuite/gdb.fortran/subarray.exp ---- a/gdb/testsuite/gdb.fortran/subarray.exp -+++ b/gdb/testsuite/gdb.fortran/subarray.exp -@@ -27,16 +27,17 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug f90}]} { - return -1 - } - --gdb_exit --gdb_start --gdb_reinitialize_dir $srcdir/$subdir --gdb_load ${binfile} -+# Avoid shared lib symbols. -+gdb_test_no_output "set auto-solib-add off" - - if ![fortran_runto_main] then { - perror "couldn't run to main" - continue - } - -+# Avoid libc symbols, in particular the 'array' type. -+gdb_test_no_output "nosharedlibrary" -+ - # Try to set breakpoint at the last write statement. - - set bp_location [gdb_get_line_number "str(:)"] -diff --git a/gdb/testsuite/gdb.mi/mi-var-child-f.exp b/gdb/testsuite/gdb.mi/mi-var-child-f.exp ---- a/gdb/testsuite/gdb.mi/mi-var-child-f.exp -+++ b/gdb/testsuite/gdb.mi/mi-var-child-f.exp -@@ -36,8 +36,14 @@ if {[gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" \ - mi_gdb_reinitialize_dir $srcdir/$subdir - mi_gdb_load ${binfile} - -+# Avoid shared lib symbols. -+mi_gdb_test "-gdb-set auto-solib-add off" "\\^done" -+ - mi_runto prog_array - -+# Avoid libc symbols, in particular the 'array' type. -+mi_gdb_test "nosharedlibrary" ".*\\^done" -+ - mi_create_varobj "array" "array" "create local variable array" - - diff --git a/gdb-symtab-add-call_site_eq-and-call_site_hash.patch b/gdb-symtab-add-call_site_eq-and-call_site_hash.patch deleted file mode 100644 index 21c7d0f..0000000 --- a/gdb-symtab-add-call_site_eq-and-call_site_hash.patch +++ /dev/null @@ -1,110 +0,0 @@ -[gdb/symtab] Add call_site_eq and call_site_hash - -In commit b4c919f7525 "[gdb/symtab] Fix htab_find_slot call in -read_call_site_scope" , I removed the comment: -... -It must be the first field as we overload core_addr_hash and core_addr_eq for -it. -... -for field pc of struct call_site. - -However, this was not tested, and when indeed moving field pc to the second -location, we run into a testsuite failure in gdb.trace/entry-values.exp. - -This is caused by core_addr_eq (the eq_f function for the htab) being -called with a pointer to the pc field (as passed into htab_find_slot) and a -pointer to a hash table element. Now that pc is no longer the first field, -the pointer to hash table element no longer points to the pc field. - -This could be fixed by simply reinstating the comment, but we're trying to -get rid of this kind of tricks that make refactoring more difficult. - -Instead, fix this by: -- reverting commit b4c919f7525, apart from the comment removal, such that - we're passing a pointer to element to htab_find_slot -- updating the htab_find_slot call in compunit_symtab::find_call_site - in a similar manner -- adding a call_site_eq and call_site_hash, and using these in the hash table - instead of core_addr_eq and core_addr_hash. - -Tested on x86_64-linux, both with and without a trigger patch that moves pc to -the second location in struct call_site. - ---- - gdb/dwarf2/read.c | 7 ++++--- - gdb/gdbtypes.h | 15 +++++++++++++++ - gdb/symtab.c | 5 ++++- - 3 files changed, 23 insertions(+), 4 deletions(-) - -diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c -index d3742bbce8c..7def1e246c4 100644 ---- a/gdb/dwarf2/read.c -+++ b/gdb/dwarf2/read.c -@@ -13287,7 +13287,7 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu) - struct gdbarch *gdbarch = objfile->arch (); - CORE_ADDR pc, baseaddr; - struct attribute *attr; -- struct call_site *call_site; -+ struct call_site *call_site, call_site_local; - void **slot; - int nparams; - struct die_info *child_die; -@@ -13312,10 +13312,11 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu) - pc = gdbarch_adjust_dwarf2_addr (gdbarch, pc); - - if (cu->call_site_htab == NULL) -- cu->call_site_htab = htab_create_alloc_ex (16, core_addr_hash, core_addr_eq, -+ cu->call_site_htab = htab_create_alloc_ex (16, call_site_hash, call_site_eq, - NULL, &objfile->objfile_obstack, - hashtab_obstack_allocate, NULL); -- slot = htab_find_slot (cu->call_site_htab, &pc, INSERT); -+ call_site_local.pc = pc; -+ slot = htab_find_slot (cu->call_site_htab, &call_site_local, INSERT); - if (*slot != NULL) - { - complaint (_("Duplicate PC %s for DW_TAG_call_site " -diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h -index f2e077c70a2..77d1e66a6b1 100644 ---- a/gdb/gdbtypes.h -+++ b/gdb/gdbtypes.h -@@ -1806,6 +1806,21 @@ struct call_site - struct call_site_parameter parameter[1]; - }; - -+static inline int -+call_site_eq (const void *a_, const void *b_) -+{ -+ const struct call_site *a = (const call_site *)a_; -+ const struct call_site *b = (const call_site *)b_; -+ return core_addr_eq (&a->pc, &b->pc); -+} -+ -+static inline hashval_t -+call_site_hash (const void *a_) -+{ -+ const struct call_site *a = (const call_site *)a_; -+ return core_addr_hash (&a->pc); -+} -+ - /* The type-specific info for TYPE_CODE_FIXED_POINT types. */ - - struct fixed_point_type_info -diff --git a/gdb/symtab.c b/gdb/symtab.c -index 1d30c8fc7a8..fe430edadb2 100644 ---- a/gdb/symtab.c -+++ b/gdb/symtab.c -@@ -334,10 +334,13 @@ search_domain_name (enum search_domain e) - call_site * - compunit_symtab::find_call_site (CORE_ADDR pc) const - { -+ struct call_site call_site_local; - if (m_call_site_htab == nullptr) - return nullptr; - -- void **slot = htab_find_slot (m_call_site_htab, &pc, NO_INSERT); -+ call_site_local.pc = pc; -+ void **slot -+ = htab_find_slot (m_call_site_htab, &call_site_local, NO_INSERT); - if (slot == nullptr) - return nullptr; - diff --git a/gdb-symtab-c-ify-call_site.patch b/gdb-symtab-c-ify-call_site.patch deleted file mode 100644 index 2620548..0000000 --- a/gdb-symtab-c-ify-call_site.patch +++ /dev/null @@ -1,317 +0,0 @@ -[gdb/symtab] C++-ify call_site - -- add constructor -- add member function call_site::pc () - -Tested on x86_64-linux. - -Co-Authored-By: Tom de Vries - ---- - gdb/dwarf2/frame-tailcall.c | 4 +-- - gdb/dwarf2/loc.c | 18 ++++++------ - gdb/dwarf2/read.c | 27 +++++++++--------- - gdb/gdbtypes.c | 9 ++++++ - gdb/gdbtypes.h | 67 +++++++++++++++++++++++++++++---------------- - gdb/symtab.c | 3 +- - 6 files changed, 77 insertions(+), 51 deletions(-) - -diff --git a/gdb/dwarf2/frame-tailcall.c b/gdb/dwarf2/frame-tailcall.c -index f112b4ecca4..9fe498b0924 100644 ---- a/gdb/dwarf2/frame-tailcall.c -+++ b/gdb/dwarf2/frame-tailcall.c -@@ -240,14 +240,14 @@ pretend_pc (struct frame_info *this_frame, struct tailcall_cache *cache) - gdb_assert (next_levels >= 0); - - if (next_levels < chain->callees) -- return chain->call_site[chain->length - next_levels - 1]->pc; -+ return chain->call_site[chain->length - next_levels - 1]->pc (); - next_levels -= chain->callees; - - /* Otherwise CHAIN->CALLEES are already covered by CHAIN->CALLERS. */ - if (chain->callees != chain->length) - { - if (next_levels < chain->callers) -- return chain->call_site[chain->callers - next_levels - 1]->pc; -+ return chain->call_site[chain->callers - next_levels - 1]->pc (); - next_levels -= chain->callers; - } - -diff --git a/gdb/dwarf2/loc.c b/gdb/dwarf2/loc.c -index d57cdc165ba..83b5fe1ac88 100644 ---- a/gdb/dwarf2/loc.c -+++ b/gdb/dwarf2/loc.c -@@ -920,10 +920,10 @@ call_site_to_target_addr (struct gdbarch *call_site_gdbarch, - { - struct bound_minimal_symbol msym; - -- msym = lookup_minimal_symbol_by_pc (call_site->pc - 1); -+ msym = lookup_minimal_symbol_by_pc (call_site->pc () - 1); - throw_error (NO_ENTRY_VALUE_ERROR, - _("DW_AT_call_target is not specified at %s in %s"), -- paddress (call_site_gdbarch, call_site->pc), -+ paddress (call_site_gdbarch, call_site->pc ()), - (msym.minsym == NULL ? "???" - : msym.minsym->print_name ())); - -@@ -932,12 +932,12 @@ call_site_to_target_addr (struct gdbarch *call_site_gdbarch, - { - struct bound_minimal_symbol msym; - -- msym = lookup_minimal_symbol_by_pc (call_site->pc - 1); -+ msym = lookup_minimal_symbol_by_pc (call_site->pc () - 1); - throw_error (NO_ENTRY_VALUE_ERROR, - _("DW_AT_call_target DWARF block resolving " - "requires known frame which is currently not " - "available at %s in %s"), -- paddress (call_site_gdbarch, call_site->pc), -+ paddress (call_site_gdbarch, call_site->pc ()), - (msym.minsym == NULL ? "???" - : msym.minsym->print_name ())); - -@@ -966,11 +966,11 @@ call_site_to_target_addr (struct gdbarch *call_site_gdbarch, - msym = lookup_minimal_symbol (physname, NULL, NULL); - if (msym.minsym == NULL) - { -- msym = lookup_minimal_symbol_by_pc (call_site->pc - 1); -+ msym = lookup_minimal_symbol_by_pc (call_site->pc () - 1); - throw_error (NO_ENTRY_VALUE_ERROR, - _("Cannot find function \"%s\" for a call site target " - "at %s in %s"), -- physname, paddress (call_site_gdbarch, call_site->pc), -+ physname, paddress (call_site_gdbarch, call_site->pc ()), - (msym.minsym == NULL ? "???" - : msym.minsym->print_name ())); - -@@ -1076,7 +1076,7 @@ func_verify_no_selftailcall (struct gdbarch *gdbarch, CORE_ADDR verify_addr) - static void - tailcall_dump (struct gdbarch *gdbarch, const struct call_site *call_site) - { -- CORE_ADDR addr = call_site->pc; -+ CORE_ADDR addr = call_site->pc (); - struct bound_minimal_symbol msym = lookup_minimal_symbol_by_pc (addr - 1); - - fprintf_unfiltered (gdb_stdlog, " %s(%s)", paddress (gdbarch, addr), -@@ -1252,7 +1252,7 @@ call_site_find_chain_1 (struct gdbarch *gdbarch, CORE_ADDR caller_pc, - - if (target_call_site) - { -- if (addr_hash.insert (target_call_site->pc).second) -+ if (addr_hash.insert (target_call_site->pc ()).second) - { - /* Successfully entered TARGET_CALL_SITE. */ - -@@ -1271,7 +1271,7 @@ call_site_find_chain_1 (struct gdbarch *gdbarch, CORE_ADDR caller_pc, - call_site = chain.back (); - chain.pop_back (); - -- size_t removed = addr_hash.erase (call_site->pc); -+ size_t removed = addr_hash.erase (call_site->pc ()); - gdb_assert (removed == 1); - - target_call_site = call_site->tail_call_next; -diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c -index 7def1e246c4..59ce3cf2b45 100644 ---- a/gdb/dwarf2/read.c -+++ b/gdb/dwarf2/read.c -@@ -13287,7 +13287,6 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu) - struct gdbarch *gdbarch = objfile->arch (); - CORE_ADDR pc, baseaddr; - struct attribute *attr; -- struct call_site *call_site, call_site_local; - void **slot; - int nparams; - struct die_info *child_die; -@@ -13312,10 +13311,11 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu) - pc = gdbarch_adjust_dwarf2_addr (gdbarch, pc); - - if (cu->call_site_htab == NULL) -- cu->call_site_htab = htab_create_alloc_ex (16, call_site_hash, call_site_eq, -- NULL, &objfile->objfile_obstack, -+ cu->call_site_htab = htab_create_alloc_ex (16, call_site::hash, -+ call_site::eq, NULL, -+ &objfile->objfile_obstack, - hashtab_obstack_allocate, NULL); -- call_site_local.pc = pc; -+ struct call_site call_site_local (pc, nullptr, nullptr); - slot = htab_find_slot (cu->call_site_htab, &call_site_local, INSERT); - if (*slot != NULL) - { -@@ -13345,14 +13345,16 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu) - nparams++; - } - -- call_site -- = ((struct call_site *) -- obstack_alloc (&objfile->objfile_obstack, -- sizeof (*call_site) -- + (sizeof (*call_site->parameter) * (nparams - 1)))); -+ struct call_site *call_site -+ = new (XOBNEWVAR (&objfile->objfile_obstack, -+ struct call_site, -+ sizeof (*call_site) + sizeof (call_site->parameter[0]) * nparams)) -+ struct call_site (pc, cu->per_cu, per_objfile); - *slot = call_site; -- memset (call_site, 0, sizeof (*call_site) - sizeof (*call_site->parameter)); -- call_site->pc = pc; -+ -+ /* We never call the destructor of call_site, so we must ensure it is -+ trivially destructible. */ -+ gdb_static_assert(std::is_trivially_destructible::value); - - if (dwarf2_flag_true_p (die, DW_AT_call_tail_call, cu) - || dwarf2_flag_true_p (die, DW_AT_GNU_tail_call, cu)) -@@ -13473,9 +13475,6 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu) - "block nor reference, for DIE %s [in module %s]"), - sect_offset_str (die->sect_off), objfile_name (objfile)); - -- call_site->per_cu = cu->per_cu; -- call_site->per_objfile = per_objfile; -- - for (child_die = die->child; - child_die && child_die->tag; - child_die = child_die->sibling) -diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c -index 05ce646bc59..1b3ed1b32ed 100644 ---- a/gdb/gdbtypes.c -+++ b/gdb/gdbtypes.c -@@ -37,6 +37,7 @@ - #include "cp-support.h" - #include "bcache.h" - #include "dwarf2/loc.h" -+#include "dwarf2/read.h" - #include "gdbcore.h" - #include "floatformat.h" - #include "f-lang.h" -@@ -6301,6 +6302,14 @@ objfile_type (struct objfile *objfile) - return objfile_type; - } - -+/* See gdbtypes.h. */ -+ -+CORE_ADDR -+call_site::pc () const -+{ -+ return m_pc; -+} -+ - void _initialize_gdbtypes (); - void - _initialize_gdbtypes () -diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h -index 77d1e66a6b1..a071188ffa1 100644 ---- a/gdb/gdbtypes.h -+++ b/gdb/gdbtypes.h -@@ -1775,52 +1775,71 @@ struct call_site_parameter - - struct call_site - { -- /* Address of the first instruction after this call. */ -- -- CORE_ADDR pc; -+ call_site (CORE_ADDR pc, dwarf2_per_cu_data *per_cu, -+ dwarf2_per_objfile *per_objfile) -+ : per_cu (per_cu), per_objfile (per_objfile), m_pc (pc) -+ {} -+ -+ static int -+ eq (const call_site *a, const call_site *b) -+ { -+ return core_addr_eq (&a->m_pc, &b->m_pc); -+ } -+ -+ static hashval_t -+ hash (const call_site *a) -+ { -+ return core_addr_hash (&a->m_pc); -+ } -+ -+ static int -+ eq (const void *a, const void *b) -+ { -+ return eq ((const call_site *)a, (const call_site *)b); -+ } -+ -+ static hashval_t -+ hash (const void *a) -+ { -+ return hash ((const call_site *)a); -+ } -+ -+ /* Return the address of the first instruction after this call. */ -+ -+ CORE_ADDR pc () const; - - /* * List successor with head in FUNC_TYPE.TAIL_CALL_LIST. */ - -- struct call_site *tail_call_next; -+ struct call_site *tail_call_next = nullptr; - - /* * Describe DW_AT_call_target. Missing attribute uses - FIELD_LOC_KIND_DWARF_BLOCK with FIELD_DWARF_BLOCK == NULL. */ - -- struct call_site_target target; -+ struct call_site_target target {}; - - /* * Size of the PARAMETER array. */ - -- unsigned parameter_count; -+ unsigned parameter_count = 0; - - /* * CU of the function where the call is located. It gets used - for DWARF blocks execution in the parameter array below. */ - -- dwarf2_per_cu_data *per_cu; -+ dwarf2_per_cu_data *const per_cu = nullptr; - - /* objfile of the function where the call is located. */ - -- dwarf2_per_objfile *per_objfile; -+ dwarf2_per_objfile *const per_objfile = nullptr; - -+ private: -+ /* Address of the first instruction after this call. */ -+ const CORE_ADDR m_pc; -+ -+ public: - /* * Describe DW_TAG_call_site's DW_TAG_formal_parameter. */ - -- struct call_site_parameter parameter[1]; -+ struct call_site_parameter parameter[]; - }; - --static inline int --call_site_eq (const void *a_, const void *b_) --{ -- const struct call_site *a = (const call_site *)a_; -- const struct call_site *b = (const call_site *)b_; -- return core_addr_eq (&a->pc, &b->pc); --} -- --static inline hashval_t --call_site_hash (const void *a_) --{ -- const struct call_site *a = (const call_site *)a_; -- return core_addr_hash (&a->pc); --} -- - /* The type-specific info for TYPE_CODE_FIXED_POINT types. */ - - struct fixed_point_type_info -diff --git a/gdb/symtab.c b/gdb/symtab.c -index fe430edadb2..14cc2b5bd8d 100644 ---- a/gdb/symtab.c -+++ b/gdb/symtab.c -@@ -334,11 +334,10 @@ search_domain_name (enum search_domain e) - call_site * - compunit_symtab::find_call_site (CORE_ADDR pc) const - { -- struct call_site call_site_local; - if (m_call_site_htab == nullptr) - return nullptr; - -- call_site_local.pc = pc; -+ struct call_site call_site_local (pc, nullptr, nullptr); - void **slot - = htab_find_slot (m_call_site_htab, &call_site_local, NO_INSERT); - if (slot == nullptr) diff --git a/gdb-symtab-fix-htab_find_slot-call-in-read_call_site_scope.patch b/gdb-symtab-fix-htab_find_slot-call-in-read_call_site_scope.patch deleted file mode 100644 index 0a652d6..0000000 --- a/gdb-symtab-fix-htab_find_slot-call-in-read_call_site_scope.patch +++ /dev/null @@ -1,68 +0,0 @@ -[gdb/symtab] Fix htab_find_slot call in read_call_site_scope - -In read_call_site_scope we have: -... - call_site_local.pc = pc; - slot = htab_find_slot (cu->call_site_htab, &call_site_local, INSERT); -... - -The call passes a call_site pointer as element. OTOH, the hashtab is created -using hash_f == core_addr_hash and eq_f == core_addr_eq, so the element -will be accessed through a CORE_ADDR pointer. - -This is not wrong (at least in C), given that pc is the first field in -call_site. - -Nevertheless, as in call_site_for_pc, make the htab_find_slot call match the -used hash_f and eq_f by using &pc instead: -... - slot = htab_find_slot (cu->call_site_htab, &pc, INSERT); -... - -Tested on x86_64-linux. - -Co-Authored-By: Tom de Vries - ---- - gdb/dwarf2/read.c | 5 ++--- - gdb/gdbtypes.h | 4 +--- - 2 files changed, 3 insertions(+), 6 deletions(-) - -diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c -index 0ce39eb9274..892d31dddf3 100644 ---- a/gdb/dwarf2/read.c -+++ b/gdb/dwarf2/read.c -@@ -13287,7 +13287,7 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu) - struct gdbarch *gdbarch = objfile->arch (); - CORE_ADDR pc, baseaddr; - struct attribute *attr; -- struct call_site *call_site, call_site_local; -+ struct call_site *call_site; - void **slot; - int nparams; - struct die_info *child_die; -@@ -13315,8 +13315,7 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu) - cu->call_site_htab = htab_create_alloc_ex (16, core_addr_hash, core_addr_eq, - NULL, &objfile->objfile_obstack, - hashtab_obstack_allocate, NULL); -- call_site_local.pc = pc; -- slot = htab_find_slot (cu->call_site_htab, &call_site_local, INSERT); -+ slot = htab_find_slot (cu->call_site_htab, &pc, INSERT); - if (*slot != NULL) - { - complaint (_("Duplicate PC %s for DW_TAG_call_site " -diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h -index 0cc00e74a20..f2e077c70a2 100644 ---- a/gdb/gdbtypes.h -+++ b/gdb/gdbtypes.h -@@ -1775,9 +1775,7 @@ struct call_site_parameter - - struct call_site - { -- /* * Address of the first instruction after this call. It must be -- the first field as we overload core_addr_hash and core_addr_eq -- for it. */ -+ /* Address of the first instruction after this call. */ - - CORE_ADDR pc; - diff --git a/gdb-symtab-fix-segfault-in-search_one_symtab.patch b/gdb-symtab-fix-segfault-in-search_one_symtab.patch deleted file mode 100644 index e3ce5fd..0000000 --- a/gdb-symtab-fix-segfault-in-search_one_symtab.patch +++ /dev/null @@ -1,175 +0,0 @@ -[gdb/symtab] Fix segfault in search_one_symtab - -PR28539 describes a segfault in lambda function search_one_symtab due to -psymbol_functions::expand_symtabs_matching calling expansion_notify with a -nullptr symtab: -... - struct compunit_symtab *symtab = - psymtab_to_symtab (objfile, ps); - - if (expansion_notify != NULL) - if (!expansion_notify (symtab)) - return false; -... - -This happens as follows. The partial symtab ps is a dwarf2_include_psymtab -for some header file: -... -(gdb) p ps.filename -$5 = 0x64fcf80 "/usr/include/c++/11/bits/stl_construct.h" -... - -The includer of ps is a shared symtab for a partial unit, with as user: -... -(gdb) p ps.includer().user.filename -$11 = 0x64fc9f0 \ - "/usr/src/debug/llvm13-13.0.0-1.2.x86_64/tools/clang/lib/AST/Decl.cpp" -... - -The call to psymtab_to_symtab expands the Decl.cpp symtab (and consequently -the shared symtab), but returns nullptr because: -... -struct dwarf2_include_psymtab : public partial_symtab -{ - ... - compunit_symtab *get_compunit_symtab (struct objfile *objfile) const override - { - return nullptr; - } -... - -Fix this by returning the Decl.cpp symtab instead, which fixes the segfault -in the PR. - -Tested on x86_64-linux. - -Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28539 - ---- - gdb/dwarf2/read.c | 5 +- - .../gdb.dwarf2/dw2-symtab-includes-lookup.exp | 101 +++++++++++++++++++++ - 2 files changed, 105 insertions(+), 1 deletion(-) - -diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c -index e73c0855fc1..ea6c6344247 100644 ---- a/gdb/dwarf2/read.c -+++ b/gdb/dwarf2/read.c -@@ -5756,7 +5756,10 @@ struct dwarf2_include_psymtab : public partial_symtab - - compunit_symtab *get_compunit_symtab (struct objfile *objfile) const override - { -- return nullptr; -+ compunit_symtab *cust = includer ()->get_compunit_symtab (objfile); -+ while (cust != nullptr && cust->user != nullptr) -+ cust = cust->user; -+ return cust; - } - - private: -diff --git a/gdb/testsuite/gdb.dwarf2/dw2-symtab-includes-lookup.exp b/gdb/testsuite/gdb.dwarf2/dw2-symtab-includes-lookup.exp -new file mode 100644 -index 00000000000..7228f85c9bb ---- /dev/null -+++ b/gdb/testsuite/gdb.dwarf2/dw2-symtab-includes-lookup.exp -@@ -0,0 +1,101 @@ -+# Copyright 2021 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 . -+ -+# Lookup a type in a partial unit with DW_AT_stmt_list. -+# -+# The test-case is setup such that the partial symtab expansion route is -+# .h partial symtab -> shared partial symtab -> toplevel symtab. -+# -+# That is, the partial symtabs (as displayed by maint print objfiles) are: -+# -+# ../sysdeps/x86_64/crtn.S at 0x3d944e0^M -+# elf-init.c at 0x3d94440^M -+# dw2-symtab-includes.h at 0x3d7c7a0^M -+# at 0x31ef870^M -+# bla.c at 0x33985f0^M -+# ../sysdeps/x86_64/crti.S at 0x33e9a00^M -+# init.c at 0x33fa600^M -+# ../sysdeps/x86_64/start.S at 0x33f3fd0^M -+# -+# and the expansion of dw2-symtab-includes.h triggers the expansion of its -+# includer , which triggers expansion of user bla.c. -+# -+# The problem in PR28539 was that after expansion of dw2-symtab-includes.h -+# the expansion_notify function in psymbol_functions::expand_symtabs_matching -+# should be called with the bla.c symtab, but instead it got called with -+# nullptr, which caused a segfault. -+ -+load_lib dwarf.exp -+ -+# This test can only be run on targets which support DWARF-2 and use gas. -+if {![dwarf2_support]} { -+ return 0 -+} -+ -+standard_testfile main.c .S -+ -+# Create the DWARF. -+set asm_file [standard_output_file $srcfile2] -+Dwarf::assemble $asm_file { -+ declare_labels partial_label lines_label -+ global srcdir subdir srcfile -+ -+ cu {} { -+ partial_label: partial_unit { -+ {stmt_list ${lines_label} DW_FORM_sec_offset} -+ } { -+ DW_TAG_base_type { -+ {DW_AT_byte_size 4 DW_FORM_sdata} -+ {DW_AT_encoding @DW_ATE_signed} -+ {DW_AT_name myint} -+ } -+ } -+ } -+ -+ cu {} { -+ compile_unit { -+ {language @DW_LANG_C} -+ {DW_AT_name bla.c} -+ } { -+ imported_unit { -+ {import $partial_label ref_addr} -+ } -+ } -+ } -+ -+ lines {version 2} lines_label { -+ include_dir "${srcdir}/${subdir}" -+ file_name "dw2-symtab-includes.h" 1 -+ program { -+ {DW_LNS_advance_line 1} -+ } -+ } -+} -+ -+if { [prepare_for_testing "failed to prepare" $testfile \ -+ "${asm_file} ${srcfile}" {}] } { -+ return -1 -+} -+ -+# Check that no symtabs are expanded. -+set test "no symtabs expanded" -+if { [readnow] } { -+ unsupported $test -+ return -1 -+} -+gdb_test_no_output "maint info symtabs" $test -+ -+# Lookup myint. Regression test for PR28539. -+gdb_test "ptype myint" "type = myint" diff --git a/gdb-symtab-remove-compunit_call_site_htab.patch b/gdb-symtab-remove-compunit_call_site_htab.patch deleted file mode 100644 index 83fa15d..0000000 --- a/gdb-symtab-remove-compunit_call_site_htab.patch +++ /dev/null @@ -1,133 +0,0 @@ -[gdb/symtab] Remove COMPUNIT_CALL_SITE_HTAB - -Remove macro COMPUNIT_CALL_SITE_HTAB, and provide access to the htab using -member functions: -- compunit_symtab::find_call_site -- compunit_symtab::set_call_site_htab - -Tested on x86_64-linux. - -Co-Authored-By: Tom de Vries - ---- - gdb/block.c | 10 +++++----- - gdb/dwarf2/read.c | 2 +- - gdb/symtab.c | 24 ++++++++++++++++++++++++ - gdb/symtab.h | 9 +++++++-- - 4 files changed, 37 insertions(+), 8 deletions(-) - -diff --git a/gdb/block.c b/gdb/block.c -index 4cb95731396..90c0c5b3250 100644 ---- a/gdb/block.c -+++ b/gdb/block.c -@@ -225,15 +225,15 @@ struct call_site * - call_site_for_pc (struct gdbarch *gdbarch, CORE_ADDR pc) - { - struct compunit_symtab *cust; -- void **slot = NULL; -+ call_site *cs = nullptr; - - /* -1 as tail call PC can be already after the compilation unit range. */ - cust = find_pc_compunit_symtab (pc - 1); - -- if (cust != NULL && COMPUNIT_CALL_SITE_HTAB (cust) != NULL) -- slot = htab_find_slot (COMPUNIT_CALL_SITE_HTAB (cust), &pc, NO_INSERT); -+ if (cust != nullptr) -+ cs = cust->find_call_site (pc); - -- if (slot == NULL) -+ if (cs == nullptr) - { - struct bound_minimal_symbol msym = lookup_minimal_symbol_by_pc (pc); - -@@ -247,7 +247,7 @@ call_site_for_pc (struct gdbarch *gdbarch, CORE_ADDR pc) - : msym.minsym->print_name ())); - } - -- return (struct call_site *) *slot; -+ return cs; - } - - /* Return the blockvector immediately containing the innermost lexical block -diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c -index 892d31dddf3..d3742bbce8c 100644 ---- a/gdb/dwarf2/read.c -+++ b/gdb/dwarf2/read.c -@@ -9457,7 +9457,7 @@ process_full_comp_unit (dwarf2_cu *cu, enum language pretend_language) - if (gcc_4_minor >= 5) - cust->epilogue_unwind_valid = 1; - -- cust->call_site_htab = cu->call_site_htab; -+ cust->set_call_site_htab (cu->call_site_htab); - } - - per_objfile->set_symtab (cu->per_cu, cust); -diff --git a/gdb/symtab.c b/gdb/symtab.c -index fa3f42207ec..1d30c8fc7a8 100644 ---- a/gdb/symtab.c -+++ b/gdb/symtab.c -@@ -331,6 +331,30 @@ search_domain_name (enum search_domain e) - - /* See symtab.h. */ - -+call_site * -+compunit_symtab::find_call_site (CORE_ADDR pc) const -+{ -+ if (m_call_site_htab == nullptr) -+ return nullptr; -+ -+ void **slot = htab_find_slot (m_call_site_htab, &pc, NO_INSERT); -+ if (slot == nullptr) -+ return nullptr; -+ -+ return (call_site *) *slot; -+} -+ -+/* See symtab.h. */ -+ -+void -+compunit_symtab::set_call_site_htab (htab_t call_site_htab) -+{ -+ gdb_assert (m_call_site_htab == nullptr); -+ m_call_site_htab = call_site_htab; -+} -+ -+/* See symtab.h. */ -+ - struct symtab * - compunit_primary_filetab (const struct compunit_symtab *cust) - { -diff --git a/gdb/symtab.h b/gdb/symtab.h -index 471ae9ef448..78ac84527ae 100644 ---- a/gdb/symtab.h -+++ b/gdb/symtab.h -@@ -1443,6 +1443,12 @@ struct symtab - - struct compunit_symtab - { -+ /* Set m_call_site_htab. */ -+ void set_call_site_htab (htab_t call_site_htab); -+ -+ /* Find call_site info for PC. */ -+ call_site *find_call_site (CORE_ADDR pc) const; -+ - /* Unordered chain of all compunit symtabs of this objfile. */ - struct compunit_symtab *next; - -@@ -1497,7 +1503,7 @@ struct compunit_symtab - unsigned int epilogue_unwind_valid : 1; - - /* struct call_site entries for this compilation unit or NULL. */ -- htab_t call_site_htab; -+ htab_t m_call_site_htab; - - /* The macro table for this symtab. Like the blockvector, this - is shared between different symtabs in a given compilation unit. -@@ -1530,7 +1536,6 @@ struct compunit_symtab - #define COMPUNIT_BLOCK_LINE_SECTION(cust) ((cust)->block_line_section) - #define COMPUNIT_LOCATIONS_VALID(cust) ((cust)->locations_valid) - #define COMPUNIT_EPILOGUE_UNWIND_VALID(cust) ((cust)->epilogue_unwind_valid) --#define COMPUNIT_CALL_SITE_HTAB(cust) ((cust)->call_site_htab) - #define COMPUNIT_MACRO_TABLE(cust) ((cust)->macro_table) - - /* A range adapter to allowing iterating over all the file tables diff --git a/gdb-symtab-use-unrelocated-addresses-in-call_site.patch b/gdb-symtab-use-unrelocated-addresses-in-call_site.patch deleted file mode 100644 index a31f5cd..0000000 --- a/gdb-symtab-use-unrelocated-addresses-in-call_site.patch +++ /dev/null @@ -1,194 +0,0 @@ -[gdb/symtab] Use unrelocated addresses in call_site - -Consider test-case gdb.trace/entry-values.exp with target board -unix/-fPIE/-pie. - -Using this command we have an abbreviated version, and can see the correct -@entry values for foo: -... -$ gdb -q -batch outputs/gdb.trace/entry-values/entry-values \ - -ex start \ - -ex "break foo" \ - -ex "set print entry-values both" \ - -ex continue -Temporary breakpoint 1 at 0x679 - -Temporary breakpoint 1, 0x0000555555554679 in main () -Breakpoint 2 at 0x55555555463e - -Breakpoint 2, 0x000055555555463e in foo (i=0, i@entry=2, j=2, j@entry=3) -... - -Now, let's try the same again, but run directly to foo rather than stopping at -main: -... -$ gdb -q -batch outputs/gdb.trace/entry-values/entry-values \ - -ex "break foo" \ - -ex "set print entry-values both" \ - -ex run -Breakpoint 1 at 0x63e - -Breakpoint 1, 0x000055555555463e in foo (i=0, i@entry=, \ - j=2, j@entry=) -... - -So, what explains the difference? Noteworthy, this is a dwarf assembly -test-case, with debug info for foo and bar, but not for main. - -In the first case: -- we run to main -- this does not trigger expanding debug info, because there's none for main -- we set a breakpoint at foo -- this triggers expanding debug info. Relocated addresses are used in - call_site info (because the exec is started) -- we continue to foo, and manage to find the call_site info - -In the second case: -- we set a breakpoint at foo -- this triggers expanding debug info. Unrelocated addresses are used in - call_site info (because the exec is not started) -- we run to foo -- this triggers objfile_relocate1, but it doesn't update the call_site - info addresses -- we don't manage to find the call_site info - -We could fix this by adding the missing call_site relocation in -objfile_relocate1. - -This solution however is counter-trend in the sense that we're trying to -work towards the situation where when starting two instances of an executable, -we need only one instance of debug information, implying the use of -unrelocated addresses. - -So, fix this instead by using unrelocated addresses in call_site info. - -Tested on x86_64-linux. - -This fixes all remaining unix/-fno-PIE/-no-pie vs unix/-fPIE/-pie -regressions, like f.i. PR24892. - -Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=24892 - -Co-Authored-By: Tom de Vries - ---- - gdb/dwarf2/loc.c | 9 ++++++++- - gdb/dwarf2/read.c | 4 +++- - gdb/gdbtypes.c | 5 ++++- - gdb/gdbtypes.h | 10 +++++----- - gdb/symtab.c | 6 +++++- - 5 files changed, 25 insertions(+), 9 deletions(-) - -diff --git a/gdb/dwarf2/loc.c b/gdb/dwarf2/loc.c -index 83b5fe1ac88..ba94780cc75 100644 ---- a/gdb/dwarf2/loc.c -+++ b/gdb/dwarf2/loc.c -@@ -979,7 +979,14 @@ call_site_to_target_addr (struct gdbarch *call_site_gdbarch, - } - - case FIELD_LOC_KIND_PHYSADDR: -- return FIELD_STATIC_PHYSADDR (call_site->target); -+ { -+ dwarf2_per_objfile *per_objfile = call_site->per_objfile; -+ compunit_symtab *cust = per_objfile->get_symtab (call_site->per_cu); -+ int sect_idx = COMPUNIT_BLOCK_LINE_SECTION (cust); -+ CORE_ADDR delta = per_objfile->objfile->section_offsets[sect_idx]; -+ -+ return FIELD_STATIC_PHYSADDR (call_site->target) + delta; -+ } - - default: - internal_error (__FILE__, __LINE__, _("invalid call site target kind")); -diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c -index 59ce3cf2b45..e73c0855fc1 100644 ---- a/gdb/dwarf2/read.c -+++ b/gdb/dwarf2/read.c -@@ -13309,6 +13309,7 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu) - } - pc = attr->as_address () + baseaddr; - pc = gdbarch_adjust_dwarf2_addr (gdbarch, pc); -+ pc -= baseaddr; - - if (cu->call_site_htab == NULL) - cu->call_site_htab = htab_create_alloc_ex (16, call_site::hash, -@@ -13465,7 +13466,8 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu) - sect_offset_str (die->sect_off), objfile_name (objfile)); - else - { -- lowpc = gdbarch_adjust_dwarf2_addr (gdbarch, lowpc + baseaddr); -+ lowpc = (gdbarch_adjust_dwarf2_addr (gdbarch, lowpc + baseaddr) -+ - baseaddr); - SET_FIELD_PHYSADDR (call_site->target, lowpc); - } - } -diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c -index 1b3ed1b32ed..f1efbb98720 100644 ---- a/gdb/gdbtypes.c -+++ b/gdb/gdbtypes.c -@@ -6307,7 +6307,10 @@ objfile_type (struct objfile *objfile) - CORE_ADDR - call_site::pc () const - { -- return m_pc; -+ compunit_symtab *cust = this->per_objfile->get_symtab (this->per_cu); -+ CORE_ADDR delta -+ = this->per_objfile->objfile->section_offsets[COMPUNIT_BLOCK_LINE_SECTION (cust)]; -+ return m_unrelocated_pc + delta; - } - - void _initialize_gdbtypes (); -diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h -index a071188ffa1..8b1fd75bccf 100644 ---- a/gdb/gdbtypes.h -+++ b/gdb/gdbtypes.h -@@ -1777,19 +1777,19 @@ struct call_site - { - call_site (CORE_ADDR pc, dwarf2_per_cu_data *per_cu, - dwarf2_per_objfile *per_objfile) -- : per_cu (per_cu), per_objfile (per_objfile), m_pc (pc) -+ : per_cu (per_cu), per_objfile (per_objfile), m_unrelocated_pc (pc) - {} - - static int - eq (const call_site *a, const call_site *b) - { -- return core_addr_eq (&a->m_pc, &b->m_pc); -+ return core_addr_eq (&a->m_unrelocated_pc, &b->m_unrelocated_pc); - } - - static hashval_t - hash (const call_site *a) - { -- return core_addr_hash (&a->m_pc); -+ return core_addr_hash (&a->m_unrelocated_pc); - } - - static int -@@ -1831,8 +1831,8 @@ struct call_site - dwarf2_per_objfile *const per_objfile = nullptr; - - private: -- /* Address of the first instruction after this call. */ -- const CORE_ADDR m_pc; -+ /* Unrelocated address of the first instruction after this call. */ -+ const CORE_ADDR m_unrelocated_pc; - - public: - /* * Describe DW_TAG_call_site's DW_TAG_formal_parameter. */ -diff --git a/gdb/symtab.c b/gdb/symtab.c -index 14cc2b5bd8d..17607fb447b 100644 ---- a/gdb/symtab.c -+++ b/gdb/symtab.c -@@ -337,7 +337,11 @@ compunit_symtab::find_call_site (CORE_ADDR pc) const - if (m_call_site_htab == nullptr) - return nullptr; - -- struct call_site call_site_local (pc, nullptr, nullptr); -+ CORE_ADDR delta -+ = this->objfile->section_offsets[COMPUNIT_BLOCK_LINE_SECTION (this)]; -+ CORE_ADDR unrelocated_pc = pc - delta; -+ -+ struct call_site call_site_local (unrelocated_pc, nullptr, nullptr); - void **slot - = htab_find_slot (m_call_site_htab, &call_site_local, NO_INSERT); - if (slot == nullptr) diff --git a/gdb-tdep-fix-avx512-m32-support-in-gdbserver.patch b/gdb-tdep-fix-avx512-m32-support-in-gdbserver.patch deleted file mode 100644 index f8bb909..0000000 --- a/gdb-tdep-fix-avx512-m32-support-in-gdbserver.patch +++ /dev/null @@ -1,169 +0,0 @@ -[gdb/tdep] Fix avx512 -m32 support in gdbserver - -PR27257 reports a problem that can be reproduced as follows: -- use x86_64 machine with avx512 support -- compile a hello world with -m32 to a.out -- start a gdbserver session with a.out -- use gdb to connect to the gdbserver session - -This makes us run into: -... -Listening on port 2346 -Remote debugging from host ::1, port 34940 -src/gdbserver/regcache.cc:257: \ - A problem internal to GDBserver has been detected. -Unknown register zmm16h requested -... - -The problem is that i387_xsave_to_cache in gdbserver/i387-fp.cc can't find a -register zmm16h in the register cache. - -To understand how this happens, first some background. - -SSE has 16 128-bit wide xmm registers. - -AVX extends the SSE registers set as follows: -- it extends the 16 existing 128-bit wide xmm registers to 256-bit wide ymm - registers. - -AVX512 extends the AVX register set as follows: -- it extends the 16 existing 256-bit wide ymm registers to 512-bit wide zmm - registers. -- it adds 16 additional 512-bit wide zmm registers (with corresponding ymm and - xmm subregisters added as well) - -However, in 32-bit mode, there are only 8 xmm/ymm/zmm registers. - -The problem we're running into is that gdbserver/i387-fp.cc uses these -constants to describe the size of the register file: -... -static const int num_avx512_zmmh_low_registers = 16; -static const int num_avx512_zmmh_high_registers = 16; -static const int num_avx512_ymmh_registers = 16; -static const int num_avx512_xmm_registers = 16; -... -which are all incorrect for the 32-bit case. - -Fix this by replacing the constants with variables that have the appropriate -values in 64-bit and 32-bit mode. - -Tested on x86_64-linux with native and unix/-m32. - ---- - gdbserver/i387-fp.cc | 50 +++++++++++++++++++++++++++++++++++++------------- - 1 file changed, 37 insertions(+), 13 deletions(-) - -diff --git a/gdbserver/i387-fp.cc b/gdbserver/i387-fp.cc -index 6d9b62ed8ce..9b07ded592d 100644 ---- a/gdbserver/i387-fp.cc -+++ b/gdbserver/i387-fp.cc -@@ -23,10 +23,6 @@ - static const int num_mpx_bnd_registers = 4; - static const int num_mpx_cfg_registers = 2; - static const int num_avx512_k_registers = 8; --static const int num_avx512_zmmh_low_registers = 16; --static const int num_avx512_zmmh_high_registers = 16; --static const int num_avx512_ymmh_registers = 16; --static const int num_avx512_xmm_registers = 16; - static const int num_pkeys_registers = 1; - - /* Note: These functions preserve the reserved bits in control registers. -@@ -256,14 +252,22 @@ void - i387_cache_to_xsave (struct regcache *regcache, void *buf) - { - struct i387_xsave *fp = (struct i387_xsave *) buf; -+ bool amd64 = register_size (regcache->tdesc, 0) == 8; - int i; - unsigned long val, val2; - unsigned long long xstate_bv = 0; - unsigned long long clear_bv = 0; - char raw[64]; - char *p; -+ - /* Amd64 has 16 xmm regs; I386 has 8 xmm regs. */ -- int num_xmm_registers = register_size (regcache->tdesc, 0) == 8 ? 16 : 8; -+ int num_xmm_registers = amd64 ? 16 : 8; -+ /* AVX512 extends the existing xmm/ymm registers to a wider mode: zmm. */ -+ int num_avx512_zmmh_low_registers = num_xmm_registers; -+ /* AVX512 adds 16 extra regs in Amd64 mode, but none in I386 mode.*/ -+ int num_avx512_zmmh_high_registers = amd64 ? 16 : 0; -+ int num_avx512_ymmh_registers = amd64 ? 16 : 0; -+ int num_avx512_xmm_registers = amd64 ? 16 : 0; - - /* The supported bits in `xstat_bv' are 8 bytes. Clear part in - vector registers if its bit in xstat_bv is zero. */ -@@ -452,7 +456,9 @@ i387_cache_to_xsave (struct regcache *regcache, void *buf) - /* Check if any of ZMM16H-ZMM31H registers are changed. */ - if ((x86_xcr0 & X86_XSTATE_ZMM)) - { -- int zmm16h_regnum = find_regno (regcache->tdesc, "zmm16h"); -+ int zmm16h_regnum = (num_avx512_zmmh_high_registers == 0 -+ ? -1 -+ : find_regno (regcache->tdesc, "zmm16h")); - - for (i = 0; i < num_avx512_zmmh_high_registers; i++) - { -@@ -469,7 +475,9 @@ i387_cache_to_xsave (struct regcache *regcache, void *buf) - /* Check if any XMM_AVX512 registers are changed. */ - if ((x86_xcr0 & X86_XSTATE_ZMM)) - { -- int xmm_avx512_regnum = find_regno (regcache->tdesc, "xmm16"); -+ int xmm_avx512_regnum = (num_avx512_xmm_registers == 0 -+ ? -1 -+ : find_regno (regcache->tdesc, "xmm16")); - - for (i = 0; i < num_avx512_xmm_registers; i++) - { -@@ -486,7 +494,9 @@ i387_cache_to_xsave (struct regcache *regcache, void *buf) - /* Check if any YMMH_AVX512 registers are changed. */ - if ((x86_xcr0 & X86_XSTATE_ZMM)) - { -- int ymmh_avx512_regnum = find_regno (regcache->tdesc, "ymm16h"); -+ int ymmh_avx512_regnum = (num_avx512_ymmh_registers == 0 -+ ? -1 -+ : find_regno (regcache->tdesc, "ymm16h")); - - for (i = 0; i < num_avx512_ymmh_registers; i++) - { -@@ -710,12 +720,20 @@ i387_xsave_to_cache (struct regcache *regcache, const void *buf) - { - struct i387_xsave *fp = (struct i387_xsave *) buf; - struct i387_fxsave *fxp = (struct i387_fxsave *) buf; -+ bool amd64 = register_size (regcache->tdesc, 0) == 8; - int i, top; - unsigned long val; - unsigned long long clear_bv; - gdb_byte *p; -- /* Amd64 has 16 xmm regs; I386 has 8 xmm regs. */ -- int num_xmm_registers = register_size (regcache->tdesc, 0) == 8 ? 16 : 8; -+ -+ /* Amd64 has 16 xmm regs; I386 has 8 xmm regs. */ -+ int num_xmm_registers = amd64 ? 16 : 8; -+ /* AVX512 extends the existing xmm/ymm registers to a wider mode: zmm. */ -+ int num_avx512_zmmh_low_registers = num_xmm_registers; -+ /* AVX512 adds 16 extra regs in Amd64 mode, but none in I386 mode.*/ -+ int num_avx512_zmmh_high_registers = amd64 ? 16 : 0; -+ int num_avx512_ymmh_registers = amd64 ? 16 : 0; -+ int num_avx512_xmm_registers = amd64 ? 16 : 0; - - /* The supported bits in `xstat_bv' are 8 bytes. Clear part in - vector registers if its bit in xstat_bv is zero. */ -@@ -845,9 +863,15 @@ i387_xsave_to_cache (struct regcache *regcache, const void *buf) - - if ((x86_xcr0 & X86_XSTATE_ZMM) != 0) - { -- int zmm16h_regnum = find_regno (regcache->tdesc, "zmm16h"); -- int ymm16h_regnum = find_regno (regcache->tdesc, "ymm16h"); -- int xmm16_regnum = find_regno (regcache->tdesc, "xmm16"); -+ int zmm16h_regnum = (num_avx512_zmmh_high_registers == 0 -+ ? -1 -+ : find_regno (regcache->tdesc, "zmm16h")); -+ int ymm16h_regnum = (num_avx512_ymmh_registers == 0 -+ ? -1 -+ : find_regno (regcache->tdesc, "ymm16h")); -+ int xmm16_regnum = (num_avx512_xmm_registers == 0 -+ ? -1 -+ : find_regno (regcache->tdesc, "xmm16")); - - if ((clear_bv & X86_XSTATE_ZMM) != 0) - { diff --git a/gdb-tdep-rs6000-don-t-skip-system-call-in-skip_prologue.patch b/gdb-tdep-rs6000-don-t-skip-system-call-in-skip_prologue.patch deleted file mode 100644 index f1f1889..0000000 --- a/gdb-tdep-rs6000-don-t-skip-system-call-in-skip_prologue.patch +++ /dev/null @@ -1,53 +0,0 @@ -[gdb/tdep, rs6000] Don't skip system call in skip_prologue - -I ran into a case where a breakpoint on _exit never triggered, because it was -set past the end of the _exit prologue, past the end of the exit_group system -call (which does not return). - -More concretely, the breakpoint was set at the last insn show here: -... -Dump of assembler code for function _exit: - 0x00007ffff7e42ea0 <+0>: 12 00 4c 3c addis r2,r12,18 - 0x00007ffff7e42ea4 <+4>: 60 43 42 38 addi r2,r2,17248 - 0x00007ffff7e42ea8 <+8>: 00 00 00 60 nop - 0x00007ffff7e42eac <+12>: f8 ff e1 fb std r31,-8(r1) - 0x00007ffff7e42eb0 <+16>: 78 1b 7f 7c mr r31,r3 - 0x00007ffff7e42eb4 <+20>: f0 ff c1 fb std r30,-16(r1) - 0x00007ffff7e42eb8 <+24>: ea 00 00 38 li r0,234 - 0x00007ffff7e42ebc <+28>: a0 8b 22 e9 ld r9,-29792(r2) - 0x00007ffff7e42ec0 <+32>: 78 fb e3 7f mr r3,r31 - 0x00007ffff7e42ec4 <+36>: 14 6a c9 7f add r30,r9,r13 - 0x00007ffff7e42ec8 <+40>: 02 00 00 44 sc - 0x00007ffff7e42ecc <+44>: 26 00 00 7c mfcr r0 - 0x00007ffff7e42ed0 <+48>: 00 10 09 74 andis. r9,r0,4096 -... - -Fix this by treating system calls the same as branches in skip_prologue: -by default, don't skip, such that the breakpoint is set at 0x00007ffff7e42eb8 -instead. - -Tested on ppc64le-linux, on a power 8 machine. - -Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28527 - ---- - gdb/rs6000-tdep.c | 6 ++++++ - 1 file changed, 6 insertions(+) - -diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c -index 826f0266ed8..9ac5db57898 100644 ---- a/gdb/rs6000-tdep.c -+++ b/gdb/rs6000-tdep.c -@@ -2137,6 +2137,12 @@ skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc, CORE_ADDR lim_pc, - /* Never skip branches. */ - break; - -+ /* Test based on opcode and mask values of -+ powerpc_opcodes[svc..svcla] in opcodes/ppc-opc.c. */ -+ if ((op & 0xffff0000) == 0x44000000) -+ /* Never skip system calls. */ -+ break; -+ - if (num_skip_non_prologue_insns++ > max_skip_non_prologue_insns) - /* Do not scan too many insns, scanning insns is expensive with - remote targets. */ diff --git a/gdb-tdep-update-syscalls-ppc64-ppc-linux.xml.patch b/gdb-tdep-update-syscalls-ppc64-ppc-linux.xml.patch index f718504..89fea68 100644 --- a/gdb-tdep-update-syscalls-ppc64-ppc-linux.xml.patch +++ b/gdb-tdep-update-syscalls-ppc64-ppc-linux.xml.patch @@ -3,14 +3,15 @@ Regenerate syscalls/{ppc64,ppc}-linux.xml on a system with 5.14 kernel. --- - gdb/syscalls/ppc-linux.xml | 139 ++++++++++++++++++++++++++++++++++++++- - gdb/syscalls/ppc-linux.xml.in | 140 ++++++++++++++++++++++++++++++++++++++- - gdb/syscalls/ppc64-linux.xml | 140 ++++++++++++++++++++++++++++++++++++--- - gdb/syscalls/ppc64-linux.xml.in | 141 +++++++++++++++++++++++++++++++++++++--- - 4 files changed, 538 insertions(+), 22 deletions(-) + gdb/syscalls/ppc-linux.xml | 139 +++++++++++++++++++++++++++++- + gdb/syscalls/ppc-linux.xml.in | 140 +++++++++++++++++++++++++++++- + gdb/syscalls/ppc64-linux.xml | 140 ++++++++++++++++++++++++++++-- + gdb/syscalls/ppc64-linux.xml.in | 141 +++++++++++++++++++++++++++++-- + gdb/testsuite/gdb.base/catch-syscall.exp | 6 +- + 5 files changed, 541 insertions(+), 25 deletions(-) diff --git a/gdb/syscalls/ppc-linux.xml b/gdb/syscalls/ppc-linux.xml -index 909240b62cc..4f48179b758 100644 +index 328b889839a..34ba8bd4e49 100644 --- a/gdb/syscalls/ppc-linux.xml +++ b/gdb/syscalls/ppc-linux.xml @@ -6,8 +6,8 @@ @@ -179,7 +180,7 @@ index 909240b62cc..4f48179b758 100644 + diff --git a/gdb/syscalls/ppc-linux.xml.in b/gdb/syscalls/ppc-linux.xml.in -index 2d68e7dc220..f1315930d60 100644 +index 0c1003e311b..61c7c585453 100644 --- a/gdb/syscalls/ppc-linux.xml.in +++ b/gdb/syscalls/ppc-linux.xml.in @@ -8,11 +8,12 @@ @@ -352,7 +353,7 @@ index 2d68e7dc220..f1315930d60 100644 + diff --git a/gdb/syscalls/ppc64-linux.xml b/gdb/syscalls/ppc64-linux.xml -index c0015694704..cb2d372cffe 100644 +index 2e46cac0684..838f73bc25e 100644 --- a/gdb/syscalls/ppc64-linux.xml +++ b/gdb/syscalls/ppc64-linux.xml @@ -6,8 +6,8 @@ @@ -515,7 +516,7 @@ index c0015694704..cb2d372cffe 100644 + diff --git a/gdb/syscalls/ppc64-linux.xml.in b/gdb/syscalls/ppc64-linux.xml.in -index 884f8380bca..af1a7b31c60 100644 +index 2a96a8d34b8..4ed80e0a41b 100644 --- a/gdb/syscalls/ppc64-linux.xml.in +++ b/gdb/syscalls/ppc64-linux.xml.in @@ -8,11 +8,12 @@ @@ -681,3 +682,20 @@ index 884f8380bca..af1a7b31c60 100644 + + +diff --git a/gdb/testsuite/gdb.base/catch-syscall.exp b/gdb/testsuite/gdb.base/catch-syscall.exp +index 939cf4876b6..3e6ed94be96 100644 +--- a/gdb/testsuite/gdb.base/catch-syscall.exp ++++ b/gdb/testsuite/gdb.base/catch-syscall.exp +@@ -621,9 +621,9 @@ proc test_catch_syscall_multi_arch {} { + + set arch1 "powerpc:common" + set arch2 "powerpc:common64" +- set syscall1_name "openat" +- set syscall2_name "unlinkat" +- set syscall_number 286 ++ set syscall1_name "fstatat64" ++ set syscall2_name "newfstatat" ++ set syscall_number 291 + test_catch_syscall_multi_arch_1 $arch1 $arch2 $syscall1_name \ + $syscall2_name $syscall_number + diff --git a/gdb-test-for-rhbz1976887.patch b/gdb-test-for-rhbz1976887.patch deleted file mode 100644 index 018fdaa..0000000 --- a/gdb-test-for-rhbz1976887.patch +++ /dev/null @@ -1,592 +0,0 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Alexandra=20H=C3=A1jkov=C3=A1?= -Date: Wed, 29 Sep 2021 11:14:51 +0200 -Subject: gdb-test-for-rhbz1976887.patch - -;; Backport test for RHBZ 1976887 (Kevin Buettner). - -Test case reproducing PR28030 bug - -The original reproducer for PR28030 required use of a specific -compiler version - gcc-c++-11.1.1-3.fc34 is mentioned in the PR, -though it seems probable that other gcc versions might also be able to -reproduce the bug as well. This commit introduces a test case which, -using the DWARF assembler, provides a reproducer which is independent -of the compiler version. (Well, it'll work with whatever compilers -the DWARF assembler works with.) - -To the best of my knowledge, it's also the first test case which uses -the DWARF assembler to provide debug info for a shared object. That -being the case, I provided more than the usual commentary which should -allow this case to be used as a template when a combo shared -library / DWARF assembler test case is required in the future. - -I provide some details regarding the bug in a comment near the -beginning of locexpr-dml.exp. - -This problem was difficult to reproduce; I found myself constantly -referring to the backtrace while trying to figure out what (else) I -might be missing while trying to create a reproducer. Below is a -partial backtrace which I include for posterity. - - #0 internal_error ( - file=0xc50110 "/ironwood1/sourceware-git/f34-pr28030/bld/../../worktree-pr28030/gdb/gdbtypes.c", line=5575, - fmt=0xc520c0 "Unexpected type field location kind: %d") - at /ironwood1/sourceware-git/f34-pr28030/bld/../../worktree-pr28030/gdbsupport/errors.cc:51 - #1 0x00000000006ef0c5 in copy_type_recursive (objfile=0x1635930, - type=0x274c260, copied_types=0x30bb290) - at /ironwood1/sourceware-git/f34-pr28030/bld/../../worktree-pr28030/gdb/gdbtypes.c:5575 - #2 0x00000000006ef382 in copy_type_recursive (objfile=0x1635930, - type=0x274ca10, copied_types=0x30bb290) - at /ironwood1/sourceware-git/f34-pr28030/bld/../../worktree-pr28030/gdb/gdbtypes.c:5602 - #3 0x0000000000a7409a in preserve_one_value (value=0x24269f0, - objfile=0x1635930, copied_types=0x30bb290) - at /ironwood1/sourceware-git/f34-pr28030/bld/../../worktree-pr28030/gdb/value.c:2529 - #4 0x000000000072012a in gdbscm_preserve_values ( - extlang=0xc55720 , objfile=0x1635930, - copied_types=0x30bb290) - at /ironwood1/sourceware-git/f34-pr28030/bld/../../worktree-pr28030/gdb/guile/scm-value.c:94 - #5 0x00000000006a3f82 in preserve_ext_lang_values (objfile=0x1635930, - copied_types=0x30bb290) - at /ironwood1/sourceware-git/f34-pr28030/bld/../../worktree-pr28030/gdb/extension.c:568 - #6 0x0000000000a7428d in preserve_values (objfile=0x1635930) - at /ironwood1/sourceware-git/f34-pr28030/bld/../../worktree-pr28030/gdb/value.c:2579 - #7 0x000000000082d514 in objfile::~objfile (this=0x1635930, - __in_chrg=) - at /ironwood1/sourceware-git/f34-pr28030/bld/../../worktree-pr28030/gdb/objfiles.c:549 - #8 0x0000000000831cc8 in std::_Sp_counted_ptr::_M_dispose (this=0x1654580) - at /usr/include/c++/11/bits/shared_ptr_base.h:348 - #9 0x00000000004e6617 in std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release (this=0x1654580) at /usr/include/c++/11/bits/shared_ptr_base.h:168 - #10 0x00000000004e1d2f in std::__shared_count<(__gnu_cxx::_Lock_policy)2>::~__shared_count (this=0x190bb88, __in_chrg=) - at /usr/include/c++/11/bits/shared_ptr_base.h:705 - #11 0x000000000082feee in std::__shared_ptr::~__shared_ptr (this=0x190bb80, __in_chrg=) - at /usr/include/c++/11/bits/shared_ptr_base.h:1154 - #12 0x000000000082ff0a in std::shared_ptr::~shared_ptr ( - this=0x190bb80, __in_chrg=) - at /usr/include/c++/11/bits/shared_ptr.h:122 - #13 0x000000000085ed7e in __gnu_cxx::new_allocator > >::destroy > (this=0x114bc00, - __p=0x190bb80) at /usr/include/c++/11/ext/new_allocator.h:168 - #14 0x000000000085e88d in std::allocator_traits > > >::destroy > (__a=..., - __p=0x190bb80) at /usr/include/c++/11/bits/alloc_traits.h:531 - #15 0x000000000085e50c in std::__cxx11::list, std::allocator > >::_M_erase (this=0x114bc00, __position= - std::shared_ptr (expired, weak count 1) = {get() = 0x1635930}) - at /usr/include/c++/11/bits/stl_list.h:1925 - #16 0x000000000085df0e in std::__cxx11::list, std::allocator > >::erase (this=0x114bc00, __position= - std::shared_ptr (expired, weak count 1) = {get() = 0x1635930}) - at /usr/include/c++/11/bits/list.tcc:158 - #17 0x000000000085c748 in program_space::remove_objfile (this=0x114bbc0, - objfile=0x1635930) - at /ironwood1/sourceware-git/f34-pr28030/bld/../../worktree-pr28030/gdb/progspace.c:210 - #18 0x000000000082d3ae in objfile::unlink (this=0x1635930) - at /ironwood1/sourceware-git/f34-pr28030/bld/../../worktree-pr28030/gdb/objfiles.c:487 - #19 0x000000000082e68c in objfile_purge_solibs () - at /ironwood1/sourceware-git/f34-pr28030/bld/../../worktree-pr28030/gdb/objfiles.c:875 - #20 0x000000000092dd37 in no_shared_libraries (ignored=0x0, from_tty=1) - at /ironwood1/sourceware-git/f34-pr28030/bld/../../worktree-pr28030/gdb/solib.c:1236 - #21 0x00000000009a37fe in target_pre_inferior (from_tty=1) - at /ironwood1/sourceware-git/f34-pr28030/bld/../../worktree-pr28030/gdb/target.c:2496 - #22 0x00000000007454d6 in run_command_1 (args=0x0, from_tty=1, - run_how=RUN_NORMAL) - at /ironwood1/sourceware-git/f34-pr28030/bld/../../worktree-pr28030/gdb/infcmd.c:437 - -I'll note a few points regarding this backtrace: - -Frame #1 is where the internal error occurs. It's caused by an -unhandled case for FIELD_LOC_KIND_DWARF_BLOCK. The fix for this bug -adds support for this case. - -Frame #22 - it's a partial backtrace - shows that GDB is attempting to -(re)run the program. You can see the exact command sequence that was -used for reproducing this problem in the PR (at -https://sourceware.org/bugzilla/show_bug.cgi?id=28030), but in a -nutshell, after starting the program and advancing to the appropriate -source line, GDB was asked to step into libstdc++; a "finish" command -was issued, returning a value. The fact that a value was returned is -very important. GDB was then used to step back into libstdc++. A -breakpoint was set on a source line in the library after which a "run" -command was issued. - -Frame #19 shows a call to objfile_purge_solibs. It's aptly named. - -Frame #7 is a call to the destructor for one of the objfile solibs; it -turned out to be the one for libstdc++. - -Frames #6 thru #3 show various value preservation frames. If you look -at preserve_values() in gdb/value.c, the value history is preserved -first, followed by internal variables, followed by values for the -extension languages (python and guile). - -diff --git a/gdb/testsuite/gdb.dwarf2/locexpr-data-member-location-lib.c b/gdb/testsuite/gdb.dwarf2/locexpr-data-member-location-lib.c -new file mode 100644 ---- /dev/null -+++ b/gdb/testsuite/gdb.dwarf2/locexpr-data-member-location-lib.c -@@ -0,0 +1,48 @@ -+/* Copyright (C) 2021 Free Software Foundation, Inc. -+ -+ This file is part of GDB. -+ -+ 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 . */ -+ -+#include "locexpr-data-member-location.h" -+ -+struct A g_A = {3, 4}; -+struct B g_B = { {8, 9}, 10, 11 }; -+ -+B * -+foo () -+{ /* foo prologue */ -+ asm ("foo_label: .globl foo_label"); -+ return &g_B; /* foo return */ -+} /* foo end */ -+ -+B * -+bar (B *v) -+{ /* bar prologue */ -+ asm ("bar_label: .globl bar_label"); -+ return v; /* bar return */ -+} /* bar end */ -+ -+/* Some of the DWARF assembler procs (e.g. function_range) compile -+ this file, expecting it to be a complete program with a main() -+ function. When IS_SHAREDLIB is NOT defined, we have main() as -+ defined below. */ -+ -+#ifndef IS_SHAREDLIB -+int -+main () -+{ -+ B *b = foo (); -+} -+#endif -diff --git a/gdb/testsuite/gdb.dwarf2/locexpr-data-member-location-main.c b/gdb/testsuite/gdb.dwarf2/locexpr-data-member-location-main.c -new file mode 100644 ---- /dev/null -+++ b/gdb/testsuite/gdb.dwarf2/locexpr-data-member-location-main.c -@@ -0,0 +1,27 @@ -+/* Copyright (C) 2021 Free Software Foundation, Inc. -+ -+ This file is part of GDB. -+ -+ 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 . */ -+ -+#include "locexpr-data-member-location.h" -+ -+int -+main (void) -+{ -+ B *v1; -+ v1 = bar (foo ()); -+ -+ return 0; -+} -diff --git a/gdb/testsuite/gdb.dwarf2/locexpr-data-member-location.exp b/gdb/testsuite/gdb.dwarf2/locexpr-data-member-location.exp -new file mode 100644 ---- /dev/null -+++ b/gdb/testsuite/gdb.dwarf2/locexpr-data-member-location.exp -@@ -0,0 +1,349 @@ -+# Copyright 2021 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 . -+ -+# This test case uses the DWARF assembler to reproduce the problem -+# described by PR28030. The bug turned out to be that -+# FIELD_LOC_KIND_DWARF_BLOCK was not handled when recursively copying -+# a value's type when preserving the value history during the freeing -+# up of objfiles associated with a shared object. (Yes, figuring out -+# how to make this happen in a concise test case turned out to be -+# challenging.) -+# -+# The following elements proved to be necessary for reproducing the -+# problem: -+# -+# 1) A location expression needed to be used with -+# DW_AT_data_member_location rather than a simple offset. -+# Moreover, this location expression needed to use opcodes -+# which GDB's DWARF reader could not convert to a simple -+# offset. (Note, however, that GDB could probably be improved -+# to handle the opcodes chosen for this test; if decode_locdesc() -+# in dwarf2/read.c is ever updated to handle both DW_OP_pick and -+# DW_OP_drop, then this test could end up passing even if -+# the bug it's intended to test has not been fixed.) -+# -+# 2) The debug info containing the above DWARF info needed -+# to be associated with a shared object since the problem -+# occurred while GDB was preserving values during the -+# purging of shared objects. -+# -+# 3) After performing some simple gdb commands, the program is -+# run again. In the course of running the objfile destructor -+# associated with the shared object, values are preserved -+# along with their types. As noted earlier, it was during -+# the recursive type copy that the bug was observed. -+# -+# Therefore, due to #2 above, this test case creates debug info -+# which is then used by a shared object. -+ -+# This test can't be run on targets lacking shared library support. -+if [skip_shlib_tests] { -+ return 0 -+} -+ -+load_lib dwarf.exp -+ -+# This test can only be run on targets which support DWARF-2 and use gas. -+if ![dwarf2_support] { -+ return 0 -+} -+ -+# gdb_test_file_name is the name of this file without the .exp -+# extension. Use it to form basenames for the main program -+# and shared object. -+set main_basename ${::gdb_test_file_name}-main -+set lib_basename ${::gdb_test_file_name}-lib -+ -+# We're generating DWARF assembly for the shared object; therefore, -+# the source file for the library / shared object must be listed first -+# (in the standard_testfile invocation) since ${srcfile} is used by -+# get_func_info (for determining the start, end, and length of a -+# function). -+# -+# The output of Dwarf::assemble will be placed in $lib_basename.S -+# which will be ${srcfile3} after the execution of standard_testfile. -+ -+standard_testfile $lib_basename.c $main_basename.c $lib_basename.S -+ -+set libsrc "${::srcdir}/${::subdir}/${::srcfile}" -+set lib_so [standard_output_file ${lib_basename}.so] -+set asm_file [standard_output_file ${::srcfile3}] -+ -+# We need to know the size of some types in order to write some of the -+# debugging info that we're about to generate. For that, we ask GDB -+# by debugging the shared object associated with this test case. -+ -+# Compile the shared library: -DIS_SHAREDLIB prevents main() from -+# being defined. Note that debugging symbols will be present for -+# this compilation. -+if {[gdb_compile_shlib $libsrc $lib_so \ -+ {additional_flags=-DIS_SHAREDLIB debug}] != ""} { -+ untested "failed to compile shared library" -+ return -+} -+ -+# Start a fresh GDB and load the shared library. -+clean_restart $lib_so -+ -+# Using our running GDB session, determine sizes of several types. -+set long_size [get_sizeof "long" -1] -+set addr_size [get_sizeof "void *" -1] -+set struct_A_size [get_sizeof "g_A" -1] -+set struct_B_size [get_sizeof "g_B" -1] -+ -+if { $long_size == -1 || $addr_size == -1 \ -+ || $struct_A_size == -1 || $struct_B_size == -1} { -+ perror "Can't determine type sizes" -+ return -+} -+ -+# Retrieve struct offset of MBR in struct TP -+proc get_offsetof { tp mbr } { -+ return [get_integer_valueof "&((${tp} *) 0)->${mbr}" -1] -+} -+ -+# Use running GDB session to get struct offsets -+set A_a [get_offsetof A a] -+set A_x [get_offsetof A x] -+set B_a [get_offsetof B a] -+set B_b [get_offsetof B b] -+set B_x2 [get_offsetof B x2] -+ -+# Create the DWARF. -+Dwarf::assemble ${asm_file} { -+ declare_labels L -+ -+ # Find start, end, and length of functions foo and bar. -+ # These calls to get_func_info will create and set variables -+ # foo_start, bar_start, foo_end, bar_end, foo_len, and -+ # bar_len. -+ # -+ # In order to get the right answers, get_func_info (and, -+ # underneath, function_range) should use the same compiler flags -+ # as those used to make a shared object. For any targets that get -+ # this far, -fpic is probably correct. -+ # -+ # Also, it should be noted that IS_SHAREDLIB is NOT defined as one -+ # of the additional flags. Not defining IS_SHAREDLIB will cause a -+ # main() to be defined for the compilation of the shared library -+ # source file which happens as a result of using get_func_info; -+ # this is currently required in order to this facility. -+ set flags {additional_flags=-fpic debug} -+ get_func_info foo $flags -+ get_func_info bar $flags -+ -+ cu {} { -+ DW_TAG_compile_unit { -+ {DW_AT_language @DW_LANG_C_plus_plus} -+ {name ${::srcfile}} -+ {stmt_list $L DW_FORM_sec_offset} -+ } { -+ declare_labels int_label class_A_label class_B_label \ -+ B_ptr_label -+ -+ int_label: DW_TAG_base_type { -+ {DW_AT_byte_size ${::long_size} DW_FORM_udata} -+ {DW_AT_encoding @DW_ATE_signed} -+ {DW_AT_name "int"} -+ } -+ -+ class_A_label: DW_TAG_class_type { -+ {DW_AT_name "A"} -+ {DW_AT_byte_size ${::struct_A_size} DW_FORM_sdata} -+ } { -+ DW_TAG_member { -+ {DW_AT_name "a"} -+ {DW_AT_type :$int_label} -+ {DW_AT_data_member_location ${::A_a} DW_FORM_udata} -+ } -+ DW_TAG_member { -+ {DW_AT_name "x"} -+ {DW_AT_type :$int_label} -+ {DW_AT_data_member_location ${::A_x} DW_FORM_udata} -+ } -+ } -+ -+ class_B_label: DW_TAG_class_type { -+ {DW_AT_name "B"} -+ {DW_AT_byte_size ${::struct_B_size} DW_FORM_sdata} -+ } { -+ # While there are easier / better ways to specify an -+ # offset used by DW_AT_data_member_location than that -+ # used below, we need a location expression here in -+ # order to reproduce the bug. Moreover, this location -+ # expression needs to use opcodes that aren't handled -+ # by decode_locdesc() in dwarf2/read.c; if we use -+ # opcodes that _are_ handled by that function, the -+ # location expression will be converted into a simple -+ # offset - which will then (again) not reproduce the -+ # bug. At the time that this test was written, -+ # neither DW_OP_pick nor DW_OP_drop were being handled -+ # by decode_locdesc(); this is why those opcodes were -+ # chosen. -+ DW_TAG_inheritance { -+ {DW_AT_type :$class_A_label} -+ {DW_AT_data_member_location { -+ DW_OP_constu ${::B_a} -+ DW_OP_plus -+ DW_OP_pick 0 -+ DW_OP_drop} SPECIAL_expr} -+ {DW_AT_accessibility 1 DW_FORM_data1} -+ } -+ DW_TAG_member { -+ {DW_AT_name "b"} -+ {DW_AT_type :$int_label} -+ {DW_AT_data_member_location ${::B_b} DW_FORM_udata} -+ } -+ DW_TAG_member { -+ {DW_AT_name "x2"} -+ {DW_AT_type :$int_label} -+ {DW_AT_data_member_location ${::B_x2} DW_FORM_udata} -+ } -+ } -+ -+ B_ptr_label: DW_TAG_pointer_type { -+ {DW_AT_type :$class_B_label} -+ {DW_AT_byte_size ${::addr_size} DW_FORM_sdata} -+ } -+ -+ DW_TAG_variable { -+ {DW_AT_name "g_A"} -+ {DW_AT_type :$class_A_label} -+ {DW_AT_external 1 flag} -+ {DW_AT_location {DW_OP_addr [gdb_target_symbol "g_A"]} \ -+ SPECIAL_expr} -+ } -+ -+ DW_TAG_variable { -+ {DW_AT_name "g_B"} -+ {DW_AT_type :$class_B_label} -+ {DW_AT_external 1 flag} -+ {DW_AT_location {DW_OP_addr [gdb_target_symbol "g_B"]} \ -+ SPECIAL_expr} -+ } -+ -+ # We can't use MACRO_AT for the definitions of foo and bar -+ # because it doesn't provide a way to pass the appropriate -+ # flags. Therefore, we list the name, low_pc, and high_pc -+ # explicitly. -+ DW_TAG_subprogram { -+ {DW_AT_name foo} -+ {DW_AT_low_pc $foo_start DW_FORM_addr} -+ {DW_AT_high_pc $foo_end DW_FORM_addr} -+ {DW_AT_type :${B_ptr_label}} -+ {DW_AT_external 1 flag} -+ } -+ -+ DW_TAG_subprogram { -+ {DW_AT_name bar} -+ {DW_AT_low_pc $bar_start DW_FORM_addr} -+ {DW_AT_high_pc $bar_end DW_FORM_addr} -+ {DW_AT_type :${B_ptr_label}} -+ {DW_AT_external 1 flag} -+ } { -+ DW_TAG_formal_parameter { -+ {DW_AT_name v} -+ {DW_AT_type :${B_ptr_label}} -+ } -+ } -+ } -+ } -+ -+ lines {version 2} L { -+ include_dir "${::srcdir}/${::subdir}" -+ file_name "${::srcfile}" 1 -+ -+ # Generate a line table program. -+ program { -+ {DW_LNE_set_address $foo_start} -+ {line [gdb_get_line_number "foo prologue"]} -+ {DW_LNS_copy} -+ {DW_LNE_set_address foo_label} -+ {line [gdb_get_line_number "foo return"]} -+ {DW_LNS_copy} -+ {line [gdb_get_line_number "foo end"]} -+ {DW_LNS_copy} -+ {DW_LNE_set_address $foo_end} -+ {DW_LNS_advance_line 1} -+ {DW_LNS_copy} -+ {DW_LNE_end_sequence} -+ -+ {DW_LNE_set_address $bar_start} -+ {line [gdb_get_line_number "bar prologue"]} -+ {DW_LNS_copy} -+ {DW_LNE_set_address bar_label} -+ {line [gdb_get_line_number "bar return"]} -+ {DW_LNS_copy} -+ {line [gdb_get_line_number "bar end"]} -+ {DW_LNS_copy} -+ {DW_LNE_set_address $bar_end} -+ {DW_LNS_advance_line 1} -+ {DW_LNS_copy} -+ {DW_LNE_end_sequence} -+ } -+ } -+} -+ -+# Compile the shared object again, but this time include / use the -+# DWARF info that we've created above. Note that (again) -+# -DIS_SHAREDLIB is used to prevent inclusion of main() in the shared -+# object. Also note the use of the "nodebug" option. Any debugging -+# information that we need will be provided by the DWARF info created -+# above. -+if {[gdb_compile_shlib [list $libsrc $asm_file] $lib_so \ -+ {additional_flags=-DIS_SHAREDLIB nodebug}] != ""} { -+ untested "failed to compile shared library" -+ return -+} -+ -+# Compile the main program for use with the shared object. -+if [prepare_for_testing "failed to prepare" ${testfile} \ -+ ${::srcfile2} [list debug shlib=$lib_so]] { -+ return -1 -+} -+ -+# Do whatever is necessary to make sure that the shared library is -+# loaded for remote targets. -+gdb_load_shlib ${lib_so} -+ -+if ![runto_main] then { -+ fail "can't run to main" -+ return -+} -+ -+# Step into foo so that we can finish out of it. -+gdb_test "step" "foo .. at .* foo end.*" "step into foo" -+ -+# Finishing out of foo will create a value that will later need to -+# be preserved when restarting the program. -+gdb_test "finish" "= \\(class B \\*\\) ${::hex} .*" "finish out of foo" -+ -+# Dereferencing and printing the return value isn't necessary -+# for reproducing the bug, but we should make sure that the -+# return value is what we expect it to be. -+gdb_test "p *$" { = { = {a = 8, x = 9}, b = 10, x2 = 11}} \ -+ "dereference return value" -+ -+# The original PR28030 reproducer stepped back into the shared object, -+# so we'll do the same here: -+gdb_test "step" "bar \\(.*" "step into bar" -+ -+# We don't want a clean restart here since that will be too clean. -+# The original reproducer for PR28030 set a breakpoint in the shared -+# library and then restarted via "run". The command below does roughly -+# the same thing. It's at this step that an internal error would -+# occur for PR28030. The "message" argument tells runto to turn on -+# the printing of PASSes while runto is doing its job. -+runto "bar" message -diff --git a/gdb/testsuite/gdb.dwarf2/locexpr-data-member-location.h b/gdb/testsuite/gdb.dwarf2/locexpr-data-member-location.h -new file mode 100644 ---- /dev/null -+++ b/gdb/testsuite/gdb.dwarf2/locexpr-data-member-location.h -@@ -0,0 +1,30 @@ -+/* Copyright (C) 2021 Free Software Foundation, Inc. -+ -+ This file is part of GDB. -+ -+ 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 . */ -+ -+typedef struct A { -+ long a; -+ long x; -+} A; -+ -+typedef struct B { -+ A a; -+ long b; -+ long x2; -+} B; -+ -+extern B *foo (); -+extern B *bar (B *v); diff --git a/gdb-testsuite-add-gdb.arch-ppc64-break-on-_exit.exp.patch b/gdb-testsuite-add-gdb.arch-ppc64-break-on-_exit.exp.patch deleted file mode 100644 index 92e0305..0000000 --- a/gdb-testsuite-add-gdb.arch-ppc64-break-on-_exit.exp.patch +++ /dev/null @@ -1,348 +0,0 @@ -[gdb/testsuite] Add gdb.arch/ppc64-break-on-_exit.exp - -Add a regression test-case for commit a50bdb99afe "[gdb/tdep, rs6000] Don't -skip system call in skip_prologue": -- set a breakpoint on a local copy of glibc's _exit, and -- verify that it triggers. - -The test-case uses an assembly file by default, but also has the possibility -to use a C source file instead. - -Tested on ppc64le-linux. Verified that the test-case fails without -aforementioned commit, and passes with the commit. Both with assembly -and C source. - ---- - gdb/testsuite/gdb.arch/ppc64-break-on-_exit-main.c | 27 +++++ - gdb/testsuite/gdb.arch/ppc64-break-on-_exit.c | 112 +++++++++++++++++++++ - gdb/testsuite/gdb.arch/ppc64-break-on-_exit.exp | 56 +++++++++++ - gdb/testsuite/gdb.arch/ppc64-break-on-_exit.s | 108 ++++++++++++++++++++ - 4 files changed, 303 insertions(+) - -diff --git a/gdb/testsuite/gdb.arch/ppc64-break-on-_exit-main.c b/gdb/testsuite/gdb.arch/ppc64-break-on-_exit-main.c -new file mode 100644 -index 00000000000..77253140e36 ---- /dev/null -+++ b/gdb/testsuite/gdb.arch/ppc64-break-on-_exit-main.c -@@ -0,0 +1,27 @@ -+/* This file is part of GDB, the GNU debugger. -+ -+ Copyright 2021 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 . */ -+ -+#include -+ -+__thread int __libc_errno; -+ -+int -+main () -+{ -+ _exit (22); -+ return 0; -+} -diff --git a/gdb/testsuite/gdb.arch/ppc64-break-on-_exit.c b/gdb/testsuite/gdb.arch/ppc64-break-on-_exit.c -new file mode 100644 -index 00000000000..8638a7a6b70 ---- /dev/null -+++ b/gdb/testsuite/gdb.arch/ppc64-break-on-_exit.c -@@ -0,0 +1,112 @@ -+/* This file is part of GDB, the GNU debugger. -+ -+ Copyright 2021 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 . */ -+ -+/* This file was generated from glibc's 2.31 _exit.c, by doing a glibc build -+ on ppc64le-linux, copying the command line, adding -g0 -save-temps and -+ recuding the _exit.i file. */ -+ -+void _exit (int status); -+ -+extern __thread int __libc_errno; -+ -+void -+_exit (int status) -+{ -+ while (1) -+ { -+ ({ -+ long int sc_err __attribute__ ((unused)); -+ long int sc_ret -+ = ({ -+ register long int r0 __asm__ ("r0"); -+ register long int r3 __asm__ ("r3"); -+ register long int r4 __asm__ ("r4"); -+ register long int r5 __asm__ ("r5"); -+ register long int r6 __asm__ ("r6"); -+ register long int r7 __asm__ ("r7"); -+ register long int r8 __asm__ ("r8"); -+ long int arg1 = (long int) (status); -+ -+ r0 = 234; -+ -+ extern void __illegally_sized_syscall_arg1 (void); -+ if (__builtin_classify_type (status) != 5 && sizeof (status) > 8) -+ __illegally_sized_syscall_arg1 (); -+ -+ r3 = arg1; -+ __asm__ __volatile__ ("sc\n\t" "mfcr %0\n\t" "0:" -+ : "=&r" (r0), "=&r" (r3), "=&r" (r4), -+ "=&r" (r5), "=&r" (r6), "=&r" (r7), -+ "=&r" (r8) : "0" (r0), "1" (r3) -+ : "r9", "r10", "r11", "r12", "cr0", "ctr", "memory"); -+ sc_err = r0; -+ -+ r3; -+ }); -+ -+ if (((void) (sc_ret), __builtin_expect ((sc_err) & (1 << 28), 0))) -+ { -+ (__libc_errno = ((sc_ret))); -+ sc_ret = -1L; -+ } -+ -+ sc_ret; -+ }); -+ -+ ({ -+ long int sc_err __attribute__ ((unused)); -+ long int sc_ret -+ = ({ -+ register long int r0 __asm__ ("r0"); -+ register long int r3 __asm__ ("r3"); -+ register long int r4 __asm__ ("r4"); -+ register long int r5 __asm__ ("r5"); -+ register long int r6 __asm__ ("r6"); -+ register long int r7 __asm__ ("r7"); -+ register long int r8 __asm__ ("r8"); -+ long int arg1 = (long int) (status); -+ -+ r0 = 1; -+ -+ extern void __illegally_sized_syscall_arg1 (void); -+ if (__builtin_classify_type (status) != 5 && sizeof (status) > 8) -+ __illegally_sized_syscall_arg1 (); -+ -+ r3 = arg1; -+ __asm__ __volatile__ ("sc\n\t" "mfcr %0\n\t" "0:" -+ : "=&r" (r0), "=&r" (r3), "=&r" (r4), -+ "=&r" (r5), "=&r" (r6), "=&r" (r7), -+ "=&r" (r8) : "0" (r0), "1" (r3) -+ : "r9", "r10", "r11", "r12", "cr0", "ctr", "memory"); -+ sc_err = r0; -+ -+ r3; -+ }); -+ -+ if (((void) (sc_ret), __builtin_expect ((sc_err) & (1 << 28), 0))) -+ { -+ (__libc_errno = ((sc_ret))); -+ sc_ret = -1L; -+ } -+ -+ sc_ret; -+ }); -+ -+ -+ asm (".long 0"); -+ } -+} -diff --git a/gdb/testsuite/gdb.arch/ppc64-break-on-_exit.exp b/gdb/testsuite/gdb.arch/ppc64-break-on-_exit.exp -new file mode 100644 -index 00000000000..b2fef8e8b76 ---- /dev/null -+++ b/gdb/testsuite/gdb.arch/ppc64-break-on-_exit.exp -@@ -0,0 +1,56 @@ -+# Copyright 2021 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 . -+ -+# Set a breakpoint on a local copy of glibc's _exit, and verify that it -+# triggers. The function does a syscall immediately after the prologue, and -+# if the breakpoint is set past the syscall due to faulty prologue skipping, -+# the breakpoint will not trigger. -+# -+# In particular, we're trying to excercise the instruction analysis -+# functionality of prologue skipping. If non-minimal symbols are -+# read, then that functionality might not be used because f.i. -+# line-info is used instead. So, we use nodebug. -+ -+if {![istarget "powerpc*"] || ![is_lp64_target]} { -+ unsupported "Not powerpc64" -+ return -+} -+ -+set flags { nodebug } -+if { 1 } { -+ standard_testfile .s -main.c -+} else { -+ standard_testfile .c -main.c -+ lappend flags optimize=-O2 -+ lappend flags additional_flags=-fno-stack-protector -+ lappend flags additional_flags=-mlong-double-128 -+ lappend flags additional_flags=-fpic -+ lappend flags additional_flags=-ftls-model=initial-exec -+} -+ -+if { [prepare_for_testing "failed to prepare" ${testfile} \ -+ [list $srcfile $srcfile2] $flags] } { -+ return -1 -+} -+ -+if ![runto_main] then { -+ return 0 -+} -+ -+gdb_breakpoint "_exit" -+ -+# If the skip_prologue analysis of _exit is too eager, we may not hit the -+# breakpoint. -+gdb_continue_to_breakpoint "_exit" "_exit \\(\\).*" -diff --git a/gdb/testsuite/gdb.arch/ppc64-break-on-_exit.s b/gdb/testsuite/gdb.arch/ppc64-break-on-_exit.s -new file mode 100644 -index 00000000000..37a9ace2aff ---- /dev/null -+++ b/gdb/testsuite/gdb.arch/ppc64-break-on-_exit.s -@@ -0,0 +1,108 @@ -+/* This file is part of GDB, the GNU debugger. -+ -+ Copyright 2021 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 . */ -+ -+/* This file was generated from ppc64-break-on-_exit.c. */ -+ -+ .file "ppc64-break-on-_exit.c" -+ .abiversion 2 -+ .section ".text" -+ .align 2 -+ .p2align 4,,15 -+ .globl _exit -+ .type _exit, @function -+_exit: -+.LCF0: -+0: addis 2,12,.TOC.-.LCF0@ha -+ addi 2,2,.TOC.-.LCF0@l -+ .localentry _exit,.-_exit -+ addis 9,2,__libc_errno@got@tprel@ha -+ std 31,-8(1) -+ mr 31,3 -+ std 30,-16(1) -+ li 0,234 -+ ld 9,__libc_errno@got@tprel@l(9) -+ mr 3,31 -+ add 30,9,__libc_errno@tls -+#APP -+ # 28 "src/gdb/testsuite/gdb.arch/ppc64-break-on-_exit.c" 1 -+ sc -+ mfcr 0 -+ 0: -+ # 0 "" 2 -+#NO_APP -+ andis. 9,0,0x1000 -+ mr 9,3 -+ li 0,1 -+ mr 3,31 -+ bne 0,.L13 -+ .p2align 4,,15 -+.L2: -+#APP -+ # 67 "src/gdb/testsuite/gdb.arch/ppc64-break-on-_exit.c" 1 -+ sc -+ mfcr 0 -+ 0: -+ # 0 "" 2 -+#NO_APP -+ andis. 9,0,0x1000 -+ bne 0,.L14 -+.L3: -+#APP -+ # 87 "src/gdb/testsuite/gdb.arch/ppc64-break-on-_exit.c" 1 -+ .long 0 -+ # 0 "" 2 -+#NO_APP -+.L15: -+ li 0,234 -+ mr 3,31 -+#APP -+ # 28 "src/gdb/testsuite/gdb.arch/ppc64-break-on-_exit.c" 1 -+ sc -+ mfcr 0 -+ 0: -+ # 0 "" 2 -+#NO_APP -+ andis. 9,0,0x1000 -+ mr 9,3 -+ li 0,1 -+ mr 3,31 -+ beq 0,.L2 -+.L13: -+ stw 9,0(30) -+#APP -+ # 67 "src/gdb/testsuite/gdb.arch/ppc64-break-on-_exit.c" 1 -+ sc -+ mfcr 0 -+ 0: -+ # 0 "" 2 -+#NO_APP -+ andis. 9,0,0x1000 -+ beq 0,.L3 -+ .p2align 4,,15 -+.L14: -+ stw 3,0(30) -+#APP -+ # 87 "src/gdb/testsuite/gdb.arch/ppc64-break-on-_exit.c" 1 -+ .long 0 -+ # 0 "" 2 -+#NO_APP -+ b .L15 -+ .long 0 -+ .byte 0,0,0,0,0,2,0,0 -+ .size _exit,.-_exit -+ .ident "GCC: (SUSE Linux) 7.5.0" -+ .section .note.GNU-stack,"",@progbits diff --git a/gdb-testsuite-add-gdb.opt-break-on-_exit.exp.patch b/gdb-testsuite-add-gdb.opt-break-on-_exit.exp.patch deleted file mode 100644 index 8a4fe67..0000000 --- a/gdb-testsuite-add-gdb.opt-break-on-_exit.exp.patch +++ /dev/null @@ -1,131 +0,0 @@ -[gdb/testsuite] Add gdb.opt/break-on-_exit.exp - -Add a test-case to excercise the problem scenario reported in PR28527 and -fixed in commit a50bdb99afe "[gdb/tdep, rs6000] Don't skip system call in -skip_prologue": -- set a breakpoint on _exit, and -- verify that it triggers. - -Note that this is not a regression test for that commit. Since the actual -code in _exit may vary across os instances, we cannot guarantee that the -problem will always trigger with this test-case. - -Rather, this test-case is a version of the original test-case -(gdb.threads/process-dies-while-detaching.exp) that is minimal while still -reproducing the problem reported in PR28527, in that same setting. - -The benefit of this test-case is that it exercise real-life code and may -expose similar problems in other settings. Also, it provides a much easier -test-case to investigate in case a similar problem occurs. - -Tested on x86_64-linux and ppc64le-linux. - ---- - gdb/testsuite/gdb.opt/break-on-_exit.c | 26 +++++++++++++ - gdb/testsuite/gdb.opt/break-on-_exit.exp | 66 ++++++++++++++++++++++++++++++++ - 2 files changed, 92 insertions(+) - -diff --git a/gdb/testsuite/gdb.opt/break-on-_exit.c b/gdb/testsuite/gdb.opt/break-on-_exit.c -new file mode 100644 -index 00000000000..d8da66193a8 ---- /dev/null -+++ b/gdb/testsuite/gdb.opt/break-on-_exit.c -@@ -0,0 +1,26 @@ -+/* This testcase is part of GDB, the GNU debugger. -+ -+ Copyright 2021 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 . */ -+ -+#include -+ -+int -+main (void) -+{ -+ _exit (0); -+ -+ return 0; -+} -diff --git a/gdb/testsuite/gdb.opt/break-on-_exit.exp b/gdb/testsuite/gdb.opt/break-on-_exit.exp -new file mode 100644 -index 00000000000..38476412862 ---- /dev/null -+++ b/gdb/testsuite/gdb.opt/break-on-_exit.exp -@@ -0,0 +1,66 @@ -+# Copyright 2021 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 . */ -+ -+# Set a breakpoint on libc's _exit, and verify that it triggers. The function -+# tends to do a syscall immediately after the prologue, and if the breakpoint is -+# set past the syscall due to faulty prologue skipping, the breakpoint will not -+# trigger. -+# -+# In particular, we're trying to excercise the instruction analysis -+# functionality of prologue skipping. If the non-minimal symbols are -+# read for libc, then that functionality might not be used because f.i. -+# line-info is used instead. Also, if the minimal symbols are not read -+# for libc, then the breakpoint is set on the exec-local _exit@plt instead, -+# and that functionality will also not be used. -+# -+# We may get the required setup in case of a libc with misssing separate -+# debuginfo, but we want the same effect if that debuginfo is installed. -+# -+# So, we use -readnever to read minimal symbols, but not non-miminal symbols. -+# -+# Because the code at _exit may be and usually is optimized, the test is in -+# the gdb.opt directory. -+ -+standard_testfile -+ -+# See if we have target board readnow.exp or similar. -+if { [lsearch -exact $GDBFLAGS -readnow] != -1 \ -+ || [lsearch -exact $GDBFLAGS --readnow] != -1 } { -+ untested "--readnever not allowed in combination with --readnow" -+ return -1 -+} -+ -+save_vars { GDBFLAGS } { -+ append GDBFLAGS " -readnever" -+ -+ if {[prepare_for_testing "failed to prepare" $testfile $srcfile nodebug]} { -+ return -1 -+ } -+} -+ -+if ![runto_main] then { -+ return 0 -+} -+ -+gdb_breakpoint "_exit" -+ -+# Give some background information about the breakpoint(s) and corresponding -+# the shared lib(s). -+gdb_test "info breakpoints" -+gdb_test "info shared" -+ -+# If the skip_prologue analysis of _exit is too eager, we may not hit the -+# breakpoint. -+gdb_continue_to_breakpoint "_exit" "_exit \\(\\) .*" diff --git a/gdb-testsuite-add-gdb.testsuite-dump-system-info.exp.patch b/gdb-testsuite-add-gdb.testsuite-dump-system-info.exp.patch deleted file mode 100644 index 5853b11..0000000 --- a/gdb-testsuite-add-gdb.testsuite-dump-system-info.exp.patch +++ /dev/null @@ -1,81 +0,0 @@ -[gdb/testsuite] Add gdb.testsuite/dump-system-info.exp - -When interpreting the testsuite results, it's often relevant what kind of -machine the testsuite ran on. On a local machine one can just do -/proc/cpuinfo, but in case of running tests using a remote system -that distributes test runs to other remote systems that are not directly -accessible, that's not possible. - -Fix this by dumping /proc/cpuinfo into the gdb.log, as well as lsb_release -a -and uname -a. - -We could do this at the start of each test run, by putting it into unix.exp -or some such. However, this might be too verbose, so we choose to put it into -its own test-case, such that it get triggered in a full testrun, but not when -running one or a subset of tests. - -We put the test-case into the gdb.testsuite directory, which is currently the -only place in the testsuite where we do not test gdb. [ Though perhaps this -could be put into a new gdb.info directory, since the test-case doesn't -actually test the testsuite. ] - -Tested on x86_64-linux. - ---- - gdb/testsuite/gdb.testsuite/dump-system-info.exp | 48 ++++++++++++++++++++++++ - 1 file changed, 48 insertions(+) - -diff --git a/gdb/testsuite/gdb.testsuite/dump-system-info.exp b/gdb/testsuite/gdb.testsuite/dump-system-info.exp -new file mode 100644 -index 00000000000..bf181469bd5 ---- /dev/null -+++ b/gdb/testsuite/gdb.testsuite/dump-system-info.exp -@@ -0,0 +1,48 @@ -+# Copyright 2021 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 . -+ -+# The purpose of this test-case is to dump /proc/cpuinfo and similar system -+# info into gdb.log. -+ -+# Check if /proc/cpuinfo is available. -+set res [remote_exec target "test -r /proc/cpuinfo"] -+set status [lindex $res 0] -+set output [lindex $res 1] -+ -+if { $status == 0 && $output == "" } { -+ verbose -log "Cpuinfo available, dumping:" -+ remote_exec target "cat /proc/cpuinfo" -+} else { -+ verbose -log "Cpuinfo not available" -+} -+ -+set res [remote_exec target "lsb_release -a"] -+set status [lindex $res 0] -+set output [lindex $res 1] -+ -+if { $status == 0 } { -+ verbose -log "lsb_release -a availabe, dumping:\n$output" -+} else { -+ verbose -log "lsb_release -a not available" -+} -+ -+set res [remote_exec target "uname -a"] -+set status [lindex $res 0] -+set output [lindex $res 1] -+ -+if { $status == 0 } { -+ verbose -log "uname -a availabe, dumping:\n$output" -+} else { -+ verbose -log "uname -a not available" -+} diff --git a/gdb-testsuite-add-missing-wait-in-gdb.base-signals-state-child.exp.patch b/gdb-testsuite-add-missing-wait-in-gdb.base-signals-state-child.exp.patch deleted file mode 100644 index e5c7cae..0000000 --- a/gdb-testsuite-add-missing-wait-in-gdb.base-signals-state-child.exp.patch +++ /dev/null @@ -1,59 +0,0 @@ -[gdb/testsuite] Add missing wait in gdb.base/signals-state-child.exp - -On OBS I ran into: -... -(gdb) shell diff -s outputs/gdb.base/signals-state-child/standalone.txt \ - outputs/gdb.base/signals-state-child/gdb.txt^M -diff: outputs/gdb.base/signals-state-child/standalone.txt: \ - No such file or directory^M -(gdb) FAIL: gdb.base/signals-state-child.exp: signals states are identical -... - -I managed to reproduce this by adding "sleep (5)" at the start of main in -signals-state-child.c. - -Fix this by waiting on the result of the spawned command. - -Tested on x86_64-linux. - ---- - gdb/testsuite/gdb.base/signals-state-child.exp | 14 +++++++++++--- - 1 file changed, 11 insertions(+), 3 deletions(-) - -diff --git a/gdb/testsuite/gdb.base/signals-state-child.exp b/gdb/testsuite/gdb.base/signals-state-child.exp -index 0984033811b..81589375f22 100644 ---- a/gdb/testsuite/gdb.base/signals-state-child.exp -+++ b/gdb/testsuite/gdb.base/signals-state-child.exp -@@ -69,9 +69,11 @@ set res [remote_spawn target "$binfile-standalone"] - if { $res < 0 || $res == "" } { - untested "spawning $binfile-standalone failed" - return 1 --} else { -- pass "collect standalone signals state" - } -+ -+set wait_status [remote_wait target 60] -+set have_standalone [expr [lindex $wait_status 0] == 0] -+gdb_assert { $have_standalone } "collect standalone signals state" - remote_close target - - # Now run the program through gdb, and dump its initial signal actions -@@ -86,6 +88,12 @@ if { ! [ runto_main ] } then { - - gdb_continue_to_end "collect signals state under gdb" - -+set test "signals states are identical" -+if { ! $have_standalone } { -+ untested $test -+ return -1 -+} -+ - if {!$purely_local} { - # Copy file from target to host through build. - remote_download host [remote_upload target gdb.txt] gdb.txt -@@ -95,4 +103,4 @@ if {!$purely_local} { - # Diff the .txt files. They should be identical. - gdb_test "shell diff -s $standalone_txt $gdb_txt" \ - "Files .* are identical.*" \ -- "signals states are identical" -+ $test diff --git a/gdb-testsuite-add-nopie-in-two-test-cases.patch b/gdb-testsuite-add-nopie-in-two-test-cases.patch deleted file mode 100644 index 4c081bf..0000000 --- a/gdb-testsuite-add-nopie-in-two-test-cases.patch +++ /dev/null @@ -1,51 +0,0 @@ -[gdb/testsuite] Add nopie in two test-cases - -When running test-case gdb.dwarf2/dw2-restrict.exp on openSUSE Leap 15.2 with -gcc-PIE installed (switching compiler default to -fPIE/-pie), I get: -... -gdb compile failed, ld: outputs/gdb.dwarf2/dw2-restrict/dw2-restrict0.o: \ - warning: relocation in read-only section `.text' -ld: warning: creating DT_TEXTREL in a PIE -UNTESTED: gdb.dwarf2/dw2-restrict.exp: failed to prepare -... - -This is due to using a hardcoded .S file that was generated with -fno-PIE. - -Fix this by adding the missing nopie. - -Likewise in gdb.arch/amd64-tailcall-noret.exp. - -Tested on x86_64-linux. - ---- - gdb/testsuite/gdb.arch/amd64-tailcall-noret.exp | 2 ++ - gdb/testsuite/gdb.dwarf2/dw2-restrict.exp | 3 ++- - 2 files changed, 4 insertions(+), 1 deletion(-) - -diff --git a/gdb/testsuite/gdb.arch/amd64-tailcall-noret.exp b/gdb/testsuite/gdb.arch/amd64-tailcall-noret.exp -index c68abce61e3..fb1d5695a11 100644 ---- a/gdb/testsuite/gdb.arch/amd64-tailcall-noret.exp -+++ b/gdb/testsuite/gdb.arch/amd64-tailcall-noret.exp -@@ -25,6 +25,8 @@ if [info exists COMPILE] { - return - } - -+lappend opts nopie -+ - if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} $opts] } { - return -1 - } -diff --git a/gdb/testsuite/gdb.dwarf2/dw2-restrict.exp b/gdb/testsuite/gdb.dwarf2/dw2-restrict.exp -index 6f98b6cfb18..2a46510c7a3 100644 ---- a/gdb/testsuite/gdb.dwarf2/dw2-restrict.exp -+++ b/gdb/testsuite/gdb.dwarf2/dw2-restrict.exp -@@ -27,7 +27,8 @@ if {![istarget x86_64-*] || ![is_lp64_target]} { - - standard_testfile .S - --if {[prepare_for_testing "failed to prepare" $testfile $srcfile {nodebug}]} { -+if {[prepare_for_testing "failed to prepare" $testfile $srcfile \ -+ {nodebug nopie}]} { - return -1 - } - diff --git a/gdb-testsuite-address-test-failures-in-gdb.mi-mi-multi-commands.exp.patch b/gdb-testsuite-address-test-failures-in-gdb.mi-mi-multi-commands.exp.patch new file mode 100644 index 0000000..3368ae1 --- /dev/null +++ b/gdb-testsuite-address-test-failures-in-gdb.mi-mi-multi-commands.exp.patch @@ -0,0 +1,69 @@ +gdb/testsuite: address test failures in gdb.mi/mi-multi-commands.exp + +The gdb.mi/mi-multi-commands.exp test was added in commit: + + commit d08cbc5d3203118da5583296e49273cf82378042 + Date: Wed Dec 22 12:57:44 2021 +0000 + + gdb: unbuffer all input streams when not using readline + +And then tweaked in commit: + + commit 144459531dd68a1287905079aaa131b777a8cc82 + Date: Mon Feb 7 20:35:58 2022 +0000 + + gdb/testsuite: relax pattern in new gdb.mi/mi-multi-commands.exp test + +The second of these commits was intended to address periodic test +failures that I was seeing, and this change did fix some problems, +but, unfortunately, introduced other issues. + +The problem is that the test relies on sending two commands to GDB in +a single write. As the characters that make these two commands arrive +they are echoed to GDB's console. However, there is a race between +how quickly the characters are echoed and how quickly GDB decides to +act on the incoming commands. + +Usually, both commands are echoed in full before GDB acts on the first +command, but sometimes this is not the case, and GDB can execute the +first command before both commands are fully echoed to the console. +In this case, the output of the first command will be mixed in with +the echoing of the second command. + +This mixing of the command echoing and the first command output is +what was causing failures in the original version of the test. + +The second commit relaxed the expected output pattern a little, but +was still susceptible to failures, so this commit further relaxes the +pattern. + +Now, we look for the first command output with no regard to what is +before, or after the command. Then we look for the first mi prompt to +indicate that the first command has completed. + +I believe that this change should make the test more stable than it +was before. + +--- + gdb/testsuite/gdb.mi/mi-multi-commands.exp | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/gdb/testsuite/gdb.mi/mi-multi-commands.exp b/gdb/testsuite/gdb.mi/mi-multi-commands.exp +index 12b1b482f9a..d00e0aaea8b 100644 +--- a/gdb/testsuite/gdb.mi/mi-multi-commands.exp ++++ b/gdb/testsuite/gdb.mi/mi-multi-commands.exp +@@ -100,9 +100,12 @@ proc run_test { args } { + set seen_second_message false + + gdb_test_multiple "" "look for first command output, command length $i" -prompt "$mi_gdb_prompt" { +- -re "\\^done,value=\"\\\\\"FIRST COMMAND\\\\\"\"\r\n" { +- pass $gdb_test_name ++ -re "\\^done,value=\"\\\\\"FIRST COMMAND\\\\\"\"" { + set seen_first_message true ++ exp_continue ++ } ++ -re "\r\n$mi_gdb_prompt" { ++ gdb_assert $seen_first_message $gdb_test_name + } + } + diff --git a/gdb-testsuite-detect-change-instead-of-init-in-gdb.mi-mi-var-block.exp.patch b/gdb-testsuite-detect-change-instead-of-init-in-gdb.mi-mi-var-block.exp.patch new file mode 100644 index 0000000..45b5d0b --- /dev/null +++ b/gdb-testsuite-detect-change-instead-of-init-in-gdb.mi-mi-var-block.exp.patch @@ -0,0 +1,74 @@ +[gdb/testsuite] Detect change instead of init in gdb.mi/mi-var-block.exp + +On openSUSE Tumbleweed with target board unix/-m32, I run into: +... +PASS: gdb.mi/mi-var-block.exp: step at do_block_test 2 +Expecting: ^(-var-update \*[^M +]+)?(\^done,changelist=\[{name="foo",in_scope="true",type_changed="false",has_more="0"}, +{name="cb",in_scope="true",type_changed="false",has_more="0"}\][^M +]+[(]gdb[)] ^M +[ ]*) +-var-update *^M +^done,changelist=[{name="foo",in_scope="true",type_changed="false",has_more="0"}]^M +(gdb) ^M +FAIL: gdb.mi/mi-var-block.exp: update all vars: cb foo changed (unexpected output) +... + +The problem is that the test-case attempts to detect a change in the cb +variable caused by this initialization: +... +void +do_block_tests () +{ + int cb = 12; +... +but that only works if the stack location happens to be unequal to 12 before +the initialization. + +Fix this by first initializing to 0, and then changing the value to 12: +... +- int cb = 12; ++ int cb = 0; ++ cb = 12; +... +and detecting that change. + +Tested on x86_64-linux. + +Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29195 + +--- + gdb/testsuite/gdb.mi/mi-var-block.exp | 5 +++++ + gdb/testsuite/gdb.mi/var-cmd.c | 3 ++- + 2 files changed, 7 insertions(+), 1 deletion(-) + +diff --git a/gdb/testsuite/gdb.mi/mi-var-block.exp b/gdb/testsuite/gdb.mi/mi-var-block.exp +index cb94936fa86..b0707eb3530 100644 +--- a/gdb/testsuite/gdb.mi/mi-var-block.exp ++++ b/gdb/testsuite/gdb.mi/mi-var-block.exp +@@ -40,6 +40,11 @@ mi_gdb_load ${binfile} + + mi_runto do_block_tests + ++# step to "cb = 12;" ++mi_step_to "do_block_tests" "" "var-cmd.c" \ ++ [gdb_get_line_number "cb = 12;"] \ ++ "step at do_block_test 0" ++ + # Test: c_variable-3.2 + # Desc: create cb and foo + mi_create_varobj "cb" "cb" "create local variable cb" +diff --git a/gdb/testsuite/gdb.mi/var-cmd.c b/gdb/testsuite/gdb.mi/var-cmd.c +index fddb0d39a5e..f3312788a80 100644 +--- a/gdb/testsuite/gdb.mi/var-cmd.c ++++ b/gdb/testsuite/gdb.mi/var-cmd.c +@@ -207,7 +207,8 @@ subroutine1 (int i, long *l) + void + do_block_tests () + { +- int cb = 12; ++ int cb = 0; ++ cb = 12; + + { + int foo; diff --git a/gdb-testsuite-detect-no-mpx-support.patch b/gdb-testsuite-detect-no-mpx-support.patch deleted file mode 100644 index d9e091c..0000000 --- a/gdb-testsuite-detect-no-mpx-support.patch +++ /dev/null @@ -1,54 +0,0 @@ -[gdb/testsuite] Detect 'No MPX support' - -On openSUSE Leap 15.3, mpx support has been disabled for m32, so I run into: -... -(gdb) run ^M -Starting program: outputs/gdb.arch/i386-mpx/i386-mpx ^M -[Thread debugging using libthread_db enabled]^M -Using host libthread_db library "/lib64/libthread_db.so.1".^M -No MPX support^M -... -and eventually into all sort of fails in this and other mpx test-cases. - -Fix this by detecting the "No MPX support" message in have_mpx. - -Tested on x86_64-linux with target boards unix and unix/-m32. - ---- - gdb/testsuite/lib/gdb.exp | 23 +++++++++++++++++++++++ - 1 file changed, 23 insertions(+) - -diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp -index 8b62d73ca9a..306e746168b 100644 ---- a/gdb/testsuite/lib/gdb.exp -+++ b/gdb/testsuite/lib/gdb.exp -@@ -8089,6 +8089,29 @@ gdb_caching_proc have_mpx { - - remote_file build delete $obj - -+ if { $status == 0 } { -+ verbose "$me: returning $status" 2 -+ return $status -+ } -+ -+ # Compile program with -mmpx -fcheck-pointer-bounds, try to trigger -+ # 'No MPX support', in other words, see if kernel supports mpx. -+ set src { int main (void) { return 0; } } -+ set comp_flags {} -+ append comp_flags " additional_flags=-mmpx" -+ append comp_flags " additional_flags=-fcheck-pointer-bounds" -+ if {![gdb_simple_compile $me-2 $src executable $comp_flags]} { -+ return 0 -+ } -+ -+ set result [remote_exec target $obj] -+ set status [lindex $result 0] -+ set output [lindex $result 1] -+ set status [expr ($status == 0) \ -+ && ![string equal $output "No MPX support\r\n"]] -+ -+ remote_file build delete $obj -+ - verbose "$me: returning $status" 2 - return $status - } diff --git a/gdb-testsuite-disable-inferior-output-in-gdb.base-foll-vfork.exp.patch b/gdb-testsuite-disable-inferior-output-in-gdb.base-foll-vfork.exp.patch deleted file mode 100644 index 9fa87a2..0000000 --- a/gdb-testsuite-disable-inferior-output-in-gdb.base-foll-vfork.exp.patch +++ /dev/null @@ -1,153 +0,0 @@ -[gdb/testsuite] Disable inferior output in gdb.base/foll-vfork.exp - -Test-case gdb.base/foll-vfork.exp has inferior output that is not needed, but -which makes the regexp matching more difficult (see commit 1f28b70def1 -"[gdb/testsuite] Fix regexp in gdb.base/foll-vfork.exp"). - -Disable the inferior output using '#if DEBUG'. - -Tested on x86_64-linux. - ---- - gdb/testsuite/gdb.base/foll-vfork-exit.c | 14 ++++++++++++-- - gdb/testsuite/gdb.base/foll-vfork.c | 9 ++++++++- - gdb/testsuite/gdb.base/foll-vfork.exp | 17 +++++++++++------ - gdb/testsuite/gdb.base/vforked-prog.c | 7 ++++++- - 4 files changed, 37 insertions(+), 10 deletions(-) - -diff --git a/gdb/testsuite/gdb.base/foll-vfork-exit.c b/gdb/testsuite/gdb.base/foll-vfork-exit.c -index 6c263cdc057..15e272afe82 100644 ---- a/gdb/testsuite/gdb.base/foll-vfork-exit.c -+++ b/gdb/testsuite/gdb.base/foll-vfork-exit.c -@@ -29,12 +29,22 @@ main () - pid = vfork (); /* VFORK */ - if (pid == 0) - { -- printf ("I'm the child!\n"); -+ const char *s = "I'm the child!"; -+#if DEBUG -+ printf ("%s\n", s); -+#else -+ const char *volatile v = s; -+#endif - _exit (0); - } - else - { -- printf ("I'm the proud parent of child #%d!\n", pid); -+ const char *s = "I'm the proud parent of child"; -+#if DEBUG -+ printf ("%s #%d!\n", s, pid); -+#else -+ const char *volatile v = s; -+#endif - } - - return 0; -diff --git a/gdb/testsuite/gdb.base/foll-vfork.c b/gdb/testsuite/gdb.base/foll-vfork.c -index 2f6661d1a0b..b7e332e146b 100644 ---- a/gdb/testsuite/gdb.base/foll-vfork.c -+++ b/gdb/testsuite/gdb.base/foll-vfork.c -@@ -40,12 +40,19 @@ main (int argc, char ** argv) - memcpy (prog + len - 10, "vforked-prog", 12); - prog[len + 2] = 0; - -+#if DEBUG - printf ("I'm the child!\n"); -+#endif - execlp (prog, prog, (char *) 0); - perror ("exec failed"); - _exit (1); - } - else { -- printf ("I'm the proud parent of child #%d!\n", pid); -+ const char *s = "I'm the proud parent of child"; -+#if DEBUG -+ printf ("%s #%d!\n", s, pid); -+#else -+ const char *volatile v = s; -+#endif - } - } -diff --git a/gdb/testsuite/gdb.base/foll-vfork.exp b/gdb/testsuite/gdb.base/foll-vfork.exp -index a781a5c2087..fc710167f7d 100644 ---- a/gdb/testsuite/gdb.base/foll-vfork.exp -+++ b/gdb/testsuite/gdb.base/foll-vfork.exp -@@ -32,9 +32,14 @@ if [gdb_debug_enabled] { - return 0 - } - -+# Set DEBUG to 0 or 1 in sources. -+set debug 0 -+ - standard_testfile - --set compile_options debug -+set compile_options {} -+lappend compile_options debug -+lappend compile_options additional_flags=-DDEBUG=$debug - - if {[build_executable $testfile.exp $testfile $srcfile $compile_options] == -1} { - untested "failed to compile main testcase" -@@ -126,7 +131,7 @@ proc vfork_parent_follow_to_bp {} { - - gdb_test_no_output "set follow-fork parent" - -- set bp_location [gdb_get_line_number "printf (\"I'm the proud parent of child"] -+ set bp_location [gdb_get_line_number "I'm the proud parent of child"] - gdb_test "break ${srcfile}:${bp_location}" ".*" "break, vfork to bp" - - set test "continue to bp" -@@ -176,7 +181,7 @@ proc vfork_and_exec_child_follow_to_main_bp {} { - - gdb_test_no_output "set follow-fork child" - -- set linenum [gdb_get_line_number "printf(\"Hello from vforked-prog" ${srcfile2}] -+ set linenum [gdb_get_line_number "Hello from vforked-prog" ${srcfile2}] - - set test "continue to bp" - gdb_test_multiple "continue" $test { -@@ -278,7 +283,7 @@ proc tcatch_vfork_then_child_follow_exec {} { - continue_to_vfork - - set linenum1 [gdb_get_line_number "pid = vfork ();"] -- set linenum2 [gdb_get_line_number "printf(\"Hello from vforked-prog" ${srcfile2}] -+ set linenum2 [gdb_get_line_number "Hello from vforked-prog" ${srcfile2}] - - set test "finish" - gdb_test_multiple "finish" $test { -@@ -356,7 +361,7 @@ proc vfork_relations_in_info_inferiors { variant } { - if { $variant == "exec" } { - global srcfile2 - -- set linenum [gdb_get_line_number "printf(\"Hello from vforked-prog" ${srcfile2}] -+ set linenum [gdb_get_line_number "Hello from vforked-prog" ${srcfile2}] - set test "continue to bp" - gdb_test_multiple "continue" $test { - -re ".*xecuting new program.*Breakpoint.*vforked-prog.c:${linenum}.*$gdb_prompt " { -@@ -487,7 +492,7 @@ set testfile "foll-vfork-exit" - set srcfile ${testfile}.c - set binfile [standard_output_file ${testfile}] - --if {[build_executable $testfile.exp $testfile $srcfile] == -1} { -+if {[build_executable $testfile.exp $testfile $srcfile $compile_options] == -1} { - untested "failed to build $testfile" - return - } -diff --git a/gdb/testsuite/gdb.base/vforked-prog.c b/gdb/testsuite/gdb.base/vforked-prog.c -index 936c6e6032d..999efa8ce0d 100644 ---- a/gdb/testsuite/gdb.base/vforked-prog.c -+++ b/gdb/testsuite/gdb.base/vforked-prog.c -@@ -19,6 +19,11 @@ - - int main (void) - { -- printf("Hello from vforked-prog...\n"); -+ const char *s = "Hello from vforked-prog"; -+#if DEBUG -+ printf ("%s...\n", s); -+#else -+ const char *volatile v = s; -+#endif - return 0; - } diff --git a/gdb-testsuite-don-t-error-when-trying-to-unset-last_spawn_tty_name.patch b/gdb-testsuite-don-t-error-when-trying-to-unset-last_spawn_tty_name.patch deleted file mode 100644 index 7979a6d..0000000 --- a/gdb-testsuite-don-t-error-when-trying-to-unset-last_spawn_tty_name.patch +++ /dev/null @@ -1,80 +0,0 @@ -gdb/testsuite: don't error when trying to unset last_spawn_tty_name - -In spawn_capture_tty_name (lib/gdb.exp) we either set or unset -last_spawn_tty_name depending on whether spawn_out(slave,name) exists -or not. - -One situation that might cause spawn_out(slave,name) to not exists is -if the spawn function is called with the argument -leaveopen, which is -how it is called when processes are created as part of a pipeline, the -created process has no tty, instead its output is written to a file -descriptor. - -If a pipeline is created consisting of multiple processes then there -will be multiple sequential calls to spawn, all using -leaveopen. The -first of these calls is fine, spawn_out(slave,name) is not set, and so -in spawn_capture_tty_name we unset last_spawn_tty_name. However, on -the second call to spawn, spawn_out(slave,name) is still not set and -so in spawn_capture_tty_name we again try to unset -last_spawn_tty_name, this now throws an error (as last_spawn_tty_name -is already unset). - -Fix this issue by using -nocomplain with the call to unset in -spawn_capture_tty_name. - -Before this commit I was seeing gdb.base/gnu-debugdata.exp report 1 -pass, and 1 unsupported test. After this commit I now see 16 passes -from this test script. - -I have also improved the code that used to do this: - - if { [info exists spawn_out] } { - set ::last_spawn_tty_name $spawn_out(slave,name) - } else { - ... - } - -The problem here is that we check for the existence of spawn_out, and -then unconditionally read spawn_out(slave,name). A situation could -arise where some other element of spawn_out is set, -e.g. spawn_out(foo), in which case we would enter the if block and try -to read a non-existent variable. After this commit we now check -specifically for spawn_out(slave,name). - -Finally, it is worth noting that before this issue was fixed runtest -itself, or rather the expect process behind runtest, would segfault -while exiting. I haven't looked at all into what the problem is here -that caused expect to crash, as fixing the bug in GDB's testing -scripts made the segfault go away. - ---- - gdb/testsuite/lib/gdb.exp | 14 ++++++++++++-- - 1 file changed, 12 insertions(+), 2 deletions(-) - -diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp -index 7a8332dd573..8b62d73ca9a 100644 ---- a/gdb/testsuite/lib/gdb.exp -+++ b/gdb/testsuite/lib/gdb.exp -@@ -2010,10 +2010,20 @@ proc gdb_file_cmd { arg } { - proc spawn_capture_tty_name { args } { - set result [uplevel builtin_spawn $args] - upvar spawn_out spawn_out -- if { [info exists spawn_out] } { -+ if { [info exists spawn_out(slave,name)] } { - set ::last_spawn_tty_name $spawn_out(slave,name) - } else { -- unset ::last_spawn_tty_name -+ # If a process is spawned as part of a pipe line (e.g. passing -+ # -leaveopen to the spawn proc) then the spawned process is no -+ # assigned a tty and spawn_out(slave,name) will not be set. -+ # In that case we want to ensure that last_spawn_tty_name is -+ # not set. -+ # -+ # If the previous process spawned was also not assigned a tty -+ # (e.g. multiple processed chained in a pipeline) then -+ # last_spawn_tty_name will already be unset, so, if we don't -+ # use -nocomplain here we would otherwise get an error. -+ unset -nocomplain ::last_spawn_tty_name - } - return $result - } diff --git a/gdb-testsuite-enable-some-test-cases-for-x86_64-m32.patch b/gdb-testsuite-enable-some-test-cases-for-x86_64-m32.patch new file mode 100644 index 0000000..50a7478 --- /dev/null +++ b/gdb-testsuite-enable-some-test-cases-for-x86_64-m32.patch @@ -0,0 +1,430 @@ +[gdb/testsuite] Enable some test-cases for x86_64 -m32 + +When trying to run test-case gdb.reverse/i387-env-reverse.exp for x86_64-linux +with target board unix/-m32, it's skipped. + +Fix this by using is_x86_like_target instead of istarget "i?86-*linux*". + +This exposes a number of duplicates, fix those by making the test names unique. + +Likewise in a couple of other test-cases. + +Tested on x86_64-linux with target boards unix/-m32. + +--- + gdb/testsuite/gdb.reverse/i386-precsave.exp | 2 +- + gdb/testsuite/gdb.reverse/i386-reverse.exp | 2 +- + gdb/testsuite/gdb.reverse/i387-env-reverse.exp | 121 +++++++------ + gdb/testsuite/gdb.reverse/i387-stack-reverse.exp | 214 +++++++++++------------ + 4 files changed, 166 insertions(+), 173 deletions(-) + +diff --git a/gdb/testsuite/gdb.reverse/i386-precsave.exp b/gdb/testsuite/gdb.reverse/i386-precsave.exp +index e3fc940f5d0..54580474430 100644 +--- a/gdb/testsuite/gdb.reverse/i386-precsave.exp ++++ b/gdb/testsuite/gdb.reverse/i386-precsave.exp +@@ -25,7 +25,7 @@ if ![supports_process_record] { + } + + +-if ![istarget "i?86-*linux*"] then { ++if ![is_x86_like_target] then { + verbose "Skipping i386 reverse tests." + return + } +diff --git a/gdb/testsuite/gdb.reverse/i386-reverse.exp b/gdb/testsuite/gdb.reverse/i386-reverse.exp +index 68e964e863c..15c18dad205 100644 +--- a/gdb/testsuite/gdb.reverse/i386-reverse.exp ++++ b/gdb/testsuite/gdb.reverse/i386-reverse.exp +@@ -24,7 +24,7 @@ if ![supports_reverse] { + } + + +-if ![istarget "i?86-*linux*"] then { ++if ![is_x86_like_target] then { + verbose "Skipping i386 reverse tests." + return + } +diff --git a/gdb/testsuite/gdb.reverse/i387-env-reverse.exp b/gdb/testsuite/gdb.reverse/i387-env-reverse.exp +index 43c493dcca9..a0a79c22ed0 100644 +--- a/gdb/testsuite/gdb.reverse/i387-env-reverse.exp ++++ b/gdb/testsuite/gdb.reverse/i387-env-reverse.exp +@@ -16,7 +16,7 @@ + # This file is part of the gdb testsuite. + + +-if ![istarget "i?86-*linux*"] then { ++if ![is_x86_like_target] then { + verbose "Skipping i387 reverse float tests." + return + } +@@ -52,82 +52,79 @@ gdb_test "until $location" ".*$srcfile:$location.*" \ + "rewind to beginning of main" + gdb_test_no_output "set exec-dir forward" "set forward direction" + +-# Test FPU env particularly ftag and fstatus reigters. ++with_test_prefix "forward" { ++ # Test FPU env particularly ftag and fstatus reigters. + +-set location [gdb_get_line_number "TEST ENV"] +-gdb_test "until $location" ".*$srcfile:$location.*asm.*nop.*" \ +- "begin testing fpu env" ++ set location [gdb_get_line_number "TEST ENV"] ++ gdb_test "until $location" ".*$srcfile:$location.*asm.*nop.*" \ ++ "begin testing fpu env" + +-gdb_test "n" "asm.*fsave.*" "save FPU env in memory" +-gdb_test "n" "asm.*frstor.*" "restore FPU env" +-gdb_test "n" "asm.*fstsw.*" "store status word in EAX" +-gdb_test "n" "asm.*fld1.*" "push st0" ++ gdb_test "n" "asm.*fsave.*" "save FPU env in memory" ++ gdb_test "n" "asm.*frstor.*" "restore FPU env" ++ gdb_test "n" "asm.*fstsw.*" "store status word in EAX" ++ gdb_test "n" "asm.*fld1.*" "push st0" + +-gdb_test "info register eax" "eax *0x8040000.*\[ \t\]+.*" "verify eax == 0x8040000" +-gdb_test "info register fstat" "fstat *0.*\[ \t\]+.*" "verify fstat == 0" +-gdb_test "info register ftag" "ftag *0xffff.*\[ \t\]+.*" "verify ftag == 0xffff" ++ gdb_test "info register eax" "eax *0x8040000.*\[ \t\]+.*" "verify eax == 0x8040000" ++ gdb_test "info register fstat" "fstat *0.*\[ \t\]+.*" "verify fstat == 0" ++ gdb_test "info register ftag" "ftag *0xffff.*\[ \t\]+.*" "verify ftag == 0xffff" + +-gdb_test "stepi" "asm.*fldl2t.*" "push st0" +-gdb_test "info register fstat" "fstat *0x3800.*\[ \t\]+.*" "verify fstat == 0x3800" +-gdb_test "info register ftag" "ftag *0x3fff.*\[ \t\]+.*" "verify ftag == 0x3fff" ++ gdb_test "stepi" "asm.*fldl2t.*" "step to fldl2t" ++ gdb_test "info register fstat" "fstat *0x3800.*\[ \t\]+.*" "verify fstat == 0x3800" ++ gdb_test "info register ftag" "ftag *0x3fff.*\[ \t\]+.*" "verify ftag == 0x3fff" + +-gdb_test "stepi" "asm.*fldl2e.*" "push st0" +-gdb_test "info register fstat" "fstat *0x3000.*\[ \t\]+.*" "verify fstat == 0x3000" +-gdb_test "info register ftag" "ftag *0xfff.*\[ \t\]+.*" "verify ftag == 0xfff" ++ gdb_test "stepi" "asm.*fldl2e.*" "step to fldl2e" ++ gdb_test "info register fstat" "fstat *0x3000.*\[ \t\]+.*" "verify fstat == 0x3000" ++ gdb_test "info register ftag" "ftag *0xfff.*\[ \t\]+.*" "verify ftag == 0xfff" + +-gdb_test "stepi" "asm.*fldpi.*" "push st0" +-gdb_test "info register fstat" "fstat *0x2800.*\[ \t\]+.*" "verify fstat == 0x2800" +-gdb_test "info register ftag" "ftag *0x3ff.*\[ \t\]+.*" "verify ftag == 0x3ff" ++ gdb_test "stepi" "asm.*fldpi.*" "step to fldpi" ++ gdb_test "info register fstat" "fstat *0x2800.*\[ \t\]+.*" "verify fstat == 0x2800" ++ gdb_test "info register ftag" "ftag *0x3ff.*\[ \t\]+.*" "verify ftag == 0x3ff" + +-gdb_test "stepi" "asm.*fldlg2.*" "push st0" +-gdb_test "info register fstat" "fstat *0x2000.*\[ \t\]+.*" "verify fstat == 0x2000" +-gdb_test "info register ftag" "ftag *0xff.*\[ \t\]+.*" "verify ftag == 0xff" ++ gdb_test "stepi" "asm.*fldlg2.*" "step to fldlg2" ++ gdb_test "info register fstat" "fstat *0x2000.*\[ \t\]+.*" "verify fstat == 0x2000" ++ gdb_test "info register ftag" "ftag *0xff.*\[ \t\]+.*" "verify ftag == 0xff" + +-gdb_test "stepi" "asm.*fldln2.*" "push st0" +-gdb_test "info register fstat" "fstat *0x1800.*\[ \t\]+.*" "verify fstat == 0x1800" +-gdb_test "info register ftag" "ftag *0x3f.*\[ \t\]+.*" "verify ftag == 0x3f" ++ gdb_test "stepi" "asm.*fldln2.*" "step to fldln2" ++ gdb_test "info register fstat" "fstat *0x1800.*\[ \t\]+.*" "verify fstat == 0x1800" ++ gdb_test "info register ftag" "ftag *0x3f.*\[ \t\]+.*" "verify ftag == 0x3f" + +-gdb_test "stepi" "asm.*fldz.*" "push st0" +-gdb_test "info register fstat" "fstat *0x1000.*\[ \t\]+.*" "verify fstat == 0x1000" +-gdb_test "info register ftag" "ftag *0xf.*\[ \t\]+.*" "verify ftag == 0xf" ++ gdb_test "stepi" "asm.*fldz.*" "step to fldz" ++ gdb_test "info register fstat" "fstat *0x1000.*\[ \t\]+.*" "verify fstat == 0x1000" ++ gdb_test "info register ftag" "ftag *0xf.*\[ \t\]+.*" "verify ftag == 0xf" + +-gdb_test "stepi" "asm.*nop.*" "push st0" +-gdb_test "info register fstat" "fstat *0x800.*\[ \t\]+.*" "verify fstat == 0x800" +-gdb_test "info register ftag" "ftag *0x7.*\[ \t\]+.*" "verify ftag == 0x7" +- +- +-# move backward and ehck we get the same registers back. +- +-gdb_test "reverse-stepi" "asm.*fldz.*" "push st0" +-gdb_test "info register fstat" "fstat *0x1000.*\[ \t\]+.*" "verify fstat == 0x1000" +-gdb_test "info register ftag" "ftag *0xf.*\[ \t\]+.*" "verify ftag == 0xf" +- +-gdb_test "reverse-stepi" "asm.*fldln2.*" "push st0" +-gdb_test "info register fstat" "fstat *0x1800.*\[ \t\]+.*" "verify fstat == 0x1800" +-gdb_test "info register ftag" "ftag *0x3f.*\[ \t\]+.*" "verify ftag == 0x3f" +- +-gdb_test "reverse-stepi" "asm.*fldlg2.*" "push st0" +-gdb_test "info register fstat" "fstat *0x2000.*\[ \t\]+.*" "verify fstat == 0x2000" +-gdb_test "info register ftag" "ftag *0xff.*\[ \t\]+.*" "verify ftag == 0xff" +- +-gdb_test "reverse-stepi" "asm.*fldpi.*" "push st0" +-gdb_test "info register fstat" "fstat *0x2800.*\[ \t\]+.*" "verify fstat == 0x2800" +-gdb_test "info register ftag" "ftag *0x3ff.*\[ \t\]+.*" "verify ftag == 0x3ff" +- +-gdb_test "reverse-stepi" "asm.*fldl2e.*" "push st0" +-gdb_test "info register fstat" "fstat *0x3000.*\[ \t\]+.*" "verify fstat == 0x3000" +-gdb_test "info register ftag" "ftag *0xfff.*\[ \t\]+.*" "verify ftag == 0xfff" ++ gdb_test "stepi" "asm.*nop.*" "step to nop" ++ gdb_test "info register fstat" "fstat *0x800.*\[ \t\]+.*" "verify fstat == 0x800" ++ gdb_test "info register ftag" "ftag *0x7.*\[ \t\]+.*" "verify ftag == 0x7" ++} + +-gdb_test "reverse-stepi" "asm.*fldl2t.*" "push st0" +-gdb_test "info register fstat" "fstat *0x3800.*\[ \t\]+.*" "verify fstat == 0x3800" +-gdb_test "info register ftag" "ftag *0x3fff.*\[ \t\]+.*" "verify ftag == 0x3fff" ++# Move backward and check we get the same registers back. + +-gdb_test "reverse-stepi" "asm.*fld1.*" "push st0" +-gdb_test "info register fstat" "fstat *0.*\[ \t\]+.*" "verify fstat == 0" +-gdb_test "info register ftag" "ftag *0xffff.*\[ \t\]+.*" "verify ftag == 0xffff" ++with_test_prefix "backward" { ++ gdb_test "reverse-stepi" "asm.*fldz.*" "step to fldz" ++ gdb_test "info register fstat" "fstat *0x1000.*\[ \t\]+.*" "verify fstat == 0x1000" ++ gdb_test "info register ftag" "ftag *0xf.*\[ \t\]+.*" "verify ftag == 0xf" + ++ gdb_test "reverse-stepi" "asm.*fldln2.*" "step to fldln2" ++ gdb_test "info register fstat" "fstat *0x1800.*\[ \t\]+.*" "verify fstat == 0x1800" ++ gdb_test "info register ftag" "ftag *0x3f.*\[ \t\]+.*" "verify ftag == 0x3f" + ++ gdb_test "reverse-stepi" "asm.*fldlg2.*" "step to fldlg2" ++ gdb_test "info register fstat" "fstat *0x2000.*\[ \t\]+.*" "verify fstat == 0x2000" ++ gdb_test "info register ftag" "ftag *0xff.*\[ \t\]+.*" "verify ftag == 0xff" + ++ gdb_test "reverse-stepi" "asm.*fldpi.*" "step to fldpi" ++ gdb_test "info register fstat" "fstat *0x2800.*\[ \t\]+.*" "verify fstat == 0x2800" ++ gdb_test "info register ftag" "ftag *0x3ff.*\[ \t\]+.*" "verify ftag == 0x3ff" + ++ gdb_test "reverse-stepi" "asm.*fldl2e.*" "step tp fldl2d" ++ gdb_test "info register fstat" "fstat *0x3000.*\[ \t\]+.*" "verify fstat == 0x3000" ++ gdb_test "info register ftag" "ftag *0xfff.*\[ \t\]+.*" "verify ftag == 0xfff" + ++ gdb_test "reverse-stepi" "asm.*fldl2t.*" "step to fldl2t" ++ gdb_test "info register fstat" "fstat *0x3800.*\[ \t\]+.*" "verify fstat == 0x3800" ++ gdb_test "info register ftag" "ftag *0x3fff.*\[ \t\]+.*" "verify ftag == 0x3fff" + ++ gdb_test "reverse-stepi" "asm.*fld1.*" "step to fld1" ++ gdb_test "info register fstat" "fstat *0.*\[ \t\]+.*" "verify fstat == 0" ++ gdb_test "info register ftag" "ftag *0xffff.*\[ \t\]+.*" "verify ftag == 0xffff" ++} +diff --git a/gdb/testsuite/gdb.reverse/i387-stack-reverse.exp b/gdb/testsuite/gdb.reverse/i387-stack-reverse.exp +index 9f8ff74da2b..cadd4f76035 100644 +--- a/gdb/testsuite/gdb.reverse/i387-stack-reverse.exp ++++ b/gdb/testsuite/gdb.reverse/i387-stack-reverse.exp +@@ -16,7 +16,7 @@ + # This file is part of the gdb testsuite. + + +-if ![istarget "i?86-*linux*"] then { ++if ![is_x86_like_target] then { + verbose "Skipping i387 reverse float tests." + return + } +@@ -48,112 +48,108 @@ gdb_test "until $location" ".*$srcfile:$location.*" \ + "rewind to beginning of main" + gdb_test_no_output "set exec-dir forward" "set forward direction" + +-# Test FPU stack. FPU stack includes st0, st1, st2, st3, st4, +-# st5, st6, st7. We push 8 values to FPU stack in record mode +-# and see whether all are getting recorded. +- +-set location [gdb_get_line_number "test st0 register"] +-gdb_test "until $location" ".*$srcfile:$location.*asm.*fld1.*" \ +- "begin test st0" +-gdb_test "stepi" "asm.*fldl2t.*" "push st0 == 1" +-gdb_test "info register st0" "st0 *1\[ \t\]+.*" "verify st0 == 1" +- +- +-gdb_test "stepi" "asm.*fldl2e.*" "push st0 == 3.3219280948*" +-gdb_test "info register st0" "st0 *3.32192.*\[ \t\]+.*" "verify st0 == 3.321928094*" +-gdb_test "info register st1" "st1 *1\[ \t\]+.*" "verify st1 == 1" +- +-gdb_test "stepi" "asm.*fldpi.*" "push st0 == 1.4426950406*" +-gdb_test "info register st0" "st0 *1.44269.*\[ \t\]+.*" "verify st0 == 1.442695040*" +-gdb_test "info register st1" "st1 *3.32192.*\[ \t\]+.*" "verify st1 == 3.3219280948*" +-gdb_test "info register st2" "st2 *1\[ \t\]+.*" "verify st2 == 1" +- +-gdb_test "stepi" "asm.*fldlg2.*" "push st0 == 3.14159265*" +-gdb_test "info register st0" "st0 *3.14159.*\[ \t\]+.*" "verify st0 == 3.14159265*" +-gdb_test "info register st1" "st1 *1.44269.*\[ \t\]+.*" "verify st1 == 1.4426950*" +-gdb_test "info register st2" "st2 *3.32192.*\[ \t\]+.*" "verify st2 == 3.3219280*" +-gdb_test "info register st3" "st3 *1\[ \t\]+.*" "verify st3 == 1" +- +-gdb_test "stepi" "asm.*fldln2.*" "push st0 == 0.301029*" +-gdb_test "info register st0" "st0 *0.30102.*\[ \t\]+.*" "verify st0 == 0.301029*" +-gdb_test "info register st1" "st1 *3.14159.*\[ \t\]+.*" "verify st1 == 3.14159265*" +-gdb_test "info register st2" "st2 *1.44269.*\[ \t\]+.*" "verify st2 == 1.44269506*" +-gdb_test "info register st3" "st3 *3.32192.*\[ \t\]+.*" "verify st3 == 3.3219280948*" +-gdb_test "info register st4" "st4 *1\[ \t\]+.*" "verify st4 == 1" +- +-gdb_test "stepi" "asm.*fldz.*" "push st0 == 0.69314*" +-gdb_test "info register st0" "st0 *0.69314.*\[ \t\]+.*" "verify st0 == 0.69314*" +-gdb_test "info register st1" "st1 *0.30102.*\[ \t\]+.*" "verify st1 == 0.301029*" +-gdb_test "info register st2" "st2 *3.14159.*\[ \t\]+.*" "verify st2 == 3.14159265*" +-gdb_test "info register st3" "st3 *1.44269.*\[ \t\]+.*" "verify st3 == 1.442695040*" +-gdb_test "info register st4" "st4 *3.32192.*\[ \t\]+.*" "verify st4 == 3.3219280948*" +-gdb_test "info register st5" "st5 *1\[ \t\]+.*" "verify st5 == 1" +- +-gdb_test "stepi" "asm.*fld1.*" "push st0 == 0" +-gdb_test "info register st0" "st0 *0\[ \t\]+.*" "verify st0 == 0" +-gdb_test "info register st1" "st1 *0.69314.*\[ \t\]+.*" "verify st1 == 0.69314*" +-gdb_test "info register st2" "st2 *0.30102.*\[ \t\]+.*" "verify st2 == 0.301029*" +-gdb_test "info register st3" "st3 *3.14159.*\[ \t\]+.*" "verify st3 == 3.14159265*" +-gdb_test "info register st4" "st4 *1.44269.*\[ \t\]+.*" "verify st4 == 1.442695040*" +-gdb_test "info register st5" "st5 *3.32192.*\[ \t\]+.*" "verify st5 == 3.32192809*" +-gdb_test "info register st6" "st6 *1\[ \t\]+.*" "verify st6 == 1" +- +-gdb_test "stepi" "asm.*nop.*" "push st0 == 0" +-gdb_test "info register st0" "st0 *1\[ \t\]+.*" "verify st0 == 1" +-gdb_test "info register st1" "st1 *0\[ \t\]+.*" "verify st1 == 0" +-gdb_test "info register st2" "st2 *0.69314.*\[ \t\]+.*" "verify st2 == 0.69314*" +-gdb_test "info register st3" "st3 *0.30102.*\[ \t\]+.*" "verify st3 == 0.301029*" +-gdb_test "info register st4" "st4 *3.14159.*\[ \t\]+.*" "verify st4 == 3.14159265*" +-gdb_test "info register st5" "st5 *1.44269.*\[ \t\]+.*" "verify st5 == 1.44269504*" +-gdb_test "info register st6" "st6 *3.32192.*\[ \t\]+.*" "verify st6 == 3.3219280948*" +-gdb_test "info register st7" "st7 *1.*" "verify st7 == 1" +- +-# Now step backward, and check that st0 value reverts to zero. +- +-gdb_test "reverse-stepi" "asm.*fld1.*" "undo registers, st0-st7" +-gdb_test "info register st0" "st0 *0\[ \t\]+.*" "verify st0 == 0" +-gdb_test "info register st1" "st1 *0.69314.*\[ \t\]+.*" "verify st1 == 0.69314*" +-gdb_test "info register st2" "st2 *0.30102.*\[ \t\]+.*" "verify st2 == 0.301029*" +-gdb_test "info register st3" "st3 *3.14159.*\[ \t\]+.*" "verify st3 == 3.14159265*" +-gdb_test "info register st4" "st4 *1.44269.*\[ \t\]+.*" "verify st4 == 1.442695040*" +-gdb_test "info register st5" "st5 *3.32192.*\[ \t\]+.*" "verify st5 == 3.3219280948*" +-gdb_test "info register st6" "st6 *1\[ \t\]+.*" "verify st6 == 1" +- +-gdb_test "reverse-stepi" "asm.*fldz.*" "push st0 == 0.69314*" +-gdb_test "info register st0" "st0 *0.69314.*\[ \t\]+.*" "verify st0 == 0.69314*" +-gdb_test "info register st1" "st1 *0.30102.*\[ \t\]+.*" "verify st1 == 0.301029*" +-gdb_test "info register st2" "st2 *3.14159.*\[ \t\]+.*" "verify st2 == 3.14159265*" +-gdb_test "info register st3" "st3 *1.44269.*\[ \t\]+.*" "verify st3 == 1.442695040*" +-gdb_test "info register st4" "st4 *3.32192.*\[ \t\]+.*" "verify st4 == 3.3219280948*" +-gdb_test "info register st5" "st5 *1\[ \t\]+.*" "verify st5 == 1" +- +-gdb_test "reverse-stepi" "asm.*fldln2.*" "push st0 == 0.301029*" +-gdb_test "info register st0" "st0 *0.30102.*\[ \t\]+.*" "verify st0 == 0.301029*" +-gdb_test "info register st1" "st1 *3.14159.*\[ \t\]+.*" "verify st1 == 3.14159265*" +-gdb_test "info register st2" "st2 *1.44269.*\[ \t\]+.*" "verify st2 == 1.442695040*" +-gdb_test "info register st3" "st3 *3.32192.*\[ \t\]+.*" "verify st3 == 3.3219280948*" +-gdb_test "info register st4" "st4 *1\[ \t\]+.*" "verify st4 == 1" +- +-gdb_test "reverse-stepi" "asm.*fldlg2.*" "push st0 == 3.14159265*" +-gdb_test "info register st0" "st0 *3.14159.*\[ \t\]+.*" "verify st0 == 3.14159265*" +-gdb_test "info register st1" "st1 *1.44269.*\[ \t\]+.*" "verify st1 == 1.442695040*" +-gdb_test "info register st2" "st2 *3.32192.*\[ \t\]+.*" "verify st2 == 3.3219280948*" +-gdb_test "info register st3" "st3 *1\[ \t\]+.*" "verify st3 == 1" +- +-gdb_test "reverse-stepi" "asm.*fldpi.*" "push st0 == 1.44269504088*" +-gdb_test "info register st0" "st0 *1.44269.*\[ \t\]+.*" "verify st0 == 1.442695040*" +-gdb_test "info register st1" "st1 *3.32192.*\[ \t\]+.*" "verify st1 == 3.3219280948*" +-gdb_test "info register st2" "st2 *1\[ \t\]+.*" "verify st2 == 1" +- +- +-gdb_test "reverse-stepi" "asm.*fldl2e.*" "push st0 == 3.3219280948*" +-gdb_test "info register st0" "st0 *3.32192.*\[ \t\]+.*" "verify st0 == 3.3219280948*" +-gdb_test "info register st1" "st1 *1\[ \t\]+.*" "verify st1 == 1" +- +-gdb_test "reverse-stepi" "asm.*fldl2t.*" "push st0 == 1" +-gdb_test "info register st0" "st0 *1\[ \t\]+.*" "verify st0 == 1" +- +- +- +- ++with_test_prefix "forward" { ++ # Test FPU stack. FPU stack includes st0, st1, st2, st3, st4, ++ # st5, st6, st7. We push 8 values to FPU stack in record mode ++ # and see whether all are getting recorded. ++ ++ set location [gdb_get_line_number "test st0 register"] ++ gdb_test "until $location" ".*$srcfile:$location.*asm.*fld1.*" \ ++ "begin test st0" ++ gdb_test "stepi" "asm.*fldl2t.*" "push st0 == 1" ++ gdb_test "info register st0" "st0 *1\[ \t\]+.*" "verify st0 == 1" ++ ++ gdb_test "stepi" "asm.*fldl2e.*" "push st0 == 3.3219280948*" ++ gdb_test "info register st0" "st0 *3.32192.*\[ \t\]+.*" "verify st0 == 3.321928094*" ++ gdb_test "info register st1" "st1 *1\[ \t\]+.*" "verify st1 == 1" ++ ++ gdb_test "stepi" "asm.*fldpi.*" "push st0 == 1.4426950406*" ++ gdb_test "info register st0" "st0 *1.44269.*\[ \t\]+.*" "verify st0 == 1.442695040*" ++ gdb_test "info register st1" "st1 *3.32192.*\[ \t\]+.*" "verify st1 == 3.3219280948*" ++ gdb_test "info register st2" "st2 *1\[ \t\]+.*" "verify st2 == 1" ++ ++ gdb_test "stepi" "asm.*fldlg2.*" "push st0 == 3.14159265*" ++ gdb_test "info register st0" "st0 *3.14159.*\[ \t\]+.*" "verify st0 == 3.14159265*" ++ gdb_test "info register st1" "st1 *1.44269.*\[ \t\]+.*" "verify st1 == 1.4426950*" ++ gdb_test "info register st2" "st2 *3.32192.*\[ \t\]+.*" "verify st2 == 3.3219280*" ++ gdb_test "info register st3" "st3 *1\[ \t\]+.*" "verify st3 == 1" ++ ++ gdb_test "stepi" "asm.*fldln2.*" "push st0 == 0.301029*" ++ gdb_test "info register st0" "st0 *0.30102.*\[ \t\]+.*" "verify st0 == 0.301029*" ++ gdb_test "info register st1" "st1 *3.14159.*\[ \t\]+.*" "verify st1 == 3.14159265*" ++ gdb_test "info register st2" "st2 *1.44269.*\[ \t\]+.*" "verify st2 == 1.44269506*" ++ gdb_test "info register st3" "st3 *3.32192.*\[ \t\]+.*" "verify st3 == 3.3219280948*" ++ gdb_test "info register st4" "st4 *1\[ \t\]+.*" "verify st4 == 1" ++ ++ gdb_test "stepi" "asm.*fldz.*" "push st0 == 0.69314*" ++ gdb_test "info register st0" "st0 *0.69314.*\[ \t\]+.*" "verify st0 == 0.69314*" ++ gdb_test "info register st1" "st1 *0.30102.*\[ \t\]+.*" "verify st1 == 0.301029*" ++ gdb_test "info register st2" "st2 *3.14159.*\[ \t\]+.*" "verify st2 == 3.14159265*" ++ gdb_test "info register st3" "st3 *1.44269.*\[ \t\]+.*" "verify st3 == 1.442695040*" ++ gdb_test "info register st4" "st4 *3.32192.*\[ \t\]+.*" "verify st4 == 3.3219280948*" ++ gdb_test "info register st5" "st5 *1\[ \t\]+.*" "verify st5 == 1" ++ ++ gdb_test "stepi" "asm.*fld1.*" "push st0 == 0" ++ gdb_test "info register st0" "st0 *0\[ \t\]+.*" "verify st0 == 0" ++ gdb_test "info register st1" "st1 *0.69314.*\[ \t\]+.*" "verify st1 == 0.69314*" ++ gdb_test "info register st2" "st2 *0.30102.*\[ \t\]+.*" "verify st2 == 0.301029*" ++ gdb_test "info register st3" "st3 *3.14159.*\[ \t\]+.*" "verify st3 == 3.14159265*" ++ gdb_test "info register st4" "st4 *1.44269.*\[ \t\]+.*" "verify st4 == 1.442695040*" ++ gdb_test "info register st5" "st5 *3.32192.*\[ \t\]+.*" "verify st5 == 3.32192809*" ++ gdb_test "info register st6" "st6 *1\[ \t\]+.*" "verify st6 == 1" ++ ++ gdb_test "stepi" "asm.*nop.*" "push st0 == 1, again" ++ gdb_test "info register st0" "st0 *1\[ \t\]+.*" "verify st0 == 1, again" ++ gdb_test "info register st1" "st1 *0\[ \t\]+.*" "verify st1 == 0" ++ gdb_test "info register st2" "st2 *0.69314.*\[ \t\]+.*" "verify st2 == 0.69314*" ++ gdb_test "info register st3" "st3 *0.30102.*\[ \t\]+.*" "verify st3 == 0.301029*" ++ gdb_test "info register st4" "st4 *3.14159.*\[ \t\]+.*" "verify st4 == 3.14159265*" ++ gdb_test "info register st5" "st5 *1.44269.*\[ \t\]+.*" "verify st5 == 1.44269504*" ++ gdb_test "info register st6" "st6 *3.32192.*\[ \t\]+.*" "verify st6 == 3.3219280948*" ++ gdb_test "info register st7" "st7 *1.*" "verify st7 == 1" ++} + ++with_test_prefix "backward" { ++ # Now step backward, and check that st0 value reverts to zero. ++ gdb_test "reverse-stepi" "asm.*fld1.*" "undo registers, st0-st7" ++ gdb_test "info register st0" "st0 *0\[ \t\]+.*" "verify st0 == 0" ++ gdb_test "info register st1" "st1 *0.69314.*\[ \t\]+.*" "verify st1 == 0.69314*" ++ gdb_test "info register st2" "st2 *0.30102.*\[ \t\]+.*" "verify st2 == 0.301029*" ++ gdb_test "info register st3" "st3 *3.14159.*\[ \t\]+.*" "verify st3 == 3.14159265*" ++ gdb_test "info register st4" "st4 *1.44269.*\[ \t\]+.*" "verify st4 == 1.442695040*" ++ gdb_test "info register st5" "st5 *3.32192.*\[ \t\]+.*" "verify st5 == 3.3219280948*" ++ gdb_test "info register st6" "st6 *1\[ \t\]+.*" "verify st6 == 1" ++ ++ gdb_test "reverse-stepi" "asm.*fldz.*" "push st0 == 0.69314*" ++ gdb_test "info register st0" "st0 *0.69314.*\[ \t\]+.*" "verify st0 == 0.69314*" ++ gdb_test "info register st1" "st1 *0.30102.*\[ \t\]+.*" "verify st1 == 0.301029*" ++ gdb_test "info register st2" "st2 *3.14159.*\[ \t\]+.*" "verify st2 == 3.14159265*" ++ gdb_test "info register st3" "st3 *1.44269.*\[ \t\]+.*" "verify st3 == 1.442695040*" ++ gdb_test "info register st4" "st4 *3.32192.*\[ \t\]+.*" "verify st4 == 3.3219280948*" ++ gdb_test "info register st5" "st5 *1\[ \t\]+.*" "verify st5 == 1" ++ ++ gdb_test "reverse-stepi" "asm.*fldln2.*" "push st0 == 0.301029*" ++ gdb_test "info register st0" "st0 *0.30102.*\[ \t\]+.*" "verify st0 == 0.301029*" ++ gdb_test "info register st1" "st1 *3.14159.*\[ \t\]+.*" "verify st1 == 3.14159265*" ++ gdb_test "info register st2" "st2 *1.44269.*\[ \t\]+.*" "verify st2 == 1.442695040*" ++ gdb_test "info register st3" "st3 *3.32192.*\[ \t\]+.*" "verify st3 == 3.3219280948*" ++ gdb_test "info register st4" "st4 *1\[ \t\]+.*" "verify st4 == 1" ++ ++ gdb_test "reverse-stepi" "asm.*fldlg2.*" "push st0 == 3.14159265*" ++ gdb_test "info register st0" "st0 *3.14159.*\[ \t\]+.*" "verify st0 == 3.14159265*" ++ gdb_test "info register st1" "st1 *1.44269.*\[ \t\]+.*" "verify st1 == 1.442695040*" ++ gdb_test "info register st2" "st2 *3.32192.*\[ \t\]+.*" "verify st2 == 3.3219280948*" ++ gdb_test "info register st3" "st3 *1\[ \t\]+.*" "verify st3 == 1" ++ ++ gdb_test "reverse-stepi" "asm.*fldpi.*" "push st0 == 1.44269504088*" ++ gdb_test "info register st0" "st0 *1.44269.*\[ \t\]+.*" "verify st0 == 1.442695040*" ++ gdb_test "info register st1" "st1 *3.32192.*\[ \t\]+.*" "verify st1 == 3.3219280948*" ++ gdb_test "info register st2" "st2 *1\[ \t\]+.*" "verify st2 == 1" ++ ++ gdb_test "reverse-stepi" "asm.*fldl2e.*" "push st0 == 3.3219280948*" ++ gdb_test "info register st0" "st0 *3.32192.*\[ \t\]+.*" "verify st0 == 3.3219280948*" ++ gdb_test "info register st1" "st1 *1\[ \t\]+.*" "verify st1 == 1" ++ ++ gdb_test "reverse-stepi" "asm.*fldl2t.*" "push st0 == 1" ++ gdb_test "info register st0" "st0 *1\[ \t\]+.*" "verify st0 == 1" ++} diff --git a/gdb-testsuite-factor-out-dump_info-in-gdb.testsuite-dump-system-info.exp.patch b/gdb-testsuite-factor-out-dump_info-in-gdb.testsuite-dump-system-info.exp.patch deleted file mode 100644 index 86f3abe..0000000 --- a/gdb-testsuite-factor-out-dump_info-in-gdb.testsuite-dump-system-info.exp.patch +++ /dev/null @@ -1,70 +0,0 @@ -[gdb/testsuite] Factor out dump_info in gdb.testsuite/dump-system-info.exp - -Factor out new proc dump_info in test-case gdb.testsuite/dump-system-info.exp, -and in the process: -- fix a few typos -- remove unnecessary "test -r /proc/cpuinfo" - -Tested on x86_64-linux. - -Co-Authored-By: Pedro Alves - ---- - gdb/testsuite/gdb.testsuite/dump-system-info.exp | 42 +++++++++--------------- - 1 file changed, 16 insertions(+), 26 deletions(-) - -diff --git a/gdb/testsuite/gdb.testsuite/dump-system-info.exp b/gdb/testsuite/gdb.testsuite/dump-system-info.exp -index bf181469bd5..1831479265c 100644 ---- a/gdb/testsuite/gdb.testsuite/dump-system-info.exp -+++ b/gdb/testsuite/gdb.testsuite/dump-system-info.exp -@@ -15,34 +15,24 @@ - # The purpose of this test-case is to dump /proc/cpuinfo and similar system - # info into gdb.log. - --# Check if /proc/cpuinfo is available. --set res [remote_exec target "test -r /proc/cpuinfo"] --set status [lindex $res 0] --set output [lindex $res 1] - --if { $status == 0 && $output == "" } { -- verbose -log "Cpuinfo available, dumping:" -- remote_exec target "cat /proc/cpuinfo" --} else { -- verbose -log "Cpuinfo not available" --} -- --set res [remote_exec target "lsb_release -a"] --set status [lindex $res 0] --set output [lindex $res 1] -+proc dump_info {cmd {what ""}} { - --if { $status == 0 } { -- verbose -log "lsb_release -a availabe, dumping:\n$output" --} else { -- verbose -log "lsb_release -a not available" --} -+ if {$what == ""} { -+ set what $cmd -+ } - --set res [remote_exec target "uname -a"] --set status [lindex $res 0] --set output [lindex $res 1] -+ set res [remote_exec target $cmd] -+ set status [lindex $res 0] -+ set output [lindex $res 1] - --if { $status == 0 } { -- verbose -log "uname -a availabe, dumping:\n$output" --} else { -- verbose -log "uname -a not available" -+ if { $status == 0 } { -+ verbose -log "$what available, dumping:\n$output" -+ } else { -+ verbose -log "$what not available" -+ } - } -+ -+dump_info "cat /proc/cpuinfo" "Cpuinfo" -+dump_info "uname -a" -+dump_info "lsb_release -a" diff --git a/gdb-testsuite-fix-assembly-comments-in-gdb.dwarf2-clang-debug-names.exp.tcl.patch b/gdb-testsuite-fix-assembly-comments-in-gdb.dwarf2-clang-debug-names.exp.tcl.patch deleted file mode 100644 index 0ffdf28..0000000 --- a/gdb-testsuite-fix-assembly-comments-in-gdb.dwarf2-clang-debug-names.exp.tcl.patch +++ /dev/null @@ -1,117 +0,0 @@ -[gdb/testsuite] Fix assembly comments in gdb.dwarf2/clang-debug-names.exp.tcl - -On openSUSE Leap 15.2 aarch64 I ran into: -... -clang-debug-names-debug.S:72: \ - Error: junk at end of line, first unrecognized character is `#' -... -due to: -... - 71 .Ldebug_names_start: - 72 .short 5 # Header: version -... - -Fix this by using the /* ... */ comment style instead: -... -$ sed -i 's% #\([^"]*\)%/*\1 */%' clang-debug-names.exp.tcl -... - -Tested on aarch64-linux and x86_64-linux. - ---- - gdb/testsuite/gdb.dwarf2/clang-debug-names.exp.tcl | 76 +++++++++++----------- - 1 file changed, 38 insertions(+), 38 deletions(-) - -diff --git a/gdb/testsuite/gdb.dwarf2/clang-debug-names.exp.tcl b/gdb/testsuite/gdb.dwarf2/clang-debug-names.exp.tcl -index 6c2858aef0a..4700024c788 100644 ---- a/gdb/testsuite/gdb.dwarf2/clang-debug-names.exp.tcl -+++ b/gdb/testsuite/gdb.dwarf2/clang-debug-names.exp.tcl -@@ -31,50 +31,50 @@ set debug_names \ - [list \ - " .4byte .Ldebug_names_end - .Ldebug_names_start" \ - ".Ldebug_names_start:" \ -- " .short 5 # Header: version" \ -- " .short 0 # Header: padding" \ -- " .long 1 # Header: compilation unit count" \ -- " .long 0 # Header: local type unit count" \ -- " .long 0 # Header: foreign type unit count" \ -- " .long 2 # Header: bucket count" \ -- " .long 2 # Header: name count" \ -+ " .short 5 /* Header: version */" \ -+ " .short 0 /* Header: padding */" \ -+ " .long 1 /* Header: compilation unit count */" \ -+ " .long 0 /* Header: local type unit count */" \ -+ " .long 0 /* Header: foreign type unit count */" \ -+ " .long 2 /* Header: bucket count */" \ -+ " .long 2 /* Header: name count */" \ - " .long .Lnames_abbrev_end0-.Lnames_abbrev_start0 " \ -- " # Header: abbreviation table size" \ -- " .long 8 # Header: augmentation string size" \ -- " .ascii \"LLVM0700\" # Header: augmentation string" \ -- " .long .Lcu1_begin # Compilation unit 0" \ -- " .long 1 # Bucket 0" \ -- " .long 0 # Bucket 1" \ -- " .long 193495088 # Hash in Bucket 0" \ -- " .long 2090499946 # Hash in Bucket 0" \ -- " .long $int_str_label # String in Bucket 0: int" \ -- " .long $main_str_label # String in Bucket 0: main" \ -- " .long .Lnames1-.Lnames_entries0 # Offset in Bucket 0" \ -- " .long .Lnames0-.Lnames_entries0 # Offset in Bucket 0" \ -+ " /* Header: abbreviation table size */" \ -+ " .long 8 /* Header: augmentation string size */" \ -+ " .ascii \"LLVM0700\" /* Header: augmentation string */" \ -+ " .long .Lcu1_begin /* Compilation unit 0 */" \ -+ " .long 1 /* Bucket 0 */" \ -+ " .long 0 /* Bucket 1 */" \ -+ " .long 193495088 /* Hash in Bucket 0 */" \ -+ " .long 2090499946 /* Hash in Bucket 0 */" \ -+ " .long $int_str_label /* String in Bucket 0: int */" \ -+ " .long $main_str_label /* String in Bucket 0: main */" \ -+ " .long .Lnames1-.Lnames_entries0/* Offset in Bucket 0 */" \ -+ " .long .Lnames0-.Lnames_entries0/* Offset in Bucket 0 */" \ - ".Lnames_abbrev_start0:" \ -- " .byte 46 # Abbrev code" \ -- " .byte 46 # DW_TAG_subprogram" \ -- " .byte 3 # DW_IDX_die_offset" \ -- " .byte 19 # DW_FORM_ref4" \ -- " .byte 0 # End of abbrev" \ -- " .byte 0 # End of abbrev" \ -- " .byte 36 # Abbrev code" \ -- " .byte 36 # DW_TAG_base_type" \ -- " .byte 3 # DW_IDX_die_offset" \ -- " .byte 19 # DW_FORM_ref4" \ -- " .byte 0 # End of abbrev" \ -- " .byte 0 # End of abbrev" \ -- " .byte 0 # End of abbrev list" \ -+ " .byte 46 /* Abbrev code */" \ -+ " .byte 46 /* DW_TAG_subprogram */" \ -+ " .byte 3 /* DW_IDX_die_offset */" \ -+ " .byte 19 /* DW_FORM_ref4 */" \ -+ " .byte 0 /* End of abbrev */" \ -+ " .byte 0 /* End of abbrev */" \ -+ " .byte 36 /* Abbrev code */" \ -+ " .byte 36 /* DW_TAG_base_type */" \ -+ " .byte 3 /* DW_IDX_die_offset */" \ -+ " .byte 19 /* DW_FORM_ref4 */" \ -+ " .byte 0 /* End of abbrev */" \ -+ " .byte 0 /* End of abbrev */" \ -+ " .byte 0 /* End of abbrev list */" \ - ".Lnames_abbrev_end0:" \ - ".Lnames_entries0:" \ - ".Lnames1:" \ -- " .byte 36 # Abbreviation code" \ -- " .long $int_die_label - .Lcu1_begin # DW_IDX_die_offset" \ -- " .long 0 # End of list: int" \ -+ " .byte 36 /* Abbreviation code */" \ -+ " .long $int_die_label - .Lcu1_begin/* DW_IDX_die_offset */" \ -+ " .long 0 /* End of list: int */" \ - ".Lnames0:" \ -- " .byte 46 # Abbreviation code" \ -- " .long $main_die_label - .Lcu1_begin # DW_IDX_die_offset" \ -- " .long 0 # End of list: main" \ -+ " .byte 46 /* Abbreviation code */" \ -+ " .long $main_die_label - .Lcu1_begin/* DW_IDX_die_offset */" \ -+ " .long 0 /* End of list: main */" \ - " .p2align 2" \ - ".Ldebug_names_end:"] - diff --git a/gdb-testsuite-fix-data-alignment-in-gdb.arch-i386-avx-sse-.exp.patch b/gdb-testsuite-fix-data-alignment-in-gdb.arch-i386-avx-sse-.exp.patch deleted file mode 100644 index 6f79805..0000000 --- a/gdb-testsuite-fix-data-alignment-in-gdb.arch-i386-avx-sse-.exp.patch +++ /dev/null @@ -1,245 +0,0 @@ -[gdb/testsuite] Fix data alignment in gdb.arch/i386-{avx,sse}.exp - -When running test-case gdb.arch/i386-avx.exp with clang I ran into: -... -(gdb) PASS: gdb.arch/i386-avx.exp: set first breakpoint in main -continue^M -Continuing.^M -^M -Program received signal SIGSEGV, Segmentation fault.^M -0x000000000040052b in main (argc=1, argv=0x7fffffffd3c8) at i386-avx.c:54^M -54 asm ("vmovaps 0(%0), %%ymm0\n\t"^M -(gdb) FAIL: gdb.arch/i386-avx.exp: continue to breakpoint: \ - continue to first breakpoint in main -... - -The problem is that the vmovaps insn requires an 256-bit (or 32-byte aligned -address), and it's only 16-byte aligned: -... -(gdb) p /x $rax -$1 = 0x601030 -... - -Fix this by copying to a sufficiently aligned address. - -Likewise in gdb.arch/i386-sse.exp. - -Tested on x86_64-linux, with both gcc and clang. - ---- - gdb/testsuite/gdb.arch/i386-avx.c | 9 +- - gdb/testsuite/gdb.arch/i386-sse.c | 10 ++- - gdb/testsuite/lib/precise-aligned-alloc.c | 131 ++++++++++++++++++++++++++++++ - 3 files changed, 148 insertions(+), 2 deletions(-) - -diff --git a/gdb/testsuite/gdb.arch/i386-avx.c b/gdb/testsuite/gdb.arch/i386-avx.c -index 4e938399a24..255ff5ee6f5 100644 ---- a/gdb/testsuite/gdb.arch/i386-avx.c -+++ b/gdb/testsuite/gdb.arch/i386-avx.c -@@ -25,7 +25,7 @@ typedef struct { - } v8sf_t; - - --v8sf_t data[] = -+v8sf_t data_orig[] = - { - { { 0.0, 0.125, 0.25, 0.375, 0.50, 0.625, 0.75, 0.875 } }, - { { 1.0, 1.125, 1.25, 1.375, 1.50, 1.625, 1.75, 1.875 } }, -@@ -47,10 +47,15 @@ v8sf_t data[] = - #endif - }; - -+#include "../lib/precise-aligned-alloc.c" - - int - main (int argc, char **argv) - { -+ void *allocated_ptr; -+ v8sf_t *data -+ = precise_aligned_dup (32, sizeof (data_orig), &allocated_ptr, data_orig); -+ - asm ("vmovaps 0(%0), %%ymm0\n\t" - "vmovaps 32(%0), %%ymm1\n\t" - "vmovaps 64(%0), %%ymm2\n\t" -@@ -107,5 +112,7 @@ main (int argc, char **argv) - - puts ("Bye!"); /* second breakpoint here */ - -+ free (allocated_ptr); -+ - return 0; - } -diff --git a/gdb/testsuite/gdb.arch/i386-sse.c b/gdb/testsuite/gdb.arch/i386-sse.c -index a5941a4071e..c78a510c1a7 100644 ---- a/gdb/testsuite/gdb.arch/i386-sse.c -+++ b/gdb/testsuite/gdb.arch/i386-sse.c -@@ -25,7 +25,7 @@ typedef struct { - } v4sf_t; - - --v4sf_t data[] = -+v4sf_t data_orig[] = - { - { { 0.0, 0.25, 0.50, 0.75 } }, - { { 1.0, 1.25, 1.50, 1.75 } }, -@@ -62,9 +62,15 @@ have_sse (void) - return 0; - } - -+#include "../lib/precise-aligned-alloc.c" -+ - int - main (int argc, char **argv) - { -+ void *allocated_ptr; -+ v4sf_t *data -+ = precise_aligned_dup (16, sizeof (data_orig), &allocated_ptr, data_orig); -+ - if (have_sse ()) - { - asm ("movaps 0(%0), %%xmm0\n\t" -@@ -124,5 +130,7 @@ main (int argc, char **argv) - puts ("Bye!"); /* second breakpoint here */ - } - -+ free (allocated_ptr); -+ - return 0; - } -diff --git a/gdb/testsuite/lib/precise-aligned-alloc.c b/gdb/testsuite/lib/precise-aligned-alloc.c -new file mode 100644 -index 00000000000..88a2e445b59 ---- /dev/null -+++ b/gdb/testsuite/lib/precise-aligned-alloc.c -@@ -0,0 +1,131 @@ -+/* This test file is part of GDB, the GNU debugger. -+ -+ Copyright 2021 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 . -+*/ -+ -+#include -+#include -+#include -+#include -+ -+/* Local version of C11's aligned_alloc, but with free_pointer PARAMETER since -+ possibly we cannot free the returned value. -+ We're not using aligned_alloc here, to allow pre-C11 usage. */ -+ -+static void * -+my_aligned_alloc (size_t alignment, size_t size, void **free_pointer) -+{ -+ void *p; -+ void *p_orig; -+ void *p_end; -+ size_t mask; -+ -+#if 0 -+ /* Use C11's aligned_alloc to do the allocation. */ -+ p = aligned_alloc (alignment, size); -+ assert (p != NULL); -+ p_orig = p; -+ p_end = p + size; -+#else -+ /* Allocate extra to ensure alignment. */ -+ size_t alloc_size = size + alignment; -+ -+ /* Use malloc to do the allocation. */ -+ p = malloc (alloc_size); -+ assert (p != NULL); -+ p_orig = p; -+ p_end = p + alloc_size; -+ -+ /* Align p. */ -+ mask = (alignment - 1); -+ if (((uintptr_t)p & mask) == 0) -+ ; -+ else -+ { -+ p = (void*)((uintptr_t)p & ~mask); -+ p += alignment; -+ } -+#endif -+ -+ /* Verify p is within bounds, and points to large enough area. */ -+ assert (p >= p_orig); -+ assert (p + size <= p_end); -+ -+ /* Verify required alignment. */ -+ mask = (alignment - 1); -+ assert (((uintptr_t)p & mask) == 0); -+ -+ if (free_pointer != NULL) -+ *free_pointer = p_orig; -+ -+ return p; -+} -+ -+/* Allocate SIZE memory with ALIGNMENT, and return it. If FREE_POINTER, -+ return in it the corresponding pointer to be passed to free. -+ -+ Do the alignment precisely, in other words, if an alignment of 4 is -+ requested, make sure the pointer is 4-byte aligned, but not 8-byte -+ aligned. In other words, make sure the pointer is not overaligned. -+ -+ The benefit of using precise alignment is that accidentally specifying -+ a too low alignment will not be compensated by accidental -+ overalignment. */ -+ -+static void * -+precise_aligned_alloc (size_t alignment, size_t size, void **free_pointer) -+{ -+ /* Allocate extra to compenate for "p += alignment". */ -+ size_t alloc_size = size + alignment; -+ /* Align extra, to be able to do precise align. */ -+ void *p = my_aligned_alloc (alignment * 2, alloc_size, free_pointer); -+ assert (p != NULL); -+ void *p_orig = p; -+ void *p_end = p + alloc_size; -+ -+ p += alignment; -+ -+ /* Verify p is without bounds, and points to large enough area. */ -+ assert (p >= p_orig); -+ assert (p + size <= p_end); -+ -+ /* Verify required alignment. */ -+ size_t mask = (alignment - 1); -+ assert (((uintptr_t)p & mask) == 0); -+ -+ /* Verify required alignment is precise. */ -+ mask = ((2 * alignment) - 1); -+ assert (((uintptr_t)p & mask) != 0); -+ -+ if (free_pointer != NULL) -+ *free_pointer = p_orig; -+ -+ return p; -+} -+ -+/* Duplicate data SRC of size SIZE to a newly allocated, precisely aligned -+ location with alignment ALIGNMENT. */ -+ -+static void * -+precise_aligned_dup (size_t alignment, size_t size, void **free_pointer, -+ void *src) -+{ -+ void *p = precise_aligned_alloc (alignment, size, free_pointer); -+ -+ memcpy (p, src, size); -+ -+ return p; -+} diff --git a/gdb-testsuite-fix-fail-in-gdb.base-annota1.exp.patch b/gdb-testsuite-fix-fail-in-gdb.base-annota1.exp.patch deleted file mode 100644 index bfe2e9b..0000000 --- a/gdb-testsuite-fix-fail-in-gdb.base-annota1.exp.patch +++ /dev/null @@ -1,48 +0,0 @@ -[gdb/testsuite] Fix FAIL in gdb.base/annota1.exp - -On openSUSE tumbleweed I run into: -... -FAIL: gdb.base/annota1.exp: run until main breakpoint (timeout) -... -due to a message related to libthread_db: -... -^Z^Zstarting^M -[Thread debugging using libthread_db enabled]^M -Using host libthread_db library "/lib64/libthread_db.so.1".^M -^M -^Z^Zframes-invalid^M -... -which is not matched by the regexp. - -Fix this by updating the regexp. - -Tested on x86_64-linux. - ---- - gdb/testsuite/gdb.base/annota1.exp | 6 +++++- - 1 file changed, 5 insertions(+), 1 deletion(-) - -diff --git a/gdb/testsuite/gdb.base/annota1.exp b/gdb/testsuite/gdb.base/annota1.exp -index 6e30c164ec9..046e942a321 100644 ---- a/gdb/testsuite/gdb.base/annota1.exp -+++ b/gdb/testsuite/gdb.base/annota1.exp -@@ -138,6 +138,10 @@ set warning_gdb_index_re \ - "to use the section anyway\\."] - set reading_re \ - "Reading \[^\r\n\]+" -+set libthread_db_re \ -+ [multi_line \ -+ "\\\[Thread debugging using libthread_db enabled\\\]" \ -+ "Using host libthread_db library \[^\r\n\]+"] - - set run_re \ - [list \ -@@ -145,7 +149,7 @@ set run_re \ - "\(\(\r\n$reading_re\)|\(\r\n$warning_slow_re\)\)*" \ - "\(\r\n$warning_gdb_index_re\)?" \ - "\(\(\r\n\r\n\032\032frames-invalid\)|\(\r\n\r\n\032\032breakpoints-invalid\)\)*\r\n\r\n" \ -- "\032\032starting\(\(\r\n$reading_re\)|\(\r\n$warning_slow_re\)\)*" \ -+ "\032\032starting\(\(\r\n$reading_re\)|\(\r\n$warning_slow_re\)|\r\n$libthread_db_re\)*" \ - "\(\(\r\n\r\n\032\032frames-invalid\)|\(\r\n\r\n\032\032breakpoints-invalid\)\)*\r\n\r\n" \ - "\032\032breakpoint 1\r\n\r\n" \ - "Breakpoint 1, \r\n" \ diff --git a/gdb-testsuite-fix-fail-in-gdb.tui-basic.exp.patch b/gdb-testsuite-fix-fail-in-gdb.tui-basic.exp.patch deleted file mode 100644 index 3cbfd13..0000000 --- a/gdb-testsuite-fix-fail-in-gdb.tui-basic.exp.patch +++ /dev/null @@ -1,175 +0,0 @@ -[gdb/testsuite] Fix FAIL in gdb.tui/basic.exp - -On openSUSE Leap 15.2 aarch64 I ran into: -... -FAIL: gdb.tui/basic.exp: check main is where we expect on the screen -... -while this is passing on x86_64. - -On x86_64-linux we have at the initial screen dump for "list -q main": -... - 0 +-/home/vries/gdb_versions/devel/src/gdb/testsuite/gdb.tui/tui-layout.c--+ - 1 | 15 You should have received a copy of the GNU General Public | - 2 | 16 along with this program. If not, see \ - and ends at 0x4004ab . -... -and on aarch64 instead: -... -$ gdb -q -batch outputs/gdb.tui/basic/basic -ex "info line main" -Line 21 of "tui-layout.c" starts at address 0x4005f4
\ - and ends at 0x4005f8 . -... - -Fix this by using a new source file main-one-line.c, that implements the -entire main function on a single line, in order to force the compiler to use -that line number. - -Also try to do less hard-coding in the test-case. - -Tested on x86_64-linux and aarch64-linux. - ---- - gdb/testsuite/gdb.tui/basic.exp | 46 ++++++++++++++++++++++++----------- - gdb/testsuite/gdb.tui/main-one-line.c | 18 ++++++++++++++ - 2 files changed, 50 insertions(+), 14 deletions(-) - -diff --git a/gdb/testsuite/gdb.tui/basic.exp b/gdb/testsuite/gdb.tui/basic.exp -index 25a11b2b285..afc770f0073 100644 ---- a/gdb/testsuite/gdb.tui/basic.exp -+++ b/gdb/testsuite/gdb.tui/basic.exp -@@ -17,7 +17,11 @@ - - tuiterm_env - --standard_testfile tui-layout.c -+# Use main-one-line.c to get the line info at a predictable location without -+# resorting to a dwarf assembly test-case. -+standard_testfile main-one-line.c -+ -+set main_line [gdb_get_line_number "int main"] - - if {[build_executable "failed to prepare" ${testfile} ${srcfile}] == -1} { - return -1 -@@ -34,7 +38,8 @@ gdb_assert {![string match "No Source Available" $text]} \ - "initial source listing" - - Term::command "list -q main" --Term::check_contents "list -q main" "21 *return 0" -+set main_re "int main \\(\\) { return 0; }" -+Term::check_contents "list -q main" "$main_line *$main_re" - - # Get the first source line. - set line [Term::get_line 1] -@@ -49,16 +54,28 @@ if {[Term::wait_for [string_to_regexp $line]] \ - fail "scroll up" - } - --# Check the horizontal scrolling. First confirm that 'main ()' is --# where we expect it to be. This relies on the current way we --# position source code on the screen, which might change in the --# future. The important part of this test is detecting the left/right --# scrolling, not which line main is actually on. --set line_num 6 --set line [Term::get_line $line_num] --gdb_assert {[regexp -- "19\[\\t \]+main \\(\\)" $line]} \ -+# Get the actual screen line that main is on. -+set main_screen_line -1 -+for { set i 1 } { $i <= $Term::_cols } { incr i } { -+ set line [Term::get_line $i] -+ if { [regexp -- "$main_line\[\\t \]+$main_re" $line] } { -+ set main_screen_line $i -+ break -+ } -+} -+ -+# Confirm that 'main ()' is where we expect it to be. This relies on the -+# current way we position source code on the screen, which might change in -+# the future. -+gdb_assert { $main_screen_line == 7 } \ - "check main is where we expect on the screen" --set regexp "19\[\\t \]+ain \\(\\)" -+if { $main_screen_line == -1 } { -+ return 0 -+} -+ -+# Check the horizontal scrolling. -+set shifted_main_re [string range $main_re 1 end] -+set regexp "$main_line\[\\t \]+$shifted_main_re" - # Send a right arrow. - send_gdb "\033\[C" - if {[Term::wait_for $regexp]} { -@@ -66,11 +83,11 @@ if {[Term::wait_for $regexp]} { - } else { - fail "scroll right" - } --set line [Term::get_line $line_num] -+set line [Term::get_line $main_screen_line] - # Send a down arrow. - send_gdb "\033\[B" - if {[Term::wait_for $regexp] \ -- && [Term::get_line [expr {$line_num - 1}]] == $line} { -+ && [Term::get_line [expr {$main_screen_line - 1}]] == $line} { - pass "scroll down" - } else { - fail "scroll down" -@@ -84,7 +101,8 @@ Term::check_contents "asm window shows main" "$hex
" - Term::check_box "asm box" 0 0 80 15 - - Term::command "layout split" --Term::check_contents "split layout contents" "21 *return 0.*$hex
" -+Term::check_contents "split layout contents" \ -+ "$main_line *$main_re.*$hex
" - - Term::check_box "source box in split layout" 0 0 80 7 - Term::check_box "asm box in split layout" 0 6 80 9 -diff --git a/gdb/testsuite/gdb.tui/main-one-line.c b/gdb/testsuite/gdb.tui/main-one-line.c -new file mode 100644 -index 00000000000..fb88c667637 ---- /dev/null -+++ b/gdb/testsuite/gdb.tui/main-one-line.c -@@ -0,0 +1,18 @@ -+/* This testcase is part of GDB, the GNU debugger. -+ -+ Copyright 2021 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 . */ -+ -+int main () { return 0; } diff --git a/gdb-testsuite-fix-fail-in-gdb.tui-corefile-run.exp.patch b/gdb-testsuite-fix-fail-in-gdb.tui-corefile-run.exp.patch deleted file mode 100644 index 3951dc9..0000000 --- a/gdb-testsuite-fix-fail-in-gdb.tui-corefile-run.exp.patch +++ /dev/null @@ -1,64 +0,0 @@ -[gdb/testsuite] Fix FAIL in gdb.tui/corefile-run.exp - -When running test-case gdb.tui/corefile-run.exp on openSUSE Tumbleweed, -I run into: -... -PASS: gdb.tui/corefile-run.exp: load corefile -FAIL: gdb.tui/corefile-run.exp: run until the end -... - -What's going on is easier to see when also doing dump_screen if -check_contents passes, and inspecting state at the preceding PASS: -... - +-------------------------------------------------------------------------+ - exec No process In: L?? PC: ?? - [New LWP 16629] - [Thread debugging using libthread_db enabled] - Using host libthread_db library "/lib64/libthread_db.so.1". - Core was generated by `/data/gdb_versions/devel/build/gdb/testsuite/output - s/gdb.tui/corefile-run/corefi'. - Program terminated with signal SIGTRAP, Trace/breakpoint trap. - #0 main () - --Type for more, q to quit, c to continue without paging-- -... - -The problem is that we're getting a pagination prompt, and the subsequent run -command is interpreted as an answer to that prompt. - -Fix this by: -- detecting the gdb prompt in response to "load corefile", such that - we detect the failure earlier, and -- doing a "set pagination off" in Term::clean_restart. - -Tested on x86_64-linux. - ---- - gdb/testsuite/gdb.tui/corefile-run.exp | 2 +- - gdb/testsuite/lib/tuiterm.exp | 1 + - 2 files changed, 2 insertions(+), 1 deletion(-) - -diff --git a/gdb/testsuite/gdb.tui/corefile-run.exp b/gdb/testsuite/gdb.tui/corefile-run.exp -index d53149fb648..b3da6d1e67c 100644 ---- a/gdb/testsuite/gdb.tui/corefile-run.exp -+++ b/gdb/testsuite/gdb.tui/corefile-run.exp -@@ -55,7 +55,7 @@ gdb_assert {![string match "No Source Available" $text]} \ - "initial source listing" - - Term::command "core-file $core" --Term::check_contents "load corefile" "21 *return 0" -+Term::check_contents "load corefile" "21 *return 0.*$gdb_prompt .*" - - Term::command "run" - Term::check_contents "run until the end" \ -diff --git a/gdb/testsuite/lib/tuiterm.exp b/gdb/testsuite/lib/tuiterm.exp -index 222583f291f..ad5cbb72ea5 100644 ---- a/gdb/testsuite/lib/tuiterm.exp -+++ b/gdb/testsuite/lib/tuiterm.exp -@@ -595,6 +595,7 @@ namespace eval Term { - } else { - ::clean_restart $executable - } -+ ::gdb_test_no_output "set pagination off" - } - } - diff --git a/gdb-testsuite-fix-gdb.ada-big_packed_array.exp-xfail-for-m32.patch b/gdb-testsuite-fix-gdb.ada-big_packed_array.exp-xfail-for-m32.patch deleted file mode 100644 index 722b04e..0000000 --- a/gdb-testsuite-fix-gdb.ada-big_packed_array.exp-xfail-for-m32.patch +++ /dev/null @@ -1,53 +0,0 @@ -[gdb/testsuite] Fix gdb.ada/big_packed_array.exp xfail for -m32 - -With test-case gdb.ada/big_packed_array.exp and target board unix/-m32 I run -into: -... -(gdb) print bad^M -$2 = (0 => 0 , 160)^M -(gdb) FAIL: gdb.ada/big_packed_array.exp: scenario=minimal: print bad -... - -The problem is that while the variable is an array of 196 bits (== 24.5 bytes), -the debug information describes it as 25 unsigned char. This is PR -gcc/101643, and the test-case contains an xfail for this, which catches only: -... -(gdb) print bad^M -$2 = (0 => 0 )^M -... - -Fix this by updating the xfail pattern. - -Tested on x86_64-linux. - ---- - gdb/testsuite/gdb.ada/big_packed_array.exp | 10 ++++++++++ - 1 file changed, 10 insertions(+) - -diff --git a/gdb/testsuite/gdb.ada/big_packed_array.exp b/gdb/testsuite/gdb.ada/big_packed_array.exp -index 32ff0dd3e1c..e62f053166b 100644 ---- a/gdb/testsuite/gdb.ada/big_packed_array.exp -+++ b/gdb/testsuite/gdb.ada/big_packed_array.exp -@@ -43,6 +43,7 @@ foreach_with_prefix scenario {all minimal} { - - set re "= \\(false \\)" - set re_xfail "= \\(0 => 0 \\)" -+ set re_xfail2 "= \\(0 => 0 , ($decimal)\\)" - gdb_test_multiple "print bad" "" { - -re -wrap $re { - pass $gdb_test_name -@@ -54,5 +55,14 @@ foreach_with_prefix scenario {all minimal} { - } - fail $gdb_test_name - } -+ -re -wrap $re_xfail2 { -+ set last $expect_out(1,string) -+ if { $have_xfail && [string is integer $last] \ -+ && [expr ($last & 0xf) == 0] } { -+ # gcc/101643 -+ setup_xfail *-*-* -+ } -+ fail $gdb_test_name -+ } - } - } diff --git a/gdb-testsuite-fix-gdb.ada-literals.exp-with-aarch64.patch b/gdb-testsuite-fix-gdb.ada-literals.exp-with-aarch64.patch new file mode 100644 index 0000000..a023ae3 --- /dev/null +++ b/gdb-testsuite-fix-gdb.ada-literals.exp-with-aarch64.patch @@ -0,0 +1,77 @@ +[gdb/testsuite] Fix gdb.ada/literals.exp with aarch64 + +On aarch64-linux, I run into: +... +(gdb) print 16#ffffffffffffffff#^M +$7 = 18446744073709551615^M +(gdb) FAIL: gdb.ada/literals.exp: print 16#ffffffffffffffff# +... +while on x86_64-linux instead, I get: +... +(gdb) print 16#ffffffffffffffff#^M +$7 = -1^M +(gdb) PASS: gdb.ada/literals.exp: print 16#ffffffffffffffff# +... + +We can easily reproduce this on x86_64-linux using: +... +$ gdb -q -batch -ex "set lang ada" -ex "set arch i386" \ + -ex "print 16#ffffffffffffffff#" +$1 = -1 +$ gdb -q -batch -ex "set lang ada" -ex "set arch aarch64" \ + -ex "print 16#ffffffffffffffff#" +$1 = 18446744073709551615 +... + +With i386, we have: +... +(gdb) p int_bits +$3 = 32 +(gdb) p long_bits +$4 = 32 +(gdb) p long_long_bits +$5 = 64 +... +and so in processInt we hit the fits-in-unsigned-long-long case where we use +as type long long: +... + /* Note: Interprets ULLONG_MAX as -1. */ + yylval.typed_val.type = type_long_long (par_state); +... + +With aarch64, we have instead: +... +(gdb) p int_bits +$1 = 32 +(gdb) p long_bits +$2 = 64 +(gdb) p long_long_bits +$3 = 64 +... +and so in processInt we hit the fits-in-unsigned-long case where we use +as type unsigned long: +... + yylval.typed_val.type + = builtin_type (par_state->gdbarch ())->builtin_unsigned_long; +... + +Fix this by updating the test-case to accept 18446744073709551615 as well. + +Tested on x86_64-linux and aarch64-linux. + +Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29416 + +--- + gdb/testsuite/gdb.ada/literals.exp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/gdb/testsuite/gdb.ada/literals.exp b/gdb/testsuite/gdb.ada/literals.exp +index a6ac89b540f..744a6bc573c 100644 +--- a/gdb/testsuite/gdb.ada/literals.exp ++++ b/gdb/testsuite/gdb.ada/literals.exp +@@ -36,4 +36,4 @@ gdb_test "print 16#f#e1" " = 240" + gdb_test "print 16#1#e10" " = 1099511627776" + + gdb_test "print/x 16#7fffffffffffffff#" " = 0x7fffffffffffffff" +-gdb_test "print 16#ffffffffffffffff#" " = -1" ++gdb_test "print 16#ffffffffffffffff#" " = (-1|18446744073709551615)" diff --git a/gdb-testsuite-fix-gdb.arch-i386-pkru.exp-on-linux.patch b/gdb-testsuite-fix-gdb.arch-i386-pkru.exp-on-linux.patch deleted file mode 100644 index f234761..0000000 --- a/gdb-testsuite-fix-gdb.arch-i386-pkru.exp-on-linux.patch +++ /dev/null @@ -1,57 +0,0 @@ -[gdb/testsuite] Fix gdb.arch/i386-pkru.exp on linux - -When running test-case gdb.arch/i386-pkru.exp on a machine with "Memory -Protection Keys for Userspace" support, we run into: -... -(gdb) PASS: gdb.arch/i386-pkru.exp: probe PKRU support -print $pkru^M -$2 = 1431655764^M -(gdb) FAIL: gdb.arch/i386-pkru.exp: pkru register -... - -The test-case expects the $pkru register to have the default value 0, matching -the "init state" of 0 defined by the XSAVE hardware. - -Since linux kernel version v4.9 containing commit acd547b29880 ("x86/pkeys: -Default to a restrictive init PKRU"), the register is set to 0x55555554 by -default (which matches the printed decimal value above). - -Fix the FAIL by accepting this value for linux. - -Tested on x86_64-linux. - ---- - gdb/testsuite/gdb.arch/i386-pkru.exp | 13 ++++++++++--- - 1 file changed, 10 insertions(+), 3 deletions(-) - -diff --git a/gdb/testsuite/gdb.arch/i386-pkru.exp b/gdb/testsuite/gdb.arch/i386-pkru.exp -index 5732bba6e97..2ee8ee72fa3 100644 ---- a/gdb/testsuite/gdb.arch/i386-pkru.exp -+++ b/gdb/testsuite/gdb.arch/i386-pkru.exp -@@ -20,6 +20,15 @@ if { ![istarget i?86-*-*] && ![istarget x86_64-*-* ] } { - return - } - -+set default_pkru_re 0x0 -+if { [istarget *-*-linux*] } { -+ # Starting with v4.9, the linux kernel contains commit acd547b29880 -+ # ("x86/pkeys: Default to a restrictive init PKRU"), which sets the -+ # pkru register to 0x55555554 by default. -+ set default_pkru_re (0x0|0x55555554) -+} -+ -+ - set comp_flags "-I${srcdir}/../nat/" - - if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \ -@@ -51,9 +60,7 @@ if { !$supports_pkru } { - } - - # Test pkru register at startup --# set test_string "0" -- --gdb_test "print \$pkru" "= 0" "pkru register" -+gdb_test "print /x \$pkru" "= $default_pkru_re" "pkru register" - - # Read values from pseudo registers. - gdb_breakpoint [ gdb_get_line_number "break here 1" ] diff --git a/gdb-testsuite-fix-gdb.base-annota1.exp-with-pie.patch b/gdb-testsuite-fix-gdb.base-annota1.exp-with-pie.patch deleted file mode 100644 index 8824aee..0000000 --- a/gdb-testsuite-fix-gdb.base-annota1.exp-with-pie.patch +++ /dev/null @@ -1,43 +0,0 @@ -[gdb/testsuite] Fix gdb.base/annota1.exp with pie - -Since commit 359efc2d894 ("[gdb/testsuite] Make gdb.base/annota1.exp more -robust") we see this fail with target board unix/-fPIE/-pie: -... -FAIL: gdb.base/annota1.exp: run until main breakpoint (timeout) -... - -The problem is that the commit makes the number and order of matched -annotations fixed, while between target boards unix and unix/-fPIE/-pie there -is a difference: -... - \032\032post-prompt - Starting program: outputs/gdb.base/annota1/annota1 - -+\032\032breakpoints-invalid -+ - \032\032starting - - \032\032frames-invalid -... - -Fix this by optionally matching the additional annotation. - -Tested on x86_64-linux. - ---- - gdb/testsuite/gdb.base/annota1.exp | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/gdb/testsuite/gdb.base/annota1.exp b/gdb/testsuite/gdb.base/annota1.exp -index 019c8048fd0..b9f80cbb6ed 100644 ---- a/gdb/testsuite/gdb.base/annota1.exp -+++ b/gdb/testsuite/gdb.base/annota1.exp -@@ -159,6 +159,8 @@ set run_re \ - "\r\n\032\032post-prompt\r\n" \ - "Starting program: $binexp \r\n" \ - $optional_re \ -+ "\(\r\n\032\032breakpoints-invalid\r\n\)?" \ -+ $optional_re \ - "\r\n\032\032starting\r\n" \ - $optional_re \ - "\r\n\032\032frames-invalid\r\n" \ diff --git a/gdb-testsuite-fix-gdb.base-catch-syscall.exp-with-with-expat-no.patch b/gdb-testsuite-fix-gdb.base-catch-syscall.exp-with-with-expat-no.patch new file mode 100644 index 0000000..e7d8b0a --- /dev/null +++ b/gdb-testsuite-fix-gdb.base-catch-syscall.exp-with-with-expat-no.patch @@ -0,0 +1,88 @@ +[gdb/testsuite] Fix gdb.base/catch-syscall.exp with --with-expat=no + +When doing a gdb build with --with-expat=no, I run into: +... +(gdb) PASS: gdb.base/catch-syscall.exp: determine pipe syscall: \ + continue to breakpoint: before pipe call +catch syscall pipe^M +Unknown syscall name 'pipe'.^M +(gdb) PASS: gdb.base/catch-syscall.exp: determine pipe syscall: \ + catch syscall pipe +catch syscall pipe2^M +Unknown syscall name 'pipe2'.^M +(gdb) PASS: gdb.base/catch-syscall.exp: determine pipe syscall: \ + catch syscall pipe2 +continue^M +Continuing.^M +[Detaching after vfork from child process 18538]^M +[Inferior 1 (process 18537) exited normally]^M +(gdb) FAIL: gdb.base/catch-syscall.exp: determine pipe syscall: continue +... + +This is a regression since recent commit 5463a15c18b ("[gdb/testsuite] Handle +pipe2 syscall in gdb.base/catch-syscall.exp"). + +Fix this by using pipe/pipe2 syscall numbers instead. + +Tested on x86_64-linux. + +--- + gdb/testsuite/gdb.base/catch-syscall.exp | 16 ++++++++++------ + 1 file changed, 10 insertions(+), 6 deletions(-) + +diff --git a/gdb/testsuite/gdb.base/catch-syscall.exp b/gdb/testsuite/gdb.base/catch-syscall.exp +index 1260a64270f..d8b6898b3e0 100644 +--- a/gdb/testsuite/gdb.base/catch-syscall.exp ++++ b/gdb/testsuite/gdb.base/catch-syscall.exp +@@ -705,10 +705,12 @@ proc setup_all_syscalls {} { + # SYS_pipe doesn't exist on aarch64 kernel. + set test "check SYS_pipe" + set have_SYS_pipe 0 ++ set SYS_pipe -1 + gdb_test_multiple "p pipe_syscall" $test { +- -re -wrap " = $decimal" { ++ -re -wrap " = ($decimal)" { + pass $test + set have_SYS_pipe 1 ++ set SYS_pipe $expect_out(1,string) + } + -re -wrap "No symbol .*" { + pass $test +@@ -717,10 +719,12 @@ proc setup_all_syscalls {} { + + set test "check SYS_pipe2" + set have_SYS_pipe2 0 ++ set SYS_pipe2 -1 + gdb_test_multiple "p pipe2_syscall" $test { +- -re -wrap " = $decimal" { ++ -re -wrap " = ($decimal)" { + pass $test + set have_SYS_pipe2 1 ++ set SYS_pipe2 $expect_out(1,string) + } + -re -wrap "No symbol .*" { + pass $test +@@ -736,19 +740,19 @@ proc setup_all_syscalls {} { + gdb_test "break $line" + gdb_continue_to_breakpoint "before pipe call" + if { $have_SYS_pipe } { +- gdb_test "catch syscall pipe" ++ gdb_test "catch syscall $SYS_pipe" + } + if { $have_SYS_pipe2 } { +- gdb_test "catch syscall pipe2" ++ gdb_test "catch syscall $SYS_pipe2" + } + set ok 0 + gdb_test_multiple "continue" "" { +- -re -wrap "Catchpoint $decimal \\(call to syscall pipe\\).*" { ++ -re -wrap "Catchpoint $decimal \\(call to syscall (pipe|$SYS_pipe)\\).*" { + lappend all_syscalls pipe + pass $gdb_test_name + set ok 1 + } +- -re -wrap "Catchpoint $decimal \\(call to syscall pipe2\\).*" { ++ -re -wrap "Catchpoint $decimal \\(call to syscall (pipe2|$SYS_pipe)\\).*" { + lappend all_syscalls pipe2 + pass $gdb_test_name + set ok 1 diff --git a/gdb-testsuite-fix-gdb.base-catch-syscall.exp-without-enable-targets.patch b/gdb-testsuite-fix-gdb.base-catch-syscall.exp-without-enable-targets.patch new file mode 100644 index 0000000..ea8b7f9 --- /dev/null +++ b/gdb-testsuite-fix-gdb.base-catch-syscall.exp-without-enable-targets.patch @@ -0,0 +1,65 @@ +[gdb/testsuite] Fix gdb.base/catch-syscall.exp without --enable-targets + +When doing a gdb build without --enable-targets, I run into: +... +(gdb) UNSUPPORTED: gdb.base/catch-syscall.exp: multiple targets: \ + s390:31-bit vs s390:64-bit: set architecture s390:64-bit +delete breakpoints^M +(gdb) info breakpoints^M +No breakpoints or watchpoints.^M +(gdb) break -qualified main^M +No symbol table is loaded. Use the "file" command.^M +Make breakpoint pending on future shared library load? (y or [n]) n^M +(gdb) FAIL: gdb.base/catch-syscall.exp: gdb_breakpoint: set breakpoint at main +... + +The problem is that due to recent commit e21d8399303 ("[gdb/testsuite] Remove +target limits in gdb.base/catch-syscall.exp") "clean_restart $binfile" no +longer is called at the end of test_catch_syscall_multi_arch. + +Fix this by moving "clean_restart $binfile" back to +test_catch_syscall_multi_arch. + +Tested on x86_64-linux. + +--- + gdb/testsuite/gdb.base/catch-syscall.exp | 8 +++++--- + 1 file changed, 5 insertions(+), 3 deletions(-) + +diff --git a/gdb/testsuite/gdb.base/catch-syscall.exp b/gdb/testsuite/gdb.base/catch-syscall.exp +index fed0e7b774c..1260a64270f 100644 +--- a/gdb/testsuite/gdb.base/catch-syscall.exp ++++ b/gdb/testsuite/gdb.base/catch-syscall.exp +@@ -568,7 +568,7 @@ proc test_catch_syscall_with_wrong_args_noxml {} { + proc test_catch_syscall_multi_arch_1 { + arch1 arch2 syscall1_name syscall2_name syscall_number + } { +- global decimal binfile ++ global decimal + + with_test_prefix "multiple targets: $arch1 vs $arch2" { + # We are not interested in loading any binary here, and in +@@ -605,12 +605,12 @@ proc test_catch_syscall_multi_arch_1 { + gdb_test "catch syscall $syscall_number" \ + "Catchpoint $decimal \\(syscall .${syscall2_name}. \\\[${syscall_number}\\\]\\)" \ + "insert catch syscall on syscall $syscall_number -- $syscall2_name on $arch2" +- +- clean_restart $binfile + } + } + + proc test_catch_syscall_multi_arch {} { ++ global binfile ++ + set arch1 "i386" + set arch2 "i386:x86-64" + set syscall1_name "exit" +@@ -650,6 +650,8 @@ proc test_catch_syscall_multi_arch {} { + set syscall_number 142 + test_catch_syscall_multi_arch_1 $arch1 $arch2 $syscall1_name \ + $syscall2_name $syscall_number ++ ++ clean_restart $binfile + } + + proc do_syscall_tests_without_xml {} { diff --git a/gdb-testsuite-fix-gdb.base-dcache-flush.exp.patch b/gdb-testsuite-fix-gdb.base-dcache-flush.exp.patch deleted file mode 100644 index 777588a..0000000 --- a/gdb-testsuite-fix-gdb.base-dcache-flush.exp.patch +++ /dev/null @@ -1,48 +0,0 @@ -[gdb/testsuite] Fix gdb.base/dcache-flush.exp - -When running test-case gdb.base/dcache-flush.exp on ubuntu 18.04.5, I run into: -... -(gdb) PASS: gdb.base/dcache-flush.exp: p var2 -info dcache^M -Dcache 4096 lines of 64 bytes each.^M -Contains data for Thread 0x7ffff7fc6b80 (LWP 3551)^M -Line 0: address 0x7fffffffd4c0 [47 hits]^M -Line 1: address 0x7fffffffd500 [31 hits]^M -Line 2: address 0x7fffffffd5c0 [7 hits]^M -Cache state: 3 active lines, 85 hits^M -(gdb) FAIL: gdb.base/dcache-flush.exp: check dcache before flushing -... -The regexp expects "Contains data for process $decimal". - -This is another case of thread_db_target::pid_to_str being used. - -Fix this by updating the regexp. - -Tested on x86_64-linux. - ---- - gdb/testsuite/gdb.base/dcache-flush.exp | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/gdb/testsuite/gdb.base/dcache-flush.exp b/gdb/testsuite/gdb.base/dcache-flush.exp -index 4ac10b9fab1..ff59b2bb7ae 100644 ---- a/gdb/testsuite/gdb.base/dcache-flush.exp -+++ b/gdb/testsuite/gdb.base/dcache-flush.exp -@@ -34,7 +34,7 @@ gdb_test "p var2" " = 3" - gdb_test "info dcache" \ - [multi_line \ - "Dcache $decimal lines of $decimal bytes each." \ -- "Contains data for process $decimal" \ -+ "Contains data for (process $decimal|Thread \[^\r\n\]*)" \ - "Line 0: address $hex \[$decimal hits\].*" \ - "Cache state: $decimal active lines, $decimal hits" ] \ - "check dcache before flushing" -@@ -58,7 +58,7 @@ with_test_prefix "refilling" { - gdb_test "info dcache" \ - [multi_line \ - "Dcache $decimal lines of $decimal bytes each." \ -- "Contains data for process $decimal" \ -+ "Contains data for (process $decimal|Thread \[^\r\n\]*)" \ - "Line 0: address $hex \[$decimal hits\].*" \ - "Cache state: $decimal active lines, $decimal hits" ] \ - "check dcache before refilling" diff --git a/gdb-testsuite-fix-gdb.dwarf2-dw2-out-of-range-end-of-seq.exp-on-aarch64.patch b/gdb-testsuite-fix-gdb.dwarf2-dw2-out-of-range-end-of-seq.exp-on-aarch64.patch new file mode 100644 index 0000000..b227074 --- /dev/null +++ b/gdb-testsuite-fix-gdb.dwarf2-dw2-out-of-range-end-of-seq.exp-on-aarch64.patch @@ -0,0 +1,82 @@ +[gdb/testsuite] Fix gdb.dwarf2/dw2-out-of-range-end-of-seq.exp on aarch64 + +On aarch64-linux, with test-case gdb.dwarf2/dw2-out-of-range-end-of-seq.exp I +run into: +... +(gdb) run ^M +Starting program: dw2-out-of-range-end-of-seq ^M +^M +Program received signal SIGILL, Illegal instruction.^M +main () at src/gdb/testsuite/gdb.dwarf2/main.c:1^M +1 /* This testcase is part of GDB, the GNU debugger.^M +(gdb) FAIL: gdb.dwarf2/dw2-out-of-range-end-of-seq.exp: runto: run to main +... + +There are two problems here: +- the test-case contains a hardcoded "DW_LNS_advance_pc 1" which causes the + breakpoint pointing in the middle of an insn +- the FAIL triggers on aarch64-linux, but not on x86_64-linux, because the + test-case uses 'main_label' as the address of the first and only valid entry + in the line table, and: + - on aarch64-linux, there's no prologue, so main_label and main coincide, + while + - on x86_64-linux, there's a prologue, so main_label is different from main. + +Fix these problems by: +- eliminating the use of "DW_LNS_advance_pc 1", and using + "DW_LNE_set_address $main_end" instead, and +- eliminating the use of main_label, using "DW_LNE_set_address $main_start" + instead. + +Tested on both x86_64-linux and aarch64-linux. + +--- + gdb/testsuite/gdb.dwarf2/dw2-out-of-range-end-of-seq.exp | 14 +++++++++++--- + 1 file changed, 11 insertions(+), 3 deletions(-) + +diff --git a/gdb/testsuite/gdb.dwarf2/dw2-out-of-range-end-of-seq.exp b/gdb/testsuite/gdb.dwarf2/dw2-out-of-range-end-of-seq.exp +index f60f622067e..749755fc771 100644 +--- a/gdb/testsuite/gdb.dwarf2/dw2-out-of-range-end-of-seq.exp ++++ b/gdb/testsuite/gdb.dwarf2/dw2-out-of-range-end-of-seq.exp +@@ -35,10 +35,16 @@ if !$gcc_compiled { + + standard_testfile main.c -dw.S + ++set func_info_vars [get_func_info main] ++ + set asm_file [standard_output_file $srcfile2] + Dwarf::assemble $asm_file { + declare_labels Llines + global srcdir subdir srcfile ++ global func_info_vars ++ foreach var $func_info_vars { ++ global $var ++ } + + cu {} { + compile_unit { +@@ -48,7 +54,9 @@ Dwarf::assemble $asm_file { + } { + subprogram { + {external 1 flag} +- {MACRO_AT_func {main}} ++ {name main} ++ {low_pc $main_start} ++ {high_pc $main_end addr} + } + } + } +@@ -58,11 +66,11 @@ Dwarf::assemble $asm_file { + file_name "$srcfile" 1 + + program { +- {DW_LNE_set_address main_label} ++ {DW_LNE_set_address $main_start} + {line 1} + {DW_LNS_copy} + +- {DW_LNS_advance_pc 1} ++ {DW_LNE_set_address $main_end} + {DW_LNE_end_sequence} + + {DW_LNE_set_address 0} diff --git a/gdb-testsuite-fix-gdb.gdb-selftest.exp.patch b/gdb-testsuite-fix-gdb.gdb-selftest.exp.patch deleted file mode 100644 index 2ef35ea..0000000 --- a/gdb-testsuite-fix-gdb.gdb-selftest.exp.patch +++ /dev/null @@ -1,44 +0,0 @@ -[gdb/testsuite] Fix gdb.gdb/selftest.exp - -With a gdb build with CFLAGS "-O2 -g -flto=auto", I run into: -... - #7 gdb_main (args=0x7fffffffd220) at src/gdb/main.c:1368^M - #8 main (argc=, argv=) at src/gdb/gdb.c:32^M - (gdb) FAIL: gdb.gdb/selftest.exp: backtrace through signal handler -... -which means that this regexp in proc test_with_self fails: -... - -re "#0.*(read|poll).*in main \\(.*\\) at .*gdb\\.c.*$gdb_prompt $" { -... - -The problem is that gdb_main has been inlined into main, and consequently the -backtrace uses: -... - #x ... -... -instead of -... - #x
in ... -... - -Fix this by updating the regexp to not require "in" before " main". - -Tested on x86_64-linux. - ---- - gdb/testsuite/gdb.gdb/selftest.exp | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/gdb/testsuite/gdb.gdb/selftest.exp b/gdb/testsuite/gdb.gdb/selftest.exp -index bee3010bca1..35b06e53e90 100644 ---- a/gdb/testsuite/gdb.gdb/selftest.exp -+++ b/gdb/testsuite/gdb.gdb/selftest.exp -@@ -143,7 +143,7 @@ proc test_with_self { } { - setup_xfail "i*86-pc-linuxaout-gnu" - set description "backtrace through signal handler" - gdb_test_multiple "backtrace" "$description" { -- -re "#0.*(read|poll).*in main \\(.*\\) at .*gdb\\.c.*$gdb_prompt $" { -+ -re "#0.*(read|poll).* main \\(.*\\) at .*gdb\\.c.*$gdb_prompt $" { - pass "$description" - } - } diff --git a/gdb-testsuite-fix-gdb.guile-scm-type.exp-with-gcc-4.8.patch b/gdb-testsuite-fix-gdb.guile-scm-type.exp-with-gcc-4.8.patch deleted file mode 100644 index 7c13454..0000000 --- a/gdb-testsuite-fix-gdb.guile-scm-type.exp-with-gcc-4.8.patch +++ /dev/null @@ -1,71 +0,0 @@ -[gdb/testsuite] Fix gdb.guile/scm-type.exp with gcc 4.8 - -With gcc 7.5.0, I get: -... -(gdb) guile (print (type-range (field-type (type-field (value-type \ - (value-dereference f)) "items"))))^M -= (0 0)^M -(gdb) PASS: gdb.guile/scm-type.exp: lang_cpp: test_range: \ - on flexible array member: $cmd -... -but with gcc 4.8.5, I get instead: -... -(gdb) guile (print (type-range (field-type (type-field (value-type \ - (value-dereference f)) "items"))))^M -= (0 -1)^M -(gdb) FAIL: gdb.guile/scm-type.exp: lang_cpp: test_range: \ - on flexible array member: $cmd -... - -There's a difference in debug info. With gcc 4.8.5, we have: -... - <2><224>: Abbrev Number: 15 (DW_TAG_member) - <225> DW_AT_name : items - <22b> DW_AT_type : <0x231> - <1><231>: Abbrev Number: 4 (DW_TAG_array_type) - <232> DW_AT_type : <0x105> - <2><23a>: Abbrev Number: 16 (DW_TAG_subrange_type) - <23b> DW_AT_type : <0x11a> - <23f> DW_AT_upper_bound : 0xffffffffffffffff -... -and with gcc 7.5.0, we have instead: -... - <2><89f>: Abbrev Number: 12 (DW_TAG_member) - <8a0> DW_AT_name : items - <8a6> DW_AT_type : <0x8ac> - <1><8ac>: Abbrev Number: 17 (DW_TAG_array_type) - <8ad> DW_AT_type : <0x29d> - <2><8b5>: Abbrev Number: 41 (DW_TAG_subrange_type) - <2><8b6>: Abbrev Number: 0 -... - -As mentioned in commit 858c8f2c1b9 "gdb/testsuite: adjust -gdb.python/flexible-array-member.exp expected pattern": -... -Ideally, GDB would present a consistent and documented value for an -array member declared with size 0, regardless of how the debug info -looks like. -... - -As in gdb.python/flexible-array-member.exp, change the test to accept the two -values. - -Tested on x86_64-linux. - ---- - gdb/testsuite/gdb.guile/scm-type.exp | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/gdb/testsuite/gdb.guile/scm-type.exp b/gdb/testsuite/gdb.guile/scm-type.exp -index ccde98ca224..e5eaab365cc 100644 ---- a/gdb/testsuite/gdb.guile/scm-type.exp -+++ b/gdb/testsuite/gdb.guile/scm-type.exp -@@ -267,7 +267,7 @@ proc test_range {} { - gdb_scm_test_silent_cmd "guile (define f (history-ref 0))" \ - "get value (f) from history" - gdb_test "guile (print (type-range (field-type (type-field (value-type (value-dereference f)) \"items\"))))" \ -- "= \\(0 0\\)" -+ "= \\(0 (0|-1)\\)" - gdb_test "guile (print (value-subscript (value-field (value-dereference f) \"items\") 0))" \ - "= 111" - gdb_test "guile (print (value-subscript (value-field (value-dereference f) \"items\") 1))" \ diff --git a/gdb-testsuite-fix-gdb.opt-clobbered-registers-o2.exp-with-gcc-12.patch b/gdb-testsuite-fix-gdb.opt-clobbered-registers-o2.exp-with-gcc-12.patch new file mode 100644 index 0000000..446ef0f --- /dev/null +++ b/gdb-testsuite-fix-gdb.opt-clobbered-registers-o2.exp-with-gcc-12.patch @@ -0,0 +1,52 @@ +[gdb/testsuite] Fix gdb.opt/clobbered-registers-O2.exp with gcc-12 + +When running test-case gdb.opt/clobbered-registers-O2.exp with gcc-12, I run +into: +... +(gdb) PASS: gdb.opt/clobbered-registers-O2.exp: backtracing +print operand0^M +$1 = (unsigned int *) 0x7fffffffd070^M +(gdb) print *operand0^M +$2 = 4195541^M +(gdb) FAIL: gdb.opt/clobbered-registers-O2.exp: print operand0 +... + +The problem is that starting gcc-12, the assignments to x and y in main are +optimized away: +... +int main(void) +{ + unsigned x, y; + + x = 13; + y = 14; + return (int)gen_movsd (&x, &y); +... + +Fix this by making x and y volatile. + +Note that the test-case intends to check the handling of debug info for +optimized code in function gen_movsd, so inhibiting optimization in main +doesn't interfere with that. + +Tested on x86_64-linux. + +Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29161 + +--- + gdb/testsuite/gdb.opt/clobbered-registers-O2.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/gdb/testsuite/gdb.opt/clobbered-registers-O2.c b/gdb/testsuite/gdb.opt/clobbered-registers-O2.c +index 7776024eb90..83cf2267d1e 100644 +--- a/gdb/testsuite/gdb.opt/clobbered-registers-O2.c ++++ b/gdb/testsuite/gdb.opt/clobbered-registers-O2.c +@@ -33,7 +33,7 @@ gen_movsd (unsigned * operand0, unsigned * operand1) + + int main(void) + { +- unsigned x, y; ++ volatile unsigned x, y; + + x = 13; + y = 14; diff --git a/gdb-testsuite-fix-gdb.python-py-events.exp.patch b/gdb-testsuite-fix-gdb.python-py-events.exp.patch deleted file mode 100644 index d8e0bf9..0000000 --- a/gdb-testsuite-fix-gdb.python-py-events.exp.patch +++ /dev/null @@ -1,50 +0,0 @@ -[gdb/testsuite] Fix gdb.python/py-events.exp - -With test-case gdb.python/py-events.exp on ubuntu 18.04.5 we run into: -... -(gdb) info threads^M - Id Target Id Frame ^M -* 1 Thread 0x7ffff7fc3740 (LWP 31467) "py-events" do_nothing () at \ - src/gdb/testsuite/gdb.python/py-events-shlib.c:19^M -(gdb) FAIL: gdb.python/py-events.exp: get current thread -... - -The info thread commands uses "Thread" instead of "process" because -libpthread is already loaded: -... -new objfile name: /lib/x86_64-linux-gnu/libdl.so.2^M -[Thread debugging using libthread_db enabled]^M -Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".^M -event type: new_objfile^M -new objfile name: /lib/x86_64-linux-gnu/libpthread.so.0^M -... -and consequently thread_db_target::pid_to_str is used. - -Fix this by parsing the "Thread" expression. - -Tested on x86_64-linux. - ---- - gdb/testsuite/gdb.python/py-events.exp | 8 ++++++-- - 1 file changed, 6 insertions(+), 2 deletions(-) - -diff --git a/gdb/testsuite/gdb.python/py-events.exp b/gdb/testsuite/gdb.python/py-events.exp -index 753709361f5..d6dc9fd4252 100644 ---- a/gdb/testsuite/gdb.python/py-events.exp -+++ b/gdb/testsuite/gdb.python/py-events.exp -@@ -82,9 +82,13 @@ delete_breakpoints - # Test inferior call events - - gdb_test_multiple "info threads" "get current thread" { -- -re "\[^\n\r\]*process (\[0-9\]+)\[^\n\r\]*do_nothing.*$gdb_prompt $" { -+ -re -wrap "process ($decimal)\[^\n\r\]*do_nothing.*" { - set process_id $expect_out(1,string) -- pass "get current thread" -+ pass $gdb_test_name -+ } -+ -re -wrap "Thread $hex \\(LWP ($decimal)\\)\[^\n\r\]*do_nothing.*" { -+ set process_id $expect_out(1,string) -+ pass $gdb_test_name - } - } - diff --git a/gdb-testsuite-fix-gdb.reverse-i387-env-reverse.exp-for-pie.patch b/gdb-testsuite-fix-gdb.reverse-i387-env-reverse.exp-for-pie.patch new file mode 100644 index 0000000..ddf448d --- /dev/null +++ b/gdb-testsuite-fix-gdb.reverse-i387-env-reverse.exp-for-pie.patch @@ -0,0 +1,34 @@ +[gdb/testsuite] Fix gdb.reverse/i387-env-reverse.exp for -pie + +When running test-case gdb.reverse/i387-env-reverse.exp for x86_64-linux with +target board unix/-m32/-fPIE/-pie, we run into: +... +(gdb) PASS: gdb.reverse/i387-env-reverse.exp: push st0 +info register eax^M +eax 0x56550000 1448411136^M +(gdb) FAIL: gdb.reverse/i387-env-reverse.exp: verify eax == 0x8040000 +... + +The problem is that the tested instruction (fstsw) only sets $ax, not $eax. + +Fix this by verifying $ax instead of $eax. + +Tested on x86_64-linux with target boards unix/-m32 and unix/-m32/-fPIE/-pie. + +--- + gdb/testsuite/gdb.reverse/i387-env-reverse.exp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/gdb/testsuite/gdb.reverse/i387-env-reverse.exp b/gdb/testsuite/gdb.reverse/i387-env-reverse.exp +index a0a79c22ed0..53fee0986df 100644 +--- a/gdb/testsuite/gdb.reverse/i387-env-reverse.exp ++++ b/gdb/testsuite/gdb.reverse/i387-env-reverse.exp +@@ -64,7 +64,7 @@ with_test_prefix "forward" { + gdb_test "n" "asm.*fstsw.*" "store status word in EAX" + gdb_test "n" "asm.*fld1.*" "push st0" + +- gdb_test "info register eax" "eax *0x8040000.*\[ \t\]+.*" "verify eax == 0x8040000" ++ gdb_test "info register ax" "ax *0x0.*\[ \t\]+.*" "verify eax == 0x0" + gdb_test "info register fstat" "fstat *0.*\[ \t\]+.*" "verify fstat == 0" + gdb_test "info register ftag" "ftag *0xffff.*\[ \t\]+.*" "verify ftag == 0xffff" + diff --git a/gdb-testsuite-fix-gdb.reverse-test_ioctl_tcsetsw.exp-with-libc-debuginfo.patch b/gdb-testsuite-fix-gdb.reverse-test_ioctl_tcsetsw.exp-with-libc-debuginfo.patch new file mode 100644 index 0000000..71aaa3c --- /dev/null +++ b/gdb-testsuite-fix-gdb.reverse-test_ioctl_tcsetsw.exp-with-libc-debuginfo.patch @@ -0,0 +1,37 @@ +[gdb/testsuite] Fix gdb.reverse/test_ioctl_TCSETSW.exp with libc debuginfo + +When running test-case gdb.reverse/test_ioctl_TCSETSW.exp with glibc debuginfo +installed, I run into: +... +(gdb) PASS: gdb.reverse/test_ioctl_TCSETSW.exp: at TCSETSW call +step^M +__tcsetattr (fd=0, optional_actions=1, termios_p=0x7fffffffcf50) at \ + ../sysdeps/unix/sysv/linux/tcsetattr.c:45^M +45 {^M +(gdb) FAIL: gdb.reverse/test_ioctl_TCSETSW.exp: handle TCSETSW +... + +The problem is that the step is expected to step over the call to tcsetattr, +but due to glibc debuginfo being installed, we step into the call. + +Fix this by using next instead of step. + +Tested on x86_64-linux. + +--- + gdb/testsuite/gdb.reverse/test_ioctl_TCSETSW.exp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/gdb/testsuite/gdb.reverse/test_ioctl_TCSETSW.exp b/gdb/testsuite/gdb.reverse/test_ioctl_TCSETSW.exp +index 86a62ebe5e5..4a81a618efc 100644 +--- a/gdb/testsuite/gdb.reverse/test_ioctl_TCSETSW.exp ++++ b/gdb/testsuite/gdb.reverse/test_ioctl_TCSETSW.exp +@@ -35,7 +35,7 @@ gdb_test "break $stop" ".*Breakpoint .*" "stop at TCSETSW" + gdb_test "continue" ".*Breakpoint .*" "at TCSETSW call" + + set test "handle TCSETSW" +-gdb_test_multiple "step" $test { ++gdb_test_multiple "next" $test { + -re "Process record and replay target doesn't support ioctl request 0x.*$gdb_prompt $" { + fail $test + } diff --git a/gdb-testsuite-fix-gdb.server-server-kill.exp-with-m32.patch b/gdb-testsuite-fix-gdb.server-server-kill.exp-with-m32.patch deleted file mode 100644 index 7bf3c7b..0000000 --- a/gdb-testsuite-fix-gdb.server-server-kill.exp-with-m32.patch +++ /dev/null @@ -1,51 +0,0 @@ -[gdb/testsuite] Fix gdb.server/server-kill.exp with -m32 - -When running test-case gdb.server/server-kill.exp with target board unix/-m32, -I run into: -... -0xf7fd6b20 in _start () from /lib/ld-linux.so.2^M -(gdb) Executing on target: kill -9 13082 (timeout = 300) -builtin_spawn -ignore SIGHUP kill -9 13082^M -bt^M -(gdb) FAIL: gdb.server/server-kill.exp: kill_pid_of=server: test_unwind_syms: bt -... - -The test-case expects the backtrace command to trigger remote communication, -which then should result in a "Remote connection closed" or similar. - -However, no remote communication is triggered, because we hit the "Check that -this frame is unwindable" case in get_prev_frame_always_1. - -We don't hit this problem in the kill_pid_of=inferior case, because there we -run to main before doing the backtrace. - -Fix this by doing the same in the kill_pid_of=server case. - -Tested on x86_64-linux. - ---- - gdb/testsuite/gdb.server/server-kill.exp | 10 ++++++---- - 1 file changed, 6 insertions(+), 4 deletions(-) - -diff --git a/gdb/testsuite/gdb.server/server-kill.exp b/gdb/testsuite/gdb.server/server-kill.exp -index 655821cc6f9..4125e5bf92d 100644 ---- a/gdb/testsuite/gdb.server/server-kill.exp -+++ b/gdb/testsuite/gdb.server/server-kill.exp -@@ -69,11 +69,13 @@ proc prepare {} { - - gdbserver_run "" - -- if { $::kill_pid_of == "inferior" } { -- # Continue past server_pid assignment. -- gdb_breakpoint ${srcfile}:[gdb_get_line_number "i = 0;"] -- gdb_continue_to_breakpoint "after server_pid assignment" -+ # Continue past server_pid assignment. We do this for both scenarios, -+ # to avoid doing a backtrace from _start, which may not trigger remote -+ # communication. -+ gdb_breakpoint ${srcfile}:[gdb_get_line_number "i = 0;"] -+ gdb_continue_to_breakpoint "after server_pid assignment" - -+ if { $::kill_pid_of == "inferior" } { - # Get the pid of GDBServer. - set test "p server_pid" - set server_pid 0 diff --git a/gdb-testsuite-fix-gdb.threads-check-libthread-db.exp-with-glibc-2.34.patch b/gdb-testsuite-fix-gdb.threads-check-libthread-db.exp-with-glibc-2.34.patch deleted file mode 100644 index c763826..0000000 --- a/gdb-testsuite-fix-gdb.threads-check-libthread-db.exp-with-glibc-2.34.patch +++ /dev/null @@ -1,49 +0,0 @@ -[gdb/testsuite] Fix gdb.threads/check-libthread-db.exp with glibc 2.34 - -When running test-case gdb.threads/check-libthread-db.exp on openSUSE -Tumbleweed (with glibc 2.34) I get: -... -(gdb) continue^M -Continuing.^M -[Thread debugging using libthread_db enabled]^M -Using host libthread_db library "/lib64/libthread_db.so.1".^M -Stopped due to shared library event:^M - Inferior loaded /lib64/libm.so.6^M - /lib64/libc.so.6^M -(gdb) FAIL: gdb.threads/check-libthread-db.exp: user-initiated check: continue -... - -The check expect the inferior to load libpthread, but since glibc 2.34 -libpthread has been integrated into glibc, and consequently it's no longer -a dependency: -... -$ ldd outputs/gdb.threads/check-libthread-db/check-libthread-db - linux-vdso.so.1 (0x00007ffe4cae4000) - libm.so.6 => /lib64/libm.so.6 (0x00007f167c77c000) - libc.so.6 => /lib64/libc.so.6 (0x00007f167c572000) - /lib64/ld-linux-x86-64.so.2 (0x00007f167c86e000) -... - -Fix this by updating the regexp to expect libpthread or libc. - -Tested on x86_64-linux. - ---- - gdb/testsuite/gdb.threads/check-libthread-db.exp | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - -diff --git a/gdb/testsuite/gdb.threads/check-libthread-db.exp b/gdb/testsuite/gdb.threads/check-libthread-db.exp -index 6ecf40db6a9..423c29978c8 100644 ---- a/gdb/testsuite/gdb.threads/check-libthread-db.exp -+++ b/gdb/testsuite/gdb.threads/check-libthread-db.exp -@@ -58,7 +58,9 @@ with_test_prefix "user-initiated check" { - - # User-initiated check with NPTL possibly uninitialized. - gdb_test "continue" \ -- ".*Stopped due to shared library event.*Inferior loaded .*libpthread.*" -+ [multi_line \ -+ "Stopped due to shared library event:" \ -+ " Inferior loaded .*(libpthread|libc).*"] - - gdb_test_sequence "maint check libthread-db" \ - "libpthread.so possibly not initialized" \ diff --git a/gdb-testsuite-fix-gdb.threads-killed-outside.exp-on-aarch64.patch b/gdb-testsuite-fix-gdb.threads-killed-outside.exp-on-aarch64.patch new file mode 100644 index 0000000..9c25440 --- /dev/null +++ b/gdb-testsuite-fix-gdb.threads-killed-outside.exp-on-aarch64.patch @@ -0,0 +1,44 @@ +[gdb/testsuite] Fix gdb.threads/killed-outside.exp on aarch64 + +On aarch64 (and likewise on arm), I run into: +... +(gdb) PASS: gdb.threads/killed-outside.exp: get pid of inferior +Executing on target: kill -9 11516 (timeout = 300) +builtin_spawn -ignore SIGHUP kill -9 11516^M +continue^M +Continuing.^M +Unable to fetch general registers: No such process.^M +(gdb) [Thread 0xfffff7d511e0 (LWP 11518) exited]^M +^M +Program terminated with signal SIGKILL, Killed.^M +The program no longer exists.^M +FAIL: gdb.threads/killed-outside.exp: prompt after first continue (timeout) +... +due to a mismatch between the actual "No such process" line and the expected +one: +... +set no_such_process_msg "Couldn't get registers: No such process\." +... + +Fix this by updating the regexp. + +Tested on aarch64-linux, and x86_64-linux. + +--- + gdb/testsuite/gdb.threads/killed-outside.exp | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/gdb/testsuite/gdb.threads/killed-outside.exp b/gdb/testsuite/gdb.threads/killed-outside.exp +index 3d4543e088c..7fa6b26c685 100644 +--- a/gdb/testsuite/gdb.threads/killed-outside.exp ++++ b/gdb/testsuite/gdb.threads/killed-outside.exp +@@ -37,7 +37,8 @@ remote_exec target "kill -9 ${testpid}" + # Give it some time to die. + sleep 2 + +-set no_such_process_msg "Couldn't get registers: No such process\." ++set regs_msg "(Couldn't get registers|Unable to fetch general registers.)" ++set no_such_process_msg "$regs_msg: No such process\." + set killed_msg "Program terminated with signal SIGKILL, Killed\." + set no_longer_exists_msg "The program no longer exists\." + set not_being_run_msg "The program is not being run\." diff --git a/gdb-testsuite-fix-gdb.threads-linux-dp.exp.patch b/gdb-testsuite-fix-gdb.threads-linux-dp.exp.patch deleted file mode 100644 index 2234630..0000000 --- a/gdb-testsuite-fix-gdb.threads-linux-dp.exp.patch +++ /dev/null @@ -1,53 +0,0 @@ -[gdb/testsuite] Fix gdb.threads/linux-dp.exp - -On openSUSE Tumbleweed with glibc-debuginfo installed I get: -... - (gdb) PASS: gdb.threads/linux-dp.exp: continue to breakpoint: thread 5's print - where^M - #0 print_philosopher (n=3, left=33 '!', right=33 '!') at linux-dp.c:105^M - #1 0x0000000000401628 in philosopher (data=0x40537c) at linux-dp.c:148^M - #2 0x00007ffff7d56b37 in start_thread (arg=) \ - at pthread_create.c:435^M - #3 0x00007ffff7ddb640 in clone3 () \ - at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81^M - (gdb) PASS: gdb.threads/linux-dp.exp: first thread-specific breakpoint hit -... -while without debuginfo installed I get instead: -... - (gdb) PASS: gdb.threads/linux-dp.exp: continue to breakpoint: thread 5's print - where^M - #0 print_philosopher (n=3, left=33 '!', right=33 '!') at linux-dp.c:105^M - #1 0x0000000000401628 in philosopher (data=0x40537c) at linux-dp.c:148^M - #2 0x00007ffff7d56b37 in start_thread () from /lib64/libc.so.6^M - #3 0x00007ffff7ddb640 in clone3 () from /lib64/libc.so.6^M - (gdb) FAIL: gdb.threads/linux-dp.exp: first thread-specific breakpoint hit -... - -The problem is that the regexp used: -... - "\(from .*libpthread\|at pthread_create\|in pthread_create\)" -... -expects the 'from' part to match libpthread, but in glibc 2.34 libpthread has -been merged into libc. - -Fix this by updating the regexp. - -Tested on x86_64-linux. - ---- - gdb/testsuite/gdb.threads/linux-dp.exp | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/gdb/testsuite/gdb.threads/linux-dp.exp b/gdb/testsuite/gdb.threads/linux-dp.exp -index 099971dca39..b01e87fa9ea 100644 ---- a/gdb/testsuite/gdb.threads/linux-dp.exp -+++ b/gdb/testsuite/gdb.threads/linux-dp.exp -@@ -226,7 +226,7 @@ gdb_continue_to_breakpoint "thread 5's print" - # If you do have debug info, the output obviously depends more on the - # exact library in use; under NPTL, you get: - # #2 0x0012b7fc in start_thread (arg=0x21) at pthread_create.c:264 --gdb_test "where" "print_philosopher.*philosopher.* \(from .*libpthread\|at pthread_create\|in pthread_create\).*" \ -+gdb_test "where" "print_philosopher.*philosopher.* \(from .*libpthread\|at pthread_create\|in pthread_create|from .*libc\\.\).*" \ - "first thread-specific breakpoint hit" - - # Make sure it's catching the right thread. Try hitting the diff --git a/gdb-testsuite-fix-gdb.threads-thread-specific-bp.exp.patch b/gdb-testsuite-fix-gdb.threads-thread-specific-bp.exp.patch deleted file mode 100644 index f37d1f2..0000000 --- a/gdb-testsuite-fix-gdb.threads-thread-specific-bp.exp.patch +++ /dev/null @@ -1,62 +0,0 @@ -[gdb/testsuite] Fix gdb.threads/thread-specific-bp.exp - -On OBS I ran into a failure in test-case gdb.threads/thread-specific-bp.exp: -... -(gdb) PASS: gdb.threads/thread-specific-bp.exp: non-stop: continue to end -info breakpoint^M -Num Type Disp Enb Address What^M -1 breakpoint keep y 0x0000555555555167 in main at $src:36^M - breakpoint already hit 1 time^M -2 breakpoint keep y 0x0000555555555151 in start at $src:23^M - breakpoint already hit 1 time^M -3 breakpoint keep y 0x0000555555555167 in main at $src:36 thread 2^M - stop only in thread 2^M -4 breakpoint keep y 0x000055555555515c in end at $src:29^M - breakpoint already hit 1 time^M -(gdb) [Thread 0x7ffff7db1640 (LWP 19984) exited]^M -Thread-specific breakpoint 3 deleted - thread 2 no longer in the thread list.^M -FAIL: gdb.threads/thread-specific-bp.exp: non-stop: \ - thread-specific breakpoint was deleted (timeout) -... - -Fix this by waiting for the "[Thread 0x7ffff7db1640 (LWP 19984) exited]" -message before issuing the "info breakpoint command". - -Tested on x86_64-linux. - ---- - gdb/testsuite/gdb.threads/thread-specific-bp.exp | 21 ++++++++++++++++++--- - 1 file changed, 18 insertions(+), 3 deletions(-) - -diff --git a/gdb/testsuite/gdb.threads/thread-specific-bp.exp b/gdb/testsuite/gdb.threads/thread-specific-bp.exp -index c59a65b3150..50f90edea55 100644 ---- a/gdb/testsuite/gdb.threads/thread-specific-bp.exp -+++ b/gdb/testsuite/gdb.threads/thread-specific-bp.exp -@@ -88,9 +88,24 @@ proc check_thread_specific_breakpoint {mode} { - set cmd "continue" - } - set test "continue to end" -- gdb_test_multiple "$cmd" $test { -- -re "Breakpoint .* end .* at .*\r\n$gdb_prompt " { -- pass $test -+ set thread_exited 0 -+ set prompt 0 -+ gdb_test_multiple "$cmd" $test -lbl { -+ -re "(^|\r\n)\\\[Thread \[^\r\n\]* exited](?=\r\n)" { -+ if { $prompt } { -+ pass $gdb_test_name -+ } else { -+ set thread_exited 1 -+ exp_continue -+ } -+ } -+ -re "\r\n$gdb_prompt " { -+ if { $thread_exited } { -+ pass $gdb_test_name -+ } else { -+ set prompt 1 -+ exp_continue -+ } - } - } - diff --git a/gdb-testsuite-fix-occasional-failure-in-gdb.mi-mi-multi-commands.exp.patch b/gdb-testsuite-fix-occasional-failure-in-gdb.mi-mi-multi-commands.exp.patch new file mode 100644 index 0000000..27833b6 --- /dev/null +++ b/gdb-testsuite-fix-occasional-failure-in-gdb.mi-mi-multi-commands.exp.patch @@ -0,0 +1,39 @@ +gdb/testsuite: fix occasional failure in gdb.mi/mi-multi-commands.exp + +In bug PR gdb/29036, another failure was reported for the test +gdb.mi/mi-multi-commands.exp. This test sends two commands to GDB as +a single write, and then checks that both commands are executed. + +The problem that was encountered here is that the output of the first +command, which looks like this: + + ^done,value="\"FIRST COMMAND\"" + +Is actually produced in parts, first the '^done' is printed, then the +',value="\"FIRST COMMAND\"" is printed. + +What was happening is that some characters from the second command +were being echoed after the '^done' had been printed, but before the +value part had been printed. To avoid this issue I've relaxed the +pattern that checks for the first command a little. With this fix in +place the occasional failure in this test is no longer showing up. + +Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29036 + +--- + gdb/testsuite/gdb.mi/mi-multi-commands.exp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/gdb/testsuite/gdb.mi/mi-multi-commands.exp b/gdb/testsuite/gdb.mi/mi-multi-commands.exp +index d00e0aaea8b..58187b15815 100644 +--- a/gdb/testsuite/gdb.mi/mi-multi-commands.exp ++++ b/gdb/testsuite/gdb.mi/mi-multi-commands.exp +@@ -100,7 +100,7 @@ proc run_test { args } { + set seen_second_message false + + gdb_test_multiple "" "look for first command output, command length $i" -prompt "$mi_gdb_prompt" { +- -re "\\^done,value=\"\\\\\"FIRST COMMAND\\\\\"\"" { ++ -re "\\^done.*,value=\"\\\\\"FIRST COMMAND\\\\\"\"" { + set seen_first_message true + exp_continue + } diff --git a/gdb-testsuite-fix-port-detection-in-gdb.debuginfod-fetch_src_and_symbols.exp.patch b/gdb-testsuite-fix-port-detection-in-gdb.debuginfod-fetch_src_and_symbols.exp.patch deleted file mode 100644 index 5f63a9d..0000000 --- a/gdb-testsuite-fix-port-detection-in-gdb.debuginfod-fetch_src_and_symbols.exp.patch +++ /dev/null @@ -1,52 +0,0 @@ -[gdb/testsuite] Fix port detection in gdb.debuginfod/fetch_src_and_symbols.exp - -On OBS I ran into this failure with test-case -gdb.debuginfod/fetch_src_and_symbols.exp: -... -Failed to listen for connections: Address already in use^M -[Thu Oct 21 11:48:49 2021] (559/559): started http server on IPv6 port=8000^M - ... -FAIL: gdb.debuginfod/fetch_src_and_symbols.exp: local_url: find port timeout -... - -The test-case is trying to start debuginfod on a port to see if it's -available, and it handles either this message: - "started http server on IPv4 IPv6 port=$port" -meaning success, or: - "failed to bind to port" -meaning failure, in which case the debuginfod instance is killed, and we try -the next port. - -The test-case only uses the v4 address 127.0.0.1, so fix this by: -- accepting "started http server on IPv4 port=$port" -- rejecting "started http server on IPv6 port=$port" - -Tested on x86_64-linux. - ---- - gdb/testsuite/gdb.debuginfod/fetch_src_and_symbols.exp | 7 ++++++- - 1 file changed, 6 insertions(+), 1 deletion(-) - -diff --git a/gdb/testsuite/gdb.debuginfod/fetch_src_and_symbols.exp b/gdb/testsuite/gdb.debuginfod/fetch_src_and_symbols.exp -index 81d4791eb6d..bb0c0c7ff29 100644 ---- a/gdb/testsuite/gdb.debuginfod/fetch_src_and_symbols.exp -+++ b/gdb/testsuite/gdb.debuginfod/fetch_src_and_symbols.exp -@@ -180,12 +180,17 @@ proc local_url { } { - spawn debuginfod -vvvv -d $db -p $port -F $debugdir - expect { - "started http server on IPv4 IPv6 port=$port" { set found 1 } -- "failed to bind to port" { kill_wait_spawned_process $spawn_id } -+ "started http server on IPv4 port=$port" { set found 1 } -+ "started http server on IPv6 port=$port" {} -+ "failed to bind to port" {} - timeout { - fail "find port timeout" - return -1 - } - } -+ if { ! $found } { -+ kill_wait_spawned_process $spawn_id -+ } - } - - set metrics [list "ready 1" \ diff --git a/gdb-testsuite-fix-regexp-in-gdb.base-foll-vfork.exp.patch b/gdb-testsuite-fix-regexp-in-gdb.base-foll-vfork.exp.patch deleted file mode 100644 index f220be5..0000000 --- a/gdb-testsuite-fix-regexp-in-gdb.base-foll-vfork.exp.patch +++ /dev/null @@ -1,45 +0,0 @@ -[gdb/testsuite] Fix regexp in gdb.base/foll-vfork.exp - -On OBS I ran into: -... -(gdb) PASS: gdb.base/foll-vfork.exp: exit: \ - vfork relations in info inferiors: continue to child exit -info inferiors^M - Num Description Connection Executable ^M - 1 foll-vfork-exit ^M -* 2 foll-vfork-exit ^M -(gdb) I'm the proud parent of child #5044!^M -FAIL: gdb.base/foll-vfork.exp: exit: vfork relations in info inferiors: \ - vfork relation no longer appears in info inferiors (timeout) -... - -Fix this by removing the '$' anchor in the corresponding '$gdb_prompt $' -regexps. - -Tested on x86_64-linux. - ---- - gdb/testsuite/gdb.base/foll-vfork.exp | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -diff --git a/gdb/testsuite/gdb.base/foll-vfork.exp b/gdb/testsuite/gdb.base/foll-vfork.exp -index 577bd4d573b..a781a5c2087 100644 ---- a/gdb/testsuite/gdb.base/foll-vfork.exp -+++ b/gdb/testsuite/gdb.base/foll-vfork.exp -@@ -374,13 +374,13 @@ proc vfork_relations_in_info_inferiors { variant } { - - set test "vfork relation no longer appears in info inferiors" - gdb_test_multiple "info inferiors" $test { -- -re "is vfork child of inferior 1.*$gdb_prompt $" { -+ -re "is vfork child of inferior 1.*$gdb_prompt " { - fail $test - } -- -re "is vfork parent of inferior 2.*$gdb_prompt $" { -+ -re "is vfork parent of inferior 2.*$gdb_prompt " { - fail $test - } -- -re "$gdb_prompt $" { -+ -re "$gdb_prompt " { - pass $test - } - } diff --git a/gdb-testsuite-fix-stepi-test-cases-with-unix-m32-fpie-pie.patch b/gdb-testsuite-fix-stepi-test-cases-with-unix-m32-fpie-pie.patch deleted file mode 100644 index 06ad330..0000000 --- a/gdb-testsuite-fix-stepi-test-cases-with-unix-m32-fpie-pie.patch +++ /dev/null @@ -1,176 +0,0 @@ -[gdb/testsuite] Fix stepi test-cases with unix/-m32/-fPIE/-pie - -When running test-case gdb.base/step-indirect-call-thunk.exp with target board -unix/-m32/-fPIE/-pie, I run into: -... -(gdb) stepi^M -0x5655552e 22 { /* inc.1 */^M -(gdb) stepi^M -0x56555530 22 { /* inc.1 */^M -(gdb) stepi^M -0x565555f7 in __x86.get_pc_thunk.ax ()^M -(gdb) FAIL: gdb.base/step-indirect-call-thunk.exp: stepi into return thunk -... - -In contrast, with unix/-m32 we have instead: -... -(gdb) stepi^M -0x08048407 22 { /* inc.1 */^M -(gdb) stepi^M -23 return x + 1; /* inc.2 */^M -(gdb) stepi^M -0x0804840c 23 return x + 1; /* inc.2 */^M -(gdb) stepi^M -24 } /* inc.3 */^M -(gdb) stepi^M -0x08048410 24 } /* inc.3 */^M -(gdb) stepi^M -0x0804848f in __x86_return_thunk ()^M -(gdb) PASS: gdb.base/step-indirect-call-thunk.exp: stepi into return thunk -... - -The test-case doesn't expect to run into __x86.get_pc_thunk.ax, which is a -PIC helper function for x86_64-linux. - -Fix this by insn-stepping through it. - -Likewise in a few other test-cases. - -Tested on x86_64-linux. - ---- - gdb/testsuite/gdb.base/step-indirect-call-thunk.exp | 5 ++++- - gdb/testsuite/gdb.base/step-test.exp | 4 +++- - gdb/testsuite/gdb.reverse/step-indirect-call-thunk.exp | 6 ++++-- - gdb/testsuite/gdb.reverse/step-precsave.exp | 10 ++++++++++ - gdb/testsuite/gdb.reverse/step-reverse.exp | 10 ++++++++++ - 5 files changed, 31 insertions(+), 4 deletions(-) - -diff --git a/gdb/testsuite/gdb.base/step-indirect-call-thunk.exp b/gdb/testsuite/gdb.base/step-indirect-call-thunk.exp -index d84a0232265..18f5bdcbe9a 100644 ---- a/gdb/testsuite/gdb.base/step-indirect-call-thunk.exp -+++ b/gdb/testsuite/gdb.base/step-indirect-call-thunk.exp -@@ -65,9 +65,12 @@ gdb_test "step" "inc\.2.*" "step through call thunk into inc" - gdb_test "step" "inc\.3.*" "step inside inc" - gdb_test "step" "thrice\.4.*" "step through return thunk back into thrice" - -+set alphanum_re "\[a-zA-Z0-9\]" -+set pic_thunk_re "__$alphanum_re*\\.get_pc_thunk\\.$alphanum_re* \\(\\)" -+ - # We can use instruction stepping to step into thunks. - stepi_until "thrice" "indirect_thunk" "stepi into call thunk" - stepi_until "indirect_thunk" "inc." "stepi out of call thunk into inc" --stepi_until "inc" "return_thunk" "stepi into return thunk" -+stepi_until "(inc|$pic_thunk_re)" "return_thunk" "stepi into return thunk" - stepi_until "return_thunk" "thrice" \ - "stepi out of return thunk back into thrice" -diff --git a/gdb/testsuite/gdb.base/step-test.exp b/gdb/testsuite/gdb.base/step-test.exp -index 8664b3eda22..5f480e07edd 100644 ---- a/gdb/testsuite/gdb.base/step-test.exp -+++ b/gdb/testsuite/gdb.base/step-test.exp -@@ -128,8 +128,10 @@ test_i "stepi into function" "stepi" \ - # Continue to step until we reach the function's body. This makes it - # more likely that we've actually completed the prologue, so "finish" - # will work. -+set alphanum_re "\[a-zA-Z0-9\]" -+set pic_thunk_re "__$alphanum_re*\\.get_pc_thunk\\.$alphanum_re* \\(\\)" - test_i "stepi into function's first source line" "stepi" \ -- ".*${decimal}.*int callee" \ -+ "(${decimal}.*int callee|$pic_thunk_re)" \ - ".*${decimal}.*myglob.*; return 0;" - - # Have to be careful here, if the finish does not work, -diff --git a/gdb/testsuite/gdb.reverse/step-indirect-call-thunk.exp b/gdb/testsuite/gdb.reverse/step-indirect-call-thunk.exp -index dad43d78e6b..1f43206074f 100644 ---- a/gdb/testsuite/gdb.reverse/step-indirect-call-thunk.exp -+++ b/gdb/testsuite/gdb.reverse/step-indirect-call-thunk.exp -@@ -86,7 +86,9 @@ gdb_test "reverse-next" "apply\.2.*" \ - step_until "stepi" "apply\.2" "indirect_thunk" "stepi into call thunk" - step_until "stepi" "indirect_thunk" "inc" \ - "stepi out of call thunk into inc" --step_until "stepi" "inc" "return_thunk" "stepi into return thunk" -+set alphanum_re "\[a-zA-Z0-9\]" -+set pic_thunk_re "__$alphanum_re*\\.get_pc_thunk\\.$alphanum_re* \\(\\)" -+step_until "stepi" "(inc|$pic_thunk_re)" "return_thunk" "stepi into return thunk" - step_until "stepi" "return_thunk" "apply" \ - "stepi out of return thunk back into apply" - -@@ -94,7 +96,7 @@ step_until "reverse-stepi" "apply" "return_thunk" \ - "reverse-stepi into return thunk" - step_until "reverse-stepi" "return_thunk" "inc" \ - "reverse-stepi out of return thunk into inc" --step_until "reverse-stepi" "inc" "indirect_thunk" \ -+step_until "reverse-stepi" "(inc|$pic_thunk_re)" "indirect_thunk" \ - "reverse-stepi into call thunk" - step_until "reverse-stepi" "indirect_thunk" "apply" \ - "reverse-stepi out of call thunk into apply" -diff --git a/gdb/testsuite/gdb.reverse/step-precsave.exp b/gdb/testsuite/gdb.reverse/step-precsave.exp -index 43f6ab3a11a..e85cdabfb73 100644 ---- a/gdb/testsuite/gdb.reverse/step-precsave.exp -+++ b/gdb/testsuite/gdb.reverse/step-precsave.exp -@@ -124,6 +124,8 @@ gdb_test_multiple "stepi" "$test_message" { - - # stepi into a function call - -+set alphanum_re "\[a-zA-Z0-9\]" -+set pic_thunk_re "__$alphanum_re*\\.get_pc_thunk\\.$alphanum_re* \\(\\)" - set test_message "stepi into function call" - gdb_test_multiple "stepi" "$test_message" { - -re "ARRIVED IN CALLEE.*$gdb_prompt $" { -@@ -143,6 +145,10 @@ gdb_test_multiple "stepi" "$test_message" { - send_gdb "stepi\n" - exp_continue - } -+ -re "$pic_thunk_re.*$gdb_prompt $" { -+ send_gdb "stepi\n" -+ exp_continue -+ } - } - - # stepi thru return of a function call -@@ -216,6 +222,10 @@ gdb_test_multiple "stepi" "$test_message" { - send_gdb "stepi\n" - exp_continue - } -+ -re "$pic_thunk_re.*$gdb_prompt $" { -+ send_gdb "stepi\n" -+ exp_continue -+ } - -re "${hex} in main .*:$stepi_location.*STEPI TEST.*$gdb_prompt $" { - send_gdb "stepi\n" - exp_continue -diff --git a/gdb/testsuite/gdb.reverse/step-reverse.exp b/gdb/testsuite/gdb.reverse/step-reverse.exp -index 335ccfbd399..32c18faaaa6 100644 ---- a/gdb/testsuite/gdb.reverse/step-reverse.exp -+++ b/gdb/testsuite/gdb.reverse/step-reverse.exp -@@ -87,6 +87,8 @@ gdb_test_multiple "stepi" "$test_message" { - - # stepi into a function call - -+set alphanum_re "\[a-zA-Z0-9\]" -+set pic_thunk_re "__$alphanum_re*\\.get_pc_thunk\\.$alphanum_re* \\(\\)" - set test_message "stepi into function call" - gdb_test_multiple "stepi" "$test_message" { - -re "ARRIVED IN CALLEE.*$gdb_prompt $" { -@@ -106,6 +108,10 @@ gdb_test_multiple "stepi" "$test_message" { - send_gdb "stepi\n" - exp_continue - } -+ -re "$pic_thunk_re.*$gdb_prompt $" { -+ send_gdb "stepi\n" -+ exp_continue -+ } - } - - # stepi thru return of a function call -@@ -179,6 +185,10 @@ gdb_test_multiple "stepi" "$test_message" { - send_gdb "stepi\n" - exp_continue - } -+ -re "$pic_thunk_re.*$gdb_prompt $" { -+ send_gdb "stepi\n" -+ exp_continue -+ } - -re "${hex} in main .*:$stepi_location.*STEPI TEST.*$gdb_prompt $" { - send_gdb "stepi\n" - exp_continue diff --git a/gdb-testsuite-fix-test-failure-when-building-against-readline-v7.patch b/gdb-testsuite-fix-test-failure-when-building-against-readline-v7.patch new file mode 100644 index 0000000..ef51b6f --- /dev/null +++ b/gdb-testsuite-fix-test-failure-when-building-against-readline-v7.patch @@ -0,0 +1,50 @@ +gdb/testsuite: fix test failure when building against readline v7 + +The test added in the commit: + + commit a6b413d24ccc5d76179bab866834e11fd6fec294 + Date: Fri Mar 11 14:44:03 2022 +0000 + + gdb: work around prompt corruption caused by bracketed-paste-mode + +Was not written with readline 7 in mind, only readline 8+. Between +readline 7 and 8 the escape sequence used to disable bracketed paste +mode changed, an additional '\r' character was added to the end. In +fact, it was the addition of this '\r' character that triggered the +issue for which the above commit is part of the solution. + +Anyway, the test tries to spot the case where the output from GDB is +not perfect, but does have the above work around applied. However, +the pattern in the test assumes that the problematic '\r' will be +present, and this is only true for readline 8+. With readline 7 the +test was failing. + +In this commit I generalise the pattern a little so that the test will +still KFAIL with readline 7. + +It's a little unfortunate that the test is KFAILing with readline 7, +as without the problematic '\r' there's actually no reason that GDB +couldn't "do the right thing" in this case, in which case, the test +would PASS, but that would require changes within GDB itself. + +My preference then is that initially we patch the test to get it +KFAILing, then in a separate commit I can modify GDB so that it can +PASS with readline 7. + +--- + gdb/testsuite/gdb.base/eof-exit.exp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/gdb/testsuite/gdb.base/eof-exit.exp b/gdb/testsuite/gdb.base/eof-exit.exp +index 53a3b56dce8..c88aced9f35 100644 +--- a/gdb/testsuite/gdb.base/eof-exit.exp ++++ b/gdb/testsuite/gdb.base/eof-exit.exp +@@ -56,7 +56,7 @@ proc run_test {} { + -re "$::gdb_prompt \[^\n\]*\r\[^\n\]*quit" { + fail "$gdb_test_name (misplaced \\r)" + } +- -re "$::gdb_prompt \[^\n\]*\r\[^\n\]*\r\nquit\r\n" { ++ -re "$::gdb_prompt (?:\[^\n\]*\r)?\[^\n\]*\r\nquit\r\n" { + # For versions of readline that don't include the + # RL_STATE_EOF patch, then the 'quit' is printed on the + # subsequent line. diff --git a/gdb-testsuite-handle-init-errors-in-gdb.mi-user-selected-context-sync.exp.patch b/gdb-testsuite-handle-init-errors-in-gdb.mi-user-selected-context-sync.exp.patch index 88f5bf6..af95ddf 100644 --- a/gdb-testsuite-handle-init-errors-in-gdb.mi-user-selected-context-sync.exp.patch +++ b/gdb-testsuite-handle-init-errors-in-gdb.mi-user-selected-context-sync.exp.patch @@ -1,43 +1,7 @@ -[gdb/testsuite] Handle init errors in gdb.mi/user-selected-context-sync.exp - -In OBS, on aarch64-linux, with a gdb 11.1 based package, I run into: -... -(gdb) builtin_spawn -pty^M -new-ui mi /dev/pts/5^M -New UI allocated^M -(gdb) =thread-group-added,id="i1"^M -(gdb) ERROR: MI channel failed -warning: Error detected on fd 11^M -thread 1.1^M -Unknown thread 1.1.^M -(gdb) UNRESOLVED: gdb.mi/user-selected-context-sync.exp: mode=non-stop: \ - test_cli_inferior: reset selection to thread 1.1 -... -with many more UNRESOLVED following. - -The ERROR is a common problem, filed as -https://sourceware.org/bugzilla/show_bug.cgi?id=28561 . - -But the many UNRESOLVEDs are due to not checking whether the setup as done in -the test_setup function succeeds or not. - -Fix this by: -- making test_setup return an error upon failure -- handling test_setup error at the call site -- adding a "setup done" pass/fail to be turned into an unresolved - in case of error during setup. - -Tested on x86_64-linux, by manually triggering the error in -mi_gdb_start_separate_mi_tty. - ---- - gdb/testsuite/gdb.mi/user-selected-context-sync.exp | 13 ++++++++++--- - 1 file changed, 10 insertions(+), 3 deletions(-) - -diff --git a/gdb/testsuite/gdb.mi/user-selected-context-sync.exp b/gdb/testsuite/gdb.mi/user-selected-context-sync.exp -index 2f1a4884a21..d4e72190d2a 100644 ---- a/gdb/testsuite/gdb.mi/user-selected-context-sync.exp -+++ b/gdb/testsuite/gdb.mi/user-selected-context-sync.exp +Index: gdb-12.1/gdb/testsuite/gdb.mi/user-selected-context-sync.exp +=================================================================== +--- gdb-12.1.orig/gdb/testsuite/gdb.mi/user-selected-context-sync.exp ++++ gdb-12.1/gdb/testsuite/gdb.mi/user-selected-context-sync.exp @@ -393,7 +393,7 @@ proc_with_prefix test_setup { mode } { } @@ -47,16 +11,16 @@ index 2f1a4884a21..d4e72190d2a 100644 } } -@@ -403,7 +403,7 @@ proc_with_prefix test_setup { mode } { +@@ -402,7 +402,7 @@ proc_with_prefix test_setup { mode } { + mi_gdb_load $binfile if { [mi_runto_main] < 0 } { - fail "can't run to main" - return + return -1 } # When using mi_expect_stop, we don't expect a prompt after the *stopped -@@ -444,6 +444,8 @@ proc_with_prefix test_setup { mode } { +@@ -443,6 +443,8 @@ proc_with_prefix test_setup { mode } { # Prepare the second inferior for the test. test_continue_to_start $mode 2 } @@ -65,7 +29,7 @@ index 2f1a4884a21..d4e72190d2a 100644 } # Reset the selection to frame #0 of thread THREAD. -@@ -1253,7 +1255,12 @@ proc_with_prefix test_cli_in_mi_frame { mode cli_in_mi_mode } { +@@ -1300,7 +1302,12 @@ proc_with_prefix test_cli_in_mi_frame { } foreach_with_prefix mode { "all-stop" "non-stop" } { diff --git a/gdb-testsuite-handle-older-python-in-gdb.python-py-send-packet.py.patch b/gdb-testsuite-handle-older-python-in-gdb.python-py-send-packet.py.patch new file mode 100644 index 0000000..fc546d9 --- /dev/null +++ b/gdb-testsuite-handle-older-python-in-gdb.python-py-send-packet.py.patch @@ -0,0 +1,62 @@ +[gdb/testsuite] Handle older python in gdb.python/py-send-packet.py + +With python 3.4, I run into: +... +Traceback (most recent call last):^M + File "", line 1, in ^M + File + "outputs/gdb.python/py-send-packet/py-send-packet.py", line 128, in \ + run_set_global_var_test^M + res = conn.send_packet(b"X%x,4:\x02\x02\x02\x02" % addr)^M +TypeError: Could not convert Python object: b'X%x,4:\x02\x02\x02\x02'.^M +Error while executing Python code.^M +... +while with python 3.6 this works fine. + +Fix this by avoiding the byte literal (with prefix b), and use instead: +... + bytes(("X%x,4:" % addr).encode('ascii') + bytearray([0x2, 0x2, 0x2, 0x2])). +... + +--- + gdb/testsuite/gdb.python/py-send-packet.py | 13 +++++++++++-- + 1 file changed, 11 insertions(+), 2 deletions(-) + +diff --git a/gdb/testsuite/gdb.python/py-send-packet.py b/gdb/testsuite/gdb.python/py-send-packet.py +index 4966688a922..f58deed1019 100644 +--- a/gdb/testsuite/gdb.python/py-send-packet.py ++++ b/gdb/testsuite/gdb.python/py-send-packet.py +@@ -122,6 +122,15 @@ def check_global_var(expected_val): + if val != expected_val: + raise gdb.GdbError("global_var is 0x%x, expected 0x%x" % (val, expected_val)) + ++# Return a bytes object representing an 'X' packet with ++# address ADDR and bytes L. ++def bytes_xpacket (addr, l): ++ # Implement b"X%x,4:\xff\xff\xff\xff" % addr in a way that works ++ # across python versions. ++ res = ("X%x,4:" % addr).encode('ascii') + bytearray(l) ++ # Force it to type bytes. ++ res = bytes(res) ++ return res + + # Set the 'X' packet to the remote target to set a global variable. + # Checks that we can send byte values. +@@ -133,7 +142,7 @@ def run_set_global_var_test(): + res = conn.send_packet("X%x,4:\x01\x01\x01\x01" % addr) + assert isinstance(res, bytes) + check_global_var(0x01010101) +- res = conn.send_packet(b"X%x,4:\x02\x02\x02\x02" % addr) ++ res = conn.send_packet(bytes_xpacket(addr, [0x2, 0x2, 0x2, 0x2])) + assert isinstance(res, bytes) + check_global_var(0x02020202) + if sys.version_info[0] > 2: +@@ -149,7 +158,7 @@ def run_set_global_var_test(): + assert saw_error + check_global_var(0x02020202) + # Now we pass a bytes object, which will work. +- res = conn.send_packet(b"X%x,4:\xff\xff\xff\xff" % addr) ++ res = conn.send_packet(bytes_xpacket(addr, [0xff, 0xff, 0xff, 0xff])) + check_global_var(0xFFFFFFFF) + else: + # On Python 2 we need to force the creation of a Unicode diff --git a/gdb-testsuite-handle-pipe2-syscall-in-gdb.base-catch-syscall.exp.patch b/gdb-testsuite-handle-pipe2-syscall-in-gdb.base-catch-syscall.exp.patch index 6fa8daa..56936f7 100644 --- a/gdb-testsuite-handle-pipe2-syscall-in-gdb.base-catch-syscall.exp.patch +++ b/gdb-testsuite-handle-pipe2-syscall-in-gdb.base-catch-syscall.exp.patch @@ -15,7 +15,8 @@ The current glibc on Tumbleweed is 2.35, which contains commit "linux: Implement pipe in terms of __NR_pipe2", and consequently syscall pipe2 is used instead of syscall pipe. -Fix this by detecting whether syscall pipe or pipe2 is used before running the tests. +Fix this by detecting whether syscall pipe or pipe2 is used before running the +tests. Tested on x86_64-linux, specifically on: - openSUSE Tumbleweed (with glibc 2.35), and @@ -26,19 +27,14 @@ On openSUSE Tumbleweed + target board unix/-m32, this exposes: (gdb) catch syscall pipe2^M Unknown syscall name 'pipe2'.^M ... -so make the test robust against this by using the syscall number instead, -while still noting that the syscall name pipe2 is not recognized: -... -FAIL: gdb.base/catch-syscall.exp: determine pipe syscall: catch syscall pipe2 -... which will be fixed in a folllow-up patch. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29056 --- - gdb/testsuite/gdb.base/catch-syscall.c | 3 +- - gdb/testsuite/gdb.base/catch-syscall.exp | 100 ++++++++++++++++++++++++++++--- - 2 files changed, 93 insertions(+), 10 deletions(-) + gdb/testsuite/gdb.base/catch-syscall.c | 3 +- + gdb/testsuite/gdb.base/catch-syscall.exp | 69 ++++++++++++++++++++++++++++---- + 2 files changed, 64 insertions(+), 8 deletions(-) diff --git a/gdb/testsuite/gdb.base/catch-syscall.c b/gdb/testsuite/gdb.base/catch-syscall.c index 0ab96318d3e..8c252a06b20 100644 @@ -55,56 +51,14 @@ index 0ab96318d3e..8c252a06b20 100644 #endif int write_syscall = SYS_write; diff --git a/gdb/testsuite/gdb.base/catch-syscall.exp b/gdb/testsuite/gdb.base/catch-syscall.exp -index a5dfd02411b..cc76a2cf61d 100644 +index a5dfd02411b..1427dfece6d 100644 --- a/gdb/testsuite/gdb.base/catch-syscall.exp +++ b/gdb/testsuite/gdb.base/catch-syscall.exp -@@ -185,7 +185,11 @@ proc insert_catch_syscall_with_many_args { syscalls numbers } { - set filter_str "" - - foreach name $syscalls number $numbers { -- set filter_str "${filter_str}'${name}' \\\[${number}\\\] " -+ if { [string is integer $name] } { -+ append filter_str "${name} " -+ } else { -+ append filter_str "'${name}' \\\[${number}\\\] " -+ } - } - - set filter_str [ string trimright $filter_str " " ] -@@ -662,42 +666,120 @@ proc fill_all_syscalls_numbers {} { - global all_syscalls_numbers last_syscall_number unknown_syscall_number all_syscalls - - foreach syscall $all_syscalls { -- lappend all_syscalls_numbers [get_integer_valueof "${syscall}_syscall" -1] -+ if { [string is integer $syscall] } { -+ lappend all_syscalls_numbers $syscall -+ } else { -+ lappend all_syscalls_numbers [get_integer_valueof "${syscall}_syscall" -1] -+ } - } - - set last_syscall_number [get_integer_valueof "exit_group_syscall" -1] +@@ -669,35 +669,90 @@ proc fill_all_syscalls_numbers {} { set unknown_syscall_number [get_integer_valueof "unknown_syscall" -1] } -# Set up the vector all_syscalls. -+# Catch syscall with NAME, or if gdb doesn't support that (yet), try NR -+# instead. -+ -+proc catch_syscall_name_or_nr { name nr } { -+ global decimal -+ -+ gdb_test_multiple "catch syscall $name" "" { -+ -re -wrap "Catchpoint $decimal \\(syscall '$name' \\\[$nr\\\]\\)" { -+ pass $gdb_test_name -+ } -+ -re -wrap "Unknown syscall name '$name'\." { -+ fail $gdb_test_name -+ gdb_test "catch syscall $nr" "Catchpoint $decimal \\(syscall $nr\\)" -+ } -+ } -+} -+ +# Set up the vector all_syscalls. Returns 1 upon success, 0 upon failure. proc setup_all_syscalls {} { @@ -125,24 +79,10 @@ index a5dfd02411b..cc76a2cf61d 100644 + set have_SYS_pipe 0 gdb_test_multiple "p pipe_syscall" $test { - -re " = .*$gdb_prompt $" { -+ -re -wrap " = ($decimal)" { -+ pass $test -+ set have_SYS_pipe 1 -+ set SYS_pipe $expect_out(1,string) -+ } -+ -re -wrap "No symbol .*" { -+ pass $test -+ } -+ } -+ -+ set test "check SYS_pipe2" -+ set have_SYS_pipe2 0 -+ gdb_test_multiple "p pipe2_syscall" $test { -+ -re -wrap " = ($decimal)" { ++ -re -wrap " = $decimal" { pass $test - lappend all_syscalls "pipe" -+ set have_SYS_pipe2 1 -+ set SYS_pipe2 $expect_out(1,string) ++ set have_SYS_pipe 1 } - -re "No symbol .*$gdb_prompt $" { + -re -wrap "No symbol .*" { @@ -152,6 +92,18 @@ index a5dfd02411b..cc76a2cf61d 100644 + } + } + ++ set test "check SYS_pipe2" ++ set have_SYS_pipe2 0 ++ gdb_test_multiple "p pipe2_syscall" $test { ++ -re -wrap " = $decimal" { ++ pass $test ++ set have_SYS_pipe2 1 ++ } ++ -re -wrap "No symbol .*" { ++ pass $test ++ } ++ } ++ + if { $have_SYS_pipe == 0 && $have_SYS_pipe2 == 0 } { + return 0 + } @@ -161,20 +113,20 @@ index a5dfd02411b..cc76a2cf61d 100644 + gdb_test "break $line" + gdb_continue_to_breakpoint "before pipe call" + if { $have_SYS_pipe } { -+ catch_syscall_name_or_nr pipe $SYS_pipe ++ gdb_test "catch syscall pipe" + } + if { $have_SYS_pipe2 } { -+ catch_syscall_name_or_nr pipe2 $SYS_pipe2 ++ gdb_test "catch syscall pipe2" + } + set ok 0 + gdb_test_multiple "continue" "" { -+ -re -wrap "Catchpoint $decimal \\(call to syscall (pipe|$SYS_pipe)\\).*" { -+ lappend all_syscalls $expect_out(1,string) ++ -re -wrap "Catchpoint $decimal \\(call to syscall pipe\\).*" { ++ lappend all_syscalls pipe + pass $gdb_test_name + set ok 1 + } -+ -re -wrap "Catchpoint $decimal \\(call to syscall (pipe2|$SYS_pipe2)\\).*" { -+ lappend all_syscalls $expect_out(1,string) ++ -re -wrap "Catchpoint $decimal \\(call to syscall pipe2\\).*" { ++ lappend all_syscalls pipe2 + pass $gdb_test_name + set ok 1 + } diff --git a/gdb-testsuite-handle-quotes-in-gdb_py_module_available.patch b/gdb-testsuite-handle-quotes-in-gdb_py_module_available.patch new file mode 100644 index 0000000..8836448 --- /dev/null +++ b/gdb-testsuite-handle-quotes-in-gdb_py_module_available.patch @@ -0,0 +1,36 @@ +[gdb/testsuite] Handle quotes in gdb_py_module_available + +On openSUSE Leap 42.3 with python 3.4, I run into: +... +(gdb) python import pygments^M +Traceback (most recent call last):^M + File "", line 1, in ^M +ImportError: No module named 'pygments'^M +Error while executing Python code.^M +(gdb) FAIL: gdb.base/style.exp: python import pygments +ERROR: unexpected output from python import +... +because gdb_py_module_available doesn't handle the single quotes around the +module name in the ImportError. + +Fix this by allowing the single quotes. + +Tested on x86_64-linux. + +--- + gdb/testsuite/lib/gdb-python.exp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/gdb/testsuite/lib/gdb-python.exp b/gdb/testsuite/lib/gdb-python.exp +index d5039bbd099..c7a3907dd2b 100644 +--- a/gdb/testsuite/lib/gdb-python.exp ++++ b/gdb/testsuite/lib/gdb-python.exp +@@ -61,7 +61,7 @@ proc gdb_py_module_available { name } { + -re -wrap "ModuleNotFoundError: No module named '${name}'.*" { + set available false + } +- -re -wrap "ImportError: No module named ${name}.*" { ++ -re -wrap "ImportError: No module named '?${name}.*'?" { + set available false + } + -re -wrap "python import ${name}" { diff --git a/gdb-testsuite-handle-recursive-internal-problem-in-gdb_internal_error_resync.patch b/gdb-testsuite-handle-recursive-internal-problem-in-gdb_internal_error_resync.patch deleted file mode 100644 index c4c8838..0000000 --- a/gdb-testsuite-handle-recursive-internal-problem-in-gdb_internal_error_resync.patch +++ /dev/null @@ -1,68 +0,0 @@ -[gdb/testsuite] Handle recursive internal problem in gdb_internal_error_resync - -I came across this problem when testing gdb.base/gdb-sigterm.exp -on a machine with a pre-release version of glib-2.34 installed: - -A problem internal to GDB has been detected, -further debugging may prove unreliable. -Quit this debugging session? (y or n) Recursive internal problem. -FAIL: gdb.base/gdb-sigterm.exp: expect eof #0 (GDB internal error) -Resyncing due to internal error. -ERROR: : spawn id exp11 not open - while executing -"expect { --i exp11 -timeout 10 - -re "Quit this debugging session\\? \\(y or n\\) $" { - send_gdb "n\n" answer - incr count - } - -re "Create..." - ("uplevel" body line 1) - invoked from within -"uplevel $body" NONE : spawn id exp11 not open -ERROR: Could not resync from internal error (timeout) -gdb.base/gdb-sigterm.exp: expect eof #0: stepped 9 times -UNRESOLVED: gdb.base/gdb-sigterm.exp: 50 SIGTERM passes - -I don't have a problem with the latter ERROR nor the UNRESOLVED -messages. However the first ERROR regarding the exp11 spawn id -not being open is not especially useful. - -This commit handles the "Recursive internal problem" case, avoiding -the problematic ERROR shown above. - -With this commit in place, the log messages look like this instead: - -A problem internal to GDB has been detected, -further debugging may prove unreliable. -Quit this debugging session? (y or n) Recursive internal problem. -FAIL: gdb.base/gdb-sigterm.exp: expect eof #15 (GDB internal error) -Resyncing due to internal error. -ERROR: Could not resync from internal error (recursive internal problem) -gdb.base/gdb-sigterm.exp: expect eof #15: stepped 12 times -UNRESOLVED: gdb.base/gdb-sigterm.exp: 50 SIGTERM passes - -gdb/testsuite/ChangeLog: - - * lib/gdb.exp (gdb_internal_error_resync): Handle "Recursive - internal problem". - ---- - gdb/testsuite/lib/gdb.exp | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp -index dbf4016aca1..7a8332dd573 100644 ---- a/gdb/testsuite/lib/gdb.exp -+++ b/gdb/testsuite/lib/gdb.exp -@@ -756,6 +756,10 @@ proc gdb_internal_error_resync {} { - set count 0 - while {$count < 10} { - gdb_expect { -+ -re "Recursive internal problem\\." { -+ perror "Could not resync from internal error (recursive internal problem)" -+ return 0 -+ } - -re "Quit this debugging session\\? \\(y or n\\) $" { - send_gdb "n\n" answer - incr count diff --git a/gdb-testsuite-handle-runto-fail-in-gdb.mi-mi-var-cp.exp.patch b/gdb-testsuite-handle-runto-fail-in-gdb.mi-mi-var-cp.exp.patch deleted file mode 100644 index cc54b46..0000000 --- a/gdb-testsuite-handle-runto-fail-in-gdb.mi-mi-var-cp.exp.patch +++ /dev/null @@ -1,164 +0,0 @@ -[gdb/testsuite] Handle runto fail in gdb.mi/mi-var-cp.exp - -On OBS I ran into: -... -PASS: gdb.mi/mi-var-cp.exp: run to mi-var-cp.cc:81 (set breakpoint) -UNRESOLVED: gdb.mi/mi-var-cp.exp: unable to start target -... -followed by 81 FAILs and two more UNRESOLVEDs. - -I didn't manage to reproduce this, but I did notice that the initial -problem causing the UNRESOLVED caused all subsequent UNRESOLVEDs and FAILs. - -I emulated the problem by commenting out the send_gdb "run\n" in -mi_run_cmd_full. - -Fix this by: -- handling mi_run_cmd failure in mi_get_inline_test -- handling mi_run_inline_test failure in gdb.mi/mi-var-cp.exp, and - other test-cases using mi_get_inline_test - -Tested on x86_64-linux. - ---- - gdb/testsuite/gdb.mi/mi-var-child.exp | 4 +++- - gdb/testsuite/gdb.mi/mi-var-cmd.exp | 18 ++++++++++++++---- - gdb/testsuite/gdb.mi/mi-var-cp.exp | 18 +++++++++++++----- - gdb/testsuite/gdb.mi/mi-var-rtti.exp | 22 +++++++++++++++------- - gdb/testsuite/lib/mi-support.exp | 6 +++++- - 5 files changed, 50 insertions(+), 18 deletions(-) - -diff --git a/gdb/testsuite/gdb.mi/mi-var-child.exp b/gdb/testsuite/gdb.mi/mi-var-child.exp -index 8632fe26cf8..63cea065c3f 100644 ---- a/gdb/testsuite/gdb.mi/mi-var-child.exp -+++ b/gdb/testsuite/gdb.mi/mi-var-child.exp -@@ -1205,7 +1205,9 @@ mi_varobj_update * {psnp->ptrs.0.next.next.long_ptr} \ - - mi_prepare_inline_tests $srcfile - --mi_run_inline_test child_deletion -+if { [mi_run_inline_test child_deletion] < 0 } { -+ return -1 -+} - - - mi_gdb_exit -diff --git a/gdb/testsuite/gdb.mi/mi-var-cmd.exp b/gdb/testsuite/gdb.mi/mi-var-cmd.exp -index fe0826d480d..fbf57aa25ac 100644 ---- a/gdb/testsuite/gdb.mi/mi-var-cmd.exp -+++ b/gdb/testsuite/gdb.mi/mi-var-cmd.exp -@@ -587,14 +587,24 @@ proc set_frozen {varobjs flag} { - } - - mi_prepare_inline_tests $srcfile --mi_run_inline_test frozen - --mi_run_inline_test bitfield -+set inline_tests { -+ frozen -+ bitfield -+} -+ -+# Needs to be last, following tests rely on this. -+lappend inline_tests floating -+ -+foreach inline_test $inline_tests { -+ if { [mi_run_inline_test $inline_test] < 0 } { -+ return -1 -+ } -+} - - # Since the inline test framework does not really work with --# function calls, first to inline tests and then do the reminder -+# function calls, first to inline tests and then do the remainder - # manually. --mi_run_inline_test floating - set do_at_tests_callee_breakpoint [gdb_get_line_number "breakpoint inside callee"] - mi_gdb_test "-break-insert var-cmd.c:$do_at_tests_callee_breakpoint" ".*" \ - "inside breakpoint inside callee" -diff --git a/gdb/testsuite/gdb.mi/mi-var-cp.exp b/gdb/testsuite/gdb.mi/mi-var-cp.exp -index 4e8abe8d961..8fdd0f863a7 100644 ---- a/gdb/testsuite/gdb.mi/mi-var-cp.exp -+++ b/gdb/testsuite/gdb.mi/mi-var-cp.exp -@@ -38,11 +38,19 @@ mi_gdb_load ${binfile} - - mi_prepare_inline_tests $srcfile - --mi_run_inline_test reference_update --mi_run_inline_test base_in_reference --mi_run_inline_test reference_to_pointer --mi_run_inline_test reference_to_struct --mi_run_inline_test path_expression -+set inline_tests { -+ reference_update -+ base_in_reference -+ reference_to_pointer -+ reference_to_struct -+ path_expression -+} -+ -+foreach inline_test $inline_tests { -+ if { [mi_run_inline_test $inline_test] < 0 } { -+ return -1 -+ } -+} - - set lineno [gdb_get_line_number "/* anonymous_structs_and_unions */"] - mi_create_breakpoint "$srcfile:$lineno" \ -diff --git a/gdb/testsuite/gdb.mi/mi-var-rtti.exp b/gdb/testsuite/gdb.mi/mi-var-rtti.exp -index b574e5c4edb..a0a2e132aaf 100644 ---- a/gdb/testsuite/gdb.mi/mi-var-rtti.exp -+++ b/gdb/testsuite/gdb.mi/mi-var-rtti.exp -@@ -109,13 +109,21 @@ proc check_new_derived_with_rtti {var_name var_type testname} { - "delete varobj for ${var_name} (with RTTI) in $testname" - } - --mi_run_inline_test use_rtti_for_ptr --mi_run_inline_test use_rtti_for_ref --mi_run_inline_test use_rtti_for_ptr_child --mi_run_inline_test use_rtti_for_ref_child --mi_run_inline_test use_rtti_with_multiple_inheritence --mi_run_inline_test type_update_when_use_rtti --mi_run_inline_test skip_type_update_when_not_use_rtti -+set inline_tests { -+ use_rtti_for_ptr -+ use_rtti_for_ref -+ use_rtti_for_ptr_child -+ use_rtti_for_ref_child -+ use_rtti_with_multiple_inheritence -+ type_update_when_use_rtti -+ skip_type_update_when_not_use_rtti -+} -+ -+foreach inline_test $inline_tests { -+ if { [mi_run_inline_test $inline_test] < 0 } { -+ return -1 -+ } -+} - - mi_gdb_exit - return 0 -diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-support.exp -index 288c651d4d4..28e23b11005 100644 ---- a/gdb/testsuite/lib/mi-support.exp -+++ b/gdb/testsuite/lib/mi-support.exp -@@ -1945,7 +1945,9 @@ proc mi_run_inline_test { testcase } { - if {$first==1} { - # Start the program afresh. - mi_tbreak "$mi_autotest_source:$line" -- mi_run_cmd -+ if { [mi_run_cmd] < 0 } { -+ return -1 -+ } - set line_now [mi_get_stop_line "$testcase: step to $line"] - set first 0 - } elseif {$line_now!=$line} { -@@ -1972,6 +1974,8 @@ proc mi_run_inline_test { testcase } { - # will need more experience to be sure. - eval $statements - } -+ -+ return 0 - } - - proc get_mi_thread_list {name} { diff --git a/gdb-testsuite-handle-sigill-in-two-gdb.arch-powerpc-test-cases.patch b/gdb-testsuite-handle-sigill-in-two-gdb.arch-powerpc-test-cases.patch deleted file mode 100644 index 7976e67..0000000 --- a/gdb-testsuite-handle-sigill-in-two-gdb.arch-powerpc-test-cases.patch +++ /dev/null @@ -1,73 +0,0 @@ -[gdb/testsuite] Handle SIGILL in two gdb.arch powerpc test-cases - -On powerpc64le-linux, with test-case gdb.arch/powerpc-addpcis.exp I run into -SIGILL: -... -(gdb) PASS: gdb.arch/powerpc-addpcis.exp: get hexadecimal valueof "$r3" -stepi^M -^M -Program terminated with signal SIGILL, Illegal instruction.^M -The program no longer exists.^M -(gdb) PASS: gdb.arch/powerpc-addpcis.exp: set r4 -... -because it's a power9 insn, and I'm running on a power8 machine. - -Fix this by handling the SIGILL. Likewise in gdb.arch/powerpc-lnia.exp. - -Tested on powerpc64le-linux. - ---- - gdb/testsuite/gdb.arch/powerpc-addpcis.exp | 14 +++++++++++++- - gdb/testsuite/gdb.arch/powerpc-lnia.exp | 14 +++++++++++++- - 2 files changed, 26 insertions(+), 2 deletions(-) - -diff --git a/gdb/testsuite/gdb.arch/powerpc-addpcis.exp b/gdb/testsuite/gdb.arch/powerpc-addpcis.exp -index d1bc7f49ce6..ff7052ce475 100644 ---- a/gdb/testsuite/gdb.arch/powerpc-addpcis.exp -+++ b/gdb/testsuite/gdb.arch/powerpc-addpcis.exp -@@ -50,7 +50,19 @@ gdb_breakpoint $bp1 - gdb_breakpoint $bp2 - gdb_breakpoint $bp3 - --gdb_test "stepi" "" "set r3 " -+set insn_supported 1 -+gdb_test_multiple "stepi" "set r3" { -+ -re "Program received signal SIGILL, Illegal instruction\\..*" { -+ set insn_supported 0 -+ } -+ -re -wrap "" { -+ pass $gdb_test_name -+ } -+} -+if { ! $insn_supported } { -+ unsupported "illegal instruction" -+ return -+} - set check_r3 [get_hexadecimal_valueof "\$r3" "default0"] - gdb_test "stepi" "" "set r4" - set check_r4 [get_hexadecimal_valueof "\$r4" "default0"] -diff --git a/gdb/testsuite/gdb.arch/powerpc-lnia.exp b/gdb/testsuite/gdb.arch/powerpc-lnia.exp -index 0f56d834046..4ab4f8d92be 100644 ---- a/gdb/testsuite/gdb.arch/powerpc-lnia.exp -+++ b/gdb/testsuite/gdb.arch/powerpc-lnia.exp -@@ -54,7 +54,19 @@ gdb_breakpoint $bp3 - - # single-step through the lnia instructions, and retrieve the - # register values as we proceed. --gdb_test "stepi" "" "set r3" -+set insn_supported 1 -+gdb_test_multiple "stepi" "set r3" { -+ -re "Program received signal SIGILL, Illegal instruction\\..*" { -+ set insn_supported 0 -+ } -+ -re -wrap "" { -+ pass $gdb_test_name -+ } -+} -+if { ! $insn_supported } { -+ unsupported "illegal instruction" -+ return -+} - set check_r3 [get_hexadecimal_valueof "\$r3" "default0"] - gdb_test "stepi" "" "set r4" - set check_r4 [get_hexadecimal_valueof "\$r4" "default0"] diff --git a/gdb-testsuite-handle-supports_memtag-in-gdb.base-gdb-caching-proc.exp.patch b/gdb-testsuite-handle-supports_memtag-in-gdb.base-gdb-caching-proc.exp.patch deleted file mode 100644 index 9ff1c98..0000000 --- a/gdb-testsuite-handle-supports_memtag-in-gdb.base-gdb-caching-proc.exp.patch +++ /dev/null @@ -1,56 +0,0 @@ -[gdb/testsuite] Handle supports_memtag in gdb.base/gdb-caching-proc.exp - -In test-case gdb.base/gdb-caching-proc.exp, we run all procs declared with -gdb_caching_proc. Some of these require a gdb instance, some not. - -We could just do a clean_restart every time, but that would amount to 44 gdb -restarts. We try to minimize this by doing this only for the few procs that -need it, and hardcoding those in the test-case. - -For those procs, we do a clean_restart, execute the proc, and then do a -gdb_exit, to make sure the gdb instance doesn't linger such that we detect -procs that need a gdb instance but are not listed in the test-case. - -However, that doesn't work in the case of gnat_runtime_has_debug_info. This -proc doesn't require a gdb instance because it starts its own. But it doesn't -clean up the gdb instance, and since it's not listed, the test-case -doesn't clean up the gdb instance eiter. Consequently, the proc -supports_memtag (which should be listed, but isn't) uses the gdb instance -started by gnat_runtime_has_debug_info rather than throwing an error. Well, -unless gnat_runtime_has_debug_info fails before starting a gdb instance, in -which case we do run into the error. - -Fix this by: -- doing gdb_exit unconditionally -- fixing the resulting error by adding supports_memtag in the test-case to - the "needing gdb instance" list - -Tested on x86_64-linux. - ---- - gdb/testsuite/gdb.base/gdb-caching-proc.exp | 5 ++--- - 1 file changed, 2 insertions(+), 3 deletions(-) - -diff --git a/gdb/testsuite/gdb.base/gdb-caching-proc.exp b/gdb/testsuite/gdb.base/gdb-caching-proc.exp -index 82675dfc061..a3f08f5db32 100644 ---- a/gdb/testsuite/gdb.base/gdb-caching-proc.exp -+++ b/gdb/testsuite/gdb.base/gdb-caching-proc.exp -@@ -85,6 +85,7 @@ proc test_file { file } { - switch $procname { - "is_address_zero_readable" { set setup_gdb 1 } - "target_is_gdbserver" { set setup_gdb 1 } -+ "supports_memtag" { set setup_gdb 1 } - default {set setup_gdb 0 } - } - -@@ -94,9 +95,7 @@ proc test_file { file } { - - test_proc $procname - -- if { $setup_gdb } { -- gdb_exit -- } -+ gdb_exit - } - } - } diff --git a/gdb-testsuite-handle-unordered-dict-in-gdb.python-py-mi-cmd.exp.patch b/gdb-testsuite-handle-unordered-dict-in-gdb.python-py-mi-cmd.exp.patch new file mode 100644 index 0000000..dedc093 --- /dev/null +++ b/gdb-testsuite-handle-unordered-dict-in-gdb.python-py-mi-cmd.exp.patch @@ -0,0 +1,48 @@ +[gdb/testsuite] Handle unordered dict in gdb.python/py-mi-cmd.exp + +When running test-case gdb.python/py-mi-cmd.exp on openSUSE Leap 42.3 with +python 3.4, I occasionally run into: +... +Expecting: ^(-pycmd dct[^M +]+)?(\^done,result={hello="world",times="42"}[^M +]+[(]gdb[)] ^M +[ ]*) +-pycmd dct^M +^done,result={times="42",hello="world"}^M +(gdb) ^M +FAIL: gdb.python/py-mi-cmd.exp: -pycmd dct (unexpected output) +... + +The problem is that the data type used here in py-mi-cmd.py: +... + elif argv[0] == "dct": + return {"result": {"hello": "world", "times": 42}} +... +is a dictionary, and only starting version 3.6 are dictionaries insertion +ordered, so using PyDict_Next in serialize_mi_result doesn't guarantee a +fixed order. + +Fix this by allowing the alternative order. + +Tested on x86_64-linux. + +--- + gdb/testsuite/gdb.python/py-mi-cmd.exp | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/gdb/testsuite/gdb.python/py-mi-cmd.exp b/gdb/testsuite/gdb.python/py-mi-cmd.exp +index 300ab956892..45278bada7c 100644 +--- a/gdb/testsuite/gdb.python/py-mi-cmd.exp ++++ b/gdb/testsuite/gdb.python/py-mi-cmd.exp +@@ -54,8 +54,10 @@ mi_gdb_test "-pycmd ary" \ + "\\^done,result=\\\[\"Hello\",\"42\"\\\]" \ + "-pycmd ary" + ++set re_order1 "\\^done,result={hello=\"world\",times=\"42\"}" ++set re_order2 "\\^done,result={times=\"42\",hello=\"world\"}" + mi_gdb_test "-pycmd dct" \ +- "\\^done,result={hello=\"world\",times=\"42\"}" \ ++ "($re_order1|$re_order2)" \ + "-pycmd dct" + + mi_gdb_test "-pycmd bk1" \ diff --git a/gdb-testsuite-make-gdb.base-annota1.exp-more-robust.patch b/gdb-testsuite-make-gdb.base-annota1.exp-more-robust.patch deleted file mode 100644 index 90a3768..0000000 --- a/gdb-testsuite-make-gdb.base-annota1.exp-more-robust.patch +++ /dev/null @@ -1,127 +0,0 @@ -[gdb/testsuite] Make gdb.base/annota1.exp more robust - -On openSUSE Tumbleweed I run into: -... -FAIL: gdb.base/annota1.exp: run until main breakpoint (timeout) -... - -The problem is that the libthread_db message occurs at a location where it's -not expected: -... -Starting program: outputs/gdb.base/annota1/annota1 ^M -^M -^Z^Zstarting^M -^M -^Z^Zframes-invalid^M -[Thread debugging using libthread_db enabled]^M -Using host libthread_db library "/lib64/libthread_db.so.1".^M -^M -^Z^Zbreakpoints-invalid^M -^M -... - -Fix this by making the matching more robust: -- rewrite the regexp such that each annotation is on a single line, - starting with \r\n\032\032 and ending with \r\n -- add a regexp variable optional_re, that matches all possible optional - output, and use it as a separator in the first part of the regexp - -Tested on x86_64-linux. - ---- - gdb/testsuite/gdb.base/annota1.exp | 71 +++++++++++++++++++++++++------------- - 1 file changed, 47 insertions(+), 24 deletions(-) - -diff --git a/gdb/testsuite/gdb.base/annota1.exp b/gdb/testsuite/gdb.base/annota1.exp -index cf0b93e01a3..019c8048fd0 100644 ---- a/gdb/testsuite/gdb.base/annota1.exp -+++ b/gdb/testsuite/gdb.base/annota1.exp -@@ -128,41 +128,64 @@ gdb_test_multiple "info break" "breakpoint info" { - set binexp [string_to_regexp $binfile] - - set warning_slow_re \ -- "warning: File transfers from remote targets can be slow\[^\r\n\]+" -+ "warning: File transfers from remote targets can be slow\[^\r\n\]+\r\n" - set warning_gdb_index_re \ - [multi_line \ - "warning: Skipping \[^\r\n\]+ .gdb_index section in \[^\r\n\]+" \ - "Do \"set use-deprecated-index-sections on\" before the file is read" \ -- "to use the section anyway\\."] -+ "to use the section anyway\\.\r\n"] - set reading_re \ -- "Reading \[^\r\n\]+" -+ "Reading \[^\r\n\]+\r\n" - set libthread_db_re \ - [multi_line \ - "\\\[Thread debugging using libthread_db enabled\\\]" \ -- "Using host libthread_db library \[^\r\n\]+"] -+ "Using host libthread_db library \[^\r\n\]+\r\n"] - --set run_re \ -+set optional_re \ - [list \ -- "\r\n\032\032post-prompt\r\nStarting program: $binexp " \ -- "\(\(\r\n$reading_re\)|\(\r\n$warning_slow_re\)\)*" \ -+ "\(" \ -+ "\($reading_re)" \ -+ "|" \ -+ "\($warning_slow_re\)" \ -+ "|" \ -+ "\($libthread_db_re\)" \ -+ "|" \ - "\(\r\n$warning_gdb_index_re\)?" \ -- "\(\(\r\n\r\n\032\032frames-invalid\)|\(\r\n\r\n\032\032breakpoints-invalid\)\)*\r\n\r\n" \ -- "\032\032starting\(\(\r\n$reading_re\)|\(\r\n$warning_slow_re\)|\r\n$libthread_db_re\)*" \ -- "\(\(\r\n\r\n\032\032frames-invalid\)|\(\r\n\r\n\032\032breakpoints-invalid\)\)*\r\n\r\n" \ -- "\032\032breakpoint 1\r\n\r\n" \ -- "Breakpoint 1, \r\n" \ -- "\032\032frame-begin 0 $hex\r\n\r\n" \ -- "\032\032frame-function-name\r\n" \ -- "main\r\n" \ -- "\032\032frame-args\r\n \\(\\)\r\n" \ -- "\032\032frame-source-begin\r\n at \r\n" \ -- "\032\032frame-source-file\r\n.*annota1.c\r\n" \ -- "\032\032frame-source-file-end\r\n:\r\n" \ -- "\032\032frame-source-line\r\n$main_line\r\n" \ -- "\032\032frame-source-end\r\n\r\n\r\n" \ -- "\032\032source.*$srcfile:$main_line:.*:beg:$hex\r\n\r\n" \ -- "\032\032frame-end\r\n\r\n" \ -- "\032\032stopped"] -+ "\)*"] -+set optional_re [join $optional_re ""] -+ -+set run_re \ -+ [list \ -+ "\r\n\032\032post-prompt\r\n" \ -+ "Starting program: $binexp \r\n" \ -+ $optional_re \ -+ "\r\n\032\032starting\r\n" \ -+ $optional_re \ -+ "\r\n\032\032frames-invalid\r\n" \ -+ $optional_re \ -+ "\r\n\032\032breakpoints-invalid\r\n" \ -+ $optional_re \ -+ "\r\n\032\032breakpoint 1\r\n" \ -+ "\r\n" \ -+ "Breakpoint 1, " \ -+ "\r\n\032\032frame-begin 0 $hex\r\n" \ -+ "\r\n\032\032frame-function-name\r\n" \ -+ "main" \ -+ "\r\n\032\032frame-args\r\n" \ -+ " \\(\\)" \ -+ "\r\n\032\032frame-source-begin\r\n" \ -+ " at " \ -+ "\r\n\032\032frame-source-file\r\n" \ -+ ".*annota1.c" \ -+ "\r\n\032\032frame-source-file-end\r\n" \ -+ ":" \ -+ "\r\n\032\032frame-source-line\r\n" \ -+ "$main_line" \ -+ "\r\n\032\032frame-source-end\r\n" \ -+ "\r\n" \ -+ "\r\n\032\032source.*$srcfile:$main_line:.*:beg:$hex\r\n" \ -+ "\r\n\032\032frame-end\r\n" \ -+ "\r\n\032\032stopped\r\n"] - - set run_re [join $run_re ""] - diff --git a/gdb-testsuite-refactor-regexp-in-gdb.base-annota1.exp.patch b/gdb-testsuite-refactor-regexp-in-gdb.base-annota1.exp.patch deleted file mode 100644 index 8d4ee2d..0000000 --- a/gdb-testsuite-refactor-regexp-in-gdb.base-annota1.exp.patch +++ /dev/null @@ -1,79 +0,0 @@ -[gdb/testsuite] Refactor regexp in gdb.base/annota1.exp - -Refactor regexp in gdb.base/annota1.exp to reduce indentation and repetition. - -Tested on x86_64-linux. - ---- - gdb/testsuite/gdb.base/annota1.exp | 56 ++++++++++++++++++++++++-------------- - 1 file changed, 35 insertions(+), 21 deletions(-) - -diff --git a/gdb/testsuite/gdb.base/annota1.exp b/gdb/testsuite/gdb.base/annota1.exp -index 383a0f4e607..6e30c164ec9 100644 ---- a/gdb/testsuite/gdb.base/annota1.exp -+++ b/gdb/testsuite/gdb.base/annota1.exp -@@ -129,29 +129,43 @@ gdb_test_multiple "info break" "breakpoint info" { - #exp_internal 1 - set binexp [string_to_regexp $binfile] - --set run_re [join [list "\r\n\032\032post-prompt\r\nStarting program: $binexp " \ -- "\(\(\r\nReading \[^\r\n\]+\)|\(\r\nwarning: File transfers from remote targets can be slow\[^\r\n\]+\)\)*" \ -- "\(\r\nwarning: Skipping \[^\r\n\]+ .gdb_index section in \[^\r\n\]+\r\nDo \"set use-deprecated-index-sections on\" before the file is read\r\nto use the section anyway\\.\)?" \ -- "\(\(\r\n\r\n\032\032frames-invalid\)|\(\r\n\r\n\032\032breakpoints-invalid\)\)*\r\n\r\n" \ -- "\032\032starting\(\(\r\nReading \[^\r\n\]+\)|\(\r\nwarning: File transfers from remote targets can be slow\[^\r\n\]+\)\)*" \ -- "\(\(\r\n\r\n\032\032frames-invalid\)|\(\r\n\r\n\032\032breakpoints-invalid\)\)*\r\n\r\n" \ -- "\032\032breakpoint 1\r\n\r\n" \ -- "Breakpoint 1, \r\n" \ -- "\032\032frame-begin 0 $hex\r\n\r\n" \ -- "\032\032frame-function-name\r\n" \ -- "main\r\n" \ -- "\032\032frame-args\r\n \\(\\)\r\n" \ -- "\032\032frame-source-begin\r\n at \r\n" \ -- "\032\032frame-source-file\r\n.*annota1.c\r\n" \ -- "\032\032frame-source-file-end\r\n:\r\n" \ -- "\032\032frame-source-line\r\n$main_line\r\n" \ -- "\032\032frame-source-end\r\n\r\n\r\n" \ -- "\032\032source.*$srcfile:$main_line:.*:beg:$hex\r\n\r\n" \ -- "\032\032frame-end\r\n\r\n" \ -- "\032\032stopped.*$gdb_prompt$" ] "" ] -+set warning_slow_re \ -+ "warning: File transfers from remote targets can be slow\[^\r\n\]+" -+set warning_gdb_index_re \ -+ [multi_line \ -+ "warning: Skipping \[^\r\n\]+ .gdb_index section in \[^\r\n\]+" \ -+ "Do \"set use-deprecated-index-sections on\" before the file is read" \ -+ "to use the section anyway\\."] -+set reading_re \ -+ "Reading \[^\r\n\]+" -+ -+set run_re \ -+ [list \ -+ "\r\n\032\032post-prompt\r\nStarting program: $binexp " \ -+ "\(\(\r\n$reading_re\)|\(\r\n$warning_slow_re\)\)*" \ -+ "\(\r\n$warning_gdb_index_re\)?" \ -+ "\(\(\r\n\r\n\032\032frames-invalid\)|\(\r\n\r\n\032\032breakpoints-invalid\)\)*\r\n\r\n" \ -+ "\032\032starting\(\(\r\n$reading_re\)|\(\r\n$warning_slow_re\)\)*" \ -+ "\(\(\r\n\r\n\032\032frames-invalid\)|\(\r\n\r\n\032\032breakpoints-invalid\)\)*\r\n\r\n" \ -+ "\032\032breakpoint 1\r\n\r\n" \ -+ "Breakpoint 1, \r\n" \ -+ "\032\032frame-begin 0 $hex\r\n\r\n" \ -+ "\032\032frame-function-name\r\n" \ -+ "main\r\n" \ -+ "\032\032frame-args\r\n \\(\\)\r\n" \ -+ "\032\032frame-source-begin\r\n at \r\n" \ -+ "\032\032frame-source-file\r\n.*annota1.c\r\n" \ -+ "\032\032frame-source-file-end\r\n:\r\n" \ -+ "\032\032frame-source-line\r\n$main_line\r\n" \ -+ "\032\032frame-source-end\r\n\r\n\r\n" \ -+ "\032\032source.*$srcfile:$main_line:.*:beg:$hex\r\n\r\n" \ -+ "\032\032frame-end\r\n\r\n" \ -+ "\032\032stopped"] -+ -+set run_re [join $run_re ""] - - gdb_test_multiple "run" "run until main breakpoint" { -- -re $run_re { -+ -re $run_re.*$gdb_prompt$ { - pass $gdb_test_name - } - } diff --git a/gdb-testsuite-remove-attach-test-from-can_spawn_for_attach.patch b/gdb-testsuite-remove-attach-test-from-can_spawn_for_attach.patch new file mode 100644 index 0000000..aa6eded --- /dev/null +++ b/gdb-testsuite-remove-attach-test-from-can_spawn_for_attach.patch @@ -0,0 +1,99 @@ +gdb: testsuite: remove attach test from can_spawn_for_attach + +As Pedro Alves said, caching procs should not issue pass/fail [1], +this commit removes attach test from can_spawn_for_attach, at the +same time, use "verbose -log" instead of "unsupported" to get a +trace about why a test run doesn't support spawning for attach. + +[1] https://sourceware.org/pipermail/gdb-patches/2022-March/186311.html + +Signed-off-by: Tiezhu Yang + +--- + gdb/testsuite/lib/gdb.exp | 52 ++++++++--------------------------------------- + 1 file changed, 9 insertions(+), 43 deletions(-) + +diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp +index f8cd2292170..01744cae7e2 100644 +--- a/gdb/testsuite/lib/gdb.exp ++++ b/gdb/testsuite/lib/gdb.exp +@@ -5096,12 +5096,12 @@ proc gdb_exit { } { + # Return true if we can spawn a program on the target and attach to + # it. + +-gdb_caching_proc can_spawn_for_attach { ++proc can_spawn_for_attach { } { + # We use exp_pid to get the inferior's pid, assuming that gives + # back the pid of the program. On remote boards, that would give + # us instead the PID of e.g., the ssh client, etc. + if [is_remote target] then { +- unsupported "skip attach tests (target is remote)" ++ verbose -log "can't spawn for attach (target is remote)" + return 0 + } + +@@ -5109,50 +5109,10 @@ gdb_caching_proc can_spawn_for_attach { + # stub-like, where GDB finds the program already started on + # initial connection. + if {[target_info exists use_gdb_stub]} { +- unsupported "skip attach tests (target is stub)" ++ verbose -log "can't spawn for attach (target is stub)" + return 0 + } + +- set me "can_spawn_for_attach" +- set src { int main (void) { sleep (600); return 0; } } +- if {![gdb_simple_compile $me $src executable]} { +- return 0 +- } +- +- set test_spawn_id [spawn_wait_for_attach $obj] +- set test_pid [spawn_id_get_pid $test_spawn_id] +- +- gdb_start +- file delete $obj +- gdb_test_multiple "attach $test_pid" "can spawn for attach" { +- -re -wrap "Attaching to process $test_pid\r\n.*No executable file now.*" { +- pass $gdb_test_name +- kill_wait_spawned_process $test_spawn_id +- return 1 +- } +- -re -wrap "Attaching to process $test_pid\r\n.*ptrace: Operation not permitted\\." { +- unsupported "$gdb_test_name (Operation not permitted)" +- kill_wait_spawned_process $test_spawn_id +- return 0 +- } +- -re -wrap "Attaching to process $test_pid\r\n.*Attaching to process $test_pid failed" { +- unsupported "$gdb_test_name (Attaching to process failed)" +- kill_wait_spawned_process $test_spawn_id +- return 0 +- } +- -re -wrap "Attaching to process $test_pid\r\n.*XML support was disabled at compile time.*" { +- pass $gdb_test_name +- kill_wait_spawned_process $test_spawn_id +- return 1 +- } +- -re "A program is being debugged already. Kill it. .y or n. " { +- send_gdb "y\n" +- exp_continue +- } +- } +- +- kill_wait_spawned_process $test_spawn_id +- + # Assume yes. + return 1 + } +@@ -5202,6 +5162,12 @@ proc spawn_id_get_pid { spawn_id } { + proc spawn_wait_for_attach { executable_list } { + set spawn_id_list {} + ++ if ![can_spawn_for_attach] { ++ # The caller should have checked can_spawn_for_attach itself ++ # before getting here. ++ error "can't spawn for attach with this target/board" ++ } ++ + foreach {executable} $executable_list { + # Note we use Expect's spawn, not Tcl's exec, because with + # spawn we control when to wait for/reap the process. That diff --git a/gdb-testsuite-remove-target-limits-in-gdb.base-catch-syscall.exp.patch b/gdb-testsuite-remove-target-limits-in-gdb.base-catch-syscall.exp.patch new file mode 100644 index 0000000..832dae7 --- /dev/null +++ b/gdb-testsuite-remove-target-limits-in-gdb.base-catch-syscall.exp.patch @@ -0,0 +1,158 @@ +[gdb/testsuite] Remove target limits in gdb.base/catch-syscall.exp + +In test-case gdb.base/catch-syscall.exp, proc test_catch_syscall_multi_arch we +test for supported targets using istarget, like so: +... + if { [istarget "i*86-*-*"] || [istarget "x86_64-*-*"] } { + ... + } elseif { [istarget "powerpc-*-linux*"] \ + || [istarget "powerpc64*-linux*"] } { + ... +... +but the tests excercised there can all be executed if gdb is configured with +--enable-targets=all. + +Rewrite the proc to iterate over all cases, and check if the test is supported +by trying "set arch $arch1" and "set arch $arch2". + +Tested on x86_64-linux, with: +- a gdb build with --enable-targets=all, and +- a gdb build build with my usual --enable-targets setting (too long to + include here) which means the sparc vs sparc:v9 case is unsupported. + +--- + gdb/testsuite/gdb.base/catch-syscall.exp | 106 ++++++++++++++++++------------- + 1 file changed, 61 insertions(+), 45 deletions(-) + +diff --git a/gdb/testsuite/gdb.base/catch-syscall.exp b/gdb/testsuite/gdb.base/catch-syscall.exp +index a5dfd02411b..939cf4876b6 100644 +--- a/gdb/testsuite/gdb.base/catch-syscall.exp ++++ b/gdb/testsuite/gdb.base/catch-syscall.exp +@@ -565,59 +565,33 @@ proc test_catch_syscall_with_wrong_args_noxml {} { + } + } + +-proc test_catch_syscall_multi_arch {} { ++proc test_catch_syscall_multi_arch_1 { ++ arch1 arch2 syscall1_name syscall2_name syscall_number ++} { + global decimal binfile + +- if { [istarget "i*86-*-*"] || [istarget "x86_64-*-*"] } { +- set arch1 "i386" +- set arch2 "i386:x86-64" +- set syscall1_name "exit" +- set syscall2_name "write" +- set syscall_number 1 +- } elseif { [istarget "powerpc-*-linux*"] \ +- || [istarget "powerpc64*-linux*"] } { +- set arch1 "powerpc:common" +- set arch2 "powerpc:common64" +- set syscall1_name "openat" +- set syscall2_name "unlinkat" +- set syscall_number 286 +- } elseif { [istarget "sparc-*-linux*"] \ +- || [istarget "sparc64-*-linux*"] } { +- set arch1 "sparc" +- set arch2 "sparc:v9" +- set syscall1_name "setresuid32" +- set syscall2_name "setresuid" +- set syscall_number 108 +- } elseif { [istarget "mips*-linux*"] } { +- # MIPS does not use the same numbers for syscalls on 32 and 64 +- # bits. +- verbose "Not testing MIPS for multi-arch syscall support" +- return +- } elseif { [istarget "arm*-linux*"] } { +- # catch syscall supports only 32-bit ARM for now. +- verbose "Not testing ARM for multi-arch syscall support" +- return +- } elseif { [istarget "aarch64*-linux*"] } { +- set arch1 "aarch64" +- set arch2 "arm" +- set syscall1_name "reboot" +- set syscall2_name "_newselect" +- set syscall_number 142 +- } elseif { [istarget "s390*-linux*"] } { +- set arch1 "s390:31-bit" +- set arch2 "s390:64-bit" +- set syscall1_name "_newselect" +- set syscall2_name "select" +- set syscall_number 142 +- } +- +- with_test_prefix "multiple targets" { ++ with_test_prefix "multiple targets: $arch1 vs $arch2" { + # We are not interested in loading any binary here, and in + # some systems (PowerPC, for example), if we load a binary + # there is no way to set other architecture. + gdb_exit + gdb_start + ++ set supported 1 ++ foreach arch [list $arch1 $arch2] { ++ gdb_test_multiple "set architecture $arch" "" { ++ -re -wrap "Undefined item: \"$arch\"\\." { ++ set supported 0 ++ unsupported $gdb_test_name ++ } ++ -re -wrap "The target architecture is set to \"$arch\"\\." { ++ } ++ } ++ } ++ if { $supported == 0 } { ++ return ++ } ++ + gdb_test "set architecture $arch1" \ + "The target architecture is set to \"$arch1\"\\." + +@@ -636,6 +610,48 @@ proc test_catch_syscall_multi_arch {} { + } + } + ++proc test_catch_syscall_multi_arch {} { ++ set arch1 "i386" ++ set arch2 "i386:x86-64" ++ set syscall1_name "exit" ++ set syscall2_name "write" ++ set syscall_number 1 ++ test_catch_syscall_multi_arch_1 $arch1 $arch2 $syscall1_name \ ++ $syscall2_name $syscall_number ++ ++ set arch1 "powerpc:common" ++ set arch2 "powerpc:common64" ++ set syscall1_name "openat" ++ set syscall2_name "unlinkat" ++ set syscall_number 286 ++ test_catch_syscall_multi_arch_1 $arch1 $arch2 $syscall1_name \ ++ $syscall2_name $syscall_number ++ ++ set arch1 "sparc" ++ set arch2 "sparc:v9" ++ set syscall1_name "setresuid32" ++ set syscall2_name "setresuid" ++ set syscall_number 108 ++ test_catch_syscall_multi_arch_1 $arch1 $arch2 $syscall1_name \ ++ $syscall2_name $syscall_number ++ ++ set arch1 "aarch64" ++ set arch2 "arm" ++ set syscall1_name "reboot" ++ set syscall2_name "_newselect" ++ set syscall_number 142 ++ test_catch_syscall_multi_arch_1 $arch1 $arch2 $syscall1_name \ ++ $syscall2_name $syscall_number ++ ++ set arch1 "s390:31-bit" ++ set arch2 "s390:64-bit" ++ set syscall1_name "_newselect" ++ set syscall2_name "select" ++ set syscall_number 142 ++ test_catch_syscall_multi_arch_1 $arch1 $arch2 $syscall1_name \ ++ $syscall2_name $syscall_number ++} ++ + proc do_syscall_tests_without_xml {} { + # Make sure GDB doesn't load the syscalls xml from the system data + # directory. diff --git a/gdb-testsuite-skip-gdb.fortran-namelist.exp-for-gfortran-4.8.patch b/gdb-testsuite-skip-gdb.fortran-namelist.exp-for-gfortran-4.8.patch new file mode 100644 index 0000000..d298b6f --- /dev/null +++ b/gdb-testsuite-skip-gdb.fortran-namelist.exp-for-gfortran-4.8.patch @@ -0,0 +1,32 @@ +[gdb/testsuite] Skip gdb.fortran/namelist.exp for gfortran 4.8 + +The test-case gdb.fortran/namelist.exp uses a gfortran feature (emitting +DW_TAG_namelist in the debug info) that has been supported since gfortran 4.9, +see PR gcc/37132. + +Skip the test for gfortran 4.8 and earlier. Do this using gcc_major_version, +and update it to be able to handle "gcc_major_version {gfortran-*} f90". + +Tested on x86_64-linux, with gfortran 4.8.5, 7.5.0, and 12.1.1. + +--- + gdb/testsuite/gdb.fortran/namelist.exp | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/gdb/testsuite/gdb.fortran/namelist.exp b/gdb/testsuite/gdb.fortran/namelist.exp +index d6263e12fec..464f2f84fc2 100644 +--- a/gdb/testsuite/gdb.fortran/namelist.exp ++++ b/gdb/testsuite/gdb.fortran/namelist.exp +@@ -37,7 +37,11 @@ set int [fortran_int4] + gdb_breakpoint [gdb_get_line_number "Display namelist"] + gdb_continue_to_breakpoint "Display namelist" + +-if {[test_compiler_info {gcc-*}]} { ++# DW_TAG_namelist is supported starting gcc 4.9. ++set supported [expr \ ++ [test_compiler_info {gcc-*}] \ ++ && [gcc_major_version] >= 4.9] ++if { $supported } { + gdb_test "ptype nml" \ + "type = Type nml\r\n *$int :: a\r\n *$int :: b\r\n *End Type nml" + gdb_test "print nml" \ diff --git a/gdb-testsuite-support-fpie-fno-pie-pie-no-pie-in-gdb_compile_rust.patch b/gdb-testsuite-support-fpie-fno-pie-pie-no-pie-in-gdb_compile_rust.patch deleted file mode 100644 index 13de7e8..0000000 --- a/gdb-testsuite-support-fpie-fno-pie-pie-no-pie-in-gdb_compile_rust.patch +++ /dev/null @@ -1,95 +0,0 @@ -[gdb/testsuite] Support -fPIE/-fno-PIE/-pie/-no-pie in gdb_compile_rust - -When running gdb.rust/*.exp test-cases with target board unix/-fPIE/-pie, I -run into: -... -builtin_spawn -ignore SIGHUP rustc --color never gdb.rust/watch.rs \ - -g -lm -fPIE -pie -o outputs/gdb.rust/watch/watch^M -error: Unrecognized option: 'f'^M -^M -compiler exited with status 1 -... - -The problem is that -fPIE and -fpie are gcc options, but for rust we use -rustc, which has different compilation options. - -Fix this by translating the gcc options to rustc options in gdb_compile_rust, -similar to how that is done for ada in target_compile_ada_from_dir. - -Likewise for unix/-fno-PIE/-no-pie. - -Tested on x86_64-linux, with: -- native -- unix/-fPIE/-pie -- unix/-fno-PIE/-no-pie -specifically, on openSUSE Leap 15.2 both with package gcc-PIE: -- installed (making gcc default to PIE) -- uninstalled (making gcc default to non-PIE). -and rustc 1.52.1. - ---- - gdb/testsuite/lib/rust-support.exp | 47 +++++++++++++++++++++++++++++++++++--- - 1 file changed, 44 insertions(+), 3 deletions(-) - -diff --git a/gdb/testsuite/lib/rust-support.exp b/gdb/testsuite/lib/rust-support.exp -index 2896ac82453..2f78d6dde0e 100644 ---- a/gdb/testsuite/lib/rust-support.exp -+++ b/gdb/testsuite/lib/rust-support.exp -@@ -27,13 +27,54 @@ proc set_lang_rust {} { - } - - proc gdb_compile_rust {sources dest options} { -+ set res -1 -+ - if {[llength $sources] > 1} { - error "gdb rust setup can only compile one source file at a time" - } -- if {[gdb_compile [lindex $sources 0] $dest executable $options] != ""} { -- return -1 -+ -+ global board -+ set board [target_info name] -+ set multilib_flags_orig [board_info $board multilib_flags] -+ set multilib_flags {} -+ foreach op $multilib_flags_orig { -+ # Pretend rustc supports -pie/-no-pie/-fPIE/-fno-PIE. -+ switch $op { -+ "-pie" - "-no-pie" { -+ # Pass it to linker. -+ lappend multilib_flags -C link-arg=$op -+ } -+ "-fno-PIE" { -+ # Translate to rustc codegen equivalent. -+ -+ # The rustc documentation insists that we should use static -+ # here, but that causes segfaults leading to: -+ # UNTESTED: gdb.rust/rawids.exp: could not run to breakpoint -+ # UNTESTED: gdb.rust/pp.exp: could not run to breakpoint -+ # Instead, we use dynamic-no-pic which does seem to work. -+ lappend multilib_flags -C relocation-model=dynamic-no-pic -+ } -+ "-fPIE" { -+ # Translate to rustc codegen equivalent. -+ lappend multilib_flags -C relocation-model=pic -+ } -+ default { -+ # Pass unmodified. -+ lappend multilib_flags $op -+ } -+ } -+ } -+ -+ save_target_board_info { multilib_flags } { -+ unset_board_info multilib_flags -+ set_board_info multilib_flags "$multilib_flags" -+ if {[gdb_compile [lindex $sources 0] $dest executable \ -+ $options] == ""} { -+ set res "" -+ } - } -- return "" -+ -+ return $res - } - - # Return the version of LLVM used by the Rust compiler. Note that diff --git a/gdb-testsuite-support-recording-of-getrandom.patch b/gdb-testsuite-support-recording-of-getrandom.patch new file mode 100644 index 0000000..d3d3ad6 --- /dev/null +++ b/gdb-testsuite-support-recording-of-getrandom.patch @@ -0,0 +1,243 @@ +[gdb/testsuite] Support recording of getrandom + +Add missing support for recording of linux syscall getrandom. + +Tested on x86_64-linux with native and target board unix/-m32. + +--- + gdb/aarch64-linux-tdep.c | 2 ++ + gdb/amd64-linux-tdep.c | 3 ++ + gdb/amd64-linux-tdep.h | 3 +- + gdb/arm-linux-tdep.c | 1 + + gdb/linux-record.c | 6 ++++ + gdb/linux-record.h | 1 + + gdb/ppc-linux-tdep.c | 2 ++ + gdb/s390-linux-tdep.c | 2 ++ + gdb/testsuite/gdb.reverse/getrandom.c | 41 ++++++++++++++++++++++++ + gdb/testsuite/gdb.reverse/getrandom.exp | 56 +++++++++++++++++++++++++++++++++ + 10 files changed, 116 insertions(+), 1 deletion(-) + +diff --git a/gdb/aarch64-linux-tdep.c b/gdb/aarch64-linux-tdep.c +index cb132d5a540..437fd083fa7 100644 +--- a/gdb/aarch64-linux-tdep.c ++++ b/gdb/aarch64-linux-tdep.c +@@ -1137,6 +1137,7 @@ enum aarch64_syscall { + aarch64_sys_finit_module = 273, + aarch64_sys_sched_setattr = 274, + aarch64_sys_sched_getattr = 275, ++ aarch64_sys_getrandom = 278 + }; + + /* aarch64_canonicalize_syscall maps syscall ids from the native AArch64 +@@ -1419,6 +1420,7 @@ aarch64_canonicalize_syscall (enum aarch64_syscall syscall_number) + UNSUPPORTED_SYSCALL_MAP (finit_module); + UNSUPPORTED_SYSCALL_MAP (sched_setattr); + UNSUPPORTED_SYSCALL_MAP (sched_getattr); ++ SYSCALL_MAP (getrandom); + default: + return gdb_sys_no_syscall; + } +diff --git a/gdb/amd64-linux-tdep.c b/gdb/amd64-linux-tdep.c +index 9788711d296..02f87ddac32 100644 +--- a/gdb/amd64-linux-tdep.c ++++ b/gdb/amd64-linux-tdep.c +@@ -463,6 +463,9 @@ amd64_canonicalize_syscall (enum amd64_syscall syscall_number) + case amd64_sys_pipe2: + return gdb_sys_pipe2; + ++ case amd64_sys_getrandom: ++ return gdb_sys_getrandom; ++ + case amd64_sys_select: + case amd64_x32_sys_select: + return gdb_sys_select; +diff --git a/gdb/amd64-linux-tdep.h b/gdb/amd64-linux-tdep.h +index 184b0c86f07..ef111f4ac2a 100644 +--- a/gdb/amd64-linux-tdep.h ++++ b/gdb/amd64-linux-tdep.h +@@ -320,7 +320,8 @@ enum amd64_syscall { + amd64_sys_sync_file_range = 277, + amd64_sys_vmsplice = 278, + amd64_sys_move_pages = 279, +- amd64_sys_pipe2 = 293 ++ amd64_sys_pipe2 = 293, ++ amd64_sys_getrandom = 318 + }; + + /* Enum that defines the syscall identifiers for x32 linux. +diff --git a/gdb/arm-linux-tdep.c b/gdb/arm-linux-tdep.c +index 6aac016afb9..be9f203bd8e 100644 +--- a/gdb/arm-linux-tdep.c ++++ b/gdb/arm-linux-tdep.c +@@ -1610,6 +1610,7 @@ arm_canonicalize_syscall (int syscall) + case 378: return gdb_sys_kcmp; + case 379: return gdb_sys_finit_module; + */ ++ case 384: return gdb_sys_getrandom; + case 983041: /* ARM_breakpoint */ return gdb_sys_no_syscall; + case 983042: /* ARM_cacheflush */ return gdb_sys_no_syscall; + case 983043: /* ARM_usr26 */ return gdb_sys_no_syscall; +diff --git a/gdb/linux-record.c b/gdb/linux-record.c +index 0af1ef2a9e0..ffc6337d18a 100644 +--- a/gdb/linux-record.c ++++ b/gdb/linux-record.c +@@ -356,6 +356,12 @@ record_linux_system_call (enum gdb_syscall syscall, + return -1; + break; + ++ case gdb_sys_getrandom: ++ regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest); ++ if (record_mem_at_reg (regcache, tdep->arg1, tmpulongest)) ++ return -1; ++ break; ++ + case gdb_sys_times: + if (record_mem_at_reg (regcache, tdep->arg1, tdep->size_tms)) + return -1; +diff --git a/gdb/linux-record.h b/gdb/linux-record.h +index 219c67f888d..c70d75b0d6e 100644 +--- a/gdb/linux-record.h ++++ b/gdb/linux-record.h +@@ -510,6 +510,7 @@ enum gdb_syscall { + gdb_sys_dup3 = 330, + gdb_sys_pipe2 = 331, + gdb_sys_inotify_init1 = 332, ++ gdb_sys_getrandom = 355, + gdb_sys_statx = 383, + gdb_sys_socket = 500, + gdb_sys_connect = 501, +diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c +index 0b165fe2ca3..cb215f9cc51 100644 +--- a/gdb/ppc-linux-tdep.c ++++ b/gdb/ppc-linux-tdep.c +@@ -1406,6 +1406,8 @@ ppc_canonicalize_syscall (int syscall, int wordsize) + result = gdb_sys_recvfrom; + else if (syscall == 342) + result = gdb_sys_recvmsg; ++ else if (syscall == 359) ++ result = gdb_sys_getrandom; + + return (enum gdb_syscall) result; + } +diff --git a/gdb/s390-linux-tdep.c b/gdb/s390-linux-tdep.c +index 56cc147a391..d4ae9275e36 100644 +--- a/gdb/s390-linux-tdep.c ++++ b/gdb/s390-linux-tdep.c +@@ -787,6 +787,8 @@ s390_canonicalize_syscall (int syscall, enum s390_abi_kind abi) + /* ioprio_set .. epoll_pwait */ + else if (syscall >= 282 && syscall <= 312) + ret = syscall + 7; ++ else if (syscall == 349) ++ ret = gdb_sys_getrandom; + else + ret = gdb_sys_no_syscall; + +diff --git a/gdb/testsuite/gdb.reverse/getrandom.c b/gdb/testsuite/gdb.reverse/getrandom.c +new file mode 100644 +index 00000000000..162de6ed81b +--- /dev/null ++++ b/gdb/testsuite/gdb.reverse/getrandom.c +@@ -0,0 +1,41 @@ ++/* This testcase is part of GDB, the GNU debugger. ++ ++ Copyright 2022 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 . */ ++ ++#include ++ ++void ++marker1 (void) ++{ ++} ++ ++void ++marker2 (void) ++{ ++} ++ ++unsigned char buf[6]; ++ ++int ++main (void) ++{ ++ buf[0] = 0xff; ++ buf[5] = 0xff; ++ marker1 (); ++ volatile ssize_t r = getrandom (&buf[1], 4, 0); ++ marker2 (); ++ return 0; ++} +diff --git a/gdb/testsuite/gdb.reverse/getrandom.exp b/gdb/testsuite/gdb.reverse/getrandom.exp +new file mode 100644 +index 00000000000..b1c7d9dad80 +--- /dev/null ++++ b/gdb/testsuite/gdb.reverse/getrandom.exp +@@ -0,0 +1,56 @@ ++# Copyright 2022 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 . ++ ++# This file is part of the gdb testsuite. ++ ++# ++# This test tests getrandom syscall for reverse execution. ++# ++ ++if ![supports_reverse] { ++ return ++} ++ ++standard_testfile ++ ++if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } { ++ return -1 ++} ++ ++runto_main ++ ++if [supports_process_record] { ++ # Activate process record/replay ++ gdb_test_no_output "record" "turn on process record" ++} ++ ++gdb_test "break marker2" \ ++ "Breakpoint $decimal at $hex: file .*$srcfile, line $decimal.*" \ ++ "set breakpoint at marker2" ++ ++gdb_continue_to_breakpoint "marker2" ".*$srcfile:.*" ++ ++gdb_test "break marker1" \ ++ "Breakpoint $decimal at $hex: file .*$srcfile, line $decimal.*" \ ++ "set breakpoint at marker1" ++ ++gdb_test "reverse-continue" ".*$srcfile:$decimal.*" "reverse to marker1" ++ ++gdb_test "print (unsigned)buf\[0\]" ".* = 255" "check buf\[0\]" ++gdb_test "print (unsigned)buf\[1\]" ".* = 0" "check buf\[1\]" ++gdb_test "print (unsigned)buf\[2\]" ".* = 0" "check buf\[2\]" ++gdb_test "print (unsigned)buf\[3\]" ".* = 0" "check buf\[3\]" ++gdb_test "print (unsigned)buf\[4\]" ".* = 0" "check buf\[4\]" ++gdb_test "print (unsigned)buf\[5\]" ".* = 255" "check buf\[5\]" diff --git a/gdb-testsuite-update-test-gdb.base-step-over-syscall.exp.patch b/gdb-testsuite-update-test-gdb.base-step-over-syscall.exp.patch deleted file mode 100644 index 2374c54..0000000 --- a/gdb-testsuite-update-test-gdb.base-step-over-syscall.exp.patch +++ /dev/null @@ -1,241 +0,0 @@ -gdb/testsuite: update test gdb.base/step-over-syscall.exp - -I was looking at PR gdb/19675 and the related test -gdb.base/step-over-syscall.exp. This test includes a call to kfail -when we are testing a displaced step over a clone syscall. - -While looking at the test I removed the call to kfail and ran the -test, and was surprised that the test passed. - -I ran the test a few times and it does sometimes fail, but mostly it -passed fine. - -PR gdb/19675 describes how, when we displaced step over a clone, the -new thread is created with a $pc in the displaced step buffer. GDB -then fails to "fix" this $pc (for the new thread), and the thread will -be set running with its current $pc value. This means that the new -thread will just start executing from whatever happens to be after the -displaced stepping buffer. - -In the original PR gdb/19675 bug report Yao Qi was seeing the new -thread cause a segfault, the problem is, what actually happens is -totally undefined. - -On my machine, I'm seeing the new thread reenter main, it then starts -trying to run the test again (in the new thread). This just happens -to be safe enough (in this simple test) that most of the time the -inferior doesn't crash. - -In this commit I try to make the test slightly more likely to fail by -doing a couple of things. - -First, I added a static variable to main, this is set true when the -first thread enters main, if a second thread ever enters main then I -force an abort. - -Second, when the test is finishing I want to ensure that the new -threads have had a chance to do "something bad" if they are going to. -So I added a global counter, as each thread starts successfully it -decrements the counter. The main thread does not proceed to the final -marker function (where GDB has placed a breakpoint) until all threads -have started successfully. This means that if the newly created -thread doesn't successfully enter clone_fn then the counter will never -reach zero and the test will timeout. - -With these two changes my hope is that the test should fail more -reliably, and so, I have also changed the test to call setup_kfail -before the specific steps that we expect to misbehave instead of just -calling kfail and skipping parts of the test completely. The benefit -of this is that if/when we fix GDB this test will start to KPASS and -we'll know to update this test to remove the setup_kfail call. - ---- - gdb/testsuite/gdb.base/step-over-clone.c | 39 ++++++++++++++++ - gdb/testsuite/gdb.base/step-over-syscall.exp | 69 +++++++++++++++++++++++----- - 2 files changed, 97 insertions(+), 11 deletions(-) - -diff --git a/gdb/testsuite/gdb.base/step-over-clone.c b/gdb/testsuite/gdb.base/step-over-clone.c -index 581bf5fdde5..ef6fd922eb1 100644 ---- a/gdb/testsuite/gdb.base/step-over-clone.c -+++ b/gdb/testsuite/gdb.base/step-over-clone.c -@@ -19,6 +19,7 @@ - #include - #include - #include -+#include - - static void - marker () -@@ -26,9 +27,22 @@ marker () - - #define STACK_SIZE 0x1000 - -+/* These are used to signal that the threads have started correctly. The -+ GLOBAL_THREAD_COUNT is set to the number of threads in main, then -+ decremented (under a lock) in each new thread. */ -+pthread_mutex_t global_lock = PTHREAD_MUTEX_INITIALIZER; -+int global_thread_count = 0; -+ - static int - clone_fn (void *unused) - { -+ /* Signal that this thread has started correctly. */ -+ if (pthread_mutex_lock (&global_lock) != 0) -+ abort (); -+ global_thread_count--; -+ if (pthread_mutex_unlock (&global_lock) != 0) -+ abort (); -+ - return 0; - } - -@@ -38,9 +52,21 @@ main (void) - int i, pid; - unsigned char *stack[6]; - -+ /* Due to bug gdb/19675 the cloned thread _might_ try to reenter main -+ (this depends on where the displaced instruction is placed for -+ execution). However, if we do reenter main then lets ensure we fail -+ hard rather then just silently executing the code below. */ -+ static int started = 0; -+ if (!started) -+ started = 1; -+ else -+ abort (); -+ - for (i = 0; i < (sizeof (stack) / sizeof (stack[0])); i++) - stack[i] = malloc (STACK_SIZE); - -+ global_thread_count = (sizeof (stack) / sizeof (stack[0])); -+ - for (i = 0; i < (sizeof (stack) / sizeof (stack[0])); i++) - { - pid = clone (clone_fn, stack[i] + STACK_SIZE, CLONE_FILES | CLONE_VM, -@@ -50,5 +76,18 @@ main (void) - for (i = 0; i < (sizeof (stack) / sizeof (stack[0])); i++) - free (stack[i]); - -+ /* Set an alarm so we don't end up stuck waiting for threads that might -+ never start correctly. */ -+ alarm (120); -+ -+ /* Now wait for all the threads to start up. */ -+ while (global_thread_count != 0) -+ { -+ /* Force memory barrier so GLOBAL_THREAD_COUNT will be refetched. */ -+ asm volatile ("" ::: "memory"); -+ sleep (1); -+ } -+ -+ /* Call marker, this is what GDB is waiting for. */ - marker (); - } -diff --git a/gdb/testsuite/gdb.base/step-over-syscall.exp b/gdb/testsuite/gdb.base/step-over-syscall.exp -index a4821d7cd5a..7e9746e8dd9 100644 ---- a/gdb/testsuite/gdb.base/step-over-syscall.exp -+++ b/gdb/testsuite/gdb.base/step-over-syscall.exp -@@ -41,11 +41,50 @@ if { [istarget "i\[34567\]86-*-linux*"] || [istarget "x86_64-*-linux*"] } { - return -1 - } - --proc_with_prefix check_pc_after_cross_syscall { syscall syscall_insn_next_addr } { -+proc_with_prefix check_pc_after_cross_syscall { displaced syscall syscall_insn_next_addr } { -+ global gdb_prompt -+ - set syscall_insn_next_addr_found [get_hexadecimal_valueof "\$pc" "0"] - -+ # After the 'stepi' we expect thread 1 to still be selected. -+ # However, when displaced stepping over a clone bug gdb/19675 -+ # means this might not be the case. -+ # -+ # Which thread we end up in depends on a race between the original -+ # thread-1, and the new thread (created by the clone), so we can't -+ # guarantee which thread we will be in at this point. -+ # -+ # For the fork/vfork syscalls, which are correctly handled by -+ # displaced stepping we will always be in thread-1 or the original -+ # process at this point. -+ set curr_thread "unknown" -+ gdb_test_multiple "info threads" "" { -+ -re "Id\\s+Target Id\\s+Frame\\s*\r\n" { -+ exp_continue -+ } -+ -re "^\\* (\\d+)\\s+\[^\r\n\]+\r\n" { -+ set curr_thread $expect_out(1,string) -+ exp_continue -+ } -+ -re "^\\s+\\d+\\s+\[^\r\n\]+\r\n" { -+ exp_continue -+ } -+ -re "$gdb_prompt " { -+ } -+ } -+ -+ # If we are displaced stepping over a clone, and we ended up in -+ # the wrong thread then the following check of the $pc value will -+ # fail. -+ if { $displaced == "on" && $syscall == "clone" && $curr_thread != 1 } { -+ # GDB doesn't support stepping over clone syscall with -+ # displaced stepping. -+ setup_kfail "*-*-*" "gdb/19675" -+ } -+ - gdb_assert {$syscall_insn_next_addr != 0 \ -- && $syscall_insn_next_addr == $syscall_insn_next_addr_found} \ -+ && $syscall_insn_next_addr == $syscall_insn_next_addr_found \ -+ && $curr_thread == 1} \ - "single step over $syscall final pc" - } - -@@ -204,7 +243,12 @@ proc step_over_syscall { syscall } { - - set testfile "step-over-$syscall" - -- if [build_executable ${testfile}.exp ${testfile} ${testfile}.c {debug}] { -+ set options [list debug] -+ if { $syscall == "clone" } { -+ lappend options "pthreads" -+ } -+ -+ if [build_executable ${testfile}.exp ${testfile} ${testfile}.c $options] { - untested "failed to compile" - return -1 - } -@@ -214,13 +258,6 @@ proc step_over_syscall { syscall } { - continue - } - -- if { $displaced == "on" && $syscall == "clone" } { -- # GDB doesn't support stepping over clone syscall with -- # displaced stepping. -- kfail "gdb/19675" "single step over clone" -- continue -- } -- - set ret [setup $syscall] - - set syscall_insn_addr [lindex $ret 0] -@@ -257,12 +294,22 @@ proc step_over_syscall { syscall } { - if {[gdb_test "stepi" "x/i .*=>.*" "single step over $syscall"] != 0} { - return -1 - } -- check_pc_after_cross_syscall $syscall $syscall_insn_next_addr -+ check_pc_after_cross_syscall $displaced $syscall $syscall_insn_next_addr - - # Delete breakpoint syscall insns to avoid interference to other syscalls. - delete_breakpoints - - gdb_test "break marker" "Breakpoint.*at.* file .*${testfile}.c, line.*" -+ -+ # If we are displaced stepping over a clone syscall then -+ # we expect the following check to fail. See also the -+ # code in check_pc_after_cross_syscall. -+ if { $displaced == "on" && $syscall == "clone" } { -+ # GDB doesn't support stepping over clone syscall with -+ # displaced stepping. -+ setup_kfail "*-*-*" "gdb/19675" -+ } -+ - gdb_test "continue" "Continuing\\..*Breakpoint \[0-9\]+, marker \\(\\) at.*" \ - "continue to marker ($syscall)" - } diff --git a/gdb-testsuite-use-compiler-generated-instead-of-gas-generated-stabs.patch b/gdb-testsuite-use-compiler-generated-instead-of-gas-generated-stabs.patch deleted file mode 100644 index db2b84d..0000000 --- a/gdb-testsuite-use-compiler-generated-instead-of-gas-generated-stabs.patch +++ /dev/null @@ -1,74 +0,0 @@ -[gdb/testsuite] Use compiler-generated instead of gas-generated stabs - -The test-case gdb.dwarf2/dw2-ranges.exp is the only one in the gdb testsuite -that uses gas-generated stabs. - -While the use seems natural alongside the use of gas-generated dwarf in the -same test-case, there are a few known issues, filed on the gdb side as: -- PR symtab/12497 - "stabs: PIE relocation does not work" -- PR symtab/28221 - "[readnow, stabs] FAIL: gdb.dwarf2/dw2-ranges.exp: \ - info line func" -and on the gas side as: -- PR gas/28233 - "[gas, --gstabs] Generate stabs more similar to gcc" - -The test-case contains a KFAIL for PR12497, but it's outdated and fails to -trigger. - -The intention of the test-case is to test gas-generated dwarf, and using -gcc-generated stabs instead of gas-generated stabs works fine. - -Supporting compiler-generated stabs is already a corner-case for gdb, and -there's no current commitment/incentive to support/workaround gas-generated -stabs, which can be considered a corner-case of a corner-case. - -Work around these problem by using compiler-generated stabs in the test-case. - -Tested on x86_64-linux. - -gdb/testsuite/ChangeLog: - -2021-08-22 Tom de Vries - - * gdb.dwarf2/dw2-ranges.exp: Use compiler-generated stabs. - ---- - gdb/testsuite/gdb.dwarf2/dw2-ranges.exp | 15 +++------------ - 1 file changed, 3 insertions(+), 12 deletions(-) - -diff --git a/gdb/testsuite/gdb.dwarf2/dw2-ranges.exp b/gdb/testsuite/gdb.dwarf2/dw2-ranges.exp -index 8566e0034cf..288fc941afa 100644 ---- a/gdb/testsuite/gdb.dwarf2/dw2-ranges.exp -+++ b/gdb/testsuite/gdb.dwarf2/dw2-ranges.exp -@@ -35,7 +35,6 @@ if !$gcc_compiled { - standard_testfile .c -2.c -3.c - set asmfile [standard_output_file ${testfile}.s] - set asmfile2 [standard_output_file ${testfile}2.s] --set asmfile3 [standard_output_file ${testfile}3.s] - set objfile [standard_output_file ${testfile}.o] - set objfile2 [standard_output_file ${testfile}2.o] - set objfile3 [standard_output_file ${testfile}3.o] -@@ -55,8 +54,7 @@ if {[gdb_compile "${srcdir}/${subdir}/${srcfile2}" "${asmfile2}" assembly {}] != - # STABS compilation is intentional as it tests the STABS lookup where is no - # partial_symtab->psymtabs_addrmap supported for that CU (Compilation Unit) in - # a file containing psymtabs_addrmap-supporting DWARF CUs. --if {[gdb_compile "${srcdir}/${subdir}/${srcfile3}" "${asmfile3}" assembly {}] != "" -- || [gdb_compile "${asmfile3}" "${objfile3}" object {additional_flags=-gstabs}] != "" } { -+if {[gdb_compile "${srcdir}/${subdir}/${srcfile3}" "${objfile3}" object {additional_flags=-gstabs}] != "" } { - return -1 - } - -@@ -82,12 +80,5 @@ gdb_test "info line func" "Line \[0-9\]* of .* starts at address .* and ends at - gdb_test "info line main2" "Line \[0-9\]* of .* starts at address .* and ends at .*" - gdb_test "info line func2" "Line \[0-9\]* of .* starts at address .* and ends at .*" - --set test "info line main3" --gdb_test_multiple $test $test { -- -re "Line \[0-9\]* of .* starts at address .* and ends at .*\r\n$gdb_prompt $" { -- pass $test -- } -- -re "Line \[0-9\]* of .* is at address .* but contains no code\\.\r\n$gdb_prompt $" { -- kfail symtab/12497 $test -- } --} -+gdb_test "info line main3" \ -+ "Line \[0-9\]* of .* starts at address .* and ends at .*" diff --git a/gdb-testsuite-workaround-unnecessary-.s-file-with-gfortran-4.8.patch b/gdb-testsuite-workaround-unnecessary-.s-file-with-gfortran-4.8.patch new file mode 100644 index 0000000..7d8d52d --- /dev/null +++ b/gdb-testsuite-workaround-unnecessary-.s-file-with-gfortran-4.8.patch @@ -0,0 +1,48 @@ +[gdb/testsuite] Workaround unnecessary .s file with gfortran 4.8 + +After running test-case gdb.fortran/namelist.exp with gfortran 4.8.5, I'm left +with: +... +$ git sti +On branch master +Your branch is up to date with 'origin/master'. + +Untracked files: + (use "git add ..." to include in what will be committed) + gdb/testsuite/lib/compiler.s + +nothing added to commit but untracked files present (use "git add" to track) +... + +We're running into PR gcc/60447, which was fixed in gcc 4.9.0. + +Workaround this by first copying the source file to the temp dir, such that +the .s file is left there instead: +... +$ ls build/gdb/testsuite/temp// +compiler.c compiler.F90 compiler.s +... + +Tested on x86_64-linux. + +--- + gdb/testsuite/lib/gdb.exp | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp +index 6f6acfe188a..f8cd2292170 100644 +--- a/gdb/testsuite/lib/gdb.exp ++++ b/gdb/testsuite/lib/gdb.exp +@@ -4087,6 +4087,12 @@ proc get_compiler_info {{arg ""}} { + set cppout [read $file] + close $file + } else { ++ # Copy $ifile to temp dir, to work around PR gcc/60447. This will leave the ++ # superfluous .s file in the temp dir instead of in the source dir. ++ set tofile [file tail $ifile] ++ set tofile [standard_temp_file $tofile] ++ file copy -force $ifile $tofile ++ set ifile $tofile + set cppout [ gdb_compile "${ifile}" "" preprocess [list "$arg" quiet getting_compiler_info] ] + } + eval log_file $saved_log diff --git a/gdb-tui-fix-breakpoint-display-functionality.patch b/gdb-tui-fix-breakpoint-display-functionality.patch deleted file mode 100644 index 44c914b..0000000 --- a/gdb-tui-fix-breakpoint-display-functionality.patch +++ /dev/null @@ -1,115 +0,0 @@ -[gdb/tui] Fix breakpoint display functionality - -In commit 81e6b8eb208 "Make tui-winsource not use breakpoint_chain", a loop -body was transformed into a lambda function body: -... -- for (bp = breakpoint_chain; -- bp != NULL; -- bp = bp->next) -+ iterate_over_breakpoints ([&] (breakpoint *bp) -> bool -... -and consequently: -- a continue was replaced by a return, and -- a final return was added. - -Then in commit 240edef62f0 "gdb: remove iterate_over_breakpoints function", we -transformed back to a loop body: -... -- iterate_over_breakpoints ([&] (breakpoint *bp) -> bool -+ for (breakpoint *bp : all_breakpoints ()) -... -but without reverting the changes that introduced the two returns. - -Consequently, breakpoints no longer show up in the tui source window. - -Fix this by reverting the changes that introduced the two returns. - -Build on x86_64-linux, tested with all .exp test-cases that contain -tuiterm_env. - -Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28483 - -gdb/ChangeLog: - -2021-10-22 Tom de Vries - - PR tui/28483 - * tui/tui-winsource.c (tui_source_window_base::update_breakpoint_info): - Fix returns in loop body. - -gdb/testsuite/ChangeLog: - -2021-10-22 Tom de Vries - - PR tui/28483 - * gdb.tui/break.exp: New file. - ---- - gdb/testsuite/gdb.tui/break.exp | 37 +++++++++++++++++++++++++++++++++++++ - gdb/tui/tui-winsource.c | 3 +-- - 2 files changed, 38 insertions(+), 2 deletions(-) - -diff --git a/gdb/testsuite/gdb.tui/break.exp b/gdb/testsuite/gdb.tui/break.exp -new file mode 100644 -index 00000000000..de4821c570a ---- /dev/null -+++ b/gdb/testsuite/gdb.tui/break.exp -@@ -0,0 +1,37 @@ -+# Copyright 2021 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 . -+ -+# Verify that breakpoint marker is shown. -+ -+tuiterm_env -+ -+standard_testfile tui-layout.c -+ -+if {[build_executable "failed to prepare" ${testfile} ${srcfile}] == -1} { -+ return -1 -+} -+ -+Term::clean_restart 24 80 $testfile -+if {![Term::enter_tui]} { -+ unsupported "TUI not supported" -+ return -+} -+ -+set text [Term::get_all_lines] -+gdb_assert {![string match "No Source Available" $text]} \ -+ "initial source listing" -+ -+Term::command "b main" -+Term::check_contents "break marker present" "\\|b\\+" -diff --git a/gdb/tui/tui-winsource.c b/gdb/tui/tui-winsource.c -index afd51e95980..955b68901fe 100644 ---- a/gdb/tui/tui-winsource.c -+++ b/gdb/tui/tui-winsource.c -@@ -460,7 +460,7 @@ tui_source_window_base::update_breakpoint_info - for (breakpoint *bp : all_breakpoints ()) - { - if (bp == being_deleted) -- return false; -+ continue; - - for (bp_location *loc : bp->locations ()) - { -@@ -478,7 +478,6 @@ tui_source_window_base::update_breakpoint_info - mode |= TUI_BP_HARDWARE; - } - } -- return false; - } - - if (line->break_mode != mode) diff --git a/gdb.changes b/gdb.changes index 0c00f76..ef7053c 100644 --- a/gdb.changes +++ b/gdb.changes @@ -1,3 +1,499 @@ +------------------------------------------------------------------- +Sat Jul 30 07:24:23 UTC 2022 - Tom de Vries + +- Maintenance script qa.sh: + * Add SLE-12/x86_64 to "known clean configs". + * Add fail for PR29405. + * Add fail for PR26915. + +------------------------------------------------------------------- +Fri Jul 29 06:53:15 UTC 2022 - Tom de Vries + +- Patches added: + * gdb-testsuite-fix-gdb.threads-killed-outside.exp-on-aarch64.patch +- Maintenance script qa.sh: + * Remove PR29247 internal-error. + * Add SLE-15/aarch64 to "known clean configs". + +------------------------------------------------------------------- +Thu Jul 28 05:48:21 UTC 2022 - Tom de Vries + +- Patches added: + * gdb-fix-watchpoints-triggered.patch +- Maintenance script qa.sh: + * Add kfails for PR25038, PR29253, and PR29423. + * Remove gdb.mi/mi-var-invalidate-shlib.exp kfails. +- Mention qa-local.sh, qa-remote.sh and README.qa as sources. + +------------------------------------------------------------------- +Wed Jul 27 06:26:34 UTC 2022 - Tom de Vries + +- Maintenance script qa-local.sh: + * Use have_combo consistently. +- Maintenance script qa.sh: + * Add kfail_aarch64. + * Add PR29419/PR29409 kfails. + * Update PR29247 kfails. +- Patches added: + * make-gdb.ada-float-bits.exp-more-generic.patch + * gdb-testsuite-fix-gdb.ada-literals.exp-with-aarch64.patch + +------------------------------------------------------------------- +Tue Jul 26 06:56:40 UTC 2022 - Tom de Vries + +- Actually apply fixup-gdb-test-bt-cfi-without-die.patch and + fixup-2-gdb-rhbz1553104-s390x-arch12-test.patch. + +------------------------------------------------------------------- +Mon Jul 25 20:28:02 UTC 2022 - Tom de Vries + +- Also remove gdb-6.5-readline-long-line-crash-test.patch from + patches list in gdb.spec. + +------------------------------------------------------------------- +Mon Jul 25 08:11:07 UTC 2022 - Tom de Vries + +- Patches added: + * powerpc-add-support-for-ieee-128-bit-format.patch + * powerpc-correct-the-gdb-ioctl-values-for-tcgets-tcsets-tcsetsw-and-tcsetsf.patch + * gdb-testsuite-remove-target-limits-in-gdb.base-catch-syscall.exp.patch + * powerpc-fix-for-gdb.base-eh_return.exp.patch + * fix-comparison-of-unsigned-long-int-to-int-in-record_linux_system_call.patch + * gdb-testsuite-fix-gdb.reverse-test_ioctl_tcsetsw.exp-with-libc-debuginfo.patch + * fixup-gdb-test-bt-cfi-without-die.patch + * fix-core-file-detach-crash-corefiles-29275.patch + * gdb-testsuite-fix-gdb.dwarf2-dw2-out-of-range-end-of-seq.exp-on-aarch64.patch + * gdb-testsuite-fix-gdb.base-catch-syscall.exp-without-enable-targets.patch + * gdb-testsuite-fix-gdb.base-catch-syscall.exp-with-with-expat-no.patch + * fix-for-gdb.base-solib-search.exp-test.patch +- Patch removed: + * gdb-6.7-ppc-clobbered-registers-O2-test.patch + * gdb-6.5-readline-long-line-crash-test.patch +- Patches updated: + * gdb-tdep-update-syscalls-ppc64-ppc-linux.xml.patch + * gdb-testsuite-handle-pipe2-syscall-in-gdb.base-catch-syscall.exp.patch + +------------------------------------------------------------------- +Wed Jun 22 14:31:30 UTC 2022 - Tom de Vries + +- Maintenance script qa.sh: + * Add PR28504 KFAILs. + * Make .sum file matching less complex. + * Add fedora test-case kfail. +- Maintenance script qa-local.sh: + * Fix incorrect path name. +- Update comments in gdb.spec. +- Patches added: + * powerpc-update-expected-floating-point-output-for-gdb.arch-altivec-regs.exp-and-gdb.arch-vsx-regs.exp.patch + +------------------------------------------------------------------- +Wed Jun 22 12:41:23 UTC 2022 - Tom de Vries + +- Patches updated: + * gdb-testsuite-support-recording-of-getrandom.patch + (add aarch64 part) +- Maintenance script qa.sh: + * Add i586 to known clean configs. + +------------------------------------------------------------------- +Tue Jun 21 21:22:58 UTC 2022 - Tom de Vries + +- Patches added: + * gdb-testsuite-enable-some-test-cases-for-x86_64-m32.patch + * gdb-testsuite-fix-gdb.reverse-i387-env-reverse.exp-for-pie.patch + * gdb-testsuite-support-recording-of-getrandom.patch +- Patches updated: + * gdb-record-handle-statx-system-call.patch +- Maintenance script qa.sh: + * Allow only two summary files, for i586. + * Add i586 KFAILs. +- Maintenance script qa-local.sh: + * Add i586. + +------------------------------------------------------------------- +Thu Jun 16 13:23:31 UTC 2022 - Tom de Vries + +- Maintenance script qa-local.sh: + * Fix rpm pathname. +- Maintenance script qa-remote.sh: + * Skip stale config openSUSE_Leap_15.2. +- Maintenance script qa.sh: + * Drop known clean config: Leap 15.2 x86_64. + +------------------------------------------------------------------- +Mon Jun 13 09:37:45 UTC 2022 - Tom de Vries + +- Maintenance script qa-local.sh: + * Add cleanup step. + * Add "build all configs without testsuite" step. + * For "build all configs with testsuite" step, redirect output + to log and produce PASS/FAIL line, and make sure buildroot is + removed also in case of missing rpm. + * Use "--clean --trust-all-projects" for osc build commands. +* Drop openSUSE_Leap_15.2. +- Maintenance script qa.sh: + * Rename argument 6 to -local. + * Add PR29247 KFAILs. + * Update internal-error regexps. +- New maintenance script qa-remote.sh. +- Add "build all configs without testsuite" step in README.qa. +- Patches added (backport from trunk): + * gdb-testsuite-remove-attach-test-from-can_spawn_for_attach.patch +- README.qa: + * Add remote qa entry. + * Update local qa entry: + * Add notes entry. + * Other updates to match changes in qa-local.sh. + +------------------------------------------------------------------- +Mon Jun 13 03:16:35 UTC 2022 - Tom de Vries + +- Fix installed but unpackaged /usr/share/info/ctf-spec.info.gz. + +------------------------------------------------------------------- +Sat Jun 11 22:51:37 UTC 2022 - Tom de Vries + +- Rebase to 12.1 release (as in fedora 36 @ 89947a7): + * DBX mode is deprecated, and will be removed in GDB 13. + + * GDB 12 is the last release of GDB that will support building against + Python 2. From GDB 13, it will only be possible to build GDB itself + with Python 3 support. + + * Improved C++ template support: + GDB now treats functions/types involving C++ templates like it does function + overloads. Users may omit parameter lists to set breakpoints on families of + template functions, including types/functions composed of multiple template types: + (gdb) break template_func(template_1, int) + The above will set breakpoints at every function `template_func' where + the first function parameter is any template type named `template_1' and + the second function parameter is `int'. + TAB completion also gains similar improvements. + + * New commands: + + maint set backtrace-on-fatal-signal on|off + maint show backtrace-on-fatal-signal + This setting is 'on' by default. When 'on' GDB will print a limited + backtrace to stderr in the situation where GDB terminates with a + fatal signal. This only supported on some platforms where the + backtrace and backtrace_symbols_fd functions are available. + + set source open on|off + show source open + This setting, which is on by default, controls whether GDB will try + to open source code files. Switching this off will stop GDB trying + to open and read source code files, which can be useful if the files + are located over a slow network connection. + + set varsize-limit + show varsize-limit + These are now deprecated aliases for "set max-value-size" and + "show max-value-size". + + task apply [all | TASK-IDS...] [FLAG]... COMMAND + Like "thread apply", but applies COMMAND to Ada tasks. + + watch [...] task ID + Watchpoints can now be restricted to a specific Ada task. + + maint set internal-error backtrace on|off + maint show internal-error backtrace + maint set internal-warning backtrace on|off + maint show internal-warning backtrace + GDB can now print a backtrace of itself when it encounters either an + internal-error, or an internal-warning. This is on by default for + internal-error and off by default for internal-warning. + + set logging on|off + Deprecated and replaced by "set logging enabled on|off". + + set logging enabled on|off + show logging enabled + These commands set or show whether logging is enabled or disabled. + + exit + You can now exit GDB by using the new command "exit", in addition to + the existing "quit" command. + + set debug threads on|off + show debug threads + Print additional debug messages about thread creation and deletion. + + set debug linux-nat on|off + show debug linux-nat + These new commands replaced the old 'set debug lin-lwp' and 'show + debug lin-lwp' respectively. Turning this setting on prints debug + messages relating to GDB's handling of native Linux inferiors. + + maint flush source-cache + Flush the contents of the source code cache. + + maint set gnu-source-highlight enabled on|off + maint show gnu-source-highlight enabled + Whether GDB should use the GNU Source Highlight library for adding + styling to source code. When off, the library will not be used, even + when available. When GNU Source Highlight isn't used, or can't add + styling to a particular source file, then the Python Pygments + library will be used instead. + + set suppress-cli-notifications (on|off) + show suppress-cli-notifications + This controls whether printing the notifications is suppressed for CLI. + CLI notifications occur when you change the selected context + (i.e., the current inferior, thread and/or the frame), or when + the program being debugged stops (e.g., because of hitting a + breakpoint, completing source-stepping, an interrupt, etc.). + + set style disassembler enabled on|off + show style disassembler enabled + If GDB is compiled with Python support, and the Python Pygments + package is available, then, when this setting is on, disassembler + output will have styling applied. + + set ada source-charset + show ada source-charset + Set the character set encoding that is assumed for Ada symbols. Valid + values for this follow the values that can be passed to the GNAT + compiler via the '-gnati' option. The default is ISO-8859-1. + + * Changed commands: + + print + Printing of floating-point values with base-modifying formats like + /x has been changed to display the underlying bytes of the value in + the desired base. This was GDB's documented behavior, but was never + implemented correctly. + + maint packet + This command can now print a reply, if the reply includes + non-printable characters. Any non-printable characters are printed + as escaped hex, e.g. \x?? where '??' is replaces with the value of + the non-printable character. + + clone-inferior + The clone-inferior command now ensures that the TTY, CMD and ARGS + settings are copied from the original inferior to the new one. + All modifications to the environment variables done using the 'set + environment' or 'unset environment' commands are also copied to the new + inferior. + + set debug lin-lwp on|off + show debug lin-lwp + These commands have been removed from GDB. The new command 'set + debug linux-nat' and 'show debug linux-nat' should be used + instead. + + info win + This command now includes information about the width of the tui + windows in its output. + + * GDB's Ada parser now supports an extension for specifying the exact + byte contents of a floating-point literal. This can be useful for + setting floating-point registers to a precise value without loss of + precision. The syntax is an extension of the based literal syntax. + Use, e.g., "16lf#0123abcd#" -- the number of "l"s controls the width + of the floating-point type, and the "f" is the marker for floating + point. + + * MI changes: + + ** The '-add-inferior' with no option flags now inherits the + connection of the current inferior, this restores the behaviour of + GDB as it was prior to GDB 10. + + ** The '-add-inferior' command now accepts a '--no-connection' + option, which causes the new inferior to start without a + connection. + + * Python API: + + ** New function gdb.add_history(), which takes a gdb.Value object + and adds the value it represents to GDB's history list. An + integer, the index of the new item in the history list, is + returned. + + ** New function gdb.history_count(), which returns the number of + values in GDB's value history. + + ** New gdb.events.gdb_exiting event. This event is called with a + gdb.GdbExitingEvent object which has the read-only attribute + 'exit_code', which contains the value of the GDB exit code. This + event is triggered once GDB decides it is going to exit, but + before GDB starts to clean up its internal state. + + ** New function gdb.architecture_names(), which returns a list + containing all of the possible Architecture.name() values. Each + entry is a string. + + ** New function gdb.Architecture.integer_type(), which returns an + integer type given a size and a signed-ness. + + ** New gdb.TargetConnection object type that represents a connection + (as displayed by the 'info connections' command). A sub-class, + gdb.RemoteTargetConnection, is used to represent 'remote' and + 'extended-remote' connections. + + ** The gdb.Inferior type now has a 'connection' property which is an + instance of gdb.TargetConnection, the connection used by this + inferior. This can be None if the inferior has no connection. + + ** New 'gdb.events.connection_removed' event registry, which emits a + 'gdb.ConnectionEvent' when a connection is removed from GDB. + This event has a 'connection' property, a gdb.TargetConnection + object for the connection being removed. + + ** New gdb.connections() function that returns a list of all + currently active connections. + + ** New gdb.RemoteTargetConnection.send_packet(PACKET) method. This + is equivalent to the existing 'maint packet' CLI command; it + allows a user specified packet to be sent to the remote target. + + ** New function gdb.host_charset(), returns a string, which is the + name of the current host charset. + + ** New gdb.set_parameter(NAME, VALUE). This sets the gdb parameter + NAME to VALUE. + + ** New gdb.with_parameter(NAME, VALUE). This returns a context + manager that temporarily sets the gdb parameter NAME to VALUE, + then resets it when the context is exited. + + ** The gdb.Value.format_string method now takes a 'styling' + argument, which is a boolean. When true, the returned string can + include escape sequences to apply styling. The styling will only + be present if styling is otherwise turned on in GDB (see 'help + set styling'). When false, which is the default if the argument + is not given, then no styling is applied to the returned string. + + ** New read-only attribute gdb.InferiorThread.details, which is + either a string, containing additional, target specific thread + state information, or None, if there is no such additional + information. + + ** New read-only attribute gdb.Type.is_scalar, which is True for + scalar types, and False for all other types. + + ** New read-only attribute gdb.Type.is_signed. This attribute + should only be read when Type.is_scalar is True, and will be True + for signed types, and False for all other types. Attempting to + read this attribute for non-scalar types will raise a ValueError. + + ** It is now possible to add GDB/MI commands implemented in Python. + +- Update libipt to v2.0.5. +- Patches added: + * gdb-6.3-rh-testversion-20041202.patch + * gdb-6.5-BEA-testsuite.patch + * gdb-6.6-buildid-locate-misleading-warning-missing-debuginfo-rhbz981154.patch + * gdb-6.7-charsign-test.patch + * gdb-6.8-bz466901-backtrace-full-prelinked.patch + * gdb-fix-for-gdb.base-eof-exit.exp-test-failures.patch + * gdb-improved-eof-handling-when-using-readline-7.patch + * gdb-libexec-add-index.patch + * gdb-tdep-detect-get_pc_thunk-call-in-i386-prologue.patch + * gdb-testsuite-address-test-failures-in-gdb.mi-mi-multi-commands.exp.patch + * gdb-testsuite-detect-change-instead-of-init-in-gdb.mi-mi-var-block.exp.patch + * gdb-testsuite-fix-gdb.opt-clobbered-registers-o2.exp-with-gcc-12.patch + * gdb-testsuite-fix-occasional-failure-in-gdb.mi-mi-multi-commands.exp.patch + * gdb-testsuite-fix-test-failure-when-building-against-readline-v7.patch + * gdb-testsuite-handle-older-python-in-gdb.python-py-send-packet.py.patch + * gdb-testsuite-handle-quotes-in-gdb_py_module_available.patch + * gdb-testsuite-handle-unordered-dict-in-gdb.python-py-mi-cmd.exp.patch + * gdb-testsuite-skip-gdb.fortran-namelist.exp-for-gfortran-4.8.patch + * gdb-testsuite-workaround-unnecessary-.s-file-with-gfortran-4.8.patch +- Patches dropped: + * aarch64-make-gdbserver-register-set-selection-dynamic.patch + * fix-build-with-current-gcc-el_explicit-location-always-non-null.patch + * fix-gdb.base-sigstep.exp-test-for-ppc.patch + * fix-gdb.multi-multi-term-settings.exp-race.patch + * fixup-2-gdb-6.6-buildid-locate.patch + * fixup-gdb-6.6-buildid-locate.patch + * gdb-6.3-inferior-notification-20050721.patch + * gdb-ada-fix-assert-in-ada_is_unconstrained_packed_array_type.patch + * gdb-build-add-cxx_dialect-to-cxx.patch + * gdb-build-make-c-exp.y-work-with-bison-3.8.patch + * gdb-doc-fix-print-inferior-events-default.patch + * gdb-exp-improve-error-reading-variable-message.patch + * gdb-fortran-handle-dw-at-string-length-with-loclistptr.patch + * gdb-r_version-check.patch + * gdb-rhbz1976887-field-location-kind.patch + * gdb-rhbz2012976-paper-over-fortran-lex-problems.patch + * gdb-symtab-add-call_site_eq-and-call_site_hash.patch + * gdb-symtab-c-ify-call_site.patch + * gdb-symtab-fix-htab_find_slot-call-in-read_call_site_scope.patch + * gdb-symtab-fix-segfault-in-search_one_symtab.patch + * gdb-symtab-remove-compunit_call_site_htab.patch + * gdb-symtab-use-unrelocated-addresses-in-call_site.patch + * gdb-tdep-fix-avx512-m32-support-in-gdbserver.patch + * gdb-tdep-rs6000-don-t-skip-system-call-in-skip_prologue.patch + * gdb-test-for-rhbz1976887.patch + * gdb-testsuite-add-gdb.arch-ppc64-break-on-_exit.exp.patch + * gdb-testsuite-add-gdb.opt-break-on-_exit.exp.patch + * gdb-testsuite-add-gdb.testsuite-dump-system-info.exp.patch + * gdb-testsuite-add-missing-wait-in-gdb.base-signals-state-child.exp.patch + * gdb-testsuite-add-nopie-in-two-test-cases.patch + * gdb-testsuite-detect-no-mpx-support.patch + * gdb-testsuite-disable-inferior-output-in-gdb.base-foll-vfork.exp.patch + * gdb-testsuite-don-t-error-when-trying-to-unset-last_spawn_tty_name.patch + * gdb-testsuite-factor-out-dump_info-in-gdb.testsuite-dump-system-info.exp.patch + * gdb-testsuite-fix-assembly-comments-in-gdb.dwarf2-clang-debug-names.exp.tcl.patch + * gdb-testsuite-fix-data-alignment-in-gdb.arch-i386-avx-sse-.exp.patch + * gdb-testsuite-fix-fail-in-gdb.base-annota1.exp.patch + * gdb-testsuite-fix-fail-in-gdb.tui-basic.exp.patch + * gdb-testsuite-fix-fail-in-gdb.tui-corefile-run.exp.patch + * gdb-testsuite-fix-gdb.ada-big_packed_array.exp-xfail-for-m32.patch + * gdb-testsuite-fix-gdb.arch-i386-pkru.exp-on-linux.patch + * gdb-testsuite-fix-gdb.base-annota1.exp-with-pie.patch + * gdb-testsuite-fix-gdb.base-dcache-flush.exp.patch + * gdb-testsuite-fix-gdb.gdb-selftest.exp.patch + * gdb-testsuite-fix-gdb.guile-scm-type.exp-with-gcc-4.8.patch + * gdb-testsuite-fix-gdb.python-py-events.exp.patch + * gdb-testsuite-fix-gdb.server-server-kill.exp-with-m32.patch + * gdb-testsuite-fix-gdb.threads-check-libthread-db.exp-with-glibc-2.34.patch + * gdb-testsuite-fix-gdb.threads-linux-dp.exp.patch + * gdb-testsuite-fix-gdb.threads-thread-specific-bp.exp.patch + * gdb-testsuite-fix-port-detection-in-gdb.debuginfod-fetch_src_and_symbols.exp.patch + * gdb-testsuite-fix-regexp-in-gdb.base-foll-vfork.exp.patch + * gdb-testsuite-fix-stepi-test-cases-with-unix-m32-fpie-pie.patch + * gdb-testsuite-handle-recursive-internal-problem-in-gdb_internal_error_resync.patch + * gdb-testsuite-handle-runto-fail-in-gdb.mi-mi-var-cp.exp.patch + * gdb-testsuite-handle-sigill-in-two-gdb.arch-powerpc-test-cases.patch + * gdb-testsuite-handle-supports_memtag-in-gdb.base-gdb-caching-proc.exp.patch + * gdb-testsuite-make-gdb.base-annota1.exp-more-robust.patch + * gdb-testsuite-refactor-regexp-in-gdb.base-annota1.exp.patch + * gdb-testsuite-support-fpie-fno-pie-pie-no-pie-in-gdb_compile_rust.patch + * gdb-testsuite-update-test-gdb.base-step-over-syscall.exp.patch + * gdb-testsuite-use-compiler-generated-instead-of-gas-generated-stabs.patch + * gdb-tui-fix-breakpoint-display-functionality.patch + * ibm-z-add-another-arch14-instruction.patch + * ibm-z-remove-lpswey-parameter.patch +- Patched updated: + * gdb-6.3-gstack-20050411.patch + * gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch + * gdb-6.6-buildid-locate-rpm-librpm-workaround.patch + * gdb-6.6-buildid-locate-rpm-scl.patch + * gdb-6.6-buildid-locate-rpm.patch + * gdb-6.6-buildid-locate-solib-missing-ids.patch + * gdb-6.6-buildid-locate.patch + * gdb-cli-add-ignore-errors-command.patch + * gdb-container-rh-pkg.patch + * gdb-core-open-vdso-warning.patch + * gdb-fedora-libncursesw.patch + * gdb-gcore-bash.patch + * gdb-linux_perf-bundle.patch + * gdb-testsuite-handle-init-errors-in-gdb.mi-user-selected-context-sync.exp.patch +- Add BuildRequires python-xml. +- Maintenance script qa.sh: + * Add -sle-12 and -factory options. + * Handle *.-fPIE.-pie.sum files. + * Add KFAILs for PRs 26292, 29238, 25059, 29240, 29241, 29244, + 29245, 29160, 29196. + * Move PR27539 KFAILs from kfail_factory to kfail. +- New maintenance script qa-local.sh. +- New file README.qa. + ------------------------------------------------------------------- Mon May 9 12:05:38 UTC 2022 - Tom de Vries diff --git a/gdb.spec b/gdb.spec index c3a07f4..1e7e895 100644 --- a/gdb.spec +++ b/gdb.spec @@ -68,7 +68,7 @@ Group: Development/Languages/C and C++ %endif Name: gdb%{name_suffix} -Version: 11.1 +Version: 12.1 Release: 0 # The release always contains a leading reserved number, start it at 1. @@ -127,7 +127,7 @@ Source4: gdbinit Source5: gdbinit.without-python # libipt: Intel Processor Trace Decoder Library -%global libipt_version 2.0.4 +%global libipt_version 2.0.5 Source7: v%{libipt_version}.tar.gz # Infrastructure to sync patches from the Fedora rpm @@ -140,6 +140,9 @@ Source13: gdb-rpmlintrc Source14: clean.sh Source15: import-patches.sh Source16: qa.sh +Source17: qa-local.sh +Source18: qa-remote.sh +Source19: README.qa %if %{build_testsuite} NoSource: 0 @@ -155,83 +158,80 @@ NoSource: 13 NoSource: 14 NoSource: 15 NoSource: 16 +NoSource: 17 +NoSource: 18 +NoSource: 19 %endif -# Fedora import from branch f35, commit 9cd9368 "Rebase to FSF GDB 11.1." +# Fedora import from branch f36, commit 89947a7 "Rebase to FSF GDB 12.1." #Fedora Packages begin Patch2: gdb-6.3-gstack-20050411.patch Patch3: gdb-6.3-test-dtorfix-20050121.patch Patch4: gdb-6.3-test-movedir-20050125.patch Patch5: gdb-6.3-threaded-watchpoints2-20050225.patch -Patch6: gdb-6.3-inferior-notification-20050721.patch -Patch7: gdb-6.3-inheritancetest-20050726.patch -Patch8: gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch -Patch9: gdb-6.5-sharedlibrary-path.patch -Patch11: gdb-6.5-last-address-space-byte-test.patch -Patch12: gdb-6.5-readline-long-line-crash-test.patch -Patch13: gdb-6.5-bz218379-ppc-solib-trampoline-test.patch -Patch14: gdb-6.5-bz109921-DW_AT_decl_file-test.patch -Patch15: gdb-6.3-bz140532-ppc-unwinding-test.patch -Patch16: gdb-6.3-bz202689-exec-from-pthread-test.patch -Patch17: gdb-6.6-bz230000-power6-disassembly-test.patch -Patch18: gdb-6.6-bz229517-gcore-without-terminal.patch -Patch19: gdb-6.6-testsuite-timeouts.patch -Patch20: gdb-6.6-bz237572-ppc-atomic-sequence-test.patch -Patch21: gdb-6.3-attach-see-vdso-test.patch -Patch22: gdb-6.5-bz243845-stale-testing-zombie-test.patch -Patch23: gdb-6.6-buildid-locate.patch -Patch24: gdb-6.6-buildid-locate-solib-missing-ids.patch -Patch25: gdb-6.6-buildid-locate-rpm.patch -Patch27: gdb-6.7-ppc-clobbered-registers-O2-test.patch -Patch28: gdb-6.7-testsuite-stable-results.patch -Patch29: gdb-6.5-ia64-libunwind-leak-test.patch -Patch30: gdb-6.5-missed-trap-on-step-test.patch -Patch31: gdb-6.5-gcore-buffer-limit-test.patch -Patch32: gdb-6.3-mapping-zero-inode-test.patch -Patch33: gdb-6.3-focus-cmd-prev-test.patch -Patch34: gdb-6.8-bz442765-threaded-exec-test.patch -Patch35: gdb-6.5-section-num-fixup-test.patch -Patch37: gdb-simultaneous-step-resume-breakpoint-test.patch -Patch38: gdb-core-open-vdso-warning.patch -Patch39: gdb-ccache-workaround.patch -Patch40: gdb-lineno-makeup-test.patch -Patch41: gdb-ppc-power7-test.patch -Patch42: gdb-archer-next-over-throw-cxx-exec.patch -Patch43: gdb-bz601887-dwarf4-rh-test.patch -Patch44: gdb-6.6-buildid-locate-rpm-librpm-workaround.patch -Patch45: gdb-test-bt-cfi-without-die.patch -Patch46: gdb-bz634108-solib_address.patch -Patch47: gdb-test-pid0-core.patch -Patch48: gdb-test-dw2-aranges.patch -Patch49: gdb-test-expr-cumulative-archer.patch -Patch50: gdb-physname-pr11734-test.patch -Patch51: gdb-physname-pr12273-test.patch -Patch52: gdb-test-ivy-bridge.patch -Patch53: gdb-runtest-pie-override.patch -Patch54: gdb-glibc-strstr-workaround.patch -Patch55: gdb-rhel5.9-testcase-xlf-var-inside-mod.patch -Patch56: gdb-rhbz-818343-set-solib-absolute-prefix-testcase.patch -Patch57: gdb-rhbz947564-findvar-assertion-frame-failed-testcase.patch -Patch58: gdb-rhbz1007614-memleak-infpy_read_memory-test.patch -Patch60: gdb-fortran-frame-string.patch -Patch61: gdb-rhbz1156192-recursive-dlopen-test.patch -Patch62: gdb-rhbz1149205-catch-syscall-after-fork-test.patch -Patch63: gdb-rhbz1186476-internal-error-unqualified-name-re-set-test.patch -Patch64: gdb-rhbz1350436-type-printers-error.patch -Patch65: gdb-rhbz1084404-ppc64-s390x-wrong-prologue-skip-O2-g-3of3.patch -Patch66: gdb-fedora-libncursesw.patch -Patch67: gdb-opcodes-clflushopt-test.patch -Patch68: gdb-6.6-buildid-locate-rpm-scl.patch -Patch69: gdb-rhbz1261564-aarch64-hw-watchpoint-test.patch -Patch70: gdb-container-rh-pkg.patch -Patch71: gdb-rhbz1325795-framefilters-test.patch -Patch72: gdb-linux_perf-bundle.patch -Patch74: gdb-rhbz1398387-tab-crash-test.patch -Patch75: gdb-rhbz1553104-s390x-arch12-test.patch -Patch76: gdb-rhbz1976887-field-location-kind.patch -Patch77: gdb-test-for-rhbz1976887.patch -Patch78: gdb-rhbz2012976-paper-over-fortran-lex-problems.patch +Patch6: gdb-6.3-inheritancetest-20050726.patch +Patch7: gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch +Patch8: gdb-6.5-sharedlibrary-path.patch +Patch10: gdb-6.5-last-address-space-byte-test.patch +Patch12: gdb-6.5-bz218379-ppc-solib-trampoline-test.patch +Patch13: gdb-6.5-bz109921-DW_AT_decl_file-test.patch +Patch14: gdb-6.3-bz140532-ppc-unwinding-test.patch +Patch15: gdb-6.3-bz202689-exec-from-pthread-test.patch +Patch16: gdb-6.6-bz230000-power6-disassembly-test.patch +Patch17: gdb-6.6-bz229517-gcore-without-terminal.patch +Patch18: gdb-6.6-testsuite-timeouts.patch +Patch19: gdb-6.6-bz237572-ppc-atomic-sequence-test.patch +Patch20: gdb-6.3-attach-see-vdso-test.patch +Patch21: gdb-6.5-bz243845-stale-testing-zombie-test.patch +Patch22: gdb-6.6-buildid-locate.patch +Patch23: gdb-6.6-buildid-locate-solib-missing-ids.patch +Patch24: gdb-6.6-buildid-locate-rpm.patch +Patch27: gdb-6.7-testsuite-stable-results.patch +Patch28: gdb-6.5-ia64-libunwind-leak-test.patch +Patch29: gdb-6.5-missed-trap-on-step-test.patch +Patch30: gdb-6.5-gcore-buffer-limit-test.patch +Patch31: gdb-6.3-mapping-zero-inode-test.patch +Patch32: gdb-6.3-focus-cmd-prev-test.patch +Patch33: gdb-6.8-bz442765-threaded-exec-test.patch +Patch34: gdb-6.5-section-num-fixup-test.patch +Patch36: gdb-simultaneous-step-resume-breakpoint-test.patch +Patch37: gdb-core-open-vdso-warning.patch +Patch38: gdb-ccache-workaround.patch +Patch39: gdb-lineno-makeup-test.patch +Patch40: gdb-ppc-power7-test.patch +Patch41: gdb-archer-next-over-throw-cxx-exec.patch +Patch42: gdb-bz601887-dwarf4-rh-test.patch +Patch43: gdb-6.6-buildid-locate-rpm-librpm-workaround.patch +Patch44: gdb-test-bt-cfi-without-die.patch +Patch45: gdb-bz634108-solib_address.patch +Patch46: gdb-test-pid0-core.patch +Patch47: gdb-test-dw2-aranges.patch +Patch48: gdb-test-expr-cumulative-archer.patch +Patch49: gdb-physname-pr11734-test.patch +Patch50: gdb-physname-pr12273-test.patch +Patch51: gdb-test-ivy-bridge.patch +Patch52: gdb-runtest-pie-override.patch +Patch53: gdb-glibc-strstr-workaround.patch +Patch54: gdb-rhel5.9-testcase-xlf-var-inside-mod.patch +Patch55: gdb-rhbz-818343-set-solib-absolute-prefix-testcase.patch +Patch56: gdb-rhbz947564-findvar-assertion-frame-failed-testcase.patch +Patch57: gdb-rhbz1007614-memleak-infpy_read_memory-test.patch +Patch59: gdb-fortran-frame-string.patch +Patch60: gdb-rhbz1156192-recursive-dlopen-test.patch +Patch61: gdb-rhbz1149205-catch-syscall-after-fork-test.patch +Patch62: gdb-rhbz1186476-internal-error-unqualified-name-re-set-test.patch +Patch63: gdb-rhbz1350436-type-printers-error.patch +Patch64: gdb-rhbz1084404-ppc64-s390x-wrong-prologue-skip-O2-g-3of3.patch +Patch65: gdb-fedora-libncursesw.patch +Patch66: gdb-opcodes-clflushopt-test.patch +Patch67: gdb-6.6-buildid-locate-rpm-scl.patch +Patch68: gdb-rhbz1261564-aarch64-hw-watchpoint-test.patch +Patch69: gdb-container-rh-pkg.patch +Patch70: gdb-rhbz1325795-framefilters-test.patch +Patch71: gdb-linux_perf-bundle.patch +Patch73: gdb-rhbz1398387-tab-crash-test.patch +Patch74: gdb-rhbz1553104-s390x-arch12-test.patch #Fedora Packages end # Fedora Packages not copied: @@ -245,19 +245,22 @@ Patch78: gdb-rhbz2012976-paper-over-fortran-lex-problems.patch # Broken: # - gdb-6.5-BEA-testsuite.patch # over-specific test-case in a shell script +# - gdb-6.5-readline-long-line-crash-test.patch +# Hangs for horizontal-scroll-mode on, times out after 10 minutes. # # Obsolete: # - gdb-6.7-charsign-test.patch +# - gdb-6.7-ppc-clobbered-registers-O2-test.patch # Fedora patches fixup Patch500: fixup-gdb-linux_perf-bundle.patch -Patch501: fixup-gdb-6.6-buildid-locate.patch -Patch502: fixup-2-gdb-6.6-buildid-locate.patch -Patch503: fixup-gdb-rhbz1325795-framefilters-test.patch -Patch504: fixup-gdb-rhbz1553104-s390x-arch12-test.patch -Patch505: fixup-gdb-glibc-strstr-workaround.patch -Patch506: fixup-gdb-6.5-bz243845-stale-testing-zombie-test.patch +Patch501: fixup-gdb-rhbz1325795-framefilters-test.patch +Patch502: fixup-gdb-rhbz1553104-s390x-arch12-test.patch +Patch503: fixup-gdb-glibc-strstr-workaround.patch +Patch504: fixup-gdb-6.5-bz243845-stale-testing-zombie-test.patch +Patch505: fixup-gdb-test-bt-cfi-without-die.patch +Patch506: fixup-2-gdb-rhbz1553104-s390x-arch12-test.patch # openSUSE specific @@ -301,118 +304,85 @@ Patch1505: gdb-testsuite-fix-gdb.base-step-over-syscall.exp-with-m32-amd-ca # breakpoint-condition-evaluation=host: target-non-stop=off: non-stop=off: \ # displaced=off: iter 1: all threads running Patch1506: gdb-testsuite-fix-race-in-gdb.threads-detach-step-over.exp.patch -# Fixes catch-syscall.exp FAILs on powerpc64. -Patch1507: gdb-tdep-update-syscalls-ppc64-ppc-linux.xml.patch # Backports from release branch -Patch1900: gdb-build-add-cxx_dialect-to-cxx.patch -Patch1901: gdb-tui-fix-breakpoint-display-functionality.patch -Patch1902: aarch64-make-gdbserver-register-set-selection-dynamic.patch +Patch1700: fix-core-file-detach-crash-corefiles-29275.patch # Backports from master, available in next release. -Patch2000: gdb-testsuite-fix-gdb.gdb-selftest.exp.patch -Patch2001: gdb-testsuite-refactor-regexp-in-gdb.base-annota1.exp.patch -Patch2002: gdb-testsuite-fix-fail-in-gdb.base-annota1.exp.patch -Patch2003: gdb-testsuite-fix-gdb.base-dcache-flush.exp.patch -Patch2004: gdb-testsuite-fix-fail-in-gdb.tui-corefile-run.exp.patch -Patch2005: gdb-testsuite-fix-gdb.threads-check-libthread-db.exp-with-glibc-2.34.patch -Patch2006: gdb-testsuite-fix-gdb.python-py-events.exp.patch -Patch2007: gdb-testsuite-handle-supports_memtag-in-gdb.base-gdb-caching-proc.exp.patch -Patch2008: gdb-symtab-fix-htab_find_slot-call-in-read_call_site_scope.patch -Patch2009: gdb-symtab-remove-compunit_call_site_htab.patch -Patch2010: gdb-symtab-add-call_site_eq-and-call_site_hash.patch -Patch2011: gdb-symtab-c-ify-call_site.patch -Patch2012: gdb-symtab-use-unrelocated-addresses-in-call_site.patch -Patch2013: gdb-testsuite-add-nopie-in-two-test-cases.patch -Patch2014: gdb-testsuite-use-compiler-generated-instead-of-gas-generated-stabs.patch -Patch2015: gdb-testsuite-support-fpie-fno-pie-pie-no-pie-in-gdb_compile_rust.patch -Patch2016: gdb-testsuite-fix-gdb.server-server-kill.exp-with-m32.patch -Patch2017: gdb-testsuite-fix-gdb.ada-big_packed_array.exp-xfail-for-m32.patch -Patch2018: fix-gdb.multi-multi-term-settings.exp-race.patch -Patch2019: gdb-testsuite-update-test-gdb.base-step-over-syscall.exp.patch -Patch2020: gdb-testsuite-fix-gdb.threads-linux-dp.exp.patch -Patch2021: gdb-testsuite-add-gdb.testsuite-dump-system-info.exp.patch -Patch2022: gdb-testsuite-factor-out-dump_info-in-gdb.testsuite-dump-system-info.exp.patch -Patch2023: gdb-testsuite-add-gdb.opt-break-on-_exit.exp.patch -Patch2024: gdb-tdep-rs6000-don-t-skip-system-call-in-skip_prologue.patch -Patch2025: gdb-testsuite-fix-stepi-test-cases-with-unix-m32-fpie-pie.patch -Patch2026: gdb-testsuite-fix-assembly-comments-in-gdb.dwarf2-clang-debug-names.exp.tcl.patch -Patch2027: gdb-doc-fix-print-inferior-events-default.patch -Patch2028: gdb-testsuite-fix-gdb.guile-scm-type.exp-with-gcc-4.8.patch -Patch2029: gdb-testsuite-add-gdb.arch-ppc64-break-on-_exit.exp.patch -Patch2030: gdb-testsuite-don-t-error-when-trying-to-unset-last_spawn_tty_name.patch -Patch2031: gdb-exp-improve-error-reading-variable-message.patch -Patch2032: fix-gdb.base-sigstep.exp-test-for-ppc.patch -Patch2033: gdb-testsuite-fix-regexp-in-gdb.base-foll-vfork.exp.patch -Patch2034: gdb-testsuite-add-missing-wait-in-gdb.base-signals-state-child.exp.patch -Patch2035: gdb-r_version-check.patch -Patch2036: ibm-z-add-another-arch14-instruction.patch -Patch2037: ibm-z-remove-lpswey-parameter.patch -Patch2038: fix-build-with-current-gcc-el_explicit-location-always-non-null.patch -Patch2039: gdb-testsuite-make-gdb.base-annota1.exp-more-robust.patch -Patch2040: gdb-testsuite-fix-gdb.base-annota1.exp-with-pie.patch -Patch2041: gdb-testsuite-detect-no-mpx-support.patch +Patch2000: gdb-testsuite-fix-gdb.opt-clobbered-registers-o2.exp-with-gcc-12.patch +Patch2001: gdb-testsuite-detect-change-instead-of-init-in-gdb.mi-mi-var-block.exp.patch +Patch2002: gdb-fix-for-gdb.base-eof-exit.exp-test-failures.patch +Patch2003: gdb-testsuite-handle-init-errors-in-gdb.mi-user-selected-context-sync.exp.patch +Patch2004: gdb-add-gdb-syscalls-makefile.patch +Patch2005: gdb-record-handle-statx-system-call.patch +Patch2006: gdb-tdep-handle-pipe2-syscall-for-amd64.patch +Patch2007: gdb-testsuite-handle-pipe2-syscall-in-gdb.base-catch-syscall.exp.patch +Patch2008: gdb-tdep-support-catch-syscall-pipe2-for-i386.patch +Patch2009: gdb-update-syscalls-amd64-i386-linux.xml.patch +Patch2010: gdb-testsuite-address-test-failures-in-gdb.mi-mi-multi-commands.exp.patch +Patch2011: gdb-testsuite-fix-occasional-failure-in-gdb.mi-mi-multi-commands.exp.patch +Patch2012: gdb-testsuite-fix-test-failure-when-building-against-readline-v7.patch +Patch2013: gdb-improved-eof-handling-when-using-readline-7.patch +Patch2014: gdb-testsuite-remove-attach-test-from-can_spawn_for_attach.patch +Patch2015: powerpc-update-expected-floating-point-output-for-gdb.arch-altivec-regs.exp-and-gdb.arch-vsx-regs.exp.patch +Patch2016: powerpc-add-support-for-ieee-128-bit-format.patch +Patch2017: powerpc-correct-the-gdb-ioctl-values-for-tcgets-tcsets-tcsetsw-and-tcsetsf.patch +Patch2018: gdb-testsuite-remove-target-limits-in-gdb.base-catch-syscall.exp.patch +Patch2019: gdb-tdep-update-syscalls-ppc64-ppc-linux.xml.patch +Patch2020: powerpc-fix-for-gdb.base-eh_return.exp.patch +Patch2021: fix-comparison-of-unsigned-long-int-to-int-in-record_linux_system_call.patch +Patch2022: gdb-testsuite-fix-gdb.reverse-test_ioctl_tcsetsw.exp-with-libc-debuginfo.patch +Patch2023: gdb-testsuite-fix-gdb.dwarf2-dw2-out-of-range-end-of-seq.exp-on-aarch64.patch +Patch2024: gdb-testsuite-support-recording-of-getrandom.patch +Patch2025: gdb-testsuite-fix-gdb.base-catch-syscall.exp-without-enable-targets.patch +Patch2026: gdb-testsuite-fix-gdb.base-catch-syscall.exp-with-with-expat-no.patch +Patch2027: fix-for-gdb.base-solib-search.exp-test.patch +Patch2028: make-gdb.ada-float-bits.exp-more-generic.patch +Patch2029: gdb-testsuite-fix-gdb.threads-killed-outside.exp-on-aarch64.patch + # Backports from master, not yet available in next release. -Patch2080: gdb-testsuite-handle-init-errors-in-gdb.mi-user-selected-context-sync.exp.patch -Patch2081: gdb-add-gdb-syscalls-makefile.patch +# # Backport from gdb-patches -# https://sourceware.org/pipermail/gdb-patches/2021-October/182474.html -Patch2100: gdb-build-make-c-exp.y-work-with-bison-3.8.patch # https://sourceware.org/pipermail/gdb-patches/2021-September/182226.html -Patch2101: gdb-python-finishbreakpoint-update.patch +Patch2100: gdb-python-finishbreakpoint-update.patch # https://sourceware.org/pipermail/gdb-patches/2021-October/182444.html -Patch2102: gdb-testsuite-prevent-compilation-fails-with-unix-fpie-pie.patch -# https://sourceware.org/pipermail/gdb-patches/2021-October/182572.html -Patch2103: gdb-fortran-handle-dw-at-string-length-with-loclistptr.patch -# https://sourceware.org/pipermail/gdb-patches/2021-August/181576.html -Patch2104: gdb-testsuite-handle-recursive-internal-problem-in-gdb_internal_error_resync.patch -# https://sourceware.org/pipermail/gdb-patches/2021-October/182800.html -Patch2105: gdb-testsuite-handle-runto-fail-in-gdb.mi-mi-var-cp.exp.patch +Patch2101: gdb-testsuite-prevent-compilation-fails-with-unix-fpie-pie.patch # https://sourceware.org/pipermail/gdb-patches/2021-October/182847.html -Patch2106: gdb-testsuite-fix-fail-in-gdb.threads-fork-and-threads.exp.patch +Patch2102: gdb-testsuite-fix-fail-in-gdb.threads-fork-and-threads.exp.patch # https://sourceware.org/pipermail/gdb-patches/2021-October/182846.html -Patch2107: gdb-testsuite-add-kfail-in-gdb.threads-fork-plus-threads.exp.patch -# https://sourceware.org/pipermail/gdb-patches/2021-October/182855.html -Patch2108: gdb-testsuite-fix-port-detection-in-gdb.debuginfod-fetch_src_and_symbols.exp.patch -# https://sourceware.org/pipermail/gdb-patches/2021-October/182868.html -Patch2110: gdb-testsuite-fix-gdb.threads-thread-specific-bp.exp.patch +Patch2103: gdb-testsuite-add-kfail-in-gdb.threads-fork-plus-threads.exp.patch # https://sourceware.org/pipermail/gdb-patches/2021-October/182919.html -Patch2111: gdb-testsuite-work-around-skip_prologue-problems-in-gdb.threads-process-dies-while-detaching.exp.patch -# https://sourceware.org/pipermail/gdb-patches/2021-October/182921.html -Patch2112: gdb-testsuite-handle-sigill-in-two-gdb.arch-powerpc-test-cases.patch +Patch2104: gdb-testsuite-work-around-skip_prologue-problems-in-gdb.threads-process-dies-while-detaching.exp.patch # https://sourceware.org/pipermail/gdb-patches/2021-May/178990.html -Patch2114: gdb-cli-add-ignore-errors-command.patch -# https://sourceware.org/pipermail/gdb-patches/2021-November/183183.html -Patch2115: gdb-testsuite-fix-data-alignment-in-gdb.arch-i386-avx-sse-.exp.patch -# https://sourceware.org/pipermail/gdb-patches/2021-October/182887.html -Patch2116: gdb-testsuite-fix-fail-in-gdb.tui-basic.exp.patch -# https://sourceware.org/pipermail/gdb-patches/2021-November/date.html -Patch2117: gdb-testsuite-disable-inferior-output-in-gdb.base-foll-vfork.exp.patch -# https://sourceware.org/pipermail/gdb-patches/2021-November/183363.html -Patch2118: gdb-symtab-fix-segfault-in-search_one_symtab.patch -# https://sourceware.org/pipermail/gdb-patches/2021-November/183939.html -Patch2119: gdb-testsuite-fix-gdb.arch-i386-pkru.exp-on-linux.patch -# https://sourceware.org/pipermail/gdb-patches/2021-November/183960.html -Patch2120: gdb-tdep-fix-avx512-m32-support-in-gdbserver.patch -# https://sourceware.org/pipermail/gdb-patches/2021-December/184241.html -Patch2121: gdb-ada-fix-assert-in-ada_is_unconstrained_packed_array_type.patch -# https://sourceware.org/pipermail/gdb-patches/2022-May/188661.html -Patch2122: gdb-tdep-handle-pipe2-syscall-for-amd64.patch -# https://sourceware.org/pipermail/gdb-patches/2022-May/188732.html -Patch2123: gdb-testsuite-handle-pipe2-syscall-in-gdb.base-catch-syscall.exp.patch -# https://sourceware.org/pipermail/gdb-patches/2022-May/188733.html -Patch2124: gdb-tdep-support-catch-syscall-pipe2-for-i386.patch -# https://sourceware.org/pipermail/gdb-patches/2022-May/188844.html -Patch2125: gdb-update-syscalls-amd64-i386-linux.xml.patch -# https://sourceware.org/pipermail/gdb-patches/2022-May/188845.html -Patch2126: gdb-record-handle-statx-system-call.patch +Patch2105: gdb-cli-add-ignore-errors-command.patch +# https://sourceware.org/pipermail/gdb-patches/2022-June/189994.html +Patch2106: gdb-testsuite-skip-gdb.fortran-namelist.exp-for-gfortran-4.8.patch +# https://sourceware.org/pipermail/gdb-patches/2022-June/189995.html +Patch2107: gdb-testsuite-workaround-unnecessary-.s-file-with-gfortran-4.8.patch +# https://sourceware.org/pipermail/gdb-patches/2022-June/190045.html +Patch2108: gdb-testsuite-handle-quotes-in-gdb_py_module_available.patch +# https://sourceware.org/pipermail/gdb-patches/2022-June/190046.html +Patch2109: gdb-testsuite-handle-unordered-dict-in-gdb.python-py-mi-cmd.exp.patch +# https://sourceware.org/pipermail/gdb-patches/2022-June/190054.html +Patch2110: gdb-testsuite-handle-older-python-in-gdb.python-py-send-packet.py.patch +# https://sourceware.org/pipermail/gdb-patches/2022-June/190248.html +Patch2111: gdb-testsuite-enable-some-test-cases-for-x86_64-m32.patch +# https://sourceware.org/pipermail/gdb-patches/2022-June/190249.html +Patch2112: gdb-testsuite-fix-gdb.reverse-i387-env-reverse.exp-for-pie.patch +# https://sourceware.org/pipermail/gdb-patches/2022-July/191107.html +Patch2113: gdb-testsuite-fix-gdb.ada-literals.exp-with-aarch64.patch +# https://sourceware.org/bugzilla/show_bug.cgi?id=29423#c8 +Patch2114: gdb-fix-watchpoints-triggered.patch +# Debug patches. + +# BuildRequires: bison @@ -608,6 +578,10 @@ BuildRequires: elfutils-debuginfod BuildRequires: xz %endif +# Provide python package xml.etree.ElementTree, used by test-case +# gdb.python/py-send-packet.exp. +BuildRequires: python-xml + %endif # %%{build_testsuite} %ifarch ia64 @@ -682,8 +656,7 @@ find -name "*.info*"|xargs rm -f %patch6 -p1 %patch7 -p1 %patch8 -p1 -%patch9 -p1 -%patch11 -p1 +%patch10 -p1 %patch12 -p1 %patch13 -p1 %patch14 -p1 @@ -697,7 +670,6 @@ find -name "*.info*"|xargs rm -f %patch22 -p1 %patch23 -p1 %patch24 -p1 -%patch25 -p1 %patch27 -p1 %patch28 -p1 %patch29 -p1 @@ -706,7 +678,7 @@ find -name "*.info*"|xargs rm -f %patch32 -p1 %patch33 -p1 %patch34 -p1 -%patch35 -p1 +%patch36 -p1 %patch37 -p1 %patch38 -p1 %patch39 -p1 @@ -728,7 +700,7 @@ find -name "*.info*"|xargs rm -f %patch55 -p1 %patch56 -p1 %patch57 -p1 -%patch58 -p1 +%patch59 -p1 %patch60 -p1 %patch61 -p1 %patch62 -p1 @@ -741,12 +713,8 @@ find -name "*.info*"|xargs rm -f %patch69 -p1 %patch70 -p1 %patch71 -p1 -%patch72 -p1 +%patch73 -p1 %patch74 -p1 -%patch75 -p1 -%patch76 -p1 -%patch77 -p1 -%patch78 -p1 #Fedora patching end %patch500 -p1 @@ -771,11 +739,8 @@ find -name "*.info*"|xargs rm -f %patch1504 -p1 %patch1505 -p1 %patch1506 -p1 -%patch1507 -p1 -%patch1900 -p1 -%patch1901 -p1 -%patch1902 -p1 +%patch1700 -p1 %patch2000 -p1 %patch2001 -p1 @@ -807,21 +772,6 @@ find -name "*.info*"|xargs rm -f %patch2027 -p1 %patch2028 -p1 %patch2029 -p1 -%patch2030 -p1 -%patch2031 -p1 -%patch2032 -p1 -%patch2033 -p1 -%patch2034 -p1 -%patch2035 -p1 -%patch2036 -p1 -%patch2037 -p1 -%patch2038 -p1 -%patch2039 -p1 -%patch2040 -p1 -%patch2041 -p1 - -%patch2080 -p1 -%patch2081 -p1 %patch2100 -p1 %patch2101 -p1 @@ -832,22 +782,13 @@ find -name "*.info*"|xargs rm -f %patch2106 -p1 %patch2107 -p1 %patch2108 -p1 +%patch2109 -p1 %patch2110 -p1 %patch2111 -p1 %patch2112 -p1 +%patch2113 -p1 %patch2114 -p1 -%patch2115 -p1 -%patch2116 -p1 -%patch2117 -p1 -%patch2118 -p1 -%patch2119 -p1 -%patch2120 -p1 -%patch2121 -p1 -%patch2122 -p1 -%patch2123 -p1 -%patch2124 -p1 -%patch2125 -p1 -%patch2126 -p1 + #unpack libipt %if 0%{have_libipt} @@ -1174,7 +1115,6 @@ $CC -o ./orphanripper %{SOURCE2} -Wall -lutil -ggdb2 # RUNTESTFLAGS='--ignore ...' is not used below as it gets separated by the # `check//...' target spawn and too much escaping there would be dense. DISABLE_TESTS= - DISABLE_TESTS="$DISABLE_TESTS gdb.base/readline-overflow.exp" DISABLE_TESTS="$DISABLE_TESTS gdb.base/bigcore.exp" DISABLE_TESTS="$DISABLE_TESTS gdb.threads/attach-many-short-lived-threads.exp" %if 0%{suse_version} == 1110 @@ -1235,7 +1175,7 @@ touch -r %{SOURCE5} $RPM_BUILD_ROOT%{_sysconfdir}/gdbinit for i in `find $RPM_BUILD_ROOT%{_datadir}/gdb/python/gdb -name "*.py"` do # Files could be also patched getting the current time. - touch -r $RPM_BUILD_DIR/%{gdb_src}/gdb/ChangeLog $i + touch -r $RPM_BUILD_DIR/%{gdb_src}/gdb/version.in $i done %if 0%{?_enable_debug_packages:1} && 0%{!?_without_python:1} @@ -1269,7 +1209,7 @@ for i in `find $RPM_BUILD_ROOT%{_datadir}/gdb/python -name "*.py"` \ `find $RPM_BUILD_ROOT%{_datadir}/gdb/auto-load%{_prefix} -name "*.py"` \ ; do # Files come from gdb-archer.patch and can be also further patched. - touch -r $RPM_BUILD_DIR/%{gdb_src}/gdb/ChangeLog $i + touch -r $RPM_BUILD_DIR/%{gdb_src}/gdb/version.in $i done %endif # 0%{!?_without_python:1} %endif # 0%{?rhel:1} && 0%{?rhel} <= 6 @@ -1335,6 +1275,7 @@ make -j1 -C gdb/doc install DESTDIR=$RPM_BUILD_ROOT # Documentation only for development; keep 'rm's here after "noarch" above. rm -f $RPM_BUILD_ROOT%{_infodir}/gdbint* rm -f $RPM_BUILD_ROOT%{_infodir}/stabs* +rm -f $RPM_BUILD_ROOT%{_infodir}/ctf-spec* # Delete this too because the dir file will be updated at rpm install time. # We don't want a gdb specific one overwriting the system wide one. diff --git a/ibm-z-add-another-arch14-instruction.patch b/ibm-z-add-another-arch14-instruction.patch deleted file mode 100644 index f8a4bf0..0000000 --- a/ibm-z-add-another-arch14-instruction.patch +++ /dev/null @@ -1,27 +0,0 @@ -IBM Z: Add another arch14 instruction - -opcodes/ - - * opcodes/s390-opc.txt: Add qpaci. - -gas/ - - * testsuite/gas/s390/zarch-arch14.d: Add qpaci. - * testsuite/gas/s390/zarch-arch14.s: Add qpaci. - ---- - gas/testsuite/gas/s390/zarch-arch14.d | 1 + - gas/testsuite/gas/s390/zarch-arch14.s | 1 + - opcodes/s390-opc.txt | 2 ++ - 3 files changed, 4 insertions(+) - -diff --git a/opcodes/s390-opc.txt b/opcodes/s390-opc.txt -index aa00b4f3b69..dfd5617f0ae 100644 ---- a/opcodes/s390-opc.txt -+++ b/opcodes/s390-opc.txt -@@ -2044,3 +2044,5 @@ b98B rdp RRF_RURR2 " " arch14 zarch optparm - eb0000000071 lpswey SIY_URD " " arch14 zarch - b200 lbear S_RD " " arch14 zarch - b201 stbear S_RD " " arch14 zarch -+ -+b28f qpaci S_RD " " arch14 zarch diff --git a/ibm-z-remove-lpswey-parameter.patch b/ibm-z-remove-lpswey-parameter.patch deleted file mode 100644 index b5ecc0c..0000000 --- a/ibm-z-remove-lpswey-parameter.patch +++ /dev/null @@ -1,52 +0,0 @@ -IBM Z: Remove lpswey parameter - -opcodes/ - * s390-opc.c (INSTR_SIY_RD): New instruction format. - (MASK_SIY_RD): New instruction mask. - * s390-opc.txt: Change instruction format of lpswey to SIY_RD. - -gas/ - * testsuite/gas/s390/zarch-arch14.d: Remove last operand of - lpswey. - * testsuite/gas/s390/zarch-arch14.s: Likewise. - ---- - gas/testsuite/gas/s390/zarch-arch14.d | 2 +- - gas/testsuite/gas/s390/zarch-arch14.s | 2 +- - opcodes/s390-opc.c | 2 ++ - opcodes/s390-opc.txt | 2 +- - 4 files changed, 5 insertions(+), 3 deletions(-) - -diff --git a/opcodes/s390-opc.c b/opcodes/s390-opc.c -index 5545dacffff..64453d945f8 100644 ---- a/opcodes/s390-opc.c -+++ b/opcodes/s390-opc.c -@@ -442,6 +442,7 @@ const struct s390_operand s390_operands[] = - #define INSTR_RX_URRD 4, { U4_8,D_20,X_12,B_16,0,0 } /* e.g. bc */ - #define INSTR_SI_RD 4, { D_20,B_16,0,0,0,0 } /* e.g. lpsw */ - #define INSTR_SI_URD 4, { D_20,B_16,U8_8,0,0,0 } /* e.g. cli */ -+#define INSTR_SIY_RD 6, { D20_20,B_16,0,0,0,0 } /* e.g. lpswey*/ - #define INSTR_SIY_URD 6, { D20_20,B_16,U8_8,0,0,0 } /* e.g. tmy */ - #define INSTR_SIY_IRD 6, { D20_20,B_16,I8_8,0,0,0 } /* e.g. asi */ - #define INSTR_SIL_RDI 6, { D_20,B_16,I16_32,0,0,0 } /* e.g. chhsi */ -@@ -664,6 +665,7 @@ const struct s390_operand s390_operands[] = - #define MASK_RX_URRD { 0xff, 0x00, 0x00, 0x00, 0x00, 0x00 } - #define MASK_SI_RD { 0xff, 0x00, 0x00, 0x00, 0x00, 0x00 } - #define MASK_SI_URD { 0xff, 0x00, 0x00, 0x00, 0x00, 0x00 } -+#define MASK_SIY_RD { 0xff, 0xff, 0x00, 0x00, 0x00, 0xff } - #define MASK_SIY_URD { 0xff, 0x00, 0x00, 0x00, 0x00, 0xff } - #define MASK_SIY_IRD { 0xff, 0x00, 0x00, 0x00, 0x00, 0xff } - #define MASK_SIL_RDI { 0xff, 0xff, 0x00, 0x00, 0x00, 0x00 } -diff --git a/opcodes/s390-opc.txt b/opcodes/s390-opc.txt -index dfd5617f0ae..ad4b6aebc2b 100644 ---- a/opcodes/s390-opc.txt -+++ b/opcodes/s390-opc.txt -@@ -2041,7 +2041,7 @@ e60000000055 vcnf VRR_VV0UU2 " " arch14 zarch - - b98B rdp RRF_RURR2 " " arch14 zarch optparm - --eb0000000071 lpswey SIY_URD " " arch14 zarch -+eb0000000071 lpswey SIY_RD " " arch14 zarch - b200 lbear S_RD " " arch14 zarch - b201 stbear S_RD " " arch14 zarch - diff --git a/make-gdb.ada-float-bits.exp-more-generic.patch b/make-gdb.ada-float-bits.exp-more-generic.patch new file mode 100644 index 0000000..2f06924 --- /dev/null +++ b/make-gdb.ada-float-bits.exp-more-generic.patch @@ -0,0 +1,145 @@ +Make gdb.ada/float-bits.exp more generic + +There are assumptions in the test about the long double format +being used. While the results are OK for i387 128-bit long doubles, it +is not correct for IEEE quad 128-bit long doubles. + +Also, depending on the target (64-bit/32-bit), long doubles may not +be available at all. And it may be the case that the compiler for a 64-bit +target doesn't support 128-bit long doubles, but GDB might still support it +internally. + +Lastly, not every long double format has invalid values. Some formats +consider all values as valid floating point numbers. + +These divergences cause the following FAIL's on aarch64/arm: + +FAIL: gdb.ada/float-bits.exp: print val_long_double +FAIL: gdb.ada/float-bits.exp: print val_long_double after assignment + +With the above in mind, extend the test a little so it behaves well on +different architectures and so it works with different long double +formats. + +Main changes: + +- Use long double values appropriate for the long double format. +- Test long double assignment to compiler-generated long + double variables. +- Test long double assignment to GDB internal variables. + +Tested on x86_64 (16 PASS), i686 (16 PASS), aarch64 (12 PASS) and arm (9 PASS). + +--- + gdb/testsuite/gdb.ada/float-bits.exp | 87 ++++++++++++++++++++++++++++-------- + 1 file changed, 68 insertions(+), 19 deletions(-) + +diff --git a/gdb/testsuite/gdb.ada/float-bits.exp b/gdb/testsuite/gdb.ada/float-bits.exp +index 4ca8dbf88e5..55a0566580c 100644 +--- a/gdb/testsuite/gdb.ada/float-bits.exp ++++ b/gdb/testsuite/gdb.ada/float-bits.exp +@@ -25,6 +25,27 @@ if {[gdb_compile_ada "${srcfile}" "${binfile}" executable {debug}] != ""} { + return -1 + } + ++# Given a floating point EXPRESSION, return the size of the result. ++ ++proc float_size { expression } { ++ ++ set size 0 ++ gdb_test_multiple "ptype ${expression}" "" { ++ -re -wrap "<16-byte float>" { ++ set size 16 ++ } ++ -re -wrap "<12-byte float>" { ++ set size 12 ++ } ++ -re -wrap "<\\d+-byte float>" { ++ # Assume 8 for anything less than or equal to 8. ++ set size 8 ++ } ++ } ++ ++ return $size ++} ++ + clean_restart ${testfile} + + set bp_location [gdb_get_line_number "BREAK" ${testdir}/prog.adb] +@@ -42,29 +63,57 @@ gdb_test "print val_double := 16lf#bc0d83c94fb6d2ac#" " = -2.0e-19" + gdb_test "print val_double" " = -2.0e-19" \ + "print val_double after assignment" + +-set 16llf_supported 0 +-gdb_test_multiple "ptype long_long_float" "" { +- -re -wrap "<16-byte float>" { +- set 16llf_supported 1 +- pass $gdb_test_name +- } +- -re -wrap "<\\d+-byte float>" { +- pass $gdb_test_name ++# Fetch the size of a compiler-generated long double. ++set compiler_long_double_size [float_size "long_long_float" ] ++ ++# Fetch the size of an internal long double type in GDB. ++set gdb_long_double_size [float_size "16llf#0#" ] ++ ++# Different architectures use different long double formats. For ++# example, IEEE quad versus i387 long doubles. Account for that in the ++# tests below. ++ ++# Set default values for 128-bit IEEE quad long doubles. ++set valid_long_double "16llf#4000921fb54442d18469898cc51701b8#" ++set printed_long_double "3.1415926535897932384626433832795028" ++set invalid_long_double "" ++set has_invalid_long_double 0 ++ ++if { [istarget x86_64-*-* ] || [istarget i?86-*-*] } { ++ # i387 long double have invalid values ++ set has_invalid_long_double 1 ++ if { $compiler_long_double_size == 16 } { ++ # 5.0e+25 in i387 128-bit long double. ++ set valid_long_double "16llf#7ffff7ff4054a56fa5b99019a5c8#" ++ set invalid_long_double "16llf#a56fa5b99019a5c800007ffff7ff4054#" ++ set printed_long_double "5.0e\\+25" ++ } elseif { $compiler_long_double_size == 12 } { ++ # 5.0e+25 in i387 80-bit long double. ++ set valid_long_double "16llf#56554054a56fa5b99019a5c8#" ++ set invalid_long_double "16llf#9019a5c800007ffff7ff4054#" ++ set printed_long_double "5.0e\\+25" + } + } + +-if { $16llf_supported } { +- gdb_test "print 16llf#7FFFF7FF4054A56FA5B99019A5C8#" " = 5.0e\\+25" ++# Exercise GDB-side long doubles. ++if { $gdb_long_double_size > 8 } { ++ gdb_test "print ${valid_long_double}" " = ${printed_long_double}" ++ gdb_test "print \$foo:=${valid_long_double}" "= ${printed_long_double}" ++ gdb_test "print \$foo" "= ${printed_long_double}" \ ++ "print internal long double variable after assignment" + } +-gdb_test "print val_long_double" " = 5.0e\\+25" +-if { $16llf_supported } { +- gdb_test "print val_long_double := 16llf#7FFFF7FF4054A56FA5B99019A5C8#" \ +- " = 5.0e\\+25" ++ ++# Exercise compiler-side long doubles. ++if { $compiler_long_double_size > 8 } { ++ gdb_test "print val_long_double" " = 5.0e\\+25" ++ gdb_test "print val_long_double := ${valid_long_double}" \ ++ " = ${printed_long_double}" ++ gdb_test "print val_long_double" " = ${printed_long_double}" \ ++ "print val_long_double after assignment" + } +-gdb_test "print val_long_double" " = 5.0e\\+25" \ +- "print val_long_double after assignment" + +-if { $16llf_supported } { +- gdb_test "print 16llf#a56fa5b99019a5c800007ffff7ff4054#" \ +- " = " ++# If the target has invalid long double values, test it now. ++if { $has_invalid_long_double } { ++ gdb_test "print ${invalid_long_double}" \ ++ " = " "print invalid long double value" + } diff --git a/powerpc-add-support-for-ieee-128-bit-format.patch b/powerpc-add-support-for-ieee-128-bit-format.patch new file mode 100644 index 0000000..80d5bd5 --- /dev/null +++ b/powerpc-add-support-for-ieee-128-bit-format.patch @@ -0,0 +1,192 @@ +PowerPC: Add support for IEEE 128-bit format. + +The test gdb.base/infcall-nested-structs-c.exp fails on a gdb assert +in function ppc64_sysv_abi_return_value in file gdb/ppc-sysv-tdep.c. The +assert is due to the missing IEEE 128-bit support in file +gdb/ppc-sysv-tdep.c. + +The IBM long double was the initial float 128-bit support added by IBM +The IEEE 128-bit support, which is similar IBM long double support, was +made the default starting with GCC 12. The floating point format +differences include the number of bits used to encode the exponent +and significand. Also, IBM long double values are passed in a pair of +floating point registers. The IEEE 128-bit value is passed in a single +vector register. + +This patch fixes the gdb_assert (ok); in function +ppc64_sysv_abi_return_value in gdb/ppc-sysv-tdep.c by adding IEEE FLOAT +128-bit type support for PowerPC. + +The patch has been tested on Power 10, ELFv2. It fixes the following list +of regression failures on Power 10: + +gdb.base/infcall-nested-structs-c.exp 192 +gdb.base/infcall-nested-structs-c++.exp 76 +gdb.base/structs.exp 9 + +The patch has been tested on Power 8 BE which is ELFv1. + +--- + gdb/ppc-sysv-tdep.c | 87 ++++++++++++++++++++++++++++++++++++++++++----------- + 1 file changed, 69 insertions(+), 18 deletions(-) + +diff --git a/gdb/ppc-sysv-tdep.c b/gdb/ppc-sysv-tdep.c +index 9a3b02f028d..b7106542b5d 100644 +--- a/gdb/ppc-sysv-tdep.c ++++ b/gdb/ppc-sysv-tdep.c +@@ -450,12 +450,17 @@ ppc_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function, + } + } + else if (len == 16 +- && type->code () == TYPE_CODE_ARRAY +- && type->is_vector () +- && tdep->vector_abi == POWERPC_VEC_ALTIVEC) ++ && ((type->code () == TYPE_CODE_ARRAY ++ && type->is_vector () ++ && tdep->vector_abi == POWERPC_VEC_ALTIVEC) ++ || (type->code () == TYPE_CODE_FLT ++ && (gdbarch_long_double_format (gdbarch) ++ == floatformats_ia64_quad)))) + { + /* Vector parameter passed in an Altivec register, or +- when that runs out, 16 byte aligned stack location. */ ++ when that runs out, 16 byte aligned stack location. ++ IEEE FLOAT 128-bit also passes parameters in vector ++ registers. */ + if (vreg <= 13) + { + if (write_pass) +@@ -1180,7 +1185,8 @@ ppc64_aggregate_candidate (struct type *type, + + static int + ppc64_elfv2_abi_homogeneous_aggregate (struct type *type, +- struct type **elt_type, int *n_elts) ++ struct type **elt_type, int *n_elts, ++ struct gdbarch *gdbarch) + { + /* Complex types at the top level are treated separately. However, + complex types can be elements of homogeneous aggregates. */ +@@ -1193,9 +1199,20 @@ ppc64_elfv2_abi_homogeneous_aggregate (struct type *type, + + if (field_count > 0) + { +- int n_regs = ((field_type->code () == TYPE_CODE_FLT +- || field_type->code () == TYPE_CODE_DECFLOAT)? +- (TYPE_LENGTH (field_type) + 7) >> 3 : 1); ++ int n_regs; ++ ++ if (field_type->code () == TYPE_CODE_FLT ++ && (gdbarch_long_double_format (gdbarch) ++ == floatformats_ia64_quad)) ++ /* IEEE Float 128-bit uses one vector register. */ ++ n_regs = 1; ++ ++ else if (field_type->code () == TYPE_CODE_FLT ++ || field_type->code () == TYPE_CODE_DECFLOAT) ++ n_regs = (TYPE_LENGTH (field_type) + 7) >> 3; ++ ++ else ++ n_regs = 1; + + /* The ELFv2 ABI allows homogeneous aggregates to occupy + up to 8 registers. */ +@@ -1422,7 +1439,16 @@ ppc64_sysv_abi_push_param (struct gdbarch *gdbarch, + ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch); + + if (type->code () == TYPE_CODE_FLT +- || type->code () == TYPE_CODE_DECFLOAT) ++ && TYPE_LENGTH (type) == 16 ++ && (gdbarch_long_double_format (gdbarch) ++ == floatformats_ia64_quad)) ++ { ++ /* IEEE FLOAT128, args in vector registers. */ ++ ppc64_sysv_abi_push_val (gdbarch, val, TYPE_LENGTH (type), 0, argpos); ++ ppc64_sysv_abi_push_vreg (gdbarch, val, argpos); ++ } ++ else if (type->code () == TYPE_CODE_FLT ++ || type->code () == TYPE_CODE_DECFLOAT) + { + /* Floating-point scalars are passed in floating-point registers. */ + ppc64_sysv_abi_push_val (gdbarch, val, TYPE_LENGTH (type), 0, argpos); +@@ -1494,14 +1520,22 @@ ppc64_sysv_abi_push_param (struct gdbarch *gdbarch, + single floating-point value, at any level of nesting of + single-member structs, are passed in floating-point registers. */ + if (type->code () == TYPE_CODE_STRUCT +- && type->num_fields () == 1) ++ && type->num_fields () == 1 && tdep->elf_abi == POWERPC_ELF_V1) + { + while (type->code () == TYPE_CODE_STRUCT + && type->num_fields () == 1) + type = check_typedef (type->field (0).type ()); + +- if (type->code () == TYPE_CODE_FLT) +- ppc64_sysv_abi_push_freg (gdbarch, type, val, argpos); ++ if (type->code () == TYPE_CODE_FLT) { ++ /* Handle the case of 128-bit floats for both IEEE and IBM long double ++ formats. */ ++ if (TYPE_LENGTH (type) == 16 ++ && (gdbarch_long_double_format (gdbarch) ++ == floatformats_ia64_quad)) ++ ppc64_sysv_abi_push_vreg (gdbarch, val, argpos); ++ else ++ ppc64_sysv_abi_push_freg (gdbarch, type, val, argpos); ++ } + } + + /* In the ELFv2 ABI, homogeneous floating-point or vector +@@ -1511,13 +1545,23 @@ ppc64_sysv_abi_push_param (struct gdbarch *gdbarch, + struct type *eltype; + int i, nelt; + +- if (ppc64_elfv2_abi_homogeneous_aggregate (type, &eltype, &nelt)) ++ if (ppc64_elfv2_abi_homogeneous_aggregate (type, &eltype, &nelt, ++ gdbarch)) + for (i = 0; i < nelt; i++) + { + const gdb_byte *elval = val + i * TYPE_LENGTH (eltype); + + if (eltype->code () == TYPE_CODE_FLT +- || eltype->code () == TYPE_CODE_DECFLOAT) ++ && TYPE_LENGTH (eltype) == 16 ++ && (gdbarch_long_double_format (gdbarch) ++ == floatformats_ia64_quad)) ++ /* IEEE FLOAT128, args in vector registers. */ ++ ppc64_sysv_abi_push_vreg (gdbarch, elval, argpos); ++ ++ else if (eltype->code () == TYPE_CODE_FLT ++ || eltype->code () == TYPE_CODE_DECFLOAT) ++ /* IBM long double and all other floats and decfloats, args ++ are in a pair of floating point registers. */ + ppc64_sysv_abi_push_freg (gdbarch, eltype, elval, argpos); + else if (eltype->code () == TYPE_CODE_ARRAY + && eltype->is_vector () +@@ -1871,10 +1915,16 @@ ppc64_sysv_abi_return_value_base (struct gdbarch *gdbarch, struct type *valtype, + return 1; + } + +- /* AltiVec vectors are returned in VRs starting at v2. */ ++ /* AltiVec vectors are returned in VRs starting at v2. ++ IEEE FLOAT 128-bit are stored in vector register. */ ++ + if (TYPE_LENGTH (valtype) == 16 +- && valtype->code () == TYPE_CODE_ARRAY && valtype->is_vector () +- && tdep->vector_abi == POWERPC_VEC_ALTIVEC) ++ && ((valtype->code () == TYPE_CODE_ARRAY ++ && valtype->is_vector () ++ && tdep->vector_abi == POWERPC_VEC_ALTIVEC) ++ || (valtype->code () == TYPE_CODE_FLT ++ && (gdbarch_long_double_format (gdbarch) ++ == floatformats_ia64_quad)))) + { + int regnum = tdep->ppc_vr0_regnum + 2 + index; + +@@ -2012,7 +2062,8 @@ ppc64_sysv_abi_return_value (struct gdbarch *gdbarch, struct value *function, + /* In the ELFv2 ABI, homogeneous floating-point or vector + aggregates are returned in registers. */ + if (tdep->elf_abi == POWERPC_ELF_V2 +- && ppc64_elfv2_abi_homogeneous_aggregate (valtype, &eltype, &nelt) ++ && ppc64_elfv2_abi_homogeneous_aggregate (valtype, &eltype, &nelt, ++ gdbarch) + && (eltype->code () == TYPE_CODE_FLT + || eltype->code () == TYPE_CODE_DECFLOAT + || (eltype->code () == TYPE_CODE_ARRAY diff --git a/powerpc-correct-the-gdb-ioctl-values-for-tcgets-tcsets-tcsetsw-and-tcsetsf.patch b/powerpc-correct-the-gdb-ioctl-values-for-tcgets-tcsets-tcsetsw-and-tcsetsf.patch new file mode 100644 index 0000000..0c25a3c --- /dev/null +++ b/powerpc-correct-the-gdb-ioctl-values-for-tcgets-tcsets-tcsetsw-and-tcsetsf.patch @@ -0,0 +1,66 @@ +PowerPC, correct the gdb ioctl values for TCGETS, TCSETS, TCSETSW and TCSETSF. + +Some of the ioctl numbers are based on the size of kernel termios structure. +Currently the PowerPC GDB definitions are "hard coded" into the ioctl +number. + +The current PowerPC values for TCGETS, TCSETS, TCSETSW and TCSETSF are +defined in gdb/ppc-linux-tdep.c as: + + record_tdep->ioctl_TCGETS = 0x403c7413; + record_tdep->ioctl_TCSETS = 0x803c7414; + record_tdep->ioctl_TCSETSW = 0x803c7415; + record_tdep->ioctl_TCSETSF = 0x803c7416; + +Where the termios structure size is in hex digits [5:4] as 0x3c. + +The definition for the PowerPC termios structure is given in: + arch/powerpc/include/uapi/asm/termbits.h + +The size of the termios data structure in this file is 0x2c not 0x3c. + +This patch changes the hex digits for the size of the PowerPC termios size +in the ioctl values for TCGETS, TCSETS, TCSETSW and TCSETSF to 0x2c. +This patch also changes the hard coding to generate the number based on a +it easier to update the ioctl numbers. + +--- + gdb/ppc-linux-tdep.c | 14 ++++++++++---- + 1 file changed, 10 insertions(+), 4 deletions(-) + +diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c +index 0b165fe2ca3..2881fcda71d 100644 +--- a/gdb/ppc-linux-tdep.c ++++ b/gdb/ppc-linux-tdep.c +@@ -1738,6 +1738,11 @@ static void + ppc_init_linux_record_tdep (struct linux_record_tdep *record_tdep, + int wordsize) + { ++ /* The values for TCGETS, TCSETS, TCSETSW, TCSETSF are based on the ++ size of struct termios in the kernel source. ++ include/uapi/asm-generic/termbits.h */ ++#define SIZE_OF_STRUCT_TERMIOS 0x2c ++ + /* Simply return if it had been initialized. */ + if (record_tdep->size_pointer != 0) + return; +@@ -1899,14 +1904,15 @@ ppc_init_linux_record_tdep (struct linux_record_tdep *record_tdep, + /* These values are the second argument of system call "sys_ioctl". + They are obtained from Linux Kernel source. + See arch/powerpc/include/uapi/asm/ioctls.h. */ +- record_tdep->ioctl_TCGETS = 0x403c7413; +- record_tdep->ioctl_TCSETS = 0x803c7414; +- record_tdep->ioctl_TCSETSW = 0x803c7415; +- record_tdep->ioctl_TCSETSF = 0x803c7416; + record_tdep->ioctl_TCGETA = 0x40147417; + record_tdep->ioctl_TCSETA = 0x80147418; + record_tdep->ioctl_TCSETAW = 0x80147419; + record_tdep->ioctl_TCSETAF = 0x8014741c; ++ record_tdep->ioctl_TCGETS = 0x40007413 | (SIZE_OF_STRUCT_TERMIOS << 16); ++ record_tdep->ioctl_TCSETS = 0x80007414 | (SIZE_OF_STRUCT_TERMIOS << 16); ++ record_tdep->ioctl_TCSETSW = 0x80007415 | (SIZE_OF_STRUCT_TERMIOS << 16); ++ record_tdep->ioctl_TCSETSF = 0x80007416 | (SIZE_OF_STRUCT_TERMIOS << 16); ++ + record_tdep->ioctl_TCSBRK = 0x2000741d; + record_tdep->ioctl_TCXONC = 0x2000741e; + record_tdep->ioctl_TCFLSH = 0x2000741f; diff --git a/powerpc-fix-for-gdb.base-eh_return.exp.patch b/powerpc-fix-for-gdb.base-eh_return.exp.patch new file mode 100644 index 0000000..e51b4f0 --- /dev/null +++ b/powerpc-fix-for-gdb.base-eh_return.exp.patch @@ -0,0 +1,72 @@ +PowerPC: fix for gdb.base/eh_return.exp + +Disable the Traceback Table generation on PowerPC for this test. The +Traceback Table consists of a series of bit fields to indicate things like +the Traceback Table version, language, and specific information about the +function. The Traceback Table is generated following the end of the code +for every function by default. The Traceback Table is defined in the +PowerPC ELF ABI and is intended to support debuggers and exception +handlers. The Traceback Table is displayed in the disassembly of functions +by default and is part of the function length. The table is typically +interpreted by the disassembler as data represented by .long xxx entries. + +Generation of the Traceback Table is disabled in this test using the +PowerPC specific gcc compiler option -mtraceback=no, the xlc option +additional_flags-qtable=none and the clang optons + -mllvm -xcoff-traceback-table=false. Disabling the Traceback Table +generation in this test results in the gdb_test_multiple statement +correctly locating the address of the bclr instruction before the statement +"End of assembler dump." in the disassembly output. + +--- + gdb/testsuite/gdb.base/eh_return.exp | 36 +++++++++++++++++++++++++++++++++++- + 1 file changed, 35 insertions(+), 1 deletion(-) + +diff --git a/gdb/testsuite/gdb.base/eh_return.exp b/gdb/testsuite/gdb.base/eh_return.exp +index df55dbc72da..6e4b9bd0bba 100644 +--- a/gdb/testsuite/gdb.base/eh_return.exp ++++ b/gdb/testsuite/gdb.base/eh_return.exp +@@ -18,8 +18,42 @@ + + standard_testfile + ++# Set compiler flags. ++if {[istarget "powerpc*"]} then { ++ # PowerPC generates a Traceback Table, as defined in the PPC64 ABI, ++ # following each function by default. The Traceback Table information is ++ # typically interpreted by the disassembler as data represented with ++ # .long xxxx following the last instruction in the function. For example: ++ # ++ # Dump of assembler code for function eh2: ++ # 0x00000000100009e0 <+0>: lis r2,4098 ++ # ... ++ # 0x0000000010000b04 <+292>: add r1,r1,r10 ++ # 0x0000000010000b08 <+296>: blr ++ # 0x0000000010000b0c <+300>: .long 0x0 ++ # 0x0000000010000b10 <+304>: .long 0x1000000 ++ # 0x0000000010000b14 <+308>: .long 0x1000180 ++ # End of assembler dump. ++ # ++ # Disable the Traceback Table generation, using the PowerPC specific ++ # compiler option, so the test gdb_test_multiple "disassemble eh2" will ++ # locate the address of the blr instruction not the last .long statement. ++ if { [test_compiler_info "gcc-*"] } { ++ set compile_flags {debug nopie additional_flags=-mtraceback=no} ++ } elseif { [test_compiler_info "xlc-*"] } { ++ set compile_flags {debug nopie additional_flags=-qtbtable=none} ++ } elseif { [test_compiler_info "clang-*"] } { ++ set compile_flags [list debug nopie additional_flags=-mllvm \ ++ additional_flags=-xcoff-traceback-table=false] ++ } else { ++ set compile_flags {debug nopie } ++ } ++} else { ++ set compile_flags {debug nopie} ++} ++ + if {[prepare_for_testing "failed to prepare" $testfile $srcfile \ +- {debug nopie}]} { ++ $compile_flags]} { + return -1 + } + diff --git a/powerpc-update-expected-floating-point-output-for-gdb.arch-altivec-regs.exp-and-gdb.arch-vsx-regs.exp.patch b/powerpc-update-expected-floating-point-output-for-gdb.arch-altivec-regs.exp-and-gdb.arch-vsx-regs.exp.patch new file mode 100644 index 0000000..cb158d9 --- /dev/null +++ b/powerpc-update-expected-floating-point-output-for-gdb.arch-altivec-regs.exp-and-gdb.arch-vsx-regs.exp.patch @@ -0,0 +1,129 @@ +PowerPC: Update expected floating point output for gdb.arch/altivec-regs.exp and gdb.arch/vsx-regs.exp + +The format for printing the floating point values was changed by commit: + + commit 56262a931b7ca8ee3ec9104bc7e9e0b40cf3d64e + Author: Tom Tromey + Date: Thu Feb 17 13:43:59 2022 -0700 + + Change how "print/x" displays floating-point value + + Currently, "print/x" will display a floating-point value by first + casting it to an integer type. This yields weird results like: + + (gdb) print/x 1.5 + $1 = 0x1 + ... + Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=16242 + +The above change results in 417 regression test failures since the expected +Power vector register output no longer match. + +This patch updates the expected Altivec floating point register prints to +the hexadecimal format for both big endian and little endian systems. The +patch also fixes a formatting isue with the decimal_vector expected value +assign statements. + +The expected VSX vector_register1, vector_register1_vr, vector_register2, +vector_register2_vr variables are updated to include the new float128 entry. +Additionally, the comment in the vsx expect file about the initialization +of the vs registers is updated. + +The patch has been tested on Power 10, Power 8 LE and Power 8 BE. + +--- + gdb/testsuite/gdb.arch/altivec-regs.exp | 8 ++++---- + gdb/testsuite/gdb.arch/vsx-regs.exp | 31 ++++++++++++++++--------------- + 2 files changed, 20 insertions(+), 19 deletions(-) + +diff --git a/gdb/testsuite/gdb.arch/altivec-regs.exp b/gdb/testsuite/gdb.arch/altivec-regs.exp +index 7bae979b984..d4c13afa8a1 100644 +--- a/gdb/testsuite/gdb.arch/altivec-regs.exp ++++ b/gdb/testsuite/gdb.arch/altivec-regs.exp +@@ -84,9 +84,9 @@ set endianness [get_endianness] + # b) the register read (below) also works. + + if {$endianness == "big"} { +-set vector_register ".uint128 = 0x1000000010000000100000001, v4_float = .0x0, 0x0, 0x0, 0x0., v4_int32 = .0x1, 0x1, 0x1, 0x1., v8_int16 = .0x0, 0x1, 0x0, 0x1, 0x0, 0x1, 0x0, 0x1., v16_int8 = .0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1.." ++set vector_register ".uint128 = 0x1000000010000000100000001, v4_float = .0x1, 0x1, 0x1, 0x1., v4_int32 = .0x1, 0x1, 0x1, 0x1., v8_int16 = .0x0, 0x1, 0x0, 0x1, 0x0, 0x1, 0x0, 0x1., v16_int8 = .0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1.." + } else { +-set vector_register ".uint128 = 0x1000000010000000100000001, v4_float = .0x0, 0x0, 0x0, 0x0., v4_int32 = .0x1, 0x1, 0x1, 0x1., v8_int16 = .0x1, 0x0, 0x1, 0x0, 0x1, 0x0, 0x1, 0x0., v16_int8 = .0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0.." ++set vector_register ".uint128 = 0x1000000010000000100000001, v4_float = .0x1, 0x1, 0x1, 0x1., v4_int32 = .0x1, 0x1, 0x1, 0x1., v8_int16 = .0x1, 0x0, 0x1, 0x0, 0x1, 0x0, 0x1, 0x0., v16_int8 = .0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0.." + } + + for {set i 0} {$i < 32} {incr i 1} { +@@ -104,9 +104,9 @@ gdb_test "info reg vscr" "vscr.*0x1\[ \t\]+1" "info reg vscr" + # the way gdb works. + + if {$endianness == "big"} { +- set decimal_vector ".uint128 = 79228162532711081671548469249, v4_float = .1.*e-45, 1.*e-45, 1.*e-45, 1.*e-45., v4_int32 = .1, 1, 1, 1., v8_int16 = .0, 1, 0, 1, 0, 1, 0, 1., v16_int8 = .0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1.." ++ set decimal_vector ".uint128 = 79228162532711081671548469249, v4_float = .1.*e-45, 1.*e-45, 1.*e-45, 1.*e-45., v4_int32 = .1, 1, 1, 1., v8_int16 = .0, 1, 0, 1, 0, 1, 0, 1., v16_int8 = .0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1.." + } else { +- set decimal_vector ".uint128 = 79228162532711081671548469249, v4_float = .1.*e-45, 1.*e-45, 1.*e-45, 1.*e-45., v4_int32 = .1, 1, 1, 1., v8_int16 = .1, 0, 1, 0, 1, 0, 1, 0., v16_int8 = .1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.." ++ set decimal_vector ".uint128 = 79228162532711081671548469249, v4_float = .1.*e-45, 1.*e-45, 1.*e-45, 1.*e-45., v4_int32 = .1, 1, 1, 1., v8_int16 = .1, 0, 1, 0, 1, 0, 1, 0., v16_int8 = .1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.." + } + + for {set i 0} {$i < 32} {incr i 1} { +diff --git a/gdb/testsuite/gdb.arch/vsx-regs.exp b/gdb/testsuite/gdb.arch/vsx-regs.exp +index 8b3841362fe..56fea796a9b 100644 +--- a/gdb/testsuite/gdb.arch/vsx-regs.exp ++++ b/gdb/testsuite/gdb.arch/vsx-regs.exp +@@ -61,29 +61,29 @@ set endianness [get_endianness] + # Data sets used throughout the test + + if {$endianness == "big"} { +- set vector_register1 ".uint128 = 0x3ff4cccccccccccd0000000000000000, v2_double = .0x1, 0x0., v4_float = .0x1, 0xf9999998, 0x0, 0x0., v4_int32 = .0x3ff4cccc, 0xcccccccd, 0x0, 0x0., v8_int16 = .0x3ff4, 0xcccc, 0xcccc, 0xcccd, 0x0, 0x0, 0x0, 0x0., v16_int8 = .0x3f, 0xf4, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcd, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0.." ++ set vector_register1 ".float128 = 0x3ff4cccccccccccd0000000000000000, uint128 = 0x3ff4cccccccccccd0000000000000000, v2_double = .0x3ff4cccccccccccd, 0x0., v4_float = .0x3ff4cccc, 0xcccccccd, 0x0, 0x0., v4_int32 = .0x3ff4cccc, 0xcccccccd, 0x0, 0x0., v8_int16 = .0x3ff4, 0xcccc, 0xcccc, 0xcccd, 0x0, 0x0, 0x0, 0x0., v16_int8 = .0x3f, 0xf4, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcd, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0.." + +- set vector_register1_vr ".uint128 = 0x3ff4cccccccccccd0000000100000001, v4_float = .0x1, 0xf9999998, 0x0, 0x0., v4_int32 = .0x3ff4cccc, 0xcccccccd, 0x1, 0x1., v8_int16 = .0x3ff4, 0xcccc, 0xcccc, 0xcccd, 0x0, 0x1, 0x0, 0x1., v16_int8 = .0x3f, 0xf4, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcd, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1.." ++ set vector_register1_vr ".uint128 = 0x3ff4cccccccccccd0000000100000001, v4_float = .0x3ff4cccc, 0xcccccccd, 0x1, 0x1., v4_int32 = .0x3ff4cccc, 0xcccccccd, 0x1, 0x1., v8_int16 = .0x3ff4, 0xcccc, 0xcccc, 0xcccd, 0x0, 0x1, 0x0, 0x1., v16_int8 = .0x3f, 0xf4, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcd, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1.." + +- set vector_register2 "uint128 = 0xdeadbeefdeadbeefdeadbeefdeadbeef, v2_double = .0x8000000000000000, 0x8000000000000000., v4_float = .0x0, 0x0, 0x0, 0x0., v4_int32 = .0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef., v8_int16 = .0xdead, 0xbeef, 0xdead, 0xbeef, 0xdead, 0xbeef, 0xdead, 0xbeef., v16_int8 = .0xde, 0xad, 0xbe, 0xef, 0xde, 0xad, 0xbe, 0xef, 0xde, 0xad, 0xbe, 0xef, 0xde, 0xad, 0xbe, 0xef.." ++ set vector_register2 ".float128 = 0xdeadbeefdeadbeefdeadbeefdeadbeef, uint128 = 0xdeadbeefdeadbeefdeadbeefdeadbeef, v2_double = .0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef., v4_float = .0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef., v4_int32 = .0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef., v8_int16 = .0xdead, 0xbeef, 0xdead, 0xbeef, 0xdead, 0xbeef, 0xdead, 0xbeef., v16_int8 = .0xde, 0xad, 0xbe, 0xef, 0xde, 0xad, 0xbe, 0xef, 0xde, 0xad, 0xbe, 0xef, 0xde, 0xad, 0xbe, 0xef.." + +- set vector_register2_vr "uint128 = 0xdeadbeefdeadbeefdeadbeefdeadbeef, v4_float = .0x0, 0x0, 0x0, 0x0., v4_int32 = .0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef., v8_int16 = .0xdead, 0xbeef, 0xdead, 0xbeef, 0xdead, 0xbeef, 0xdead, 0xbeef., v16_int8 = .0xde, 0xad, 0xbe, 0xef, 0xde, 0xad, 0xbe, 0xef, 0xde, 0xad, 0xbe, 0xef, 0xde, 0xad, 0xbe, 0xef.." ++ set vector_register2_vr ".uint128 = 0xdeadbeefdeadbeefdeadbeefdeadbeef, v4_float = .0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef., v4_int32 = .0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef., v8_int16 = .0xdead, 0xbeef, 0xdead, 0xbeef, 0xdead, 0xbeef, 0xdead, 0xbeef., v16_int8 = .0xde, 0xad, 0xbe, 0xef, 0xde, 0xad, 0xbe, 0xef, 0xde, 0xad, 0xbe, 0xef, 0xde, 0xad, 0xbe, 0xef.." + +- set vector_register3 ".uint128 = 0x1000000010000000100000001, v2_double = .0x0, 0x0., v4_float = .0x0, 0x0, 0x0, 0x0., v4_int32 = .0x1, 0x1, 0x1, 0x1., v8_int16 = .0x0, 0x1, 0x0, 0x1, 0x0, 0x1, 0x0, 0x1., v16_int8 = .0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1.." ++ set vector_register3 ".float128 = 0x1000000010000000100000001, uint128 = 0x1000000010000000100000001, v2_double = .0x100000001, 0x100000001., v4_float = .0x1, 0x1, 0x1, 0x1., v4_int32 = .0x1, 0x1, 0x1, 0x1., v8_int16 = .0x0, 0x1, 0x0, 0x1, 0x0, 0x1, 0x0, 0x1., v16_int8 = .0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1.." + +- set vector_register3_vr ".uint128 = 0x1000000010000000100000001, v4_float = .0x0, 0x0, 0x0, 0x0., v4_int32 = .0x1, 0x1, 0x1, 0x1., v8_int16 = .0x0, 0x1, 0x0, 0x1, 0x0, 0x1, 0x0, 0x1., v16_int8 = .0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1.." ++ set vector_register3_vr ".uint128 = 0x1000000010000000100000001, v4_float = .0x1, 0x1, 0x1, 0x1., v4_int32 = .0x1, 0x1, 0x1, 0x1., v8_int16 = .0x0, 0x1, 0x0, 0x1, 0x0, 0x1, 0x0, 0x1., v16_int8 = .0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1.." + } else { +- set vector_register1 ".uint128 = 0x3ff4cccccccccccd0000000000000000, v2_double = .0x0, 0x1., v4_float = .0x0, 0x0, 0xf9999998, 0x1., v4_int32 = .0x0, 0x0, 0xcccccccd, 0x3ff4cccc., v8_int16 = .0x0, 0x0, 0x0, 0x0, 0xcccd, 0xcccc, 0xcccc, 0x3ff4., v16_int8 = .0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xcd, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xf4, 0x3f.." ++ set vector_register1 ".float128 = 0x3ff4cccccccccccd0000000000000000, uint128 = 0x3ff4cccccccccccd0000000000000000, v2_double = .0x0, 0x3ff4cccccccccccd., v4_float = .0x0, 0x0, 0xcccccccd, 0x3ff4cccc., v4_int32 = .0x0, 0x0, 0xcccccccd, 0x3ff4cccc., v8_int16 = .0x0, 0x0, 0x0, 0x0, 0xcccd, 0xcccc, 0xcccc, 0x3ff4., v16_int8 = .0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xcd, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xf4, 0x3f.." + +- set vector_register1_vr ".uint128 = 0x3ff4cccccccccccd0000000100000001, v4_float = .0x0, 0x0, 0xf9999998, 0x1., v4_int32 = .0x1, 0x1, 0xcccccccd, 0x3ff4cccc., v8_int16 = .0x1, 0x0, 0x1, 0x0, 0xcccd, 0xcccc, 0xcccc, 0x3ff4., v16_int8 = .0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0xcd, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xf4, 0x3f.." ++ set vector_register1_vr ".uint128 = 0x3ff4cccccccccccd0000000100000001, v4_float = .0x1, 0x1, 0xcccccccd, 0x3ff4cccc., v4_int32 = .0x1, 0x1, 0xcccccccd, 0x3ff4cccc., v8_int16 = .0x1, 0x0, 0x1, 0x0, 0xcccd, 0xcccc, 0xcccc, 0x3ff4., v16_int8 = .0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0xcd, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xf4, 0x3f.." + +- set vector_register2 "uint128 = 0xdeadbeefdeadbeefdeadbeefdeadbeef, v2_double = .0x8000000000000000, 0x8000000000000000., v4_float = .0x0, 0x0, 0x0, 0x0., v4_int32 = .0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef., v8_int16 = .0xbeef, 0xdead, 0xbeef, 0xdead, 0xbeef, 0xdead, 0xbeef, 0xdead., v16_int8 = .0xef, 0xbe, 0xad, 0xde, 0xef, 0xbe, 0xad, 0xde, 0xef, 0xbe, 0xad, 0xde, 0xef, 0xbe, 0xad, 0xde.." ++ set vector_register2 ".float128 = 0xdeadbeefdeadbeefdeadbeefdeadbeef, uint128 = 0xdeadbeefdeadbeefdeadbeefdeadbeef, v2_double = .0xdeadbeefdeadbeef, 0xdeadbeefdeadbeef., v4_float = .0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef., v4_int32 = .0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef., v8_int16 = .0xbeef, 0xdead, 0xbeef, 0xdead, 0xbeef, 0xdead, 0xbeef, 0xdead., v16_int8 = .0xef, 0xbe, 0xad, 0xde, 0xef, 0xbe, 0xad, 0xde, 0xef, 0xbe, 0xad, 0xde, 0xef, 0xbe, 0xad, 0xde.." + +- set vector_register2_vr "uint128 = 0xdeadbeefdeadbeefdeadbeefdeadbeef, v4_float = .0x0, 0x0, 0x0, 0x0., v4_int32 = .0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef., v8_int16 = .0xbeef, 0xdead, 0xbeef, 0xdead, 0xbeef, 0xdead, 0xbeef, 0xdead., v16_int8 = .0xef, 0xbe, 0xad, 0xde, 0xef, 0xbe, 0xad, 0xde, 0xef, 0xbe, 0xad, 0xde, 0xef, 0xbe, 0xad, 0xde.." ++ set vector_register2_vr ".uint128 = 0xdeadbeefdeadbeefdeadbeefdeadbeef, v4_float = .0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef., v4_int32 = .0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef., v8_int16 = .0xbeef, 0xdead, 0xbeef, 0xdead, 0xbeef, 0xdead, 0xbeef, 0xdead., v16_int8 = .0xef, 0xbe, 0xad, 0xde, 0xef, 0xbe, 0xad, 0xde, 0xef, 0xbe, 0xad, 0xde, 0xef, 0xbe, 0xad, 0xde.." + +- set vector_register3 ".uint128 = 0x1000000010000000100000001, v2_double = .0x0, 0x0., v4_float = .0x0, 0x0, 0x0, 0x0., v4_int32 = .0x1, 0x1, 0x1, 0x1., v8_int16 = .0x1, 0x0, 0x1, 0x0, 0x1, 0x0, 0x1, 0x0., v16_int8 = .0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0.." ++ set vector_register3 ".float128 = 0x1000000010000000100000001, uint128 = 0x1000000010000000100000001, v2_double = .0x100000001, 0x100000001., v4_float = .0x1, 0x1, 0x1, 0x1., v4_int32 = .0x1, 0x1, 0x1, 0x1., v8_int16 = .0x1, 0x0, 0x1, 0x0, 0x1, 0x0, 0x1, 0x0., v16_int8 = .0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0.." + +- set vector_register3_vr ".uint128 = 0x1000000010000000100000001, v4_float = .0x0, 0x0, 0x0, 0x0., v4_int32 = .0x1, 0x1, 0x1, 0x1., v8_int16 = .0x1, 0x0, 0x1, 0x0, 0x1, 0x0, 0x1, 0x0., v16_int8 = .0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0.." ++ set vector_register3_vr ".uint128 = 0x1000000010000000100000001, v4_float = .0x1, 0x1, 0x1, 0x1., v4_int32 = .0x1, 0x1, 0x1, 0x1., v8_int16 = .0x1, 0x0, 0x1, 0x0, 0x1, 0x0, 0x1, 0x0., v16_int8 = .0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0.." + } + + set float_register ".raw 0xdeadbeefdeadbeef." +@@ -93,12 +93,13 @@ set float_register ".raw 0xdeadbeefdeadbeef." + # after updates to F*. + # Since dl_main uses some VS* registers, and per inspection their values are + # no longer zero when our test reaches main(), we need to explicitly +-# initialize the doubleword1 portions before we run our tests against +-# values currently in those registers. ++# initialize the VS* registers before we run our tests against the values ++# currently in those registers. + +-# 0: Initialize the (doubleword 1) portion of the VS0-VS31 registers. ++# 0: Initialize the (doubleword 0 and 1) portion of the VS0-VS31 registers. + for {set i 0} {$i < 32} {incr i 1} { + gdb_test_no_output "set \$vs$i.v2_double\[0\] = 0" ++ gdb_test_no_output "set \$vs$i.v2_double\[1\] = 0" + } + + # 1: Set F0~F31 registers and check if it reflects on VS0~VS31. diff --git a/qa-local.sh b/qa-local.sh new file mode 100644 index 0000000..0474741 --- /dev/null +++ b/qa-local.sh @@ -0,0 +1,199 @@ +#!/bin/sh + +pwd=$(pwd -P) + +root=$pwd/tmp-qa-local +logs=$root/logs +pkgs=$root/pkgs + +configs=" +openSUSE_Leap_15.4 +openSUSE_Leap_15.3 +openSUSE_Factory +SLE-15 +SLE-12 +" + +usage () +{ + echo "usage: $0 <1-4>" + echo "1: Cleanup" + echo "2: Do local builds without testsuite" + echo "3: Do local builds with testsuite" + echo "4: Verify local testsuite results" +} + +if [ $# -eq 0 ]; then + usage + exit 1 +fi + +n="$1" +shift + +extract () +{ + local package + package="$1" + + rpm2cpio "$package" \ + | cpio -idmv \ + > /dev/null \ + 2>&1 +} + +cleanup () +{ + if [ -d $root ]; then + echo "About to remove dir $root" + echo "Press ^C to abort, enter to continue" + read + fi + rm -Rf $root + mkdir -p $root +} + +acquire_sudo_rights () +{ + # Acquire sudo rights. + sudo --validate + + # Keep sudo rights alive. + while true; do + sleep 100 + sudo --validate --non-interactive + kill -0 "$$" 2>/dev/null || exit + done & +} + +archs="x86_64 i586" + +have_combo () +{ + arch="$1" + c="$2" + + if [ "$arch" = "i586" ]; then + case $c in + SLE-*) + return 1 + ;; + esac + fi + return 0 +} + +case "$n" in + 1) + cleanup + ;; + + 2) + acquire_sudo_rights + + rm -Rf $logs/$n + mkdir -p $logs/$n + + for arch in $archs; do + for c in $configs; do + if ! have_combo $arch $c; then + continue + fi + osc build \ + --clean \ + --trust-all-projects \ + --no-service \ + $c $arch \ + > $logs/$n/LOG.$c.$arch \ + 2>&1 + + if [ $? -eq 0 ]; then + echo PASS: $c $arch + else + echo FAIL: $c $arch + fi + + sudo rm -Rf /var/tmp/build-root/$c-$arch + done + done + ;; + + 3) + acquire_sudo_rights + + rm -Rf $logs/$n + mkdir -p $logs/$n + + for arch in $archs; do + for c in $configs; do + if ! have_combo $arch $c; then + continue + fi + mkdir -p $pkgs/$c.$arch + osc build \ + --clean \ + --trust-all-projects \ + --no-service \ + -k $pkgs/$c.$arch \ + -M testsuite \ + $c $arch \ + > $logs/$n/LOG.$c.$arch \ + 2>&1 + if [ $? -eq 0 ]; then + ok=true + else + ok=false + fi + + rpm=gdb-testresults-12.1-0.$arch.rpm + if [ -f $pkgs/$c.$arch/$rpm ]; then + ( + cd $pkgs/$c.$arch + extract gdb-testresults-12.1-0.$arch.rpm + ) + mv \ + $pkgs/$c.$arch/usr/share/doc/packages/gdb-testresults \ + $pkgs/gdb-testresults.$c.$arch + rm -Rf $pkgs/$c.$arch + else + ok=false + fi + + if $ok; then + echo PASS: $c $arch + else + echo FAIL: $c $arch + fi + + sudo rm -Rf /var/tmp/build-root/$c-$arch + done + done + ;; + + 4) + for arch in $archs; do + for c in $configs; do + if ! have_combo $arch $c; then + continue + fi + echo "CONFIG: $c $arch" + case $c in + openSUSE_Factory) + bash qa.sh -local -factory $pkgs/gdb-testresults.$c.$arch + ;; + SLE-12) + bash qa.sh -local -sle12 $pkgs/gdb-testresults.$c.$arch + ;; + *) + bash qa.sh -local $pkgs/gdb-testresults.$c.$arch + ;; + esac + done + done + ;; + + *) + echo "Don't know how to handle arg: $n" + exit 1 + ;; +esac diff --git a/qa-remote.sh b/qa-remote.sh new file mode 100644 index 0000000..e9a930e --- /dev/null +++ b/qa-remote.sh @@ -0,0 +1,118 @@ +#!/bin/sh + +pwd=$(pwd -P) + +root=$pwd/tmp-qa-remote +pkgs=$root/pkgs + +usage () +{ + echo "usage: $0 <1-2>" + echo " $0 <3> <1-5>" + echo "1: Cleanup" + echo "2: Get remote testsuite results" + echo "3: Verify remote testsuite result" +} + +if [ $# -eq 0 ]; then + usage + exit 1 +fi + +n="$1" +shift + +extract () +{ + local package + package="$1" + + rpm2cpio "$package" \ + | cpio -idmv \ + > /dev/null \ + 2>&1 +} + +get_item () +{ + c="$1" + arch="$2" + + if [ -d $root/binaries-testsuite.$c.$arch/gdb-testresults ]; then + return + fi + + if [ "$c" = "openSUSE_Leap_15.2" ]; then + # Stale config, skip. + return + fi + + local dir + dir=$pkgs/$c.$arch + + if [ ! -d $dir ]; then + mkdir -p $dir + fi + + if [ ! -f $dir/gdb-testresults-12.1-*.rpm ]; then + osc getbinaries -q -M testsuite -d $dir $c $arch + fi + + if [ ! -d $pkgs/gdb-testresults.$c.$arch ]; then + ( + cd $dir + extract gdb-testresults-12.1-*.rpm + ) + fi + + if [ -d $dir/usr/share/doc/packages/gdb-testresults ]; then + mkdir $root/binaries-testsuite.$c.$arch + mv \ + $dir/usr/share/doc/packages/gdb-testresults \ + $root/binaries-testsuite.$c.$arch/gdb-testresults + fi + + if [ -d $root/binaries-testsuite.$c.$arch/gdb-testresults ]; then + rm -Rf $dir + fi +} + +cleanup () +{ + if [ -d $root ]; then + echo "About to remove dir $root" + echo "Press ^C to abort, enter to continue" + read + fi + rm -Rf $root + mkdir -p $root +} + +case "$n" in + 1) + cleanup + ;; + + 2) + osc results -M testsuite \ + | grep succeeded \ + | awk '{print $1, $2}' \ + | while read line; do + get_item $line + done + ;; + + 3) + m="$1" + shift + ( + cd $root + bash $pwd/qa.sh $m + ) + ;; + + *) + echo "Don't know how to handle arg: $n" + exit 1 + ;; +esac diff --git a/qa.sh b/qa.sh index 427d973..19d426b 100644 --- a/qa.sh +++ b/qa.sh @@ -23,7 +23,8 @@ usage () { echo "usage: $0 <1-5>" - echo " $0 <6> " + echo " $0 -local [ -sle12 | -factory ] " + echo echo "Verify remote results at:" echo " ./binaries-testsuite.distro.arch/gdb-testresults" echo "1: gdb.sum: Check for 'FAIL: .* internal error' (all configs)" @@ -31,9 +32,10 @@ usage () echo "3: gdb.log: Check for 'internal-error:' (all configs)" echo "4: gdb.sum: Check FAIL and ERROR (known clean configs)" echo "5: gdb.sum: Check gdb.suse PASS (all configs)" + echo echo "Verify local results at:" echo " \$dir" - echo "6: gdb.sum: Check FAIL and ERROR" + echo "-local: gdb.sum: Check FAIL and ERROR" } if [ $# -eq 0 ]; then @@ -44,7 +46,29 @@ fi n="$1" shift -if [ "$n" = "6" ]; then +have_sle12=false +have_factory=false +have_aarch64=false +if [ "$n" = "-local" ]; then + while [ $# -gt 1 ]; do + case $1 in + -sle12) + have_sle12=true + ;; + -factory) + have_factory=true + ;; + -aarch64) + have_aarch64=true + ;; + *) + echo "Don't know how to handle arg: $1" + usage + exit 1 + ;; + esac + shift 1 + done dir="$1" shift fi @@ -105,6 +129,7 @@ kfail=( "FAIL: gdb.arch/amd64-init-x87-values.exp: check_x87_regs_around_init: check post FLD1 value of .fioff" # https://sourceware.org/bugzilla/show_bug.cgi?id=24845 "FAIL: gdb.base/step-over-syscall.exp: clone: displaced=off: single step over clone" + "FAIL: gdb.base/step-over-syscall.exp: clone: displaced=off: continue to marker \(clone\)" # https://sourceware.org/bugzilla/show_bug.cgi?id=19436#c1 "FAIL: gdb.cp/no-dmgl-verbose.exp: setting breakpoint at 'f\(std::string\)'" # https://sourceware.org/bugzilla/show_bug.cgi?id=25504 @@ -117,6 +142,7 @@ kfail=( "FAIL: gdb.threads/signal-while-stepping-over-bp-other-thread.exp: step \(pattern 3\)" # https://sourceware.org/bugzilla/show_bug.cgi?id=26915 "FAIL: gdb.threads/schedlock.exp: schedlock=off: .*: other threads ran - unlocked" + "FAIL: gdb.threads/watchthreads-threaded.exp: watchpoint on args\[3\] hit in thread" # https://sourceware.org/bugzilla/show_bug.cgi?id=28479 "FAIL: gdb.mi/mi-nonstop.exp: wait for thread exit \(timeout\)" # https://sourceware.org/bugzilla/show_bug.cgi?id=26273 @@ -144,7 +170,129 @@ kfail=( "FAIL: gdb.xml/tdesc-reload.exp: .*internal error" # https://sourceware.org/bugzilla/show_bug.cgi?id=26761 "FAIL: gdb.base/gdb-sigterm.exp: .*internal error" -) + + # If a test-case fails to compile, it's not a GDB FAIL, ignore. + "FAIL: gdb.ada/.*\.exp: compilation .*\.adb" + + # https://sourceware.org/bugzilla/show_bug.cgi?id=27539 + "FAIL: gdb.cp/typeid.exp: before starting: print &typeid\(i\)" + "FAIL: gdb.cp/typeid.exp: before starting: print &typeid\(i\) == &typeid\(typeof\(i\)\)" + "FAIL: gdb.cp/typeid.exp: before starting: print &typeid\(cp\)" + "FAIL: gdb.cp/typeid.exp: before starting: print &typeid\(cp\) == &typeid\(typeof\(cp\)\)" + "FAIL: gdb.cp/typeid.exp: before starting: print &typeid\(ccp\)" + "FAIL: gdb.cp/typeid.exp: before starting: print &typeid\(ccp\) == &typeid\(typeof\(ccp\)\)" + + # Fails for i586. Appearantly, glibc for i586 doesn't use vdso to do + # syscalls. Fedora test-case. + "FAIL: gdb.base/set-solib-absolute-prefix.exp: backtrace with __kernel_vsyscall" + + # https://sourceware.org/bugzilla/show_bug.cgi?id=28504 + "FAIL: gdb.arch/i386-sse.exp: check contents of data\[2\]" + "FAIL: gdb.arch/i386-sse.exp: check contents of data\[3\]" + "FAIL: gdb.arch/i386-sse.exp: check contents of data\[4\]" + "FAIL: gdb.arch/i386-sse.exp: check contents of data\[5\]" + "FAIL: gdb.arch/i386-sse.exp: check contents of data\[6\]" + "FAIL: gdb.arch/i386-sse.exp: check contents of data\[7\]" + "FAIL: gdb.reverse/i386-sse-reverse.exp: verify xmm2 after reverse addps" + "FAIL: gdb.reverse/i386-sse-reverse.exp: verify xmm2 after reverse addss" + "FAIL: gdb.reverse/i386-sse-reverse.exp: verify xmm2 after reverse addsubpd" + "FAIL: gdb.reverse/i386-sse-reverse.exp: verify xmm2 after reverse andpd" + "FAIL: gdb.reverse/i386-sse-reverse.exp: verify xmm2 after reverse blendps" + "FAIL: gdb.reverse/i386-sse-reverse.exp: verify xmm2 after reverse cmppd" + "FAIL: gdb.reverse/i386-sse-reverse.exp: verify xmm2 after reverse cmpps" + "FAIL: gdb.reverse/i386-sse-reverse.exp: verify xmm2 after reverse cmpss" + "FAIL: gdb.reverse/i386-sse-reverse.exp: verify xmm2 after reverse comisd" + "FAIL: gdb.reverse/i386-sse-reverse.exp: verify xmm2 after reverse comiss" + "FAIL: gdb.reverse/i386-sse-reverse.exp: verify xmm2 after reverse cvtdq2pd" + "FAIL: gdb.reverse/i386-sse-reverse.exp: verify xmm2 after reverse cvtpd2dq" + "FAIL: gdb.reverse/i386-sse-reverse.exp: verify xmm2 after reverse cvtpd2ps" + "FAIL: gdb.reverse/i386-sse-reverse.exp: verify xmm2 after reverse divpd" + "FAIL: gdb.reverse/i386-sse-reverse.exp: verify xmm2 after reverse divsd" + "FAIL: gdb.reverse/i386-sse-reverse.exp: verify xmm2 after reverse divss" + "FAIL: gdb.reverse/i386-sse-reverse.exp: verify xmm2 after reverse mulps" + "FAIL: gdb.reverse/i386-sse-reverse.exp: verify xmm2 after reverse mulss" + "FAIL: gdb.reverse/i386-sse-reverse.exp: verify xmm2 after reverse orpd" + "FAIL: gdb.reverse/i386-sse-reverse.exp: verify xmm2 after reverse orps" + "FAIL: gdb.reverse/i386-sse-reverse.exp: verify xmm2 after reverse pabsw" + "FAIL: gdb.reverse/i386-sse-reverse.exp: verify xmm2 after reverse packsswb" + "FAIL: gdb.reverse/i386-sse-reverse.exp: verify xmm2 after reverse ucomisd" + "FAIL: gdb.reverse/i386-sse-reverse.exp: verify xmm2 after reverse ucomiss" + "FAIL: gdb.reverse/i386-sse-reverse.exp: verify xmm2 after reverse unpckhpd" + "FAIL: gdb.reverse/i386-sse-reverse.exp: verify xmm2 after reverse unpckhps" + "FAIL: gdb.reverse/i386-sse-reverse.exp: verify xmm2 after reverse xorpd" + "FAIL: gdb.reverse/i386-sse-reverse.exp: verify xmm2 after reverse xorps" + + # Fedora test. Fails because it doesn't handle ppc64le. + "FAIL: gdb.arch/powerpc-bcl-prologue.exp: powerpc arch test" + + # https://sourceware.org/bugzilla/show_bug.cgi?id=29419 + # https://sourceware.org/bugzilla/show_bug.cgi?id=29409 + "FAIL: gdb.opt/inline-small-func.exp: info breakpoints" + "FAIL: gdb.ada/access_tagged_param.exp: continue" + "FAIL: gdb.ada/inline-section-gc.exp: break callee.adb:22" + "FAIL: gdb.ada/ptype_tagged_param.exp: ptype s, with debug info" + "FAIL: gdb.ada/ref_param.exp: frame argument value printed" + "FAIL: gdb.reverse/singlejmp-reverse.exp: next to v = 1" + "FAIL: gdb.reverse/singlejmp-reverse.exp: next to f" + "FAIL: gdb.reverse/singlejmp-reverse.exp: next to nodebug" + "FAIL: gdb.reverse/singlejmp-reverse.exp: next to v = 3" + "FAIL: gdb.reverse/singlejmp-reverse.exp: reverse-step" + "FAIL: gdb.reverse/singlejmp-reverse.exp: reverse-next" + + # https://sourceware.org/bugzilla/show_bug.cgi?id=25038 + "FAIL: gdb.reverse/test_ioctl_TCSETSW.exp: handle TCSETSW" +) # kfail + +kfail_sle12=( + # https://sourceware.org/bugzilla/show_bug.cgi?id=26292 + "FAIL: gdb.base/checkpoint-ns.exp: .* \(timeout\)" + "FAIL: gdb.base/checkpoint.exp: .* \(timeout\)" + + # https://sourceware.org/bugzilla/show_bug.cgi?id=29238 + "FAIL: gdb.cp/ambiguous.exp: all vars: print jv" + "FAIL: gdb.cp/ambiguous.exp: all vars: print jva1" + "FAIL: gdb.cp/ambiguous.exp: all vars: print jva1v" + "FAIL: gdb.cp/ambiguous.exp: all vars: print jva2" + + # https://sourceware.org/bugzilla/show_bug.cgi?id=25059 + "FAIL: gdb.cp/subtypes.exp:" + "FAIL: gdb.base/max-depth-c\+\+.exp:" + + # https://sourceware.org/bugzilla/show_bug.cgi?id=29240 + "FAIL: gdb.base/align-c.exp: print _Alignof\(double\)" + "FAIL: gdb.base/align-c.exp: print _Alignof\(long long\)" + "FAIL: gdb.base/align-c.exp: print _Alignof\(unsigned long long\)" + + # https://sourceware.org/bugzilla/show_bug.cgi?id=29241 + "FAIL: gdb.guile/scm-type.exp: lang_cpp: test_range: on flexible array member: guile \(print \(type-range \(field-type \(type-field \(value-type \(value-dereference f\)\) \"items\"\)\)\)\)" + "FAIL: gdb.guile/scm-type.exp: lang_cpp: test_range: on flexible array member: guile \(print \(value-subscript \(value-field \(value-dereference f\) \"items\"\) 0\)\)" + "FAIL: gdb.guile/scm-type.exp: lang_cpp: test_range: on flexible array member: guile \(print \(value-subscript \(value-field \(value-dereference f\) \"items\"\) 1\)\)" + + # Cluster of gcc 4.8 ada FAILs, to be investigated, but not high priority. + "FAIL: gdb.ada/info_locals_renaming.exp: info locals" + "FAIL: gdb.ada/interface.exp: info locals" + "FAIL: gdb.ada/length_cond.exp: cond 1 loc'first > 15" + "FAIL: gdb.ada/length_cond.exp: cond 1 loc'last > 15" + "FAIL: gdb.ada/length_cond.exp: cond 1 loc'length > 15" + "FAIL: gdb.ada/null_overload.exp: print f\(r_access'\(null\)\)" + "FAIL: gdb.ada/str_uninit.exp: print my_str" + + # https://sourceware.org/bugzilla/show_bug.cgi?id=29244 + "FAIL: gdb.arch/amd64-disp-step-avx.exp: running to main in runto" + "FAIL: gdb.arch/amd64-init-x87-values.exp: check_setting_mxcsr_before_enable: running to main in runto" + "FAIL: gdb.arch/amd64-init-x87-values.exp: check_setting_x87_regs_before_enable: running to main in runto" + "FAIL: gdb.arch/amd64-init-x87-values.exp: check_x87_regs_around_init: running to main in runto" + "FAIL: gdb.dwarf2/frame-inlined-in-outer-frame.exp: frame" + "FAIL: gdb.dwarf2/frame-inlined-in-outer-frame.exp: starti prompt" + "FAIL: gdb.dwarf2/frame-inlined-in-outer-frame.exp: step back into _start \(the program is no longer running\)" + "FAIL: gdb.dwarf2/frame-inlined-in-outer-frame.exp: step back into foo \(the program is no longer running\)" + "FAIL: gdb.dwarf2/frame-inlined-in-outer-frame.exp: step into bar \(the program is no longer running\)" + "FAIL: gdb.dwarf2/frame-inlined-in-outer-frame.exp: step into foo \(the program is no longer running\)" + + # https://sourceware.org/bugzilla/show_bug.cgi?id=29245 + # Python-2 related. + "FAIL: gdb.python/py-mi-cmd.exp: -pycmd bk3 \(unexpected output\)" +) # kfail_sle12 kfail_factory=( # https://sourceware.org/bugzilla/show_bug.cgi?id=27027 @@ -158,13 +306,6 @@ kfail_factory=( "FAIL: gdb.base/langs.exp: up to foo in langs.exp" "FAIL: gdb.base/langs.exp: up to cppsub_ in langs.exp" "FAIL: gdb.base/langs.exp: up to fsub in langs.exp" - # https://sourceware.org/bugzilla/show_bug.cgi?id=27539 - "FAIL: gdb.cp/typeid.exp: before starting: print &typeid\(i\)" - "FAIL: gdb.cp/typeid.exp: before starting: print &typeid\(i\) == &typeid\(typeof\(i\)\)" - "FAIL: gdb.cp/typeid.exp: before starting: print &typeid\(cp\)" - "FAIL: gdb.cp/typeid.exp: before starting: print &typeid\(cp\) == &typeid\(typeof\(cp\)\)" - "FAIL: gdb.cp/typeid.exp: before starting: print &typeid\(ccp\)" - "FAIL: gdb.cp/typeid.exp: before starting: print &typeid\(ccp\) == &typeid\(typeof\(ccp\)\)" # https://sourceware.org/pipermail/gdb-patches/2021-October/182449.html "FAIL: gdb.threads/current-lwp-dead.exp: continue to breakpoint: fn_return" # Similar error message to the one above, see if fixing that one fixes this. @@ -188,15 +329,59 @@ kfail_factory=( # https://sourceware.org/bugzilla/show_bug.cgi?id=28667 "FAIL: gdb.reverse/watch-precsave.exp: watchpoint hit, fourth time \\(GDB internal error\\)" -) + + # https://sourceware.org/bugzilla/show_bug.cgi?id=29160 + "FAIL: gdb.ctf/.*.exp" + "FAIL: gdb.base/ctf-.*.exp" + + # https://sourceware.org/bugzilla/show_bug.cgi?id=29196 + "FAIL: gdb.base/gdb11531.exp: watchpoint variable triggers at next" + "FAIL: gdb.base/gdb11531.exp: watchpoint variable triggers at continue" + + # https://sourceware.org/bugzilla/show_bug.cgi?id=29247 + "FAIL: gdb.base/varargs.exp: print find_max_long_double_real\(4, ldc1, ldc2, ldc3, ldc4\)" + + # We get "value has been optimized out", which is possible for an optimized gdb, due + # to optimization of function c_print_type. + "FAIL: gdb.gdb/python-helper.exp: print \*type->main_type" + + # https://sourceware.org/bugzilla/show_bug.cgi?id=29253 + "FAIL: gdb.server/stop-reply-no-thread.exp: to_disable=threads: continue to main \(timeout\)" + "FAIL: gdb.server/stop-reply-no-thread.exp: to_disable=threads: continue until exit \(timeout\)" + +) # kfail_factory + +kfail_aarch64=( + # https://sourceware.org/bugzilla/show_bug.cgi?id=29408 + "FAIL: gdb.base/large-frame.exp: optimize=-O0: backtrace" + "FAIL: gdb.base/large-frame.exp: optimize=-O1: backtrace" + "FAIL: gdb.base/large-frame.exp: optimize=-O2: backtrace" + + # https://sourceware.org/bugzilla/show_bug.cgi?id=29405 + "FAIL: gdb.base/step-over-syscall.exp: vfork: displaced=off: pc after stepi matches insn addr after syscall" + "FAIL: gdb.base/step-over-syscall.exp: vfork: displaced=on: pc after stepi matches insn addr after syscall" + "FAIL: gdb.base/step-over-syscall.exp: fork: displaced=on: check_pc_after_cross_syscall: single step over fork final pc" + + # https://sourceware.org/bugzilla/show_bug.cgi?id=29418 + "FAIL: gdb.ada/O2_float_param.exp: scenario=all: frame" + "FAIL: gdb.ada/O2_float_param.exp: scenario=minimal: frame" + + # https://sourceware.org/bugzilla/show_bug.cgi?id=29420 + "FAIL: gdb.ada/convvar_comp.exp: print \\\$item.started" + + # https://sourceware.org/bugzilla/show_bug.cgi?id=29423 + "FAIL: gdb.base/watchpoint-unaligned.exp: continue \(timeout\)" + "FAIL: gdb.base/watchpoint-unaligned.exp: size8twice write" +) # kfail_aarch64 case $n in 1) # 'FAIL: .* internal error' in gdb.sum. # Test fail due to internal error. # - # Todo: apply kfail_factory only on factory sum files. + # Todo: apply kfail_factory/kfail_sle12 only when appropriate. kfail+=("${kfail_factory[@]}") + kfail+=("${kfail_sle12[@]}") kfail_re=$(join "|" "${kfail[@]}") grep "^FAIL:.*internal error" binaries-testsuite*/gdb-testresults/*.sum \ | grep -E -v "$kfail_re" @@ -222,11 +407,11 @@ case $n in # kfail+=( # https://sourceware.org/bugzilla/show_bug.cgi?id=26284 - "infrun.c:[0-9]*: internal-error: int finish_step_over\(.*\): Assertion \`ecs->event_thread->control.trap_expected' failed." + "infrun.c:[0-9]*: internal-error: finish_step_over: Assertion \`ecs->event_thread->control.trap_expected' failed." # https://sourceware.org/bugzilla/show_bug.cgi?id=26363 ".i586.*i386-linux-nat.c:[0-9]*: internal-error: Got request for bad register number 41." # https://sourceware.org/bugzilla/show_bug.cgi?id=26761 - "thread.c:[0-9]*: internal-error: .* inferior_thread\(\): Assertion \`current_thread_ \!= nullptr' failed." + "thread.c:[0-9]*: internal-error: inferior_thread: Assertion \`current_thread_ \!= nullptr' failed." # https://sourceware.org/bugzilla/show_bug.cgi?id=19675 "linux-nat.c:[0-9]*: internal-error: wait returned unexpected status" # https://sourceware.org/bugzilla/show_bug.cgi?id=28553 @@ -249,16 +434,6 @@ case $n in 4) sums=() - # Note: below we avoid gdb-x86_64-suse-linux-m32.sum (the pie variant). - # That one hasn't been cleaned up. - - # Known clean config: Leap 15.2 x86_64. - config=openSUSE_Leap_15.2.x86_64/gdb-testresults - sums+=("$config/gdb-x86_64-suse-linux-m64.-fno-PIE.-no-pie.sum" - "$config/gdb-x86_64-suse-linux-m64.sum" - "$config/gdb-x86_64-suse-linux-m32.-fno-PIE.-no-pie.sum" - "$config/gdb-x86_64-suse-linux-m32.sum") - # Known clean config: Leap 15.3 x86_64 config=openSUSE_Leap_15.3.x86_64/gdb-testresults sums+=("$config/gdb-x86_64-suse-linux-m64.-fno-PIE.-no-pie.sum" @@ -266,6 +441,11 @@ case $n in "$config/gdb-x86_64-suse-linux-m32.-fno-PIE.-no-pie.sum" "$config/gdb-x86_64-suse-linux-m32.sum") + # Known clean config: Leap 15.3 i586 + config=openSUSE_Leap_15.3.i586/gdb-testresults + sums+=("$config/gdb-i586-suse-linux-m32.-fno-PIE.-no-pie.sum" + "$config/gdb-i586-suse-linux-m32.sum") + # Known clean config: Leap 15.4 x86_64 config=openSUSE_Leap_15.4.x86_64/gdb-testresults sums+=("$config/gdb-x86_64-suse-linux-m64.-fno-PIE.-no-pie.sum" @@ -273,6 +453,11 @@ case $n in "$config/gdb-x86_64-suse-linux-m32.-fno-PIE.-no-pie.sum" "$config/gdb-x86_64-suse-linux-m32.sum") + # Known clean config: Leap 15.4 i586 + config=openSUSE_Leap_15.4.i586/gdb-testresults + sums+=("$config/gdb-i586-suse-linux-m32.-fno-PIE.-no-pie.sum" + "$config/gdb-i586-suse-linux-m32.sum") + # Known clean config: SLE 15 x86_64. config=SLE-15.x86_64/gdb-testresults sums+=("$config/gdb-x86_64-suse-linux-m64.-fno-PIE.-no-pie.sum" @@ -280,19 +465,62 @@ case $n in "$config/gdb-x86_64-suse-linux-m32.-fno-PIE.-no-pie.sum" "$config/gdb-x86_64-suse-linux-m32.sum") - # Known cleanish config: Factory x86_64. - config=openSUSE_Factory.x86_64/gdb-testresults - sums+=("$config/gdb-x86_64-suse-linux-m64.-fno-PIE.-no-pie.sum" - "$config/gdb-x86_64-suse-linux-m64.sum" - "$config/gdb-x86_64-suse-linux-m32.-fno-PIE.-no-pie.sum" - "$config/gdb-x86_64-suse-linux-m32.sum") - - kfail+=("${kfail_factory[@]}") - for sum in "${sums[@]}"; do sum=binaries-testsuite.$sum report_sum "$sum" done + + ( + # Known clean config: SLE 12 x86_64. + config=SLE-12.x86_64/gdb-testresults + sums=("$config/gdb-x86_64-suse-linux-m64.-fPIE.-pie.sum" + "$config/gdb-x86_64-suse-linux-m64.sum" + "$config/gdb-x86_64-suse-linux-m32.-fPIE.-pie.sum" + "$config/gdb-x86_64-suse-linux-m32.sum") + + kfail+=("${kfail_sle12[@]}") + + for sum in "${sums[@]}"; do + sum=binaries-testsuite.$sum + report_sum "$sum" + done + ) + + ( + # Known cleanish config: Factory x86_64. + config=openSUSE_Factory.x86_64/gdb-testresults + sums=("$config/gdb-x86_64-suse-linux-m64.-fno-PIE.-no-pie.sum" + "$config/gdb-x86_64-suse-linux-m64.sum" + "$config/gdb-x86_64-suse-linux-m32.-fno-PIE.-no-pie.sum" + "$config/gdb-x86_64-suse-linux-m32.sum") + + # Known clean config: Factory i586 + config=openSUSE_Factory.i586/gdb-testresults + sums+=("$config/gdb-i586-suse-linux-m32.-fno-PIE.-no-pie.sum" + "$config/gdb-i586-suse-linux-m32.sum") + + kfail+=("${kfail_factory[@]}") + + for sum in "${sums[@]}"; do + sum=binaries-testsuite.$sum + report_sum "$sum" + done + ) + + ( + # Known clean config: SLE 15 aarch64. + config=SLE-15.aarch64/gdb-testresults + sums=("$config/gdb-aarch64-suse-linux.-fno-PIE.-no-pie.sum" + "$config/gdb-aarch64-suse-linux.sum") + + kfail+=("${kfail_aarch64[@]}") + + for sum in "${sums[@]}"; do + sum=binaries-testsuite.$sum + report_sum "$sum" + done + ) + ;; 5) @@ -308,21 +536,29 @@ case $n in | grep -E -v ":1" ;; - 6) + -local) sums=() + for f in "$dir"/*.sum; do + mapfile -t < <(echo_line "$f") + sums+=("${MAPFILE[@]}") + done - mapfile -t < <(echo_line "$dir"/*-m64.-fno-PIE.-no-pie.sum) - sums+=("${MAPFILE[@]}") - mapfile -t < <(echo_line "$dir"/*-m64.sum) - sums+=("${MAPFILE[@]}") - mapfile -t < <(echo_line "$dir"/*-m32.-fno-PIE.-no-pie.sum) - sums+=("${MAPFILE[@]}") - mapfile -t < <(echo_line "$dir"/*-m32.sum) - sums+=("${MAPFILE[@]}") + if [ ${#sums[@]} -ne 4 ] && [ ${#sums[@]} -ne 2 ]; then + echo "No summary files to check" + exit 1 + fi - # Assume this is factory. - kfail+=("${kfail_factory[@]}") + if $have_factory; then + kfail+=("${kfail_factory[@]}") + fi + if $have_sle12; then + kfail+=("${kfail_sle12[@]}") + fi + if $have_aarch64; then + kfail+=("${kfail_aarch64[@]}") + fi + for sum in "${sums[@]}"; do report_sum "$sum" done diff --git a/v2.0.4.tar.gz b/v2.0.4.tar.gz deleted file mode 100644 index 5376cac..0000000 --- a/v2.0.4.tar.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:3716f3b4de964061f60dbbfc5f1bd57b271824e98f08d2a5af321a50014dd9ac -size 343202 diff --git a/v2.0.5.tar.gz b/v2.0.5.tar.gz new file mode 100644 index 0000000..bab6fb3 --- /dev/null +++ b/v2.0.5.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:95acf499fdf0a0f5ebd07587bb443c702b1fd79f7d869749824234388b9bff80 +size 343369