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

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

[elpa] externals/realgud-lldb abffd0d: Misc fixes


From: Stefan Monnier
Subject: [elpa] externals/realgud-lldb abffd0d: Misc fixes
Date: Sat, 17 Apr 2021 10:43:29 -0400 (EDT)

branch: externals/realgud-lldb
commit abffd0d2d23f6c87be5dc5d36e948af92de5df86
Author: rocky <rocky@gnu.org>
Commit: rocky <rocky@gnu.org>

    Misc fixes
    
    Copyright in cask-install.el
    Some file reading fixes, I think.
---
 cask-install.el | 15 +++++++++++
 lldb/core.el    | 81 ++++++++++++++++++++++++++++++---------------------------
 lldb/init.el    |  3 ++-
 3 files changed, 59 insertions(+), 40 deletions(-)

diff --git a/cask-install.el b/cask-install.el
index 9d964cf..ad0d65a 100644
--- a/cask-install.el
+++ b/cask-install.el
@@ -1,3 +1,18 @@
+;; Copyright (C) 2021 Free Software Foundation, Inc
+
+;; This program is free software: you can redistribute it and/or
+;; modify it under the terms of the GNU General Public License as
+;; published by the Free Software Foundation, either version 3 of the
+;; License, or (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful, but
+;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+;; General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see
+;; <http://www.gnu.org/licenses/>.
 (require 'cask "~/.cask/cask.el")
 (let*
     ((parent-dir
diff --git a/lldb/core.el b/lldb/core.el
index 66ecacf..9d85481 100644
--- a/lldb/core.el
+++ b/lldb/core.el
@@ -22,6 +22,7 @@
 (declare-function realgud-lang-mode? 'realgud-lang)
 (declare-function realgud-parse-command-arg 'realgud-core)
 (declare-function realgud-query-cmdline 'realgud-core)
+(declare-function realgud--file-matching-suffix 'realgud-file)
 
 ;; FIXME: I think the following could be generalized and moved to
 ;; realgud-... probably via a macro.
@@ -48,45 +49,47 @@
   value is associated filesystem string presumably in the
   filesystem")
 
-(defun realgud--lldb-find-file(cmd-marker filename directory)
-  "A find-file specific for lldb. We will prompt for a mapping and save that in
-`realgud--lldb-file-remap' when that works."
-  (let ((resolved-filename filename)
-       (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)
-     ('t
-      (setq resolved-filename
-           (buffer-file-name
-            (compilation-find-file (point-marker) filename nil "")))
-      (puthash filename resolved-filename realgud--lldb-file-remap)))
-     ))
-
-(defun realgud--cmd-lldb-break()
-  "Set a breakpoint storing mapping between a file and its basename"
-  (let* ((resolved-filename (realgud-expand-format "%X"))
-        (cmdbuf (realgud-get-cmdbuf))
-        (filename (file-name-nondirectory resolved-filename)))
-
-    ;; Save mapping from basename to long name so that we know what's
-    ;; up in a "Breakpoint set at" message
-    (puthash filename resolved-filename realgud--lldb-file-remap)
-
-    ;; Run actual command
-    (realgud:cmd-break)
-    ))
-
-
-;; FIXME: setting a breakpoint should add a[ file-to-basename mapping
-;; so that when this is called it can look up the short name and
-;; remap it.
-(defun realgud--lldb-loc-fn-callback(text filename lineno source-str
-                                        cmd-mark directory column)
-  (realgud:file-loc-from-line filename lineno
-                             cmd-mark source-str nil nil directory))
-                             ;; 'realgud--lldb-find-file directory))
+;; ;; FIXME: replace with realgud--file-matching-suffix when that
+;; ;; hits the streets
+;; (defun realgud--lldb-matching-suffix(paths suffix)
+;;   (seq-filter (lambda (x) (string-suffix-p suffix x)) paths))
+
+;; ;; FIXME this might not need to be needed with the newer realgud
+;; (defun realgud--lldb-find-file(filename cmd-marker)
+;;   "A find-file specific for lldb. We will prompt for a mapping and save 
that in
+;; `realgud--lldb-file-remap' when that works."
+;;   (let ((resolved-filename filename)
+;;     (remapped-filename (gethash filename realgud--lldb-file-remap))
+;;     (matching-list)
+;;     (buffer-files))
+;;     (cond
+;;      ;; If this filename is already in a list of remapped file names, use 
that.
+;;      ((and remapped-filename (stringp remapped-filename)
+;;        (file-exists-p remapped-filename)) remapped-filename)
+;;      ;;
+;;      ((file-exists-p filename) filename)
+
+;;      ;; If we can find filename, e.g. "src/code.c" as a suffix of file in
+;;      ;; the list of buffers seen, that user that
+;;      ((and
+;;        (setq buffer-files
+;;          (with-current-buffer (marker-buffer cmd-marker)
+;;            (mapcar (lambda (buf) (buffer-file-name buf))
+;;                    (realgud-cmdbuf-info-srcbuf-list realgud-cmdbuf-info))))
+;;        (setq matching-list (realgud--lldb-matching-suffix buffer-files 
filename))
+;;        (car matching-list)))
+;;      (t nil)
+;;      )))
+
+;; ;; FIXME this might not need to be needed with the newer realgud
+;; (defun realgud--lldb-loc-fn-callback(text filename lineno source-str
+;;                                       cmd-mark directory column)
+;;   (let ((resolved-filename
+;;      (or (realgud--lldb-find-file filename cmd-mark) filename)))
+;;     (realgud:file-loc-from-line resolved-filename lineno
+;;                             cmd-mark source-str nil nil directory)
+;;     ;; 'realgud--lldb-find-file directory
+;;   ))
 
 (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 293e817..38053a0 100644
--- a/lldb/init.el
+++ b/lldb/init.el
@@ -55,7 +55,8 @@ the debugger specific hash table, e.g. 
'realugd-lldd-pat-hash'.")
   (format "[ ]*\\(?:frame \\)?#%s[:]? "
          realgud:regexp-captured-num))
 
-(setf (gethash "loc-callback-fn" realgud--lldb-pat-hash) 
'realgud--lldb-loc-fn-callback)
+;; Not needed if realgud-20190724.2001 or later is used
+;; (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]