* gdb.texinfo: Document "complaints". Change doc of -q since
[deliverable/binutils-gdb.git] / gdb / doc / gdbint.texinfo
CommitLineData
cfddbd02 1GDB Internals documentation
f222d23d 2
cfddbd02
JG
3This needs to be wrapped in texinfo stuff...
4
bbb5013f 5 Cleanups
cfddbd02
JG
6
7Cleanups are a structured way to deal with things that need to be done
8later. When your code does something (like malloc some memory, or open
9a file) that needs to be undone later (e.g. free the memory or close
10the file), it can make a cleanup. The cleanup will be done at some
11future point: when the command is finished, when an error occurs, or
12when your code decides it's time to do cleanups.
13
14You can also discard cleanups, that is, throw them away without doing
15what they say. This is only done if you ask that it be done.
16
17Syntax:
18
19 old_chain = make_cleanup (function, arg);
20
21This 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
23passed to do_cleanups or discard_cleanups later. Unless you are
24going to call do_cleanups or discard_cleanups yourself,
25you can ignore the result from make_cleanup.
26
27 do_cleanups (old_chain);
28
29Performs all cleanups done since make_cleanup returned OLD_CHAIN.
30E.g.: make_cleanup (a, 0); old = make_cleanup (b, 0); do_cleanups (old);
31will call b() but will not call a(). The cleanup that calls a() will remain
32in the cleanup chain, and will be done later unless otherwise discarded.
33
34 discard_cleanups (old_chain);
35
36Same as do_cleanups except that it just removes the cleanups from the
37chain and does not call the specified functions.
38
39
40Some functions, e.g. fputs_filtered() or error(), specify that they
41"should not be called when cleanups are not in place". This means
42that any actions you need to reverse in the case of an error or
43interruption must be on the cleanup chain before you call these functions,
44since they might never return to your code (they "longjmp" instead).
7f27984e
JG
45
46
47
bbb5013f
JG
48 Wrapping output lines
49
50Output that goes through printf_filtered or fputs_filtered or
51fputs_demangled needs only to have calls to wrap_here() added
52in places that would be good breaking points. The utility routines
53will take care of actually wrapping if the line width is exceeded.
54
55The argument to wrap_here() is an indentation string which is printed
56ONLY if the line breaks there. This argument is saved away and used
57later. It must remain valid until the next call to wrap_here() or
58until a newline has been printed through the *_filtered functions.
59Don't pass in a local variable and then return!
60
61It is usually best to call wrap_here() after printing a comma or space.
62If you call it before printing a space, make sure that your indentation
63properly accounts for the leading space that will print if the line wraps
64there.
65
66
67
68
7f27984e
JG
69 Configuring GDB for release
70
71
72GDB should be released after doing "config.gdb none" in the top level
73directory. This will leave a makefile there, but no tm- or xm- files.
74The makefile is needed, for example, for "make gdb.tar.Z"... If you
75have tm- or xm-files in the main source directory, C's include rules
76cause them to be used in preference to tm- and xm-files in the
77subdirectories where the user will actually configure and build the
78binaries.
79
80"config.gdb none" is also a good way to rebuild the top level Makefile
81after changing Makefile.dist, alldeps.mak, etc.
82
83
84
85
86 The README file
87
88
89Check the README file, it often has useful information that does not
90appear anywhere else in the directory.
This page took 0.150756 seconds and 4 git commands to generate.