unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* GUD mode bug
@ 2007-06-27 11:46 Joonhwan Lee
  2007-06-28  1:44 ` Nick Roberts
  0 siblings, 1 reply; 6+ messages in thread
From: Joonhwan Lee @ 2007-06-27 11:46 UTC (permalink / raw)
  To: bug-gnu-emacs


[-- Attachment #1.1: Type: text/plain, Size: 1280 bytes --]

Dear,

M-x dbx
dbx -c "runargs -simu; run" path-to-the-debuggee

Above workflow doesn't work on Emacs 22.1.1

I found something in gud.el, look at this.

;; Perform initializations common to all debuggers.
;; The first arg is the specified command line,
;; which starts with the program to debug.
;; The other three args specify the values to use
;; 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
     ;; 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)))
.
.
.

>From above,  variable "command-line" is converted into list. But Just
"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


Thanks Emacs Team

[-- Attachment #1.2: Type: text/html, Size: 1853 bytes --]

[-- Attachment #2: Type: text/plain, Size: 149 bytes --]

_______________________________________________
bug-gnu-emacs mailing list
bug-gnu-emacs@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-gnu-emacs

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: GUD mode bug
  2007-06-27 11:46 GUD mode bug Joonhwan Lee
@ 2007-06-28  1:44 ` Nick Roberts
       [not found]   ` <1c82e0ef0706272055l21eb531bmf3bea9a331b3fb7a@mail.gmail.com>
  0 siblings, 1 reply; 6+ messages in thread
From: Nick Roberts @ 2007-06-28  1:44 UTC (permalink / raw)
  To: Joonhwan Lee; +Cc: bug-gnu-emacs

 > 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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: GUD mode bug
       [not found]   ` <1c82e0ef0706272055l21eb531bmf3bea9a331b3fb7a@mail.gmail.com>
@ 2007-06-28  3:57     ` Joonhwan Lee
  2007-06-28  8:43       ` Nick Roberts
  0 siblings, 1 reply; 6+ messages in thread
From: Joonhwan Lee @ 2007-06-28  3:57 UTC (permalink / raw)
  To: bug-gnu-emacs, nickrob


[-- Attachment #1.1: Type: text/plain, Size: 3521 bytes --]

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 <nickrob@snap.net.nz>:
>
> > 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 <http://www.inet.net.nz/%7Enickrob>
>
>
> (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

[-- Attachment #1.2: Type: text/html, Size: 6571 bytes --]

[-- Attachment #2: Type: text/plain, Size: 149 bytes --]

_______________________________________________
bug-gnu-emacs mailing list
bug-gnu-emacs@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-gnu-emacs

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: GUD mode bug
  2007-06-28  3:57     ` Joonhwan Lee
@ 2007-06-28  8:43       ` Nick Roberts
  2007-06-28 19:25         ` Richard Stallman
  0 siblings, 1 reply; 6+ messages in thread
From: Nick Roberts @ 2007-06-28  8:43 UTC (permalink / raw)
  To: Joonhwan Lee; +Cc: bug-gnu-emacs

 > 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.

It looks like the problem wasn't as simple as you originally suggested.  No
matter, I think we needed to make that change for other reasons, anyway.

 > 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?

Without the hypen Emacs has no real way of knowing that the isn't the name
of the program being debugged.

I have a suggestion though, which is use gdb.  AFAIK, dbx isn't free software
and (maybe RMS will comment) support for it could be removed from Emacs at some
stage in the future.

I'm no longer familiar with dbx but I guess your construct means "run my
program under dbx with the program argument -simu".

Here's how to do that with gdb:

Type:

gdb path-to-the-debuggee

Then at the gdb prompt:

(gdb) r -simu
Starting program: path-to-the-debuggee -simu
...

This _can_ be parsed easily by Emacs and will also enable you to use the GDB
graphical interface that is new to Emacs 22.1.

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: GUD mode bug
  2007-06-28  8:43       ` Nick Roberts
@ 2007-06-28 19:25         ` Richard Stallman
  2007-06-28 21:01           ` Nick Roberts
  0 siblings, 1 reply; 6+ messages in thread
From: Richard Stallman @ 2007-06-28 19:25 UTC (permalink / raw)
  To: Nick Roberts; +Cc: bug-gnu-emacs, joonhwan.lee

dbx was free software last I looked.  I would expect that the
versions in the BSD systems are free.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: GUD mode bug
  2007-06-28 19:25         ` Richard Stallman
@ 2007-06-28 21:01           ` Nick Roberts
  0 siblings, 0 replies; 6+ messages in thread
From: Nick Roberts @ 2007-06-28 21:01 UTC (permalink / raw)
  To: rms; +Cc: bug-gnu-emacs, joonhwan.lee

 > dbx was free software last I looked.  I would expect that the
 > versions in the BSD systems are free.

OK, I guess then another option is for Joonhwan to do:

dbx path-to-the-debuggee
...
(dbx) runargs -simu
(dbx) run

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2007-06-28 21:01 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-27 11:46 GUD mode bug Joonhwan Lee
2007-06-28  1:44 ` Nick Roberts
     [not found]   ` <1c82e0ef0706272055l21eb531bmf3bea9a331b3fb7a@mail.gmail.com>
2007-06-28  3:57     ` Joonhwan Lee
2007-06-28  8:43       ` Nick Roberts
2007-06-28 19:25         ` Richard Stallman
2007-06-28 21:01           ` Nick Roberts

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).