diff options
| -rw-r--r-- | lldb/lit/Breakpoint/Inputs/jitbp.cpp | 2 | ||||
| -rw-r--r-- | lldb/lit/Breakpoint/jitbp_elf.test | 12 | ||||
| -rw-r--r-- | lldb/lit/helper/toolchain.py | 2 | ||||
| -rw-r--r-- | lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp | 4 | ||||
| -rw-r--r-- | lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp | 2 | 
5 files changed, 20 insertions, 2 deletions
diff --git a/lldb/lit/Breakpoint/Inputs/jitbp.cpp b/lldb/lit/Breakpoint/Inputs/jitbp.cpp new file mode 100644 index 00000000000..447d9d66df8 --- /dev/null +++ b/lldb/lit/Breakpoint/Inputs/jitbp.cpp @@ -0,0 +1,2 @@ +int jitbp() { return 0; } +int main() { return jitbp(); } diff --git a/lldb/lit/Breakpoint/jitbp_elf.test b/lldb/lit/Breakpoint/jitbp_elf.test new file mode 100644 index 00000000000..6bf8eab6e6e --- /dev/null +++ b/lldb/lit/Breakpoint/jitbp_elf.test @@ -0,0 +1,12 @@ +# REQUIRES: target-x86_64 +# XFAIL: system-windows + +# RUN: %clang -g -S -emit-llvm --target=x86_64-unknown-unknown-elf -o %t.ll %p/Inputs/jitbp.cpp +# RUN: %lldb -b -o 'settings set plugin.jit-loader.gdb.enable on' -o 'b jitbp' -o 'run -jit-kind=mcjit %t.ll' lli | FileCheck %s + +# CHECK: Breakpoint 1: no locations (pending). +# CHECK: (lldb) run -jit-kind=mcjit {{.*}}/jitbp_elf.test.tmp.ll +# CHECK: 1 location added to breakpoint 1 +# CHECK: Process {{.*}} stopped +# CHECK: JIT(0x{{.*}})`jitbp: +# CHECK: Process {{.*}} launched: {{.*}} diff --git a/lldb/lit/helper/toolchain.py b/lldb/lit/helper/toolchain.py index 61dfd84535d..08fb7fe8980 100644 --- a/lldb/lit/helper/toolchain.py +++ b/lldb/lit/helper/toolchain.py @@ -134,6 +134,6 @@ def use_support_substitutions(config):      support_tools = ['yaml2obj', 'obj2yaml', 'llvm-pdbutil',                       'llvm-mc', 'llvm-readobj', 'llvm-objdump', -                     'llvm-objcopy'] +                     'llvm-objcopy', 'lli']      additional_tool_dirs += [config.lldb_tools_dir, config.llvm_tools_dir]      llvm_config.add_tool_substitutions(support_tools, additional_tool_dirs) diff --git a/lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp b/lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp index 4fbdd22b84b..890d9f996be 100644 --- a/lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp +++ b/lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp @@ -327,6 +327,10 @@ bool JITLoaderGDB::ReadJITDescriptorImpl(bool all_entries) {            FileSpec(jit_name), symbolfile_addr, symbolfile_size);        if (module_sp && module_sp->GetObjectFile()) { +        // Object formats (like ELF) have no representation for a JIT type. +        // We will get it wrong, if we deduce it from the header. +        module_sp->GetObjectFile()->SetType(ObjectFile::eTypeJIT); +          // load the symbol table right away          module_sp->GetObjectFile()->GetSymtab(); diff --git a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp index d41d9722fa2..ff499dbad8c 100644 --- a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp +++ b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp @@ -1865,7 +1865,7 @@ void ObjectFileELF::CreateSections(SectionList &unified_section_list) {      return;    m_sections_up = llvm::make_unique<SectionList>(); -  VMAddressProvider address_provider(CalculateType()); +  VMAddressProvider address_provider(GetType());    size_t LoadID = 0;    for (const auto &EnumPHdr : llvm::enumerate(ProgramHeaders())) {  | 

