From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: nickrob@snap.net.nz (Nick Roberts) Newsgroups: gmane.emacs.devel Subject: Re: GDB on Mac is (NOT) Broken Date: Sun, 21 Mar 2010 19:50:41 +1300 Message-ID: <19365.49601.379093.424303@totara.tehura.co.nz> References: <19357.53872.672127.600861@totara.tehura.co.nz> <19359.5799.721358.312552@totara.tehura.co.nz> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1269156094 19147 80.91.229.12 (21 Mar 2010 07:21:34 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 21 Mar 2010 07:21:34 +0000 (UTC) Cc: emacs-devel@gnu.org To: YAMAMOTO Mitsuharu Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Mar 21 08:21:29 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 1NtFTT-0000Br-71 for ged-emacs-devel@m.gmane.org; Sun, 21 Mar 2010 08:21:28 +0100 Original-Received: from localhost ([127.0.0.1]:33595 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NtFTQ-0006cn-9a for ged-emacs-devel@m.gmane.org; Sun, 21 Mar 2010 03:21:24 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NtFPr-0005o2-Ah for emacs-devel@gnu.org; Sun, 21 Mar 2010 03:17:43 -0400 Original-Received: from [140.186.70.92] (port=36466 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NtFPg-0005ks-W2 for emacs-devel@gnu.org; Sun, 21 Mar 2010 03:17:41 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1NtFPa-0004U7-1c for emacs-devel@gnu.org; Sun, 21 Mar 2010 03:17:32 -0400 Original-Received: from mx.southnet.co.nz ([202.37.101.20]:43172 helo=viper.snap.net.nz) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NtFPZ-0004Tf-G0 for emacs-devel@gnu.org; Sun, 21 Mar 2010 03:17:25 -0400 Original-Received: from totara (unknown [123.255.30.223]) by viper.snap.net.nz (Postfix) with ESMTP id 410E33DAA63; Sun, 21 Mar 2010 19:51:32 +1300 (NZDT) Original-Received: by totara (Postfix, from userid 1000) id 6E781C172; Sun, 21 Mar 2010 19:50:41 +1300 (NZDT) In-Reply-To: X-Mailer: VM 7.19 under Emacs 22.2.1 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4-2.6 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:122404 Archived-At: > >> *************** > >> *** 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)) > > > (if (gdb-first-post-prompt) > > > would probably also work > > I guess you meant "(if gdb-first-prompt", but whichever the variables, > I think its value might be changed in the while-loop in > gud-gdba-marker-filter via annotation handler calls. Actually both probably come too late. One problem with trying to match for "Apple" in the first output line is that the user might use -q: nickrob@totara:~$ gdb -q myprog (gdb) 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? -- Nick http://users.snap.net.nz/~nickrob