Rebase to FSF GDB 7.12.
This commit is contained in:
parent
eed01b8fe7
commit
53edfc5dad
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,3 +1,3 @@
|
||||
/gdb-libstdc++-v3-python-6.1.1-20160817.tar.xz
|
||||
/v1.5.tar.gz
|
||||
/gdb-7.11.90.20161006.tar.xz
|
||||
/gdb-7.12.tar.xz
|
||||
|
101
gdb-6.7-testsuite-stable-results.patch
Normal file
101
gdb-6.7-testsuite-stable-results.patch
Normal file
@ -0,0 +1,101 @@
|
||||
gdb/testsuite/gdb.base/fileio.c:
|
||||
gdb/testsuite/gdb.base/fileio.exp:
|
||||
2007-12-08 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
* gdb.base/fileio.c (ROOTSUBDIR): New macro.
|
||||
(main): CHDIR into ROOTSUBDIR. CHOWN ROOTSUBDIR and CHDIR into
|
||||
ROOTSUBDIR if we are being run as root.
|
||||
* gdb.base/fileio.exp: Change the startup and finish cleanup.
|
||||
Change the test file reference to be into the `fileio.dir' directory.
|
||||
|
||||
|
||||
sources/gdb/testsuite/gdb.base/dump.exp:
|
||||
Found on RHEL-5.s390x.
|
||||
|
||||
|
||||
gdb-6.8.50.20090209/gdb/testsuite/gdb.base/auxv.exp:
|
||||
random FAIL: gdb.base/auxv.exp: matching auxv data from live and gcore
|
||||
|
||||
|
||||
gdb-6.8.50.20090209/gdb/testsuite/gdb.base/annota1.exp:
|
||||
frames-invalid can happen asynchronously.
|
||||
|
||||
Index: gdb-7.12/gdb/testsuite/gdb.base/fileio.c
|
||||
===================================================================
|
||||
--- gdb-7.12.orig/gdb/testsuite/gdb.base/fileio.c 2016-08-01 17:50:21.000000000 +0200
|
||||
+++ gdb-7.12/gdb/testsuite/gdb.base/fileio.c 2016-10-07 22:49:20.689346914 +0200
|
||||
@@ -556,6 +556,28 @@
|
||||
int
|
||||
main ()
|
||||
{
|
||||
+ /* These tests
|
||||
+ Open for write but no write permission returns EACCES
|
||||
+ Unlinking a file in a directory w/o write access returns EACCES
|
||||
+ fail if we are being run as root - drop the privileges here. */
|
||||
+
|
||||
+ if (geteuid () == 0)
|
||||
+ {
|
||||
+ uid_t uid = 99;
|
||||
+
|
||||
+ if (chown (OUTDIR, uid, uid) != 0)
|
||||
+ {
|
||||
+ printf ("chown %d.%d %s: %s\n", (int) uid, (int) uid,
|
||||
+ OUTDIR, strerror (errno));
|
||||
+ exit (1);
|
||||
+ }
|
||||
+ if (setuid (uid) || geteuid () == 0)
|
||||
+ {
|
||||
+ printf ("setuid %d: %s\n", (int) uid, strerror (errno));
|
||||
+ exit (1);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
/* Don't change the order of the calls. They partly depend on each other */
|
||||
test_open ();
|
||||
test_write ();
|
||||
Index: gdb-7.12/gdb/testsuite/gdb.base/fileio.exp
|
||||
===================================================================
|
||||
--- gdb-7.12.orig/gdb/testsuite/gdb.base/fileio.exp 2016-08-01 17:50:21.000000000 +0200
|
||||
+++ gdb-7.12/gdb/testsuite/gdb.base/fileio.exp 2016-10-07 22:54:44.680071906 +0200
|
||||
@@ -24,9 +24,9 @@
|
||||
standard_testfile
|
||||
|
||||
if {[is_remote host]} {
|
||||
- set outdir .
|
||||
+ set outdir "fileio.dir"
|
||||
} else {
|
||||
- set outdir [standard_output_file {}]
|
||||
+ set outdir [standard_output_file "fileio.dir"]
|
||||
}
|
||||
|
||||
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" \
|
||||
@@ -47,7 +47,8 @@
|
||||
if {[file exists $dir2] && ![file writable $dir2]} {
|
||||
system "chmod +w $dir2"
|
||||
}
|
||||
-system "rm -rf [standard_output_file *.fileio.test]"
|
||||
+system "rm -rf [standard_output_file fileio.dir]"
|
||||
+system "mkdir -m777 [standard_output_file fileio.dir]"
|
||||
|
||||
set oldtimeout $timeout
|
||||
set timeout [expr "$timeout + 60"]
|
||||
@@ -89,7 +90,7 @@
|
||||
|
||||
gdb_test "continue" ".*" ""
|
||||
|
||||
-catch "system \"chmod -f -w [standard_output_file nowrt.fileio.test]\""
|
||||
+catch "system \"chmod -f -w [standard_output_file fileio.dir/nowrt.fileio.test]\""
|
||||
|
||||
gdb_test continue \
|
||||
"Continuing\\..*open 5:.*EACCES$stop_msg" \
|
||||
@@ -276,9 +277,7 @@
|
||||
gdb_exit
|
||||
|
||||
# Make dir2 writable again so rm -rf of a build tree Just Works.
|
||||
-if {[file exists $dir2] && ![file writable $dir2]} {
|
||||
- system "chmod +w $dir2"
|
||||
-}
|
||||
+system "chmod -R +w $outdir"
|
||||
|
||||
set timeout $oldtimeout
|
||||
return 0
|
@ -1,68 +0,0 @@
|
||||
http://sourceware.org/ml/gdb-patches/2016-04/msg00181.html
|
||||
Subject: [testsuite patch] Fix 7.11 regression: gdb.dwarf2/dw2-undefined-ret-addr.exp [now with the patch]
|
||||
|
||||
|
||||
--oyUTqETQ0mS9luUI
|
||||
Content-Type: text/plain; charset=us-ascii
|
||||
Content-Disposition: inline
|
||||
|
||||
Hi,
|
||||
|
||||
a038fa3e14a477d4d72a26c2e139fa47d2774be2 is the first bad commit
|
||||
commit a038fa3e14a477d4d72a26c2e139fa47d2774be2
|
||||
Author: Markus Metzger <markus.t.metzger@intel.com>
|
||||
stack: check frame_unwind_caller_id
|
||||
[PATCH v3 2/3] stack: check frame_unwind_caller_id
|
||||
https://sourceware.org/ml/gdb-patches/2016-02/msg00363.html
|
||||
Message-Id: <1455207283-12660-2-git-send-email-markus.t.metzger@intel.com>
|
||||
|
||||
(gdb) PASS: gdb.dwarf2/dw2-undefined-ret-addr.exp: up refuses to go up
|
||||
info frame
|
||||
Stack level 0, frame at 0x0:
|
||||
- rip = 0x40059a in stop_frame (dw2-undefined-ret-addr.c:22); saved rip = <not saved>
|
||||
+ rip = 0x40059a in stop_frame (dw2-undefined-ret-addr.c:22); saved rip = <unavailable>
|
||||
Outermost frame: outermost
|
||||
source language c.
|
||||
Arglist at 0x7fffffffd610, args:
|
||||
Locals at 0x7fffffffd610, Previous frame's sp is 0x7fffffffd620
|
||||
Saved registers:
|
||||
rbp at 0x7fffffffd610
|
||||
-(gdb) PASS: gdb.dwarf2/dw2-undefined-ret-addr.exp: info frame
|
||||
+(gdb) FAIL: gdb.dwarf2/dw2-undefined-ret-addr.exp: info frame
|
||||
|
||||
It happens on normal native Fedora 23 x86_64.
|
||||
|
||||
I am not completely sure about the reasons but it looks to me GDB behavior has
|
||||
just changed.
|
||||
|
||||
OK for check-in?
|
||||
|
||||
|
||||
Thanks,
|
||||
Jan
|
||||
|
||||
--oyUTqETQ0mS9luUI
|
||||
Content-Type: text/plain; charset=us-ascii
|
||||
Content-Disposition: inline; filename=1
|
||||
|
||||
gdb/testsuite/ChangeLog
|
||||
2016-04-08 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
* gdb.dwarf2/dw2-undefined-ret-addr.exp: Expect <unavailable>.
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-undefined-ret-addr.exp b/gdb/testsuite/gdb.dwarf2/dw2-undefined-ret-addr.exp
|
||||
index c666584..e43054b 100644
|
||||
--- a/gdb/testsuite/gdb.dwarf2/dw2-undefined-ret-addr.exp
|
||||
+++ b/gdb/testsuite/gdb.dwarf2/dw2-undefined-ret-addr.exp
|
||||
@@ -48,7 +48,7 @@ gdb_test "up" \
|
||||
# doesn't cause an error, and shows "<not saved>".
|
||||
gdb_test "info frame" [multi_line \
|
||||
"Stack level 0, frame at $hex\:" \
|
||||
- " rip = $hex in stop_frame \\(dw2-undefined-ret-addr\\.c:22\\); saved rip = <not saved>" \
|
||||
+ " rip = $hex in stop_frame \\(dw2-undefined-ret-addr\\.c:22\\); saved rip = <unavailable>" \
|
||||
" Outermost frame: outermost" \
|
||||
" source language c\\." \
|
||||
" Arglist at $hex, args\: " \
|
||||
|
||||
--oyUTqETQ0mS9luUI--
|
||||
|
@ -112,621 +112,3 @@ Date: Wed Oct 5 21:56:46 2016 +0200
|
||||
+ "#0 ($hex in )?func.*\r\n#1 <signal handler called>\r\n#2 ($hex in )?main.*"
|
||||
|
||||
gdb_test "finish" "Run till exit from \#0 func.*<signal handler called>"
|
||||
|
||||
|
||||
commit e027976f02ce8ed4cf0da79238226c03a640f2b3
|
||||
Author: Pedro Alves <palves@redhat.com>
|
||||
Date: Thu Oct 6 12:57:39 2016 +0100
|
||||
|
||||
Fix a few gdb.base/jit-simple.exp problems
|
||||
|
||||
I noticed that we sometimes get this:
|
||||
|
||||
(gdb) print &__jit_debug_descriptor
|
||||
$1 = (struct jit_descriptor *) 0x601040 <__jit_debug_descriptor>
|
||||
(gdb) PASS: gdb.base/jit-simple.exp: blah 1
|
||||
[...]
|
||||
(gdb) run
|
||||
[...]
|
||||
Starting program: build/gdb/testsuite/outputs/gdb.base/jit-simple/jit-simple
|
||||
Unsupported JIT protocol version 4 in descriptor (expected 1)
|
||||
|
||||
Breakpoint 2, main () at src/gdb/testsuite/gdb.base/jit-simple.c:36
|
||||
36 return 0;
|
||||
(gdb) print &__jit_debug_descriptor
|
||||
$2 = (struct jit_descriptor *) 0x601040 <__jit_debug_descriptor>
|
||||
(gdb) PASS: gdb.base/jit-simple.exp: blah 1
|
||||
|
||||
All tests PASSed, but note the "Unsupported JIT protocol version 4"
|
||||
message.
|
||||
|
||||
Also notice that "__jit_debug_descriptor" has the same address before
|
||||
and after the rerun, while the test is built in a way that should make
|
||||
that address change between runs.
|
||||
|
||||
The test doesn't catch any of this because it doesn't compare
|
||||
before/after addresses.
|
||||
|
||||
And then notice the "blah 1" test messages. "blah" is clearly a WIP
|
||||
message, but it should be at least "blah 2" the second time. :-)
|
||||
|
||||
The reason this sometimes happens is that the test recompiles the
|
||||
program and expects gdb to reload it automaticallyt on "run". However,
|
||||
if the original program and the new recompilation happen to be in the
|
||||
same second, then gdb does not realize that the binary needs to be
|
||||
reloaded. (This is an old problem out of scope of this series.) If
|
||||
that happens, then GDB ends up using the wrong symbols for the program
|
||||
that it spawns, reads the JIT descriptor out of the wrong address,
|
||||
finds garbage, and prints that "unsupported version" notice.
|
||||
|
||||
Fix that in the same way gdb.base/reread.exp handles it -- by sleeping
|
||||
one second before recompiling.
|
||||
|
||||
gdb/testsuite/ChangeLog:
|
||||
2016-10-06 Pedro Alves <palves@redhat.com>
|
||||
|
||||
* gdb.base/jit-simple.exp (top level) Delete get_compiler_info
|
||||
call.
|
||||
(jit_run): Delete.
|
||||
(jit_test_reread): Use with_test_prefix. Reload the main binary
|
||||
explicitly. Compare the before/after addresses of the JIT
|
||||
descriptor.
|
||||
|
||||
### a/gdb/testsuite/ChangeLog
|
||||
### b/gdb/testsuite/ChangeLog
|
||||
## -1,3 +1,12 @@
|
||||
+2016-10-06 Pedro Alves <palves@redhat.com>
|
||||
+
|
||||
+ * gdb.base/jit-simple.exp (top level) Delete get_compiler_info
|
||||
+ call.
|
||||
+ (jit_run): Delete.
|
||||
+ (jit_test_reread): Use with_test_prefix. Reload the main binary
|
||||
+ explicitly. Compare the before/after addresses of the JIT
|
||||
+ descriptor.
|
||||
+
|
||||
2016-10-03 Antoine Tremblay <antoine.tremblay@ericsson.com>
|
||||
2016-10-03 Simon Marchi <simon.marchi@ericsson.com>
|
||||
|
||||
--- a/gdb/testsuite/gdb.base/jit-simple.exp
|
||||
+++ b/gdb/testsuite/gdb.base/jit-simple.exp
|
||||
@@ -18,16 +18,6 @@ if {[skip_shlib_tests]} {
|
||||
return -1
|
||||
}
|
||||
|
||||
-if {[get_compiler_info]} {
|
||||
- warning "Could not get compiler info"
|
||||
- untested jit-simple.exp
|
||||
- return 1
|
||||
-}
|
||||
-
|
||||
-#
|
||||
-# test running programs
|
||||
-#
|
||||
-
|
||||
standard_testfile
|
||||
|
||||
if {[build_executable $testfile.exp $testfile $srcfile debug] == -1} {
|
||||
@@ -35,39 +25,43 @@ if {[build_executable $testfile.exp $testfile $srcfile debug] == -1} {
|
||||
return -1
|
||||
}
|
||||
|
||||
-# A helper for jit_test_reread that invokes gdb_run_cmd.
|
||||
-proc jit_run {msg} {
|
||||
- global decimal gdb_prompt
|
||||
-
|
||||
- gdb_run_cmd
|
||||
- gdb_test "" "Inferior .* exited.*" $msg
|
||||
-}
|
||||
-
|
||||
# Test re-running an inferior with a JIT descriptor, where the JIT
|
||||
# descriptor changes address between runs.
|
||||
# http://sourceware.org/bugzilla/show_bug.cgi?id=13431
|
||||
proc jit_test_reread {} {
|
||||
global testfile binfile subdir srcfile srcdir
|
||||
+ global hex
|
||||
|
||||
- clean_restart $testfile
|
||||
+ with_test_prefix "initial run" {
|
||||
+ clean_restart $testfile
|
||||
|
||||
- # jit_run "initial run"
|
||||
- runto_main
|
||||
-
|
||||
- gdb_test "print &__jit_debug_descriptor" "= .*" "blah 1"
|
||||
+ runto_main
|
||||
|
||||
- gdb_rename_execfile $binfile ${binfile}x
|
||||
+ set addr_before [get_hexadecimal_valueof "&__jit_debug_descriptor" 0 \
|
||||
+ "get address of __jit_debug_descriptor"]
|
||||
+ }
|
||||
|
||||
- if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DSPACER}] != "" } {
|
||||
- fail "recompile $srcfile"
|
||||
- } else {
|
||||
- pass "recompile $srcfile"
|
||||
+ with_test_prefix "second run" {
|
||||
+ # Ensure that the new executable is at least one second newer
|
||||
+ # than the old. If the recompilation happens in the same
|
||||
+ # second, gdb might not reload the executable automatically.
|
||||
+ sleep 1
|
||||
|
||||
- # jit_run "second run"
|
||||
+ gdb_rename_execfile $binfile ${binfile}x
|
||||
+ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DSPACER}] != "" } {
|
||||
+ fail "recompile"
|
||||
+ return
|
||||
+ } else {
|
||||
+ pass "recompile"
|
||||
+ }
|
||||
|
||||
runto_main
|
||||
- gdb_test "print &__jit_debug_descriptor" "= .*" "blah 1"
|
||||
+
|
||||
+ set addr_after [get_hexadecimal_valueof "&__jit_debug_descriptor" 0 \
|
||||
+ "get address of __jit_debug_descriptor"]
|
||||
}
|
||||
+
|
||||
+ gdb_assert {$addr_before != $addr_after} "address changed"
|
||||
}
|
||||
|
||||
jit_test_reread
|
||||
|
||||
|
||||
commit f8da6fe399c8dafa98e7dbed36d3562a919768f5
|
||||
Author: Pedro Alves <palves@redhat.com>
|
||||
Date: Thu Oct 6 12:57:40 2016 +0100
|
||||
|
||||
Fix PR11094: JIT breakpoint is not properly recreated on reruns
|
||||
|
||||
Even though this was supposedly in the gdb 7.2 timeframe, the testcase
|
||||
in PR11094 crashes current GDB with a segfault:
|
||||
|
||||
Program received signal SIGSEGV, Segmentation fault.
|
||||
0x00000000005ee894 in event_location_to_string (location=0x0) at
|
||||
src/gdb/location.c:412
|
||||
412 if (EL_STRING (location) == NULL)
|
||||
(top-gdb) bt
|
||||
#0 0x00000000005ee894 in event_location_to_string (location=0x0) at
|
||||
src/gdb/location.c:412
|
||||
#1 0x000000000057411a in print_breakpoint_location (b=0x18288e0, loc=0x0) at
|
||||
src/gdb/breakpoint.c:6201
|
||||
#2 0x000000000057483f in print_one_breakpoint_location (b=0x18288e0,
|
||||
loc=0x182cf10, loc_number=0, last_loc=0x7fffffffd258, allflag=1)
|
||||
at src/gdb/breakpoint.c:6473
|
||||
#3 0x00000000005751e1 in print_one_breakpoint (b=0x18288e0,
|
||||
last_loc=0x7fffffffd258, allflag=1) at
|
||||
src/gdb/breakpoint.c:6707
|
||||
#4 0x000000000057589c in breakpoint_1 (args=0x0, allflag=1, filter=0x0) at
|
||||
src/gdb/breakpoint.c:6947
|
||||
#5 0x0000000000575aa8 in maintenance_info_breakpoints (args=0x0, from_tty=0)
|
||||
at src/gdb/breakpoint.c:7026
|
||||
[...]
|
||||
|
||||
This is GDB trying to print the location spec of the JIT event
|
||||
breakpoint, but that's an internal breakpoint without one.
|
||||
|
||||
If I add a NULL check, then we see that the JIT breakpoint is now
|
||||
pending (because its location has shlib_disabled set):
|
||||
|
||||
(gdb) maint info breakpoints
|
||||
Num Type Disp Enb Address What
|
||||
[...]
|
||||
-8 jit events keep y <PENDING> inf 1
|
||||
[...]
|
||||
|
||||
But that's incorrect. GDB should have managed to recreate the JIT
|
||||
breakpoint's location for the second run. So the problem is
|
||||
elsewhere.
|
||||
|
||||
The problem is that if the JIT loads at the same address on the second
|
||||
run, we never recreate the JIT breakpoint, because we hit this early
|
||||
return:
|
||||
|
||||
static int
|
||||
jit_breakpoint_re_set_internal (struct gdbarch *gdbarch,
|
||||
struct jit_program_space_data *ps_data)
|
||||
{
|
||||
[...]
|
||||
if (ps_data->cached_code_address == addr)
|
||||
return 0;
|
||||
|
||||
[...]
|
||||
delete_breakpoint (ps_data->jit_breakpoint);
|
||||
[...]
|
||||
ps_data->jit_breakpoint = create_jit_event_breakpoint (gdbarch, addr);
|
||||
|
||||
Fix this by deleting the breakpoint and discarding the cached code
|
||||
address when the objfile where the previous JIT breakpoint was found
|
||||
is deleted/unloaded in the first place.
|
||||
|
||||
The test that was originally added for PR11094 doesn't trip on this
|
||||
because:
|
||||
|
||||
#1 - It doesn't test the case of the JIT descriptor's address _not_
|
||||
changing between reruns.
|
||||
|
||||
#2 - And then it doesn't do "maint info breakpoints", or really
|
||||
anything with the JIT at all.
|
||||
|
||||
#3 - and even then, to trigger the problem the JIT descriptor needs
|
||||
to be in a separate library, while the current test puts it in
|
||||
the main program.
|
||||
|
||||
The patch extends the test to cover all combinations of these
|
||||
scenarios.
|
||||
|
||||
gdb/ChangeLog:
|
||||
2016-10-06 Pedro Alves <palves@redhat.com>
|
||||
|
||||
* jit.c (free_objfile_data): Delete the JIT breakpoint and clear
|
||||
the cached code address.
|
||||
|
||||
gdb/testsuite/ChangeLog:
|
||||
2016-10-06 Pedro Alves <palves@redhat.com>
|
||||
|
||||
* gdb.base/jit-simple-dl.c: New file.
|
||||
* gdb.base/jit-simple-jit.c: New file, factored out from ...
|
||||
* gdb.base/jit-simple.c: ... this.
|
||||
* gdb.base/jit-simple.exp (jit_run): Delete.
|
||||
(build_jit): New proc.
|
||||
(jit_test_reread): Recompile either the main program or the shared
|
||||
library, depending on what is being tested. Skip changing address
|
||||
if caller wants to. Compare before/after addresses. If testing
|
||||
standalone, explicitly load the binary. Test "maint info
|
||||
breakpoints".
|
||||
(top level): Add "standalone vs shared lib" and "change address"
|
||||
vs "same address" axes.
|
||||
|
||||
### a/gdb/ChangeLog
|
||||
### b/gdb/ChangeLog
|
||||
## -1,3 +1,8 @@
|
||||
+2016-10-06 Pedro Alves <palves@redhat.com>
|
||||
+
|
||||
+ * jit.c (free_objfile_data): Delete the JIT breakpoint and clear
|
||||
+ the cached code address.
|
||||
+
|
||||
2016-10-03 Simon Marchi <simark@simark.ca>
|
||||
|
||||
* infrun.c (restore_current_uiout_cleanup): Move to ui-out.c.
|
||||
--- a/gdb/jit.c
|
||||
+++ b/gdb/jit.c
|
||||
@@ -1482,7 +1482,11 @@ free_objfile_data (struct objfile *objfile, void *data)
|
||||
= ((struct jit_program_space_data *)
|
||||
program_space_data (objfile->pspace, jit_program_space_data));
|
||||
if (ps_data != NULL && ps_data->objfile == objfile)
|
||||
- ps_data->objfile = NULL;
|
||||
+ {
|
||||
+ ps_data->objfile = NULL;
|
||||
+ delete_breakpoint (ps_data->jit_breakpoint);
|
||||
+ ps_data->cached_code_address = 0;
|
||||
+ }
|
||||
}
|
||||
|
||||
xfree (data);
|
||||
### a/gdb/testsuite/ChangeLog
|
||||
### b/gdb/testsuite/ChangeLog
|
||||
## -1,5 +1,20 @@
|
||||
2016-10-06 Pedro Alves <palves@redhat.com>
|
||||
|
||||
+ * gdb.base/jit-simple-dl.c: New file.
|
||||
+ * gdb.base/jit-simple-jit.c: New file, factored out from ...
|
||||
+ * gdb.base/jit-simple.c: ... this.
|
||||
+ * gdb.base/jit-simple.exp (jit_run): Delete.
|
||||
+ (build_jit): New proc.
|
||||
+ (jit_test_reread): Recompile either the main program or the shared
|
||||
+ library, depending on what is being tested. Skip changing address
|
||||
+ if caller wants to. Compare before/after addresses. If testing
|
||||
+ standalone, explicitly load the binary. Test "maint info
|
||||
+ breakpoints".
|
||||
+ (top level): Add "standalone vs shared lib" and "change address"
|
||||
+ vs "same address" axes.
|
||||
+
|
||||
+2016-10-06 Pedro Alves <palves@redhat.com>
|
||||
+
|
||||
* gdb.base/jit-simple.exp (top level) Delete get_compiler_info
|
||||
call.
|
||||
(jit_run): Delete.
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.base/jit-simple-dl.c
|
||||
@@ -0,0 +1,25 @@
|
||||
+/* This testcase is part of GDB, the GNU debugger.
|
||||
+
|
||||
+ Copyright 2016 Free Software Foundation, Inc.
|
||||
+
|
||||
+ This program is free software; you can redistribute it and/or modify
|
||||
+ it under the terms of the GNU General Public License as published by
|
||||
+ the Free Software Foundation; either version 3 of the License, or
|
||||
+ (at your option) any later version.
|
||||
+
|
||||
+ This program is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ GNU General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU General Public License
|
||||
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
+
|
||||
+/* A stub program that links with a simple library that uses the JIT
|
||||
+ API. */
|
||||
+
|
||||
+int
|
||||
+main (void)
|
||||
+{
|
||||
+ return 0;
|
||||
+}
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.base/jit-simple-jit.c
|
||||
@@ -0,0 +1,50 @@
|
||||
+/* This testcase is part of GDB, the GNU debugger.
|
||||
+
|
||||
+ Copyright 2012-2016 Free Software Foundation, Inc.
|
||||
+
|
||||
+ This program is free software; you can redistribute it and/or modify
|
||||
+ it under the terms of the GNU General Public License as published by
|
||||
+ the Free Software Foundation; either version 3 of the License, or
|
||||
+ (at your option) any later version.
|
||||
+
|
||||
+ This program is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ GNU General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU General Public License
|
||||
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
+
|
||||
+/* Simple library using the JIT API. */
|
||||
+
|
||||
+#include <stdint.h>
|
||||
+
|
||||
+struct jit_code_entry
|
||||
+{
|
||||
+ struct jit_code_entry *next_entry;
|
||||
+ struct jit_code_entry *prev_entry;
|
||||
+ const char *symfile_addr;
|
||||
+ uint64_t symfile_size;
|
||||
+};
|
||||
+
|
||||
+struct jit_descriptor
|
||||
+{
|
||||
+ uint32_t version;
|
||||
+ /* This type should be jit_actions_t, but we use uint32_t
|
||||
+ to be explicit about the bitwidth. */
|
||||
+ uint32_t action_flag;
|
||||
+ struct jit_code_entry *relevant_entry;
|
||||
+ struct jit_code_entry *first_entry;
|
||||
+};
|
||||
+
|
||||
+#ifdef SPACER
|
||||
+/* This exists to change the address of __jit_debug_descriptor. */
|
||||
+int spacer = 4;
|
||||
+#endif
|
||||
+
|
||||
+struct jit_descriptor __jit_debug_descriptor = { 1, 0, 0, 0 };
|
||||
+
|
||||
+void
|
||||
+__jit_debug_register_code (void)
|
||||
+{
|
||||
+}
|
||||
--- a/gdb/testsuite/gdb.base/jit-simple.c
|
||||
+++ b/gdb/testsuite/gdb.base/jit-simple.c
|
||||
@@ -1,37 +1,26 @@
|
||||
-/* Simple program using the JIT API. */
|
||||
+/* This testcase is part of GDB, the GNU debugger.
|
||||
|
||||
-#include <stdint.h>
|
||||
+ Copyright 2016 Free Software Foundation, Inc.
|
||||
|
||||
-struct jit_code_entry
|
||||
-{
|
||||
- struct jit_code_entry *next_entry;
|
||||
- struct jit_code_entry *prev_entry;
|
||||
- const char *symfile_addr;
|
||||
- uint64_t symfile_size;
|
||||
-};
|
||||
+ 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.
|
||||
|
||||
-struct jit_descriptor
|
||||
-{
|
||||
- uint32_t version;
|
||||
- /* This type should be jit_actions_t, but we use uint32_t
|
||||
- to be explicit about the bitwidth. */
|
||||
- uint32_t action_flag;
|
||||
- struct jit_code_entry *relevant_entry;
|
||||
- struct jit_code_entry *first_entry;
|
||||
-};
|
||||
+ 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.
|
||||
|
||||
-#ifdef SPACER
|
||||
-/* This exists to change the address of __jit_debug_descriptor. */
|
||||
-int spacer = 4;
|
||||
-#endif
|
||||
+ You should have received a copy of the GNU General Public License
|
||||
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
-struct jit_descriptor __jit_debug_descriptor = { 1, 0, 0, 0 };
|
||||
+/* Simple standalone program using the JIT API. */
|
||||
|
||||
-void __jit_debug_register_code()
|
||||
-{
|
||||
-}
|
||||
+#include "jit-simple-jit.c"
|
||||
|
||||
-int main()
|
||||
+int
|
||||
+main (void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
--- a/gdb/testsuite/gdb.base/jit-simple.exp
|
||||
+++ b/gdb/testsuite/gdb.base/jit-simple.exp
|
||||
@@ -13,6 +13,17 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
+# Test re-running an inferior with a JIT descriptor, where the JIT
|
||||
+# descriptor changes address between runs.
|
||||
+# http://sourceware.org/bugzilla/show_bug.cgi?id=13431
|
||||
+
|
||||
+# Test both the case of the JIT reader being included in the main
|
||||
+# program directly, and the case of the JIT reader being split out to
|
||||
+# a shared library.
|
||||
+
|
||||
+# For completeness, also test when the JIT descriptor does not change
|
||||
+# address between runs.
|
||||
+
|
||||
if {[skip_shlib_tests]} {
|
||||
untested jit-simple.exp
|
||||
return -1
|
||||
@@ -20,25 +31,81 @@ if {[skip_shlib_tests]} {
|
||||
|
||||
standard_testfile
|
||||
|
||||
-if {[build_executable $testfile.exp $testfile $srcfile debug] == -1} {
|
||||
+set libname $testfile-jit
|
||||
+set srcfile_lib $srcdir/$subdir/$libname.c
|
||||
+set binfile_lib [standard_output_file $libname.so]
|
||||
+
|
||||
+# Build a standalone JIT binary.
|
||||
+
|
||||
+proc build_standalone_jit {{options ""}} {
|
||||
+ global testfile srcfile binfile
|
||||
+
|
||||
+ lappend options "debug"
|
||||
+
|
||||
+ if {[build_executable $testfile.exp $testfile $srcfile $options] == -1} {
|
||||
+ return -1
|
||||
+ }
|
||||
+
|
||||
+ return 0
|
||||
+}
|
||||
+
|
||||
+# Build the shared library JIT.
|
||||
+
|
||||
+proc build_shared_jit {{options ""}} {
|
||||
+ global testfile
|
||||
+ global srcfile_lib binfile_lib
|
||||
+
|
||||
+ lappend options "debug additional_flags=-fPIC"
|
||||
+ if { [gdb_compile_shlib $srcfile_lib $binfile_lib $options] != "" } {
|
||||
+ return -1
|
||||
+ }
|
||||
+
|
||||
+ return 0
|
||||
+}
|
||||
+
|
||||
+if {[build_standalone_jit] == -1} {
|
||||
+ untested "could not compile $binfile"
|
||||
+ return
|
||||
+}
|
||||
+
|
||||
+if {[build_shared_jit] == -1} {
|
||||
+ untested "could not compile $binfile_lib"
|
||||
+ return
|
||||
+}
|
||||
+
|
||||
+# Built the program that loads the JIT library.
|
||||
+set srcfile_dl $testfile-dl.c
|
||||
+set binfile_dl $binfile-dl
|
||||
+set options [list debug shlib=${binfile_lib}]
|
||||
+if {[gdb_compile ${srcdir}/${subdir}/${srcfile_dl} $binfile_dl executable \
|
||||
+ [list debug shlib=$binfile_lib]] == -1 } {
|
||||
untested jit-simple.exp
|
||||
return -1
|
||||
}
|
||||
|
||||
-# Test re-running an inferior with a JIT descriptor, where the JIT
|
||||
-# descriptor changes address between runs.
|
||||
-# http://sourceware.org/bugzilla/show_bug.cgi?id=13431
|
||||
-proc jit_test_reread {} {
|
||||
- global testfile binfile subdir srcfile srcdir
|
||||
+# STANDALONE is true when the JIT reader is included directly in the
|
||||
+# main program. False when the JIT reader is in a separate shared
|
||||
+# library. If CHANGE_ADDR is true, force changing the JIT descriptor
|
||||
+# changes address between runs.
|
||||
+proc jit_test_reread {standalone change_addr} {
|
||||
+ global testfile binfile subdir srcfile srcdir binfile_lib binfile_dl
|
||||
global hex
|
||||
|
||||
with_test_prefix "initial run" {
|
||||
- clean_restart $testfile
|
||||
+ if {$standalone} {
|
||||
+ clean_restart $binfile
|
||||
+ } else {
|
||||
+ clean_restart $binfile_dl
|
||||
+ }
|
||||
|
||||
runto_main
|
||||
|
||||
set addr_before [get_hexadecimal_valueof "&__jit_debug_descriptor" 0 \
|
||||
"get address of __jit_debug_descriptor"]
|
||||
+
|
||||
+ gdb_test "maint info breakpoints" \
|
||||
+ "jit events keep y $hex <__jit_debug_register_code>.*" \
|
||||
+ "maint info breakpoints shows jit breakpoint"
|
||||
}
|
||||
|
||||
with_test_prefix "second run" {
|
||||
@@ -47,21 +114,49 @@ proc jit_test_reread {} {
|
||||
# second, gdb might not reload the executable automatically.
|
||||
sleep 1
|
||||
|
||||
- gdb_rename_execfile $binfile ${binfile}x
|
||||
- if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DSPACER}] != "" } {
|
||||
- fail "recompile"
|
||||
- return
|
||||
- } else {
|
||||
- pass "recompile"
|
||||
+ if ${change_addr} {
|
||||
+ set options "additional_flags=-DSPACER"
|
||||
+ if {$standalone} {
|
||||
+ gdb_rename_execfile $binfile ${binfile}x
|
||||
+ set res [build_standalone_jit $options]
|
||||
+ } else {
|
||||
+ gdb_rename_execfile $binfile_lib ${binfile_lib}x
|
||||
+ set res [build_shared_jit $options]
|
||||
+ }
|
||||
+ if { $res == -1 } {
|
||||
+ fail "recompile"
|
||||
+ return
|
||||
+ } else {
|
||||
+ pass "recompile"
|
||||
+ }
|
||||
}
|
||||
|
||||
runto_main
|
||||
|
||||
set addr_after [get_hexadecimal_valueof "&__jit_debug_descriptor" 0 \
|
||||
"get address of __jit_debug_descriptor"]
|
||||
+
|
||||
+ # This used to crash in the JIT-in-shared-library case:
|
||||
+ # https://sourceware.org/bugzilla/show_bug.cgi?id=11094
|
||||
+ gdb_test "maint info breakpoints" \
|
||||
+ "jit events keep y $hex <__jit_debug_register_code>.*" \
|
||||
+ "maint info breakpoints shows jit breakpoint"
|
||||
}
|
||||
|
||||
- gdb_assert {$addr_before != $addr_after} "address changed"
|
||||
+ if ${change_addr} {
|
||||
+ gdb_assert {$addr_before != $addr_after} "address changed"
|
||||
+ } else {
|
||||
+ gdb_assert {$addr_before == $addr_after} "address didn't change"
|
||||
+ }
|
||||
}
|
||||
|
||||
-jit_test_reread
|
||||
+foreach standalone {1 0} {
|
||||
+ with_test_prefix [expr ($standalone)?"standalone":"shared"] {
|
||||
+ with_test_prefix "change addr" {
|
||||
+ jit_test_reread $standalone 1
|
||||
+ }
|
||||
+ with_test_prefix "same addr" {
|
||||
+ jit_test_reread $standalone 0
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
|
39
gdb.spec
39
gdb.spec
@ -21,13 +21,12 @@ Name: %{?scl_prefix}gdb
|
||||
%global snapsrc 20160801
|
||||
# See timestamp of source gnulib installed into gdb/gnulib/ .
|
||||
%global snapgnulib 20150822
|
||||
%global tardate 20161006
|
||||
%global tarname gdb-7.11.90.%{tardate}
|
||||
%global tarname gdb-%{version}
|
||||
Version: 7.12
|
||||
|
||||
# The release always contains a leading reserved number, start it at 1.
|
||||
# `upstream' is not a part of `name' to stay fully rpm dependencies compatible for the testing.
|
||||
Release: 0.20.%{tardate}%{?dist}
|
||||
Release: 21%{?dist}
|
||||
|
||||
License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ and GPLv2+ with exceptions and GPL+ and LGPLv2+ and BSD and Public Domain and GFDL
|
||||
Group: Development/Debuggers
|
||||
@ -85,7 +84,11 @@ Provides: bundled(binutils) = %{snapsrc}
|
||||
Provides: bundled(md5-gcc) = %{snapsrc}
|
||||
|
||||
# https://fedoraproject.org/wiki/Packaging:Guidelines#BuildRequires_and_.25.7B_isa.7D
|
||||
%global buildisa %{?_with_buildisa:%{?_isa}}
|
||||
%if 0%{?_with_buildisa:1} || 0%{?_with_testsuite:1}
|
||||
%global buildisa %{?_isa}
|
||||
%else
|
||||
%global buildisa
|
||||
%endif
|
||||
|
||||
%if 0%{!?rhel:1} || 0%{?rhel} > 7
|
||||
Recommends: dnf-command(debuginfo-install)
|
||||
@ -323,6 +326,10 @@ Patch282: gdb-6.7-charsign-test.patch
|
||||
#=fedoratest+ppc
|
||||
Patch284: gdb-6.7-ppc-clobbered-registers-O2-test.patch
|
||||
|
||||
# Testsuite fixes for more stable/comparable results.
|
||||
#=fedoratest
|
||||
Patch287: gdb-6.7-testsuite-stable-results.patch
|
||||
|
||||
# Test ia64 memory leaks of the code using libunwind.
|
||||
#=fedoratest
|
||||
Patch289: gdb-6.5-ia64-libunwind-leak-test.patch
|
||||
@ -582,9 +589,6 @@ Patch1113: gdb-rhbz1261564-aarch64-hw-watchpoint-test.patch
|
||||
# Add messages suggesting more recent RHEL gdbserver (RH BZ 1321114).
|
||||
Patch1118: gdb-container-rh-pkg.patch
|
||||
|
||||
# [testsuite] Fix 7.11 regression: gdb.dwarf2/dw2-undefined-ret-addr.exp
|
||||
Patch1120: gdb-testsuite-dw2-undefined-ret-addr.patch
|
||||
|
||||
# New test for Python "Cannot locate object file for block" (for RH BZ 1325795).
|
||||
Patch1123: gdb-rhbz1325795-framefilters-test.patch
|
||||
|
||||
@ -704,10 +708,18 @@ BuildRequires: fpc
|
||||
%endif
|
||||
%endif
|
||||
# Copied from: gcc-6.2.1-1.fc26
|
||||
# Exception for RHEL<=7
|
||||
%ifarch s390x
|
||||
%if 0%{!?rhel:1} || 0%{?rhel} > 7
|
||||
BuildRequires: gcc-gnat
|
||||
BuildRequires: libgnat%{bits_local} libgnat%{bits_other}
|
||||
%endif
|
||||
%else
|
||||
%ifarch %{ix86} x86_64 ia64 ppc %{power64} alpha s390x %{arm} aarch64
|
||||
BuildRequires: gcc-gnat
|
||||
BuildRequires: libgnat%{bits_local} libgnat%{bits_other}
|
||||
%endif
|
||||
%endif
|
||||
BuildRequires: glibc-devel%{bits_local} glibc-devel%{bits_other}
|
||||
BuildRequires: libgcc%{bits_local} libgcc%{bits_other}
|
||||
BuildRequires: libgfortran%{bits_local} libgfortran%{bits_other}
|
||||
@ -726,7 +738,15 @@ BuildRequires: libgo-devel%{bits_local} libgo-devel%{bits_other}
|
||||
BuildRequires: glibc-static%{bits_local}
|
||||
# multilib glibc-static is open Bug 488472:
|
||||
#BuildRequires: glibc-static%{bits_other}
|
||||
# Exception for RHEL<=7
|
||||
%ifarch s390x
|
||||
BuildRequires: valgrind%{bits_local}
|
||||
%if 0%{!?rhel:1} || 0%{?rhel} > 7
|
||||
BuildRequires: valgrind%{bits_local} valgrind%{bits_other}
|
||||
%endif
|
||||
%else
|
||||
BuildRequires: valgrind%{bits_local} valgrind%{bits_other}
|
||||
%endif
|
||||
%if 0%{!?rhel:1} || 0%{?rhel} > 6
|
||||
BuildRequires: xz
|
||||
%endif
|
||||
@ -846,6 +866,7 @@ find -name "*.info*"|xargs rm -f
|
||||
%patch353 -p1
|
||||
%patch282 -p1
|
||||
%patch284 -p1
|
||||
%patch287 -p1
|
||||
%patch289 -p1
|
||||
%patch290 -p1
|
||||
%patch294 -p1
|
||||
@ -927,7 +948,6 @@ done
|
||||
%patch331 -p1
|
||||
%patch1113 -p1
|
||||
%patch1118 -p1
|
||||
%patch1120 -p1
|
||||
%patch1123 -p1
|
||||
%patch1143 -p1
|
||||
%patch1144 -p1
|
||||
@ -1490,6 +1510,9 @@ then
|
||||
fi
|
||||
|
||||
%changelog
|
||||
* Fri Oct 7 2016 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.12-21.fc25
|
||||
- Rebase to FSF GDB 7.12.
|
||||
|
||||
* Thu Oct 6 2016 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.12-0.20.20161006.fc25
|
||||
- Rebase to FSF GDB 7.11.90.20161006 (pre-7.12 branch snapshot).
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user