* gdb-int.texinfo: Add minor sections on configuring gdb for
[binutils-gdb.git] / gdb / doc / gdbint.texinfo
1 GDB Internals documentation
2
3 This needs to be wrapped in texinfo stuff...
4
5 Cleanups
6
7 Cleanups are a structured way to deal with things that need to be done
8 later. When your code does something (like malloc some memory, or open
9 a file) that needs to be undone later (e.g. free the memory or close
10 the file), it can make a cleanup. The cleanup will be done at some
11 future point: when the command is finished, when an error occurs, or
12 when your code decides it's time to do cleanups.
13
14 You can also discard cleanups, that is, throw them away without doing
15 what they say. This is only done if you ask that it be done.
16
17 Syntax:
18
19 old_chain = make_cleanup (function, arg);
20
21 This makes a cleanup which will cause FUNCTION to be called with ARG
22 (a char *) later. The result, OLD_CHAIN, is a handle that can be
23 passed to do_cleanups or discard_cleanups later. Unless you are
24 going to call do_cleanups or discard_cleanups yourself,
25 you can ignore the result from make_cleanup.
26
27 do_cleanups (old_chain);
28
29 Performs all cleanups done since make_cleanup returned OLD_CHAIN.
30 E.g.: make_cleanup (a, 0); old = make_cleanup (b, 0); do_cleanups (old);
31 will call b() but will not call a(). The cleanup that calls a() will remain
32 in the cleanup chain, and will be done later unless otherwise discarded.
33
34 discard_cleanups (old_chain);
35
36 Same as do_cleanups except that it just removes the cleanups from the
37 chain and does not call the specified functions.
38
39
40 Some functions, e.g. fputs_filtered() or error(), specify that they
41 "should not be called when cleanups are not in place". This means
42 that any actions you need to reverse in the case of an error or
43 interruption must be on the cleanup chain before you call these functions,
44 since they might never return to your code (they "longjmp" instead).
45
46
47
48 Configuring GDB for release
49
50
51 GDB should be released after doing "config.gdb none" in the top level
52 directory. This will leave a makefile there, but no tm- or xm- files.
53 The makefile is needed, for example, for "make gdb.tar.Z"... If you
54 have tm- or xm-files in the main source directory, C's include rules
55 cause them to be used in preference to tm- and xm-files in the
56 subdirectories where the user will actually configure and build the
57 binaries.
58
59 "config.gdb none" is also a good way to rebuild the top level Makefile
60 after changing Makefile.dist, alldeps.mak, etc.
61
62
63
64
65 The README file
66
67
68 Check the README file, it often has useful information that does not
69 appear anywhere else in the directory.