OLD | NEW |
1 This is gdbint.info, produced by makeinfo version 4.8 from | 1 This is gdbint.info, produced by makeinfo version 4.8 from |
2 ./gdbint.texinfo. | 2 ./gdbint.texinfo. |
3 | 3 |
4 INFO-DIR-SECTION Software development | 4 INFO-DIR-SECTION Software development |
5 START-INFO-DIR-ENTRY | 5 START-INFO-DIR-ENTRY |
6 * Gdb-Internals: (gdbint). The GNU debugger's internals. | 6 * Gdb-Internals: (gdbint). The GNU debugger's internals. |
7 END-INFO-DIR-ENTRY | 7 END-INFO-DIR-ENTRY |
8 | 8 |
9 Copyright (C) 1990-1994, 1996, 1998-2006, 2008-2012 Free Software | 9 Copyright (C) 1990-1994, 1996, 1998-2006, 2008-2012 Free Software |
10 Foundation, Inc. Contributed by Cygnus Solutions. Written by John | 10 Foundation, Inc. Contributed by Cygnus Solutions. Written by John |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 * Misc Guidelines:: | 61 * Misc Guidelines:: |
62 * Porting GDB:: | 62 * Porting GDB:: |
63 * Versions and Branches:: | 63 * Versions and Branches:: |
64 * Start of New Year Procedure:: | 64 * Start of New Year Procedure:: |
65 * Releasing GDB:: | 65 * Releasing GDB:: |
66 * Testsuite:: | 66 * Testsuite:: |
67 * Hints:: | 67 * Hints:: |
68 | 68 |
69 * GDB Observers:: GDB Currently available observers | 69 * GDB Observers:: GDB Currently available observers |
70 * GNU Free Documentation License:: The license for this documentation | 70 * GNU Free Documentation License:: The license for this documentation |
71 * Index:: | 71 * Concept Index:: |
| 72 * Function and Variable Index:: |
72 | 73 |
73 | 74 |
74 File: gdbint.info, Node: Summary, Next: Overall Structure, Prev: Top, Up: To
p | 75 File: gdbint.info, Node: Summary, Next: Overall Structure, Prev: Top, Up: To
p |
75 | 76 |
76 1 Summary | 77 1 Summary |
77 ********* | 78 ********* |
78 | 79 |
79 * Menu: | 80 * Menu: |
80 | 81 |
81 * Requirements:: | 82 * Requirements:: |
(...skipping 4373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4455 to return a new PC that is at the start of the real function. | 4456 to return a new PC that is at the start of the real function. |
4456 | 4457 |
4457 `int gdbarch_deprecated_fp_regnum (GDBARCH)' | 4458 `int gdbarch_deprecated_fp_regnum (GDBARCH)' |
4458 If the frame pointer is in a register, use this function to return | 4459 If the frame pointer is in a register, use this function to return |
4459 the number of that register. | 4460 the number of that register. |
4460 | 4461 |
4461 `int gdbarch_stab_reg_to_regnum (GDBARCH, STAB_REGNR)' | 4462 `int gdbarch_stab_reg_to_regnum (GDBARCH, STAB_REGNR)' |
4462 Use this function to convert stab register STAB_REGNR into GDB | 4463 Use this function to convert stab register STAB_REGNR into GDB |
4463 regnum. If not defined, no conversion will be done. | 4464 regnum. If not defined, no conversion will be done. |
4464 | 4465 |
4465 `SYMBOL_RELOADING_DEFAULT' | |
4466 The default value of the "symbol-reloading" variable. (Never | |
4467 defined in current sources.) | |
4468 | |
4469 `TARGET_CHAR_BIT' | 4466 `TARGET_CHAR_BIT' |
4470 Number of bits in a char; defaults to 8. | 4467 Number of bits in a char; defaults to 8. |
4471 | 4468 |
4472 `int gdbarch_char_signed (GDBARCH)' | 4469 `int gdbarch_char_signed (GDBARCH)' |
4473 Non-zero if `char' is normally signed on this architecture; zero if | 4470 Non-zero if `char' is normally signed on this architecture; zero if |
4474 it should be unsigned. | 4471 it should be unsigned. |
4475 | 4472 |
4476 The ISO C standard requires the compiler to treat `char' as | 4473 The ISO C standard requires the compiler to treat `char' as |
4477 equivalent to either `signed char' or `unsigned char'; any | 4474 equivalent to either `signed char' or `unsigned char'; any |
4478 character in the standard execution set is supposed to be positive. | 4475 character in the standard execution set is supposed to be positive. |
(...skipping 839 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5318 In addition, whitespace around casts and unary operators should | 5315 In addition, whitespace around casts and unary operators should |
5319 follow the following guidelines: | 5316 follow the following guidelines: |
5320 | 5317 |
5321 Use... ...instead of | 5318 Use... ...instead of |
5322 `!x' `! x' | 5319 `!x' `! x' |
5323 `~x' `~ x' | 5320 `~x' `~ x' |
5324 `-x' `- x' (unary minus) | 5321 `-x' `- x' (unary minus) |
5325 `(foo) x' `(foo)x' (cast) | 5322 `(foo) x' `(foo)x' (cast) |
5326 `*x' `* x' (pointer dereference) | 5323 `*x' `* x' (pointer dereference) |
5327 | 5324 |
| 5325 Any two or more lines in code should be wrapped in braces, even if |
| 5326 they are comments, as they look like separate statements: |
| 5327 |
| 5328 if (i) |
| 5329 { |
| 5330 /* Return success. */ |
| 5331 return 0; |
| 5332 } |
| 5333 |
| 5334 and not: |
| 5335 |
| 5336 if (i) |
| 5337 /* Return success. */ |
| 5338 return 0; |
| 5339 |
5328 16.1.3 Comments | 5340 16.1.3 Comments |
5329 --------------- | 5341 --------------- |
5330 | 5342 |
5331 The standard GNU requirements on comments must be followed strictly. | 5343 The standard GNU requirements on comments must be followed strictly. |
5332 | 5344 |
5333 Block comments must appear in the following form, with no `/*'- or | 5345 Block comments must appear in the following form, with no `/*'- or |
5334 `*/'-only lines, and no leading `*': | 5346 `*/'-only lines, and no leading `*': |
5335 | 5347 |
5336 /* Wait for control to return from inferior to debugger. If inferior | 5348 /* Wait for control to return from inferior to debugger. If inferior |
5337 gets a signal, we may decide to start it up again instead of | 5349 gets a signal, we may decide to start it up again instead of |
(...skipping 842 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6180 | 6192 |
6181 * Update the copyright year in the startup message | 6193 * Update the copyright year in the startup message |
6182 | 6194 |
6183 Update the copyright year in: | 6195 Update the copyright year in: |
6184 * file `top.c', function `print_gdb_version' | 6196 * file `top.c', function `print_gdb_version' |
6185 | 6197 |
6186 * file `gdbserver/server.c', function `gdbserver_version' | 6198 * file `gdbserver/server.c', function `gdbserver_version' |
6187 | 6199 |
6188 * file `gdbserver/gdbreplay.c', function `gdbreplay_version' | 6200 * file `gdbserver/gdbreplay.c', function `gdbreplay_version' |
6189 | 6201 |
6190 * Run the `copyright.sh' script to add the new year in the copyright | 6202 * Run the `copyright.py' Python script to add the new year in the |
6191 notices of most source files. This script requires Emacs 22 or | 6203 copyright notices of most source files. This script has been |
6192 later to be installed. | 6204 tested with Python 2.6 and 2.7. |
6193 | |
6194 * The new year also needs to be added manually in all other files | |
6195 that are not already taken care of by the `copyright.sh' script: | |
6196 * `*.s' | |
6197 | |
6198 * `*.f' | |
6199 | |
6200 * `*.f90' | |
6201 | |
6202 * `*.igen' | |
6203 | |
6204 * `*.ac' | |
6205 | |
6206 * `*.texi' | |
6207 | |
6208 * `*.texinfo' | |
6209 | |
6210 * `*.tex' | |
6211 | |
6212 * `*.defs' | |
6213 | |
6214 * `*.1' | |
6215 | 6205 |
6216 | 6206 |
6217 | 6207 |
6218 File: gdbint.info, Node: Releasing GDB, Next: Testsuite, Prev: Start of New Y
ear Procedure, Up: Top | 6208 File: gdbint.info, Node: Releasing GDB, Next: Testsuite, Prev: Start of New Y
ear Procedure, Up: Top |
6219 | 6209 |
6220 21 Releasing GDB | 6210 21 Releasing GDB |
6221 **************** | 6211 **************** |
6222 | 6212 |
6223 21.1 Branch Commit Policy | 6213 21.1 Branch Commit Policy |
6224 ========================= | 6214 ========================= |
(...skipping 751 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6976 When testing a different GDB, it is often useful to also test a | 6966 When testing a different GDB, it is often useful to also test a |
6977 different gdbserver. | 6967 different gdbserver. |
6978 | 6968 |
6979 make check RUNTESTFLAGS="GDB=/usr/bin/gdb GDBSERVER=/usr/bin/gdbserver
" | 6969 make check RUNTESTFLAGS="GDB=/usr/bin/gdb GDBSERVER=/usr/bin/gdbserver
" |
6980 | 6970 |
6981 * `INTERNAL_GDBFLAGS' | 6971 * `INTERNAL_GDBFLAGS' |
6982 | 6972 |
6983 When running the testsuite normally one doesn't want whatever is in | 6973 When running the testsuite normally one doesn't want whatever is in |
6984 `~/.gdbinit' to interfere with the tests, therefore the test | 6974 `~/.gdbinit' to interfere with the tests, therefore the test |
6985 harness passes `-nx' to GDB. One also doesn't want any windowed | 6975 harness passes `-nx' to GDB. One also doesn't want any windowed |
6986 version of GDB, e.g., `gdbtui', to run. This is achieved via | 6976 version of GDB, e.g., `gdb -tui', to run. This is achieved via |
6987 `INTERNAL_GDBFLAGS'. | 6977 `INTERNAL_GDBFLAGS'. |
6988 | 6978 |
6989 set INTERNAL_GDBFLAGS "-nw -nx" | 6979 set INTERNAL_GDBFLAGS "-nw -nx" |
6990 | 6980 |
6991 This is all well and good, except when testing an installed GDB | 6981 This is all well and good, except when testing an installed GDB |
6992 that has been configured with `--with-system-gdbinit'. Here one | 6982 that has been configured with `--with-system-gdbinit'. Here one |
6993 does not want `~/.gdbinit' loaded but one may want the system | 6983 does not want `~/.gdbinit' loaded but one may want the system |
6994 `.gdbinit' file loaded. This can be achieved by pointing `$HOME' | 6984 `.gdbinit' file loaded. This can be achieved by pointing `$HOME' |
6995 at a directory without a `.gdbinit' and by overriding | 6985 at a directory without a `.gdbinit' and by overriding |
6996 `INTERNAL_GDBFLAGS' and removing `-nx'. | 6986 `INTERNAL_GDBFLAGS' and removing `-nx'. |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7116 On some operating systems (e.g. OpenBSD) the TTY layer expands tabs to | 7106 On some operating systems (e.g. OpenBSD) the TTY layer expands tabs to |
7117 spaces, so by the time GDB's output reaches expect the tab is gone. | 7107 spaces, so by the time GDB's output reaches expect the tab is gone. |
7118 | 7108 |
7119 The source language programs do _not_ need to be in a consistent | 7109 The source language programs do _not_ need to be in a consistent |
7120 style. Since GDB is used to debug programs written in many different | 7110 style. Since GDB is used to debug programs written in many different |
7121 styles, it's worth having a mix of styles in the testsuite; for | 7111 styles, it's worth having a mix of styles in the testsuite; for |
7122 instance, some GDB bugs involving the display of source lines would | 7112 instance, some GDB bugs involving the display of source lines would |
7123 never manifest themselves if the programs used GNU coding style | 7113 never manifest themselves if the programs used GNU coding style |
7124 uniformly. | 7114 uniformly. |
7125 | 7115 |
| 7116 Some testcase results need more detailed explanation: |
| 7117 |
| 7118 `KFAIL' |
| 7119 Known problem of GDB itself. You must specify the GDB bug report |
| 7120 number like in these sample tests: |
| 7121 kfail "gdb/13392" "continue to marker 2" |
| 7122 or |
| 7123 setup_kfail gdb/13392 "*-*-*" |
| 7124 kfail "continue to marker 2" |
| 7125 |
| 7126 `XFAIL' |
| 7127 Known problem of environment. This typically includes GCC but it |
| 7128 includes also many other system components which cannot be fixed |
| 7129 in the GDB project. Sample test with sanity check not knowing the |
| 7130 specific cause of the problem: |
| 7131 # On x86_64 it is commonly about 4MB. |
| 7132 if {$stub_size > 25000000} { |
| 7133 xfail "stub size $stub_size is too large" |
| 7134 return |
| 7135 } |
| 7136 |
| 7137 You should provide bug report number for the failing component of |
| 7138 the environment, if such bug report is available: |
| 7139 if {[test_compiler_info {gcc-[0-3]-*}] |
| 7140 || [test_compiler_info {gcc-4-[0-5]-*}]} { |
| 7141 setup_xfail "gcc/46955" *-*-* |
| 7142 } |
| 7143 gdb_test "python print ttype.template_argument(2)" "&C::c" |
| 7144 |
| 7145 22.6 Board settings |
| 7146 =================== |
| 7147 |
| 7148 In GDB testsuite, the tests can be configured or customized in the board |
| 7149 file by means of "Board Settings". Each setting should be consulted |
| 7150 by test cases that depend on the corresponding feature. |
| 7151 |
| 7152 Here are the supported board settings: |
| 7153 |
| 7154 `gdb,cannot_call_functions' |
| 7155 The board does not support inferior call, that is, invoking |
| 7156 inferior functions in GDB. |
| 7157 |
| 7158 `gdb,can_reverse' |
| 7159 The board supports reverse execution. |
| 7160 |
| 7161 `gdb,no_hardware_watchpoints' |
| 7162 The board does not support hardware watchpoints. |
| 7163 |
| 7164 `gdb,nofileio' |
| 7165 GDB is unable to intercept target file operations in remote and |
| 7166 perform them on the host. |
| 7167 |
| 7168 `gdb,noinferiorio' |
| 7169 The board is unable to provide I/O capability to the inferior. |
| 7170 |
| 7171 `gdb,nosignals' |
| 7172 The board does not support signals. |
| 7173 |
| 7174 `gdb,skip_huge_test' |
| 7175 Skip time-consuming tests on the board with slow connection. |
| 7176 |
| 7177 `gdb,skip_float_tests' |
| 7178 Skip tests related to float points on target board. |
| 7179 |
| 7180 `gdb,use_precord' |
| 7181 The board supports process record. |
| 7182 |
| 7183 `gdb_server_prog' |
| 7184 The location of GDBserver. If GDBserver somewhere other than its |
| 7185 default location is used in test, specify the location of |
| 7186 GDBserver in this variable. The location is a file name of |
| 7187 GDBserver that can be either absolute or relative to testsuite |
| 7188 subdirectory in build directory. |
| 7189 |
| 7190 `in_proc_agent' |
| 7191 The location of in-process agent. If in-process agent other than |
| 7192 its default location is used in test, specify the location of |
| 7193 in-process agent in this variable. The location is a file name of |
| 7194 in-process agent that can be either absolute or relative to |
| 7195 testsuite subdirectory in build directory. |
| 7196 |
| 7197 `noargs' |
| 7198 GDB does not support argument passing for inferior. |
| 7199 |
| 7200 `no_long_long' |
| 7201 The board does not support type `long long'. |
| 7202 |
| 7203 `use_gdb_stub' |
| 7204 The tests are running with gdb stub. |
| 7205 |
7126 ---------- Footnotes ---------- | 7206 ---------- Footnotes ---------- |
7127 | 7207 |
7128 (1) If you are using a board file, it could override the test-suite | 7208 (1) If you are using a board file, it could override the test-suite |
7129 default; search the board file for "timeout". | 7209 default; search the board file for "timeout". |
7130 | 7210 |
7131 | 7211 |
7132 File: gdbint.info, Node: Hints, Next: GDB Observers, Prev: Testsuite, Up: To
p | 7212 File: gdbint.info, Node: Hints, Next: GDB Observers, Prev: Testsuite, Up: To
p |
7133 | 7213 |
7134 23 Hints | 7214 23 Hints |
7135 ******** | 7215 ******** |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7213 `info display' command invokes `display_info'. When this convention is | 7293 `info display' command invokes `display_info'. When this convention is |
7214 not followed, you might have to use `grep' or `M-x tags-search' in | 7294 not followed, you might have to use `grep' or `M-x tags-search' in |
7215 emacs, or run GDB on itself and set a breakpoint in `execute_command'. | 7295 emacs, or run GDB on itself and set a breakpoint in `execute_command'. |
7216 | 7296 |
7217 If all of the above fail, it may be appropriate to ask for | 7297 If all of the above fail, it may be appropriate to ask for |
7218 information on `bug-gdb'. But _never_ post a generic question like "I | 7298 information on `bug-gdb'. But _never_ post a generic question like "I |
7219 was wondering if anyone could give me some tips about understanding | 7299 was wondering if anyone could give me some tips about understanding |
7220 GDB"--if we had some magic secret we would put it in this manual. | 7300 GDB"--if we had some magic secret we would put it in this manual. |
7221 Suggestions for improving the manual are always welcome, of course. | 7301 Suggestions for improving the manual are always welcome, of course. |
7222 | 7302 |
7223 | |
7224 File: gdbint.info, Node: Debugging GDB, Prev: Getting Started, Up: Hints | |
7225 | |
7226 23.2 Debugging GDB with itself | |
7227 ============================== | |
7228 | |
7229 If GDB is limping on your machine, this is the preferred way to get it | |
7230 fully functional. Be warned that in some ancient Unix systems, like | |
7231 Ultrix 4.2, a program can't be running in one process while it is being | |
7232 debugged in another. Rather than typing the command `./gdb ./gdb', | |
7233 which works on Suns and such, you can copy `gdb' to `gdb2' and then | |
7234 type `./gdb ./gdb2'. | |
7235 | |
7236 When you run GDB in the GDB source directory, it will read a | |
7237 `.gdbinit' file that sets up some simple things to make debugging gdb | |
7238 easier. The `info' command, when executed without a subcommand in a | |
7239 GDB being debugged by gdb, will pop you back up to the top level gdb. | |
7240 See `.gdbinit' for details. | |
7241 | |
7242 If you use emacs, you will probably want to do a `make TAGS' after | |
7243 you configure your distribution; this will put the machine dependent | |
7244 routines for your local machine where they will be accessed first by | |
7245 `M-.' | |
7246 | |
7247 Also, make sure that you've either compiled GDB with your local cc, | |
7248 or have run `fixincludes' if you are compiling with gcc. | |
7249 | |
7250 23.3 Submitting Patches | |
7251 ======================= | |
7252 | |
7253 Thanks for thinking of offering your changes back to the community of | |
7254 GDB users. In general we like to get well designed enhancements. | |
7255 Thanks also for checking in advance about the best way to transfer the | |
7256 changes. | |
7257 | |
7258 The GDB maintainers will only install "cleanly designed" patches. | |
7259 This manual summarizes what we believe to be clean design for GDB. | |
7260 | |
7261 If the maintainers don't have time to put the patch in when it | |
7262 arrives, or if there is any question about a patch, it goes into a | |
7263 large queue with everyone else's patches and bug reports. | |
7264 | |
7265 The legal issue is that to incorporate substantial changes requires a | |
7266 copyright assignment from you and/or your employer, granting ownership | |
7267 of the changes to the Free Software Foundation. You can get the | |
7268 standard documents for doing this by sending mail to `gnu@gnu.org' and | |
7269 asking for it. We recommend that people write in "All programs owned | |
7270 by the Free Software Foundation" as "NAME OF PROGRAM", so that changes | |
7271 in many programs (not just GDB, but GAS, Emacs, GCC, etc) can be | |
7272 contributed with only one piece of legalese pushed through the | |
7273 bureaucracy and filed with the FSF. We can't start merging changes | |
7274 until this paperwork is received by the FSF (their rules, which we | |
7275 follow since we maintain it for them). | |
7276 | |
7277 Technically, the easiest way to receive changes is to receive each | |
7278 feature as a small context diff or unidiff, suitable for `patch'. Each | |
7279 message sent to me should include the changes to C code and header | |
7280 files for a single feature, plus `ChangeLog' entries for each directory | |
7281 where files were modified, and diffs for any changes needed to the | |
7282 manuals (`gdb/doc/gdb.texinfo' or `gdb/doc/gdbint.texinfo'). If there | |
7283 are a lot of changes for a single feature, they can be split down into | |
7284 multiple messages. | |
7285 | |
7286 In this way, if we read and like the feature, we can add it to the | |
7287 sources with a single patch command, do some testing, and check it in. | |
7288 If you leave out the `ChangeLog', we have to write one. If you leave | |
7289 out the doc, we have to puzzle out what needs documenting. Etc., etc. | |
7290 | |
7291 The reason to send each change in a separate message is that we will | |
7292 not install some of the changes. They'll be returned to you with | |
7293 questions or comments. If we're doing our job correctly, the message | |
7294 back to you will say what you have to fix in order to make the change | |
7295 acceptable. The reason to have separate messages for separate features | |
7296 is so that the acceptable changes can be installed while one or more | |
7297 changes are being reworked. If multiple features are sent in a single | |
7298 message, we tend to not put in the effort to sort out the acceptable | |
7299 changes from the unacceptable, so none of the features get installed | |
7300 until all are acceptable. | |
7301 | |
7302 If this sounds painful or authoritarian, well, it is. But we get a | |
7303 lot of bug reports and a lot of patches, and many of them don't get | |
7304 installed because we don't have the time to finish the job that the bug | |
7305 reporter or the contributor could have done. Patches that arrive | |
7306 complete, working, and well designed, tend to get installed on the day | |
7307 they arrive. The others go into a queue and get installed as time | |
7308 permits, which, since the maintainers have many demands to meet, may not | |
7309 be for quite some time. | |
7310 | |
7311 Please send patches directly to the GDB maintainers | |
7312 <gdb-patches@sourceware.org>. | |
7313 | |
7314 23.4 Build Script | |
7315 ================= | |
7316 | |
7317 The script `gdb_buildall.sh' builds GDB with flag | |
7318 `--enable-targets=all' set. This builds GDB with all supported targets | |
7319 activated. This helps testing GDB when doing changes that affect more | |
7320 than one architecture and is much faster than using `gdb_mbuild.sh'. | |
7321 | |
7322 After building GDB the script checks which architectures are | |
7323 supported and then switches the current architecture to each of those | |
7324 to get information about the architecture. The test results are stored | |
7325 in log files in the directory the script was called from. | |
7326 | |
OLD | NEW |