emacs-devel
[Top][All Lists]
Advanced

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

Re: GDB on Mac is (NOT) Broken


From: YAMAMOTO Mitsuharu
Subject: Re: GDB on Mac is (NOT) Broken
Date: Tue, 16 Mar 2010 09:18:34 +0900
User-agent: Wanderlust/2.14.0 (Africa) SEMI/1.14.6 (Maruoka) FLIM/1.14.8 (Shijō) APEL/10.6 Emacs/22.3 (sparc-sun-solaris2.8) MULE/5.0 (SAKAKI)

>>>>> On Mon, 15 Mar 2010 19:23:44 +1300, address@hidden (Nick Roberts) said:

> That it [Emacs] doesn't work with Apple GDB I don't see as a bug.
> Of course, if you or someone else posts a fix, I will be happy to
> apply it.

The simplest workaround would be something like (push '("\\`gdb\\'"
. (utf-8-dos . utf-8-unix)) process-coding-system-alist).  But
detecting Apple versions of GDB would be better.  Could you check the
patch below?

                                     YAMAMOTO Mitsuharu
                                address@hidden

=== modified file 'lisp/progmodes/gdb-ui.el'
*** lisp/progmodes/gdb-ui.el    2010-02-19 04:55:31 +0000
--- lisp/progmodes/gdb-ui.el    2010-03-15 23:47:49 +0000
***************
*** 162,167 ****
--- 162,168 ----
  (defvar gdb-ready nil)
  (defvar gdb-stack-update nil)
  (defvar gdb-early-user-input nil)
+ (defvar gdb-first-output-line "")
  
  (defvar gdb-buffer-type nil
    "One of the symbols bound in `gdb-buffer-rules'.")
***************
*** 335,340 ****
--- 336,342 ----
    (setq gdb-stack-update nil)
    (setq gdb-flush-pending-output nil)
    (setq gdb-early-user-input nil)
+   (setq gdb-first-output-line "")
    (setq gud-filter-pending-text nil)
    (gdb-thread-identification)
    (run-hooks 'gdb-mode-hook))
***************
*** 705,710 ****
--- 707,722 ----
  
    (if gdb-use-separate-io-buffer (gdb-clear-inferior-io))
  
+   ;; Workaround for some Apple versions of GDB that add ^M at EOL
+   ;; after the command "server interpreter mi -stack-info-frame".
+   (if (string-match "(Apple version " gdb-first-output-line)
+       (let* ((process (get-buffer-process gud-comint-buffer))
+            (coding-systems (process-coding-system process)))
+       (set-process-coding-system process
+                                  (coding-system-change-eol-conversion
+                                   (car coding-systems) 'dos)
+                                  (cdr coding-systems))))
+ 
    ;; Hack to see test for GDB 6.4+ (-stack-info-frame was implemented in 6.4)
    (gdb-enqueue-input (list "server interpreter mi -stack-info-frame\n"
                           'gdb-get-version)))
***************
*** 1769,1774 ****
--- 1781,1792 ----
        (progn
          (setq output (gdb-concat-output output gud-marker-acc))
          (setq gud-marker-acc "")))
+       (if (not (string-match "\n" gdb-first-output-line))
+         (setq gdb-first-output-line
+               (concat gdb-first-output-line
+                       (if (string-match "\n" output)
+                           (substring output 0 (match-end 0))
+                         output))))
        output)))
  
  (defun gdb-concat-output (so-far new)





reply via email to

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