aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Jacobowitz <drow@false.org>2008-07-27 21:05:37 +0000
committerDaniel Jacobowitz <drow@false.org>2008-07-27 21:05:37 +0000
commite09490f18a66aa4d02a2f5b7a75d2530caf09d5b (patch)
treee2e584bfa3cbc4f22445c6621d8244d3e26c6efa
parent6387b45f80c8d6f9392b37bf15a316bd43c8d58b (diff)
downloadgdb-e09490f18a66aa4d02a2f5b7a75d2530caf09d5b.zip
gdb-e09490f18a66aa4d02a2f5b7a75d2530caf09d5b.tar.gz
gdb-e09490f18a66aa4d02a2f5b7a75d2530caf09d5b.tar.bz2
* linux-nat.c (count_events_callback, select_event_lwp_callback): Only
report events from resumed threads. * gdb.threads/schedlock.exp (get_args): Update to work for any value of NUM. (Top level): Report the number of threads that did not resume.
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/linux-nat.c8
-rw-r--r--gdb/testsuite/ChangeLog6
-rw-r--r--gdb/testsuite/gdb.threads/schedlock.exp23
4 files changed, 32 insertions, 10 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index e58b216..7cc48ef 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@
2008-07-27 Daniel Jacobowitz <dan@codesourcery.com>
+ * linux-nat.c (count_events_callback, select_event_lwp_callback): Only
+ report events from resumed threads.
+
+2008-07-27 Daniel Jacobowitz <dan@codesourcery.com>
+
* mips-linux-tdep.c (mips_linux_syscall_next_pc): New function.
(mips_linux_init_abi): Set tdep->syscall_next_pc.
* mips-tdep.c (enum mips_fpu_type, struct gdbarch_tdep): Move to
diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
index 967beb4..5ccff50 100644
--- a/gdb/linux-nat.c
+++ b/gdb/linux-nat.c
@@ -2319,8 +2319,8 @@ count_events_callback (struct lwp_info *lp, void *data)
gdb_assert (count != NULL);
- /* Count only LWPs that have a SIGTRAP event pending. */
- if (lp->status != 0
+ /* Count only resumed LWPs that have a SIGTRAP event pending. */
+ if (lp->status != 0 && lp->resumed
&& WIFSTOPPED (lp->status) && WSTOPSIG (lp->status) == SIGTRAP)
(*count)++;
@@ -2347,8 +2347,8 @@ select_event_lwp_callback (struct lwp_info *lp, void *data)
gdb_assert (selector != NULL);
- /* Select only LWPs that have a SIGTRAP event pending. */
- if (lp->status != 0
+ /* Select only resumed LWPs that have a SIGTRAP event pending. */
+ if (lp->status != 0 && lp->resumed
&& WIFSTOPPED (lp->status) && WSTOPSIG (lp->status) == SIGTRAP)
if ((*selector)-- == 0)
return 1;
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 867eff9..ae66c01 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,5 +1,11 @@
2008-07-27 Daniel Jacobowitz <dan@codesourcery.com>
+ * gdb.threads/schedlock.exp (get_args): Update to work for any
+ value of NUM.
+ (Top level): Report the number of threads that did not resume.
+
+2008-07-27 Daniel Jacobowitz <dan@codesourcery.com>
+
* gdb.dwarf2/dw2-compressed.S: Also define __start.
2008-07-27 Daniel Jacobowitz <dan@codesourcery.com>
diff --git a/gdb/testsuite/gdb.threads/schedlock.exp b/gdb/testsuite/gdb.threads/schedlock.exp
index f6b319c..8faee9f 100644
--- a/gdb/testsuite/gdb.threads/schedlock.exp
+++ b/gdb/testsuite/gdb.threads/schedlock.exp
@@ -45,14 +45,25 @@ if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executab
proc get_args { } {
global list_count
global gdb_prompt
+ global NUM
+
+ set pattern "(\[0-9\]+)"
+ for {set i 1} {[expr $i < $NUM]} {incr i} {
+ append pattern ", (\[0-9\]+)"
+ }
send_gdb "print args\n"
gdb_expect {
- -re "\\\$\[0-9\]+ = {(\[0-9\]+), (\[0-9\]+)}.*$gdb_prompt"
+ -re "\\\$\[0-9\]+ = {$pattern}.*$gdb_prompt"
{
set list_count [expr $list_count + 1]
pass "listed args ($list_count)"
- return [list $expect_out(1,string) $expect_out(2,string)]
+
+ set result ""
+ for {set i 1} {[expr $i <= $NUM]} {incr i} {
+ lappend result $expect_out($i,string)
+ }
+ return $result
}
-re "$gdb_prompt"
{
@@ -202,16 +213,16 @@ my_continue "initial"
set cont_args [get_args]
-set ok 1
+set bad 0
for {set i 0} {[expr $i < $NUM]} {set i [expr $i + 1]} {
if {[lindex $start_args $i] == [lindex $cont_args $i]} {
- set ok 0
+ incr bad
}
}
-if { $ok } {
+if { $bad == 0 } {
pass "all threads alive"
} else {
- fail "all threads alive"
+ fail "all threads alive ($bad/$NUM did not run)"
}
# We can't change threads, unfortunately, in current GDB. Use