Fix regression#2 of the optimized-out entry data values fix (of BZ 1111910).
- Rebase to FSF GDB 7.7.90.20140711 (pre-7.8 snapshot). - [testsuite] Disable --with testsuite PIE testing, it has too many false FAILs.
This commit is contained in:
parent
4f54fc4526
commit
33d54d9950
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,2 +1,2 @@
|
||||
/gdb-libstdc++-v3-python-r155978.tar.bz2
|
||||
/gdb-7.7.90.20140627.tar.bz2
|
||||
/gdb-7.7.90.20140711.tar.bz2
|
||||
|
@ -1,48 +1,74 @@
|
||||
http://sourceware.org/ml/gdb-patches/2014-07/msg00158.html
|
||||
Subject: [patchv2] Fix crash on optimized-out entry data values
|
||||
http://sourceware.org/ml/gdb-patches/2014-07/msg00277.html
|
||||
Subject: [patchv3] Fix crash on optimized-out entry data values
|
||||
|
||||
|
||||
--UlVJffcvxoiEqYs2
|
||||
--Dxnq1zWXvFF0Q93v
|
||||
Content-Type: text/plain; charset=us-ascii
|
||||
Content-Disposition: inline
|
||||
|
||||
Hi,
|
||||
On Wed, 09 Jul 2014 17:31:21 +0200, Jan Kratochvil wrote:
|
||||
> On Wed, 09 Jul 2014 13:52:00 +0200, Pedro Alves wrote:
|
||||
> > On 07/09/2014 11:33 AM, Jan Kratochvil wrote:
|
||||
> > > --- a/gdb/value.c
|
||||
> > > +++ b/gdb/value.c
|
||||
> > > @@ -198,12 +198,13 @@ struct value
|
||||
> > > unsigned int lazy : 1;
|
||||
> > >
|
||||
> > > /* If nonzero, this is the value of a variable that does not
|
||||
> > > - actually exist in the program. If nonzero, and LVAL is
|
||||
> > > + actually fully exist in the program. If nonzero, and LVAL is
|
||||
> > > lval_register, this is a register ($pc, $sp, etc., never a
|
||||
> > > program variable) that has not been saved in the frame. All
|
||||
> > > optimized-out values are treated pretty much the same, except
|
||||
> > > registers have a different string representation and related
|
||||
> > > - error strings. */
|
||||
> > > + error strings. It is true also for only partially optimized
|
||||
> > > + out variables - see the 'unavailable' field below. */
|
||||
> > > unsigned int optimized_out : 1;
|
||||
> > >
|
||||
> > > /* If value is a variable, is it initialized or not. */
|
||||
> > > @@ -334,7 +335,10 @@ struct value
|
||||
> > > valid if lazy is nonzero. */
|
||||
> > > gdb_byte *contents;
|
||||
> > >
|
||||
> > > - /* Unavailable ranges in CONTENTS. We mark unavailable ranges,
|
||||
> > > + /* If OPTIMIZED_OUT is false then UNAVAILABLE must be VEC_empty
|
||||
> > > + (not necessarily NULL).
|
||||
> >
|
||||
> > Hmm, why? We can collect only part of a non-optimized out value.
|
||||
> > What am I missing?
|
||||
>
|
||||
> I miss some documentation how these availability fields interact together.
|
||||
|
||||
former post of this fix was for:
|
||||
[patch+7.8] Fix crash on optimized-out entry data values
|
||||
https://sourceware.org/ml/gdb-patches/2014-06/msg00797.html
|
||||
=
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1111910
|
||||
this can happen for real world -O2 -g executables:
|
||||
#9 0x0000003b6e0998b2 in wxEntry (argc=@0x7fffffffd86c: 1,
|
||||
argc@entry=@0x7fffffffd86c: <optimized out>,
|
||||
^^^^^^^^^^^^^^^
|
||||
argv=<optimized out>) at src/common/init.cpp:460
|
||||
GDB did crash in such case.
|
||||
>From a comment in mail
|
||||
Message-Id: <201102071427.55970.pedro@codesourcery.com>
|
||||
We give preference to printing <optimized out> rather
|
||||
than <unavailable>, since if a value had been optimized out
|
||||
at compile time, it can never be collected at run-time.
|
||||
|
||||
But the fix was wrong/regressing as shown here:
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1117192
|
||||
https://bugzilla.redhat.com/attachment.cgi?id=916298 (at the bottom)
|
||||
|
||||
Here is a new fix, also with a new testcase reproducing crash of the wrong fix
|
||||
above.
|
||||
|
||||
No regressions on {x86_64,x86_64-m32,i686}-fedorarawhide-linux-gnu.
|
||||
it seems it is just reversed, that 'unavailable' can exist only for
|
||||
!optimized_out and it cannot exist for for optimized_out values.
|
||||
|
||||
|
||||
> You are right, this patch regresses during gdbserver mode.
|
||||
|
||||
It PASSes now even in gdbserver mode.
|
||||
|
||||
|
||||
Thanks,
|
||||
Jan
|
||||
|
||||
--UlVJffcvxoiEqYs2
|
||||
--Dxnq1zWXvFF0Q93v
|
||||
Content-Type: text/plain; charset=us-ascii
|
||||
Content-Disposition: inline; filename="optimfix2.patch"
|
||||
Content-Disposition: inline; filename="optimfix3.patch"
|
||||
|
||||
gdb/
|
||||
2014-07-09 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
* value.c (struct value): Extend the comment for fields optimized_out
|
||||
and unavailable.
|
||||
(value_available_contents_bits_eq): Handle OPTIMIZED_OUT values with
|
||||
empty UNAVAILABLE as special cases.
|
||||
(value_available_contents_bits_eq): Handle OPTIMIZED_OUT values as
|
||||
special cases.
|
||||
|
||||
gdb/testsuite/
|
||||
2014-07-09 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
@ -55,48 +81,46 @@ gdb/testsuite/
|
||||
* gdb.arch/amd64-optimout-repeat.exp: New file.
|
||||
|
||||
diff --git a/gdb/value.c b/gdb/value.c
|
||||
index 557056f..4b7495e 100644
|
||||
index 557056f..c017c75 100644
|
||||
--- a/gdb/value.c
|
||||
+++ b/gdb/value.c
|
||||
@@ -198,12 +198,13 @@ struct value
|
||||
@@ -198,12 +198,14 @@ struct value
|
||||
unsigned int lazy : 1;
|
||||
|
||||
/* If nonzero, this is the value of a variable that does not
|
||||
- actually exist in the program. If nonzero, and LVAL is
|
||||
+ actually fully exist in the program. If nonzero, and LVAL is
|
||||
+ actually exist in the program at all. If nonzero, and LVAL is
|
||||
lval_register, this is a register ($pc, $sp, etc., never a
|
||||
program variable) that has not been saved in the frame. All
|
||||
optimized-out values are treated pretty much the same, except
|
||||
registers have a different string representation and related
|
||||
- error strings. */
|
||||
+ error strings. It is true also for only partially optimized
|
||||
+ out variables - see the 'unavailable' field below. */
|
||||
+ error strings. When it is zero it still maybe only partially
|
||||
+ available (equally partially optimized out) - see the
|
||||
+ 'unavailable' field below. */
|
||||
unsigned int optimized_out : 1;
|
||||
|
||||
/* If value is a variable, is it initialized or not. */
|
||||
@@ -334,7 +335,10 @@ struct value
|
||||
@@ -334,7 +336,9 @@ struct value
|
||||
valid if lazy is nonzero. */
|
||||
gdb_byte *contents;
|
||||
|
||||
- /* Unavailable ranges in CONTENTS. We mark unavailable ranges,
|
||||
+ /* If OPTIMIZED_OUT is false then UNAVAILABLE must be VEC_empty
|
||||
+ (not necessarily NULL). If OPTIMIZED_OUT is true then VEC_empty
|
||||
+ UNAVAILABLE means the whole value range. Otherwise it specifies
|
||||
+ /* If OPTIMIZED_OUT is nonzero then UNAVAILABLE must be VEC_empty
|
||||
+ (not necessarily NULL). Otherwise it specifies
|
||||
+ unavailable ranges in CONTENTS. We mark unavailable ranges,
|
||||
rather than available, since the common and default case is for a
|
||||
value to be available. This is filled in at value read time. The
|
||||
unavailable ranges are tracked in bits. */
|
||||
@@ -701,6 +705,15 @@ value_available_contents_bits_eq (const struct value *val1, int offset1,
|
||||
@@ -701,6 +705,13 @@ value_available_contents_bits_eq (const struct value *val1, int offset1,
|
||||
/* See function description in value.h. */
|
||||
gdb_assert (!val1->lazy && !val2->lazy);
|
||||
|
||||
+ gdb_assert (val1->optimized_out || VEC_empty (range_s, val1->unavailable));
|
||||
+ gdb_assert (val2->optimized_out || VEC_empty (range_s, val2->unavailable));
|
||||
+ gdb_assert (!val1->optimized_out || VEC_empty (range_s, val1->unavailable));
|
||||
+ gdb_assert (!val2->optimized_out || VEC_empty (range_s, val2->unavailable));
|
||||
+ if (val1->optimized_out != val2->optimized_out)
|
||||
+ return 0;
|
||||
+ if (val1->optimized_out && val2->optimized_out
|
||||
+ && VEC_empty (range_s, val1->unavailable)
|
||||
+ && VEC_empty (range_s, val2->unavailable))
|
||||
+ if (val1->optimized_out && val2->optimized_out)
|
||||
+ return 1;
|
||||
+
|
||||
while (length > 0)
|
||||
@ -648,7 +672,7 @@ index 0000000..f06247d
|
||||
+gdb_continue_to_breakpoint "break-here" ".* break-here .*"
|
||||
+gdb_test "frame" {bar \(ref=@0x[0-9a-f]+: 10, ref@entry=@0x[0-9a-f]+: <optimized out>\) at .*}
|
||||
diff --git a/gdb/testsuite/gdb.arch/amd64-optimout-repeat.S b/gdb/testsuite/gdb.arch/amd64-optimout-repeat.S
|
||||
new file mode 100755
|
||||
new file mode 100644
|
||||
index 0000000..2f8f4d2
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.arch/amd64-optimout-repeat.S
|
||||
@ -1028,5 +1052,5 @@ index 0000000..f3c93a4
|
||||
+
|
||||
+gdb_test "print v" { = {i = 0, xxx = {<optimized out> <repeats 256 times>}}}
|
||||
|
||||
--UlVJffcvxoiEqYs2--
|
||||
--Dxnq1zWXvFF0Q93v--
|
||||
|
||||
|
439
gdb-upstream.patch
Normal file
439
gdb-upstream.patch
Normal file
@ -0,0 +1,439 @@
|
||||
http://sourceware.org/ml/gdb-patches/2014-07/msg00274.html
|
||||
Subject: [obv] Fix false argv0-symlink.exp FAIL running under a very long directory name
|
||||
|
||||
Hi,
|
||||
|
||||
checked in as obvious:
|
||||
|
||||
Starting program: /home/jkratoch/redhat/gdb-test-fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff/gdb/testsuite/gdb.base/argv0-symlink-filelink ^M
|
||||
[...]
|
||||
(gdb) print argv[0]^M
|
||||
$1 = 0x7fffffffda39 "/home/jkratoch/redhat/gdb-test-", 'f' <repeats 169 times>...^M
|
||||
(gdb) FAIL: gdb.base/argv0-symlink.exp: kept file symbolic link name
|
||||
|
||||
after "set print repeats 10000":
|
||||
|
||||
print argv[0]^M
|
||||
$1 = 0x7fffffffda39 "/home/jkratoch/redhat/gdb-test-fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"...^M
|
||||
(gdb) FAIL: gdb.base/argv0-symlink.exp: kept file symbolic link name
|
||||
|
||||
after "set print elements 10000":
|
||||
|
||||
print argv[0]^M
|
||||
$1 = 0x7fffffffda39 "/home/jkratoch/redhat/gdb-test-fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff/gdb/testsuite/gdb.base/argv0-symlink-filelink"^M
|
||||
(gdb) PASS: gdb.base/argv0-symlink.exp: kept file symbolic link name
|
||||
|
||||
commit 218c2655603748b844dcaf103e34fd14d8ee8aef
|
||||
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
Date: Fri Jul 11 17:26:42 2014 +0200
|
||||
|
||||
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
|
||||
index 74f7bce..253eeeb 100644
|
||||
### a/gdb/testsuite/ChangeLog
|
||||
### b/gdb/testsuite/ChangeLog
|
||||
## -1,3 +1,9 @@
|
||||
+2014-07-11 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
+
|
||||
+ Fix false FAIL running under a very long directory name.
|
||||
+ * gdb.base/argv0-symlink.exp: Add "set print repeats 10000"
|
||||
+ and "set print elements 10000". Twice.
|
||||
+
|
||||
2014-07-11 Yao Qi <yao@codesourcery.com>
|
||||
|
||||
* gdb.base/exprs.exp: "set print symbol off".
|
||||
diff --git a/gdb/testsuite/gdb.base/argv0-symlink.exp b/gdb/testsuite/gdb.base/argv0-symlink.exp
|
||||
index 0e0202d..d849b4c 100644
|
||||
--- a/gdb/testsuite/gdb.base/argv0-symlink.exp
|
||||
+++ b/gdb/testsuite/gdb.base/argv0-symlink.exp
|
||||
@@ -36,6 +36,9 @@ if ![runto_main] {
|
||||
return -1
|
||||
}
|
||||
|
||||
+gdb_test_no_output "set print repeats 10000"
|
||||
+gdb_test_no_output "set print elements 10000"
|
||||
+
|
||||
gdb_test {print argv[0]} "/$filelink\"" $test
|
||||
|
||||
# For a link named /PATH/TO/DIR/LINK, we want to check the output
|
||||
@@ -67,6 +70,9 @@ if ![runto_main] {
|
||||
return -1
|
||||
}
|
||||
|
||||
+gdb_test_no_output "set print repeats 10000"
|
||||
+gdb_test_no_output "set print elements 10000"
|
||||
+
|
||||
# gdbserver does not have this issue.
|
||||
if ![is_remote target] {
|
||||
setup_kfail "*-*-*" gdb/15934
|
||||
|
||||
|
||||
|
||||
|
||||
commit 768fbcfda81ff37027eb7a02c043ff669f7701fa
|
||||
Author: Pedro Alves <palves@redhat.com>
|
||||
Date: Fri Jul 11 11:11:20 2014 +0100
|
||||
|
||||
GDBserver crashes when killing a multi-thread process
|
||||
|
||||
Here's an example, with the new test:
|
||||
|
||||
gdbserver :9999 gdb.threads/kill
|
||||
gdb gdb.threads/kill
|
||||
(gdb) b 52
|
||||
Breakpoint 1 at 0x4007f4: file kill.c, line 52.
|
||||
Continuing.
|
||||
|
||||
Breakpoint 1, main () at kill.c:52
|
||||
52 return 0; /* set break here */
|
||||
(gdb) k
|
||||
Kill the program being debugged? (y or n) y
|
||||
|
||||
gdbserver :9999 gdb.threads/kill
|
||||
Process gdb.base/watch_thread_num created; pid = 9719
|
||||
Listening on port 1234
|
||||
Remote debugging from host 127.0.0.1
|
||||
Killing all inferiors
|
||||
Segmentation fault (core dumped)
|
||||
|
||||
Backtrace:
|
||||
|
||||
(gdb) bt
|
||||
#0 0x00000000004068a0 in find_inferior (list=0x66b060 <all_threads>, func=0x427637 <kill_one_lwp_callback>, arg=0x7fffffffd3fc) at src/gdb/gdbserver/inferiors.c:199
|
||||
#1 0x00000000004277b6 in linux_kill (pid=15708) at src/gdb/gdbserver/linux-low.c:966
|
||||
#2 0x000000000041354d in kill_inferior (pid=15708) at src/gdb/gdbserver/target.c:163
|
||||
#3 0x00000000004107e9 in kill_inferior_callback (entry=0x6704f0) at src/gdb/gdbserver/server.c:2934
|
||||
#4 0x0000000000406522 in for_each_inferior (list=0x66b050 <all_processes>, action=0x4107a6 <kill_inferior_callback>) at src/gdb/gdbserver/inferiors.c:57
|
||||
#5 0x0000000000412377 in process_serial_event () at src/gdb/gdbserver/server.c:3767
|
||||
#6 0x000000000041267c in handle_serial_event (err=0, client_data=0x0) at src/gdb/gdbserver/server.c:3880
|
||||
#7 0x00000000004189ff in handle_file_event (event_file_desc=4) at src/gdb/gdbserver/event-loop.c:434
|
||||
#8 0x00000000004181c6 in process_event () at src/gdb/gdbserver/event-loop.c:189
|
||||
#9 0x0000000000418f45 in start_event_loop () at src/gdb/gdbserver/event-loop.c:552
|
||||
#10 0x0000000000411272 in main (argc=3, argv=0x7fffffffd8d8) at src/gdb/gdbserver/server.c:3283
|
||||
|
||||
The problem is that linux_wait_for_event deletes lwps that have exited
|
||||
(even those not passed in as lwps of interest), while the lwp/thread
|
||||
list is being walked on with find_inferior. find_inferior can handle
|
||||
the current iterated inferior being deleted, but not others.
|
||||
|
||||
When killing lwps, we don't really care about any of the pending
|
||||
status handling of linux_wait_for_event. We can just waitpid the lwps
|
||||
directly, which is also what GDB does (see
|
||||
linux-nat.c:kill_wait_callback). This way the lwps are not deleted
|
||||
while we're walking the list. They'll be deleted by linux_mourn
|
||||
afterwards.
|
||||
|
||||
This crash triggers several times when running the testsuite against
|
||||
GDBserver with the native-gdbserver board (target remote), but as GDB
|
||||
can't distinguish between GDBserver crashing and "kill" being
|
||||
sucessful, as in both cases the connection is closed (the 'k' packet
|
||||
doesn't require a reply), and the inferior is gone, that results in no
|
||||
FAIL.
|
||||
|
||||
The patch adds a generic test that catches the issue with
|
||||
extended-remote mode (and works fine with native testing too). Here's
|
||||
how it fails with the native-extended-gdbserver board without the fix:
|
||||
|
||||
(gdb) info threads
|
||||
Id Target Id Frame
|
||||
6 Thread 15367.15374 0x000000373bcbc98d in nanosleep () at ../sysdeps/unix/syscall-template.S:81
|
||||
5 Thread 15367.15373 0x000000373bcbc98d in nanosleep () at ../sysdeps/unix/syscall-template.S:81
|
||||
4 Thread 15367.15372 0x000000373bcbc98d in nanosleep () at ../sysdeps/unix/syscall-template.S:81
|
||||
3 Thread 15367.15371 0x000000373bcbc98d in nanosleep () at ../sysdeps/unix/syscall-template.S:81
|
||||
2 Thread 15367.15370 0x000000373bcbc98d in nanosleep () at ../sysdeps/unix/syscall-template.S:81
|
||||
* 1 Thread 15367.15367 main () at .../gdb.threads/kill.c:52
|
||||
(gdb) kill
|
||||
Kill the program being debugged? (y or n) y
|
||||
Remote connection closed
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
(gdb) FAIL: gdb.threads/kill.exp: kill
|
||||
|
||||
Extended remote should remain connected after the kill.
|
||||
|
||||
gdb/gdbserver/
|
||||
2014-07-11 Pedro Alves <palves@redhat.com>
|
||||
|
||||
* linux-low.c (kill_wait_lwp): New function, based on
|
||||
kill_one_lwp_callback, but use my_waitpid directly.
|
||||
(kill_one_lwp_callback, linux_kill): Use it.
|
||||
|
||||
gdb/testsuite/
|
||||
2014-07-11 Pedro Alves <palves@redhat.com>
|
||||
|
||||
* gdb.threads/kill.c: New file.
|
||||
* gdb.threads/kill.exp: New file.
|
||||
|
||||
### a/gdb/gdbserver/ChangeLog
|
||||
### b/gdb/gdbserver/ChangeLog
|
||||
## -1,3 +1,9 @@
|
||||
+2014-07-11 Pedro Alves <palves@redhat.com>
|
||||
+
|
||||
+ * linux-low.c (kill_wait_lwp): New function, based on
|
||||
+ kill_one_lwp_callback, but use my_waitpid directly.
|
||||
+ (kill_one_lwp_callback, linux_kill): Use it.
|
||||
+
|
||||
2014-06-23 Pedro Alves <palves@redhat.com>
|
||||
|
||||
* linux-x86-low.c (x86_linux_prepare_to_resume): Clear DR_CONTROL
|
||||
--- a/gdb/gdbserver/linux-low.c
|
||||
+++ b/gdb/gdbserver/linux-low.c
|
||||
@@ -909,6 +909,46 @@ linux_kill_one_lwp (struct lwp_info *lwp)
|
||||
errno ? strerror (errno) : "OK");
|
||||
}
|
||||
|
||||
+/* Kill LWP and wait for it to die. */
|
||||
+
|
||||
+static void
|
||||
+kill_wait_lwp (struct lwp_info *lwp)
|
||||
+{
|
||||
+ struct thread_info *thr = get_lwp_thread (lwp);
|
||||
+ int pid = ptid_get_pid (ptid_of (thr));
|
||||
+ int lwpid = ptid_get_lwp (ptid_of (thr));
|
||||
+ int wstat;
|
||||
+ int res;
|
||||
+
|
||||
+ if (debug_threads)
|
||||
+ debug_printf ("kwl: killing lwp %d, for pid: %d\n", lwpid, pid);
|
||||
+
|
||||
+ do
|
||||
+ {
|
||||
+ linux_kill_one_lwp (lwp);
|
||||
+
|
||||
+ /* Make sure it died. Notes:
|
||||
+
|
||||
+ - The loop is most likely unnecessary.
|
||||
+
|
||||
+ - We don't use linux_wait_for_event as that could delete lwps
|
||||
+ while we're iterating over them. We're not interested in
|
||||
+ any pending status at this point, only in making sure all
|
||||
+ wait status on the kernel side are collected until the
|
||||
+ process is reaped.
|
||||
+
|
||||
+ - We don't use __WALL here as the __WALL emulation relies on
|
||||
+ SIGCHLD, and killing a stopped process doesn't generate
|
||||
+ one, nor an exit status.
|
||||
+ */
|
||||
+ res = my_waitpid (lwpid, &wstat, 0);
|
||||
+ if (res == -1 && errno == ECHILD)
|
||||
+ res = my_waitpid (lwpid, &wstat, __WCLONE);
|
||||
+ } while (res > 0 && WIFSTOPPED (wstat));
|
||||
+
|
||||
+ gdb_assert (res > 0);
|
||||
+}
|
||||
+
|
||||
/* Callback for `find_inferior'. Kills an lwp of a given process,
|
||||
except the leader. */
|
||||
|
||||
@@ -917,7 +957,6 @@ kill_one_lwp_callback (struct inferior_list_entry *entry, void *args)
|
||||
{
|
||||
struct thread_info *thread = (struct thread_info *) entry;
|
||||
struct lwp_info *lwp = get_thread_lwp (thread);
|
||||
- int wstat;
|
||||
int pid = * (int *) args;
|
||||
|
||||
if (ptid_get_pid (entry->id) != pid)
|
||||
@@ -936,14 +975,7 @@ kill_one_lwp_callback (struct inferior_list_entry *entry, void *args)
|
||||
return 0;
|
||||
}
|
||||
|
||||
- do
|
||||
- {
|
||||
- linux_kill_one_lwp (lwp);
|
||||
-
|
||||
- /* Make sure it died. The loop is most likely unnecessary. */
|
||||
- pid = linux_wait_for_event (thread->entry.id, &wstat, __WALL);
|
||||
- } while (pid > 0 && WIFSTOPPED (wstat));
|
||||
-
|
||||
+ kill_wait_lwp (lwp);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -952,8 +984,6 @@ linux_kill (int pid)
|
||||
{
|
||||
struct process_info *process;
|
||||
struct lwp_info *lwp;
|
||||
- int wstat;
|
||||
- int lwpid;
|
||||
|
||||
process = find_process_pid (pid);
|
||||
if (process == NULL)
|
||||
@@ -976,21 +1006,7 @@ linux_kill (int pid)
|
||||
pid);
|
||||
}
|
||||
else
|
||||
- {
|
||||
- struct thread_info *thr = get_lwp_thread (lwp);
|
||||
-
|
||||
- if (debug_threads)
|
||||
- debug_printf ("lk_1: killing lwp %ld, for pid: %d\n",
|
||||
- lwpid_of (thr), pid);
|
||||
-
|
||||
- do
|
||||
- {
|
||||
- linux_kill_one_lwp (lwp);
|
||||
-
|
||||
- /* Make sure it died. The loop is most likely unnecessary. */
|
||||
- lwpid = linux_wait_for_event (thr->entry.id, &wstat, __WALL);
|
||||
- } while (lwpid > 0 && WIFSTOPPED (wstat));
|
||||
- }
|
||||
+ kill_wait_lwp (lwp);
|
||||
|
||||
the_target->mourn (process);
|
||||
|
||||
### a/gdb/testsuite/ChangeLog
|
||||
### b/gdb/testsuite/ChangeLog
|
||||
## -1,3 +1,8 @@
|
||||
+2014-07-11 Pedro Alves <palves@redhat.com>
|
||||
+
|
||||
+ * gdb.threads/kill.c: New file.
|
||||
+ * gdb.threads/kill.exp: New file.
|
||||
+
|
||||
2014-07-09 Pedro Alves <palves@redhat.com>
|
||||
|
||||
* gdb.base/attach-wait-input.exp: New file.
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.threads/kill.c
|
||||
@@ -0,0 +1,64 @@
|
||||
+/* This testcase is part of GDB, the GNU debugger.
|
||||
+
|
||||
+ Copyright 2014 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/>. */
|
||||
+
|
||||
+#ifdef USE_THREADS
|
||||
+
|
||||
+#include <unistd.h>
|
||||
+#include <pthread.h>
|
||||
+
|
||||
+#define NUM 5
|
||||
+
|
||||
+pthread_barrier_t barrier;
|
||||
+
|
||||
+void *
|
||||
+thread_function (void *arg)
|
||||
+{
|
||||
+ volatile unsigned int counter = 1;
|
||||
+
|
||||
+ pthread_barrier_wait (&barrier);
|
||||
+
|
||||
+ while (counter > 0)
|
||||
+ {
|
||||
+ counter++;
|
||||
+ usleep (1);
|
||||
+ }
|
||||
+
|
||||
+ pthread_exit (NULL);
|
||||
+}
|
||||
+
|
||||
+#endif /* USE_THREADS */
|
||||
+
|
||||
+void
|
||||
+setup (void)
|
||||
+{
|
||||
+#ifdef USE_THREADS
|
||||
+ pthread_t threads[NUM];
|
||||
+ int i;
|
||||
+
|
||||
+ pthread_barrier_init (&barrier, NULL, NUM + 1);
|
||||
+ for (i = 0; i < NUM; i++)
|
||||
+ pthread_create (&threads[i], NULL, thread_function, NULL);
|
||||
+ pthread_barrier_wait (&barrier);
|
||||
+#endif /* USE_THREADS */
|
||||
+}
|
||||
+
|
||||
+int
|
||||
+main (void)
|
||||
+{
|
||||
+ setup ();
|
||||
+ return 0; /* set break here */
|
||||
+}
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.threads/kill.exp
|
||||
@@ -0,0 +1,77 @@
|
||||
+# This testcase is part of GDB, the GNU debugger.
|
||||
+
|
||||
+# Copyright 2014 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/>. */
|
||||
+
|
||||
+standard_testfile
|
||||
+
|
||||
+# Run the test proper. THREADED indicates whether to build a threaded
|
||||
+# program and spawn several threads before trying to kill the program.
|
||||
+
|
||||
+proc test {threaded} {
|
||||
+ global testfile srcfile
|
||||
+
|
||||
+ with_test_prefix [expr ($threaded)?"threaded":"non-threaded"] {
|
||||
+
|
||||
+ set options {debug}
|
||||
+ if {$threaded} {
|
||||
+ lappend options "pthreads"
|
||||
+ lappend options "additional_flags=-DUSE_THREADS"
|
||||
+ set prog ${testfile}_threads
|
||||
+ } else {
|
||||
+ set prog ${testfile}_nothreads
|
||||
+ }
|
||||
+
|
||||
+ if {[prepare_for_testing "failed to prepare" $prog $srcfile $options] == -1} {
|
||||
+ return -1
|
||||
+ }
|
||||
+
|
||||
+ if { ![runto main] } then {
|
||||
+ fail "run to main"
|
||||
+ return
|
||||
+ }
|
||||
+
|
||||
+ set linenum [gdb_get_line_number "set break here"]
|
||||
+ gdb_breakpoint "$srcfile:$linenum"
|
||||
+ gdb_continue_to_breakpoint "break here" ".*break here.*"
|
||||
+
|
||||
+ if {$threaded} {
|
||||
+ gdb_test "info threads" "6.*5.*4.*3.*2.*1.*" "all threads started"
|
||||
+ }
|
||||
+
|
||||
+ # This kills and ensures no output other than the prompt comes out,
|
||||
+ # like:
|
||||
+ #
|
||||
+ # (gdb) kill
|
||||
+ # Kill the program being debugged? (y or n) y
|
||||
+ # (gdb)
|
||||
+ #
|
||||
+ # If we instead saw more output, like e.g., with an extended-remote
|
||||
+ # connection:
|
||||
+ #
|
||||
+ # (gdb) kill
|
||||
+ # Kill the program being debugged? (y or n) y
|
||||
+ # Remote connection closed
|
||||
+ # (gdb)
|
||||
+ #
|
||||
+ # the above would mean that the remote end crashed.
|
||||
+
|
||||
+ gdb_test "kill" "^y" "kill program" "Kill the program being debugged\\? \\(y or n\\) $" "y"
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+foreach threaded {true false} {
|
||||
+ test $threaded
|
||||
+}
|
15
gdb.spec
15
gdb.spec
@ -18,14 +18,14 @@ Summary: A GNU source-level debugger for C, C++, Fortran, Go and other languages
|
||||
Name: %{?scl_prefix}gdb
|
||||
|
||||
# Freeze it when GDB gets branched
|
||||
%global snapsrc 20140627
|
||||
%global snapsrc 20140711
|
||||
# See timestamp of source gnulib installed into gdb/gnulib/ .
|
||||
%global snapgnulib 20121213
|
||||
Version: 7.7.90.%{snapsrc}
|
||||
|
||||
# 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: 10%{?dist}
|
||||
Release: 11%{?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
|
||||
@ -218,7 +218,7 @@ Patch231: gdb-6.3-bz202689-exec-from-pthread-test.patch
|
||||
|
||||
# Backported fixups post the source tarball.
|
||||
#Xdrop: Just backports.
|
||||
#Patch232: gdb-upstream.patch
|
||||
Patch232: gdb-upstream.patch
|
||||
|
||||
# Testcase for PPC Power6/DFP instructions disassembly (BZ 230000).
|
||||
#=fedoratest+ppc
|
||||
@ -695,7 +695,7 @@ find -name "*.info*"|xargs rm -f
|
||||
%patch2 -p1
|
||||
|
||||
%patch349 -p1
|
||||
#patch232 -p1
|
||||
%patch232 -p1
|
||||
%patch888 -p1
|
||||
%patch912 -p1
|
||||
%patch1 -p1
|
||||
@ -1059,7 +1059,7 @@ gcc -o ./orphanripper %{SOURCE2} -Wall -lutil -ggdb2
|
||||
|
||||
# Run all the scheduled testsuite runs also in the PIE mode.
|
||||
# See also: gdb-runtest-pie-override.exp
|
||||
CHECK="$(echo $CHECK|sed 's#check//unix/[^ ]*#& &/-fPIC/-pie#g')"
|
||||
###CHECK="$(echo $CHECK|sed 's#check//unix/[^ ]*#& &/-fPIC/-pie#g')"
|
||||
|
||||
./orphanripper make %{?_smp_mflags} -k $CHECK || :
|
||||
)
|
||||
@ -1291,6 +1291,11 @@ then
|
||||
fi
|
||||
|
||||
%changelog
|
||||
* Fri Jul 11 2014 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.7.90.20140711-11.fc21
|
||||
- Fix regression#2 of the optimized-out entry data values fix (of BZ 1111910).
|
||||
- Rebase to FSF GDB 7.7.90.20140711 (pre-7.8 snapshot).
|
||||
- [testsuite] Disable --with testsuite PIE testing, it has too many false FAILs.
|
||||
|
||||
* Wed Jul 9 2014 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.7.90.20140627-10.fc21
|
||||
- Fix regression of the optimized-out entry data values fix (of BZ 1111910).
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user