aboutsummaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorNick Roberts2010-03-28 02:27:43 +1300
committerNick Roberts2010-03-28 02:27:43 +1300
commit691cf4a0a2e4805dbfad20644a9748bf3597024a (patch)
tree3d98fd36bd4d24a03b216900676410cdd7b15df8 /doc
parent31f191b3a2d314c41a1e48b51615fdfe3fe20260 (diff)
downloademacs-691cf4a0a2e4805dbfad20644a9748bf3597024a.tar.gz
emacs-691cf4a0a2e4805dbfad20644a9748bf3597024a.zip
Restore GDB/MI fuctionality removed by 2009-12-29T07:15:34Z!nickrob@snap.net.nz:
added: lisp/progmodes/gdb-mi.el removed: lisp/progmodes/gdb-ui.el modified: doc/emacs/building.texi doc/emacs/emacs.texi etc/NEWS lisp/Makefile.in lisp/progmodes/gud.el
Diffstat (limited to 'doc')
-rw-r--r--doc/emacs/building.texi226
-rw-r--r--doc/emacs/emacs.texi18
2 files changed, 192 insertions, 52 deletions
diff --git a/doc/emacs/building.texi b/doc/emacs/building.texi
index 6dbd5abf026..8637641f9e1 100644
--- a/doc/emacs/building.texi
+++ b/doc/emacs/building.texi
@@ -853,18 +853,19 @@ use @kbd{M-x gud-gdb}. You need to use text command mode to debug
853multiple programs within one Emacs session. 853multiple programs within one Emacs session.
854 854
855@menu 855@menu
856* GDB-UI Layout:: Control the number of displayed buffers. 856* GDB User Interface Layout:: Control the number of displayed buffers.
857* Source Buffers:: Use the mouse in the fringe/margin to 857* Source Buffers:: Use the mouse in the fringe/margin to
858 control your program. 858 control your program.
859* Breakpoints Buffer:: A breakpoint control panel. 859* Breakpoints Buffer:: A breakpoint control panel.
860* Threads Buffer:: Displays your threads.
860* Stack Buffer:: Select a frame from the call stack. 861* Stack Buffer:: Select a frame from the call stack.
861* Other GDB-UI Buffers:: Input/output, locals, registers, 862* Other GDB Buffers:: Input/output, locals, registers,
862 assembler, threads and memory buffers. 863 assembler, threads and memory buffers.
863* Watch Expressions:: Monitor variable values in the speedbar. 864* Watch Expressions:: Monitor variable values in the speedbar.
864* Reverse Debugging:: Execute and reverse debug your program. 865* Multithreaded Debugging:: Debugging programs with several threads.
865@end menu 866@end menu
866 867
867@node GDB-UI Layout 868@node GDB User Interface Layout
868@subsubsection GDB User Interface Layout 869@subsubsection GDB User Interface Layout
869@cindex GDB User Interface layout 870@cindex GDB User Interface layout
870 871
@@ -1014,10 +1015,92 @@ Visit the source line for the current breakpoint
1014Visit the source line for the breakpoint you click on. 1015Visit the source line for the breakpoint you click on.
1015@end table 1016@end table
1016 1017
1018@vindex gdb-show-threads-by-default
1017When @code{gdb-many-windows} is non-@code{nil}, the breakpoints buffer 1019When @code{gdb-many-windows} is non-@code{nil}, the breakpoints buffer
1018shares its window with the threads buffer. To switch from one to the 1020shares its window with the threads buffer. To switch from one to the
1019other click with @kbd{Mouse-1} on the relevant button in the header 1021other click with @kbd{Mouse-1} on the relevant button in the header
1020line. 1022line. If @code{gdb-show-threads-by-default} is non-@code{nil}, the
1023threads buffer, rather than the breakpoints buffer, is shown at start
1024up.
1025
1026@node Threads Buffer
1027@subsubsection Threads Buffer
1028
1029@findex gdb-select-thread
1030The threads buffer displays a summary of all threads currently in your
1031program (@pxref{Threads, Threads, Debugging programs with multiple
1032threads, gdb, The GNU debugger}). Move point to any thread in the list
1033and press @key{RET} to select it (@code{gdb-select-thread}) and
1034display the associated source in the primary source buffer.
1035Alternatively, click @kbd{Mouse-2} on a thread to select it. Contents
1036of all GDB buffers are updated whenever you select a thread.
1037
1038 You can customize variables under @code{gdb-buffers} group to select
1039fields included in threads buffer.
1040
1041@table @code
1042@item gdb-thread-buffer-verbose-names
1043@vindex gdb-thread-buffer-verbose-names
1044Show long thread names like @samp{Thread 0x4e2ab70 (LWP 1983)} in
1045threads buffer.
1046
1047@item gdb-thread-buffer-arguments
1048@vindex gdb-thread-buffer-arguments
1049Show arguments of thread top frames in threads buffer.
1050
1051@item gdb-thread-buffer-locations
1052@vindex gdb-thread-buffer-locations
1053Show file information or library names in threads buffer.
1054
1055@item gdb-thread-buffer-addresses
1056@vindex gdb-thread-buffer-addresses
1057Show addresses for thread frames in threads buffer.
1058@end table
1059
1060 It’s possible to observe information for several threads
1061simultaneously (in addition to buffers which show information for
1062currently selected thread) using the following keys from the threads
1063buffer.
1064
1065@table @kbd
1066@item d
1067@kindex d @r{(GDB threads buffer)}
1068@findex gdb-display-disassembly-for-thread
1069Display disassembly buffer for the thread at current line.
1070(@code{gdb-display-disassembly-for-thread})
1071
1072@item f
1073@kindex f @r{(GDB threads buffer)}
1074@findex gdb-display-stack-for-thread
1075Display stack buffer for the thread at current line.
1076(@code{gdb-display-stack-for-thread}).
1077
1078@item l
1079@kindex l @r{(GDB threads buffer)}
1080@findex gdb-display-locals-for-thread
1081Display locals buffer for the thread at current line.
1082(@code{gdb-display-locals-for-thread}).
1083
1084@item r
1085@kindex r @r{(GDB threads buffer)}
1086@findex gdb-display-registers-for-thread
1087Display registers buffer for the thread at current line.
1088(@code{gdb-display-registers-for-thread}).
1089@end table
1090
1091Pressing their upper-case counterparts, @kbd{D}, @kbd{F} ,@kbd{L} and
1092@kbd{R} displays the corresponding buffer in a new frame.
1093
1094 When you create a buffer showing information about some specific
1095thread, it becomes bound to that thread and keeps showing actual
1096information while you debug your program. Every GDB buffer contains a
1097number of thread it shows information for in its mode name. Thread
1098number is also included in the buffer name of bound buffers to prevent
1099buffer names clashing.
1100
1101Further commands are available in the threads buffer which depend on the
1102mode of GDB that is used for controlling execution of your program.
1103(@pxref{Multithreaded Debugging, Stopping and Starting Multi-threaded Programs}).
1021 1104
1022@node Stack Buffer 1105@node Stack Buffer
1023@subsubsection Stack Buffer 1106@subsubsection Stack Buffer
@@ -1035,7 +1118,7 @@ that stack frame and type @key{RET} (@code{gdb-frames-select}), or click
1035selecting a stack frame updates it to display the local variables of the 1118selecting a stack frame updates it to display the local variables of the
1036new frame. 1119new frame.
1037 1120
1038@node Other GDB-UI Buffers 1121@node Other GDB Buffers
1039@subsubsection Other Buffers 1122@subsubsection Other Buffers
1040 1123
1041@table @asis 1124@table @asis
@@ -1079,21 +1162,6 @@ arrow points to the current instruction, and you can set and remove
1079breakpoints as in a source buffer. Breakpoint icons also appear in 1162breakpoints as in a source buffer. Breakpoint icons also appear in
1080the fringe or margin. 1163the fringe or margin.
1081 1164
1082@item Threads Buffer
1083@findex gdb-threads-select
1084The threads buffer displays a summary of all threads currently in your
1085program (@pxref{Threads, Threads, Debugging programs with multiple
1086threads, gdb, The GNU debugger}). Move point to any thread in the
1087list and press @key{RET} to select it (@code{gdb-threads-select}) and
1088display the associated source in the primary source buffer.
1089Alternatively, click @kbd{Mouse-2} on a thread to select it. If the
1090locals buffer is visible, its contents update to display the variables
1091that are local in the new thread.
1092
1093When there is more than one main thread and the threads buffer is
1094present, Emacs displays the selected thread number in the mode line of
1095many of the GDB-UI Buffers.
1096
1097@item Memory Buffer 1165@item Memory Buffer
1098The memory buffer lets you examine sections of program memory 1166The memory buffer lets you examine sections of program memory
1099(@pxref{Memory, Memory, Examining memory, gdb, The GNU debugger}). 1167(@pxref{Memory, Memory, Examining memory, gdb, The GNU debugger}).
@@ -1104,9 +1172,9 @@ displays. Alternatively, use @kbd{S} or @kbd{N} respectively. Click
1104size for these data items. 1172size for these data items.
1105@end table 1173@end table
1106 1174
1107When @code{gdb-many-windows} is non-@code{nil}, the threads buffer 1175When @code{gdb-many-windows} is non-@code{nil}, the locals buffer
1108shares its window with the breakpoints buffer, and the locals buffer 1176shares its window with the registers buffer, just like breakpoints
1109with the registers buffer. To switch from one to the other click with 1177and threads buffers. To switch from one to the other click with
1110@kbd{Mouse-1} on the relevant button in the header line. 1178@kbd{Mouse-1} on the relevant button in the header line.
1111 1179
1112@node Watch Expressions 1180@node Watch Expressions
@@ -1175,26 +1243,96 @@ expressions updates, set @code{gdb-speedbar-auto-raise} to
1175non-@code{nil}. This can be useful if you are debugging with a full 1243non-@code{nil}. This can be useful if you are debugging with a full
1176screen Emacs frame. 1244screen Emacs frame.
1177 1245
1178@node Reverse Debugging 1246@node Multithreaded Debugging
1179@subsubsection Reverse Debugging 1247@subsubsection Stopping and Starting Multi-threaded Programs
1180 1248@cindex Multithreaded debugging in GDB
1181 The GDB tool bar shares many buttons with the other GUD debuggers 1249
1182for tasks like stepping and printing expressions. It also has a 1250@subsubheading All-stop Debugging
1183further set of buttons that allow reverse debugging (@pxref{Process 1251
1184Record and Replay, , ,gdb, The GNU debugger}). This is useful when it 1252In all-stop mode, whenever your program stops, @emph{all} threads of
1185takes a long time to reproduce the conditions where your program fails 1253execution stop. Likewise, whenever you restart the program, all
1186or for transient problems, like race conditions in multi-threaded 1254threads start executing. @xref{All-Stop Mode, , All-Stop Mode, gdb,
1187programs, where a failure might otherwise be hard to reproduce. 1255The GNU debugger}. You can enable this behaviour in Emacs by setting
1188 1256@code{gdb-non-stop-setting} to @code{nil} before starting a debugging
1189To use reverse debugging, set a breakpoint slightly before the 1257session.
1190location of interest and run your program to that point. Enable 1258
1191process recording by clicking on the record button. At this point, a 1259@subsubheading Non-stop Debugging
1192new set of buttons appear. These buttons allow program execution in 1260@cindex Non-stop debugging in GDB
1193the reverse direction. Run your program over the code where the 1261
1194problem occurs, and then use the new set of buttons to retrace your 1262For some multi-threaded targets, GDB supports a further mode of
1195steps, examine values, and analyze the problem. When analysis is 1263operation in which you can examine stopped program threads in the
1196complete, turn off process recording by clicking on the record button 1264debugger while other threads continue to execute freely.
1197again. 1265@xref{Non-Stop Mode, , Non-Stop Mode, gdb, The GNU debugger}.
1266This is referred to as @dfn{non-stop} mode.
1267
1268Versions of GDB prior to 7.0 do not support non-stop mode and it does
1269not work on all targets. In such cases, Emacs uses all-stop mode
1270regardless of the value of @code{gdb-non-stop-setting}.
1271
1272@vindex gdb-non-stop-setting
1273If the variable @code{gdb-non-stop-setting} is non-@code{nil} (the
1274default value), Emacs tries to start GDB in non-stop mode. Note that
1275GDB debugging session needs to be restarted for change of this setting
1276to take effect.
1277
1278@vindex gdb-switch-when-another-stopped
1279When a thread stops in non-stop mode, Emacs automatically switches to
1280that thread. It may be undesirable to allow switching of current
1281thread when some other stopped thread is already selected. Set
1282@code{gdb-switch-when-another-stopped} to @code{nil} to prevent this.
1283
1284@vindex gdb-switch-reasons
1285Emacs can decide whether or not to switch to the stopped thread
1286depending on the reason which caused the stop. Customize
1287@code{gdb-switch-reasons} to select stop reasons which make Emacs
1288switch thread.
1289
1290@vindex gdb-stopped-hooks
1291The variable @code{gdb-stopped-hooks} allows you to execute your
1292functions whenever some thread stops.
1293
1294 In non-stop mode, you can switch between different modes for GUD
1295execution control commands.
1296
1297@vindex gdb-gud-control-all-threads
1298@table @dfn
1299@item Non-stop/A
1300
1301When @code{gdb-gud-control-all-threads} is @code{t} (the default
1302value), interruption and continuation commands apply to all threads,
1303so you can halt or continue all your threads with one command using
1304@code{gud-stop-subjob} and @code{gud-cont}, respectively. The
1305@samp{Go} button is shown on the toolbar when at least one thread is
1306stopped, whereas @samp{Stop} button is shown when at least one thread
1307is running.
1308
1309@item Non-stop/T
1310
1311When @code{gdb-gud-control-all-threads} is @code{nil}, only the
1312current thread is stopped/continued. @samp{Go} and @samp{Stop}
1313buttons on the GUD toolbar are shown depending on the state of current
1314thread.
1315@end table
1316
1317You can change the current value of @code{gdb-gud-control-all-threads}
1318from the tool bar or from @samp{GUD->GDB-MI} menu.
1319
1320 Stepping commands always apply to the current thread.
1321
1322@subsubheading Fine Thread Control
1323
1324 In non-stop mode, you can interrupt/continue your threads without
1325selecting them. Hitting @kbd{i} in threads buffer interrupts thread
1326under point, @kbd{c} continues it, @kbd{s} steps through. More such
1327commands may be added in the future.
1328
1329Combined with creating bound buffers for any thread, this allows you
1330to change and track state of many threads in the same time.
1331
1332 Note that when you interrupt a thread, it stops with @samp{signal
1333received} reason. If that reason is included in your
1334@code{gdb-switch-reasons} (it is by default), Emacs will switch to
1335that thread.
1198 1336
1199@node Executing Lisp 1337@node Executing Lisp
1200@section Executing Lisp Expressions 1338@section Executing Lisp Expressions
diff --git a/doc/emacs/emacs.texi b/doc/emacs/emacs.texi
index 7e8c2052d94..b77863e366b 100644
--- a/doc/emacs/emacs.texi
+++ b/doc/emacs/emacs.texi
@@ -746,14 +746,16 @@ Running Debuggers Under Emacs
746 746
747GDB Graphical Interface 747GDB Graphical Interface
748 748
749* GDB-UI Layout:: Control the number of displayed buffers. 749* GDB-UI Layout:: Control the number of displayed buffers.
750* Source Buffers:: Use the mouse in the fringe/margin to 750* Source Buffers:: Use the mouse in the fringe/margin to
751 control your program. 751 control your program.
752* Breakpoints Buffer:: A breakpoint control panel. 752* Breakpoints Buffer:: A breakpoint control panel.
753* Stack Buffer:: Select a frame from the call stack. 753* Threads Buffer:: Displays your threads.
754* Other GDB-UI Buffers::Input/output, locals, registers, 754* Stack Buffer:: Select a frame from the call stack.
755 assembler, threads and memory buffers. 755* Other GDB-UI Buffers:: Input/output, locals, registers,
756* Watch Expressions:: Monitor variable values in the speedbar. 756 assembler, threads and memory buffers.
757* Watch Expressions:: Monitor variable values in the speedbar.
758* Multithreaded Debugging:: Debugging programs with several threads.
757 759
758Maintaining Large Programs 760Maintaining Large Programs
759 761