diff options
| author | Nick Roberts | 2009-12-29 20:15:34 +1300 |
|---|---|---|
| committer | Nick Roberts | 2009-12-29 20:15:34 +1300 |
| commit | 49f073bd8a61b525da3fbc35981abdaa7fc24182 (patch) | |
| tree | c4dc7de6c4a412d118c1ed10ad4ac589856bfd5f /doc | |
| parent | 460f6e7ced30ef7dbbf05284f0ca28f94e613c71 (diff) | |
| download | emacs-49f073bd8a61b525da3fbc35981abdaa7fc24182.tar.gz emacs-49f073bd8a61b525da3fbc35981abdaa7fc24182.zip | |
This changeset reverts GDB Graphical Interface to use annotations. It incorporates features added
(and never released) on the EMACS_23_1_RC branch. Namely reverse debugging and the display of STL
collections as watch expressions.
The long term aim is to move to GDB/MI, so these changes will be re-instated at some time in the future.
At the moment, however, there are issues with gdb-mi.el that have not yet
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/emacs/building.texi | 225 | ||||
| -rw-r--r-- | doc/emacs/emacs.texi | 18 |
2 files changed, 51 insertions, 192 deletions
diff --git a/doc/emacs/building.texi b/doc/emacs/building.texi index a5ce5f20c7b..343eb646a83 100644 --- a/doc/emacs/building.texi +++ b/doc/emacs/building.texi | |||
| @@ -854,12 +854,11 @@ multiple programs within one Emacs session. | |||
| 854 | * Source Buffers:: Use the mouse in the fringe/margin to | 854 | * Source Buffers:: Use the mouse in the fringe/margin to |
| 855 | control your program. | 855 | control your program. |
| 856 | * Breakpoints Buffer:: A breakpoint control panel. | 856 | * Breakpoints Buffer:: A breakpoint control panel. |
| 857 | * Threads Buffer:: Displays your threads. | ||
| 858 | * Stack Buffer:: Select a frame from the call stack. | 857 | * Stack Buffer:: Select a frame from the call stack. |
| 859 | * Other GDB-UI Buffers:: Input/output, locals, registers, | 858 | * Other GDB-UI Buffers:: Input/output, locals, registers, |
| 860 | assembler, threads and memory buffers. | 859 | assembler, threads and memory buffers. |
| 861 | * Watch Expressions:: Monitor variable values in the speedbar. | 860 | * Watch Expressions:: Monitor variable values in the speedbar. |
| 862 | * Multithreaded Debugging:: Debugging programs with several threads. | 861 | * Reverse Debugging:: Execute and reverse debug your program. |
| 863 | @end menu | 862 | @end menu |
| 864 | 863 | ||
| 865 | @node GDB-UI Layout | 864 | @node GDB-UI Layout |
| @@ -884,7 +883,7 @@ displays the following frame layout: | |||
| 884 | |--------------------------------+--------------------------------+ | 883 | |--------------------------------+--------------------------------+ |
| 885 | | Primary Source buffer | I/O buffer for debugged pgm | | 884 | | Primary Source buffer | I/O buffer for debugged pgm | |
| 886 | |--------------------------------+--------------------------------+ | 885 | |--------------------------------+--------------------------------+ |
| 887 | | Stack buffer | Breakpoints/Thread buffer | | 886 | | Stack buffer | Breakpoints/Threads buffer | |
| 888 | +--------------------------------+--------------------------------+ | 887 | +--------------------------------+--------------------------------+ |
| 889 | @end group | 888 | @end group |
| 890 | @end smallexample | 889 | @end smallexample |
| @@ -1012,92 +1011,10 @@ Visit the source line for the current breakpoint | |||
| 1012 | Visit the source line for the breakpoint you click on. | 1011 | Visit the source line for the breakpoint you click on. |
| 1013 | @end table | 1012 | @end table |
| 1014 | 1013 | ||
| 1015 | @vindex gdb-show-threads-by-default | ||
| 1016 | When @code{gdb-many-windows} is non-@code{nil}, the breakpoints buffer | 1014 | When @code{gdb-many-windows} is non-@code{nil}, the breakpoints buffer |
| 1017 | shares its window with the threads buffer. To switch from one to the | 1015 | shares its window with the threads buffer. To switch from one to the |
| 1018 | other click with @kbd{Mouse-1} on the relevant button in the header | 1016 | other click with @kbd{Mouse-1} on the relevant button in the header |
| 1019 | line, or press @kbd{TAB} inside that buffer. If | 1017 | line. |
| 1020 | @code{gdb-show-threads-by-default} is non-@code{nil}, the threads | ||
| 1021 | buffer, rather than the breakpoints buffer, is shown at start up. | ||
| 1022 | |||
| 1023 | @node Threads Buffer | ||
| 1024 | @subsubsection Threads Buffer | ||
| 1025 | |||
| 1026 | @findex gdb-select-thread | ||
| 1027 | The threads buffer displays a summary of all threads currently in your | ||
| 1028 | program (@pxref{Threads, Threads, Debugging programs with multiple | ||
| 1029 | threads, gdb, The GNU debugger}). Move point to any thread in the list | ||
| 1030 | and press @key{RET} to select it (@code{gdb-select-thread}) and | ||
| 1031 | display the associated source in the primary source buffer. | ||
| 1032 | Alternatively, click @kbd{Mouse-2} on a thread to select it. Contents | ||
| 1033 | of all GDB buffers are updated whenever you select a thread. | ||
| 1034 | |||
| 1035 | You can customize variables under @code{gdb-buffers} group to select | ||
| 1036 | fields included in threads buffer. | ||
| 1037 | |||
| 1038 | @table @code | ||
| 1039 | @item gdb-thread-buffer-verbose-names | ||
| 1040 | @vindex gdb-thread-buffer-verbose-names | ||
| 1041 | Show long thread names like @samp{Thread 0x4e2ab70 (LWP 1983)} in | ||
| 1042 | threads buffer. | ||
| 1043 | |||
| 1044 | @item gdb-thread-buffer-arguments | ||
| 1045 | @vindex gdb-thread-buffer-arguments | ||
| 1046 | Show arguments of thread top frames in threads buffer. | ||
| 1047 | |||
| 1048 | @item gdb-thread-buffer-locations | ||
| 1049 | @vindex gdb-thread-buffer-locations | ||
| 1050 | Show file information or library names in threads buffer. | ||
| 1051 | |||
| 1052 | @item gdb-thread-buffer-addresses | ||
| 1053 | @vindex gdb-thread-buffer-addresses | ||
| 1054 | Show addresses for thread frames in threads buffer. | ||
| 1055 | @end table | ||
| 1056 | |||
| 1057 | It’s possible to observe information for several threads | ||
| 1058 | simultaneously (in addition to buffers which show information for | ||
| 1059 | currently selected thread) using the following keys from the threads | ||
| 1060 | buffer. | ||
| 1061 | |||
| 1062 | @table @kbd | ||
| 1063 | @item d | ||
| 1064 | @kindex d @r{(GDB threads buffer)} | ||
| 1065 | @findex gdb-display-disassembly-for-thread | ||
| 1066 | Display disassembly buffer for the thread at current line. | ||
| 1067 | (@code{gdb-display-disassembly-for-thread}) | ||
| 1068 | |||
| 1069 | @item f | ||
| 1070 | @kindex f @r{(GDB threads buffer)} | ||
| 1071 | @findex gdb-display-stack-for-thread | ||
| 1072 | Display stack buffer for the thread at current line. | ||
| 1073 | (@code{gdb-display-stack-for-thread}). | ||
| 1074 | |||
| 1075 | @item l | ||
| 1076 | @kindex l @r{(GDB threads buffer)} | ||
| 1077 | @findex gdb-display-locals-for-thread | ||
| 1078 | Display locals buffer for the thread at current line. | ||
| 1079 | (@code{gdb-display-locals-for-thread}). | ||
| 1080 | |||
| 1081 | @item r | ||
| 1082 | @kindex r @r{(GDB threads buffer)} | ||
| 1083 | @findex gdb-display-registers-for-thread | ||
| 1084 | Display registers buffer for the thread at current line. | ||
| 1085 | (@code{gdb-display-registers-for-thread}). | ||
| 1086 | @end table | ||
| 1087 | |||
| 1088 | Pressing their upper-case counterparts, @kbd{D}, @kbd{F} ,@kbd{L} and | ||
| 1089 | @kbd{R} displays the corresponding buffer in a new frame. | ||
| 1090 | |||
| 1091 | When you create a buffer showing information about some specific | ||
| 1092 | thread, it becomes bound to that thread and keeps showing actual | ||
| 1093 | information while you debug your program. Every GDB buffer contains a | ||
| 1094 | number of thread it shows information for in its mode name. Thread | ||
| 1095 | number is also included in the buffer name of bound buffers to prevent | ||
| 1096 | buffer names clashing. | ||
| 1097 | |||
| 1098 | Further commands are available in the threads buffer which depend on the | ||
| 1099 | mode of GDB that is used for controlling execution of your program. | ||
| 1100 | (@pxref{Multithreaded Debugging, Stopping and Starting Multi-threaded Programs}). | ||
| 1101 | 1018 | ||
| 1102 | @node Stack Buffer | 1019 | @node Stack Buffer |
| 1103 | @subsubsection Stack Buffer | 1020 | @subsubsection Stack Buffer |
| @@ -1134,7 +1051,7 @@ as are the commands to send signals to the debugged program. | |||
| 1134 | @item Locals Buffer | 1051 | @item Locals Buffer |
| 1135 | The locals buffer displays the values of local variables of the | 1052 | The locals buffer displays the values of local variables of the |
| 1136 | current frame for simple data types (@pxref{Frame Info, Frame Info, | 1053 | current frame for simple data types (@pxref{Frame Info, Frame Info, |
| 1137 | Information on a frame, gdb, The GNU debugger}). Press @key{RET} or | 1054 | Information on a frame, gdb, The GNU debugger}). Press @key{RET} or |
| 1138 | click @kbd{Mouse-2} on the value if you want to edit it. | 1055 | click @kbd{Mouse-2} on the value if you want to edit it. |
| 1139 | 1056 | ||
| 1140 | Arrays and structures display their type only. With GDB 6.4 or later, | 1057 | Arrays and structures display their type only. With GDB 6.4 or later, |
| @@ -1153,12 +1070,27 @@ With GDB 6.4 or later, recently changed register values display with | |||
| 1153 | press @key{SPC} to toggle the display of floating point registers | 1070 | press @key{SPC} to toggle the display of floating point registers |
| 1154 | (@code{toggle-gdb-all-registers}). | 1071 | (@code{toggle-gdb-all-registers}). |
| 1155 | 1072 | ||
| 1156 | @item Disassembly Buffer | 1073 | @item Assembler Buffer |
| 1157 | The disassembly buffer displays the current frame as machine code. An | 1074 | The assembler buffer displays the current frame as machine code. An |
| 1158 | arrow points to the current instruction, and you can set and remove | 1075 | arrow points to the current instruction, and you can set and remove |
| 1159 | breakpoints as in a source buffer. Breakpoint icons also appear in | 1076 | breakpoints as in a source buffer. Breakpoint icons also appear in |
| 1160 | the fringe or margin. | 1077 | the fringe or margin. |
| 1161 | 1078 | ||
| 1079 | @item Threads Buffer | ||
| 1080 | @findex gdb-threads-select | ||
| 1081 | The threads buffer displays a summary of all threads currently in your | ||
| 1082 | program (@pxref{Threads, Threads, Debugging programs with multiple | ||
| 1083 | threads, gdb, The GNU debugger}). Move point to any thread in the | ||
| 1084 | list and press @key{RET} to select it (@code{gdb-threads-select}) and | ||
| 1085 | display the associated source in the primary source buffer. | ||
| 1086 | Alternatively, click @kbd{Mouse-2} on a thread to select it. If the | ||
| 1087 | locals buffer is visible, its contents update to display the variables | ||
| 1088 | that are local in the new thread. | ||
| 1089 | |||
| 1090 | When there is more than one main thread and the threads buffer is | ||
| 1091 | present, Emacs displays the selected thread number in the mode line of | ||
| 1092 | many of the GDB-UI Buffers. | ||
| 1093 | |||
| 1162 | @item Memory Buffer | 1094 | @item Memory Buffer |
| 1163 | The memory buffer lets you examine sections of program memory | 1095 | The memory buffer lets you examine sections of program memory |
| 1164 | (@pxref{Memory, Memory, Examining memory, gdb, The GNU debugger}). | 1096 | (@pxref{Memory, Memory, Examining memory, gdb, The GNU debugger}). |
| @@ -1171,9 +1103,8 @@ size for these data items. | |||
| 1171 | 1103 | ||
| 1172 | When @code{gdb-many-windows} is non-@code{nil}, the threads buffer | 1104 | When @code{gdb-many-windows} is non-@code{nil}, the threads buffer |
| 1173 | shares its window with the breakpoints buffer, and the locals buffer | 1105 | shares its window with the breakpoints buffer, and the locals buffer |
| 1174 | with the registers buffer. To switch from one to the other click with | 1106 | with the registers buffer. To switch from one to the other click with |
| 1175 | @kbd{Mouse-1} on the relevant button in the header line or press | 1107 | @kbd{Mouse-1} on the relevant button in the header line. |
| 1176 | @kbd{TAB} inside the buffer. | ||
| 1177 | 1108 | ||
| 1178 | @node Watch Expressions | 1109 | @node Watch Expressions |
| 1179 | @subsubsection Watch Expressions | 1110 | @subsubsection Watch Expressions |
| @@ -1241,96 +1172,26 @@ expressions updates, set @code{gdb-speedbar-auto-raise} to | |||
| 1241 | non-@code{nil}. This can be useful if you are debugging with a full | 1172 | non-@code{nil}. This can be useful if you are debugging with a full |
| 1242 | screen Emacs frame. | 1173 | screen Emacs frame. |
| 1243 | 1174 | ||
| 1244 | @node Multithreaded Debugging | 1175 | @node Reverse Debugging |
| 1245 | @subsubsection Stopping and Starting Multi-threaded Programs | 1176 | @subsubsection Reverse Debugging |
| 1246 | @cindex Multithreaded debugging in GDB | 1177 | |
| 1247 | 1178 | The GDB tool bar shares many buttons with the other GUD debuggers | |
| 1248 | @subsubheading All-stop Debugging | 1179 | for tasks like stepping and printing expressions. It also has a |
| 1249 | 1180 | further set of buttons that allow reverse debugging (@pxref{Process | |
| 1250 | In all-stop mode, whenever your program stops, @emph{all} threads of | 1181 | Record and Replay, , ,gdb, The GNU debugger}). This is useful when it |
| 1251 | execution stop. Likewise, whenever you restart the program, all | 1182 | takes a long time to reproduce the conditions where your program fails |
| 1252 | threads start executing. @xref{All-Stop Mode, , All-Stop Mode, gdb, | 1183 | or for transient problems, like race conditions in multi-threaded |
| 1253 | The GNU debugger}. You can enable this behaviour in Emacs by setting | 1184 | programs, where a failure might otherwise be hard to reproduce. |
| 1254 | @code{gdb-non-stop-setting} to @code{nil} before starting a debugging | 1185 | |
| 1255 | session. | 1186 | To use reverse debugging, set a breakpoint slightly before the |
| 1256 | 1187 | location of interest and run your program to that point. Enable | |
| 1257 | @subsubheading Non-stop Debugging | 1188 | process recording by clicking on the record button. At this point, a |
| 1258 | @cindex Non-stop debugging in GDB | 1189 | new set of buttons appear. These buttons allow program execution in |
| 1259 | 1190 | the reverse direction. Run your program over the code where the | |
| 1260 | For some multi-threaded targets, GDB supports a further mode of | 1191 | problem occurs, and then use the new set of buttons to retrace your |
| 1261 | operation in which you can examine stopped program threads in the | 1192 | steps, examine values, and analyze the problem. When analysis is |
| 1262 | debugger while other threads continue to execute freely. | 1193 | complete, turn off process recording by clicking on the record button |
| 1263 | @xref{Non-Stop Mode, , Non-Stop Mode, gdb, The GNU debugger}. | 1194 | again. |
| 1264 | This is referred to as @dfn{non-stop} mode. | ||
| 1265 | |||
| 1266 | Versions of GDB prior to 7.0 do not support non-stop mode and it does | ||
| 1267 | not work on all targets. In such cases, Emacs uses all-stop mode | ||
| 1268 | regardless of the value of @code{gdb-non-stop-setting}. | ||
| 1269 | |||
| 1270 | @vindex gdb-non-stop-setting | ||
| 1271 | If the variable @code{gdb-non-stop-setting} is non-@code{nil} (the | ||
| 1272 | default value), Emacs tries to start GDB in non-stop mode. Note that | ||
| 1273 | GDB debugging session needs to be restarted for change of this setting | ||
| 1274 | to take effect. | ||
| 1275 | |||
| 1276 | @vindex gdb-switch-when-another-stopped | ||
| 1277 | When a thread stops in non-stop mode, Emacs automatically switches to | ||
| 1278 | that thread. It may be undesirable to allow switching of current | ||
| 1279 | thread when some other stopped thread is already selected. Set | ||
| 1280 | @code{gdb-switch-when-another-stopped} to @code{nil} to prevent this. | ||
| 1281 | |||
| 1282 | @vindex gdb-switch-reasons | ||
| 1283 | Emacs can decide whether or not to switch to the stopped thread | ||
| 1284 | depending on the reason which caused the stop. Customize | ||
| 1285 | @code{gdb-switch-reasons} to select stop reasons which make Emacs | ||
| 1286 | switch thread. | ||
| 1287 | |||
| 1288 | @vindex gdb-stopped-hooks | ||
| 1289 | The variable @code{gdb-stopped-hooks} allows you to execute your | ||
| 1290 | functions whenever some thread stops. | ||
| 1291 | |||
| 1292 | In non-stop mode, you can switch between different modes for GUD | ||
| 1293 | execution control commands. | ||
| 1294 | |||
| 1295 | @vindex gdb-gud-control-all-threads | ||
| 1296 | @table @dfn | ||
| 1297 | @item Non-stop/A | ||
| 1298 | |||
| 1299 | When @code{gdb-gud-control-all-threads} is @code{t} (the default | ||
| 1300 | value), interruption and continuation commands apply to all threads, | ||
| 1301 | so you can halt or continue all your threads with one command using | ||
| 1302 | @code{gud-stop-subjob} and @code{gud-cont}, respectively. The | ||
| 1303 | @samp{Go} button is shown on the toolbar when at least one thread is | ||
| 1304 | stopped, whereas @samp{Stop} button is shown when at least one thread | ||
| 1305 | is running. | ||
| 1306 | |||
| 1307 | @item Non-stop/T | ||
| 1308 | |||
| 1309 | When @code{gdb-gud-control-all-threads} is @code{nil}, only the | ||
| 1310 | current thread is stopped/continued. @samp{Go} and @samp{Stop} | ||
| 1311 | buttons on the GUD toolbar are shown depending on the state of current | ||
| 1312 | thread. | ||
| 1313 | @end table | ||
| 1314 | |||
| 1315 | You can change the current value of @code{gdb-gud-control-all-threads} | ||
| 1316 | from the tool bar or from @samp{GUD->GDB-MI} menu. | ||
| 1317 | |||
| 1318 | Stepping commands always apply to the current thread. | ||
| 1319 | |||
| 1320 | @subsubheading Fine Thread Control | ||
| 1321 | |||
| 1322 | In non-stop mode, you can interrupt/continue your threads without | ||
| 1323 | selecting them. Hitting @kbd{i} in threads buffer interrupts thread | ||
| 1324 | under point, @kbd{c} continues it, @kbd{s} steps through. More such | ||
| 1325 | commands may be added in the future. | ||
| 1326 | |||
| 1327 | Combined with creating bound buffers for any thread, this allows you | ||
| 1328 | to change and track state of many threads in the same time. | ||
| 1329 | |||
| 1330 | Note that when you interrupt a thread, it stops with @samp{signal | ||
| 1331 | received} reason. If that reason is included in your | ||
| 1332 | @code{gdb-switch-reasons} (it is by default), Emacs will switch to | ||
| 1333 | that thread. | ||
| 1334 | 1195 | ||
| 1335 | @node Executing Lisp | 1196 | @node Executing Lisp |
| 1336 | @section Executing Lisp Expressions | 1197 | @section Executing Lisp Expressions |
diff --git a/doc/emacs/emacs.texi b/doc/emacs/emacs.texi index 4b9ea28dcc3..7037574245a 100644 --- a/doc/emacs/emacs.texi +++ b/doc/emacs/emacs.texi | |||
| @@ -745,16 +745,14 @@ Running Debuggers Under Emacs | |||
| 745 | 745 | ||
| 746 | GDB Graphical Interface | 746 | GDB Graphical Interface |
| 747 | 747 | ||
| 748 | * GDB-UI Layout:: Control the number of displayed buffers. | 748 | * GDB-UI Layout:: Control the number of displayed buffers. |
| 749 | * Source Buffers:: Use the mouse in the fringe/margin to | 749 | * Source Buffers:: Use the mouse in the fringe/margin to |
| 750 | control your program. | 750 | control your program. |
| 751 | * Breakpoints Buffer:: A breakpoint control panel. | 751 | * Breakpoints Buffer:: A breakpoint control panel. |
| 752 | * Threads Buffer:: Displays your threads. | 752 | * Stack Buffer:: Select a frame from the call stack. |
| 753 | * Stack Buffer:: Select a frame from the call stack. | 753 | * Other GDB-UI Buffers::Input/output, locals, registers, |
| 754 | * Other GDB-UI Buffers:: Input/output, locals, registers, | 754 | assembler, threads and memory buffers. |
| 755 | assembler, threads and memory buffers. | 755 | * Watch Expressions:: Monitor variable values in the speedbar. |
| 756 | * Watch Expressions:: Monitor variable values in the speedbar. | ||
| 757 | * Multithreaded Debugging:: Debugging programs with several threads. | ||
| 758 | 756 | ||
| 759 | Maintaining Large Programs | 757 | Maintaining Large Programs |
| 760 | 758 | ||