diff options
| author | Chong Yidong | 2009-12-30 05:39:47 -0500 |
|---|---|---|
| committer | Chong Yidong | 2009-12-30 05:39:47 -0500 |
| commit | 0df6175ca5efd81a9558fa5034e952caff640cea (patch) | |
| tree | a8b7fcd2d5dd329ff59e8a378d12032a4e3b8bf5 | |
| parent | ac4a95293677222db75f7daa533f7ab3de51787c (diff) | |
| download | emacs-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.texi | 225 |
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 | |||
| 1015 | Visit the source line for the breakpoint you click on. | 1014 | Visit the source line for the breakpoint you click on. |
| 1016 | @end table | 1015 | @end table |
| 1017 | 1016 | ||
| 1018 | @vindex gdb-show-threads-by-default | ||
| 1019 | When @code{gdb-many-windows} is non-@code{nil}, the breakpoints buffer | 1017 | When @code{gdb-many-windows} is non-@code{nil}, the breakpoints buffer |
| 1020 | shares its window with the threads buffer. To switch from one to the | 1018 | shares its window with the threads buffer. To switch from one to the |
| 1021 | other click with @kbd{Mouse-1} on the relevant button in the header | 1019 | other click with @kbd{Mouse-1} on the relevant button in the header |
| 1022 | line, or press @kbd{TAB} inside that buffer. If | 1020 | line. |
| 1023 | @code{gdb-show-threads-by-default} is non-@code{nil}, the threads | ||
| 1024 | buffer, 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 | ||
| 1030 | The threads buffer displays a summary of all threads currently in your | ||
| 1031 | program (@pxref{Threads, Threads, Debugging programs with multiple | ||
| 1032 | threads, gdb, The GNU debugger}). Move point to any thread in the list | ||
| 1033 | and press @key{RET} to select it (@code{gdb-select-thread}) and | ||
| 1034 | display the associated source in the primary source buffer. | ||
| 1035 | Alternatively, click @kbd{Mouse-2} on a thread to select it. Contents | ||
| 1036 | of all GDB buffers are updated whenever you select a thread. | ||
| 1037 | |||
| 1038 | You can customize variables under @code{gdb-buffers} group to select | ||
| 1039 | fields included in threads buffer. | ||
| 1040 | |||
| 1041 | @table @code | ||
| 1042 | @item gdb-thread-buffer-verbose-names | ||
| 1043 | @vindex gdb-thread-buffer-verbose-names | ||
| 1044 | Show long thread names like @samp{Thread 0x4e2ab70 (LWP 1983)} in | ||
| 1045 | threads buffer. | ||
| 1046 | |||
| 1047 | @item gdb-thread-buffer-arguments | ||
| 1048 | @vindex gdb-thread-buffer-arguments | ||
| 1049 | Show arguments of thread top frames in threads buffer. | ||
| 1050 | |||
| 1051 | @item gdb-thread-buffer-locations | ||
| 1052 | @vindex gdb-thread-buffer-locations | ||
| 1053 | Show file information or library names in threads buffer. | ||
| 1054 | |||
| 1055 | @item gdb-thread-buffer-addresses | ||
| 1056 | @vindex gdb-thread-buffer-addresses | ||
| 1057 | Show addresses for thread frames in threads buffer. | ||
| 1058 | @end table | ||
| 1059 | |||
| 1060 | It’s possible to observe information for several threads | ||
| 1061 | simultaneously (in addition to buffers which show information for | ||
| 1062 | currently selected thread) using the following keys from the threads | ||
| 1063 | buffer. | ||
| 1064 | |||
| 1065 | @table @kbd | ||
| 1066 | @item d | ||
| 1067 | @kindex d @r{(GDB threads buffer)} | ||
| 1068 | @findex gdb-display-disassembly-for-thread | ||
| 1069 | Display 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 | ||
| 1075 | Display 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 | ||
| 1081 | Display 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 | ||
| 1087 | Display registers buffer for the thread at current line. | ||
| 1088 | (@code{gdb-display-registers-for-thread}). | ||
| 1089 | @end table | ||
| 1090 | |||
| 1091 | Pressing 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 | ||
| 1095 | thread, it becomes bound to that thread and keeps showing actual | ||
| 1096 | information while you debug your program. Every GDB buffer contains a | ||
| 1097 | number of thread it shows information for in its mode name. Thread | ||
| 1098 | number is also included in the buffer name of bound buffers to prevent | ||
| 1099 | buffer names clashing. | ||
| 1100 | |||
| 1101 | Further commands are available in the threads buffer which depend on the | ||
| 1102 | mode 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 |
| 1138 | The locals buffer displays the values of local variables of the | 1055 | The locals buffer displays the values of local variables of the |
| 1139 | current frame for simple data types (@pxref{Frame Info, Frame Info, | 1056 | current frame for simple data types (@pxref{Frame Info, Frame Info, |
| 1140 | Information on a frame, gdb, The GNU debugger}). Press @key{RET} or | 1057 | Information on a frame, gdb, The GNU debugger}). Press @key{RET} or |
| 1141 | click @kbd{Mouse-2} on the value if you want to edit it. | 1058 | click @kbd{Mouse-2} on the value if you want to edit it. |
| 1142 | 1059 | ||
| 1143 | Arrays and structures display their type only. With GDB 6.4 or later, | 1060 | Arrays 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 | |||
| 1156 | press @key{SPC} to toggle the display of floating point registers | 1073 | press @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 |
| 1160 | The disassembly buffer displays the current frame as machine code. An | 1077 | The assembler buffer displays the current frame as machine code. An |
| 1161 | arrow points to the current instruction, and you can set and remove | 1078 | arrow points to the current instruction, and you can set and remove |
| 1162 | breakpoints as in a source buffer. Breakpoint icons also appear in | 1079 | breakpoints as in a source buffer. Breakpoint icons also appear in |
| 1163 | the fringe or margin. | 1080 | the fringe or margin. |
| 1164 | 1081 | ||
| 1082 | @item Threads Buffer | ||
| 1083 | @findex gdb-threads-select | ||
| 1084 | The threads buffer displays a summary of all threads currently in your | ||
| 1085 | program (@pxref{Threads, Threads, Debugging programs with multiple | ||
| 1086 | threads, gdb, The GNU debugger}). Move point to any thread in the | ||
| 1087 | list and press @key{RET} to select it (@code{gdb-threads-select}) and | ||
| 1088 | display the associated source in the primary source buffer. | ||
| 1089 | Alternatively, click @kbd{Mouse-2} on a thread to select it. If the | ||
| 1090 | locals buffer is visible, its contents update to display the variables | ||
| 1091 | that are local in the new thread. | ||
| 1092 | |||
| 1093 | When there is more than one main thread and the threads buffer is | ||
| 1094 | present, Emacs displays the selected thread number in the mode line of | ||
| 1095 | many of the GDB-UI Buffers. | ||
| 1096 | |||
| 1165 | @item Memory Buffer | 1097 | @item Memory Buffer |
| 1166 | The memory buffer lets you examine sections of program memory | 1098 | The 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 | ||
| 1175 | When @code{gdb-many-windows} is non-@code{nil}, the threads buffer | 1107 | When @code{gdb-many-windows} is non-@code{nil}, the threads buffer |
| 1176 | shares its window with the breakpoints buffer, and the locals buffer | 1108 | shares its window with the breakpoints buffer, and the locals buffer |
| 1177 | with the registers buffer. To switch from one to the other click with | 1109 | with 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 | |||
| 1244 | non-@code{nil}. This can be useful if you are debugging with a full | 1175 | non-@code{nil}. This can be useful if you are debugging with a full |
| 1245 | screen Emacs frame. | 1176 | screen 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 | 1182 | for tasks like stepping and printing expressions. It also has a |
| 1252 | 1183 | further set of buttons that allow reverse debugging (@pxref{Process | |
| 1253 | In all-stop mode, whenever your program stops, @emph{all} threads of | 1184 | Record and Replay, , ,gdb, The GNU debugger}). This is useful when it |
| 1254 | execution stop. Likewise, whenever you restart the program, all | 1185 | takes a long time to reproduce the conditions where your program fails |
| 1255 | threads start executing. @xref{All-Stop Mode, , All-Stop Mode, gdb, | 1186 | or for transient problems, like race conditions in multi-threaded |
| 1256 | The GNU debugger}. You can enable this behaviour in Emacs by setting | 1187 | programs, where a failure might otherwise be hard to reproduce. |
| 1257 | @code{gdb-non-stop-setting} to @code{nil} before starting a debugging | 1188 | |
| 1258 | session. | 1189 | To use reverse debugging, set a breakpoint slightly before the |
| 1259 | 1190 | location of interest and run your program to that point. Enable | |
| 1260 | @subsubheading Non-stop Debugging | 1191 | process recording by clicking on the record button. At this point, a |
| 1261 | @cindex Non-stop debugging in GDB | 1192 | new set of buttons appear. These buttons allow program execution in |
| 1262 | 1193 | the reverse direction. Run your program over the code where the | |
| 1263 | For some multi-threaded targets, GDB supports a further mode of | 1194 | problem occurs, and then use the new set of buttons to retrace your |
| 1264 | operation in which you can examine stopped program threads in the | 1195 | steps, examine values, and analyze the problem. When analysis is |
| 1265 | debugger while other threads continue to execute freely. | 1196 | complete, turn off process recording by clicking on the record button |
| 1266 | @xref{Non-Stop Mode, , Non-Stop Mode, gdb, The GNU debugger}. | 1197 | again. |
| 1267 | This is referred to as @dfn{non-stop} mode. | ||
| 1268 | |||
| 1269 | Versions of GDB prior to 7.0 do not support non-stop mode and it does | ||
| 1270 | not work on all targets. In such cases, Emacs uses all-stop mode | ||
| 1271 | regardless of the value of @code{gdb-non-stop-setting}. | ||
| 1272 | |||
| 1273 | @vindex gdb-non-stop-setting | ||
| 1274 | If the variable @code{gdb-non-stop-setting} is non-@code{nil} (the | ||
| 1275 | default value), Emacs tries to start GDB in non-stop mode. Note that | ||
| 1276 | GDB debugging session needs to be restarted for change of this setting | ||
| 1277 | to take effect. | ||
| 1278 | |||
| 1279 | @vindex gdb-switch-when-another-stopped | ||
| 1280 | When a thread stops in non-stop mode, Emacs automatically switches to | ||
| 1281 | that thread. It may be undesirable to allow switching of current | ||
| 1282 | thread 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 | ||
| 1286 | Emacs can decide whether or not to switch to the stopped thread | ||
| 1287 | depending on the reason which caused the stop. Customize | ||
| 1288 | @code{gdb-switch-reasons} to select stop reasons which make Emacs | ||
| 1289 | switch thread. | ||
| 1290 | |||
| 1291 | @vindex gdb-stopped-hooks | ||
| 1292 | The variable @code{gdb-stopped-hooks} allows you to execute your | ||
| 1293 | functions whenever some thread stops. | ||
| 1294 | |||
| 1295 | In non-stop mode, you can switch between different modes for GUD | ||
| 1296 | execution control commands. | ||
| 1297 | |||
| 1298 | @vindex gdb-gud-control-all-threads | ||
| 1299 | @table @dfn | ||
| 1300 | @item Non-stop/A | ||
| 1301 | |||
| 1302 | When @code{gdb-gud-control-all-threads} is @code{t} (the default | ||
| 1303 | value), interruption and continuation commands apply to all threads, | ||
| 1304 | so 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 | ||
| 1307 | stopped, whereas @samp{Stop} button is shown when at least one thread | ||
| 1308 | is running. | ||
| 1309 | |||
| 1310 | @item Non-stop/T | ||
| 1311 | |||
| 1312 | When @code{gdb-gud-control-all-threads} is @code{nil}, only the | ||
| 1313 | current thread is stopped/continued. @samp{Go} and @samp{Stop} | ||
| 1314 | buttons on the GUD toolbar are shown depending on the state of current | ||
| 1315 | thread. | ||
| 1316 | @end table | ||
| 1317 | |||
| 1318 | You can change the current value of @code{gdb-gud-control-all-threads} | ||
| 1319 | from 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 | ||
| 1326 | selecting them. Hitting @kbd{i} in threads buffer interrupts thread | ||
| 1327 | under point, @kbd{c} continues it, @kbd{s} steps through. More such | ||
| 1328 | commands may be added in the future. | ||
| 1329 | |||
| 1330 | Combined with creating bound buffers for any thread, this allows you | ||
| 1331 | to 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 | ||
| 1334 | received} reason. If that reason is included in your | ||
| 1335 | @code{gdb-switch-reasons} (it is by default), Emacs will switch to | ||
| 1336 | that thread. | ||
| 1337 | 1198 | ||
| 1338 | @node Executing Lisp | 1199 | @node Executing Lisp |
| 1339 | @section Executing Lisp Expressions | 1200 | @section Executing Lisp Expressions |