diff options
author | Pedro Alves <palves@redhat.com> | 2011-05-20 16:31:31 +0000 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2011-05-20 16:31:31 +0000 |
commit | 09cee04be9e51b992fd835e7fa671d3b65448a6b (patch) | |
tree | fe2d3c07280753606639cd25a9d182906b5ff68f /gdb/infrun.c | |
parent | 751b8ce122ef06e9bd673542e7876f44dcd0165c (diff) | |
download | gdb-09cee04be9e51b992fd835e7fa671d3b65448a6b.zip gdb-09cee04be9e51b992fd835e7fa671d3b65448a6b.tar.gz gdb-09cee04be9e51b992fd835e7fa671d3b65448a6b.tar.bz2 |
2011-05-20 Pedro Alves <pedro@codesourcery.com>
gdb/
* infcmd.c: Include "inf-loop.h".
(step_once): When stepping into an inline subroutine, pretend the
target has run. If the target can async, switch the inferior
event loop to INF_EXEC_COMPLETE.
* inferior.h (user_visible_resume_ptid): Declare.
* infrun.c (user_visible_resume_ptid): New function, factored out
from `resume'.
(resume): Use it.
* mi/mi-main.c (mi_execute_async_cli_command): Remove assertion
that the current thread is running. Merge async and sync
branches.
Diffstat (limited to 'gdb/infrun.c')
-rw-r--r-- | gdb/infrun.c | 62 |
1 files changed, 40 insertions, 22 deletions
diff --git a/gdb/infrun.c b/gdb/infrun.c index 8d6910d..7b9245c 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -1601,6 +1601,45 @@ maybe_software_singlestep (struct gdbarch *gdbarch, CORE_ADDR pc) return hw_step; } +/* Return a ptid representing the set of threads that we will proceed, + in the perspective of the user/frontend. We may actually resume + fewer threads at first, e.g., if a thread is stopped at a + breakpoint that needs stepping-off, but that should be visible to + the user/frontend, and neither should the frontend/user be allowed + to proceed any of the threads that happen to be stopped at for + internal run control handling, if a previous command wanted them + resumed. */ + +ptid_t +user_visible_resume_ptid (int step) +{ + /* By default, resume all threads of all processes. */ + ptid_t resume_ptid = RESUME_ALL; + + /* Maybe resume only all threads of the current process. */ + if (!sched_multi && target_supports_multi_process ()) + { + resume_ptid = pid_to_ptid (ptid_get_pid (inferior_ptid)); + } + + /* Maybe resume a single thread after all. */ + if (non_stop) + { + /* With non-stop mode on, threads are always handled + individually. */ + resume_ptid = inferior_ptid; + } + else if ((scheduler_mode == schedlock_on) + || (scheduler_mode == schedlock_step + && (step || singlestep_breakpoints_inserted_p))) + { + /* User-settable 'scheduler' mode requires solo thread resume. */ + resume_ptid = inferior_ptid; + } + + return resume_ptid; +} + /* 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 @@ -1762,15 +1801,7 @@ a command like `return' or `jump' to continue execution.")); /* Decide the set of threads to ask the target to resume. Start by assuming everything will be resumed, than narrow the set by applying increasingly restricting conditions. */ - - /* By default, resume all threads of all processes. */ - resume_ptid = RESUME_ALL; - - /* Maybe resume only all threads of the current process. */ - if (!sched_multi && target_supports_multi_process ()) - { - resume_ptid = pid_to_ptid (ptid_get_pid (inferior_ptid)); - } + resume_ptid = user_visible_resume_ptid (step); /* Maybe resume a single thread after all. */ if (singlestep_breakpoints_inserted_p @@ -1804,19 +1835,6 @@ a command like `return' or `jump' to continue execution.")); breakpoint, not just the one at PC. */ resume_ptid = inferior_ptid; } - else if (non_stop) - { - /* With non-stop mode on, threads are always handled - individually. */ - resume_ptid = inferior_ptid; - } - else if ((scheduler_mode == schedlock_on) - || (scheduler_mode == schedlock_step - && (step || singlestep_breakpoints_inserted_p))) - { - /* User-settable 'scheduler' mode requires solo thread resume. */ - resume_ptid = inferior_ptid; - } if (gdbarch_cannot_step_breakpoint (gdbarch)) { |