aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChong Yidong2009-12-30 05:39:47 -0500
committerChong Yidong2009-12-30 05:39:47 -0500
commit0df6175ca5efd81a9558fa5034e952caff640cea (patch)
treea8b7fcd2d5dd329ff59e8a378d12032a4e3b8bf5
parentac4a95293677222db75f7daa533f7ab3de51787c (diff)
downloademacs-0df6175ca5efd81a9558fa5034e952caff640cea.tar.gz
emacs-0df6175ca5efd81a9558fa5034e952caff640cea.zip
* doc/emacs/building.texi: Re-apply 2009-12-29T07:15:34Z!nickrob@snap.net.nz, which was
accidentally overwritten in the last change.
-rw-r--r--doc/emacs/building.texi225
1 files changed, 43 insertions, 182 deletions
diff --git a/doc/emacs/building.texi b/doc/emacs/building.texi
index 619e1b0271d..d4209558e62 100644
--- a/doc/emacs/building.texi
+++ b/doc/emacs/building.texi
@@ -857,12 +857,11 @@ multiple programs within one Emacs session.
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.
861* Stack Buffer:: Select a frame from the call stack. 860* Stack Buffer:: Select a frame from the call stack.
862* Other GDB-UI Buffers:: Input/output, locals, registers, 861* Other GDB-UI Buffers:: Input/output, locals, registers,
863 assembler, threads and memory buffers. 862 assembler, threads and memory buffers.
864* Watch Expressions:: Monitor variable values in the speedbar. 863* Watch Expressions:: Monitor variable values in the speedbar.
865* Multithreaded Debugging:: Debugging programs with several threads. 864* Reverse Debugging:: Execute and reverse debug your program.
866@end menu 865@end menu
867 866
868@node GDB-UI Layout 867@node GDB-UI Layout
@@ -887,7 +886,7 @@ displays the following frame layout:
887|--------------------------------+--------------------------------+ 886|--------------------------------+--------------------------------+
888| Primary Source buffer | I/O buffer for debugged pgm | 887| Primary Source buffer | I/O buffer for debugged pgm |
889|--------------------------------+--------------------------------+ 888|--------------------------------+--------------------------------+
890| Stack buffer | Breakpoints/Thread buffer | 889| Stack buffer | Breakpoints/Threads buffer |
891+--------------------------------+--------------------------------+ 890+--------------------------------+--------------------------------+
892@end group 891@end group
893@end smallexample 892@end smallexample
@@ -1015,92 +1014,10 @@ Visit the source line for the current breakpoint
1015Visit the source line for the breakpoint you click on. 1014Visit the source line for the breakpoint you click on.
1016@end table 1015@end table
1017 1016
1018@vindex gdb-show-threads-by-default
1019When @code{gdb-many-windows} is non-@code{nil}, the breakpoints buffer 1017When @code{gdb-many-windows} is non-@code{nil}, the breakpoints buffer
1020shares its window with the threads buffer. To switch from one to the 1018shares its window with the threads buffer. To switch from one to the
1021other click with @kbd{Mouse-1} on the relevant button in the header 1019other click with @kbd{Mouse-1} on the relevant button in the header
1022line, or press @kbd{TAB} inside that buffer. If 1020line.
1023@code{gdb-show-threads-by-default} is non-@code{nil}, the threads
1024buffer, rather than the breakpoints buffer, is shown at start up.
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}).
1104 1021
1105@node Stack Buffer 1022@node Stack Buffer
1106@subsubsection Stack Buffer 1023@subsubsection Stack Buffer
@@ -1137,7 +1054,7 @@ as are the commands to send signals to the debugged program.
1137@item Locals Buffer 1054@item Locals Buffer
1138The locals buffer displays the values of local variables of the 1055The locals buffer displays the values of local variables of the
1139current frame for simple data types (@pxref{Frame Info, Frame Info, 1056current frame for simple data types (@pxref{Frame Info, Frame Info,
1140Information on a frame, gdb, The GNU debugger}). Press @key{RET} or 1057Information on a frame, gdb, The GNU debugger}). Press @key{RET} or
1141click @kbd{Mouse-2} on the value if you want to edit it. 1058click @kbd{Mouse-2} on the value if you want to edit it.
1142 1059
1143Arrays and structures display their type only. With GDB 6.4 or later, 1060Arrays and structures display their type only. With GDB 6.4 or later,
@@ -1156,12 +1073,27 @@ With GDB 6.4 or later, recently changed register values display with
1156press @key{SPC} to toggle the display of floating point registers 1073press @key{SPC} to toggle the display of floating point registers
1157(@code{toggle-gdb-all-registers}). 1074(@code{toggle-gdb-all-registers}).
1158 1075
1159@item Disassembly Buffer 1076@item Assembler Buffer
1160The disassembly buffer displays the current frame as machine code. An 1077The assembler buffer displays the current frame as machine code. An
1161arrow points to the current instruction, and you can set and remove 1078arrow points to the current instruction, and you can set and remove
1162breakpoints as in a source buffer. Breakpoint icons also appear in 1079breakpoints as in a source buffer. Breakpoint icons also appear in
1163the fringe or margin. 1080the fringe or margin.
1164 1081
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
1165@item Memory Buffer 1097@item Memory Buffer
1166The memory buffer lets you examine sections of program memory 1098The memory buffer lets you examine sections of program memory
1167(@pxref{Memory, Memory, Examining memory, gdb, The GNU debugger}). 1099(@pxref{Memory, Memory, Examining memory, gdb, The GNU debugger}).
@@ -1174,9 +1106,8 @@ size for these data items.
1174 1106
1175When @code{gdb-many-windows} is non-@code{nil}, the threads buffer 1107When @code{gdb-many-windows} is non-@code{nil}, the threads buffer
1176shares its window with the breakpoints buffer, and the locals buffer 1108shares its window with the breakpoints buffer, and the locals buffer
1177with the registers buffer. To switch from one to the other click with 1109with the registers buffer. To switch from one to the other click with
1178@kbd{Mouse-1} on the relevant button in the header line or press 1110@kbd{Mouse-1} on the relevant button in the header line.
1179@kbd{TAB} inside the buffer.
1180 1111
1181@node Watch Expressions 1112@node Watch Expressions
1182@subsubsection Watch Expressions 1113@subsubsection Watch Expressions
@@ -1244,96 +1175,26 @@ expressions updates, set @code{gdb-speedbar-auto-raise} to
1244non-@code{nil}. This can be useful if you are debugging with a full 1175non-@code{nil}. This can be useful if you are debugging with a full
1245screen Emacs frame. 1176screen Emacs frame.
1246 1177
1247@node Multithreaded Debugging 1178@node Reverse Debugging
1248@subsubsection Stopping and Starting Multi-threaded Programs 1179@subsubsection Reverse Debugging
1249@cindex Multithreaded debugging in GDB 1180
1250 1181 The GDB tool bar shares many buttons with the other GUD debuggers
1251@subsubheading All-stop Debugging 1182for tasks like stepping and printing expressions. It also has a
1252 1183further set of buttons that allow reverse debugging (@pxref{Process
1253In all-stop mode, whenever your program stops, @emph{all} threads of 1184Record and Replay, , ,gdb, The GNU debugger}). This is useful when it
1254execution stop. Likewise, whenever you restart the program, all 1185takes a long time to reproduce the conditions where your program fails
1255threads start executing. @xref{All-Stop Mode, , All-Stop Mode, gdb, 1186or for transient problems, like race conditions in multi-threaded
1256The GNU debugger}. You can enable this behaviour in Emacs by setting 1187programs, where a failure might otherwise be hard to reproduce.
1257@code{gdb-non-stop-setting} to @code{nil} before starting a debugging 1188
1258session. 1189To use reverse debugging, set a breakpoint slightly before the
1259 1190location of interest and run your program to that point. Enable
1260@subsubheading Non-stop Debugging 1191process recording by clicking on the record button. At this point, a
1261@cindex Non-stop debugging in GDB 1192new set of buttons appear. These buttons allow program execution in
1262 1193the reverse direction. Run your program over the code where the
1263For some multi-threaded targets, GDB supports a further mode of 1194problem occurs, and then use the new set of buttons to retrace your
1264operation in which you can examine stopped program threads in the 1195steps, examine values, and analyze the problem. When analysis is
1265debugger while other threads continue to execute freely. 1196complete, turn off process recording by clicking on the record button
1266@xref{Non-Stop Mode, , Non-Stop Mode, gdb, The GNU debugger}. 1197again.
1267This is referred to as @dfn{non-stop} mode.
1268
1269Versions of GDB prior to 7.0 do not support non-stop mode and it does
1270not work on all targets. In such cases, Emacs uses all-stop mode
1271regardless of the value of @code{gdb-non-stop-setting}.
1272
1273@vindex gdb-non-stop-setting
1274If the variable @code{gdb-non-stop-setting} is non-@code{nil} (the
1275default value), Emacs tries to start GDB in non-stop mode. Note that
1276GDB debugging session needs to be restarted for change of this setting
1277to take effect.
1278
1279@vindex gdb-switch-when-another-stopped
1280When a thread stops in non-stop mode, Emacs automatically switches to
1281that thread. It may be undesirable to allow switching of current
1282thread when some other stopped thread is already selected. Set
1283@code{gdb-switch-when-another-stopped} to @code{nil} to prevent this.
1284
1285@vindex gdb-switch-reasons
1286Emacs can decide whether or not to switch to the stopped thread
1287depending on the reason which caused the stop. Customize
1288@code{gdb-switch-reasons} to select stop reasons which make Emacs
1289switch thread.
1290
1291@vindex gdb-stopped-hooks
1292The variable @code{gdb-stopped-hooks} allows you to execute your
1293functions whenever some thread stops.
1294
1295 In non-stop mode, you can switch between different modes for GUD
1296execution control commands.
1297
1298@vindex gdb-gud-control-all-threads
1299@table @dfn
1300@item Non-stop/A
1301
1302When @code{gdb-gud-control-all-threads} is @code{t} (the default
1303value), interruption and continuation commands apply to all threads,
1304so you can halt or continue all your threads with one command using
1305@code{gud-stop-subjob} and @code{gud-cont}, respectively. The
1306@samp{Go} button is shown on the toolbar when at least one thread is
1307stopped, whereas @samp{Stop} button is shown when at least one thread
1308is running.
1309
1310@item Non-stop/T
1311
1312When @code{gdb-gud-control-all-threads} is @code{nil}, only the
1313current thread is stopped/continued. @samp{Go} and @samp{Stop}
1314buttons on the GUD toolbar are shown depending on the state of current
1315thread.
1316@end table
1317
1318You can change the current value of @code{gdb-gud-control-all-threads}
1319from the tool bar or from @samp{GUD->GDB-MI} menu.
1320
1321 Stepping commands always apply to the current thread.
1322
1323@subsubheading Fine Thread Control
1324
1325 In non-stop mode, you can interrupt/continue your threads without
1326selecting them. Hitting @kbd{i} in threads buffer interrupts thread
1327under point, @kbd{c} continues it, @kbd{s} steps through. More such
1328commands may be added in the future.
1329
1330Combined with creating bound buffers for any thread, this allows you
1331to change and track state of many threads in the same time.
1332
1333 Note that when you interrupt a thread, it stops with @samp{signal
1334received} reason. If that reason is included in your
1335@code{gdb-switch-reasons} (it is by default), Emacs will switch to
1336that thread.
1337 1198
1338@node Executing Lisp 1199@node Executing Lisp
1339@section Executing Lisp Expressions 1200@section Executing Lisp Expressions