[Lldb-commits] [lldb] [LLDB] Add module hook implementation (PR #185465)

via lldb-commits lldb-commits at lists.llvm.org
Wed Mar 18 10:49:16 PDT 2026


================
@@ -1640,6 +1641,171 @@ class Target : public std::enable_shared_from_this<Target>,
 
   typedef std::shared_ptr<StopHook> StopHookSP;
 
+  // Target Hooks
+  //
+  // Hooks fire on lifecycle events. By default, they fire when modules
+  // are loaded into the target (via ModulesDidLoad). They can also fire
+  // on module unload (via ModulesDidUnload) and on process stop (via
+  // RunStopHooks), controlled by the event mask.
+  class Hook : public UserID {
+  public:
+    Hook(const Hook &rhs);
+    virtual ~Hook() = default;
+
+    enum class HookKind : uint32_t { CommandBased = 0, ScriptBased };
+
+    /// Event mask bits controlling when this hook fires.
----------------
jimingham wrote:

Can we figure out a better name for these than EventMask's.  We use that name also in the Event/Listener/Broadcaster interaction, so having it used for a similar but slightly different purpose here is going to be confusing.

How about calling these Triggers?  That goes along with saying the callbacks "fire" when  something happens...

https://github.com/llvm/llvm-project/pull/185465


More information about the lldb-commits mailing list