[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 12:15:01 PDT 2023


splhack marked 3 inline comments as done.
splhack added a comment.

SBPlatform API and Python will use SBPlatformLocateModuleCallback type.

  typedef SBError (*SBPlatformLocateModuleCallback)(
      void *baton,
      const SBModuleSpec &module_spec,
      SBFileSpec &module_file_spec,
      SBFileSpec &symbol_file_spec);

Platform.h will use LocateModuleCallback type.

  typedef std::function<Status(
      const ModuleSpec &module_spec,
      FileSpec &module_file_spec,
      FileSpec &symbol_file_spec)> LocateModuleCallback;

So, Platform.h does not need to have SB* dependencies,
and SBPlatform can convert ModuleSpec/FileSpec from/to SBModuleSpec/SBFileSpec for the callback.



================
Comment at: lldb/include/lldb/Target/Platform.h:888
+  /// from symbol servers.
+  void SetTargetGetModuleCallback(void *callback_baton);
+
----------------
clayborg wrote:
> You actually need a callback along with the baton here. We probably don't need the word "Target" in the function name?
> 
> Maybe better named as 
> ```
> void SetLocationModuleCallback(PlatformLocateModuleCallback callback, void *baton);
> ```
Platform.h now only retains a std::function for the locate module callback.

In D153735, SBPlatform will use a lambda
- to capture callback(SBPlatformLocateModuleCallback) and baton(void *)
- to convert ModuleSpec/FileSpec from/to SBModuleSpec/SBFileSpec

Therefore, Platform.h does not need SB* dependencies.


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