Accepting request 721544 from home:tomdevries:branches:devel:gcc-2
- Master backport: * gdb-fix-breakpoints-on-file-reloads-for-pie-binaries.patch - Master backports testsuite: * gdb-testsuite-i386-pkru-exp.patch * gdb-testsuite-read1-fixes.patch * gdb-testsuite-pie-no-pie.patch * gdb-testsuite-add-missing-initial-prompt-read-in-multidictionary.exp.patch - Work around bsc#1115034: * gdb-testsuite-ada-pie.patch - Fixes for fedora patches: * gdb-testsuite-fix-perror-in-gdb.opt-fortran-string.exp.patch * gdb-testsuite-avoid-pagination-in-attach-32.exp.patch OBS-URL: https://build.opensuse.org/request/show/721544 OBS-URL: https://build.opensuse.org/package/show/devel:gcc/gdb?expand=0&rev=219
This commit is contained in:
parent
3b3c59425c
commit
27ab902d16
154
gdb-fix-breakpoints-on-file-reloads-for-pie-binaries.patch
Normal file
154
gdb-fix-breakpoints-on-file-reloads-for-pie-binaries.patch
Normal file
@ -0,0 +1,154 @@
|
|||||||
|
Fix breakpoints on file reloads for PIE binaries
|
||||||
|
|
||||||
|
When a binary is built using PIE, reloading the file will cause GDB to error
|
||||||
|
on restart. For example:
|
||||||
|
gdb ./a.out
|
||||||
|
(gdb) break main
|
||||||
|
(gdb) run
|
||||||
|
(gdb) file ./a.out
|
||||||
|
(gdb) continue
|
||||||
|
|
||||||
|
Will cause GDB to error with:
|
||||||
|
Continuing.
|
||||||
|
Warning:
|
||||||
|
Cannot insert breakpoint 1.
|
||||||
|
Cannot access memory at address 0x9e0
|
||||||
|
Command aborted.
|
||||||
|
|
||||||
|
This is due to the symbol offsets not being relocated after reloading the file.
|
||||||
|
|
||||||
|
Fix is to ensure solib_create_inferior_hook is called, in the same manner as
|
||||||
|
infrun.c:follow_exec().
|
||||||
|
|
||||||
|
Expand the idempotent test to cover PIE scenarios.
|
||||||
|
|
||||||
|
gdb/ChangeLog:
|
||||||
|
|
||||||
|
* symfile.c (symbol_file_command): Call solib_create_inferior_hook.
|
||||||
|
|
||||||
|
gdb/testsuite/ChangeLog:
|
||||||
|
|
||||||
|
* gdb.base/break-idempotent.exp: Test both PIE and non PIE.
|
||||||
|
|
||||||
|
---
|
||||||
|
gdb/ChangeLog | 4 ++
|
||||||
|
gdb/symfile.c | 12 ++++++
|
||||||
|
gdb/testsuite/ChangeLog | 4 ++
|
||||||
|
gdb/testsuite/gdb.base/break-idempotent.exp | 66 ++++++++++++++++-------------
|
||||||
|
4 files changed, 56 insertions(+), 30 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/gdb/symfile.c b/gdb/symfile.c
|
||||||
|
index bd79315687..a03ac29541 100644
|
||||||
|
--- a/gdb/symfile.c
|
||||||
|
+++ b/gdb/symfile.c
|
||||||
|
@@ -1672,7 +1672,19 @@ symbol_file_command (const char *args, int from_tty)
|
||||||
|
|
||||||
|
validate_readnow_readnever (flags);
|
||||||
|
|
||||||
|
+ /* Set SYMFILE_DEFER_BP_RESET because the proper displacement for a PIE
|
||||||
|
+ (Position Independent Executable) main symbol file will only be
|
||||||
|
+ computed by the solib_create_inferior_hook below. Without it,
|
||||||
|
+ breakpoint_re_set would fail to insert the breakpoints with the zero
|
||||||
|
+ displacement. */
|
||||||
|
+ add_flags |= SYMFILE_DEFER_BP_RESET;
|
||||||
|
+
|
||||||
|
symbol_file_add_main_1 (name, add_flags, flags, offset);
|
||||||
|
+
|
||||||
|
+ solib_create_inferior_hook (from_tty);
|
||||||
|
+
|
||||||
|
+ /* Now it's safe to re-add the breakpoints. */
|
||||||
|
+ breakpoint_re_set ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
diff --git a/gdb/testsuite/gdb.base/break-idempotent.exp b/gdb/testsuite/gdb.base/break-idempotent.exp
|
||||||
|
index 902a5f818b..96f91c50f9 100644
|
||||||
|
--- a/gdb/testsuite/gdb.base/break-idempotent.exp
|
||||||
|
+++ b/gdb/testsuite/gdb.base/break-idempotent.exp
|
||||||
|
@@ -36,23 +36,6 @@
|
||||||
|
|
||||||
|
standard_testfile
|
||||||
|
|
||||||
|
-if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} {
|
||||||
|
- return -1
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
-if ![runto_main] then {
|
||||||
|
- fail "can't run to main"
|
||||||
|
- return 0
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
-if [is_remote host] {
|
||||||
|
- set arg [remote_download host $binfile]
|
||||||
|
- if { $arg == "" } {
|
||||||
|
- perror "download failed"
|
||||||
|
- return -1
|
||||||
|
- }
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
# Force a breakpoint re-set in GDB. Currently this is done by
|
||||||
|
# reloading symbols with the "file" command.
|
||||||
|
|
||||||
|
@@ -123,7 +106,7 @@ proc set_breakpoint { break_command } {
|
||||||
|
proc test_break { always_inserted break_command } {
|
||||||
|
set cmd [lindex [split "$break_command"] 0]
|
||||||
|
|
||||||
|
- with_test_prefix "always-inserted $always_inserted: $cmd" {
|
||||||
|
+ with_test_prefix "$cmd" {
|
||||||
|
delete_breakpoints
|
||||||
|
|
||||||
|
if ![runto_main] then {
|
||||||
|
@@ -163,20 +146,43 @@ proc test_break { always_inserted break_command } {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
-foreach always_inserted { "off" "on" } {
|
||||||
|
- test_break $always_inserted "break"
|
||||||
|
+# The testcase uses the "file" command to force breakpoint re-set in
|
||||||
|
+# GDB. Test both with and without PIE, as GDB used to mishandle
|
||||||
|
+# breakpoint re-set when reloading PIEs.
|
||||||
|
+foreach_with_prefix pie { "nopie" "pie" } {
|
||||||
|
+
|
||||||
|
+ set opts {debug}
|
||||||
|
+ lappend opts $pie
|
||||||
|
|
||||||
|
- if {![skip_hw_breakpoint_tests]} {
|
||||||
|
- test_break $always_inserted "hbreak"
|
||||||
|
+ set binfile [standard_output_file $testfile-$pie]
|
||||||
|
+
|
||||||
|
+ if {[prepare_for_testing "failed to prepare" $binfile $srcfile $opts]} {
|
||||||
|
+ continue
|
||||||
|
}
|
||||||
|
|
||||||
|
- if {![skip_hw_watchpoint_tests]} {
|
||||||
|
- test_break $always_inserted "watch"
|
||||||
|
+ if [is_remote host] {
|
||||||
|
+ set arg [remote_download host $binfile]
|
||||||
|
+ if { $arg == "" } {
|
||||||
|
+ untested "download failed"
|
||||||
|
+ continue
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
|
||||||
|
- if {![skip_hw_watchpoint_access_tests]
|
||||||
|
- && ![skip_hw_watchpoint_multi_tests]} {
|
||||||
|
- test_break $always_inserted "rwatch"
|
||||||
|
- test_break $always_inserted "awatch"
|
||||||
|
+ foreach_with_prefix always_inserted { "off" "on" } {
|
||||||
|
+ test_break $always_inserted "break"
|
||||||
|
+
|
||||||
|
+ if {![skip_hw_breakpoint_tests]} {
|
||||||
|
+ test_break $always_inserted "hbreak"
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if {![skip_hw_watchpoint_tests]} {
|
||||||
|
+ test_break $always_inserted "watch"
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if {![skip_hw_watchpoint_access_tests]
|
||||||
|
+ && ![skip_hw_watchpoint_multi_tests]} {
|
||||||
|
+ test_break $always_inserted "rwatch"
|
||||||
|
+ test_break $always_inserted "awatch"
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
}
|
125
gdb-testsuite-ada-pie.patch
Normal file
125
gdb-testsuite-ada-pie.patch
Normal file
@ -0,0 +1,125 @@
|
|||||||
|
[gdb/testsuite] Compile ada hello world for skip_ada_tests
|
||||||
|
|
||||||
|
For openSUSE Leap 15.0 with gcc-PIE installed (which makes gcc create PIE
|
||||||
|
executables by default) we get:
|
||||||
|
...
|
||||||
|
FAIL: gdb.ada/O2_float_param.exp: compilation foo.adb
|
||||||
|
...
|
||||||
|
|
||||||
|
The problem is that while gcc-PIE affects gcc, it does not affect gnatlink,
|
||||||
|
so it links in the libgnat.a, rather than libgnat_pic.a. [ This is
|
||||||
|
bsc#1115034. ]
|
||||||
|
|
||||||
|
[ Without gcc-PIE, we have a related problem: if we run ada tests with
|
||||||
|
--target_board=unix/-fPIE/-pie, which makes sure PIE executables are generated
|
||||||
|
for c/c++ test-cases, still we get non-PIE ada executables, because gnatmake
|
||||||
|
does not pass -pie to gnatlink. And if gnatmake would pass -pie to gnatlink,
|
||||||
|
we'd run into the same FAIL as above because gnatlink does not use use
|
||||||
|
libgnat_pic.a when -pie is specified (this is PR gcc/87936). So, in order to
|
||||||
|
have ada tests generate PIE executables, we need
|
||||||
|
--target_board=unix/-fPIE/-largs/-pie/-lgnat_pic/-margs, which will not work
|
||||||
|
with c/c++ test-cases. ]
|
||||||
|
|
||||||
|
For now, we check whether we can compile an ada hello world, and if not,
|
||||||
|
generate an UNSUPPORTED in either skip_ada_tests or gdb_compile_ada, to
|
||||||
|
not have this problem result in ~200 FAILs.
|
||||||
|
|
||||||
|
gdb/testsuite/ChangeLog:
|
||||||
|
|
||||||
|
2019-08-06 Tom de Vries <tdevries@suse.de>
|
||||||
|
|
||||||
|
* lib/ada.exp (gdb_compile_ada_bare): Factor out of ...
|
||||||
|
(gdb_compile_ada): ... here.
|
||||||
|
(gdb_can_compile_ada): New gdb_caching_proc.
|
||||||
|
* lib/gdb.exp: Add load_lib ada.exp.
|
||||||
|
(skip_ada_tests): Return 1 if !gdb_can_compile_ada.
|
||||||
|
|
||||||
|
---
|
||||||
|
gdb/testsuite/lib/ada.exp | 38 +++++++++++++++++++++++++++++++++++++-
|
||||||
|
gdb/testsuite/lib/gdb.exp | 6 ++++++
|
||||||
|
2 files changed, 43 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/gdb/testsuite/lib/ada.exp b/gdb/testsuite/lib/ada.exp
|
||||||
|
index 1345c747c5..e3a600327e 100644
|
||||||
|
--- a/gdb/testsuite/lib/ada.exp
|
||||||
|
+++ b/gdb/testsuite/lib/ada.exp
|
||||||
|
@@ -29,7 +29,7 @@ proc target_compile_ada_from_dir {builddir source dest type options} {
|
||||||
|
|
||||||
|
# Compile some Ada code.
|
||||||
|
|
||||||
|
-proc gdb_compile_ada {source dest type options} {
|
||||||
|
+proc gdb_compile_ada_bare {source dest type options} {
|
||||||
|
|
||||||
|
set srcdir [file dirname $source]
|
||||||
|
set gprdir [file dirname $srcdir]
|
||||||
|
@@ -53,10 +53,46 @@ proc gdb_compile_ada {source dest type options} {
|
||||||
|
# We therefore simply check whether the dest file has been created
|
||||||
|
# or not. Unless not present, the build has succeeded.
|
||||||
|
if [file exists $dest] { set result "" }
|
||||||
|
+ return $result
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+proc gdb_compile_ada {source dest type options} {
|
||||||
|
+ if { [gdb_can_compile_ada] == 0 } {
|
||||||
|
+ global gdb_test_file_name
|
||||||
|
+ unsupported "$gdb_test_file_name"
|
||||||
|
+ return "Cannot compile ada"
|
||||||
|
+ }
|
||||||
|
+ set result [gdb_compile_ada_bare $source $dest $type $options]
|
||||||
|
gdb_compile_test $source $result
|
||||||
|
return $result
|
||||||
|
}
|
||||||
|
|
||||||
|
+gdb_caching_proc gdb_can_compile_ada {
|
||||||
|
+ set name "hello"
|
||||||
|
+ set dir "[pwd]/tmp-ada-hello-[pid]"
|
||||||
|
+ set src "$dir/$name.adb"
|
||||||
|
+ set dest "$dir/$name"
|
||||||
|
+
|
||||||
|
+ set code {
|
||||||
|
+ with Ada.Text_IO;
|
||||||
|
+
|
||||||
|
+ procedure Hello is
|
||||||
|
+ begin
|
||||||
|
+ Ada.Text_IO.Put_Line("Hello, world!");
|
||||||
|
+ end Hello;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ file mkdir $dir
|
||||||
|
+ gdb_produce_source $src $code
|
||||||
|
+ set res [gdb_compile_ada_bare $src $dest executable {debug}]
|
||||||
|
+ file delete -force $dir
|
||||||
|
+
|
||||||
|
+ if { $res != "" } {
|
||||||
|
+ return 0
|
||||||
|
+ }
|
||||||
|
+ return 1
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
# Like standard_testfile, but for Ada. Historically the Ada tests
|
||||||
|
# used a different naming convention from many of the other gdb tests,
|
||||||
|
# and this difference was preserved during the conversion to
|
||||||
|
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
|
||||||
|
index edc8dfcdfd..8585320bd2 100644
|
||||||
|
--- a/gdb/testsuite/lib/gdb.exp
|
||||||
|
+++ b/gdb/testsuite/lib/gdb.exp
|
||||||
|
@@ -29,6 +29,7 @@ load_lib libgloss.exp
|
||||||
|
load_lib cache.exp
|
||||||
|
load_lib gdb-utils.exp
|
||||||
|
load_lib memory.exp
|
||||||
|
+load_lib ada.exp
|
||||||
|
|
||||||
|
global GDB
|
||||||
|
|
||||||
|
@@ -1881,6 +1882,11 @@ proc skip_fortran_tests {} {
|
||||||
|
# Return a 1 if I don't even want to try to test ada.
|
||||||
|
|
||||||
|
proc skip_ada_tests {} {
|
||||||
|
+ if { [gdb_can_compile_ada] == 0 } {
|
||||||
|
+ global gdb_test_file_name
|
||||||
|
+ unsupported "$gdb_test_file_name"
|
||||||
|
+ return 1
|
||||||
|
+ }
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,59 @@
|
|||||||
|
[gdb/testsuite] Add missing initial prompt read in multidictionary.exp
|
||||||
|
|
||||||
|
When running multidictionary.exp in conjunction with:
|
||||||
|
...
|
||||||
|
$ stress -c $(($(cat /proc/cpuinfo | grep -c "^processor") + 1))
|
||||||
|
...
|
||||||
|
we get:
|
||||||
|
...
|
||||||
|
Running gdb/testsuite/gdb.dwarf2/multidictionary.exp ...
|
||||||
|
ERROR: Couldn't load multidictionary into gdb.
|
||||||
|
|
||||||
|
=== gdb Summary ===
|
||||||
|
|
||||||
|
nr of unresolved testcases 1
|
||||||
|
...
|
||||||
|
|
||||||
|
The multidictionary test-case needs -readnow, and achieves this using:
|
||||||
|
...
|
||||||
|
gdb_spawn_with_cmdline_opts "-readnow"
|
||||||
|
gdb_load
|
||||||
|
...
|
||||||
|
but the initial gdb prompt is not read. Usually, the following gdb_load
|
||||||
|
command accidentally consumes that initial prompt (at the gdb_expect for the
|
||||||
|
kill command in gdb_file_cmd). But under high load, that doesn't happen and
|
||||||
|
we run into the error.
|
||||||
|
|
||||||
|
Fix this by consuming the initial gdb prompt after spawning gdb.
|
||||||
|
|
||||||
|
Tested on x86_64-linux.
|
||||||
|
|
||||||
|
gdb/testsuite/ChangeLog:
|
||||||
|
|
||||||
|
2019-07-23 Tom de Vries <tdevries@suse.de>
|
||||||
|
|
||||||
|
PR testsuite/24842
|
||||||
|
* gdb.dwarf2/multidictionary.exp: Consume initial prompt after
|
||||||
|
gdb_spawn_with_cmdline_opts.
|
||||||
|
|
||||||
|
---
|
||||||
|
gdb/testsuite/gdb.dwarf2/multidictionary.exp | 6 ++++++
|
||||||
|
2 files changed, 12 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/gdb/testsuite/gdb.dwarf2/multidictionary.exp b/gdb/testsuite/gdb.dwarf2/multidictionary.exp
|
||||||
|
index 5588ef2144..c307ed8adc 100644
|
||||||
|
--- a/gdb/testsuite/gdb.dwarf2/multidictionary.exp
|
||||||
|
+++ b/gdb/testsuite/gdb.dwarf2/multidictionary.exp
|
||||||
|
@@ -148,6 +148,12 @@ if {[build_executable $testfile.exp $testfile [list $asm_file $srcfile] {}] \
|
||||||
|
|
||||||
|
# We force the DIEs above to be read in via "-readnow".
|
||||||
|
gdb_spawn_with_cmdline_opts "-readnow"
|
||||||
|
+set test "initial prompt"
|
||||||
|
+gdb_test_multiple "" $test {
|
||||||
|
+ -re ".*$gdb_prompt $" {
|
||||||
|
+ pass "$test"
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
gdb_load $binfile
|
||||||
|
|
||||||
|
# All we need to do is check whether GDB is alive. Without
|
97
gdb-testsuite-avoid-pagination-in-attach-32.exp.patch
Normal file
97
gdb-testsuite-avoid-pagination-in-attach-32.exp.patch
Normal file
@ -0,0 +1,97 @@
|
|||||||
|
Avoid pagination in attach-32.exp
|
||||||
|
|
||||||
|
When running test-case attach-32.exp from
|
||||||
|
gdb-6.3-inferior-notification-20050721.patch, we run into:
|
||||||
|
...
|
||||||
|
spawn build/gdb/testsuite/../../gdb/gdb -nw -nx \
|
||||||
|
-data-directory build/gdb/testsuite/../data-directory --pid=27520
|
||||||
|
GNU gdb (GDB) 8.3.50.20190726-git
|
||||||
|
Copyright (C) 2019 Free Software Foundation, Inc.
|
||||||
|
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
|
||||||
|
This is free software: you are free to change and redistribute it.
|
||||||
|
There is NO WARRANTY, to the extent permitted by law.
|
||||||
|
Type "show copying" and "show warranty" for details.
|
||||||
|
This GDB was configured as "x86_64-pc-linux-gnu".
|
||||||
|
Type "show configuration" for configuration details.
|
||||||
|
For bug reporting instructions, please see:
|
||||||
|
<http://www.gnu.org/software/gdb/bugs/>.
|
||||||
|
Find the GDB manual and other documentation resources online at:
|
||||||
|
<http://www.gnu.org/software/gdb/documentation/>.
|
||||||
|
|
||||||
|
For help, type "help".
|
||||||
|
Type "apropos word" to search for commands related to "word".
|
||||||
|
Attaching to process 27520
|
||||||
|
Reading symbols from build/gdb/testsuite/outputs/gdb.base/attach-32/attach-32...
|
||||||
|
Reading symbols from /lib/libm.so.6...
|
||||||
|
(No debugging symbols found in /lib/libm.so.6)
|
||||||
|
Reading symbols from /lib/libc.so.6...
|
||||||
|
(No debugging symbols found in /lib/libc.so.6)
|
||||||
|
(No debugging symbols found in /lib/libc.so.6)
|
||||||
|
Reading symbols from /lib/ld-linux.so.2...
|
||||||
|
(No debugging symbols found in /lib/ld-linux.so.2)
|
||||||
|
main () at /data/gdb_versions/devel/src/gdb/testsuite/gdb.base/attach-32.c:15
|
||||||
|
--Type <RET> for more, q to quit, c to continue without paging--ERROR: \
|
||||||
|
(timeout) GDB never initialized after 10 seconds.
|
||||||
|
...
|
||||||
|
The test-case hangs because pagination is activated, with height == 25
|
||||||
|
due to gdb_init.
|
||||||
|
|
||||||
|
Fix this by starting gdb using -iex "set width 0" -iex "set height 0" -quiet,
|
||||||
|
similar to how it is done in attach.exp (see commit fef1b2933d "Avoid
|
||||||
|
pagination in attach.exp").
|
||||||
|
|
||||||
|
Tested on x86_64-linux.
|
||||||
|
|
||||||
|
gdb/testsuite/ChangeLog:
|
||||||
|
|
||||||
|
2019-07-26 Tom de Vries <tdevries@suse.de>
|
||||||
|
|
||||||
|
* gdb.base/attach-32.exp: Start gdb using -iex "set width 0" -iex
|
||||||
|
"set height 0" -quiet.
|
||||||
|
|
||||||
|
---
|
||||||
|
gdb/testsuite/gdb.base/attach-32.exp | 24 ++++++++++++++++--------
|
||||||
|
1 file changed, 16 insertions(+), 8 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/gdb/testsuite/gdb.base/attach-32.exp b/gdb/testsuite/gdb.base/attach-32.exp
|
||||||
|
index 67ded02ccf..7627a0a5db 100644
|
||||||
|
--- a/gdb/testsuite/gdb.base/attach-32.exp
|
||||||
|
+++ b/gdb/testsuite/gdb.base/attach-32.exp
|
||||||
|
@@ -212,10 +212,14 @@ if { [istarget "*-*-cygwin*"] } {
|
||||||
|
set testpid [ exec ps -e | gawk "{ if (\$1 == $testpid) print \$4; }" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
-set GDBFLAGS_orig $GDBFLAGS
|
||||||
|
-set GDBFLAGS "--pid=$testpid"
|
||||||
|
-gdb_start
|
||||||
|
-set GDBFLAGS $GDBFLAGS_orig
|
||||||
|
+set res [gdb_spawn_with_cmdline_opts \
|
||||||
|
+ "-quiet -iex \"set height 0\" -iex \"set width 0\" --pid=$testpid"]
|
||||||
|
+set test "starting with --pid"
|
||||||
|
+gdb_test_multiple "" $test {
|
||||||
|
+ -re "Reading symbols from.*$gdb_prompt $" {
|
||||||
|
+ pass "$test"
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
|
||||||
|
gdb_reinitialize_dir $srcdir/$subdir
|
||||||
|
|
||||||
|
@@ -234,10 +238,14 @@ if { [istarget "*-*-cygwin*"] } {
|
||||||
|
set testpid [ exec ps -e | gawk "{ if (\$1 == $testpid) print \$4; }" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
-set GDBFLAGS_orig $GDBFLAGS
|
||||||
|
-set GDBFLAGS "--pid=$testpid"
|
||||||
|
-gdb_start
|
||||||
|
-set GDBFLAGS $GDBFLAGS_orig
|
||||||
|
+set res [gdb_spawn_with_cmdline_opts \
|
||||||
|
+ "-quiet -iex \"set height 0\" -iex \"set width 0\" --pid=$testpid"]
|
||||||
|
+set test "starting with --pid"
|
||||||
|
+gdb_test_multiple "" $test {
|
||||||
|
+ -re "Reading symbols from.*$gdb_prompt $" {
|
||||||
|
+ pass "$test"
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
|
||||||
|
gdb_reinitialize_dir $srcdir/$subdir
|
||||||
|
do_call_attach_tests
|
39
gdb-testsuite-fix-perror-in-gdb.opt-fortran-string.exp.patch
Normal file
39
gdb-testsuite-fix-perror-in-gdb.opt-fortran-string.exp.patch
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
Fix perror in gdb.opt/fortran-string.exp
|
||||||
|
|
||||||
|
When running the test-case gdb.opt/fortran-string.exp from
|
||||||
|
gdb-archer-vla-tests.patch, we run into:
|
||||||
|
...
|
||||||
|
ERROR: couldn't run to breakpoint MAIN__
|
||||||
|
...
|
||||||
|
The test case attempts to set a breakpoint on a line containing an "s = s"
|
||||||
|
assignment and when that doesn't work, it error out with above error message.
|
||||||
|
|
||||||
|
The test-case executable is optimized, and the "s = s" assignment is optimized
|
||||||
|
away, so there's not really an error, it's just that the test-case is
|
||||||
|
unsupported due to the optimizations done by the compiler.
|
||||||
|
|
||||||
|
Fix this by replacing the ERROR with UNSUPPORTED.
|
||||||
|
|
||||||
|
gdb/testsuite/ChangeLog:
|
||||||
|
|
||||||
|
2019-07-26 Tom de Vries <tdevries@suse.de>
|
||||||
|
|
||||||
|
* gdb.opt/fortran-string.exp: Replace error with unsupported.
|
||||||
|
|
||||||
|
---
|
||||||
|
gdb/testsuite/gdb.opt/fortran-string.exp | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/gdb/testsuite/gdb.opt/fortran-string.exp b/gdb/testsuite/gdb.opt/fortran-string.exp
|
||||||
|
index 90a2bdf212..6e5f37d439 100644
|
||||||
|
--- a/gdb/testsuite/gdb.opt/fortran-string.exp
|
||||||
|
+++ b/gdb/testsuite/gdb.opt/fortran-string.exp
|
||||||
|
@@ -30,7 +30,7 @@ if { [prepare_for_testing ${test}.exp ${test} ${srcfile} {debug f90 additional_f
|
||||||
|
}
|
||||||
|
|
||||||
|
if ![runto $srcfile:[gdb_get_line_number "s = s"]] then {
|
||||||
|
- perror "couldn't run to breakpoint MAIN__"
|
||||||
|
+ unsupported "couldn't run to breakpoint s = s in optimized executable"
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
47
gdb-testsuite-i386-pkru-exp.patch
Normal file
47
gdb-testsuite-i386-pkru-exp.patch
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
commit 1512d3b7b9de3a1943623f2e1f373459d5d80a98
|
||||||
|
Author: Tom de Vries <tdevries@suse.de>
|
||||||
|
Date: Fri Jul 26 21:49:45 2019 +0200
|
||||||
|
|
||||||
|
[gdb/testsuite] Fix unterminated string in i386-pkru.exp
|
||||||
|
|
||||||
|
I ran into this error:
|
||||||
|
...
|
||||||
|
ERROR: tcl error sourcing gdb/testsuite/gdb.arch/i386-pkru.exp.
|
||||||
|
ERROR: missing "
|
||||||
|
while executing
|
||||||
|
"untested ""
|
||||||
|
invoked from within
|
||||||
|
"if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \
|
||||||
|
[list debug additional_flags=${comp_flags}]] } {
|
||||||
|
untested "failed to c..."
|
||||||
|
(file "gdb/testsuite/gdb.arch/i386-pkru.exp" line 25)
|
||||||
|
invoked from within
|
||||||
|
...
|
||||||
|
caused by:
|
||||||
|
...
|
||||||
|
untested "failed to compile x86 PKEYS test.
|
||||||
|
...
|
||||||
|
|
||||||
|
Fix the unterminated string.
|
||||||
|
|
||||||
|
Tested on x86_64-linux.
|
||||||
|
|
||||||
|
gdb/testsuite/ChangeLog:
|
||||||
|
|
||||||
|
2019-07-26 Tom de Vries <tdevries@suse.de>
|
||||||
|
|
||||||
|
* gdb.arch/i386-pkru.exp: Fix unterminated string.
|
||||||
|
|
||||||
|
diff --git a/gdb/testsuite/gdb.arch/i386-pkru.exp b/gdb/testsuite/gdb.arch/i386-pkru.exp
|
||||||
|
index 7a2c65799e..db271522f0 100644
|
||||||
|
--- a/gdb/testsuite/gdb.arch/i386-pkru.exp
|
||||||
|
+++ b/gdb/testsuite/gdb.arch/i386-pkru.exp
|
||||||
|
@@ -24,7 +24,7 @@ set comp_flags "-I${srcdir}/../nat/"
|
||||||
|
|
||||||
|
if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \
|
||||||
|
[list debug additional_flags=${comp_flags}]] } {
|
||||||
|
- untested "failed to compile x86 PKEYS test.
|
||||||
|
+ untested "failed to compile x86 PKEYS test."
|
||||||
|
return -1
|
||||||
|
}
|
||||||
|
|
522
gdb-testsuite-pie-no-pie.patch
Normal file
522
gdb-testsuite-pie-no-pie.patch
Normal file
@ -0,0 +1,522 @@
|
|||||||
|
- Testsuite: Ensure pie is disabled on some tests
|
||||||
|
- Testsuite: Remove pie from trace tests
|
||||||
|
- [gdb/testsuite] Fail in gdb_compile if nopie results in PIE executable
|
||||||
|
- [gdb/testsuite] Fail in gdb_compile if pie results in non-PIE executable
|
||||||
|
|
||||||
|
---------------------------------------------------------
|
||||||
|
|
||||||
|
[gdb/testsuite] Fail in gdb_compile if pie results in non-PIE executable
|
||||||
|
|
||||||
|
When running gdb.base/break-idempotent.exp with
|
||||||
|
--target_board=unix/-fno-PIE/-no-pie, we get:
|
||||||
|
...
|
||||||
|
nr of expected passes 140
|
||||||
|
...
|
||||||
|
|
||||||
|
The test-case is compiled once with nopie and once with pie, but in both cases
|
||||||
|
we end up with a non-PIE executable. The "-fno-PIE -no-pie" options specified
|
||||||
|
using the target_board are interpreted by dejagnu as multilib_flags, and end up
|
||||||
|
overriding the pie flags.
|
||||||
|
|
||||||
|
Fix this by checking in gdb_compile if the resulting exec is non-PIE despite of
|
||||||
|
a pie setting, and if so return an error:
|
||||||
|
...
|
||||||
|
Running gdb/testsuite/gdb.base/break-idempotent.exp ...
|
||||||
|
gdb compile failed, pie failed to generate PIE executable
|
||||||
|
|
||||||
|
=== gdb Summary ===
|
||||||
|
|
||||||
|
nr of expected passes 70
|
||||||
|
nr of untested testcases 1
|
||||||
|
...
|
||||||
|
|
||||||
|
Tested on x86_64-linux.
|
||||||
|
|
||||||
|
gdb/testsuite/ChangeLog:
|
||||||
|
|
||||||
|
2019-08-05 Tom de Vries <tdevries@suse.de>
|
||||||
|
|
||||||
|
* lib/gdb.exp (version_at_least): Factor out of ...
|
||||||
|
(tcl_version_at_least): ... here.
|
||||||
|
(gdb_compile): Fail if pie results in non-PIE executable.
|
||||||
|
(readelf_version, readelf_prints_pie): New proc.
|
||||||
|
(exec_is_pie): Return -1 if unknown.
|
||||||
|
|
||||||
|
---------------------------------------------------------
|
||||||
|
|
||||||
|
[gdb/testsuite] Fail in gdb_compile if nopie results in PIE executable
|
||||||
|
|
||||||
|
When running gdb.base/dump.exp with --target_board=unix/-fPIE/-pie, we get:
|
||||||
|
...
|
||||||
|
Running gdb/testsuite/gdb.base/dump.exp ...
|
||||||
|
FAIL: gdb.base/dump.exp: dump array as value, intel hex
|
||||||
|
...
|
||||||
|
|
||||||
|
The FAIL happens because although the test specifies nopie, the exec is
|
||||||
|
in fact compiled as PIE. The "-fPIE -pie" options specified using the
|
||||||
|
target_board are interpreted by dejagnu as multilib_flags, and end up
|
||||||
|
overriding the nopie flags.
|
||||||
|
|
||||||
|
Fix this by checking in gdb_compile if the resulting exec is PIE despite of
|
||||||
|
a nopie setting, and if so return an error:
|
||||||
|
...
|
||||||
|
Running gdb/testsuite/gdb.base/dump.exp ...
|
||||||
|
gdb compile failed, nopie failed to prevent PIE executable
|
||||||
|
|
||||||
|
=== gdb Summary ===
|
||||||
|
|
||||||
|
nr of untested testcases 1
|
||||||
|
...
|
||||||
|
|
||||||
|
Tested on x86_64-linux.
|
||||||
|
|
||||||
|
gdb/testsuite/ChangeLog:
|
||||||
|
|
||||||
|
2019-07-30 Tom de Vries <tdevries@suse.de>
|
||||||
|
|
||||||
|
PR testsuite/24834
|
||||||
|
* lib/gdb.exp (gdb_compile): Fail if nopie results in PIE executable.
|
||||||
|
(exec_is_pie): New proc.
|
||||||
|
|
||||||
|
---------------------------------------------------------
|
||||||
|
|
||||||
|
Testsuite: Remove pie from trace tests
|
||||||
|
|
||||||
|
Ubuntu/Debian defaults PIE to enabled. This causes the trace tests
|
||||||
|
to fall over due to variables being returned as "unavailable". The
|
||||||
|
tests were never designed to work with pie.
|
||||||
|
|
||||||
|
Simply ensure the nopie flag is always used for the failing tests.
|
||||||
|
|
||||||
|
This removes 100+ failures when running native-gdbserver on Ubuntu 18.04.
|
||||||
|
|
||||||
|
gdb/testsuite/ChangeLog:
|
||||||
|
|
||||||
|
* gdb.trace/backtrace.exp: Use nopie flag.
|
||||||
|
* gdb.trace/circ.exp: Likewise.
|
||||||
|
* gdb.trace/collection.exp: Likewise.
|
||||||
|
* gdb.trace/ftrace.exp: Likewise.
|
||||||
|
* gdb.trace/mi-trace-unavailable.exp: Likewise.
|
||||||
|
* gdb.trace/mi-traceframe-changed.exp: Likewise.
|
||||||
|
* gdb.trace/qtro.exp: Likewise.
|
||||||
|
* gdb.trace/read-memory.exp: Likewise.
|
||||||
|
* gdb.trace/report.exp: Likewise.
|
||||||
|
* gdb.trace/tfile.exp: Likewise.
|
||||||
|
* gdb.trace/tfind.exp: Likewise.
|
||||||
|
* gdb.trace/unavailable.exp: Likewise.
|
||||||
|
|
||||||
|
---------------------------------------------------------
|
||||||
|
|
||||||
|
Testsuite: Ensure pie is disabled on some tests
|
||||||
|
|
||||||
|
Recent versions of Ubuntu and Debian default GCC to enable pie.
|
||||||
|
|
||||||
|
In dump.exp, pie will causes addresses to be out of range for IHEX.
|
||||||
|
|
||||||
|
In break-interp.exp, pie is explicitly set for some tests and assumed
|
||||||
|
to be disabled for the remainder.
|
||||||
|
|
||||||
|
Ensure pie is disabled for these tests when required.
|
||||||
|
|
||||||
|
In addition, add a pie option to gdb_compile to match the nopie option
|
||||||
|
and simplify use.
|
||||||
|
|
||||||
|
gdb/testsuite/ChangeLog:
|
||||||
|
|
||||||
|
* README: Add pie options.
|
||||||
|
* gdb.base/break-interp.exp: Ensure pie is disabled.
|
||||||
|
* gdb.base/dump.exp: Likewise.
|
||||||
|
* lib/gdb.exp (gdb_compile): Add pie option.
|
||||||
|
|
||||||
|
---------------------------------------------------------
|
||||||
|
|
||||||
|
diff --git a/gdb/testsuite/README b/gdb/testsuite/README
|
||||||
|
index b5e75b9a79..db90ea4698 100644
|
||||||
|
--- a/gdb/testsuite/README
|
||||||
|
+++ b/gdb/testsuite/README
|
||||||
|
@@ -482,6 +482,16 @@ gdb,no_thread_names
|
||||||
|
|
||||||
|
The target doesn't support thread names.
|
||||||
|
|
||||||
|
+gdb,pie_flag
|
||||||
|
+
|
||||||
|
+ The flag required to force the compiler to produce position-independent
|
||||||
|
+ executables.
|
||||||
|
+
|
||||||
|
+gdb,pie_ldflag
|
||||||
|
+
|
||||||
|
+ The flag required to force the linker to produce position-independent
|
||||||
|
+ executables.
|
||||||
|
+
|
||||||
|
gdb,nopie_flag
|
||||||
|
|
||||||
|
The flag required to force the compiler to produce non-position-independent
|
||||||
|
diff --git a/gdb/testsuite/gdb.base/break-interp.exp b/gdb/testsuite/gdb.base/break-interp.exp
|
||||||
|
index f85e8a650a..51e31f6503 100644
|
||||||
|
--- a/gdb/testsuite/gdb.base/break-interp.exp
|
||||||
|
+++ b/gdb/testsuite/gdb.base/break-interp.exp
|
||||||
|
@@ -625,8 +625,10 @@ foreach ldprelink {NO YES} {
|
||||||
|
lappend opts {debug}
|
||||||
|
}
|
||||||
|
if {$binpie != "NO"} {
|
||||||
|
- lappend opts {additional_flags=-fPIE}
|
||||||
|
- lappend opts {ldflags=-pie}
|
||||||
|
+ lappend opts {pie}
|
||||||
|
+ } else {
|
||||||
|
+ # Debian9/Ubuntu16.10 onwards default to PIE enabled. Ensure it is disabled.
|
||||||
|
+ lappend opts {nopie}
|
||||||
|
}
|
||||||
|
|
||||||
|
set dir ${exec}.d
|
||||||
|
diff --git a/gdb/testsuite/gdb.base/dump.exp b/gdb/testsuite/gdb.base/dump.exp
|
||||||
|
index 44b0988b80..52ba5f8ebe 100644
|
||||||
|
--- a/gdb/testsuite/gdb.base/dump.exp
|
||||||
|
+++ b/gdb/testsuite/gdb.base/dump.exp
|
||||||
|
@@ -36,6 +36,10 @@ if {[istarget "spu*-*-*"]} then {
|
||||||
|
set is64bitonly "yes"
|
||||||
|
}
|
||||||
|
|
||||||
|
+# Debian9/Ubuntu16.10 onwards default to PIE enabled. Ensure it is disabled as
|
||||||
|
+# this causes addresses to be out of range for IHEX.
|
||||||
|
+lappend options {nopie}
|
||||||
|
+
|
||||||
|
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable ${options}] != "" } {
|
||||||
|
untested "failed to compile"
|
||||||
|
return -1
|
||||||
|
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
|
||||||
|
index 36f167336c..3d5f8726f7 100644
|
||||||
|
--- a/gdb/testsuite/lib/gdb.exp
|
||||||
|
+++ b/gdb/testsuite/lib/gdb.exp
|
||||||
|
@@ -3492,6 +3492,7 @@ set gdb_saved_set_unbuffered_mode_obj ""
|
||||||
|
# dynamically load libraries at runtime. For example, on Linux, this adds
|
||||||
|
# -ldl so that the test can use dlopen.
|
||||||
|
# - nowarnings: Inhibit all compiler warnings.
|
||||||
|
+# - pie: Force creation of PIE executables.
|
||||||
|
# - nopie: Prevent creation of PIE executables.
|
||||||
|
#
|
||||||
|
# And here are some of the not too obscure options understood by DejaGnu that
|
||||||
|
@@ -3630,8 +3631,33 @@ proc gdb_compile {source dest type options} {
|
||||||
|
set options [lreplace $options $nowarnings $nowarnings $flag]
|
||||||
|
}
|
||||||
|
|
||||||
|
- # Replace the "nopie" option with the appropriate additional_flags
|
||||||
|
- # to disable PIE executables.
|
||||||
|
+ # Replace the "pie" option with the appropriate compiler and linker flags
|
||||||
|
+ # to enable PIE executables.
|
||||||
|
+ set pie [lsearch -exact $options pie]
|
||||||
|
+ if {$pie != -1} {
|
||||||
|
+ if [target_info exists gdb,pie_flag] {
|
||||||
|
+ set flag "additional_flags=[target_info gdb,pie_flag]"
|
||||||
|
+ } else {
|
||||||
|
+ # For safety, use fPIE rather than fpie. On AArch64, m68k, PowerPC
|
||||||
|
+ # and SPARC, fpie can cause compile errors due to the GOT exceeding
|
||||||
|
+ # a maximum size. On other architectures the two flags are
|
||||||
|
+ # identical (see the GCC manual). Note Debian9 and Ubuntu16.10
|
||||||
|
+ # onwards default GCC to using fPIE. If you do require fpie, then
|
||||||
|
+ # it can be set using the pie_flag.
|
||||||
|
+ set flag "additional_flags=-fPIE"
|
||||||
|
+ }
|
||||||
|
+ set options [lreplace $options $pie $pie $flag]
|
||||||
|
+
|
||||||
|
+ if [target_info exists gdb,pie_ldflag] {
|
||||||
|
+ set flag "ldflags=[target_info gdb,pie_ldflag]"
|
||||||
|
+ } else {
|
||||||
|
+ set flag "ldflags=-pie"
|
||||||
|
+ }
|
||||||
|
+ lappend options "$flag"
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ # Replace the "nopie" option with the appropriate linker flag to disable
|
||||||
|
+ # PIE executables. There are no compiler flags for this option.
|
||||||
|
set nopie [lsearch -exact $options nopie]
|
||||||
|
if {$nopie != -1} {
|
||||||
|
if [target_info exists gdb,nopie_flag] {
|
||||||
|
diff --git a/gdb/testsuite/gdb.trace/backtrace.exp b/gdb/testsuite/gdb.trace/backtrace.exp
|
||||||
|
index 0f60153cb5..24e097135f 100644
|
||||||
|
--- a/gdb/testsuite/gdb.trace/backtrace.exp
|
||||||
|
+++ b/gdb/testsuite/gdb.trace/backtrace.exp
|
||||||
|
@@ -27,7 +27,7 @@ if ![gdb_trace_common_supports_arch] {
|
||||||
|
}
|
||||||
|
|
||||||
|
if [prepare_for_testing "failed to prepare" $executable $srcfile \
|
||||||
|
- [list debug nowarnings]] {
|
||||||
|
+ [list debug nowarnings nopie]] {
|
||||||
|
return -1
|
||||||
|
}
|
||||||
|
|
||||||
|
diff --git a/gdb/testsuite/gdb.trace/circ.exp b/gdb/testsuite/gdb.trace/circ.exp
|
||||||
|
index d48eca5deb..30ec9b47fc 100644
|
||||||
|
--- a/gdb/testsuite/gdb.trace/circ.exp
|
||||||
|
+++ b/gdb/testsuite/gdb.trace/circ.exp
|
||||||
|
@@ -17,7 +17,7 @@ load_lib "trace-support.exp"
|
||||||
|
|
||||||
|
standard_testfile
|
||||||
|
|
||||||
|
-if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug nowarnings}]} {
|
||||||
|
+if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug nowarnings nopie}]} {
|
||||||
|
return -1
|
||||||
|
}
|
||||||
|
|
||||||
|
diff --git a/gdb/testsuite/gdb.trace/collection.exp b/gdb/testsuite/gdb.trace/collection.exp
|
||||||
|
index 8c064385ba..44eccbe865 100644
|
||||||
|
--- a/gdb/testsuite/gdb.trace/collection.exp
|
||||||
|
+++ b/gdb/testsuite/gdb.trace/collection.exp
|
||||||
|
@@ -19,7 +19,7 @@ load_lib "trace-support.exp"
|
||||||
|
standard_testfile
|
||||||
|
set executable $testfile
|
||||||
|
|
||||||
|
-if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug nowarnings}]} {
|
||||||
|
+if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug nowarnings nopie}]} {
|
||||||
|
return -1
|
||||||
|
}
|
||||||
|
|
||||||
|
diff --git a/gdb/testsuite/gdb.trace/ftrace.exp b/gdb/testsuite/gdb.trace/ftrace.exp
|
||||||
|
index f97c2c6193..702efe76bb 100644
|
||||||
|
--- a/gdb/testsuite/gdb.trace/ftrace.exp
|
||||||
|
+++ b/gdb/testsuite/gdb.trace/ftrace.exp
|
||||||
|
@@ -53,7 +53,7 @@ set remote_libipa [gdb_load_shlib $libipa]
|
||||||
|
# file unused because linking not done" when building the object.
|
||||||
|
|
||||||
|
if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \
|
||||||
|
- executable [list debug $additional_flags shlib=$libipa] ] != "" } {
|
||||||
|
+ executable [list debug nopie $additional_flags shlib=$libipa] ] != "" } {
|
||||||
|
untested "failed to compile"
|
||||||
|
return -1
|
||||||
|
}
|
||||||
|
diff --git a/gdb/testsuite/gdb.trace/mi-trace-unavailable.exp b/gdb/testsuite/gdb.trace/mi-trace-unavailable.exp
|
||||||
|
index 5ec4bbc152..f0b3c52728 100644
|
||||||
|
--- a/gdb/testsuite/gdb.trace/mi-trace-unavailable.exp
|
||||||
|
+++ b/gdb/testsuite/gdb.trace/mi-trace-unavailable.exp
|
||||||
|
@@ -17,7 +17,7 @@ load_lib trace-support.exp
|
||||||
|
|
||||||
|
standard_testfile trace-unavailable.c
|
||||||
|
|
||||||
|
-if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} {debug}] } {
|
||||||
|
+if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} {debug nopie}] } {
|
||||||
|
return -1
|
||||||
|
}
|
||||||
|
|
||||||
|
diff --git a/gdb/testsuite/gdb.trace/mi-traceframe-changed.exp b/gdb/testsuite/gdb.trace/mi-traceframe-changed.exp
|
||||||
|
index 781d3646cb..1244b5b273 100644
|
||||||
|
--- a/gdb/testsuite/gdb.trace/mi-traceframe-changed.exp
|
||||||
|
+++ b/gdb/testsuite/gdb.trace/mi-traceframe-changed.exp
|
||||||
|
@@ -32,7 +32,7 @@ if {![is_remote host] && ![is_remote target]} {
|
||||||
|
|
||||||
|
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" \
|
||||||
|
executable \
|
||||||
|
- [list debug nowarnings \
|
||||||
|
+ [list debug nowarnings nopie\
|
||||||
|
"additional_flags=-DTFILE_DIR=\"$tfile_dir\""]] \
|
||||||
|
!= "" } {
|
||||||
|
untested "failed to compile"
|
||||||
|
diff --git a/gdb/testsuite/gdb.trace/qtro.exp b/gdb/testsuite/gdb.trace/qtro.exp
|
||||||
|
index 9eabfeb51e..d5d912b5b9 100644
|
||||||
|
--- a/gdb/testsuite/gdb.trace/qtro.exp
|
||||||
|
+++ b/gdb/testsuite/gdb.trace/qtro.exp
|
||||||
|
@@ -22,7 +22,7 @@ load_lib trace-support.exp
|
||||||
|
|
||||||
|
standard_testfile
|
||||||
|
|
||||||
|
-if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} {
|
||||||
|
+if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug nopie}]} {
|
||||||
|
return -1
|
||||||
|
}
|
||||||
|
clean_restart $testfile
|
||||||
|
diff --git a/gdb/testsuite/gdb.trace/read-memory.exp b/gdb/testsuite/gdb.trace/read-memory.exp
|
||||||
|
index 61fc137916..4d19f0074d 100644
|
||||||
|
--- a/gdb/testsuite/gdb.trace/read-memory.exp
|
||||||
|
+++ b/gdb/testsuite/gdb.trace/read-memory.exp
|
||||||
|
@@ -17,7 +17,7 @@ load_lib "trace-support.exp"
|
||||||
|
|
||||||
|
standard_testfile
|
||||||
|
|
||||||
|
-if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} {
|
||||||
|
+if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug nopie}]} {
|
||||||
|
return -1
|
||||||
|
}
|
||||||
|
|
||||||
|
diff --git a/gdb/testsuite/gdb.trace/report.exp b/gdb/testsuite/gdb.trace/report.exp
|
||||||
|
index f43fbb7c62..c847ab0c5b 100644
|
||||||
|
--- a/gdb/testsuite/gdb.trace/report.exp
|
||||||
|
+++ b/gdb/testsuite/gdb.trace/report.exp
|
||||||
|
@@ -27,7 +27,7 @@ if ![gdb_trace_common_supports_arch] {
|
||||||
|
return -1
|
||||||
|
}
|
||||||
|
if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \
|
||||||
|
- executable {debug nowarnings}] != "" } {
|
||||||
|
+ executable {debug nowarnings nopie}] != "" } {
|
||||||
|
untested "failed to compile"
|
||||||
|
return -1
|
||||||
|
}
|
||||||
|
diff --git a/gdb/testsuite/gdb.trace/tfile.exp b/gdb/testsuite/gdb.trace/tfile.exp
|
||||||
|
index 04f3e98e99..23f4fc58d0 100644
|
||||||
|
--- a/gdb/testsuite/gdb.trace/tfile.exp
|
||||||
|
+++ b/gdb/testsuite/gdb.trace/tfile.exp
|
||||||
|
@@ -37,7 +37,7 @@ if {![is_remote host] && ![is_remote target]} {
|
||||||
|
standard_testfile
|
||||||
|
if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \
|
||||||
|
executable \
|
||||||
|
- [list debug \
|
||||||
|
+ [list debug nopie\
|
||||||
|
"additional_flags=-DTFILE_DIR=\"$tfile_dir\""]] \
|
||||||
|
!= "" } {
|
||||||
|
untested "failed to compile"
|
||||||
|
diff --git a/gdb/testsuite/gdb.trace/tfind.exp b/gdb/testsuite/gdb.trace/tfind.exp
|
||||||
|
index 2c9996b040..fb58f80196 100644
|
||||||
|
--- a/gdb/testsuite/gdb.trace/tfind.exp
|
||||||
|
+++ b/gdb/testsuite/gdb.trace/tfind.exp
|
||||||
|
@@ -29,7 +29,7 @@ if ![gdb_trace_common_supports_arch] {
|
||||||
|
}
|
||||||
|
|
||||||
|
if { [gdb_compile "$srcdir/$subdir/$srcfile" "$binfile" \
|
||||||
|
- executable {debug nowarnings}] != "" } {
|
||||||
|
+ executable {debug nowarnings nopie}] != "" } {
|
||||||
|
untested "failed to compile"
|
||||||
|
return -1
|
||||||
|
}
|
||||||
|
diff --git a/gdb/testsuite/gdb.trace/unavailable.exp b/gdb/testsuite/gdb.trace/unavailable.exp
|
||||||
|
index 23d593e7d3..f3bb54db34 100644
|
||||||
|
--- a/gdb/testsuite/gdb.trace/unavailable.exp
|
||||||
|
+++ b/gdb/testsuite/gdb.trace/unavailable.exp
|
||||||
|
@@ -19,7 +19,7 @@ standard_testfile unavailable.cc
|
||||||
|
set executable $testfile
|
||||||
|
|
||||||
|
if {[prepare_for_testing "failed to prepare" $testfile $srcfile \
|
||||||
|
- {debug nowarnings c++}]} {
|
||||||
|
+ {debug nowarnings c++ nopie}]} {
|
||||||
|
return -1
|
||||||
|
}
|
||||||
|
|
||||||
|
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
|
||||||
|
index 3d5f8726f7..cf7739aee3 100644
|
||||||
|
--- a/gdb/testsuite/lib/gdb.exp
|
||||||
|
+++ b/gdb/testsuite/lib/gdb.exp
|
||||||
|
@@ -3722,6 +3722,12 @@ proc gdb_compile {source dest type options} {
|
||||||
|
regsub "\[\r\n\]*$" "$result" "" result
|
||||||
|
regsub "^\[\r\n\]*" "$result" "" result
|
||||||
|
|
||||||
|
+ if { $type == "executable" && $result == "" && $nopie != -1 } {
|
||||||
|
+ if { [exec_is_pie "$dest"] } {
|
||||||
|
+ set result "nopie failed to prevent PIE executable"
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
if {[lsearch $options quiet] < 0} {
|
||||||
|
# We shall update this on a per language basis, to avoid
|
||||||
|
# changing the entire testsuite in one go.
|
||||||
|
@@ -5083,6 +5089,18 @@ proc rerun_to_main {} {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
+# Return true if EXECUTABLE is a Position Independent Executable.
|
||||||
|
+
|
||||||
|
+proc exec_is_pie { executable } {
|
||||||
|
+ set readelf_program [gdb_find_readelf]
|
||||||
|
+ set res [catch {exec $readelf_program -d $executable \
|
||||||
|
+ | grep -E "(FLAGS_1).*Flags:.* PIE($| )" }]
|
||||||
|
+ if { $res == 0 } {
|
||||||
|
+ return 1
|
||||||
|
+ }
|
||||||
|
+ return 0
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
# Return true if a test should be skipped due to lack of floating
|
||||||
|
# point support or GDB can't fetch the contents from floating point
|
||||||
|
# registers.
|
||||||
|
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
|
||||||
|
index cf7739aee3..896e0f1b40 100644
|
||||||
|
--- a/gdb/testsuite/lib/gdb.exp
|
||||||
|
+++ b/gdb/testsuite/lib/gdb.exp
|
||||||
|
@@ -1097,6 +1097,18 @@ proc gdb_test { args } {
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
|
||||||
|
+# Return 1 if version MAJOR.MINOR is at least AT_LEAST_MAJOR.AT_LEAST_MINOR.
|
||||||
|
+proc version_at_least { major minor at_least_major at_least_minor} {
|
||||||
|
+ if { $major > $at_least_major } {
|
||||||
|
+ return 1
|
||||||
|
+ } elseif { $major == $at_least_major \
|
||||||
|
+ && $minor >= $at_least_minor } {
|
||||||
|
+ return 1
|
||||||
|
+ } else {
|
||||||
|
+ return 0
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
# gdb_test_no_output COMMAND MESSAGE
|
||||||
|
# Send a command to GDB and verify that this command generated no output.
|
||||||
|
#
|
||||||
|
@@ -3722,9 +3734,13 @@ proc gdb_compile {source dest type options} {
|
||||||
|
regsub "\[\r\n\]*$" "$result" "" result
|
||||||
|
regsub "^\[\r\n\]*" "$result" "" result
|
||||||
|
|
||||||
|
- if { $type == "executable" && $result == "" && $nopie != -1 } {
|
||||||
|
- if { [exec_is_pie "$dest"] } {
|
||||||
|
+ if { $type == "executable" && $result == "" \
|
||||||
|
+ && ($nopie != -1 || $pie != -1) } {
|
||||||
|
+ set is_pie [exec_is_pie "$dest"]
|
||||||
|
+ if { $nopie != -1 && $is_pie == 1 } {
|
||||||
|
set result "nopie failed to prevent PIE executable"
|
||||||
|
+ } elseif { $pie != -1 && $is_pie == 0 } {
|
||||||
|
+ set result "pie failed to generate PIE executable"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -5089,13 +5105,53 @@ proc rerun_to_main {} {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
-# Return true if EXECUTABLE is a Position Independent Executable.
|
||||||
|
+# Return list with major and minor version of readelf, or an empty list.
|
||||||
|
+gdb_caching_proc readelf_version {
|
||||||
|
+ set readelf_program [gdb_find_readelf]
|
||||||
|
+ set res [catch {exec $readelf_program --version} output]
|
||||||
|
+ if { $res != 0 } {
|
||||||
|
+ return [list]
|
||||||
|
+ }
|
||||||
|
+ set lines [split $output \n]
|
||||||
|
+ set line [lindex $lines 0]
|
||||||
|
+ set res [regexp {[ \t]+([0-9]+)[.]([0-9]+)[^ \t]*$} \
|
||||||
|
+ $line dummy major minor]
|
||||||
|
+ if { $res != 1 } {
|
||||||
|
+ return [list]
|
||||||
|
+ }
|
||||||
|
+ return [list $major $minor]
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+# Return 1 if readelf prints the PIE flag, 0 if is doesn't, and -1 if unknown.
|
||||||
|
+proc readelf_prints_pie { } {
|
||||||
|
+ set version [readelf_version]
|
||||||
|
+ if { [llength $version] == 0 } {
|
||||||
|
+ return -1
|
||||||
|
+ }
|
||||||
|
+ set major [lindex $version 0]
|
||||||
|
+ set minor [lindex $version 1]
|
||||||
|
+ # It would be better to construct a PIE executable and test if the PIE
|
||||||
|
+ # flag is printed by readelf, but we cannot reliably construct a PIE
|
||||||
|
+ # executable if the multilib_flags dictate otherwise
|
||||||
|
+ # (--target_board=unix/-no-pie/-fno-PIE).
|
||||||
|
+ return [version_at_least $major $minor 2 26]
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+# Return 1 if EXECUTABLE is a Position Independent Executable, 0 if it is not,
|
||||||
|
+# and -1 if unknown.
|
||||||
|
|
||||||
|
proc exec_is_pie { executable } {
|
||||||
|
+ set res [readelf_prints_pie]
|
||||||
|
+ if { $res != 1 } {
|
||||||
|
+ return -1
|
||||||
|
+ }
|
||||||
|
set readelf_program [gdb_find_readelf]
|
||||||
|
- set res [catch {exec $readelf_program -d $executable \
|
||||||
|
- | grep -E "(FLAGS_1).*Flags:.* PIE($| )" }]
|
||||||
|
- if { $res == 0 } {
|
||||||
|
+ set res [catch {exec $readelf_program -d $executable} output]
|
||||||
|
+ if { $res != 0 } {
|
||||||
|
+ return -1
|
||||||
|
+ }
|
||||||
|
+ set res [regexp -line {\(FLAGS_1\).*Flags:.* PIE($| )} $output]
|
||||||
|
+ if { $res == 1 } {
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
return 0
|
312
gdb-testsuite-read1-fixes.patch
Normal file
312
gdb-testsuite-read1-fixes.patch
Normal file
@ -0,0 +1,312 @@
|
|||||||
|
- Fix test_gdb_complete_tab_multiple race
|
||||||
|
- [gdb/testsuite] Don't expect gdb_prompt in mi_skip_python_test
|
||||||
|
- [gdb/testsuite] Fix gdb.base/maint.exp with check-read1
|
||||||
|
- [gdb/testsuite] Fix mi-catch-cpp-exceptions.exp and mi-nonstop.exp with check-read1
|
||||||
|
- [gdb/testsuite] Fix python.exp with check-read1
|
||||||
|
- [gdb/testsuite, 1/2] Fix gdb.linespec/explicit.exp with check-read1
|
||||||
|
- [gdb/testsuite, 2/2] Fix gdb.linespec/explicit.exp with check-read1
|
||||||
|
- [gdb/testsuite] Test skip_libstdcxx_probe_tests in mi-catch-cpp-exceptions.exp
|
||||||
|
|
||||||
|
diff --git a/gdb/testsuite/gdb.base/maint.exp b/gdb/testsuite/gdb.base/maint.exp
|
||||||
|
index 38e9a1ec4b..810c7c9b8c 100644
|
||||||
|
--- a/gdb/testsuite/gdb.base/maint.exp
|
||||||
|
+++ b/gdb/testsuite/gdb.base/maint.exp
|
||||||
|
@@ -69,15 +69,15 @@ set saw_registers 0
|
||||||
|
set saw_headers 0
|
||||||
|
set test "maint print registers"
|
||||||
|
gdb_test_multiple $test $test {
|
||||||
|
- -re "\[^\r\n\]+Name\[^\r\n\]+Nr\[^\r\n\]+Rel\[^\r\n\]+Offset\[^\r\n\]+Size\[^\r\n\]+Type\[^\r\n\]+\[\r\n\]+" {
|
||||||
|
+ -re "\[^\r\n\]+Name\[^\r\n\]+Nr\[^\r\n\]+Rel\[^\r\n\]+Offset\[^\r\n\]+Size\[^\r\n\]+Type\[^\r\n\]+\r\n" {
|
||||||
|
set saw_headers 1
|
||||||
|
exp_continue
|
||||||
|
}
|
||||||
|
- -re "^\[^\r\n\]+\[0-9\]+\[^\r\n\]+\[0-9\]+\[^\r\n\]+\[0-9\]+\[^\r\n\]+\[0-9\]+\[^\r\n\]+\[\r\n\]+" {
|
||||||
|
+ -re "^\[^\r\n\]+\[0-9\]+\[^\r\n\]+\[0-9\]+\[^\r\n\]+\[0-9\]+\[^\r\n\]+\[0-9\]+\[^\r\n\]+\r\n" {
|
||||||
|
set saw_registers 1
|
||||||
|
exp_continue
|
||||||
|
}
|
||||||
|
- -re "^\\*\[0-9\]+\[^\r\n\]+\[\r\n\]+" {
|
||||||
|
+ -re "^\\*\[0-9\]+\[^\r\n\]+\r\n" {
|
||||||
|
exp_continue
|
||||||
|
}
|
||||||
|
-re "$gdb_prompt $" {
|
||||||
|
diff --git a/gdb/testsuite/gdb.linespec/explicit.exp b/gdb/testsuite/gdb.linespec/explicit.exp
|
||||||
|
index 11656ca5c5..e50e503343 100644
|
||||||
|
--- a/gdb/testsuite/gdb.linespec/explicit.exp
|
||||||
|
+++ b/gdb/testsuite/gdb.linespec/explicit.exp
|
||||||
|
@@ -241,20 +241,7 @@ namespace eval $testfile {
|
||||||
|
-re "break -source exp\\\x07licit" {
|
||||||
|
send_gdb "\t\t"
|
||||||
|
gdb_test_multiple "" $tst {
|
||||||
|
- -re "\\\x07\r\nexplicit.c\[ \t\]+explicit2.c\[ \t\]+\r\n$gdb_prompt" {
|
||||||
|
- send_gdb "\n"
|
||||||
|
- gdb_test "" \
|
||||||
|
- {Source filename requires function, label, or line offset.} \
|
||||||
|
- $tst
|
||||||
|
- }
|
||||||
|
- }
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- -re "break -source exp\\\x07l" {
|
||||||
|
- # This pattern may occur when glibc debuginfo is installed.
|
||||||
|
- send_gdb "\t\t"
|
||||||
|
- gdb_test_multiple "" $tst {
|
||||||
|
- -re "\\\x07\r\nexplicit.c\[ \t\]+explicit2.c\[ \t\]+expl.*\r\n$gdb_prompt" {
|
||||||
|
+ -re "\\\x07\r\nexplicit.c\[ \t\]+explicit2.c\[ \t\]+\(expl.*\)?\r\n$gdb_prompt" {
|
||||||
|
send_gdb "\n"
|
||||||
|
gdb_test "" \
|
||||||
|
{Source filename requires function, label, or line offset.} \
|
||||||
|
@@ -486,7 +473,7 @@ namespace eval $testfile {
|
||||||
|
send_gdb "break \t"
|
||||||
|
gdb_test_multiple "" $tst {
|
||||||
|
"break \\\x07" {
|
||||||
|
- send_gdb "\t\t"
|
||||||
|
+ send_gdb "\t"
|
||||||
|
gdb_test_multiple "" $tst {
|
||||||
|
"Display all" {
|
||||||
|
send_gdb "y"
|
||||||
|
diff --git a/gdb/testsuite/gdb.python/python.exp b/gdb/testsuite/gdb.python/python.exp
|
||||||
|
index b62572ceb8..f5c1d1b261 100644
|
||||||
|
--- a/gdb/testsuite/gdb.python/python.exp
|
||||||
|
+++ b/gdb/testsuite/gdb.python/python.exp
|
||||||
|
@@ -450,7 +450,7 @@ gdb_py_test_multiple "prompt substitution readline" \
|
||||||
|
"end" ""
|
||||||
|
|
||||||
|
gdb_test_multiple "python gdb.prompt_hook = error_prompt" "set the hook" {
|
||||||
|
- -re "Python Exception (exceptions.RuntimeError|<(type 'exceptions.|class ')RuntimeError'>) Python exception called.*" {
|
||||||
|
+ -re "Python Exception (exceptions.RuntimeError|<(type 'exceptions.|class ')RuntimeError'>) Python exception called.*$gdb_prompt $" {
|
||||||
|
pass "set hook"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@@ -462,7 +462,7 @@ gdb_py_test_silent_cmd "set python print-stack full" \
|
||||||
|
"set print-stack full for prompt error test" 1
|
||||||
|
|
||||||
|
gdb_test_multiple "python gdb.prompt_hook = error_prompt" "set the hook" {
|
||||||
|
- -re "Traceback.*File.*line.*RuntimeError.*Python exception called.*" {
|
||||||
|
+ -re "Traceback.*File.*line.*RuntimeError.*Python exception called.*$gdb_prompt $" {
|
||||||
|
pass "set hook"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
diff --git a/gdb/testsuite/lib/completion-support.exp b/gdb/testsuite/lib/completion-support.exp
|
||||||
|
index 3e498d3c63..8a75b0d785 100644
|
||||||
|
--- a/gdb/testsuite/lib/completion-support.exp
|
||||||
|
+++ b/gdb/testsuite/lib/completion-support.exp
|
||||||
|
@@ -144,8 +144,12 @@ proc test_gdb_complete_tab_multiple { input_line add_completed_line \
|
||||||
|
set maybe_bell ""
|
||||||
|
}
|
||||||
|
gdb_test_multiple "" "$test (second tab)" {
|
||||||
|
- -re "^${maybe_bell}\r\n$expected_re\r\n$gdb_prompt $input_line_re$add_completed_line_re$" {
|
||||||
|
- pass "$test"
|
||||||
|
+ -re "^${maybe_bell}\r\n$expected_re\r\n$gdb_prompt " {
|
||||||
|
+ gdb_test_multiple "" "$test (second tab)" {
|
||||||
|
+ -re "^$input_line_re$add_completed_line_re$" {
|
||||||
|
+ pass "$test"
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
|
||||||
|
index 896e0f1b40..2eb00d58b9 100644
|
||||||
|
--- a/gdb/testsuite/lib/gdb.exp
|
||||||
|
+++ b/gdb/testsuite/lib/gdb.exp
|
||||||
|
@@ -695,7 +695,7 @@ proc gdb_internal_error_resync {} {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
-# gdb_test_multiple COMMAND MESSAGE EXPECT_ARGUMENTS
|
||||||
|
+# gdb_test_multiple COMMAND MESSAGE EXPECT_ARGUMENTS PROMPT_REGEXP
|
||||||
|
# Send a command to gdb; test the result.
|
||||||
|
#
|
||||||
|
# COMMAND is the command to execute, send to GDB with send_gdb. If
|
||||||
|
@@ -707,6 +707,8 @@ proc gdb_internal_error_resync {} {
|
||||||
|
# context; action elements will be executed in the caller's context.
|
||||||
|
# Unlike patterns for gdb_test, these patterns should generally include
|
||||||
|
# the final newline and prompt.
|
||||||
|
+# PROMPT_REGEXP is a regexp matching the expected prompt after the command
|
||||||
|
+# output. If empty, defaults to "$gdb_prompt $"
|
||||||
|
#
|
||||||
|
# Returns:
|
||||||
|
# 1 if the test failed, according to a built-in failure pattern
|
||||||
|
@@ -744,7 +746,7 @@ proc gdb_internal_error_resync {} {
|
||||||
|
# expected from $gdb_spawn_id. IOW, callers do not need to worry
|
||||||
|
# about resetting "-i" back to $gdb_spawn_id explicitly.
|
||||||
|
#
|
||||||
|
-proc gdb_test_multiple { command message user_code } {
|
||||||
|
+proc gdb_test_multiple { command message user_code { prompt_regexp "" } } {
|
||||||
|
global verbose use_gdb_stub
|
||||||
|
global gdb_prompt pagination_prompt
|
||||||
|
global GDB
|
||||||
|
@@ -754,6 +756,10 @@ proc gdb_test_multiple { command message user_code } {
|
||||||
|
upvar expect_out expect_out
|
||||||
|
global any_spawn_id
|
||||||
|
|
||||||
|
+ if { "$prompt_regexp" == "" } {
|
||||||
|
+ set prompt_regexp "$gdb_prompt $"
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
if { $message == "" } {
|
||||||
|
set message $command
|
||||||
|
}
|
||||||
|
@@ -913,7 +919,7 @@ proc gdb_test_multiple { command message user_code } {
|
||||||
|
}
|
||||||
|
|
||||||
|
append code {
|
||||||
|
- -re "Ending remote debugging.*$gdb_prompt $" {
|
||||||
|
+ -re "Ending remote debugging.*$prompt_regexp" {
|
||||||
|
if ![isnative] then {
|
||||||
|
warning "Can`t communicate to remote target."
|
||||||
|
}
|
||||||
|
@@ -921,17 +927,17 @@ proc gdb_test_multiple { command message user_code } {
|
||||||
|
gdb_start
|
||||||
|
set result -1
|
||||||
|
}
|
||||||
|
- -re "Undefined\[a-z\]* command:.*$gdb_prompt $" {
|
||||||
|
+ -re "Undefined\[a-z\]* command:.*$prompt_regexp" {
|
||||||
|
perror "Undefined command \"$command\"."
|
||||||
|
fail "$message"
|
||||||
|
set result 1
|
||||||
|
}
|
||||||
|
- -re "Ambiguous command.*$gdb_prompt $" {
|
||||||
|
+ -re "Ambiguous command.*$prompt_regexp" {
|
||||||
|
perror "\"$command\" is not a unique command name."
|
||||||
|
fail "$message"
|
||||||
|
set result 1
|
||||||
|
}
|
||||||
|
- -re "$inferior_exited_re with code \[0-9\]+.*$gdb_prompt $" {
|
||||||
|
+ -re "$inferior_exited_re with code \[0-9\]+.*$prompt_regexp" {
|
||||||
|
if ![string match "" $message] then {
|
||||||
|
set errmsg "$message (the program exited)"
|
||||||
|
} else {
|
||||||
|
@@ -940,7 +946,7 @@ proc gdb_test_multiple { command message user_code } {
|
||||||
|
fail "$errmsg"
|
||||||
|
set result -1
|
||||||
|
}
|
||||||
|
- -re "$inferior_exited_re normally.*$gdb_prompt $" {
|
||||||
|
+ -re "$inferior_exited_re normally.*$prompt_regexp" {
|
||||||
|
if ![string match "" $message] then {
|
||||||
|
set errmsg "$message (the program exited)"
|
||||||
|
} else {
|
||||||
|
@@ -949,7 +955,7 @@ proc gdb_test_multiple { command message user_code } {
|
||||||
|
fail "$errmsg"
|
||||||
|
set result -1
|
||||||
|
}
|
||||||
|
- -re "The program is not being run.*$gdb_prompt $" {
|
||||||
|
+ -re "The program is not being run.*$prompt_regexp" {
|
||||||
|
if ![string match "" $message] then {
|
||||||
|
set errmsg "$message (the program is no longer running)"
|
||||||
|
} else {
|
||||||
|
@@ -958,7 +964,7 @@ proc gdb_test_multiple { command message user_code } {
|
||||||
|
fail "$errmsg"
|
||||||
|
set result -1
|
||||||
|
}
|
||||||
|
- -re "\r\n$gdb_prompt $" {
|
||||||
|
+ -re "\r\n$prompt_regexp" {
|
||||||
|
if ![string match "" $message] then {
|
||||||
|
fail "$message"
|
||||||
|
}
|
||||||
|
@@ -972,13 +978,13 @@ proc gdb_test_multiple { command message user_code } {
|
||||||
|
}
|
||||||
|
-re "\\((y or n|y or \\\[n\\\]|\\\[y\\\] or n)\\) " {
|
||||||
|
send_gdb "n\n"
|
||||||
|
- gdb_expect -re "$gdb_prompt $"
|
||||||
|
+ gdb_expect -re "$prompt_regexp"
|
||||||
|
fail "$message (got interactive prompt)"
|
||||||
|
set result -1
|
||||||
|
}
|
||||||
|
-re "\\\[0\\\] cancel\r\n\\\[1\\\] all.*\r\n> $" {
|
||||||
|
send_gdb "0\n"
|
||||||
|
- gdb_expect -re "$gdb_prompt $"
|
||||||
|
+ gdb_expect -re "$prompt_regexp"
|
||||||
|
fail "$message (got breakpoint menu)"
|
||||||
|
set result -1
|
||||||
|
}
|
||||||
|
@@ -1842,7 +1848,7 @@ proc skip_python_tests_prompt { prompt_regexp } {
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
-re "$prompt_regexp" {}
|
||||||
|
- }
|
||||||
|
+ } "$prompt_regexp"
|
||||||
|
|
||||||
|
set gdb_py_is_py24 0
|
||||||
|
gdb_test_multiple "python print (sys.version_info\[0\])" "check if python 3" {
|
||||||
|
@@ -1852,7 +1858,7 @@ proc skip_python_tests_prompt { prompt_regexp } {
|
||||||
|
-re ".*$prompt_regexp" {
|
||||||
|
set gdb_py_is_py3k 0
|
||||||
|
}
|
||||||
|
- }
|
||||||
|
+ } "$prompt_regexp"
|
||||||
|
if { $gdb_py_is_py3k == 0 } {
|
||||||
|
gdb_test_multiple "python print (sys.version_info\[1\])" "check if python 2.4" {
|
||||||
|
-re "\[45\].*$prompt_regexp" {
|
||||||
|
@@ -1861,7 +1867,7 @@ proc skip_python_tests_prompt { prompt_regexp } {
|
||||||
|
-re ".*$prompt_regexp" {
|
||||||
|
set gdb_py_is_py24 0
|
||||||
|
}
|
||||||
|
- }
|
||||||
|
+ } "$prompt_regexp"
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0
|
||||||
|
@@ -3079,22 +3085,27 @@ proc skip_unwinder_tests {} {
|
||||||
|
|
||||||
|
# Return 0 if we should skip tests that require the libstdc++ stap
|
||||||
|
# probes. This must be invoked while gdb is running, after shared
|
||||||
|
-# libraries have been loaded.
|
||||||
|
-
|
||||||
|
-proc skip_libstdcxx_probe_tests {} {
|
||||||
|
- global gdb_prompt
|
||||||
|
+# libraries have been loaded. PROMPT_REGEXP is the expected prompt.
|
||||||
|
|
||||||
|
+proc skip_libstdcxx_probe_tests_prompt { prompt_regexp } {
|
||||||
|
set ok 0
|
||||||
|
gdb_test_multiple "info probe" "check for stap probe in libstdc++" {
|
||||||
|
- -re ".*libstdcxx.*catch.*\r\n$gdb_prompt $" {
|
||||||
|
+ -re ".*libstdcxx.*catch.*\r\n$prompt_regexp" {
|
||||||
|
set ok 1
|
||||||
|
}
|
||||||
|
- -re "\r\n$gdb_prompt $" {
|
||||||
|
+ -re "\r\n$prompt_regexp" {
|
||||||
|
}
|
||||||
|
- }
|
||||||
|
+ } "$prompt_regexp"
|
||||||
|
return $ok
|
||||||
|
}
|
||||||
|
|
||||||
|
+# As skip_libstdcxx_probe_tests_prompt, with gdb_prompt.
|
||||||
|
+
|
||||||
|
+proc skip_libstdcxx_probe_tests {} {
|
||||||
|
+ global gdb_prompt
|
||||||
|
+ return [skip_libstdcxx_probe_tests_prompt "$gdb_prompt $"]
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
# Return 1 if we should skip tests of the "compile" feature.
|
||||||
|
# This must be invoked after the inferior has been started.
|
||||||
|
|
||||||
|
@@ -3131,7 +3142,7 @@ proc gdb_is_target_1 { target_name target_stack_regexp prompt_regexp } {
|
||||||
|
-re "$prompt_regexp" {
|
||||||
|
pass $test
|
||||||
|
}
|
||||||
|
- }
|
||||||
|
+ } "$prompt_regexp"
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-support.exp
|
||||||
|
index a58c4f6e11..d0ee5ca744 100644
|
||||||
|
--- a/gdb/testsuite/lib/mi-support.exp
|
||||||
|
+++ b/gdb/testsuite/lib/mi-support.exp
|
||||||
|
@@ -2596,6 +2596,13 @@ proc mi_skip_python_tests {} {
|
||||||
|
return [skip_python_tests_prompt "$mi_gdb_prompt$"]
|
||||||
|
}
|
||||||
|
|
||||||
|
+# As skip_libstdcxx_probe_tests_prompt, with mi_gdb_prompt.
|
||||||
|
+
|
||||||
|
+proc mi_skip_libstdcxx_probe_tests {} {
|
||||||
|
+ global mi_gdb_prompt
|
||||||
|
+ return [skip_libstdcxx_probe_tests_prompt "$mi_gdb_prompt$"]
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
# Check whether we're testing with the remote or extended-remote
|
||||||
|
# targets.
|
||||||
|
|
16
gdb.changes
16
gdb.changes
@ -1,3 +1,19 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Tue Aug 6 21:36:49 UTC 2019 - Tom de Vries <tdevries@suse.de>
|
||||||
|
|
||||||
|
- Master backport:
|
||||||
|
* gdb-fix-breakpoints-on-file-reloads-for-pie-binaries.patch
|
||||||
|
- Master backports testsuite:
|
||||||
|
* gdb-testsuite-i386-pkru-exp.patch
|
||||||
|
* gdb-testsuite-read1-fixes.patch
|
||||||
|
* gdb-testsuite-pie-no-pie.patch
|
||||||
|
* gdb-testsuite-add-missing-initial-prompt-read-in-multidictionary.exp.patch
|
||||||
|
- Work around bsc#1115034:
|
||||||
|
* gdb-testsuite-ada-pie.patch
|
||||||
|
- Fixes for fedora patches:
|
||||||
|
* gdb-testsuite-fix-perror-in-gdb.opt-fortran-string.exp.patch
|
||||||
|
* gdb-testsuite-avoid-pagination-in-attach-32.exp.patch
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Thu Jul 25 21:46:56 UTC 2019 - Stefan Brüns <stefan.bruens@rwth-aachen.de>
|
Thu Jul 25 21:46:56 UTC 2019 - Stefan Brüns <stefan.bruens@rwth-aachen.de>
|
||||||
|
|
||||||
|
20
gdb.spec
20
gdb.spec
@ -212,10 +212,16 @@ Patch114: gdb-rhbz795424-bitpos-arrayview.patch
|
|||||||
Patch115: gdb-rhbz1371380-gcore-elf-headers.patch
|
Patch115: gdb-rhbz1371380-gcore-elf-headers.patch
|
||||||
#Fedora Packages end
|
#Fedora Packages end
|
||||||
|
|
||||||
|
#Fedora patches fixup
|
||||||
|
|
||||||
|
Patch500: gdb-testsuite-avoid-pagination-in-attach-32.exp.patch
|
||||||
|
Patch501: gdb-testsuite-fix-perror-in-gdb.opt-fortran-string.exp.patch
|
||||||
|
|
||||||
# openSUSE specific
|
# openSUSE specific
|
||||||
|
|
||||||
Patch1000: gdb-gcore-bash.patch
|
Patch1000: gdb-gcore-bash.patch
|
||||||
Patch1002: gdb-6.6-buildid-locate-rpm-suse.patch
|
Patch1002: gdb-6.6-buildid-locate-rpm-suse.patch
|
||||||
|
Patch1003: gdb-testsuite-ada-pie.patch
|
||||||
|
|
||||||
# Patches to upstream
|
# Patches to upstream
|
||||||
|
|
||||||
@ -233,6 +239,11 @@ Patch2000: gdb-handle-vfork-in-thread-with-follow-fork-mode-child.patch
|
|||||||
Patch2001: gdb-fix-riscv-tdep.patch
|
Patch2001: gdb-fix-riscv-tdep.patch
|
||||||
Patch2002: gdb-x86_64-i386-syscall-restart-master.patch
|
Patch2002: gdb-x86_64-i386-syscall-restart-master.patch
|
||||||
Patch2003: gdb-suppress-sigttou-when-handling-errors.patch
|
Patch2003: gdb-suppress-sigttou-when-handling-errors.patch
|
||||||
|
Patch2004: gdb-testsuite-add-missing-initial-prompt-read-in-multidictionary.exp.patch
|
||||||
|
Patch2005: gdb-testsuite-pie-no-pie.patch
|
||||||
|
Patch2006: gdb-fix-breakpoints-on-file-reloads-for-pie-binaries.patch
|
||||||
|
Patch2007: gdb-testsuite-read1-fixes.patch
|
||||||
|
Patch2008: gdb-testsuite-i386-pkru-exp.patch
|
||||||
|
|
||||||
# Submitted for master
|
# Submitted for master
|
||||||
|
|
||||||
@ -552,8 +563,12 @@ find -name "*.info*"|xargs rm -f
|
|||||||
%patch115 -p1
|
%patch115 -p1
|
||||||
#Fedora patching end
|
#Fedora patching end
|
||||||
|
|
||||||
|
%patch500 -p1
|
||||||
|
%patch501 -p1
|
||||||
|
|
||||||
%patch1000 -p1
|
%patch1000 -p1
|
||||||
%patch1002 -p1
|
%patch1002 -p1
|
||||||
|
%patch1003 -p1
|
||||||
|
|
||||||
%patch1005 -p1
|
%patch1005 -p1
|
||||||
%patch1007 -p1
|
%patch1007 -p1
|
||||||
@ -562,6 +577,11 @@ find -name "*.info*"|xargs rm -f
|
|||||||
%patch2001 -p1
|
%patch2001 -p1
|
||||||
%patch2002 -p1
|
%patch2002 -p1
|
||||||
%patch2003 -p1
|
%patch2003 -p1
|
||||||
|
%patch2004 -p1
|
||||||
|
%patch2005 -p1
|
||||||
|
%patch2006 -p1
|
||||||
|
%patch2007 -p1
|
||||||
|
%patch2008 -p1
|
||||||
|
|
||||||
%patch2500 -p1
|
%patch2500 -p1
|
||||||
%patch2501 -p1
|
%patch2501 -p1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user