Merge remote-tracking branch 'origin/vendor/LIBARCHIVE'
[dragonfly.git] / gnu / usr.bin / gdb / gdb / gdbint.7
1 .\" Automatically generated by Pod::Man 2.27 (Pod::Simple 3.28)
2 .\"
3 .\" Standard preamble:
4 .\" ========================================================================
5 .de Sp \" Vertical space (when we can't use .PP)
6 .if t .sp .5v
7 .if n .sp
8 ..
9 .de Vb \" Begin verbatim text
10 .ft CW
11 .nf
12 .ne \\$1
13 ..
14 .de Ve \" End verbatim text
15 .ft R
16 .fi
17 ..
18 .\" Set up some character translations and predefined strings.  \*(-- will
19 .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
20 .\" double quote, and \*(R" will give a right double quote.  \*(C+ will
21 .\" give a nicer C++.  Capital omega is used to do unbreakable dashes and
22 .\" therefore won't be available.  \*(C` and \*(C' expand to `' in nroff,
23 .\" nothing in troff, for use with C<>.
24 .tr \(*W-
25 .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
26 .ie n \{\
27 .    ds -- \(*W-
28 .    ds PI pi
29 .    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
30 .    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
31 .    ds L" ""
32 .    ds R" ""
33 .    ds C` ""
34 .    ds C' ""
35 'br\}
36 .el\{\
37 .    ds -- \|\(em\|
38 .    ds PI \(*p
39 .    ds L" ``
40 .    ds R" ''
41 .    ds C`
42 .    ds C'
43 'br\}
44 .\"
45 .\" Escape single quotes in literal strings from groff's Unicode transform.
46 .ie \n(.g .ds Aq \(aq
47 .el       .ds Aq '
48 .\"
49 .\" If the F register is turned on, we'll generate index entries on stderr for
50 .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
51 .\" entries marked with X<> in POD.  Of course, you'll have to process the
52 .\" output yourself in some meaningful fashion.
53 .\"
54 .\" Avoid warning from groff about undefined register 'F'.
55 .de IX
56 ..
57 .nr rF 0
58 .if \n(.g .if rF .nr rF 1
59 .if (\n(rF:(\n(.g==0)) \{
60 .    if \nF \{
61 .        de IX
62 .        tm Index:\\$1\t\\n%\t"\\$2"
63 ..
64 .        if !\nF==2 \{
65 .            nr % 0
66 .            nr F 2
67 .        \}
68 .    \}
69 .\}
70 .rr rF
71 .\"
72 .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
73 .\" Fear.  Run.  Save yourself.  No user-serviceable parts.
74 .    \" fudge factors for nroff and troff
75 .if n \{\
76 .    ds #H 0
77 .    ds #V .8m
78 .    ds #F .3m
79 .    ds #[ \f1
80 .    ds #] \fP
81 .\}
82 .if t \{\
83 .    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
84 .    ds #V .6m
85 .    ds #F 0
86 .    ds #[ \&
87 .    ds #] \&
88 .\}
89 .    \" simple accents for nroff and troff
90 .if n \{\
91 .    ds ' \&
92 .    ds ` \&
93 .    ds ^ \&
94 .    ds , \&
95 .    ds ~ ~
96 .    ds /
97 .\}
98 .if t \{\
99 .    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
100 .    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
101 .    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
102 .    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
103 .    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
104 .    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
105 .\}
106 .    \" troff and (daisy-wheel) nroff accents
107 .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
108 .ds 8 \h'\*(#H'\(*b\h'-\*(#H'
109 .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
110 .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
111 .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
112 .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
113 .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
114 .ds ae a\h'-(\w'a'u*4/10)'e
115 .ds Ae A\h'-(\w'A'u*4/10)'E
116 .    \" corrections for vroff
117 .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
118 .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
119 .    \" for low resolution devices (crt and lpr)
120 .if \n(.H>23 .if \n(.V>19 \
121 \{\
122 .    ds : e
123 .    ds 8 ss
124 .    ds o a
125 .    ds d- d\h'-1'\(ga
126 .    ds D- D\h'-1'\(hy
127 .    ds th \o'bp'
128 .    ds Th \o'LP'
129 .    ds ae ae
130 .    ds Ae AE
131 .\}
132 .rm #[ #] #H #V #F C
133 .\" ========================================================================
134 .\"
135 .IX Title "GDBINT 7"
136 .TH GDBINT 7 "2015-04-03" "perl v5.18.4" "DragonFly Miscellaneous Information Manual"
137 .\" For nroff, turn off justification.  Always turn off hyphenation; it makes
138 .\" way too many mistakes in technical documents.
139 .if n .ad l
140 .nh
141 .SH "NAME"
142 GNU Debugger Internals \- Conversion of gdbint.info
143 .SH "Scope of this Document"
144 .IX Header "Scope of this Document"
145 This document documents the internals of the \s-1GNU\s0 debugger, \s-1GDB. \s0 It
146 includes description of \s-1GDB\s0's key algorithms and operations, as well as
147 the mechanisms that adapt \s-1GDB\s0 to specific hosts and targets.
148 .PP
149 * Menu:
150 .PP
151 See also \*(L"Summary\*(R"
152 .PP
153 See also \*(L"Overall Structure\*(R"
154 .PP
155 See also \*(L"Algorithms\*(R"
156 .PP
157 See also \*(L"User Interface\*(R"
158 .PP
159 See also \*(L"libgdb\*(R"
160 .PP
161 See also \*(L"Values\*(R"
162 .PP
163 See also \*(L"Stack Frames\*(R"
164 .PP
165 See also \*(L"Symbol Handling\*(R"
166 .PP
167 See also \*(L"Language Support\*(R"
168 .PP
169 See also \*(L"Host Definition\*(R"
170 .PP
171 See also \*(L"Target Architecture Definition\*(R"
172 .PP
173 See also \*(L"Target Descriptions\*(R"
174 .PP
175 See also \*(L"Target Vector Definition\*(R"
176 .PP
177 See also \*(L"Native Debugging\*(R"
178 .PP
179 See also \*(L"Support Libraries\*(R"
180 .PP
181 See also \*(L"Coding Standards\*(R"
182 .PP
183 See also \*(L"Misc Guidelines\*(R"
184 .PP
185 See also \*(L"Porting \s-1GDB\*(R"\s0
186 .PP
187 See also \*(L"Versions and Branches\*(R"
188 .PP
189 See also \*(L"Start of New Year Procedure\*(R"
190 .PP
191 See also \*(L"Releasing \s-1GDB\*(R"\s0
192 .PP
193 See also \*(L"Testsuite\*(R"
194 .PP
195 See also \*(L"Hints\*(R"
196 .PP
197 \&\s-1GDB\s0 Currently available observers: see \*(L"\s-1GDB\s0 Observers\*(R"
198 .PP
199 The license for this documentation: see \*(L"\s-1GNU\s0 Free Documentation License\*(R"
200 .PP
201 See also \*(L"Concept Index\*(R"
202 .PP
203 See also \*(L"Function and Variable Index\*(R"
204 .SS "1 Summary"
205 .IX Subsection "1 Summary"
206 * Menu:
207 .PP
208 See also \*(L"Requirements\*(R"
209 .PP
210 See also \*(L"Contributors\*(R"
211 .PP
212 \&\fB1.1 Requirements\fR
213 .PP
214 Before diving into the internals, you should understand the formal
215 requirements and other expectations for \s-1GDB. \s0 Although some of these
216 may seem obvious, there have been proposals for \s-1GDB\s0 that have run
217 counter to these requirements.
218 .PP
219 First of all, \s-1GDB\s0 is a debugger.  It's not designed to be a front
220 panel for embedded systems.  It's not a text editor.  It's not a shell.
221 It's not a programming environment.
222 .PP
223 \&\s-1GDB\s0 is an interactive tool.  Although a batch mode is available,
224 \&\s-1GDB\s0's primary role is to interact with a human programmer.
225 .PP
226 \&\s-1GDB\s0 should be responsive to the user.  A programmer hot on the trail
227 of a nasty bug, and operating under a looming deadline, is going to be
228 very impatient of everything, including the response time to debugger
229 commands.
230 .PP
231 \&\s-1GDB\s0 should be relatively permissive, such as for expressions.  While
232 the compiler should be picky (or have the option to be made picky),
233 since source code lives for a long time usually, the programmer doing
234 debugging shouldn't be spending time figuring out to mollify the
235 debugger.
236 .PP
237 \&\s-1GDB\s0 will be called upon to deal with really large programs.
238 Executable sizes of 50 to 100 megabytes occur regularly, and we've
239 heard reports of programs approaching 1 gigabyte in size.
240 .PP
241 \&\s-1GDB\s0 should be able to run everywhere.  No other debugger is
242 available for even half as many configurations as \s-1GDB\s0 supports.
243 .PP
244 \&\fB1.2 Contributors\fR
245 .PP
246 The first edition of this document was written by John Gilmore of
247 Cygnus Solutions. The current second edition was written by Stan Shebs
248 of Cygnus Solutions, who continues to update the manual.
249 .PP
250 Over the years, many others have made additions and changes to this
251 document. This section attempts to record the significant contributors
252 to that effort. One of the virtues of free software is that everyone is
253 free to contribute to it; with regret, we cannot actually acknowledge
254 everyone here.
255 .PP
256 _Plea:_ This section has only been added relatively recently (four
257 years after publication of the second edition). Additions to this
258 section are particularly welcome.  If you or your friends (or
259 enemies, to be evenhanded) have been unfairly omitted from this
260 list, we would like to add your names!
261 .PP
262 A document such as this relies on being kept up to date by numerous
263 small updates by contributing engineers as they make changes to the
264 code base. The file `\fBChangeLog\fR' in the \s-1GDB\s0 distribution approximates a
265 blow-by-blow account. The most prolific contributors to this important,
266 but low profile task are Andrew Cagney (responsible for over half the
267 entries), Daniel Jacobowitz, Mark Kettenis, Jim Blandy and Eli
268 Zaretskii.
269 .PP
270 Eli Zaretskii and Daniel Jacobowitz wrote the sections documenting
271 watchpoints.
272 .PP
273 Jeremy Bennett updated the sections on initializing a new
274 architecture and register representation, and added the section on
275 Frame Interpretation.
276 .SS "2 Overall Structure"
277 .IX Subsection "2 Overall Structure"
278 \&\s-1GDB\s0 consists of three major subsystems: user interface, symbol handling
279 (the \*(L"symbol side\*(R"), and target system handling (the \*(L"target side\*(R").
280 .PP
281 The user interface consists of several actual interfaces, plus
282 supporting code.
283 .PP
284 The symbol side consists of object file readers, debugging info
285 interpreters, symbol table management, source language expression
286 parsing, type and value printing.
287 .PP
288 The target side consists of execution control, stack frame analysis,
289 and physical target manipulation.
290 .PP
291 The target side/symbol side division is not formal, and there are a
292 number of exceptions.  For instance, core file support involves symbolic
293 elements (the basic core file reader is in \s-1BFD\s0) and target elements (it
294 supplies the contents of memory and the values of registers).  Instead,
295 this division is useful for understanding how the minor subsystems
296 should fit together.
297 .PP
298 2.1 The Symbol Side
299 ===================
300 .PP
301 The symbolic side of \s-1GDB\s0 can be thought of as \*(L"everything you can do in
302 \&\s-1GDB\s0 without having a live program running\*(R".  For instance, you can look
303 at the types of variables, and evaluate many kinds of expressions.
304 .PP
305 2.2 The Target Side
306 ===================
307 .PP
308 The target side of \s-1GDB\s0 is the \*(L"bits and bytes manipulator\*(R".  Although
309 it may make reference to symbolic info here and there, most of the
310 target side will run with only a stripped executable available\*(--or even
311 no executable at all, in remote debugging cases.
312 .PP
313 Operations such as disassembly, stack frame crawls, and register
314 display, are able to work with no symbolic info at all.  In some cases,
315 such as disassembly, \s-1GDB\s0 will use symbolic info to present addresses
316 relative to symbols rather than as raw numbers, but it will work either
317 way.
318 .PP
319 2.3 Configurations
320 ==================
321 .PP
322 \&\*(L"Host\*(R" refers to attributes of the system where \s-1GDB\s0 runs.  \*(L"Target\*(R"
323 refers to the system where the program being debugged executes.  In
324 most cases they are the same machine, in which case a third type of
325 \&\*(L"Native\*(R" attributes come into play.
326 .PP
327 Defines and include files needed to build on the host are host
328 support.  Examples are tty support, system defined types, host byte
329 order, host float format.  These are all calculated by `\fBautoconf\fR' when
330 the debugger is built.
331 .PP
332 Defines and information needed to handle the target format are target
333 dependent.  Examples are the stack frame format, instruction set,
334 breakpoint instruction, registers, and how to set up and tear down the
335 stack to call a function.
336 .PP
337 Information that is only needed when the host and target are the
338 same, is native dependent.  One example is Unix child process support;
339 if the host and target are not the same, calling `\fBfork\fR' to start the
340 target process is a bad idea.  The various macros needed for finding the
341 registers in the `\fBupage\fR', running `\fBptrace\fR', and such are all in the
342 native-dependent files.
343 .PP
344 Another example of native-dependent code is support for features that
345 are really part of the target environment, but which require `\fB#include\fR'
346 files that are only available on the host system.  Core file handling
347 and `\fBsetjmp\fR' handling are two common cases.
348 .PP
349 When you want to make \s-1GDB\s0 work as the traditional native debugger on
350 a system, you will need to supply both target and native information.
351 .PP
352 2.4 Source Tree Structure
353 =========================
354 .PP
355 The \s-1GDB\s0 source directory has a mostly flat structure\*(--there are only a
356 few subdirectories.  A file's name usually gives a hint as to what it
357 does; for example, `\fBstabsread.c\fR' reads stabs, `\fBdwarf2read.c\fR' reads
358 \&\s-1DWARF 2,\s0 etc.
359 .PP
360 Files that are related to some common task have names that share
361 common substrings.  For example, `\fB*\-thread.c\fR' files deal with debugging
362 threads on various platforms; `\fB*read.c\fR' files deal with reading various
363 kinds of symbol and object files; `\fBinf*.c\fR' files deal with direct
364 control of the \*(L"inferior program\*(R" (\s-1GDB\s0 parlance for the program being
365 debugged).
366 .PP
367 There are several dozens of files in the `\fB*\-tdep.c\fR' family.  `\fBtdep\fR'
368 stands for \*(L"target-dependent code\*(R"\-\-each of these files implements
369 debug support for a specific target architecture (sparc, mips, etc).
370 Usually, only one of these will be used in a specific \s-1GDB\s0 configuration
371 (sometimes two, closely related).
372 .PP
373 Similarly, there are many `\fB*\-nat.c\fR' files, each one for native
374 debugging on a specific system (e.g., `\fBsparc\-linux\-nat.c\fR' is for native
375 debugging of Sparc machines running the Linux kernel).
376 .PP
377 The few subdirectories of the source tree are:
378 .PP
379 `\fBcli\fR'
380 Code that implements \*(L"\s-1CLI\*(R",\s0 the \s-1GDB\s0 Command-Line Interpreter.
381 *Note Command Interpreter: User Interface.
382 .PP
383 `\fBgdbserver\fR'
384 Code for the \s-1GDB\s0 remote server.
385 .PP
386 `\fBgdbtk\fR'
387 Code for Insight, the \s-1GDB\s0 TK-based \s-1GUI\s0 front-end.
388 .PP
389 `\fBmi\fR'
390 The \*(L"\s-1GDB/MI\*(R",\s0 the \s-1GDB\s0 Machine Interface interpreter.
391 .PP
392 `\fBsignals\fR'
393 Target signal translation code.
394 .PP
395 `\fBtui\fR'
396 Code for \*(L"\s-1TUI\*(R",\s0 the \s-1GDB\s0 Text-mode full-screen User Interface.
397 *Note \s-1TUI:\s0 User Interface.
398 .SS "3 Algorithms"
399 .IX Subsection "3 Algorithms"
400 \&\s-1GDB\s0 uses a number of debugging-specific algorithms.  They are often not
401 very complicated, but get lost in the thicket of special cases and
402 real-world issues.  This chapter describes the basic algorithms and
403 mentions some of the specific target definitions that they use.
404 .PP
405 3.1 Prologue Analysis
406 =====================
407 .PP
408 To produce a backtrace and allow the user to manipulate older frames'
409 variables and arguments, \s-1GDB\s0 needs to find the base addresses of older
410 frames, and discover where those frames' registers have been saved.
411 Since a frame's \*(L"callee-saves\*(R" registers get saved by younger frames if
412 and when they're reused, a frame's registers may be scattered
413 unpredictably across younger frames.  This means that changing the
414 value of a register-allocated variable in an older frame may actually
415 entail writing to a save slot in some younger frame.
416 .PP
417 Modern versions of \s-1GCC\s0 emit Dwarf call frame information (\*(L"\s-1CFI\*(R"\s0),
418 which describes how to find frame base addresses and saved registers.
419 But \s-1CFI\s0 is not always available, so as a fallback \s-1GDB\s0 uses a technique
420 called \*(L"prologue analysis\*(R" to find frame sizes and saved registers.  A
421 prologue analyzer disassembles the function's machine code starting
422 from its entry point, and looks for instructions that allocate frame
423 space, save the stack pointer in a frame pointer register, save
424 registers, and so on.  Obviously, this can't be done accurately in
425 general, but it's tractable to do well enough to be very helpful.
426 Prologue analysis predates the \s-1GNU\s0 toolchain's support for \s-1CFI\s0; at one
427 time, prologue analysis was the only mechanism \s-1GDB\s0 used for stack
428 unwinding at all, when the function calling conventions didn't specify
429 a fixed frame layout.
430 .PP
431 In the olden days, function prologues were generated by hand-written,
432 target-specific code in \s-1GCC,\s0 and treated as opaque and untouchable by
433 optimizers.  Looking at this code, it was usually straightforward to
434 write a prologue analyzer for \s-1GDB\s0 that would accurately understand all
435 the prologues \s-1GCC\s0 would generate.  However, over time \s-1GCC\s0 became more
436 aggressive about instruction scheduling, and began to understand more
437 about the semantics of the prologue instructions themselves; in
438 response, \s-1GDB\s0's analyzers became more complex and fragile.  Keeping the
439 prologue analyzers working as \s-1GCC \s0(and the instruction sets themselves)
440 evolved became a substantial task.
441 .PP
442 To try to address this problem, the code in `\fBprologue\-value.h\fR' and
443 `\fBprologue\-value.c\fR' provides a general framework for writing prologue
444 analyzers that are simpler and more robust than ad-hoc analyzers.  When
445 we analyze a prologue using the prologue-value framework, we're really
446 doing \*(L"abstract interpretation\*(R" or \*(L"pseudo-evaluation\*(R": running the
447 function's code in simulation, but using conservative approximations of
448 the values registers and memory would hold when the code actually runs.
449 For example, if our function starts with the instruction:
450 .PP
451 addi r1, 42     # add 42 to r1
452 we don't know exactly what value will be in `\fBr1\fR' after executing
453 this instruction, but we do know it'll be 42 greater than its original
454 value.
455 .PP
456 If we then see an instruction like:
457 .PP
458 addi r1, 22     # add 22 to r1
459 we still don't know what `\fBr1\fR's' value is, but again, we can say it
460 is now 64 greater than its original value.
461 .PP
462 If the next instruction were:
463 .PP
464 mov r2, r1      # set r2 to r1's value
465 then we can say that `\fBr2\fR's' value is now the original value of `\fBr1\fR'
466 plus 64.
467 .PP
468 It's common for prologues to save registers on the stack, so we'll
469 need to track the values of stack frame slots, as well as the
470 registers.  So after an instruction like this:
471 .PP
472 mov (fp+4), r2
473 then we'd know that the stack slot four bytes above the frame pointer
474 holds the original value of `\fBr1\fR' plus 64.
475 .PP
476 And so on.
477 .PP
478 Of course, this can only go so far before it gets unreasonable.  If
479 we wanted to be able to say anything about the value of `\fBr1\fR' after the
480 instruction:
481 .PP
482 xor r1, r3      # exclusive-or r1 and r3, place result in r1
483 then things would get pretty complex.  But remember, we're just doing
484 a conservative approximation; if exclusive-or instructions aren't
485 relevant to prologues, we can just say `\fBr1\fR''s value is now \*(L"unknown\*(R".
486 We can ignore things that are too complex, if that loss of information
487 is acceptable for our application.
488 .PP
489 So when we say \*(L"conservative approximation\*(R" here, what we mean is an
490 approximation that is either accurate, or marked \*(L"unknown\*(R", but never
491 inaccurate.
492 .PP
493 Using this framework, a prologue analyzer is simply an interpreter
494 for machine code, but one that uses conservative approximations for the
495 contents of registers and memory instead of actual values.  Starting
496 from the function's entry point, you simulate instructions up to the
497 current \s-1PC,\s0 or an instruction that you don't know how to simulate.  Now
498 you can examine the state of the registers and stack slots you've kept
499 track of.
500 .PP
501 * To see how large your stack frame is, just check the value of the
502 stack pointer register; if it's the original value of the \s-1SP\s0 minus
503 a constant, then that constant is the stack frame's size.  If the
504 \&\s-1SP\s0's value has been marked as \*(L"unknown\*(R", then that means the
505 prologue has done something too complex for us to track, and we
506 don't know the frame size.
507 .PP
508 * To see where we've saved the previous frame's registers, we just
509 search the values we've tracked \*(-- stack slots, usually, but
510 registers, too, if you want \*(-- for something equal to the
511 register's original value.  If the calling conventions suggest a
512 standard place to save a given register, then we can check there
513 first, but really, anything that will get us back the original
514 value will probably work.
515 .PP
516 This does take some work.  But prologue analyzers aren't
517 quick-and-simple pattern patching to recognize a few fixed prologue
518 forms any more; they're big, hairy functions.  Along with inferior
519 function calls, prologue analysis accounts for a substantial portion of
520 the time needed to stabilize a \s-1GDB\s0 port.  So it's worthwhile to look
521 for an approach that will be easier to understand and maintain.  In the
522 approach described above:
523 .PP
524 It's easier to see that the analyzer is correct: see \*(L"you just see\*(R"
525 .PP
526 whether the analyzer properly (albeit conservatively) simulates
527 the effect of each instruction.
528 .PP
529 It's easier to extend the analyzer: see \*(L"you can add support for new\*(R"
530 .PP
531 instructions, and know that you haven't broken anything that
532 wasn't already broken before.
533 .PP
534 It's orthogonal: see \*(L"to gather new information, you don't need to\*(R"
535 .PP
536 complicate the code for each instruction.  As long as your domain
537 of conservative values is already detailed enough to tell you what
538 you need, then all the existing instruction simulations are
539 already gathering the right data for you.
540 .PP
541 The file `\fBprologue\-value.h\fR' contains detailed comments explaining
542 the framework and how to use it.
543 .PP
544 3.2 Breakpoint Handling
545 =======================
546 .PP
547 In general, a breakpoint is a user-designated location in the program
548 where the user wants to regain control if program execution ever reaches
549 that location.
550 .PP
551 There are two main ways to implement breakpoints; either as
552 \&\*(L"hardware\*(R" breakpoints or as \*(L"software\*(R" breakpoints.
553 .PP
554 Hardware breakpoints are sometimes available as a builtin debugging
555 features with some chips.  Typically these work by having dedicated
556 register into which the breakpoint address may be stored.  If the \s-1PC
557 \&\s0(shorthand for \*(L"program counter\*(R") ever matches a value in a breakpoint
558 registers, the \s-1CPU\s0 raises an exception and reports it to \s-1GDB.\s0
559 .PP
560 Another possibility is when an emulator is in use; many emulators
561 include circuitry that watches the address lines coming out from the
562 processor, and force it to stop if the address matches a breakpoint's
563 address.
564 .PP
565 A third possibility is that the target already has the ability to do
566 breakpoints somehow; for instance, a \s-1ROM\s0 monitor may do its own
567 software breakpoints.  So although these are not literally \*(L"hardware
568 breakpoints\*(R", from \s-1GDB\s0's point of view they work the same; \s-1GDB\s0 need not
569 do anything more than set the breakpoint and wait for something to
570 happen.
571 .PP
572 Since they depend on hardware resources, hardware breakpoints may be
573 limited in number; when the user asks for more, \s-1GDB\s0 will start trying
574 to set software breakpoints.  (On some architectures, notably the
575 32\-bit x86 platforms, \s-1GDB\s0 cannot always know whether there's enough
576 hardware resources to insert all the hardware breakpoints and
577 watchpoints.  On those platforms, \s-1GDB\s0 prints an error message only when
578 the program being debugged is continued.)
579 .PP
580 Software breakpoints require \s-1GDB\s0 to do somewhat more work.  The
581 basic theory is that \s-1GDB\s0 will replace a program instruction with a
582 trap, illegal divide, or some other instruction that will cause an
583 exception, and then when it's encountered, \s-1GDB\s0 will take the exception
584 and stop the program.  When the user says to continue, \s-1GDB\s0 will restore
585 the original instruction, single-step, re-insert the trap, and continue
586 on.
587 .PP
588 Since it literally overwrites the program being tested, the program
589 area must be writable, so this technique won't work on programs in \s-1ROM.\s0
590 It can also distort the behavior of programs that examine themselves,
591 although such a situation would be highly unusual.
592 .PP
593 Also, the software breakpoint instruction should be the smallest
594 size of instruction, so it doesn't overwrite an instruction that might
595 be a jump target, and cause disaster when the program jumps into the
596 middle of the breakpoint instruction.  (Strictly speaking, the
597 breakpoint must be no larger than the smallest interval between
598 instructions that may be jump targets; perhaps there is an architecture
599 where only even-numbered instructions may jumped to.)  Note that it's
600 possible for an instruction set not to have any instructions usable for
601 a software breakpoint, although in practice only the \s-1ARC\s0 has failed to
602 define such an instruction.
603 .PP
604 Basic breakpoint object handling is in `\fBbreakpoint.c\fR'.  However,
605 much of the interesting breakpoint action is in `\fBinfrun.c\fR'.
606 .PP
607 `\fBtarget_remove_breakpoint (\s-1BP_TGT\s0)\fR'
608 `\fBtarget_insert_breakpoint (\s-1BP_TGT\s0)\fR'
609 Insert or remove a software breakpoint at address
610 `\fB\s-1BP_TGT\-\s0>placed_address\fR'.  Returns zero for success, non-zero for
611 failure.  On input, \s-1BP_TGT\s0 contains the address of the breakpoint,
612 and is otherwise initialized to zero.  The fields of the `struct
613 bp_target_info' pointed to by \s-1BP_TGT\s0 are updated to contain other
614 information about the breakpoint on output.  The field
615 `\fBplaced_address\fR' may be updated if the breakpoint was placed at a
616 related address; the field `\fBshadow_contents\fR' contains the real
617 contents of the bytes where the breakpoint has been inserted, if
618 reading memory would return the breakpoint instead of the
619 underlying memory; the field `\fBshadow_len\fR' is the length of memory
620 cached in `\fBshadow_contents\fR', if any; and the field `\fBplaced_size\fR'
621 is optionally set and used by the target, if it could differ from
622 `\fBshadow_len\fR'.
623 .PP
624 For example, the remote target `\fBZ0\fR' packet does not require
625 shadowing memory, so `\fBshadow_len\fR' is left at zero.  However, the
626 length reported by `\fBgdbarch_breakpoint_from_pc\fR' is cached in
627 `\fBplaced_size\fR', so that a matching `\fBz0\fR' packet can be used to
628 remove the breakpoint.
629 .PP
630 `\fBtarget_remove_hw_breakpoint (\s-1BP_TGT\s0)\fR'
631 `\fBtarget_insert_hw_breakpoint (\s-1BP_TGT\s0)\fR'
632 Insert or remove a hardware-assisted breakpoint at address
633 `\fB\s-1BP_TGT\-\s0>placed_address\fR'.  Returns zero for success, non-zero for
634 failure.  See `\fBtarget_insert_breakpoint\fR' for a description of the
635 `\fBstruct bp_target_info\fR' pointed to by \s-1BP_TGT\s0; the
636 `\fBshadow_contents\fR' and `\fBshadow_len\fR' members are not used for
637 hardware breakpoints, but `\fBplaced_size\fR' may be.
638 .PP
639 3.3 Single Stepping
640 ===================
641 .PP
642 3.4 Signal Handling
643 ===================
644 .PP
645 3.5 Thread Handling
646 ===================
647 .PP
648 3.6 Inferior Function Calls
649 ===========================
650 .PP
651 3.7 Longjmp Support
652 ===================
653 .PP
654 \&\s-1GDB\s0 has support for figuring out that the target is doing a `\fBlongjmp\fR'
655 and for stopping at the target of the jump, if we are stepping.  This
656 is done with a few specialized internal breakpoints, which are visible
657 in the output of the `\fBmaint info breakpoint\fR' command.
658 .PP
659 To make this work, you need to define a function called
660 `\fBgdbarch_get_longjmp_target\fR', which will examine the `\fBjmp_buf\fR'
661 structure and extract the `\fBlongjmp\fR' target address.  Since `\fBjmp_buf\fR' is
662 target specific and typically defined in a target header not available
663 to \s-1GDB,\s0 you will need to determine the offset of the \s-1PC\s0 manually and
664 return that; many targets define a `\fBjb_pc_offset\fR' field in the tdep
665 structure to save the value once calculated.
666 .PP
667 3.8 Watchpoints
668 ===============
669 .PP
670 Watchpoints are a special kind of breakpoints (*note breakpoints:
671 Algorithms.) which break when data is accessed rather than when some
672 instruction is executed.  When you have data which changes without your
673 knowing what code does that, watchpoints are the silver bullet to hunt
674 down and kill such bugs.
675 .PP
676 Watchpoints can be either hardware-assisted or not; the latter type
677 is known as \*(L"software watchpoints.\*(R"  \s-1GDB\s0 always uses hardware-assisted
678 watchpoints if they are available, and falls back on software
679 watchpoints otherwise.  Typical situations where \s-1GDB\s0 will use software
680 watchpoints are:
681 .PP
682 * The watched memory region is too large for the underlying hardware
683 watchpoint support.  For example, each x86 debug register can
684 watch up to 4 bytes of memory, so trying to watch data structures
685 whose size is more than 16 bytes will cause \s-1GDB\s0 to use software
686 watchpoints.
687 .PP
688 * The value of the expression to be watched depends on data held in
689 registers (as opposed to memory).
690 .PP
691 * Too many different watchpoints requested.  (On some architectures,
692 this situation is impossible to detect until the debugged program
693 is resumed.)  Note that x86 debug registers are used both for
694 hardware breakpoints and for watchpoints, so setting too many
695 hardware breakpoints might cause watchpoint insertion to fail.
696 .PP
697 * No hardware-assisted watchpoints provided by the target
698 implementation.
699 .PP
700 Software watchpoints are very slow, since \s-1GDB\s0 needs to single-step
701 the program being debugged and test the value of the watched
702 expression(s) after each instruction.  The rest of this section is
703 mostly irrelevant for software watchpoints.
704 .PP
705 When the inferior stops, \s-1GDB\s0 tries to establish, among other
706 possible reasons, whether it stopped due to a watchpoint being hit.  It
707 first uses `\fB\s-1STOPPED_BY_WATCHPOINT\s0\fR' to see if any watchpoint was hit.
708 If not, all watchpoint checking is skipped.
709 .PP
710 Then \s-1GDB\s0 calls `\fBtarget_stopped_data_address\fR' exactly once.  This
711 method returns the address of the watchpoint which triggered, if the
712 target can determine it.  If the triggered address is available, \s-1GDB\s0
713 compares the address returned by this method with each watched memory
714 address in each active watchpoint.  For data-read and data-access
715 watchpoints, \s-1GDB\s0 announces every watchpoint that watches the triggered
716 address as being hit.  For this reason, data-read and data-access
717 watchpoints _require_ that the triggered address be available; if not,
718 read and access watchpoints will never be considered hit.  For
719 data-write watchpoints, if the triggered address is available, \s-1GDB\s0
720 considers only those watchpoints which match that address; otherwise,
721 \&\s-1GDB\s0 considers all data-write watchpoints.  For each data-write
722 watchpoint that \s-1GDB\s0 considers, it evaluates the expression whose value
723 is being watched, and tests whether the watched value has changed.
724 Watchpoints whose watched values have changed are announced as hit.
725 .PP
726 \&\s-1GDB\s0 uses several macros and primitives to support hardware
727 watchpoints:
728 .PP
729 `\fB\s-1TARGET_CAN_USE_HARDWARE_WATCHPOINT \s0(\s-1TYPE, COUNT, OTHER\s0)\fR'
730 Return the number of hardware watchpoints of type \s-1TYPE\s0 that are
731 possible to be set.  The value is positive if \s-1COUNT\s0 watchpoints of
732 this type can be set, zero if setting watchpoints of this type is
733 not supported, and negative if \s-1COUNT\s0 is more than the maximum
734 number of watchpoints of type \s-1TYPE\s0 that can be set.  \s-1OTHER\s0 is
735 non-zero if other types of watchpoints are currently enabled (there
736 are architectures which cannot set watchpoints of different types
737 at the same time).
738 .PP
739 `\fB\s-1TARGET_REGION_OK_FOR_HW_WATCHPOINT \s0(\s-1ADDR, LEN\s0)\fR'
740 Return non-zero if hardware watchpoints can be used to watch a
741 region whose address is \s-1ADDR\s0 and whose length in bytes is \s-1LEN.\s0
742 .PP
743 `\fBtarget_insert_watchpoint (\s-1ADDR, LEN, TYPE\s0)\fR'
744 `\fBtarget_remove_watchpoint (\s-1ADDR, LEN, TYPE\s0)\fR'
745 Insert or remove a hardware watchpoint starting at \s-1ADDR,\s0 for \s-1LEN\s0
746 bytes.  \s-1TYPE\s0 is the watchpoint type, one of the possible values of
747 the enumerated data type `\fBtarget_hw_bp_type\fR', defined by
748 `\fBbreakpoint.h\fR' as follows:
749 .PP
750 enum target_hw_bp_type
751 {
752 hw_write   = 0, /* Common (write) \s-1HW\s0 watchpoint */
753 hw_read    = 1, /* Read    \s-1HW\s0 watchpoint */
754 hw_access  = 2, /* Access (read or write) \s-1HW\s0 watchpoint */
755 hw_execute = 3  /* Execute \s-1HW\s0 breakpoint */
756 };
757 .PP
758 These two macros should return 0 for success, non-zero for failure.
759 .PP
760 `\fBtarget_stopped_data_address (\s-1ADDR_P\s0)\fR'
761 If the inferior has some watchpoint that triggered, place the
762 address associated with the watchpoint at the location pointed to
763 by \s-1ADDR_P\s0 and return non-zero.  Otherwise, return zero.  This is
764 required for data-read and data-access watchpoints.  It is not
765 required for data-write watchpoints, but \s-1GDB\s0 uses it to improve
766 handling of those also.
767 .PP
768 \&\s-1GDB\s0 will only call this method once per watchpoint stop,
769 immediately after calling `\fB\s-1STOPPED_BY_WATCHPOINT\s0\fR'.  If the
770 target's watchpoint indication is sticky, i.e., stays set after
771 resuming, this method should clear it.  For instance, the x86 debug
772 control register has sticky triggered flags.
773 .PP
774 `\fBtarget_watchpoint_addr_within_range (\s-1TARGET, ADDR, START, LENGTH\s0)\fR'
775 Check whether \s-1ADDR \s0(as returned by `\fBtarget_stopped_data_address\fR')
776 lies within the hardware-defined watchpoint region described by
777 \&\s-1START\s0 and \s-1LENGTH. \s0 This only needs to be provided if the
778 granularity of a watchpoint is greater than one byte, i.e., if the
779 watchpoint can also trigger on nearby addresses outside of the
780 watched region.
781 .PP
782 `\fB\s-1HAVE_STEPPABLE_WATCHPOINT\s0\fR'
783 If defined to a non-zero value, it is not necessary to disable a
784 watchpoint to step over it.  Like
785 `\fBgdbarch_have_nonsteppable_watchpoint\fR', this is usually set when
786 watchpoints trigger at the instruction which will perform an
787 interesting read or write.  It should be set if there is a
788 temporary disable bit which allows the processor to step over the
789 interesting instruction without raising the watchpoint exception
790 again.
791 .PP
792 `\fBint gdbarch_have_nonsteppable_watchpoint (\s-1GDBARCH\s0)\fR'
793 If it returns a non-zero value, \s-1GDB\s0 should disable a watchpoint to
794 step the inferior over it.  This is usually set when watchpoints
795 trigger at the instruction which will perform an interesting read
796 or write.
797 .PP
798 `\fB\s-1HAVE_CONTINUABLE_WATCHPOINT\s0\fR'
799 If defined to a non-zero value, it is possible to continue the
800 inferior after a watchpoint has been hit.  This is usually set
801 when watchpoints trigger at the instruction following an
802 interesting read or write.
803 .PP
804 `\fB\s-1STOPPED_BY_WATCHPOINT \s0(\s-1WAIT_STATUS\s0)\fR'
805 Return non-zero if stopped by a watchpoint.  \s-1WAIT_STATUS\s0 is of the
806 type `\fBstruct target_waitstatus\fR', defined by `\fBtarget.h\fR'.  Normally,
807 this macro is defined to invoke the function pointed to by the
808 `\fBto_stopped_by_watchpoint\fR' member of the structure (of the type
809 `\fBtarget_ops\fR', defined on `\fBtarget.h\fR') that describes the
810 target-specific operations; `\fBto_stopped_by_watchpoint\fR' ignores the
811 \&\s-1WAIT_STATUS\s0 argument.
812 .PP
813 \&\s-1GDB\s0 does not require the non-zero value returned by
814 `\fB\s-1STOPPED_BY_WATCHPOINT\s0\fR' to be 100% correct, so if a target cannot
815 determine for sure whether the inferior stopped due to a
816 watchpoint, it could return non-zero \*(L"just in case\*(R".
817 .PP
818 3.8.1 Watchpoints and Threads
819 \&\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
820 .PP
821 \&\s-1GDB\s0 only supports process-wide watchpoints, which trigger in all
822 threads.  \s-1GDB\s0 uses the thread \s-1ID\s0 to make watchpoints act as if they
823 were thread-specific, but it cannot set hardware watchpoints that only
824 trigger in a specific thread.  Therefore, even if the target supports
825 threads, per-thread debug registers, and watchpoints which only affect
826 a single thread, it should set the per-thread debug registers for all
827 threads to the same value.  On GNU/Linux native targets, this is
828 accomplished by using `\fB\s-1ALL_LWPS\s0\fR' in `\fBtarget_insert_watchpoint\fR' and
829 `\fBtarget_remove_watchpoint\fR' and by using `\fBlinux_set_new_thread\fR' to
830 register a handler for newly created threads.
831 .PP
832 \&\s-1GDB\s0's GNU/Linux support only reports a single event at a time,
833 although multiple events can trigger simultaneously for multi-threaded
834 programs.  When multiple events occur, `\fBlinux\-nat.c\fR' queues subsequent
835 events and returns them the next time the program is resumed.  This
836 means that `\fB\s-1STOPPED_BY_WATCHPOINT\s0\fR' and `\fBtarget_stopped_data_address\fR'
837 only need to consult the current thread's state\*(--the thread indicated
838 by `\fBinferior_ptid\fR'.  If two threads have hit watchpoints
839 simultaneously, those routines will be called a second time for the
840 second thread.
841 .PP
842 3.8.2 x86 Watchpoints
843 \&\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
844 .PP
845 The 32\-bit Intel x86 (a.k.a. ia32) processors feature special debug
846 registers designed to facilitate debugging.  \s-1GDB\s0 provides a generic
847 library of functions that x86\-based ports can use to implement support
848 for watchpoints and hardware-assisted breakpoints.  This subsection
849 documents the x86 watchpoint facilities in \s-1GDB.\s0
850 .PP
851 (At present, the library functions read and write debug registers
852 directly, and are thus only available for native configurations.)
853 .PP
854 To use the generic x86 watchpoint support, a port should do the
855 following:
856 .PP
857 * Define the macro `\fBI386_USE_GENERIC_WATCHPOINTS\fR' somewhere in the
858 target-dependent headers.
859 .PP
860 * Include the `\fBconfig/i386/nm\-i386.h\fR' header file _after_ defining
861 `\fBI386_USE_GENERIC_WATCHPOINTS\fR'.
862 .PP
863 * Add `\fBi386\-nat.o\fR' to the value of the Make variable `\fB\s-1NATDEPFILES\s0\fR'
864 (*note \s-1NATDEPFILES:\s0 Native Debugging.).
865 .PP
866 * Provide implementations for the `\fBI386_DR_LOW_*\fR' macros described
867 below.  Typically, each macro should call a target-specific
868 function which does the real work.
869 .PP
870 The x86 watchpoint support works by maintaining mirror images of the
871 debug registers.  Values are copied between the mirror images and the
872 real debug registers via a set of macros which each target needs to
873 provide:
874 .PP
875 `\fBI386_DR_LOW_SET_CONTROL (\s-1VAL\s0)\fR'
876 Set the Debug Control (\s-1DR7\s0) register to the value \s-1VAL.\s0
877 .PP
878 `\fBI386_DR_LOW_SET_ADDR (\s-1IDX, ADDR\s0)\fR'
879 Put the address \s-1ADDR\s0 into the debug register number \s-1IDX.\s0
880 .PP
881 `\fBI386_DR_LOW_RESET_ADDR (\s-1IDX\s0)\fR'
882 Reset (i.e. zero out) the address stored in the debug register
883 number \s-1IDX.\s0
884 .PP
885 `\fBI386_DR_LOW_GET_STATUS\fR'
886 Return the value of the Debug Status (\s-1DR6\s0) register.  This value is
887 used immediately after it is returned by `\fBI386_DR_LOW_GET_STATUS\fR',
888 so as to support per-thread status register values.
889 .PP
890 For each one of the 4 debug registers (whose indices are from 0 to 3)
891 that store addresses, a reference count is maintained by \s-1GDB,\s0 to allow
892 sharing of debug registers by several watchpoints.  This allows users
893 to define several watchpoints that watch the same expression, but with
894 different conditions and/or commands, without wasting debug registers
895 which are in short supply.  \s-1GDB\s0 maintains the reference counts
896 internally, targets don't have to do anything to use this feature.
897 .PP
898 The x86 debug registers can each watch a region that is 1, 2, or 4
899 bytes long.  The ia32 architecture requires that each watched region be
900 appropriately aligned: 2\-byte region on 2\-byte boundary, 4\-byte region
901 on 4\-byte boundary.  However, the x86 watchpoint support in \s-1GDB\s0 can
902 watch unaligned regions and regions larger than 4 bytes (up to 16
903 bytes) by allocating several debug registers to watch a single region.
904 This allocation of several registers per a watched region is also done
905 automatically without target code intervention.
906 .PP
907 The generic x86 watchpoint support provides the following \s-1API\s0 for the
908 \&\s-1GDB\s0's application code:
909 .PP
910 `\fBi386_region_ok_for_watchpoint (\s-1ADDR, LEN\s0)\fR'
911 The macro `\fB\s-1TARGET_REGION_OK_FOR_HW_WATCHPOINT\s0\fR' is set to call this
912 function.  It counts the number of debug registers required to
913 watch a given region, and returns a non-zero value if that number
914 is less than 4, the number of debug registers available to x86
915 processors.
916 .PP
917 `\fBi386_stopped_data_address (\s-1ADDR_P\s0)\fR'
918 The target function `\fBtarget_stopped_data_address\fR' is set to call
919 this function.  This function examines the breakpoint condition
920 bits in the \s-1DR6\s0 Debug Status register, as returned by the
921 `\fBI386_DR_LOW_GET_STATUS\fR' macro, and returns the address associated
922 with the first bit that is set in \s-1DR6.\s0
923 .PP
924 `\fBi386_stopped_by_watchpoint (void)\fR'
925 The macro `\fB\s-1STOPPED_BY_WATCHPOINT\s0\fR' is set to call this function.
926 The argument passed to `\fB\s-1STOPPED_BY_WATCHPOINT\s0\fR' is ignored.  This
927 function examines the breakpoint condition bits in the \s-1DR6\s0 Debug
928 Status register, as returned by the `\fBI386_DR_LOW_GET_STATUS\fR'
929 macro, and returns true if any bit is set.  Otherwise, false is
930 returned.
931 .PP
932 `\fBi386_insert_watchpoint (\s-1ADDR, LEN, TYPE\s0)\fR'
933 `\fBi386_remove_watchpoint (\s-1ADDR, LEN, TYPE\s0)\fR'
934 Insert or remove a watchpoint.  The macros
935 `\fBtarget_insert_watchpoint\fR' and `\fBtarget_remove_watchpoint\fR' are set
936 to call these functions.  `\fBi386_insert_watchpoint\fR' first looks for
937 a debug register which is already set to watch the same region for
938 the same access types; if found, it just increments the reference
939 count of that debug register, thus implementing debug register
940 sharing between watchpoints.  If no such register is found, the
941 function looks for a vacant debug register, sets its mirrored
942 value to \s-1ADDR,\s0 sets the mirrored value of \s-1DR7\s0 Debug Control
943 register as appropriate for the \s-1LEN\s0 and \s-1TYPE\s0 parameters, and then
944 passes the new values of the debug register and \s-1DR7\s0 to the
945 inferior by calling `\fBI386_DR_LOW_SET_ADDR\fR' and
946 `\fBI386_DR_LOW_SET_CONTROL\fR'.  If more than one debug register is
947 required to cover the given region, the above process is repeated
948 for each debug register.
949 .PP
950 `\fBi386_remove_watchpoint\fR' does the opposite: it resets the address
951 in the mirrored value of the debug register and its read/write and
952 length bits in the mirrored value of \s-1DR7,\s0 then passes these new
953 values to the inferior via `\fBI386_DR_LOW_RESET_ADDR\fR' and
954 `\fBI386_DR_LOW_SET_CONTROL\fR'.  If a register is shared by several
955 watchpoints, each time a `\fBi386_remove_watchpoint\fR' is called, it
956 decrements the reference count, and only calls
957 `\fBI386_DR_LOW_RESET_ADDR\fR' and `\fBI386_DR_LOW_SET_CONTROL\fR' when the
958 count goes to zero.
959 .PP
960 `\fBi386_insert_hw_breakpoint (\s-1BP_TGT\s0)\fR'
961 `\fBi386_remove_hw_breakpoint (\s-1BP_TGT\s0)\fR'
962 These functions insert and remove hardware-assisted breakpoints.
963 The macros `\fBtarget_insert_hw_breakpoint\fR' and
964 `\fBtarget_remove_hw_breakpoint\fR' are set to call these functions.
965 The argument is a `\fBstruct bp_target_info *\fR', as described in the
966 documentation for `\fBtarget_insert_breakpoint\fR'.  These functions
967 work like `\fBi386_insert_watchpoint\fR' and `\fBi386_remove_watchpoint\fR',
968 respectively, except that they set up the debug registers to watch
969 instruction execution, and each hardware-assisted breakpoint
970 always requires exactly one debug register.
971 .PP
972 `\fBi386_cleanup_dregs (void)\fR'
973 This function clears all the reference counts, addresses, and
974 control bits in the mirror images of the debug registers.  It
975 doesn't affect the actual debug registers in the inferior process.
976 .PP
977 *Notes:*
978 1. x86 processors support setting watchpoints on I/O reads or writes.
979 However, since no target supports this (as of March 2001), and
980 since `\fBenum target_hw_bp_type\fR' doesn't even have an enumeration
981 for I/O watchpoints, this feature is not yet available to \s-1GDB\s0
982 running on x86.
983 .PP
984 2. x86 processors can enable watchpoints locally, for the current task
985 only, or globally, for all the tasks.  For each debug register,
986 there's a bit in the \s-1DR7\s0 Debug Control register that determines
987 whether the associated address is watched locally or globally.  The
988 current implementation of x86 watchpoint support in \s-1GDB\s0 always
989 sets watchpoints to be locally enabled, since global watchpoints
990 might interfere with the underlying \s-1OS\s0 and are probably
991 unavailable in many platforms.
992 .PP
993 3.9 Checkpoints
994 ===============
995 .PP
996 In the abstract, a checkpoint is a point in the execution history of
997 the program, which the user may wish to return to at some later time.
998 .PP
999 Internally, a checkpoint is a saved copy of the program state,
1000 including whatever information is required in order to restore the
1001 program to that state at a later time.  This can be expected to include
1002 the state of registers and memory, and may include external state such
1003 as the state of open files and devices.
1004 .PP
1005 There are a number of ways in which checkpoints may be implemented
1006 in gdb, e.g. as corefiles, as forked processes, and as some opaque
1007 method implemented on the target side.
1008 .PP
1009 A corefile can be used to save an image of target memory and register
1010 state, which can in principle be restored later \*(-- but corefiles do not
1011 typically include information about external entities such as open
1012 files.  Currently this method is not implemented in gdb.
1013 .PP
1014 A forked process can save the state of user memory and registers, as
1015 well as some subset of external (kernel) state.  This method is used to
1016 implement checkpoints on Linux, and in principle might be used on other
1017 systems.
1018 .PP
1019 Some targets, e.g. simulators, might have their own built-in method
1020 for saving checkpoints, and gdb might be able to take advantage of that
1021 capability without necessarily knowing any details of how it is done.
1022 .PP
1023 3.10 Observing changes in \s-1GDB\s0 internals
1024 =======================================
1025 .PP
1026 In order to function properly, several modules need to be notified when
1027 some changes occur in the \s-1GDB\s0 internals.  Traditionally, these modules
1028 have relied on several paradigms, the most common ones being hooks and
1029 gdb-events.  Unfortunately, none of these paradigms was versatile
1030 enough to become the standard notification mechanism in \s-1GDB. \s0 The fact
1031 that they only supported one \*(L"client\*(R" was also a strong limitation.
1032 .PP
1033 A new paradigm, based on the Observer pattern of the `Design
1034 Patterns' book, has therefore been implemented.  The goal was to provide
1035 a new interface overcoming the issues with the notification mechanisms
1036 previously available.  This new interface needed to be strongly typed,
1037 easy to extend, and versatile enough to be used as the standard
1038 interface when adding new notifications.
1039 .PP
1040 See see \*(L"\s-1GDB\s0 Observers\*(R" for a brief description of the observers
1041 currently implemented in \s-1GDB.\s0 The rationale for the current
1042 implementation is also briefly discussed.
1043 .SS "4 User Interface"
1044 .IX Subsection "4 User Interface"
1045 \&\s-1GDB\s0 has several user interfaces, of which the traditional command-line
1046 interface is perhaps the most familiar.
1047 .PP
1048 4.1 Command Interpreter
1049 =======================
1050 .PP
1051 The command interpreter in \s-1GDB\s0 is fairly simple.  It is designed to
1052 allow for the set of commands to be augmented dynamically, and also has
1053 a recursive subcommand capability, where the first argument to a
1054 command may itself direct a lookup on a different command list.
1055 .PP
1056 For instance, the `\fBset\fR' command just starts a lookup on the
1057 `\fBsetlist\fR' command list, while `\fBset thread\fR' recurses to the
1058 `\fBset_thread_cmd_list\fR'.
1059 .PP
1060 To add commands in general, use `\fBadd_cmd\fR'.  `\fBadd_com\fR' adds to the
1061 main command list, and should be used for those commands.  The usual
1062 place to add commands is in the `\fB_initialize_XYZ\fR' routines at the ends
1063 of most source files.
1064 .PP
1065 To add paired `\fBset\fR' and `\fBshow\fR' commands, use `\fBadd_setshow_cmd\fR' or
1066 `\fBadd_setshow_cmd_full\fR'.  The former is a slightly simpler interface
1067 which is useful when you don't need to further modify the new command
1068 structures, while the latter returns the new command structures for
1069 manipulation.
1070 .PP
1071 Before removing commands from the command set it is a good idea to
1072 deprecate them for some time.  Use `\fBdeprecate_cmd\fR' on commands or
1073 aliases to set the deprecated flag.  `\fBdeprecate_cmd\fR' takes a `struct
1074 cmd_list_element' as it's first argument.  You can use the return value
1075 from `\fBadd_com\fR' or `\fBadd_cmd\fR' to deprecate the command immediately after
1076 it is created.
1077 .PP
1078 The first time a command is used the user will be warned and offered
1079 a replacement (if one exists). Note that the replacement string passed
1080 to `\fBdeprecate_cmd\fR' should be the full name of the command, i.e., the
1081 entire string the user should type at the command line.
1082 .PP
1083 4.2 UI-Independent Output\*(--the `\fBui_out\fR' Functions
1084 =================================================
1085 .PP
1086 The `\fBui_out\fR' functions present an abstraction level for the \s-1GDB\s0 output
1087 code.  They hide the specifics of different user interfaces supported
1088 by \s-1GDB,\s0 and thus free the programmer from the need to write several
1089 versions of the same code, one each for every \s-1UI,\s0 to produce output.
1090 .PP
1091 4.2.1 Overview and Terminology
1092 \&\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
1093 .PP
1094 In general, execution of each \s-1GDB\s0 command produces some sort of output,
1095 and can even generate an input request.
1096 .PP
1097 Output can be generated for the following purposes:
1098 .PP
1099 * to display a _result_ of an operation;
1100 .PP
1101 * to convey _info_ or produce side-effects of a requested operation;
1102 .PP
1103 * to provide a _notification_ of an asynchronous event (including
1104 progress indication of a prolonged asynchronous operation);
1105 .PP
1106 * to display _error messages_ (including warnings);
1107 .PP
1108 * to show _debug data_;
1109 .PP
1110 * to _query_ or prompt a user for input (a special case).
1111 .PP
1112 This section mainly concentrates on how to build result output,
1113 although some of it also applies to other kinds of output.
1114 .PP
1115 Generation of output that displays the results of an operation
1116 involves one or more of the following:
1117 .PP
1118 * output of the actual data
1119 .PP
1120 * formatting the output as appropriate for console output, to make it
1121 easily readable by humans
1122 .PP
1123 * machine oriented formatting-a more terse formatting to allow for
1124 easy parsing by programs which read \s-1GDB\s0's output
1125 .PP
1126 * annotation, whose purpose is to help legacy GUIs to identify
1127 interesting parts in the output
1128 .PP
1129 The `\fBui_out\fR' routines take care of the first three aspects.
1130 Annotations are provided by separate annotation routines.  Note that use
1131 of annotations for an interface between a \s-1GUI\s0 and \s-1GDB\s0 is deprecated.
1132 .PP
1133 Output can be in the form of a single item, which we call a \*(L"field\*(R";
1134 a \*(L"list\*(R" consisting of identical fields; a \*(L"tuple\*(R" consisting of
1135 non-identical fields; or a \*(L"table\*(R", which is a tuple consisting of a
1136 header and a body.  In a BNF-like form:
1137 .PP
1138 `\fB<table> ==>\fR'
1139 `\fB<header> <body>\fR'
1140 .PP
1141 `\fB<header> ==>\fR'
1142 `\fB{ <column> }\fR'
1143 .PP
1144 `\fB<column> ==>\fR'
1145 `\fB<width> <alignment> <title>\fR'
1146 .PP
1147 `\fB<body> ==>\fR'
1148 `\fB{<row>}\fR'
1149 .PP
1150 4.2.2 General Conventions
1151 \&\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
1152 .PP
1153 Most `\fBui_out\fR' routines are of type `\fBvoid\fR', the exceptions are
1154 `\fBui_out_stream_new\fR' (which returns a pointer to the newly created
1155 object) and the `\fBmake_cleanup\fR' routines.
1156 .PP
1157 The first parameter is always the `\fBui_out\fR' vector object, a pointer
1158 to a `\fBstruct ui_out\fR'.
1159 .PP
1160 The \s-1FORMAT\s0 parameter is like in `\fBprintf\fR' family of functions.  When
1161 it is present, there must also be a variable list of arguments
1162 sufficient used to satisfy the `\fB%\fR' specifiers in the supplied format.
1163 .PP
1164 When a character string argument is not used in a `\fBui_out\fR' function
1165 call, a `\fB\s-1NULL\s0\fR' pointer has to be supplied instead.
1166 .PP
1167 4.2.3 Table, Tuple and List Functions
1168 \&\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
1169 .PP
1170 This section introduces `\fBui_out\fR' routines for building lists, tuples
1171 and tables.  The routines to output the actual data items (fields) are
1172 presented in the next section.
1173 .PP
1174 To recap: A \*(L"tuple\*(R" is a sequence of \*(L"fields\*(R", each field containing
1175 information about an object; a \*(L"list\*(R" is a sequence of fields where
1176 each field describes an identical object.
1177 .PP
1178 Use the \*(L"table\*(R" functions when your output consists of a list of
1179 rows (tuples) and the console output should include a heading.  Use this
1180 even when you are listing just one object but you still want the header.
1181 .PP
1182 Tables can not be nested.  Tuples and lists can be nested up to a
1183 maximum of five levels.
1184 .PP
1185 The overall structure of the table output code is something like
1186 this:
1187 .PP
1188 ui_out_table_begin
1189 ui_out_table_header
1190 \&...
1191 ui_out_table_body
1192 ui_out_tuple_begin
1193 ui_out_field_*
1194 \&...
1195 ui_out_tuple_end
1196 \&...
1197 ui_out_table_end
1198 .PP
1199 Here is the description of table\-, tuple\- and list-related `\fBui_out\fR'
1200 functions:
1201 .PP
1202 \&\-\- Function: void ui_out_table_begin (struct ui_out *UIOUT, int
1203 \&\s-1NBROFCOLS,\s0 int \s-1NR_ROWS,\s0 const char *TBLID)
1204 The function `\fBui_out_table_begin\fR' marks the beginning of the output
1205 of a table.  It should always be called before any other `\fBui_out\fR'
1206 function for a given table.  \s-1NBROFCOLS\s0 is the number of columns in
1207 the table. \s-1NR_ROWS\s0 is the number of rows in the table.  \s-1TBLID\s0 is
1208 an optional string identifying the table.  The string pointed to
1209 by \s-1TBLID\s0 is copied by the implementation of `\fBui_out_table_begin\fR',
1210 so the application can free the string if it was `\fBmalloc\fR'ed.
1211 .PP
1212 The companion function `\fBui_out_table_end\fR', described below, marks
1213 the end of the table's output.
1214 .PP
1215 \&\-\- Function: void ui_out_table_header (struct ui_out *UIOUT, int
1216 \&\s-1WIDTH,\s0 enum ui_align \s-1ALIGNMENT,\s0 const char *COLHDR)
1217 `\fBui_out_table_header\fR' provides the header information for a single
1218 table column.  You call this function several times, one each for
1219 every column of the table, after `\fBui_out_table_begin\fR', but before
1220 `\fBui_out_table_body\fR'.
1221 .PP
1222 The value of \s-1WIDTH\s0 gives the column width in characters.  The
1223 value of \s-1ALIGNMENT\s0 is one of `\fBleft\fR', `\fBcenter\fR', and `\fBright\fR', and it
1224 specifies how to align the header: left-justify, center, or
1225 right-justify it.  \s-1COLHDR\s0 points to a string that specifies the
1226 column header; the implementation copies that string, so column
1227 header strings in `\fBmalloc\fR'ed storage can be freed after the call.
1228 .PP
1229 \&\-\- Function: void ui_out_table_body (struct ui_out *UIOUT)
1230 This function delimits the table header from the table body.
1231 .PP
1232 \&\-\- Function: void ui_out_table_end (struct ui_out *UIOUT)
1233 This function signals the end of a table's output.  It should be
1234 called after the table body has been produced by the list and
1235 field output functions.
1236 .PP
1237 There should be exactly one call to `\fBui_out_table_end\fR' for each
1238 call to `\fBui_out_table_begin\fR', otherwise the `\fBui_out\fR' functions
1239 will signal an internal error.
1240 .PP
1241 The output of the tuples that represent the table rows must follow
1242 the call to `\fBui_out_table_body\fR' and precede the call to
1243 `\fBui_out_table_end\fR'.  You build a tuple by calling `\fBui_out_tuple_begin\fR'
1244 and `\fBui_out_tuple_end\fR', with suitable calls to functions which actually
1245 output fields between them.
1246 .PP
1247 \&\-\- Function: void ui_out_tuple_begin (struct ui_out *UIOUT, const char
1248 *ID)
1249 This function marks the beginning of a tuple output.  \s-1ID\s0 points to
1250 an optional string that identifies the tuple; it is copied by the
1251 implementation, and so strings in `\fBmalloc\fR'ed storage can be freed
1252 after the call.
1253 .PP
1254 \&\-\- Function: void ui_out_tuple_end (struct ui_out *UIOUT)
1255 This function signals an end of a tuple output.  There should be
1256 exactly one call to `\fBui_out_tuple_end\fR' for each call to
1257 `\fBui_out_tuple_begin\fR', otherwise an internal \s-1GDB\s0 error will be
1258 signaled.
1259 .PP
1260 \&\-\- Function: struct cleanup * make_cleanup_ui_out_tuple_begin_end
1261 (struct ui_out *UIOUT, const char *ID)
1262 This function first opens the tuple and then establishes a cleanup
1263 (*note Cleanups: Misc Guidelines.) to close the tuple.  It
1264 provides a convenient and correct implementation of the
1265 \&\fInon\-portable\fR\|(1) code sequence:
1266 struct cleanup *old_cleanup;
1267 ui_out_tuple_begin (uiout, \*(L"...\*(R");
1268 old_cleanup = make_cleanup ((void(*)(void *)) ui_out_tuple_end,
1269 uiout);
1270 .PP
1271 \&\-\- Function: void ui_out_list_begin (struct ui_out *UIOUT, const char
1272 *ID)
1273 This function marks the beginning of a list output.  \s-1ID\s0 points to
1274 an optional string that identifies the list; it is copied by the
1275 implementation, and so strings in `\fBmalloc\fR'ed storage can be freed
1276 after the call.
1277 .PP
1278 \&\-\- Function: void ui_out_list_end (struct ui_out *UIOUT)
1279 This function signals an end of a list output.  There should be
1280 exactly one call to `\fBui_out_list_end\fR' for each call to
1281 `\fBui_out_list_begin\fR', otherwise an internal \s-1GDB\s0 error will be
1282 signaled.
1283 .PP
1284 \&\-\- Function: struct cleanup * make_cleanup_ui_out_list_begin_end
1285 (struct ui_out *UIOUT, const char *ID)
1286 Similar to `\fBmake_cleanup_ui_out_tuple_begin_end\fR', this function
1287 opens a list and then establishes cleanup (*note Cleanups: Misc
1288 Guidelines.)  that will close the list.
1289 .PP
1290 4.2.4 Item Output Functions
1291 \&\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
1292 .PP
1293 The functions described below produce output for the actual data items,
1294 or fields, which contain information about the object.
1295 .PP
1296 Choose the appropriate function accordingly to your particular needs.
1297 .PP
1298 \&\-\- Function: void ui_out_field_fmt (struct ui_out *UIOUT, char
1299 *FLDNAME, char *FORMAT, ...)
1300 This is the most general output function.  It produces the
1301 representation of the data in the variable-length argument list
1302 according to formatting specifications in \s-1FORMAT,\s0 a `\fBprintf\fR'\-like
1303 format string.  The optional argument \s-1FLDNAME\s0 supplies the name of
1304 the field.  The data items themselves are supplied as additional
1305 arguments after \s-1FORMAT.\s0
1306 .PP
1307 This generic function should be used only when it is not possible
1308 to use one of the specialized versions (see below).
1309 .PP
1310 \&\-\- Function: void ui_out_field_int (struct ui_out *UIOUT, const char
1311 *FLDNAME, int \s-1VALUE\s0)
1312 This function outputs a value of an `\fBint\fR' variable.  It uses the
1313 `\fB\*(L"%d\*(R"\fR' output conversion specification.  \s-1FLDNAME\s0 specifies the
1314 name of the field.
1315 .PP
1316 \&\-\- Function: void ui_out_field_fmt_int (struct ui_out *UIOUT, int
1317 \&\s-1WIDTH,\s0 enum ui_align \s-1ALIGNMENT,\s0 const char *FLDNAME, int
1318 \&\s-1VALUE\s0)
1319 This function outputs a value of an `\fBint\fR' variable.  It differs
1320 from `\fBui_out_field_int\fR' in that the caller specifies the desired
1321 \&\s-1WIDTH\s0 and \s-1ALIGNMENT\s0 of the output.  \s-1FLDNAME\s0 specifies the name of
1322 the field.
1323 .PP
1324 \&\-\- Function: void ui_out_field_core_addr (struct ui_out *UIOUT, const
1325 char *FLDNAME, struct gdbarch *GDBARCH, \s-1CORE_ADDR ADDRESS\s0)
1326 This function outputs an address as appropriate for \s-1GDBARCH.\s0
1327 .PP
1328 \&\-\- Function: void ui_out_field_string (struct ui_out *UIOUT, const
1329 char *FLDNAME, const char *STRING)
1330 This function outputs a string using the `\fB\*(L"%s\*(R"\fR' conversion
1331 specification.
1332 .PP
1333 Sometimes, there's a need to compose your output piece by piece using
1334 functions that operate on a stream, such as `\fBvalue_print\fR' or
1335 `\fBfprintf_symbol_filtered\fR'.  These functions accept an argument of the
1336 type `\fBstruct ui_file *\fR', a pointer to a `\fBui_file\fR' object used to store
1337 the data stream used for the output.  When you use one of these
1338 functions, you need a way to pass their results stored in a `\fBui_file\fR'
1339 object to the `\fBui_out\fR' functions.  To this end, you first create a
1340 `\fBui_stream\fR' object by calling `\fBui_out_stream_new\fR', pass the `\fBstream\fR'
1341 member of that `\fBui_stream\fR' object to `\fBvalue_print\fR' and similar
1342 functions, and finally call `\fBui_out_field_stream\fR' to output the field
1343 you constructed.  When the `\fBui_stream\fR' object is no longer needed, you
1344 should destroy it and free its memory by calling `\fBui_out_stream_delete\fR'.
1345 .PP
1346 \&\-\- Function: struct ui_stream * ui_out_stream_new (struct ui_out
1347 *UIOUT)
1348 This function creates a new `\fBui_stream\fR' object which uses the same
1349 output methods as the `\fBui_out\fR' object whose pointer is passed in
1350 \&\s-1UIOUT. \s0 It returns a pointer to the newly created `\fBui_stream\fR'
1351 object.
1352 .PP
1353 \&\-\- Function: void ui_out_stream_delete (struct ui_stream *STREAMBUF)
1354 This functions destroys a `\fBui_stream\fR' object specified by
1355 \&\s-1STREAMBUF.\s0
1356 .PP
1357 \&\-\- Function: void ui_out_field_stream (struct ui_out *UIOUT, const
1358 char *FIELDNAME, struct ui_stream *STREAMBUF)
1359 This function consumes all the data accumulated in
1360 `\fBstreambuf\->stream\fR' and outputs it like `\fBui_out_field_string\fR'
1361 does.  After a call to `\fBui_out_field_stream\fR', the accumulated data
1362 no longer exists, but the stream is still valid and may be used
1363 for producing more fields.
1364 .PP
1365 *Important:* If there is any chance that your code could bail out
1366 before completing output generation and reaching the point where
1367 `\fBui_out_stream_delete\fR' is called, it is necessary to set up a cleanup,
1368 to avoid leaking memory and other resources.  Here's a skeleton code to
1369 do that:
1370 .PP
1371 struct ui_stream *mybuf = ui_out_stream_new (uiout);
1372 struct cleanup *old = make_cleanup (ui_out_stream_delete, mybuf);
1373 \&...
1374 do_cleanups (old);
1375 .PP
1376 If the function already has the old cleanup chain set (for other
1377 kinds of cleanups), you just have to add your cleanup to it:
1378 .PP
1379 mybuf = ui_out_stream_new (uiout);
1380 make_cleanup (ui_out_stream_delete, mybuf);
1381 .PP
1382 Note that with cleanups in place, you should not call
1383 `\fBui_out_stream_delete\fR' directly, or you would attempt to free the same
1384 buffer twice.
1385 .PP
1386 4.2.5 Utility Output Functions
1387 \&\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
1388 .PP
1389 \&\-\- Function: void ui_out_field_skip (struct ui_out *UIOUT, const char
1390 *FLDNAME)
1391 This function skips a field in a table.  Use it if you have to
1392 leave an empty field without disrupting the table alignment.  The
1393 argument \s-1FLDNAME\s0 specifies a name for the (missing) filed.
1394 .PP
1395 \&\-\- Function: void ui_out_text (struct ui_out *UIOUT, const char
1396 *STRING)
1397 This function outputs the text in \s-1STRING\s0 in a way that makes it
1398 easy to be read by humans.  For example, the console
1399 implementation of this method filters the text through a built-in
1400 pager, to prevent it from scrolling off the visible portion of the
1401 screen.
1402 .PP
1403 Use this function for printing relatively long chunks of text
1404 around the actual field data: the text it produces is not aligned
1405 according to the table's format.  Use `\fBui_out_field_string\fR' to
1406 output a string field, and use `\fBui_out_message\fR', described below,
1407 to output short messages.
1408 .PP
1409 \&\-\- Function: void ui_out_spaces (struct ui_out *UIOUT, int \s-1NSPACES\s0)
1410 This function outputs \s-1NSPACES\s0 spaces.  It is handy to align the
1411 text produced by `\fBui_out_text\fR' with the rest of the table or list.
1412 .PP
1413 \&\-\- Function: void ui_out_message (struct ui_out *UIOUT, int \s-1VERBOSITY,\s0
1414 const char *FORMAT, ...)
1415 This function produces a formatted message, provided that the
1416 current verbosity level is at least as large as given by
1417 \&\s-1VERBOSITY. \s0 The current verbosity level is specified by the user
1418 with the `\fBset verbositylevel\fR' \fIcommand.\fR\|(2)
1419 .PP
1420 \&\-\- Function: void ui_out_wrap_hint (struct ui_out *UIOUT, char *INDENT)
1421 This function gives the console output filter (a paging filter) a
1422 hint of where to break lines which are too long.  Ignored for all
1423 other output consumers.  \s-1INDENT,\s0 if non\-`\fB\s-1NULL\s0\fR', is the string to
1424 be printed to indent the wrapped text on the next line; it must
1425 remain accessible until the next call to `\fBui_out_wrap_hint\fR', or
1426 until an explicit newline is produced by one of the other
1427 functions.  If \s-1INDENT\s0 is `\fB\s-1NULL\s0\fR', the wrapped text will not be
1428 indented.
1429 .PP
1430 \&\-\- Function: void ui_out_flush (struct ui_out *UIOUT)
1431 This function flushes whatever output has been accumulated so far,
1432 if the \s-1UI\s0 buffers output.
1433 .PP
1434 4.2.6 Examples of Use of `\fBui_out\fR' functions
1435 \&\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
1436 .PP
1437 This section gives some practical examples of using the `\fBui_out\fR'
1438 functions to generalize the old console-oriented code in \s-1GDB. \s0 The
1439 examples all come from functions defined on the `\fBbreakpoints.c\fR' file.
1440 .PP
1441 This example, from the `\fBbreakpoint_1\fR' function, shows how to produce
1442 a table.
1443 .PP
1444 The original code was:
1445 .PP
1446 if (!found_a_breakpoint++)
1447 {
1448 annotate_breakpoints_headers ();
1449 .PP
1450 annotate_field (0);
1451 printf_filtered (\*(L"Num \*(R");
1452 annotate_field (1);
1453 printf_filtered (\*(L"Type           \*(R");
1454 annotate_field (2);
1455 printf_filtered (\*(L"Disp \*(R");
1456 annotate_field (3);
1457 printf_filtered (\*(L"Enb \*(R");
1458 if (addressprint)
1459 {
1460 annotate_field (4);
1461 printf_filtered (\*(L"Address    \*(R");
1462 }
1463 annotate_field (5);
1464 printf_filtered (\*(L"What\en\*(R");
1465 .PP
1466 annotate_breakpoints_table ();
1467 }
1468 .PP
1469 Here's the new version:
1470 .PP
1471 nr_printable_breakpoints = ...;
1472 .PP
1473 if (addressprint)
1474 ui_out_table_begin (ui, 6, nr_printable_breakpoints, \*(L"BreakpointTable\*(R");
1475 else
1476 ui_out_table_begin (ui, 5, nr_printable_breakpoints, \*(L"BreakpointTable\*(R");
1477 .PP
1478 if (nr_printable_breakpoints > 0)
1479 annotate_breakpoints_headers ();
1480 if (nr_printable_breakpoints > 0)
1481 annotate_field (0);
1482 ui_out_table_header (uiout, 3, ui_left, \*(L"number\*(R", \*(L"Num\*(R");                /* 1 */
1483 if (nr_printable_breakpoints > 0)
1484 annotate_field (1);
1485 ui_out_table_header (uiout, 14, ui_left, \*(L"type\*(R", \*(L"Type\*(R");                /* 2 */
1486 if (nr_printable_breakpoints > 0)
1487 annotate_field (2);
1488 ui_out_table_header (uiout, 4, ui_left, \*(L"disp\*(R", \*(L"Disp\*(R");         /* 3 */
1489 if (nr_printable_breakpoints > 0)
1490 annotate_field (3);
1491 ui_out_table_header (uiout, 3, ui_left, \*(L"enabled\*(R", \*(L"Enb\*(R");       /* 4 */
1492 if (addressprint)
1493 {
1494 if (nr_printable_breakpoints > 0)
1495 annotate_field (4);
1496 if (print_address_bits <= 32)
1497 ui_out_table_header (uiout, 10, ui_left, \*(L"addr\*(R", \*(L"Address\*(R");/* 5 */
1498 else
1499 ui_out_table_header (uiout, 18, ui_left, \*(L"addr\*(R", \*(L"Address\*(R");/* 5 */
1500 }
1501 if (nr_printable_breakpoints > 0)
1502 annotate_field (5);
1503 ui_out_table_header (uiout, 40, ui_noalign, \*(L"what\*(R", \*(L"What\*(R");     /* 6 */
1504 ui_out_table_body (uiout);
1505 if (nr_printable_breakpoints > 0)
1506 annotate_breakpoints_table ();
1507 .PP
1508 This example, from the `\fBprint_one_breakpoint\fR' function, shows how to
1509 produce the actual data for the table whose structure was defined in
1510 the above example.  The original code was:
1511 .PP
1512 annotate_record ();
1513 annotate_field (0);
1514 printf_filtered (\*(L"%\-3d \*(R", b\->number);
1515 annotate_field (1);
1516 if ((int)b\->type > (sizeof(bptypes)/sizeof(bptypes[0]))
1517 || ((int) b\->type != bptypes[(int) b\->type].type))
1518 internal_error (\*(L"bptypes table does not describe type #%d.\*(R",
1519 (int)b\->type);
1520 printf_filtered (\*(L"%\-14s \*(R", bptypes[(int)b\->type].description);
1521 annotate_field (2);
1522 printf_filtered (\*(L"%\-4s \*(R", bpdisps[(int)b\->disposition]);
1523 annotate_field (3);
1524 printf_filtered (\*(L"%\-3c \*(R", bpenables[(int)b\->enable]);
1525 \&...
1526 .PP
1527 This is the new version:
1528 .PP
1529 annotate_record ();
1530 ui_out_tuple_begin (uiout, \*(L"bkpt\*(R");
1531 annotate_field (0);
1532 ui_out_field_int (uiout, \*(L"number\*(R", b\->number);
1533 annotate_field (1);
1534 if (((int) b\->type > (sizeof (bptypes) / sizeof (bptypes[0])))
1535 || ((int) b\->type != bptypes[(int) b\->type].type))
1536 internal_error (\*(L"bptypes table does not describe type #%d.\*(R",
1537 (int) b\->type);
1538 ui_out_field_string (uiout, \*(L"type\*(R", bptypes[(int)b\->type].description);
1539 annotate_field (2);
1540 ui_out_field_string (uiout, \*(L"disp\*(R", bpdisps[(int)b\->disposition]);
1541 annotate_field (3);
1542 ui_out_field_fmt (uiout, \*(L"enabled\*(R", \*(L"%c\*(R", bpenables[(int)b\->enable]);
1543 \&...
1544 .PP
1545 This example, also from `\fBprint_one_breakpoint\fR', shows how to produce
1546 a complicated output field using the `\fBprint_expression\fR' functions which
1547 requires a stream to be passed.  It also shows how to automate stream
1548 destruction with cleanups.  The original code was:
1549 .PP
1550 annotate_field (5);
1551 print_expression (b\->exp, gdb_stdout);
1552 .PP
1553 The new version is:
1554 .PP
1555 struct ui_stream *stb = ui_out_stream_new (uiout);
1556 struct cleanup *old_chain = make_cleanup_ui_out_stream_delete (stb);
1557 \&...
1558 annotate_field (5);
1559 print_expression (b\->exp, stb\->stream);
1560 ui_out_field_stream (uiout, \*(L"what\*(R", local_stream);
1561 .PP
1562 This example, also from `\fBprint_one_breakpoint\fR', shows how to use
1563 `\fBui_out_text\fR' and `\fBui_out_field_string\fR'.  The original code was:
1564 .PP
1565 annotate_field (5);
1566 if (b\->dll_pathname == \s-1NULL\s0)
1567 printf_filtered (\*(L"<any library> \*(R");
1568 else
1569 printf_filtered (\*(L"library \e\*(R"%s\e\*(L" \*(R", b\->dll_pathname);
1570 .PP
1571 It became:
1572 .PP
1573 annotate_field (5);
1574 if (b\->dll_pathname == \s-1NULL\s0)
1575 {
1576 ui_out_field_string (uiout, \*(L"what\*(R", \*(L"<any library>\*(R");
1577 ui_out_spaces (uiout, 1);
1578 }
1579 else
1580 {
1581 ui_out_text (uiout, \*(L"library \e\*(R"\*(L");
1582 ui_out_field_string (uiout, \*(R"what\*(L", b\->dll_pathname);
1583 ui_out_text (uiout, \*(R"\e\*(L" \*(R");
1584 }
1585 .PP
1586 The following example from `\fBprint_one_breakpoint\fR' shows how to use
1587 `\fBui_out_field_int\fR' and `\fBui_out_spaces\fR'.  The original code was:
1588 .PP
1589 annotate_field (5);
1590 if (b\->forked_inferior_pid != 0)
1591 printf_filtered (\*(L"process \f(CW%d\fR \*(R", b\->forked_inferior_pid);
1592 .PP
1593 It became:
1594 .PP
1595 annotate_field (5);
1596 if (b\->forked_inferior_pid != 0)
1597 {
1598 ui_out_text (uiout, \*(L"process \*(R");
1599 ui_out_field_int (uiout, \*(L"what\*(R", b\->forked_inferior_pid);
1600 ui_out_spaces (uiout, 1);
1601 }
1602 .PP
1603 Here's an example of using `\fBui_out_field_string\fR'.  The original code
1604 was:
1605 .PP
1606 annotate_field (5);
1607 if (b\->exec_pathname != \s-1NULL\s0)
1608 printf_filtered (\*(L"program \e\*(R"%s\e\*(L" \*(R", b\->exec_pathname);
1609 .PP
1610 It became:
1611 .PP
1612 annotate_field (5);
1613 if (b\->exec_pathname != \s-1NULL\s0)
1614 {
1615 ui_out_text (uiout, \*(L"program \e\*(R"\*(L");
1616 ui_out_field_string (uiout, \*(R"what\*(L", b\->exec_pathname);
1617 ui_out_text (uiout, \*(R"\e\*(L" \*(R");
1618 }
1619 .PP
1620 Finally, here's an example of printing an address.  The original
1621 code:
1622 .PP
1623 annotate_field (4);
1624 printf_filtered (\*(L"%s \*(R",
1625 hex_string_custom ((unsigned long) b\->address, 8));
1626 .PP
1627 It became:
1628 .PP
1629 annotate_field (4);
1630 ui_out_field_core_addr (uiout, \*(L"Address\*(R", b\->address);
1631 .PP
1632 4.3 Console Printing
1633 ====================
1634 .PP
1635 4.4 \s-1TUI\s0
1636 =======
1637 .PP
1638 \&\-\-\-\-\-\-\-\-\-\- Footnotes \-\-\-\-\-\-\-\-\-\-
1639 .PP
1640 (1) The function cast is not portable \s-1ISO C.\s0
1641 .PP
1642 (2) As of this writing (April 2001), setting verbosity level is not
1643 yet implemented, and is always returned as zero.  So calling
1644 `\fBui_out_message\fR' with a \s-1VERBOSITY\s0 argument more than zero will cause
1645 the message to never be printed.
1646 .SS "5 libgdb"
1647 .IX Subsection "5 libgdb"
1648 5.1 libgdb 1.0
1649 ==============
1650 .PP
1651 `\fBlibgdb\fR' 1.0 was an abortive project of years ago.  The theory was to
1652 provide an \s-1API\s0 to \s-1GDB\s0's functionality.
1653 .PP
1654 5.2 libgdb 2.0
1655 ==============
1656 .PP
1657 `\fBlibgdb\fR' 2.0 is an ongoing effort to update \s-1GDB\s0 so that is better able
1658 to support graphical and other environments.
1659 .PP
1660 Since `\fBlibgdb\fR' development is on-going, its architecture is still
1661 evolving.  The following components have so far been identified:
1662 .PP
1663 * Observer \- `\fBgdb\-events.h\fR'.
1664 .PP
1665 * Builder \- `\fBui\-out.h\fR'
1666 .PP
1667 * Event Loop \- `\fBevent\-loop.h\fR'
1668 .PP
1669 * Library \- `\fBgdb.h\fR'
1670 .PP
1671 The model that ties these components together is described below.
1672 .PP
1673 5.3 The `\fBlibgdb\fR' Model
1674 ======================
1675 .PP
1676 A client of `\fBlibgdb\fR' interacts with the library in two ways.
1677 .PP
1678 * As an observer (using `\fBgdb-events\fR') receiving notifications from
1679 `\fBlibgdb\fR' of any internal state changes (break point changes, run
1680 state, etc).
1681 .PP
1682 * As a client querying `\fBlibgdb\fR' (using the `\fBui-out\fR' builder) to
1683 obtain various status values from \s-1GDB.\s0
1684 .PP
1685 Since `\fBlibgdb\fR' could have multiple clients (e.g., a \s-1GUI\s0 supporting
1686 the existing \s-1GDB CLI\s0), those clients must co-operate when controlling
1687 `\fBlibgdb\fR'.  In particular, a client must ensure that `\fBlibgdb\fR' is idle
1688 (i.e. no other client is using `\fBlibgdb\fR') before responding to a
1689 `\fBgdb-event\fR' by making a query.
1690 .PP
1691 5.4 \s-1CLI\s0 support
1692 ===============
1693 .PP
1694 At present \s-1GDB\s0's \s-1CLI\s0 is very much entangled in with the core of
1695 `\fBlibgdb\fR'.  Consequently, a client wishing to include the \s-1CLI\s0 in their
1696 interface needs to carefully co-ordinate its own and the \s-1CLI\s0's
1697 requirements.
1698 .PP
1699 It is suggested that the client set `\fBlibgdb\fR' up to be bi-modal
1700 (alternate between \s-1CLI\s0 and client query modes).  The notes below sketch
1701 out the theory:
1702 .PP
1703 * The client registers itself as an observer of `\fBlibgdb\fR'.
1704 .PP
1705 * The client create and install `\fBcli-out\fR' builder using its own
1706 versions of the `\fBui-file\fR' `\fBgdb_stderr\fR', `\fBgdb_stdtarg\fR' and
1707 `\fBgdb_stdout\fR' streams.
1708 .PP
1709 * The client creates a separate custom `\fBui-out\fR' builder that is only
1710 used while making direct queries to `\fBlibgdb\fR'.
1711 .PP
1712 When the client receives input intended for the \s-1CLI,\s0 it simply
1713 passes it along.  Since the `\fBcli-out\fR' builder is installed by default,
1714 all the \s-1CLI\s0 output in response to that command is routed (pronounced
1715 rooted) through to the client controlled `\fBgdb_stdout\fR' et. al. streams.
1716 At the same time, the client is kept abreast of internal changes by
1717 virtue of being a `\fBlibgdb\fR' observer.
1718 .PP
1719 The only restriction on the client is that it must wait until
1720 `\fBlibgdb\fR' becomes idle before initiating any queries (using the client's
1721 custom builder).
1722 .PP
1723 5.5 `\fBlibgdb\fR' components
1724 =======================
1725 .PP
1726 Observer \- `\fBgdb\-events.h\fR'
1727 \&\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
1728 .PP
1729 `\fBgdb-events\fR' provides the client with a very raw mechanism that can be
1730 used to implement an observer.  At present it only allows for one
1731 observer and that observer must, internally, handle the need to delay
1732 the processing of any event notifications until after `\fBlibgdb\fR' has
1733 finished the current command.
1734 .PP
1735 Builder \- `\fBui\-out.h\fR'
1736 \&\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
1737 .PP
1738 `\fBui-out\fR' provides the infrastructure necessary for a client to create a
1739 builder.  That builder is then passed down to `\fBlibgdb\fR' when doing any
1740 queries.
1741 .PP
1742 Event Loop \- `\fBevent\-loop.h\fR'
1743 \&\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
1744 .PP
1745 `\fBevent-loop\fR', currently non-re-entrant, provides a simple event loop.
1746 A client would need to either plug its self into this loop or,
1747 implement a new event-loop that \s-1GDB\s0 would use.
1748 .PP
1749 The event-loop will eventually be made re-entrant.  This is so that
1750 \&\s-1GDB\s0 can better handle the problem of some commands blocking instead of
1751 returning.
1752 .PP
1753 Library \- `\fBgdb.h\fR'
1754 \&\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
1755 .PP
1756 `\fBlibgdb\fR' is the most obvious component of this system.  It provides the
1757 query interface.  Each function is parameterized by a `\fBui-out\fR' builder.
1758 The result of the query is constructed using that builder before the
1759 query function returns.
1760 .SS "6 Values"
1761 .IX Subsection "6 Values"
1762 6.1 Values
1763 ==========
1764 .PP
1765 \&\s-1GDB\s0 uses `\fBstruct value\fR', or \*(L"values\*(R", as an internal abstraction for
1766 the representation of a variety of inferior objects and \s-1GDB\s0 convenience
1767 objects.
1768 .PP
1769 Values have an associated `\fBstruct type\fR', that describes a virtual
1770 view of the raw data or object stored in or accessed through the value.
1771 .PP
1772 A value is in addition discriminated by its lvalue-ness, given its
1773 `\fBenum lval_type\fR' enumeration type:
1774 .PP
1775 ``\fBnot_lval\fR''
1776 This value is not an lval.  It can't be assigned to.
1777 .PP
1778 ``\fBlval_memory\fR''
1779 This value represents an object in memory.
1780 .PP
1781 ``\fBlval_register\fR''
1782 This value represents an object that lives in a register.
1783 .PP
1784 ``\fBlval_internalvar\fR''
1785 Represents the value of an internal variable.
1786 .PP
1787 ``\fBlval_internalvar_component\fR''
1788 Represents part of a \s-1GDB\s0 internal variable.  E.g., a structure
1789 field.
1790 .PP
1791 ``\fBlval_computed\fR''
1792 These are \*(L"computed\*(R" values.  They allow creating specialized value
1793 objects for specific purposes, all abstracted away from the core
1794 value support code.  The creator of such a value writes specialized
1795 functions to handle the reading and writing to/from the value's
1796 backend data, and optionally, a \*(L"copy operator\*(R" and a \*(L"destructor\*(R".
1797 .PP
1798 Pointers to these functions are stored in a `\fBstruct lval_funcs\fR'
1799 instance (declared in `\fBvalue.h\fR'), and passed to the
1800 `\fBallocate_computed_value\fR' function, as in the example below.
1801 .PP
1802 static void
1803 nil_value_read (struct value *v)
1804 {
1805 /* This callback reads data from some backend, and stores it in V.
1806 In this case, we always read null data.  You'll want to fill in
1807 something more interesting.  */
1808 .PP
1809 memset (value_contents_all_raw (v),
1810 value_offset (v),
1811 \&\s-1TYPE_LENGTH \s0(value_type (v)));
1812 }
1813 .PP
1814 static void
1815 nil_value_write (struct value *v, struct value *fromval)
1816 {
1817 /* Takes the data from \s-1FROMVAL\s0 and stores it in the backend of V.  */
1818 .PP
1819 to_oblivion (value_contents_all_raw (fromval),
1820 value_offset (v),
1821 \&\s-1TYPE_LENGTH \s0(value_type (fromval)));
1822 }
1823 .PP
1824 static struct lval_funcs nil_value_funcs =
1825 {
1826 nil_value_read,
1827 nil_value_write
1828 };
1829 .PP
1830 struct value *
1831 make_nil_value (void)
1832 {
1833 struct type *type;
1834 struct value *v;
1835 .PP
1836 type = make_nils_type ();
1837 v = allocate_computed_value (type, &nil_value_funcs, \s-1NULL\s0);
1838 .PP
1839 return v;
1840 }
1841 .PP
1842 See the implementation of the `\fB\f(CB$_siginfo\fB\fR' convenience variable in
1843 `\fBinfrun.c\fR' as a real example use of lval_computed.
1844 .SS "7 Stack Frames"
1845 .IX Subsection "7 Stack Frames"
1846 A frame is a construct that \s-1GDB\s0 uses to keep track of calling and
1847 called functions.
1848 .PP
1849 \&\s-1GDB\s0's frame model, a fresh design, was implemented with the need to
1850 support \s-1DWARF\s0's Call Frame Information in mind.  In fact, the term
1851 \&\*(L"unwind\*(R" is taken directly from that specification.  Developers wishing
1852 to learn more about unwinders, are encouraged to read the \s-1DWARF\s0
1853 specification, available from `\fBhttp://www.dwarfstd.org\fR'.
1854 .PP
1855 \&\s-1GDB\s0's model is that you find a frame's registers by \*(L"unwinding\*(R" them
1856 from the next younger frame.  That is, `\fBget_frame_register\fR' which
1857 returns the value of a register in frame #1 (the next-to-youngest
1858 frame), is implemented by calling frame #0's `\fBframe_register_unwind\fR'
1859 (the youngest frame).  But then the obvious question is: how do you
1860 access the registers of the youngest frame itself?
1861 .PP
1862 To answer this question, \s-1GDB\s0 has the \*(L"sentinel\*(R" frame, the \*(L"\-1st\*(R"
1863 frame.  Unwinding registers from the sentinel frame gives you the
1864 current values of the youngest real frame's registers.  If F is a
1865 sentinel frame, then `\fBget_frame_type (F) == \s-1SENTINEL_FRAME\s0\fR'.
1866 .PP
1867 7.1 Selecting an Unwinder
1868 =========================
1869 .PP
1870 The architecture registers a list of frame unwinders (`struct
1871 frame_unwind'), using the functions `\fBframe_unwind_prepend_unwinder\fR' and
1872 `\fBframe_unwind_append_unwinder\fR'.  Each unwinder includes a sniffer.
1873 Whenever \s-1GDB\s0 needs to unwind a frame (to fetch the previous frame's
1874 registers or the current frame's \s-1ID\s0), it calls registered sniffers in
1875 order to find one which recognizes the frame.  The first time a sniffer
1876 returns non-zero, the corresponding unwinder is assigned to the frame.
1877 .PP
1878 7.2 Unwinding the Frame \s-1ID\s0
1879 ==========================
1880 .PP
1881 Every frame has an associated \s-1ID,\s0 of type `\fBstruct frame_id\fR'.  The \s-1ID\s0
1882 includes the stack base and function start address for the frame.  The
1883 \&\s-1ID\s0 persists through the entire life of the frame, including while other
1884 called frames are running; it is used to locate an appropriate `struct
1885 frame_info' from the cache.
1886 .PP
1887 Every time the inferior stops, and at various other times, the frame
1888 cache is flushed.  Because of this, parts of \s-1GDB\s0 which need to keep
1889 track of individual frames cannot use pointers to `\fBstruct frame_info\fR'.
1890 A frame \s-1ID\s0 provides a stable reference to a frame, even when the
1891 unwinder must be run again to generate a new `\fBstruct frame_info\fR' for
1892 the same frame.
1893 .PP
1894 The frame's unwinder's `\fBthis_id\fR' method is called to find the \s-1ID.\s0
1895 Note that this is different from register unwinding, where the next
1896 frame's `\fBprev_register\fR' is called to unwind this frame's registers.
1897 .PP
1898 Both stack base and function address are required to identify the
1899 frame, because a recursive function has the same function address for
1900 two consecutive frames and a leaf function may have the same stack
1901 address as its caller.  On some platforms, a third address is part of
1902 the \s-1ID\s0 to further disambiguate frames\*(--for instance, on \s-1IA\-64\s0 the
1903 separate register stack address is included in the \s-1ID.\s0
1904 .PP
1905 An invalid frame \s-1ID \s0(`\fBouter_frame_id\fR') returned from the `\fBthis_id\fR'
1906 method means to stop unwinding after this frame.
1907 .PP
1908 `\fBnull_frame_id\fR' is another invalid frame \s-1ID\s0 which should be used
1909 when there is no frame.  For instance, certain breakpoints are attached
1910 to a specific frame, and that frame is identified through its frame \s-1ID
1911 \&\s0(we use this to implement the \*(L"finish\*(R" command).  Using `\fBnull_frame_id\fR'
1912 as the frame \s-1ID\s0 for a given breakpoint means that the breakpoint is not
1913 specific to any frame.  The `\fBthis_id\fR' method should never return
1914 `\fBnull_frame_id\fR'.
1915 .PP
1916 7.3 Unwinding Registers
1917 =======================
1918 .PP
1919 Each unwinder includes a `\fBprev_register\fR' method.  This method takes a
1920 frame, an associated cache pointer, and a register number.  It returns
1921 a `\fBstruct value *\fR' describing the requested register, as saved by this
1922 frame.  This is the value of the register that is current in this
1923 frame's caller.
1924 .PP
1925 The returned value must have the same type as the register.  It may
1926 have any lvalue type.  In most circumstances one of these routines will
1927 generate the appropriate value:
1928 .PP
1929 `\fBframe_unwind_got_optimized\fR'
1930 This register was not saved.
1931 .PP
1932 `\fBframe_unwind_got_register\fR'
1933 This register was copied into another register in this frame.  This
1934 is also used for unchanged registers; they are \*(L"copied\*(R" into the
1935 same register.
1936 .PP
1937 `\fBframe_unwind_got_memory\fR'
1938 This register was saved in memory.
1939 .PP
1940 `\fBframe_unwind_got_constant\fR'
1941 This register was not saved, but the unwinder can compute the
1942 previous value some other way.
1943 .PP
1944 `\fBframe_unwind_got_address\fR'
1945 Same as `\fBframe_unwind_got_constant\fR', except that the value is a
1946 target address.  This is frequently used for the stack pointer,
1947 which is not explicitly saved but has a known offset from this
1948 frame's stack pointer.  For architectures with a flat unified
1949 address space, this is generally the same as
1950 `\fBframe_unwind_got_constant\fR'.
1951 .SS "8 Symbol Handling"
1952 .IX Subsection "8 Symbol Handling"
1953 Symbols are a key part of \s-1GDB\s0's operation.  Symbols include variables,
1954 functions, and types.
1955 .PP
1956 Symbol information for a large program can be truly massive, and
1957 reading of symbol information is one of the major performance
1958 bottlenecks in \s-1GDB\s0; it can take many minutes to process it all.
1959 Studies have shown that nearly all the time spent is computational,
1960 rather than file reading.
1961 .PP
1962 One of the ways for \s-1GDB\s0 to provide a good user experience is to
1963 start up quickly, taking no more than a few seconds.  It is simply not
1964 possible to process all of a program's debugging info in that time, and
1965 so we attempt to handle symbols incrementally.  For instance, we create
1966 \&\*(L"partial symbol tables\*(R" consisting of only selected symbols, and only
1967 expand them to full symbol tables when necessary.
1968 .PP
1969 8.1 Symbol Reading
1970 ==================
1971 .PP
1972 \&\s-1GDB\s0 reads symbols from \*(L"symbol files\*(R".  The usual symbol file is the
1973 file containing the program which \s-1GDB\s0 is debugging.  \s-1GDB\s0 can be
1974 directed to use a different file for symbols (with the `\fBsymbol-file\fR'
1975 command), and it can also read more symbols via the `\fBadd-file\fR' and
1976 `\fBload\fR' commands. In addition, it may bring in more symbols while
1977 loading shared libraries.
1978 .PP
1979 Symbol files are initially opened by code in `\fBsymfile.c\fR' using the
1980 \&\s-1BFD\s0 library (see \*(L"Support Libraries\*(R").  \s-1BFD\s0 identifies the type of
1981 the file by examining its header.  `\fBfind_sym_fns\fR' then uses this
1982 identification to locate a set of symbol-reading functions.
1983 .PP
1984 Symbol-reading modules identify themselves to \s-1GDB\s0 by calling
1985 `\fBadd_symtab_fns\fR' during their module initialization.  The argument to
1986 `\fBadd_symtab_fns\fR' is a `\fBstruct sym_fns\fR' which contains the name (or name
1987 prefix) of the symbol format, the length of the prefix, and pointers to
1988 four functions.  These functions are called at various times to process
1989 symbol files whose identification matches the specified prefix.
1990 .PP
1991 The functions supplied by each module are:
1992 .PP
1993 `\fBXYZ_symfile_init(struct sym_fns *sf)\fR'
1994 Called from `\fBsymbol_file_add\fR' when we are about to read a new
1995 symbol file.  This function should clean up any internal state
1996 (possibly resulting from half-read previous files, for example)
1997 and prepare to read a new symbol file.  Note that the symbol file
1998 which we are reading might be a new \*(L"main\*(R" symbol file, or might
1999 be a secondary symbol file whose symbols are being added to the
2000 existing symbol table.
2001 .PP
2002 The argument to `\fBXYZ_symfile_init\fR' is a newly allocated `struct
2003 sym_fns' whose `\fBbfd\fR' field contains the \s-1BFD\s0 for the new symbol
2004 file being read.  Its `\fBprivate\fR' field has been zeroed, and can be
2005 modified as desired.  Typically, a struct of private information
2006 will be `\fBmalloc\fR''d, and a pointer to it will be placed in the
2007 `\fBprivate\fR' field.
2008 .PP
2009 There is no result from `\fBXYZ_symfile_init\fR', but it can call
2010 `\fBerror\fR' if it detects an unavoidable problem.
2011 .PP
2012 `\fB\f(BIXYZ_new_init()\fB\fR'
2013 Called from `\fBsymbol_file_add\fR' when discarding existing symbols.
2014 This function needs only handle the symbol-reading module's
2015 internal state; the symbol table data structures visible to the
2016 rest of \s-1GDB\s0 will be discarded by `\fBsymbol_file_add\fR'.  It has no
2017 arguments and no result.  It may be called after
2018 `\fBXYZ_symfile_init\fR', if a new symbol table is being read, or may be
2019 called alone if all symbols are simply being discarded.
2020 .PP
2021 `\fBXYZ_symfile_read(struct sym_fns *sf, \s-1CORE_ADDR\s0 addr, int mainline)\fR'
2022 Called from `\fBsymbol_file_add\fR' to actually read the symbols from a
2023 symbol-file into a set of psymtabs or symtabs.
2024 .PP
2025 `\fBsf\fR' points to the `\fBstruct sym_fns\fR' originally passed to
2026 `\fBXYZ_sym_init\fR' for possible initialization.  `\fBaddr\fR' is the offset
2027 between the file's specified start address and its true address in
2028 memory.  `\fBmainline\fR' is 1 if this is the main symbol table being
2029 read, and 0 if a secondary symbol file (e.g., shared library or
2030 dynamically loaded file) is being read.
2031 .PP
2032 In addition, if a symbol-reading module creates psymtabs when
2033 XYZ_symfile_read is called, these psymtabs will contain a pointer to a
2034 function `\fBXYZ_psymtab_to_symtab\fR', which can be called from any point in
2035 the \s-1GDB\s0 symbol-handling code.
2036 .PP
2037 `\fBXYZ_psymtab_to_symtab (struct partial_symtab *pst)\fR'
2038 Called from `\fBpsymtab_to_symtab\fR' (or the `\fB\s-1PSYMTAB_TO_SYMTAB\s0\fR' macro)
2039 if the psymtab has not already been read in and had its
2040 `\fBpst\->symtab\fR' pointer set.  The argument is the psymtab to be
2041 fleshed-out into a symtab.  Upon return, `\fBpst\->readin\fR' should have
2042 been set to 1, and `\fBpst\->symtab\fR' should contain a pointer to the
2043 new corresponding symtab, or zero if there were no symbols in that
2044 part of the symbol file.
2045 .PP
2046 8.2 Partial Symbol Tables
2047 =========================
2048 .PP
2049 \&\s-1GDB\s0 has three types of symbol tables:
2050 .PP
2051 * Full symbol tables (\*(L"symtabs\*(R").  These contain the main
2052 information about symbols and addresses.
2053 .PP
2054 * Partial symbol tables (\*(L"psymtabs\*(R").  These contain enough
2055 information to know when to read the corresponding part of the full
2056 symbol table.
2057 .PP
2058 * Minimal symbol tables (\*(L"msymtabs\*(R").  These contain information
2059 gleaned from non-debugging symbols.
2060 .PP
2061 This section describes partial symbol tables.
2062 .PP
2063 A psymtab is constructed by doing a very quick pass over an
2064 executable file's debugging information.  Small amounts of information
2065 are extracted\*(--enough to identify which parts of the symbol table will
2066 need to be re-read and fully digested later, when the user needs the
2067 information.  The speed of this pass causes \s-1GDB\s0 to start up very
2068 quickly.  Later, as the detailed rereading occurs, it occurs in small
2069 pieces, at various times, and the delay therefrom is mostly invisible to
2070 the user.
2071 .PP
2072 The symbols that show up in a file's psymtab should be, roughly,
2073 those visible to the debugger's user when the program is not running
2074 code from that file.  These include external symbols and types, static
2075 symbols and types, and `\fBenum\fR' values declared at file scope.
2076 .PP
2077 The psymtab also contains the range of instruction addresses that the
2078 full symbol table would represent.
2079 .PP
2080 The idea is that there are only two ways for the user (or much of the
2081 code in the debugger) to reference a symbol:
2082 .PP
2083 * By its address (e.g., execution stops at some address which is
2084 inside a function in this file).  The address will be noticed to
2085 be in the range of this psymtab, and the full symtab will be read
2086 in.  `\fBfind_pc_function\fR', `\fBfind_pc_line\fR', and other `\fBfind_pc_...\fR'
2087 functions handle this.
2088 .PP
2089 * By its name (e.g., the user asks to print a variable, or set a
2090 breakpoint on a function).  Global names and file-scope names will
2091 be found in the psymtab, which will cause the symtab to be pulled
2092 in.  Local names will have to be qualified by a global name, or a
2093 file-scope name, in which case we will have already read in the
2094 symtab as we evaluated the qualifier.  Or, a local symbol can be
2095 referenced when we are \*(L"in\*(R" a local scope, in which case the first
2096 case applies.  `\fBlookup_symbol\fR' does most of the work here.
2097 .PP
2098 The only reason that psymtabs exist is to cause a symtab to be read
2099 in at the right moment.  Any symbol that can be elided from a psymtab,
2100 while still causing that to happen, should not appear in it.  Since
2101 psymtabs don't have the idea of scope, you can't put local symbols in
2102 them anyway.  Psymtabs don't have the idea of the type of a symbol,
2103 either, so types need not appear, unless they will be referenced by
2104 name.
2105 .PP
2106 It is a bug for \s-1GDB\s0 to behave one way when only a psymtab has been
2107 read, and another way if the corresponding symtab has been read in.
2108 Such bugs are typically caused by a psymtab that does not contain all
2109 the visible symbols, or which has the wrong instruction address ranges.
2110 .PP
2111 The psymtab for a particular section of a symbol file (objfile)
2112 could be thrown away after the symtab has been read in.  The symtab
2113 should always be searched before the psymtab, so the psymtab will never
2114 be used (in a bug-free environment).  Currently, psymtabs are allocated
2115 on an obstack, and all the psymbols themselves are allocated in a pair
2116 of large arrays on an obstack, so there is little to be gained by
2117 trying to free them unless you want to do a lot more work.
2118 .PP
2119 Whether or not psymtabs are created depends on the objfile's symbol
2120 reader.  The core of \s-1GDB\s0 hides the details of partial symbols and
2121 partial symbol tables behind a set of function pointers known as the
2122 \&\*(L"quick symbol functions\*(R".  These are documented in `\fBsymfile.h\fR'.
2123 .PP
2124 8.3 Types
2125 =========
2126 .PP
2127 Fundamental Types (e.g., `\fB\s-1FT_VOID\s0\fR', `\fB\s-1FT_BOOLEAN\s0\fR').
2128 \&\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
2129 .PP
2130 These are the fundamental types that \s-1GDB\s0 uses internally.  Fundamental
2131 types from the various debugging formats (stabs, \s-1ELF,\s0 etc) are mapped
2132 into one of these.  They are basically a union of all fundamental types
2133 that \s-1GDB\s0 knows about for all the languages that \s-1GDB\s0 knows about.
2134 .PP
2135 Type Codes (e.g., `\fB\s-1TYPE_CODE_PTR\s0\fR', `\fB\s-1TYPE_CODE_ARRAY\s0\fR').
2136 \&\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
2137 .PP
2138 Each time \s-1GDB\s0 builds an internal type, it marks it with one of these
2139 types.  The type may be a fundamental type, such as `\fB\s-1TYPE_CODE_INT\s0\fR', or
2140 a derived type, such as `\fB\s-1TYPE_CODE_PTR\s0\fR' which is a pointer to another
2141 type.  Typically, several `\fBFT_*\fR' types map to one `\fBTYPE_CODE_*\fR' type,
2142 and are distinguished by other members of the type struct, such as
2143 whether the type is signed or unsigned, and how many bits it uses.
2144 .PP
2145 Builtin Types (e.g., `\fBbuiltin_type_void\fR', `\fBbuiltin_type_char\fR').
2146 \&\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
2147 .PP
2148 These are instances of type structs that roughly correspond to
2149 fundamental types and are created as global types for \s-1GDB\s0 to use for
2150 various ugly historical reasons.  We eventually want to eliminate
2151 these.  Note for example that `\fBbuiltin_type_int\fR' initialized in
2152 `\fBgdbtypes.c\fR' is basically the same as a `\fB\s-1TYPE_CODE_INT\s0\fR' type that is
2153 initialized in `\fBc\-lang.c\fR' for an `\fB\s-1FT_INTEGER\s0\fR' fundamental type.  The
2154 difference is that the `\fBbuiltin_type\fR' is not associated with any
2155 particular objfile, and only one instance exists, while `\fBc\-lang.c\fR'
2156 builds as many `\fB\s-1TYPE_CODE_INT\s0\fR' types as needed, with each one
2157 associated with some particular objfile.
2158 .PP
2159 8.4 Object File Formats
2160 =======================
2161 .PP
2162 8.4.1 a.out
2163 \&\-\-\-\-\-\-\-\-\-\-\-
2164 .PP
2165 The `\fBa.out\fR' format is the original file format for Unix.  It consists
2166 of three sections: `\fBtext\fR', `\fBdata\fR', and `\fBbss\fR', which are for program
2167 code, initialized data, and uninitialized data, respectively.
2168 .PP
2169 The `\fBa.out\fR' format is so simple that it doesn't have any reserved
2170 place for debugging information.  (Hey, the original Unix hackers used
2171 `\fBadb\fR', which is a machine-language debugger!)  The only debugging
2172 format for `\fBa.out\fR' is stabs, which is encoded as a set of normal
2173 symbols with distinctive attributes.
2174 .PP
2175 The basic `\fBa.out\fR' reader is in `\fBdbxread.c\fR'.
2176 .PP
2177 8.4.2 \s-1COFF
2178 \&\-\-\-\-\-\-\-\-\-\-\s0
2179 .PP
2180 The \s-1COFF\s0 format was introduced with System V Release 3 (\s-1SVR3\s0) Unix.
2181 \&\s-1COFF\s0 files may have multiple sections, each prefixed by a header.  The
2182 number of sections is limited.
2183 .PP
2184 The \s-1COFF\s0 specification includes support for debugging.  Although this
2185 was a step forward, the debugging information was woefully limited.
2186 For instance, it was not possible to represent code that came from an
2187 included file.  \s-1GNU\s0's COFF-using configs often use stabs-type info,
2188 encapsulated in special sections.
2189 .PP
2190 The \s-1COFF\s0 reader is in `\fBcoffread.c\fR'.
2191 .PP
2192 8.4.3 \s-1ECOFF
2193 \&\-\-\-\-\-\-\-\-\-\-\-\s0
2194 .PP
2195 \&\s-1ECOFF\s0 is an extended \s-1COFF\s0 originally introduced for Mips and Alpha
2196 workstations.
2197 .PP
2198 The basic \s-1ECOFF\s0 reader is in `\fBmipsread.c\fR'.
2199 .PP
2200 8.4.4 \s-1XCOFF
2201 \&\-\-\-\-\-\-\-\-\-\-\-\s0
2202 .PP
2203 The \s-1IBM RS/6000\s0 running \s-1AIX\s0 uses an object file format called \s-1XCOFF.\s0
2204 The \s-1COFF\s0 sections, symbols, and line numbers are used, but debugging
2205 symbols are `\fBdbx\fR'\-style stabs whose strings are located in the `\fB.debug\fR'
2206 section (rather than the string table).  For more information, see
2207 *note Top: (stabs)Top.
2208 .PP
2209 The shared library scheme has a clean interface for figuring out what
2210 shared libraries are in use, but the catch is that everything which
2211 refers to addresses (symbol tables and breakpoints at least) needs to be
2212 relocated for both shared libraries and the main executable.  At least
2213 using the standard mechanism this can only be done once the program has
2214 been run (or the core file has been read).
2215 .PP
2216 8.4.5 \s-1PE
2217 \&\-\-\-\-\-\-\-\-\s0
2218 .PP
2219 Windows 95 and \s-1NT\s0 use the \s-1PE \s0(\*(L"Portable Executable\*(R") format for their
2220 executables.  \s-1PE\s0 is basically \s-1COFF\s0 with additional headers.
2221 .PP
2222 While \s-1BFD\s0 includes special \s-1PE\s0 support, \s-1GDB\s0 needs only the basic \s-1COFF\s0
2223 reader.
2224 .PP
2225 8.4.6 \s-1ELF
2226 \&\-\-\-\-\-\-\-\-\-\s0
2227 .PP
2228 The \s-1ELF\s0 format came with System V Release 4 (\s-1SVR4\s0) Unix.  \s-1ELF\s0 is
2229 similar to \s-1COFF\s0 in being organized into a number of sections, but it
2230 removes many of \s-1COFF\s0's limitations.  Debugging info may be either stabs
2231 encapsulated in \s-1ELF\s0 sections, or more commonly these days, \s-1DWARF.\s0
2232 .PP
2233 The basic \s-1ELF\s0 reader is in `\fBelfread.c\fR'.
2234 .PP
2235 8.4.7 \s-1SOM
2236 \&\-\-\-\-\-\-\-\-\-\s0
2237 .PP
2238 \&\s-1SOM\s0 is \s-1HP\s0's object file and debug format (not to be confused with \s-1IBM\s0's
2239 \&\s-1SOM,\s0 which is a cross-language \s-1ABI\s0).
2240 .PP
2241 The \s-1SOM\s0 reader is in `\fBsomread.c\fR'.
2242 .PP
2243 8.5 Debugging File Formats
2244 ==========================
2245 .PP
2246 This section describes characteristics of debugging information that
2247 are independent of the object file format.
2248 .PP
2249 8.5.1 stabs
2250 \&\-\-\-\-\-\-\-\-\-\-\-
2251 .PP
2252 `\fBstabs\fR' started out as special symbols within the `\fBa.out\fR' format.
2253 Since then, it has been encapsulated into other file formats, such as
2254 \&\s-1COFF\s0 and \s-1ELF.\s0
2255 .PP
2256 While `\fBdbxread.c\fR' does some of the basic stab processing, including
2257 for encapsulated versions, `\fBstabsread.c\fR' does the real work.
2258 .PP
2259 8.5.2 \s-1COFF
2260 \&\-\-\-\-\-\-\-\-\-\-\s0
2261 .PP
2262 The basic \s-1COFF\s0 definition includes debugging information.  The level of
2263 support is minimal and non-extensible, and is not often used.
2264 .PP
2265 8.5.3 Mips debug (Third Eye)
2266 \&\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
2267 .PP
2268 \&\s-1ECOFF\s0 includes a definition of a special debug format.
2269 .PP
2270 The file `\fBmdebugread.c\fR' implements reading for this format.
2271 .PP
2272 8.5.4 \s-1DWARF 2
2273 \&\-\-\-\-\-\-\-\-\-\-\-\-\-\s0
2274 .PP
2275 \&\s-1DWARF 2\s0 is an improved but incompatible version of \s-1DWARF 1.\s0
2276 .PP
2277 The \s-1DWARF 2\s0 reader is in `\fBdwarf2read.c\fR'.
2278 .PP
2279 8.5.5 Compressed \s-1DWARF 2
2280 \&\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\s0
2281 .PP
2282 Compressed \s-1DWARF 2\s0 is not technically a separate debugging format, but
2283 merely \s-1DWARF 2\s0 debug information that has been compressed.  In this
2284 format, every object-file section holding \s-1DWARF 2\s0 debugging information
2285 is compressed and prepended with a header.  (The section is also
2286 typically renamed, so a section called `\fB.debug_info\fR' in a \s-1DWARF 2\s0
2287 binary would be called `\fB.zdebug_info\fR' in a compressed \s-1DWARF 2\s0 binary.)
2288 The header is 12 bytes long:
2289 .PP
2290 4 bytes: see \*(L"the literal string \*(R"\s-1ZLIB""\s0
2291 .PP
2292 8 bytes: see \*(L"the uncompressed size of the section, in big-endian byte\*(R"
2293 .PP
2294 order.
2295 .PP
2296 The same reader is used for both compressed an normal \s-1DWARF 2\s0 info.
2297 Section decompression is done in `\fBzlib_decompress_section\fR' in
2298 `\fBdwarf2read.c\fR'.
2299 .PP
2300 8.5.6 \s-1DWARF 3
2301 \&\-\-\-\-\-\-\-\-\-\-\-\-\-\s0
2302 .PP
2303 \&\s-1DWARF 3\s0 is an improved version of \s-1DWARF 2.\s0
2304 .PP
2305 8.5.7 \s-1SOM
2306 \&\-\-\-\-\-\-\-\-\-\s0
2307 .PP
2308 Like \s-1COFF,\s0 the \s-1SOM\s0 definition includes debugging information.
2309 .PP
2310 8.6 Adding a New Symbol Reader to \s-1GDB\s0
2311 =====================================
2312 .PP
2313 If you are using an existing object file format (`\fBa.out\fR', \s-1COFF, ELF,\s0
2314 etc), there is probably little to be done.
2315 .PP
2316 If you need to add a new object file format, you must first add it to
2317 \&\s-1BFD. \s0 This is beyond the scope of this document.
2318 .PP
2319 You must then arrange for the \s-1BFD\s0 code to provide access to the
2320 debugging symbols.  Generally \s-1GDB\s0 will have to call swapping routines
2321 from \s-1BFD\s0 and a few other \s-1BFD\s0 internal routines to locate the debugging
2322 information.  As much as possible, \s-1GDB\s0 should not depend on the \s-1BFD\s0
2323 internal data structures.
2324 .PP
2325 For some targets (e.g., \s-1COFF\s0), there is a special transfer vector
2326 used to call swapping routines, since the external data structures on
2327 various platforms have different sizes and layouts.  Specialized
2328 routines that will only ever be implemented by one object file format
2329 may be called directly.  This interface should be described in a file
2330 `\fBbfd/libXYZ.h\fR', which is included by \s-1GDB.\s0
2331 .PP
2332 8.7 Memory Management for Symbol Files
2333 ======================================
2334 .PP
2335 Most memory associated with a loaded symbol file is stored on its
2336 `\fBobjfile_obstack\fR'.  This includes symbols, types, namespace data, and
2337 other information produced by the symbol readers.
2338 .PP
2339 Because this data lives on the objfile's obstack, it is automatically
2340 released when the objfile is unloaded or reloaded.  Therefore one
2341 objfile must not reference symbol or type data from another objfile;
2342 they could be unloaded at different times.
2343 .PP
2344 User convenience variables, et cetera, have associated types.
2345 Normally these types live in the associated objfile.  However, when the
2346 objfile is unloaded, those types are deep copied to global memory, so
2347 that the values of the user variables and history items are not lost.
2348 .SS "9 Language Support"
2349 .IX Subsection "9 Language Support"
2350 \&\s-1GDB\s0's language support is mainly driven by the symbol reader, although
2351 it is possible for the user to set the source language manually.
2352 .PP
2353 \&\s-1GDB\s0 chooses the source language by looking at the extension of the
2354 file recorded in the debug info; `\fB.c\fR' means C, `\fB.f\fR' means Fortran, etc.
2355 It may also use a special-purpose language identifier if the debug
2356 format supports it, like with \s-1DWARF.\s0
2357 .PP
2358 9.1 Adding a Source Language to \s-1GDB\s0
2359 ===================================
2360 .PP
2361 To add other languages to \s-1GDB\s0's expression parser, follow the following
2362 steps:
2363 .PP
2364 _Create the expression parser._
2365 This should reside in a file `\fBLANG\-exp.y\fR'.  Routines for building
2366 parsed expressions into a `\fBunion exp_element\fR' list are in
2367 `\fBparse.c\fR'.
2368 .PP
2369 Since we can't depend upon everyone having Bison, and \s-1YACC\s0 produces
2370 parsers that define a bunch of global names, the following lines
2371 *must* be included at the top of the \s-1YACC\s0 parser, to prevent the
2372 various parsers from defining the same global names:
2373 .PP
2374 #define yyparse         LANG_parse
2375 #define yylex           LANG_lex
2376 #define yyerror         LANG_error
2377 #define yylval          LANG_lval
2378 #define yychar          LANG_char
2379 #define yydebug         LANG_debug
2380 #define yypact          LANG_pact
2381 #define yyr1            LANG_r1
2382 #define yyr2            LANG_r2
2383 #define yydef           LANG_def
2384 #define yychk           LANG_chk
2385 #define yypgo           LANG_pgo
2386 #define yyact           LANG_act
2387 #define yyexca          LANG_exca
2388 #define yyerrflag       LANG_errflag
2389 #define yynerrs         LANG_nerrs
2390 .PP
2391 At the bottom of your parser, define a `\fBstruct language_defn\fR' and
2392 initialize it with the right values for your language.  Define an
2393 `\fBinitialize_LANG\fR' routine and have it call
2394 `\fBadd_language(LANG_language_defn)\fR' to tell the rest of \s-1GDB\s0 that
2395 your language exists.  You'll need some other supporting variables
2396 and functions, which will be used via pointers from your
2397 `\fBLANG_language_defn\fR'.  See the declaration of `struct
2398 language_defn' in `\fBlanguage.h\fR', and the other `\fB*\-exp.y\fR' files, for
2399 more information.
2400 .PP
2401 _Add any evaluation routines, if necessary_
2402 If you need new opcodes (that represent the operations of the
2403 language), add them to the enumerated type in `\fBexpression.h\fR'.  Add
2404 support code for these operations in the `\fBevaluate_subexp\fR' function
2405 defined in the file `\fBeval.c\fR'.  Add cases for new opcodes in two
2406 functions from `\fBparse.c\fR': `\fBprefixify_subexp\fR' and
2407 `\fBlength_of_subexp\fR'.  These compute the number of `\fBexp_element\fR's
2408 that a given operation takes up.
2409 .PP
2410 _Update some existing code_
2411 Add an enumerated identifier for your language to the enumerated
2412 type `\fBenum language\fR' in `\fBdefs.h\fR'.
2413 .PP
2414 Update the routines in `\fBlanguage.c\fR' so your language is included.
2415 These routines include type predicates and such, which (in some
2416 cases) are language dependent.  If your language does not appear
2417 in the switch statement, an error is reported.
2418 .PP
2419 Also included in `\fBlanguage.c\fR' is the code that updates the variable
2420 `\fBcurrent_language\fR', and the routines that translate the
2421 `\fBlanguage_LANG\fR' enumerated identifier into a printable string.
2422 .PP
2423 Update the function `\fB_initialize_language\fR' to include your
2424 language.  This function picks the default language upon startup,
2425 so is dependent upon which languages that \s-1GDB\s0 is built for.
2426 .PP
2427 Update `\fBallocate_symtab\fR' in `\fBsymfile.c\fR' and/or symbol-reading code
2428 so that the language of each symtab (source file) is set properly.
2429 This is used to determine the language to use at each stack frame
2430 level.  Currently, the language is set based upon the extension of
2431 the source file.  If the language can be better inferred from the
2432 symbol information, please set the language of the symtab in the
2433 symbol-reading code.
2434 .PP
2435 Add helper code to `\fBprint_subexp\fR' (in `\fBexpprint.c\fR') to handle any
2436 new expression opcodes you have added to `\fBexpression.h\fR'.  Also,
2437 add the printed representations of your operators to
2438 `\fBop_print_tab\fR'.
2439 .PP
2440 _Add a place of call_
2441 Add a call to `\fB\f(BILANG_parse()\fB\fR' and `\fBLANG_error\fR' in `\fBparse_exp_1\fR'
2442 (defined in `\fBparse.c\fR').
2443 .PP
2444 _Edit `\fBMakefile.in\fR'_
2445 Add dependencies in `\fBMakefile.in\fR'.  Make sure you update the macro
2446 variables such as `\fB\s-1HFILES\s0\fR' and `\fB\s-1OBJS\s0\fR', otherwise your code may not
2447 get linked in, or, worse yet, it may not get `\fBtar\fR'red into the
2448 distribution!
2449 .SS "10 Host Definition"
2450 .IX Subsection "10 Host Definition"
2451 With the advent of Autoconf, it's rarely necessary to have host
2452 definition machinery anymore.  The following information is provided,
2453 mainly, as an historical reference.
2454 .PP
2455 10.1 Adding a New Host
2456 ======================
2457 .PP
2458 \&\s-1GDB\s0's host configuration support normally happens via Autoconf.  New
2459 host-specific definitions should not be needed.  Older hosts \s-1GDB\s0 still
2460 use the host-specific definitions and files listed below, but these
2461 mostly exist for historical reasons, and will eventually disappear.
2462 .PP
2463 `\fBgdb/config/ARCH/XYZ.mh\fR'
2464 This file is a Makefile fragment that once contained both host and
2465 native configuration information (see \*(L"Native Debugging\*(R") for the
2466 machine \s-1XYZ. \s0 The host configuration information is now handled by
2467 Autoconf.
2468 .PP
2469 Host configuration information included definitions for `\fB\s-1CC\s0\fR',
2470 `\fB\s-1SYSV_DEFINE\s0\fR', `\fB\s-1XM_CFLAGS\s0\fR', `\fB\s-1XM_ADD_FILES\s0\fR', `\fB\s-1XM_CLIBS\s0\fR',
2471 `\fB\s-1XM_CDEPS\s0\fR', etc.; see `\fBMakefile.in\fR'.
2472 .PP
2473 New host-only configurations do not need this file.
2474 .PP
2475 (Files named `\fBgdb/config/ARCH/xm\-XYZ.h\fR' were once used to define
2476 host-specific macros, but were no longer needed and have all been
2477 removed.)
2478 .PP
2479 Generic Host Support Files
2480 \&\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
2481 .PP
2482 There are some \*(L"generic\*(R" versions of routines that can be used by
2483 various systems.
2484 .PP
2485 `\fBser\-unix.c\fR'
2486 This contains serial line support for Unix systems.  It is
2487 included by default on all Unix-like hosts.
2488 .PP
2489 `\fBser\-pipe.c\fR'
2490 This contains serial pipe support for Unix systems.  It is
2491 included by default on all Unix-like hosts.
2492 .PP
2493 `\fBser\-mingw.c\fR'
2494 This contains serial line support for 32\-bit programs running under
2495 Windows using MinGW.
2496 .PP
2497 `\fBser\-go32.c\fR'
2498 This contains serial line support for 32\-bit programs running
2499 under \s-1DOS,\s0 using the \s-1DJGPP \s0(a.k.a. \s-1GO32\s0) execution environment.
2500 .PP
2501 `\fBser\-tcp.c\fR'
2502 This contains generic \s-1TCP\s0 support using sockets.  It is included by
2503 default on all Unix-like hosts and with MinGW.
2504 .PP
2505 10.2 Host Conditionals
2506 ======================
2507 .PP
2508 When \s-1GDB\s0 is configured and compiled, various macros are defined or left
2509 undefined, to control compilation based on the attributes of the host
2510 system.  While formerly they could be set in host-specific header
2511 files, at present they can be changed only by setting `\fB\s-1CFLAGS\s0\fR' when
2512 building, or by editing the source code.
2513 .PP
2514 These macros and their meanings (or if the meaning is not documented
2515 here, then one of the source files where they are used is indicated)
2516 are:
2517 .PP
2518 `\fB\s-1GDBINIT_FILENAME\s0\fR'
2519 The default name of \s-1GDB\s0's initialization file (normally
2520 `\fB.gdbinit\fR').
2521 .PP
2522 `\fB\s-1CRLF_SOURCE_FILES\s0\fR'
2523 Define this if host files use `\fB\er\en\fR' rather than `\fB\en\fR' as a line
2524 terminator.  This will cause source file listings to omit `\fB\er\fR'
2525 characters when printing and it will allow `\fB\er\en\fR' line endings of
2526 files which are \*(L"sourced\*(R" by gdb.  It must be possible to open
2527 files in binary mode using `\fBO_BINARY\fR' or, for fopen, `\fB\*(L"rb\*(R"\fR'.
2528 .PP
2529 `\fB\s-1DEFAULT_PROMPT\s0\fR'
2530 The default value of the prompt string (normally `\fB\*(L"(gdb) \*(R"\fR').
2531 .PP
2532 `\fB\s-1DEV_TTY\s0\fR'
2533 The name of the generic \s-1TTY\s0 device, defaults to `\fB\*(L"/dev/tty\*(R"\fR'.
2534 .PP
2535 `\fB\s-1ISATTY\s0\fR'
2536 Substitute for isatty, if not available.
2537 .PP
2538 `\fB\s-1FOPEN_RB\s0\fR'
2539 Define this if binary files are opened the same way as text files.
2540 .PP
2541 `\fB\s-1PRINTF_HAS_LONG_LONG\s0\fR'
2542 Define this if the host can handle printing of long long integers
2543 via the printf format conversion specifier `\fBll\fR'.  This is set by
2544 the `\fBconfigure\fR' script.
2545 .PP
2546 `\fB\s-1LSEEK_NOT_LINEAR\s0\fR'
2547 Define this if `\fBlseek (n)\fR' does not necessarily move to byte number
2548 `\fBn\fR' in the file.  This is only used when reading source files.  It
2549 is normally faster to define `\fB\s-1CRLF_SOURCE_FILES\s0\fR' when possible.
2550 .PP
2551 `\fBlint\fR'
2552 Define this to help placate `\fBlint\fR' in some situations.
2553 .PP
2554 `\fBvolatile\fR'
2555 Define this to override the defaults of `\fB_\|_volatile_\|_\fR' or `\fB/**/\fR'.
2556 .SS "11 Target Architecture Definition"
2557 .IX Subsection "11 Target Architecture Definition"
2558 \&\s-1GDB\s0's target architecture defines what sort of machine-language
2559 programs \s-1GDB\s0 can work with, and how it works with them.
2560 .PP
2561 The target architecture object is implemented as the C structure
2562 `\fBstruct gdbarch *\fR'.  The structure, and its methods, are generated
2563 using the Bourne shell script `\fBgdbarch.sh\fR'.
2564 .PP
2565 * Menu:
2566 .PP
2567 See also \*(L"\s-1OS ABI\s0 Variant Handling\*(R"
2568 .PP
2569 See also \*(L"Initialize New Architecture\*(R"
2570 .PP
2571 See also \*(L"Registers and Memory\*(R"
2572 .PP
2573 See also \*(L"Pointers and Addresses\*(R"
2574 .PP
2575 See also \*(L"Address Classes\*(R"
2576 .PP
2577 See also \*(L"Register Representation\*(R"
2578 .PP
2579 See also \*(L"Frame Interpretation\*(R"
2580 .PP
2581 See also \*(L"Inferior Call Setup\*(R"
2582 .PP
2583 See also \*(L"Adding support for debugging core files\*(R"
2584 .PP
2585 See also \*(L"Defining Other Architecture Features\*(R"
2586 .PP
2587 See also \*(L"Adding a New Target\*(R"
2588 .PP
2589 \&\fB11.1 Operating System \s-1ABI\s0 Variant Handling\fR
2590 .PP
2591 \&\s-1GDB\s0 provides a mechanism for handling variations in \s-1OS\s0 ABIs.  An \s-1OS ABI\s0
2592 variant may have influence over any number of variables in the target
2593 architecture definition.  There are two major components in the \s-1OS ABI\s0
2594 mechanism: sniffers and handlers.
2595 .PP
2596 A \*(L"sniffer\*(R" examines a file matching a \s-1BFD\s0 architecture/flavour pair
2597 (the architecture may be wildcarded) in an attempt to determine the \s-1OS
2598 ABI\s0 of that file.  Sniffers with a wildcarded architecture are
2599 considered to be \*(L"generic\*(R", while sniffers for a specific architecture
2600 are considered to be \*(L"specific\*(R".  A match from a specific sniffer
2601 overrides a match from a generic sniffer.  Multiple sniffers for an
2602 architecture/flavour may exist, in order to differentiate between two
2603 different operating systems which use the same basic file format.  The
2604 \&\s-1OS ABI\s0 framework provides a generic sniffer for ELF-format files which
2605 examines the `\fB\s-1EI_OSABI\s0\fR' field of the \s-1ELF\s0 header, as well as note
2606 sections known to be used by several operating systems.
2607 .PP
2608 A \*(L"handler\*(R" is used to fine-tune the `\fBgdbarch\fR' structure for the
2609 selected \s-1OS ABI. \s0 There may be only one handler for a given \s-1OS ABI\s0 for
2610 each \s-1BFD\s0 architecture.
2611 .PP
2612 The following \s-1OS ABI\s0 variants are defined in `\fBdefs.h\fR':
2613 .PP
2614 `\fB\s-1GDB_OSABI_UNINITIALIZED\s0\fR'
2615 Used for struct gdbarch_info if \s-1ABI\s0 is still uninitialized.
2616 .PP
2617 `\fB\s-1GDB_OSABI_UNKNOWN\s0\fR'
2618 The \s-1ABI\s0 of the inferior is unknown.  The default `\fBgdbarch\fR'
2619 settings for the architecture will be used.
2620 .PP
2621 `\fB\s-1GDB_OSABI_SVR4\s0\fR'
2622 \&\s-1UNIX\s0 System V Release 4.
2623 .PP
2624 `\fB\s-1GDB_OSABI_HURD\s0\fR'
2625 \&\s-1GNU\s0 using the Hurd kernel.
2626 .PP
2627 `\fB\s-1GDB_OSABI_SOLARIS\s0\fR'
2628 Sun Solaris.
2629 .PP
2630 `\fB\s-1GDB_OSABI_OSF1\s0\fR'
2631 \&\s-1OSF/1,\s0 including Digital \s-1UNIX\s0 and Compaq Tru64 \s-1UNIX.\s0
2632 .PP
2633 `\fB\s-1GDB_OSABI_LINUX\s0\fR'
2634 \&\s-1GNU\s0 using the Linux kernel.
2635 .PP
2636 `\fB\s-1GDB_OSABI_FREEBSD_AOUT\s0\fR'
2637 FreeBSD using the `\fBa.out\fR' executable format.
2638 .PP
2639 `\fB\s-1GDB_OSABI_FREEBSD_ELF\s0\fR'
2640 FreeBSD using the \s-1ELF\s0 executable format.
2641 .PP
2642 `\fB\s-1GDB_OSABI_NETBSD_AOUT\s0\fR'
2643 NetBSD using the `\fBa.out\fR' executable format.
2644 .PP
2645 `\fB\s-1GDB_OSABI_NETBSD_ELF\s0\fR'
2646 NetBSD using the \s-1ELF\s0 executable format.
2647 .PP
2648 `\fB\s-1GDB_OSABI_OPENBSD_ELF\s0\fR'
2649 OpenBSD using the \s-1ELF\s0 executable format.
2650 .PP
2651 `\fB\s-1GDB_OSABI_WINCE\s0\fR'
2652 Windows \s-1CE.\s0
2653 .PP
2654 `\fB\s-1GDB_OSABI_GO32\s0\fR'
2655 \&\s-1DJGPP.\s0
2656 .PP
2657 `\fB\s-1GDB_OSABI_IRIX\s0\fR'
2658 Irix.
2659 .PP
2660 `\fB\s-1GDB_OSABI_INTERIX\s0\fR'
2661 Interix (Posix layer for MS-Windows systems).
2662 .PP
2663 `\fB\s-1GDB_OSABI_HPUX_ELF\s0\fR'
2664 \&\s-1HP/UX\s0 using the \s-1ELF\s0 executable format.
2665 .PP
2666 `\fB\s-1GDB_OSABI_HPUX_SOM\s0\fR'
2667 \&\s-1HP/UX\s0 using the \s-1SOM\s0 executable format.
2668 .PP
2669 `\fB\s-1GDB_OSABI_QNXNTO\s0\fR'
2670 \&\s-1QNX\s0 Neutrino.
2671 .PP
2672 `\fB\s-1GDB_OSABI_CYGWIN\s0\fR'
2673 Cygwin.
2674 .PP
2675 `\fB\s-1GDB_OSABI_AIX\s0\fR'
2676 \&\s-1AIX.\s0
2677 .PP
2678 Here are the functions that make up the \s-1OS ABI\s0 framework:
2679 .PP
2680 \&\-\- Function: const char * gdbarch_osabi_name (enum gdb_osabi \s-1OSABI\s0)
2681 Return the name of the \s-1OS ABI\s0 corresponding to \s-1OSABI.\s0
2682 .PP
2683 \&\-\- Function: void gdbarch_register_osabi (enum bfd_architecture \s-1ARCH,\s0
2684 unsigned long \s-1MACHINE,\s0 enum gdb_osabi \s-1OSABI,\s0 void
2685 (*INIT_OSABI)(struct gdbarch_info \s-1INFO,\s0 struct gdbarch
2686 *GDBARCH))
2687 Register the \s-1OS ABI\s0 handler specified by \s-1INIT_OSABI\s0 for the
2688 architecture, machine type and \s-1OS ABI\s0 specified by \s-1ARCH, MACHINE\s0
2689 and \s-1OSABI. \s0 In most cases, a value of zero for the machine type,
2690 which implies the architecture's default machine type, will
2691 suffice.
2692 .PP
2693 \&\-\- Function: void gdbarch_register_osabi_sniffer (enum
2694 bfd_architecture \s-1ARCH,\s0 enum bfd_flavour \s-1FLAVOUR,\s0 enum
2695 gdb_osabi (*SNIFFER)(bfd *ABFD))
2696 Register the \s-1OS ABI\s0 file sniffer specified by \s-1SNIFFER\s0 for the \s-1BFD\s0
2697 architecture/flavour pair specified by \s-1ARCH\s0 and \s-1FLAVOUR. \s0 If \s-1ARCH\s0
2698 is `\fBbfd_arch_unknown\fR', the sniffer is considered to be generic,
2699 and is allowed to examine FLAVOUR-flavoured files for any
2700 architecture.
2701 .PP
2702 \&\-\- Function: enum gdb_osabi gdbarch_lookup_osabi (bfd *ABFD)
2703 Examine the file described by \s-1ABFD\s0 to determine its \s-1OS ABI. \s0 The
2704 value `\fB\s-1GDB_OSABI_UNKNOWN\s0\fR' is returned if the \s-1OS ABI\s0 cannot be
2705 determined.
2706 .PP
2707 \&\-\- Function: void gdbarch_init_osabi (struct gdbarch info \s-1INFO,\s0 struct
2708 gdbarch *GDBARCH, enum gdb_osabi \s-1OSABI\s0)
2709 Invoke the \s-1OS ABI\s0 handler corresponding to \s-1OSABI\s0 to fine-tune the
2710 `\fBgdbarch\fR' structure specified by \s-1GDBARCH. \s0 If a handler
2711 corresponding to \s-1OSABI\s0 has not been registered for \s-1GDBARCH\s0's
2712 architecture, a warning will be issued and the debugging session
2713 will continue with the defaults already established for \s-1GDBARCH.\s0
2714 .PP
2715 \&\-\- Function: void generic_elf_osabi_sniff_abi_tag_sections (bfd *ABFD,
2716 asection *SECT, void *OBJ)
2717 Helper routine for \s-1ELF\s0 file sniffers.  Examine the file described
2718 by \s-1ABFD\s0 and look at \s-1ABI\s0 tag note sections to determine the \s-1OS ABI\s0
2719 from the note.  This function should be called via
2720 `\fBbfd_map_over_sections\fR'.
2721 .PP
2722 \&\fB11.2 Initializing a New Architecture\fR
2723 .PP
2724 * Menu:
2725 .PP
2726 See also \*(L"How an Architecture is Represented\*(R"
2727 .PP
2728 See also \*(L"Looking Up an Existing Architecture\*(R"
2729 .PP
2730 See also \*(L"Creating a New Architecture\*(R"
2731 .PP
2732 \&\fB11.2.1 How an Architecture is Represented\fR
2733 .PP
2734 Each `\fBgdbarch\fR' is associated with a single \s-1BFD\s0 architecture, via a
2735 `\fBbfd_arch_ARCH\fR' in the `\fBbfd_architecture\fR' enumeration.  The `\fBgdbarch\fR'
2736 is registered by a call to `\fBregister_gdbarch_init\fR', usually from the
2737 file's `\fB_initialize_FILENAME\fR' routine, which will be automatically
2738 called during \s-1GDB\s0 startup.  The arguments are a \s-1BFD\s0 architecture
2739 constant and an initialization function.
2740 .PP
2741 A \s-1GDB\s0 description for a new architecture, \s-1ARCH\s0 is created by
2742 defining a global function `\fB_initialize_ARCH_tdep\fR', by convention in
2743 the source file `\fBARCH\-tdep.c\fR'.  For example, in the case of the
2744 OpenRISC 1000, this function is called `\fB_initialize_or1k_tdep\fR' and is
2745 found in the file `\fBor1k\-tdep.c\fR'.
2746 .PP
2747 The resulting object files containing the implementation of the
2748 `\fB_initialize_ARCH_tdep\fR' function are specified in the \s-1GDB\s0
2749 `\fBconfigure.tgt\fR' file, which includes a large case statement pattern
2750 matching against the `\fB\-\-target\fR' option of the `\fBconfigure\fR' script.  The
2751 new `\fBstruct gdbarch\fR' is created within the `\fB_initialize_ARCH_tdep\fR'
2752 function by calling `\fBgdbarch_register\fR':
2753 .PP
2754 void gdbarch_register (enum bfd_architecture    \s-1ARCHITECTURE,\s0
2755 gdbarch_init_ftype      *INIT_FUNC,
2756 gdbarch_dump_tdep_ftype *TDEP_DUMP_FUNC);
2757 .PP
2758 The \s-1ARCHITECTURE\s0 will identify the unique \s-1BFD\s0 to be associated with
2759 this `\fBgdbarch\fR'.  The \s-1INIT_FUNC\s0 funciton is called to create and return
2760 the new `\fBstruct gdbarch\fR'.  The \s-1TDEP_DUMP_FUNC\s0 function will dump the
2761 target specific details associated with this architecture.
2762 .PP
2763 For example the function `\fB_initialize_or1k_tdep\fR' creates its
2764 architecture for 32\-bit OpenRISC 1000 architectures by calling:
2765 .PP
2766 gdbarch_register (bfd_arch_or32, or1k_gdbarch_init, or1k_dump_tdep);
2767 .PP
2768 \&\fB11.2.2 Looking Up an Existing Architecture\fR
2769 .PP
2770 The initialization function has this prototype:
2771 .PP
2772 static struct gdbarch *
2773 ARCH_gdbarch_init (struct gdbarch_info \s-1INFO,\s0
2774 struct gdbarch_list *ARCHES)
2775 .PP
2776 The \s-1INFO\s0 argument contains parameters used to select the correct
2777 architecture, and \s-1ARCHES\s0 is a list of architectures which have already
2778 been created with the same `\fBbfd_arch_ARCH\fR' value.
2779 .PP
2780 The initialization function should first make sure that \s-1INFO\s0 is
2781 acceptable, and return `\fB\s-1NULL\s0\fR' if it is not.  Then, it should search
2782 through \s-1ARCHES\s0 for an exact match to \s-1INFO,\s0 and return one if found.
2783 Lastly, if no exact match was found, it should create a new
2784 architecture based on \s-1INFO\s0 and return it.
2785 .PP
2786 The lookup is done using `\fBgdbarch_list_lookup_by_info\fR'.  It is
2787 passed the list of existing architectures, \s-1ARCHES,\s0 and the `struct
2788 gdbarch_info', \s-1INFO,\s0 and returns the first matching architecture it
2789 finds, or `\fB\s-1NULL\s0\fR' if none are found.  If an architecture is found it can
2790 be returned as the result from the initialization function, otherwise a
2791 new `\fBstruct gdbach\fR' will need to be created.
2792 .PP
2793 The struct gdbarch_info has the following components:
2794 .PP
2795 struct gdbarch_info
2796 {
2797 const struct bfd_arch_info *bfd_arch_info;
2798 int                         byte_order;
2799 bfd                        *abfd;
2800 struct gdbarch_tdep_info   *tdep_info;
2801 enum gdb_osabi              osabi;
2802 const struct target_desc   *target_desc;
2803 };
2804 .PP
2805 The `\fBbfd_arch_info\fR' member holds the key details about the
2806 architecture.  The `\fBbyte_order\fR' member is a value in an enumeration
2807 indicating the endianism.  The `\fBabfd\fR' member is a pointer to the full
2808 \&\s-1BFD,\s0 the `\fBtdep_info\fR' member is additional custom target specific
2809 information, `\fBosabi\fR' identifies which (if any) of a number of operating
2810 specific ABIs are used by this architecture and the `\fBtarget_desc\fR'
2811 member is a set of name-value pairs with information about register
2812 usage in this target.
2813 .PP
2814 When the `\fBstruct gdbarch\fR' initialization function is called, not all
2815 the fields are provided\*(--only those which can be deduced from the \s-1BFD.\s0
2816 The `\fBstruct gdbarch_info\fR', \s-1INFO\s0 is used as a look-up key with the list
2817 of existing architectures, \s-1ARCHES\s0 to see if a suitable architecture
2818 already exists.  The \s-1TDEP_INFO, OSABI\s0 and \s-1TARGET_DESC\s0 fields may be
2819 added before this lookup to refine the search.
2820 .PP
2821 Only information in \s-1INFO\s0 should be used to choose the new
2822 architecture.  Historically, \s-1INFO\s0 could be sparse, and defaults would
2823 be collected from the first element on \s-1ARCHES. \s0 However, \s-1GDB\s0 now fills
2824 in \s-1INFO\s0 more thoroughly, so new `\fBgdbarch\fR' initialization functions
2825 should not take defaults from \s-1ARCHES.\s0
2826 .PP
2827 \&\fB11.2.3 Creating a New Architecture\fR
2828 .PP
2829 If no architecture is found, then a new architecture must be created,
2830 by calling `\fBgdbarch_alloc\fR' using the supplied `\fBstruct gdbarch_info\fR' and
2831 any additional custom target specific information in a `struct
2832 gdbarch_tdep'.  The prototype for `\fBgdbarch_alloc\fR' is:
2833 .PP
2834 struct gdbarch *gdbarch_alloc (const struct gdbarch_info *INFO,
2835 struct gdbarch_tdep       *TDEP);
2836 .PP
2837 The newly created struct gdbarch must then be populated.  Although
2838 there are default values, in most cases they are not what is required.
2839 .PP
2840 For each element, X, there is are a pair of corresponding accessor
2841 functions, one to set the value of that element, `\fBset_gdbarch_X\fR', the
2842 second to either get the value of an element (if it is a variable) or
2843 to apply the element (if it is a function), `\fBgdbarch_X\fR'.  Note that
2844 both accessor functions take a pointer to the `\fBstruct gdbarch\fR' as first
2845 argument.  Populating the new `\fBgdbarch\fR' should use the `\fBset_gdbarch\fR'
2846 functions.
2847 .PP
2848 The following sections identify the main elements that should be set
2849 in this way.  This is not the complete list, but represents the
2850 functions and elements that must commonly be specified for a new
2851 architecture.  Many of the functions and variables are described in the
2852 header file `\fBgdbarch.h\fR'.
2853 .PP
2854 This is the main work in defining a new architecture.  Implementing
2855 the set of functions to populate the `\fBstruct gdbarch\fR'.
2856 .PP
2857 `\fBstruct gdbarch_tdep\fR' is not defined within GDB\*(--it is up to the
2858 user to define this struct if it is needed to hold custom target
2859 information that is not covered by the standard `\fBstruct gdbarch\fR'. For
2860 example with the OpenRISC 1000 architecture it is used to hold the
2861 number of matchpoints available in the target (along with other
2862 information).
2863 .PP
2864 If there is no additional target specific information, it can be set
2865 to `\fB\s-1NULL\s0\fR'.
2866 .PP
2867 \&\fB11.3 Registers and Memory\fR
2868 .PP
2869 \&\s-1GDB\s0's model of the target machine is rather simple.  \s-1GDB\s0 assumes the
2870 machine includes a bank of registers and a block of memory.  Each
2871 register may have a different size.
2872 .PP
2873 \&\s-1GDB\s0 does not have a magical way to match up with the compiler's idea
2874 of which registers are which; however, it is critical that they do
2875 match up accurately.  The only way to make this work is to get accurate
2876 information about the order that the compiler uses, and to reflect that
2877 in the `\fBgdbarch_register_name\fR' and related functions.
2878 .PP
2879 \&\s-1GDB\s0 can handle big-endian, little-endian, and bi-endian
2880 architectures.
2881 .PP
2882 \&\fB11.4 Pointers Are Not Always Addresses\fR
2883 .PP
2884 On almost all 32\-bit architectures, the representation of a pointer is
2885 indistinguishable from the representation of some fixed-length number
2886 whose value is the byte address of the object pointed to.  On such
2887 machines, the words \*(L"pointer\*(R" and \*(L"address\*(R" can be used interchangeably.
2888 However, architectures with smaller word sizes are often cramped for
2889 address space, so they may choose a pointer representation that breaks
2890 this identity, and allows a larger code address space.
2891 .PP
2892 For example, the Renesas D10V is a 16\-bit \s-1VLIW\s0 processor whose
2893 instructions are 32 bits \fIlong\fR\|(1).  If the D10V used ordinary byte
2894 addresses to refer to code locations, then the processor would only be
2895 able to address 64kb of instructions.  However, since instructions must
2896 be aligned on four-byte boundaries, the low two bits of any valid
2897 instruction's byte address are always zero\*(--byte addresses waste two
2898 bits.  So instead of byte addresses, the D10V uses word addresses\*(--byte
2899 addresses shifted right two bits\*(--to refer to code.  Thus, the D10V can
2900 use 16\-bit words to address 256kb of code space.
2901 .PP
2902 However, this means that code pointers and data pointers have
2903 different forms on the D10V.  The 16\-bit word `\fB0xC020\fR' refers to byte
2904 address `\fB0xC020\fR' when used as a data address, but refers to byte address
2905 `\fB0x30080\fR' when used as a code address.
2906 .PP
2907 (The D10V also uses separate code and data address spaces, which also
2908 affects the correspondence between pointers and addresses, but we're
2909 going to ignore that here; this example is already too long.)
2910 .PP
2911 To cope with architectures like this\*(--the D10V is not the only
2912 one!\-\-GDB tries to distinguish between \*(L"addresses\*(R", which are byte
2913 numbers, and \*(L"pointers\*(R", which are the target's representation of an
2914 address of a particular type of data.  In the example above, `\fB0xC020\fR'
2915 is the pointer, which refers to one of the addresses `\fB0xC020\fR' or
2916 `\fB0x30080\fR', depending on the type imposed upon it.  \s-1GDB\s0 provides
2917 functions for turning a pointer into an address and vice versa, in the
2918 appropriate way for the current architecture.
2919 .PP
2920 Unfortunately, since addresses and pointers are identical on almost
2921 all processors, this distinction tends to bit-rot pretty quickly.  Thus,
2922 each time you port \s-1GDB\s0 to an architecture which does distinguish
2923 between pointers and addresses, you'll probably need to clean up some
2924 architecture-independent code.
2925 .PP
2926 Here are functions which convert between pointers and addresses:
2927 .PP
2928 \&\-\- Function: \s-1CORE_ADDR\s0 extract_typed_address (void *BUF, struct type
2929 *TYPE)
2930 Treat the bytes at \s-1BUF\s0 as a pointer or reference of type \s-1TYPE,\s0 and
2931 return the address it represents, in a manner appropriate for the
2932 current architecture.  This yields an address \s-1GDB\s0 can use to read
2933 target memory, disassemble, etc.  Note that \s-1BUF\s0 refers to a buffer
2934 in \s-1GDB\s0's memory, not the inferior's.
2935 .PP
2936 For example, if the current architecture is the Intel x86, this
2937 function extracts a little-endian integer of the appropriate
2938 length from \s-1BUF\s0 and returns it.  However, if the current
2939 architecture is the D10V, this function will return a 16\-bit
2940 integer extracted from \s-1BUF,\s0 multiplied by four if \s-1TYPE\s0 is a
2941 pointer to a function.
2942 .PP
2943 If \s-1TYPE\s0 is not a pointer or reference type, then this function
2944 will signal an internal error.
2945 .PP
2946 \&\-\- Function: \s-1CORE_ADDR\s0 store_typed_address (void *BUF, struct type
2947 *TYPE, \s-1CORE_ADDR ADDR\s0)
2948 Store the address \s-1ADDR\s0 in \s-1BUF,\s0 in the proper format for a pointer
2949 of type \s-1TYPE\s0 in the current architecture.  Note that \s-1BUF\s0 refers to
2950 a buffer in \s-1GDB\s0's memory, not the inferior's.
2951 .PP
2952 For example, if the current architecture is the Intel x86, this
2953 function stores \s-1ADDR\s0 unmodified as a little-endian integer of the
2954 appropriate length in \s-1BUF. \s0 However, if the current architecture
2955 is the D10V, this function divides \s-1ADDR\s0 by four if \s-1TYPE\s0 is a
2956 pointer to a function, and then stores it in \s-1BUF.\s0
2957 .PP
2958 If \s-1TYPE\s0 is not a pointer or reference type, then this function
2959 will signal an internal error.
2960 .PP
2961 \&\-\- Function: \s-1CORE_ADDR\s0 value_as_address (struct value *VAL)
2962 Assuming that \s-1VAL\s0 is a pointer, return the address it represents,
2963 as appropriate for the current architecture.
2964 .PP
2965 This function actually works on integral values, as well as
2966 pointers.  For pointers, it performs architecture-specific
2967 conversions as described above for `\fBextract_typed_address\fR'.
2968 .PP
2969 \&\-\- Function: \s-1CORE_ADDR\s0 value_from_pointer (struct type *TYPE,
2970 \&\s-1CORE_ADDR ADDR\s0)
2971 Create and return a value representing a pointer of type \s-1TYPE\s0 to
2972 the address \s-1ADDR,\s0 as appropriate for the current architecture.
2973 This function performs architecture-specific conversions as
2974 described above for `\fBstore_typed_address\fR'.
2975 .PP
2976 Here are two functions which architectures can define to indicate the
2977 relationship between pointers and addresses.  These have default
2978 definitions, appropriate for architectures on which all pointers are
2979 simple unsigned byte addresses.
2980 .PP
2981 \&\-\- Function: \s-1CORE_ADDR\s0 gdbarch_pointer_to_address (struct gdbarch
2982 *GDBARCH, struct type *TYPE, char *BUF)
2983 Assume that \s-1BUF\s0 holds a pointer of type \s-1TYPE,\s0 in the appropriate
2984 format for the current architecture.  Return the byte address the
2985 pointer refers to.
2986 .PP
2987 This function may safely assume that \s-1TYPE\s0 is either a pointer or a
2988 \&\*(C+ reference type.
2989 .PP
2990 \&\-\- Function: void gdbarch_address_to_pointer (struct gdbarch *GDBARCH,
2991 struct type *TYPE, char *BUF, \s-1CORE_ADDR ADDR\s0)
2992 Store in \s-1BUF\s0 a pointer of type \s-1TYPE\s0 representing the address \s-1ADDR,\s0
2993 in the appropriate format for the current architecture.
2994 .PP
2995 This function may safely assume that \s-1TYPE\s0 is either a pointer or a
2996 \&\*(C+ reference type.
2997 .PP
2998 \&\-\-\-\-\-\-\-\-\-\- Footnotes \-\-\-\-\-\-\-\-\-\-
2999 .PP
3000 (1) Some D10V instructions are actually pairs of 16\-bit
3001 sub-instructions.  However, since you can't jump into the middle of
3002 such a pair, code addresses can only refer to full 32 bit instructions,
3003 which is what matters in this explanation.
3004 .PP
3005 \&\fB11.5 Address Classes\fR
3006 .PP
3007 Sometimes information about different kinds of addresses is available
3008 via the debug information.  For example, some programming environments
3009 define addresses of several different sizes.  If the debug information
3010 distinguishes these kinds of address classes through either the size
3011 info (e.g, `\fBDW_AT_byte_size\fR' in \s-1DWARF 2\s0) or through an explicit address
3012 class attribute (e.g, `\fBDW_AT_address_class\fR' in \s-1DWARF 2\s0), the following
3013 macros should be defined in order to disambiguate these types within
3014 \&\s-1GDB\s0 as well as provide the added information to a \s-1GDB\s0 user when
3015 printing type expressions.
3016 .PP
3017 \&\-\- Function: int gdbarch_address_class_type_flags (struct gdbarch
3018 *GDBARCH, int \s-1BYTE_SIZE,\s0 int \s-1DWARF2_ADDR_CLASS\s0)
3019 Returns the type flags needed to construct a pointer type whose
3020 size is \s-1BYTE_SIZE\s0 and whose address class is \s-1DWARF2_ADDR_CLASS.\s0
3021 This function is normally called from within a symbol reader.  See
3022 `\fBdwarf2read.c\fR'.
3023 .PP
3024 \&\-\- Function: char * gdbarch_address_class_type_flags_to_name (struct
3025 gdbarch *GDBARCH, int \s-1TYPE_FLAGS\s0)
3026 Given the type flags representing an address class qualifier,
3027 return its name.
3028 .PP
3029 \&\-\- Function: int gdbarch_address_class_name_to_type_flags (struct
3030 gdbarch *GDBARCH, int \s-1NAME,\s0 int *TYPE_FLAGS_PTR)
3031 Given an address qualifier name, set the `\fBint\fR' referenced by
3032 \&\s-1TYPE_FLAGS_PTR\s0 to the type flags for that address class qualifier.
3033 .PP
3034 Since the need for address classes is rather rare, none of the
3035 address class functions are defined by default.  Predicate functions
3036 are provided to detect when they are defined.
3037 .PP
3038 Consider a hypothetical architecture in which addresses are normally
3039 32\-bits wide, but 16\-bit addresses are also supported.  Furthermore,
3040 suppose that the \s-1DWARF 2\s0 information for this architecture simply uses
3041 a `\fBDW_AT_byte_size\fR' value of 2 to indicate the use of one of these
3042 \&\*(L"short\*(R" pointers.  The following functions could be defined to
3043 implement the address class functions:
3044 .PP
3045 somearch_address_class_type_flags (int byte_size,
3046 int dwarf2_addr_class)
3047 {
3048 if (byte_size == 2)
3049 return \s-1TYPE_FLAG_ADDRESS_CLASS_1\s0;
3050 else
3051 return 0;
3052 }
3053 .PP
3054 static char *
3055 somearch_address_class_type_flags_to_name (int type_flags)
3056 {
3057 if (type_flags & \s-1TYPE_FLAG_ADDRESS_CLASS_1\s0)
3058 return \*(L"short\*(R";
3059 else
3060 return \s-1NULL\s0;
3061 }
3062 .PP
3063 int
3064 somearch_address_class_name_to_type_flags (char *name,
3065 int *type_flags_ptr)
3066 {
3067 if (strcmp (name, \*(L"short\*(R") == 0)
3068 {
3069 *type_flags_ptr = \s-1TYPE_FLAG_ADDRESS_CLASS_1\s0;
3070 return 1;
3071 }
3072 else
3073 return 0;
3074 }
3075 .PP
3076 The qualifier `\fB\f(CB@short\fB\fR' is used in \s-1GDB\s0's type expressions to indicate
3077 the presence of one of these \*(L"short\*(R" pointers.  For example if the
3078 debug information indicates that `\fBshort_ptr_var\fR' is one of these short
3079 pointers, \s-1GDB\s0 might show the following behavior:
3080 .PP
3081 (gdb) ptype short_ptr_var
3082 type = int * \f(CW@short\fR
3083 .PP
3084 \&\fB11.6 Register Representation\fR
3085 .PP
3086 * Menu:
3087 .PP
3088 See also \*(L"Raw and Cooked Registers\*(R"
3089 .PP
3090 See also \*(L"Register Architecture Functions & Variables\*(R"
3091 .PP
3092 See also \*(L"Register Information Functions\*(R"
3093 .PP
3094 See also \*(L"Register and Memory Data\*(R"
3095 .PP
3096 See also \*(L"Register Caching\*(R"
3097 .PP
3098 \&\fB11.6.1 Raw and Cooked Registers\fR
3099 .PP
3100 \&\s-1GDB\s0 considers registers to be a set with members numbered linearly from
3101 0 upwards.  The first part of that set corresponds to real physical
3102 registers, the second part to any \*(L"pseudo-registers\*(R".  Pseudo-registers
3103 have no independent physical existence, but are useful representations
3104 of information within the architecture.  For example the OpenRISC 1000
3105 architecture has up to 32 general purpose registers, which are
3106 typically represented as 32\-bit (or 64\-bit) integers.  However the GPRs
3107 are also used as operands to the floating point operations, and it
3108 could be convenient to define a set of pseudo-registers, to show the
3109 GPRs represented as floating point values.
3110 .PP
3111 For any architecture, the implementer will decide on a mapping from
3112 hardware to \s-1GDB\s0 register numbers.  The registers corresponding to real
3113 hardware are referred to as \*(L"raw\*(R" registers, the remaining registers are
3114 \&\*(L"pseudo-registers\*(R".  The total register set (raw and pseudo) is called
3115 the \*(L"cooked\*(R" register set.
3116 .PP
3117 \&\fB11.6.2 Functions and Variables Specifying the Register Architecture\fR
3118 .PP
3119 These `\fBstruct gdbarch\fR' functions and variables specify the number and
3120 type of registers in the architecture.
3121 .PP
3122 \&\-\- Architecture Function: \s-1CORE_ADDR\s0 read_pc (struct regcache *REGCACHE)
3123 .PP
3124 \&\-\- Architecture Function: void write_pc (struct regcache *REGCACHE,
3125 \&\s-1CORE_ADDR VAL\s0)
3126 Read or write the program counter.  The default value of both
3127 functions is `\fB\s-1NULL\s0\fR' (no function available).  If the program
3128 counter is just an ordinary register, it can be specified in
3129 `\fBstruct gdbarch\fR' instead (see `\fBpc_regnum\fR' below) and it will be
3130 read or written using the standard routines to access registers.
3131 This function need only be specified if the program counter is not
3132 an ordinary register.
3133 .PP
3134 Any register information can be obtained using the supplied
3135 register cache, \s-1REGCACHE. \s0 *Note Register Caching: Register
3136 Caching.
3137 .PP
3138 \&\-\- Architecture Function: void pseudo_register_read (struct gdbarch
3139 *GDBARCH, struct regcache *REGCACHE, int \s-1REGNUM,\s0 const
3140 gdb_byte *BUF)
3141 .PP
3142 \&\-\- Architecture Function: void pseudo_register_write (struct gdbarch
3143 *GDBARCH, struct regcache *REGCACHE, int \s-1REGNUM,\s0 const
3144 gdb_byte *BUF)
3145 These functions should be defined if there are any
3146 pseudo-registers.  The default value is `\fB\s-1NULL\s0\fR'.  \s-1REGNUM\s0 is the
3147 number of the register to read or write (which will be a \*(L"cooked\*(R"
3148 register number) and \s-1BUF\s0 is the buffer where the value read will be
3149 placed, or from which the value to be written will be taken.  The
3150 value in the buffer may be converted to or from a signed or
3151 unsigned integral value using one of the utility functions (*note
3152 Using Different Register and Memory Data Representations: Register
3153 and Memory Data.).
3154 .PP
3155 The access should be for the specified architecture, \s-1GDBARCH. \s0 Any
3156 register information can be obtained using the supplied register
3157 cache, \s-1REGCACHE. \s0 *Note Register Caching: Register Caching.
3158 .PP
3159 \&\-\- Architecture Variable: int sp_regnum
3160 This specifies the register holding the stack pointer, which may
3161 be a raw or pseudo-register.  It defaults to \-1 (not defined), but
3162 it is an error for it not to be defined.
3163 .PP
3164 The value of the stack pointer register can be accessed withing
3165 \&\s-1GDB\s0 as the variable `\fB\f(CB$sp\fB\fR'.
3166 .PP
3167 \&\-\- Architecture Variable: int pc_regnum
3168 This specifies the register holding the program counter, which may
3169 be a raw or pseudo-register.  It defaults to \-1 (not defined).  If
3170 `\fBpc_regnum\fR' is not defined, then the functions `\fBread_pc\fR' and
3171 `\fBwrite_pc\fR' (see above) must be defined.
3172 .PP
3173 The value of the program counter (whether defined as a register, or
3174 through `\fBread_pc\fR' and `\fBwrite_pc\fR') can be accessed withing \s-1GDB\s0 as
3175 the variable `\fB\f(CB$pc\fB\fR'.
3176 .PP
3177 \&\-\- Architecture Variable: int ps_regnum
3178 This specifies the register holding the processor status (often
3179 called the status register), which may be a raw or
3180 pseudo-register.  It defaults to \-1 (not defined).
3181 .PP
3182 If defined, the value of this register can be accessed withing \s-1GDB\s0
3183 as the variable `\fB\f(CB$ps\fB\fR'.
3184 .PP
3185 \&\-\- Architecture Variable: int fp0_regnum
3186 This specifies the first floating point register.  It defaults to
3187 0.  `\fBfp0_regnum\fR' is not needed unless the target offers support
3188 for floating point.
3189 .PP
3190 \&\fB11.6.3 Functions Giving Register Information\fR
3191 .PP
3192 These functions return information about registers.
3193 .PP
3194 \&\-\- Architecture Function: const char * register_name (struct gdbarch
3195 *GDBARCH, int \s-1REGNUM\s0)
3196 This function should convert a register number (raw or pseudo) to a
3197 register name (as a C `\fBconst char *\fR').  This is used both to
3198 determine the name of a register for output and to work out the
3199 meaning of any register names used as input.  The function may
3200 also return `\fB\s-1NULL\s0\fR', to indicate that \s-1REGNUM\s0 is not a valid
3201 register.
3202 .PP
3203 For example with the OpenRISC 1000, \s-1GDB\s0 registers 0\-31 are the
3204 General Purpose Registers, register 32 is the program counter and
3205 register 33 is the supervision register (i.e. the processor status
3206 register), which map to the strings `\fB\*(L"gpr00\*(R"\fR' through `\fB\*(L"gpr31\*(R"\fR',
3207 `\fB\*(L"pc\*(R"\fR' and `\fB\*(L"sr\*(R"\fR' respectively. This means that the \s-1GDB\s0 command
3208 `\fBprint \f(CB$gpr5\fB\fR' should print the value of the \s-1OR1K\s0 general purpose
3209 register 5(1).
3210 .PP
3211 The default value for this function is `\fB\s-1NULL\s0\fR', meaning undefined.
3212 It should always be defined.
3213 .PP
3214 The access should be for the specified architecture, \s-1GDBARCH.\s0
3215 .PP
3216 \&\-\- Architecture Function: struct type * register_type (struct gdbarch
3217 *GDBARCH, int \s-1REGNUM\s0)
3218 Given a register number, this function identifies the type of data
3219 it may be holding, specified as a `\fBstruct type\fR'.  \s-1GDB\s0 allows
3220 creation of arbitrary types, but a number of built in types are
3221 provided (`\fBbuiltin_type_void\fR', `\fBbuiltin_type_int32\fR' etc), together
3222 with functions to derive types from these.
3223 .PP
3224 Typically the program counter will have a type of \*(L"pointer to
3225 function\*(R" (it points to code), the frame pointer and stack pointer
3226 will have types of \*(L"pointer to void\*(R" (they point to data on the
3227 stack) and all other integer registers will have a type of 32\-bit
3228 integer or 64\-bit integer.
3229 .PP
3230 This information guides the formatting when displaying register
3231 information.  The default value is `\fB\s-1NULL\s0\fR' meaning no information is
3232 available to guide formatting when displaying registers.
3233 .PP
3234 \&\-\- Architecture Function: void print_registers_info (struct gdbarch
3235 *GDBARCH, struct ui_file *FILE, struct frame_info *FRAME, int
3236 \&\s-1REGNUM,\s0 int \s-1ALL\s0)
3237 Define this function to print out one or all of the registers for
3238 the \s-1GDB\s0 `\fBinfo registers\fR' command.  The default value is the
3239 function `\fBdefault_print_registers_info\fR', which uses the register
3240 type information (see `\fBregister_type\fR' above) to determine how each
3241 register should be printed.  Define a custom version of this
3242 function for fuller control over how the registers are displayed.
3243 .PP
3244 The access should be for the specified architecture, \s-1GDBARCH,\s0 with
3245 output to the file specified by the User Interface Independent
3246 Output file handle, \s-1FILE \s0(*note UI-Independent Output\*(--the
3247 `\fBui_out\fR' Functions: UI-Independent Output.).
3248 .PP
3249 The registers should show their values in the frame specified by
3250 \&\s-1FRAME. \s0 If \s-1REGNUM\s0 is \-1 and \s-1ALL\s0 is zero, then all the
3251 \&\*(L"significant\*(R" registers should be shown (the implementer should
3252 decide which registers are \*(L"significant\*(R"). Otherwise only the
3253 value of the register specified by \s-1REGNUM\s0 should be output.  If
3254 \&\s-1REGNUM\s0 is \-1 and \s-1ALL\s0 is non-zero (true), then the value of all
3255 registers should be shown.
3256 .PP
3257 By default `\fBdefault_print_registers_info\fR' prints one register per
3258 line, and if \s-1ALL\s0 is zero omits floating-point registers.
3259 .PP
3260 \&\-\- Architecture Function: void print_float_info (struct gdbarch
3261 *GDBARCH, struct ui_file *FILE, struct frame_info *FRAME,
3262 const char *ARGS)
3263 Define this function to provide output about the floating point
3264 unit and registers for the \s-1GDB\s0 `\fBinfo float\fR' command respectively.
3265 The default value is `\fB\s-1NULL\s0\fR' (not defined), meaning no information
3266 will be provided.
3267 .PP
3268 The \s-1GDBARCH\s0 and \s-1FILE\s0 and \s-1FRAME\s0 arguments have the same meaning as
3269 in the `\fBprint_registers_info\fR' function above. The string \s-1ARGS\s0
3270 contains any supplementary arguments to the `\fBinfo float\fR' command.
3271 .PP
3272 Define this function if the target supports floating point
3273 operations.
3274 .PP
3275 \&\-\- Architecture Function: void print_vector_info (struct gdbarch
3276 *GDBARCH, struct ui_file *FILE, struct frame_info *FRAME,
3277 const char *ARGS)
3278 Define this function to provide output about the vector unit and
3279 registers for the \s-1GDB\s0 `\fBinfo vector\fR' command respectively.  The
3280 default value is `\fB\s-1NULL\s0\fR' (not defined), meaning no information will
3281 be provided.
3282 .PP
3283 The \s-1GDBARCH, FILE\s0 and \s-1FRAME\s0 arguments have the same meaning as in
3284 the `\fBprint_registers_info\fR' function above.  The string \s-1ARGS\s0
3285 contains any supplementary arguments to the `\fBinfo vector\fR' command.
3286 .PP
3287 Define this function if the target supports vector operations.
3288 .PP
3289 \&\-\- Architecture Function: int register_reggroup_p (struct gdbarch
3290 *GDBARCH, int \s-1REGNUM,\s0 struct reggroup *GROUP)
3291 \&\s-1GDB\s0 groups registers into different categories (general, vector,
3292 floating point etc).  This function, given a register, \s-1REGNUM,\s0 and
3293 group, \s-1GROUP,\s0 returns 1 (true) if the register is in the group and
3294 0 (false) otherwise.
3295 .PP
3296 The information should be for the specified architecture, \s-1GDBARCH\s0
3297 .PP
3298 The default value is the function `\fBdefault_register_reggroup_p\fR'
3299 which will do a reasonable job based on the type of the register
3300 (see the function `\fBregister_type\fR' above), with groups for general
3301 purpose registers, floating point registers, vector registers and
3302 raw (i.e not pseudo) registers.
3303 .PP
3304 \&\-\-\-\-\-\-\-\-\-\- Footnotes \-\-\-\-\-\-\-\-\-\-
3305 .PP
3306 (1) Historically, \s-1GDB\s0 always had a concept of a frame pointer
3307 register, which could be accessed via the \s-1GDB\s0 variable, `\fB\f(CB$fp\fB\fR'.  That
3308 concept is now deprecated, recognizing that not all architectures have
3309 a frame pointer.  However if an architecture does have a frame pointer
3310 register, and defines a register or pseudo-register with the name
3311 `\fB\*(L"fp\*(R"\fR', then that register will be used as the value of the `\fB\f(CB$fp\fB\fR'
3312 variable.
3313 .PP
3314 \&\fB11.6.4 Using Different Register and Memory Data Representations\fR
3315 .PP
3316 Some architectures have different representations of data objects,
3317 depending whether the object is held in a register or memory.  For
3318 example:
3319 .PP
3320 * The Alpha architecture can represent 32 bit integer values in
3321 floating-point registers.
3322 .PP
3323 * The x86 architecture supports 80\-bit floating-point registers.  The
3324 `\fBlong double\fR' data type occupies 96 bits in memory but only 80
3325 bits when stored in a register.
3326 .PP
3327 In general, the register representation of a data type is determined
3328 by the architecture, or \s-1GDB\s0's interface to the architecture, while the
3329 memory representation is determined by the Application Binary Interface.
3330 .PP
3331 For almost all data types on almost all architectures, the two
3332 representations are identical, and no special handling is needed.
3333 However, they do occasionally differ.  An architecture may define the
3334 following `\fBstruct gdbarch\fR' functions to request conversions between the
3335 register and memory representations of a data type:
3336 .PP
3337 \&\-\- Architecture Function: int gdbarch_convert_register_p (struct
3338 gdbarch *GDBARCH, int \s-1REG\s0)
3339 Return non-zero (true) if the representation of a data value
3340 stored in this register may be different to the representation of
3341 that same data value when stored in memory.  The default value is
3342 `\fB\s-1NULL\s0\fR' (undefined).
3343 .PP
3344 If this function is defined and returns non-zero, the `struct
3345 gdbarch' functions `\fBgdbarch_register_to_value\fR' and
3346 `\fBgdbarch_value_to_register\fR' (see below) should be used to perform
3347 any necessary conversion.
3348 .PP
3349 If defined, this function should return zero for the register's
3350 native type, when no conversion is necessary.
3351 .PP
3352 \&\-\- Architecture Function: void gdbarch_register_to_value (struct
3353 gdbarch *GDBARCH, int \s-1REG,\s0 struct type *TYPE, char *FROM,
3354 char *TO)
3355 Convert the value of register number \s-1REG\s0 to a data object of type
3356 \&\s-1TYPE. \s0 The buffer at \s-1FROM\s0 holds the register's value in raw
3357 format; the converted value should be placed in the buffer at \s-1TO.\s0
3358 .PP
3359 _Note:_ `\fBgdbarch_register_to_value\fR' and
3360 `\fBgdbarch_value_to_register\fR' take their \s-1REG\s0 and \s-1TYPE\s0 arguments
3361 in different orders.
3362 .PP
3363 `\fBgdbarch_register_to_value\fR' should only be used with registers for
3364 which the `\fBgdbarch_convert_register_p\fR' function returns a non-zero
3365 value.
3366 .PP
3367 \&\-\- Architecture Function: void gdbarch_value_to_register (struct
3368 gdbarch *GDBARCH, struct type *TYPE, int \s-1REG,\s0 char *FROM,
3369 char *TO)
3370 Convert a data value of type \s-1TYPE\s0 to register number \s-1REG\s0' raw
3371 format.
3372 .PP
3373 _Note:_ `\fBgdbarch_register_to_value\fR' and
3374 `\fBgdbarch_value_to_register\fR' take their \s-1REG\s0 and \s-1TYPE\s0 arguments
3375 in different orders.
3376 .PP
3377 `\fBgdbarch_value_to_register\fR' should only be used with registers for
3378 which the `\fBgdbarch_convert_register_p\fR' function returns a non-zero
3379 value.
3380 .PP
3381 \&\fB11.6.5 Register Caching\fR
3382 .PP
3383 Caching of registers is used, so that the target does not need to be
3384 accessed and reanalyzed multiple times for each register in
3385 circumstances where the register value cannot have changed.
3386 .PP
3387 \&\s-1GDB\s0 provides `\fBstruct regcache\fR', associated with a particular `struct
3388 gdbarch' to hold the cached values of the raw registers.  A set of
3389 functions is provided to access both the raw registers (with `\fBraw\fR' in
3390 their name) and the full set of cooked registers (with `\fBcooked\fR' in
3391 their name).  Functions are provided to ensure the register cache is
3392 kept synchronized with the values of the actual registers in the target.
3393 .PP
3394 Accessing registers through the `\fBstruct regcache\fR' routines will
3395 ensure that the appropriate `\fBstruct gdbarch\fR' functions are called when
3396 necessary to access the underlying target architecture.  In general
3397 users should use the \*(L"cooked\*(R" functions, since these will map to the
3398 \&\*(L"raw\*(R" functions automatically as appropriate.
3399 .PP
3400 The two key functions are `\fBregcache_cooked_read\fR' and
3401 `\fBregcache_cooked_write\fR' which read or write a register from or to a
3402 byte buffer (type `\fBgdb_byte *\fR').  For convenience the wrapper functions
3403 `\fBregcache_cooked_read_signed\fR', `\fBregcache_cooked_read_unsigned\fR',
3404 `\fBregcache_cooked_write_signed\fR' and `\fBregcache_cooked_write_unsigned\fR' are
3405 provided, which read or write the value using the buffer and convert to
3406 or from an integral value as appropriate.
3407 .PP
3408 \&\fB11.7 Frame Interpretation\fR
3409 .PP
3410 * Menu:
3411 .PP
3412 See also \*(L"All About Stack Frames\*(R"
3413 .PP
3414 See also \*(L"Frame Handling Terminology\*(R"
3415 .PP
3416 See also \*(L"Prologue Caches\*(R"
3417 .PP
3418 See also \*(L"Functions and Variable to Analyze Frames\*(R"
3419 .PP
3420 See also \*(L"Functions to Access Frame Data\*(R"
3421 .PP
3422 See also \*(L"Analyzing Stacks\-\-\-Frame Sniffers\*(R"
3423 .PP
3424 \&\fB11.7.1 All About Stack Frames\fR
3425 .PP
3426 \&\s-1GDB\s0 needs to understand the stack on which local (automatic) variables
3427 are stored.  The area of the stack containing all the local variables
3428 for a function invocation is known as the \*(L"stack frame\*(R" for that
3429 function (or colloquially just as the \*(L"frame\*(R").  In turn the function
3430 that called the function will have its stack frame, and so on back
3431 through the chain of functions that have been called.
3432 .PP
3433 Almost all architectures have one register dedicated to point to the
3434 end of the stack (the \*(L"stack pointer\*(R").  Many have a second register
3435 which points to the start of the currently active stack frame (the
3436 \&\*(L"frame pointer\*(R").  The specific arrangements for an architecture are a
3437 key part of the \s-1ABI.\s0
3438 .PP
3439 A diagram helps to explain this.  Here is a simple program to compute
3440 factorials:
3441 .PP
3442 #include <stdio.h>
3443 int fact (int n)
3444 {
3445 if (0 == n)
3446 {
3447 return 1;
3448 }
3449 else
3450 {
3451 return n * fact (n \- 1);
3452 }
3453 }
3454 .PP
3455 main ()
3456 {
3457 int i;
3458 .PP
3459 for (i = 0; i < 10; i++)
3460 {
3461 int   f = fact (i);
3462 printf (\*(L"%d! = \f(CW%d\fR\en\*(R", i, f);
3463 }
3464 }
3465 .PP
3466 Consider the state of the stack when the code reaches line 6 after
3467 the main program has called `\fBfact (3)\fR'.  The chain of function calls
3468 will be `\fBmain ()\fR', `\fBfact (3)\fR', `\fBfact (2)\fR', `\fBfact (1)\fR' and `\fBfact (0)\fR'.
3469 .PP
3470 In this illustration the stack is falling (as used for example by the
3471 OpenRISC 1000 \s-1ABI\s0).  The stack pointer (\s-1SP\s0) is at the end of the stack
3472 (lowest address) and the frame pointer (\s-1FP\s0) is at the highest address
3473 in the current stack frame.  The following diagram shows how the stack
3474 looks.
3475 .PP
3476 ^    \->|            |
3477 Frame             |   |  |            |
3478 Number          \- |   |  |============|       int fact (int n)
3479 |  |   |  |   i = 3    |       {
3480 |  |   |  |\-\-\-\-\-\-\-\-\-\-\-\-|         if (0 == n) {
3481 |  |   |  |   f = ?    |           return  1;  <\-\-\-\-\-\-\-\- \s-1PC\s0
3482 #4 \fImain()\fR   <   |   |  |\-\-\-\-\-\-\-\-\-\-\-\-|        }
3483 |  |   |  |            |         else {
3484 |  |  \-+\->|\-\-\-\-\-\-\-\-\-\-\-\-|   \-\-\->    return n * fact (n \- 1);
3485 |   \-+\-+\-\-+\-\-\-\-\-o      |  |      }
3486 =   | |  |============|  |    }
3487 |    | |  |   n = 3    |  |
3488 |    | |  |\-\-\-\-\-\-\-\-\-\-\-\-|  |    main ()
3489 #3 fact (3) <     | |  |     o\-\-\-\-\-\-\-\-\-+\-   {
3490 |   \-+\-+\->|\-\-\-\-\-\-\-\-\-\-\-\-|  | |    int  i;
3491 |  | |  \-\-+\-\-\-\-\-o      |  | |
3492 = | |    |============|  | |    for (i = 0; i < 10; i++) {
3493 |  | |    |   n = 2    |  |  \->    int  f = fact (i);
3494 |  | |    |\-\-\-\-\-\-\-\-\-\-\-\-|  |        printf (\*(L"%d! = \f(CW%d\fR\en\*(R", i , f);
3495 #2 fact (2) <   | |    |     o\-\-\-\-\-\-+\-\-|      }
3496 |  | |  \->|\-\-\-\-\-\-\-\-\-\-\-\-|  |    }
3497 |  |  \-+\-\-+\-\-\-\-\-o      |  |
3498 = |   |  |============|  |
3499 |  |   |  |   n = 1    |  |
3500 |  |   |  |\-\-\-\-\-\-\-\-\-\-\-\-|  |
3501 #1 fact (1) <   |   |  |     o\-\-\-\-\-\-+\-\-|
3502 |  |   |  |\-\-\-\-\-\-\-\-\-\-\-\-|  |
3503 |   \-\-\-|\-\-+\-\-\-\-\-o      |<\-+\-\-\-\-\-\-\- \s-1FP\s0
3504 =     |  |============|  |                   |
3505 |      |  |   n = 0    |  |                   |
3506 |      |  |\-\-\-\-\-\-\-\-\-\-\-\-|  |                   |
3507 #0 fact (0) <       |  |     o\-\-\-\-\-\-\-\-\-                    |
3508 |      |  |\-\-\-\-\-\-\-\-\-\-\-\-|                      |
3509 |       \-\-+\-\-\-\-\-o      |<\-\-\-\-\-\-\-\-\- \s-1SP        \s0 |
3510 =        |============|                      |
3511 |         |  Red Zone  |                      v
3512 |         \e/\e/\e/\e/\e/\e/\e/                 Direction of
3513 #\-1         <          \e/\e/\e/\e/\e/\e/\e/                 stack growth
3514 |         |            |
3515 .PP
3516 In each stack frame, offset 0 from the stack pointer is the frame
3517 pointer of the previous frame and offset 4 (this is illustrating a
3518 32\-bit architecture) from the stack pointer is the return address.
3519 Local variables are indexed from the frame pointer, with negative
3520 indexes.  In the function `\fBfact\fR', offset \-4 from the frame pointer is
3521 the argument N.  In the `\fBmain\fR' function, offset \-4 from the frame
3522 pointer is the local variable I and offset \-8 from the frame pointer is
3523 the local variable F(1).
3524 .PP
3525 It is very easy to get confused when examining stacks.  \s-1GDB\s0 has
3526 terminology it uses rigorously throughout.  The stack frame of the
3527 function currently executing, or where execution stopped is numbered
3528 zero.  In this example frame #0 is the stack frame of the call to
3529 `\fBfact (0)\fR'.  The stack frame of its calling function (`\fBfact (1)\fR' in
3530 this case) is numbered #1 and so on back through the chain of calls.
3531 .PP
3532 The main \s-1GDB\s0 data structure describing frames is
3533 `\fBstruct frame_info\fR'.  It is not used directly, but only via its
3534 accessor functions.  `\fBframe_info\fR' includes information about the
3535 registers in the frame and a pointer to the code of the function with
3536 which the frame is associated.  The entire stack is represented as a
3537 linked list of `\fBframe_info\fR' structs.
3538 .PP
3539 \&\-\-\-\-\-\-\-\-\-\- Footnotes \-\-\-\-\-\-\-\-\-\-
3540 .PP
3541 (1) This is a simplified example for illustrative purposes only.
3542 Good optimizing compilers would not put anything on the stack for such
3543 simple functions.  Indeed they might eliminate the recursion and use of
3544 the stack entirely!
3545 .PP
3546 \&\fB11.7.2 Frame Handling Terminology\fR
3547 .PP
3548 It is easy to get confused when referencing stack frames.  \s-1GDB\s0 uses
3549 some precise terminology.
3550 .PP
3551 * \*(L"\s-1THIS\*(R"\s0 frame is the frame currently under consideration.
3552 .PP
3553 * The \*(L"\s-1NEXT\*(R"\s0 frame, also sometimes called the inner or newer frame
3554 is the frame of the function called by the function of \s-1THIS\s0 frame.
3555 .PP
3556 * The \*(L"\s-1PREVIOUS\*(R"\s0 frame, also sometimes called the outer or older
3557 frame is the frame of the function which called the function of
3558 \&\s-1THIS\s0 frame.
3559 .PP
3560 So in the example in the previous section (*note All About Stack
3561 Frames: All About Stack Frames.), if \s-1THIS\s0 frame is #3 (the call to
3562 `\fBfact (3)\fR'), the \s-1NEXT\s0 frame is frame #2 (the call to `\fBfact (2)\fR') and
3563 the \s-1PREVIOUS\s0 frame is frame #4 (the call to `\fBmain ()\fR').
3564 .PP
3565 The \*(L"innermost\*(R" frame is the frame of the current executing
3566 function, or where the program stopped, in this example, in the middle
3567 of the call to `\fBfact (0))\fR'.  It is always numbered frame #0.
3568 .PP
3569 The \*(L"base\*(R" of a frame is the address immediately before the start of
3570 the \s-1NEXT\s0 frame.  For a stack which grows down in memory (a \*(L"falling\*(R"
3571 stack) this will be the lowest address and for a stack which grows up
3572 in memory (a \*(L"rising\*(R" stack) this will be the highest address in the
3573 frame.
3574 .PP
3575 \&\s-1GDB\s0 functions to analyze the stack are typically given a pointer to
3576 the \s-1NEXT\s0 frame to determine information about \s-1THIS\s0 frame.  Information
3577 about \s-1THIS\s0 frame includes data on where the registers of the \s-1PREVIOUS\s0
3578 frame are stored in this stack frame.  In this example the frame
3579 pointer of the \s-1PREVIOUS\s0 frame is stored at offset 0 from the stack
3580 pointer of \s-1THIS\s0 frame.
3581 .PP
3582 The process whereby a function is given a pointer to the \s-1NEXT\s0 frame
3583 to work out information about \s-1THIS\s0 frame is referred to as \*(L"unwinding\*(R".
3584 The \s-1GDB\s0 functions involved in this typically include unwind in their
3585 name.
3586 .PP
3587 The process of analyzing a target to determine the information that
3588 should go in struct frame_info is called \*(L"sniffing\*(R".  The functions
3589 that carry this out are called sniffers and typically include sniffer
3590 in their name.  More than one sniffer may be required to extract all
3591 the information for a particular frame.
3592 .PP
3593 Because so many functions work using the \s-1NEXT\s0 frame, there is an
3594 issue about addressing the innermost frame\*(--it has no \s-1NEXT\s0 frame.  To
3595 solve this \s-1GDB\s0 creates a dummy frame #\-1, known as the \*(L"sentinel\*(R" frame.
3596 .PP
3597 \&\fB11.7.3 Prologue Caches\fR
3598 .PP
3599 All the frame sniffing functions typically examine the code at the
3600 start of the corresponding function, to determine the state of
3601 registers.  The \s-1ABI\s0 will save old values and set new values of key
3602 registers at the start of each function in what is known as the
3603 function \*(L"prologue\*(R".
3604 .PP
3605 For any particular stack frame this data does not change, so all the
3606 standard unwinding functions, in addition to receiving a pointer to the
3607 \&\s-1NEXT\s0 frame as their first argument, receive a pointer to a \*(L"prologue
3608 cache\*(R" as their second argument.  This can be used to store values
3609 associated with a particular frame, for reuse on subsequent calls
3610 involving the same frame.
3611 .PP
3612 It is up to the user to define the structure used (it is a `\fBvoid *\fR'
3613 pointer) and arrange allocation and deallocation of storage.  However
3614 for general use, \s-1GDB\s0 provides `\fBstruct trad_frame_cache\fR', with a set of
3615 accessor routines.  This structure holds the stack and code address of
3616 \&\s-1THIS\s0 frame, the base address of the frame, a pointer to the struct
3617 `\fBframe_info\fR' for the \s-1NEXT\s0 frame and details of where the registers of
3618 the \s-1PREVIOUS\s0 frame may be found in \s-1THIS\s0 frame.
3619 .PP
3620 Typically the first time any sniffer function is called with \s-1NEXT\s0
3621 frame, the prologue sniffer for \s-1THIS\s0 frame will be `\fB\s-1NULL\s0\fR'.  The sniffer
3622 will analyze the frame, allocate a prologue cache structure and
3623 populate it.  Subsequent calls using the same \s-1NEXT\s0 frame will pass in
3624 this prologue cache, so the data can be returned with no additional
3625 analysis.
3626 .PP
3627 \&\fB11.7.4 Functions and Variable to Analyze Frames\fR
3628 .PP
3629 These struct `\fBgdbarch\fR' functions and variable should be defined to
3630 provide analysis of the stack frame and allow it to be adjusted as
3631 required.
3632 .PP
3633 \&\-\- Architecture Function: \s-1CORE_ADDR\s0 skip_prologue (struct gdbarch
3634 *GDBARCH, \s-1CORE_ADDR PC\s0)
3635 The prologue of a function is the code at the beginning of the
3636 function which sets up the stack frame, saves the return address
3637 etc.  The code representing the behavior of the function starts
3638 after the prologue.
3639 .PP
3640 This function skips past the prologue of a function if the program
3641 counter, \s-1PC,\s0 is within the prologue of a function.  The result is
3642 the program counter immediately after the prologue.  With modern
3643 optimizing compilers, this may be a far from trivial exercise.
3644 However the required information may be within the binary as
3645 \&\s-1DWARF2\s0 debugging information, making the job much easier.
3646 .PP
3647 The default value is `\fB\s-1NULL\s0\fR' (not defined).  This function should
3648 always be provided, but can take advantage of \s-1DWARF2\s0 debugging
3649 information, if that is available.
3650 .PP
3651 \&\-\- Architecture Function: int inner_than (\s-1CORE_ADDR LHS, CORE_ADDR RHS\s0)
3652 Given two frame or stack pointers, return non-zero (true) if the
3653 first represents the \*(L"inner\*(R" stack frame and 0 (false) otherwise.
3654 This is used to determine whether the target has a stack which
3655 grows up in memory (rising stack) or grows down in memory (falling
3656 stack).  *Note All About Stack Frames: All About Stack Frames, for
3657 an explanation of \*(L"inner\*(R" frames.
3658 .PP
3659 The default value of this function is `\fB\s-1NULL\s0\fR' and it should always
3660 be defined.  However for almost all architectures one of the
3661 built-in functions can be used: `\fBcore_addr_lessthan\fR' (for stacks
3662 growing down in memory) or `\fBcore_addr_greaterthan\fR' (for stacks
3663 growing up in memory).
3664 .PP
3665 \&\-\- Architecture Function: \s-1CORE_ADDR\s0 frame_align (struct gdbarch
3666 *GDBARCH, \s-1CORE_ADDR ADDRESS\s0)
3667 The architecture may have constraints on how its frames are
3668 aligned.  For example the OpenRISC 1000 \s-1ABI\s0 requires stack frames
3669 to be double-word aligned, but 32\-bit versions of the architecture
3670 allocate single-word values to the stack.  Thus extra padding may
3671 be needed at the end of a stack frame.
3672 .PP
3673 Given a proposed address for the stack pointer, this function
3674 returns a suitably aligned address (by expanding the stack frame).
3675 .PP
3676 The default value is `\fB\s-1NULL\s0\fR' (undefined).  This function should be
3677 defined for any architecture where it is possible the stack could
3678 become misaligned.  The utility functions `\fBalign_down\fR' (for falling
3679 stacks) and `\fBalign_up\fR' (for rising stacks) will facilitate the
3680 implementation of this function.
3681 .PP
3682 \&\-\- Architecture Variable: int frame_red_zone_size
3683 Some ABIs reserve space beyond the end of the stack for use by leaf
3684 functions without prologue or epilogue or by exception handlers
3685 (for example the OpenRISC 1000).
3686 .PP
3687 This is known as a \*(L"red zone\*(R" (\s-1AMD\s0 terminology).  The \s-1AMD64 \s0(nee
3688 x86\-64) \s-1ABI\s0 documentation refers to the \*(L"red zone\*(R" when describing
3689 this scratch area.
3690 .PP
3691 The default value is 0.  Set this field if the architecture has
3692 such a red zone.  The value must be aligned as required by the \s-1ABI
3693 \&\s0(see `\fBframe_align\fR' above for an explanation of stack frame
3694 alignment).
3695 .PP
3696 \&\fB11.7.5 Functions to Access Frame Data\fR
3697 .PP
3698 These functions provide access to key registers and arguments in the
3699 stack frame.
3700 .PP
3701 \&\-\- Architecture Function: \s-1CORE_ADDR\s0 unwind_pc (struct gdbarch
3702 *GDBARCH, struct frame_info *NEXT_FRAME)
3703 This function is given a pointer to the \s-1NEXT\s0 stack frame (*note
3704 All About Stack Frames: All About Stack Frames, for how frames are
3705 represented) and returns the value of the program counter in the
3706 \&\s-1PREVIOUS\s0 frame (i.e. the frame of the function that called \s-1THIS\s0
3707 one).  This is commonly referred to as the \*(L"return address\*(R".
3708 .PP
3709 The implementation, which must be frame agnostic (work with any
3710 frame), is typically no more than:
3711 .PP
3712 \&\s-1ULONGEST\s0 pc;
3713 pc = frame_unwind_register_unsigned (next_frame, \s-1ARCH_PC_REGNUM\s0);
3714 return gdbarch_addr_bits_remove (gdbarch, pc);
3715 .PP
3716 \&\-\- Architecture Function: \s-1CORE_ADDR\s0 unwind_sp (struct gdbarch
3717 *GDBARCH, struct frame_info *NEXT_FRAME)
3718 This function is given a pointer to the \s-1NEXT\s0 stack frame (*note
3719 All About Stack Frames: All About Stack Frames. for how frames are
3720 represented) and returns the value of the stack pointer in the
3721 \&\s-1PREVIOUS\s0 frame (i.e. the frame of the function that called \s-1THIS\s0
3722 one).
3723 .PP
3724 The implementation, which must be frame agnostic (work with any
3725 frame), is typically no more than:
3726 .PP
3727 \&\s-1ULONGEST\s0 sp;
3728 sp = frame_unwind_register_unsigned (next_frame, \s-1ARCH_SP_REGNUM\s0);
3729 return gdbarch_addr_bits_remove (gdbarch, sp);
3730 .PP
3731 \&\-\- Architecture Function: int frame_num_args (struct gdbarch *GDBARCH,
3732 struct frame_info *THIS_FRAME)
3733 This function is given a pointer to \s-1THIS\s0 stack frame (*note All
3734 About Stack Frames: All About Stack Frames. for how frames are
3735 represented), and returns the number of arguments that are being
3736 passed, or \-1 if not known.
3737 .PP
3738 The default value is `\fB\s-1NULL\s0\fR' (undefined), in which case the number
3739 of arguments passed on any stack frame is always unknown.  For many
3740 architectures this will be a suitable default.
3741 .PP
3742 \&\fB11.7.6 Analyzing Stacks\*(--Frame Sniffers\fR
3743 .PP
3744 When a program stops, \s-1GDB\s0 needs to construct the chain of struct
3745 `\fBframe_info\fR' representing the state of the stack using appropriate
3746 \&\*(L"sniffers\*(R".
3747 .PP
3748 Each architecture requires appropriate sniffers, but they do not form
3749 entries in `\fBstruct gdbarch\fR', since more than one sniffer may be
3750 required and a sniffer may be suitable for more than one
3751 `\fBstruct gdbarch\fR'.  Instead sniffers are associated with architectures
3752 using the following functions.
3753 .PP
3754 * `\fBframe_unwind_append_sniffer\fR' is used to add a new sniffer to
3755 analyze \s-1THIS\s0 frame when given a pointer to the \s-1NEXT\s0 frame.
3756 .PP
3757 * `\fBframe_base_append_sniffer\fR' is used to add a new sniffer which can
3758 determine information about the base of a stack frame.
3759 .PP
3760 * `\fBframe_base_set_default\fR' is used to specify the default base
3761 sniffer.
3762 .PP
3763 These functions all take a reference to `\fBstruct gdbarch\fR', so they
3764 are associated with a specific architecture.  They are usually called
3765 in the `\fBgdbarch\fR' initialization function, after the `\fBgdbarch\fR' struct
3766 has been set up.  Unless a default has been set, the most recently
3767 appended sniffer will be tried first.
3768 .PP
3769 The main frame unwinding sniffer (as set by
3770 `\fBframe_unwind_append_sniffer)\fR' returns a structure specifying a set of
3771 sniffing functions:
3772 .PP
3773 struct frame_unwind
3774 {
3775 enum frame_type            type;
3776 frame_this_id_ftype       *this_id;
3777 frame_prev_register_ftype *prev_register;
3778 const struct frame_data   *unwind_data;
3779 frame_sniffer_ftype       *sniffer;
3780 frame_prev_pc_ftype       *prev_pc;
3781 frame_dealloc_cache_ftype *dealloc_cache;
3782 };
3783 .PP
3784 The `\fBtype\fR' field indicates the type of frame this sniffer can
3785 handle: normal, dummy (*note Functions Creating Dummy Frames: Functions
3786 Creating Dummy Frames.), signal handler or sentinel.  Signal handlers
3787 sometimes have their own simplified stack structure for efficiency, so
3788 may need their own handlers.
3789 .PP
3790 The `\fBunwind_data\fR' field holds additional information which may be
3791 relevant to particular types of frame.  For example it may hold
3792 additional information for signal handler frames.
3793 .PP
3794 The remaining fields define functions that yield different types of
3795 information when given a pointer to the \s-1NEXT\s0 stack frame.  Not all
3796 functions need be provided.  If an entry is `\fB\s-1NULL\s0\fR', the next sniffer
3797 will be tried instead.
3798 .PP
3799 * `\fBthis_id\fR' determines the stack pointer and function (code entry
3800 point) for \s-1THIS\s0 stack frame.
3801 .PP
3802 * `\fBprev_register\fR' determines where the values of registers for the
3803 \&\s-1PREVIOUS\s0 stack frame are stored in \s-1THIS\s0 stack frame.
3804 .PP
3805 * `\fBsniffer\fR' takes a look at \s-1THIS\s0 frame's registers to determine if
3806 this is the appropriate unwinder.
3807 .PP
3808 * `\fBprev_pc\fR' determines the program counter for \s-1THIS\s0 frame.  Only
3809 needed if the program counter is not an ordinary register (*note
3810 Functions and Variables Specifying the Register Architecture:
3811 Register Architecture Functions & Variables.).
3812 .PP
3813 * `\fBdealloc_cache\fR' frees any additional memory associated with the
3814 prologue cache for this frame (*note Prologue Caches: Prologue
3815 Caches.).
3816 .PP
3817 In general it is only the `\fBthis_id\fR' and `\fBprev_register\fR' fields that
3818 need be defined for custom sniffers.
3819 .PP
3820 The frame base sniffer is much simpler.  It is a
3821 `\fBstruct frame_base\fR', which refers to the corresponding `\fBframe_unwind\fR'
3822 struct and whose fields refer to functions yielding various addresses
3823 within the frame.
3824 .PP
3825 struct frame_base
3826 {
3827 const struct frame_unwind *unwind;
3828 frame_this_base_ftype     *this_base;
3829 frame_this_locals_ftype   *this_locals;
3830 frame_this_args_ftype     *this_args;
3831 };
3832 .PP
3833 All the functions referred to take a pointer to the \s-1NEXT\s0 frame as
3834 argument. The function referred to by `\fBthis_base\fR' returns the base
3835 address of \s-1THIS\s0 frame, the function referred to by `\fBthis_locals\fR'
3836 returns the base address of local variables in \s-1THIS\s0 frame and the
3837 function referred to by `\fBthis_args\fR' returns the base address of the
3838 function arguments in this frame.
3839 .PP
3840 As described above, the base address of a frame is the address
3841 immediately before the start of the \s-1NEXT\s0 frame.  For a falling stack,
3842 this is the lowest address in the frame and for a rising stack it is
3843 the highest address in the frame.  For most architectures the same
3844 address is also the base address for local variables and arguments, in
3845 which case the same function can be used for all three \fIentries\fR\|(1).
3846 .PP
3847 \&\-\-\-\-\-\-\-\-\-\- Footnotes \-\-\-\-\-\-\-\-\-\-
3848 .PP
3849 (1) It is worth noting that if it cannot be determined in any other
3850 way (for example by there being a register with the name `\fB\*(L"fp\*(R"\fR'), then
3851 the result of the `\fBthis_base\fR' function will be used as the value of the
3852 frame pointer variable `\fB\f(CB$fp\fB\fR' in \s-1GDB. \s0 This is very often not correct
3853 (for example with the OpenRISC 1000, this value is the stack pointer,
3854 `\fB\f(CB$sp\fB\fR').  In this case a register (raw or pseudo) with the name `\fB\*(L"fp\*(R"\fR'
3855 should be defined.  It will be used in preference as the value of `\fB\f(CB$fp\fB\fR'.
3856 .PP
3857 \&\fB11.8 Inferior Call Setup\fR
3858 .PP
3859 * Menu:
3860 .PP
3861 See also \*(L"About Dummy Frames\*(R"
3862 .PP
3863 See also \*(L"Functions Creating Dummy Frames\*(R"
3864 .PP
3865 \&\fB11.8.1 About Dummy Frames\fR
3866 .PP
3867 \&\s-1GDB\s0 can call functions in the target code (for example by using the
3868 `\fBcall\fR' or `\fBprint\fR' commands).  These functions may be breakpointed, and
3869 it is essential that if a function does hit a breakpoint, commands like
3870 `\fBbacktrace\fR' work correctly.
3871 .PP
3872 This is achieved by making the stack look as though the function had
3873 been called from the point where \s-1GDB\s0 had previously stopped.  This
3874 requires that \s-1GDB\s0 can set up stack frames appropriate for such function
3875 calls.
3876 .PP
3877 \&\fB11.8.2 Functions Creating Dummy Frames\fR
3878 .PP
3879 The following functions provide the functionality to set up such
3880 \&\*(L"dummy\*(R" stack frames.
3881 .PP
3882 \&\-\- Architecture Function: \s-1CORE_ADDR\s0 push_dummy_call (struct gdbarch
3883 *GDBARCH, struct value *FUNCTION, struct regcache *REGCACHE,
3884 \&\s-1CORE_ADDR BP_ADDR,\s0 int \s-1NARGS,\s0 struct value **ARGS, \s-1CORE_ADDR
3885 SP,\s0 int \s-1STRUCT_RETURN, CORE_ADDR STRUCT_ADDR\s0)
3886 This function sets up a dummy stack frame for the function about
3887 to be called.  `\fBpush_dummy_call\fR' is given the arguments to be
3888 passed and must copy them into registers or push them on to the
3889 stack as appropriate for the \s-1ABI.\s0
3890 .PP
3891 \&\s-1FUNCTION\s0 is a pointer to the function that will be called and
3892 \&\s-1REGCACHE\s0 the register cache from which values should be obtained.
3893 \&\s-1BP_ADDR\s0 is the address to which the function should return (which
3894 is breakpointed, so \s-1GDB\s0 can regain control, hence the name).
3895 \&\s-1NARGS\s0 is the number of arguments to pass and \s-1ARGS\s0 an array
3896 containing the argument values.  \s-1STRUCT_RETURN\s0 is non-zero (true)
3897 if the function returns a structure, and if so \s-1STRUCT_ADDR\s0 is the
3898 address in which the structure should be returned.
3899 .PP
3900 After calling this function, \s-1GDB\s0 will pass control to the target
3901 at the address of the function, which will find the stack and
3902 registers set up just as expected.
3903 .PP
3904 The default value of this function is `\fB\s-1NULL\s0\fR' (undefined).  If the
3905 function is not defined, then \s-1GDB\s0 will not allow the user to call
3906 functions within the target being debugged.
3907 .PP
3908 \&\-\- Architecture Function: struct frame_id unwind_dummy_id (struct
3909 gdbarch *GDBARCH, struct frame_info *NEXT_FRAME)
3910 This is the inverse of `\fBpush_dummy_call\fR' which restores the stack
3911 pointer and program counter after a call to evaluate a function
3912 using a dummy stack frame.  The result is a `\fBstruct frame_id\fR',
3913 which contains the value of the stack pointer and program counter
3914 to be used.
3915 .PP
3916 The \s-1NEXT\s0 frame pointer is provided as argument, \s-1NEXT_FRAME.  THIS\s0
3917 frame is the frame of the dummy function, which can be unwound, to
3918 yield the required stack pointer and program counter from the
3919 \&\s-1PREVIOUS\s0 frame.
3920 .PP
3921 The default value is `\fB\s-1NULL\s0\fR' (undefined).  If `\fBpush_dummy_call\fR' is
3922 defined, then this function should also be defined.
3923 .PP
3924 \&\-\- Architecture Function: \s-1CORE_ADDR\s0 push_dummy_code (struct gdbarch
3925 *GDBARCH, \s-1CORE_ADDR SP, CORE_ADDR FUNADDR,\s0 struct value
3926 **ARGS, int \s-1NARGS,\s0 struct type *VALUE_TYPE, \s-1CORE_ADDR\s0
3927 *REAL_PC, \s-1CORE_ADDR\s0 *BP_ADDR, struct regcache *REGCACHE)
3928 If this function is not defined (its default value is `\fB\s-1NULL\s0\fR'), a
3929 dummy call will use the entry point of the currently loaded code
3930 on the target as its return address.  A temporary breakpoint will
3931 be set there, so the location must be writable and have room for a
3932 breakpoint.
3933 .PP
3934 It is possible that this default is not suitable.  It might not be
3935 writable (in \s-1ROM\s0 possibly), or the \s-1ABI\s0 might require code to be
3936 executed on return from a call to unwind the stack before the
3937 breakpoint is encountered.
3938 .PP
3939 If either of these is the case, then push_dummy_code should be
3940 defined to push an instruction sequence onto the end of the stack
3941 to which the dummy call should return.
3942 .PP
3943 The arguments are essentially the same as those to
3944 `\fBpush_dummy_call\fR'.  However the function is provided with the type
3945 of the function result, \s-1VALUE_TYPE, BP_ADDR\s0 is used to return a
3946 value (the address at which the breakpoint instruction should be
3947 inserted) and \s-1REAL PC\s0 is used to specify the resume address when
3948 starting the call sequence.  The function should return the
3949 updated innermost stack address.
3950 .PP
3951 _Note:_ This does require that code in the stack can be
3952 executed.  Some Harvard architectures may not allow this.
3953 .PP
3954 \&\fB11.9 Adding support for debugging core files\fR
3955 .PP
3956 The prerequisite for adding core file support in \s-1GDB\s0 is to have core
3957 file support in \s-1BFD.\s0
3958 .PP
3959 Once \s-1BFD\s0 support is available, writing the apropriate
3960 `\fBregset_from_core_section\fR' architecture function should be all that is
3961 needed in order to add support for core files in \s-1GDB.\s0
3962 .PP
3963 \&\fB11.10 Defining Other Architecture Features\fR
3964 .PP
3965 This section describes other functions and values in `\fBgdbarch\fR',
3966 together with some useful macros, that you can use to define the target
3967 architecture.
3968 .PP
3969 `\fB\s-1CORE_ADDR\s0 gdbarch_addr_bits_remove (\s-1GDBARCH, ADDR\s0)\fR'
3970 If a raw machine instruction address includes any bits that are not
3971 really part of the address, then this function is used to zero
3972 those bits in \s-1ADDR. \s0 This is only used for addresses of
3973 instructions, and even then not in all contexts.
3974 .PP
3975 For example, the two low-order bits of the \s-1PC\s0 on the
3976 Hewlett-Packard \s-1PA 2.0\s0 architecture contain the privilege level of
3977 the corresponding instruction.  Since instructions must always be
3978 aligned on four-byte boundaries, the processor masks out these
3979 bits to generate the actual address of the instruction.
3980 `\fBgdbarch_addr_bits_remove\fR' would then for example look like that:
3981 arch_addr_bits_remove (\s-1CORE_ADDR\s0 addr)
3982 {
3983 return (addr &= ~0x3);
3984 }
3985 .PP
3986 `\fBint address_class_name_to_type_flags (\s-1GDBARCH, NAME, TYPE_FLAGS_PTR\s0)\fR'
3987 If \s-1NAME\s0 is a valid address class qualifier name, set the `\fBint\fR'
3988 referenced by \s-1TYPE_FLAGS_PTR\s0 to the mask representing the qualifier
3989 and return 1.  If \s-1NAME\s0 is not a valid address class qualifier name,
3990 return 0.
3991 .PP
3992 The value for \s-1TYPE_FLAGS_PTR\s0 should be one of
3993 `\fB\s-1TYPE_FLAG_ADDRESS_CLASS_1\s0\fR', `\fB\s-1TYPE_FLAG_ADDRESS_CLASS_2\s0\fR', or
3994 possibly some combination of these values or'd together.  *Note
3995 Address Classes: Target Architecture Definition.
3996 .PP
3997 `\fBint address_class_name_to_type_flags_p (\s-1GDBARCH\s0)\fR'
3998 Predicate which indicates whether
3999 `\fBaddress_class_name_to_type_flags\fR' has been defined.
4000 .PP
4001 `\fBint gdbarch_address_class_type_flags (\s-1GDBARCH, BYTE_SIZE, DWARF2_ADDR_CLASS\s0)\fR'
4002 Given a pointers byte size (as described by the debug information)
4003 and the possible `\fBDW_AT_address_class\fR' value, return the type flags
4004 used by \s-1GDB\s0 to represent this address class.  The value returned
4005 should be one of `\fB\s-1TYPE_FLAG_ADDRESS_CLASS_1\s0\fR',
4006 `\fB\s-1TYPE_FLAG_ADDRESS_CLASS_2\s0\fR', or possibly some combination of these
4007 values or'd together.  *Note Address Classes: Target Architecture
4008 Definition.
4009 .PP
4010 `\fBint gdbarch_address_class_type_flags_p (\s-1GDBARCH\s0)\fR'
4011 Predicate which indicates whether
4012 `\fBgdbarch_address_class_type_flags_p\fR' has been defined.
4013 .PP
4014 `\fBconst char *gdbarch_address_class_type_flags_to_name (\s-1GDBARCH, TYPE_FLAGS\s0)\fR'
4015 Return the name of the address class qualifier associated with the
4016 type flags given by \s-1TYPE_FLAGS.\s0
4017 .PP
4018 `\fBint gdbarch_address_class_type_flags_to_name_p (\s-1GDBARCH\s0)\fR'
4019 Predicate which indicates whether
4020 `\fBgdbarch_address_class_type_flags_to_name\fR' has been defined.
4021 *Note Address Classes: Target Architecture Definition.
4022 .PP
4023 `\fBvoid gdbarch_address_to_pointer (\s-1GDBARCH, TYPE, BUF, ADDR\s0)\fR'
4024 Store in \s-1BUF\s0 a pointer of type \s-1TYPE\s0 representing the address \s-1ADDR,\s0
4025 in the appropriate format for the current architecture.  This
4026 function may safely assume that \s-1TYPE\s0 is either a pointer or a \*(C+
4027 reference type.  *Note Pointers Are Not Always Addresses: Target
4028 Architecture Definition.
4029 .PP
4030 `\fBint gdbarch_believe_pcc_promotion (\s-1GDBARCH\s0)\fR'
4031 Used to notify if the compiler promotes a `\fBshort\fR' or `\fBchar\fR'
4032 parameter to an `\fBint\fR', but still reports the parameter as its
4033 original type, rather than the promoted type.
4034 .PP
4035 `\fBgdbarch_bits_big_endian (\s-1GDBARCH\s0)\fR'
4036 This is used if the numbering of bits in the targets does *not*
4037 match the endianism of the target byte order.  A value of 1 means
4038 that the bits are numbered in a big-endian bit order, 0 means
4039 little-endian.
4040 .PP
4041 `\fBset_gdbarch_bits_big_endian (\s-1GDBARCH, BITS_BIG_ENDIAN\s0)\fR'
4042 Calling set_gdbarch_bits_big_endian with a value of 1 indicates
4043 that the bits in the target are numbered in a big-endian bit
4044 order, 0 indicates little-endian.
4045 .PP
4046 `\fB\s-1BREAKPOINT\s0\fR'
4047 This is the character array initializer for the bit pattern to put
4048 into memory where a breakpoint is set.  Although it's common to
4049 use a trap instruction for a breakpoint, it's not required; for
4050 instance, the bit pattern could be an invalid instruction.  The
4051 breakpoint must be no longer than the shortest instruction of the
4052 architecture.
4053 .PP
4054 `\fB\s-1BREAKPOINT\s0\fR' has been deprecated in favor of
4055 `\fBgdbarch_breakpoint_from_pc\fR'.
4056 .PP
4057 `\fB\s-1BIG_BREAKPOINT\s0\fR'
4058 `\fB\s-1LITTLE_BREAKPOINT\s0\fR'
4059 Similar to \s-1BREAKPOINT,\s0 but used for bi-endian targets.
4060 .PP
4061 `\fB\s-1BIG_BREAKPOINT\s0\fR' and `\fB\s-1LITTLE_BREAKPOINT\s0\fR' have been deprecated in
4062 favor of `\fBgdbarch_breakpoint_from_pc\fR'.
4063 .PP
4064 `\fBconst gdb_byte *gdbarch_breakpoint_from_pc (\s-1GDBARCH, PCPTR, LENPTR\s0)\fR'
4065 Use the program counter to determine the contents and size of a
4066 breakpoint instruction.  It returns a pointer to a static string
4067 of bytes that encode a breakpoint instruction, stores the length
4068 of the string to `\fB*LENPTR\fR', and adjusts the program counter (if
4069 necessary) to point to the actual memory location where the
4070 breakpoint should be inserted.  On input, the program counter
4071 (`\fB*PCPTR\fR' is the encoded inferior's \s-1PC\s0 register.  If software
4072 breakpoints are supported, the function sets this argument to the
4073 \&\s-1PC\s0's plain address.  If software breakpoints are not supported,
4074 the function returns \s-1NULL\s0 instead of the encoded breakpoint
4075 instruction.
4076 .PP
4077 Although it is common to use a trap instruction for a breakpoint,
4078 it's not required; for instance, the bit pattern could be an
4079 invalid instruction.  The breakpoint must be no longer than the
4080 shortest instruction of the architecture.
4081 .PP
4082 Provided breakpoint bytes can be also used by
4083 `\fBbp_loc_is_permanent\fR' to detect permanent breakpoints.
4084 `\fBgdbarch_breakpoint_from_pc\fR' should return an unchanged memory
4085 copy if it was called for a location with permanent breakpoint as
4086 some architectures use breakpoint instructions containing
4087 arbitrary parameter value.
4088 .PP
4089 Replaces all the other \s-1BREAKPOINT\s0 macros.
4090 .PP
4091 `\fBint gdbarch_memory_insert_breakpoint (\s-1GDBARCH, BP_TGT\s0)\fR'
4092 `\fBgdbarch_memory_remove_breakpoint (\s-1GDBARCH, BP_TGT\s0)\fR'
4093 Insert or remove memory based breakpoints.  Reasonable defaults
4094 (`\fBdefault_memory_insert_breakpoint\fR' and
4095 `\fBdefault_memory_remove_breakpoint\fR' respectively) have been
4096 provided so that it is not necessary to set these for most
4097 architectures.  Architectures which may want to set
4098 `\fBgdbarch_memory_insert_breakpoint\fR' and
4099 `\fBgdbarch_memory_remove_breakpoint\fR' will likely have instructions
4100 that are oddly sized or are not stored in a conventional manner.
4101 .PP
4102 It may also be desirable (from an efficiency standpoint) to define
4103 custom breakpoint insertion and removal routines if
4104 `\fBgdbarch_breakpoint_from_pc\fR' needs to read the target's memory for
4105 some reason.
4106 .PP
4107 `\fB\s-1CORE_ADDR\s0 gdbarch_adjust_breakpoint_address (\s-1GDBARCH, BPADDR\s0)\fR'
4108 Given an address at which a breakpoint is desired, return a
4109 breakpoint address adjusted to account for architectural
4110 constraints on breakpoint placement.  This method is not needed by
4111 most targets.
4112 .PP
4113 The FR-V target (see `\fBfrv\-tdep.c\fR') requires this method.  The FR-V
4114 is a \s-1VLIW\s0 architecture in which a number of RISC-like instructions
4115 are grouped (packed) together into an aggregate instruction or
4116 instruction bundle.  When the processor executes one of these
4117 bundles, the component instructions are executed in parallel.
4118 .PP
4119 In the course of optimization, the compiler may group instructions
4120 from distinct source statements into the same bundle.  The line
4121 number information associated with one of the latter statements
4122 will likely refer to some instruction other than the first one in
4123 the bundle.  So, if the user attempts to place a breakpoint on one
4124 of these latter statements, \s-1GDB\s0 must be careful to _not_ place the
4125 break instruction on any instruction other than the first one in
4126 the bundle.  (Remember though that the instructions within a
4127 bundle execute in parallel, so the _first_ instruction is the
4128 instruction at the lowest address and has nothing to do with
4129 execution order.)
4130 .PP
4131 The FR-V's `\fBgdbarch_adjust_breakpoint_address\fR' method will adjust a
4132 breakpoint's address by scanning backwards for the beginning of
4133 the bundle, returning the address of the bundle.
4134 .PP
4135 Since the adjustment of a breakpoint may significantly alter a
4136 user's expectation, \s-1GDB\s0 prints a warning when an adjusted
4137 breakpoint is initially set and each time that that breakpoint is
4138 hit.
4139 .PP
4140 `\fBint gdbarch_call_dummy_location (\s-1GDBARCH\s0)\fR'
4141 See the file `\fBinferior.h\fR'.
4142 .PP
4143 This method has been replaced by `\fBgdbarch_push_dummy_code\fR' (*note
4144 gdbarch_push_dummy_code::).
4145 .PP
4146 `\fBint gdbarch_cannot_fetch_register (\s-1GDBARCH, REGUM\s0)\fR'
4147 This function should return nonzero if \s-1REGNO\s0 cannot be fetched
4148 from an inferior process.
4149 .PP
4150 `\fBint gdbarch_cannot_store_register (\s-1GDBARCH, REGNUM\s0)\fR'
4151 This function should return nonzero if \s-1REGNO\s0 should not be written
4152 to the target.  This is often the case for program counters,
4153 status words, and other special registers.  This function returns
4154 0 as default so that \s-1GDB\s0 will assume that all registers may be
4155 written.
4156 .PP
4157 `\fBint gdbarch_convert_register_p (\s-1GDBARCH, REGNUM,\s0 struct type *TYPE)\fR'
4158 Return non-zero if register \s-1REGNUM\s0 represents data values of type
4159 \&\s-1TYPE\s0 in a non-standard form.  *Note Using Different Register and
4160 Memory Data Representations: Target Architecture Definition.
4161 .PP
4162 `\fBint gdbarch_fp0_regnum (\s-1GDBARCH\s0)\fR'
4163 This function returns the number of the first floating point
4164 register, if the machine has such registers.  Otherwise, it
4165 returns \-1.
4166 .PP
4167 `\fB\s-1CORE_ADDR\s0 gdbarch_decr_pc_after_break (\s-1GDBARCH\s0)\fR'
4168 This function shall return the amount by which to decrement the \s-1PC\s0
4169 after the program encounters a breakpoint.  This is often the
4170 number of bytes in `\fB\s-1BREAKPOINT\s0\fR', though not always.  For most
4171 targets this value will be 0.
4172 .PP
4173 `\fB\s-1DISABLE_UNSETTABLE_BREAK \s0(\s-1ADDR\s0)\fR'
4174 If defined, this should evaluate to 1 if \s-1ADDR\s0 is in a shared
4175 library in which breakpoints cannot be set and so should be
4176 disabled.
4177 .PP
4178 `\fBint gdbarch_dwarf2_reg_to_regnum (\s-1GDBARCH, DWARF2_REGNR\s0)\fR'
4179 Convert \s-1DWARF2\s0 register number \s-1DWARF2_REGNR\s0 into \s-1GDB\s0 regnum.  If
4180 not defined, no conversion will be performed.
4181 .PP
4182 `\fBint gdbarch_ecoff_reg_to_regnum (\s-1GDBARCH, ECOFF_REGNR\s0)\fR'
4183 Convert \s-1ECOFF\s0 register number  \s-1ECOFF_REGNR\s0 into \s-1GDB\s0 regnum.  If
4184 not defined, no conversion will be performed.
4185 .PP
4186 `\fB\s-1GCC_COMPILED_FLAG_SYMBOL\s0\fR'
4187 `\fB\s-1GCC2_COMPILED_FLAG_SYMBOL\s0\fR'
4188 If defined, these are the names of the symbols that \s-1GDB\s0 will look
4189 for to detect that \s-1GCC\s0 compiled the file.  The default symbols are
4190 `\fBgcc_compiled.\fR' and `\fBgcc2_compiled.\fR', respectively.  (Currently
4191 only defined for the Delta 68.)
4192 .PP
4193 `\fBgdbarch_get_longjmp_target\fR'
4194 This function determines the target \s-1PC\s0 address that `\fBlongjmp\fR' will
4195 jump to, assuming that we have just stopped at a `\fBlongjmp\fR'
4196 breakpoint.  It takes a `\fB\s-1CORE_ADDR\s0 *\fR' as argument, and stores the
4197 target \s-1PC\s0 value through this pointer.  It examines the current
4198 state of the machine as needed, typically by using a
4199 manually-determined offset into the `\fBjmp_buf\fR'.  (While we might
4200 like to get the offset from the target's `\fBjmpbuf.h\fR', that header
4201 file cannot be assumed to be available when building a
4202 cross-debugger.)
4203 .PP
4204 `\fB\s-1DEPRECATED_IBM6000_TARGET\s0\fR'
4205 Shows that we are configured for an \s-1IBM RS/6000\s0 system.  This
4206 conditional should be eliminated (\s-1FIXME\s0) and replaced by
4207 feature-specific macros.  It was introduced in haste and we are
4208 repenting at leisure.
4209 .PP
4210 `\fBI386_USE_GENERIC_WATCHPOINTS\fR'
4211 An x86\-based target can define this to use the generic x86
4212 watchpoint support; see *note I386_USE_GENERIC_WATCHPOINTS:
4213 Algorithms.
4214 .PP
4215 `\fBgdbarch_in_function_epilogue_p (\s-1GDBARCH, ADDR\s0)\fR'
4216 Returns non-zero if the given \s-1ADDR\s0 is in the epilogue of a
4217 function.  The epilogue of a function is defined as the part of a
4218 function where the stack frame of the function already has been
4219 destroyed up to the final `\fBreturn from function call\fR' instruction.
4220 .PP
4221 `\fBint gdbarch_in_solib_return_trampoline (\s-1GDBARCH, PC, NAME\s0)\fR'
4222 Define this function to return nonzero if the program is stopped
4223 in the trampoline that returns from a shared library.
4224 .PP
4225 `\fBtarget_so_ops.in_dynsym_resolve_code (\s-1PC\s0)\fR'
4226 Define this to return nonzero if the program is stopped in the
4227 dynamic linker.
4228 .PP
4229 `\fB\s-1SKIP_SOLIB_RESOLVER \s0(\s-1PC\s0)\fR'
4230 Define this to evaluate to the (nonzero) address at which execution
4231 should continue to get past the dynamic linker's symbol resolution
4232 function.  A zero value indicates that it is not important or
4233 necessary to set a breakpoint to get through the dynamic linker
4234 and that single stepping will suffice.
4235 .PP
4236 `\fB\s-1CORE_ADDR\s0 gdbarch_integer_to_address (\s-1GDBARCH, TYPE, BUF\s0)\fR'
4237 Define this when the architecture needs to handle non-pointer to
4238 address conversions specially.  Converts that value to an address
4239 according to the current architectures conventions.
4240 .PP
4241 _Pragmatics: When the user copies a well defined expression from
4242 their source code and passes it, as a parameter, to \s-1GDB\s0's `\fBprint\fR'
4243 command, they should get the same value as would have been
4244 computed by the target program.  Any deviation from this rule can
4245 cause major confusion and annoyance, and needs to be justified
4246 carefully.  In other words, \s-1GDB\s0 doesn't really have the freedom to
4247 do these conversions in clever and useful ways.  It has, however,
4248 been pointed out that users aren't complaining about how \s-1GDB\s0 casts
4249 integers to pointers; they are complaining that they can't take an
4250 address from a disassembly listing and give it to `\fBx/i\fR'.  Adding
4251 an architecture method like `\fBgdbarch_integer_to_address\fR' certainly
4252 makes it possible for \s-1GDB\s0 to \*(L"get it right\*(R" in all circumstances._
4253 .PP
4254 *Note Pointers Are Not Always Addresses: Target Architecture
4255 Definition.
4256 .PP
4257 `\fB\s-1CORE_ADDR\s0 gdbarch_pointer_to_address (\s-1GDBARCH, TYPE, BUF\s0)\fR'
4258 Assume that \s-1BUF\s0 holds a pointer of type \s-1TYPE,\s0 in the appropriate
4259 format for the current architecture.  Return the byte address the
4260 pointer refers to.  *Note Pointers Are Not Always Addresses:
4261 Target Architecture Definition.
4262 .PP
4263 `\fBvoid gdbarch_register_to_value(\s-1GDBARCH, FRAME, REGNUM, TYPE, FUR\s0)\fR'
4264 Convert the raw contents of register \s-1REGNUM\s0 into a value of type
4265 \&\s-1TYPE. \s0 *Note Using Different Register and Memory Data
4266 Representations: Target Architecture Definition.
4267 .PP
4268 `\fB\s-1REGISTER_CONVERT_TO_VIRTUAL\s0(\s-1REG, TYPE, FROM, TO\s0)\fR'
4269 Convert the value of register \s-1REG\s0 from its raw form to its virtual
4270 form.  *Note Raw and Virtual Register Representations: Target
4271 Architecture Definition.
4272 .PP
4273 `\fB\s-1REGISTER_CONVERT_TO_RAW\s0(\s-1TYPE, REG, FROM, TO\s0)\fR'
4274 Convert the value of register \s-1REG\s0 from its virtual form to its raw
4275 form.  *Note Raw and Virtual Register Representations: Target
4276 Architecture Definition.
4277 .PP
4278 `\fBconst struct regset *regset_from_core_section (struct gdbarch * \s-1GDBARCH,\s0 const char * \s-1SECT_NAME,\s0 size_t \s-1SECT_SIZE\s0)\fR'
4279 Return the appropriate register set for a core file section with
4280 name \s-1SECT_NAME\s0 and size \s-1SECT_SIZE.\s0
4281 .PP
4282 `\fB\s-1\f(BISOFTWARE_SINGLE_STEP_P\s0()\fB\fR'
4283 Define this as 1 if the target does not have a hardware single-step
4284 mechanism.  The macro `\fB\s-1SOFTWARE_SINGLE_STEP\s0\fR' must also be defined.
4285 .PP
4286 `\fB\s-1SOFTWARE_SINGLE_STEP\s0(\s-1SIGNAL, INSERT_BREAKPOINTS_P\s0)\fR'
4287 A function that inserts or removes (depending on
4288 \&\s-1INSERT_BREAKPOINTS_P\s0) breakpoints at each possible destinations of
4289 the next instruction.  See `\fBsparc\-tdep.c\fR' and `\fBrs6000\-tdep.c\fR' for
4290 examples.
4291 .PP
4292 `\fBset_gdbarch_sofun_address_maybe_missing (\s-1GDBARCH, SET\s0)\fR'
4293 Somebody clever observed that, the more actual addresses you have
4294 in the debug information, the more time the linker has to spend
4295 relocating them.  So whenever there's some other way the debugger
4296 could find the address it needs, you should omit it from the debug
4297 info, to make linking faster.
4298 .PP
4299 Calling `\fBset_gdbarch_sofun_address_maybe_missing\fR' with a non-zero
4300 argument \s-1SET\s0 indicates that a particular set of hacks of this sort
4301 are in use, affecting `\fBN_SO\fR' and `\fBN_FUN\fR' entries in stabs-format
4302 debugging information.  `\fBN_SO\fR' stabs mark the beginning and ending
4303 addresses of compilation units in the text segment.  `\fBN_FUN\fR' stabs
4304 mark the starts and ends of functions.
4305 .PP
4306 In this case, \s-1GDB\s0 assumes two things:
4307 .PP
4308 * `\fBN_FUN\fR' stabs have an address of zero.  Instead of using those
4309 addresses, you should find the address where the function
4310 starts by taking the function name from the stab, and then
4311 looking that up in the minsyms (the linker/assembler symbol
4312 table).  In other words, the stab has the name, and the
4313 linker/assembler symbol table is the only place that carries
4314 the address.
4315 .PP
4316 * `\fBN_SO\fR' stabs have an address of zero, too.  You just look at
4317 the `\fBN_FUN\fR' stabs that appear before and after the `\fBN_SO\fR'
4318 stab, and guess the starting and ending addresses of the
4319 compilation unit from them.
4320 .PP
4321 `\fBint gdbarch_stabs_argument_has_addr (\s-1GDBARCH, TYPE\s0)\fR'
4322 Define this function to return nonzero if a function argument of
4323 type \s-1TYPE\s0 is passed by reference instead of value.
4324 .PP
4325 `\fB\s-1CORE_ADDR\s0 gdbarch_push_dummy_call (\s-1GDBARCH, FUNCTION, REGCACHE, BP_ADDR, NARGS, ARGS, SP, STRUCT_RETURN, STRUCT_ADDR\s0)\fR'
4326 Define this to push the dummy frame's call to the inferior
4327 function onto the stack.  In addition to pushing \s-1NARGS,\s0 the code
4328 should push \s-1STRUCT_ADDR \s0(when \s-1STRUCT_RETURN\s0 is non-zero), and the
4329 return address (\s-1BP_ADDR,\s0 in inferior's \s-1PC\s0 register encoding).
4330 .PP
4331 \&\s-1FUNCTION\s0 is a pointer to a `\fBstruct value\fR'; on architectures that
4332 use function descriptors, this contains the function descriptor
4333 value.
4334 .PP
4335 Returns the updated top-of-stack pointer.
4336 .PP
4337 `\fB\s-1CORE_ADDR\s0 gdbarch_push_dummy_code (\s-1GDBARCH, SP, FUNADDR, USING_GCC, ARGS, NARGS, VALUE_TYPE, REAL_PC, BP_ADDR, REGCACHE\s0)\fR'
4338 Given a stack based call dummy, push the instruction sequence
4339 (including space for a breakpoint) to which the called function
4340 should return.
4341 .PP
4342 Set \s-1BP_ADDR\s0 to the address at which the breakpoint instruction
4343 should be inserted (in inferior's \s-1PC\s0 register encoding), \s-1REAL_PC\s0
4344 to the resume address when starting the call sequence, and return
4345 the updated inner-most stack address.
4346 .PP
4347 By default, the stack is grown sufficient to hold a frame-aligned
4348 (see \*(L"frame_align\*(R") breakpoint, \s-1BP_ADDR\s0 is set to the address
4349 reserved for that breakpoint (in inferior's \s-1PC\s0 register encoding),
4350 and \s-1REAL_PC\s0 set to \s-1FUNADDR.\s0
4351 .PP
4352 This method replaces `\fBgdbarch_call_dummy_location (\s-1GDBARCH\s0)\fR'.
4353 .PP
4354 `\fBint gdbarch_sdb_reg_to_regnum (\s-1GDBARCH, SDB_REGNR\s0)\fR'
4355 Use this function to convert sdb register \s-1SDB_REGNR\s0 into \s-1GDB\s0
4356 regnum.  If not defined, no conversion will be done.
4357 .PP
4358 `\fBenum return_value_convention gdbarch_return_value (struct gdbarch *GDBARCH, struct type *VALTYPE, struct regcache *REGCACHE, void *READBUF, const void *WRITEBUF)\fR'
4359 Given a function with a return-value of type \s-1RETTYPE,\s0 return which
4360 return-value convention that function would use.
4361 .PP
4362 \&\s-1GDB\s0 currently recognizes two function return-value conventions:
4363 `\fB\s-1RETURN_VALUE_REGISTER_CONVENTION\s0\fR' where the return value is found
4364 in registers; and `\fB\s-1RETURN_VALUE_STRUCT_CONVENTION\s0\fR' where the return
4365 value is found in memory and the address of that memory location is
4366 passed in as the function's first parameter.
4367 .PP
4368 If the register convention is being used, and \s-1WRITEBUF\s0 is
4369 non\-`\fB\s-1NULL\s0\fR', also copy the return-value in \s-1WRITEBUF\s0 into \s-1REGCACHE.\s0
4370 .PP
4371 If the register convention is being used, and \s-1READBUF\s0 is
4372 non\-`\fB\s-1NULL\s0\fR', also copy the return value from \s-1REGCACHE\s0 into \s-1READBUF
4373 \&\s0(\s-1REGCACHE\s0 contains a copy of the registers from the just returned
4374 function).
4375 .PP
4376 _Maintainer note: This method replaces separate predicate, extract,
4377 store methods.  By having only one method, the logic needed to
4378 determine the return-value convention need only be implemented in
4379 one place.  If \s-1GDB\s0 were written in an \s-1OO\s0 language, this method
4380 would instead return an object that knew how to perform the
4381 register return-value extract and store._
4382 .PP
4383 _Maintainer note: This method does not take a \s-1GCC_P\s0 parameter, and
4384 such a parameter should not be added.  If an architecture that
4385 requires per-compiler or per-function information be identified,
4386 then the replacement of \s-1RETTYPE\s0 with `\fBstruct value\fR' \s-1FUNCTION\s0
4387 should be pursued._
4388 .PP
4389 _Maintainer note: The \s-1REGCACHE\s0 parameter limits this methods to
4390 the inner most frame.  While replacing \s-1REGCACHE\s0 with a `struct
4391 frame_info' \s-1FRAME\s0 parameter would remove that limitation there has
4392 yet to be a demonstrated need for such a change._
4393 .PP
4394 `\fBvoid gdbarch_skip_permanent_breakpoint (\s-1GDBARCH, REGCACHE\s0)\fR'
4395 Advance the inferior's \s-1PC\s0 past a permanent breakpoint.  \s-1GDB\s0
4396 normally steps over a breakpoint by removing it, stepping one
4397 instruction, and re-inserting the breakpoint.  However, permanent
4398 breakpoints are hardwired into the inferior, and can't be removed,
4399 so this strategy doesn't work.  Calling
4400 `\fBgdbarch_skip_permanent_breakpoint\fR' adjusts the processor's state
4401 so that execution will resume just after the breakpoint.  This
4402 function does the right thing even when the breakpoint is in the
4403 delay slot of a branch or jump.
4404 .PP
4405 `\fB\s-1CORE_ADDR\s0 gdbarch_skip_trampoline_code (\s-1GDBARCH, FRAME, PC\s0)\fR'
4406 If the target machine has trampoline code that sits between
4407 callers and the functions being called, then define this function
4408 to return a new \s-1PC\s0 that is at the start of the real function.
4409 .PP
4410 `\fBint gdbarch_deprecated_fp_regnum (\s-1GDBARCH\s0)\fR'
4411 If the frame pointer is in a register, use this function to return
4412 the number of that register.
4413 .PP
4414 `\fBint gdbarch_stab_reg_to_regnum (\s-1GDBARCH, STAB_REGNR\s0)\fR'
4415 Use this function to convert stab register \s-1STAB_REGNR\s0 into \s-1GDB\s0
4416 regnum.  If not defined, no conversion will be done.
4417 .PP
4418 `\fB\s-1TARGET_CHAR_BIT\s0\fR'
4419 Number of bits in a char; defaults to 8.
4420 .PP
4421 `\fBint gdbarch_char_signed (\s-1GDBARCH\s0)\fR'
4422 Non-zero if `\fBchar\fR' is normally signed on this architecture; zero if
4423 it should be unsigned.
4424 .PP
4425 The \s-1ISO C\s0 standard requires the compiler to treat `\fBchar\fR' as
4426 equivalent to either `\fBsigned char\fR' or `\fBunsigned char\fR'; any
4427 character in the standard execution set is supposed to be positive.
4428 Most compilers treat `\fBchar\fR' as signed, but `\fBchar\fR' is unsigned on
4429 the \s-1IBM S/390, RS6000,\s0 and PowerPC targets.
4430 .PP
4431 `\fBint gdbarch_double_bit (\s-1GDBARCH\s0)\fR'
4432 Number of bits in a double float; defaults to
4433 `\fB8 * \s-1TARGET_CHAR_BIT\s0\fR'.
4434 .PP
4435 `\fBint gdbarch_float_bit (\s-1GDBARCH\s0)\fR'
4436 Number of bits in a float; defaults to `\fB4 * \s-1TARGET_CHAR_BIT\s0\fR'.
4437 .PP
4438 `\fBint gdbarch_int_bit (\s-1GDBARCH\s0)\fR'
4439 Number of bits in an integer; defaults to `\fB4 * \s-1TARGET_CHAR_BIT\s0\fR'.
4440 .PP
4441 `\fBint gdbarch_long_bit (\s-1GDBARCH\s0)\fR'
4442 Number of bits in a long integer; defaults to
4443 `\fB4 * \s-1TARGET_CHAR_BIT\s0\fR'.
4444 .PP
4445 `\fBint gdbarch_long_double_bit (\s-1GDBARCH\s0)\fR'
4446 Number of bits in a long double float; defaults to
4447 `\fB2 * gdbarch_double_bit (\s-1GDBARCH\s0)\fR'.
4448 .PP
4449 `\fBint gdbarch_long_long_bit (\s-1GDBARCH\s0)\fR'
4450 Number of bits in a long long integer; defaults to
4451 `\fB2 * gdbarch_long_bit (\s-1GDBARCH\s0)\fR'.
4452 .PP
4453 `\fBint gdbarch_ptr_bit (\s-1GDBARCH\s0)\fR'
4454 Number of bits in a pointer; defaults to
4455 `\fBgdbarch_int_bit (\s-1GDBARCH\s0)\fR'.
4456 .PP
4457 `\fBint gdbarch_short_bit (\s-1GDBARCH\s0)\fR'
4458 Number of bits in a short integer; defaults to
4459 `\fB2 * \s-1TARGET_CHAR_BIT\s0\fR'.
4460 .PP
4461 `\fBvoid gdbarch_virtual_frame_pointer (\s-1GDBARCH, PC, FRAME_REGNUM, FRAME_OFFSET\s0)\fR'
4462 Returns a `\fB(\s-1REGISTER, OFFSET\s0)\fR' pair representing the virtual frame
4463 pointer in use at the code address \s-1PC. \s0 If virtual frame pointers
4464 are not used, a default definition simply returns
4465 `\fBgdbarch_deprecated_fp_regnum\fR' (or `\fBgdbarch_sp_regnum\fR', if no
4466 frame pointer is defined), with an offset of zero.
4467 .PP
4468 `\fB\s-1TARGET_HAS_HARDWARE_WATCHPOINTS\s0\fR'
4469 If non-zero, the target has support for hardware-assisted
4470 watchpoints.  *Note watchpoints: Algorithms, for more details and
4471 other related macros.
4472 .PP
4473 `\fBint gdbarch_print_insn (\s-1GDBARCH, VMA, INFO\s0)\fR'
4474 This is the function used by \s-1GDB\s0 to print an assembly instruction.
4475 It prints the instruction at address \s-1VMA\s0 in debugged memory and
4476 returns the length of the instruction, in bytes.  This usually
4477 points to a function in the `\fBopcodes\fR' library (*note Opcodes:
4478 Support Libraries.).  \s-1INFO\s0 is a structure (of type
4479 `\fBdisassemble_info\fR') defined in the header file
4480 `\fBinclude/dis\-asm.h\fR', and used to pass information to the
4481 instruction decoding routine.
4482 .PP
4483 `\fBframe_id gdbarch_dummy_id (\s-1GDBARCH, FRAME\s0)\fR'
4484 Given \s-1FRAME\s0 return a `\fBstruct frame_id\fR' that uniquely identifies an
4485 inferior function call's dummy frame.  The value returned must
4486 match the dummy frame stack value previously saved by
4487 `\fBcall_function_by_hand\fR'.
4488 .PP
4489 `\fBvoid gdbarch_value_to_register (\s-1GDBARCH, FRAME, TYPE, BUF\s0)\fR'
4490 Convert a value of type \s-1TYPE\s0 into the raw contents of a register.
4491 *Note Using Different Register and Memory Data Representations:
4492 Target Architecture Definition.
4493 .PP
4494 Motorola M68K target conditionals.
4495 .PP
4496 `\fB\s-1BPT_VECTOR\s0\fR'
4497 Define this to be the 4\-bit location of the breakpoint trap
4498 vector.  If not defined, it will default to `\fB0xf\fR'.
4499 .PP
4500 `\fB\s-1REMOTE_BPT_VECTOR\s0\fR'
4501 Defaults to `\fB1\fR'.
4502 .PP
4503 \&\fB11.11 Adding a New Target\fR
4504 .PP
4505 The following files add a target to \s-1GDB:\s0
4506 .PP
4507 `\fBgdb/TTT\-tdep.c\fR'
4508 Contains any miscellaneous code required for this target machine.
4509 On some machines it doesn't exist at all.
4510 .PP
4511 `\fBgdb/ARCH\-tdep.c\fR'
4512 `\fBgdb/ARCH\-tdep.h\fR'
4513 This is required to describe the basic layout of the target
4514 machine's processor chip (registers, stack, etc.).  It can be
4515 shared among many targets that use the same processor architecture.
4516 .PP
4517 (Target header files such as `\fBgdb/config/ARCH/tm\-TTT.h\fR',
4518 `\fBgdb/config/ARCH/tm\-ARCH.h\fR', and `\fBconfig/tm\-OS.h\fR' are no longer used.)
4519 .PP
4520 A \s-1GDB\s0 description for a new architecture, arch is created by
4521 defining a global function `\fB_initialize_ARCH_tdep\fR', by convention in
4522 the source file `\fBARCH\-tdep.c\fR'.  For example, in the case of the
4523 OpenRISC 1000, this function is called `\fB_initialize_or1k_tdep\fR' and is
4524 found in the file `\fBor1k\-tdep.c\fR'.
4525 .PP
4526 The object file resulting from compiling this source file, which will
4527 contain the implementation of the `\fB_initialize_ARCH_tdep\fR' function is
4528 specified in the \s-1GDB\s0 `\fBconfigure.tgt\fR' file, which includes a large case
4529 statement pattern matching against the `\fB\-\-target\fR' option of the
4530 `\fBconfigure\fR' script.
4531 .PP
4532 _Note:_ If the architecture requires multiple source files, the
4533 corresponding binaries should be included in `\fBconfigure.tgt\fR'.
4534 However if there are header files, the dependencies on these will
4535 not be picked up from the entries in `\fBconfigure.tgt\fR'. The
4536 `\fBMakefile.in\fR' file will need extending to show these dependencies.
4537 .PP
4538 A new struct gdbarch, defining the new architecture, is created
4539 within the `\fB_initialize_ARCH_tdep\fR' function by calling
4540 `\fBgdbarch_register\fR':
4541 .PP
4542 void gdbarch_register (enum bfd_architecture    architecture,
4543 gdbarch_init_ftype      *init_func,
4544 gdbarch_dump_tdep_ftype *tdep_dump_func);
4545 .PP
4546 This function has been described fully in an earlier section.  *Note
4547 How an Architecture is Represented: How an Architecture is Represented.
4548 .PP
4549 The new `\fBstruct gdbarch\fR' should contain implementations of the
4550 necessary functions (described in the previous sections) to describe
4551 the basic layout of the target machine's processor chip (registers,
4552 stack, etc.).  It can be shared among many targets that use the same
4553 processor architecture.
4554 .SS "12 Target Descriptions"
4555 .IX Subsection "12 Target Descriptions"
4556 The target architecture definition (*note Target Architecture
4557 Definition::) contains \s-1GDB\s0's hard-coded knowledge about an
4558 architecture.  For some platforms, it is handy to have more flexible
4559 knowledge about a specific instance of the architecture\*(--for instance,
4560 a processor or development board.  \*(L"Target descriptions\*(R" provide a
4561 mechanism for the user to tell \s-1GDB\s0 more about what their target
4562 supports, or for the target to tell \s-1GDB\s0 directly.
4563 .PP
4564 For details on writing, automatically supplying, and manually
4565 selecting target descriptions, see *note Target Descriptions:
4566 (gdb)Target Descriptions.  This section will cover some related topics
4567 about the \s-1GDB\s0 internals.
4568 .PP
4569 * Menu:
4570 .PP
4571 See also \*(L"Target Descriptions Implementation\*(R"
4572 .PP
4573 See also \*(L"Adding Target Described Register Support\*(R"
4574 .PP
4575 \&\fB12.1 Target Descriptions Implementation\fR
4576 .PP
4577 Before \s-1GDB\s0 connects to a new target, or runs a new program on an
4578 existing target, it discards any existing target description and
4579 reverts to a default gdbarch.  Then, after connecting, it looks for a
4580 new target description by calling `\fBtarget_find_description\fR'.
4581 .PP
4582 A description may come from a user specified file (\s-1XML\s0), the remote
4583 `\fBqXfer:features:read\fR' packet (also \s-1XML\s0), or from any custom
4584 `\fBto_read_description\fR' routine in the target vector.  For instance, the
4585 remote target supports guessing whether a \s-1MIPS\s0 target is 32\-bit or
4586 64\-bit based on the size of the `\fBg\fR' packet.
4587 .PP
4588 If any target description is found, \s-1GDB\s0 creates a new gdbarch
4589 incorporating the description by calling `\fBgdbarch_update_p\fR'.  Any
4590 `\fB<architecture>\fR' element is handled first, to determine which
4591 architecture's gdbarch initialization routine is called to create the
4592 new architecture.  Then the initialization routine is called, and has a
4593 chance to adjust the constructed architecture based on the contents of
4594 the target description.  For instance, it can recognize any properties
4595 set by a `\fBto_read_description\fR' routine.  Also see *note Adding Target
4596 Described Register Support::.
4597 .PP
4598 \&\fB12.2 Adding Target Described Register Support\fR
4599 .PP
4600 Target descriptions can report additional registers specific to an
4601 instance of the target.  But it takes a little work in the architecture
4602 specific routines to support this.
4603 .PP
4604 A target description must either have no registers or a complete
4605 set\*(--this avoids complexity in trying to merge standard registers with
4606 the target defined registers.  It is the architecture's responsibility
4607 to validate that a description with registers has everything it needs.
4608 To keep architecture code simple, the same mechanism is used to assign
4609 fixed internal register numbers to standard registers.
4610 .PP
4611 If `\fBtdesc_has_registers\fR' returns 1, the description contains
4612 registers.  The architecture's `\fBgdbarch_init\fR' routine should:
4613 .PP
4614 * Call `\fBtdesc_data_alloc\fR' to allocate storage, early, before
4615 searching for a matching gdbarch or allocating a new one.
4616 .PP
4617 * Use `\fBtdesc_find_feature\fR' to locate standard features by name.
4618 .PP
4619 * Use `\fBtdesc_numbered_register\fR' and `\fBtdesc_numbered_register_choices\fR'
4620 to locate the expected registers in the standard features.
4621 .PP
4622 * Return `\fB\s-1NULL\s0\fR' if a required feature is missing, or if any standard
4623 feature is missing expected registers.  This will produce a
4624 warning that the description was incomplete.
4625 .PP
4626 * Free the allocated data before returning, unless
4627 `\fBtdesc_use_registers\fR' is called.
4628 .PP
4629 * Call `\fBset_gdbarch_num_regs\fR' as usual, with a number higher than any
4630 fixed number passed to `\fBtdesc_numbered_register\fR'.
4631 .PP
4632 * Call `\fBtdesc_use_registers\fR' after creating a new gdbarch, before
4633 returning it.
4634 .PP
4635 After `\fBtdesc_use_registers\fR' has been called, the architecture's
4636 `\fBregister_name\fR', `\fBregister_type\fR', and `\fBregister_reggroup_p\fR' routines
4637 will not be called; that information will be taken from the target
4638 description.  `\fBnum_regs\fR' may be increased to account for any additional
4639 registers in the description.
4640 .PP
4641 Pseudo-registers require some extra care:
4642 .PP
4643 * Using `\fBtdesc_numbered_register\fR' allows the architecture to give
4644 constant register numbers to standard architectural registers, e.g.
4645 as an `\fBenum\fR' in `\fBARCH\-tdep.h\fR'.  But because pseudo-registers are
4646 always numbered above `\fBnum_regs\fR', which may be increased by the
4647 description, constant numbers can not be used for pseudos.  They
4648 must be numbered relative to `\fBnum_regs\fR' instead.
4649 .PP
4650 * The description will not describe pseudo-registers, so the
4651 architecture must call `\fBset_tdesc_pseudo_register_name\fR',
4652 `\fBset_tdesc_pseudo_register_type\fR', and
4653 `\fBset_tdesc_pseudo_register_reggroup_p\fR' to supply routines
4654 describing pseudo registers.  These routines will be passed
4655 internal register numbers, so the same routines used for the
4656 gdbarch equivalents are usually suitable.
4657 .SS "13 Target Vector Definition"
4658 .IX Subsection "13 Target Vector Definition"
4659 The target vector defines the interface between \s-1GDB\s0's abstract handling
4660 of target systems, and the nitty-gritty code that actually exercises
4661 control over a process or a serial port.  \s-1GDB\s0 includes some 30\-40
4662 different target vectors; however, each configuration of \s-1GDB\s0 includes
4663 only a few of them.
4664 .PP
4665 * Menu:
4666 .PP
4667 See also \*(L"Managing Execution State\*(R"
4668 .PP
4669 See also \*(L"Existing Targets\*(R"
4670 .PP
4671 \&\fB13.1 Managing Execution State\fR
4672 .PP
4673 A target vector can be completely inactive (not pushed on the target
4674 stack), active but not running (pushed, but not connected to a fully
4675 manifested inferior), or completely active (pushed, with an accessible
4676 inferior).  Most targets are only completely inactive or completely
4677 active, but some support persistent connections to a target even when
4678 the target has exited or not yet started.
4679 .PP
4680 For example, connecting to the simulator using `\fBtarget sim\fR' does not
4681 create a running program.  Neither registers nor memory are accessible
4682 until `\fBrun\fR'.  Similarly, after `\fBkill\fR', the program can not continue
4683 executing.  But in both cases \s-1GDB\s0 remains connected to the simulator,
4684 and target-specific commands are directed to the simulator.
4685 .PP
4686 A target which only supports complete activation should push itself
4687 onto the stack in its `\fBto_open\fR' routine (by calling `\fBpush_target\fR'), and
4688 unpush itself from the stack in its `\fBto_mourn_inferior\fR' routine (by
4689 calling `\fBunpush_target\fR').
4690 .PP
4691 A target which supports both partial and complete activation should
4692 still call `\fBpush_target\fR' in `\fBto_open\fR', but not call `\fBunpush_target\fR' in
4693 `\fBto_mourn_inferior\fR'.  Instead, it should call either
4694 `\fBtarget_mark_running\fR' or `\fBtarget_mark_exited\fR' in its `\fBto_open\fR',
4695 depending on whether the target is fully active after connection.  It
4696 should also call `\fBtarget_mark_running\fR' any time the inferior becomes
4697 fully active (e.g. in `\fBto_create_inferior\fR' and `\fBto_attach\fR'), and
4698 `\fBtarget_mark_exited\fR' when the inferior becomes inactive (in
4699 `\fBto_mourn_inferior\fR').  The target should also make sure to call
4700 `\fBtarget_mourn_inferior\fR' from its `\fBto_kill\fR', to return the target to
4701 inactive state.
4702 .PP
4703 \&\fB13.2 Existing Targets\fR
4704 .PP
4705 13.2.1 File Targets
4706 \&\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
4707 .PP
4708 Both executables and core files have target vectors.
4709 .PP
4710 13.2.2 Standard Protocol and Remote Stubs
4711 \&\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
4712 .PP
4713 \&\s-1GDB\s0's file `\fBremote.c\fR' talks a serial protocol to code that runs in the
4714 target system.  \s-1GDB\s0 provides several sample \*(L"stubs\*(R" that can be
4715 integrated into target programs or operating systems for this purpose;
4716 they are named `\fBCPU\-stub.c\fR'.  Many operating systems, embedded targets,
4717 emulators, and simulators already have a \s-1GDB\s0 stub built into them, and
4718 maintenance of the remote protocol must be careful to preserve
4719 compatibility.
4720 .PP
4721 The \s-1GDB\s0 user's manual describes how to put such a stub into your
4722 target code.  What follows is a discussion of integrating the \s-1SPARC\s0
4723 stub into a complicated operating system (rather than a simple
4724 program), by Stu Grossman, the author of this stub.
4725 .PP
4726 The trap handling code in the stub assumes the following upon entry
4727 to `\fBtrap_low\fR':
4728 .PP
4729 1. \f(CW%l1\fR and \f(CW%l2\fR contain pc and npc respectively at the time of the
4730 trap;
4731 .PP
4732 2. traps are disabled;
4733 .PP
4734 3. you are in the correct trap window.
4735 .PP
4736 As long as your trap handler can guarantee those conditions, then
4737 there is no reason why you shouldn't be able to \*(L"share\*(R" traps with the
4738 stub.  The stub has no requirement that it be jumped to directly from
4739 the hardware trap vector.  That is why it calls `\fB\f(BIexceptionHandler()\fB\fR',
4740 which is provided by the external environment.  For instance, this could
4741 set up the hardware traps to actually execute code which calls the stub
4742 first, and then transfers to its own trap handler.
4743 .PP
4744 For the most point, there probably won't be much of an issue with
4745 \&\*(L"sharing\*(R" traps, as the traps we use are usually not used by the kernel,
4746 and often indicate unrecoverable error conditions.  Anyway, this is all
4747 controlled by a table, and is trivial to modify.  The most important
4748 trap for us is for `\fBta 1\fR'.  Without that, we can't single step or do
4749 breakpoints.  Everything else is unnecessary for the proper operation
4750 of the debugger/stub.
4751 .PP
4752 From reading the stub, it's probably not obvious how breakpoints
4753 work.  They are simply done by deposit/examine operations from \s-1GDB.\s0
4754 .PP
4755 13.2.3 \s-1ROM\s0 Monitor Interface
4756 \&\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
4757 .PP
4758 13.2.4 Custom Protocols
4759 \&\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
4760 .PP
4761 13.2.5 Transport Layer
4762 \&\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
4763 .PP
4764 13.2.6 Builtin Simulator
4765 \&\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
4766 .SS "14 Native Debugging"
4767 .IX Subsection "14 Native Debugging"
4768 Several files control \s-1GDB\s0's configuration for native support:
4769 .PP
4770 `\fBgdb/config/ARCH/XYZ.mh\fR'
4771 Specifies Makefile fragments needed by a _native_ configuration on
4772 machine \s-1XYZ. \s0 In particular, this lists the required
4773 native-dependent object files, by defining `\fBNATDEPFILES=...\fR'.
4774 Also specifies the header file which describes native support on
4775 \&\s-1XYZ,\s0 by defining `\fBNAT_FILE= nm\-XYZ.h\fR'.  You can also define
4776 `\fB\s-1NAT_CFLAGS\s0\fR', `\fB\s-1NAT_ADD_FILES\s0\fR', `\fB\s-1NAT_CLIBS\s0\fR', `\fB\s-1NAT_CDEPS\s0\fR',
4777 `\fB\s-1NAT_GENERATED_FILES\s0\fR', etc.; see `\fBMakefile.in\fR'.
4778 .PP
4779 _Maintainer's note: The `\fB.mh\fR' suffix is because this file
4780 originally contained `\fBMakefile\fR' fragments for hosting \s-1GDB\s0 on
4781 machine \s-1XYZ. \s0 While the file is no longer used for this purpose,
4782 the `\fB.mh\fR' suffix remains.  Perhaps someone will eventually rename
4783 these fragments so that they have a `\fB.mn\fR' suffix._
4784 .PP
4785 `\fBgdb/config/ARCH/nm\-XYZ.h\fR'
4786 (`\fBnm.h\fR' is a link to this file, created by `\fBconfigure\fR').  Contains
4787 C macro definitions describing the native system environment, such
4788 as child process control and core file support.
4789 .PP
4790 `\fBgdb/XYZ\-nat.c\fR'
4791 Contains any miscellaneous C code required for this native support
4792 of this machine.  On some machines it doesn't exist at all.
4793 .PP
4794 There are some \*(L"generic\*(R" versions of routines that can be used by
4795 various systems.  These can be customized in various ways by macros
4796 defined in your `\fBnm\-XYZ.h\fR' file.  If these routines work for the \s-1XYZ\s0
4797 host, you can just include the generic file's name (with `\fB.o\fR', not
4798 `\fB.c\fR') in `\fB\s-1NATDEPFILES\s0\fR'.
4799 .PP
4800 Otherwise, if your machine needs custom support routines, you will
4801 need to write routines that perform the same functions as the generic
4802 file.  Put them into `\fBXYZ\-nat.c\fR', and put `\fBXYZ\-nat.o\fR' into
4803 `\fB\s-1NATDEPFILES\s0\fR'.
4804 .PP
4805 `\fBinftarg.c\fR'
4806 This contains the _target_ops vector_ that supports Unix child
4807 processes on systems which use ptrace and wait to control the
4808 child.
4809 .PP
4810 `\fBprocfs.c\fR'
4811 This contains the _target_ops vector_ that supports Unix child
4812 processes on systems which use /proc to control the child.
4813 .PP
4814 `\fBfork\-child.c\fR'
4815 This does the low-level grunge that uses Unix system calls to do a
4816 \&\*(L"fork and exec\*(R" to start up a child process.
4817 .PP
4818 `\fBinfptrace.c\fR'
4819 This is the low level interface to inferior processes for systems
4820 using the Unix `\fBptrace\fR' call in a vanilla way.
4821 .PP
4822 14.1 ptrace
4823 ===========
4824 .PP
4825 14.2 /proc
4826 ==========
4827 .PP
4828 14.3 win32
4829 ==========
4830 .PP
4831 14.4 shared libraries
4832 =====================
4833 .PP
4834 14.5 Native Conditionals
4835 ========================
4836 .PP
4837 When \s-1GDB\s0 is configured and compiled, various macros are defined or left
4838 undefined, to control compilation when the host and target systems are
4839 the same.  These macros should be defined (or left undefined) in
4840 `\fBnm\-SYSTEM.h\fR'.
4841 .PP
4842 `\fBI386_USE_GENERIC_WATCHPOINTS\fR'
4843 An x86\-based machine can define this to use the generic x86
4844 watchpoint support; see *note I386_USE_GENERIC_WATCHPOINTS:
4845 Algorithms.
4846 .PP
4847 `\fB\s-1SOLIB_ADD \s0(\s-1FILENAME, FROM_TTY, TARG, READSYMS\s0)\fR'
4848 Define this to expand into an expression that will cause the
4849 symbols in \s-1FILENAME\s0 to be added to \s-1GDB\s0's symbol table.  If
4850 \&\s-1READSYMS\s0 is zero symbols are not read but any necessary low level
4851 processing for \s-1FILENAME\s0 is still done.
4852 .PP
4853 `\fB\s-1SOLIB_CREATE_INFERIOR_HOOK\s0\fR'
4854 Define this to expand into any shared-library-relocation code that
4855 you want to be run just after the child process has been forked.
4856 .PP
4857 `\fB\s-1START_INFERIOR_TRAPS_EXPECTED\s0\fR'
4858 When starting an inferior, \s-1GDB\s0 normally expects to trap twice;
4859 once when the shell execs, and once when the program itself execs.
4860 If the actual number of traps is something other than 2, then
4861 define this macro to expand into the number expected.
4862 .SS "15 Support Libraries"
4863 .IX Subsection "15 Support Libraries"
4864 15.1 \s-1BFD\s0
4865 ========
4866 .PP
4867 \&\s-1BFD\s0 provides support for \s-1GDB\s0 in several ways:
4868 .PP
4869 _identifying executable and core files_
4870 \&\s-1BFD\s0 will identify a variety of file types, including a.out, coff,
4871 and several variants thereof, as well as several kinds of core
4872 files.
4873 .PP
4874 _access to sections of files_
4875 \&\s-1BFD\s0 parses the file headers to determine the names, virtual
4876 addresses, sizes, and file locations of all the various named
4877 sections in files (such as the text section or the data section).
4878 \&\s-1GDB\s0 simply calls \s-1BFD\s0 to read or write section X at byte offset Y
4879 for length Z.
4880 .PP
4881 _specialized core file support_
4882 \&\s-1BFD\s0 provides routines to determine the failing command name stored
4883 in a core file, the signal with which the program failed, and
4884 whether a core file matches (i.e. could be a core dump of) a
4885 particular executable file.
4886 .PP
4887 _locating the symbol information_
4888 \&\s-1GDB\s0 uses an internal interface of \s-1BFD\s0 to determine where to find
4889 the symbol information in an executable file or symbol-file.  \s-1GDB\s0
4890 itself handles the reading of symbols, since \s-1BFD\s0 does not
4891 \&\*(L"understand\*(R" debug symbols, but \s-1GDB\s0 uses \s-1BFD\s0's cached information
4892 to find the symbols, string table, etc.
4893 .PP
4894 15.2 opcodes
4895 ============
4896 .PP
4897 The opcodes library provides \s-1GDB\s0's disassembler.  (It's a separate
4898 library because it's also used in binutils, for `\fBobjdump\fR').
4899 .PP
4900 15.3 readline
4901 =============
4902 .PP
4903 The `\fBreadline\fR' library provides a set of functions for use by
4904 applications that allow users to edit command lines as they are typed
4905 in.
4906 .PP
4907 15.4 libiberty
4908 ==============
4909 .PP
4910 The `\fBlibiberty\fR' library provides a set of functions and features that
4911 integrate and improve on functionality found in modern operating
4912 systems.  Broadly speaking, such features can be divided into three
4913 groups: supplemental functions (functions that may be missing in some
4914 environments and operating systems), replacement functions (providing a
4915 uniform and easier to use interface for commonly used standard
4916 functions), and extensions (which provide additional functionality
4917 beyond standard functions).
4918 .PP
4919 \&\s-1GDB\s0 uses various features provided by the `\fBlibiberty\fR' library, for
4920 instance the \*(C+ demangler, the \s-1IEEE\s0 floating format support functions,
4921 the input options parser `\fBgetopt\fR', the `\fBobstack\fR' extension, and other
4922 functions.
4923 .PP
4924 15.4.1 `\fBobstacks\fR' in \s-1GDB
4925 \&\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\s0
4926 .PP
4927 The obstack mechanism provides a convenient way to allocate and free
4928 chunks of memory.  Each obstack is a pool of memory that is managed
4929 like a stack.  Objects (of any nature, size and alignment) are
4930 allocated and freed in a \s-1LIFO\s0 fashion on an obstack (see `\fBlibiberty\fR''s
4931 documentation for a more detailed explanation of `\fBobstacks\fR').
4932 .PP
4933 The most noticeable use of the `\fBobstacks\fR' in \s-1GDB\s0 is in object files.
4934 There is an obstack associated with each internal representation of an
4935 object file.  Lots of things get allocated on these `\fBobstacks\fR':
4936 dictionary entries, blocks, blockvectors, symbols, minimal symbols,
4937 types, vectors of fundamental types, class fields of types, object
4938 files section lists, object files section offset lists, line tables,
4939 symbol tables, partial symbol tables, string tables, symbol table
4940 private data, macros tables, debug information sections and entries,
4941 import and export lists (som), unwind information (hppa), dwarf2
4942 location expressions data.  Plus various strings such as directory
4943 names strings, debug format strings, names of types.
4944 .PP
4945 An essential and convenient property of all data on `\fBobstacks\fR' is
4946 that memory for it gets allocated (with `\fBobstack_alloc\fR') at various
4947 times during a debugging session, but it is released all at once using
4948 the `\fBobstack_free\fR' function.  The `\fBobstack_free\fR' function takes a
4949 pointer to where in the stack it must start the deletion from (much
4950 like the cleanup chains have a pointer to where to start the cleanups).
4951 Because of the stack like structure of the `\fBobstacks\fR', this allows to
4952 free only a top portion of the obstack.  There are a few instances in
4953 \&\s-1GDB\s0 where such thing happens.  Calls to `\fBobstack_free\fR' are done after
4954 some local data is allocated to the obstack.  Only the local data is
4955 deleted from the obstack.  Of course this assumes that nothing between
4956 the `\fBobstack_alloc\fR' and the `\fBobstack_free\fR' allocates anything else on
4957 the same obstack.  For this reason it is best and safest to use
4958 temporary `\fBobstacks\fR'.
4959 .PP
4960 Releasing the whole obstack is also not safe per se.  It is safe only
4961 under the condition that we know the `\fBobstacks\fR' memory is no longer
4962 needed.  In \s-1GDB\s0 we get rid of the `\fBobstacks\fR' only when we get rid of
4963 the whole objfile(s), for instance upon reading a new symbol file.
4964 .PP
4965 15.5 gnu-regex
4966 ==============
4967 .PP
4968 Regex conditionals.
4969 .PP
4970 `\fBC_ALLOCA\fR'
4971 .PP
4972 `\fB\s-1NFAILURES\s0\fR'
4973 .PP
4974 `\fB\s-1RE_NREGS\s0\fR'
4975 .PP
4976 `\fB\s-1SIGN_EXTEND_CHAR\s0\fR'
4977 .PP
4978 `\fB\s-1SWITCH_ENUM_BUG\s0\fR'
4979 .PP
4980 `\fB\s-1SYNTAX_TABLE\s0\fR'
4981 .PP
4982 `\fBSword\fR'
4983 .PP
4984 `\fBsparc\fR'
4985 .PP
4986 15.6 Array Containers
4987 =====================
4988 .PP
4989 Often it is necessary to manipulate a dynamic array of a set of
4990 objects.  C forces some bookkeeping on this, which can get cumbersome
4991 and repetitive.  The `\fBvec.h\fR' file contains macros for defining and
4992 using a typesafe vector type.  The functions defined will be inlined
4993 when compiling, and so the abstraction cost should be zero.  Domain
4994 checks are added to detect programming errors.
4995 .PP
4996 An example use would be an array of symbols or section information.
4997 The array can be grown as symbols are read in (or preallocated), and
4998 the accessor macros provided keep care of all the necessary
4999 bookkeeping.  Because the arrays are type safe, there is no danger of
5000 accidentally mixing up the contents.  Think of these as \*(C+ templates,
5001 but implemented in C.
5002 .PP
5003 Because of the different behavior of structure objects, scalar
5004 objects and of pointers, there are three flavors of vector, one for
5005 each of these variants.  Both the structure object and pointer variants
5006 pass pointers to objects around \*(-- in the former case the pointers are
5007 stored into the vector and in the latter case the pointers are
5008 dereferenced and the objects copied into the vector.  The scalar object
5009 variant is suitable for `\fBint\fR'\-like objects, and the vector elements are
5010 returned by value.
5011 .PP
5012 There are both `\fBindex\fR' and `\fBiterate\fR' accessors.  The iterator
5013 returns a boolean iteration condition and updates the iteration
5014 variable passed by reference.  Because the iterator will be inlined,
5015 the address-of can be optimized away.
5016 .PP
5017 The vectors are implemented using the trailing array idiom, thus they
5018 are not resizeable without changing the address of the vector object
5019 itself.  This means you cannot have variables or fields of vector type
5020 \&\*(-- always use a pointer to a vector.  The one exception is the final
5021 field of a structure, which could be a vector type.  You will have to
5022 use the `\fBembedded_size\fR' & `\fBembedded_init\fR' calls to create such objects,
5023 and they will probably not be resizeable (so don't use the \*(L"safe\*(R"
5024 allocation variants).  The trailing array idiom is used (rather than a
5025 pointer to an array of data), because, if we allow `\fB\s-1NULL\s0\fR' to also
5026 represent an empty vector, empty vectors occupy minimal space in the
5027 structure containing them.
5028 .PP
5029 Each operation that increases the number of active elements is
5030 available in \*(L"quick\*(R" and \*(L"safe\*(R" variants.  The former presumes that
5031 there is sufficient allocated space for the operation to succeed (it
5032 dies if there is not).  The latter will reallocate the vector, if
5033 needed.  Reallocation causes an exponential increase in vector size.
5034 If you know you will be adding N elements, it would be more efficient
5035 to use the reserve operation before adding the elements with the
5036 \&\*(L"quick\*(R" operation.  This will ensure there are at least as many
5037 elements as you ask for, it will exponentially increase if there are
5038 too few spare slots.  If you want reserve a specific number of slots,
5039 but do not want the exponential increase (for instance, you know this
5040 is the last allocation), use a negative number for reservation.  You
5041 can also create a vector of a specific size from the get go.
5042 .PP
5043 You should prefer the push and pop operations, as they append and
5044 remove from the end of the vector.  If you need to remove several items
5045 in one go, use the truncate operation.  The insert and remove
5046 operations allow you to change elements in the middle of the vector.
5047 There are two remove operations, one which preserves the element
5048 ordering `\fBordered_remove\fR', and one which does not `\fBunordered_remove\fR'.
5049 The latter function copies the end element into the removed slot,
5050 rather than invoke a memmove operation.  The `\fBlower_bound\fR' function
5051 will determine where to place an item in the array using insert that
5052 will maintain sorted order.
5053 .PP
5054 If you need to directly manipulate a vector, then the `\fBaddress\fR'
5055 accessor will return the address of the start of the vector.  Also the
5056 `\fBspace\fR' predicate will tell you whether there is spare capacity in the
5057 vector.  You will not normally need to use these two functions.
5058 .PP
5059 Vector types are defined using a `\fBDEF_VEC_{O,P,I}(\s-1TYPENAME\s0)\fR' macro.
5060 Variables of vector type are declared using a `\fB\s-1VEC\s0(\s-1TYPENAME\s0)\fR' macro.
5061 The characters `\fBO\fR', `\fBP\fR' and `\fBI\fR' indicate whether \s-1TYPENAME\s0 is an object
5062 (`\fBO\fR'), pointer (`\fBP\fR') or integral (`\fBI\fR') type.  Be careful to pick the
5063 correct one, as you'll get an awkward and inefficient \s-1API\s0 if you use
5064 the wrong one.  There is a check, which results in a compile-time
5065 warning, for the `\fBP\fR' and `\fBI\fR' versions, but there is no check for the
5066 `\fBO\fR' versions, as that is not possible in plain C.
5067 .PP
5068 An example of their use would be,
5069 .PP
5070 \&\s-1DEF_VEC_P\s0(tree);   // non-managed tree vector.
5071 .PP
5072 struct my_struct {
5073 \&\s-1VEC\s0(tree) *v;      // A (pointer to) a vector of tree pointers.
5074 };
5075 .PP
5076 struct my_struct *s;
5077 .PP
5078 if (VEC_length(tree, s\->v)) { we have some contents }
5079 VEC_safe_push(tree, s\->v, decl); // append some decl onto the end
5080 for (ix = 0; VEC_iterate(tree, s\->v, ix, elt); ix++)
5081 { do something with elt }
5082 .PP
5083 The `\fBvec.h\fR' file provides details on how to invoke the various
5084 accessors provided.  They are enumerated here:
5085 .PP
5086 `\fBVEC_length\fR'
5087 Return the number of items in the array,
5088 .PP
5089 `\fBVEC_empty\fR'
5090 Return true if the array has no elements.
5091 .PP
5092 `\fBVEC_last\fR'
5093 `\fBVEC_index\fR'
5094 Return the last or arbitrary item in the array.
5095 .PP
5096 `\fBVEC_iterate\fR'
5097 Access an array element and indicate whether the array has been
5098 traversed.
5099 .PP
5100 `\fBVEC_alloc\fR'
5101 `\fBVEC_free\fR'
5102 Create and destroy an array.
5103 .PP
5104 `\fBVEC_embedded_size\fR'
5105 `\fBVEC_embedded_init\fR'
5106 Helpers for embedding an array as the final element of another
5107 struct.
5108 .PP
5109 `\fBVEC_copy\fR'
5110 Duplicate an array.
5111 .PP
5112 `\fBVEC_space\fR'
5113 Return the amount of free space in an array.
5114 .PP
5115 `\fBVEC_reserve\fR'
5116 Ensure a certain amount of free space.
5117 .PP
5118 `\fBVEC_quick_push\fR'
5119 `\fBVEC_safe_push\fR'
5120 Append to an array, either assuming the space is available, or
5121 making sure that it is.
5122 .PP
5123 `\fBVEC_pop\fR'
5124 Remove the last item from an array.
5125 .PP
5126 `\fBVEC_truncate\fR'
5127 Remove several items from the end of an array.
5128 .PP
5129 `\fBVEC_safe_grow\fR'
5130 Add several items to the end of an array.
5131 .PP
5132 `\fBVEC_replace\fR'
5133 Overwrite an item in the array.
5134 .PP
5135 `\fBVEC_quick_insert\fR'
5136 `\fBVEC_safe_insert\fR'
5137 Insert an item into the middle of the array.  Either the space must
5138 already exist, or the space is created.
5139 .PP
5140 `\fBVEC_ordered_remove\fR'
5141 `\fBVEC_unordered_remove\fR'
5142 Remove an item from the array, preserving order or not.
5143 .PP
5144 `\fBVEC_block_remove\fR'
5145 Remove a set of items from the array.
5146 .PP
5147 `\fBVEC_address\fR'
5148 Provide the address of the first element.
5149 .PP
5150 `\fBVEC_lower_bound\fR'
5151 Binary search the array.
5152 .PP
5153 15.7 include
5154 ============
5155 .SS "16 Coding Standards"
5156 .IX Subsection "16 Coding Standards"
5157 16.1 \s-1GDB C\s0 Coding Standards
5158 ===========================
5159 .PP
5160 \&\s-1GDB\s0 follows the \s-1GNU\s0 coding standards, as described in
5161 `\fBetc/standards.texi\fR'.  This file is also available for anonymous \s-1FTP\s0
5162 from \s-1GNU\s0 archive sites.  \s-1GDB\s0 takes a strict interpretation of the
5163 standard; in general, when the \s-1GNU\s0 standard recommends a practice but
5164 does not require it, \s-1GDB\s0 requires it.
5165 .PP
5166 \&\s-1GDB\s0 follows an additional set of coding standards specific to \s-1GDB,\s0
5167 as described in the following sections.
5168 .PP
5169 16.1.1 \s-1ISO C
5170 \&\-\-\-\-\-\-\-\-\-\-\-\-\s0
5171 .PP
5172 \&\s-1GDB\s0 assumes an \s-1ISO/IEC 9899:1990 \s0(a.k.a. \s-1ISO C90\s0) compliant compiler.
5173 .PP
5174 \&\s-1GDB\s0 does not assume an \s-1ISO C\s0 or \s-1POSIX\s0 compliant C library.
5175 .PP
5176 16.1.2 Formatting
5177 \&\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
5178 .PP
5179 The standard \s-1GNU\s0 recommendations for formatting must be followed
5180 strictly.  Any GDB-specific deviation from \s-1GNU\s0 recomendations is
5181 described below.
5182 .PP
5183 A function declaration should not have its name in column zero.  A
5184 function definition should have its name in column zero.
5185 .PP
5186 /* Declaration */
5187 static void foo (void);
5188 /* Definition */
5189 void
5190 foo (void)
5191 {
5192 }
5193 .PP
5194 _Pragmatics: This simplifies scripting.  Function definitions can be
5195 found using `\fB^function\-name\fR'._
5196 .PP
5197 There must be a space between a function or macro name and the
5198 opening parenthesis of its argument list (except for macro definitions,
5199 as required by C).  There must not be a space after an open
5200 paren/bracket or before a close paren/bracket.
5201 .PP
5202 While additional whitespace is generally helpful for reading, do not
5203 use more than one blank line to separate blocks, and avoid adding
5204 whitespace after the end of a program line (as of 1/99, some 600 lines
5205 had whitespace after the semicolon).  Excess whitespace causes
5206 difficulties for `\fBdiff\fR' and `\fBpatch\fR' utilities.
5207 .PP
5208 Pointers are declared using the traditional K&R C style:
5209 .PP
5210 void *foo;
5211 .PP
5212 and not:
5213 .PP
5214 void * foo;
5215 void* foo;
5216 .PP
5217 In addition, whitespace around casts and unary operators should
5218 follow the following guidelines:
5219 .PP
5220 Use...         ...instead of
5221 `\fB!x\fR'           `\fB! x\fR'
5222 `\fB~x\fR'           `\fB~ x\fR'
5223 `\fB\-x\fR'           `\fB\- x\fR'          (unary minus)
5224 `\fB(foo) x\fR'      `\fB(foo)x\fR'       (cast)
5225 `\fB*x\fR'           `\fB* x\fR'          (pointer dereference)
5226 .PP
5227 Any two or more lines in code should be wrapped in braces, even if
5228 they are comments, as they look like separate statements:
5229 .PP
5230 if (i)
5231 {
5232 /* Return success.  */
5233 return 0;
5234 }
5235 .PP
5236 and not:
5237 .PP
5238 if (i)
5239 /* Return success.  */
5240 return 0;
5241 .PP
5242 16.1.3 Comments
5243 \&\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
5244 .PP
5245 The standard \s-1GNU\s0 requirements on comments must be followed strictly.
5246 .PP
5247 Block comments must appear in the following form, with no `\fB/*\fR'\- or
5248 `\fB*/\fR'\-only lines, and no leading `\fB*\fR':
5249 .PP
5250 /* Wait for control to return from inferior to debugger.  If inferior
5251 gets a signal, we may decide to start it up again instead of
5252 returning.  That is why there is a loop in this function.  When
5253 this function actually returns it means the inferior should be left
5254 stopped and \s-1GDB\s0 should read more commands.  */
5255 .PP
5256 (Note that this format is encouraged by Emacs; tabbing for a
5257 multi-line comment works correctly, and `\fBM\-q\fR' fills the block
5258 consistently.)
5259 .PP
5260 Put a blank line between the block comments preceding function or
5261 variable definitions, and the definition itself.
5262 .PP
5263 In general, put function-body comments on lines by themselves, rather
5264 than trying to fit them into the 20 characters left at the end of a
5265 line, since either the comment or the code will inevitably get longer
5266 than will fit, and then somebody will have to move it anyhow.
5267 .PP
5268 16.1.4 C Usage
5269 \&\-\-\-\-\-\-\-\-\-\-\-\-\-\-
5270 .PP
5271 Code must not depend on the sizes of C data types, the format of the
5272 host's floating point numbers, the alignment of anything, or the order
5273 of evaluation of expressions.
5274 .PP
5275 Use functions freely.  There are only a handful of compute-bound
5276 areas in \s-1GDB\s0 that might be affected by the overhead of a function call,
5277 mainly in symbol reading.  Most of \s-1GDB\s0's performance is limited by the
5278 target interface (whether serial line or system call).
5279 .PP
5280 However, use functions with moderation.  A thousand one-line
5281 functions are just as hard to understand as a single thousand-line
5282 function.
5283 .PP
5284 _Macros are bad, M'kay._ (But if you have to use a macro, make sure
5285 that the macro arguments are protected with parentheses.)
5286 .PP
5287 Declarations like `\fBstruct foo *\fR' should be used in preference to
5288 declarations like `\fBtypedef struct foo { ... } *foo_ptr\fR'.
5289 .PP
5290 Zero constant (`\fB0\fR') is not interchangeable with a null pointer
5291 constant (`\fB\s-1NULL\s0\fR') anywhere.  \s-1GCC\s0 does not give a warning for such
5292 interchange.  Specifically:
5293 .PP
5294 incorrect      `\fBif (pointervar) {}\fR'
5295 incorrect      `\fBif (!pointervar) {}\fR'
5296 incorrect      `\fBif (pointervar != 0) {}\fR'
5297 incorrect      `\fBif (pointervar == 0) {}\fR'
5298 correct        `\fBif (pointervar != \s-1NULL\s0) {}\fR'
5299 correct        `\fBif (pointervar == \s-1NULL\s0) {}\fR'
5300 .PP
5301 16.1.5 Function Prototypes
5302 \&\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
5303 .PP
5304 Prototypes must be used when both _declaring_ and _defining_ a
5305 function.  Prototypes for \s-1GDB\s0 functions must include both the argument
5306 type and name, with the name matching that used in the actual function
5307 definition.
5308 .PP
5309 All external functions should have a declaration in a header file
5310 that callers include, that declaration should use the `\fBextern\fR' modifier.
5311 The only exception concerns `\fB_initialize_*\fR' functions, which must be
5312 external so that `\fBinit.c\fR' construction works, but shouldn't be visible
5313 to random source files.
5314 .PP
5315 Where a source file needs a forward declaration of a static function,
5316 that declaration must appear in a block near the top of the source file.
5317 .PP
5318 16.1.6 File Names
5319 \&\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
5320 .PP
5321 Any file used when building the core of \s-1GDB\s0 must be in lower case.  Any
5322 file used when building the core of \s-1GDB\s0 must be 8.3 unique.  These
5323 requirements apply to both source and generated files.
5324 .PP
5325 _Pragmatics: The core of \s-1GDB\s0 must be buildable on many platforms
5326 including \s-1DJGPP\s0 and MacOS/HFS.  Every time an unfriendly file is
5327 introduced to the build process both `\fBMakefile.in\fR' and `\fBconfigure.in\fR'
5328 need to be modified accordingly.  Compare the convoluted conversion
5329 process needed to transform `\fB\s-1COPYING\s0\fR' into `\fBcopying.c\fR' with the
5330 conversion needed to transform `\fBversion.in\fR' into `\fBversion.c\fR'._
5331 .PP
5332 Any file non 8.3 compliant file (that is not used when building the
5333 core of \s-1GDB\s0) must be added to `\fBgdb/config/djgpp/fnchange.lst\fR'.
5334 .PP
5335 _Pragmatics: This is clearly a compromise._
5336 .PP
5337 When \s-1GDB\s0 has a local version of a system header file (ex `\fBstring.h\fR')
5338 the file name based on the \s-1POSIX\s0 header prefixed with `\fBgdb_\fR'
5339 (`\fBgdb_string.h\fR').  These headers should be relatively independent: they
5340 should use only macros defined by `\fBconfigure\fR', the compiler, or the
5341 host; they should include only system headers; they should refer only
5342 to system types.  They may be shared between multiple programs, e.g.
5343 \&\s-1GDB\s0 and \s-1GDBSERVER.\s0
5344 .PP
5345 For other files `\fB\-\fR' is used as the separator.
5346 .PP
5347 16.1.7 Include Files
5348 \&\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
5349 .PP
5350 A `\fB.c\fR' file should include `\fBdefs.h\fR' first.
5351 .PP
5352 A `\fB.c\fR' file should directly include the `\fB.h\fR' file of every
5353 declaration and/or definition it directly refers to.  It cannot rely on
5354 indirect inclusion.
5355 .PP
5356 A `\fB.h\fR' file should directly include the `\fB.h\fR' file of every
5357 declaration and/or definition it directly refers to.  It cannot rely on
5358 indirect inclusion.  Exception: The file `\fBdefs.h\fR' does not need to be
5359 directly included.
5360 .PP
5361 An external declaration should only appear in one include file.
5362 .PP
5363 An external declaration should never appear in a `\fB.c\fR' file.
5364 Exception: a declaration for the `\fB_initialize\fR' function that pacifies
5365 `\fB\-Wmissing\-declaration\fR'.
5366 .PP
5367 A `\fBtypedef\fR' definition should only appear in one include file.
5368 .PP
5369 An opaque `\fBstruct\fR' declaration can appear in multiple `\fB.h\fR' files.
5370 Where possible, a `\fB.h\fR' file should use an opaque `\fBstruct\fR' declaration
5371 instead of an include.
5372 .PP
5373 All `\fB.h\fR' files should be wrapped in:
5374 .PP
5375 #ifndef \s-1INCLUDE_FILE_NAME_H\s0
5376 #define \s-1INCLUDE_FILE_NAME_H\s0
5377 header body
5378 #endif
5379 .PP
5380 16.2 \s-1GDB\s0 Python Coding Standards
5381 ================================
5382 .PP
5383 \&\s-1GDB\s0 follows the published `\fBPython\fR' coding standards in `\fB\s-1PEP008\s0\fR'
5384 (http://www.python.org/dev/peps/pep\-0008/).
5385 .PP
5386 In addition, the guidelines in the Google Python Style Guide
5387 (http://google\-styleguide.googlecode.com/svn/trunk/pyguide.html) are
5388 also followed where they do not conflict with `\fB\s-1PEP008\s0\fR'.
5389 .PP
5390 16.2.1 GDB-specific exceptions
5391 \&\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
5392 .PP
5393 There are a few exceptions to the published standards.  They exist
5394 mainly for consistency with the `\fBC\fR' standards.
5395 .PP
5396 * Use `\fB\s-1FIXME\s0\fR' instead of `\fB\s-1TODO\s0\fR'.
5397 .SS "17 Misc Guidelines"
5398 .IX Subsection "17 Misc Guidelines"
5399 This chapter covers topics that are lower-level than the major
5400 algorithms of \s-1GDB.\s0
5401 .PP
5402 17.1 Cleanups
5403 =============
5404 .PP
5405 Cleanups are a structured way to deal with things that need to be done
5406 later.
5407 .PP
5408 When your code does something (e.g., `\fBxmalloc\fR' some memory, or
5409 `\fBopen\fR' a file) that needs to be undone later (e.g., `\fBxfree\fR' the memory
5410 or `\fBclose\fR' the file), it can make a cleanup.  The cleanup will be done
5411 at some future point: when the command is finished and control returns
5412 to the top level; when an error occurs and the stack is unwound; or
5413 when your code decides it's time to explicitly perform cleanups.
5414 Alternatively you can elect to discard the cleanups you created.
5415 .PP
5416 Syntax:
5417 .PP
5418 `\fBstruct cleanup *OLD_CHAIN;\fR'
5419 Declare a variable which will hold a cleanup chain handle.
5420 .PP
5421 `\fB\s-1OLD_CHAIN\s0 = make_cleanup (\s-1FUNCTION, ARG\s0);\fR'
5422 Make a cleanup which will cause \s-1FUNCTION\s0 to be called with \s-1ARG \s0(a
5423 `\fBchar *\fR') later.  The result, \s-1OLD_CHAIN,\s0 is a handle that can
5424 later be passed to `\fBdo_cleanups\fR' or `\fBdiscard_cleanups\fR'.  Unless
5425 you are going to call `\fBdo_cleanups\fR' or `\fBdiscard_cleanups\fR', you can
5426 ignore the result from `\fBmake_cleanup\fR'.
5427 .PP
5428 `\fBdo_cleanups (\s-1OLD_CHAIN\s0);\fR'
5429 Do all cleanups added to the chain since the corresponding
5430 `\fBmake_cleanup\fR' call was made.
5431 .PP
5432 `\fBdiscard_cleanups (\s-1OLD_CHAIN\s0);\fR'
5433 Same as `\fBdo_cleanups\fR' except that it just removes the cleanups from
5434 the chain and does not call the specified functions.
5435 .PP
5436 Cleanups are implemented as a chain.  The handle returned by
5437 `\fBmake_cleanups\fR' includes the cleanup passed to the call and any later
5438 cleanups appended to the chain (but not yet discarded or performed).
5439 E.g.:
5440 .PP
5441 make_cleanup (a, 0);
5442 {
5443 struct cleanup *old = make_cleanup (b, 0);
5444 make_cleanup (c, 0)
5445 \&...
5446 do_cleanups (old);
5447 }
5448 .PP
5449 will call `\fBc()\fR' and `\fBb()\fR' but will not call `\fBa()\fR'.  The cleanup that
5450 calls `\fBa()\fR' will remain in the cleanup chain, and will be done later
5451 unless otherwise discarded.
5452 .PP
5453 Your function should explicitly do or discard the cleanups it
5454 creates.  Failing to do this leads to non-deterministic behavior since
5455 the caller will arbitrarily do or discard your functions cleanups.
5456 This need leads to two common cleanup styles.
5457 .PP
5458 The first style is try/finally.  Before it exits, your code-block
5459 calls `\fBdo_cleanups\fR' with the old cleanup chain and thus ensures that
5460 your code-block's cleanups are always performed.  For instance, the
5461 following code-segment avoids a memory leak problem (even when `\fBerror\fR'
5462 is called and a forced stack unwind occurs) by ensuring that the
5463 `\fBxfree\fR' will always be called:
5464 .PP
5465 struct cleanup *old = make_cleanup (null_cleanup, 0);
5466 data = xmalloc (sizeof blah);
5467 make_cleanup (xfree, data);
5468 \&... blah blah ...
5469 do_cleanups (old);
5470 .PP
5471 The second style is try/except.  Before it exits, your code-block
5472 calls `\fBdiscard_cleanups\fR' with the old cleanup chain and thus ensures
5473 that any created cleanups are not performed.  For instance, the
5474 following code segment, ensures that the file will be closed but only
5475 if there is an error:
5476 .PP
5477 \&\s-1FILE\s0 *file = fopen (\*(L"afile\*(R", \*(L"r\*(R");
5478 struct cleanup *old = make_cleanup (close_file, file);
5479 \&... blah blah ...
5480 discard_cleanups (old);
5481 return file;
5482 .PP
5483 Some functions, e.g., `\fB\f(BIfputs_filtered()\fB\fR' or `\fB\f(BIerror()\fB\fR', specify that
5484 they \*(L"should not be called when cleanups are not in place\*(R".  This means
5485 that any actions you need to reverse in the case of an error or
5486 interruption must be on the cleanup chain before you call these
5487 functions, since they might never return to your code (they `\fBlongjmp\fR'
5488 instead).
5489 .PP
5490 17.2 Per-architecture module data
5491 =================================
5492 .PP
5493 The multi-arch framework includes a mechanism for adding module
5494 specific per-architecture data-pointers to the `\fBstruct gdbarch\fR'
5495 architecture object.
5496 .PP
5497 A module registers one or more per-architecture data-pointers using:
5498 .PP
5499 \&\-\- Architecture Function: struct gdbarch_data *
5500 gdbarch_data_register_pre_init (gdbarch_data_pre_init_ftype *PRE_INIT)
5501 \&\s-1PRE_INIT\s0 is used to, on-demand, allocate an initial value for a
5502 per-architecture data-pointer using the architecture's obstack
5503 (passed in as a parameter).  Since \s-1PRE_INIT\s0 can be called during
5504 architecture creation, it is not parameterized with the
5505 architecture.  and must not call modules that use per-architecture
5506 data.
5507 .PP
5508 \&\-\- Architecture Function: struct gdbarch_data *
5509 gdbarch_data_register_post_init (gdbarch_data_post_init_ftype
5510 *POST_INIT)
5511 \&\s-1POST_INIT\s0 is used to obtain an initial value for a
5512 per-architecture data-pointer _after_.  Since \s-1POST_INIT\s0 is always
5513 called after architecture creation, it both receives the fully
5514 initialized architecture and is free to call modules that use
5515 per-architecture data (care needs to be taken to ensure that those
5516 other modules do not try to call back to this module as that will
5517 create in cycles in the initialization call graph).
5518 .PP
5519 These functions return a `\fBstruct gdbarch_data\fR' that is used to
5520 identify the per-architecture data-pointer added for that module.
5521 .PP
5522 The per-architecture data-pointer is accessed using the function:
5523 .PP
5524 \&\-\- Architecture Function: void * gdbarch_data (struct gdbarch
5525 *GDBARCH, struct gdbarch_data *DATA_HANDLE)
5526 Given the architecture \s-1ARCH\s0 and module data handle \s-1DATA_HANDLE
5527 \&\s0(returned by `\fBgdbarch_data_register_pre_init\fR' or
5528 `\fBgdbarch_data_register_post_init\fR'), this function returns the
5529 current value of the per-architecture data-pointer.  If the data
5530 pointer is `\fB\s-1NULL\s0\fR', it is first initialized by calling the
5531 corresponding \s-1PRE_INIT\s0 or \s-1POST_INIT\s0 method.
5532 .PP
5533 The examples below assume the following definitions:
5534 .PP
5535 struct nozel { int total; };
5536 static struct gdbarch_data *nozel_handle;
5537 .PP
5538 A module can extend the architecture vector, adding additional
5539 per-architecture data, using the \s-1PRE_INIT\s0 method.  The module's
5540 per-architecture data is then initialized during architecture creation.
5541 .PP
5542 In the below, the module's per-architecture _nozel_ is added.  An
5543 architecture can specify its nozel by calling `\fBset_gdbarch_nozel\fR' from
5544 `\fBgdbarch_init\fR'.
5545 .PP
5546 static void *
5547 nozel_pre_init (struct obstack *obstack)
5548 {
5549 struct nozel *data = \s-1OBSTACK_ZALLOC \s0(obstack, struct nozel);
5550 return data;
5551 }
5552 .PP
5553 extern void
5554 set_gdbarch_nozel (struct gdbarch *gdbarch, int total)
5555 {
5556 struct nozel *data = gdbarch_data (gdbarch, nozel_handle);
5557 data\->total = nozel;
5558 }
5559 .PP
5560 A module can on-demand create architecture dependent data structures
5561 using `\fBpost_init\fR'.
5562 .PP
5563 In the below, the nozel's total is computed on-demand by
5564 `\fBnozel_post_init\fR' using information obtained from the architecture.
5565 .PP
5566 static void *
5567 nozel_post_init (struct gdbarch *gdbarch)
5568 {
5569 struct nozel *data = \s-1GDBARCH_OBSTACK_ZALLOC \s0(gdbarch, struct nozel);
5570 nozel\->total = gdbarch... (gdbarch);
5571 return data;
5572 }
5573 .PP
5574 extern int
5575 nozel_total (struct gdbarch *gdbarch)
5576 {
5577 struct nozel *data = gdbarch_data (gdbarch, nozel_handle);
5578 return data\->total;
5579 }
5580 .PP
5581 17.3 Wrapping Output Lines
5582 ==========================
5583 .PP
5584 Output that goes through `\fBprintf_filtered\fR' or `\fBfputs_filtered\fR' or
5585 `\fBfputs_demangled\fR' needs only to have calls to `\fBwrap_here\fR' added in
5586 places that would be good breaking points.  The utility routines will
5587 take care of actually wrapping if the line width is exceeded.
5588 .PP
5589 The argument to `\fBwrap_here\fR' is an indentation string which is
5590 printed _only_ if the line breaks there.  This argument is saved away
5591 and used later.  It must remain valid until the next call to
5592 `\fBwrap_here\fR' or until a newline has been printed through the
5593 `\fB*_filtered\fR' functions.  Don't pass in a local variable and then return!
5594 .PP
5595 It is usually best to call `\fBwrap_here\fR' after printing a comma or
5596 space.  If you call it before printing a space, make sure that your
5597 indentation properly accounts for the leading space that will print if
5598 the line wraps there.
5599 .PP
5600 Any function or set of functions that produce filtered output must
5601 finish by printing a newline, to flush the wrap buffer, before switching
5602 to unfiltered (`\fBprintf\fR') output.  Symbol reading routines that print
5603 warnings are a good example.
5604 .PP
5605 17.4 Memory Management
5606 ======================
5607 .PP
5608 \&\s-1GDB\s0 does not use the functions `\fBmalloc\fR', `\fBrealloc\fR', `\fBcalloc\fR', `\fBfree\fR'
5609 and `\fBasprintf\fR'.
5610 .PP
5611 \&\s-1GDB\s0 uses the functions `\fBxmalloc\fR', `\fBxrealloc\fR' and `\fBxcalloc\fR' when
5612 allocating memory.  Unlike `\fBmalloc\fR' et.al.  these functions do not
5613 return when the memory pool is empty.  Instead, they unwind the stack
5614 using cleanups.  These functions return `\fB\s-1NULL\s0\fR' when requested to
5615 allocate a chunk of memory of size zero.
5616 .PP
5617 _Pragmatics: By using these functions, the need to check every
5618 memory allocation is removed.  These functions provide portable
5619 behavior._
5620 .PP
5621 \&\s-1GDB\s0 does not use the function `\fBfree\fR'.
5622 .PP
5623 \&\s-1GDB\s0 uses the function `\fBxfree\fR' to return memory to the memory pool.
5624 Consistent with ISO-C, this function ignores a request to free a `\fB\s-1NULL\s0\fR'
5625 pointer.
5626 .PP
5627 _Pragmatics: On some systems `\fBfree\fR' fails when passed a `\fB\s-1NULL\s0\fR'
5628 pointer._
5629 .PP
5630 \&\s-1GDB\s0 can use the non-portable function `\fBalloca\fR' for the allocation of
5631 small temporary values (such as strings).
5632 .PP
5633 _Pragmatics: This function is very non-portable.  Some systems
5634 restrict the memory being allocated to no more than a few kilobytes._
5635 .PP
5636 \&\s-1GDB\s0 uses the string function `\fBxstrdup\fR' and the print function
5637 `\fBxstrprintf\fR'.
5638 .PP
5639 _Pragmatics: `\fBasprintf\fR' and `\fBstrdup\fR' can fail.  Print functions such
5640 as `\fBsprintf\fR' are very prone to buffer overflow errors._
5641 .PP
5642 17.5 Compiler Warnings
5643 ======================
5644 .PP
5645 With few exceptions, developers should avoid the configuration option
5646 `\fB\-\-disable\-werror\fR' when building \s-1GDB. \s0 The exceptions are listed in the
5647 file `\fBgdb/MAINTAINERS\fR'.  The default, when building with \s-1GCC,\s0 is
5648 `\fB\-\-enable\-werror\fR'.
5649 .PP
5650 This option causes \s-1GDB \s0(when built using \s-1GCC\s0) to be compiled with a
5651 carefully selected list of compiler warning flags.  Any warnings from
5652 those flags are treated as errors.
5653 .PP
5654 The current list of warning flags includes:
5655 .PP
5656 `\fB\-Wall\fR'
5657 Recommended \s-1GCC\s0 warnings.
5658 .PP
5659 `\fB\-Wdeclaration\-after\-statement\fR'
5660 \&\s-1GCC 3\s0.x (and later) and C99 allow declarations mixed with code,
5661 but \s-1GCC 2\s0.x and C89 do not.
5662 .PP
5663 `\fB\-Wpointer\-arith\fR'
5664 .PP
5665 `\fB\-Wformat\-nonliteral\fR'
5666 Non-literal format strings, with a few exceptions, are bugs \- they
5667 might contain unintended user-supplied format specifiers.  Since
5668 \&\s-1GDB\s0 uses the `\fBformat printf\fR' attribute on all `\fBprintf\fR' like
5669 functions this checks not just `\fBprintf\fR' calls but also calls to
5670 functions such as `\fBfprintf_unfiltered\fR'.
5671 .PP
5672 `\fB\-Wno\-pointer\-sign\fR'
5673 In version 4.0, \s-1GCC\s0 began warning about pointer argument passing or
5674 assignment even when the source and destination differed only in
5675 signedness.  However, most \s-1GDB\s0 code doesn't distinguish carefully
5676 between `\fBchar\fR' and `\fBunsigned char\fR'.  In early 2006 the \s-1GDB\s0
5677 developers decided correcting these warnings wasn't worth the time
5678 it would take.
5679 .PP
5680 `\fB\-Wno\-unused\-parameter\fR'
5681 Due to the way that \s-1GDB\s0 is implemented many functions have unused
5682 parameters.  Consequently this warning is avoided.  The macro
5683 `\fB\s-1ATTRIBUTE_UNUSED\s0\fR' is not used as it leads to false negatives \*(--
5684 it is not an error to have `\fB\s-1ATTRIBUTE_UNUSED\s0\fR' on a parameter that
5685 is being used.
5686 .PP
5687 `\fB\-Wno\-unused\fR'
5688 `\fB\-Wno\-switch\fR'
5689 `\fB\-Wno\-char\-subscripts\fR'
5690 These are warnings which might be useful for \s-1GDB,\s0 but are
5691 currently too noisy to enable with `\fB\-Werror\fR'.
5692 .PP
5693 17.6 Internal Error Recovery
5694 ============================
5695 .PP
5696 During its execution, \s-1GDB\s0 can encounter two types of errors.  User
5697 errors and internal errors.  User errors include not only a user
5698 entering an incorrect command but also problems arising from corrupt
5699 object files and system errors when interacting with the target.
5700 Internal errors include situations where \s-1GDB\s0 has detected, at run time,
5701 a corrupt or erroneous situation.
5702 .PP
5703 When reporting an internal error, \s-1GDB\s0 uses `\fBinternal_error\fR' and
5704 `\fBgdb_assert\fR'.
5705 .PP
5706 \&\s-1GDB\s0 must not call `\fBabort\fR' or `\fBassert\fR'.
5707 .PP
5708 _Pragmatics: There is no `\fBinternal_warning\fR' function.  Either the
5709 code detected a user error, recovered from it and issued a `\fBwarning\fR' or
5710 the code failed to correctly recover from the user error and issued an
5711 `\fBinternal_error\fR'._
5712 .PP
5713 17.7 Command Names
5714 ==================
5715 .PP
5716 \&\s-1GDB U/I\s0 commands are written `\fBfoo-bar\fR', not `\fBfoo_bar\fR'.
5717 .PP
5718 17.8 Clean Design and Portable Implementation
5719 =============================================
5720 .PP
5721 In addition to getting the syntax right, there's the little question of
5722 semantics.  Some things are done in certain ways in \s-1GDB\s0 because long
5723 experience has shown that the more obvious ways caused various kinds of
5724 trouble.
5725 .PP
5726 You can't assume the byte order of anything that comes from a target
5727 (including VALUEs, object files, and instructions).  Such things must
5728 be byte-swapped using `\fB\s-1SWAP_TARGET_AND_HOST\s0\fR' in \s-1GDB,\s0 or one of the swap
5729 routines defined in `\fBbfd.h\fR', such as `\fBbfd_get_32\fR'.
5730 .PP
5731 You can't assume that you know what interface is being used to talk
5732 to the target system.  All references to the target must go through the
5733 current `\fBtarget_ops\fR' vector.
5734 .PP
5735 You can't assume that the host and target machines are the same
5736 machine (except in the \*(L"native\*(R" support modules).  In particular, you
5737 can't assume that the target machine's header files will be available
5738 on the host machine.  Target code must bring along its own header files
5739 \&\- written from scratch or explicitly donated by their owner, to avoid
5740 copyright problems.
5741 .PP
5742 Insertion of new `\fB#ifdef\fR''s will be frowned upon.  It's much better
5743 to write the code portably than to conditionalize it for various
5744 systems.
5745 .PP
5746 New `\fB#ifdef\fR''s which test for specific compilers or manufacturers or
5747 operating systems are unacceptable.  All `\fB#ifdef\fR''s should test for
5748 features.  The information about which configurations contain which
5749 features should be segregated into the configuration files.  Experience
5750 has proven far too often that a feature unique to one particular system
5751 often creeps into other systems; and that a conditional based on some
5752 predefined macro for your current system will become worthless over
5753 time, as new versions of your system come out that behave differently
5754 with regard to this feature.
5755 .PP
5756 Adding code that handles specific architectures, operating systems,
5757 target interfaces, or hosts, is not acceptable in generic code.
5758 .PP
5759 One particularly notorious area where system dependencies tend to
5760 creep in is handling of file names.  The mainline \s-1GDB\s0 code assumes
5761 Posix semantics of file names: absolute file names begin with a forward
5762 slash `\fB/\fR', slashes are used to separate leading directories,
5763 case-sensitive file names.  These assumptions are not necessarily true
5764 on non-Posix systems such as MS-Windows.  To avoid system-dependent
5765 code where you need to take apart or construct a file name, use the
5766 following portable macros:
5767 .PP
5768 `\fB\s-1HAVE_DOS_BASED_FILE_SYSTEM\s0\fR'
5769 This preprocessing symbol is defined to a non-zero value on hosts
5770 whose filesystems belong to the MS\-DOS/MS\-Windows family.  Use this
5771 symbol to write conditional code which should only be compiled for
5772 such hosts.
5773 .PP
5774 `\fB\s-1IS_DIR_SEPARATOR \s0(C)\fR'
5775 Evaluates to a non-zero value if C is a directory separator
5776 character.  On Unix and GNU/Linux systems, only a slash `\fB/\fR' is
5777 such a character, but on Windows, both `\fB/\fR' and `\fB\e\fR' will pass.
5778 .PP
5779 `\fB\s-1IS_ABSOLUTE_PATH \s0(\s-1FILE\s0)\fR'
5780 Evaluates to a non-zero value if \s-1FILE\s0 is an absolute file name.
5781 For Unix and GNU/Linux hosts, a name which begins with a slash `\fB/\fR'
5782 is absolute.  On \s-1DOS\s0 and Windows, `\fBd:/foo\fR' and `\fBx:\ebar\fR' are also
5783 absolute file names.
5784 .PP
5785 `\fB\s-1FILENAME_CMP \s0(F1, F2)\fR'
5786 Calls a function which compares file names F1 and F2 as
5787 appropriate for the underlying host filesystem.  For Posix systems,
5788 this simply calls `\fBstrcmp\fR'; on case-insensitive filesystems it
5789 will call `\fBstrcasecmp\fR' instead.
5790 .PP
5791 `\fB\s-1DIRNAME_SEPARATOR\s0\fR'
5792 Evaluates to a character which separates directories in
5793 `\fB\s-1PATH\s0\fR'\-style lists, typically held in environment variables.  This
5794 character is `\fB:\fR' on Unix, `\fB;\fR' on \s-1DOS\s0 and Windows.
5795 .PP
5796 `\fB\s-1SLASH_STRING\s0\fR'
5797 This evaluates to a constant string you should use to produce an
5798 absolute filename from leading directories and the file's basename.
5799 `\fB\s-1SLASH_STRING\s0\fR' is `\fB\*(L"/\*(R"\fR' on most systems, but might be `\fB\*(L"\e\e\*(R"\fR' for
5800 some Windows-based ports.
5801 .PP
5802 In addition to using these macros, be sure to use portable library
5803 functions whenever possible.  For example, to extract a directory or a
5804 basename part from a file name, use the `\fBdirname\fR' and `\fBbasename\fR'
5805 library functions (available in `\fBlibiberty\fR' for platforms which don't
5806 provide them), instead of searching for a slash with `\fBstrrchr\fR'.
5807 .PP
5808 Another way to generalize \s-1GDB\s0 along a particular interface is with an
5809 attribute struct.  For example, \s-1GDB\s0 has been generalized to handle
5810 multiple kinds of remote interfaces\*(--not by `\fB#ifdef\fR's everywhere, but
5811 by defining the `\fBtarget_ops\fR' structure and having a current target (as
5812 well as a stack of targets below it, for memory references).  Whenever
5813 something needs to be done that depends on which remote interface we are
5814 using, a flag in the current target_ops structure is tested (e.g.,
5815 `\fBtarget_has_stack\fR'), or a function is called through a pointer in the
5816 current target_ops structure.  In this way, when a new remote interface
5817 is added, only one module needs to be touched\*(--the one that actually
5818 implements the new remote interface.  Other examples of
5819 attribute-structs are \s-1BFD\s0 access to multiple kinds of object file
5820 formats, or \s-1GDB\s0's access to multiple source languages.
5821 .PP
5822 Please avoid duplicating code.  For example, in \s-1GDB 3\s0.x all the code
5823 interfacing between `\fBptrace\fR' and the rest of \s-1GDB\s0 was duplicated in
5824 `\fB*\-dep.c\fR', and so changing something was very painful.  In \s-1GDB 4\s0.x,
5825 these have all been consolidated into `\fBinfptrace.c\fR'.  `\fBinfptrace.c\fR' can
5826 deal with variations between systems the same way any system-independent
5827 file would (hooks, `\fB#if defined\fR', etc.), and machines which are
5828 radically different don't need to use `\fBinfptrace.c\fR' at all.
5829 .PP
5830 All debugging code must be controllable using the `\fBset debug \s-1MODULE\s0\fR'
5831 command.  Do not use `\fBprintf\fR' to print trace messages.  Use
5832 `\fBfprintf_unfiltered(gdb_stdlog, ...\fR'.  Do not use `\fB#ifdef \s-1DEBUG\s0\fR'.
5833 .SS "18 Porting \s-1GDB\s0"
5834 .IX Subsection "18 Porting GDB"
5835 Most of the work in making \s-1GDB\s0 compile on a new machine is in
5836 specifying the configuration of the machine.  Porting a new
5837 architecture to \s-1GDB\s0 can be broken into a number of steps.
5838 .PP
5839 * Ensure a \s-1BFD\s0 exists for executables of the target architecture in
5840 the `\fBbfd\fR' directory.  If one does not exist, create one by
5841 modifying an existing similar one.
5842 .PP
5843 * Implement a disassembler for the target architecture in the
5844 `\fBopcodes\fR' directory.
5845 .PP
5846 * Define the target architecture in the `\fBgdb\fR' directory (*note
5847 Adding a New Target: Adding a New Target.).  Add the pattern for
5848 the new target to `\fBconfigure.tgt\fR' with the names of the files that
5849 contain the code.  By convention the target architecture
5850 definition for an architecture \s-1ARCH\s0 is placed in `\fBARCH\-tdep.c\fR'.
5851 .PP
5852 Within `\fBARCH\-tdep.c\fR' define the function `\fB_initialize_ARCH_tdep\fR'
5853 which calls `\fBgdbarch_register\fR' to create the new `\fBstruct gdbarch\fR'
5854 for the architecture.
5855 .PP
5856 * If a new remote target is needed, consider adding a new remote
5857 target by defining a function `\fB_initialize_remote_ARCH\fR'.  However
5858 if at all possible use the \s-1GDB\s0 _Remote Serial Protocol_ for this
5859 and implement the server side protocol independently with the
5860 target.
5861 .PP
5862 * If desired implement a simulator in the `\fBsim\fR' directory.  This
5863 should create the library `\fBlibsim.a\fR' implementing the interface in
5864 `\fBremote\-sim.h\fR' (found in the `\fBinclude\fR' directory).
5865 .PP
5866 * Build and test.  If desired, lobby the \s-1GDB\s0 steering group to have
5867 the new port included in the main distribution!
5868 .PP
5869 * Add a description of the new architecture to the main \s-1GDB\s0 user
5870 guide (*note Configuration Specific Information:
5871 (gdb)Configuration Specific Information.).
5872 .SS "19 Versions and Branches"
5873 .IX Subsection "19 Versions and Branches"
5874 19.1 Versions
5875 =============
5876 .PP
5877 \&\s-1GDB\s0's version is determined by the file `\fBgdb/version.in\fR' and takes one
5878 of the following forms:
5879 .PP
5880 \&\s-1MAJOR.MINOR
5881 MAJOR.MINOR.PATCHLEVEL\s0
5882 an official release (e.g., 6.2 or 6.2.1)
5883 .PP
5884 \&\s-1MAJOR.MINOR.PATCHLEVEL.YYYYMMDD\s0
5885 a snapshot taken at YYYY-MM-DD-gmt (e.g., 6.1.50.20020302,
5886 6.1.90.20020304, or 6.1.0.20020308)
5887 .PP
5888 \&\s-1MAJOR.MINOR.PATCHLEVEL\s0.YYYYMMDD\-cvs
5889 a \s-1CVS\s0 check out drawn on YYYY-MM-DD (e.g., 6.1.50.20020302\-cvs,
5890 6.1.90.20020304\-cvs, or 6.1.0.20020308\-cvs)
5891 .PP
5892 \&\s-1MAJOR.MINOR.PATCHLEVEL.YYYYMMDD \s0(\s-1VENDOR\s0)
5893 a vendor specific release of \s-1GDB,\s0 that while based on
5894 \&\s-1MAJOR.MINOR.PATCHLEVEL.YYYYMMDD,\s0 may include additional changes
5895 .PP
5896 \&\s-1GDB\s0's mainline uses the \s-1MAJOR\s0 and \s-1MINOR\s0 version numbers from the
5897 most recent release branch, with a \s-1PATCHLEVEL\s0 of 50.  At the time each
5898 new release branch is created, the mainline's \s-1MAJOR\s0 and \s-1MINOR\s0 version
5899 numbers are updated.
5900 .PP
5901 \&\s-1GDB\s0's release branch is similar.  When the branch is cut, the
5902 \&\s-1PATCHLEVEL\s0 is changed from 50 to 90.  As draft releases are drawn from
5903 the branch, the \s-1PATCHLEVEL\s0 is incremented.  Once the first release
5904 (\s-1MAJOR.MINOR\s0) has been made, the \s-1PATCHLEVEL\s0 is set to 0 and updates
5905 have an incremented \s-1PATCHLEVEL.\s0
5906 .PP
5907 For snapshots, and \s-1CVS\s0 check outs, it is also possible to identify
5908 the \s-1CVS\s0 origin:
5909 .PP
5910 \&\s-1MAJOR.MINOR.50.YYYYMMDD\s0
5911 drawn from the \s-1HEAD\s0 of mainline \s-1CVS \s0(e.g., 6.1.50.20020302)
5912 .PP
5913 \&\s-1MAJOR.MINOR.90.YYYYMMDD
5914 MAJOR.MINOR.91.YYYYMMDD ...\s0
5915 drawn from a release branch prior to the release (e.g.,
5916 6.1.90.20020304)
5917 .PP
5918 \&\s-1MAJOR.MINOR.0.YYYYMMDD
5919 MAJOR.MINOR.1.YYYYMMDD ...\s0
5920 drawn from a release branch after the release (e.g.,
5921 6.2.0.20020308)
5922 .PP
5923 If the previous \s-1GDB\s0 version is 6.1 and the current version is 6.2,
5924 then, substituting 6 for \s-1MAJOR\s0 and 1 or 2 for \s-1MINOR,\s0 here's an
5925 illustration of a typical sequence:
5926 .PP
5927 <\s-1HEAD\s0>
5928 |
5929 6.1.50.20020302\-cvs
5930 |
5931 +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-.
5932 |                    <gdb_6_2\-branch>
5933 |                          |
5934 6.2.50.20020303\-cvs        6.1.90 (draft #1)
5935 |                          |
5936 6.2.50.20020304\-cvs        6.1.90.20020304\-cvs
5937 |                          |
5938 6.2.50.20020305\-cvs        6.1.91 (draft #2)
5939 |                          |
5940 6.2.50.20020306\-cvs        6.1.91.20020306\-cvs
5941 |                          |
5942 6.2.50.20020307\-cvs        6.2 (release)
5943 |                          |
5944 6.2.50.20020308\-cvs        6.2.0.20020308\-cvs
5945 |                          |
5946 6.2.50.20020309\-cvs        6.2.1 (update)
5947 |                          |
5948 6.2.50.20020310\-cvs         <branch closed>
5949 |
5950 6.2.50.20020311\-cvs
5951 |
5952 +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-.
5953 |                     <gdb_6_3\-branch>
5954 |                          |
5955 6.3.50.20020312\-cvs        6.2.90 (draft #1)
5956 |                          |
5957 .PP
5958 19.2 Release Branches
5959 =====================
5960 .PP
5961 \&\s-1GDB\s0 draws a release series (6.2, 6.2.1, ...) from a single release
5962 branch, and identifies that branch using the \s-1CVS\s0 branch tags:
5963 .PP
5964 gdb_MAJOR_MINOR\-YYYYMMDD\-branchpoint
5965 gdb_MAJOR_MINOR\-branch
5966 gdb_MAJOR_MINOR\-YYYYMMDD\-release
5967 .PP
5968 _Pragmatics: To help identify the date at which a branch or release
5969 is made, both the branchpoint and release tags include the date that
5970 they are cut (\s-1YYYYMMDD\s0) in the tag.  The branch tag, denoting the head
5971 of the branch, does not need this._
5972 .PP
5973 19.3 Vendor Branches
5974 ====================
5975 .PP
5976 To avoid version conflicts, vendors are expected to modify the file
5977 `\fBgdb/version.in\fR' to include a vendor unique alphabetic identifier (an
5978 official \s-1GDB\s0 release never uses alphabetic characters in its version
5979 identifier).  E.g., `\fB6.2widgit2\fR', or `\fB6.2 (Widgit Inc Patch 2)\fR'.
5980 .PP
5981 19.4 Experimental Branches
5982 ==========================
5983 .PP
5984 19.4.1 Guidelines
5985 \&\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
5986 .PP
5987 \&\s-1GDB\s0 permits the creation of branches, cut from the \s-1CVS\s0 repository, for
5988 experimental development.  Branches make it possible for developers to
5989 share preliminary work, and maintainers to examine significant new
5990 developments.
5991 .PP
5992 The following are a set of guidelines for creating such branches:
5993 .PP
5994 _a branch has an owner_
5995 The owner can set further policy for a branch, but may not change
5996 the ground rules.  In particular, they can set a policy for
5997 commits (be it adding more reviewers or deciding who can commit).
5998 .PP
5999 _all commits are posted_
6000 All changes committed to a branch shall also be posted to the \s-1GDB\s0
6001 patches mailing list <gdb\-patches@sourceware.org>.  While
6002 commentary on such changes are encouraged, people should remember
6003 that the changes only apply to a branch.
6004 .PP
6005 _all commits are covered by an assignment_
6006 This ensures that all changes belong to the Free Software
6007 Foundation, and avoids the possibility that the branch may become
6008 contaminated.
6009 .PP
6010 _a branch is focused_
6011 A focused branch has a single objective or goal, and does not
6012 contain unnecessary or irrelevant changes.  Cleanups, where
6013 identified, being be pushed into the mainline as soon as possible.
6014 .PP
6015 _a branch tracks mainline_
6016 This keeps the level of divergence under control.  It also keeps
6017 the pressure on developers to push cleanups and other stuff into
6018 the mainline.
6019 .PP
6020 _a branch shall contain the entire \s-1GDB\s0 module_
6021 The \s-1GDB\s0 module `\fBgdb\fR' should be specified when creating a branch
6022 (branches of individual files should be avoided).  see \*(L"Tags\*(R".
6023 .PP
6024 _a branch shall be branded using `\fBversion.in\fR'_
6025 The file `\fBgdb/version.in\fR' shall be modified so that it identifies
6026 the branch \s-1OWNER\s0 and branch \s-1NAME,\s0 e.g.,
6027 `\fB6.2.50.20030303_owner_name\fR' or `\fB6.2 (Owner Name)\fR'.
6028 .PP
6029 19.4.2 Tags
6030 \&\-\-\-\-\-\-\-\-\-\-\-
6031 .PP
6032 To simplify the identification of \s-1GDB\s0 branches, the following branch
6033 tagging convention is strongly recommended:
6034 .PP
6035 `\fBOWNER_NAME\-YYYYMMDD\-branchpoint\fR'
6036 `\fBOWNER_NAME\-YYYYMMDD\-branch\fR'
6037 The branch point and corresponding branch tag.  \s-1YYYYMMDD\s0 is the
6038 date that the branch was created.  A branch is created using the
6039 sequence:
6040 cvs rtag OWNER_NAME\-YYYYMMDD\-branchpoint gdb
6041 cvs rtag \-b \-r OWNER_NAME\-YYYYMMDD\-branchpoint \e
6042 OWNER_NAME\-YYYYMMDD\-branch gdb
6043 .PP
6044 `\fBOWNER_NAME\-YYYYMMDD\-mergepoint\fR'
6045 The tagged point, on the mainline, that was used when merging the
6046 branch on \s-1YYYYMMDD. \s0 To merge in all changes since the branch was
6047 cut, use a command sequence like:
6048 cvs rtag OWNER_NAME\-YYYYMMDD\-mergepoint gdb
6049 cvs update \e
6050 \&\-jOWNER_NAME\-YYYYMMDD\-branchpoint
6051 \&\-jOWNER_NAME\-YYYYMMDD\-mergepoint
6052 Similar sequences can be used to just merge in changes since the
6053 last merge.
6054 .PP
6055 For further information on \s-1CVS,\s0 see Concurrent Versions System
6056 (http://www.gnu.org/software/cvs/).
6057 .SS "20 Start of New Year Procedure"
6058 .IX Subsection "20 Start of New Year Procedure"
6059 At the start of each new year, the following actions should be
6060 performed:
6061 .PP
6062 * Rotate the ChangeLog file
6063 .PP
6064 The current `\fBChangeLog\fR' file should be renamed into
6065 `\fBChangeLog-YYYY\fR' where \s-1YYYY\s0 is the year that has just passed.  A
6066 new `\fBChangeLog\fR' file should be created, and its contents should
6067 contain a reference to the previous ChangeLog.  The following
6068 should also be preserved at the end of the new ChangeLog, in order
6069 to provide the appropriate settings when editing this file with
6070 Emacs:
6071 Local Variables:
6072 mode: change-log
6073 left-margin: 8
6074 fill-column: 74
6075 version-control: never
6076 coding: utf\-8
6077 End:
6078 .PP
6079 * Add an entry for the newly created ChangeLog file
6080 (`\fBChangeLog-YYYY\fR') in `\fBgdb/config/djgpp/fnchange.lst\fR'.
6081 .PP
6082 * Update the copyright year in the startup message
6083 .PP
6084 Update the copyright year in:
6085 *   file `\fBtop.c\fR', function `\fBprint_gdb_version\fR'
6086 .PP
6087 *   file `\fBgdbserver/server.c\fR', function `\fBgdbserver_version\fR'
6088 .PP
6089 *   file `\fBgdbserver/gdbreplay.c\fR', function `\fBgdbreplay_version\fR'
6090 .PP
6091 * Run the `\fBcopyright.py\fR' Python script to add the new year in the
6092 copyright notices of most source files.  This script has been
6093 tested with Python 2.6 and 2.7.
6094 .SS "21 Releasing \s-1GDB\s0"
6095 .IX Subsection "21 Releasing GDB"
6096 21.1 Branch Commit Policy
6097 =========================
6098 .PP
6099 The branch commit policy is pretty slack.  \s-1GDB\s0 releases 5.0, 5.1 and
6100 5.2 all used the below:
6101 .PP
6102 * The `\fBgdb/MAINTAINERS\fR' file still holds.
6103 .PP
6104 * Don't fix something on the branch unless/until it is also fixed in
6105 the trunk.  If this isn't possible, mentioning it in the
6106 `\fBgdb/PROBLEMS\fR' file is better than committing a hack.
6107 .PP
6108 * When considering a patch for the branch, suggested criteria
6109 include: Does it fix a build?  Does it fix the sequence `break
6110 main; run' when debugging a static binary?
6111 .PP
6112 * The further a change is from the core of \s-1GDB,\s0 the less likely the
6113 change will worry anyone (e.g., target specific code).
6114 .PP
6115 * Only post a proposal to change the core of \s-1GDB\s0 after you've sent
6116 individual bribes to all the people listed in the `\fB\s-1MAINTAINERS\s0\fR'
6117 file ;\-)
6118 .PP
6119 _Pragmatics: Provided updates are restricted to non-core
6120 functionality there is little chance that a broken change will be fatal.
6121 This means that changes such as adding a new architectures or (within
6122 reason) support for a new host are considered acceptable._
6123 .PP
6124 21.2 Obsoleting code
6125 ====================
6126 .PP
6127 Before anything else, poke the other developers (and around the source
6128 code) to see if there is anything that can be removed from \s-1GDB \s0(an old
6129 target, an unused file).
6130 .PP
6131 Obsolete code is identified by adding an `\fB\s-1OBSOLETE\s0\fR' prefix to every
6132 line.  Doing this means that it is easy to identify something that has
6133 been obsoleted when greping through the sources.
6134 .PP
6135 The process is done in stages \*(-- this is mainly to ensure that the
6136 wider \s-1GDB\s0 community has a reasonable opportunity to respond.  Remember,
6137 everything on the Internet takes a week.
6138 .PP
6139 1. Post the proposal on the \s-1GDB\s0 mailing list <gdb@sourceware.org>
6140 Creating a bug report to track the task's state, is also highly
6141 recommended.
6142 .PP
6143 2. Wait a week or so.
6144 .PP
6145 3. Post the proposal on the \s-1GDB\s0 Announcement mailing list
6146 <gdb\-announce@sourceware.org>.
6147 .PP
6148 4. Wait a week or so.
6149 .PP
6150 5. Go through and edit all relevant files and lines so that they are
6151 prefixed with the word `\fB\s-1OBSOLETE\s0\fR'.
6152 .PP
6153 6. Wait until the next \s-1GDB\s0 version, containing this obsolete code,
6154 has been released.
6155 .PP
6156 7. Remove the obsolete code.
6157 .PP
6158 _Maintainer note: While removing old code is regrettable it is
6159 hopefully better for \s-1GDB\s0's long term development.  Firstly it helps the
6160 developers by removing code that is either no longer relevant or simply
6161 wrong.  Secondly since it removes any history associated with the file
6162 (effectively clearing the slate) the developer has a much freer hand
6163 when it comes to fixing broken files._
6164 .PP
6165 21.3 Before the Branch
6166 ======================
6167 .PP
6168 The most important objective at this stage is to find and fix simple
6169 changes that become a pain to track once the branch is created.  For
6170 instance, configuration problems that stop \s-1GDB\s0 from even building.  If
6171 you can't get the problem fixed, document it in the `\fBgdb/PROBLEMS\fR' file.
6172 .PP
6173 Prompt for `\fBgdb/NEWS\fR'
6174 \&\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
6175 .PP
6176 People always forget.  Send a post reminding them but also if you know
6177 something interesting happened add it yourself.  The `\fBschedule\fR' script
6178 will mention this in its e\-mail.
6179 .PP
6180 Review `\fBgdb/README\fR'
6181 \&\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
6182 .PP
6183 Grab one of the nightly snapshots and then walk through the
6184 `\fBgdb/README\fR' looking for anything that can be improved.  The `\fBschedule\fR'
6185 script will mention this in its e\-mail.
6186 .PP
6187 Refresh any imported files.
6188 \&\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
6189 .PP
6190 A number of files are taken from external repositories.  They include:
6191 .PP
6192 * `\fBtexinfo/texinfo.tex\fR'
6193 .PP
6194 * `\fBconfig.guess\fR' et. al. (see the top-level `\fB\s-1MAINTAINERS\s0\fR' file)
6195 .PP
6196 * `\fBetc/standards.texi\fR', `\fBetc/make\-stds.texi\fR'
6197 .PP
6198 Check the \s-1ARI
6199 \&\-\-\-\-\-\-\-\-\-\-\-\-\-\s0
6200 .PP
6201 A.R.I. is an `\fBawk\fR' script (Awk Regression Index ;\-) that checks for a
6202 number of errors and coding conventions.  The checks include things
6203 like using `\fBmalloc\fR' instead of `\fBxmalloc\fR' and file naming problems.
6204 There shouldn't be any regressions.
6205 .PP
6206 21.3.1 Review the bug data base
6207 \&\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
6208 .PP
6209 Close anything obviously fixed.
6210 .PP
6211 21.3.2 Check all cross targets build
6212 \&\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
6213 .PP
6214 The targets are listed in `\fBgdb/MAINTAINERS\fR'.
6215 .PP
6216 21.4 Cut the Branch
6217 ===================
6218 .PP
6219 Create the branch
6220 \&\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
6221 .PP
6222 $  u=5.1
6223 $  v=5.2
6224 $  V=`\fBecho \f(CB$v\fB | sed \fR's/\e./_/g'`
6225 $  D=`date \-u +%Y\-%m\-%d`
6226 $  echo \f(CW$u\fR \f(CW$V\fR \f(CW$D\fR
6227 5.1 5_2 2002\-03\-03
6228 $  echo cvs \-f \-d :ext:sourceware.org:/cvs/src rtag \e
6229 \&\-D \f(CW$D\fR\-gmt gdb_$V\-$D\-branchpoint insight
6230 cvs \-f \-d :ext:sourceware.org:/cvs/src rtag
6231 \&\-D 2002\-03\-03\-gmt gdb_5_2\-2002\-03\-03\-branchpoint insight
6232 $  ^echo ^^
6233 \&...
6234 $  echo cvs \-f \-d :ext:sourceware.org:/cvs/src rtag \e
6235 \&\-b \-r gdb_$V\-$D\-branchpoint gdb_$V\-branch insight
6236 cvs \-f \-d :ext:sourceware.org:/cvs/src rtag \e
6237 \&\-b \-r gdb_5_2\-2002\-03\-03\-branchpoint gdb_5_2\-branch insight
6238 $  ^echo ^^
6239 \&...
6240 $
6241 .PP
6242 * By using `\fB\-D YYYY-MM-DD-gmt\fR', the branch is forced to an exact
6243 date/time.
6244 .PP
6245 * The trunk is first tagged so that the branch point can easily be
6246 found.
6247 .PP
6248 * Insight, which includes \s-1GDB,\s0 is tagged at the same time.
6249 .PP
6250 * `\fBversion.in\fR' gets bumped to avoid version number conflicts.
6251 .PP
6252 * The reading of `\fB.cvsrc\fR' is disabled using `\fB\-f\fR'.
6253 .PP
6254 Update `\fBversion.in\fR'
6255 \&\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
6256 .PP
6257 $  u=5.1
6258 $  v=5.2
6259 $  V=`\fBecho \f(CB$v\fB | sed \fR's/\e./_/g'`
6260 $  echo \f(CW$u\fR \f(CW$v\fR$V
6261 5.1 5_2
6262 $  cd /tmp
6263 $  echo cvs \-f \-d :ext:sourceware.org:/cvs/src co \e
6264 \&\-r gdb_$V\-branch src/gdb/version.in
6265 cvs \-f \-d :ext:sourceware.org:/cvs/src co
6266 \&\-r gdb_5_2\-branch src/gdb/version.in
6267 $  ^echo ^^
6268 U src/gdb/version.in
6269 $  cd src/gdb
6270 $  echo \f(CW$u\fR.90\-0000\-00\-00\-cvs > version.in
6271 $  cat version.in
6272 5.1.90\-0000\-00\-00\-cvs
6273 $  cvs \-f commit version.in
6274 .PP
6275 * `\fB0000\-00\-00\fR' is used as a date to pump prime the version.in update
6276 mechanism.
6277 .PP
6278 * `\fB.90\fR' and the previous branch version are used as fairly arbitrary
6279 initial branch version number.
6280 .PP
6281 Update the web and news pages
6282 \&\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
6283 .PP
6284 Something?
6285 .PP
6286 Tweak cron to track the new branch
6287 \&\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
6288 .PP
6289 The file `\fBgdbadmin/cron/crontab\fR' contains gdbadmin's cron table.  This
6290 file needs to be updated so that:
6291 .PP
6292 * A daily timestamp is added to the file `\fBversion.in\fR'.
6293 .PP
6294 * The new branch is included in the snapshot process.
6295 .PP
6296 See the file `\fBgdbadmin/cron/README\fR' for how to install the updated cron
6297 table.
6298 .PP
6299 The file `\fBgdbadmin/ss/README\fR' should also be reviewed to reflect any
6300 changes.  That file is copied to both the branch/ and current/ snapshot
6301 directories.
6302 .PP
6303 Update the \s-1NEWS\s0 and \s-1README\s0 files
6304 \&\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
6305 .PP
6306 The `\fB\s-1NEWS\s0\fR' file needs to be updated so that on the branch it refers to
6307 _changes in the current release_ while on the trunk it also refers to
6308 _changes since the current release_.
6309 .PP
6310 The `\fB\s-1README\s0\fR' file needs to be updated so that it refers to the
6311 current release.
6312 .PP
6313 Post the branch info
6314 \&\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
6315 .PP
6316 Send an announcement to the mailing lists:
6317 .PP
6318 * \s-1GDB\s0 Announcement mailing list <gdb\-announce@sourceware.org>
6319 .PP
6320 * \s-1GDB\s0 Discussion mailing list <gdb@sourceware.org> and \s-1GDB\s0 Testers
6321 mailing list <gdb\-testers@sourceware.org>
6322 .PP
6323 _Pragmatics: The branch creation is sent to the announce list to
6324 ensure that people people not subscribed to the higher volume discussion
6325 list are alerted._
6326 .PP
6327 The announcement should include:
6328 .PP
6329 * The branch tag.
6330 .PP
6331 * How to check out the branch using \s-1CVS.\s0
6332 .PP
6333 * The date/number of weeks until the release.
6334 .PP
6335 * The branch commit policy still holds.
6336 .PP
6337 21.5 Stabilize the branch
6338 =========================
6339 .PP
6340 Something goes here.
6341 .PP
6342 21.6 Create a Release
6343 =====================
6344 .PP
6345 The process of creating and then making available a release is broken
6346 down into a number of stages.  The first part addresses the technical
6347 process of creating a releasable tar ball.  The later stages address the
6348 process of releasing that tar ball.
6349 .PP
6350 When making a release candidate just the first section is needed.
6351 .PP
6352 21.6.1 Create a release candidate
6353 \&\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
6354 .PP
6355 The objective at this stage is to create a set of tar balls that can be
6356 made available as a formal release (or as a less formal release
6357 candidate).
6358 .PP
6359 Freeze the branch
6360 \&.................
6361 .PP
6362 Send out an e\-mail notifying everyone that the branch is frozen to
6363 <gdb\-patches@sourceware.org>.
6364 .PP
6365 Establish a few defaults.
6366 \&.........................
6367 .PP
6368 $  b=gdb_5_2\-branch
6369 $  v=5.2
6370 $  t=/sourceware/snapshot\-tmp/gdbadmin\-tmp
6371 $  echo \f(CW$t\fR/$b/$v
6372 /sourceware/snapshot\-tmp/gdbadmin\-tmp/gdb_5_2\-branch/5.2
6373 $  mkdir \-p \f(CW$t\fR/$b/$v
6374 $  cd \f(CW$t\fR/$b/$v
6375 $  pwd
6376 /sourceware/snapshot\-tmp/gdbadmin\-tmp/gdb_5_2\-branch/5.2
6377 $  which autoconf
6378 /home/gdbadmin/bin/autoconf
6379 $
6380 .PP
6381 Notes:
6382 .PP
6383 * Check the `\fBautoconf\fR' version carefully.  You want to be using the
6384 version documented in the toplevel `\fBREADME-maintainer-mode\fR' file.
6385 It is very unlikely that the version of `\fBautoconf\fR' installed in
6386 system directories (e.g., `\fB/usr/bin/autoconf\fR') is correct.
6387 .PP
6388 Check out the relevant modules:
6389 \&...............................
6390 .PP
6391 $  for m in gdb insight
6392 do
6393 ( mkdir \-p \f(CW$m\fR && cd \f(CW$m\fR && cvs \-q \-f \-d /cvs/src co \-P \-r \f(CW$b\fR \f(CW$m\fR )
6394 done
6395 $
6396 .PP
6397 Note:
6398 .PP
6399 * The reading of `\fB.cvsrc\fR' is disabled (`\fB\-f\fR') so that there isn't any
6400 confusion between what is written here and what your local `\fBcvs\fR'
6401 really does.
6402 .PP
6403 Update relevant files.
6404 \&......................
6405 .PP
6406 `\fBgdb/NEWS\fR'
6407 Major releases get their comments added as part of the mainline.
6408 Minor releases should probably mention any significant bugs that
6409 were fixed.
6410 .PP
6411 Don't forget to include the `\fBChangeLog\fR' entry.
6412 .PP
6413 $  emacs gdb/src/gdb/NEWS
6414 \&...
6415 c\-x 4 a
6416 \&...
6417 c\-x c\-s c\-x c\-c
6418 $  cp gdb/src/gdb/NEWS insight/src/gdb/NEWS
6419 $  cp gdb/src/gdb/ChangeLog insight/src/gdb/ChangeLog
6420 .PP
6421 `\fBgdb/README\fR'
6422 You'll need to update:
6423 .PP
6424 * The version.
6425 .PP
6426 * The update date.
6427 .PP
6428 * Who did it.
6429 .PP
6430 $  emacs gdb/src/gdb/README
6431 \&...
6432 c\-x 4 a
6433 \&...
6434 c\-x c\-s c\-x c\-c
6435 $  cp gdb/src/gdb/README insight/src/gdb/README
6436 $  cp gdb/src/gdb/ChangeLog insight/src/gdb/ChangeLog
6437 .PP
6438 _Maintainer note: Hopefully the `\fB\s-1README\s0\fR' file was reviewed before
6439 the initial branch was cut so just a simple substitute is needed
6440 to get it updated._
6441 .PP
6442 _Maintainer note: Other projects generate `\fB\s-1README\s0\fR' and `\fB\s-1INSTALL\s0\fR'
6443 from the core documentation.  This might be worth pursuing._
6444 .PP
6445 `\fBgdb/version.in\fR'
6446 $  echo \f(CW$v\fR > gdb/src/gdb/version.in
6447 $  cat gdb/src/gdb/version.in
6448 5.2
6449 $  emacs gdb/src/gdb/version.in
6450 \&...
6451 c\-x 4 a
6452 \&... Bump to version ...
6453 c\-x c\-s c\-x c\-c
6454 $  cp gdb/src/gdb/version.in insight/src/gdb/version.in
6455 $  cp gdb/src/gdb/ChangeLog insight/src/gdb/ChangeLog
6456 .PP
6457 Do the dirty work
6458 \&.................
6459 .PP
6460 This is identical to the process used to create the daily snapshot.
6461 .PP
6462 $  for m in gdb insight
6463 do
6464 ( cd \f(CW$m\fR/src && gmake \-f src-release \f(CW$m\fR.tar )
6465 done
6466 .PP
6467 If the top level source directory does not have `\fBsrc-release\fR' (\s-1GDB\s0
6468 version 5.3.1 or earlier), try these commands instead:
6469 .PP
6470 $  for m in gdb insight
6471 do
6472 ( cd \f(CW$m\fR/src && gmake \-f Makefile.in \f(CW$m\fR.tar )
6473 done
6474 .PP
6475 Check the source files
6476 \&......................
6477 .PP
6478 You're looking for files that have mysteriously disappeared.
6479 `\fBdistclean\fR' has the habit of deleting files it shouldn't.  Watch out
6480 for the `\fBversion.in\fR' update `\fBcronjob\fR'.
6481 .PP
6482 $  ( cd gdb/src && cvs \-f \-q \-n update )
6483 M djunpack.bat
6484 ? gdb\-5.1.91.tar
6485 ? proto-toplev
6486 \&... lots of generated files ...
6487 M gdb/ChangeLog
6488 M gdb/NEWS
6489 M gdb/README
6490 M gdb/version.in
6491 \&... lots of generated files ...
6492 $
6493 .PP
6494 _Don't worry about the `\fBgdb.info\-??\fR' or `\fBgdb/p\-exp.tab.c\fR'.  They were
6495 generated (and yes `\fBgdb.info\-1\fR' was also generated only something
6496 strange with \s-1CVS\s0 means that they didn't get suppressed).  Fixing it
6497 would be nice though._
6498 .PP
6499 Create compressed versions of the release
6500 \&.........................................
6501 .PP
6502 $  cp */src/*.tar .
6503 $  cp */src/*.bz2 .
6504 $  ls \-F
6505 gdb/ gdb\-5.2.tar insight/ insight\-5.2.tar
6506 $  for m in gdb insight
6507 do
6508 bzip2 \-v \-9 \-c \f(CW$m\fR\-$v.tar > \f(CW$m\fR\-$v.tar.bz2
6509 gzip \-v \-9 \-c \f(CW$m\fR\-$v.tar > \f(CW$m\fR\-$v.tar.gz
6510 done
6511 $
6512 .PP
6513 Note:
6514 .PP
6515 * A pipe such as `\fBbunzip2 < xxx.bz2 | gzip \-9 > xxx.gz\fR' is not since,
6516 in that mode, `\fBgzip\fR' does not know the name of the file and, hence,
6517 can not include it in the compressed file.  This is also why the
6518 release process runs `\fBtar\fR' and `\fBbzip2\fR' as separate passes.
6519 .PP
6520 21.6.2 Sanity check the tar ball
6521 \&\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
6522 .PP
6523 Pick a popular machine (Solaris/PPC?) and try the build on that.
6524 .PP
6525 $  bunzip2 < gdb\-5.2.tar.bz2 | tar xpf \-
6526 $  cd gdb\-5.2
6527 $  ./configure
6528 $  make
6529 \&...
6530 $  ./gdb/gdb ./gdb/gdb
6531 \&\s-1GNU\s0 gdb 5.2
6532 \&...
6533 (gdb)  b main
6534 Breakpoint 1 at 0x80732bc: file main.c, line 734.
6535 (gdb)  run
6536 Starting program: /tmp/gdb\-5.2/gdb/gdb
6537 .PP
6538 Breakpoint 1, main (argc=1, argv=0xbffff8b4) at main.c:734
6539 734       catch_errors (captured_main, &args, "", \s-1RETURN_MASK_ALL\s0);
6540 (gdb)  print args
6541 \&\f(CW$1\fR = {argc = 136426532, argv = 0x821b7f0}
6542 (gdb)
6543 .PP
6544 21.6.3 Make a release candidate available
6545 \&\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
6546 .PP
6547 If this is a release candidate then the only remaining steps are:
6548 .PP
6549 1. Commit `\fBversion.in\fR' and `\fBChangeLog\fR'
6550 .PP
6551 2. Tweak `\fBversion.in\fR' (and `\fBChangeLog\fR' to read L.M.N\-0000\-00\-00\-cvs
6552 so that the version update process can restart.
6553 .PP
6554 3. Make the release candidate available in
6555 `\fBftp://sourceware.org/pub/gdb/snapshots/branch\fR'
6556 .PP
6557 4. Notify the relevant mailing lists ( <gdb@sourceware.org> and
6558 <gdb\-testers@sourceware.org> that the candidate is available.
6559 .PP
6560 21.6.4 Make a formal release available
6561 \&\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
6562 .PP
6563 (And you thought all that was required was to post an e\-mail.)
6564 .PP
6565 Install on sware
6566 \&................
6567 .PP
6568 Copy the new files to both the release and the old release directory:
6569 .PP
6570 $  cp *.bz2 *.gz ~ftp/pub/gdb/old\-releases/
6571 $  cp *.bz2 *.gz ~ftp/pub/gdb/releases
6572 .PP
6573 Clean up the releases directory so that only the most recent releases
6574 are available (e.g. keep 5.2 and 5.2.1 but remove 5.1):
6575 .PP
6576 $  cd ~ftp/pub/gdb/releases
6577 $  rm ...
6578 .PP
6579 Update the file `\fB\s-1README\s0\fR' and `\fB.message\fR' in the releases directory:
6580 .PP
6581 $  vi \s-1README
6582 \&...
6583 $ \s0 rm \-f .message
6584 $  ln \s-1README \s0.message
6585 .PP
6586 Update the web pages.
6587 \&.....................
6588 .PP
6589 `\fBhtdocs/download/ANNOUNCEMENT\fR'
6590 This file, which is posted as the official announcement, includes:
6591 * General announcement.
6592 .PP
6593 * News.  If making an M.N.1 release, retain the news from
6594 earlier M.N release.
6595 .PP
6596 * Errata.
6597 .PP
6598 `\fBhtdocs/index.html\fR'
6599 `\fBhtdocs/news/index.html\fR'
6600 `\fBhtdocs/download/index.html\fR'
6601 These files include:
6602 * Announcement of the most recent release.
6603 .PP
6604 * News entry (remember to update both the top level and the
6605 news directory).
6606 These pages also need to be regenerate using `\fBindex.sh\fR'.
6607 .PP
6608 `\fBdownload/onlinedocs/\fR'
6609 You need to find the magic command that is used to generate the
6610 online docs from the `\fB.tar.bz2\fR'.  The best way is to look in the
6611 output from one of the nightly `\fBcron\fR' jobs and then just edit
6612 accordingly.  Something like:
6613 .PP
6614 $  ~/ss/update\-web\-docs \e
6615 ~ftp/pub/gdb/releases/gdb\-5.2.tar.bz2 \e
6616 \&\f(CW$PWD\fR/www \e
6617 /www/sourceware/htdocs/gdb/download/onlinedocs \e
6618 gdb
6619 .PP
6620 `\fBdownload/ari/\fR'
6621 Just like the online documentation.  Something like:
6622 .PP
6623 $  /bin/sh ~/ss/update\-web\-ari \e
6624 ~ftp/pub/gdb/releases/gdb\-5.2.tar.bz2 \e
6625 \&\f(CW$PWD\fR/www \e
6626 /www/sourceware/htdocs/gdb/download/ari \e
6627 gdb
6628 .PP
6629 Shadow the pages onto gnu
6630 \&.........................
6631 .PP
6632 Something goes here.
6633 .PP
6634 Install the \s-1GDB\s0 tar ball on \s-1GNU
6635 \&...............................\s0
6636 .PP
6637 At the time of writing, the \s-1GNU\s0 machine was `\fBgnudist.gnu.org\fR' in
6638 `\fB~ftp/gnu/gdb\fR'.
6639 .PP
6640 Make the `\fB\s-1ANNOUNCEMENT\s0\fR'
6641 \&.......................
6642 .PP
6643 Post the `\fB\s-1ANNOUNCEMENT\s0\fR' file you created above to:
6644 .PP
6645 * \s-1GDB\s0 Announcement mailing list <gdb\-announce@sourceware.org>
6646 .PP
6647 * General \s-1GNU\s0 Announcement list <info\-gnu@gnu.org> (but delay it a
6648 day or so to let things get out)
6649 .PP
6650 * \s-1GDB\s0 Bug Report mailing list <bug\-gdb@gnu.org>
6651 .PP
6652 21.6.5 Cleanup
6653 \&\-\-\-\-\-\-\-\-\-\-\-\-\-\-
6654 .PP
6655 The release is out but you're still not finished.
6656 .PP
6657 Commit outstanding changes
6658 \&..........................
6659 .PP
6660 In particular you'll need to commit any changes to:
6661 .PP
6662 * `\fBgdb/ChangeLog\fR'
6663 .PP
6664 * `\fBgdb/version.in\fR'
6665 .PP
6666 * `\fBgdb/NEWS\fR'
6667 .PP
6668 * `\fBgdb/README\fR'
6669 .PP
6670 Tag the release
6671 \&...............
6672 .PP
6673 Something like:
6674 .PP
6675 $  d=`date \-u +%Y\-%m\-%d`
6676 $  echo \f(CW$d\fR
6677 2002\-01\-24
6678 $  ( cd insight/src/gdb && cvs \-f \-q update )
6679 $  ( cd insight/src && cvs \-f \-q tag gdb_5_2\-$d\-release )
6680 .PP
6681 Insight is used since that contains more of the release than \s-1GDB.\s0
6682 .PP
6683 Mention the release on the trunk
6684 \&................................
6685 .PP
6686 Just put something in the `\fBChangeLog\fR' so that the trunk also indicates
6687 when the release was made.
6688 .PP
6689 Restart `\fBgdb/version.in\fR'
6690 \&........................
6691 .PP
6692 If `\fBgdb/version.in\fR' does not contain an \s-1ISO\s0 date such as `\fB2002\-01\-24\fR'
6693 then the daily `\fBcronjob\fR' won't update it.  Having committed all the
6694 release changes it can be set to `\fB5.2.0_0000\-00\-00\-cvs\fR' which will
6695 restart things (yes the `\fB_\fR' is important \- it affects the snapshot
6696 process).
6697 .PP
6698 Don't forget the `\fBChangeLog\fR'.
6699 .PP
6700 Merge into trunk
6701 \&................
6702 .PP
6703 The files committed to the branch may also need changes merged into the
6704 trunk.
6705 .PP
6706 Revise the release schedule
6707 \&...........................
6708 .PP
6709 Post a revised release schedule to \s-1GDB\s0 Discussion List
6710 <gdb@sourceware.org> with an updated announcement.  The schedule can be
6711 generated by running:
6712 .PP
6713 $  ~/ss/schedule `date +%s` schedule
6714 .PP
6715 The first parameter is approximate date/time in seconds (from the epoch)
6716 of the most recent release.
6717 .PP
6718 Also update the schedule `\fBcronjob\fR'.
6719 .PP
6720 21.7 Post release
6721 =================
6722 .PP
6723 Remove any `\fB\s-1OBSOLETE\s0\fR' code.
6724 .SS "22 Testsuite"
6725 .IX Subsection "22 Testsuite"
6726 The testsuite is an important component of the \s-1GDB\s0 package.  While it
6727 is always worthwhile to encourage user testing, in practice this is
6728 rarely sufficient; users typically use only a small subset of the
6729 available commands, and it has proven all too common for a change to
6730 cause a significant regression that went unnoticed for some time.
6731 .PP
6732 The \s-1GDB\s0 testsuite uses the DejaGNU testing framework.  The tests
6733 themselves are calls to various `\fBTcl\fR' procs; the framework runs all the
6734 procs and summarizes the passes and fails.
6735 .PP
6736 22.1 Using the Testsuite
6737 ========================
6738 .PP
6739 To run the testsuite, simply go to the \s-1GDB\s0 object directory (or to the
6740 testsuite's objdir) and type `\fBmake check\fR'.  This just sets up some
6741 environment variables and invokes DejaGNU's `\fBruntest\fR' script.  While
6742 the testsuite is running, you'll get mentions of which test file is in
6743 use, and a mention of any unexpected passes or fails.  When the
6744 testsuite is finished, you'll get a summary that looks like this:
6745 .PP
6746 === gdb Summary ===
6747 .PP
6748 # of expected passes            6016
6749 # of unexpected failures        58
6750 # of unexpected successes       5
6751 # of expected failures          183
6752 # of unresolved testcases       3
6753 # of untested testcases         5
6754 .PP
6755 To run a specific test script, type:
6756 make check RUNTESTFLAGS='\s-1TESTS\s0'
6757 where \s-1TESTS\s0 is a list of test script file names, separated by spaces.
6758 .PP
6759 If you use \s-1GNU\s0 make, you can use its `\fB\-j\fR' option to run the
6760 testsuite in parallel.  This can greatly reduce the amount of time it
6761 takes for the testsuite to run.  In this case, if you set
6762 `\fB\s-1RUNTESTFLAGS\s0\fR' then, by default, the tests will be run serially even
6763 under `\fB\-j\fR'.  You can override this and force a parallel run by setting
6764 the `\fBmake\fR' variable `\fB\s-1FORCE_PARALLEL\s0\fR' to any non-empty value.  Note that
6765 the parallel `\fBmake check\fR' assumes that you want to run the entire
6766 testsuite, so it is not compatible with some dejagnu options, like
6767 `\fB\-\-directory\fR'.
6768 .PP
6769 The ideal test run consists of expected passes only; however, reality
6770 conspires to keep us from this ideal.  Unexpected failures indicate
6771 real problems, whether in \s-1GDB\s0 or in the testsuite.  Expected failures
6772 are still failures, but ones which have been decided are too hard to
6773 deal with at the time; for instance, a test case might work everywhere
6774 except on \s-1AIX,\s0 and there is no prospect of the \s-1AIX\s0 case being fixed in
6775 the near future.  Expected failures should not be added lightly, since
6776 you may be masking serious bugs in \s-1GDB. \s0 Unexpected successes are
6777 expected fails that are passing for some reason, while unresolved and
6778 untested cases often indicate some minor catastrophe, such as the
6779 compiler being unable to deal with a test program.
6780 .PP
6781 When making any significant change to \s-1GDB,\s0 you should run the
6782 testsuite before and after the change, to confirm that there are no
6783 regressions.  Note that truly complete testing would require that you
6784 run the testsuite with all supported configurations and a variety of
6785 compilers; however this is more than really necessary.  In many cases
6786 testing with a single configuration is sufficient.  Other useful
6787 options are to test one big-endian (Sparc) and one little-endian (x86)
6788 host, a cross config with a builtin simulator (powerpc-eabi, mips-elf),
6789 or a 64\-bit host (Alpha).
6790 .PP
6791 If you add new functionality to \s-1GDB,\s0 please consider adding tests
6792 for it as well; this way future \s-1GDB\s0 hackers can detect and fix their
6793 changes that break the functionality you added.  Similarly, if you fix
6794 a bug that was not previously reported as a test failure, please add a
6795 test case for it.  Some cases are extremely difficult to test, such as
6796 code that handles host \s-1OS\s0 failures or bugs in particular versions of
6797 compilers, and it's \s-1OK\s0 not to try to write tests for all of those.
6798 .PP
6799 DejaGNU supports separate build, host, and target machines.  However,
6800 some \s-1GDB\s0 test scripts do not work if the build machine and the host
6801 machine are not the same.  In such an environment, these scripts will
6802 give a result of \*(L"\s-1UNRESOLVED\*(R",\s0 like this:
6803 .PP
6804 \&\s-1UNRESOLVED:\s0 gdb.base/example.exp: This test script does not work on a remote host.
6805 .PP
6806 22.2 Testsuite Parameters
6807 =========================
6808 .PP
6809 Several variables exist to modify the behavior of the testsuite.
6810 .PP
6811 * `\fB\s-1TRANSCRIPT\s0\fR'
6812 .PP
6813 Sometimes it is convenient to get a transcript of the commands
6814 which the testsuite sends to \s-1GDB. \s0 For example, if \s-1GDB\s0 crashes
6815 during testing, a transcript can be used to more easily
6816 reconstruct the failure when running \s-1GDB\s0 under \s-1GDB.\s0
6817 .PP
6818 You can instruct the \s-1GDB\s0 testsuite to write transcripts by setting
6819 the DejaGNU variable `\fB\s-1TRANSCRIPT\s0\fR' (to any value) before invoking
6820 `\fBruntest\fR' or `\fBmake check\fR'.  The transcripts will be written into
6821 DejaGNU's output directory.  One transcript will be made for each
6822 invocation of \s-1GDB\s0; they will be named `\fBtranscript.N\fR', where N is
6823 an integer.  The first line of the transcript file will show how
6824 \&\s-1GDB\s0 was invoked; each subsequent line is a command sent as input
6825 to \s-1GDB.\s0
6826 .PP
6827 make check RUNTESTFLAGS=TRANSCRIPT=y
6828 .PP
6829 Note that the transcript is not always complete.  In particular,
6830 tests of completion can yield partial command lines.
6831 .PP
6832 * `\fB\s-1GDB\s0\fR'
6833 .PP
6834 Sometimes one wishes to test a different \s-1GDB\s0 than the one in the
6835 build directory.  For example, one may wish to run the testsuite on
6836 `\fB/usr/bin/gdb\fR'.
6837 .PP
6838 make check RUNTESTFLAGS=GDB=/usr/bin/gdb
6839 .PP
6840 * `\fB\s-1GDBSERVER\s0\fR'
6841 .PP
6842 When testing a different \s-1GDB,\s0 it is often useful to also test a
6843 different gdbserver.
6844 .PP
6845 make check RUNTESTFLAGS=\*(L"GDB=/usr/bin/gdb GDBSERVER=/usr/bin/gdbserver\*(R"
6846 .PP
6847 * `\fB\s-1INTERNAL_GDBFLAGS\s0\fR'
6848 .PP
6849 When running the testsuite normally one doesn't want whatever is in
6850 `\fB~/.gdbinit\fR' to interfere with the tests, therefore the test
6851 harness passes `\fB\-nx\fR' to \s-1GDB. \s0 One also doesn't want any windowed
6852 version of \s-1GDB,\s0 e.g., `\fBgdb \-tui\fR', to run.  This is achieved via
6853 `\fB\s-1INTERNAL_GDBFLAGS\s0\fR'.
6854 .PP
6855 set \s-1INTERNAL_GDBFLAGS \s0\*(L"\-nw \-nx\*(R"
6856 .PP
6857 This is all well and good, except when testing an installed \s-1GDB\s0
6858 that has been configured with `\fB\-\-with\-system\-gdbinit\fR'.  Here one
6859 does not want `\fB~/.gdbinit\fR' loaded but one may want the system
6860 `\fB.gdbinit\fR' file loaded.  This can be achieved by pointing `\fB\f(CB$HOME\fB\fR'
6861 at a directory without a `\fB.gdbinit\fR' and by overriding
6862 `\fB\s-1INTERNAL_GDBFLAGS\s0\fR' and removing `\fB\-nx\fR'.
6863 .PP
6864 cd testsuite
6865 HOME=`pwd` runtest \e
6866 GDB=/usr/bin/gdb \e
6867 GDBSERVER=/usr/bin/gdbserver \e
6868 INTERNAL_GDBFLAGS=\-nw
6869 .PP
6870 There are two ways to run the testsuite and pass additional
6871 parameters to DejaGnu.  The first is with `\fBmake check\fR' and specifying
6872 the makefile variable `\fB\s-1RUNTESTFLAGS\s0\fR'.
6873 .PP
6874 make check RUNTESTFLAGS=TRANSCRIPT=y
6875 .PP
6876 The second is to cd to the `\fBtestsuite\fR' directory and invoke the
6877 DejaGnu `\fBruntest\fR' command directly.
6878 .PP
6879 cd testsuite
6880 make site.exp
6881 runtest TRANSCRIPT=y
6882 .PP
6883 22.3 Testsuite Configuration
6884 ============================
6885 .PP
6886 It is possible to adjust the behavior of the testsuite by defining the
6887 global variables listed below, either in a `\fBsite.exp\fR' file, or in a
6888 board file.
6889 .PP
6890 * `\fBgdb_test_timeout\fR'
6891 .PP
6892 Defining this variable changes the default timeout duration used
6893 during communication with \s-1GDB. \s0 More specifically, the global
6894 variable used during testing is `\fBtimeout\fR', but this variable gets
6895 reset to `\fBgdb_test_timeout\fR' at the beginning of each testcase,
6896 making sure that any local change to `\fBtimeout\fR' in a testcase does
6897 not affect subsequent testcases.
6898 .PP
6899 This global variable comes in handy when the debugger is slower
6900 than normal due to the testing environment, triggering unexpected
6901 `\fB\s-1TIMEOUT\s0\fR' test failures.  Examples include when testing on a
6902 remote machine, or against a system where communications are slow.
6903 .PP
6904 If not specifically defined, this variable gets automatically
6905 defined to the same value as `\fBtimeout\fR' during the testsuite
6906 initialization.  The default value of the timeout is defined in
6907 the file `\fBgdb/testsuite/config/unix.exp\fR' that is part of the \s-1GDB\s0
6908 test \fIsuite\fR\|(1).
6909 .PP
6910 22.4 Testsuite Organization
6911 ===========================
6912 .PP
6913 The testsuite is entirely contained in `\fBgdb/testsuite\fR'.  While the
6914 testsuite includes some makefiles and configury, these are very minimal,
6915 and used for little besides cleaning up, since the tests themselves
6916 handle the compilation of the programs that \s-1GDB\s0 will run.  The file
6917 `\fBtestsuite/lib/gdb.exp\fR' contains common utility procs useful for all
6918 \&\s-1GDB\s0 tests, while the directory `\fBtestsuite/config\fR' contains
6919 configuration-specific files, typically used for special-purpose
6920 definitions of procs like `\fBgdb_load\fR' and `\fBgdb_start\fR'.
6921 .PP
6922 The tests themselves are to be found in `\fBtestsuite/gdb.*\fR' and
6923 subdirectories of those.  The names of the test files must always end
6924 with `\fB.exp\fR'.  DejaGNU collects the test files by wildcarding in the
6925 test directories, so both subdirectories and individual files get
6926 chosen and run in alphabetical order.
6927 .PP
6928 The following table lists the main types of subdirectories and what
6929 they are for.  Since DejaGNU finds test files no matter where they are
6930 located, and since each test file sets up its own compilation and
6931 execution environment, this organization is simply for convenience and
6932 intelligibility.
6933 .PP
6934 `\fBgdb.base\fR'
6935 This is the base testsuite.  The tests in it should apply to all
6936 configurations of \s-1GDB \s0(but generic native-only tests may live
6937 here).  The test programs should be in the subset of C that is
6938 valid K&R, \s-1ANSI/ISO,\s0 and \*(C+ (`\fB#ifdef\fR's are allowed if necessary,
6939 for instance for prototypes).
6940 .PP
6941 `\fBgdb.LANG\fR'
6942 Language-specific tests for any language \s-1LANG\s0 besides C.  Examples
6943 are `\fBgdb.cp\fR' and `\fBgdb.java\fR'.
6944 .PP
6945 `\fBgdb.PLATFORM\fR'
6946 Non-portable tests.  The tests are specific to a specific
6947 configuration (host or target), such as HP-UX or eCos.  Example is
6948 `\fBgdb.hp\fR', for HP-UX.
6949 .PP
6950 `\fBgdb.COMPILER\fR'
6951 Tests specific to a particular compiler.  As of this writing (June
6952 1999), there aren't currently any groups of tests in this category
6953 that couldn't just as sensibly be made platform-specific, but one
6954 could imagine a `\fBgdb.gcc\fR', for tests of \s-1GDB\s0's handling of \s-1GCC\s0
6955 extensions.
6956 .PP
6957 `\fBgdb.SUBSYSTEM\fR'
6958 Tests that exercise a specific \s-1GDB\s0 subsystem in more depth.  For
6959 instance, `\fBgdb.disasm\fR' exercises various disassemblers, while
6960 `\fBgdb.stabs\fR' tests pathways through the stabs symbol reader.
6961 .PP
6962 22.5 Writing Tests
6963 ==================
6964 .PP
6965 In many areas, the \s-1GDB\s0 tests are already quite comprehensive; you
6966 should be able to copy existing tests to handle new cases.
6967 .PP
6968 You should try to use `\fBgdb_test\fR' whenever possible, since it
6969 includes cases to handle all the unexpected errors that might happen.
6970 However, it doesn't cost anything to add new test procedures; for
6971 instance, `\fBgdb.base/exprs.exp\fR' defines a `\fBtest_expr\fR' that calls
6972 `\fBgdb_test\fR' multiple times.
6973 .PP
6974 Only use `\fBsend_gdb\fR' and `\fBgdb_expect\fR' when absolutely necessary.
6975 Even if \s-1GDB\s0 has several valid responses to a command, you can use
6976 `\fBgdb_test_multiple\fR'.  Like `\fBgdb_test\fR', `\fBgdb_test_multiple\fR' recognizes
6977 internal errors and unexpected prompts.
6978 .PP
6979 Do not write tests which expect a literal tab character from \s-1GDB.\s0
6980 On some operating systems (e.g. OpenBSD) the \s-1TTY\s0 layer expands tabs to
6981 spaces, so by the time \s-1GDB\s0's output reaches expect the tab is gone.
6982 .PP
6983 The source language programs do _not_ need to be in a consistent
6984 style.  Since \s-1GDB\s0 is used to debug programs written in many different
6985 styles, it's worth having a mix of styles in the testsuite; for
6986 instance, some \s-1GDB\s0 bugs involving the display of source lines would
6987 never manifest themselves if the programs used \s-1GNU\s0 coding style
6988 uniformly.
6989 .PP
6990 Some testcase results need more detailed explanation:
6991 .PP
6992 `\fB\s-1KFAIL\s0\fR'
6993 Known problem of \s-1GDB\s0 itself.  You must specify the \s-1GDB\s0 bug report
6994 number like in these sample tests:
6995 kfail \*(L"gdb/13392\*(R" \*(L"continue to marker 2\*(R"
6996 or
6997 setup_kfail gdb/13392 \*(L"*\-*\-*\*(R"
6998 kfail \*(L"continue to marker 2\*(R"
6999 .PP
7000 `\fB\s-1XFAIL\s0\fR'
7001 Known problem of environment.  This typically includes \s-1GCC\s0 but it
7002 includes also many other system components which cannot be fixed
7003 in the \s-1GDB\s0 project.  Sample test with sanity check not knowing the
7004 specific cause of the problem:
7005 # On x86_64 it is commonly about 4MB.
7006 if {$stub_size > 25000000} {
7007 xfail \*(L"stub size \f(CW$stub_size\fR is too large\*(R"
7008 return
7009 }
7010 .PP
7011 You should provide bug report number for the failing component of
7012 the environment, if such bug report is available:
7013 if {[test_compiler_info {gcc\-[0\-3]\-*}]
7014 || [test_compiler_info {gcc\-4\-[0\-5]\-*}]} {
7015 setup_xfail \*(L"gcc/46955\*(R" *\-*\-*
7016 }
7017 gdb_test \*(L"python print \fIttype.template_argument\fR\|(2)\*(R" \*(L"&C::c\*(R"
7018 .PP
7019 22.6 Board settings
7020 ===================
7021 .PP
7022 In \s-1GDB\s0 testsuite, the tests can be configured or customized in the board
7023 file by means of \*(L"Board Settings\*(R".  Each setting   should be consulted
7024 by test cases that depend on the corresponding feature.
7025 .PP
7026 Here are the supported board settings:
7027 .PP
7028 `\fBgdb,cannot_call_functions\fR'
7029 The board does not support inferior call, that is, invoking
7030 inferior functions in \s-1GDB.\s0
7031 .PP
7032 `\fBgdb,can_reverse\fR'
7033 The board supports reverse execution.
7034 .PP
7035 `\fBgdb,no_hardware_watchpoints\fR'
7036 The board does not support hardware watchpoints.
7037 .PP
7038 `\fBgdb,nofileio\fR'
7039 \&\s-1GDB\s0 is unable to intercept target file operations in remote and
7040 perform them on the host.
7041 .PP
7042 `\fBgdb,noinferiorio\fR'
7043 The board is unable to provide I/O capability to the inferior.
7044 .PP
7045 `\fBgdb,nosignals\fR'
7046 The board does not support signals.
7047 .PP
7048 `\fBgdb,skip_huge_test\fR'
7049 Skip time-consuming tests on the board with slow connection.
7050 .PP
7051 `\fBgdb,skip_float_tests\fR'
7052 Skip tests related to float points on target board.
7053 .PP
7054 `\fBgdb,use_precord\fR'
7055 The board supports process record.
7056 .PP
7057 `\fBgdb_server_prog\fR'
7058 The location of GDBserver.  If GDBserver somewhere other than its
7059 default location is used in test, specify the location of
7060 GDBserver in this variable.  The location is a file name of
7061 GDBserver that can be either absolute or relative to testsuite
7062 subdirectory in build directory.
7063 .PP
7064 `\fBin_proc_agent\fR'
7065 The location of in-process agent.  If in-process agent other than
7066 its default location is used in test, specify the location of
7067 in-process agent in this variable.  The location is a file name of
7068 in-process agent that can be either  absolute or relative to
7069 testsuite subdirectory in build directory.
7070 .PP
7071 `\fBnoargs\fR'
7072 \&\s-1GDB\s0 does not support argument passing for inferior.
7073 .PP
7074 `\fBno_long_long\fR'
7075 The board does not support type `\fBlong long\fR'.
7076 .PP
7077 `\fBuse_gdb_stub\fR'
7078 The tests are running with gdb stub.
7079 .PP
7080 \&\-\-\-\-\-\-\-\-\-\- Footnotes \-\-\-\-\-\-\-\-\-\-
7081 .PP
7082 (1) If you are using a board file, it could override the test-suite
7083 default; search the board file for \*(L"timeout\*(R".
7084 .SS "23 Hints"
7085 .IX Subsection "23 Hints"
7086 Check the `\fB\s-1README\s0\fR' file, it often has useful information that does not
7087 appear anywhere else in the directory.
7088 .PP
7089 * Menu:
7090 .PP
7091 Getting started working on \s-1GDB:\s0 see \*(L"Getting Started\*(R"
7092 .PP
7093 Debugging \s-1GDB\s0 with itself: see \*(L"Debugging \s-1GDB\*(R"\s0
7094 .PP
7095 \&\fB23.1 Getting Started\fR
7096 .PP
7097 \&\s-1GDB\s0 is a large and complicated program, and if you first starting to
7098 work on it, it can be hard to know where to start.  Fortunately, if you
7099 know how to go about it, there are ways to figure out what is going on.
7100 .PP
7101 This manual, the \s-1GDB\s0 Internals manual, has information which applies
7102 generally to many parts of \s-1GDB.\s0
7103 .PP
7104 Information about particular functions or data structures are
7105 located in comments with those functions or data structures.  If you
7106 run across a function or a global variable which does not have a
7107 comment correctly explaining what is does, this can be thought of as a
7108 bug in \s-1GDB\s0; feel free to submit a bug report, with a suggested comment
7109 if you can figure out what the comment should say.  If you find a
7110 comment which is actually wrong, be especially sure to report that.
7111 .PP
7112 Comments explaining the function of macros defined in host, target,
7113 or native dependent files can be in several places.  Sometimes they are
7114 repeated every place the macro is defined.  Sometimes they are where the
7115 macro is used.  Sometimes there is a header file which supplies a
7116 default definition of the macro, and the comment is there.  This manual
7117 also documents all the available macros.
7118 .PP
7119 Start with the header files.  Once you have some idea of how \s-1GDB\s0's
7120 internal symbol tables are stored (see `\fBsymtab.h\fR', `\fBgdbtypes.h\fR'), you
7121 will find it much easier to understand the code which uses and creates
7122 those symbol tables.
7123 .PP
7124 You may wish to process the information you are getting somehow, to
7125 enhance your understanding of it.  Summarize it, translate it to another
7126 language, add some (perhaps trivial or non-useful) feature to \s-1GDB,\s0 use
7127 the code to predict what a test case would do and write the test case
7128 and verify your prediction, etc.  If you are reading code and your eyes
7129 are starting to glaze over, this is a sign you need to use a more active
7130 approach.
7131 .PP
7132 Once you have a part of \s-1GDB\s0 to start with, you can find more
7133 specifically the part you are looking for by stepping through each
7134 function with the `\fBnext\fR' command.  Do not use `\fBstep\fR' or you will
7135 quickly get distracted; when the function you are stepping through
7136 calls another function try only to get a big-picture understanding
7137 (perhaps using the comment at the beginning of the function being
7138 called) of what it does.  This way you can identify which of the
7139 functions being called by the function you are stepping through is the
7140 one which you are interested in.  You may need to examine the data
7141 structures generated at each stage, with reference to the comments in
7142 the header files explaining what the data structures are supposed to
7143 look like.
7144 .PP
7145 Of course, this same technique can be used if you are just reading
7146 the code, rather than actually stepping through it.  The same general
7147 principle applies\*(--when the code you are looking at calls something
7148 else, just try to understand generally what the code being called does,
7149 rather than worrying about all its details.
7150 .PP
7151 A good place to start when tracking down some particular area is with
7152 a command which invokes that feature.  Suppose you want to know how
7153 single-stepping works.  As a \s-1GDB\s0 user, you know that the `\fBstep\fR' command
7154 invokes single-stepping.  The command is invoked via command tables
7155 (see `\fBcommand.h\fR'); by convention the function which actually performs
7156 the command is formed by taking the name of the command and adding
7157 `\fB_command\fR', or in the case of an `\fBinfo\fR' subcommand, `\fB_info\fR'.  For
7158 example, the `\fBstep\fR' command invokes the `\fBstep_command\fR' function and the
7159 `\fBinfo display\fR' command invokes `\fBdisplay_info\fR'.  When this convention is
7160 not followed, you might have to use `\fBgrep\fR' or `\fBM\-x tags-search\fR' in
7161 emacs, or run \s-1GDB\s0 on itself and set a breakpoint in `\fBexecute_command\fR'.
7162 .PP
7163 If all of the above fail, it may be appropriate to ask for
7164 information on `\fBbug-gdb\fR'.  But _never_ post a generic question like \*(L"I
7165 was wondering if anyone could give me some tips about understanding
7166 \&\s-1GDB\s0\*(R"\-\-if we had some magic secret we would put it in this manual.
7167 Suggestions for improving the manual are always welcome, of course.
7168 .PP
7169 \&\fB23.2 Debugging \s-1GDB\s0 with itself\fR
7170 .PP
7171 If \s-1GDB\s0 is limping on your machine, this is the preferred way to get it
7172 fully functional.  Be warned that in some ancient Unix systems, like
7173 Ultrix 4.2, a program can't be running in one process while it is being
7174 debugged in another.  Rather than typing the command `\fB./gdb ./gdb\fR',
7175 which works on Suns and such, you can copy `\fBgdb\fR' to `\fBgdb2\fR' and then
7176 type `\fB./gdb ./gdb2\fR'.
7177 .PP
7178 When you run \s-1GDB\s0 in the \s-1GDB\s0 source directory, it will read
7179 `\fBgdb\-gdb.gdb\fR' file (plus possibly `\fBgdb\-gdb.py\fR' file) that sets up some
7180 simple things to make debugging gdb easier.  The `\fBinfo\fR' command, when
7181 executed without a subcommand in a \s-1GDB\s0 being debugged by gdb, will pop
7182 you back up to the top level gdb.  See `\fBgdb\-gdb.gdb\fR' for details.
7183 .PP
7184 If you use emacs, you will probably want to do a `\fBmake \s-1TAGS\s0\fR' after
7185 you configure your distribution; this will put the machine dependent
7186 routines for your local machine where they will be accessed first by
7187 `\fBM\-.\fR'
7188 .PP
7189 Also, make sure that you've either compiled \s-1GDB\s0 with your local cc,
7190 or have run `\fBfixincludes\fR' if you are compiling with gcc.
7191 .PP
7192 23.3 Submitting Patches
7193 =======================
7194 .PP
7195 Thanks for thinking of offering your changes back to the community of
7196 \&\s-1GDB\s0 users.  In general we like to get well designed enhancements.
7197 Thanks also for checking in advance about the best way to transfer the
7198 changes.
7199 .PP
7200 The \s-1GDB\s0 maintainers will only install \*(L"cleanly designed\*(R" patches.
7201 This manual summarizes what we believe to be clean design for \s-1GDB.\s0
7202 .PP
7203 If the maintainers don't have time to put the patch in when it
7204 arrives, or if there is any question about a patch, it goes into a
7205 large queue with everyone else's patches and bug reports.
7206 .PP
7207 The legal issue is that to incorporate substantial changes requires a
7208 copyright assignment from you and/or your employer, granting ownership
7209 of the changes to the Free Software Foundation.  You can get the
7210 standard documents for doing this by sending mail to `\fBgnu@gnu.org\fR' and
7211 asking for it.  We recommend that people write in \*(L"All programs owned
7212 by the Free Software Foundation\*(R" as \*(L"\s-1NAME OF PROGRAM\*(R",\s0 so that changes
7213 in many programs (not just \s-1GDB,\s0 but \s-1GAS,\s0 Emacs, \s-1GCC,\s0 etc) can be
7214 contributed with only one piece of legalese pushed through the
7215 bureaucracy and filed with the \s-1FSF. \s0 We can't start merging changes
7216 until this paperwork is received by the \s-1FSF \s0(their rules, which we
7217 follow since we maintain it for them).
7218 .PP
7219 Technically, the easiest way to receive changes is to receive each
7220 feature as a small context diff or unidiff, suitable for `\fBpatch\fR'.  Each
7221 message sent to me should include the changes to C code and header
7222 files for a single feature, plus `\fBChangeLog\fR' entries for each directory
7223 where files were modified, and diffs for any changes needed to the
7224 manuals (`\fBgdb/doc/gdb.texinfo\fR' or `\fBgdb/doc/gdbint.texinfo\fR').  If there
7225 are a lot of changes for a single feature, they can be split down into
7226 multiple messages.
7227 .PP
7228 In this way, if we read and like the feature, we can add it to the
7229 sources with a single patch command, do some testing, and check it in.
7230 If you leave out the `\fBChangeLog\fR', we have to write one.  If you leave
7231 out the doc, we have to puzzle out what needs documenting.  Etc., etc.
7232 .PP
7233 The reason to send each change in a separate message is that we will
7234 not install some of the changes.  They'll be returned to you with
7235 questions or comments.  If we're doing our job correctly, the message
7236 back to you will say what you have to fix in order to make the change
7237 acceptable.  The reason to have separate messages for separate features
7238 is so that the acceptable changes can be installed while one or more
7239 changes are being reworked.  If multiple features are sent in a single
7240 message, we tend to not put in the effort to sort out the acceptable
7241 changes from the unacceptable, so none of the features get installed
7242 until all are acceptable.
7243 .PP
7244 If this sounds painful or authoritarian, well, it is.  But we get a
7245 lot of bug reports and a lot of patches, and many of them don't get
7246 installed because we don't have the time to finish the job that the bug
7247 reporter or the contributor could have done.  Patches that arrive
7248 complete, working, and well designed, tend to get installed on the day
7249 they arrive.  The others go into a queue and get installed as time
7250 permits, which, since the maintainers have many demands to meet, may not
7251 be for quite some time.
7252 .PP
7253 Please send patches directly to the \s-1GDB\s0 maintainers
7254 <gdb\-patches@sourceware.org>.
7255 .PP
7256 23.4 Build Script
7257 =================
7258 .PP
7259 The script `\fBgdb_buildall.sh\fR' builds \s-1GDB\s0 with flag
7260 `\fB\-\-enable\-targets=all\fR' set.  This builds \s-1GDB\s0 with all supported targets
7261 activated.  This helps testing \s-1GDB\s0 when doing changes that affect more
7262 than one architecture and is much faster than using `\fBgdb_mbuild.sh\fR'.
7263 .PP
7264 After building \s-1GDB\s0 the script checks which architectures are
7265 supported and then switches the current architecture to each of those
7266 to get information about the architecture.  The test results are stored
7267 in log files in the directory the script was called from.
7268 .SS "Appendix A \s-1GDB\s0 Currently available observers"
7269 .IX Subsection "Appendix A GDB Currently available observers"
7270 A.1 Implementation rationale
7271 ============================
7272 .PP
7273 An \*(L"observer\*(R" is an entity which is interested in being notified when
7274 \&\s-1GDB\s0 reaches certain states, or certain events occur in \s-1GDB. \s0 The entity
7275 being observed is called the \*(L"subject\*(R".  To receive notifications, the
7276 observer attaches a callback to the subject.  One subject can have
7277 several observers.
7278 .PP
7279 `\fBobserver.c\fR' implements an internal generic low-level event
7280 notification mechanism.  This generic event notification mechanism is
7281 then re-used to implement the exported high-level notification
7282 management routines for all possible notifications.
7283 .PP
7284 The current implementation of the generic observer provides support
7285 for contextual data.  This contextual data is given to the subject when
7286 attaching the callback.  In return, the subject will provide this
7287 contextual data back to the observer as a parameter of the callback.
7288 .PP
7289 Note that the current support for the contextual data is only
7290 partial, as it lacks a mechanism that would deallocate this data when
7291 the callback is detached.  This is not a problem so far, as this
7292 contextual data is only used internally to hold a function pointer.
7293 Later on, if a certain observer needs to provide support for user-level
7294 contextual data, then the generic notification mechanism will need to be
7295 enhanced to allow the observer to provide a routine to deallocate the
7296 data when attaching the callback.
7297 .PP
7298 The observer implementation is also currently not reentrant.  In
7299 particular, it is therefore not possible to call the attach or detach
7300 routines during a notification.
7301 .PP
7302 A.2 Debugging
7303 =============
7304 .PP
7305 Observer notifications can be traced using the command `set debug
7306 observer 1' (*note Optional messages about internal happenings:
7307 (gdb)Debugging Output.).
7308 .PP
7309 A.3 `\fBnormal_stop\fR' Notifications
7310 ===============================
7311 .PP
7312 \&\s-1GDB\s0 notifies all `\fBnormal_stop\fR' observers when the inferior execution
7313 has just stopped, the associated messages and annotations have been
7314 printed, and the control is about to be returned to the user.
7315 .PP
7316 Note that the `\fBnormal_stop\fR' notification is not emitted when the
7317 execution stops due to a breakpoint, and this breakpoint has a
7318 condition that is not met.  If the breakpoint has any associated
7319 commands list, the commands are executed after the notification is
7320 emitted.
7321 .PP
7322 The following interfaces are available to manage observers:
7323 .PP
7324 \&\-\- Function: extern struct observer *observer_attach_EVENT
7325 (observer_EVENT_ftype *F)
7326 Using the function F, create an observer that is notified when
7327 ever \s-1EVENT\s0 occurs, return the observer.
7328 .PP
7329 \&\-\- Function: extern void observer_detach_EVENT (struct observer
7330 *OBSERVER);
7331 Remove \s-1OBSERVER\s0 from the list of observers to be notified when
7332 \&\s-1EVENT\s0 occurs.
7333 .PP
7334 \&\-\- Function: extern void observer_notify_EVENT (void);
7335 Send a notification to all \s-1EVENT\s0 observers.
7336 .PP
7337 The following observable events are defined:
7338 .PP
7339 \&\-\- Function: void normal_stop (struct bpstats *BS, int \s-1PRINT_FRAME\s0)
7340 The inferior has stopped for real.  The  \s-1BS\s0 argument describes the
7341 breakpoints were are stopped at, if any.  Second argument
7342 \&\s-1PRINT_FRAME\s0 non-zero means display the location where the inferior
7343 has stopped.
7344 .PP
7345 \&\-\- Function: void target_changed (struct target_ops *TARGET)
7346 The target's register contents have changed.
7347 .PP
7348 \&\-\- Function: void executable_changed (void)
7349 The executable being debugged by \s-1GDB\s0 has changed: The user decided
7350 to debug a different program, or the program he was debugging has
7351 been modified since being loaded by the debugger (by being
7352 recompiled, for instance).
7353 .PP
7354 \&\-\- Function: void inferior_created (struct target_ops *OBJFILE, int
7355 \&\s-1FROM_TTY\s0)
7356 \&\s-1GDB\s0 has just connected to an inferior.  For `\fBrun\fR', \s-1GDB\s0 calls this
7357 observer while the inferior is still stopped at the entry-point
7358 instruction.  For `\fBattach\fR' and `\fBcore\fR', \s-1GDB\s0 calls this observer
7359 immediately after connecting to the inferior, and before any
7360 information on the inferior has been printed.
7361 .PP
7362 \&\-\- Function: void record_changed (struct inferior *INFERIOR, int
7363 \&\s-1STARTED\s0)
7364 The status of process record for inferior \s-1INFERIOR\s0 in \s-1GDB\s0 has
7365 changed.  The process record is started if \s-1STARTED\s0 is true, and
7366 the process record is stopped if \s-1STARTED\s0 is false.
7367 .PP
7368 \&\-\- Function: void solib_loaded (struct so_list *SOLIB)
7369 The shared library specified by \s-1SOLIB\s0 has been loaded.  Note that
7370 when \s-1GDB\s0 calls this observer, the library's symbols probably
7371 haven't been loaded yet.
7372 .PP
7373 \&\-\- Function: void solib_unloaded (struct so_list *SOLIB)
7374 The shared library specified by \s-1SOLIB\s0 has been unloaded.  Note
7375 that when \s-1GDB\s0 calls this observer, the library's symbols have not
7376 been unloaded yet, and thus are still available.
7377 .PP
7378 \&\-\- Function: void new_objfile (struct objfile *OBJFILE)
7379 The symbol file specified by \s-1OBJFILE\s0 has been loaded.  Called with
7380 \&\s-1OBJFILE\s0 equal to `\fB\s-1NULL\s0\fR' to indicate previously loaded symbol table
7381 data has now been invalidated.
7382 .PP
7383 \&\-\- Function: void new_thread (struct thread_info *T)
7384 The thread specified by T has been created.
7385 .PP
7386 \&\-\- Function: void thread_exit (struct thread_info *T, int \s-1SILENT\s0)
7387 The thread specified by T has exited.  The \s-1SILENT\s0 argument
7388 indicates that \s-1GDB\s0 is removing the thread from its tables without
7389 wanting to notify the user about it.
7390 .PP
7391 \&\-\- Function: void thread_stop_requested (ptid_t \s-1PTID\s0)
7392 An explicit stop request was issued to \s-1PTID. \s0 If \s-1PTID\s0 equals
7393 \&\s-1MINUS_ONE_PTID,\s0 the request applied to all threads.  If
7394 `\fBptid_is_pid(ptid)\fR' returns true, the request applied to all
7395 threads of the process pointed at by \s-1PTID. \s0 Otherwise, the request
7396 applied to the single thread pointed at by \s-1PTID.\s0
7397 .PP
7398 \&\-\- Function: void target_resumed (ptid_t \s-1PTID\s0)
7399 The target was resumed.  The \s-1PTID\s0 parameter specifies which thread
7400 was resume, and may be \s-1RESUME_ALL\s0 if all threads are resumed.
7401 .PP
7402 \&\-\- Function: void about_to_proceed (void)
7403 The target is about to be proceeded.
7404 .PP
7405 \&\-\- Function: void breakpoint_created (struct breakpoint *B)
7406 A new breakpoint B has been created.
7407 .PP
7408 \&\-\- Function: void breakpoint_deleted (struct breakpoint *B)
7409 A breakpoint has been destroyed.  The argument B is the pointer to
7410 the destroyed breakpoint.
7411 .PP
7412 \&\-\- Function: void breakpoint_modified (struct breakpoint *B)
7413 A breakpoint has been modified in some way.  The argument B is the
7414 modified breakpoint.
7415 .PP
7416 \&\-\- Function: void traceframe_changed (int \s-1TFNUM,\s0 int \s-1TPNUM\s0)
7417 The trace frame is changed to \s-1TFNUM \s0(e.g., by using the `\fBtfind\fR'
7418 command).  If \s-1TFNUM\s0 is negative, it means \s-1GDB\s0 resumes live
7419 debugging.  The number of the tracepoint associated with this
7420 traceframe is \s-1TPNUM.\s0
7421 .PP
7422 \&\-\- Function: void architecture_changed (struct gdbarch *NEWARCH)
7423 The current architecture has changed.  The argument \s-1NEWARCH\s0 is a
7424 pointer to the new architecture.
7425 .PP
7426 \&\-\- Function: void thread_ptid_changed (ptid_t \s-1OLD_PTID,\s0 ptid_t
7427 \&\s-1NEW_PTID\s0)
7428 The thread's ptid has changed.  The \s-1OLD_PTID\s0 parameter specifies
7429 the old value, and \s-1NEW_PTID\s0 specifies the new value.
7430 .PP
7431 \&\-\- Function: void inferior_added (struct inferior *INF)
7432 The inferior \s-1INF\s0 has been added to the list of inferiors.  At this
7433 point, it might not be associated with any process.
7434 .PP
7435 \&\-\- Function: void inferior_appeared (struct inferior *INF)
7436 The inferior identified by \s-1INF\s0 has been attached to a process.
7437 .PP
7438 \&\-\- Function: void inferior_exit (struct inferior *INF)
7439 Either the inferior associated with \s-1INF\s0 has been detached from the
7440 process, or the process has exited.
7441 .PP
7442 \&\-\- Function: void inferior_removed (struct inferior *INF)
7443 The inferior \s-1INF\s0 has been removed from the list of inferiors.
7444 This method is called immediately before freeing \s-1INF.\s0
7445 .PP
7446 \&\-\- Function: void memory_changed (struct inferior *INFERIOR, \s-1CORE_ADDR
7447 ADDR,\s0 ssize_t \s-1LEN,\s0 const bfd_byte *DATA)
7448 Bytes from \s-1DATA\s0 to \s-1DATA + LEN\s0 have been written to the \s-1INFERIOR\s0 at
7449 \&\s-1ADDR.\s0
7450 .PP
7451 \&\-\- Function: void before_prompt (const char *CURRENT_PROMPT)
7452 Called before a top-level prompt is displayed.  \s-1CURRENT_PROMPT\s0 is
7453 the current top-level prompt.
7454 .PP
7455 \&\-\- Function: void gdb_datadir_changed (void)
7456 Variable gdb_datadir has been set.  The value may not necessarily
7457 change.
7458 .PP
7459 \&\-\- Function: void command_param_changed (const char *PARAM, const char
7460 *VALUE)
7461 The parameter of some `\fBset\fR' commands in console are changed.  This
7462 method is called after a command `\fBset \s-1PARAM VALUE\s0\fR'.  \s-1PARAM\s0 is the
7463 parameter of `\fBset\fR' command, and \s-1VALUE\s0 is the value of changed
7464 parameter.
7465 .PP
7466 \&\-\- Function: void tsv_created (const struct trace_state_variable *TSV)
7467 The new trace state variable \s-1TSV\s0 is created.
7468 .PP
7469 \&\-\- Function: void tsv_deleted (const struct trace_state_variable *TSV)
7470 The trace state variable \s-1TSV\s0 is deleted.  If \s-1TSV\s0 is `\fB\s-1NULL\s0\fR', all
7471 trace state variables are deleted.
7472 .PP
7473 \&\-\- Function: void tsv_modified (const struct trace_state_variable *TSV)
7474 The trace state value \s-1TSV\s0 is modified.
7475 .PP
7476 \&\-\- Function: void test_notification (int \s-1SOMEARG\s0)
7477 This observer is used for internal testing.  Do not use.  See
7478 testsuite/gdb.gdb/observer.exp.
7479 .SS "Appendix B \s-1GNU\s0 Free Documentation License"
7480 .IX Subsection "Appendix B GNU Free Documentation License"
7481 Version 1.3, 3 November 2008
7482 .PP
7483 Copyright (C) 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc.
7484 `\fBhttp://fsf.org/\fR'
7485 .PP
7486 Everyone is permitted to copy and distribute verbatim copies
7487 of this license document, but changing it is not allowed.
7488 .PP
7489 0. \s-1PREAMBLE\s0
7490 .PP
7491 The purpose of this License is to make a manual, textbook, or other
7492 functional and useful document \*(L"free\*(R" in the sense of freedom: to
7493 assure everyone the effective freedom to copy and redistribute it,
7494 with or without modifying it, either commercially or
7495 noncommercially.  Secondarily, this License preserves for the
7496 author and publisher a way to get credit for their work, while not
7497 being considered responsible for modifications made by others.
7498 .PP
7499 This License is a kind of \*(L"copyleft\*(R", which means that derivative
7500 works of the document must themselves be free in the same sense.
7501 It complements the \s-1GNU\s0 General Public License, which is a copyleft
7502 license designed for free software.
7503 .PP
7504 We have designed this License in order to use it for manuals for
7505 free software, because free software needs free documentation: a
7506 free program should come with manuals providing the same freedoms
7507 that the software does.  But this License is not limited to
7508 software manuals; it can be used for any textual work, regardless
7509 of subject matter or whether it is published as a printed book.
7510 We recommend this License principally for works whose purpose is
7511 instruction or reference.
7512 .PP
7513 1. \s-1APPLICABILITY AND DEFINITIONS\s0
7514 .PP
7515 This License applies to any manual or other work, in any medium,
7516 that contains a notice placed by the copyright holder saying it
7517 can be distributed under the terms of this License.  Such a notice
7518 grants a world-wide, royalty-free license, unlimited in duration,
7519 to use that work under the conditions stated herein.  The
7520 \&\*(L"Document\*(R", below, refers to any such manual or work.  Any member
7521 of the public is a licensee, and is addressed as \*(L"you\*(R".  You
7522 accept the license if you copy, modify or distribute the work in a
7523 way requiring permission under copyright law.
7524 .PP
7525 A \*(L"Modified Version\*(R" of the Document means any work containing the
7526 Document or a portion of it, either copied verbatim, or with
7527 modifications and/or translated into another language.
7528 .PP
7529 A \*(L"Secondary Section\*(R" is a named appendix or a front-matter section
7530 of the Document that deals exclusively with the relationship of the
7531 publishers or authors of the Document to the Document's overall
7532 subject (or to related matters) and contains nothing that could
7533 fall directly within that overall subject.  (Thus, if the Document
7534 is in part a textbook of mathematics, a Secondary Section may not
7535 explain any mathematics.)  The relationship could be a matter of
7536 historical connection with the subject or with related matters, or
7537 of legal, commercial, philosophical, ethical or political position
7538 regarding them.
7539 .PP
7540 The \*(L"Invariant Sections\*(R" are certain Secondary Sections whose
7541 titles are designated, as being those of Invariant Sections, in
7542 the notice that says that the Document is released under this
7543 License.  If a section does not fit the above definition of
7544 Secondary then it is not allowed to be designated as Invariant.
7545 The Document may contain zero Invariant Sections.  If the Document
7546 does not identify any Invariant Sections then there are none.
7547 .PP
7548 The \*(L"Cover Texts\*(R" are certain short passages of text that are
7549 listed, as Front-Cover Texts or Back-Cover Texts, in the notice
7550 that says that the Document is released under this License.  A
7551 Front-Cover Text may be at most 5 words, and a Back-Cover Text may
7552 be at most 25 words.
7553 .PP
7554 A \*(L"Transparent\*(R" copy of the Document means a machine-readable copy,
7555 represented in a format whose specification is available to the
7556 general public, that is suitable for revising the document
7557 straightforwardly with generic text editors or (for images
7558 composed of pixels) generic paint programs or (for drawings) some
7559 widely available drawing editor, and that is suitable for input to
7560 text formatters or for automatic translation to a variety of
7561 formats suitable for input to text formatters.  A copy made in an
7562 otherwise Transparent file format whose markup, or absence of
7563 markup, has been arranged to thwart or discourage subsequent
7564 modification by readers is not Transparent.  An image format is
7565 not Transparent if used for any substantial amount of text.  A
7566 copy that is not \*(L"Transparent\*(R" is called \*(L"Opaque\*(R".
7567 .PP
7568 Examples of suitable formats for Transparent copies include plain
7569 \&\s-1ASCII\s0 without markup, Texinfo input format, LaTeX input format,
7570 \&\s-1SGML\s0 or \s-1XML\s0 using a publicly available \s-1DTD,\s0 and
7571 standard-conforming simple \s-1HTML,\s0 PostScript or \s-1PDF\s0 designed for
7572 human modification.  Examples of transparent image formats include
7573 \&\s-1PNG, XCF\s0 and \s-1JPG. \s0 Opaque formats include proprietary formats that
7574 can be read and edited only by proprietary word processors, \s-1SGML\s0 or
7575 \&\s-1XML\s0 for which the \s-1DTD\s0 and/or processing tools are not generally
7576 available, and the machine-generated \s-1HTML,\s0 PostScript or \s-1PDF\s0
7577 produced by some word processors for output purposes only.
7578 .PP
7579 The \*(L"Title Page\*(R" means, for a printed book, the title page itself,
7580 plus such following pages as are needed to hold, legibly, the
7581 material this License requires to appear in the title page.  For
7582 works in formats which do not have any title page as such, \*(L"Title
7583 Page\*(R" means the text near the most prominent appearance of the
7584 work's title, preceding the beginning of the body of the text.
7585 .PP
7586 The \*(L"publisher\*(R" means any person or entity that distributes copies
7587 of the Document to the public.
7588 .PP
7589 A section \*(L"Entitled \s-1XYZ\*(R"\s0 means a named subunit of the Document
7590 whose title either is precisely \s-1XYZ\s0 or contains \s-1XYZ\s0 in parentheses
7591 following text that translates \s-1XYZ\s0 in another language.  (Here \s-1XYZ\s0
7592 stands for a specific section name mentioned below, such as
7593 \&\*(L"Acknowledgements\*(R", \*(L"Dedications\*(R", \*(L"Endorsements\*(R", or \*(L"History\*(R".)
7594 To \*(L"Preserve the Title\*(R" of such a section when you modify the
7595 Document means that it remains a section \*(L"Entitled \s-1XYZ\*(R"\s0 according
7596 to this definition.
7597 .PP
7598 The Document may include Warranty Disclaimers next to the notice
7599 which states that this License applies to the Document.  These
7600 Warranty Disclaimers are considered to be included by reference in
7601 this License, but only as regards disclaiming warranties: any other
7602 implication that these Warranty Disclaimers may have is void and
7603 has no effect on the meaning of this License.
7604 .PP
7605 2. \s-1VERBATIM COPYING\s0
7606 .PP
7607 You may copy and distribute the Document in any medium, either
7608 commercially or noncommercially, provided that this License, the
7609 copyright notices, and the license notice saying this License
7610 applies to the Document are reproduced in all copies, and that you
7611 add no other conditions whatsoever to those of this License.  You
7612 may not use technical measures to obstruct or control the reading
7613 or further copying of the copies you make or distribute.  However,
7614 you may accept compensation in exchange for copies.  If you
7615 distribute a large enough number of copies you must also follow
7616 the conditions in section 3.
7617 .PP
7618 You may also lend copies, under the same conditions stated above,
7619 and you may publicly display copies.
7620 .PP
7621 3. \s-1COPYING IN QUANTITY\s0
7622 .PP
7623 If you publish printed copies (or copies in media that commonly
7624 have printed covers) of the Document, numbering more than 100, and
7625 the Document's license notice requires Cover Texts, you must
7626 enclose the copies in covers that carry, clearly and legibly, all
7627 these Cover Texts: Front-Cover Texts on the front cover, and
7628 Back-Cover Texts on the back cover.  Both covers must also clearly
7629 and legibly identify you as the publisher of these copies.  The
7630 front cover must present the full title with all words of the
7631 title equally prominent and visible.  You may add other material
7632 on the covers in addition.  Copying with changes limited to the
7633 covers, as long as they preserve the title of the Document and
7634 satisfy these conditions, can be treated as verbatim copying in
7635 other respects.
7636 .PP
7637 If the required texts for either cover are too voluminous to fit
7638 legibly, you should put the first ones listed (as many as fit
7639 reasonably) on the actual cover, and continue the rest onto
7640 adjacent pages.
7641 .PP
7642 If you publish or distribute Opaque copies of the Document
7643 numbering more than 100, you must either include a
7644 machine-readable Transparent copy along with each Opaque copy, or
7645 state in or with each Opaque copy a computer-network location from
7646 which the general network-using public has access to download
7647 using public-standard network protocols a complete Transparent
7648 copy of the Document, free of added material.  If you use the
7649 latter option, you must take reasonably prudent steps, when you
7650 begin distribution of Opaque copies in quantity, to ensure that
7651 this Transparent copy will remain thus accessible at the stated
7652 location until at least one year after the last time you
7653 distribute an Opaque copy (directly or through your agents or
7654 retailers) of that edition to the public.
7655 .PP
7656 It is requested, but not required, that you contact the authors of
7657 the Document well before redistributing any large number of
7658 copies, to give them a chance to provide you with an updated
7659 version of the Document.
7660 .PP
7661 4. \s-1MODIFICATIONS\s0
7662 .PP
7663 You may copy and distribute a Modified Version of the Document
7664 under the conditions of sections 2 and 3 above, provided that you
7665 release the Modified Version under precisely this License, with
7666 the Modified Version filling the role of the Document, thus
7667 licensing distribution and modification of the Modified Version to
7668 whoever possesses a copy of it.  In addition, you must do these
7669 things in the Modified Version:
7670 .PP
7671 A. Use in the Title Page (and on the covers, if any) a title
7672 distinct from that of the Document, and from those of
7673 previous versions (which should, if there were any, be listed
7674 in the History section of the Document).  You may use the
7675 same title as a previous version if the original publisher of
7676 that version gives permission.
7677 .PP
7678 B. List on the Title Page, as authors, one or more persons or
7679 entities responsible for authorship of the modifications in
7680 the Modified Version, together with at least five of the
7681 principal authors of the Document (all of its principal
7682 authors, if it has fewer than five), unless they release you
7683 from this requirement.
7684 .PP
7685 C. State on the Title page the name of the publisher of the
7686 Modified Version, as the publisher.
7687 .PP
7688 D. Preserve all the copyright notices of the Document.
7689 .PP
7690 E. Add an appropriate copyright notice for your modifications
7691 adjacent to the other copyright notices.
7692 .PP
7693 F. Include, immediately after the copyright notices, a license
7694 notice giving the public permission to use the Modified
7695 Version under the terms of this License, in the form shown in
7696 the Addendum below.
7697 .PP
7698 G. Preserve in that license notice the full lists of Invariant
7699 Sections and required Cover Texts given in the Document's
7700 license notice.
7701 .PP
7702 H. Include an unaltered copy of this License.
7703 .PP
7704 I. Preserve the section Entitled \*(L"History\*(R", Preserve its Title,
7705 and add to it an item stating at least the title, year, new
7706 authors, and publisher of the Modified Version as given on
7707 the Title Page.  If there is no section Entitled \*(L"History\*(R" in
7708 the Document, create one stating the title, year, authors,
7709 and publisher of the Document as given on its Title Page,
7710 then add an item describing the Modified Version as stated in
7711 the previous sentence.
7712 .PP
7713 J. Preserve the network location, if any, given in the Document
7714 for public access to a Transparent copy of the Document, and
7715 likewise the network locations given in the Document for
7716 previous versions it was based on.  These may be placed in
7717 the \*(L"History\*(R" section.  You may omit a network location for a
7718 work that was published at least four years before the
7719 Document itself, or if the original publisher of the version
7720 it refers to gives permission.
7721 .PP
7722 K. For any section Entitled \*(L"Acknowledgements\*(R" or \*(L"Dedications\*(R",
7723 Preserve the Title of the section, and preserve in the
7724 section all the substance and tone of each of the contributor
7725 acknowledgements and/or dedications given therein.
7726 .PP
7727 L. Preserve all the Invariant Sections of the Document,
7728 unaltered in their text and in their titles.  Section numbers
7729 or the equivalent are not considered part of the section
7730 titles.
7731 .PP
7732 M. Delete any section Entitled \*(L"Endorsements\*(R".  Such a section
7733 may not be included in the Modified Version.
7734 .PP
7735 N. Do not retitle any existing section to be Entitled
7736 \&\*(L"Endorsements\*(R" or to conflict in title with any Invariant
7737 Section.
7738 .PP
7739 O. Preserve any Warranty Disclaimers.
7740 .PP
7741 If the Modified Version includes new front-matter sections or
7742 appendices that qualify as Secondary Sections and contain no
7743 material copied from the Document, you may at your option
7744 designate some or all of these sections as invariant.  To do this,
7745 add their titles to the list of Invariant Sections in the Modified
7746 Version's license notice.  These titles must be distinct from any
7747 other section titles.
7748 .PP
7749 You may add a section Entitled \*(L"Endorsements\*(R", provided it contains
7750 nothing but endorsements of your Modified Version by various
7751 parties\*(--for example, statements of peer review or that the text
7752 has been approved by an organization as the authoritative
7753 definition of a standard.
7754 .PP
7755 You may add a passage of up to five words as a Front-Cover Text,
7756 and a passage of up to 25 words as a Back-Cover Text, to the end
7757 of the list of Cover Texts in the Modified Version.  Only one
7758 passage of Front-Cover Text and one of Back-Cover Text may be
7759 added by (or through arrangements made by) any one entity.  If the
7760 Document already includes a cover text for the same cover,
7761 previously added by you or by arrangement made by the same entity
7762 you are acting on behalf of, you may not add another; but you may
7763 replace the old one, on explicit permission from the previous
7764 publisher that added the old one.
7765 .PP
7766 The author(s) and publisher(s) of the Document do not by this
7767 License give permission to use their names for publicity for or to
7768 assert or imply endorsement of any Modified Version.
7769 .PP
7770 5. \s-1COMBINING DOCUMENTS\s0
7771 .PP
7772 You may combine the Document with other documents released under
7773 this License, under the terms defined in section 4 above for
7774 modified versions, provided that you include in the combination
7775 all of the Invariant Sections of all of the original documents,
7776 unmodified, and list them all as Invariant Sections of your
7777 combined work in its license notice, and that you preserve all
7778 their Warranty Disclaimers.
7779 .PP
7780 The combined work need only contain one copy of this License, and
7781 multiple identical Invariant Sections may be replaced with a single
7782 copy.  If there are multiple Invariant Sections with the same name
7783 but different contents, make the title of each such section unique
7784 by adding at the end of it, in parentheses, the name of the
7785 original author or publisher of that section if known, or else a
7786 unique number.  Make the same adjustment to the section titles in
7787 the list of Invariant Sections in the license notice of the
7788 combined work.
7789 .PP
7790 In the combination, you must combine any sections Entitled
7791 \&\*(L"History\*(R" in the various original documents, forming one section
7792 Entitled \*(L"History\*(R"; likewise combine any sections Entitled
7793 \&\*(L"Acknowledgements\*(R", and any sections Entitled \*(L"Dedications\*(R".  You
7794 must delete all sections Entitled \*(L"Endorsements.\*(R"
7795 .PP
7796 6. \s-1COLLECTIONS OF DOCUMENTS\s0
7797 .PP
7798 You may make a collection consisting of the Document and other
7799 documents released under this License, and replace the individual
7800 copies of this License in the various documents with a single copy
7801 that is included in the collection, provided that you follow the
7802 rules of this License for verbatim copying of each of the
7803 documents in all other respects.
7804 .PP
7805 You may extract a single document from such a collection, and
7806 distribute it individually under this License, provided you insert
7807 a copy of this License into the extracted document, and follow
7808 this License in all other respects regarding verbatim copying of
7809 that document.
7810 .PP
7811 7. \s-1AGGREGATION WITH INDEPENDENT WORKS\s0
7812 .PP
7813 A compilation of the Document or its derivatives with other
7814 separate and independent documents or works, in or on a volume of
7815 a storage or distribution medium, is called an \*(L"aggregate\*(R" if the
7816 copyright resulting from the compilation is not used to limit the
7817 legal rights of the compilation's users beyond what the individual
7818 works permit.  When the Document is included in an aggregate, this
7819 License does not apply to the other works in the aggregate which
7820 are not themselves derivative works of the Document.
7821 .PP
7822 If the Cover Text requirement of section 3 is applicable to these
7823 copies of the Document, then if the Document is less than one half
7824 of the entire aggregate, the Document's Cover Texts may be placed
7825 on covers that bracket the Document within the aggregate, or the
7826 electronic equivalent of covers if the Document is in electronic
7827 form.  Otherwise they must appear on printed covers that bracket
7828 the whole aggregate.
7829 .PP
7830 8. \s-1TRANSLATION\s0
7831 .PP
7832 Translation is considered a kind of modification, so you may
7833 distribute translations of the Document under the terms of section
7834 4.  Replacing Invariant Sections with translations requires special
7835 permission from their copyright holders, but you may include
7836 translations of some or all Invariant Sections in addition to the
7837 original versions of these Invariant Sections.  You may include a
7838 translation of this License, and all the license notices in the
7839 Document, and any Warranty Disclaimers, provided that you also
7840 include the original English version of this License and the
7841 original versions of those notices and disclaimers.  In case of a
7842 disagreement between the translation and the original version of
7843 this License or a notice or disclaimer, the original version will
7844 prevail.
7845 .PP
7846 If a section in the Document is Entitled \*(L"Acknowledgements\*(R",
7847 \&\*(L"Dedications\*(R", or \*(L"History\*(R", the requirement (section 4) to
7848 Preserve its Title (section 1) will typically require changing the
7849 actual title.
7850 .PP
7851 9. \s-1TERMINATION\s0
7852 .PP
7853 You may not copy, modify, sublicense, or distribute the Document
7854 except as expressly provided under this License.  Any attempt
7855 otherwise to copy, modify, sublicense, or distribute it is void,
7856 and will automatically terminate your rights under this License.
7857 .PP
7858 However, if you cease all violation of this License, then your
7859 license from a particular copyright holder is reinstated (a)
7860 provisionally, unless and until the copyright holder explicitly
7861 and finally terminates your license, and (b) permanently, if the
7862 copyright holder fails to notify you of the violation by some
7863 reasonable means prior to 60 days after the cessation.
7864 .PP
7865 Moreover, your license from a particular copyright holder is
7866 reinstated permanently if the copyright holder notifies you of the
7867 violation by some reasonable means, this is the first time you have
7868 received notice of violation of this License (for any work) from
7869 that copyright holder, and you cure the violation prior to 30 days
7870 after your receipt of the notice.
7871 .PP
7872 Termination of your rights under this section does not terminate
7873 the licenses of parties who have received copies or rights from
7874 you under this License.  If your rights have been terminated and
7875 not permanently reinstated, receipt of a copy of some or all of
7876 the same material does not give you any rights to use it.
7877 .PP
7878 10. \s-1FUTURE REVISIONS OF THIS LICENSE\s0
7879 .PP
7880 The Free Software Foundation may publish new, revised versions of
7881 the \s-1GNU\s0 Free Documentation License from time to time.  Such new
7882 versions will be similar in spirit to the present version, but may
7883 differ in detail to address new problems or concerns.  See
7884 `\fBhttp://www.gnu.org/copyleft/\fR'.
7885 .PP
7886 Each version of the License is given a distinguishing version
7887 number.  If the Document specifies that a particular numbered
7888 version of this License \*(L"or any later version\*(R" applies to it, you
7889 have the option of following the terms and conditions either of
7890 that specified version or of any later version that has been
7891 published (not as a draft) by the Free Software Foundation.  If
7892 the Document does not specify a version number of this License,
7893 you may choose any version ever published (not as a draft) by the
7894 Free Software Foundation.  If the Document specifies that a proxy
7895 can decide which future versions of this License can be used, that
7896 proxy's public statement of acceptance of a version permanently
7897 authorizes you to choose that version for the Document.
7898 .PP
7899 11. \s-1RELICENSING\s0
7900 .PP
7901 \&\*(L"Massive Multiauthor Collaboration Site\*(R" (or \*(L"\s-1MMC\s0 Site\*(R") means any
7902 World Wide Web server that publishes copyrightable works and also
7903 provides prominent facilities for anybody to edit those works.  A
7904 public wiki that anybody can edit is an example of such a server.
7905 A \*(L"Massive Multiauthor Collaboration\*(R" (or \*(L"\s-1MMC\*(R"\s0) contained in the
7906 site means any set of copyrightable works thus published on the \s-1MMC\s0
7907 site.
7908 .PP
7909 \&\*(L"CC-BY-SA\*(R" means the Creative Commons Attribution-Share Alike 3.0
7910 license published by Creative Commons Corporation, a not-for-profit
7911 corporation with a principal place of business in San Francisco,
7912 California, as well as future copyleft versions of that license
7913 published by that same organization.
7914 .PP
7915 \&\*(L"Incorporate\*(R" means to publish or republish a Document, in whole or
7916 in part, as part of another Document.
7917 .PP
7918 An \s-1MMC\s0 is \*(L"eligible for relicensing\*(R" if it is licensed under this
7919 License, and if all works that were first published under this
7920 License somewhere other than this \s-1MMC,\s0 and subsequently
7921 incorporated in whole or in part into the \s-1MMC, \\fIs0\fR\|(1) had no cover
7922 texts or invariant sections, and (2) were thus incorporated prior
7923 to November 1, 2008.
7924 .PP
7925 The operator of an \s-1MMC\s0 Site may republish an \s-1MMC\s0 contained in the
7926 site under CC-BY-SA on the same site at any time before August 1,
7927 2009, provided the \s-1MMC\s0 is eligible for relicensing.
7928 .PP
7929 \&\s-1ADDENDUM:\s0 How to use this License for your documents
7930 ====================================================
7931 .PP
7932 To use this License in a document you have written, include a copy of
7933 the License in the document and put the following copyright and license
7934 notices just after the title page:
7935 .PP
7936 Copyright (C)  \s-1YEAR  YOUR NAME.\s0
7937 Permission is granted to copy, distribute and/or modify this document
7938 under the terms of the \s-1GNU\s0 Free Documentation License, Version 1.3
7939 or any later version published by the Free Software Foundation;
7940 with no Invariant Sections, no Front-Cover Texts, and no Back-Cover
7941 Texts.  A copy of the license is included in the section entitled ``\s-1GNU\s0
7942 Free Documentation License''.
7943 .PP
7944 If you have Invariant Sections, Front-Cover Texts and Back-Cover
7945 Texts, replace the \*(L"with...Texts.\*(R" line with this:
7946 .PP
7947 with the Invariant Sections being \s-1LIST THEIR TITLES,\s0 with
7948 the Front-Cover Texts being \s-1LIST,\s0 and with the Back-Cover Texts
7949 being \s-1LIST.\s0
7950 .PP
7951 If you have Invariant Sections without Cover Texts, or some other
7952 combination of the three, merge those two alternatives to suit the
7953 situation.
7954 .PP
7955 If your document contains nontrivial examples of program code, we
7956 recommend releasing these examples in parallel under your choice of
7957 free software license, such as the \s-1GNU\s0 General Public License, to
7958 permit their use in free software.
7959 .SS "Concept Index"
7960 .IX Subsection "Concept Index"
7961 \0\b[index\0\b]
7962 * Menu:
7963 .PP
7964 \&\f(CW$fp:\fR see \*(L"Register Information Functions\*(R", .
7965 .PP
7966 (line 126)
7967 \&\f(CW$pc:\fR see \*(L"Register Architecture Functions & Variables\*(R", .
7968 .PP
7969 (line  58)
7970 \&\f(CW$ps:\fR see \*(L"Register Architecture Functions & Variables\*(R", .
7971 .PP
7972 (line  69)
7973 \&\f(CW$sp:\fR see \*(L"Register Architecture Functions & Variables\*(R", .
7974 .PP
7975 (line  49)
7976 a.out format: see \*(L"Symbol Handling\*(R", .     (line 218)
7977 .PP
7978 abstract interpretation of function prologues: see \*(L"Algorithms\*(R", .  (line  48)
7979 .PP
7980 adding a new host: see \*(L"Host Definition\*(R", .     (line  13)
7981 .PP
7982 adding a symbol-reading module: see \*(L"Symbol Handling\*(R", .     (line  37)
7983 .PP
7984 adding a target: see \*(L"Adding a New Target\*(R", . (line   6)
7985 .PP
7986 adding debugging info reader: see \*(L"Symbol Handling\*(R", .     (line 365)
7987 .PP
7988 adding source language: see \*(L"Language Support\*(R", .    (line  17)
7989 .PP
7990 address classes: see \*(L"Address Classes\*(R", .     (line   6)
7991 .PP
7992 address representation: see \*(L"Pointers and Addresses\*(R", .
7993 .PP
7994 (line   6)
7995 address spaces, separate data and code: see \*(L"Pointers and Addresses\*(R", .
7996 .PP
7997 (line   6)
7998 algorithms: see \*(L"Algorithms\*(R", .          (line   6)
7999 .PP
8000 ARCH\-tdep.c: see \*(L"How an Architecture is Represented\*(R", .
8001 .PP
8002 (line  13)
8003 architecture representation: see \*(L"How an Architecture is Represented\*(R", .
8004 .PP
8005 (line   6)
8006 Array Containers: see \*(L"Support Libraries\*(R", .   (line 131)
8007 .PP
8008 assumptions about targets: see \*(L"Misc Guidelines\*(R", .     (line 334)
8009 .PP
8010 base of a frame: see \*(L"Frame Handling Terminology\*(R", .
8011 .PP
8012 (line  28)
8013 \&\s-1BFD\s0 library: see \*(L"Support Libraries\*(R", .   (line   9)
8014 .PP
8015 breakpoint address adjusted: see \*(L"Defining Other Architecture Features\*(R", .
8016 .PP
8017 (line 149)
8018 breakpoints: see \*(L"Algorithms\*(R", .          (line 151)
8019 .PP
8020 bug-gdb mailing list: see \*(L"Getting Started\*(R", .     (line  72)
8021 .PP
8022 build script: see \*(L"Debugging \s-1GDB\*(R"\s0, .       (line  94)
8023 .PP
8024 C data types: see \*(L"Coding Standards\*(R", .    (line 120)
8025 .PP
8026 call frame information: see \*(L"Algorithms\*(R", .          (line  14)
8027 .PP
8028 call stack frame: see \*(L"Stack Frames\*(R", .        (line   6)
8029 .PP
8030 calls to the inferior: see \*(L"Inferior Call Setup\*(R", . (line   6)
8031 .PP
8032 \&\s-1CFI \s0(call frame information): see \*(L"Algorithms\*(R", .          (line  14)
8033 .PP
8034 checkpoints: see \*(L"Algorithms\*(R", .          (line 600)
8035 .PP
8036 cleanups: see \*(L"Misc Guidelines\*(R", .     (line  12)
8037 .PP
8038 \&\s-1CLI:\s0 see \*(L"User Interface\*(R", .      (line  12)
8039 .PP
8040 code pointers, word-addressed: see \*(L"Pointers and Addresses\*(R", .
8041 .PP
8042 (line   6)
8043 coding standards: see \*(L"Coding Standards\*(R", .    (line   6)
8044 .PP
8045 \&\s-1COFF\s0 debugging info: see \*(L"Symbol Handling\*(R", .     (line 315)
8046 .PP
8047 \&\s-1COFF\s0 format: see \*(L"Symbol Handling\*(R", .     (line 233)
8048 .PP
8049 command implementation: see \*(L"Getting Started\*(R", .     (line  60)
8050 .PP
8051 command interpreter: see \*(L"User Interface\*(R", .      (line  12)
8052 .PP
8053 comment formatting: see \*(L"Coding Standards\*(R", .    (line  94)
8054 .PP
8055 compiler warnings: see \*(L"Misc Guidelines\*(R", .     (line 252)
8056 .PP
8057 Compressed \s-1DWARF 2\s0 debugging info: see \*(L"Symbol Handling\*(R", .     (line 335)
8058 .PP
8059 computed values: see \*(L"Values\*(R", .              (line  35)
8060 .PP
8061 configure.tgt: see \*(L"How an Architecture is Represented\*(R", .
8062 .PP
8063 (line  19)
8064 converting between pointers and addresses: see \*(L"Pointers and Addresses\*(R", .
8065 .PP
8066 (line   6)
8067 converting integers to addresses: see \*(L"Defining Other Architecture Features\*(R", .
8068 .PP
8069 (line 278)
8070 cooked register representation: see \*(L"Raw and Cooked Registers\*(R", .
8071 .PP
8072 (line   6)
8073 core files: see \*(L"Adding support for debugging core files\*(R", .
8074 .PP
8075 (line   6)
8076 D10V addresses: see \*(L"Pointers and Addresses\*(R", .
8077 .PP
8078 (line   6)
8079 data output: see \*(L"User Interface\*(R", .      (line 254)
8080 .PP
8081 data-pointer, per\-architecture/per\-module: see \*(L"Misc Guidelines\*(R", . (line 100)
8082 .PP
8083 debugging \s-1GDB:\s0 see \*(L"Debugging \s-1GDB\*(R"\s0, .       (line   6)
8084 .PP
8085 deprecating commands: see \*(L"User Interface\*(R", .      (line  32)
8086 .PP
8087 design: see \*(L"Misc Guidelines\*(R", .     (line 329)
8088 .PP
8089 \&\s-1DOS\s0 text files: see \*(L"Host Definition\*(R", .     (line  79)
8090 .PP
8091 dummy frames: see \*(L"About Dummy Frames\*(R", .  (line   6)
8092 .PP
8093 DW_AT_address_class: see \*(L"Address Classes\*(R", .     (line   6)
8094 .PP
8095 DW_AT_byte_size: see \*(L"Address Classes\*(R", .     (line   6)
8096 .PP
8097 \&\s-1DWARF 2\s0 debugging info: see \*(L"Symbol Handling\*(R", .     (line 328)
8098 .PP
8099 \&\s-1DWARF 3\s0 debugging info: see \*(L"Symbol Handling\*(R", .     (line 355)
8100 .PP
8101 \&\s-1ECOFF\s0 debugging info: see \*(L"Symbol Handling\*(R", .     (line 321)
8102 .PP
8103 \&\s-1ECOFF\s0 format: see \*(L"Symbol Handling\*(R", .     (line 248)
8104 .PP
8105 \&\s-1ELF\s0 format: see \*(L"Symbol Handling\*(R", .     (line 281)
8106 .PP
8107 execution state: see \*(L"Managing Execution State\*(R", .
8108 .PP
8109 (line   6)
8110 experimental branches: see \*(L"Versions and Branches\*(R", .
8111 .PP
8112 (line 116)
8113 expression evaluation routines: see \*(L"Language Support\*(R", .    (line  58)
8114 .PP
8115 expression parser: see \*(L"Language Support\*(R", .    (line  21)
8116 .PP
8117 field output functions: see \*(L"User Interface\*(R", .      (line 254)
8118 .PP
8119 file names, portability: see \*(L"Misc Guidelines\*(R", .     (line 367)
8120 .PP
8121 finding a symbol: see \*(L"Symbol Handling\*(R", .     (line 133)
8122 .PP
8123 fine-tuning gdbarch structure: see \*(L"\s-1OS ABI\s0 Variant Handling\*(R", .
8124 .PP
8125 (line  23)
8126 first floating point register: see \*(L"Register Architecture Functions & Variables\*(R", .
8127 .PP
8128 (line  78)
8129 frame: see \*(L"Stack Frames\*(R", .        (line   6)
8130 .PP
8131 frame \s-1ID:\s0 see \*(L"Stack Frames\*(R", .        (line  41)
8132 .PP
8133 frame pointer: see \*(L"Register Information Functions\*(R", .
8134 .PP
8135 (line 126)
8136 frame, definition of base of a frame: see \*(L"Frame Handling Terminology\*(R", .
8137 .PP
8138 (line  28)
8139 frame, definition of innermost frame: see \*(L"Frame Handling Terminology\*(R", .
8140 .PP
8141 (line  24)
8142 frame, definition of \s-1NEXT\s0 frame: see \*(L"Frame Handling Terminology\*(R", .
8143 .PP
8144 (line  11)
8145 frame, definition of \s-1PREVIOUS\s0 frame: see \*(L"Frame Handling Terminology\*(R", .
8146 .PP
8147 (line  14)
8148 frame, definition of sentinel frame: see \*(L"Frame Handling Terminology\*(R", .
8149 .PP
8150 (line  52)
8151 frame, definition of sniffing: see \*(L"Frame Handling Terminology\*(R", .
8152 .PP
8153 (line  46)
8154 frame, definition of \s-1THIS\s0 frame: see \*(L"Frame Handling Terminology\*(R", .
8155 .PP
8156 (line   9)
8157 frame, definition of unwinding: see \*(L"Frame Handling Terminology\*(R", .
8158 .PP
8159 (line  41)
8160 frame_base: see \*(L"Analyzing Stacks\-\-\-Frame Sniffers\*(R", .
8161 .PP
8162 (line  89)
8163 frame_unwind: see \*(L"Analyzing Stacks\-\-\-Frame Sniffers\*(R", .
8164 .PP
8165 (line  36)
8166 full symbol table: see \*(L"Symbol Handling\*(R", .     (line 104)
8167 .PP
8168 function prologue: see \*(L"Prologue Caches\*(R", .     (line   6)
8169 .PP
8170 function prototypes: see \*(L"Coding Standards\*(R", .    (line 153)
8171 .PP
8172 function usage: see \*(L"Coding Standards\*(R", .    (line 124)
8173 .PP
8174 fundamental types: see \*(L"Symbol Handling\*(R", .     (line 183)
8175 .PP
8176 \&\s-1GDB\s0 source tree structure: see \*(L"Overall Structure\*(R", .   (line  83)
8177 .PP
8178 gdb_byte: see \*(L"Register Caching\*(R", .    (line  23)
8179 .PP
8180 gdbarch: see \*(L"How an Architecture is Represented\*(R", .
8181 .PP
8182 (line  19)
8183 gdbarch accessor functions: see \*(L"Creating a New Architecture\*(R", .
8184 .PP
8185 (line  14)
8186 gdbarch lookup: see \*(L"Looking Up an Existing Architecture\*(R", .
8187 .PP
8188 (line   6)
8189 gdbarch register architecture functions: see \*(L"Register Architecture Functions & Variables\*(R", .
8190 .PP
8191 (line   6)
8192 gdbarch register information functions: see \*(L"Register Information Functions\*(R", .
8193 .PP
8194 (line   6)
8195 gdbarch_info: see \*(L"Looking Up an Existing Architecture\*(R", .
8196 .PP
8197 (line  22)
8198 gdbarch_tdep definition: see \*(L"Creating a New Architecture\*(R", .
8199 .PP
8200 (line  34)
8201 gdbarch_tdep when allocating new gdbarch: see \*(L"Creating a New Architecture\*(R", .
8202 .PP
8203 (line   6)
8204 generic host support: see \*(L"Host Definition\*(R", .     (line  38)
8205 .PP
8206 hardware breakpoints: see \*(L"Algorithms\*(R", .          (line 158)
8207 .PP
8208 hardware watchpoints: see \*(L"Algorithms\*(R", .          (line 280)
8209 .PP
8210 host: see \*(L"Overall Structure\*(R", .   (line  50)
8211 .PP
8212 host, adding: see \*(L"Host Definition\*(R", .     (line  13)
8213 .PP
8214 innermost frame: see \*(L"Frame Handling Terminology\*(R", .
8215 .PP
8216 (line  24)
8217 insert or remove hardware breakpoint: see \*(L"Algorithms\*(R", .          (line 234)
8218 .PP
8219 insert or remove hardware watchpoint: see \*(L"Algorithms\*(R", .          (line 347)
8220 .PP
8221 insert or remove software breakpoint: see \*(L"Algorithms\*(R", .          (line 211)
8222 .PP
8223 item output functions: see \*(L"User Interface\*(R", .      (line 254)
8224 .PP
8225 language parser: see \*(L"Language Support\*(R", .    (line  25)
8226 .PP
8227 language support: see \*(L"Language Support\*(R", .    (line   6)
8228 .PP
8229 legal papers for code contributions: see \*(L"Debugging \s-1GDB\*(R"\s0, .       (line  42)
8230 .PP
8231 libgdb: see \*(L"libgdb\*(R", .              (line  15)
8232 .PP
8233 libiberty library: see \*(L"Support Libraries\*(R", .   (line  52)
8234 .PP
8235 line wrap in output: see \*(L"Misc Guidelines\*(R", .     (line 191)
8236 .PP
8237 list output functions: see \*(L"User Interface\*(R", .      (line 131)
8238 .PP
8239 longjmp debugging: see \*(L"Algorithms\*(R", .          (line 258)
8240 .PP
8241 lookup_symbol: see \*(L"Symbol Handling\*(R", .     (line 142)
8242 .PP
8243 lval_type enumeration, for values.: see \*(L"Values\*(R", .              (line  19)
8244 .PP
8245 making a new release of gdb: see \*(L"Releasing \s-1GDB\*(R"\s0, .       (line   6)
8246 .PP
8247 memory representation: see \*(L"Register and Memory Data\*(R", .
8248 .PP
8249 (line   6)
8250 minimal symbol table: see \*(L"Symbol Handling\*(R", .     (line 111)
8251 .PP
8252 minsymtabs: see \*(L"Symbol Handling\*(R", .     (line 111)
8253 .PP
8254 multi-arch data: see \*(L"Misc Guidelines\*(R", .     (line 100)
8255 .PP
8256 native conditionals: see \*(L"Native Debugging\*(R", .    (line  75)
8257 .PP
8258 native debugging: see \*(L"Native Debugging\*(R", .    (line   6)
8259 .PP
8260 nesting level in ui_out functions: see \*(L"User Interface\*(R", .      (line 143)
8261 .PP
8262 new year procedure: see \*(L"Start of New Year Procedure\*(R", .
8263 .PP
8264 (line   6)
8265 \&\s-1NEXT\s0 frame: see \*(L"Frame Handling Terminology\*(R", .
8266 .PP
8267 (line  11)
8268 normal_stop observer: see \*(L"\s-1GDB\s0 Observers\*(R", .       (line  48)
8269 .PP
8270 notification about inferior execution stop: see \*(L"\s-1GDB\s0 Observers\*(R", .  (line  48)
8271 .PP
8272 notifications about changes in internals: see \*(L"Algorithms\*(R", .       (line 630)
8273 .PP
8274 object file formats: see \*(L"Symbol Handling\*(R", .     (line 215)
8275 .PP
8276 observer pattern interface: see \*(L"Algorithms\*(R", .          (line 630)
8277 .PP
8278 observers implementation rationale: see \*(L"\s-1GDB\s0 Observers\*(R", .       (line   9)
8279 .PP
8280 obstacks: see \*(L"Support Libraries\*(R", .   (line  69)
8281 .PP
8282 opcodes library: see \*(L"Support Libraries\*(R", .   (line  39)
8283 .PP
8284 \&\s-1OS ABI\s0 variants: see \*(L"\s-1OS ABI\s0 Variant Handling\*(R", .
8285 .PP
8286 (line   6)
8287 partial symbol table: see \*(L"Symbol Handling\*(R", .     (line 114)
8288 .PP
8289 PE-COFF format: see \*(L"Symbol Handling\*(R", .     (line 272)
8290 .PP
8291 per-architecture module data: see \*(L"Misc Guidelines\*(R", .     (line 100)
8292 .PP
8293 pointer representation: see \*(L"Pointers and Addresses\*(R", .
8294 .PP
8295 (line   6)
8296 portability: see \*(L"Misc Guidelines\*(R", .     (line 350)
8297 .PP
8298 portable file name handling: see \*(L"Misc Guidelines\*(R", .     (line 367)
8299 .PP
8300 porting to new machines: see \*(L"Porting \s-1GDB\*(R"\s0, .         (line   6)
8301 .PP
8302 \&\s-1PREVIOUS\s0 frame: see \*(L"Frame Handling Terminology\*(R", .
8303 .PP
8304 (line  14)
8305 processor status register: see \*(L"Register Architecture Functions & Variables\*(R", .
8306 .PP
8307 (line  69)
8308 program counter <1>: see \*(L"Algorithms\*(R", .          (line 158)
8309 .PP
8310 program counter: see \*(L"Register Architecture Functions & Variables\*(R", .
8311 .PP
8312 (line  58)
8313 prologue analysis: see \*(L"Algorithms\*(R", .          (line  14)
8314 .PP
8315 prologue cache: see \*(L"Prologue Caches\*(R", .     (line  12)
8316 .PP
8317 prologue of a function: see \*(L"Prologue Caches\*(R", .     (line   6)
8318 .PP
8319 prologue\-value.c: see \*(L"Algorithms\*(R", .          (line  48)
8320 .PP
8321 prompt: see \*(L"Host Definition\*(R", .     (line  86)
8322 .PP
8323 pseudo-evaluation of function prologues: see \*(L"Algorithms\*(R", .        (line  48)
8324 .PP
8325 psymtabs: see \*(L"Symbol Handling\*(R", .     (line 107)
8326 .PP
8327 raw register representation: see \*(L"Raw and Cooked Registers\*(R", .
8328 .PP
8329 (line   6)
8330 reading of symbols: see \*(L"Symbol Handling\*(R", .     (line  25)
8331 .PP
8332 readline library: see \*(L"Support Libraries\*(R", .   (line  45)
8333 .PP
8334 register caching: see \*(L"Register Caching\*(R", .    (line   6)
8335 .PP
8336 register data formats, converting: see \*(L"Register and Memory Data\*(R", .
8337 .PP
8338 (line   6)
8339 register representation: see \*(L"Register and Memory Data\*(R", .
8340 .PP
8341 (line   6)
8342 regular expressions library: see \*(L"Support Libraries\*(R", .   (line 110)
8343 .PP
8344 Release Branches: see \*(L"Versions and Branches\*(R", .
8345 .PP
8346 (line  93)
8347 remote debugging support: see \*(L"Host Definition\*(R", .     (line  41)
8348 .PP
8349 representation of architecture: see \*(L"How an Architecture is Represented\*(R", .
8350 .PP
8351 (line   6)
8352 representations, raw and cooked registers: see \*(L"Raw and Cooked Registers\*(R", .
8353 .PP
8354 (line   6)
8355 representations, register and memory: see \*(L"Register and Memory Data\*(R", .
8356 .PP
8357 (line   6)
8358 requirements for \s-1GDB:\s0 see \*(L"Requirements\*(R", .        (line   6)
8359 .PP
8360 restart: see \*(L"Algorithms\*(R", .          (line 600)
8361 .PP
8362 running the test suite: see \*(L"Testsuite\*(R", .           (line  19)
8363 .PP
8364 secondary symbol file: see \*(L"Symbol Handling\*(R", .     (line  47)
8365 .PP
8366 sentinel frame <1>: see \*(L"Frame Handling Terminology\*(R", .
8367 .PP
8368 (line  52)
8369 sentinel frame: see \*(L"Stack Frames\*(R", .        (line  22)
8370 .PP
8371 separate data and code address spaces: see \*(L"Pointers and Addresses\*(R", .
8372 .PP
8373 (line   6)
8374 serial line support: see \*(L"Host Definition\*(R", .     (line  41)
8375 .PP
8376 set_gdbarch functions: see \*(L"Creating a New Architecture\*(R", .
8377 .PP
8378 (line  14)
8379 sniffing: see \*(L"Frame Handling Terminology\*(R", .
8380 .PP
8381 (line  46)
8382 software breakpoints: see \*(L"Algorithms\*(R", .          (line 184)
8383 .PP
8384 software watchpoints: see \*(L"Algorithms\*(R", .          (line 280)
8385 .PP
8386 \&\s-1SOM\s0 debugging info: see \*(L"Symbol Handling\*(R", .     (line 360)
8387 .PP
8388 \&\s-1SOM\s0 format: see \*(L"Symbol Handling\*(R", .     (line 291)
8389 .PP
8390 source code formatting: see \*(L"Coding Standards\*(R", .    (line  28)
8391 .PP
8392 spaces, separate data and code address: see \*(L"Pointers and Addresses\*(R", .
8393 .PP
8394 (line   6)
8395 stabs debugging info: see \*(L"Symbol Handling\*(R", .     (line 305)
8396 .PP
8397 stack frame, definition of base of a frame: see \*(L"Frame Handling Terminology\*(R", .
8398 .PP
8399 (line  28)
8400 stack frame, definition of innermost frame: see \*(L"Frame Handling Terminology\*(R", .
8401 .PP
8402 (line  24)
8403 stack frame, definition of \s-1NEXT\s0 frame: see \*(L"Frame Handling Terminology\*(R", .
8404 .PP
8405 (line  11)
8406 stack frame, definition of \s-1PREVIOUS\s0 frame: see \*(L"Frame Handling Terminology\*(R", .
8407 .PP
8408 (line  14)
8409 stack frame, definition of sentinel frame: see \*(L"Frame Handling Terminology\*(R", .
8410 .PP
8411 (line  52)
8412 stack frame, definition of sniffing: see \*(L"Frame Handling Terminology\*(R", .
8413 .PP
8414 (line  46)
8415 stack frame, definition of \s-1THIS\s0 frame: see \*(L"Frame Handling Terminology\*(R", .
8416 .PP
8417 (line   9)
8418 stack frame, definition of unwinding: see \*(L"Frame Handling Terminology\*(R", .
8419 .PP
8420 (line  41)
8421 stack pointer: see \*(L"Register Architecture Functions & Variables\*(R", .
8422 .PP
8423 (line  49)
8424 status register: see \*(L"Register Architecture Functions & Variables\*(R", .
8425 .PP
8426 (line  69)
8427 struct gdbarch creation: see \*(L"Creating a New Architecture\*(R", .
8428 .PP
8429 (line   6)
8430 struct regcache: see \*(L"Register Caching\*(R", .    (line  10)
8431 .PP
8432 struct value, converting register contents to: see \*(L"Register and Memory Data\*(R", .
8433 .PP
8434 (line   6)
8435 submitting patches: see \*(L"Debugging \s-1GDB\*(R"\s0, .       (line  30)
8436 .PP
8437 sym_fns structure: see \*(L"Symbol Handling\*(R", .     (line  37)
8438 .PP
8439 symbol files: see \*(L"Symbol Handling\*(R", .     (line  25)
8440 .PP
8441 symbol lookup: see \*(L"Symbol Handling\*(R", .     (line 133)
8442 .PP
8443 symbol reading: see \*(L"Symbol Handling\*(R", .     (line  25)
8444 .PP
8445 symtabs: see \*(L"Symbol Handling\*(R", .     (line 104)
8446 .PP
8447 system dependencies: see \*(L"Misc Guidelines\*(R", .     (line 354)
8448 .PP
8449 table output functions: see \*(L"User Interface\*(R", .      (line 131)
8450 .PP
8451 target: see \*(L"Overall Structure\*(R", .   (line  50)
8452 .PP
8453 target architecture definition: see \*(L"Target Architecture Definition\*(R", .
8454 .PP
8455 (line   6)
8456 target dependent files: see \*(L"Adding a New Target\*(R", . (line   8)
8457 .PP
8458 target descriptions: see \*(L"Target Descriptions\*(R", . (line   6)
8459 .PP
8460 target descriptions, adding register support: see \*(L"Adding Target Described Register Support\*(R", .
8461 .PP
8462 (line   6)
8463 target descriptions, implementation: see \*(L"Target Descriptions Implementation\*(R", .
8464 .PP
8465 (line   6)
8466 target vector: see \*(L"Target Vector Definition\*(R", .
8467 .PP
8468 (line   6)
8469 targets: see \*(L"Existing Targets\*(R", .    (line   6)
8470 .PP
8471 \&\s-1TCP\s0 remote support: see \*(L"Host Definition\*(R", .     (line  57)
8472 .PP
8473 terminal device: see \*(L"Host Definition\*(R", .     (line  89)
8474 .PP
8475 test suite: see \*(L"Testsuite\*(R", .           (line   6)
8476 .PP
8477 test suite organization: see \*(L"Testsuite\*(R", .           (line 195)
8478 .PP
8479 Testsuite Configuration: see \*(L"Testsuite\*(R", .           (line 167)
8480 .PP
8481 \&\s-1THIS\s0 frame: see \*(L"Frame Handling Terminology\*(R", .
8482 .PP
8483 (line   9)
8484 tuple output functions: see \*(L"User Interface\*(R", .      (line 131)
8485 .PP
8486 type codes: see \*(L"Symbol Handling\*(R", .     (line 191)
8487 .PP
8488 types: see \*(L"Coding Standards\*(R", .    (line 136)
8489 .PP
8490 ui_out functions: see \*(L"User Interface\*(R", .      (line  47)
8491 .PP
8492 ui_out functions, usage examples: see \*(L"User Interface\*(R", .      (line 398)
8493 .PP
8494 unwind frame: see \*(L"Stack Frames\*(R", .        (line   9)
8495 .PP
8496 unwinding: see \*(L"Frame Handling Terminology\*(R", .
8497 .PP
8498 (line  41)
8499 using ui_out functions: see \*(L"User Interface\*(R", .      (line 398)
8500 .PP
8501 value structure: see \*(L"Values\*(R", .              (line   9)
8502 .PP
8503 values: see \*(L"Values\*(R", .              (line   9)
8504 .PP
8505 \&\s-1VEC:\s0 see \*(L"Support Libraries\*(R", .   (line 131)
8506 .PP
8507 vendor branches: see \*(L"Versions and Branches\*(R", .
8508 .PP
8509 (line 108)
8510 watchpoints: see \*(L"Algorithms\*(R", .          (line 274)
8511 .PP
8512 watchpoints, on x86: see \*(L"Algorithms\*(R", .          (line 449)
8513 .PP
8514 watchpoints, with threads: see \*(L"Algorithms\*(R", .          (line 425)
8515 .PP
8516 word-addressed machines: see \*(L"Pointers and Addresses\*(R", .
8517 .PP
8518 (line   6)
8519 writing tests: see \*(L"Testsuite\*(R", .           (line 247)
8520 .PP
8521 x86 debug registers: see \*(L"Algorithms\*(R", .          (line 449)
8522 .PP
8523 \&\s-1XCOFF\s0 format: see \*(L"Symbol Handling\*(R", .     (line 256)
8524 .SS "Function and Variable Index"
8525 .IX Subsection "Function and Variable Index"
8526 \0\b[index\0\b]
8527 * Menu:
8528 .PP
8529 _initialize_ARCH_tdep <1>: see \*(L"Adding a New Target\*(R", . (line  22)
8530 .PP
8531 _initialize_ARCH_tdep: see \*(L"How an Architecture is Represented\*(R", .
8532 .PP
8533 (line  13)
8534 _initialize_language: see \*(L"Language Support\*(R", .    (line  79)
8535 .PP
8536 about_to_proceed: see \*(L"\s-1GDB\s0 Observers\*(R", .       (line 139)
8537 .PP
8538 add_cmd: see \*(L"User Interface\*(R", .      (line  21)
8539 .PP
8540 add_com: see \*(L"User Interface\*(R", .      (line  21)
8541 .PP
8542 add_setshow_cmd: see \*(L"User Interface\*(R", .      (line  26)
8543 .PP
8544 add_setshow_cmd_full: see \*(L"User Interface\*(R", .      (line  26)
8545 .PP
8546 add_symtab_fns: see \*(L"Symbol Handling\*(R", .     (line  37)
8547 .PP
8548 address_class_name_to_type_flags: see \*(L"Defining Other Architecture Features\*(R", .
8549 .PP
8550 (line  28)
8551 address_class_name_to_type_flags_p: see \*(L"Defining Other Architecture Features\*(R", .
8552 .PP
8553 (line  39)
8554 align_down: see \*(L"Functions and Variable to Analyze Frames\*(R", .
8555 .PP
8556 (line  46)
8557 align_up: see \*(L"Functions and Variable to Analyze Frames\*(R", .
8558 .PP
8559 (line  46)
8560 allocate_symtab: see \*(L"Language Support\*(R", .    (line  83)
8561 .PP
8562 architecture_changed: see \*(L"\s-1GDB\s0 Observers\*(R", .       (line 159)
8563 .PP
8564 before_prompt: see \*(L"\s-1GDB\s0 Observers\*(R", .       (line 188)
8565 .PP
8566 bfd_arch_info: see \*(L"Looking Up an Existing Architecture\*(R", .
8567 .PP
8568 (line  41)
8569 \&\s-1BIG_BREAKPOINT:\s0 see \*(L"Defining Other Architecture Features\*(R", .
8570 .PP
8571 (line 100)
8572 \&\s-1BPT_VECTOR:\s0 see \*(L"Defining Other Architecture Features\*(R", .
8573 .PP
8574 (line 538)
8575 \&\s-1BREAKPOINT:\s0 see \*(L"Defining Other Architecture Features\*(R", .
8576 .PP
8577 (line  88)
8578 breakpoint_created: see \*(L"\s-1GDB\s0 Observers\*(R", .       (line 142)
8579 .PP
8580 breakpoint_deleted: see \*(L"\s-1GDB\s0 Observers\*(R", .       (line 145)
8581 .PP
8582 breakpoint_modified: see \*(L"\s-1GDB\s0 Observers\*(R", .       (line 149)
8583 .PP
8584 command_param_changed: see \*(L"\s-1GDB\s0 Observers\*(R", .       (line 197)
8585 .PP
8586 core_addr_greaterthan: see \*(L"Functions and Variable to Analyze Frames\*(R", .
8587 .PP
8588 (line  30)
8589 core_addr_lessthan: see \*(L"Functions and Variable to Analyze Frames\*(R", .
8590 .PP
8591 (line  30)
8592 \&\s-1CRLF_SOURCE_FILES:\s0 see \*(L"Host Definition\*(R", .     (line  78)
8593 .PP
8594 current_language: see \*(L"Language Support\*(R", .    (line  75)
8595 .PP
8596 \&\s-1DEFAULT_PROMPT:\s0 see \*(L"Host Definition\*(R", .     (line  85)
8597 .PP
8598 deprecate_cmd: see \*(L"User Interface\*(R", .      (line  32)
8599 .PP
8600 \&\s-1DEPRECATED_IBM6000_TARGET:\s0 see \*(L"Defining Other Architecture Features\*(R", .
8601 .PP
8602 (line 246)
8603 \&\s-1DEV_TTY:\s0 see \*(L"Host Definition\*(R", .     (line  88)
8604 .PP
8605 \&\s-1DIRNAME_SEPARATOR:\s0 see \*(L"Misc Guidelines\*(R", .     (line 399)
8606 .PP
8607 \&\s-1DISABLE_UNSETTABLE_BREAK:\s0 see \*(L"Defining Other Architecture Features\*(R", .
8608 .PP
8609 (line 215)
8610 discard_cleanups: see \*(L"Misc Guidelines\*(R", .     (line  39)
8611 .PP
8612 do_cleanups: see \*(L"Misc Guidelines\*(R", .     (line  35)
8613 .PP
8614 evaluate_subexp: see \*(L"Language Support\*(R", .    (line  58)
8615 .PP
8616 executable_changed: see \*(L"\s-1GDB\s0 Observers\*(R", .       (line  85)
8617 .PP
8618 extract_typed_address: see \*(L"Pointers and Addresses\*(R", .
8619 .PP
8620 (line  52)
8621 \&\s-1FILENAME_CMP:\s0 see \*(L"Misc Guidelines\*(R", .     (line 393)
8622 .PP
8623 find_pc_function: see \*(L"Symbol Handling\*(R", .     (line 136)
8624 .PP
8625 find_pc_line: see \*(L"Symbol Handling\*(R", .     (line 136)
8626 .PP
8627 find_sym_fns: see \*(L"Symbol Handling\*(R", .     (line  32)
8628 .PP
8629 \&\s-1FOPEN_RB:\s0 see \*(L"Host Definition\*(R", .     (line  94)
8630 .PP
8631 fp0_regnum: see \*(L"Register Architecture Functions & Variables\*(R", .
8632 .PP
8633 (line  78)
8634 frame_align: see \*(L"Functions and Variable to Analyze Frames\*(R", .
8635 .PP
8636 (line  46)
8637 frame_base_append_sniffer: see \*(L"Analyzing Stacks\-\-\-Frame Sniffers\*(R", .
8638 .PP
8639 (line  19)
8640 frame_base_set_default: see \*(L"Analyzing Stacks\-\-\-Frame Sniffers\*(R", .
8641 .PP
8642 (line  22)
8643 frame_num_args: see \*(L"Functions to Access Frame Data\*(R", .
8644 .PP
8645 (line  43)
8646 frame_red_zone_size: see \*(L"Functions and Variable to Analyze Frames\*(R", .
8647 .PP
8648 (line  63)
8649 frame_register_unwind: see \*(L"Stack Frames\*(R", .        (line  15)
8650 .PP
8651 frame_unwind_append_sniffer: see \*(L"Analyzing Stacks\-\-\-Frame Sniffers\*(R", .
8652 .PP
8653 (line  16)
8654 frame_unwind_append_unwinder: see \*(L"Stack Frames\*(R", .        (line  30)
8655 .PP
8656 frame_unwind_got_address: see \*(L"Stack Frames\*(R", .        (line 105)
8657 .PP
8658 frame_unwind_got_constant: see \*(L"Stack Frames\*(R", .        (line 101)
8659 .PP
8660 frame_unwind_got_memory: see \*(L"Stack Frames\*(R", .        (line  98)
8661 .PP
8662 frame_unwind_got_optimized: see \*(L"Stack Frames\*(R", .        (line  90)
8663 .PP
8664 frame_unwind_got_register: see \*(L"Stack Frames\*(R", .        (line  93)
8665 .PP
8666 frame_unwind_prepend_unwinder: see \*(L"Stack Frames\*(R", .        (line  30)
8667 .PP
8668 \&\s-1GCC2_COMPILED_FLAG_SYMBOL:\s0 see \*(L"Defining Other Architecture Features\*(R", .
8669 .PP
8670 (line 229)
8671 \&\s-1GCC_COMPILED_FLAG_SYMBOL:\s0 see \*(L"Defining Other Architecture Features\*(R", .
8672 .PP
8673 (line 229)
8674 gdb_datadir_changed: see \*(L"\s-1GDB\s0 Observers\*(R", .       (line 192)
8675 .PP
8676 \&\s-1GDB_OSABI_AIX:\s0 see \*(L"\s-1OS ABI\s0 Variant Handling\*(R", .
8677 .PP
8678 (line  90)
8679 \&\s-1GDB_OSABI_CYGWIN:\s0 see \*(L"\s-1OS ABI\s0 Variant Handling\*(R", .
8680 .PP
8681 (line  87)
8682 \&\s-1GDB_OSABI_FREEBSD_AOUT:\s0 see \*(L"\s-1OS ABI\s0 Variant Handling\*(R", .
8683 .PP
8684 (line  51)
8685 \&\s-1GDB_OSABI_FREEBSD_ELF:\s0 see \*(L"\s-1OS ABI\s0 Variant Handling\*(R", .
8686 .PP
8687 (line  54)
8688 \&\s-1GDB_OSABI_GO32:\s0 see \*(L"\s-1OS ABI\s0 Variant Handling\*(R", .
8689 .PP
8690 (line  69)
8691 \&\s-1GDB_OSABI_HPUX_ELF:\s0 see \*(L"\s-1OS ABI\s0 Variant Handling\*(R", .
8692 .PP
8693 (line  78)
8694 \&\s-1GDB_OSABI_HPUX_SOM:\s0 see \*(L"\s-1OS ABI\s0 Variant Handling\*(R", .
8695 .PP
8696 (line  81)
8697 \&\s-1GDB_OSABI_HURD:\s0 see \*(L"\s-1OS ABI\s0 Variant Handling\*(R", .
8698 .PP
8699 (line  39)
8700 \&\s-1GDB_OSABI_INTERIX:\s0 see \*(L"\s-1OS ABI\s0 Variant Handling\*(R", .
8701 .PP
8702 (line  75)
8703 \&\s-1GDB_OSABI_IRIX:\s0 see \*(L"\s-1OS ABI\s0 Variant Handling\*(R", .
8704 .PP
8705 (line  72)
8706 \&\s-1GDB_OSABI_LINUX:\s0 see \*(L"\s-1OS ABI\s0 Variant Handling\*(R", .
8707 .PP
8708 (line  48)
8709 \&\s-1GDB_OSABI_NETBSD_AOUT:\s0 see \*(L"\s-1OS ABI\s0 Variant Handling\*(R", .
8710 .PP
8711 (line  57)
8712 \&\s-1GDB_OSABI_NETBSD_ELF:\s0 see \*(L"\s-1OS ABI\s0 Variant Handling\*(R", .
8713 .PP
8714 (line  60)
8715 \&\s-1GDB_OSABI_OPENBSD_ELF:\s0 see \*(L"\s-1OS ABI\s0 Variant Handling\*(R", .
8716 .PP
8717 (line  63)
8718 \&\s-1GDB_OSABI_OSF1:\s0 see \*(L"\s-1OS ABI\s0 Variant Handling\*(R", .
8719 .PP
8720 (line  45)
8721 \&\s-1GDB_OSABI_QNXNTO:\s0 see \*(L"\s-1OS ABI\s0 Variant Handling\*(R", .
8722 .PP
8723 (line  84)
8724 \&\s-1GDB_OSABI_SOLARIS:\s0 see \*(L"\s-1OS ABI\s0 Variant Handling\*(R", .
8725 .PP
8726 (line  42)
8727 \&\s-1GDB_OSABI_SVR4:\s0 see \*(L"\s-1OS ABI\s0 Variant Handling\*(R", .
8728 .PP
8729 (line  36)
8730 \&\s-1GDB_OSABI_UNINITIALIZED:\s0 see \*(L"\s-1OS ABI\s0 Variant Handling\*(R", .
8731 .PP
8732 (line  29)
8733 \&\s-1GDB_OSABI_UNKNOWN:\s0 see \*(L"\s-1OS ABI\s0 Variant Handling\*(R", .
8734 .PP
8735 (line  32)
8736 \&\s-1GDB_OSABI_WINCE:\s0 see \*(L"\s-1OS ABI\s0 Variant Handling\*(R", .
8737 .PP
8738 (line  66)
8739 gdbarch_addr_bits_remove: see \*(L"Defining Other Architecture Features\*(R", .
8740 .PP
8741 (line  11)
8742 gdbarch_address_class_name_to_type_flags: see \*(L"Address Classes\*(R", .  (line  30)
8743 .PP
8744 gdbarch_address_class_type_flags <1>: see \*(L"Address Classes\*(R", .     (line  18)
8745 .PP
8746 gdbarch_address_class_type_flags: see \*(L"Defining Other Architecture Features\*(R", .
8747 .PP
8748 (line  43)
8749 gdbarch_address_class_type_flags_p: see \*(L"Defining Other Architecture Features\*(R", .
8750 .PP
8751 (line  52)
8752 gdbarch_address_class_type_flags_to_name <1>: see \*(L"Address Classes\*(R", .
8753 .PP
8754 (line  25)
8755 gdbarch_address_class_type_flags_to_name: see \*(L"Defining Other Architecture Features\*(R", .
8756 .PP
8757 (line  56)
8758 gdbarch_address_class_type_flags_to_name_p: see \*(L"Defining Other Architecture Features\*(R", .
8759 .PP
8760 (line  60)
8761 gdbarch_address_to_pointer <1>: see \*(L"Defining Other Architecture Features\*(R", .
8762 .PP
8763 (line  65)
8764 gdbarch_address_to_pointer: see \*(L"Pointers and Addresses\*(R", .
8765 .PP
8766 (line 114)
8767 gdbarch_adjust_breakpoint_address: see \*(L"Defining Other Architecture Features\*(R", .
8768 .PP
8769 (line 149)
8770 gdbarch_alloc: see \*(L"Creating a New Architecture\*(R", .
8771 .PP
8772 (line   6)
8773 gdbarch_believe_pcc_promotion: see \*(L"Defining Other Architecture Features\*(R", .
8774 .PP
8775 (line  72)
8776 gdbarch_bits_big_endian: see \*(L"Defining Other Architecture Features\*(R", .
8777 .PP
8778 (line  77)
8779 gdbarch_breakpoint_from_pc: see \*(L"Defining Other Architecture Features\*(R", .
8780 .PP
8781 (line 106)
8782 gdbarch_call_dummy_location: see \*(L"Defining Other Architecture Features\*(R", .
8783 .PP
8784 (line 182)
8785 gdbarch_cannot_fetch_register: see \*(L"Defining Other Architecture Features\*(R", .
8786 .PP
8787 (line 188)
8788 gdbarch_cannot_store_register: see \*(L"Defining Other Architecture Features\*(R", .
8789 .PP
8790 (line 192)
8791 gdbarch_char_signed: see \*(L"Defining Other Architecture Features\*(R", .
8792 .PP
8793 (line 463)
8794 gdbarch_convert_register_p <1>: see \*(L"Register and Memory Data\*(R", .
8795 .PP
8796 (line  30)
8797 gdbarch_convert_register_p: see \*(L"Defining Other Architecture Features\*(R", .
8798 .PP
8799 (line 199)
8800 gdbarch_data: see \*(L"Misc Guidelines\*(R", .     (line 133)
8801 .PP
8802 gdbarch_data_register_post_init: see \*(L"Misc Guidelines\*(R", .     (line 118)
8803 .PP
8804 gdbarch_data_register_pre_init: see \*(L"Misc Guidelines\*(R", .     (line 108)
8805 .PP
8806 gdbarch_decr_pc_after_break: see \*(L"Defining Other Architecture Features\*(R", .
8807 .PP
8808 (line 209)
8809 gdbarch_deprecated_fp_regnum: see \*(L"Defining Other Architecture Features\*(R", .
8810 .PP
8811 (line 452)
8812 gdbarch_double_bit: see \*(L"Defining Other Architecture Features\*(R", .
8813 .PP
8814 (line 473)
8815 gdbarch_dummy_id: see \*(L"Defining Other Architecture Features\*(R", .
8816 .PP
8817 (line 525)
8818 gdbarch_dwarf2_reg_to_regnum: see \*(L"Defining Other Architecture Features\*(R", .
8819 .PP
8820 (line 220)
8821 gdbarch_ecoff_reg_to_regnum: see \*(L"Defining Other Architecture Features\*(R", .
8822 .PP
8823 (line 224)
8824 gdbarch_float_bit: see \*(L"Defining Other Architecture Features\*(R", .
8825 .PP
8826 (line 477)
8827 gdbarch_fp0_regnum: see \*(L"Defining Other Architecture Features\*(R", .
8828 .PP
8829 (line 204)
8830 gdbarch_get_longjmp_target <1>: see \*(L"Defining Other Architecture Features\*(R", .
8831 .PP
8832 (line 235)
8833 gdbarch_get_longjmp_target: see \*(L"Algorithms\*(R", .          (line 263)
8834 .PP
8835 gdbarch_have_nonsteppable_watchpoint: see \*(L"Algorithms\*(R", .          (line 396)
8836 .PP
8837 gdbarch_in_function_epilogue_p: see \*(L"Defining Other Architecture Features\*(R", .
8838 .PP
8839 (line 257)
8840 gdbarch_in_solib_return_trampoline: see \*(L"Defining Other Architecture Features\*(R", .
8841 .PP
8842 (line 263)
8843 gdbarch_init_osabi: see \*(L"\s-1OS ABI\s0 Variant Handling\*(R", .
8844 .PP
8845 (line 125)
8846 gdbarch_int_bit: see \*(L"Defining Other Architecture Features\*(R", .
8847 .PP
8848 (line 480)
8849 gdbarch_integer_to_address: see \*(L"Defining Other Architecture Features\*(R", .
8850 .PP
8851 (line 278)
8852 gdbarch_list_lookup_by_info: see \*(L"Looking Up an Existing Architecture\*(R", .
8853 .PP
8854 (line  22)
8855 gdbarch_long_bit: see \*(L"Defining Other Architecture Features\*(R", .
8856 .PP
8857 (line 483)
8858 gdbarch_long_double_bit: see \*(L"Defining Other Architecture Features\*(R", .
8859 .PP
8860 (line 487)
8861 gdbarch_long_long_bit: see \*(L"Defining Other Architecture Features\*(R", .
8862 .PP
8863 (line 491)
8864 gdbarch_lookup_osabi: see \*(L"\s-1OS ABI\s0 Variant Handling\*(R", .
8865 .PP
8866 (line 119)
8867 gdbarch_memory_insert_breakpoint: see \*(L"Defining Other Architecture Features\*(R", .
8868 .PP
8869 (line 134)
8870 gdbarch_memory_remove_breakpoint: see \*(L"Defining Other Architecture Features\*(R", .
8871 .PP
8872 (line 134)
8873 gdbarch_osabi_name: see \*(L"\s-1OS ABI\s0 Variant Handling\*(R", .
8874 .PP
8875 (line  97)
8876 gdbarch_pointer_to_address <1>: see \*(L"Pointers and Addresses\*(R", .
8877 .PP
8878 (line 105)
8879 gdbarch_pointer_to_address: see \*(L"Defining Other Architecture Features\*(R", .
8880 .PP
8881 (line 299)
8882 gdbarch_print_insn: see \*(L"Defining Other Architecture Features\*(R", .
8883 .PP
8884 (line 515)
8885 gdbarch_ptr_bit: see \*(L"Defining Other Architecture Features\*(R", .
8886 .PP
8887 (line 495)
8888 gdbarch_push_dummy_call: see \*(L"Defining Other Architecture Features\*(R", .
8889 .PP
8890 (line 367)
8891 gdbarch_push_dummy_code: see \*(L"Defining Other Architecture Features\*(R", .
8892 .PP
8893 (line 379)
8894 gdbarch_register <1>: see \*(L"How an Architecture is Represented\*(R", .
8895 .PP
8896 (line  19)
8897 gdbarch_register: see \*(L"Adding a New Target\*(R", . (line  40)
8898 .PP
8899 gdbarch_register_osabi: see \*(L"\s-1OS ABI\s0 Variant Handling\*(R", .
8900 .PP
8901 (line 103)
8902 gdbarch_register_osabi_sniffer: see \*(L"\s-1OS ABI\s0 Variant Handling\*(R", .
8903 .PP
8904 (line 112)
8905 gdbarch_register_to_value <1>: see \*(L"Register and Memory Data\*(R", .
8906 .PP
8907 (line  46)
8908 gdbarch_register_to_value: see \*(L"Defining Other Architecture Features\*(R", .
8909 .PP
8910 (line 305)
8911 gdbarch_return_value: see \*(L"Defining Other Architecture Features\*(R", .
8912 .PP
8913 (line 400)
8914 gdbarch_sdb_reg_to_regnum: see \*(L"Defining Other Architecture Features\*(R", .
8915 .PP
8916 (line 396)
8917 gdbarch_short_bit: see \*(L"Defining Other Architecture Features\*(R", .
8918 .PP
8919 (line 499)
8920 gdbarch_skip_permanent_breakpoint: see \*(L"Defining Other Architecture Features\*(R", .
8921 .PP
8922 (line 436)
8923 gdbarch_skip_trampoline_code: see \*(L"Defining Other Architecture Features\*(R", .
8924 .PP
8925 (line 447)
8926 gdbarch_stab_reg_to_regnum: see \*(L"Defining Other Architecture Features\*(R", .
8927 .PP
8928 (line 456)
8929 gdbarch_stabs_argument_has_addr: see \*(L"Defining Other Architecture Features\*(R", .
8930 .PP
8931 (line 363)
8932 gdbarch_value_to_register <1>: see \*(L"Defining Other Architecture Features\*(R", .
8933 .PP
8934 (line 531)
8935 gdbarch_value_to_register: see \*(L"Register and Memory Data\*(R", .
8936 .PP
8937 (line  62)
8938 gdbarch_virtual_frame_pointer: see \*(L"Defining Other Architecture Features\*(R", .
8939 .PP
8940 (line 503)
8941 \&\s-1GDBINIT_FILENAME:\s0 see \*(L"Host Definition\*(R", .     (line  74)
8942 .PP
8943 generic_elf_osabi_sniff_abi_tag_sections: see \*(L"\s-1OS ABI\s0 Variant Handling\*(R", .
8944 .PP
8945 (line 133)
8946 get_frame_register: see \*(L"Stack Frames\*(R", .        (line  15)
8947 .PP
8948 get_frame_type: see \*(L"Stack Frames\*(R", .        (line  22)
8949 .PP
8950 \&\s-1HAVE_CONTINUABLE_WATCHPOINT:\s0 see \*(L"Algorithms\*(R", .          (line 402)
8951 .PP
8952 \&\s-1HAVE_DOS_BASED_FILE_SYSTEM:\s0 see \*(L"Misc Guidelines\*(R", .     (line 376)
8953 .PP
8954 \&\s-1HAVE_STEPPABLE_WATCHPOINT:\s0 see \*(L"Algorithms\*(R", .          (line 386)
8955 .PP
8956 i386_cleanup_dregs: see \*(L"Algorithms\*(R", .          (line 576)
8957 .PP
8958 I386_DR_LOW_GET_STATUS: see \*(L"Algorithms\*(R", .          (line 489)
8959 .PP
8960 I386_DR_LOW_RESET_ADDR: see \*(L"Algorithms\*(R", .          (line 485)
8961 .PP
8962 I386_DR_LOW_SET_ADDR: see \*(L"Algorithms\*(R", .          (line 482)
8963 .PP
8964 I386_DR_LOW_SET_CONTROL: see \*(L"Algorithms\*(R", .          (line 479)
8965 .PP
8966 i386_insert_hw_breakpoint: see \*(L"Algorithms\*(R", .          (line 564)
8967 .PP
8968 i386_insert_watchpoint: see \*(L"Algorithms\*(R", .          (line 536)
8969 .PP
8970 i386_region_ok_for_watchpoint: see \*(L"Algorithms\*(R", .          (line 514)
8971 .PP
8972 i386_remove_hw_breakpoint: see \*(L"Algorithms\*(R", .          (line 564)
8973 .PP
8974 i386_remove_watchpoint: see \*(L"Algorithms\*(R", .          (line 536)
8975 .PP
8976 i386_stopped_by_watchpoint: see \*(L"Algorithms\*(R", .          (line 528)
8977 .PP
8978 i386_stopped_data_address: see \*(L"Algorithms\*(R", .          (line 521)
8979 .PP
8980 I386_USE_GENERIC_WATCHPOINTS: see \*(L"Algorithms\*(R", .          (line 461)
8981 .PP
8982 in_dynsym_resolve_code: see \*(L"Defining Other Architecture Features\*(R", .
8983 .PP
8984 (line 267)
8985 inferior_added: see \*(L"\s-1GDB\s0 Observers\*(R", .       (line 168)
8986 .PP
8987 inferior_appeared: see \*(L"\s-1GDB\s0 Observers\*(R", .       (line 172)
8988 .PP
8989 inferior_created: see \*(L"\s-1GDB\s0 Observers\*(R", .       (line  92)
8990 .PP
8991 inferior_exit: see \*(L"\s-1GDB\s0 Observers\*(R", .       (line 175)
8992 .PP
8993 inferior_removed: see \*(L"\s-1GDB\s0 Observers\*(R", .       (line 179)
8994 .PP
8995 inner_than: see \*(L"Functions and Variable to Analyze Frames\*(R", .
8996 .PP
8997 (line  30)
8998 \&\s-1IS_ABSOLUTE_PATH:\s0 see \*(L"Misc Guidelines\*(R", .     (line 387)
8999 .PP
9000 \&\s-1IS_DIR_SEPARATOR:\s0 see \*(L"Misc Guidelines\*(R", .     (line 382)
9001 .PP
9002 \&\s-1ISATTY:\s0 see \*(L"Host Definition\*(R", .     (line  91)
9003 .PP
9004 length_of_subexp: see \*(L"Language Support\*(R", .    (line  58)
9005 .PP
9006 lint: see \*(L"Host Definition\*(R", .     (line 107)
9007 .PP
9008 \&\s-1LITTLE_BREAKPOINT:\s0 see \*(L"Defining Other Architecture Features\*(R", .
9009 .PP
9010 (line 100)
9011 \&\s-1LSEEK_NOT_LINEAR:\s0 see \*(L"Host Definition\*(R", .     (line 102)
9012 .PP
9013 make_cleanup: see \*(L"Misc Guidelines\*(R", .     (line  28)
9014 .PP
9015 make_cleanup_ui_out_list_begin_end: see \*(L"User Interface\*(R", .      (line 247)
9016 .PP
9017 make_cleanup_ui_out_tuple_begin_end: see \*(L"User Interface\*(R", .      (line 223)
9018 .PP
9019 memory_changed: see \*(L"\s-1GDB\s0 Observers\*(R", .       (line 184)
9020 .PP
9021 \&\s-1NATDEPFILES:\s0 see \*(L"Native Debugging\*(R", .    (line   8)
9022 .PP
9023 new_objfile: see \*(L"\s-1GDB\s0 Observers\*(R", .       (line 115)
9024 .PP
9025 new_thread: see \*(L"\s-1GDB\s0 Observers\*(R", .       (line 120)
9026 .PP
9027 normal_stop: see \*(L"\s-1GDB\s0 Observers\*(R", .       (line  76)
9028 .PP
9029 op_print_tab: see \*(L"Language Support\*(R", .    (line  91)
9030 .PP
9031 parse_exp_1: see \*(L"Language Support\*(R", .    (line  97)
9032 .PP
9033 pc_regnum: see \*(L"Register Architecture Functions & Variables\*(R", .
9034 .PP
9035 (line  58)
9036 prefixify_subexp: see \*(L"Language Support\*(R", .    (line  58)
9037 .PP
9038 print_float_info: see \*(L"Register Information Functions\*(R", .
9039 .PP
9040 (line  80)
9041 print_registers_info: see \*(L"Register Information Functions\*(R", .
9042 .PP
9043 (line  53)
9044 print_subexp: see \*(L"Language Support\*(R", .    (line  91)
9045 .PP
9046 print_vector_info: see \*(L"Register Information Functions\*(R", .
9047 .PP
9048 (line  96)
9049 \&\s-1PRINTF_HAS_LONG_LONG:\s0 see \*(L"Host Definition\*(R", .     (line  97)
9050 .PP
9051 ps_regnum: see \*(L"Register Architecture Functions & Variables\*(R", .
9052 .PP
9053 (line  69)
9054 pseudo_register_read: see \*(L"Register Architecture Functions & Variables\*(R", .
9055 .PP
9056 (line  29)
9057 pseudo_register_write: see \*(L"Register Architecture Functions & Variables\*(R", .
9058 .PP
9059 (line  33)
9060 push_dummy_call: see \*(L"Functions Creating Dummy Frames\*(R", .
9061 .PP
9062 (line  13)
9063 push_dummy_code: see \*(L"Functions Creating Dummy Frames\*(R", .
9064 .PP
9065 (line  57)
9066 read_pc: see \*(L"Register Architecture Functions & Variables\*(R", .
9067 .PP
9068 (line  10)
9069 record_changed: see \*(L"\s-1GDB\s0 Observers\*(R", .       (line 100)
9070 .PP
9071 regcache_cooked_read: see \*(L"Register Caching\*(R", .    (line  23)
9072 .PP
9073 regcache_cooked_read_signed: see \*(L"Register Caching\*(R", .    (line  23)
9074 .PP
9075 regcache_cooked_read_unsigned: see \*(L"Register Caching\*(R", .    (line  23)
9076 .PP
9077 regcache_cooked_write: see \*(L"Register Caching\*(R", .    (line  23)
9078 .PP
9079 regcache_cooked_write_signed: see \*(L"Register Caching\*(R", .    (line  23)
9080 .PP
9081 regcache_cooked_write_unsigned: see \*(L"Register Caching\*(R", .    (line  23)
9082 .PP
9083 \&\s-1REGISTER_CONVERT_TO_RAW:\s0 see \*(L"Defining Other Architecture Features\*(R", .
9084 .PP
9085 (line 315)
9086 \&\s-1REGISTER_CONVERT_TO_VIRTUAL:\s0 see \*(L"Defining Other Architecture Features\*(R", .
9087 .PP
9088 (line 310)
9089 register_name: see \*(L"Register Information Functions\*(R", .
9090 .PP
9091 (line  10)
9092 register_reggroup_p: see \*(L"Register Information Functions\*(R", .
9093 .PP
9094 (line 110)
9095 register_type: see \*(L"Register Information Functions\*(R", .
9096 .PP
9097 (line  33)
9098 regset_from_core_section: see \*(L"Defining Other Architecture Features\*(R", .
9099 .PP
9100 (line 320)
9101 \&\s-1REMOTE_BPT_VECTOR:\s0 see \*(L"Defining Other Architecture Features\*(R", .
9102 .PP
9103 (line 542)
9104 \&\s-1SENTINEL_FRAME:\s0 see \*(L"Stack Frames\*(R", .        (line  22)
9105 .PP
9106 set_gdbarch_bits_big_endian: see \*(L"Defining Other Architecture Features\*(R", .
9107 .PP
9108 (line  83)
9109 set_gdbarch_sofun_address_maybe_missing: see \*(L"Defining Other Architecture Features\*(R", .
9110 .PP
9111 (line 334)
9112 skip_prologue: see \*(L"Functions and Variable to Analyze Frames\*(R", .
9113 .PP
9114 (line  12)
9115 \&\s-1SKIP_SOLIB_RESOLVER:\s0 see \*(L"Defining Other Architecture Features\*(R", .
9116 .PP
9117 (line 271)
9118 \&\s-1SLASH_STRING:\s0 see \*(L"Misc Guidelines\*(R", .     (line 404)
9119 .PP
9120 \&\s-1SOFTWARE_SINGLE_STEP:\s0 see \*(L"Defining Other Architecture Features\*(R", .
9121 .PP
9122 (line 328)
9123 \&\s-1SOFTWARE_SINGLE_STEP_P:\s0 see \*(L"Defining Other Architecture Features\*(R", .
9124 .PP
9125 (line 324)
9126 \&\s-1SOLIB_ADD:\s0 see \*(L"Native Debugging\*(R", .    (line  86)
9127 .PP
9128 \&\s-1SOLIB_CREATE_INFERIOR_HOOK:\s0 see \*(L"Native Debugging\*(R", .    (line  92)
9129 .PP
9130 solib_loaded: see \*(L"\s-1GDB\s0 Observers\*(R", .       (line 105)
9131 .PP
9132 solib_unloaded: see \*(L"\s-1GDB\s0 Observers\*(R", .       (line 110)
9133 .PP
9134 sp_regnum: see \*(L"Register Architecture Functions & Variables\*(R", .
9135 .PP
9136 (line  49)
9137 \&\s-1START_INFERIOR_TRAPS_EXPECTED:\s0 see \*(L"Native Debugging\*(R", .    (line  96)
9138 .PP
9139 \&\s-1STOPPED_BY_WATCHPOINT:\s0 see \*(L"Algorithms\*(R", .          (line 408)
9140 .PP
9141 store_typed_address: see \*(L"Pointers and Addresses\*(R", .
9142 .PP
9143 (line  70)
9144 struct: see \*(L"\s-1GDB\s0 Observers\*(R", .       (line  62)
9145 .PP
9146 \&\s-1TARGET_CAN_USE_HARDWARE_WATCHPOINT:\s0 see \*(L"Algorithms\*(R", .          (line 333)
9147 .PP
9148 target_changed: see \*(L"\s-1GDB\s0 Observers\*(R", .       (line  82)
9149 .PP
9150 \&\s-1TARGET_CHAR_BIT:\s0 see \*(L"Defining Other Architecture Features\*(R", .
9151 .PP
9152 (line 460)
9153 target_insert_breakpoint: see \*(L"Algorithms\*(R", .          (line 211)
9154 .PP
9155 target_insert_hw_breakpoint: see \*(L"Algorithms\*(R", .          (line 234)
9156 .PP
9157 target_insert_watchpoint: see \*(L"Algorithms\*(R", .          (line 347)
9158 .PP
9159 \&\s-1TARGET_REGION_OK_FOR_HW_WATCHPOINT:\s0 see \*(L"Algorithms\*(R", .          (line 343)
9160 .PP
9161 target_remove_breakpoint: see \*(L"Algorithms\*(R", .          (line 211)
9162 .PP
9163 target_remove_hw_breakpoint: see \*(L"Algorithms\*(R", .          (line 234)
9164 .PP
9165 target_remove_watchpoint: see \*(L"Algorithms\*(R", .          (line 347)
9166 .PP
9167 target_resumed: see \*(L"\s-1GDB\s0 Observers\*(R", .       (line 135)
9168 .PP
9169 target_stopped_data_address: see \*(L"Algorithms\*(R", .          (line 364)
9170 .PP
9171 target_watchpoint_addr_within_range: see \*(L"Algorithms\*(R", .          (line 378)
9172 .PP
9173 test_notification: see \*(L"\s-1GDB\s0 Observers\*(R", .       (line 213)
9174 .PP
9175 thread_exit: see \*(L"\s-1GDB\s0 Observers\*(R", .       (line 123)
9176 .PP
9177 thread_ptid_changed: see \*(L"\s-1GDB\s0 Observers\*(R", .       (line 164)
9178 .PP
9179 thread_stop_requested: see \*(L"\s-1GDB\s0 Observers\*(R", .       (line 128)
9180 .PP
9181 traceframe_changed: see \*(L"\s-1GDB\s0 Observers\*(R", .       (line 153)
9182 .PP
9183 tsv_created: see \*(L"\s-1GDB\s0 Observers\*(R", .       (line 203)
9184 .PP
9185 tsv_deleted: see \*(L"\s-1GDB\s0 Observers\*(R", .       (line 206)
9186 .PP
9187 tsv_modified: see \*(L"\s-1GDB\s0 Observers\*(R", .       (line 210)
9188 .PP
9189 ui_out_field_core_addr: see \*(L"User Interface\*(R", .      (line 287)
9190 .PP
9191 ui_out_field_fmt: see \*(L"User Interface\*(R", .      (line 261)
9192 .PP
9193 ui_out_field_fmt_int: see \*(L"User Interface\*(R", .      (line 280)
9194 .PP
9195 ui_out_field_int: see \*(L"User Interface\*(R", .      (line 273)
9196 .PP
9197 ui_out_field_skip: see \*(L"User Interface\*(R", .      (line 352)
9198 .PP
9199 ui_out_field_stream: see \*(L"User Interface\*(R", .      (line 320)
9200 .PP
9201 ui_out_field_string: see \*(L"User Interface\*(R", .      (line 291)
9202 .PP
9203 ui_out_flush: see \*(L"User Interface\*(R", .      (line 392)
9204 .PP
9205 ui_out_list_begin: see \*(L"User Interface\*(R", .      (line 234)
9206 .PP
9207 ui_out_list_end: see \*(L"User Interface\*(R", .      (line 240)
9208 .PP
9209 ui_out_message: see \*(L"User Interface\*(R", .      (line 376)
9210 .PP
9211 ui_out_spaces: see \*(L"User Interface\*(R", .      (line 371)
9212 .PP
9213 ui_out_stream_delete: see \*(L"User Interface\*(R", .      (line 315)
9214 .PP
9215 ui_out_stream_new: see \*(L"User Interface\*(R", .      (line 309)
9216 .PP
9217 ui_out_table_begin: see \*(L"User Interface\*(R", .      (line 165)
9218 .PP
9219 ui_out_table_body: see \*(L"User Interface\*(R", .      (line 191)
9220 .PP
9221 ui_out_table_end: see \*(L"User Interface\*(R", .      (line 194)
9222 .PP
9223 ui_out_table_header: see \*(L"User Interface\*(R", .      (line 178)
9224 .PP
9225 ui_out_text: see \*(L"User Interface\*(R", .      (line 358)
9226 .PP
9227 ui_out_tuple_begin: see \*(L"User Interface\*(R", .      (line 210)
9228 .PP
9229 ui_out_tuple_end: see \*(L"User Interface\*(R", .      (line 216)
9230 .PP
9231 ui_out_wrap_hint: see \*(L"User Interface\*(R", .      (line 382)
9232 .PP
9233 unwind_dummy_id: see \*(L"Functions Creating Dummy Frames\*(R", .
9234 .PP
9235 (line  38)
9236 unwind_pc: see \*(L"Functions to Access Frame Data\*(R", .
9237 .PP
9238 (line  11)
9239 unwind_sp: see \*(L"Functions to Access Frame Data\*(R", .
9240 .PP
9241 (line  27)
9242 value_as_address: see \*(L"Pointers and Addresses\*(R", .
9243 .PP
9244 (line  84)
9245 value_from_pointer: see \*(L"Pointers and Addresses\*(R", .
9246 .PP
9247 (line  93)
9248 void: see \*(L"\s-1GDB\s0 Observers\*(R", .       (line  71)
9249 .PP
9250 volatile: see \*(L"Host Definition\*(R", .     (line 110)
9251 .PP
9252 wrap_here: see \*(L"Misc Guidelines\*(R", .     (line 191)
9253 .PP
9254 write_pc: see \*(L"Register Architecture Functions & Variables\*(R", .
9255 .PP
9256 (line  13)