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: Mon, 22 Mar 2010 10:29:15 +0900 Organization: Faculty of Science, Chiba University Message-ID: References: <19357.53872.672127.600861@totara.tehura.co.nz> <19359.5799.721358.312552@totara.tehura.co.nz> <19365.49601.379093.424303@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 1269221374 13208 80.91.229.12 (22 Mar 2010 01:29:34 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 22 Mar 2010 01:29:34 +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 Mon Mar 22 02:29:30 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 1NtWSP-000830-IM for ged-emacs-devel@m.gmane.org; Mon, 22 Mar 2010 02:29:29 +0100 Original-Received: from localhost ([127.0.0.1]:33012 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NtWSP-0004Oi-1c for ged-emacs-devel@m.gmane.org; Sun, 21 Mar 2010 21:29:29 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NtWSJ-0004O6-D3 for emacs-devel@gnu.org; Sun, 21 Mar 2010 21:29:23 -0400 Original-Received: from [140.186.70.92] (port=54124 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NtWSH-0004Ny-6M for emacs-devel@gnu.org; Sun, 21 Mar 2010 21:29:22 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1NtWSF-0008Ms-AZ for emacs-devel@gnu.org; Sun, 21 Mar 2010 21:29:21 -0400 Original-Received: from mathmail.math.s.chiba-u.ac.jp ([133.82.132.2]:56374) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NtWSE-0008Ml-QE for emacs-devel@gnu.org; Sun, 21 Mar 2010 21:29:19 -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 B1E97C0557; Mon, 22 Mar 2010 10:29:15 +0900 (JST) In-Reply-To: <19365.49601.379093.424303@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:122438 Archived-At: >>>>> On Sun, 21 Mar 2010 19:50:41 +1300, nickrob@snap.net.nz (Nick Roberts) said: > To be safer you need to add something like: > (gdb-enqueue-input (list "server show version\n" 'gdb-apple-test))) > maybe at the start of gdb-init-2 and where gdb-apple-test inspects the > output of "show version" (the prefix server ensures that the user > doesn't see this command in the gdb history): > ;; Workaround for some Apple versions of GDB that add ^M at EOL > ;; after the command "server interpreter mi -stack-info-frame". > (defun gdb-apple-test () > (goto-char (point-min)) > (if (re-search-forward "(Apple version " nil t) > (setq gdb-version "pre-6.4") > (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)))))) > To see how this works instrument gdb-apple-test with Edebug and look in > the " *partial-output-yourprog" buffer (note leading space means hidden > buffer). >> If we want to >> avoid string-match for most cases, then we can save the original value >> at the beginning of the while-loop to some variable (say, >> orig-gdb-first-prompt) and use it like this: > The above patch would avoid continually matching in gud-gdba-marker-filter > too. > WDYT? I think it's much cleaner. I tried your code with removing the line (setq gdb-version "pre-6.4") in gdb-apple-test, because set-process-coding-system should go to the then-clause. (I'm not familiar with this at all, but should Apple versions be regarded as pre-6.4? On Mac OS X 10.6, the first line looks like `GNU gdb 6.3.50-20050815 (Apple version gdb-1346) (Fri Sep 18 20:40:51 UTC 2009)', and `server interpreter mi -stack-info-frame' results in `^error,msg="No registers."'.) It avoided the hang in completion, but in the " *partial-output-yourprog*" buffer, ^M was already added because "server show version\n" was executed after "server interpreter mi -stack-info-frame\n" which triggered the addition of ^M. How about checking the result of "server show version\n" before "server interpreter mi -stack-info-frame\n"? YAMAMOTO Mitsuharu mituharu@math.s.chiba-u.ac.jp