diff options
author | Eli Zaretskii <eliz@gnu.org> | 2020-12-15 19:19:43 +0200 |
---|---|---|
committer | Eli Zaretskii <eliz@gnu.org> | 2020-12-15 19:19:43 +0200 |
commit | f3e21483106cb3ff64adcf21d30c8327a23a3401 (patch) | |
tree | 21d8f2127f18c3f2765dcba7bd47583187e37ece /lisp/progmodes/gdb-mi.el | |
parent | 92c56300c317c9e5573dca787a2cf20f777b3179 (diff) | |
download | emacs-f3e21483106cb3ff64adcf21d30c8327a23a3401.tar.gz |
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)
Diffstat (limited to 'lisp/progmodes/gdb-mi.el')
-rw-r--r-- | lisp/progmodes/gdb-mi.el | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/lisp/progmodes/gdb-mi.el b/lisp/progmodes/gdb-mi.el index 4c248f771cd..330a8511bab 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) |