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