From be3a1b14dc45898aca1b9a85a86849614e82aa87 Mon Sep 17 00:00:00 2001 From: Sean Callanan Date: Tue, 26 Oct 2010 00:31:56 +0000 Subject: [PATCH] Fixed a problem where function calls on i386 weren't being generated correctly. Also added a messy way to single-step through expressions that I will improve soon. llvm-svn: 117342 --- lldb/source/Expression/ClangExpressionDeclMap.cpp | 6 +++++- lldb/source/Expression/ClangExpressionParser.cpp | 8 +++++++- lldb/source/Expression/IRForTarget.cpp | 3 +++ lldb/source/Target/ThreadPlanCallFunction.cpp | 5 ++++- 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/lldb/source/Expression/ClangExpressionDeclMap.cpp b/lldb/source/Expression/ClangExpressionDeclMap.cpp index 5a32013e3997..4b540c0fa38a 100644 --- a/lldb/source/Expression/ClangExpressionDeclMap.cpp +++ b/lldb/source/Expression/ClangExpressionDeclMap.cpp @@ -88,8 +88,12 @@ ClangExpressionDeclMap::~ClangExpressionDeclMap() } if (m_materialized_location) - { + { +//#define SINGLE_STEP_EXPRESSIONS + +#ifndef SINGLE_STEP_EXPRESSIONS m_exe_ctx.process->DeallocateMemory(m_materialized_location); +#endif m_materialized_location = 0; } } diff --git a/lldb/source/Expression/ClangExpressionParser.cpp b/lldb/source/Expression/ClangExpressionParser.cpp index 94c1c0134214..d0f276c211cb 100644 --- a/lldb/source/Expression/ClangExpressionParser.cpp +++ b/lldb/source/Expression/ClangExpressionParser.cpp @@ -467,13 +467,19 @@ ClangExpressionParser::MakeJIT (lldb::addr_t &func_addr, std::string error_string; + llvm::Reloc::Model relocation_model = llvm::TargetMachine::getRelocationModel(); + + llvm::TargetMachine::setRelocationModel(llvm::Reloc::PIC_); + m_execution_engine.reset(llvm::ExecutionEngine::createJIT (module, &error_string, m_jit_mm, - CodeGenOpt::Default, + CodeGenOpt::Less, true, CodeModel::Small)); + llvm::TargetMachine::setRelocationModel(relocation_model); + if (!m_execution_engine.get()) { err.SetErrorToGenericError(); diff --git a/lldb/source/Expression/IRForTarget.cpp b/lldb/source/Expression/IRForTarget.cpp index 5b189492b852..fbb2eda0240a 100644 --- a/lldb/source/Expression/IRForTarget.cpp +++ b/lldb/source/Expression/IRForTarget.cpp @@ -335,6 +335,9 @@ IRForTarget::RewriteObjCSelector(Instruction* selector_load, if (!m_decl_map->GetFunctionAddress (g_sel_registerName_str, srN_addr)) return false; + if (log) + log->Printf("Found sel_registerName at 0x%llx", srN_addr); + // Build the function type: struct objc_selector *sel_registerName(uint8_t*) // The below code would be "more correct," but in actuality what's required is uint8_t* diff --git a/lldb/source/Target/ThreadPlanCallFunction.cpp b/lldb/source/Target/ThreadPlanCallFunction.cpp index 2f5f7cca1cd7..1e51762147ac 100644 --- a/lldb/source/Target/ThreadPlanCallFunction.cpp +++ b/lldb/source/Target/ThreadPlanCallFunction.cpp @@ -276,10 +276,13 @@ ThreadPlanCallFunction::RunState () void ThreadPlanCallFunction::DidPush () { +//#define SINGLE_STEP_EXPRESSIONS + +#ifndef SINGLE_STEP_EXPRESSIONS m_subplan_sp.reset(new ThreadPlanRunToAddress(m_thread, m_start_addr, m_stop_other_threads)); m_thread.QueueThreadPlan(m_subplan_sp, false); - +#endif } bool