Revert lldb changes due to post-3.3 clang and llvm API changes

Revisions:
svn	git
183929	99447a6
183862	15c1774
  source/Host/common/FileSpec.cpp

184954	007e7bc
184948	4dc3761
  source/Expression/ClangExpressionParser.cpp

182099	b31044e
181387	779e6ac
  include/lldb/Expression/IRExecutionUnit.h
  source/Expression/IRExecutionUnit.cpp

184177	0b2934b
182650	f2dcf35
181703	7bef4e2
  source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp

182683	0d91b80
  source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp

Sponsored by:	DARPA, AFRL
This commit is contained in:
emaste 2013-08-24 10:06:51 +00:00
parent 739c3b84b8
commit 7b3e1df40a
6 changed files with 80 additions and 37 deletions

View File

@ -336,19 +336,45 @@ private:
/// @return
/// True in case of failure, false in case of success.
//------------------------------------------------------------------
virtual bool finalizeMemory(std::string *ErrMsg) {
// TODO: Ensure that the instruction cache is flushed because
// relocations are updated by dy-load. See:
// sys::Memory::InvalidateInstructionCache
// llvm::SectionMemoryManager
return false;
}
bool applyPermissions(std::string *ErrMsg) { return false; }
//------------------------------------------------------------------
/// Passthrough interface stub
//------------------------------------------------------------------
virtual void deallocateFunctionBody(void *Body);
//------------------------------------------------------------------
/// Passthrough interface stub
//------------------------------------------------------------------
virtual uint8_t* startExceptionTable(const llvm::Function* F,
uintptr_t &ActualSize);
//------------------------------------------------------------------
/// Complete the exception table for a function, and add it to the
/// m_exception_tables map
///
/// @param[in] F
/// The function whose exception table is being written.
///
/// @param[in] TableStart
/// The first byte of the exception table.
///
/// @param[in] TableEnd
/// The last byte of the exception table.
///
/// @param[in] FrameRegister
/// I don't know what this does, but it's passed through.
//------------------------------------------------------------------
virtual void endExceptionTable(const llvm::Function *F,
uint8_t *TableStart,
uint8_t *TableEnd,
uint8_t* FrameRegister);
//------------------------------------------------------------------
/// Passthrough interface stub
//------------------------------------------------------------------
virtual void deallocateExceptionTable(void *ET);
//------------------------------------------------------------------
/// Passthrough interface stub
//------------------------------------------------------------------

View File

@ -52,7 +52,7 @@
#include "llvm/ADT/StringRef.h"
#include "llvm/ExecutionEngine/ExecutionEngine.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/PathV1.h"
#include "llvm/Support/TargetSelect.h"
#if defined(__FreeBSD__)
@ -81,16 +81,19 @@ using namespace lldb_private;
//===----------------------------------------------------------------------===//
std::string GetBuiltinIncludePath(const char *Argv0) {
SmallString<128> P(llvm::sys::fs::getMainExecutable(
Argv0, (void *)(intptr_t) GetBuiltinIncludePath));
if (!P.empty()) {
llvm::sys::path::remove_filename(P); // Remove /clang from foo/bin/clang
llvm::sys::path::remove_filename(P); // Remove /bin from foo/bin
llvm::sys::Path P =
llvm::sys::Path::GetMainExecutable(Argv0,
(void*)(intptr_t) GetBuiltinIncludePath);
if (!P.isEmpty()) {
P.eraseComponent(); // Remove /clang from foo/bin/clang
P.eraseComponent(); // Remove /bin from foo/bin
// Get foo/lib/clang/<version>/include
llvm::sys::path::append(P, "lib", "clang", CLANG_VERSION_STRING,
"include");
P.appendComponent("lib");
P.appendComponent("clang");
P.appendComponent(CLANG_VERSION_STRING);
P.appendComponent("include");
}
return P.str();

View File

@ -563,6 +563,28 @@ IRExecutionUnit::MemoryManager::deallocateFunctionBody(void *Body)
m_default_mm_ap->deallocateFunctionBody(Body);
}
uint8_t*
IRExecutionUnit::MemoryManager::startExceptionTable(const llvm::Function* F,
uintptr_t &ActualSize)
{
return m_default_mm_ap->startExceptionTable(F, ActualSize);
}
void
IRExecutionUnit::MemoryManager::endExceptionTable(const llvm::Function *F,
uint8_t *TableStart,
uint8_t *TableEnd,
uint8_t* FrameRegister)
{
m_default_mm_ap->endExceptionTable(F, TableStart, TableEnd, FrameRegister);
}
void
IRExecutionUnit::MemoryManager::deallocateExceptionTable(void *ET)
{
m_default_mm_ap->deallocateExceptionTable (ET);
}
lldb::addr_t
IRExecutionUnit::GetRemoteAddressForLocal (lldb::addr_t local_address)
{

View File

@ -553,8 +553,9 @@ FileSpec::ResolveExecutableLocation ()
if (file_cstr)
{
const std::string file_str (file_cstr);
std::string path = llvm::sys::FindProgramByName (file_str);
llvm::StringRef dir_ref = llvm::sys::path::parent_path(path);
llvm::sys::Path path = llvm::sys::Program::FindProgramByName (file_str);
const std::string &path_str = path.str();
llvm::StringRef dir_ref = llvm::sys::path::parent_path(path_str);
//llvm::StringRef dir_ref = path.getDirname();
if (! dir_ref.empty())
{

View File

@ -10,7 +10,6 @@
#include "DisassemblerLLVMC.h"
#include "llvm-c/Disassembler.h"
#include "llvm/ADT/OwningPtr.h"
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCDisassembler.h"
@ -18,7 +17,6 @@
#include "llvm/MC/MCInstPrinter.h"
#include "llvm/MC/MCInstrInfo.h"
#include "llvm/MC/MCRegisterInfo.h"
#include "llvm/MC/MCRelocationInfo.h"
#include "llvm/MC/MCSubtargetInfo.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/MemoryObject.h"
@ -442,30 +440,23 @@ DisassemblerLLVMC::LLVMCDisassembler::LLVMCDisassembler (const char *triple, uns
m_subtarget_info_ap.reset(curr_target->createMCSubtargetInfo(triple, "",
features_str));
m_asm_info_ap.reset(curr_target->createMCAsmInfo(*curr_target->createMCRegInfo(triple), triple));
m_asm_info_ap.reset(curr_target->createMCAsmInfo(triple));
if (m_instr_info_ap.get() == NULL || m_reg_info_ap.get() == NULL || m_subtarget_info_ap.get() == NULL || m_asm_info_ap.get() == NULL)
{
m_is_valid = false;
return;
}
m_context_ap.reset(new llvm::MCContext(m_asm_info_ap.get(), m_reg_info_ap.get(), 0));
m_context_ap.reset(new llvm::MCContext(*m_asm_info_ap.get(), *(m_reg_info_ap.get()), 0));
m_disasm_ap.reset(curr_target->createMCDisassembler(*m_subtarget_info_ap.get()));
if (m_disasm_ap.get() && m_context_ap.get())
if (m_disasm_ap.get())
{
llvm::OwningPtr<llvm::MCRelocationInfo> RelInfo(curr_target->createMCRelocationInfo(triple, *m_context_ap.get()));
if (!RelInfo)
{
m_is_valid = false;
return;
}
m_disasm_ap->setupForSymbolicDisassembly(NULL,
DisassemblerLLVMC::SymbolLookupCallback,
(void *) &owner,
m_context_ap.get(),
RelInfo);
DisassemblerLLVMC::SymbolLookupCallback,
(void *) &owner,
m_context_ap.get());
unsigned asm_printer_variant;
if (flavor == ~0U)

View File

@ -25,7 +25,7 @@
#include "Utility/ARM_DWARF_Registers.h"
#include "llvm/Support/MathExtras.h" // for SignExtend32 template function
// and countTrailingZeros function
// and CountTrailingZeros_32 function
using namespace lldb;
using namespace lldb_private;
@ -47,7 +47,7 @@ using namespace lldb_private;
static uint32_t
CountITSize (uint32_t ITMask) {
// First count the trailing zeros of the IT mask.
uint32_t TZ = llvm::countTrailingZeros(ITMask);
uint32_t TZ = llvm::CountTrailingZeros_32(ITMask);
if (TZ > 3)
{
#ifdef LLDB_CONFIGURATION_DEBUG