unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Toggle view in gdba
@ 2004-10-17 15:24 Masatake YAMATO
  2004-10-18  1:49 ` Nick Roberts
  0 siblings, 1 reply; 9+ messages in thread
From: Masatake YAMATO @ 2004-10-17 15:24 UTC (permalink / raw)


Is there any strong reason that gdba doesn't provides keyboard 
interface for the its great functions?

2004-10-18  Masatake YAMATO  <jet@gyve.org>

	* progmodes/gdb-ui.el (gdb-ann3): Define a key which toggles
	source view and assembler view.

Index: lisp/progmodes/gdb-ui.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/progmodes/gdb-ui.el,v
retrieving revision 1.24
diff -u -r1.24 gdb-ui.el
--- lisp/progmodes/gdb-ui.el	6 Oct 2004 07:20:53 -0000	1.24
+++ lisp/progmodes/gdb-ui.el	17 Oct 2004 15:23:05 -0000
@@ -169,6 +169,14 @@
 			  (forward-char 2)
 			  (gud-call "until *%a" arg)))
 	   "\C-u" "Continue to current line or address.")
+  ;;
+  (gud-def gud-toggle-view (cond
+			    ((eq gdb-selected-view 'assembler)
+			     (gdb-view-source-function))
+			    ((eq gdb-selected-view 'source)
+			     (gdb-view-assembler)))
+	   "t" "Toggle source and assembler view.")
+			     
 
   (define-key gud-minor-mode-map [left-margin mouse-1]
     'gdb-mouse-toggle-breakpoint)

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

* Toggle view in gdba
  2004-10-17 15:24 Toggle view in gdba Masatake YAMATO
@ 2004-10-18  1:49 ` Nick Roberts
  2004-10-19  2:05   ` Masatake YAMATO
  0 siblings, 1 reply; 9+ messages in thread
From: Nick Roberts @ 2004-10-18  1:49 UTC (permalink / raw)
  Cc: emacs-devel


It can currently be toggled from the menubar but providing a keyboard
interface can only help. However, it needs a different keybinding e.g 
`C-c C-something':

   * The key sequences bound in a major mode keymap should usually
     start with `C-c', followed by a control character, a digit, or `{',
     `}', `<', `>', `:' or `;'.  The other punctuation characters are
     reserved for minor modes, and ordinary letters are reserved for
     users.

Nick

Masatake YAMATO writes:
 > Is there any strong reason that gdba doesn't provides keyboard 
 > interface for the its great functions?
 > 
 > 2004-10-18  Masatake YAMATO  <jet@gyve.org>
 > 
 > 	* progmodes/gdb-ui.el (gdb-ann3): Define a key which toggles
 > 	source view and assembler view.
 > 
 > Index: lisp/progmodes/gdb-ui.el
 > ===================================================================
 > RCS file: /cvsroot/emacs/emacs/lisp/progmodes/gdb-ui.el,v
 > retrieving revision 1.24
 > diff -u -r1.24 gdb-ui.el
 > --- lisp/progmodes/gdb-ui.el	6 Oct 2004 07:20:53 -0000	1.24
 > +++ lisp/progmodes/gdb-ui.el	17 Oct 2004 15:23:05 -0000
 > @@ -169,6 +169,14 @@
 >  			  (forward-char 2)
 >  			  (gud-call "until *%a" arg)))
 >  	   "\C-u" "Continue to current line or address.")
 > +  ;;
 > +  (gud-def gud-toggle-view (cond
 > +			    ((eq gdb-selected-view 'assembler)
 > +			     (gdb-view-source-function))
 > +			    ((eq gdb-selected-view 'source)
 > +			     (gdb-view-assembler)))
 > +	   "t" "Toggle source and assembler view.")
 > +			     
 >  
 >    (define-key gud-minor-mode-map [left-margin mouse-1]
 >      'gdb-mouse-toggle-breakpoint)

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

* Re: Toggle view in gdba
  2004-10-18  1:49 ` Nick Roberts
@ 2004-10-19  2:05   ` Masatake YAMATO
  2004-10-19 11:00     ` Nick Roberts
  0 siblings, 1 reply; 9+ messages in thread
From: Masatake YAMATO @ 2004-10-19  2:05 UTC (permalink / raw)
  Cc: emacs-devel

> It can currently be toggled from the menubar but providing a keyboard
> interface can only help. However, it needs a different keybinding e.g 
> `C-c C-something':
> 
>    * The key sequences bound in a major mode keymap should usually
>      start with `C-c', followed by a control character, a digit, or `{',
>      `}', `<', `>', `:' or `;'.  The other punctuation characters are
>      reserved for minor modes, and ordinary letters are reserved for
>      users.
> 
> Nick

How about next patch?
\C-c\C-v is used as a prefix key view and display switch commands.

Masatake YAMATO

Index: lisp/progmodes/gdb-ui.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/progmodes/gdb-ui.el,v
retrieving revision 1.24
diff -u -r1.24 gdb-ui.el
--- lisp/progmodes/gdb-ui.el	6 Oct 2004 07:20:53 -0000	1.24
+++ lisp/progmodes/gdb-ui.el	19 Oct 2004 02:06:25 -0000
@@ -169,7 +169,28 @@
 			  (forward-char 2)
 			  (gud-call "until *%a" arg)))
 	   "\C-u" "Continue to current line or address.")
-
+  ;;
+  (gud-def gud-toggle-view (cond
+			    ((eq gdb-selected-view 'assembler)
+			     (gdb-view-source-function))
+			    ((eq gdb-selected-view 'source)
+			     (gdb-view-assembler)))
+	   "\C-v\C-v" "Toggle source and assembler view.")
+  (gud-def gud-display-gdb-buffer (gdb-display-gdb-buffer)
+	   "\C-vg" "Display GUD buffer.")    
+  (gud-def gud-display-assembler-buffer (gdb-display-assembler-buffer)
+	   "\C-va" "Display disassembly view.")
+  (gud-def gud-display-threads-buffer (gdb-display-threads-buffer)
+	   "\C-vt" "Display IDs of currently known threads.")
+  (gud-def gud-display-registers-buffer (gdb-display-registers-buffer)
+	   "\C-vr" "Display integer register contents.")
+  (gud-def gud-display-locals-buffer (gdb-display-locals-buffer)
+	   "\C-vl" "Display local variables of current stack and their values.")
+  (gud-def gud-display-stack-buffer (gdb-display-stack-buffer)
+	   "\C-vs" "Display backtrace of current stack.")
+  (gud-def gud-display-breakpoints-buffer (gdb-display-breakpoints-buffer)
+	   "\C-vb" "Display status of user-settable breakpoints.")
+			     
   (define-key gud-minor-mode-map [left-margin mouse-1]
     'gdb-mouse-toggle-breakpoint)
   (define-key gud-minor-mode-map [left-fringe mouse-1]

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

* Re: Toggle view in gdba
  2004-10-19  2:05   ` Masatake YAMATO
@ 2004-10-19 11:00     ` Nick Roberts
  2004-10-19 16:21       ` Masatake YAMATO
  0 siblings, 1 reply; 9+ messages in thread
From: Nick Roberts @ 2004-10-19 11:00 UTC (permalink / raw)
  Cc: emacs-devel


Actually I think it would be better not to use any of these keybindings.
Gud-watch doesn't have a keybindings and I've just remembered why: these
commands are really GDB specific and don't work for "gdb -fullname", perldb,
pdb etc. Once GDB-UI has been invoked these keybindings are set for all the
other debugger modes. As recent discussion has shown, there are still problems
with GDB-UI so I don't want to interfere with these other modes, particularly
the original gdb mode.

Nick

 > How about next patch?
 > \C-c\C-v is used as a prefix key view and display switch commands.
 > 
 > Masatake YAMATO
 > 
 > Index: lisp/progmodes/gdb-ui.el
 > ===================================================================
 > RCS file: /cvsroot/emacs/emacs/lisp/progmodes/gdb-ui.el,v
 > retrieving revision 1.24
 > diff -u -r1.24 gdb-ui.el
 > --- lisp/progmodes/gdb-ui.el	6 Oct 2004 07:20:53 -0000	1.24
 > +++ lisp/progmodes/gdb-ui.el	19 Oct 2004 02:06:25 -0000
 > @@ -169,7 +169,28 @@
 >  			  (forward-char 2)
 >  			  (gud-call "until *%a" arg)))
 >  	   "\C-u" "Continue to current line or address.")
 > -
 > +  ;;
 > +  (gud-def gud-toggle-view (cond
 > +			    ((eq gdb-selected-view 'assembler)
 > +			     (gdb-view-source-function))
 > +			    ((eq gdb-selected-view 'source)
 > +			     (gdb-view-assembler)))
 > +	   "\C-v\C-v" "Toggle source and assembler view.")
 > +  (gud-def gud-display-gdb-buffer (gdb-display-gdb-buffer)
 > +	   "\C-vg" "Display GUD buffer.")    
 > +  (gud-def gud-display-assembler-buffer (gdb-display-assembler-buffer)
 > +	   "\C-va" "Display disassembly view.")
 > +  (gud-def gud-display-threads-buffer (gdb-display-threads-buffer)
 > +	   "\C-vt" "Display IDs of currently known threads.")
 > +  (gud-def gud-display-registers-buffer (gdb-display-registers-buffer)
 > +	   "\C-vr" "Display integer register contents.")
 > +  (gud-def gud-display-locals-buffer (gdb-display-locals-buffer)
 > +	   "\C-vl" "Display local variables of current stack and their values.")
 > +  (gud-def gud-display-stack-buffer (gdb-display-stack-buffer)
 > +	   "\C-vs" "Display backtrace of current stack.")
 > +  (gud-def gud-display-breakpoints-buffer (gdb-display-breakpoints-buffer)
 > +	   "\C-vb" "Display status of user-settable breakpoints.")
 > +			     
 >    (define-key gud-minor-mode-map [left-margin mouse-1]
 >      'gdb-mouse-toggle-breakpoint)
 >    (define-key gud-minor-mode-map [left-fringe mouse-1]

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

* Re: Toggle view in gdba
  2004-10-19 11:00     ` Nick Roberts
@ 2004-10-19 16:21       ` Masatake YAMATO
  2004-10-23  8:01         ` Masatake YAMATO
  0 siblings, 1 reply; 9+ messages in thread
From: Masatake YAMATO @ 2004-10-19 16:21 UTC (permalink / raw)
  Cc: emacs-devel

Hi,

> Actually I think it would be better not to use any of these keybindings.
> Gud-watch doesn't have a keybindings and I've just remembered why: these
> commands are really GDB specific and don't work for "gdb -fullname", perldb,
> pdb etc. Once GDB-UI has been invoked these keybindings are set for all the
> other debugger modes. As recent discussion has shown, there are still problems
> with GDB-UI so I don't want to interfere with these other modes, particularly
> the original gdb mode.

Is it ok if the key bindings are not propagated to the other modes (and global-map)?

Experimentally, I added new a argument LOCAL to gud-def and added line

	(use-local-map (copy-keymap (current-local-map)))

to `gdb-ann3'.

Index: lisp/progmodes/gud.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/progmodes/gud.el,v
retrieving revision 1.26
diff -u -r1.26 gud.el
--- lisp/progmodes/gud.el	13 Oct 2004 16:32:41 -0000	1.26
+++ lisp/progmodes/gud.el	19 Oct 2004 16:18:02 -0000
@@ -220,7 +220,7 @@
 ;; major mode.  The function is also bound in the global keymap with the
 ;; GUD prefix.
 
-(defmacro gud-def (func cmd key &optional doc)
+(defmacro gud-def (func cmd key &optional doc local)
   "Define FUNC to be a command sending STR and bound to KEY, with
 optional doc string DOC.  Certain %-escapes in the string arguments
 are interpreted specially if present.  These are:
@@ -247,7 +247,7 @@
 	    `(gud-call ,cmd arg)
 	  cmd))
      ,(if key `(local-set-key ,(concat "\C-c" key) ',func))
-     ,(if key `(global-set-key (vconcat gud-key-prefix ,key) ',func))))
+     ,(if (and key (not local)) `(global-set-key (vconcat gud-key-prefix ,key) ',func))))
 
 ;; Where gud-display-frame should put the debugging arrow; a cons of
 ;; (filename . line-number).  This is set by the marker-filter, which scans
Index: lisp/progmodes/gdb-ui.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/progmodes/gdb-ui.el,v
retrieving revision 1.24
diff -u -r1.24 gdb-ui.el
--- lisp/progmodes/gdb-ui.el	6 Oct 2004 07:20:53 -0000	1.24
+++ lisp/progmodes/gdb-ui.el	19 Oct 2004 16:18:02 -0000
@@ -169,15 +169,46 @@
 			  (forward-char 2)
 			  (gud-call "until *%a" arg)))
 	   "\C-u" "Continue to current line or address.")
-
+  ;;
   (define-key gud-minor-mode-map [left-margin mouse-1]
     'gdb-mouse-toggle-breakpoint)
   (define-key gud-minor-mode-map [left-fringe mouse-1]
     'gdb-mouse-toggle-breakpoint)
 
+  ;; Don't propagate key defs to other than gdba mode.
+    (use-local-map (copy-keymap (current-local-map)))
+  (gud-def gud-toggle-view (cond
+			    ((eq gdb-selected-view 'assembler)
+			     (gdb-view-source-function))
+			    ((eq gdb-selected-view 'source)
+			     (gdb-view-assembler)))
+	   "\C-v\C-v" "Toggle source and assembler view."
+	   'local)
+  (gud-def gud-display-gdb-buffer (gdb-display-gdb-buffer)
+	   "\C-vg" "Display GUD buffer." 
+	   'local)    
+  (gud-def gud-display-assembler-buffer (gdb-display-assembler-buffer)
+	   "\C-va" "Display disassembly view." 
+	   'local)
+  (gud-def gud-display-threads-buffer (gdb-display-threads-buffer)
+	   "\C-vt" "Display IDs of currently known threads." 
+	   'local)
+  (gud-def gud-display-registers-buffer (gdb-display-registers-buffer)
+	   "\C-vr" "Display integer register contents." 
+	   'local)
+  (gud-def gud-display-locals-buffer (gdb-display-locals-buffer)
+	   "\C-vl" "Display local variables of current stack and their values."
+	   'local)
+  (gud-def gud-display-stack-buffer (gdb-display-stack-buffer)
+	   "\C-vs" "Display backtrace of current stack."
+	   'local)
+  (gud-def gud-display-breakpoints-buffer (gdb-display-breakpoints-buffer)
+	   "\C-vb" "Display status of user-settable breakpoints."
+	   'local)
+
   (setq comint-input-sender 'gdb-send)
   ;;
-  ;; (re-)initialise
+  ;; (re-)initialize
   (setq gdb-current-address "main")
   (setq gdb-previous-address nil)
   (setq gdb-previous-frame nil)

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

* Re: Toggle view in gdba
  2004-10-19 16:21       ` Masatake YAMATO
@ 2004-10-23  8:01         ` Masatake YAMATO
  2004-10-23 14:24           ` Stefan
  2004-10-24 20:38           ` Nick Roberts
  0 siblings, 2 replies; 9+ messages in thread
From: Masatake YAMATO @ 2004-10-23  8:01 UTC (permalink / raw)


> Hi,
> 
> > Actually I think it would be better not to use any of these keybindings.
> > Gud-watch doesn't have a keybindings and I've just remembered why: these
> > commands are really GDB specific and don't work for "gdb -fullname", perldb,
> > pdb etc. Once GDB-UI has been invoked these keybindings are set for all the
> > other debugger modes. As recent discussion has shown, there are still problems
> > with GDB-UI so I don't want to interfere with these other modes, particularly
> > the original gdb mode.
> 
> Is it ok if the key bindings are not propagated to the other modes (and global-map)?
> 
> Experimentally, I added new a argument LOCAL to gud-def and added line
> 
> 	(use-local-map (copy-keymap (current-local-map)))
> 
> to `gdb-ann3'.

No objectoin about my patch?

   http://lists.gnu.org/archive/html/emacs-devel/2004-10/msg00834.html

Masatake YAMATO

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

* Re: Toggle view in gdba
  2004-10-23  8:01         ` Masatake YAMATO
@ 2004-10-23 14:24           ` Stefan
  2004-10-23 21:57             ` Nick Roberts
  2004-10-24 20:38           ` Nick Roberts
  1 sibling, 1 reply; 9+ messages in thread
From: Stefan @ 2004-10-23 14:24 UTC (permalink / raw)
  Cc: emacs-devel

>> > Actually I think it would be better not to use any of these
>> > keybindings.  Gud-watch doesn't have a keybindings and I've just
>> > remembered why: these commands are really GDB specific and don't work
>> > for "gdb -fullname", perldb, pdb etc. Once GDB-UI has been invoked
>> > these keybindings are set for all the other debugger modes. As recent
>> > discussion has shown, there are still problems with GDB-UI so I don't
>> > want to interfere with these other modes, particularly the original
>> > gdb mode.

I don't see where's the problem.  If you start GUD with "gdb --fullname"
and then another GUD with pdb, things will go wrong as well.  This should be
fixed, but it is orthogonal to the gdb-ui support.

>> Experimentally, I added new a argument LOCAL to gud-def and added line
>> 
>> (use-local-map (copy-keymap (current-local-map)))
>> 
>> to `gdb-ann3'.

This is ugly.  I'd rather just add the gdb-ui keybindings globally.


        Stefan


PS: I think what should happen is that gud should use a more traditional
keybinding scheme, where the keybindings are "static" (i.e. not changed when
you do M-x gdb) and the *commands* then check whether they're talking to
gdb, or pdb.

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

* Re: Toggle view in gdba
  2004-10-23 14:24           ` Stefan
@ 2004-10-23 21:57             ` Nick Roberts
  0 siblings, 0 replies; 9+ messages in thread
From: Nick Roberts @ 2004-10-23 21:57 UTC (permalink / raw)
  Cc: Masatake YAMATO, emacs-devel

 > >> > Actually I think it would be better not to use any of these
 > >> > keybindings.  Gud-watch doesn't have a keybindings and I've just
 > >> > remembered why: these commands are really GDB specific and don't work
 > >> > for "gdb -fullname", perldb, pdb etc. Once GDB-UI has been invoked
 > >> > these keybindings are set for all the other debugger modes. As recent
 > >> > discussion has shown, there are still problems with GDB-UI so I don't
 > >> > want to interfere with these other modes, particularly the original
 > >> > gdb mode.
 > 
 > I don't see where's the problem.  If you start GUD with "gdb --fullname"
 > and then another GUD with pdb, things will go wrong as well.  This should be
 > fixed, but it is orthogonal to the gdb-ui support.

I'm talking invoking the modes serially, not about multiple sessions.

 > >> Experimentally, I added new a argument LOCAL to gud-def and added line
 > >> 
 > >> (use-local-map (copy-keymap (current-local-map)))
 > >> 
 > >> to `gdb-ann3'.
 > 
 > This is ugly.  I'd rather just add the gdb-ui keybindings globally.

Ugliness is really the price of having two modes that use GDB. The old
mode needs to be removed, which clearly is not acceptable at the moment.

 > PS: I think what should happen is that gud should use a more traditional
 > keybinding scheme, where the keybindings are "static" (i.e. not changed when
 > you do M-x gdb) and the *commands* then check whether they're talking to
 > gdb, or pdb.

Yes. Lets try that after the release.

Nick

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

* Re: Toggle view in gdba
  2004-10-23  8:01         ` Masatake YAMATO
  2004-10-23 14:24           ` Stefan
@ 2004-10-24 20:38           ` Nick Roberts
  1 sibling, 0 replies; 9+ messages in thread
From: Nick Roberts @ 2004-10-24 20:38 UTC (permalink / raw)
  Cc: emacs-devel

 > > Is it ok if the key bindings are not propagated to the other modes (and global-map)?
 > > 
 > > Experimentally, I added new a argument LOCAL to gud-def and added line
 > > 
 > > 	(use-local-map (copy-keymap (current-local-map)))
 > > 
 > > to `gdb-ann3'.
 > 
 > No objectoin about my patch?
 > 

I don't think the benefit justifies the extra complexity (also there's another
set of commands gud-frame-assembler-buffer etc that the user might prefer to
use). Let's leave this one, for the moment, and review it again when/if, at
some stage in the future, the keybindings, in general, are simplified.

Nick

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

end of thread, other threads:[~2004-10-24 20:38 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-10-17 15:24 Toggle view in gdba Masatake YAMATO
2004-10-18  1:49 ` Nick Roberts
2004-10-19  2:05   ` Masatake YAMATO
2004-10-19 11:00     ` Nick Roberts
2004-10-19 16:21       ` Masatake YAMATO
2004-10-23  8:01         ` Masatake YAMATO
2004-10-23 14:24           ` Stefan
2004-10-23 21:57             ` Nick Roberts
2004-10-24 20:38           ` 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).