From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: YAMAMOTO Mitsuharu Newsgroups: gmane.emacs.devel Subject: Re: GDB on Mac is (NOT) Broken Date: Tue, 16 Mar 2010 09:18:34 +0900 Organization: Faculty of Science, Chiba University Message-ID: References: <19357.53872.672127.600861@totara.tehura.co.nz> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII X-Trace: dough.gmane.org 1268698749 5277 80.91.229.12 (16 Mar 2010 00:19:09 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 16 Mar 2010 00:19:09 +0000 (UTC) Cc: emacs-devel@gnu.org To: nickrob@snap.net.nz (Nick Roberts) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Mar 16 01:19:04 2010 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1NrKUr-0007oy-9m for ged-emacs-devel@m.gmane.org; Tue, 16 Mar 2010 01:18:57 +0100 Original-Received: from localhost ([127.0.0.1]:33084 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NrKUq-0000MA-6U for ged-emacs-devel@m.gmane.org; Mon, 15 Mar 2010 20:18:56 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NrKUl-0000M5-1R for emacs-devel@gnu.org; Mon, 15 Mar 2010 20:18:51 -0400 Original-Received: from [140.186.70.92] (port=37227 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NrKUj-0000Lx-DP for emacs-devel@gnu.org; Mon, 15 Mar 2010 20:18:50 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1NrKUc-00017N-Un for emacs-devel@gnu.org; Mon, 15 Mar 2010 20:18:49 -0400 Original-Received: from mathmail.math.s.chiba-u.ac.jp ([133.82.132.2]:62634) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NrKUa-00016j-1w for emacs-devel@gnu.org; Mon, 15 Mar 2010 20:18:42 -0400 Original-Received: from church.math.s.chiba-u.ac.jp (church [133.82.132.36]) by mathmail.math.s.chiba-u.ac.jp (Postfix) with ESMTP id AB1F5C0557; Tue, 16 Mar 2010 09:18:34 +0900 (JST) In-Reply-To: <19357.53872.672127.600861@totara.tehura.co.nz> User-Agent: Wanderlust/2.14.0 (Africa) SEMI/1.14.6 (Maruoka) FLIM/1.14.8 (=?ISO-8859-4?Q?Shij=F2?=) APEL/10.6 Emacs/22.3 (sparc-sun-solaris2.8) MULE/5.0 (SAKAKI) X-detected-operating-system: by eggs.gnu.org: NetBSD 3.0 (DF) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:122031 Archived-At: >>>>> On Mon, 15 Mar 2010 19:23:44 +1300, nickrob@snap.net.nz (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 mituharu@math.s.chiba-u.ac.jp === 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)