unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
blob 03b2ca810d7f54ad6b3baba05a109814482f24a6 2384 bytes (raw)
name: gnu/packages/patches/llvm-OProfile-line-num.patch 	 # note: path name is non-authoritative(*)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
 
commit 4840cf7299bb312125d41fc84733c15c2370f18e
Author: DokFaust <rodia@autistici.org>
Date:   Fri Jun 8 19:23:01 2018 +0200

    Add debug line-level code information to OProfile module

diff --git a/lib/ExecutionEngine/OProfileJIT/LLVMBuild.txt b/lib/ExecutionEngine/OProfileJIT/LLVMBuild.txt
index 7d5550046a5..ea100286318 100644
--- a/lib/ExecutionEngine/OProfileJIT/LLVMBuild.txt
+++ b/lib/ExecutionEngine/OProfileJIT/LLVMBuild.txt
@@ -24 +24 @@ parent = ExecutionEngine
-required_libraries = Support Object ExecutionEngine
+required_libraries = DebugInfoDWARF Support Object ExecutionEngine
diff --git a/lib/ExecutionEngine/OProfileJIT/OProfileJITEventListener.cpp b/lib/ExecutionEngine/OProfileJIT/OProfileJITEventListener.cpp
index 3581d645839..045ecb82853 100644
--- a/lib/ExecutionEngine/OProfileJIT/OProfileJITEventListener.cpp
+++ b/lib/ExecutionEngine/OProfileJIT/OProfileJITEventListener.cpp
@@ -26,0 +27,2 @@
+#include "llvm/DebugInfo/DIContext.h"
+#include "llvm/DebugInfo/DWARF/DWARFContext.h"
@@ -86,0 +89,2 @@ void OProfileJITEventListener::NotifyObjectEmitted(
+  std::unique_ptr<DIContext> Context = DWARFContext::create(DebugObj);
+  std::string SourceFileName;
@@ -111 +115,23 @@ void OProfileJITEventListener::NotifyObjectEmitted(
-    // TODO: support line number info (similar to IntelJITEventListener.cpp)
+    DILineInfoTable Lines = Context->getLineInfoForAddressRange(Addr, Size);
+    DILineInfoTable::iterator Begin = Lines.begin();
+    DILineInfoTable::iterator End = Lines.end();
+    size_t i = 0;
+
+    size_t num_entries = std::distance(Begin, End);
+    static struct debug_line_info* debug_line;
+    debug_line = (struct debug_line_info * )calloc(num_entries, sizeof(struct debug_line_info));
+
+    for(DILineInfoTable::iterator It=Begin; It != End; ++It){
+        i = std::distance(Begin,It);
+        debug_line[i].vma = (unsigned long) It->first;
+        debug_line[i].lineno = It->second.Line;
+        SourceFileName = Lines.front().second.FileName;
+        debug_line[i].filename = const_cast<char *>(SourceFileName.c_str());
+    }
+
+    if(Wrapper->op_write_debug_line_info((void*) Addr, num_entries, debug_line) == -1) {
+        DEBUG(dbgs() << "Failed to tell OProfiler about debug object at ["
+                     << (void*) Addr << "-" << ((char *) Addr + Size)
+                     <<  "]\n");
+        continue;
+    }

debug log:

solving 03b2ca810 ...
found 03b2ca810 in https://yhetil.org/guix-patches/20190423094936.27413-1-anothersms@gmail.com/ ||
	https://yhetil.org/guix-patches/20190425075114.10284-1-anothersms@gmail.com/

applying [1/1] https://yhetil.org/guix-patches/20190423094936.27413-1-anothersms@gmail.com/
diff --git a/gnu/packages/patches/llvm-OProfile-line-num.patch b/gnu/packages/patches/llvm-OProfile-line-num.patch
new file mode 100644
index 0000000000..03b2ca810d

Checking patch gnu/packages/patches/llvm-OProfile-line-num.patch...
Applied patch gnu/packages/patches/llvm-OProfile-line-num.patch cleanly.

skipping https://yhetil.org/guix-patches/20190425075114.10284-1-anothersms@gmail.com/ for 03b2ca810d
index at:
100644 03b2ca810d7f54ad6b3baba05a109814482f24a6	gnu/packages/patches/llvm-OProfile-line-num.patch

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).