diff --git a/emacs-gdb-ascii.patch b/emacs-gdb-ascii.patch new file mode 100644 index 0000000..a91d278 --- /dev/null +++ b/emacs-gdb-ascii.patch @@ -0,0 +1,70 @@ +--- emacs-24.5/lisp/progmodes/gdb-mi.el 2015-04-02 09:23:06.000000000 +0200 ++++ emacs-24.5-new/lisp/progmodes/gdb-mi.el 2016-02-02 12:40:28.635711182 +0100 +@@ -2305,10 +2305,67 @@ the end of the current result or async r + ; list ==> + ; "[]" | "[" value ( "," value )* "]" | "[" result ( "," result )* "]" + ++(defcustom gdb-mi-decode-strings nil ++ "When non-nil, decode octal escapes in GDB output into non-ASCII text. ++ ++If the value is a coding-system, use that coding-system to decode ++the bytes reconstructed from octal escapes. Any other non-nil value ++means to decode using the coding-system set for the GDB process. ++ ++Warning: setting this non-nil might mangle strings reported by GDB ++that have literal substrings which match the \\nnn octal escape ++patterns, where nnn is an octal number between 200 and 377. So ++we only recommend to set this variable non-nil if the program you ++are debugging really reports non-ASCII text, or some of its source ++file names include non-ASCII characters." ++ :type '(choice ++ (const :tag "Don't decode" nil) ++ (const :tag "Decode using default coding-system" t) ++ (coding-system :tag "Decode using this coding-system")) ++ :group 'gdb ++ :version "25.1") ++ ++;; The idea of the following function was suggested ++;; by Kenichi Handa . ++;; ++;; FIXME: This is fragile: it relies on the assumption that all the ++;; non-ASCII strings output by GDB, including names of the source ++;; files, values of string variables in the inferior, etc., are all ++;; encoded in the same encoding. It also assumes that the \nnn ++;; sequences are not split between chunks of output of the GDB process ++;; due to buffering, and arrive together. Finally, if some string ++;; included literal \nnn strings (as opposed to non-ASCII characters ++;; converted by by GDB/MI to octal escapes), this decoding will mangle ++;; those strings. When/if GDB acquires the ability to not ++;; escape-protect non-ASCII characters in its MI output, this kludge ++;; should be removed. ++(defun gdb-mi-decode (string) ++ "Decode octal escapes in MI output STRING into multibyte text." ++ (let ((coding ++ (if (coding-system-p gdb-mi-decode-strings) ++ gdb-mi-decode-strings ++ (with-current-buffer ++ (gdb-get-buffer-create 'gdb-partial-output-buffer) ++ buffer-file-coding-system)))) ++ (with-temp-buffer ++ (set-buffer-multibyte nil) ++ (prin1 string (current-buffer)) ++ (goto-char (point-min)) ++ ;; prin1 quotes the octal escapes as well, which interferes with ++ ;; their interpretation by 'read' below. Remove the extra ++ ;; backslashes to countermand that. ++ (while (re-search-forward "\\\\\\(\\\\[2-3][0-7][0-7]\\)" nil t) ++ (replace-match "\\1" nil nil)) ++ (goto-char (point-min)) ++ (decode-coding-string (read (current-buffer)) coding)))) + + (defun gud-gdbmi-marker-filter (string) + "Filter GDB/MI output." + ++ ;; If required, decode non-ASCII text encoded with octal escapes. ++ (or (null gdb-mi-decode-strings) ++ (setq string (gdb-mi-decode string))) ++ + ;; Record transactions if logging is enabled. + (when gdb-enable-debug + (push (cons 'recv string) gdb-debug-log) diff --git a/emacs.spec b/emacs.spec index 60573dd..6674291 100644 --- a/emacs.spec +++ b/emacs.spec @@ -29,6 +29,9 @@ Patch4: emacs-system-crypto-policies.patch Patch5: emacs-bbdb.patch # http://git.savannah.gnu.org/cgit/emacs.git/commit/?id=06083cf41c473404d246de9b91a0116f38c5485f Patch6: emacs-mercurial.patch +# http://git.savannah.gnu.org/cgit/emacs.git/commit/?id=439f483be35a000e7a3bec6acf395ce4d54d6323 +# http://git.savannah.gnu.org/cgit/emacs.git/commit/?id=9c86325b69d75e9b17ff468f5a2220597979635f +Patch7: emacs-gdb-ascii.patch BuildRequires: atk-devel BuildRequires: cairo-devel @@ -173,6 +176,7 @@ packages that add functionality to Emacs. %patch4 -p1 -b .system-crypto-policies %patch5 -p1 -b .bbdb %patch6 -p1 +%patch7 -p1 autoconf # We prefer our emacs.desktop file @@ -446,6 +450,7 @@ update-desktop-database &> /dev/null || : %changelog * Tue Feb 2 2016 Jan Synáček - 1:24.5-9 - emacs "deadlocked" after using mercurial with huge amounts of ignored files in the repository (#1232422) +- GDB interface gets confused by non-ASCII (#1283412) * Tue Jan 5 2016 Jan Synáček - 1:24.5-9 - set default value for smime-CA-directory (#1131558)