diff options
author | Simon Marchi <simon.marchi@polymtl.ca> | 2021-02-03 14:36:54 -0500 |
---|---|---|
committer | Simon Marchi <simon.marchi@polymtl.ca> | 2021-02-03 14:37:27 -0500 |
commit | 72d383bb08c3d09f77921e2b3f52569116bbf41e (patch) | |
tree | 7c8e2be4fb433c88fcf3056863cab09e91744a4d | |
parent | 61ecbbae8eb1d161316380ca0175912f414725ce (diff) | |
download | gdb-72d383bb08c3d09f77921e2b3f52569116bbf41e.zip gdb-72d383bb08c3d09f77921e2b3f52569116bbf41e.tar.gz gdb-72d383bb08c3d09f77921e2b3f52569116bbf41e.tar.bz2 |
gdb: infrun: move stop_soon variable to inner scoped in handle_inferior_event
Moving it to an inner scope makes it clearer where it's used (only while
handling the TARGET_WAITKIND_LOADED event).
gdb/ChangeLog:
* infrun.c (handle_inferior_event): Move stop_soon variable to
inner scope.
Change-Id: Ic57685a21714cfbb38f1487ee96cea1d12b44652
-rw-r--r-- | gdb/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/infrun.c | 132 |
2 files changed, 71 insertions, 66 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 4a02a64..4ac326b 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2021-02-03 Simon Marchi <simon.marchi@polymtl.ca> + + * infrun.c (handle_inferior_event): Move stop_soon variable to + inner scope. + 2021-02-03 Pedro Alves <pedro@palves.net> * infcmd.c (detach_command): Hold strong reference to target, and diff --git a/gdb/infrun.c b/gdb/infrun.c index f2abfe4..6ec269a 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -5023,8 +5023,6 @@ handle_inferior_event (struct execution_control_state *ecs) end. */ scoped_value_mark free_values; - enum stop_kind stop_soon; - infrun_debug_printf ("%s", target_waitstatus_to_string (&ecs->ws).c_str ()); if (ecs->ws.kind == TARGET_WAITKIND_IGNORE) @@ -5118,80 +5116,82 @@ handle_inferior_event (struct execution_control_state *ecs) switch (ecs->ws.kind) { case TARGET_WAITKIND_LOADED: - context_switch (ecs); - /* Ignore gracefully during startup of the inferior, as it might - be the shell which has just loaded some objects, otherwise - add the symbols for the newly loaded objects. Also ignore at - the beginning of an attach or remote session; we will query - the full list of libraries once the connection is - established. */ - - stop_soon = get_inferior_stop_soon (ecs); - if (stop_soon == NO_STOP_QUIETLY) - { - struct regcache *regcache; - - regcache = get_thread_regcache (ecs->event_thread); + { + context_switch (ecs); + /* Ignore gracefully during startup of the inferior, as it might + be the shell which has just loaded some objects, otherwise + add the symbols for the newly loaded objects. Also ignore at + the beginning of an attach or remote session; we will query + the full list of libraries once the connection is + established. */ + + stop_kind stop_soon = get_inferior_stop_soon (ecs); + if (stop_soon == NO_STOP_QUIETLY) + { + struct regcache *regcache; - handle_solib_event (); + regcache = get_thread_regcache (ecs->event_thread); - ecs->event_thread->control.stop_bpstat - = bpstat_stop_status (regcache->aspace (), - ecs->event_thread->suspend.stop_pc, - ecs->event_thread, &ecs->ws); + handle_solib_event (); - if (handle_stop_requested (ecs)) - return; + ecs->event_thread->control.stop_bpstat + = bpstat_stop_status (regcache->aspace (), + ecs->event_thread->suspend.stop_pc, + ecs->event_thread, &ecs->ws); - if (bpstat_causes_stop (ecs->event_thread->control.stop_bpstat)) - { - /* A catchpoint triggered. */ - process_event_stop_test (ecs); + if (handle_stop_requested (ecs)) return; - } - /* If requested, stop when the dynamic linker notifies - gdb of events. This allows the user to get control - and place breakpoints in initializer routines for - dynamically loaded objects (among other things). */ - ecs->event_thread->suspend.stop_signal = GDB_SIGNAL_0; - if (stop_on_solib_events) - { - /* Make sure we print "Stopped due to solib-event" in - normal_stop. */ - stop_print_frame = true; + if (bpstat_causes_stop (ecs->event_thread->control.stop_bpstat)) + { + /* A catchpoint triggered. */ + process_event_stop_test (ecs); + return; + } - stop_waiting (ecs); - return; - } - } + /* If requested, stop when the dynamic linker notifies + gdb of events. This allows the user to get control + and place breakpoints in initializer routines for + dynamically loaded objects (among other things). */ + ecs->event_thread->suspend.stop_signal = GDB_SIGNAL_0; + if (stop_on_solib_events) + { + /* Make sure we print "Stopped due to solib-event" in + normal_stop. */ + stop_print_frame = true; - /* If we are skipping through a shell, or through shared library - loading that we aren't interested in, resume the program. If - we're running the program normally, also resume. */ - if (stop_soon == STOP_QUIETLY || stop_soon == NO_STOP_QUIETLY) - { - /* Loading of shared libraries might have changed breakpoint - addresses. Make sure new breakpoints are inserted. */ - if (stop_soon == NO_STOP_QUIETLY) - insert_breakpoints (); - resume (GDB_SIGNAL_0); - prepare_to_wait (ecs); - return; - } + stop_waiting (ecs); + return; + } + } - /* But stop if we're attaching or setting up a remote - connection. */ - if (stop_soon == STOP_QUIETLY_NO_SIGSTOP - || stop_soon == STOP_QUIETLY_REMOTE) - { - infrun_debug_printf ("quietly stopped"); - stop_waiting (ecs); - return; - } + /* If we are skipping through a shell, or through shared library + loading that we aren't interested in, resume the program. If + we're running the program normally, also resume. */ + if (stop_soon == STOP_QUIETLY || stop_soon == NO_STOP_QUIETLY) + { + /* Loading of shared libraries might have changed breakpoint + addresses. Make sure new breakpoints are inserted. */ + if (stop_soon == NO_STOP_QUIETLY) + insert_breakpoints (); + resume (GDB_SIGNAL_0); + prepare_to_wait (ecs); + return; + } - internal_error (__FILE__, __LINE__, - _("unhandled stop_soon: %d"), (int) stop_soon); + /* But stop if we're attaching or setting up a remote + connection. */ + if (stop_soon == STOP_QUIETLY_NO_SIGSTOP + || stop_soon == STOP_QUIETLY_REMOTE) + { + infrun_debug_printf ("quietly stopped"); + stop_waiting (ecs); + return; + } + + internal_error (__FILE__, __LINE__, + _("unhandled stop_soon: %d"), (int) stop_soon); + } case TARGET_WAITKIND_SPURIOUS: if (handle_stop_requested (ecs)) |