bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: GUD mode bug


From: Joonhwan Lee
Subject: RE: GUD mode bug
Date: Thu, 28 Jun 2007 12:57:33 +0900

Greate. your new string->strings func works well.  I'm elisp beginner and had spent a quite long time in
writing the equivalent routine but failed, though.

Anyway, Here's another issue introduced.

In gud-common-init, there is routine extracting the name of debuggee.
It seems to me that

;; Extract the file name from WORDS
     ;; and put t in its place.
     ;; Later on we will put the modified file name arg back there.
     (file-word (let ((w (cdr words)))
              (while (and w (= ?- (aref (car w) 0)))
            (setq w (cdr w)))
              (and w
               (prog1 (car w)
                 (setcar w t)))))

is too naive.

In my previous example, the name of debuggee should be the last one(path-to-the-debuggee)
But with above code, gud thought it is "runargs -simu; run" 'cause it doesn't start with hypen.

btw, It seems to me that it may be a little hard to introduce a general way of extracting the name of debuggee.
Any idea? maybe user-configurable predicator for this?

Joon.

2007/6/28, Nick Roberts <address@hidden>:
> M-x dbx
> dbx -c "runargs -simu; run" path-to-the-debuggee
>
> Above workflow doesn't work on Emacs 22.1.1

>
> "Split-String" by default separator.
>
> In the end, because the quote in my original dbx execution, output list by
> split-string was
>
> ("-c" "\"runargs" "-simu;" "run\"" "path-to-the-debuggee)
>
> instead of
>
> ("-c" "runargs -simu; run" "path-to-the-debuggee")
>
> which is actually correct for (start-process) to be called with

I've fixed this in the CVS repository at Savannah.  If you can build from there
can you tell me if it is fixed now.  Failing that, please apply the patch below
to gud.el, evaluate the function string->strings and try it from there.  Does
that work now?

--
Nick                                           http://www.inet.net.nz/~nickrob


(defun string->strings (string &optional separator)
  "Split the STRING into a list of strings.
It understands elisp style quoting within STRING such that
  (string->strings (strings->string strs)) == strs
The SEPARATOR regexp defaults to \"\\s-+\"."
  (let ((sep (or separator "\\s-+"))
        (i (string-match "[\"]" string)))
    (if (null i) (split-string string sep t)    ; no quoting:  easy
      (append (unless (eq i 0) (split-string (substring string 0 i) sep t))
              (let ((rfs (read-from-string string i)))
                (cons (car rfs)
                      (string->strings (substring string (cdr rfs))
                                           sep)))))))



*** gud.el      13 May 2007 16:21:01 +1200      1.130
--- gud.el      28 Jun 2007 12:56:38 +1200
*************** comint mode, which see."
*** 2462,2468 ****
  ;; for local variables in the debugger buffer.
  (defun gud-common-init (command-line massage-args marker-filter
                                     &optional find-file)
!   (let* ((words (split-string command-line))
         (program (car words))
         (dir default-directory)
         ;; Extract the file name from WORDS
--- 2462,2468 ----
  ;; for local variables in the debugger buffer.
  (defun gud-common-init (command-line massage-args marker-filter
                                     &optional find-file)
!   (let* ((words (string->strings command-line))
         (program (car words))
         (dir default-directory)
         ;; Extract the file name from WORDS



--

Joon


--

Joon
reply via email to

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