emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/realgud-lldb 2b329f9 22/56: Hack to use "global" to res


From: Rocky Bernstein
Subject: [elpa] externals/realgud-lldb 2b329f9 22/56: Hack to use "global" to resolve names.
Date: Thu, 23 May 2019 02:11:39 -0400 (EDT)

branch: externals/realgud-lldb
commit 2b329f9792d029610ab6cd64431162001267186a
Author: rocky <address@hidden>
Commit: rocky <address@hidden>

    Hack to use "global" to resolve names.
---
 lldb/core.el | 35 +++++++++++++++++++++++++++++++++++
 lldb/init.el |  4 +++-
 2 files changed, 38 insertions(+), 1 deletion(-)

diff --git a/lldb/core.el b/lldb/core.el
index 5e9e3bb..20341b0 100644
--- a/lldb/core.el
+++ b/lldb/core.el
@@ -41,6 +41,41 @@
    'realgud:lldb-minibuffer-history
    opt-debugger))
 
+(defvar realgud:lldb-file-remap (make-hash-table :test 'equal)
+  "How to remap lldb files in  when we otherwise can't find in
+  the filesystem. The hash key is the file string we saw, and the
+  value is associated filesystem string presumably in the
+  filesystem")
+
+(defun realgud:lldb-find-file(filename)
+  "A find-file specific for lldb. We use `global' to map a
+name to a filename. Failing that
+we will prompt for a mapping and save that in `realgud:lldb-file-remap' when
+that works."
+  (let ((resolved-filename filename)
+       (global-output)
+       (remapped-filename (gethash filename realgud:lldb-file-remap)))
+    (cond
+     ((and remapped-filename (stringp remapped-filename)
+          (file-exists-p remapped-filename)) remapped-filename)
+     ((file-exists-p filename) filename)
+     ((and (setq resolved-filename (shell-command-to-string (format "global -P 
%s" filename)))
+          (stringp resolved-filename)
+          (file-exists-p (setq resolved-filename (realgud:strip 
resolved-filename))))
+       (puthash filename resolved-filename realgud:lldb-file-remap))
+     ('t
+      (setq resolved-filename
+           (buffer-file-name
+            (compilation-find-file (point-marker) filename nil "")))
+      (puthash filename resolved-filename realgud:lldb-file-remap)))
+     ))
+
+(defun realgud:lldb-loc-fn-callback(text filename lineno source-str
+                                        ignore-file-re cmd-mark)
+  (realgud:file-loc-from-line filename lineno
+                             cmd-mark source-str nil
+                             ignore-file-re 'realgud:lldb-find-file))
+
 (defun realgud:lldb-parse-cmd-args (orig-args)
   "Parse command line ARGS for the annotate level and name of script to debug.
 
diff --git a/lldb/init.el b/lldb/init.el
index 42a9e6e..a8c4961 100644
--- a/lldb/init.el
+++ b/lldb/init.el
@@ -38,7 +38,9 @@ realgud-loc-pat struct")
 ;; Some versions of lldb insert "frame" and some don't.
 (defconst realgud:lldb-frame-num-regexp
   (format "[ ]*\\(?:frame \\)?#%s[:]? "
-         realgud:regexp-captured-num realgud:regexp-captured-num))
+         realgud:regexp-captured-num))
+
+(setf (gethash "loc-callback-fn" realgud:lldb-pat-hash) 
'realgud:lldb-loc-fn-callback)
 
 ;; realgud-loc-pat that describes a lldb location generally shown
 ;; before a command prompt.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]