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: Nick Roberts
Subject: Re: GDB on Mac is (NOT) Broken
Date: Sun, 21 Mar 2010 19:50:41 +1300

 > >> ***************
 > >> *** 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:

  address@hidden:~$ 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




reply via email to

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