unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* gud.el gdb --cd and libtool
@ 2002-11-08 10:35 Simon Josefsson
  2002-11-08 15:59 ` Stefan Monnier
  2002-11-09 11:55 ` Richard Stallman
  0 siblings, 2 replies; 6+ messages in thread
From: Simon Josefsson @ 2002-11-08 10:35 UTC (permalink / raw)


The recent patch below breaks M-x gdb when using it with libtool
(e.g., M-x gdb RET libtool gdb file RET).  Given the earlier related
problem with --fullname (solved to my satisfaction now though), it
seems gud.el should be made a little bit more aware of libtool.  I'm
not sure exactly what the best solution would be though, but hopefully
the gud.el maintainers can come up with something.

(The error is that libtool rightly complains that the -cd option isn't
known.)

Index: gud.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/gud.el,v
retrieving revision 1.160
retrieving revision 1.161
diff -u -p -r1.160 -r1.161
--- gud.el	18 Sep 2002 16:02:14 -0000	1.160
+++ gud.el	26 Oct 2002 22:37:04 -0000	1.161
@@ -405,7 +405,9 @@ The directory containing FILE becomes th
 and source-file directory for your debugger."
   (interactive (list (gud-query-cmdline 'gdb)))
 
-  (gud-common-init command-line nil
+  (gud-common-init command-line
+		   #'(lambda (file args)
+		       `("-cd" ,(expand-file-name default-directory) . ,args))
 		   'gud-gdb-marker-filter 'gud-gdb-find-file)
   (set (make-local-variable 'gud-minor-mode) 'gdb)

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

* Re: gud.el gdb --cd and libtool
  2002-11-08 10:35 gud.el gdb --cd and libtool Simon Josefsson
@ 2002-11-08 15:59 ` Stefan Monnier
  2002-11-08 17:02   ` Simon Josefsson
  2002-11-09 11:55 ` Richard Stallman
  1 sibling, 1 reply; 6+ messages in thread
From: Stefan Monnier @ 2002-11-08 15:59 UTC (permalink / raw)
  Cc: emacs-devel

> The recent patch below breaks M-x gdb when using it with libtool
> (e.g., M-x gdb RET libtool gdb file RET).  Given the earlier related
> problem with --fullname (solved to my satisfaction now though), it
> seems gud.el should be made a little bit more aware of libtool.  I'm
> not sure exactly what the best solution would be though, but hopefully
> the gud.el maintainers can come up with something.
> 
> (The error is that libtool rightly complains that the -cd option isn't
> known.)

Yes, the problem with adding libtool-specific code is that it's not
sufficient.  The same problem shows up in other cases (for example
with PVM) where you can't run gdb directly.

I think any post-processing of the command should be avoided as
much as possible since we don't actually know what the command looks
like and does other than the fact that at some point it should
end up running the specified debugger.
Adding this `cd' command seems not be worth it.  After all, why should
it be the default when GDB is run within Emacs but not when it's
run outside Emacs ?  GUD should concentrate on just interfacing with
GDB and should not try to change GDB's behavior.


	Stefan

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

* Re: gud.el gdb --cd and libtool
  2002-11-08 15:59 ` Stefan Monnier
@ 2002-11-08 17:02   ` Simon Josefsson
  0 siblings, 0 replies; 6+ messages in thread
From: Simon Josefsson @ 2002-11-08 17:02 UTC (permalink / raw)
  Cc: emacs-devel

"Stefan Monnier" <monnier+gnu/emacs@rum.cs.yale.edu> writes:

>> The recent patch below breaks M-x gdb when using it with libtool
>> (e.g., M-x gdb RET libtool gdb file RET).  Given the earlier related
>> problem with --fullname (solved to my satisfaction now though), it
>> seems gud.el should be made a little bit more aware of libtool.  I'm
>> not sure exactly what the best solution would be though, but hopefully
>> the gud.el maintainers can come up with something.
>> 
>> (The error is that libtool rightly complains that the -cd option isn't
>> known.)
>
> Yes, the problem with adding libtool-specific code is that it's not
> sufficient.  The same problem shows up in other cases (for example
> with PVM) where you can't run gdb directly.
>
> I think any post-processing of the command should be avoided as
> much as possible since we don't actually know what the command looks
> like and does other than the fact that at some point it should
> end up running the specified debugger.
> Adding this `cd' command seems not be worth it.  After all, why should
> it be the default when GDB is run within Emacs but not when it's
> run outside Emacs ?  GUD should concentrate on just interfacing with
> GDB and should not try to change GDB's behavior.

I think we agree.  The only options that will be passed to gdb should
be the one in the prompt the user enters.  Wouldn't it also be better
to add a interactive command in gdb for --fullname, and having
gud-mode send it to gdb when invoked?  Then even running dbx (if that
is supported at all) will work; dbx wouldn't reject the unknown
-fullname option and the user will get an error on the fullname
command (which could be disabled alltogether with an option if the
user is annoyed by it).

It would also be nice if gud-mode could find out if libtool is used,
and then suggest start the program as "libtool gdb foo" instead of
"gdb foo".  Detecting if pvm is used reliably is somewhat trickier
though, I think.

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

* Re: gud.el gdb --cd and libtool
  2002-11-08 10:35 gud.el gdb --cd and libtool Simon Josefsson
  2002-11-08 15:59 ` Stefan Monnier
@ 2002-11-09 11:55 ` Richard Stallman
  2002-11-10 11:23   ` Simon Josefsson
  1 sibling, 1 reply; 6+ messages in thread
From: Richard Stallman @ 2002-11-09 11:55 UTC (permalink / raw)
  Cc: emacs-devel

Does this change fix it?

*** gud.el.~1.161.~	Mon Oct 21 15:26:25 2002
--- gud.el	Sat Nov  9 05:53:52 2002
***************
*** 406,413 ****
    (interactive (list (gud-query-cmdline 'gdb)))
  
    (gud-common-init command-line
! 		   #'(lambda (file args)
! 		       `("-cd" ,(expand-file-name default-directory) . ,args))
  		   'gud-gdb-marker-filter 'gud-gdb-find-file)
    (set (make-local-variable 'gud-minor-mode) 'gdb)
  
--- 406,412 ----
    (interactive (list (gud-query-cmdline 'gdb)))
  
    (gud-common-init command-line
! 		   #'(lambda (file args) args)
  		   'gud-gdb-marker-filter 'gud-gdb-find-file)
    (set (make-local-variable 'gud-minor-mode) 'gdb)
  
***************
*** 2233,2238 ****
--- 2232,2238 ----
  (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.
***************
*** 2256,2261 ****
--- 2256,2262 ----
  		      file-subst)))
  	 (filepart (and file-word (concat "-" (file-name-nondirectory file)))))
      (pop-to-buffer (concat "*gud" filepart "*"))
+     (setq default-directory dir)
      ;; Set default-directory to the file's directory.
      (and file-word
  	 gud-chdir-before-run

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

* Re: gud.el gdb --cd and libtool
  2002-11-09 11:55 ` Richard Stallman
@ 2002-11-10 11:23   ` Simon Josefsson
  2002-11-11 10:18     ` Richard Stallman
  0 siblings, 1 reply; 6+ messages in thread
From: Simon Josefsson @ 2002-11-10 11:23 UTC (permalink / raw)
  Cc: emacs-devel

Richard Stallman <rms@gnu.org> writes:

> Does this change fix it?
>
> *** gud.el.~1.161.~	Mon Oct 21 15:26:25 2002
> --- gud.el	Sat Nov  9 05:53:52 2002
> ***************
> *** 406,413 ****
>     (interactive (list (gud-query-cmdline 'gdb)))
>   
>     (gud-common-init command-line
> ! 		   #'(lambda (file args)
> ! 		       `("-cd" ,(expand-file-name default-directory) . ,args))
>   		   'gud-gdb-marker-filter 'gud-gdb-find-file)
>     (set (make-local-variable 'gud-minor-mode) 'gdb)
>   
> --- 406,412 ----
>     (interactive (list (gud-query-cmdline 'gdb)))
>   
>     (gud-common-init command-line
> ! 		   #'(lambda (file args) args)
>   		   'gud-gdb-marker-filter 'gud-gdb-find-file)
>     (set (make-local-variable 'gud-minor-mode) 'gdb)

I think this works, but it seems cleaner to replace #'(lambda (file
args) args) with nil as it was before the patch.

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

* Re: gud.el gdb --cd and libtool
  2002-11-10 11:23   ` Simon Josefsson
@ 2002-11-11 10:18     ` Richard Stallman
  0 siblings, 0 replies; 6+ messages in thread
From: Richard Stallman @ 2002-11-11 10:18 UTC (permalink / raw)
  Cc: emacs-devel

Thanks.

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

end of thread, other threads:[~2002-11-11 10:18 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-11-08 10:35 gud.el gdb --cd and libtool Simon Josefsson
2002-11-08 15:59 ` Stefan Monnier
2002-11-08 17:02   ` Simon Josefsson
2002-11-09 11:55 ` Richard Stallman
2002-11-10 11:23   ` Simon Josefsson
2002-11-11 10:18     ` Richard Stallman

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