2828#include " lldb/Target/ExecutionContextScope.h"
2929#include " lldb/Target/PathMappingList.h"
3030#include " lldb/Target/SectionLoadHistory.h"
31- #include " lldb/Target/ThreadSpec.h"
3231#include " lldb/Utility/ArchSpec.h"
3332#include " lldb/Utility/Broadcaster.h"
3433#include " lldb/Utility/LLDBAssert.h"
@@ -509,8 +508,6 @@ class Target : public std::enable_shared_from_this<Target>,
509508
510509 static void SetDefaultArchitecture (const ArchSpec &arch);
511510
512- bool IsDummyTarget () const { return m_is_dummy_target; }
513-
514511 // / Find a binary on the system and return its Module,
515512 // / or return an existing Module that is already in the Target.
516513 // /
@@ -1142,27 +1139,23 @@ class Target : public std::enable_shared_from_this<Target>,
11421139 class StopHook : public UserID {
11431140 public:
11441141 StopHook (const StopHook &rhs);
1145- virtual ~StopHook () = default ;
11461142
1147- enum class StopHookKind : uint32_t { CommandBased = 0 , ScriptBased };
1143+ ~StopHook ();
1144+
1145+ StringList *GetCommandPointer () { return &m_commands; }
1146+
1147+ const StringList &GetCommands () { return m_commands; }
11481148
11491149 lldb::TargetSP &GetTarget () { return m_target_sp; }
11501150
1151+ void SetCommands (StringList &in_commands) { m_commands = in_commands; }
1152+
11511153 // Set the specifier. The stop hook will own the specifier, and is
11521154 // responsible for deleting it when we're done.
11531155 void SetSpecifier (SymbolContextSpecifier *specifier);
11541156
11551157 SymbolContextSpecifier *GetSpecifier () { return m_specifier_sp.get (); }
11561158
1157- bool ExecutionContextPasses (const ExecutionContext &exe_ctx);
1158-
1159- // Called on stop, this gets passed the ExecutionContext for each "stop
1160- // with a reason" thread. It should add to the stream whatever text it
1161- // wants to show the user, and return False to indicate it wants the target
1162- // not to stop.
1163- virtual bool HandleStop (ExecutionContext &exe_ctx,
1164- lldb::StreamSP output) = 0;
1165-
11661159 // Set the Thread Specifier. The stop hook will own the thread specifier,
11671160 // and is responsible for deleting it when we're done.
11681161 void SetThreadSpecifier (ThreadSpec *specifier);
@@ -1180,79 +1173,26 @@ class Target : public std::enable_shared_from_this<Target>,
11801173 bool GetAutoContinue () const { return m_auto_continue; }
11811174
11821175 void GetDescription (Stream *s, lldb::DescriptionLevel level) const ;
1183- virtual void GetSubclassDescription (Stream *s,
1184- lldb::DescriptionLevel level) const = 0;
11851176
1186- protected :
1177+ private :
11871178 lldb::TargetSP m_target_sp;
1179+ StringList m_commands;
11881180 lldb::SymbolContextSpecifierSP m_specifier_sp;
11891181 std::unique_ptr<ThreadSpec> m_thread_spec_up;
11901182 bool m_active = true ;
11911183 bool m_auto_continue = false ;
11921184
1193- StopHook (lldb::TargetSP target_sp, lldb::user_id_t uid);
1194- };
1195-
1196- class StopHookCommandLine : public StopHook {
1197- public:
1198- virtual ~StopHookCommandLine () = default ;
1199-
1200- StringList &GetCommands () { return m_commands; }
1201- void SetActionFromString (const std::string &strings);
1202- void SetActionFromStrings (const std::vector<std::string> &strings);
1203-
1204- bool HandleStop (ExecutionContext &exc_ctx,
1205- lldb::StreamSP output_sp) override ;
1206- void GetSubclassDescription (Stream *s,
1207- lldb::DescriptionLevel level) const override ;
1208-
1209- private:
1210- StringList m_commands;
12111185 // Use CreateStopHook to make a new empty stop hook. The GetCommandPointer
12121186 // and fill it with commands, and SetSpecifier to set the specifier shared
12131187 // pointer (can be null, that will match anything.)
1214- StopHookCommandLine (lldb::TargetSP target_sp, lldb::user_id_t uid)
1215- : StopHook(target_sp, uid) {}
1216- friend class Target ;
1217- };
1218-
1219- class StopHookScripted : public StopHook {
1220- public:
1221- virtual ~StopHookScripted () = default ;
1222- bool HandleStop (ExecutionContext &exc_ctx, lldb::StreamSP output) override ;
1223-
1224- Status SetScriptCallback (std::string class_name,
1225- StructuredData::ObjectSP extra_args_sp);
1226-
1227- void GetSubclassDescription (Stream *s,
1228- lldb::DescriptionLevel level) const override ;
1229-
1230- private:
1231- std::string m_class_name;
1232- // / This holds the dictionary of keys & values that can be used to
1233- // / parametrize any given callback's behavior.
1234- StructuredDataImpl *m_extra_args; // We own this structured data,
1235- // but the SD itself manages the UP.
1236- // / This holds the python callback object.
1237- StructuredData::GenericSP m_implementation_sp;
1238-
1239- // / Use CreateStopHook to make a new empty stop hook. The GetCommandPointer
1240- // / and fill it with commands, and SetSpecifier to set the specifier shared
1241- // / pointer (can be null, that will match anything.)
1242- StopHookScripted (lldb::TargetSP target_sp, lldb::user_id_t uid)
1243- : StopHook(target_sp, uid) {}
1188+ StopHook (lldb::TargetSP target_sp, lldb::user_id_t uid);
12441189 friend class Target ;
12451190 };
1246-
12471191 typedef std::shared_ptr<StopHook> StopHookSP;
12481192
1249- // / Add an empty stop hook to the Target's stop hook list, and returns a
1250- // / shared pointer to it in new_hook. Returns the id of the new hook.
1251- StopHookSP CreateStopHook (StopHook::StopHookKind kind);
1252-
1253- // / If you tried to create a stop hook, and that failed, call this to
1254- // / remove the stop hook, as it will also reset the stop hook counter.
1255- void UndoCreateStopHook (lldb::user_id_t uid);
1193+ // Add an empty stop hook to the Target's stop hook list, and returns a
1194+ // shared pointer to it in new_hook. Returns the id of the new hook.
1195+ StopHookSP CreateStopHook ();
12561196
12571197 void RunStopHooks ();
12581198
0 commit comments