aboutsummaryrefslogtreecommitdiff
path: root/gdb/infrun.h
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@polymtl.ca>2020-03-06 18:04:52 -0500
committerSimon Marchi <simon.marchi@efficios.com>2020-03-06 18:30:37 -0500
commit29734269a7d1f2909814ff9c518c295c9640d6f5 (patch)
treebd97651fa4027721737d72eddff2ae0be8978883 /gdb/infrun.h
parentb7d64b29094ef58448c9b41bcde299fad2976237 (diff)
downloadfsf-binutils-gdb-29734269a7d1f2909814ff9c518c295c9640d6f5.zip
fsf-binutils-gdb-29734269a7d1f2909814ff9c518c295c9640d6f5.tar.gz
fsf-binutils-gdb-29734269a7d1f2909814ff9c518c295c9640d6f5.tar.bz2
Pass thread_info pointer to various inferior control functions
[ Migrating this from Gerrit: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/321 ] I noticed that some functions in infcmd and infrun call each other and all call inferior_thread, while they could just get the thread_info pointer from their caller. That means less calls to inferior_thread, so less reliance on global state, since inferior_thread reads inferior_ptid. The paths I am unsure about are: - fetch_inferior_event calls... - step_command_fsm::should_stop calls... - prepare_one_step and - process_event_stop_test calls... - set_step_info Before this patch, prepare_one_step gets the thread pointer using inferior_thread. After this patch, it gets it from the execution_control_state structure in fetch_inferior_event. Are we sure that the thread from the execution_control_state structure is the same as the one inferior_thread would return? This code path is used when a thread completes a step, but the user had specified a step count (e.g. "step 5") so we decide to do one more step. It would be strange (and even a bug I suppose) if the thread in the ecs structure in fetch_inferior_event was not the same thread that is prepared to stepped by prepare_one_step. So I believe passing the ecs thread is fine. The same logic applies to process_event_stop_test calling set_step_info. gdb/ChangeLog: * infrun.h: Forward-declare thread_info. (set_step_info): Add thread_info parameter, add doc. * infrun.c (set_step_info): Add thread_info parameter, move doc to header. * infrun.c (process_event_stop_test): Pass thread to set_step_info call. * infcmd.c (set_step_frame): Add thread_info pointer, pass it to set_step_info. (prepare_one_step): Add thread_info parameter, pass it to set_step_frame and prepare_one_step (recursive) call. (step_1): Pass thread to prepare_one_step call. (step_command_fsm::should_stop): Pass thread to prepare_one_step. (until_next_fsm): Pass thread to set_step_frame call. (finish_command): Pass thread to set_step_info call.
Diffstat (limited to 'gdb/infrun.h')
-rw-r--r--gdb/infrun.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/gdb/infrun.h b/gdb/infrun.h
index 625c53a..9808541 100644
--- a/gdb/infrun.h
+++ b/gdb/infrun.h
@@ -26,6 +26,7 @@ struct frame_info;
struct address_space;
struct return_value_info;
struct process_stratum_target;
+struct thread_info;
/* True if we are debugging run control. */
extern unsigned int debug_infrun;
@@ -150,7 +151,9 @@ extern int thread_is_stepping_over_breakpoint (int thread);
triggers a non-steppable watchpoint. */
extern int stepping_past_nonsteppable_watchpoint (void);
-extern void set_step_info (struct frame_info *frame,
+/* Record in TP the frame and location we're currently stepping through. */
+extern void set_step_info (thread_info *tp,
+ struct frame_info *frame,
struct symtab_and_line sal);
/* Several print_*_reason helper functions to print why the inferior