@@ -10950,106 +10950,66 @@ awatch_command (const char *arg, int from_tty)
10950
10950
in infcmd.c. Here because it uses the mechanisms of
10951
10951
breakpoints. */
10952
10952
10953
- struct until_break_fsm
10953
+ struct until_break_fsm : public thread_fsm
10954
10954
{
10955
- /* The base class. */
10956
- struct thread_fsm thread_fsm ;
10957
-
10958
- /* The thread that as current when the command was executed. */
10955
+ /* The thread that was current when the command was executed. */
10959
10956
int thread ;
10960
10957
10961
10958
/* The breakpoint set at the destination location. */
10962
- struct breakpoint * location_breakpoint ;
10959
+ breakpoint_up location_breakpoint ;
10963
10960
10964
10961
/* Breakpoint set at the return address in the caller frame. May be
10965
10962
NULL. */
10966
- struct breakpoint * caller_breakpoint ;
10967
- };
10968
-
10969
- static void until_break_fsm_clean_up (struct thread_fsm * self ,
10970
- struct thread_info * thread );
10971
- static int until_break_fsm_should_stop (struct thread_fsm * self ,
10972
- struct thread_info * thread );
10973
- static enum async_reply_reason
10974
- until_break_fsm_async_reply_reason (struct thread_fsm * self );
10963
+ breakpoint_up caller_breakpoint ;
10975
10964
10976
- /* until_break_fsm's vtable. */
10965
+ until_break_fsm (struct interp * cmd_interp , int thread ,
10966
+ breakpoint_up && location_breakpoint ,
10967
+ breakpoint_up && caller_breakpoint )
10968
+ : thread_fsm (cmd_interp ),
10969
+ thread (thread ),
10970
+ location_breakpoint (std ::move (location_breakpoint )),
10971
+ caller_breakpoint (std ::move (caller_breakpoint ))
10972
+ {
10973
+ }
10977
10974
10978
- static struct thread_fsm_ops until_break_fsm_ops =
10979
- {
10980
- NULL , /* dtor */
10981
- until_break_fsm_clean_up ,
10982
- until_break_fsm_should_stop ,
10983
- NULL , /* return_value */
10984
- until_break_fsm_async_reply_reason ,
10975
+ void clean_up (struct thread_info * thread ) override ;
10976
+ bool should_stop (struct thread_info * thread ) override ;
10977
+ enum async_reply_reason do_async_reply_reason () override ;
10985
10978
};
10986
10979
10987
- /* Allocate a new until_break_command_fsm. */
10988
-
10989
- static struct until_break_fsm *
10990
- new_until_break_fsm (struct interp * cmd_interp , int thread ,
10991
- breakpoint_up && location_breakpoint ,
10992
- breakpoint_up && caller_breakpoint )
10993
- {
10994
- struct until_break_fsm * sm ;
10995
-
10996
- sm = XCNEW (struct until_break_fsm );
10997
- thread_fsm_ctor (& sm -> thread_fsm , & until_break_fsm_ops , cmd_interp );
10998
-
10999
- sm -> thread = thread ;
11000
- sm -> location_breakpoint = location_breakpoint .release ();
11001
- sm -> caller_breakpoint = caller_breakpoint .release ();
11002
-
11003
- return sm ;
11004
- }
11005
-
11006
10980
/* Implementation of the 'should_stop' FSM method for the
11007
10981
until(location)/advance commands. */
11008
10982
11009
- static int
11010
- until_break_fsm_should_stop (struct thread_fsm * self ,
11011
- struct thread_info * tp )
10983
+ bool
10984
+ until_break_fsm ::should_stop (struct thread_info * tp )
11012
10985
{
11013
- struct until_break_fsm * sm = (struct until_break_fsm * ) self ;
11014
-
11015
10986
if (bpstat_find_breakpoint (tp -> control .stop_bpstat ,
11016
- sm -> location_breakpoint ) != NULL
11017
- || (sm -> caller_breakpoint != NULL
10987
+ location_breakpoint . get () ) != NULL
10988
+ || (caller_breakpoint != NULL
11018
10989
&& bpstat_find_breakpoint (tp -> control .stop_bpstat ,
11019
- sm -> caller_breakpoint ) != NULL ))
11020
- thread_fsm_set_finished ( self );
10990
+ caller_breakpoint . get () ) != NULL ))
10991
+ set_finished ( );
11021
10992
11022
- return 1 ;
10993
+ return true ;
11023
10994
}
11024
10995
11025
10996
/* Implementation of the 'clean_up' FSM method for the
11026
10997
until(location)/advance commands. */
11027
10998
11028
- static void
11029
- until_break_fsm_clean_up (struct thread_fsm * self ,
11030
- struct thread_info * thread )
10999
+ void
11000
+ until_break_fsm ::clean_up (struct thread_info * )
11031
11001
{
11032
- struct until_break_fsm * sm = (struct until_break_fsm * ) self ;
11033
-
11034
11002
/* Clean up our temporary breakpoints. */
11035
- if (sm -> location_breakpoint != NULL )
11036
- {
11037
- delete_breakpoint (sm -> location_breakpoint );
11038
- sm -> location_breakpoint = NULL ;
11039
- }
11040
- if (sm -> caller_breakpoint != NULL )
11041
- {
11042
- delete_breakpoint (sm -> caller_breakpoint );
11043
- sm -> caller_breakpoint = NULL ;
11044
- }
11045
- delete_longjmp_breakpoint (sm -> thread );
11003
+ location_breakpoint .reset ();
11004
+ caller_breakpoint .reset ();
11005
+ delete_longjmp_breakpoint (thread );
11046
11006
}
11047
11007
11048
11008
/* Implementation of the 'async_reply_reason' FSM method for the
11049
11009
until(location)/advance commands. */
11050
11010
11051
- static enum async_reply_reason
11052
- until_break_fsm_async_reply_reason ( struct thread_fsm * self )
11011
+ enum async_reply_reason
11012
+ until_break_fsm :: do_async_reply_reason ( )
11053
11013
{
11054
11014
return EXEC_ASYNC_LOCATION_REACHED ;
11055
11015
}
@@ -11063,7 +11023,6 @@ until_break_command (const char *arg, int from_tty, int anywhere)
11063
11023
struct frame_id caller_frame_id ;
11064
11024
int thread ;
11065
11025
struct thread_info * tp ;
11066
- struct until_break_fsm * sm ;
11067
11026
11068
11027
clear_proceed_status (0 );
11069
11028
@@ -11142,10 +11101,9 @@ until_break_command (const char *arg, int from_tty, int anywhere)
11142
11101
location_breakpoint = set_momentary_breakpoint (frame_gdbarch , sal ,
11143
11102
stack_frame_id , bp_until );
11144
11103
11145
- sm = new_until_break_fsm (command_interp (), tp -> global_num ,
11146
- std ::move (location_breakpoint ),
11147
- std ::move (caller_breakpoint ));
11148
- tp -> thread_fsm = & sm -> thread_fsm ;
11104
+ tp -> thread_fsm = new until_break_fsm (command_interp (), tp -> global_num ,
11105
+ std ::move (location_breakpoint ),
11106
+ std ::move (caller_breakpoint ));
11149
11107
11150
11108
if (lj_deleter )
11151
11109
lj_deleter -> release ();
0 commit comments