[Lldb-commits] [PATCH] D108233: WIP: Add minidump save-core functionality to ELF object files

Greg Clayton via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Aug 25 14:03:02 PDT 2021


clayborg added inline comments.


================
Comment at: lldb/source/Plugins/ObjectFile/Minidump/ObjectFileMinidump.cpp:31
+      /*create_memory_callback=*/nullptr,
+      /*get_module_specifications=*/nullptr, SaveCore);
+}
----------------
It should be fine to not inherit from ObjectFile and yes I agree, probably best to not modify other code. 

All you need to provide is static function callbacks that have the correct static function signature, and that doesn't require your class to inherit from ObjectFile. You already have a CreateInstance function to see how to do this. The CreateInstance(...) function you have can do nothing and just return nullptr. 

Then you need to make a create memory callback and a get module specifications:
```
ObjectFile *ObjectFileMinidump::CreateMemoryInstance(
    const lldb::ModuleSP &module_sp, DataBufferSP &data_sp,
    const ProcessSP &process_sp, lldb::addr_t header_addr) {
  return nullptr;
}

size_t ObjectFileMinidump::GetModuleSpecifications(
    const lldb_private::FileSpec &file, lldb::DataBufferSP &data_sp,
    lldb::offset_t data_offset, lldb::offset_t file_offset,
    lldb::offset_t length, lldb_private::ModuleSpecList &specs) {
  specs.Clear();
  return 0;
}
```

Then your registration call looks like:

```
PluginManager::RegisterPlugin(
  GetPluginNameStatic(), GetPluginDescriptionStatic(), CreateInstance,
      CreateMemoryInstance, GetModuleSpecifications, SaveCore);
```


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108233



More information about the lldb-commits mailing list