[Lldb-commits] [PATCH] D61611: [JITLoaderGDB] Set eTypeJIT for objects read from JIT descriptors

Stefan Gränitz via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed May 8 10:12:46 PDT 2019


sgraenitz updated this revision to Diff 198692.
sgraenitz added a comment.
Herald added a reviewer: alexshap.

Add lit test


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D61611/new/

https://reviews.llvm.org/D61611

Files:
  lldb/lit/Breakpoint/Inputs/jitbp.cpp
  lldb/lit/Breakpoint/jitbp_elf.test
  lldb/lit/helper/toolchain.py
  lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp
  lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp


Index: lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
===================================================================
--- lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
+++ lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
@@ -1865,7 +1865,7 @@
     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())) {
Index: lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp
===================================================================
--- lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp
+++ lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp
@@ -327,6 +327,10 @@
           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();
 
Index: lldb/lit/helper/toolchain.py
===================================================================
--- lldb/lit/helper/toolchain.py
+++ lldb/lit/helper/toolchain.py
@@ -129,6 +129,6 @@
 
     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)
Index: lldb/lit/Breakpoint/jitbp_elf.test
===================================================================
--- /dev/null
+++ lldb/lit/Breakpoint/jitbp_elf.test
@@ -0,0 +1,13 @@
+# REQUIRES: target-x86_64, system-linux, native
+
+# RUN: %clang -g -S -emit-llvm -o %t.ll %p/Inputs/jitbp.cpp
+# RUN: %lldb -b -o 'b jitbp' -o 'run -jit-kind=mcjit %t.ll' lli | FileCheck %s
+
+# CHECK: (lldb) target create "{{.*}}/lli"
+# CHECK: (lldb) b jitbp
+# 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: {{.*}}
Index: lldb/lit/Breakpoint/Inputs/jitbp.cpp
===================================================================
--- /dev/null
+++ lldb/lit/Breakpoint/Inputs/jitbp.cpp
@@ -0,0 +1,2 @@
+int jitbp() { return 0; }
+int main() { return jitbp(); }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D61611.198692.patch
Type: text/x-patch
Size: 2723 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20190508/fc8f72b5/attachment.bin>


More information about the lldb-commits mailing list