[Lldb-commits] [lldb] Add SBDebugger:: AddNotificationCallback API (PR #111206)

2025-01-30 Thread via lldb-commits
jimingham wrote: There were a bunch of review comments that need to be addressed. But I also am a bit nervous about adding a feature that is intended to be a general "lldb interesting classes lifecycle notification" but when designed only supports Debugger Lifecycle Events. Those are the sim

[Lldb-commits] [lldb] Add SBDebugger:: AddNotificationCallback API (PR #111206)

2025-01-30 Thread Zequan Wu via lldb-commits
ZequanWu wrote: Is there any update on this PR? I'm interested in working on a similar callback that can be triggered when target is created, but I want to wait for this one to get landed first as they will share some common code. https://github.com/llvm/llvm-project/pull/111206 __

[Lldb-commits] [lldb] Add SBDebugger:: AddNotificationCallback API (PR #111206)

2024-10-22 Thread Zequan Wu via lldb-commits
@@ -737,19 +752,35 @@ class Debugger : public std::enable_shared_from_this, lldb::TargetSP m_dummy_target_sp; Diagnostics::CallbackID m_diagnostics_callback_id; - std::mutex m_destroy_callback_mutex; - lldb::callback_token_t m_destroy_callback_next_token = 0; - struct

[Lldb-commits] [lldb] Add SBDebugger:: AddNotificationCallback API (PR #111206)

2024-10-16 Thread via lldb-commits
jimingham wrote: That seems a common enough problem that there should be a more straightforward way to do it than having to barge into the middle of target setup... The SBPlatform already has a "module location callback" that you can hook in to find debug modules in a programmatic way. It a

[Lldb-commits] [lldb] Add SBDebugger:: AddNotificationCallback API (PR #111206)

2024-10-16 Thread via lldb-commits
cmtice wrote: > I have wanted to be able to hook into target creation to be able to setup > targets when they get created. It would be also nice to get an event when a > process is not longer being debugged due to process exit or detach. Something I have wanted for a long time is a stop hook j

[Lldb-commits] [lldb] Add SBDebugger:: AddNotificationCallback API (PR #111206)

2024-10-10 Thread via lldb-commits
jimingham wrote: > (This is in reply to Jim's comment > [here](https://github.com/llvm/llvm-project/pull/111206#issuecomment-2400376223). > I can't quote it, because github garbles it beyond recognition, probably > because it was sent by email :/) I'm trying to remember not to believe the bi

[Lldb-commits] [lldb] Add SBDebugger:: AddNotificationCallback API (PR #111206)

2024-10-10 Thread Pavel Labath via lldb-commits
@@ -1362,6 +1362,12 @@ enum Severity { eSeverityInfo, // Equivalent to Remark used in clang. }; +enum NotificationType { + eDebuggerWillBeCreated = (1 << 0), + eDebuggerWillBeDestroyed = + (1 << 1), // Call before debugger object is destroyed labath w

[Lldb-commits] [lldb] Add SBDebugger:: AddNotificationCallback API (PR #111206)

2024-10-10 Thread Pavel Labath via lldb-commits
@@ -739,16 +745,29 @@ DebuggerSP Debugger::CreateInstance(lldb::LogOutputCallback log_callback, g_debugger_list_ptr->push_back(debugger_sp); } debugger_sp->InstanceInitialize(); + + InvokeNotificationCallbacks(debugger_sp, lldb::eDebuggerWillBeCreated); return debu

[Lldb-commits] [lldb] Add SBDebugger:: AddNotificationCallback API (PR #111206)

2024-10-10 Thread Pavel Labath via lldb-commits
@@ -1703,6 +1703,30 @@ void SBDebugger::SetDestroyCallback( } } +lldb::callback_token_t SBDebugger::AddNotificationCallback( +lldb::NotificationType type, +lldb::SBNotificationCallback notification_callback, void *baton) { + LLDB_INSTRUMENT_VA(type, notification_cal

[Lldb-commits] [lldb] Add SBDebugger:: AddNotificationCallback API (PR #111206)

2024-10-10 Thread Pavel Labath via lldb-commits
@@ -1024,6 +1024,46 @@ static void LLDBSwigPythonCallPythonLogOutputCallback(const char *str, } } +// For NotificationCallback functions +static void LLDBSwigPythonCallPythonSBNotificationCallback( + lldb::NotificationType type, lldb::SBDebugger &debugger, + lldb::SBExec

[Lldb-commits] [lldb] Add SBDebugger:: AddNotificationCallback API (PR #111206)

2024-10-10 Thread Pavel Labath via lldb-commits
@@ -1703,6 +1703,30 @@ void SBDebugger::SetDestroyCallback( } } +lldb::callback_token_t SBDebugger::AddNotificationCallback( +lldb::NotificationType type, +lldb::SBNotificationCallback notification_callback, void *baton) { + LLDB_INSTRUMENT_VA(type, notification_cal

[Lldb-commits] [lldb] Add SBDebugger:: AddNotificationCallback API (PR #111206)

2024-10-10 Thread Pavel Labath via lldb-commits
@@ -739,16 +745,29 @@ DebuggerSP Debugger::CreateInstance(lldb::LogOutputCallback log_callback, g_debugger_list_ptr->push_back(debugger_sp); } debugger_sp->InstanceInitialize(); + + InvokeNotificationCallbacks(debugger_sp, lldb::eDebuggerWillBeCreated); return debu

[Lldb-commits] [lldb] Add SBDebugger:: AddNotificationCallback API (PR #111206)

2024-10-10 Thread Pavel Labath via lldb-commits
labath wrote: (This is in reply to Jim's comment [here](https://github.com/llvm/llvm-project/pull/111206#issuecomment-2400376223). I can't quote it, because github garbles it beyond recognition, probably because it was sent by email :/) You're right, I have misunderstood the intention. The th

[Lldb-commits] [lldb] Add SBDebugger:: AddNotificationCallback API (PR #111206)

2024-10-08 Thread via lldb-commits
@@ -737,19 +752,35 @@ class Debugger : public std::enable_shared_from_this, lldb::TargetSP m_dummy_target_sp; Diagnostics::CallbackID m_diagnostics_callback_id; - std::mutex m_destroy_callback_mutex; - lldb::callback_token_t m_destroy_callback_next_token = 0; - struct

[Lldb-commits] [lldb] Add SBDebugger:: AddNotificationCallback API (PR #111206)

2024-10-08 Thread via lldb-commits
jimingham wrote: I couldn't see what the `original_callback` argument and ivar are for? They just seem to get copied around but not used? We should also add a command way to add these, but it doesn't make sense to do that for the debugger created and destroyed ones because the command interp

[Lldb-commits] [lldb] Add SBDebugger:: AddNotificationCallback API (PR #111206)

2024-10-08 Thread via lldb-commits
@@ -1362,6 +1362,12 @@ enum Severity { eSeverityInfo, // Equivalent to Remark used in clang. }; +enum NotificationType { jimingham wrote: Might be good to put a comment here saying (a) this is used for SBNotificationCallbacks and (b) this is where you shou

[Lldb-commits] [lldb] Add SBDebugger:: AddNotificationCallback API (PR #111206)

2024-10-08 Thread via lldb-commits
@@ -1362,6 +1362,12 @@ enum Severity { eSeverityInfo, // Equivalent to Remark used in clang. }; +enum NotificationType { + eDebuggerWillBeCreated = (1 << 0), jimingham wrote: Yes, it's not useful to call this before the new Debugger is fully initialized.

[Lldb-commits] [lldb] Add SBDebugger:: AddNotificationCallback API (PR #111206)

2024-10-08 Thread via lldb-commits
@@ -569,6 +569,18 @@ class Debugger : public std::enable_shared_from_this, SetDestroyCallback(lldb_private::DebuggerDestroyCallback destroy_callback, void *baton); + /// Add a notification callback when notification type event happens. Return a + ///

[Lldb-commits] [lldb] Add SBDebugger:: AddNotificationCallback API (PR #111206)

2024-10-08 Thread via lldb-commits
@@ -569,6 +569,18 @@ class Debugger : public std::enable_shared_from_this, SetDestroyCallback(lldb_private::DebuggerDestroyCallback destroy_callback, void *baton); + /// Add a notification callback when notification type event happens. Return a --

[Lldb-commits] [lldb] Add SBDebugger:: AddNotificationCallback API (PR #111206)

2024-10-08 Thread via lldb-commits
@@ -138,7 +138,10 @@ class LLDB_API SBUnixSignals; typedef bool (*SBBreakpointHitCallback)(void *baton, lldb::SBProcess &process, lldb::SBThread &thread, lldb::SBBreakpointLocation &location); - +ty

[Lldb-commits] [lldb] Add SBDebugger:: AddNotificationCallback API (PR #111206)

2024-10-08 Thread Greg Clayton via lldb-commits
@@ -138,7 +138,10 @@ class LLDB_API SBUnixSignals; typedef bool (*SBBreakpointHitCallback)(void *baton, lldb::SBProcess &process, lldb::SBThread &thread, lldb::SBBreakpointLocation &location); - +ty

[Lldb-commits] [lldb] Add SBDebugger:: AddNotificationCallback API (PR #111206)

2024-10-08 Thread Greg Clayton via lldb-commits
@@ -1362,6 +1362,12 @@ enum Severity { eSeverityInfo, // Equivalent to Remark used in clang. }; +enum NotificationType { + eDebuggerWillBeCreated = (1 << 0), clayborg wrote: Should this be `eDebuggerWasCreated` to indicate that a debugger object was creat

[Lldb-commits] [lldb] Add SBDebugger:: AddNotificationCallback API (PR #111206)

2024-10-08 Thread via lldb-commits
https://github.com/jeffreytan81 edited https://github.com/llvm/llvm-project/pull/111206 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits