* [PATCH v4 0/14] Run all-stop on non-stop target
@ 2012-05-03 13:12 Yao Qi
2012-05-03 13:12 ` [PATCH 03/14] Change parameters of adjust_pc_after_break Yao Qi
` (14 more replies)
0 siblings, 15 replies; 22+ messages in thread
From: Yao Qi @ 2012-05-03 13:12 UTC (permalink / raw)
To: gdb-patches
This series are the V4 of this sereis, and V3 can be found here,
[PATCH v3 0/15] Run all-stop on non-stop target
http://sourceware.org/ml/gdb-patches/2012-04/msg00278.html
This version includes following changes, compared with V3,
- Rebased to CVS trunk
- Remove [PATCH 09/15] Don't trigger async event in inf-call and
[PATCH 11/15] Don't check $ after gdb_prompt out of this sereis,
because they are not relevant.
- Add changes to ia64-sigill.exp.
Tested on x86_64 native and native-gdbserver. No regressions.
All ITSET patches in my local trees are dependent on this series
of patches. They are about changes in many files, so that other
commits to CVS trunk may easily break them. I appreciate people
can review them shortly, to reduce my pain to resolve conflicts
in five different git branches.
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH 03/14] Change parameters of adjust_pc_after_break.
2012-05-03 13:12 [PATCH v4 0/14] Run all-stop on non-stop target Yao Qi
@ 2012-05-03 13:12 ` Yao Qi
2012-05-03 13:12 ` [PATCH 01/14] Fix displaced stepping debug log Yao Qi
` (13 subsequent siblings)
14 siblings, 0 replies; 22+ messages in thread
From: Yao Qi @ 2012-05-03 13:12 UTC (permalink / raw)
To: gdb-patches
A refactor change patch.
gdb:
2012-04-12 Pedro Alves <pedro@codesourcery.com>
* infrun.c (adjust_pc_after_break): Remove parameter `ecs'. Add
parameter `thread' and 'ws'. Change to return int.
(handle_inferior_event): Caller update.
---
gdb/infrun.c | 38 ++++++++++++++++++++++++--------------
1 files changed, 24 insertions(+), 14 deletions(-)
diff --git a/gdb/infrun.c b/gdb/infrun.c
index c58688c..9de9674 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -2937,13 +2937,18 @@ context_switch (ptid_t ptid)
switch_to_thread (ptid);
}
-static void
-adjust_pc_after_break (struct execution_control_state *ecs)
+/* Adjust PC value after thread THREAD hits breakpoint. Return 1 if PC value
+ is adjusted, otherwise, return 0. */
+
+static int
+adjust_pc_after_break (struct thread_info *thread,
+ struct target_waitstatus *ws)
{
struct regcache *regcache;
struct gdbarch *gdbarch;
struct address_space *aspace;
CORE_ADDR breakpoint_pc;
+ int ret = 0;
/* If we've hit a breakpoint, we'll normally be stopped with SIGTRAP. If
we aren't, just return.
@@ -2966,11 +2971,11 @@ adjust_pc_after_break (struct execution_control_state *ecs)
target with both of these set in GDB history, and it seems unlikely to be
correct, so gdbarch_have_nonsteppable_watchpoint is not checked here. */
- if (ecs->ws.kind != TARGET_WAITKIND_STOPPED)
- return;
+ if (ws->kind != TARGET_WAITKIND_STOPPED)
+ return 0;
- if (ecs->ws.value.sig != TARGET_SIGNAL_TRAP)
- return;
+ if (ws->value.sig != TARGET_SIGNAL_TRAP)
+ return 0;
/* In reverse execution, when a breakpoint is hit, the instruction
under it has already been de-executed. The reported PC always
@@ -2999,14 +3004,14 @@ adjust_pc_after_break (struct execution_control_state *ecs)
INSN1 hadn't been de-executed yet. Doing nothing is the correct
behaviour. */
if (execution_direction == EXEC_REVERSE)
- return;
+ return 0;
/* If this target does not decrement the PC after breakpoints, then
we have nothing to do. */
- regcache = get_thread_regcache (ecs->ptid);
+ regcache = get_thread_regcache (thread->ptid);
gdbarch = get_regcache_arch (regcache);
if (gdbarch_decr_pc_after_break (gdbarch) == 0)
- return;
+ return 0;
aspace = get_regcache_aspace (regcache);
@@ -3050,14 +3055,19 @@ adjust_pc_after_break (struct execution_control_state *ecs)
we also need to back up to the breakpoint address. */
if (singlestep_breakpoints_inserted_p
- || !ptid_equal (ecs->ptid, inferior_ptid)
- || !currently_stepping (ecs->event_thread)
- || ecs->event_thread->prev_pc == breakpoint_pc)
- regcache_write_pc (regcache, breakpoint_pc);
+ || !ptid_equal (thread->ptid, inferior_ptid)
+ || !currently_stepping (thread)
+ || thread->prev_pc == breakpoint_pc)
+ {
+ regcache_write_pc (regcache, breakpoint_pc);
+ ret = 1;
+ }
if (RECORD_IS_USED)
do_cleanups (old_cleanups);
}
+
+ return ret;
}
void
@@ -3264,7 +3274,7 @@ handle_inferior_event (struct execution_control_state *ecs)
ecs->event_thread = find_thread_ptid (ecs->ptid);
/* Dependent on valid ECS->EVENT_THREAD. */
- adjust_pc_after_break (ecs);
+ adjust_pc_after_break (ecs->event_thread, &ecs->ws);
/* Dependent on the current PC value modified by adjust_pc_after_break. */
reinit_frame_cache ();
--
1.7.0.4
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH 01/14] Fix displaced stepping debug log.
2012-05-03 13:12 [PATCH v4 0/14] Run all-stop on non-stop target Yao Qi
2012-05-03 13:12 ` [PATCH 03/14] Change parameters of adjust_pc_after_break Yao Qi
@ 2012-05-03 13:12 ` Yao Qi
2012-05-03 15:01 ` Pedro Alves
2012-05-03 13:13 ` [PATCH 08/14] Uninstall infrun_async_inferior_event token in remote target Yao Qi
` (12 subsequent siblings)
14 siblings, 1 reply; 22+ messages in thread
From: Yao Qi @ 2012-05-03 13:12 UTC (permalink / raw)
To: gdb-patches
gdb:
2012-04-12 Pedro Alves <pedro@codesourcery.com>
* infrun.c (displaced_step_fixup): Add prefix "displaced:" in debug
log.
---
gdb/infrun.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/gdb/infrun.c b/gdb/infrun.c
index ab51806..c3074d5 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -1545,7 +1545,7 @@ displaced_step_fixup (ptid_t event_ptid, enum target_signal signal)
if (debug_displaced)
fprintf_unfiltered (gdb_stdlog,
- "breakpoint is gone %s: step(%d)\n",
+ "displaced: breakpoint is gone: %s, step(%d)\n",
target_pid_to_str (tp->ptid), step);
target_resume (ptid, step, TARGET_SIGNAL_0);
--
1.7.0.4
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH 08/14] Uninstall infrun_async_inferior_event token in remote target.
2012-05-03 13:12 [PATCH v4 0/14] Run all-stop on non-stop target Yao Qi
2012-05-03 13:12 ` [PATCH 03/14] Change parameters of adjust_pc_after_break Yao Qi
2012-05-03 13:12 ` [PATCH 01/14] Fix displaced stepping debug log Yao Qi
@ 2012-05-03 13:13 ` Yao Qi
2012-05-03 13:13 ` [PATCH 05/14] Support in linux-nat target Yao Qi
` (11 subsequent siblings)
14 siblings, 0 replies; 22+ messages in thread
From: Yao Qi @ 2012-05-03 13:13 UTC (permalink / raw)
To: gdb-patches
This patch is to fix the problem that GDB is unable to handle ctrl-c
well.
The infrun_async_inferior_event_token is not needed in remote target.
This patch is to uninstall infrun_async_inferior_event_token
in remote target, and restore it when remote target is closed.
Note I don't think I understand the cause of this problem fully, so
explanations on this problem is appreciated.
gdb:
2012-04-12 Yao Qi <yao@codesourcery.com>
* inferior.h: Function declaration.
* infrun.c (do_target_resume): Check NULL of
infrun_async_inferior_event_token.
(resume): Likewise.
(infrun_async_inferior_event_handler_install): New.
(infrun_async_inferior_event_handler_remove): New.
* remote.c (remote_close): Call
infrun_async_inferior_event_handler_install.
(remote_open_1): Call infrun_async_inferior_event_handler_remove.
---
gdb/inferior.h | 4 ++++
gdb/infrun.c | 25 +++++++++++++++++++------
gdb/remote.c | 4 ++++
3 files changed, 27 insertions(+), 6 deletions(-)
diff --git a/gdb/inferior.h b/gdb/inferior.h
index 63245a2..7932210 100644
--- a/gdb/inferior.h
+++ b/gdb/inferior.h
@@ -269,6 +269,10 @@ extern void notice_new_inferior (ptid_t, int, int);
extern struct value *get_return_value (struct type *func_type,
struct type *value_type);
+extern void infrun_async_inferior_event_handler_install (void);
+
+extern void infrun_async_inferior_event_handler_remove (void);
+
/* Address at which inferior stopped. */
extern CORE_ADDR stop_pc;
diff --git a/gdb/infrun.c b/gdb/infrun.c
index b7afa39..0d487eb 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -1851,7 +1851,7 @@ do_target_resume (ptid_t ptid, int step, enum target_signal signo)
{
can_wildcard = 0;
- if (target_can_async_p ())
+ if (target_can_async_p () && infrun_async_inferior_event_token)
{
target_async (inferior_event_handler, 0);
@@ -1931,7 +1931,7 @@ do_target_resume (ptid_t ptid, int step, enum target_signal signo)
clear_inline_frame_state (ptid);
}
- if (target_can_async_p ())
+ if (target_can_async_p () && infrun_async_inferior_event_token)
{
target_async (inferior_event_handler, 0);
/* Tell the event loop we have something to process. */
@@ -1971,7 +1971,7 @@ resume (int step, enum target_signal sig)
clear_inline_frame_state (inferior_ptid);
discard_cleanups (old_cleanups);
- if (target_can_async_p ())
+ if (target_can_async_p () && infrun_async_inferior_event_token)
{
target_async (inferior_event_handler, 0);
/* Tell the event loop we have something to process. */
@@ -7857,14 +7857,27 @@ infrun_async_inferior_event_handler (gdb_client_data data)
}
void
+infrun_async_inferior_event_handler_install (void)
+{
+ /* Register extra event sources in the event loop. */
+ infrun_async_inferior_event_token
+ = create_async_event_handler (infrun_async_inferior_event_handler, NULL);
+}
+
+void
+infrun_async_inferior_event_handler_remove (void)
+{
+ if (infrun_async_inferior_event_token)
+ delete_async_event_handler (&infrun_async_inferior_event_token);
+}
+
+void
_initialize_infrun (void)
{
int i;
int numsigs;
- /* Register extra event sources in the event loop. */
- infrun_async_inferior_event_token
- = create_async_event_handler (infrun_async_inferior_event_handler, NULL);
+ infrun_async_inferior_event_handler_install ();
add_info ("signals", signals_info, _("\
What debugger does when program gets various signals.\n\
diff --git a/gdb/remote.c b/gdb/remote.c
index 6d58aca..0fe2c9e 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -3022,6 +3022,8 @@ remote_close (int quitting)
delete_async_event_handler (&remote_async_inferior_event_token);
if (remote_async_get_pending_events_token)
delete_async_event_handler (&remote_async_get_pending_events_token);
+
+ infrun_async_inferior_event_handler_install ();
}
/* Query the remote side for the text, data and bss offsets. */
@@ -4208,6 +4210,8 @@ remote_open_1 (char *name, int from_tty,
= create_async_event_handler (remote_async_get_pending_events_handler,
NULL);
+ infrun_async_inferior_event_handler_remove ();
+
/* Reset the target state; these things will be queried either by
remote_query_supported or as they are needed. */
init_all_packet_configs ();
--
1.7.0.4
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH 05/14] Support in linux-nat target.
2012-05-03 13:12 [PATCH v4 0/14] Run all-stop on non-stop target Yao Qi
` (2 preceding siblings ...)
2012-05-03 13:13 ` [PATCH 08/14] Uninstall infrun_async_inferior_event token in remote target Yao Qi
@ 2012-05-03 13:13 ` Yao Qi
2012-05-03 13:13 ` [PATCH 10/14] watchthreads-reorder.exp: Don't assume there is no infrun output after prompt Yao Qi
` (10 subsequent siblings)
14 siblings, 0 replies; 22+ messages in thread
From: Yao Qi @ 2012-05-03 13:13 UTC (permalink / raw)
To: gdb-patches
gdb:
2012-04-12 Pedro Alves <pedro@codesourcery.com>
* linux-nat.c (linux_nat_is_non_stop_p): New.
(linux_nat_add_target): Install linux_nat_is_non_stop_p.
---
gdb/linux-nat.c | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
index a96a73c..265d0b2 100644
--- a/gdb/linux-nat.c
+++ b/gdb/linux-nat.c
@@ -4912,6 +4912,12 @@ linux_nat_supports_non_stop (void)
return 1;
}
+static int
+linux_nat_is_non_stop_p (void)
+{
+ return 1;
+}
+
/* True if we want to support multi-process. To be removed when GDB
supports multi-exec. */
@@ -5227,6 +5233,7 @@ linux_nat_add_target (struct target_ops *t)
t->to_can_async_p = linux_nat_can_async_p;
t->to_is_async_p = linux_nat_is_async_p;
t->to_supports_non_stop = linux_nat_supports_non_stop;
+ t->to_is_non_stop_p = linux_nat_is_non_stop_p;
t->to_async = linux_nat_async;
t->to_terminal_inferior = linux_nat_terminal_inferior;
t->to_terminal_ours = linux_nat_terminal_ours;
--
1.7.0.4
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH 09/14] Set thread's state in infcall.
2012-05-03 13:12 [PATCH v4 0/14] Run all-stop on non-stop target Yao Qi
` (5 preceding siblings ...)
2012-05-03 13:13 ` [PATCH 12/14] manythreads.exp: Adjust to handle threads appearing/disappearing after "Program received signal SIGFOO" Yao Qi
@ 2012-05-03 13:13 ` Yao Qi
2012-05-03 13:13 ` [PATCH 14/14] kfail gdb/13858 Yao Qi
` (7 subsequent siblings)
14 siblings, 0 replies; 22+ messages in thread
From: Yao Qi @ 2012-05-03 13:13 UTC (permalink / raw)
To: gdb-patches
Split from original V2. Nothing changed.
Fix this fail below in both native and remote.
-FAIL: gdb.base/step-resume-infcall.exp: next
+PASS: gdb.base/step-resume-infcall.exp: next
gdb:
2012-04-12 Pedro Alves <pedro@codesourcery.com>
* infcall.c (run_inferior_call): Set the thread's state to
THREAD_STOPPED while calling clear_proceed_status.
---
gdb/infcall.c | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/gdb/infcall.c b/gdb/infcall.c
index 6c250e3..d40b7ef 100644
--- a/gdb/infcall.c
+++ b/gdb/infcall.c
@@ -387,11 +387,21 @@ run_inferior_call (struct thread_info *call_thread, CORE_ADDR real_pc)
volatile struct gdb_exception e;
int saved_in_infcall = call_thread->control.in_infcall;
ptid_t call_thread_ptid = call_thread->ptid;
+ int state = call_thread->state;
call_thread->control.in_infcall = 1;
+ /* Fudge the thread's state so clear_proceed_status doesn't ignore
+ it. We may be running an infcall with a THREAD_RUNNING but
+ !executing thread, e.g., when evaluating a breakpoint's
+ condition. */
+ state = call_thread->state;
+ call_thread->state = THREAD_STOPPED;
+
clear_proceed_status ();
+ call_thread->state = state;
+
disable_watchpoints_before_interactive_call_start ();
/* We want stop_registers, please... */
--
1.7.0.4
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH 13/14] ia64-sigill.exp: Don't assume there's no infrun output after the prompt
2012-05-03 13:12 [PATCH v4 0/14] Run all-stop on non-stop target Yao Qi
` (8 preceding siblings ...)
2012-05-03 13:13 ` [PATCH 02/14] Move displaced_step_fixup bits out to displaced_step_next Yao Qi
@ 2012-05-03 13:13 ` Yao Qi
2012-05-03 13:13 ` [PATCH 07/14] Support in remote target Yao Qi
` (4 subsequent siblings)
14 siblings, 0 replies; 22+ messages in thread
From: Yao Qi @ 2012-05-03 13:13 UTC (permalink / raw)
To: gdb-patches
From: Pedro Alves <pedro@codesourcery.com>
In async mode, we can still see TARGET_WAITKIND_IGNORE and
TARGET_WAITKIND_NORESUMED events after displaying the prompt, breaking
this test with timeouts, due to the anchor in "$gdb_prompt $"
This fixes it.
v2:
- new in v2.
gdb/testsuite/
2011-12-16 Pedro Alves <pedro@codesourcery.com>
* gdb.threads/ia64-sigill.exp: Don't assume there's no infrun
output after the prompt.
---
gdb/testsuite/gdb.threads/ia64-sigill.exp | 26 ++++++++++++++++++++------
1 files changed, 20 insertions(+), 6 deletions(-)
diff --git a/gdb/testsuite/gdb.threads/ia64-sigill.exp b/gdb/testsuite/gdb.threads/ia64-sigill.exp
index e14c685..4b2ebae 100644
--- a/gdb/testsuite/gdb.threads/ia64-sigill.exp
+++ b/gdb/testsuite/gdb.threads/ia64-sigill.exp
@@ -55,21 +55,35 @@ gdb_test_no_output {set $sigill_bpnum=$bpnum}
gdb_breakpoint [gdb_get_line_number "break-at-exit"]
+# The ia64 SIGILL signal is only visible in the infrun debug output.
+# Note we can't assume there's no infrun output after the prompt from
+# here on.
gdb_test_no_output "set debug infrun 1"
-# The ia64 SIGILL signal is visible only in the lin-lwp debug.
-
-gdb_test "continue" "Breakpoint \[0-9\]+,( .* in)? thread_func .*"
+set test "continue to thread_func"
+gdb_test_multiple "continue" $test {
+ -re "Breakpoint \[0-9\]+,( .* in)? thread_func .*$gdb_prompt " {
+ pass $test
+ }
+}
-gdb_test_no_output {delete $sigill_bpnum}
+set test {delete $sigill_bpnum}
+gdb_test_multiple "continue" $test {
+ -re "$gdb_prompt " {
+ pass $test
+ }
+}
set test "continue for the pending signal"
gdb_test_multiple "continue" $test {
- -re "Breakpoint \[0-9\]+, .*break-at-exit.*\r\n$gdb_prompt $" {
+ -re "Breakpoint \[0-9\]+, .*break-at-exit.*\r\n$gdb_prompt " {
# Breakpoint has been skipped in the other thread.
pass $test
}
- -re "Program received signal .*\r\n$gdb_prompt $" {
+ -re "Program received signal .*\r\n$gdb_prompt " {
+ fail $test
+ }
+ -re "$gdb_prompt " {
fail $test
}
}
--
1.7.0.4
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH 11/14] Fix fails in gdb.trace/pending.exp.
2012-05-03 13:12 [PATCH v4 0/14] Run all-stop on non-stop target Yao Qi
` (11 preceding siblings ...)
2012-05-03 13:13 ` [PATCH 06/14] Flip to set target-async on by default and NEWS Yao Qi
@ 2012-05-03 13:13 ` Yao Qi
2012-05-03 13:14 ` [PATCH 04/14] Run all-stop on non-stop Yao Qi
2012-05-03 14:23 ` [PATCH v4 0/14] Run all-stop on non-stop target Pedro Alves
14 siblings, 0 replies; 22+ messages in thread
From: Yao Qi @ 2012-05-03 13:13 UTC (permalink / raw)
To: gdb-patches
gdb/testsuite:
2012-04-09 Yao Qi <yao@codesourcery.com>
* gdb.trace/pending.exp (pending_tracepoint_resolved_during_trace):
Match the output of continue mixed with other messages.
(pending_tracepoint_installed_during_trace): Likewise.
(ending_tracepoint_disconnect_after_resolved): Likewise.
(pending_tracepoint_with_action_resolved): Likewise.
---
gdb/testsuite/gdb.trace/pending.exp | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/gdb/testsuite/gdb.trace/pending.exp b/gdb/testsuite/gdb.trace/pending.exp
index 018ded2..a759513 100644
--- a/gdb/testsuite/gdb.trace/pending.exp
+++ b/gdb/testsuite/gdb.trace/pending.exp
@@ -213,7 +213,7 @@ proc pending_tracepoint_resolved_during_trace { trace_type } \
fail $test
}
}
- -re "Continuing.\r\n\r\nBreakpoint.*marker.*at.*$srcfile.*$gdb_prompt $" {
+ -re "Continuing\\.\r\n.*\r\nBreakpoint.*marker.*at.*$srcfile.*$gdb_prompt $" {
pass $test
}
}
@@ -286,7 +286,7 @@ proc pending_tracepoint_installed_during_trace { trace_type } \
fail $test
}
}
- -re "Continuing.\r\n\r\nBreakpoint.*marker.*at.*$srcfile.*$gdb_prompt $" {
+ -re "Continuing\\.\r\n.*\r\nBreakpoint.*marker.*at.*$srcfile.*$gdb_prompt $" {
pass $test
}
}
@@ -383,7 +383,7 @@ proc pending_tracepoint_disconnect_after_resolved { trace_type } \
gdb_test "continue" "Continuing.\r\n\r\nBreakpoint.*marker.*at.*pending.c.*" \
"continue to marker 1"
- gdb_test "continue" "Continuing.\r\n\r\nBreakpoint.*marker.*at.*pending.c.*" \
+ gdb_test "continue" "Continuing\\.\r\n.*\r\nBreakpoint.*marker.*at.*pending.c.*" \
"continue to marker 2"
# There should be no pending tracepoint, so no warning should be emitted.
@@ -465,7 +465,7 @@ proc pending_tracepoint_with_action_resolved { trace_type } \
fail $test
}
}
- -re "Continuing.\r\n\r\nBreakpoint.*marker.*at.*$srcfile.*$gdb_prompt $" {
+ -re "Continuing\\.\r\n.*\r\nBreakpoint.*marker.*at.*$srcfile.*$gdb_prompt $" {
pass "continue to marker 2"
}
--
1.7.0.4
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH 10/14] watchthreads-reorder.exp: Don't assume there is no infrun output after prompt.
2012-05-03 13:12 [PATCH v4 0/14] Run all-stop on non-stop target Yao Qi
` (3 preceding siblings ...)
2012-05-03 13:13 ` [PATCH 05/14] Support in linux-nat target Yao Qi
@ 2012-05-03 13:13 ` Yao Qi
2012-05-03 13:13 ` [PATCH 12/14] manythreads.exp: Adjust to handle threads appearing/disappearing after "Program received signal SIGFOO" Yao Qi
` (9 subsequent siblings)
14 siblings, 0 replies; 22+ messages in thread
From: Yao Qi @ 2012-05-03 13:13 UTC (permalink / raw)
To: gdb-patches
Copied from this,
[RFC/WIP PATCH v2 05/14] watchthreads-reorder.exp: Don't assume there's no infrun output after the prompt
http://sourceware.org/ml/gdb-patches/2011-12/msg00565.html
gdb/testsuite:
2011-12-16 Pedro Alves <pedro@codesourcery.com>
* gdb.threads/watchthreads-reorder.exp: Don't assume there's no infrun
output after the prompt.
---
gdb/testsuite/gdb.threads/watchthreads-reorder.exp | 14 +++++++++++++-
1 files changed, 13 insertions(+), 1 deletions(-)
diff --git a/gdb/testsuite/gdb.threads/watchthreads-reorder.exp b/gdb/testsuite/gdb.threads/watchthreads-reorder.exp
index 5197983..a9464a4 100644
--- a/gdb/testsuite/gdb.threads/watchthreads-reorder.exp
+++ b/gdb/testsuite/gdb.threads/watchthreads-reorder.exp
@@ -92,5 +92,17 @@ foreach reorder {0 1} { with_test_prefix "reorder$reorder" {
# found in the DEBUG_INFRUN code path.
gdb_test "set debug infrun 1"
- gdb_continue_to_breakpoint "break-at-exit" ".*break-at-exit.*"
+ set test "break-at-exit"
+ send_gdb "continue\n"
+ gdb_expect {
+ -re "Breakpoint .* (at|in) .* break-at-exit .*\r\n$gdb_prompt " {
+ pass $test
+ }
+ -re ".*$gdb_prompt $" {
+ fail $test
+ }
+ timeout {
+ fail "$test (timeout)"
+ }
+ }
}}
--
1.7.0.4
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH 07/14] Support in remote target.
2012-05-03 13:12 [PATCH v4 0/14] Run all-stop on non-stop target Yao Qi
` (9 preceding siblings ...)
2012-05-03 13:13 ` [PATCH 13/14] ia64-sigill.exp: Don't assume there's no infrun output after the prompt Yao Qi
@ 2012-05-03 13:13 ` Yao Qi
2012-05-03 13:13 ` [PATCH 06/14] Flip to set target-async on by default and NEWS Yao Qi
` (3 subsequent siblings)
14 siblings, 0 replies; 22+ messages in thread
From: Yao Qi @ 2012-05-03 13:13 UTC (permalink / raw)
To: gdb-patches
This patch is to support remote target.
gdb:
2012-04-12 Yao Qi <yao@codesourcery.com>
* remote.c (remote_is_non_stop_p): New.
(init_remote_ops): Install remote_is_non_stop_p.
(remote_add_inferior): Set tp->control.resumed to 1.
(add_current_inferior_and_thread): Likewise.
(extended_remote_attach_1): Likewise.
---
gdb/remote.c | 19 ++++++++++++++++---
1 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/gdb/remote.c b/gdb/remote.c
index 68864d1..6d58aca 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -1506,8 +1506,9 @@ remote_add_inferior (int fake_pid_p, int pid, int attached)
static void
remote_add_thread (ptid_t ptid, int running)
{
- add_thread (ptid);
+ struct thread_info *tp = add_thread (ptid);
+ tp->control.resumed = 1;
set_executing (ptid, running);
set_running (ptid, running);
}
@@ -3227,6 +3228,7 @@ add_current_inferior_and_thread (void)
struct remote_state *rs = get_remote_state ();
int fake_pid_p = 0;
ptid_t ptid;
+ struct thread_info *tp;
inferior_ptid = null_ptid;
@@ -3252,7 +3254,8 @@ add_current_inferior_and_thread (void)
remote_add_inferior (fake_pid_p, ptid_get_pid (inferior_ptid), -1);
/* Add the main thread. */
- add_thread_silent (inferior_ptid);
+ tp = add_thread_silent (inferior_ptid);
+ tp->control.resumed = 1;
}
static void
@@ -4441,11 +4444,14 @@ extended_remote_attach_1 (struct target_ops *target, char *args, int from_tty)
}
else
{
+ struct thread_info *tp;
+
/* Now, if we have thread information, update inferior_ptid. */
inferior_ptid = remote_current_thread (inferior_ptid);
/* Add the main thread to the thread list. */
- add_thread_silent (inferior_ptid);
+ tp = add_thread_silent (inferior_ptid);
+ tp->control.resumed = 1;
}
/* Next, if the target can specify a description, read it. We do
@@ -10900,6 +10906,12 @@ remote_can_use_agent (void)
return (remote_protocol_packets[PACKET_QAgent].support != PACKET_DISABLE);
}
+static int
+remote_is_non_stop_p (void)
+{
+ return non_stop;
+}
+
static void
init_remote_ops (void)
{
@@ -10965,6 +10977,7 @@ Specify the serial device it is connected to\n\
remote_ops.to_can_async_p = remote_can_async_p;
remote_ops.to_is_async_p = remote_is_async_p;
remote_ops.to_async = remote_async;
+ remote_ops.to_is_non_stop_p = remote_is_non_stop_p;
remote_ops.to_terminal_inferior = remote_terminal_inferior;
remote_ops.to_terminal_ours = remote_terminal_ours;
remote_ops.to_supports_non_stop = remote_supports_non_stop;
--
1.7.0.4
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH 12/14] manythreads.exp: Adjust to handle threads appearing/disappearing after "Program received signal SIGFOO"
2012-05-03 13:12 [PATCH v4 0/14] Run all-stop on non-stop target Yao Qi
` (4 preceding siblings ...)
2012-05-03 13:13 ` [PATCH 10/14] watchthreads-reorder.exp: Don't assume there is no infrun output after prompt Yao Qi
@ 2012-05-03 13:13 ` Yao Qi
2012-05-03 13:13 ` [PATCH 09/14] Set thread's state in infcall Yao Qi
` (8 subsequent siblings)
14 siblings, 0 replies; 22+ messages in thread
From: Yao Qi @ 2012-05-03 13:13 UTC (permalink / raw)
To: gdb-patches
From: Pedro Alves <pedro@codesourcery.com>
As infrun only decides to stop or not all threads after handling the
event the target reported, threads can now appear or disappear after
"Program received signal SIGFOO" and presenting the prompt, which
breaks the manythreads.exp test. This fixes it.
v2:
- "stop threads 1" test needed adjustment too.
gdb/testsuite/
2011-12-16 Pedro Alves <pedro@codesourcery.com>
* gdb.threads/manythreads.exp: Don't assume threads can't appear
or disappear after printing "Program received signal ".
---
gdb/testsuite/gdb.threads/manythreads.exp | 68 +++++++++++++++++++++++------
1 files changed, 54 insertions(+), 14 deletions(-)
diff --git a/gdb/testsuite/gdb.threads/manythreads.exp b/gdb/testsuite/gdb.threads/manythreads.exp
index 42333e6..83d1a9b 100644
--- a/gdb/testsuite/gdb.threads/manythreads.exp
+++ b/gdb/testsuite/gdb.threads/manythreads.exp
@@ -49,6 +49,22 @@ gdb_test_multiple "continue" "first continue" {
}
}
+
+# Note that in the tests below, we can't suffix the "Program received
+# signal SIGINT" regexes with $gdb_prompt, as doing so would mean that
+# e.g. with,
+#
+# Program received signal SIGINT, Interrupt.
+# [New Thread FOO]
+# [Switching to Thread BAR]
+# 0xdeadbeef in bar () from bar.so
+# (gdb)
+#
+# the [New ...] or [... exited] regexes would eat the "Program
+# received ..." bit. [New FOO] and [FOO exited] may appear while GDB
+# is stopping threads.
+
+
# Wait one second. This is better than the TCL "after" command, because
# we don't lose GDB's output while we do it.
remote_expect host 1 { timeout { } }
@@ -57,6 +73,17 @@ remote_expect host 1 { timeout { } }
send_gdb "\003"
set message "stop threads 1"
gdb_test_multiple "" "stop threads 1" {
+ -re "Program received signal SIGINT" {
+ # Eat the prompt.
+ gdb_expect {
+ -re "$gdb_prompt $" {
+ pass "$message"
+ }
+ timeout {
+ fail "$message (timeout)"
+ }
+ }
+ }
-re "\\\[New \[^\]\]*\\\]\r\n" {
exp_continue
}
@@ -66,9 +93,6 @@ gdb_test_multiple "" "stop threads 1" {
-re "Thread \[^\n\]* executing\r\n" {
exp_continue
}
- -re "Program received signal SIGINT.*$gdb_prompt $" {
- pass "$message"
- }
timeout {
fail "$message (timeout)"
}
@@ -111,6 +135,21 @@ gdb_test_multiple "continue" "second continue" {
# to handle duplicate SIGINTs sent to multiple threads.
set failed 0
remote_expect host 1 {
+ -re "Program received signal SIGINT" {
+
+ # Eat the prompt.
+ gdb_expect {
+ -re "$gdb_prompt $" {
+ }
+ }
+
+ if { $failed == 0 } {
+ fail "check for duplicate SIGINT"
+ }
+ send_gdb "continue\n"
+ set failed 1
+ exp_continue
+ }
-re "\\\[New \[^\]\]*\\\]\r\n" {
exp_continue -continue_timer
}
@@ -120,14 +159,6 @@ remote_expect host 1 {
-re "Thread \[^\n\]* executing\r\n" {
exp_continue -continue_timer
}
- -re "Program received signal SIGINT.*$gdb_prompt $" {
- if { $failed == 0 } {
- fail "check for duplicate SIGINT"
- }
- send_gdb "continue\n"
- set failed 1
- exp_continue
- }
timeout {
if { $failed == 0 } {
pass "check for duplicate SIGINT"
@@ -139,6 +170,18 @@ remote_expect host 1 {
send_gdb "\003"
set message "stop threads 2"
gdb_test_multiple "" "stop threads 2" {
+ -re "Program received signal SIGINT" {
+
+ # Eat the prompt.
+ gdb_expect {
+ -re "$gdb_prompt $" {
+ pass "$message"
+ }
+ timeout {
+ fail "$message (timeout)"
+ }
+ }
+ }
-re "\\\[New \[^\]\]*\\\]\r\n" {
exp_continue
}
@@ -148,9 +191,6 @@ gdb_test_multiple "" "stop threads 2" {
-re "Thread \[^\n\]* executing\r\n" {
exp_continue
}
- -re "Program received signal SIGINT.*$gdb_prompt $" {
- pass "$message"
- }
timeout {
fail "$message (timeout)"
}
--
1.7.0.4
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH 02/14] Move displaced_step_fixup bits out to displaced_step_next.
2012-05-03 13:12 [PATCH v4 0/14] Run all-stop on non-stop target Yao Qi
` (7 preceding siblings ...)
2012-05-03 13:13 ` [PATCH 14/14] kfail gdb/13858 Yao Qi
@ 2012-05-03 13:13 ` Yao Qi
2012-05-03 13:13 ` [PATCH 13/14] ia64-sigill.exp: Don't assume there's no infrun output after the prompt Yao Qi
` (5 subsequent siblings)
14 siblings, 0 replies; 22+ messages in thread
From: Yao Qi @ 2012-05-03 13:13 UTC (permalink / raw)
To: gdb-patches
It is a refactor patch. No functionality is changed.
gdb:
2012-04-12 Pedro Alves <pedro@codesourcery.com>
* infrun.c (displaced_step_fixup): Change return type to int. Factor out
bits into ...
(displaced_step_next): ... this.
(handle_inferior_event): Call displaced_step_next if displaced_step_fixup
returns non-zero.
---
gdb/infrun.c | 35 +++++++++++++++++++++++++++++------
1 files changed, 29 insertions(+), 6 deletions(-)
diff --git a/gdb/infrun.c b/gdb/infrun.c
index c3074d5..c58688c 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -1432,21 +1432,26 @@ displaced_step_restore (struct displaced_step_inferior_state *displaced,
displaced->step_copy));
}
-static void
+/* Fix up the resulting state after displaced stepping. Return 0 if
+ no event to process. Return 1 if instruction completes, otherwise
+ return -1. */
+
+static int
displaced_step_fixup (ptid_t event_ptid, enum target_signal signal)
{
struct cleanup *old_cleanups;
struct displaced_step_inferior_state *displaced
= get_displaced_stepping_state (ptid_get_pid (event_ptid));
+ int ret;
/* Was any thread of this process doing a displaced step? */
if (displaced == NULL)
- return;
+ return 0;
/* Was this event for the pid we displaced? */
if (ptid_equal (displaced->step_ptid, null_ptid)
|| ! ptid_equal (displaced->step_ptid, event_ptid))
- return;
+ return 0;
old_cleanups = make_cleanup (displaced_step_clear_cleanup, displaced);
@@ -1461,6 +1466,7 @@ displaced_step_fixup (ptid_t event_ptid, enum target_signal signal)
displaced->step_original,
displaced->step_copy,
get_thread_regcache (displaced->step_ptid));
+ ret = 1;
}
else
{
@@ -1471,12 +1477,27 @@ displaced_step_fixup (ptid_t event_ptid, enum target_signal signal)
pc = displaced->step_original + (pc - displaced->step_copy);
regcache_write_pc (regcache, pc);
+ ret = -1;
}
do_cleanups (old_cleanups);
displaced->step_ptid = null_ptid;
+ return ret;
+}
+
+/* Process pending displaced stepping requests. */
+
+static void
+displaced_step_next (ptid_t event_ptid)
+{
+ struct displaced_step_inferior_state *displaced
+ = get_displaced_stepping_state (ptid_get_pid (event_ptid));
+
+ if (displaced == NULL)
+ return;
+
/* Are there any pending displaced stepping requests? If so, run
one now. Leave the state object around, since we're likely to
need it again soon. */
@@ -3481,7 +3502,8 @@ handle_inferior_event (struct execution_control_state *ecs)
has been done. Perform cleanup for parent process here. Note
that this operation also cleans up the child process for vfork,
because their pages are shared. */
- displaced_step_fixup (ecs->ptid, TARGET_SIGNAL_TRAP);
+ if (displaced_step_fixup (ecs->ptid, TARGET_SIGNAL_TRAP))
+ displaced_step_next (ecs->ptid);
if (ecs->ws.kind == TARGET_WAITKIND_FORKED)
{
@@ -3743,8 +3765,9 @@ handle_inferior_event (struct execution_control_state *ecs)
/* Do we need to clean up the state of a thread that has
completed a displaced single-step? (Doing so usually affects
the PC, so do it here, before we set stop_pc.) */
- displaced_step_fixup (ecs->ptid,
- ecs->event_thread->suspend.stop_signal);
+ if (displaced_step_fixup (ecs->ptid,
+ ecs->event_thread->suspend.stop_signal))
+ displaced_step_next (ecs->ptid);
/* If we either finished a single-step or hit a breakpoint, but
the user wanted this thread to be stopped, pretend we got a
--
1.7.0.4
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH 06/14] Flip to set target-async on by default and NEWS.
2012-05-03 13:12 [PATCH v4 0/14] Run all-stop on non-stop target Yao Qi
` (10 preceding siblings ...)
2012-05-03 13:13 ` [PATCH 07/14] Support in remote target Yao Qi
@ 2012-05-03 13:13 ` Yao Qi
2012-05-03 13:13 ` [PATCH 11/14] Fix fails in gdb.trace/pending.exp Yao Qi
` (2 subsequent siblings)
14 siblings, 0 replies; 22+ messages in thread
From: Yao Qi @ 2012-05-03 13:13 UTC (permalink / raw)
To: gdb-patches
[RFC/WIP PATCH v2 01/12] Flip to set target-async on by default
http://sourceware.org/ml/gdb-patches/2011-12/msg00551.html
gdb:
2012-04-12 Pedro Alves <pedro@codesourcery.com>
* target.c: Set target-async on.
2012-04-12 Yao Qi <yao@codesourcery.com>
* NEWS: Use async mode in default.
---
gdb/NEWS | 2 ++
gdb/target.c | 4 ++--
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/gdb/NEWS b/gdb/NEWS
index 2762c09..30cef5d 100644
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -96,6 +96,8 @@
* GDB can now support 'breakpoint always-inserted mode' in 'record'
target.
+* GDB now defaults to async mode for targets that support it.
+
* New commands
** "catch load" and "catch unload" can be used to stop when a shared
diff --git a/gdb/target.c b/gdb/target.c
index aa386db..38906c2 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -4652,11 +4652,11 @@ maintenance_print_target_stack (char *cmd, int from_tty)
}
/* Controls if async mode is permitted. */
-int target_async_permitted = 0;
+int target_async_permitted = 1;
/* The set command writes to this variable. If the inferior is
executing, linux_nat_async_permitted is *not* updated. */
-static int target_async_permitted_1 = 0;
+static int target_async_permitted_1 = 1;
static void
set_maintenance_target_async_permitted (char *args, int from_tty,
--
1.7.0.4
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH 14/14] kfail gdb/13858
2012-05-03 13:12 [PATCH v4 0/14] Run all-stop on non-stop target Yao Qi
` (6 preceding siblings ...)
2012-05-03 13:13 ` [PATCH 09/14] Set thread's state in infcall Yao Qi
@ 2012-05-03 13:13 ` Yao Qi
2012-05-03 13:13 ` [PATCH 02/14] Move displaced_step_fixup bits out to displaced_step_next Yao Qi
` (6 subsequent siblings)
14 siblings, 0 replies; 22+ messages in thread
From: Yao Qi @ 2012-05-03 13:13 UTC (permalink / raw)
To: gdb-patches
When this series patches go in, displaced stepping is used even user
dones't turn it on. PR gdb/13858 is caused by displaced stepping.
KFAIL them first.
gdb/testsuite:
2012-04-12 Yao Qi <yao@codesourcery.com>
* gdb.base/break-interp.exp: kfail for gdb/13858.
---
gdb/testsuite/gdb.base/break-interp.exp | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/gdb/testsuite/gdb.base/break-interp.exp b/gdb/testsuite/gdb.base/break-interp.exp
index 1e47b34..addc9ea 100644
--- a/gdb/testsuite/gdb.base/break-interp.exp
+++ b/gdb/testsuite/gdb.base/break-interp.exp
@@ -170,6 +170,9 @@ proc reach_1 {func command displacement} {
fail $test
}
}
+ -re "Entry point address is not known\\..*\r\n$gdb_prompt $" {
+ kfail gdb/13858 $test
+ }
}
if ![regexp {^(NONE|FOUND-.*)$} $displacement] {
fail $test_displacement
@@ -461,6 +464,7 @@ proc test_ld {file ifmain trynosym displacement} {
}
if {$entrynohex != ""} {
gdb_test "break *0x$entrynohex" "" "break at entry point"
+ setup_kfail gdb/13858 *-*-*
gdb_test "continue" "\r\nBreakpoint \[0-9\]+, 0x0*$entrynohex in .*" "entry point reached"
}
} else {
--
1.7.0.4
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH 04/14] Run all-stop on non-stop
2012-05-03 13:12 [PATCH v4 0/14] Run all-stop on non-stop target Yao Qi
` (12 preceding siblings ...)
2012-05-03 13:13 ` [PATCH 11/14] Fix fails in gdb.trace/pending.exp Yao Qi
@ 2012-05-03 13:14 ` Yao Qi
2012-05-03 14:23 ` [PATCH v4 0/14] Run all-stop on non-stop target Pedro Alves
14 siblings, 0 replies; 22+ messages in thread
From: Yao Qi @ 2012-05-03 13:14 UTC (permalink / raw)
To: gdb-patches
This patch is mostly split from original V2,
[RFC/WIP PATCH v2 02/14] Implement all-stop on top of a target running non-stop mode
http://sourceware.org/ml/gdb-patches/2011-12/msg00564.html
except some minor fixes I pointed out in changelog entry.
gdb:
2012-04-12 Pedro Alves <pedro@codesourcery.com>
* breakpoint.c (breakpoints_always_inserted_mode): Check
target_is_non_stop_p instead of non_stop
(update_global_location_list): Ditto.
* infrun.c (use_displaced_stepping): Ditto.
(adjust_pc_after_break): Ditto.
(handle_inferior_event): Ditto.
(process_event_stop_test:): Ditto.
* linux-nat.c (get_pending_status): Ditto.
(linux_nat_detach): Ditto.
(linux_handle_extended_wait): Ditto.
(linux_nat_wait): Ditto.
(linux_nat_stop_lwp): Ditto.
* target.c (update_current_target): INHERIT and de_fault
to_is_non_stop_p.
(target_wait): Return TARGET_WAITKIND_NO_RESUMED by default.
* target.h (struct target_ops) <to_is_non_stop_p>: New field.
(target_is_non_stop_p): New.
* gdbthread.h (ALL_THREADS, ALL_LIVE_THREADS): New.
(struct thread_control_state): New field `resumed'.
(struct thread_suspend_state): New fields `waitstatus' and
`waitstatus_pending_p'.
* inf-ptrace.c (inf_ptrace_attach): Set the main thread's resumed
flag.
* infrun.c (displaced_step_next): Use do_target_resume.
(displaced_step_queued_p): New.
(do_target_resume): New.
(resume): Return early is the thread has a pending status. Resume
all threads if placed in the displaced stepping queue. Use
do_target_resume.
(print_target_wait_results): Print the whole ptid.
(do_target_wait): New.
(prepare_for_detach): Use do_target_wait.
(cancel_breakpoints): New.
(set_executing_from_state): Add the event thread to the thread list
if not already there. Stop all threads and select the event
thread.
(select_event_thread): New.
(wait_for_inferior): Use do_target_wait. Call
set_executing_from_state. Add the event thread to the thread list
if not already there. Stop all threads and select the event
thread.
(fetch_inferior_event): Ditto.
(wait_one): New.
(stop_all_threads): New.
(handle_inferior_event): Adjust to interface changes. Use
target_is_non_stop.
(stop_stepping): Stop all threads if necessary.
(keep_going): Stop all threads if starting a step-over.
(infrun_async_inferior_event_handler): New.
* linux-nat.c (linux_handle_extended_wait): Set the resumed flag of the
new lwp.
* thread.c (thread_list): Make extern.
(new_thread): Clear the suspend.waitstatus.kind field.
2012-04-12 Yao Qi <yao@codesourcery.com>
* infrun.c (stop_all_threads): s/infrun.c/infrun/ in debug log.
---
gdb/breakpoint.c | 4 +-
gdb/gdbthread.h | 22 ++
gdb/inf-ptrace.c | 4 +-
gdb/infrun.c | 828 +++++++++++++++++++++++++++++++++++++++++++++++++++---
gdb/linux-nat.c | 19 +-
gdb/target.c | 6 +-
gdb/target.h | 4 +
gdb/thread.c | 3 +-
8 files changed, 831 insertions(+), 59 deletions(-)
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index ab5f324..12a784e 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -409,7 +409,7 @@ int
breakpoints_always_inserted_mode (void)
{
return (always_inserted_mode == always_inserted_on
- || (always_inserted_mode == always_inserted_auto && non_stop));
+ || (always_inserted_mode == always_inserted_auto && target_is_non_stop_p ()));
}
static const char condition_evaluation_both[] = "host or target";
@@ -11782,7 +11782,7 @@ update_global_location_list (int should_insert)
if (!found_object)
{
- if (removed && non_stop
+ if (removed && target_is_non_stop_p ()
&& breakpoint_address_is_meaningful (old_loc->owner)
&& !is_hardware_watchpoint (old_loc->owner))
{
diff --git a/gdb/gdbthread.h b/gdb/gdbthread.h
index fb8de16..9600b1a 100644
--- a/gdb/gdbthread.h
+++ b/gdb/gdbthread.h
@@ -38,6 +38,15 @@ enum thread_state
THREAD_EXITED,
};
+#define ALL_THREADS(T) \
+ for ((T) = thread_list; (T); (T) = (T)->next)
+
+#define ALL_LIVE_THREADS(T) \
+ for ((T) = thread_list; (T); (T) = (T)->next) \
+ if ((T)->state != THREAD_EXITED)
+
+extern struct thread_info *thread_list;
+
/* Inferior thread specific part of `struct infcall_control_state'.
Inferior process counterpart is `struct inferior_control_state'. */
@@ -114,6 +123,14 @@ struct thread_control_state
/* Chain containing status of breakpoint(s) the thread stopped
at. */
bpstat stop_bpstat;
+
+ /* Non-zero if this thread will be/has been resumed. Note that a
+ thread can be marked both as stopped and resumed at the same
+ time. This happens if we try to resume a thread that has a wait
+ status pending. We shouldn't let the thread run until that wait
+ status has been processed, but we should not report that wait
+ status if GDB didn't try to let the thread run. */
+ int resumed;
};
/* Inferior thread specific part of `struct infcall_suspend_state'.
@@ -124,6 +141,11 @@ struct thread_suspend_state
{
/* Last signal that the inferior received (why it stopped). */
enum target_signal stop_signal;
+
+ /* The waitstatus for this thread's last event. */
+ struct target_waitstatus waitstatus;
+ /* If true WAITSTATUS hasn't been handled yet. */
+ int waitstatus_pending_p;
};
struct thread_info
diff --git a/gdb/inf-ptrace.c b/gdb/inf-ptrace.c
index fc8ab87..c059caa 100644
--- a/gdb/inf-ptrace.c
+++ b/gdb/inf-ptrace.c
@@ -193,6 +193,7 @@ inf_ptrace_attach (struct target_ops *ops, char *args, int from_tty)
char *exec_file;
pid_t pid;
struct inferior *inf;
+ struct thread_info *tp;
/* Do not change either targets above or the same target if already present.
The reason is the target stack is shared across multiple inferiors. */
@@ -242,7 +243,8 @@ inf_ptrace_attach (struct target_ops *ops, char *args, int from_tty)
/* Always add a main thread. If some target extends the ptrace
target, it should decorate the ptid later with more info. */
- add_thread_silent (inferior_ptid);
+ tp = add_thread_silent (inferior_ptid);
+ tp->control.resumed = 1;
if (! ops_already_pushed)
discard_cleanups (back_to);
diff --git a/gdb/infrun.c b/gdb/infrun.c
index 9de9674..b7afa39 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -57,6 +57,12 @@
#include "skip.h"
#include "probe.h"
#include "objfiles.h"
+#include "event-loop.h"
+
+/* Asynchronous signal handle registered as event loop source for
+ when we have pending events ready to be passed to the core. */
+
+static struct async_event_handler *infrun_async_inferior_event_token;
/* Prototypes for local functions */
@@ -1232,7 +1238,7 @@ static int
use_displaced_stepping (struct gdbarch *gdbarch)
{
return (((can_use_displaced_stepping == can_use_displaced_stepping_auto
- && non_stop)
+ && target_is_non_stop_p ())
|| can_use_displaced_stepping == can_use_displaced_stepping_on)
&& gdbarch_displaced_step_copy_insn_p (gdbarch)
&& !RECORD_IS_USED);
@@ -1487,6 +1493,8 @@ displaced_step_fixup (ptid_t event_ptid, enum target_signal signal)
return ret;
}
+static void do_target_resume (ptid_t ptid, int step, enum target_signal signo);
+
/* Process pending displaced stepping requests. */
static void
@@ -1509,6 +1517,7 @@ displaced_step_next (ptid_t event_ptid)
struct gdbarch *gdbarch;
CORE_ADDR actual_pc;
struct address_space *aspace;
+ struct thread_info *tp;
head = displaced->step_request_queue;
ptid = head->ptid;
@@ -1521,6 +1530,11 @@ displaced_step_next (ptid_t event_ptid)
actual_pc = regcache_read_pc (regcache);
aspace = get_regcache_aspace (regcache);
+ tp = inferior_thread ();
+
+ gdb_assert (!tp->control.resumed);
+ gdb_assert (!tp->executing);
+
if (breakpoint_here_p (aspace, actual_pc))
{
if (debug_displaced)
@@ -1545,9 +1559,9 @@ displaced_step_next (ptid_t event_ptid)
if (gdbarch_displaced_step_hw_singlestep (gdbarch,
displaced->step_closure))
- target_resume (ptid, 1, TARGET_SIGNAL_0);
+ do_target_resume (ptid, 1, TARGET_SIGNAL_0);
else
- target_resume (ptid, 0, TARGET_SIGNAL_0);
+ do_target_resume (ptid, 0, TARGET_SIGNAL_0);
/* Done, we're stepping a thread. */
break;
@@ -1569,7 +1583,7 @@ displaced_step_next (ptid_t event_ptid)
"displaced: breakpoint is gone: %s, step(%d)\n",
target_pid_to_str (tp->ptid), step);
- target_resume (ptid, step, TARGET_SIGNAL_0);
+ do_target_resume (ptid, step, TARGET_SIGNAL_0);
tp->suspend.stop_signal = TARGET_SIGNAL_0;
/* This request was discarded. See if there's any other
@@ -1717,6 +1731,214 @@ user_visible_resume_ptid (int step)
return resume_ptid;
}
+/* Return 1 if displaced stepping to thread PTID has been queued. */
+
+static int
+displaced_step_queued_p (ptid_t ptid)
+{
+ struct displaced_step_inferior_state *displaced
+ = get_displaced_stepping_state (ptid_get_pid (ptid));
+ struct displaced_step_request *head;
+
+ if (displaced != NULL)
+ for (head = displaced->step_request_queue; head != NULL; head = head->next)
+ if (ptid_equal (head->ptid, ptid))
+ return 1;
+
+ return 0;
+}
+
+static void
+do_target_resume (ptid_t ptid, int step, enum target_signal signo)
+{
+ int resume_many;
+ struct thread_info *tp;
+ struct regcache *regcache = get_current_regcache ();
+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
+ int want_all_signals;
+ int can_wildcard;
+ int any_to_resume;
+ ptid_t leader_ptid = inferior_ptid;
+
+ /* A specific PTID means `step only this process id'. */
+ resume_many = (ptid_equal (minus_one_ptid, ptid)
+ || ptid_is_pid (ptid));
+
+ /* See if it's the current inferior that should be handled
+ specially. */
+ if (resume_many)
+ tp = find_thread_ptid (inferior_ptid);
+ else
+ tp = find_thread_ptid (ptid);
+ gdb_assert (tp != NULL);
+ gdb_assert (tp->state != THREAD_EXITED);
+
+ /* Advise target which signals may be handled silently. If we have
+ removed breakpoints because we are stepping over one (which can
+ happen only if we are not using displaced stepping), we need to
+ receive all signals to avoid accidentally skipping a breakpoint
+ during execution of a signal handler. */
+ want_all_signals = ((step || singlestep_breakpoints_inserted_p)
+ && tp->control.trap_expected
+ && !use_displaced_stepping (gdbarch));
+ if (want_all_signals)
+ target_pass_signals (0, NULL);
+ else
+ target_pass_signals ((int) TARGET_SIGNAL_LAST, signal_pass);
+
+ can_wildcard = 1;
+
+ ALL_LIVE_THREADS (tp)
+ {
+ if (ptid_match (tp->ptid, ptid))
+ {
+ if (tp->executing)
+ {
+ if (debug_infrun)
+ fprintf_unfiltered (gdb_stdlog,
+ "infrun: do_target_resume: executing\n");
+
+ /* Need to prevent wildcard; the target may want to read
+ PC for example. And, we may have set EXECUTING
+ temporarily true, while the thread really isn't
+ executing, which would mean it's not safe to assume
+ the target ignores this thread. */
+ can_wildcard = 0;
+ continue;
+ }
+
+ if (displaced_step_queued_p (tp->ptid))
+ {
+ if (debug_infrun)
+ fprintf_unfiltered (gdb_stdlog,
+ "infrun: do_target_resume: queued for displaced step\n");
+ can_wildcard = 0;
+ continue;
+ }
+
+ /* Avoid confusing the next resume, if the next stop/resume
+ happens to apply to another thread. */
+ tp->suspend.stop_signal = TARGET_SIGNAL_0;
+ tp->control.resumed = 1;
+
+ if (tp->suspend.waitstatus_pending_p)
+ {
+ /* FIXME: What should we do if we are supposed to
+ continue this thread with a signal? */
+ gdb_assert (signo == TARGET_SIGNAL_0);
+
+ if (!step
+ && tp->suspend.waitstatus.kind == TARGET_WAITKIND_STOPPED
+ && !want_all_signals
+ && signal_pass[signo])
+ {
+ if (debug_infrun)
+ {
+ char *statstr;
+
+ statstr = target_waitstatus_to_string (&tp->suspend.waitstatus);
+ fprintf_unfiltered (gdb_stdlog,
+ "infrun: Not short circuiting for ignored "
+ "status %s\n",
+ statstr);
+ xfree (statstr);
+ }
+
+ signo = tp->suspend.waitstatus.value.sig;
+ tp->suspend.waitstatus_pending_p = 0;
+ }
+ else
+ {
+ can_wildcard = 0;
+
+ if (target_can_async_p ())
+ {
+ target_async (inferior_event_handler, 0);
+
+ /* Tell the event loop we have something to
+ process. */
+ mark_async_event_handler (infrun_async_inferior_event_token);
+ }
+ return; /// XXX why?
+ }
+ }
+
+ if (!tp->suspend.waitstatus_pending_p)
+ any_to_resume = 1;
+ }
+ }
+
+ if (can_wildcard)
+ {
+ if (debug_infrun)
+ fprintf_unfiltered (gdb_stdlog,
+ "infrun: managed a wildcard target_resume\n");
+ target_resume (ptid, step, signo);
+ }
+ else
+ {
+ if (debug_infrun)
+ fprintf_unfiltered (gdb_stdlog,
+ "infrun: resuming threads individually\n");
+ ALL_LIVE_THREADS (tp)
+ {
+ if (ptid_match (tp->ptid, ptid))
+ {
+ if (tp->executing)
+ {
+ if (debug_infrun)
+ fprintf_unfiltered (gdb_stdlog,
+ "infrun: Not resuming %s (executing)\n",
+ target_pid_to_str (tp->ptid));
+ }
+ else if (displaced_step_queued_p (tp->ptid))
+ {
+ if (debug_infrun)
+ fprintf_unfiltered (gdb_stdlog,
+ "infrun: Not resuming %s (queued for displaced step)\n",
+ target_pid_to_str (tp->ptid));
+ }
+ else if (!tp->suspend.waitstatus_pending_p)
+ {
+ if (debug_infrun)
+ fprintf_unfiltered (gdb_stdlog,
+ "infrun: resuming %s (no pending status)\n",
+ target_pid_to_str (tp->ptid));
+ switch_to_thread (tp->ptid);
+
+ if (ptid_equal (tp->ptid, leader_ptid))
+ target_resume (tp->ptid, step, signo);
+ else
+ target_resume (tp->ptid, 0, TARGET_SIGNAL_0);
+ }
+ else
+ {
+ if (debug_infrun)
+ {
+ char *statstr;
+
+ statstr = target_waitstatus_to_string (&tp->suspend.waitstatus);
+ fprintf_unfiltered (gdb_stdlog,
+ "infrun: not resuming %s, has pending status %s\n",
+ target_pid_to_str (tp->ptid), statstr);
+ xfree (statstr);
+ }
+ }
+ }
+ }
+
+ set_running (ptid, 1);
+ clear_inline_frame_state (ptid);
+ }
+
+ if (target_can_async_p ())
+ {
+ target_async (inferior_event_handler, 0);
+ /* Tell the event loop we have something to process. */
+ mark_async_event_handler (infrun_async_inferior_event_token);
+ }
+}
+
/* Resume the inferior, but allow a QUIT. This is useful if the user
wants to interrupt some lengthy single-stepping operation
(for child processes, the SIGINT goes to the inferior, and so
@@ -1738,6 +1960,26 @@ resume (int step, enum target_signal sig)
QUIT;
+ if (tp->suspend.waitstatus_pending_p)
+ {
+ /* Avoid confusing the next resume, if the next stop/resume
+ happens to apply to another thread. */
+ tp->suspend.stop_signal = TARGET_SIGNAL_0;
+ tp->control.resumed = 1;
+
+ set_running (inferior_ptid, 1);
+ clear_inline_frame_state (inferior_ptid);
+ discard_cleanups (old_cleanups);
+
+ if (target_can_async_p ())
+ {
+ target_async (inferior_event_handler, 0);
+ /* Tell the event loop we have something to process. */
+ mark_async_event_handler (infrun_async_inferior_event_token);
+ }
+ return;
+ }
+
if (current_inferior ()->waiting_for_vfork_done)
{
/* Don't try to single-step a vfork parent that is waiting for
@@ -1801,14 +2043,34 @@ a command like `return' or `jump' to continue execution."));
if (!displaced_step_prepare (inferior_ptid))
{
+ ptid_t resume_ptid;
+
+ if (debug_infrun)
+ fprintf_unfiltered (gdb_stdlog,
+ "Got placed in displaced stepping queue\n");
+
/* Got placed in displaced stepping queue. Will be resumed
later when all the currently queued displaced stepping
requests finish. The thread is not executing at this point,
and the call to set_executing will be made later. But we
need to call set_running here, since from frontend point of view,
the thread is running. */
+
+ tp->suspend.stop_signal = TARGET_SIGNAL_0;
set_running (inferior_ptid, 1);
+ clear_inline_frame_state (inferior_ptid);
discard_cleanups (old_cleanups);
+
+ resume_ptid = user_visible_resume_ptid (step);
+
+ gdb_assert (!tp->control.resumed);
+
+ /* Resume others. */
+ tp->executing = 1;
+ do_target_resume (resume_ptid, 0, TARGET_SIGNAL_0);
+ tp->executing = 0;
+
+ gdb_assert (!tp->control.resumed);
return;
}
@@ -1944,23 +2206,7 @@ a command like `return' or `jump' to continue execution."));
/* Install inferior's terminal modes. */
target_terminal_inferior ();
- /* Avoid confusing the next resume, if the next stop/resume
- happens to apply to another thread. */
- tp->suspend.stop_signal = TARGET_SIGNAL_0;
-
- /* Advise target which signals may be handled silently. If we have
- removed breakpoints because we are stepping over one (which can
- happen only if we are not using displaced stepping), we need to
- receive all signals to avoid accidentally skipping a breakpoint
- during execution of a signal handler. */
- if ((step || singlestep_breakpoints_inserted_p)
- && tp->control.trap_expected
- && !use_displaced_stepping (gdbarch))
- target_pass_signals (0, NULL);
- else
- target_pass_signals ((int) TARGET_SIGNAL_LAST, signal_pass);
-
- target_resume (resume_ptid, step, sig);
+ do_target_resume (resume_ptid, step, sig);
}
discard_cleanups (old_cleanups);
@@ -1974,6 +2220,15 @@ a command like `return' or `jump' to continue execution."));
static void
clear_proceed_status_thread (struct thread_info *tp)
{
+ if (tp->state == THREAD_RUNNING)
+ {
+ if (debug_infrun)
+ fprintf_unfiltered (gdb_stdlog,
+ "infrun: clear_proceed_status_thread (%s): ignored, thread is running\n",
+ target_pid_to_str (tp->ptid));
+ return;
+ }
+
if (debug_infrun)
fprintf_unfiltered (gdb_stdlog,
"infrun: clear_proceed_status_thread (%s)\n",
@@ -2602,14 +2857,20 @@ print_target_wait_results (ptid_t waiton_ptid, ptid_t result_ptid,
is set. */
fprintf_unfiltered (tmp_stream,
- "infrun: target_wait (%d", PIDGET (waiton_ptid));
+ "infrun: target_wait (%d.%ld.%ld",
+ ptid_get_pid (waiton_ptid),
+ ptid_get_lwp (waiton_ptid),
+ ptid_get_tid (waiton_ptid));
if (PIDGET (waiton_ptid) != -1)
fprintf_unfiltered (tmp_stream,
" [%s]", target_pid_to_str (waiton_ptid));
fprintf_unfiltered (tmp_stream, ", status) =\n");
fprintf_unfiltered (tmp_stream,
- "infrun: %d [%s],\n",
- PIDGET (result_ptid), target_pid_to_str (result_ptid));
+ "infrun: %d.%ld.%ld [%s],\n",
+ ptid_get_pid (result_ptid),
+ ptid_get_lwp (result_ptid),
+ ptid_get_tid (result_ptid),
+ target_pid_to_str (result_ptid));
fprintf_unfiltered (tmp_stream,
"infrun: %s\n",
status_string);
@@ -2625,6 +2886,88 @@ print_target_wait_results (ptid_t waiton_ptid, ptid_t result_ptid,
ui_file_delete (tmp_stream);
}
+static ptid_t
+do_target_wait (ptid_t ptid, struct target_waitstatus *status, int options)
+{
+ ptid_t event_ptid;
+ struct thread_info *tp;
+
+ /* First check if there is a thread with a wait status pending. */
+ if (ptid_equal (ptid, minus_one_ptid) || ptid_is_pid (ptid))
+ {
+ ALL_LIVE_THREADS (tp)
+ {
+ /* Only report a pending wait status if we pretend that this
+ has indeed been resumed. */
+ if (ptid_match (tp->ptid, ptid)
+ && tp->control.resumed
+ && tp->suspend.waitstatus_pending_p)
+ {
+ gdb_assert (!tp->executing);
+ break;
+ }
+ }
+ }
+ else
+ {
+ if (debug_infrun)
+ fprintf_unfiltered (gdb_stdlog,
+ "infrun: Waiting for specific thread %s.\n",
+ target_pid_to_str (ptid));
+
+ /* We have a specific thread to check. */
+ tp = find_thread_ptid (ptid);
+ gdb_assert (tp);
+ if (!tp->suspend.waitstatus_pending_p)
+ tp = NULL;
+ }
+
+ if (tp)
+ {
+ if (debug_infrun)
+ {
+ char *statstr;
+
+ statstr = target_waitstatus_to_string (&tp->suspend.waitstatus);
+ fprintf_unfiltered (gdb_stdlog,
+ "infrun: Using pending wait status %s for %s.\n",
+ statstr,
+ target_pid_to_str (tp->ptid));
+ xfree (statstr);
+ }
+
+ *status = tp->suspend.waitstatus;
+ tp->suspend.waitstatus_pending_p = 0;
+ return tp->ptid;
+ }
+
+ /* But if we don't find one, we'll have to wait. */
+
+ if (deprecated_target_wait_hook)
+ event_ptid = deprecated_target_wait_hook (ptid, status, options);
+ else
+ event_ptid = target_wait (ptid, status, options);
+
+ if (status->kind != TARGET_WAITKIND_EXITED
+ && status->kind != TARGET_WAITKIND_SIGNALLED
+ /* If a thread not the main thread execl's, we'll see the event
+ happening on the main thread, even if it was stopped. It's
+ as if the pre-exec thread changes its thread id (well, it
+ really is that way on the Linux kernel). */
+ && status->kind != TARGET_WAITKIND_EXECD
+ && status->kind != TARGET_WAITKIND_IGNORE)
+ {
+ tp = find_thread_ptid (event_ptid);
+ if (tp)
+ {
+ gdb_assert (tp->control.resumed);
+ tp->suspend.waitstatus = *status;
+ }
+ }
+
+ return event_ptid;
+}
+
/* Prepare and stabilize the inferior for detaching it. E.g.,
detaching while a thread is displaced stepping is a recipe for
crashing it, as nothing would readjust the PC out of the scratch
@@ -2663,10 +3006,7 @@ prepare_for_detach (void)
overlay_cache_invalid = 1;
- if (deprecated_target_wait_hook)
- ecs->ptid = deprecated_target_wait_hook (pid_ptid, &ecs->ws, 0);
- else
- ecs->ptid = target_wait (pid_ptid, &ecs->ws, 0);
+ ecs->ptid = do_target_wait (pid_ptid, &ecs->ws, 0);
if (debug_infrun)
print_target_wait_results (pid_ptid, ecs->ptid, &ecs->ws);
@@ -2704,6 +3044,189 @@ prepare_for_detach (void)
discard_cleanups (old_chain_1);
}
+static void stop_all_threads (void);
+static int adjust_pc_after_break (struct thread_info *thread,
+ struct target_waitstatus *ws);
+
+static void
+cancel_breakpoints (void)
+{
+ struct thread_info *t;
+
+ /* Cancel any breakpoints in other threads that have hit a
+ breakpoint. If we do not do this, then we run the risk that the
+ user will delete or disable the breakpoint, but the thread will
+ have already tripped on it. */
+ ALL_LIVE_THREADS (t)
+ if (t->control.resumed
+ && t->suspend.waitstatus_pending_p)
+ {
+ if (adjust_pc_after_break (t, &t->suspend.waitstatus))
+ {
+ /* Throw away the trap. The thread will re-trap if
+ re-resumed and the breakpoint is still
+ installed. */
+ t->suspend.waitstatus_pending_p = 0;
+ t->suspend.waitstatus.kind = TARGET_WAITKIND_IGNORE;
+
+ /* Need to call displaced_step_fixup here too, for SSS
+ targets? */
+ }
+ else if (t->suspend.waitstatus.kind == TARGET_WAITKIND_STOPPED
+ && displaced_step_fixup (t->ptid,
+ t->suspend.waitstatus.value.sig) > 0)
+ {
+ /* Throw away the trap. */
+ t->suspend.waitstatus_pending_p = 0;
+ t->suspend.waitstatus.kind = TARGET_WAITKIND_IGNORE;
+ }
+ else if (t->suspend.waitstatus.kind == TARGET_WAITKIND_STOPPED
+ && t->suspend.waitstatus.value.sig == TARGET_SIGNAL_TRAP
+ && currently_stepping (t))
+ {
+ /* Throw away the step trap. */
+ t->suspend.waitstatus_pending_p = 0;
+ t->suspend.waitstatus.kind = TARGET_WAITKIND_IGNORE;
+ }
+ }
+}
+
+static void
+set_executing_from_state (struct execution_control_state *ecs)
+{
+ if (ecs->ws.kind == TARGET_WAITKIND_IGNORE
+ || ecs->ws.kind == TARGET_WAITKIND_NO_RESUMED)
+ ;
+ else if (ecs->ws.kind == TARGET_WAITKIND_SIGNALLED
+ || ecs->ws.kind == TARGET_WAITKIND_EXITED)
+ {
+ int exited_pid = ptid_get_pid (ecs->ptid);
+ struct thread_info *t;
+
+ ALL_THREADS (t)
+ if (ptid_get_pid (t->ptid) == exited_pid)
+ t->executing = 0;
+ }
+ else
+ set_executing (ecs->ptid, 0);
+}
+
+int stop_only_if_needed = 1;
+
+static void
+select_event_thread (struct execution_control_state *ecs)
+{
+ if (!non_stop && target_is_non_stop_p () && !stop_only_if_needed)
+ {
+ stop_all_threads ();
+
+ if (ecs->ws.kind != TARGET_WAITKIND_NO_RESUMED
+ && ecs->ws.kind != TARGET_WAITKIND_EXITED
+ && ecs->ws.kind != TARGET_WAITKIND_SIGNALLED
+ && (ptid_equal (waiton_ptid, minus_one_ptid)
+ || ptid_is_pid (waiton_ptid)))
+ {
+ /* If we're not waiting for a specific thread, choose an
+ event thread from among those that have had events.
+ Giving equal priority to all threads that have had events
+ helps prevent starvation. */
+
+ int num_events = 0;
+ int random_selector;
+ struct thread_info *event_tp;
+
+ ecs->event_thread = find_thread_ptid (ecs->ptid);
+ /* Record the wait status for the original thread. */
+ ecs->event_thread->suspend.waitstatus = ecs->ws;
+
+ /* Give preference to any thread that is being
+ single-stepped. */
+ ALL_LIVE_THREADS (event_tp)
+ if (ptid_match (event_tp->ptid, waiton_ptid)
+ && event_tp->control.resumed
+ && event_tp->suspend.waitstatus_pending_p
+ && currently_stepping (event_tp))
+ break;
+
+ if (event_tp != NULL)
+ {
+ if (debug_infrun)
+ fprintf_unfiltered (gdb_stdlog,
+ "infrun: Select single-step %s\n",
+ target_pid_to_str (event_tp->ptid));
+ }
+ else
+ {
+ /* No single-stepping thread. Select one at random,
+ out of those which have had events.
+
+ First see how many events we have. Count only
+ resumed threads that have an event pending. */
+ ALL_LIVE_THREADS (event_tp)
+ if (ptid_match (event_tp->ptid, waiton_ptid)
+ && event_tp->control.resumed
+ && event_tp->suspend.waitstatus_pending_p)
+ num_events++;
+
+ /* Now randomly pick a LWP out of those that have had a SIGTRAP. */
+ random_selector = (int)
+ ((num_events * (double) rand ()) / (RAND_MAX + 1.0));
+
+ if (debug_infrun && num_events > 1)
+ fprintf_unfiltered (gdb_stdlog,
+ "infrun: Found %d events, selecting #%d\n",
+ num_events, random_selector);
+
+ /* Select the Nth thread that has had an event. */
+ ALL_LIVE_THREADS (event_tp)
+ if (ptid_match (event_tp->ptid, waiton_ptid)
+ && event_tp->control.resumed
+ && event_tp->suspend.waitstatus_pending_p)
+ if (random_selector-- == 0)
+ break;
+ }
+
+ if (event_tp != NULL)
+ {
+ /* Switch the event thread. */
+ ecs->ptid = event_tp->ptid;
+ ecs->event_thread = event_tp;
+ ecs->ws = event_tp->suspend.waitstatus;
+ }
+
+ /* Flush the wait status for the event thread. */
+ ecs->event_thread->suspend.waitstatus_pending_p = 0;
+ }
+
+ {
+ struct thread_info *t;
+
+ /* Now that we've selected our final event thread, cancel
+ any breakpoints in other threads that have hit a
+ breakpoint. If we do not do this, then we run the risk
+ that the user will delete or disable the breakpoint,
+ but the thread will have already tripped on it. */
+ cancel_breakpoints ();
+
+ /* In all-stop, from the core's perspective, all threads
+ are now stopped until a new resume action is sent
+ over. */
+ ALL_LIVE_THREADS (t)
+ t->control.resumed = 0;
+ }
+ }
+ else
+ {
+ if (ecs->ws.kind != TARGET_WAITKIND_NO_RESUMED
+ && ecs->ws.kind != TARGET_WAITKIND_EXITED
+ && ecs->ws.kind != TARGET_WAITKIND_SIGNALLED)
+ {
+ ecs->event_thread = find_thread_ptid (ecs->ptid);
+ ecs->event_thread->control.resumed = 0;
+ }
+ }
+}
+
/* Wait for control to return from inferior to debugger.
If inferior gets a signal, we may decide to start it up again
@@ -2734,19 +3257,26 @@ wait_for_inferior (void)
overlay_cache_invalid = 1;
- if (deprecated_target_wait_hook)
- ecs->ptid = deprecated_target_wait_hook (waiton_ptid, &ecs->ws, 0);
- else
- ecs->ptid = target_wait (waiton_ptid, &ecs->ws, 0);
+ ecs->ptid = do_target_wait (waiton_ptid, &ecs->ws, 0);
if (debug_infrun)
print_target_wait_results (waiton_ptid, ecs->ptid, &ecs->ws);
+ set_executing_from_state (ecs);
+
/* If an error happens while handling the event, propagate GDB's
knowledge of the executing state to the frontend/user running
state. */
old_chain = make_cleanup (finish_thread_state_cleanup, &minus_one_ptid);
+ if (ecs->ws.kind != TARGET_WAITKIND_EXITED
+ && ecs->ws.kind != TARGET_WAITKIND_SIGNALLED
+ && ecs->ws.kind != TARGET_WAITKIND_NO_RESUMED
+ && !in_thread_list (ecs->ptid))
+ add_thread (ecs->ptid);
+
+ select_event_thread (ecs);
+
/* Now figure out what to do with the result of the result. */
handle_inferior_event (ecs);
@@ -2803,15 +3333,23 @@ fetch_inferior_event (void *client_data)
make_cleanup_restore_integer (&execution_direction);
execution_direction = target_execution_direction ();
- if (deprecated_target_wait_hook)
- ecs->ptid =
- deprecated_target_wait_hook (waiton_ptid, &ecs->ws, TARGET_WNOHANG);
- else
- ecs->ptid = target_wait (waiton_ptid, &ecs->ws, TARGET_WNOHANG);
+ ecs->ptid = do_target_wait (waiton_ptid, &ecs->ws, TARGET_WNOHANG);
if (debug_infrun)
print_target_wait_results (waiton_ptid, ecs->ptid, &ecs->ws);
+ if (ecs->ws.kind != TARGET_WAITKIND_EXITED
+ && ecs->ws.kind != TARGET_WAITKIND_SIGNALLED
+ && ecs->ws.kind != TARGET_WAITKIND_IGNORE
+ && ecs->ws.kind != TARGET_WAITKIND_NO_RESUMED
+ && !in_thread_list (ecs->ptid))
+ add_thread (ecs->ptid);
+
+ set_executing_from_state (ecs);
+
+ if (ecs->ws.kind != TARGET_WAITKIND_IGNORE)
+ select_event_thread (ecs);
+
if (non_stop
&& ecs->ws.kind != TARGET_WAITKIND_IGNORE
&& ecs->ws.kind != TARGET_WAITKIND_NO_RESUMED
@@ -3029,7 +3567,8 @@ adjust_pc_after_break (struct thread_info *thread,
SIGTRAPs, we keep a list of such breakpoint locations for a bit,
and retire them after a number of stop events are reported. */
if (software_breakpoint_inserted_here_p (aspace, breakpoint_pc)
- || (non_stop && moribund_breakpoint_here_p (aspace, breakpoint_pc)))
+ || (target_is_non_stop_p ()
+ && moribund_breakpoint_here_p (aspace, breakpoint_pc)))
{
struct cleanup *old_cleanups = NULL;
@@ -3184,6 +3723,165 @@ fill_in_stop_func (struct gdbarch *gdbarch,
}
}
+static ptid_t
+wait_one (ptid_t wait_ptid, struct target_waitstatus *ws)
+{
+ struct cleanup *old_chain;
+ ptid_t event_ptid;
+
+ /* We have to invalidate the registers BEFORE calling target_wait
+ because they can be loaded from the target while in target_wait.
+ This makes remote debugging a bit more efficient for those
+ targets that provide critical registers as part of their normal
+ status mechanism. */
+
+ overlay_cache_invalid = 1;
+ registers_changed ();
+
+ if (deprecated_target_wait_hook)
+ event_ptid = deprecated_target_wait_hook (wait_ptid, ws, 0);
+ else
+ event_ptid = target_wait (wait_ptid, ws, 0);
+
+ if (debug_infrun)
+ print_target_wait_results (wait_ptid, event_ptid, ws);
+
+ if (ws->kind == TARGET_WAITKIND_SYSCALL_ENTRY
+ || ws->kind == TARGET_WAITKIND_SYSCALL_RETURN)
+ ws->value.syscall_number = UNKNOWN_SYSCALL;
+
+ return event_ptid;
+}
+
+static void
+stop_all_threads (void)
+{
+ /* We may need multiple passes to discover all threads. */
+ int pass;
+ int iterations = 0;
+
+ if (debug_infrun)
+ fprintf_unfiltered (gdb_stdlog, "infrun: stop_all_threads\n");
+
+ /* Stop threads in two passes since threads could be spawning as we
+ go through the first pass. In the second pass, we will stop such
+ spawned threads. */
+ for (pass = 0; pass < 2; pass++, iterations++)
+ {
+ if (debug_infrun)
+ fprintf_unfiltered (gdb_stdlog,
+ "infrun: stop_all_threads, pass=%d, iterations=%d\n",
+ pass, iterations);
+ while (1)
+ {
+ ptid_t event_ptid;
+ struct target_waitstatus ws;
+ int need_wait = 0;
+ struct thread_info *t = NULL;
+
+ update_thread_list ();
+
+ /* Go through all threads looking for threads that we need
+ to tell the target to stop. */
+ ALL_LIVE_THREADS (t)
+ {
+ if (t->executing)
+ {
+ /* If already stopping, don't request a stop again.
+ We just haven't seen the notification yet. */
+ if (!t->stop_requested)
+ {
+ if (debug_infrun)
+ fprintf_unfiltered (gdb_stdlog,
+ "infrun: %s executing, need stop\n",
+ target_pid_to_str (t->ptid));
+ target_stop (t->ptid);
+ t->stop_requested = 1;
+ }
+ else
+ {
+ if (debug_infrun)
+ fprintf_unfiltered (gdb_stdlog,
+ "infrun: %s executing, already stopping\n",
+ target_pid_to_str (t->ptid));
+ }
+
+ /* FIXME: original: if (t->stop_requested) */
+ need_wait = 1;
+ }
+ else
+ {
+ if (debug_infrun)
+ fprintf_unfiltered (gdb_stdlog,
+ "infrun: %s not executing\n",
+ target_pid_to_str (t->ptid));
+ }
+ }
+
+ if (!need_wait)
+ break;
+
+ /* If we find new threads on the second iteration, restart
+ over. We want to see two iterations in a row with all
+ threads stopped. */
+ if (pass > 0)
+ pass = -1;
+
+ event_ptid = wait_one (minus_one_ptid, &ws);
+ if (ws.kind == TARGET_WAITKIND_NO_RESUMED)
+ /* All resumed threads exited. */
+ ;
+ else if (ws.kind == TARGET_WAITKIND_EXITED
+ || ws.kind == TARGET_WAITKIND_SIGNALLED)
+ warning (_("exited while stopping threads\n"));
+ else
+ {
+ if (!in_thread_list (event_ptid))
+ t = add_thread (event_ptid);
+ else
+ t = find_thread_ptid (event_ptid);
+
+ t->stop_requested = 0;
+ t->executing = 0;
+
+ if (ws.kind == TARGET_WAITKIND_STOPPED && ws.value.sig == TARGET_SIGNAL_0)
+ {
+ /* We caught the event that we intended to catch, so
+ there's no event pending. */
+ t->suspend.waitstatus.kind = TARGET_WAITKIND_IGNORE;
+ t->suspend.waitstatus_pending_p = 0;
+ }
+ else
+ {
+ if (debug_infrun)
+ {
+ char *statstr;
+
+ statstr = target_waitstatus_to_string (&ws);
+ fprintf_unfiltered (gdb_stdlog,
+ "infrun: target_wait %s, saving "
+ "status for %d.%ld.%ld\n",
+ statstr,
+ ptid_get_pid (t->ptid),
+ ptid_get_lwp (t->ptid),
+ ptid_get_tid (t->ptid));
+ xfree (statstr);
+ }
+
+ /* Record for later. */
+ t->suspend.waitstatus = ws;
+ t->suspend.waitstatus_pending_p = 1;
+ }
+
+ set_running (event_ptid, 0);
+ }
+ }
+ }
+
+ if (debug_infrun)
+ fprintf_unfiltered (gdb_stdlog, "infrun: stop_all_threads done\n");
+}
+
/* Given an execution control state that has been freshly filled in
by an event from the inferior, figure out what it means and take
appropriate action. */
@@ -3314,7 +4012,7 @@ handle_inferior_event (struct execution_control_state *ecs)
we're handling a process exit in non-stop mode, there's nothing
to do, as threads of the dead process are gone, and threads of
any other process were left running. */
- if (!non_stop)
+ if (!non_stop && !(target_is_non_stop_p () && stop_only_if_needed))
set_executing (minus_one_ptid, 0);
else if (ecs->ws.kind != TARGET_WAITKIND_SIGNALLED
&& ecs->ws.kind != TARGET_WAITKIND_EXITED)
@@ -3748,7 +4446,7 @@ handle_inferior_event (struct execution_control_state *ecs)
if (ecs->new_thread_event)
{
- if (non_stop)
+ if (target_is_non_stop_p ())
/* Non-stop assumes that the target handles adding new threads
to the thread list. */
internal_error (__FILE__, __LINE__,
@@ -4656,7 +5354,7 @@ process_event_stop_test:
/* In all-stop mode, if we're currently stepping but have stopped in
some other thread, we need to switch back to the stepped thread. */
- if (!non_stop)
+ if (!target_is_non_stop_p ())
{
struct thread_info *tp;
@@ -5697,6 +6395,23 @@ stop_stepping (struct execution_control_state *ecs)
/* Let callers know we don't want to wait for the inferior anymore. */
ecs->wait_some_more = 0;
+
+ if (!non_stop
+ && target_is_non_stop_p ()
+ && stop_only_if_needed)
+ {
+ struct thread_info *t;
+
+ stop_all_threads ();
+
+ cancel_breakpoints ();
+
+ /* In all-stop, from the core's perspective, all threads
+ are now stopped until a new resume action is sent
+ over. */
+ ALL_LIVE_THREADS (t)
+ t->control.resumed = 0;
+ }
}
/* This function handles various cases where we need to continue
@@ -5748,10 +6463,23 @@ keep_going (struct execution_control_state *ecs)
struct regcache *thread_regcache = get_thread_regcache (ecs->ptid);
if (!use_displaced_stepping (get_regcache_arch (thread_regcache)))
- /* Since we can't do a displaced step, we have to remove
- the breakpoint while we step it. To keep things
- simple, we remove them all. */
- remove_breakpoints ();
+ {
+ struct thread_info *t;
+
+ /* Since we can't do a displaced step, we have to remove
+ the breakpoint while we step it. To keep things
+ simple, we remove them all. */
+ stop_all_threads ();
+
+ cancel_breakpoints ();
+ /* In all-stop, from the core's perspective, all threads
+ are now stopped until a new resume action is sent
+ over. */
+ ALL_LIVE_THREADS (t)
+ t->control.resumed = 0;
+
+ remove_breakpoints ();
+ }
}
else
{
@@ -7122,12 +7850,22 @@ static const struct internalvar_funcs siginfo_funcs =
NULL
};
+static void
+infrun_async_inferior_event_handler (gdb_client_data data)
+{
+ inferior_event_handler (INF_REG_EVENT, NULL);
+}
+
void
_initialize_infrun (void)
{
int i;
int numsigs;
+ /* Register extra event sources in the event loop. */
+ infrun_async_inferior_event_token
+ = create_async_event_handler (infrun_async_inferior_event_handler, NULL);
+
add_info ("signals", signals_info, _("\
What debugger does when program gets various signals.\n\
Specify a signal as argument to print info on that signal only."));
diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
index ac1a0ea..a96a73c 100644
--- a/gdb/linux-nat.c
+++ b/gdb/linux-nat.c
@@ -1732,13 +1732,13 @@ get_pending_status (struct lwp_info *lp, int *status)
signo = TARGET_SIGNAL_0; /* a pending ptrace event, not a real signal. */
else if (lp->status)
signo = target_signal_from_host (WSTOPSIG (lp->status));
- else if (non_stop && !is_executing (lp->ptid))
+ else if (target_is_non_stop_p () && !is_executing (lp->ptid))
{
struct thread_info *tp = find_thread_ptid (lp->ptid);
signo = tp->suspend.stop_signal;
}
- else if (!non_stop)
+ else if (!target_is_non_stop_p ())
{
struct target_waitstatus last;
ptid_t last_ptid;
@@ -1890,7 +1890,7 @@ linux_nat_detach (struct target_ops *ops, char *args, int from_tty)
available. */
linux_fork_detach (args, from_tty);
- if (non_stop && target_can_async_p ())
+ if (target_is_non_stop_p () && target_can_async_p ())
target_async (inferior_event_handler, 0);
}
else
@@ -2368,7 +2368,7 @@ linux_handle_extended_wait (struct lwp_info *lp, int status,
status = 0;
}
- if (non_stop)
+ if (target_is_non_stop_p ())
{
/* Add the new thread to GDB's lists as soon as possible
so that:
@@ -2392,6 +2392,7 @@ linux_handle_extended_wait (struct lwp_info *lp, int status,
{
set_running (new_lp->ptid, 1);
set_executing (new_lp->ptid, 1);
+ find_thread_ptid (new_lp->ptid)->control.resumed = 1;
/* thread_db_attach_lwp -> lin_lwp_attach_lwp forced
resume_stop. */
new_lp->last_resume_kind = resume_continue;
@@ -3734,7 +3735,7 @@ retry:
core before this one is handled. All-stop
always cancels breakpoint hits in all
threads. */
- if (non_stop
+ if (target_is_non_stop_p ()
&& linux_nat_lp_status_is_event (lp)
&& cancel_breakpoint (lp))
{
@@ -3893,7 +3894,7 @@ retry:
goto retry;
}
- if (!non_stop)
+ if (!target_is_non_stop_p ())
{
/* Only do the below in all-stop, as we currently use SIGINT
to implement target_stop (see linux_nat_stop) in
@@ -3921,7 +3922,7 @@ retry:
fprintf_unfiltered (gdb_stdlog, "LLW: Candidate event %s in %s.\n",
status_to_str (status), target_pid_to_str (lp->ptid));
- if (!non_stop)
+ if (!target_is_non_stop_p ())
{
/* Now stop all other LWP's ... */
iterate_over_lwps (minus_one_ptid, stop_callback, NULL);
@@ -4068,7 +4069,7 @@ linux_nat_wait (struct target_ops *ops,
specific_process, for example, see linux_nat_wait_1), and
meanwhile the event became uninteresting. Don't bother resuming
LWPs we're not going to wait for if they'd stop immediately. */
- if (non_stop)
+ if (target_is_non_stop_p ())
iterate_over_lwps (minus_one_ptid, resume_stopped_resumed_lwps, &ptid);
event_ptid = linux_nat_wait_1 (ops, ptid, ourstatus, target_options);
@@ -5133,7 +5134,7 @@ linux_nat_stop_lwp (struct lwp_info *lwp, void *data)
static void
linux_nat_stop (ptid_t ptid)
{
- if (non_stop)
+ if (target_is_non_stop_p ())
iterate_over_lwps (ptid, linux_nat_stop_lwp, NULL);
else
linux_ops->to_stop (ptid);
diff --git a/gdb/target.c b/gdb/target.c
index cffea2c..aa386db 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -660,6 +660,8 @@ update_current_target (void)
INHERIT (to_can_async_p, t);
INHERIT (to_is_async_p, t);
INHERIT (to_async, t);
+ /* Do not inherit to_supports_non_stop. */
+ INHERIT (to_is_non_stop_p, t);
INHERIT (to_find_memory_regions, t);
INHERIT (to_make_corefile_notes, t);
INHERIT (to_get_bookmark, t);
@@ -940,6 +942,7 @@ update_current_target (void)
(int (*) (void))
return_zero);
de_fault (to_execution_direction, default_execution_direction);
+ de_fault (to_is_non_stop_p, return_zero);
#undef de_fault
@@ -2639,7 +2642,8 @@ target_wait (ptid_t ptid, struct target_waitstatus *status, int options)
}
}
- noprocess ();
+ status->kind = TARGET_WAITKIND_NO_RESUMED;
+ return minus_one_ptid;
}
char *
diff --git a/gdb/target.h b/gdb/target.h
index 50a0ea6..6148665 100644
--- a/gdb/target.h
+++ b/gdb/target.h
@@ -538,6 +538,7 @@ struct target_ops
int (*to_is_async_p) (void);
void (*to_async) (void (*) (enum inferior_event_type, void *), void *);
int (*to_supports_non_stop) (void);
+ int (*to_is_non_stop_p) (void);
/* find_memory_regions support method for gcore */
int (*to_find_memory_regions) (find_memory_region_ftype func, void *data);
/* make_corefile_notes support method for gcore */
@@ -1370,6 +1371,9 @@ extern int target_async_permitted;
int target_supports_non_stop (void);
+/* Is the target in non-stop mode? */
+#define target_is_non_stop_p() (current_target.to_is_non_stop_p ())
+
/* Put the target in async mode with the specified callback function. */
#define target_async(CALLBACK,CONTEXT) \
(current_target.to_async ((CALLBACK), (CONTEXT)))
diff --git a/gdb/thread.c b/gdb/thread.c
index d361dd8..4ad226d 100644
--- a/gdb/thread.c
+++ b/gdb/thread.c
@@ -54,7 +54,7 @@ void _initialize_thread (void);
/* Prototypes for local functions. */
-static struct thread_info *thread_list = NULL;
+struct thread_info *thread_list = NULL;
static int highest_thread_num;
static void thread_command (char *tidstr, int from_tty);
@@ -173,6 +173,7 @@ new_thread (ptid_t ptid)
/* Nothing to follow yet. */
tp->pending_follow.kind = TARGET_WAITKIND_SPURIOUS;
tp->state = THREAD_STOPPED;
+ tp->suspend.waitstatus.kind = TARGET_WAITKIND_IGNORE;
return tp;
}
--
1.7.0.4
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH v4 0/14] Run all-stop on non-stop target
2012-05-03 13:12 [PATCH v4 0/14] Run all-stop on non-stop target Yao Qi
` (13 preceding siblings ...)
2012-05-03 13:14 ` [PATCH 04/14] Run all-stop on non-stop Yao Qi
@ 2012-05-03 14:23 ` Pedro Alves
2012-05-03 14:38 ` Yao Qi
14 siblings, 1 reply; 22+ messages in thread
From: Pedro Alves @ 2012-05-03 14:23 UTC (permalink / raw)
To: Yao Qi; +Cc: gdb-patches
I'm looking at the existing async issues now. We can't just kfail known
async issues and then propose flipping async on by default. That's cheating. ;-)
--
Pedro Alves
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH v4 0/14] Run all-stop on non-stop target
2012-05-03 14:23 ` [PATCH v4 0/14] Run all-stop on non-stop target Pedro Alves
@ 2012-05-03 14:38 ` Yao Qi
2012-05-09 17:46 ` Pedro Alves
0 siblings, 1 reply; 22+ messages in thread
From: Yao Qi @ 2012-05-03 14:38 UTC (permalink / raw)
To: Pedro Alves; +Cc: gdb-patches
On 05/03/2012 10:22 PM, Pedro Alves wrote:
> I'm looking at the existing async issues now. We can't just kfail known
> async issues and then propose flipping async on by default. That's cheating. ;-)
Oh, we should. I tried to fix them, but made no progress after two
days. So I kfail them and post patches first :). Pedro, thanks for
looking at them.
--
Yao (é½å°§)
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH 01/14] Fix displaced stepping debug log.
2012-05-03 13:12 ` [PATCH 01/14] Fix displaced stepping debug log Yao Qi
@ 2012-05-03 15:01 ` Pedro Alves
0 siblings, 0 replies; 22+ messages in thread
From: Pedro Alves @ 2012-05-03 15:01 UTC (permalink / raw)
To: Yao Qi; +Cc: gdb-patches
On 05/03/2012 02:14 PM, Yao Qi wrote:
> gdb:
>
> 2012-04-12 Pedro Alves <pedro@codesourcery.com>
>
> * infrun.c (displaced_step_fixup): Add prefix "displaced:" in debug
> log.
This one's pretty independent and obvious. I've put it in.
> ---
> gdb/infrun.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/gdb/infrun.c b/gdb/infrun.c
> index ab51806..c3074d5 100644
> --- a/gdb/infrun.c
> +++ b/gdb/infrun.c
> @@ -1545,7 +1545,7 @@ displaced_step_fixup (ptid_t event_ptid, enum target_signal signal)
>
> if (debug_displaced)
> fprintf_unfiltered (gdb_stdlog,
> - "breakpoint is gone %s: step(%d)\n",
> + "displaced: breakpoint is gone: %s, step(%d)\n",
> target_pid_to_str (tp->ptid), step);
>
> target_resume (ptid, step, TARGET_SIGNAL_0);
--
Pedro Alves
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH v4 0/14] Run all-stop on non-stop target
2012-05-03 14:38 ` Yao Qi
@ 2012-05-09 17:46 ` Pedro Alves
2012-05-10 12:09 ` Yao Qi
0 siblings, 1 reply; 22+ messages in thread
From: Pedro Alves @ 2012-05-09 17:46 UTC (permalink / raw)
To: Yao Qi; +Cc: gdb-patches
On 05/03/2012 03:40 PM, Yao Qi wrote:
> On 05/03/2012 10:22 PM, Pedro Alves wrote:
>> I'm looking at the existing async issues now. We can't just kfail known
>> async issues and then propose flipping async on by default. That's cheating. ;-)
>
> Oh, we should. I tried to fix them, but made no progress after two
> days. So I kfail them and post patches first :). Pedro, thanks for
> looking at them.
Well, it takes me days to understand and fix these issues myself
too. ;-) It's just the nature of the beast...
I see this in sync vs async:
PASS: gdb.python/py-finish-breakpoint.exp: set FinishBreakpoint with default frame value
PASS: gdb.python/py-finish-breakpoint.exp: set FinishBreakpoint
PASS: gdb.python/py-finish-breakpoint.exp: check return_value at init
-PASS: gdb.python/py-finish-breakpoint.exp: check MyFinishBreakpoint hit
-PASS: gdb.python/py-finish-breakpoint.exp: check return_value
-PASS: gdb.python/py-finish-breakpoint.exp: check finishBP on default frame has been hit
-PASS: gdb.python/py-finish-breakpoint.exp: ensure that finish bp is invalid afer normal hit
-PASS: gdb.python/py-finish-breakpoint.exp: return to main()
-PASS: gdb.python/py-finish-breakpoint.exp: check FinishBP not allowed in main
+FAIL: gdb.python/py-finish-breakpoint.exp: check MyFinishBreakpoint hit (GDB internal error)
+ERROR: Could not resync from internal error (timeout)
+UNRESOLVED: gdb.python/py-finish-breakpoint.exp: check return_value (timeout)
+ERROR: Process no longer exists
+UNRESOLVED: gdb.python/py-finish-breakpoint.exp: check finishBP on default frame has been hit
+ERROR: Couldn't send python print finishbp.is_valid() to GDB.
+UNRESOLVED: gdb.python/py-finish-breakpoint.exp: ensure that finish bp is invalid afer normal hit
+ERROR: Couldn't send finish to GDB.
+UNRESOLVED: gdb.python/py-finish-breakpoint.exp: return to main()
+ERROR: Couldn't send python MyFinishBreakpoint (None, gdb.selected_frame ()) to GDB.
+UNRESOLVED: gdb.python/py-finish-breakpoint.exp: check FinishBP not allowed in main
Do you see it too?
I looked at this a couple months ago, but didn't make much progress. I'll try to
figure it out next.
--
Pedro Alves
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH v4 0/14] Run all-stop on non-stop target
2012-05-09 17:46 ` Pedro Alves
@ 2012-05-10 12:09 ` Yao Qi
2012-05-10 14:21 ` Pedro Alves
0 siblings, 1 reply; 22+ messages in thread
From: Yao Qi @ 2012-05-10 12:09 UTC (permalink / raw)
To: Pedro Alves; +Cc: gdb-patches
On 05/10/2012 01:46 AM, Pedro Alves wrote:
> I see this in sync vs async:
>
> PASS: gdb.python/py-finish-breakpoint.exp: set FinishBreakpoint with default frame value
> PASS: gdb.python/py-finish-breakpoint.exp: set FinishBreakpoint
> PASS: gdb.python/py-finish-breakpoint.exp: check return_value at init
> -PASS: gdb.python/py-finish-breakpoint.exp: check MyFinishBreakpoint hit
> -PASS: gdb.python/py-finish-breakpoint.exp: check return_value
> -PASS: gdb.python/py-finish-breakpoint.exp: check finishBP on default frame has been hit
> -PASS: gdb.python/py-finish-breakpoint.exp: ensure that finish bp is invalid afer normal hit
> -PASS: gdb.python/py-finish-breakpoint.exp: return to main()
> -PASS: gdb.python/py-finish-breakpoint.exp: check FinishBP not allowed in main
> +FAIL: gdb.python/py-finish-breakpoint.exp: check MyFinishBreakpoint hit (GDB internal error)
> +ERROR: Could not resync from internal error (timeout)
> +UNRESOLVED: gdb.python/py-finish-breakpoint.exp: check return_value (timeout)
> +ERROR: Process no longer exists
> +UNRESOLVED: gdb.python/py-finish-breakpoint.exp: check finishBP on default frame has been hit
> +ERROR: Couldn't send python print finishbp.is_valid() to GDB.
> +UNRESOLVED: gdb.python/py-finish-breakpoint.exp: ensure that finish bp is invalid afer normal hit
> +ERROR: Couldn't send finish to GDB.
> +UNRESOLVED: gdb.python/py-finish-breakpoint.exp: return to main()
> +ERROR: Couldn't send python MyFinishBreakpoint (None, gdb.selected_frame ()) to GDB.
> +UNRESOLVED: gdb.python/py-finish-breakpoint.exp: check FinishBP not allowed in main
>
> Do you see it too?
>
Yes, I saw them as well on both native gdb and remote. This is the last
set problems of on async.
> I looked at this a couple months ago, but didn't make much progress. I'll try to
> figure it out next.
Thanks for looking at these issues, Pedro.
--
Yao (é½å°§)
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH v4 0/14] Run all-stop on non-stop target
2012-05-10 12:09 ` Yao Qi
@ 2012-05-10 14:21 ` Pedro Alves
2012-05-26 11:08 ` Yao Qi
0 siblings, 1 reply; 22+ messages in thread
From: Pedro Alves @ 2012-05-10 14:21 UTC (permalink / raw)
To: Yao Qi; +Cc: gdb-patches
On 05/10/2012 01:08 PM, Yao Qi wrote:
> Yes, I saw them as well on both native gdb and remote. This is the last
> set problems of on async.
There were PRs filed recently too. PR13869 at least.
--
Pedro Alves
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH v4 0/14] Run all-stop on non-stop target
2012-05-10 14:21 ` Pedro Alves
@ 2012-05-26 11:08 ` Yao Qi
0 siblings, 0 replies; 22+ messages in thread
From: Yao Qi @ 2012-05-26 11:08 UTC (permalink / raw)
To: Pedro Alves; +Cc: gdb-patches
On 05/10/2012 10:21 PM, Pedro Alves wrote:
> On 05/10/2012 01:08 PM, Yao Qi wrote:
>
>> Yes, I saw them as well on both native gdb and remote. This is the last
>> set problems of on async.
>
>
> There were PRs filed recently too. PR13869 at least.
>
Are you suggesting that this patch series can't go in until these
async-related PR are fixed? I browsed bugzilla, and there are 27 bugs
related on async. I tried to fix one or two, and find it is not a small
piece of work.
Can we let this series go in without setting target-async on in default?
If it is OK, I'll rebase my tree to latest CVS trunk, and post patches
again.
Then, we can push ITSET related code into CVS gradually, and fix async
bugs in parallel. ITSET is a great feature, and very competitive. I'd
like to put it into GDB as soon as possible, and let users to have a try
earlier.
--
Yao (é½å°§)
^ permalink raw reply [flat|nested] 22+ messages in thread
end of thread, other threads:[~2012-05-26 11:08 UTC | newest]
Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-03 13:12 [PATCH v4 0/14] Run all-stop on non-stop target Yao Qi
2012-05-03 13:12 ` [PATCH 03/14] Change parameters of adjust_pc_after_break Yao Qi
2012-05-03 13:12 ` [PATCH 01/14] Fix displaced stepping debug log Yao Qi
2012-05-03 15:01 ` Pedro Alves
2012-05-03 13:13 ` [PATCH 08/14] Uninstall infrun_async_inferior_event token in remote target Yao Qi
2012-05-03 13:13 ` [PATCH 05/14] Support in linux-nat target Yao Qi
2012-05-03 13:13 ` [PATCH 10/14] watchthreads-reorder.exp: Don't assume there is no infrun output after prompt Yao Qi
2012-05-03 13:13 ` [PATCH 12/14] manythreads.exp: Adjust to handle threads appearing/disappearing after "Program received signal SIGFOO" Yao Qi
2012-05-03 13:13 ` [PATCH 09/14] Set thread's state in infcall Yao Qi
2012-05-03 13:13 ` [PATCH 14/14] kfail gdb/13858 Yao Qi
2012-05-03 13:13 ` [PATCH 02/14] Move displaced_step_fixup bits out to displaced_step_next Yao Qi
2012-05-03 13:13 ` [PATCH 13/14] ia64-sigill.exp: Don't assume there's no infrun output after the prompt Yao Qi
2012-05-03 13:13 ` [PATCH 07/14] Support in remote target Yao Qi
2012-05-03 13:13 ` [PATCH 06/14] Flip to set target-async on by default and NEWS Yao Qi
2012-05-03 13:13 ` [PATCH 11/14] Fix fails in gdb.trace/pending.exp Yao Qi
2012-05-03 13:14 ` [PATCH 04/14] Run all-stop on non-stop Yao Qi
2012-05-03 14:23 ` [PATCH v4 0/14] Run all-stop on non-stop target Pedro Alves
2012-05-03 14:38 ` Yao Qi
2012-05-09 17:46 ` Pedro Alves
2012-05-10 12:09 ` Yao Qi
2012-05-10 14:21 ` Pedro Alves
2012-05-26 11:08 ` Yao Qi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox