used to do this because we needed to find the shared pointer for a .o file when the .o file's module was needed in a SymbolContext since the module in a symbol context was a shared pointer. Now that we are using intrusive pointers we don't have this limitation anymore since any instrusive shared pointer can be made from a pointer to an object all on its own. Also switched over to having the Module and SymbolVendor use shared pointers to their object files as had a leak on MacOSX when the SymbolVendor's object file wasn't the same as the Module's (debug info in a stand along file (dSYM file)). Now everything will correctly clean itself up when the module goes away after an executable gets rebuilt. Now we correctly get rid of .o files that are used with the DWARF with debug map executables on subsequent runs since the only shared pointer to the object files in from the DWARF symbol file debug map parser, and when the module gets replaced, it destroys to old one along with all .o files. Also added a small optimization when using BSD archives where we will remove old BSD containers from the shared list when they are outdated. llvm-svn: 140002
92 lines
2.6 KiB
C++
92 lines
2.6 KiB
C++
//===-- ObjectContainerUniversalMachO.h -------------------------*- C++ -*-===//
|
|
//
|
|
// The LLVM Compiler Infrastructure
|
|
//
|
|
// This file is distributed under the University of Illinois Open Source
|
|
// License. See LICENSE.TXT for details.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#ifndef liblldb_ObjectContainerUniversalMachO_h_
|
|
#define liblldb_ObjectContainerUniversalMachO_h_
|
|
|
|
#include "lldb/Symbol/ObjectContainer.h"
|
|
#include "lldb/Host/FileSpec.h"
|
|
|
|
#include "llvm/Support/MachO.h"
|
|
|
|
class ObjectContainerUniversalMachO :
|
|
public lldb_private::ObjectContainer
|
|
{
|
|
public:
|
|
//------------------------------------------------------------------
|
|
// Static Functions
|
|
//------------------------------------------------------------------
|
|
static void
|
|
Initialize();
|
|
|
|
static void
|
|
Terminate();
|
|
|
|
static const char *
|
|
GetPluginNameStatic();
|
|
|
|
static const char *
|
|
GetPluginDescriptionStatic();
|
|
|
|
static lldb_private::ObjectContainer *
|
|
CreateInstance (lldb_private::Module* module,
|
|
lldb::DataBufferSP& dataSP,
|
|
const lldb_private::FileSpec *file,
|
|
lldb::addr_t offset,
|
|
lldb::addr_t length);
|
|
|
|
static bool
|
|
MagicBytesMatch (lldb::DataBufferSP& dataSP);
|
|
|
|
//------------------------------------------------------------------
|
|
// Member Functions
|
|
//------------------------------------------------------------------
|
|
ObjectContainerUniversalMachO (lldb_private::Module* module,
|
|
lldb::DataBufferSP& dataSP,
|
|
const lldb_private::FileSpec *file,
|
|
lldb::addr_t offset,
|
|
lldb::addr_t length);
|
|
|
|
virtual
|
|
~ObjectContainerUniversalMachO();
|
|
|
|
virtual bool
|
|
ParseHeader ();
|
|
|
|
virtual void
|
|
Dump (lldb_private::Stream *s) const;
|
|
|
|
virtual size_t
|
|
GetNumArchitectures () const;
|
|
|
|
virtual bool
|
|
GetArchitectureAtIndex (uint32_t cpu_idx, lldb_private::ArchSpec& arch) const;
|
|
|
|
virtual lldb::ObjectFileSP
|
|
GetObjectFile (const lldb_private::FileSpec *file);
|
|
|
|
//------------------------------------------------------------------
|
|
// PluginInterface protocol
|
|
//------------------------------------------------------------------
|
|
virtual const char *
|
|
GetPluginName();
|
|
|
|
virtual const char *
|
|
GetShortPluginName();
|
|
|
|
virtual uint32_t
|
|
GetPluginVersion();
|
|
|
|
protected:
|
|
llvm::MachO::fat_header m_header;
|
|
std::vector<llvm::MachO::fat_arch> m_fat_archs;
|
|
};
|
|
|
|
#endif // liblldb_ObjectContainerUniversalMachO_h_
|