forked from cldwalker/debugger
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathrdebug-emacs.texi
1030 lines (803 loc) · 33.5 KB
/
rdebug-emacs.texi
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
\input texinfo @c -*-texinfo-*-
@setfilename rdebug-emacs.info
@set DBG ruby-debug
@set ttrdebug @code{rdebug}
@set ttDBG @code{@value{DBG}}
@set Emacs @sc{gnu} Emacs
@set RDEBUG_EMACS_VERSION 0.1
@include version-rdebug-emacs.texi
@finalout
@c Karl Berry informs me that this will add straight quotes in
@c typewriter text.
@c See the "Inserting Quote Characters" node in the Texinfo manual
@set txicodequoteundirected
@set txicodequotebacktick
@c THIS MANUAL REQUIRES TEXINFO 4.0 OR LATER.
@c This is a dir.info fragment to support semi-automated addition of
@c manuals to an info tree.
@dircategory Programming & development tools.
@direntry
* ruby-debug-emacs: (ruby-debug). Ruby Debugger for GNU Emacs
@end direntry
@titlepage
@title Debugging with @code{ruby-debug} inside GNU Emacs Version @value{RDEBUG_EMACS_VERSION}
@sp 1
@subtitle @value{EDITION} Edition
@subtitle @value{UPDATED-MONTH}
@author Rocky Bernstein and Anders Lindgren
@page
@ifset WHERETO
@tex
{\parskip=0pt
\hfill (Send bugs and comments on ruby-debug to fill in...)\par
\hfill {\it Debugging with {\tt ruby-debug}\par
\hfill \TeX{}info \texinfoversion\par
}
@end tex
@end ifset
@end titlepage
@page
@node Top, Getting started, (dir), (dir)
@top Debugging with ruby-debug under GNU Emacs
@menu
* Getting started::
* The Multi-window Mode::
* Debugger Buffers::
* Emacs Debugger Commands:: Indexes (nodes containing large menus)
* Emacs Command Index:: An item for each GNU/Emacs command name.
* Emacs Function Index:: An item for each Emacs Function.
* Emacs Key Binding Index:: An item for each Emacs Debugger Command.
@detailmenu
--- The Detailed Node Listing ---
Getting started
* Installation:: How to install this package
* Emacs rdebug:: Invoke the ruby debugger initially
* Emacs shell tracking mode:: Entering rdebug from an existing shell buffer
Debugger Buffers
* Debugger Command Buffer::
* Emacs Source:: Commands from the source script
Emacs Debugger Commands
* Emacs Debugger Common Commands::
* Emacs Debugger Breakpoint Buffer Commands::
* Emacs Debugger Stack Buffer Commands::
* Emacs Debugger Variable Buffer Commands::
* Emacs Debugger Watch Buffer Commands::
* Emacs GUD Commands::
@end detailmenu
@end menu
This file describes ruby-debug, the Ruby Debugger,
version @value{RDEBUG_EMACS_VERSION}
This is the @value{EDITION} Edition, @value{UPDATED}
@c Copyright (C) 2007 ...
@c @node GNU Emacs
@c @chapter Using @code{ruby-debug} from GNU Emacs
@cindex @value{Emacs}
A special interface which comes with Ruby that allows you to use
@value{Emacs} to view (and edit) the source files for the program you
are debugging with @value{DBG}. However you must be using at least
version 21 of @value{Emacs}, but with @value{Emacs} version 22 or 23
there are even more debugging features available. @code{M-x
show-emacs-version} inside @value{Emacs} will tell you what version you
are running.
This package provide a full-fledged debugging environment, on par with
modern integrated development environments. Once the debugger has been
activated, the Emacs frame is divided into a number of dedicated
debugger windows.@footnote{If you are an @value{Emacs} traditionalist,
you can, of course, run this package with only a shell and source
buffer}
This package comes with a number of predefined window layouts. It is
fully customizable so you can create your own.
@c -------------------------------------------------------------------
@node Getting started, The Multi-window Mode, Top, Top
@chapter Getting started
@menu
* Installation:: How to install this package
* Emacs rdebug:: Invoke the ruby debugger initially
* Emacs shell tracking mode:: Entering rdebug from an existing shell buffer
* Configurating this package:: Introducing the configure system
@end menu
@node Installation, Emacs rdebug, Getting started, Getting started
@section Installation
To use this interface, load the file @code{rdebug.el}. This file is a
light-weight file, basically it only contains a handful of
@code{autoload} directives.
For example, you can place the following in your @code{~/.emacs} file:
@smallexample
(require 'rdebug)
@end smallexample
In addition, you must have Ruby and ruby-debug installed.
@node Emacs rdebug, Emacs shell tracking mode, Installation, Getting started
@section Emacs rdebug
Use the command @kbd{M-x rdebug} in @sc{gnu} Emacs to start debugging.
Give the executable file you want to debug as an argument. Make sure
to use the version that comes with this package as this is newer than
that supplied with @value{Emacs}.
The @kbd{rdebug} command starts @value{DBG} as a subprocess of Emacs,
with input and output through a newly created Emacs buffer.
Using @value{DBG} under Emacs is just like using @value{DBG}
normally except for two things:
@itemize @bullet
@item
All ``terminal'' input and output goes through the GNU Emacs buffer.
@end itemize
This applies both to @value{DBG} commands and their output, and to the input
and output done by the program you are debugging.
This is useful because it means that you can copy the text of previous
commands and input them again; you can even use parts of the output
in this way.
All the facilities of GNU Emacs' Shell mode are available for interacting
with your script. In particular, you can send signals the usual
way---for example, @kbd{C-c C-c} for an interrupt, @kbd{C-c C-z} for a
stop.
@node Emacs shell tracking mode, Configurating this package, Emacs rdebug, Getting started
@section Entering rdebug from an existing shell buffer
Many times it's not feasible to enter the debugger from the outset.
Instead a call to the debugger is put inside the program.
@c See @xref{Unit Testing Session}.
It is also possible in GNU emacs to use a (``comint'') shell and set a
mode to watch for @value{DBG} prompts and track the source code in
another window. @xref{Interactive Shell, , Shell, Emacs, The @value{Emacs}
Manual}.
To enable, this run @kbd{M-x turn-on-rdebug-track-mode}. There is some
overhead involved in scanning output, so if you are not debugging Ruby
programs you probably want to turn this off which can be done via the
@code{M-x turn-off-rdebugtrack} command.
@node Configurating this package, , Emacs shell tracking mode, Getting started
@section Configurating this package
In this manual we present a number of @value{Emacs} lisp variables and
functions that you can use to configure the debugger interface. In
addition, you can use the @value{Emacs} @emph{customize} system, see the
@kbd{<menu-bar> <debugger> <options> <customize>} menu item.
@c -------------------------------------------------------------------
@node The Multi-window Mode, Debugger Buffers, Getting started, Top
@chapter Multi-window
In the multi-window debugger mode, a number of buffers are visible when
the debugger starts. This chapter will describe each of them, in
addition it will describe the features associated with the multi-window
mode.
The default multi-window layout looks like the following:
@verbatim
+----------------------------------------------------------------------+
| Toolbar |
+-----------------------------------+----------------------------------+
| | |
| Debugger shell | Variables buffer |
| | |
+-----------------------------------+----------------------------------+
| | |
| Source buffer | Output buffer |
| | |
+-----------------------------------+----------------------------------+
| | |
| Stack buffer | Breakpoints buffer |
| | |
+-----------------------------------+----------------------------------+
@end verbatim
@section Activating Multi-window mode
The variable @code{rdebug-many-windows} controls if multi-window mode
should be used, it is enabled by default. When starting the debugger
using the @code{M-x rdebug} mode the command line option @code{--emacs
3} must be specified (this is also the default).
When attaching to an already running debugger process, you must give the
debugger command @kbd{set annotate 3}.
@section Window Layouts
When the debugger is started, the original window layout of
@value{Emacs} is replaced with the window layout of the debugger. You
can switch back and forth between the original window layout and the
debugger layout using
@kbd{M-x rdebug-display-original-window-configuration} and
@kbd{M-x rdebug-display-debugger-window-configuration}.
If, for some reason, the debugger layout has been garbled you can
restore it to the original state using @kbd{M-x
rdebug-restore-debugger-window-layout}.
The debugger provides a number of different window layouts. The easies
way to try them out is to use the menu @kbd{<menu-bar> <debugger>
<layout>} and select any in the section starting with @code{Standard}.
@section The buffers
All buffers in this section share a set of commands for common debugger
operations and for switching between buffers. In addition, each buffer
has got a set of dedicated commands.
All debugger buffers, with the exception of source and the debugger
shell window, are called @emph{secondary buffers}.
@subsection Keybindings for all Debugger Windows
The debugger provides key-bindings that work in all debugger windows,
including Ruby source buffers. The key bindings are designed to match
keys of commonly used debugger environments.
The variable @code{rdebug-populate-common-keys-function} can be assigned
to a function that should bind the keys use. Three functions are
provided @code{rdebug-populate-common-keys-standard},
@code{...-eclipse}, and @code{...-netbeans}.
@multitable @columnfractions 0.4 0.2 0.2 0.2
@headitem Command @tab Standard @tab Eclipse @tab Netbeans
@item Run @tab f5 @tab @tab
@item Quit @tab S-f5 @tab @tab
@item Toggle Breakpoint @tab f9 @tab @tab
@item Enable/Disable Breakpoint @tab C-f9 @tab S-C-b @tab S-f8
@item Step over @tab f10 @tab f6 @tab f8
@item Step into @tab f11 @tab f5 @tab f7
@item Step out @tab S-f11 @tab f7 @tab M-S-f7
@end multitable
@subsection Keybindings for Secondary Buffers
The following commands are available in all secondary windows.
Capital letters move between secondary buffers as mentioned above (jump
to if visible or replace a secondary if not).
@table @kbd
@item SPACE
step (edebug compatible)
@item <
Up in the stack trace
@item >
Down in the stack trace
@item ?
Help
@item B
Display breakpoints buffer
@item C
Display command buffer
@item O
Display program output
@item S
Display source window
@item T
Display stack trace buffer
@item V
display variables buffer
@item W
display watch buffer
@item b
Set breakpoint
@item c
Continue (i.e. run)
@item d
Remove breakpoint
@item f
Finish (i.e. step out of the current function)
@item n
Next (i.e. step into function)
@item p
print
@item q
Quit
@item r
Restart
@item s
Step (i.e. step over function)
@end table
You can use the same commands in the source buffer if you enable
@code{rdebug-short-key-mode}. The best way to do this is to add the
following to your init file:
@smallexample
(add-hook 'rdebug-mode-hook 'rdebug-turn-on-short-key-mode)
@end smallexample
@subsection The Debugger Shell Buffer
The @emph{debugger shell window} is the main communication channel
between @value{DBG} and @value{Emacs}. You can use the shell to issue
debugger commands directly. In addition, any @value{Emacs} debugger
command you issue will be translated into shell commands, and the output
will be parsed.
It is the ambition that the @value{Emacs} debugger interface should be
in a state where the debugger shell window would not need to be visible.
@subsection The Source Buffer
The @emph{source buffers} (or buffers) contains the actual Ruby source
code that is being debugged. A small arrow in the left fringe displays
the current line. Active breakpoints are displayed as red dots and
passive as grey.
@subsection The Output Buffer
The @emph{output buffer} displays any output the debugged program emits.
The option @code{rdebug-use-separate-io-buffer} controls if the output
buffer should be used, or if the output would go into the debugger shell
buffer.
@subsection The Variables Buffer
In this buffer, local and object variables are displayed. The values of
the variables can be edited.
@table @kbd
@item RET
Edit the value
@item e
Print the value
@item x
Pretty-print the value
@end table
@subsection The Stack Trace Buffer
The @emph{stack trace} buffer displays the function that is currently
being debugger, the function that called it, etc., all the way up to the
originally called function.
You can navigate in the stack trace buffer in order to see the source of
any function in the call chain. The Variables buffer will also be
updated to reflect the local variables of that function.
@table @kbd
@item RET
Select a function to display
@item <digits>
Go to a stack frame
@end table
@subsection The Watch Buffer
The @emph{Watch Buffer} can display arbitrary expressions, including,
but not limited to, global variables.
@table @kbd
@item a
Add a watch expression
@item C-d, d
Delete a watch expression
@item RET, e
Edit a watch expression
@item <digits>
Go to the expression
@end table
@subsection The Breakpoints Buffer
The @emph{Breakpoints Buffer} displays all breakpoints that currently are
defined and shows if they are enabled or disabled.
@table @kbd
@item t
Toggle a breakpoint between enabled and disabled
@item i
Add a breakpoint condition
@item ret
Goto a breakpoint
@item C-d
Delete a breakpoint
@item <digits>
Go to the expression
@end table
@subsection The Help Buffer
The @emph{Help Buffer} is displayed whenever you press @code{?}. It will
display a help text on the available debugger commands and commands to
navigate between the buffers.
@c -------------------------------------------------------------------
@node Debugger Buffers, Emacs Debugger Commands, The Multi-window Mode, Top
@chapter Debugger Buffers
@menu
* Debugger Command Buffer::
* Emacs Source:: Commands from the source script
@end menu
@node Debugger Command Buffer, Emacs Source, Debugger Buffers, Debugger Buffers
@section Emacs Debugger Command buffer
Each time @value{DBG} displays a stack frame, Emacs automatically finds the
source file for that frame and puts an arrow (@samp{=>}) at the
left margin of the current line. Emacs uses a separate buffer for
source display, and splits the screen to show both your @value{DBG} session
and the source.
Explicit @value{DBG} @code{list} or search commands still produce output as
usual, but you probably have no reason to use them from GNU Emacs.
@quotation
@emph{Warning:} If the directory where your script resides is not your
current directory, it can be easy to confuse Emacs about the location of
the source files, in which case the auxiliary display buffer does not
appear to show your source. @value{DBG} can find programs by searching your
environment's @code{PATH} variable, so the @value{DBG} input and output
session proceeds normally; but Emacs does not get enough information
back from @value{DBG} to locate the source files in this situation. To
avoid this problem, either start @value{DBG} mode from the directory where
your script resides, or specify an absolute file name when prompted for the
@kbd{M-x gdb} argument.
A similar confusion can result if you use the @value{DBG} @code{file} command to
switch to debugging a program in some other location, from an existing
@value{DBG} buffer in Emacs.
@end quotation
@noindent
(preceded by @kbd{M-:} or @kbd{ESC :}, or typed in the @code{*scratch*} buffer, or
in your @file{.emacs} file).
In the @value{DBG} I/O buffer, you can use the Emacs commands listed
below in addition to the standard Shell mode commands. The I/O buffer
name name is usually @code{*gud-}@emph{script-name}@code{*}, where
@emph{script-name} is the name of the script you are debugging.
Many of the commands listed below are also bound to a second key
sequence which also can be used in the also be used in the source
script. These are listed in @ref{Emacs Source}.
In secondary buffers many commands are available the corresponding
final keystroke. For example @code{C-c n} in a secondary buffer is
@code{n}.
@table @kbd
@item C-h m
Describe the features of Emacs' @value{DBG} Mode.
@item C-x C-a C-b (gud-break)
@pindex C-x C-a C-b (gud-break)
Set breakpoint at current line.
@item C-x C-a C-d (gud-remove)
@pindex C-x C-a C-d (gud-remove)
Remove breakpoint at current line.
@item C-x C-a C-l (gud-refresh)
@pindex C-x C-a C-d (gud-refresh)
Fix up a possibly garbled display, and redraw the arrow.
@item C-c RET (comint-copy-old-input)
@pindex C-c RET (comint-copy-old-input)
Insert after prompt old input at point as new input to be edited.
Calls `comint-get-old-input' to get old input.
@item C-c n (gud-next)
@pindex C-c n (gud-next)
Step one line, skipping functions. (Step over).
@item C-x C-a C-o (comint-delete-output)
@pindex C-c n (comint-delete-output)
Delete all output from interpreter since last input. Does not delete
the prompt.
@item C-x C-a C-r (gud-cont)
@item C-c SPC (gud-step @var{arg})
@pindex C-c SPC (gud-step @var{arg})
@itemx C-x C-a C-s (gud-step @var{arg})
@pindex C-x C-a C-s (gud-step @var{arg})
Step one source line. Same as @value{DBG} @code{step} command. The
@value{Emacs} command name is @code{gud-step} and @code{C-x C-a C-s}
is an alternate binding which can be used in the source
script.
@c @xref{Step}.
With a numeric argument, run that many times.
@xref{Arguments, , Numeric Arguments, Emacs, The @value{Emacs}
Manual}.
@item C-x C-a C-t (gud-tbreak @var{arg})
Set temporary breakpoint at current line.
@item C-x C-a C-w (backward-kill-word)
@item C-x C-a C-x (comint-get-next-from-history)
@item C-x C-a C-z (comint-stop-subjob)
Stop the current subjob.
This command also kills the pending input
between the process mark and point.
WARNING: if there is no current subjob, you can end up suspending
the top-level process running in the buffer. If you accidentally do
this, use M-x comint-continue-subjob to resume the process. (This
is not a problem with most shells, since they ignore this signal.)
@item C-x C-a C-\ (comint-quit-subjob)
Send quit signal to the current subjob.
This command also kills the pending input
between the process mark and point.
@item C-c + (gud-step-plus)
Run @code{step+}.
@item C-c . (comint-insert-previous-argument @var{index})
Insert the @emph{index-th} argument from the previous Comint command-line at point.
Spaces are added at beginning and/or end of the inserted string if
necessary to ensure that it's separated from adjacent arguments.
Interactively, if no prefix argument is given, the last argument is inserted.
Repeated interactive invocations will cycle through the same argument
from progressively earlier commands (using the value of index specified
with the first command).
@item C-c < (gud-up)
Go up a stack frame. With a numeric argument, go up that many
stack frames. Same @value{DBG} @code{up} command.
@xref{Arguments, , Numeric Arguments, Emacs, The @value{Emacs}
Manual}.
@item C-c > (gud-down)
Go down a stack frame. Same as @value{DBG} @code{down}.
With a numeric argument, go down that many stack frames.
@xref{Arguments, , Numeric Arguments, Emacs, The @value{Emacs}
Manual}.
@item C-c ? (rdebug-display-secondary-window-help-buffer)
Display the rdebug help buffer.
@item C-c B (rdebug-display-breakpoints-buffer)
Display the rdebug breakpoints buffer.
@item C-x C-a C (rdebug-display-cmd-buffer)
Display the rdebug command buffer.
@item C-c O (rdebug-display-output-buffer)
Display the rdebug output buffer.
@item C-c R (gud-run)
@itemx C-c r (gud run)
Restart or run the script. Same as @value{DBG} @code{run} command.
@item C-c S (gud-source-resync)
@item C-c T (rdebug-display-stack-buffer)
Display the rdebug stack buffer.
@item C-c V (rdebug-display-variables-buffer)
Display the rdebug variables buffer.
@item C-c W (rdebug-display-watch-buffer)
Display the rdebug watch buffer.
@item C-c f (gud-finish @var{arg})
@pindex C-c f (gud-finish @var{arg})
Finish executing current function.
@itemx C-x C-a C-f (gud-finish)
@pindex C-x C-a C-f (gud-finish)
Finish executing current function. The same as @value{DBG}
@code{finish} command.
@c @xref{Finish}.
@item C-c n (gud-next)
@pindex C-c n (gud-next)
Execute to next source line in this function, skipping all function
calls. Same as @value{DBG} @code{next} command.
@c @xref{Next}.
With a numeric argument, run that many times.
@c @xref{Arguments, , Numeric Arguments, Emacs, The @value{Emacs} Manual}.
@item C-c q (gud-quit)
@item C-x C-a C-l
Resynchronize the current position with the source window. The
@value{Emacs} command name is @code{gud-refresh} and @code{C-x C-a
C-l} is an alternate binding which also can be used in the source script.
@item C-c a
Shows argument variables (e.g.@: @code{$1}, @code{$2}) of the current
stack frame. Same as @value{DBG} @code{info args} command. The
@value{Emacs} command name is @code{gud-args} and @code{C-x C-a a} is
an alternate binding which also can be used in the source script.
@item C-c T
Show stack trace. Same as @value{DBG} @code{where} command. The
@value{Emacs} command name is @code{gud-where} and @code{C-x C-a T} is
an alternate binding which can be used in the source
script.
@c @xref{Backtrace}.
@end table
In any source file, the Emacs command @kbd{C-x SPC} (@code{gud-break})
tells @value{DBG} to set a breakpoint on the source line point is on.
If you accidentally delete the source-display buffer, an easy way to get
it back is to type the command @code{frame} in the @value{DBG} buffer, to
request a frame display; when you run under Emacs, this recreates
the source buffer if necessary to show you the context of the current
frame.
The source files displayed in Emacs are in ordinary Emacs buffers
which are visiting the source files in the usual way. You can edit
the files with these buffers if you wish; but keep in mind that @value{DBG}
communicates with Emacs in terms of line numbers. If you add or
delete lines from the text, the line numbers that @value{DBG} knows cease
to correspond properly with the code.
@xref{Debugger Operation, , , Emacs, The @value{Emacs}
Manual}.
@node Emacs Source, , Debugger Command Buffer, Debugger Buffers
@section Commands from the source script
@table @kbd
@item C-x SPC
tells @value{DBG} to set a breakpoint on the source
line point is on. (@code{gud-break})
@item C-x C-a t
@code{gud-linetrace}
@item C-x C-a C-f
Restart or run the script. Same as @value{DBG} @code{run} command. The
@value{Emacs} command name is @code{gud-finish}. In the corresponding
I/O buffer, @code{C-c R} is an alternate binding.
@item C-x C-a T
Show stack trace. Same as @value{DBG} @code{where} command. In the
corresponding I/O buffer, @code{C-c T} is an alternate
binding.
@c @xref{Backtrace}.
@item C-x C-a <
Go up a stack frame. With a numeric argument, go up that many
stack frames. Same @value{DBG} @code{up} command.
@xref{Arguments, , Numeric Arguments, Emacs, The @value{Emacs} Manual}.
The @value{Emacs} command name is @code{gud-up}. In the corresponding
I/O buffer, @code{C-c <} is an alternate binding.
@item C-x C-a >
Go down a stack frame. Same as @value{DBG} @code{down}.
With a numeric argument, go down that many stack frames.
@xref{Arguments, , Numeric Arguments, Emacs, The @value{Emacs}
Manual}.
The @value{Emacs} command name is @code{gud-down}. In the
corresponding I/O buffer, @code{C-c >} is an alternate binding.
@item C-x C-a C-t
@code{gud-tbreak}
@item C-x C-a C-s
Step one source line. Same as @value{DBG} @code{step}
command.
@c @xref{Step}.
With a numeric argument, run that many times.
@xref{Arguments, , Numeric Arguments, Emacs, The @value{Emacs}
Manual}.
The @value{Emacs} command name is @code{gud-step}. In the
corresponding I/O buffer, @code{C-x C-a C-s} is an alternate binding.
@item C-x C-a C-e
@code{gud-statement}
@item C-x C-a R
Restart or run the script. Same as @value{DBG} @code{run} command. The
@value{Emacs} command name is @code{gud-run}. In the corresponding I/O
buffer, @code{C-c R} is an alternate binding.
@item C-x C-a C-d
Delete breakpoint. @code{gud-remove}
@item C-x C-a C-p
@code{gud-print}
@item C-x C-a C-n
Execute to next source line in this function, skipping all function
calls. Same as @value{DBG} @code{next} command. With a numeric
argument, run that many times. @xref{Arguments, , Numeric Arguments,
Emacs, The @value{Emacs} Manual}.
The @value{Emacs} command name is @code{gud-next}. In the
corresponding I/O buffer, @code{C-x C-a C-n} is an alternate binding.
@item C-x C-a f C-f
@code{gud-finish}
@item C-x C-a C-r
Continue execution of your script Same as @value{DBG} @code{continue}
command. The @value{Emacs} command name is @code{gud-cont}. In the
corresponding I/O buffer, @code{C-x C-a C-r} is an alternate binding.
@c See @ref{Continue}.
@item C-x C-a C-b
@code{gud-break}
@item C-x C-a a
@code{gud-args}
Shows argument variables (e.g.@: @code{$1}, @code{$2}) of the current
stack frame. Same as @value{DBG} @code{info args} command. The
@value{Emacs} command name is @code{gud-args}. In the corresponding
I/O buffer, @code{C-c a} is an alternate binding which also can be
used in the source script.
@item C-x C-a C-l
Move to current position in this source window. The @value{Emacs}
command name is @code{gud-refresh}. In the corresponding I/O buffer,
@code{C-x C-a C-l} is an alternate binding.
@end table
@node Emacs Debugger Commands, Emacs Command Index, Debugger Buffers, Top
@chapter Emacs Debugger Commands
@menu
* Emacs Debugger Common Commands::
* Emacs Debugger Breakpoint Buffer Commands::
* Emacs Debugger Stack Buffer Commands::
* Emacs Debugger Variable Buffer Commands::
* Emacs Debugger Watch Buffer Commands::
* Emacs GUD Commands::
@end menu
@node Emacs Debugger Common Commands, Emacs Debugger Breakpoint Buffer Commands, Emacs Debugger Commands, Emacs Debugger Commands
@section Emacs Debugger Common Commands
The commands in this section are used to make a secondary buffer
visible. If the buffer doesn't exist, nothing is done.
The way the buffer is made visible is follows the following
rules tried in order:
@enumerate
@item
If the buffer doesn't exist, do nothing.
@item
If the buffer is already displayed, switch to it.
@item
If the current buffer is a
secondary buffer, bury it replacing with the requested
buffer.
@item
If there is secondary buffer visible, that
is replaced instead.
@item
Just pick a visible buffer to bury and replace.
@end enumerate
The commands are also have key bindings that end in an uppercase
letter. This letter is given in parenthesis. When in one of the
secondary buffers, the uppercase letter is bound to the command as well.
@table @kbd
@item (rdebug-display-breakpoints-buffer) (@kbd{B})
@findex rdebug-display-breakpoints-buffer (@kbd{B})
Display the rdebug breakpoints buffer. Bound to: @kbd{C-x C-a B},
@kbd{<menu-bar> <debugger> <view> <breakpoints>}. Secondary buffers:
@kbd{O}.
@item (rdebug-display-cmd-buffer) (@kbd{C})
@findex rdebug-display-cmd-buffer (@kbd{C})
Display the debugger command buffer.
Bound to: @kbd{C-x C-a C}, @kbd{<menu-bar> <debugger> <view> <shell>}.
@item (rdebug-display-output-buffer) (@kbd{O})
@findex rdebug-display-output-buffer (@kbd{?})
Display the debugger output buffer.
Bound to: @kbd{C-x C-a O}, @kbd{<menu-bar> <debugger> <view>
<output>}. Secondary buffers: @kbd{O}.
@item (rdebug-display-secondary-window-help-buffer) (@kbd{?})
@findex rdebug-display-secondary-window-help-buffer (@kbd{?})
@item (rdebug-display-stack-buffer) (@kbd{T})
@findex rdebug-display-stack-buffer (@kbd{T})
Display the debugger stack buffer. Bound to: @kbd{C-x C-a T},
@kbd{<menu-bar> <debugger> <view> <stack>}. Secondary buffers: @kbd{T}.
@item (rdebug-display-variables-buffer) (@kbd{V})
@findex rdebug-display-variables-buffer (@kbd{V})
Display the debugger variables buffer. Bound to: @kbd{C-x C-a V},
@kbd{<menu-bar> <debugger> <view> <variables>}. Secondary buffers:
@kbd{V}.
@item (rdebug-display-watch-buffer) (@kbd{W})
@findex rdebug-display-watch-buffer (@kbd{W})
Display the debugger variables buffer. Bound to: @kbd{C-x C-a W},
@kbd{<menu-bar> <debugger> <view> <watch>}. Secondary buffers: @kbd{V}.
@item (rdebug-display-debugger-window-configuration)
@findex rdebug-display-debugger-window-configuration
Display the current layout of windows of the rdebug Ruby debugger.
@item (rdebug-display-original-window-configuration)
@findex rdebug-display-original-window-configuration
Display the layout of windows prior to starting the rdebug Ruby
debugger. This function is called upon quitting the debugger and
@var{rdebug-many-windows} is not nil.
@item (rdebug-goto-entry-n)
@findex rdebug-goto-entry-n
Breakpoints, Display expressions and Stack Frames all have
numbers associated with them which are distinct from line
numbers. In a secondary buffer, this function is usually bound to
a numeric key. which will position you at that entry number. To
go to an entry above 9, just keep entering the number. For
example, if you press 1 and then 9, you should jump to entry
1 (if it exists) and then 19 (if that exists). Entering any
non-digit will start entry number from the beginning again.
@item (rdebug-quit) - q
@findex rdebug-quit (q)
Kill the debugger process associated with the buffer.
When @var{rdebug-many-windows} is active, the original window layout is
restored.
@item (rdebug-restore-windows)
@findex rdebug-restore-windows
Display the initial ruby debugger window layout.
@end table
@node Emacs Debugger Breakpoint Buffer Commands, Emacs Debugger Stack Buffer Commands, Emacs Debugger Common Commands, Emacs Debugger Commands
@section Emacs Debugger Breakpoint Buffer Commands
@table @kbd
@item (rdebug-goto-breakpoint)
@findex rdebug-goto-breakpoint
@item (rdebug-goto-breakpoint-mouse)
@findex rdebug-goto-breakpoint-mouse
@item (rdebug-breakpoints-mode)
@findex rdebug-breakpoints-mode
Major mode for displaying breakpoints in a secondary window. Uses
@var{rdebug-breakpoints-mode-map}.
@end table
@node Emacs Debugger Stack Buffer Commands, Emacs Debugger Variable Buffer Commands, Emacs Debugger Breakpoint Buffer Commands, Emacs Debugger Commands
@section Emacs Debugger Stack Buffer Commands
@table @kbd
@item (rdebug-goto-stack-frame)
@findex rdebug-goto-stack-frame
@item (rdebug-frames-mode)
@findex rdebug-frames-mode
Major mode for displaying the stack trace. Uses
@var{rdebug-frames-mode-map}.
@end table
@node Emacs Debugger Variable Buffer Commands, Emacs Debugger Watch Buffer Commands, Emacs Debugger Stack Buffer Commands, Emacs Debugger Commands
@section Emacs Debugger Variable Buffer Commands
@table @kbd
@item (rdebug-variables-edit)
@findex rdebug-variables-edit
@end table
@node Emacs Debugger Watch Buffer Commands, Emacs GUD Commands, Emacs Debugger Variable Buffer Commands, Emacs Debugger Commands
@section Emacs Debugger Watch Buffer Commands
@table @kbd
@item (rdebug-watch-add)
@findex rdebug-watch-add
Add a display expression.
@item (rdebug-watch-delete)
@findex rdebug-watch-delete
Delete a display expression.
@item (rdebug-watch-edit)
@findex rdebug-watch-edit
Edit a display expression.
@item (rdebug-watch-mode)
@findex rdebug-watch-mode
Major mode for displaying the display expressions. Uses
@var{rdebug-watch-mode-map}.
@end table
@node Emacs GUD Commands, , Emacs Debugger Watch Buffer Commands, Emacs Debugger Commands
@section Emacs Debugger GUD Commands
@table @kbd
@item (comint-copy-old-input)
@findex comint-copy-old-input
Insert after prompt old input at point as new input to be edited.
Calls `comint-get-old-input' to get old input.
@item (comint-delete-output)
@findex comint-delete-output
Delete all output from interpreter since last input.
Does not delete the prompt.
@item (gud-break)
@findex gud-break
Set a breakpoint on the source line point is on.
@item (gud-cont) - c
@findex gud-cont (c)
Continue execution.
@item (gud-next) - n
@findex gud-next (n)
Step one line, skipping functions. (Step over).
@item (gud-refresh)
@findex gud-refresh
Fix up a possibly garbled display, and redraw the arrow.
@item (gud-remove)
@findex gud-remove
Remove breakpoint at current line.
@item (gud-step) - s
@findex gud-step (s)
Step one statement. (Step into)
@item (gud-step-plus) - +
@findex gud-step-plus (+)
Run @code{step+}---like @code{gud-step} but ensure we go to a new
line.
@item (gud-tbreak @var{arg})
@findex gud-tbreak
Set temporary breakpoint at current line.
@end table