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

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

[elpa] master 20947cb 4/5: Merge commit 'd7bac581f04756582078cd9ea45e5a2


From: Rocky Bernstein
Subject: [elpa] master 20947cb 4/5: Merge commit 'd7bac581f04756582078cd9ea45e5a28406ee05c'
Date: Thu, 4 Aug 2016 03:03:26 +0000 (UTC)

branch: master
commit 20947cb461a44f2cb4e770e95c3ede7467e70186
Merge: 05c3099 d7bac58
Author: rocky <address@hidden>
Commit: rocky <address@hidden>

    Merge commit 'd7bac581f04756582078cd9ea45e5a28406ee05c'
---
 packages/realgud/realgud.el                   |    3 ++-
 packages/realgud/realgud/common/core.el       |   16 +++++++++----
 packages/realgud/realgud/common/helper.el     |    5 ++++
 packages/realgud/realgud/common/track.el      |   32 +++++++++++++++++++++++++
 packages/realgud/realgud/debugger/gdb/core.el |    7 +++---
 packages/realgud/test/test-regexp-remake.el   |   27 +++++++++++++--------
 6 files changed, 72 insertions(+), 18 deletions(-)

diff --git a/packages/realgud/realgud.el b/packages/realgud/realgud.el
index 8e0fa97..b16cc48 100644
--- a/packages/realgud/realgud.el
+++ b/packages/realgud/realgud.el
@@ -24,7 +24,8 @@
 
 ;;; Commentary:
 
-;; A modular GNU Emacs front-end for interacting with external debuggers.
+;; A modular, extensible GNU Emacs front-end for interacting with
+;; external debuggers.
 ;;
 ;; Quick start: https://github.com/realgud/realgud/
 ;;
diff --git a/packages/realgud/realgud/common/core.el 
b/packages/realgud/realgud/common/core.el
index c051e26..ad5dd6a 100644
--- a/packages/realgud/realgud/common/core.el
+++ b/packages/realgud/realgud/common/core.el
@@ -1,4 +1,4 @@
-;; Copyright (C) 2010-2015 Free Software Foundation, Inc
+;; Copyright (C) 2010-2016 Free Software Foundation, Inc
 
 ;; Author: Rocky Bernstein <address@hidden>
 
@@ -12,7 +12,9 @@
 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 ;; GNU General Public License for more details.
 
-; (require 'term)
+;; (require 'term)
+(require 'files)
+
 (if (< emacs-major-version 24)
     (error
      "You need at least Emacs 24 or greater to run this - you have version %d"
@@ -195,10 +197,16 @@ the buffer and data associated with it are already gone."
   (message "That's all folks.... %s" string))
 
 (defun realgud:binary (file-name)
-"Return a priority for whether file-name is likely we can run gdb on"
-  (let ((output (shell-command-to-string (format "file %s" file-name))))
+  "Return a whether FILE-NAME is executable or not or very large"
+  (let* ((truename (file-chase-links file-name))
+        (output (shell-command-to-string
+                 (format "file %s" truename)))
+        (filesize (nth 7 (file-attributes truename)))
+        )
     (cond
      ((string-match "ELF" output) t)
+     ((and large-file-warning-threshold filesize
+          (> filesize large-file-warning-threshold)) t)
      ('t nil))))
 
 
diff --git a/packages/realgud/realgud/common/helper.el 
b/packages/realgud/realgud/common/helper.el
index 82bc878..705100d 100644
--- a/packages/realgud/realgud/common/helper.el
+++ b/packages/realgud/realgud/common/helper.el
@@ -13,6 +13,7 @@
 ;; GNU General Public License for more details.
 
 (require 'cl-lib)
+(require 'cl)
 
 ;;; Miscellaneous utility functions
 (require 'load-relative)
@@ -102,3 +103,7 @@ gives:
 ;;        (eval (intern var-str))))
 
 (provide-me "realgud-")
+
+;; Local Variables:
+;; byte-compile-warnings: (not cl-functions)
+;; End:
diff --git a/packages/realgud/realgud/common/track.el 
b/packages/realgud/realgud/common/track.el
index 971534b..f047c13 100644
--- a/packages/realgud/realgud/common/track.el
+++ b/packages/realgud/realgud/common/track.el
@@ -206,6 +206,10 @@ evaluating (realgud-cmdbuf-info-loc-regexp 
realgud-cmdbuf-info)"
                                               (realgud-cmdbuf-pat 
"brkpt-disable")
                                               nil)
              (setq frame-num (realgud-track-selected-frame text))
+             (if (and frame-num (not loc))
+                 (setq loc (realgud-track-loc-from-selected-frame
+                            text cmd-mark)))
+
              (setq bp-loc (realgud-track-bp-loc text-sans-loc cmd-mark cmdbuf))
              (if bp-loc
                  (let ((src-buffer (realgud-loc-goto bp-loc)))
@@ -600,6 +604,30 @@ loc-regexp pattern"
   )
 
 
+(defun realgud-track-loc-from-selected-frame(text cmd-mark &optional
+                                                 opt-regexp opt-ignore-file-re)
+  "Return a selected frame number found in TEXT or nil if none found."
+  (if (realgud-cmdbuf?)
+      (let ((selected-frame-pat (realgud-cmdbuf-pat "selected-frame"))
+           (frame-num-regexp)
+           (ignore-file-re (or opt-ignore-file-re
+                               (realgud-sget 'cmdbuf-info 'ignore-file-re))))
+       (if (and selected-frame-pat
+                (setq frame-num-regexp (realgud-loc-pat-regexp
+                                        selected-frame-pat)))
+           (if (string-match frame-num-regexp text)
+               (let* ((file-group (realgud-loc-pat-file-group 
selected-frame-pat))
+                      (line-group (realgud-loc-pat-line-group 
selected-frame-pat))
+                      (filename (match-string file-group text))
+                      (lineno (string-to-number (match-string line-group 
text))))
+                 (if (and filename lineno)
+                     (realgud:file-loc-from-line filename lineno
+                                                 cmd-mark nil nil 
ignore-file-re)
+                   nil))
+             nil)
+         nil))
+    nil))
+
 (defun realgud-track-termination?(text)
   "Return 't and call `realgud:terminate' we we have a termination message"
   (if (realgud-cmdbuf?)
@@ -762,3 +790,7 @@ command buffer's debugger location pattern against the line 
at PT."
     ))
 
 (provide-me "realgud-")
+
+;; Local Variables:
+;; byte-compile-warnings: (not cl-functions)
+;; End:
diff --git a/packages/realgud/realgud/debugger/gdb/core.el 
b/packages/realgud/realgud/debugger/gdb/core.el
index 22fbed3..5a36a23 100644
--- a/packages/realgud/realgud/debugger/gdb/core.el
+++ b/packages/realgud/realgud/debugger/gdb/core.el
@@ -17,6 +17,7 @@
 
 (eval-when-compile (require 'cl))
 
+(require 'files)
 (require 'load-relative)
 (require-relative-list '("../../common/track"
                         "../../common/core"
@@ -147,15 +148,15 @@ Note that path elements have been expanded via 
`expand-file-name'.
 (defvar realgud:gdb-command-name)
 
 (defun realgud:gdb-executable (file-name)
-"Return a priority for whether file-name is likely we can run gdb on"
-  (let ((output (shell-command-to-string (format "file %s" file-name))))
+  "Return a priority for whether FILE-NAME is likely we can run gdb on"
+  (let ((output (shell-command-to-string
+                (format "file %s" (file-chase-links file-name)))))
     (cond
      ((string-match "ASCII" output) 2)
      ((string-match "ELF" output) 7)
      ((string-match "executable" output) 6)
      ('t 5))))
 
-
 (defun realgud:gdb-suggest-invocation (&optional debugger-name)
   "Suggest a gdb command invocation. Here is the priority we use:
 * an executable file with the name of the current buffer stripped of its 
extension
diff --git a/packages/realgud/test/test-regexp-remake.el 
b/packages/realgud/test/test-regexp-remake.el
index 1a3390c..1aa2748 100644
--- a/packages/realgud/test/test-regexp-remake.el
+++ b/packages/realgud/test/test-regexp-remake.el
@@ -7,6 +7,13 @@
 
 (test-simple-start)
 
+(eval-when-compile
+  (defvar prompt-pat) (defvar frame-pat)   (defvar frame-re)
+  (defvar loc-pat)    (defvar prompt-pat)  (defvar test-text)
+  (defvar file-group) (defvar line-group)  (defvar test-pos)
+  (defvar num-pat)    (defvar num-group)   (defvar realgud:remake-pat-hash)
+)
+
 (set (make-local-variable 'prompt-pat)
      (gethash "prompt"             realgud:remake-pat-hash))
 (set (make-local-variable 'frame-pat)
@@ -17,7 +24,7 @@
 (prompt-match  "remake<<1>> " "1" "recursive remake %s")
 
 (note "remake debugger-backtrace")
-(setq s1
+(setq test-text
       "=>#0  Makefile.in at /tmp/Makefile:216
   #1  Makefile at /tmp/Makefile:230
 ")
@@ -31,31 +38,31 @@
 (set (make-local-variable 'line-group)
      (realgud-loc-pat-line-group frame-pat))
 
-(assert-equal 0 (string-match frame-re s1))
-(assert-equal "0" (substring s1
+(assert-equal 0 (string-match frame-re test-text))
+(assert-equal "0" (substring test-text
                             (match-beginning num-group)
                             (match-end num-group)))
 (assert-equal "/tmp/Makefile"
-             (substring s1
+             (substring test-text
                         (match-beginning file-group)
                         (match-end file-group)))
 (assert-equal "216"
-             (substring s1
+             (substring test-text
                         (match-beginning line-group)
                         (match-end line-group)))
-(set (make-local-variable 'pos)
+(set (make-local-variable 'test-pos)
      (match-end 0))
 
-(assert-equal 39 (string-match frame-re s1 pos))
-(assert-equal "1" (substring s1
+(assert-equal 39 (string-match frame-re test-text test-pos))
+(assert-equal "1" (substring test-text
                             (match-beginning num-group)
                             (match-end num-group)))
 (assert-equal "/tmp/Makefile"
-             (substring s1
+             (substring test-text
                         (match-beginning file-group)
                         (match-end file-group)))
 (assert-equal "230"
-             (substring s1
+             (substring test-text
                         (match-beginning line-group)
                         (match-end line-group)))
 



reply via email to

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