diff options
| author | Eli Zaretskii | 2023-03-07 14:39:27 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2023-03-07 14:39:27 +0200 |
| commit | ab417c8a6eeb7df7ccce3e5f8416f48544a5174e (patch) | |
| tree | ebea14aae6f9a6847af9967576320aa40d4277b1 | |
| parent | bd07cec844257ba8ae95b2ab2e66982360576c9d (diff) | |
| download | emacs-ab417c8a6eeb7df7ccce3e5f8416f48544a5174e.tar.gz emacs-ab417c8a6eeb7df7ccce3e5f8416f48544a5174e.zip | |
Fix problem with debuginfod queries in "M-x gdb"
* lisp/progmodes/gdb-mi.el (gdb-debuginfod-enable-setting): New
defcustom.
(gdb-debuginfod-message): New function.
(gdb-init-1): Initialize gdb-debuginfod-enable. Ask the user
about debuginfod queries and display any error messages.
(Bug#61973)
* etc/NEWS: Announce the change.
| -rw-r--r-- | etc/NEWS | 12 | ||||
| -rw-r--r-- | lisp/progmodes/gdb-mi.el | 61 |
2 files changed, 67 insertions, 6 deletions
| @@ -2085,6 +2085,18 @@ command accepts the Unicode name of an Emoji (for example, "smiling | |||
| 2085 | face" or "heart with arrow"), like 'C-x 8 e e', with minibuffer | 2085 | face" or "heart with arrow"), like 'C-x 8 e e', with minibuffer |
| 2086 | completion, and adds the Emoji into the search string. | 2086 | completion, and adds the Emoji into the search string. |
| 2087 | 2087 | ||
| 2088 | ** GDB/MI | ||
| 2089 | |||
| 2090 | --- | ||
| 2091 | *** New user option 'gdb-debuginfod-enable-setting'. | ||
| 2092 | On capable platforms, GDB 10.1 and later can download missing source | ||
| 2093 | and debug info files from special-purpose servers, called "debuginfod | ||
| 2094 | servers". Use this new option to control whether "M-x gdb" instructs | ||
| 2095 | GDB to download missing files from debuginfod servers when you debug | ||
| 2096 | the corresponding programs. The default is to ask you at the | ||
| 2097 | beginning of each debugging session whether to download the files for | ||
| 2098 | that session. | ||
| 2099 | |||
| 2088 | ** Glyphless Characters | 2100 | ** Glyphless Characters |
| 2089 | 2101 | ||
| 2090 | +++ | 2102 | +++ |
diff --git a/lisp/progmodes/gdb-mi.el b/lisp/progmodes/gdb-mi.el index 8b157dd3333..8db16729163 100644 --- a/lisp/progmodes/gdb-mi.el +++ b/lisp/progmodes/gdb-mi.el | |||
| @@ -255,6 +255,9 @@ This variable is updated in `gdb-done-or-error' and returned by | |||
| 255 | It is initialized to `gdb-non-stop-setting' at the beginning of | 255 | It is initialized to `gdb-non-stop-setting' at the beginning of |
| 256 | every GDB session.") | 256 | every GDB session.") |
| 257 | 257 | ||
| 258 | (defvar gdb-debuginfod-enable nil | ||
| 259 | "Whether the current GDB session can query debuginfod servers.") | ||
| 260 | |||
| 258 | (defvar-local gdb-buffer-type nil | 261 | (defvar-local gdb-buffer-type nil |
| 259 | "One of the symbols bound in `gdb-buffer-rules'.") | 262 | "One of the symbols bound in `gdb-buffer-rules'.") |
| 260 | 263 | ||
| @@ -467,6 +470,30 @@ GDB session needs to be restarted for this setting to take effect." | |||
| 467 | :group 'gdb-non-stop | 470 | :group 'gdb-non-stop |
| 468 | :version "26.1") | 471 | :version "26.1") |
| 469 | 472 | ||
| 473 | (defcustom gdb-debuginfod-enable-setting | ||
| 474 | ;; debuginfod servers are only for ELF executables, and elfutils, of | ||
| 475 | ;; which libdebuginfod is a part, is not usually available on | ||
| 476 | ;; MS-Windows. | ||
| 477 | (if (not (eq system-type 'windows-nt)) 'ask) | ||
| 478 | "Whether to enable downloading missing debug info from debuginfod servers. | ||
| 479 | The debuginfod servers are HTTP servers for distributing source | ||
| 480 | files and debug info files of programs. If GDB was built with | ||
| 481 | debuginfod support, it can query these servers when you debug a | ||
| 482 | program for which some of these files are not available locally, | ||
| 483 | and download the files if the servers have them. | ||
| 484 | |||
| 485 | The value nil means never to download from debuginfod servers. | ||
| 486 | The value t means always download from debuginfod servers when | ||
| 487 | some source or debug info files are missing. | ||
| 488 | The value `ask', the default, means ask at the beginning of each | ||
| 489 | debugging session whether to download from debuginfod servers | ||
| 490 | during that session." | ||
| 491 | :type '(choice (const :tag "Never download from debuginfod servers" nil) | ||
| 492 | (const :tag "Download from debuginfod servers when necessary" t) | ||
| 493 | (const :tag "Ask whether to download for each session" ask)) | ||
| 494 | :group 'gdb | ||
| 495 | :version "29.1") | ||
| 496 | |||
| 470 | ;; TODO Some commands can't be called with --all (give a notice about | 497 | ;; TODO Some commands can't be called with --all (give a notice about |
| 471 | ;; it in setting doc) | 498 | ;; it in setting doc) |
| 472 | (defcustom gdb-gud-control-all-threads t | 499 | (defcustom gdb-gud-control-all-threads t |
| @@ -1021,6 +1048,11 @@ detailed description of this mode. | |||
| 1021 | 1048 | ||
| 1022 | (run-hooks 'gdb-mode-hook)) | 1049 | (run-hooks 'gdb-mode-hook)) |
| 1023 | 1050 | ||
| 1051 | (defconst gdb--string-regexp (rx "\"" | ||
| 1052 | (* (or (seq "\\" nonl) | ||
| 1053 | (not (any "\"\\")))) | ||
| 1054 | "\"")) | ||
| 1055 | |||
| 1024 | (defun gdb-init-1 () | 1056 | (defun gdb-init-1 () |
| 1025 | ;; (Re-)initialize. | 1057 | ;; (Re-)initialize. |
| 1026 | (setq gdb-selected-frame nil | 1058 | (setq gdb-selected-frame nil |
| @@ -1044,7 +1076,8 @@ detailed description of this mode. | |||
| 1044 | gdb-threads-list '() | 1076 | gdb-threads-list '() |
| 1045 | gdb-breakpoints-list '() | 1077 | gdb-breakpoints-list '() |
| 1046 | gdb-register-names '() | 1078 | gdb-register-names '() |
| 1047 | gdb-non-stop gdb-non-stop-setting) | 1079 | gdb-non-stop gdb-non-stop-setting |
| 1080 | gdb-debuginfod-enable gdb-debuginfod-enable-setting) | ||
| 1048 | ;; | 1081 | ;; |
| 1049 | (gdbmi-bnf-init) | 1082 | (gdbmi-bnf-init) |
| 1050 | ;; | 1083 | ;; |
| @@ -1053,6 +1086,15 @@ detailed description of this mode. | |||
| 1053 | (gdb-force-mode-line-update | 1086 | (gdb-force-mode-line-update |
| 1054 | (propertize "initializing..." 'face font-lock-variable-name-face)) | 1087 | (propertize "initializing..." 'face font-lock-variable-name-face)) |
| 1055 | 1088 | ||
| 1089 | ;; This needs to be done before we ask GDB for anything that might | ||
| 1090 | ;; trigger questions about debuginfod queries. | ||
| 1091 | (if (eq gdb-debuginfod-enable 'ask) | ||
| 1092 | (setq gdb-debuginfod-enable | ||
| 1093 | (y-or-n-p "Enable querying debuginfod servers for this session?"))) | ||
| 1094 | (gdb-input (format "-gdb-set debuginfod enabled %s" | ||
| 1095 | (if gdb-debuginfod-enable "on" "off")) | ||
| 1096 | 'gdb-debuginfod-message) | ||
| 1097 | |||
| 1056 | (gdb-get-buffer-create 'gdb-inferior-io) | 1098 | (gdb-get-buffer-create 'gdb-inferior-io) |
| 1057 | (gdb-clear-inferior-io) | 1099 | (gdb-clear-inferior-io) |
| 1058 | (gdb-inferior-io--init-proc (get-process "gdb-inferior")) | 1100 | (gdb-inferior-io--init-proc (get-process "gdb-inferior")) |
| @@ -1080,6 +1122,18 @@ detailed description of this mode. | |||
| 1080 | (gdb-input "-file-list-exec-source-file" 'gdb-get-source-file) | 1122 | (gdb-input "-file-list-exec-source-file" 'gdb-get-source-file) |
| 1081 | (gdb-input "-gdb-show prompt" 'gdb-get-prompt)) | 1123 | (gdb-input "-gdb-show prompt" 'gdb-get-prompt)) |
| 1082 | 1124 | ||
| 1125 | (defun gdb-debuginfod-message () | ||
| 1126 | "Show in the echo area GDB error response for a debuginfod command, if any." | ||
| 1127 | (goto-char (point-min)) | ||
| 1128 | (cond | ||
| 1129 | ((re-search-forward "msg=\\(\".+\"\\)$" nil t) | ||
| 1130 | ;; Supports debuginfod, but cannot perform command. | ||
| 1131 | (message "%s" (buffer-substring (1+ (match-beginning 1)) | ||
| 1132 | (1- (line-end-position))))) | ||
| 1133 | ((re-search-forward "No symbol" nil t) | ||
| 1134 | (message "This version of GDB doesn't support debuginfod commands.")) | ||
| 1135 | (t (message nil)))) | ||
| 1136 | |||
| 1083 | (defun gdb-non-stop-handler () | 1137 | (defun gdb-non-stop-handler () |
| 1084 | (goto-char (point-min)) | 1138 | (goto-char (point-min)) |
| 1085 | (if (re-search-forward "No symbol" nil t) | 1139 | (if (re-search-forward "No symbol" nil t) |
| @@ -1148,11 +1202,6 @@ no input, and GDB is waiting for input." | |||
| 1148 | (declare-function tooltip-show "tooltip" (text &optional use-echo-area | 1202 | (declare-function tooltip-show "tooltip" (text &optional use-echo-area |
| 1149 | text-face default-face)) | 1203 | text-face default-face)) |
| 1150 | 1204 | ||
| 1151 | (defconst gdb--string-regexp (rx "\"" | ||
| 1152 | (* (or (seq "\\" nonl) | ||
| 1153 | (not (any "\"\\")))) | ||
| 1154 | "\"")) | ||
| 1155 | |||
| 1156 | (defun gdb-tooltip-print (expr) | 1205 | (defun gdb-tooltip-print (expr) |
| 1157 | (with-current-buffer (gdb-get-buffer 'gdb-partial-output-buffer) | 1206 | (with-current-buffer (gdb-get-buffer 'gdb-partial-output-buffer) |
| 1158 | (goto-char (point-min)) | 1207 | (goto-char (point-min)) |