emacs-diffs
[Top][All Lists]
Advanced

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

master f3e2148: Fix setting breakpoints in "M-x gdb" when a source file


From: Eli Zaretskii
Subject: master f3e2148: Fix setting breakpoints in "M-x gdb" when a source file is missing
Date: Tue, 15 Dec 2020 12:21:14 -0500 (EST)

branch: master
commit f3e21483106cb3ff64adcf21d30c8327a23a3401
Author: Eli Zaretskii <eliz@gnu.org>
Commit: Eli Zaretskii <eliz@gnu.org>

    Fix setting breakpoints in "M-x gdb" when a source file is missing
    
    * lisp/progmodes/gdb-mi.el (gdb-get-location): Fix control flow
    logic when "fullname" is not found.  Unquote and unescape the full
    file name by calling gdb-mi--c-string-from-string.  FLAG is a
    string, not a character.  (Bug#15051)
---
 lisp/progmodes/gdb-mi.el | 33 ++++++++++++++++++---------------
 1 file changed, 18 insertions(+), 15 deletions(-)

diff --git a/lisp/progmodes/gdb-mi.el b/lisp/progmodes/gdb-mi.el
index 4c248f7..330a851 100644
--- a/lisp/progmodes/gdb-mi.el
+++ b/lisp/progmodes/gdb-mi.el
@@ -3127,24 +3127,27 @@ See `def-gdb-auto-update-handler'."
   (concat "fullname=\\(" gdb--string-regexp "\\)"))
 
 (defun gdb-get-location (bptno line flag)
-  "Find the directory containing the relevant source file.
-Put in buffer and place breakpoint icon."
+  "Glean name of source file using `gdb-source-file-regexp', and visit it.
+Place breakpoint icon in its buffer."
   (goto-char (point-min))
   (catch 'file-not-found
-    (if (re-search-forward gdb-source-file-regexp nil t)
-       (delete (cons bptno "File not found") gdb-location-alist)
-      ;; FIXME: Why/how do we use (match-string 1) when the search failed?
-      (push (cons bptno (match-string 1)) gdb-location-alist)
-      (gdb-resync)
-      (unless (assoc bptno gdb-location-alist)
-       (push (cons bptno "File not found") gdb-location-alist)
-       (message-box "Cannot find source file for breakpoint location.
+    (let (source-file)
+      (if (re-search-forward gdb-source-file-regexp nil t)
+          (progn
+            (setq source-file (gdb-mi--c-string-from-string (match-string 1)))
+            (delete (cons bptno "File not found") gdb-location-alist)
+            (push (cons bptno source-file) gdb-location-alist))
+        (gdb-resync)
+        (unless (assoc bptno gdb-location-alist)
+         (push (cons bptno "File not found") gdb-location-alist)
+         (message-box "Cannot find source file for breakpoint location.
 Add directory to search path for source files using the GDB command, dir."))
-      (throw 'file-not-found nil))
-    (with-current-buffer (find-file-noselect (match-string 1))
-      (gdb-init-buffer)
-      ;; only want one breakpoint icon at each location
-      (gdb-put-breakpoint-icon (eq flag ?y) bptno (string-to-number line)))))
+        (throw 'file-not-found nil))
+      (with-current-buffer (find-file-noselect source-file)
+        (gdb-init-buffer)
+        ;; Only want one breakpoint icon at each location.
+        (gdb-put-breakpoint-icon (string-equal flag "y") bptno
+                                 (string-to-number line))))))
 
 (add-hook 'find-file-hook 'gdb-find-file-hook)
 



reply via email to

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