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: Sun, 21 Mar 2010 13:43:36 +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 1269146648 31916 80.91.229.12 (21 Mar 2010 04:44:08 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 21 Mar 2010 04:44:08 +0000 (UTC) Cc: Nick Roberts , emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Mar 21 05:44:01 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 1NtD16-0008UW-D1 for ged-emacs-devel@m.gmane.org; Sun, 21 Mar 2010 05:44:00 +0100 Original-Received: from localhost ([127.0.0.1]:38747 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NtD15-0007xu-SK for ged-emacs-devel@m.gmane.org; Sun, 21 Mar 2010 00:43:59 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NtD0z-0007vv-DS for emacs-devel@gnu.org; Sun, 21 Mar 2010 00:43:53 -0400 Original-Received: from [140.186.70.92] (port=58772 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NtD0t-0007rV-OO for emacs-devel@gnu.org; Sun, 21 Mar 2010 00:43:52 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1NtD0n-0001UV-Gx for emacs-devel@gnu.org; Sun, 21 Mar 2010 00:43:47 -0400 Original-Received: from mathmail.math.s.chiba-u.ac.jp ([133.82.132.2]:56919) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NtD0m-0001UM-Qk for emacs-devel@gnu.org; Sun, 21 Mar 2010 00:43:41 -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 49B8DC0557; Sun, 21 Mar 2010 13:43:36 +0900 (JST) In-Reply-To: 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:122400 Archived-At: >>>>> On Sat, 20 Mar 2010 15:45:59 -0400, Stefan Monnier said: >> + ;; 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)))) >> + > Actually, detecting the CRLF itself would be better. But at least this > seems "safe for GNU". So I think it's acceptable for 23.2. Strangely, the EOL style suddenly changes from LF to CRLF after the command "server interpreter mi -stack-info-frame", . I.e., the first output line ends with LF. Maybe I'll improve the comment. >> + (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))) > Rather than string-match, you can > (eq ?\n (aref gdb-first-output-line (1- (length gdb-first-output-line)))) Currently, gdb-first-output-line is initialized to "". And I thought (and (not (string= gdb-first-output-line "") (eq ?\n (aref gdb-first-output-line (1- (length gdb-first-output-line)))) a bit awkward and doubted its merit because it involves more bytecode-level operations. Of course, one can initialize the variable to some dummy non-empty string, but it doesn't look natural. YAMAMOTO Mitsuharu mituharu@math.s.chiba-u.ac.jp