parent
cc958f0050
commit
e26dcbddda
|
@ -83,7 +83,6 @@
|
|||
260E07C8136FAB9200CF21D3 /* OptionGroupFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260E07C7136FAB9200CF21D3 /* OptionGroupFile.cpp */; };
|
||||
261744781168585B005ADD65 /* SBType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 261744771168585B005ADD65 /* SBType.cpp */; };
|
||||
2617447A11685869005ADD65 /* SBType.h in Headers */ = {isa = PBXBuildFile; fileRef = 2617447911685869005ADD65 /* SBType.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
26274FA214030EEF006BA130 /* OperatingSystemDarwinKernel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26274FA014030EEF006BA130 /* OperatingSystemDarwinKernel.cpp */; };
|
||||
26274FA714030F79006BA130 /* DynamicLoaderDarwinKernel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26274FA514030F79006BA130 /* DynamicLoaderDarwinKernel.cpp */; };
|
||||
2628A4D513D4977900F5487A /* ThreadKDP.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2628A4D313D4977900F5487A /* ThreadKDP.cpp */; };
|
||||
262CFC7711A4510000946C6C /* debugserver in Resources */ = {isa = PBXBuildFile; fileRef = 26CE05A0115C31E50022F371 /* debugserver */; };
|
||||
|
@ -908,8 +907,6 @@
|
|||
26217932133BCB850083B112 /* lldb-private-enumerations.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "lldb-private-enumerations.h"; path = "include/lldb/lldb-private-enumerations.h"; sourceTree = "<group>"; };
|
||||
2623096E13D0EFFB006381D9 /* StreamBuffer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = StreamBuffer.h; path = include/lldb/Core/StreamBuffer.h; sourceTree = "<group>"; };
|
||||
2626B6AD143E1BEA00EF935C /* RangeMap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RangeMap.h; path = include/lldb/Core/RangeMap.h; sourceTree = "<group>"; };
|
||||
26274FA014030EEF006BA130 /* OperatingSystemDarwinKernel.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = OperatingSystemDarwinKernel.cpp; sourceTree = "<group>"; };
|
||||
26274FA114030EEF006BA130 /* OperatingSystemDarwinKernel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OperatingSystemDarwinKernel.h; sourceTree = "<group>"; };
|
||||
26274FA514030F79006BA130 /* DynamicLoaderDarwinKernel.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DynamicLoaderDarwinKernel.cpp; sourceTree = "<group>"; };
|
||||
26274FA614030F79006BA130 /* DynamicLoaderDarwinKernel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DynamicLoaderDarwinKernel.h; sourceTree = "<group>"; };
|
||||
2628A4D313D4977900F5487A /* ThreadKDP.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ThreadKDP.cpp; sourceTree = "<group>"; };
|
||||
|
@ -2145,15 +2142,6 @@
|
|||
path = scripts/Python/interface;
|
||||
sourceTree = SOURCE_ROOT;
|
||||
};
|
||||
26274F9F14030EEF006BA130 /* Darwin-Kernel */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
26274FA014030EEF006BA130 /* OperatingSystemDarwinKernel.cpp */,
|
||||
26274FA114030EEF006BA130 /* OperatingSystemDarwinKernel.h */,
|
||||
);
|
||||
path = "Darwin-Kernel";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
26274FA414030F79006BA130 /* Darwin-Kernel */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
|
@ -2382,7 +2370,6 @@
|
|||
266DFE9013FD64D200D0C574 /* OperatingSystem */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
26274F9F14030EEF006BA130 /* Darwin-Kernel */,
|
||||
2698699715E6CBD0002415FF /* Python */,
|
||||
);
|
||||
path = OperatingSystem;
|
||||
|
@ -4294,7 +4281,6 @@
|
|||
26F4A21C13FBA31A0064B613 /* ThreadMemory.cpp in Sources */,
|
||||
266DFE9713FD656E00D0C574 /* OperatingSystem.cpp in Sources */,
|
||||
26954EBE1401EE8B00294D09 /* DynamicRegisterInfo.cpp in Sources */,
|
||||
26274FA214030EEF006BA130 /* OperatingSystemDarwinKernel.cpp in Sources */,
|
||||
26274FA714030F79006BA130 /* DynamicLoaderDarwinKernel.cpp in Sources */,
|
||||
94FA3DE01405D50400833217 /* ValueObjectConstResultChild.cpp in Sources */,
|
||||
949ADF031406F648004833E1 /* ValueObjectConstResultImpl.cpp in Sources */,
|
||||
|
|
|
@ -1,4 +1 @@
|
|||
if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
|
||||
add_subdirectory(Darwin-Kernel)
|
||||
endif()
|
||||
add_subdirectory(Python)
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
set(LLVM_NO_RTTI 1)
|
||||
|
||||
add_lldb_library(lldbPluginOSDarwinKernel
|
||||
OperatingSystemDarwinKernel.cpp
|
||||
)
|
|
@ -1,14 +0,0 @@
|
|||
##==- source/Plugins/OperatingSystem/Darwin-Kernel/Makefile -*- Makefile -*-==##
|
||||
#
|
||||
# The LLVM Compiler Infrastructure
|
||||
#
|
||||
# This file is distributed under the University of Illinois Open Source
|
||||
# License. See LICENSE.TXT for details.
|
||||
#
|
||||
##===----------------------------------------------------------------------===##
|
||||
|
||||
LLDB_LEVEL := ../../../..
|
||||
LIBRARYNAME := lldbPluginOperatingSystemDarwinKernel
|
||||
BUILD_ARCHIVE = 1
|
||||
|
||||
include $(LLDB_LEVEL)/Makefile
|
|
@ -1,302 +0,0 @@
|
|||
//===-- OperatingSystemDarwinKernel.cpp --------------------------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "OperatingSystemDarwinKernel.h"
|
||||
// C Includes
|
||||
// C++ Includes
|
||||
// Other libraries and framework includes
|
||||
#include "llvm/ADT/Triple.h"
|
||||
|
||||
#include "lldb/Core/ArchSpec.h"
|
||||
#include "lldb/Core/DataBufferHeap.h"
|
||||
#include "lldb/Core/Module.h"
|
||||
#include "lldb/Core/PluginManager.h"
|
||||
#include "lldb/Core/RegisterValue.h"
|
||||
#include "lldb/Core/ValueObjectVariable.h"
|
||||
#include "lldb/Symbol/ClangNamespaceDecl.h"
|
||||
#include "lldb/Symbol/ObjectFile.h"
|
||||
#include "lldb/Symbol/VariableList.h"
|
||||
#include "lldb/Target/Process.h"
|
||||
#include "lldb/Target/StopInfo.h"
|
||||
#include "lldb/Target/Target.h"
|
||||
#include "lldb/Target/ThreadList.h"
|
||||
#include "lldb/Target/Thread.h"
|
||||
#include "Plugins/Process/Utility/DynamicRegisterInfo.h"
|
||||
#include "Plugins/Process/Utility/RegisterContextMemory.h"
|
||||
#include "Plugins/Process/Utility/ThreadMemory.h"
|
||||
|
||||
using namespace lldb;
|
||||
using namespace lldb_private;
|
||||
|
||||
static ConstString &
|
||||
GetThreadGPRMemberName ()
|
||||
{
|
||||
static ConstString g_gpr_member_name("gpr");
|
||||
return g_gpr_member_name;
|
||||
}
|
||||
|
||||
void
|
||||
OperatingSystemDarwinKernel::Initialize()
|
||||
{
|
||||
PluginManager::RegisterPlugin (GetPluginNameStatic(),
|
||||
GetPluginDescriptionStatic(),
|
||||
CreateInstance);
|
||||
}
|
||||
|
||||
void
|
||||
OperatingSystemDarwinKernel::Terminate()
|
||||
{
|
||||
PluginManager::UnregisterPlugin (CreateInstance);
|
||||
}
|
||||
|
||||
OperatingSystem *
|
||||
OperatingSystemDarwinKernel::CreateInstance (Process *process, bool force)
|
||||
{
|
||||
#if 0
|
||||
bool create = force;
|
||||
if (!create)
|
||||
{
|
||||
Module* exe_module = process->GetTarget().GetExecutableModulePointer();
|
||||
if (exe_module)
|
||||
{
|
||||
ObjectFile *object_file = exe_module->GetObjectFile();
|
||||
if (object_file)
|
||||
{
|
||||
if (object_file->GetStrata() != ObjectFile::eStrataKernel)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// We can limit the creation of this plug-in to "*-apple-macosx" or "*-apple-ios" triples
|
||||
// if we comment out the lines below...
|
||||
// if (create)
|
||||
// {
|
||||
// const llvm::Triple &triple_ref = process->GetTarget().GetArchitecture().GetTriple();
|
||||
// create = triple_ref.getOS() == llvm::Triple::Darwin && triple_ref.getVendor() == llvm::Triple::Apple;
|
||||
// }
|
||||
}
|
||||
|
||||
if (create)
|
||||
return new OperatingSystemDarwinKernel (process);
|
||||
#endif
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
const char *
|
||||
OperatingSystemDarwinKernel::GetPluginNameStatic()
|
||||
{
|
||||
return "macosx-kernel";
|
||||
}
|
||||
|
||||
const char *
|
||||
OperatingSystemDarwinKernel::GetPluginDescriptionStatic()
|
||||
{
|
||||
return "Operating system plug-in that gathers OS information from darwin kernels.";
|
||||
}
|
||||
|
||||
|
||||
OperatingSystemDarwinKernel::OperatingSystemDarwinKernel (lldb_private::Process *process) :
|
||||
OperatingSystem (process),
|
||||
m_thread_list_valobj_sp (),
|
||||
m_register_info_ap ()
|
||||
{
|
||||
}
|
||||
|
||||
OperatingSystemDarwinKernel::~OperatingSystemDarwinKernel ()
|
||||
{
|
||||
}
|
||||
|
||||
ValueObjectSP
|
||||
OperatingSystemDarwinKernel::GetThreadListValueObject ()
|
||||
{
|
||||
if (m_thread_list_valobj_sp.get() == NULL)
|
||||
{
|
||||
VariableList variable_list;
|
||||
const uint32_t max_matches = 1;
|
||||
const bool append = true;
|
||||
static ConstString g_thread_list_name("g_thread_list");
|
||||
Module *exe_module = m_process->GetTarget().GetExecutableModulePointer();
|
||||
if (exe_module)
|
||||
{
|
||||
if (exe_module->FindGlobalVariables (g_thread_list_name,
|
||||
NULL,
|
||||
append,
|
||||
max_matches,
|
||||
variable_list))
|
||||
{
|
||||
m_thread_list_valobj_sp = ValueObjectVariable::Create (m_process, variable_list.GetVariableAtIndex(0));
|
||||
}
|
||||
}
|
||||
}
|
||||
return m_thread_list_valobj_sp;
|
||||
}
|
||||
|
||||
DynamicRegisterInfo *
|
||||
OperatingSystemDarwinKernel::GetDynamicRegisterInfo ()
|
||||
{
|
||||
if (m_register_info_ap.get() == NULL && m_thread_list_valobj_sp)
|
||||
{
|
||||
m_register_info_ap.reset (new DynamicRegisterInfo());
|
||||
ConstString empty_name;
|
||||
const bool can_create = true;
|
||||
AddressType addr_type;
|
||||
addr_t base_addr = LLDB_INVALID_ADDRESS;
|
||||
ValueObjectSP gpr_valobj_sp (m_thread_list_valobj_sp->GetChildMemberWithName(GetThreadGPRMemberName (), can_create));
|
||||
|
||||
if (gpr_valobj_sp->IsPointerType ())
|
||||
base_addr = gpr_valobj_sp->GetPointerValue (&addr_type);
|
||||
else
|
||||
base_addr = gpr_valobj_sp->GetAddressOf (true, &addr_type);
|
||||
|
||||
ValueObjectSP child_valobj_sp;
|
||||
if (gpr_valobj_sp)
|
||||
{
|
||||
ABI *abi = m_process->GetABI().get();
|
||||
assert (abi);
|
||||
uint32_t num_children = gpr_valobj_sp->GetNumChildren();
|
||||
|
||||
ConstString gpr_name (gpr_valobj_sp->GetName());
|
||||
uint32_t reg_num = 0;
|
||||
for (uint32_t i=0; i<num_children; ++i)
|
||||
{
|
||||
child_valobj_sp = gpr_valobj_sp->GetChildAtIndex(i, can_create);
|
||||
|
||||
ConstString reg_name(child_valobj_sp->GetName());
|
||||
if (reg_name)
|
||||
{
|
||||
const char *reg_name_cstr = reg_name.GetCString();
|
||||
while (reg_name_cstr[0] == '_')
|
||||
++reg_name_cstr;
|
||||
if (reg_name_cstr != reg_name.GetCString())
|
||||
reg_name.SetCString (reg_name_cstr);
|
||||
}
|
||||
|
||||
RegisterInfo reg_info;
|
||||
if (abi->GetRegisterInfoByName(reg_name, reg_info))
|
||||
{
|
||||
// Adjust the byte size and the offset to match the layout of registers in our struct
|
||||
reg_info.byte_size = child_valobj_sp->GetByteSize();
|
||||
reg_info.byte_offset = child_valobj_sp->GetAddressOf(true, &addr_type) - base_addr;
|
||||
reg_info.kinds[eRegisterKindLLDB] = reg_num++;
|
||||
m_register_info_ap->AddRegister (reg_info, reg_name, empty_name, gpr_name);
|
||||
}
|
||||
}
|
||||
|
||||
m_register_info_ap->Finalize();
|
||||
}
|
||||
}
|
||||
assert (m_register_info_ap.get());
|
||||
return m_register_info_ap.get();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------
|
||||
// PluginInterface protocol
|
||||
//------------------------------------------------------------------
|
||||
const char *
|
||||
OperatingSystemDarwinKernel::GetPluginName()
|
||||
{
|
||||
return "OperatingSystemDarwinKernel";
|
||||
}
|
||||
|
||||
const char *
|
||||
OperatingSystemDarwinKernel::GetShortPluginName()
|
||||
{
|
||||
return GetPluginNameStatic();
|
||||
}
|
||||
|
||||
uint32_t
|
||||
OperatingSystemDarwinKernel::GetPluginVersion()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
bool
|
||||
OperatingSystemDarwinKernel::UpdateThreadList (ThreadList &old_thread_list, ThreadList &new_thread_list)
|
||||
{
|
||||
// Make any constant strings once and cache the uniqued C string values
|
||||
// so we don't have to rehash them each time through this function call
|
||||
static ConstString g_tid_member_name("tid");
|
||||
static ConstString g_next_member_name("next");
|
||||
|
||||
ValueObjectSP root_valobj_sp (GetThreadListValueObject ());
|
||||
ValueObjectSP valobj_sp = root_valobj_sp;
|
||||
const bool can_create = true;
|
||||
while (valobj_sp)
|
||||
{
|
||||
if (valobj_sp->GetValueAsUnsigned(0) == 0)
|
||||
break;
|
||||
|
||||
ValueObjectSP tid_valobj_sp(valobj_sp->GetChildMemberWithName(g_tid_member_name, can_create));
|
||||
if (!tid_valobj_sp)
|
||||
break;
|
||||
|
||||
tid_t tid = tid_valobj_sp->GetValueAsUnsigned (LLDB_INVALID_THREAD_ID);
|
||||
if (tid == LLDB_INVALID_THREAD_ID)
|
||||
break;
|
||||
|
||||
ThreadSP thread_sp (old_thread_list.FindThreadByID (tid, false));
|
||||
if (!thread_sp)
|
||||
thread_sp.reset (new ThreadMemory (*m_process, tid, valobj_sp));
|
||||
|
||||
new_thread_list.AddThread(thread_sp);
|
||||
|
||||
ValueObjectSP next_valobj_sp (valobj_sp->GetChildMemberWithName(g_next_member_name, can_create));
|
||||
|
||||
if (next_valobj_sp)
|
||||
{
|
||||
// Watch for circular linked lists
|
||||
if (next_valobj_sp.get() == root_valobj_sp.get())
|
||||
break;
|
||||
}
|
||||
next_valobj_sp.swap(valobj_sp);
|
||||
}
|
||||
return new_thread_list.GetSize(false) > 0;
|
||||
}
|
||||
|
||||
void
|
||||
OperatingSystemDarwinKernel::ThreadWasSelected (Thread *thread)
|
||||
{
|
||||
}
|
||||
|
||||
RegisterContextSP
|
||||
OperatingSystemDarwinKernel::CreateRegisterContextForThread (Thread *thread, lldb::addr_t reg_data_addr)
|
||||
{
|
||||
ThreadMemory *generic_thread = (ThreadMemory *)thread;
|
||||
RegisterContextSP reg_ctx_sp;
|
||||
|
||||
ValueObjectSP thread_valobj_sp (generic_thread->GetValueObject());
|
||||
if (thread_valobj_sp)
|
||||
{
|
||||
const bool can_create = true;
|
||||
AddressType addr_type;
|
||||
addr_t base_addr = LLDB_INVALID_ADDRESS;
|
||||
ValueObjectSP gpr_valobj_sp (thread_valobj_sp->GetChildMemberWithName(GetThreadGPRMemberName (), can_create));
|
||||
if (gpr_valobj_sp)
|
||||
{
|
||||
if (gpr_valobj_sp->IsPointerType ())
|
||||
base_addr = gpr_valobj_sp->GetPointerValue (&addr_type);
|
||||
else
|
||||
base_addr = gpr_valobj_sp->GetAddressOf (true, &addr_type);
|
||||
reg_ctx_sp.reset (new RegisterContextMemory (*thread, 0, *GetDynamicRegisterInfo (), base_addr));
|
||||
}
|
||||
}
|
||||
return reg_ctx_sp;
|
||||
}
|
||||
|
||||
StopInfoSP
|
||||
OperatingSystemDarwinKernel::CreateThreadStopReason (lldb_private::Thread *thread)
|
||||
{
|
||||
StopInfoSP stop_info_sp; //(StopInfo::CreateStopReasonWithSignal (*thread, SIGSTOP));
|
||||
return stop_info_sp;
|
||||
}
|
||||
|
||||
|
|
@ -1,91 +0,0 @@
|
|||
//===-- OperatingSystemDarwinKernel.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_OperatingSystemDarwinKernel_h_
|
||||
#define liblldb_OperatingSystemDarwinKernel_h_
|
||||
|
||||
// C Includes
|
||||
// C++ Includes
|
||||
// Other libraries and framework includes
|
||||
#include "lldb/Target/OperatingSystem.h"
|
||||
|
||||
class DynamicRegisterInfo;
|
||||
|
||||
class OperatingSystemDarwinKernel : public lldb_private::OperatingSystem
|
||||
{
|
||||
public:
|
||||
//------------------------------------------------------------------
|
||||
// Static Functions
|
||||
//------------------------------------------------------------------
|
||||
static lldb_private::OperatingSystem *
|
||||
CreateInstance (lldb_private::Process *process, bool force);
|
||||
|
||||
static void
|
||||
Initialize();
|
||||
|
||||
static void
|
||||
Terminate();
|
||||
|
||||
static const char *
|
||||
GetPluginNameStatic();
|
||||
|
||||
static const char *
|
||||
GetPluginDescriptionStatic();
|
||||
|
||||
//------------------------------------------------------------------
|
||||
// Class Methods
|
||||
//------------------------------------------------------------------
|
||||
OperatingSystemDarwinKernel (lldb_private::Process *process);
|
||||
|
||||
virtual
|
||||
~OperatingSystemDarwinKernel ();
|
||||
|
||||
//------------------------------------------------------------------
|
||||
// lldb_private::PluginInterface Methods
|
||||
//------------------------------------------------------------------
|
||||
virtual const char *
|
||||
GetPluginName();
|
||||
|
||||
virtual const char *
|
||||
GetShortPluginName();
|
||||
|
||||
virtual uint32_t
|
||||
GetPluginVersion();
|
||||
|
||||
//------------------------------------------------------------------
|
||||
// lldb_private::OperatingSystem Methods
|
||||
//------------------------------------------------------------------
|
||||
virtual bool
|
||||
UpdateThreadList (lldb_private::ThreadList &old_thread_list,
|
||||
lldb_private::ThreadList &new_thread_list);
|
||||
|
||||
virtual void
|
||||
ThreadWasSelected (lldb_private::Thread *thread);
|
||||
|
||||
virtual lldb::RegisterContextSP
|
||||
CreateRegisterContextForThread (lldb_private::Thread *thread,
|
||||
lldb::addr_t reg_data_addr);
|
||||
|
||||
virtual lldb::StopInfoSP
|
||||
CreateThreadStopReason (lldb_private::Thread *thread);
|
||||
|
||||
protected:
|
||||
|
||||
lldb::ValueObjectSP
|
||||
GetThreadListValueObject ();
|
||||
|
||||
DynamicRegisterInfo *
|
||||
GetDynamicRegisterInfo ();
|
||||
|
||||
lldb::ValueObjectSP m_thread_list_valobj_sp;
|
||||
std::unique_ptr<DynamicRegisterInfo> m_register_info_ap;
|
||||
|
||||
};
|
||||
|
||||
#endif // #ifndef liblldb_OperatingSystemDarwinKernel_h_
|
Loading…
Reference in New Issue