1*349cc55cSDimitry Andric //===-- ObjectFileMinidump.h ---------------------------------- -*- C++ -*-===// 2*349cc55cSDimitry Andric // 3*349cc55cSDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4*349cc55cSDimitry Andric // See https://llvm.org/LICENSE.txt for license information. 5*349cc55cSDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6*349cc55cSDimitry Andric // 7*349cc55cSDimitry Andric //===----------------------------------------------------------------------===// 8*349cc55cSDimitry Andric // 9*349cc55cSDimitry Andric /// \file 10*349cc55cSDimitry Andric /// Placeholder plugin for the save core functionality. 11*349cc55cSDimitry Andric /// 12*349cc55cSDimitry Andric /// ObjectFileMinidump is created only to be able to save minidump core files 13*349cc55cSDimitry Andric /// from existing processes with the ObjectFileMinidump::SaveCore function. 14*349cc55cSDimitry Andric /// Minidump files are not ObjectFile objects, but they are core files and 15*349cc55cSDimitry Andric /// currently LLDB's ObjectFile plug-ins handle emitting core files. If the 16*349cc55cSDimitry Andric /// core file saving ever moves into a new plug-in type within LLDB, this code 17*349cc55cSDimitry Andric /// should move as well, but for now this is the best place architecturally. 18*349cc55cSDimitry Andric //===----------------------------------------------------------------------===// 19*349cc55cSDimitry Andric 20*349cc55cSDimitry Andric #ifndef LLDB_SOURCE_PLUGINS_OBJECTFILE_MINIDUMP_OBJECTFILEMINIDUMP_H 21*349cc55cSDimitry Andric #define LLDB_SOURCE_PLUGINS_OBJECTFILE_MINIDUMP_OBJECTFILEMINIDUMP_H 22*349cc55cSDimitry Andric 23*349cc55cSDimitry Andric #include "lldb/Symbol/ObjectFile.h" 24*349cc55cSDimitry Andric #include "lldb/Utility/ArchSpec.h" 25*349cc55cSDimitry Andric 26*349cc55cSDimitry Andric class ObjectFileMinidump : public lldb_private::PluginInterface { 27*349cc55cSDimitry Andric public: 28*349cc55cSDimitry Andric // Static Functions 29*349cc55cSDimitry Andric static void Initialize(); 30*349cc55cSDimitry Andric static void Terminate(); 31*349cc55cSDimitry Andric 32*349cc55cSDimitry Andric static llvm::StringRef GetPluginNameStatic() { return "minidump"; } 33*349cc55cSDimitry Andric static const char *GetPluginDescriptionStatic() { 34*349cc55cSDimitry Andric return "Minidump object file."; 35*349cc55cSDimitry Andric } 36*349cc55cSDimitry Andric 37*349cc55cSDimitry Andric // PluginInterface protocol 38*349cc55cSDimitry Andric llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); } 39*349cc55cSDimitry Andric 40*349cc55cSDimitry Andric static lldb_private::ObjectFile * 41*349cc55cSDimitry Andric CreateInstance(const lldb::ModuleSP &module_sp, lldb::DataBufferSP &data_sp, 42*349cc55cSDimitry Andric lldb::offset_t data_offset, const lldb_private::FileSpec *file, 43*349cc55cSDimitry Andric lldb::offset_t offset, lldb::offset_t length); 44*349cc55cSDimitry Andric 45*349cc55cSDimitry Andric static lldb_private::ObjectFile *CreateMemoryInstance( 46*349cc55cSDimitry Andric const lldb::ModuleSP &module_sp, lldb::DataBufferSP &data_sp, 47*349cc55cSDimitry Andric const lldb::ProcessSP &process_sp, lldb::addr_t header_addr); 48*349cc55cSDimitry Andric 49*349cc55cSDimitry Andric static size_t GetModuleSpecifications(const lldb_private::FileSpec &file, 50*349cc55cSDimitry Andric lldb::DataBufferSP &data_sp, 51*349cc55cSDimitry Andric lldb::offset_t data_offset, 52*349cc55cSDimitry Andric lldb::offset_t file_offset, 53*349cc55cSDimitry Andric lldb::offset_t length, 54*349cc55cSDimitry Andric lldb_private::ModuleSpecList &specs); 55*349cc55cSDimitry Andric 56*349cc55cSDimitry Andric // Saves dump in Minidump file format 57*349cc55cSDimitry Andric static bool SaveCore(const lldb::ProcessSP &process_sp, 58*349cc55cSDimitry Andric const lldb_private::FileSpec &outfile, 59*349cc55cSDimitry Andric lldb::SaveCoreStyle &core_style, 60*349cc55cSDimitry Andric lldb_private::Status &error); 61*349cc55cSDimitry Andric 62*349cc55cSDimitry Andric private: 63*349cc55cSDimitry Andric ObjectFileMinidump() = default; 64*349cc55cSDimitry Andric }; 65*349cc55cSDimitry Andric 66*349cc55cSDimitry Andric #endif // LLDB_SOURCE_PLUGINS_OBJECTFILE_MINIDUMP_OBJECTFILEMINIDUMP_H 67