[Lldb-commits] [PATCH] D153734: [lldb][LocateModuleCallback] Call locate module callback

Kazuki Sakamoto via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Jul 11 17:48:21 PDT 2023


splhack added inline comments.


================
Comment at: lldb/include/lldb/Target/Platform.h:884-887
+  typedef std::function<Status(const ModuleSpec &module_spec,
+                               FileSpec &module_file_spec,
+                               FileSpec &symbol_file_spec)>
+      LocateModuleCallback;
----------------
clayborg wrote:
> I think we still need a baton for the callback so clients can register a callback + void *.
Yes, callback and baton(`void *`) are retained by SBPlatform.
The detailed flow is here https://reviews.llvm.org/D153735#4491892


================
Comment at: lldb/include/lldb/Target/Platform.h:944
   const std::unique_ptr<ModuleCache> m_module_cache;
+  LocateModuleCallback m_locate_module_callback;
 
----------------
splhack wrote:
> clayborg wrote:
> > We probably need a baton still. In order to make this work for python, we need to be able to set a callback and a baton for the python callable?
> @clayborg Yes, in D153735, both the callback and the baton are captured and retained by SBPlatform. The reason of why SBPlatform captures and retains the callback and the baton is the SBPlatformLocateModuleCallback type contains SBModuleSpec type and SBFileSpec type in the argument. Which are not available in Platform.h.
> 
> ```
> typedef SBError (*SBPlatformLocateModuleCallback)(
>     void *baton, const SBModuleSpec &module_spec, SBFileSpec &module_file_spec,
>     SBFileSpec &symbol_file_spec);
> ```
commented the detailed callback and baton flow here.
https://reviews.llvm.org/D153735#4491892


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D153734/new/

https://reviews.llvm.org/D153734



More information about the lldb-commits mailing list