Cleanups after the update to Autoconf 2.64, Automake 1.11.
[deliverable/binutils-gdb.git] / gdb / doc / gdbint.texinfo
index 85b991fa2ad3ddd8d17e38bae83b3939be33668b..6d0a22640a1d60db89bdd99fceafe2af87eab0e1 100644 (file)
@@ -6,10 +6,10 @@
 * Gdb-Internals: (gdbint).     The GNU debugger's internals.
 @end direntry
 
-@ifinfo
-This file documents the internals of the GNU debugger @value{GDBN}.
-Copyright 1990,1991,1992,1993,1994,1996,1998,1999,2000,2001,2002,2003,2004
-   Free Software Foundation, Inc.
+@copying
+Copyright @copyright{} 1990, 1991, 1992, 1993, 1994, 1996, 1998, 1999,
+2000, 2001, 2002, 2003, 2004, 2005, 2006, 2008, 2009
+Free Software Foundation, Inc.
 Contributed by Cygnus Solutions.  Written by John Gilmore.
 Second Edition by Stan Shebs.
 
@@ -19,7 +19,13 @@ any later version published by the Free Software Foundation; with no
 Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
 Texts.  A copy of the license is included in the section entitled ``GNU
 Free Documentation License''.
-@end ifinfo
+@end copying
+
+@ifnottex
+This file documents the internals of the GNU debugger @value{GDBN}.
+
+@insertcopying
+@end ifnottex
 
 @setchapternewpage off
 @settitle @value{GDBN} Internals
@@ -47,15 +53,7 @@ Free Documentation License''.
 @end tex
 
 @vskip 0pt plus 1filll
-Copyright @copyright{} 1990,1991,1992,1993,1994,1996,1998,1999,2000,2001,
-   2002, 2003, 2004  Free Software Foundation, Inc.
-
-Permission is granted to copy, distribute and/or modify this document
-under the terms of the GNU Free Documentation License, Version 1.1 or
-any later version published by the Free Software Foundation; with no
-Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
-Texts.  A copy of the license is included in the section entitled ``GNU
-Free Documentation License''.
+@insertcopying
 @end titlepage
 
 @contents
@@ -70,20 +68,25 @@ includes description of @value{GDBN}'s key algorithms and operations, as well
 as the mechanisms that adapt @value{GDBN} to specific hosts and targets.
 
 @menu
-* Requirements::
+* Summary::
 * Overall Structure::
 * Algorithms::
 * User Interface::
 * libgdb::
+* Values::
+* Stack Frames::
 * Symbol Handling::
 * Language Support::
 * Host Definition::
 * Target Architecture Definition::
+* Target Descriptions::
 * Target Vector Definition::
 * Native Debugging::
 * Support Libraries::
 * Coding::
 * Porting GDB::
+* Versions and Branches::
+* Start of New Year Procedure::
 * Releasing GDB::
 * Testsuite::
 * Hints::
@@ -93,9 +96,16 @@ as the mechanisms that adapt @value{GDBN} to specific hosts and targets.
 * Index::
 @end menu
 
-@node Requirements
+@node Summary
+@chapter Summary
+
+@menu
+* Requirements::
+* Contributors::
+@end menu
 
-@chapter Requirements
+@node Requirements
+@section Requirements
 @cindex requirements for @value{GDBN}
 
 Before diving into the internals, you should understand the formal
@@ -130,6 +140,41 @@ heard reports of programs approaching 1 gigabyte in size.
 available for even half as many configurations as @value{GDBN}
 supports.
 
+@node Contributors
+@section Contributors
+
+The first edition of this document was written by John Gilmore of
+Cygnus Solutions. The current second edition was written by Stan Shebs
+of Cygnus Solutions, who continues to update the manual.
+
+Over the years, many others have made additions and changes to this
+document. This section attempts to record the significant contributors
+to that effort. One of the virtues of free software is that everyone
+is free to contribute to it; with regret, we cannot actually
+acknowledge everyone here.
+
+@quotation
+@emph{Plea:} This section has only been added relatively recently (four
+years after publication of the second edition). Additions to this
+section are particularly welcome.  If you or your friends (or enemies,
+to be evenhanded) have been unfairly omitted from this list, we would
+like to add your names!
+@end quotation
+
+A document such as this relies on being kept up to date by numerous
+small updates by contributing engineers as they make changes to the
+code base. The file @file{ChangeLog} in the @value{GDBN} distribution
+approximates a blow-by-blow account. The most prolific contributors to
+this important, but low profile task are Andrew Cagney (responsible
+for over half the entries), Daniel Jacobowitz, Mark Kettenis, Jim
+Blandy and Eli Zaretskii.
+
+Eli Zaretskii and Daniel Jacobowitz wrote the sections documenting
+watchpoints.
+
+Jeremy Bennett updated the sections on initializing a new architecture
+and register representation, and added the section on Frame Interpretation.
+
 
 @node Overall Structure
 
@@ -185,9 +230,10 @@ way.
 executes.  In most cases they are the same machine, in which case a
 third type of @dfn{Native} attributes come into play.
 
-Defines and include files needed to build on the host are host support.
-Examples are tty support, system defined types, host byte order, host
-float format.
+Defines and include files needed to build on the host are host
+support.  Examples are tty support, system defined types, host byte
+order, host float format.  These are all calculated by @code{autoconf}
+when the debugger is built.
 
 Defines and information needed to handle the target format are target
 dependent.  Examples are the stack frame format, instruction set,
@@ -196,7 +242,7 @@ to call a function.
 
 Information that is only needed when the host and target are the same,
 is native dependent.  One example is Unix child process support; if the
-host and target are not the same, doing a fork to start the target
+host and target are not the same, calling @code{fork} to start the target
 process is a bad idea.  The various macros needed for finding the
 registers in the @code{upage}, running @code{ptrace}, and such are all
 in the native-dependent files.
@@ -206,9 +252,57 @@ are really part of the target environment, but which require
 @code{#include} files that are only available on the host system.  Core
 file handling and @code{setjmp} handling are two common cases.
 
-When you want to make @value{GDBN} work ``native'' on a particular machine, you
-have to include all three kinds of information.
+When you want to make @value{GDBN} work as the traditional native debugger
+on a system, you will need to supply both target and native information.
+
+@section Source Tree Structure
+@cindex @value{GDBN} source tree structure
+
+The @value{GDBN} source directory has a mostly flat structure---there
+are only a few subdirectories.  A file's name usually gives a hint as
+to what it does; for example, @file{stabsread.c} reads stabs,
+@file{dwarf2read.c} reads @sc{DWARF 2}, etc.
+
+Files that are related to some common task have names that share
+common substrings.  For example, @file{*-thread.c} files deal with
+debugging threads on various platforms; @file{*read.c} files deal with
+reading various kinds of symbol and object files; @file{inf*.c} files
+deal with direct control of the @dfn{inferior program} (@value{GDBN}
+parlance for the program being debugged).
+
+There are several dozens of files in the @file{*-tdep.c} family.
+@samp{tdep} stands for @dfn{target-dependent code}---each of these
+files implements debug support for a specific target architecture
+(sparc, mips, etc).  Usually, only one of these will be used in a
+specific @value{GDBN} configuration (sometimes two, closely related).
+
+Similarly, there are many @file{*-nat.c} files, each one for native
+debugging on a specific system (e.g., @file{sparc-linux-nat.c} is for
+native debugging of Sparc machines running the Linux kernel).
+
+The few subdirectories of the source tree are:
+
+@table @file
+@item cli
+Code that implements @dfn{CLI}, the @value{GDBN} Command-Line
+Interpreter.  @xref{User Interface, Command Interpreter}.
+
+@item gdbserver
+Code for the @value{GDBN} remote server.
+
+@item gdbtk
+Code for Insight, the @value{GDBN} TK-based GUI front-end.
+
+@item mi
+The @dfn{GDB/MI}, the @value{GDBN} Machine Interface interpreter.
 
+@item signals
+Target signal translation code.
+
+@item tui
+Code for @dfn{TUI}, the @value{GDBN} Text-mode full-screen User
+Interface.  @xref{User Interface, TUI}.
+@end table
 
 @node Algorithms
 
@@ -221,38 +315,174 @@ cases and real-world issues.  This chapter describes the basic
 algorithms and mentions some of the specific target definitions that
 they use.
 
-@section Frames
+@section Prologue Analysis
+
+@cindex prologue analysis
+@cindex call frame information
+@cindex CFI (call frame information)
+To produce a backtrace and allow the user to manipulate older frames'
+variables and arguments, @value{GDBN} needs to find the base addresses
+of older frames, and discover where those frames' registers have been
+saved.  Since a frame's ``callee-saves'' registers get saved by
+younger frames if and when they're reused, a frame's registers may be
+scattered unpredictably across younger frames.  This means that
+changing the value of a register-allocated variable in an older frame
+may actually entail writing to a save slot in some younger frame.
+
+Modern versions of GCC emit Dwarf call frame information (``CFI''),
+which describes how to find frame base addresses and saved registers.
+But CFI is not always available, so as a fallback @value{GDBN} uses a
+technique called @dfn{prologue analysis} to find frame sizes and saved
+registers.  A prologue analyzer disassembles the function's machine
+code starting from its entry point, and looks for instructions that
+allocate frame space, save the stack pointer in a frame pointer
+register, save registers, and so on.  Obviously, this can't be done
+accurately in general, but it's tractable to do well enough to be very
+helpful.  Prologue analysis predates the GNU toolchain's support for
+CFI; at one time, prologue analysis was the only mechanism
+@value{GDBN} used for stack unwinding at all, when the function
+calling conventions didn't specify a fixed frame layout.
+
+In the olden days, function prologues were generated by hand-written,
+target-specific code in GCC, and treated as opaque and untouchable by
+optimizers.  Looking at this code, it was usually straightforward to
+write a prologue analyzer for @value{GDBN} that would accurately
+understand all the prologues GCC would generate.  However, over time
+GCC became more aggressive about instruction scheduling, and began to
+understand more about the semantics of the prologue instructions
+themselves; in response, @value{GDBN}'s analyzers became more complex
+and fragile.  Keeping the prologue analyzers working as GCC (and the
+instruction sets themselves) evolved became a substantial task.
+
+@cindex @file{prologue-value.c}
+@cindex abstract interpretation of function prologues
+@cindex pseudo-evaluation of function prologues
+To try to address this problem, the code in @file{prologue-value.h}
+and @file{prologue-value.c} provides a general framework for writing
+prologue analyzers that are simpler and more robust than ad-hoc
+analyzers.  When we analyze a prologue using the prologue-value
+framework, we're really doing ``abstract interpretation'' or
+``pseudo-evaluation'': running the function's code in simulation, but
+using conservative approximations of the values registers and memory
+would hold when the code actually runs.  For example, if our function
+starts with the instruction:
+
+@example
+addi r1, 42     # add 42 to r1
+@end example
+@noindent
+we don't know exactly what value will be in @code{r1} after executing
+this instruction, but we do know it'll be 42 greater than its original
+value.
 
-@cindex frame
-@cindex call stack frame
-A frame is a construct that @value{GDBN} uses to keep track of calling
-and called functions.
+If we then see an instruction like:
 
-@findex create_new_frame
-@vindex FRAME_FP
-@code{FRAME_FP} in the machine description has no meaning to the
-machine-independent part of @value{GDBN}, except that it is used when
-setting up a new frame from scratch, as follows:
+@example
+addi r1, 22     # add 22 to r1
+@end example
+@noindent
+we still don't know what @code{r1's} value is, but again, we can say
+it is now 64 greater than its original value.
 
-@smallexample
-create_new_frame (read_register (DEPRECATED_FP_REGNUM), read_pc ()));
-@end smallexample
+If the next instruction were:
+
+@example
+mov r2, r1      # set r2 to r1's value
+@end example
+@noindent
+then we can say that @code{r2's} value is now the original value of
+@code{r1} plus 64.
+
+It's common for prologues to save registers on the stack, so we'll
+need to track the values of stack frame slots, as well as the
+registers.  So after an instruction like this:
+
+@example
+mov (fp+4), r2
+@end example
+@noindent
+then we'd know that the stack slot four bytes above the frame pointer
+holds the original value of @code{r1} plus 64.
+
+And so on.
+
+Of course, this can only go so far before it gets unreasonable.  If we
+wanted to be able to say anything about the value of @code{r1} after
+the instruction:
+
+@example
+xor r1, r3      # exclusive-or r1 and r3, place result in r1
+@end example
+@noindent
+then things would get pretty complex.  But remember, we're just doing
+a conservative approximation; if exclusive-or instructions aren't
+relevant to prologues, we can just say @code{r1}'s value is now
+``unknown''.  We can ignore things that are too complex, if that loss of
+information is acceptable for our application.
+
+So when we say ``conservative approximation'' here, what we mean is an
+approximation that is either accurate, or marked ``unknown'', but
+never inaccurate.
+
+Using this framework, a prologue analyzer is simply an interpreter for
+machine code, but one that uses conservative approximations for the
+contents of registers and memory instead of actual values.  Starting
+from the function's entry point, you simulate instructions up to the
+current PC, or an instruction that you don't know how to simulate.
+Now you can examine the state of the registers and stack slots you've
+kept track of.
+
+@itemize @bullet
+
+@item
+To see how large your stack frame is, just check the value of the
+stack pointer register; if it's the original value of the SP
+minus a constant, then that constant is the stack frame's size.
+If the SP's value has been marked as ``unknown'', then that means
+the prologue has done something too complex for us to track, and
+we don't know the frame size.
+
+@item
+To see where we've saved the previous frame's registers, we just
+search the values we've tracked --- stack slots, usually, but
+registers, too, if you want --- for something equal to the register's
+original value.  If the calling conventions suggest a standard place
+to save a given register, then we can check there first, but really,
+anything that will get us back the original value will probably work.
+@end itemize
+
+This does take some work.  But prologue analyzers aren't
+quick-and-simple pattern patching to recognize a few fixed prologue
+forms any more; they're big, hairy functions.  Along with inferior
+function calls, prologue analysis accounts for a substantial portion
+of the time needed to stabilize a @value{GDBN} port.  So it's
+worthwhile to look for an approach that will be easier to understand
+and maintain.  In the approach described above:
+
+@itemize @bullet
+
+@item
+It's easier to see that the analyzer is correct: you just see
+whether the analyzer properly (albeit conservatively) simulates
+the effect of each instruction.
+
+@item
+It's easier to extend the analyzer: you can add support for new
+instructions, and know that you haven't broken anything that
+wasn't already broken before.
+
+@item
+It's orthogonal: to gather new information, you don't need to
+complicate the code for each instruction.  As long as your domain
+of conservative values is already detailed enough to tell you
+what you need, then all the existing instruction simulations are
+already gathering the right data for you.
+
+@end itemize
+
+The file @file{prologue-value.h} contains detailed comments explaining
+the framework and how to use it.
 
-@cindex frame pointer register
-Other than that, all the meaning imparted to @code{DEPRECATED_FP_REGNUM}
-is imparted by the machine-dependent code.  So,
-@code{DEPRECATED_FP_REGNUM} can have any value that is convenient for
-the code that creates new frames.  (@code{create_new_frame} calls
-@code{DEPRECATED_INIT_EXTRA_FRAME_INFO} if it is defined; that is where
-you should use the @code{DEPRECATED_FP_REGNUM} value, if your frames are
-nonstandard.)
-
-@cindex frame chain
-Given a @value{GDBN} frame, define @code{DEPRECATED_FRAME_CHAIN} to
-determine the address of the calling function's frame.  This will be
-used to create a new @value{GDBN} frame struct, and then
-@code{DEPRECATED_INIT_EXTRA_FRAME_INFO} and
-@code{DEPRECATED_INIT_FRAME_PC} will be called for the new frame.
 
 @section Breakpoint Handling
 
@@ -318,13 +548,50 @@ set not to have any instructions usable for a software breakpoint,
 although in practice only the ARC has failed to define such an
 instruction.
 
-@findex BREAKPOINT
-The basic definition of the software breakpoint is the macro
-@code{BREAKPOINT}.
-
 Basic breakpoint object handling is in @file{breakpoint.c}.  However,
 much of the interesting breakpoint action is in @file{infrun.c}.
 
+@table @code
+@cindex insert or remove software breakpoint
+@findex target_remove_breakpoint
+@findex target_insert_breakpoint
+@item target_remove_breakpoint (@var{bp_tgt})
+@itemx target_insert_breakpoint (@var{bp_tgt})
+Insert or remove a software breakpoint at address
+@code{@var{bp_tgt}->placed_address}.  Returns zero for success,
+non-zero for failure.  On input, @var{bp_tgt} contains the address of the
+breakpoint, and is otherwise initialized to zero.  The fields of the
+@code{struct bp_target_info} pointed to by @var{bp_tgt} are updated
+to contain other information about the breakpoint on output.  The field
+@code{placed_address} may be updated if the breakpoint was placed at a
+related address; the field @code{shadow_contents} contains the real
+contents of the bytes where the breakpoint has been inserted,
+if reading memory would return the breakpoint instead of the
+underlying memory; the field @code{shadow_len} is the length of
+memory cached in @code{shadow_contents}, if any; and the field
+@code{placed_size} is optionally set and used by the target, if
+it could differ from @code{shadow_len}.
+
+For example, the remote target @samp{Z0} packet does not require
+shadowing memory, so @code{shadow_len} is left at zero.  However,
+the length reported by @code{gdbarch_breakpoint_from_pc} is cached in
+@code{placed_size}, so that a matching @samp{z0} packet can be
+used to remove the breakpoint.
+
+@cindex insert or remove hardware breakpoint
+@findex target_remove_hw_breakpoint
+@findex target_insert_hw_breakpoint
+@item target_remove_hw_breakpoint (@var{bp_tgt})
+@itemx target_insert_hw_breakpoint (@var{bp_tgt})
+Insert or remove a hardware-assisted breakpoint at address
+@code{@var{bp_tgt}->placed_address}.  Returns zero for success,
+non-zero for failure.  See @code{target_insert_breakpoint} for
+a description of the @code{struct bp_target_info} pointed to by
+@var{bp_tgt}; the @code{shadow_contents} and
+@code{shadow_len} members are not used for hardware breakpoints,
+but @code{placed_size} may be.
+@end table
+
 @section Single Stepping
 
 @section Signal Handling
@@ -342,13 +609,15 @@ stepping.  This is done with a few specialized internal breakpoints,
 which are visible in the output of the @samp{maint info breakpoint}
 command.
 
-@findex GET_LONGJMP_TARGET
-To make this work, you need to define a macro called
-@code{GET_LONGJMP_TARGET}, which will examine the @code{jmp_buf}
-structure and extract the longjmp target address.  Since @code{jmp_buf}
-is target specific, you will need to define it in the appropriate
-@file{tm-@var{target}.h} file.  Look in @file{tm-sun4os4.h} and
-@file{sparc-tdep.c} for examples of how to do this.
+@findex gdbarch_get_longjmp_target
+To make this work, you need to define a function called
+@code{gdbarch_get_longjmp_target}, which will examine the
+@code{jmp_buf} structure and extract the @code{longjmp} target address.
+Since @code{jmp_buf} is target specific and typically defined in a
+target header not available to @value{GDBN}, you will need to
+determine the offset of the PC manually and return that; many targets
+define a @code{jb_pc_offset} field in the tdep structure to save the
+value once calculated.
 
 @section Watchpoints
 @cindex watchpoints
@@ -396,14 +665,35 @@ single-step the program being debugged and test the value of the
 watched expression(s) after each instruction.  The rest of this
 section is mostly irrelevant for software watchpoints.
 
+When the inferior stops, @value{GDBN} tries to establish, among other
+possible reasons, whether it stopped due to a watchpoint being hit.
+It first uses @code{STOPPED_BY_WATCHPOINT} to see if any watchpoint
+was hit.  If not, all watchpoint checking is skipped.
+
+Then @value{GDBN} calls @code{target_stopped_data_address} exactly
+once.  This method returns the address of the watchpoint which
+triggered, if the target can determine it.  If the triggered address
+is available, @value{GDBN} compares the address returned by this
+method with each watched memory address in each active watchpoint.
+For data-read and data-access watchpoints, @value{GDBN} announces
+every watchpoint that watches the triggered address as being hit.
+For this reason, data-read and data-access watchpoints
+@emph{require} that the triggered address be available; if not, read
+and access watchpoints will never be considered hit.  For data-write
+watchpoints, if the triggered address is available, @value{GDBN}
+considers only those watchpoints which match that address;
+otherwise, @value{GDBN} considers all data-write watchpoints.  For
+each data-write watchpoint that @value{GDBN} considers, it evaluates
+the expression whose value is being watched, and tests whether the
+watched value has changed.  Watchpoints whose watched values have
+changed are announced as hit.
+
+@c FIXME move these to the main lists of target/native defns
+
 @value{GDBN} uses several macros and primitives to support hardware
 watchpoints:
 
 @table @code
-@findex TARGET_HAS_HARDWARE_WATCHPOINTS
-@item TARGET_HAS_HARDWARE_WATCHPOINTS
-If defined, the target supports hardware watchpoints.
-
 @findex TARGET_CAN_USE_HARDWARE_WATCHPOINT
 @item TARGET_CAN_USE_HARDWARE_WATCHPOINT (@var{type}, @var{count}, @var{other})
 Return the number of hardware watchpoints of type @var{type} that are
@@ -420,27 +710,7 @@ the same time).
 Return non-zero if hardware watchpoints can be used to watch a region
 whose address is @var{addr} and whose length in bytes is @var{len}.
 
-@findex TARGET_REGION_SIZE_OK_FOR_HW_WATCHPOINT
-@item TARGET_REGION_SIZE_OK_FOR_HW_WATCHPOINT (@var{size})
-Return non-zero if hardware watchpoints can be used to watch a region
-whose size is @var{size}.  @value{GDBN} only uses this macro as a
-fall-back, in case @code{TARGET_REGION_OK_FOR_HW_WATCHPOINT} is not
-defined.
-
-@findex TARGET_DISABLE_HW_WATCHPOINTS
-@item TARGET_DISABLE_HW_WATCHPOINTS (@var{pid})
-Disables watchpoints in the process identified by @var{pid}.  This is
-used, e.g., on HP-UX which provides operations to disable and enable
-the page-level memory protection that implements hardware watchpoints
-on that platform.
-
-@findex TARGET_ENABLE_HW_WATCHPOINTS
-@item TARGET_ENABLE_HW_WATCHPOINTS (@var{pid})
-Enables watchpoints in the process identified by @var{pid}.  This is
-used, e.g., on HP-UX which provides operations to disable and enable
-the page-level memory protection that implements hardware watchpoints
-on that platform.
-
+@cindex insert or remove hardware watchpoint
 @findex target_insert_watchpoint
 @findex target_remove_watchpoint
 @item target_insert_watchpoint (@var{addr}, @var{len}, @var{type})
@@ -463,37 +733,53 @@ defined by @file{breakpoint.h} as follows:
 @noindent
 These two macros should return 0 for success, non-zero for failure.
 
-@cindex insert or remove hardware breakpoint
-@findex target_remove_hw_breakpoint
-@findex target_insert_hw_breakpoint
-@item target_remove_hw_breakpoint (@var{addr}, @var{shadow})
-@itemx target_insert_hw_breakpoint (@var{addr}, @var{shadow})
-Insert or remove a hardware-assisted breakpoint at address @var{addr}.
-Returns zero for success, non-zero for failure.  @var{shadow} is the
-real contents of the byte where the breakpoint has been inserted; it
-is generally not valid when hardware breakpoints are used, but since
-no other code touches these values, the implementations of the above
-two macros can use them for their internal purposes.
-
 @findex target_stopped_data_address
-@item target_stopped_data_address ()
-If the inferior has some watchpoint that triggered, return the address
-associated with that watchpoint.  Otherwise, return zero.
+@item target_stopped_data_address (@var{addr_p})
+If the inferior has some watchpoint that triggered, place the address
+associated with the watchpoint at the location pointed to by
+@var{addr_p} and return non-zero.  Otherwise, return zero.  This
+is required for data-read and data-access watchpoints.  It is
+not required for data-write watchpoints, but @value{GDBN} uses
+it to improve handling of those also.
+
+@value{GDBN} will only call this method once per watchpoint stop,
+immediately after calling @code{STOPPED_BY_WATCHPOINT}.  If the
+target's watchpoint indication is sticky, i.e., stays set after
+resuming, this method should clear it.  For instance, the x86 debug
+control register has sticky triggered flags.
+
+@findex target_watchpoint_addr_within_range
+@item target_watchpoint_addr_within_range (@var{target}, @var{addr}, @var{start}, @var{length})
+Check whether @var{addr} (as returned by @code{target_stopped_data_address})
+lies within the hardware-defined watchpoint region described by
+@var{start} and @var{length}.  This only needs to be provided if the
+granularity of a watchpoint is greater than one byte, i.e., if the
+watchpoint can also trigger on nearby addresses outside of the watched
+region.
 
 @findex HAVE_STEPPABLE_WATCHPOINT
 @item HAVE_STEPPABLE_WATCHPOINT
 If defined to a non-zero value, it is not necessary to disable a
-watchpoint to step over it.
-
-@findex HAVE_NONSTEPPABLE_WATCHPOINT
-@item HAVE_NONSTEPPABLE_WATCHPOINT
-If defined to a non-zero value, @value{GDBN} should disable a
-watchpoint to step the inferior over it.
+watchpoint to step over it.  Like @code{gdbarch_have_nonsteppable_watchpoint},
+this is usually set when watchpoints trigger at the instruction
+which will perform an interesting read or write.  It should be
+set if there is a temporary disable bit which allows the processor
+to step over the interesting instruction without raising the
+watchpoint exception again.
+
+@findex gdbarch_have_nonsteppable_watchpoint 
+@item int gdbarch_have_nonsteppable_watchpoint (@var{gdbarch})
+If it returns a non-zero value, @value{GDBN} should disable a
+watchpoint to step the inferior over it.  This is usually set when
+watchpoints trigger at the instruction which will perform an
+interesting read or write.
 
 @findex HAVE_CONTINUABLE_WATCHPOINT
 @item HAVE_CONTINUABLE_WATCHPOINT
 If defined to a non-zero value, it is possible to continue the
-inferior after a watchpoint has been hit.
+inferior after a watchpoint has been hit.  This is usually set
+when watchpoints trigger at the instruction following an interesting
+read or write.
 
 @findex CANNOT_STEP_HW_WATCHPOINTS
 @item CANNOT_STEP_HW_WATCHPOINTS
@@ -504,8 +790,44 @@ watchpoints before stepping the inferior.
 @item STOPPED_BY_WATCHPOINT (@var{wait_status})
 Return non-zero if stopped by a watchpoint.  @var{wait_status} is of
 the type @code{struct target_waitstatus}, defined by @file{target.h}.
+Normally, this macro is defined to invoke the function pointed to by
+the @code{to_stopped_by_watchpoint} member of the structure (of the
+type @code{target_ops}, defined on @file{target.h}) that describes the
+target-specific operations; @code{to_stopped_by_watchpoint} ignores
+the @var{wait_status} argument.
+
+@value{GDBN} does not require the non-zero value returned by
+@code{STOPPED_BY_WATCHPOINT} to be 100% correct, so if a target cannot
+determine for sure whether the inferior stopped due to a watchpoint,
+it could return non-zero ``just in case''.
 @end table
 
+@subsection Watchpoints and Threads
+@cindex watchpoints, with threads
+
+@value{GDBN} only supports process-wide watchpoints, which trigger
+in all threads.  @value{GDBN} uses the thread ID to make watchpoints
+act as if they were thread-specific, but it cannot set hardware
+watchpoints that only trigger in a specific thread.  Therefore, even
+if the target supports threads, per-thread debug registers, and
+watchpoints which only affect a single thread, it should set the
+per-thread debug registers for all threads to the same value.  On
+@sc{gnu}/Linux native targets, this is accomplished by using
+@code{ALL_LWPS} in @code{target_insert_watchpoint} and
+@code{target_remove_watchpoint} and by using
+@code{linux_set_new_thread} to register a handler for newly created
+threads.
+
+@value{GDBN}'s @sc{gnu}/Linux support only reports a single event
+at a time, although multiple events can trigger simultaneously for
+multi-threaded programs.  When multiple events occur, @file{linux-nat.c}
+queues subsequent events and returns them the next time the program
+is resumed.  This means that @code{STOPPED_BY_WATCHPOINT} and
+@code{target_stopped_data_address} only need to consult the current
+thread's state---the thread indicated by @code{inferior_ptid}.  If
+two threads have hit watchpoints simultaneously, those routines
+will be called a second time for the second thread.
+
 @subsection x86 Watchpoints
 @cindex x86 debug registers
 @cindex watchpoints, on x86
@@ -516,6 +838,9 @@ generic library of functions that x86-based ports can use to implement
 support for watchpoints and hardware-assisted breakpoints.  This
 subsection documents the x86 watchpoint facilities in @value{GDBN}.
 
+(At present, the library functions read and write debug registers directly, and are
+thus only available for native configurations.)
+
 To use the generic x86 watchpoint support, a port should do the
 following:
 
@@ -531,8 +856,7 @@ defining @code{I386_USE_GENERIC_WATCHPOINTS}.
 
 @item
 Add @file{i386-nat.o} to the value of the Make variable
-@code{NATDEPFILES} (@pxref{Native Debugging, NATDEPFILES}) or
-@code{TDEPFILES} (@pxref{Target Architecture Definition, TDEPFILES}).
+@code{NATDEPFILES} (@pxref{Native Debugging, NATDEPFILES}).
 
 @item
 Provide implementations for the @code{I386_DR_LOW_*} macros described
@@ -598,15 +922,25 @@ less than 4, the number of debug registers available to x86
 processors.
 
 @findex i386_stopped_data_address
-@item i386_stopped_data_address (void)
-The macros @code{STOPPED_BY_WATCHPOINT} and
-@code{target_stopped_data_address} are set to call this function.  The
-argument passed to @code{STOPPED_BY_WATCHPOINT} is ignored.  This
+@item i386_stopped_data_address (@var{addr_p})
+The target function
+@code{target_stopped_data_address} is set to call this function.
+This
 function examines the breakpoint condition bits in the DR6 Debug
 Status register, as returned by the @code{I386_DR_LOW_GET_STATUS}
 macro, and returns the address associated with the first bit that is
 set in DR6.
 
+@findex i386_stopped_by_watchpoint
+@item i386_stopped_by_watchpoint (void)
+The macro @code{STOPPED_BY_WATCHPOINT}
+is set to call this function.  The
+argument passed to @code{STOPPED_BY_WATCHPOINT} is ignored.  This
+function examines the breakpoint condition bits in the DR6 Debug
+Status register, as returned by the @code{I386_DR_LOW_GET_STATUS}
+macro, and returns true if any bit is set.  Otherwise, false is
+returned.
+
 @findex i386_insert_watchpoint
 @findex i386_remove_watchpoint
 @item i386_insert_watchpoint (@var{addr}, @var{len}, @var{type})
@@ -639,11 +973,13 @@ the count goes to zero.
 
 @findex i386_insert_hw_breakpoint
 @findex i386_remove_hw_breakpoint
-@item i386_insert_hw_breakpoint (@var{addr}, @var{shadow}
-@itemx i386_remove_hw_breakpoint (@var{addr}, @var{shadow})
+@item i386_insert_hw_breakpoint (@var{bp_tgt})
+@itemx i386_remove_hw_breakpoint (@var{bp_tgt})
 These functions insert and remove hardware-assisted breakpoints.  The
 macros @code{target_insert_hw_breakpoint} and
 @code{target_remove_hw_breakpoint} are set to call these functions.
+The argument is a @code{struct bp_target_info *}, as described in
+the documentation for @code{target_insert_breakpoint}.
 These functions work like @code{i386_insert_watchpoint} and
 @code{i386_remove_watchpoint}, respectively, except that they set up
 the debug registers to watch instruction execution, and each
@@ -654,7 +990,7 @@ register.
 @item i386_stopped_by_hwbp (void)
 This function returns non-zero if the inferior has some watchpoint or
 hardware breakpoint that triggered.  It works like
-@code{i386_stopped_data_address}, except that it doesn't return the
+@code{i386_stopped_data_address}, except that it doesn't record the
 address whose watchpoint triggered.
 
 @findex i386_cleanup_dregs
@@ -685,6 +1021,38 @@ watchpoints might interfere with the underlying OS and are probably
 unavailable in many platforms.
 @end enumerate
 
+@section Checkpoints
+@cindex checkpoints
+@cindex restart
+In the abstract, a checkpoint is a point in the execution history of
+the program, which the user may wish to return to at some later time.
+
+Internally, a checkpoint is a saved copy of the program state, including
+whatever information is required in order to restore the program to that
+state at a later time.  This can be expected to include the state of 
+registers and memory, and may include external state such as the state
+of open files and devices.
+
+There are a number of ways in which checkpoints may be implemented
+in gdb, e.g.@: as corefiles, as forked processes, and as some opaque
+method implemented on the target side.
+
+A corefile can be used to save an image of target memory and register
+state, which can in principle be restored later --- but corefiles do
+not typically include information about external entities such as 
+open files.  Currently this method is not implemented in gdb.
+
+A forked process can save the state of user memory and registers, 
+as well as some subset of external (kernel) state.  This method 
+is used to implement checkpoints on Linux, and in principle might
+be used on other systems.
+
+Some targets, e.g.@: simulators, might have their own built-in 
+method for saving checkpoints, and gdb might be able to take
+advantage of that capability without necessarily knowing any
+details of how it is done.
+
+
 @section Observing changes in @value{GDBN} internals
 @cindex observer pattern interface
 @cindex notifications about changes in internals
@@ -712,8 +1080,8 @@ implementation is also briefly discussed.
 
 @chapter User Interface
 
-@value{GDBN} has several user interfaces.  Although the command-line interface
-is the most common and most familiar, there are others.
+@value{GDBN} has several user interfaces, of which the traditional
+command-line interface is perhaps the most familiar.
 
 @section Command Interpreter
 
@@ -754,9 +1122,10 @@ command immediately after it is created.
 
 The first time a command is used the user will be warned and offered a
 replacement (if one exists). Note that the replacement string passed to
-@code{deprecate_cmd} should be the full name of the command, i.e. the
+@code{deprecate_cmd} should be the full name of the command, i.e., the
 entire string the user should type at the command line.
 
+@anchor{UI-Independent Output}
 @section UI-Independent Output---the @code{ui_out} Functions
 @c This section is based on the documentation written by Fernando
 @c Nasser <fnasser@redhat.com>.
@@ -963,7 +1332,7 @@ one call to @code{ui_out_tuple_end} for each call to
 be signaled.
 @end deftypefun
 
-@deftypefun struct cleanup *make_cleanup_ui_out_tuple_begin_end (struct ui_out *@var{uiout}, const char *@var{id})
+@deftypefun {struct cleanup *} make_cleanup_ui_out_tuple_begin_end (struct ui_out *@var{uiout}, const char *@var{id})
 This function first opens the tuple and then establishes a cleanup
 (@pxref{Coding, Cleanups}) to close the tuple.  It provides a convenient
 and correct implementation of the non-portable@footnote{The function
@@ -990,10 +1359,10 @@ one call to @code{ui_out_list_end} for each call to
 be signaled.
 @end deftypefun
 
-@deftypefun struct cleanup *make_cleanup_ui_out_list_begin_end (struct ui_out *@var{uiout}, const char *@var{id})
+@deftypefun {struct cleanup *} make_cleanup_ui_out_list_begin_end (struct ui_out *@var{uiout}, const char *@var{id})
 Similar to @code{make_cleanup_ui_out_tuple_begin_end}, this function
 opens a list and then establishes cleanup (@pxref{Coding, Cleanups})
-that will close the list.list.
+that will close the list.
 @end deftypefun
 
 @subsection Item Output Functions
@@ -1031,8 +1400,8 @@ This function outputs a value of an @code{int} variable.  It differs from
 the name of the field.
 @end deftypefun
 
-@deftypefun void ui_out_field_core_addr (struct ui_out *@var{uiout}, const char *@var{fldname}, CORE_ADDR @var{address})
-This function outputs an address.
+@deftypefun void ui_out_field_core_addr (struct ui_out *@var{uiout}, const char *@var{fldname}, struct gdbarch *@var{gdbarch}, CORE_ADDR @var{address})
+This function outputs an address as appropriate for @var{gdbarch}.
 @end deftypefun
 
 @deftypefun void ui_out_field_string (struct ui_out *@var{uiout}, const char *@var{fldname}, const char *@var{string})
@@ -1055,7 +1424,7 @@ constructed.  When the @code{ui_stream} object is no longer needed,
 you should destroy it and free its memory by calling
 @code{ui_out_stream_delete}.
 
-@deftypefun struct ui_stream *ui_out_stream_new (struct ui_out *@var{uiout})
+@deftypefun {struct ui_stream *} ui_out_stream_new (struct ui_out *@var{uiout})
 This function creates a new @code{ui_stream} object which uses the
 same output methods as the @code{ui_out} object whose pointer is
 passed in @var{uiout}.  It returns a pointer to the newly created
@@ -1220,7 +1589,7 @@ Here's the new version:
     @{
      if (nr_printable_breakpoints > 0)
        annotate_field (4);
-     if (TARGET_ADDR_BIT <= 32)
+     if (print_address_bits <= 32)
        ui_out_table_header (uiout, 10, ui_left, "addr", "Address");/* 5 */
      else
        ui_out_table_header (uiout, 18, ui_left, "addr", "Address");/* 5 */
@@ -1372,7 +1741,7 @@ Finally, here's an example of printing an address.  The original code:
 @smallexample
   annotate_field (4);
   printf_filtered ("%s ",
-        local_hex_string_custom ((unsigned long) b->address, "08l"));
+        hex_string_custom ((unsigned long) b->address, 8));
 @end smallexample
 
 It became:
@@ -1431,10 +1800,10 @@ As a client querying @code{libgdb} (using the @file{ui-out} builder) to
 obtain various status values from @value{GDBN}.
 @end itemize
 
-Since @code{libgdb} could have multiple clients (e.g. a GUI supporting
+Since @code{libgdb} could have multiple clients (e.g., a GUI supporting
 the existing @value{GDBN} CLI), those clients must co-operate when
 controlling @code{libgdb}.  In particular, a client must ensure that
-@code{libgdb} is idle (i.e. no other client is using @code{libgdb})
+@code{libgdb} is idle (i.e.@: no other client is using @code{libgdb})
 before responding to a @file{gdb-event} by making a query.
 
 @section CLI support
@@ -1489,7 +1858,7 @@ when doing any queries.
 @c There could be an entire section on the event-loop
 @file{event-loop}, currently non-re-entrant, provides a simple event
 loop.  A client would need to either plug its self into this loop or,
-implement a new event-loop that GDB would use.
+implement a new event-loop that @value{GDBN} would use.
 
 The event-loop will eventually be made re-entrant.  This is so that
 @value{GDBN} can better handle the problem of some commands blocking
@@ -1501,12 +1870,241 @@ the query interface.  Each function is parameterized by a @code{ui-out}
 builder.  The result of the query is constructed using that builder
 before the query function returns.
 
+@node Values
+@chapter Values
+@section Values
+
+@cindex values
+@cindex @code{value} structure
+@value{GDBN} uses @code{struct value}, or @dfn{values}, as an internal
+abstraction for the representation of a variety of inferior objects
+and @value{GDBN} convenience objects.
+
+Values have an associated @code{struct type}, that describes a virtual
+view of the raw data or object stored in or accessed through the
+value.
+
+A value is in addition discriminated by its lvalue-ness, given its
+@code{enum lval_type} enumeration type:
+
+@cindex @code{lval_type} enumeration, for values.
+@table @code
+@item @code{not_lval}
+This value is not an lval.  It can't be assigned to.
+
+@item @code{lval_memory}
+This value represents an object in memory.
+
+@item @code{lval_register}
+This value represents an object that lives in a register.
+
+@item @code{lval_internalvar}
+Represents the value of an internal variable.
+
+@item @code{lval_internalvar_component}
+Represents part of a @value{GDBN} internal variable.  E.g., a
+structure field.
+
+@cindex computed values
+@item @code{lval_computed}
+These are ``computed'' values.  They allow creating specialized value
+objects for specific purposes, all abstracted away from the core value
+support code.  The creator of such a value writes specialized
+functions to handle the reading and writing to/from the value's
+backend data, and optionally, a ``copy operator'' and a
+``destructor''.
+
+Pointers to these functions are stored in a @code{struct lval_funcs}
+instance (declared in @file{value.h}), and passed to the
+@code{allocate_computed_value} function, as in the example below.
+
+@smallexample
+static void
+nil_value_read (struct value *v)
+@{
+  /* This callback reads data from some backend, and stores it in V.
+     In this case, we always read null data.  You'll want to fill in
+     something more interesting.  */
+
+  memset (value_contents_all_raw (v),
+          value_offset (v),
+          TYPE_LENGTH (value_type (v)));
+@}
+
+static void
+nil_value_write (struct value *v, struct value *fromval)
+@{
+  /* Takes the data from FROMVAL and stores it in the backend of V.  */
+
+  to_oblivion (value_contents_all_raw (fromval),
+               value_offset (v),
+               TYPE_LENGTH (value_type (fromval)));
+@}
+
+static struct lval_funcs nil_value_funcs =
+  @{
+    nil_value_read,
+    nil_value_write
+  @};
+
+struct value *
+make_nil_value (void)
+@{
+   struct type *type;
+   struct value *v;
+
+   type = make_nils_type ();
+   v = allocate_computed_value (type, &nil_value_funcs, NULL);
+
+   return v;
+@}
+@end smallexample
+
+See the implementation of the @code{$_siginfo} convenience variable in
+@file{infrun.c} as a real example use of lval_computed.
+
+@end table
+
+@node Stack Frames
+@chapter Stack Frames
+
+@cindex frame
+@cindex call stack frame
+A frame is a construct that @value{GDBN} uses to keep track of calling
+and called functions.
+
+@cindex unwind frame
+@value{GDBN}'s frame model, a fresh design, was implemented with the
+need to support @sc{dwarf}'s Call Frame Information in mind.  In fact,
+the term ``unwind'' is taken directly from that specification.
+Developers wishing to learn more about unwinders, are encouraged to
+read the @sc{dwarf} specification, available from
+@url{http://www.dwarfstd.org}.
+
+@findex frame_register_unwind
+@findex get_frame_register
+@value{GDBN}'s model is that you find a frame's registers by
+``unwinding'' them from the next younger frame.  That is,
+@samp{get_frame_register} which returns the value of a register in
+frame #1 (the next-to-youngest frame), is implemented by calling frame
+#0's @code{frame_register_unwind} (the youngest frame).  But then the
+obvious question is: how do you access the registers of the youngest
+frame itself?
+
+@cindex sentinel frame
+@findex get_frame_type
+@vindex SENTINEL_FRAME
+To answer this question, @value{GDBN} has the @dfn{sentinel} frame, the
+``-1st'' frame.  Unwinding registers from the sentinel frame gives you
+the current values of the youngest real frame's registers.  If @var{f}
+is a sentinel frame, then @code{get_frame_type (@var{f}) @equiv{}
+SENTINEL_FRAME}.
+
+@section Selecting an Unwinder
+
+@findex frame_unwind_prepend_unwinder
+@findex frame_unwind_append_unwinder
+The architecture registers a list of frame unwinders (@code{struct
+frame_unwind}), using the functions
+@code{frame_unwind_prepend_unwinder} and
+@code{frame_unwind_append_unwinder}.  Each unwinder includes a
+sniffer.  Whenever @value{GDBN} needs to unwind a frame (to fetch the
+previous frame's registers or the current frame's ID), it calls
+registered sniffers in order to find one which recognizes the frame.
+The first time a sniffer returns non-zero, the corresponding unwinder
+is assigned to the frame.
+
+@section Unwinding the Frame ID
+@cindex frame ID
+
+Every frame has an associated ID, of type @code{struct frame_id}.
+The ID includes the stack base and function start address for
+the frame.  The ID persists through the entire life of the frame,
+including while other called frames are running; it is used to
+locate an appropriate @code{struct frame_info} from the cache.
+
+Every time the inferior stops, and at various other times, the frame
+cache is flushed.  Because of this, parts of @value{GDBN} which need
+to keep track of individual frames cannot use pointers to @code{struct
+frame_info}.  A frame ID provides a stable reference to a frame, even
+when the unwinder must be run again to generate a new @code{struct
+frame_info} for the same frame.
+
+The frame's unwinder's @code{this_id} method is called to find the ID.
+Note that this is different from register unwinding, where the next
+frame's @code{prev_register} is called to unwind this frame's
+registers.
+
+Both stack base and function address are required to identify the
+frame, because a recursive function has the same function address for
+two consecutive frames and a leaf function may have the same stack
+address as its caller.  On some platforms, a third address is part of
+the ID to further disambiguate frames---for instance, on IA-64
+the separate register stack address is included in the ID.
+
+An invalid frame ID (@code{null_frame_id}) returned from the
+@code{this_id} method means to stop unwinding after this frame.
+
+@section Unwinding Registers
+
+Each unwinder includes a @code{prev_register} method.  This method
+takes a frame, an associated cache pointer, and a register number.
+It returns a @code{struct value *} describing the requested register,
+as saved by this frame.  This is the value of the register that is
+current in this frame's caller.
+
+The returned value must have the same type as the register.  It may
+have any lvalue type.  In most circumstances one of these routines
+will generate the appropriate value:
+
+@table @code
+@item frame_unwind_got_optimized
+@findex frame_unwind_got_optimized
+This register was not saved.
+
+@item frame_unwind_got_register
+@findex frame_unwind_got_register
+This register was copied into another register in this frame.  This
+is also used for unchanged registers; they are ``copied'' into the
+same register.
+
+@item frame_unwind_got_memory
+@findex frame_unwind_got_memory
+This register was saved in memory.
+
+@item frame_unwind_got_constant
+@findex frame_unwind_got_constant
+This register was not saved, but the unwinder can compute the previous
+value some other way.
+
+@item frame_unwind_got_address
+@findex frame_unwind_got_address
+Same as @code{frame_unwind_got_constant}, except that the value is a target
+address.  This is frequently used for the stack pointer, which is not
+explicitly saved but has a known offset from this frame's stack
+pointer.  For architectures with a flat unified address space, this is
+generally the same as @code{frame_unwind_got_constant}.
+@end table
+
 @node Symbol Handling
 
 @chapter Symbol Handling
 
-Symbols are a key part of @value{GDBN}'s operation.  Symbols include variables,
-functions, and types.
+Symbols are a key part of @value{GDBN}'s operation.  Symbols include
+variables, functions, and types.
+
+Symbol information for a large program can be truly massive, and
+reading of symbol information is one of the major performance
+bottlenecks in @value{GDBN}; it can take many minutes to process it
+all.  Studies have shown that nearly all the time spent is
+computational, rather than file reading.
+
+One of the ways for @value{GDBN} to provide a good user experience is
+to start up quickly, taking no more than a few seconds.  It is simply
+not possible to process all of a program's debugging info in that
+time, and so we attempt to handle symbols incrementally.  For instance,
+we create @dfn{partial symbol tables} consisting of only selected
+symbols, and only expand them to full symbol tables when necessary.
 
 @section Symbol Reading
 
@@ -1517,8 +2115,9 @@ functions, and types.
 file is the file containing the program which @value{GDBN} is
 debugging.  @value{GDBN} can be directed to use a different file for
 symbols (with the @samp{symbol-file} command), and it can also read
-more symbols via the @samp{add-file} and @samp{load} commands, or while
-reading symbols from shared libraries.
+more symbols via the @samp{add-file} and @samp{load} commands. In
+addition, it may bring in more symbols while loading shared
+libraries.
 
 @findex find_sym_fns
 Symbol files are initially opened by code in @file{symfile.c} using
@@ -1579,7 +2178,7 @@ symbol-file into a set of psymtabs or symtabs.
 @code{@var{xyz}_sym_init} for possible initialization.  @code{addr} is
 the offset between the file's specified start address and its true
 address in memory.  @code{mainline} is 1 if this is the main symbol
-table being read, and 0 if a secondary symbol file (e.g. shared library
+table being read, and 0 if a secondary symbol file (e.g., shared library
 or dynamically loaded file) is being read.@refill
 @end table
 
@@ -1653,7 +2252,7 @@ code in the debugger) to reference a symbol:
 @findex find_pc_function
 @findex find_pc_line
 @item
-By its address (e.g. execution stops at some address which is inside a
+By its address (e.g., execution stops at some address which is inside a
 function in this file).  The address will be noticed to be in the
 range of this psymtab, and the full symtab will be read in.
 @code{find_pc_function}, @code{find_pc_line}, and other
@@ -1662,7 +2261,7 @@ range of this psymtab, and the full symtab will be read in.
 @cindex lookup_symbol
 @item
 By its name
-(e.g. the user asks to print a variable, or set a breakpoint on a
+(e.g., the user asks to print a variable, or set a breakpoint on a
 function).  Global names and file-scope names will be found in the
 psymtab, which will cause the symtab to be pulled in.  Local names will
 have to be qualified by a global name, or a file-scope name, in which
@@ -1757,9 +2356,10 @@ COFF files may have multiple sections, each prefixed by a header.  The
 number of sections is limited.
 
 The COFF specification includes support for debugging.  Although this
-was a step forward, the debugging information was woefully limited.  For
-instance, it was not possible to represent code that came from an
-included file.
+was a step forward, the debugging information was woefully limited.
+For instance, it was not possible to represent code that came from an
+included file.  GNU's COFF-using configs often use stabs-type info,
+encapsulated in special sections.
 
 The COFF reader is in @file{coffread.c}.
 
@@ -1799,9 +2399,10 @@ COFF reader.
 @subsection ELF
 
 @cindex ELF format
-The ELF format came with System V Release 4 (SVR4) Unix.  ELF is similar
-to COFF in being organized into a number of sections, but it removes
-many of COFF's limitations.
+The ELF format came with System V Release 4 (SVR4) Unix.  ELF is
+similar to COFF in being organized into a number of sections, but it
+removes many of COFF's limitations.  Debugging info may be either stabs
+encapsulated in ELF sections, or more commonly these days, DWARF.
 
 The basic ELF reader is in @file{elfread.c}.
 
@@ -1811,13 +2412,7 @@ The basic ELF reader is in @file{elfread.c}.
 SOM is HP's object file and debug format (not to be confused with IBM's
 SOM, which is a cross-language ABI).
 
-The SOM reader is in @file{hpread.c}.
-
-@subsection Other File Formats
-
-@cindex Netware Loadable Module format
-Other file formats that have been supported by @value{GDBN} include Netware
-Loadable Modules (@file{nlmread.c}).
+The SOM reader is in @file{somread.c}.
 
 @section Debugging File Formats
 
@@ -1848,19 +2443,7 @@ ECOFF includes a definition of a special debug format.
 
 The file @file{mdebugread.c} implements reading for this format.
 
-@subsection DWARF 1
-
-@cindex DWARF 1 debugging info
-DWARF 1 is a debugging format that was originally designed to be
-used with ELF in SVR4 systems.
-
-@c GCC_PRODUCER
-@c GPLUS_PRODUCER
-@c LCC_PRODUCER
-@c If defined, these are the producer strings in a DWARF 1 file.  All of
-@c these have reasonable defaults already.
-
-The DWARF 1 reader is in @file{dwarfread.c}.
+@c mention DWARF 1 as a formerly-supported format
 
 @subsection DWARF 2
 
@@ -1869,6 +2452,34 @@ DWARF 2 is an improved but incompatible version of DWARF 1.
 
 The DWARF 2 reader is in @file{dwarf2read.c}.
 
+@subsection Compressed DWARF 2
+
+@cindex Compressed DWARF 2 debugging info
+Compressed DWARF 2 is not technically a separate debugging format, but
+merely DWARF 2 debug information that has been compressed.  In this
+format, every object-file section holding DWARF 2 debugging
+information is compressed and prepended with a header.  (The section
+is also typically renamed, so a section called @code{.debug_info} in a
+DWARF 2 binary would be called @code{.zdebug_info} in a compressed
+DWARF 2 binary.)  The header is 12 bytes long:
+
+@itemize @bullet
+@item
+4 bytes: the literal string ``ZLIB''
+@item
+8 bytes: the uncompressed size of the section, in big-endian byte
+order.
+@end itemize
+
+The same reader is used for both compressed an normal DWARF 2 info.
+Section decompression is done in @code{zlib_decompress_section} in
+@file{dwarf2read.c}.
+
+@subsection DWARF 3
+
+@cindex DWARF 3 debugging info
+DWARF 3 is an improved version of DWARF 2.
+
 @subsection SOM
 
 @cindex SOM debugging info
@@ -1884,10 +2495,10 @@ If you need to add a new object file format, you must first add it to
 BFD.  This is beyond the scope of this document.
 
 You must then arrange for the BFD code to provide access to the
-debugging symbols.  Generally @value{GDBN} will have to call swapping routines
-from BFD and a few other BFD internal routines to locate the debugging
-information.  As much as possible, @value{GDBN} should not depend on the BFD
-internal data structures.
+debugging symbols.  Generally @value{GDBN} will have to call swapping
+routines from BFD and a few other BFD internal routines to locate the
+debugging information.  As much as possible, @value{GDBN} should not
+depend on the BFD internal data structures.
 
 For some targets (e.g., COFF), there is a special transfer vector used
 to call swapping routines, since the external data structures on various
@@ -1896,6 +2507,22 @@ will only ever be implemented by one object file format may be called
 directly.  This interface should be described in a file
 @file{bfd/lib@var{xyz}.h}, which is included by @value{GDBN}.
 
+@section Memory Management for Symbol Files
+
+Most memory associated with a loaded symbol file is stored on
+its @code{objfile_obstack}.  This includes symbols, types,
+namespace data, and other information produced by the symbol readers.
+
+Because this data lives on the objfile's obstack, it is automatically
+released when the objfile is unloaded or reloaded.  Therefore one
+objfile must not reference symbol or type data from another objfile;
+they could be unloaded at different times.
+
+User convenience variables, et cetera, have associated types.  Normally
+these types live in the associated objfile.  However, when the objfile
+is unloaded, those types are deep copied to global memory, so that
+the values of the user variables and history items are not lost.
+
 
 @node Language Support
 
@@ -2016,23 +2643,6 @@ printed representations of your operators to @code{op_print_tab}.
 Add a call to @code{@var{lang}_parse()} and @code{@var{lang}_error} in
 @code{parse_exp_1} (defined in @file{parse.c}).
 
-@item Use macros to trim code
-
-@cindex trimming language-dependent code
-The user has the option of building @value{GDBN} for some or all of the
-languages.  If the user decides to build @value{GDBN} for the language
-@var{lang}, then every file dependent on @file{language.h} will have the
-macro @code{_LANG_@var{lang}} defined in it.  Use @code{#ifdef}s to
-leave out large routines that the user won't need if he or she is not
-using your language.
-
-Note that you do not need to do this in your YACC parser, since if @value{GDBN}
-is not build for @var{lang}, then @file{@var{lang}-exp.tab.o} (the
-compiled form of your parser) is not linked into @value{GDBN} at all.
-
-See the file @file{configure.in} for how @value{GDBN} is configured
-for different languages.
-
 @item Edit @file{Makefile.in}
 
 Add dependencies in @file{Makefile.in}.  Make sure you update the macro
@@ -2062,52 +2672,43 @@ eventually disappear.
 
 @table @file
 @item gdb/config/@var{arch}/@var{xyz}.mh
-This file once contained both host and native configuration information
-(@pxref{Native Debugging}) for the machine @var{xyz}.  The host
-configuration information is now handed by Autoconf.
+This file is a Makefile fragment that once contained both host and
+native configuration information (@pxref{Native Debugging}) for the
+machine @var{xyz}.  The host configuration information is now handled
+by Autoconf.
 
-Host configuration information included a definition of
-@code{XM_FILE=xm-@var{xyz}.h} and possibly definitions for @code{CC},
+Host configuration information included definitions for @code{CC},
 @code{SYSV_DEFINE}, @code{XM_CFLAGS}, @code{XM_ADD_FILES},
 @code{XM_CLIBS}, @code{XM_CDEPS}, etc.; see @file{Makefile.in}.
 
-New host only configurations do not need this file.
-
-@item gdb/config/@var{arch}/xm-@var{xyz}.h
-This file once contained definitions and includes required when hosting
-gdb on machine @var{xyz}.  Those definitions and includes are now
-handled by Autoconf.
-
-New host and native configurations do not need this file.
-
-@emph{Maintainer's note: Some hosts continue to use the @file{xm-xyz.h}
-file to define the macros @var{HOST_FLOAT_FORMAT},
-@var{HOST_DOUBLE_FORMAT} and @var{HOST_LONG_DOUBLE_FORMAT}.  That code
-also needs to be replaced with either an Autoconf or run-time test.}
+New host-only configurations do not need this file.
 
 @end table
 
+(Files named @file{gdb/config/@var{arch}/xm-@var{xyz}.h} were once
+used to define host-specific macros, but were no longer needed and
+have all been removed.)
+
 @subheading Generic Host Support Files
 
 @cindex generic host support
 There are some ``generic'' versions of routines that can be used by
-various systems.  These can be customized in various ways by macros
-defined in your @file{xm-@var{xyz}.h} file.  If these routines work for
-the @var{xyz} host, you can just include the generic file's name (with
-@samp{.o}, not @samp{.c}) in @code{XDEPFILES}.
-
-Otherwise, if your machine needs custom support routines, you will need
-to write routines that perform the same functions as the generic file.
-Put them into @code{@var{xyz}-xdep.c}, and put @code{@var{xyz}-xdep.o}
-into @code{XDEPFILES}.
+various systems.
 
 @table @file
 @cindex remote debugging support
 @cindex serial line support
 @item ser-unix.c
-This contains serial line support for Unix systems.  This is always
-included, via the makefile variable @code{SER_HARDWIRE}; override this
-variable in the @file{.mh} file to avoid it.
+This contains serial line support for Unix systems.  It is included by
+default on all Unix-like hosts.
+
+@item ser-pipe.c
+This contains serial pipe support for Unix systems.  It is included by
+default on all Unix-like hosts.
+
+@item ser-mingw.c
+This contains serial line support for 32-bit programs running under
+Windows using MinGW.
 
 @item ser-go32.c
 This contains serial line support for 32-bit programs running under DOS,
@@ -2115,25 +2716,27 @@ using the DJGPP (a.k.a.@: GO32) execution environment.
 
 @cindex TCP remote support
 @item ser-tcp.c
-This contains generic TCP support using sockets.
+This contains generic TCP support using sockets.  It is included by
+default on all Unix-like hosts and with MinGW.
 @end table
 
 @section Host Conditionals
 
 When @value{GDBN} is configured and compiled, various macros are
 defined or left undefined, to control compilation based on the
-attributes of the host system.  These macros and their meanings (or if
-the meaning is not documented here, then one of the source files where
-they are used is indicated) are:
+attributes of the host system.  While formerly they could be set in
+host-specific header files, at present they can be changed only by
+setting @code{CFLAGS} when building, or by editing the source code.
+
+These macros and their meanings (or if the meaning is not documented
+here, then one of the source files where they are used is indicated)
+are:
 
 @ftable @code
 @item @value{GDBN}INIT_FILENAME
 The default name of @value{GDBN}'s initialization file (normally
 @file{.gdbinit}).
 
-@item NO_STD_REGS
-This macro is deprecated.
-
 @item SIGWINCH_HANDLER
 If your host defines @code{SIGWINCH}, you can define this to be the name
 of a function to be called if @code{SIGWINCH} is received.
@@ -2142,13 +2745,6 @@ of a function to be called if @code{SIGWINCH} is received.
 Define this to expand into code that will define the function named by
 the expansion of @code{SIGWINCH_HANDLER}.
 
-@item ALIGN_STACK_ON_STARTUP
-@cindex stack alignment
-Define this if your system is of a sort that will crash in
-@code{tgetent} if the stack happens not to be longword-aligned when
-@code{main} is called.  This is a rare situation, but is known to occur
-on several different types of systems.
-
 @item CRLF_SOURCE_FILES
 @cindex DOS text files
 Define this if host files use @code{\r\n} rather than @code{\n} as a
@@ -2165,31 +2761,11 @@ The default value of the prompt string (normally @code{"(gdb) "}).
 @cindex terminal device
 The name of the generic TTY device, defaults to @code{"/dev/tty"}.
 
-@item FOPEN_RB
-Define this if binary files are opened the same way as text files.
-
-@item HAVE_MMAP
-@findex mmap
-In some cases, use the system call @code{mmap} for reading symbol
-tables.  For some machines this allows for sharing and quick updates.
-
-@item HAVE_TERMIO
-Define this if the host system has @code{termio.h}.
-
-@item INT_MAX
-@itemx INT_MIN
-@itemx LONG_MAX
-@itemx UINT_MAX
-@itemx ULONG_MAX
-Values for host-side constants.
-
 @item ISATTY
 Substitute for isatty, if not available.
 
-@item LONGEST
-This is the longest integer type available on the host.  If not defined,
-it will default to @code{long long} or @code{long}, depending on
-@code{CC_HAS_LONG_LONG}.
+@item FOPEN_RB
+Define this if binary files are opened the same way as text files.
 
 @item CC_HAS_LONG_LONG
 @cindex @code{long long} data type
@@ -2201,30 +2777,11 @@ Define this if the host can handle printing of long long integers via
 the printf format conversion specifier @code{ll}.  This is set by the
 @code{configure} script.
 
-@item HAVE_LONG_DOUBLE
-Define this if the host C compiler supports @code{long double}.  This is
-set by the @code{configure} script.
-
-@item PRINTF_HAS_LONG_DOUBLE
-Define this if the host can handle printing of long double float-point
-numbers via the printf format conversion specifier @code{Lg}.  This is
-set by the @code{configure} script.
-
-@item SCANF_HAS_LONG_DOUBLE
-Define this if the host can handle the parsing of long double
-float-point numbers via the scanf format conversion specifier
-@code{Lg}.  This is set by the @code{configure} script.
-
 @item LSEEK_NOT_LINEAR
 Define this if @code{lseek (n)} does not necessarily move to byte number
 @code{n} in the file.  This is only used when reading source files.  It
 is normally faster to define @code{CRLF_SOURCE_FILES} when possible.
 
-@item L_SET
-This macro is used as the argument to @code{lseek} (or, most commonly,
-@code{bfd_seek}).  FIXME, should be replaced by SEEK_SET instead,
-which is the POSIX equivalent.
-
 @item NORETURN
 If defined, this should be one or more tokens, such as @code{volatile},
 that can be used in both the declaration and definition of functions to
@@ -2238,20 +2795,6 @@ of functions to indicate that they never return.  The default is already
 set correctly if compiling with GCC.  This will almost never need to be
 defined.
 
-@item SEEK_CUR
-@itemx SEEK_SET
-Define these to appropriate value for the system @code{lseek}, if not already
-defined.
-
-@item STOP_SIGNAL
-This is the signal for stopping @value{GDBN}.  Defaults to
-@code{SIGTSTP}.  (Only redefined for the Convex.)
-
-@item USG
-Means that System V (prior to SVR4) include files are in use.  (FIXME:
-This symbol is abused in @file{infrun.c}, @file{regex.c}, and
-@file{utils.c} for other things, at the moment.)
-
 @item lint
 Define this to help placate @code{lint} in some situations.
 
@@ -2274,6 +2817,21 @@ The target architecture object is implemented as the C structure
 @code{struct gdbarch *}.  The structure, and its methods, are generated
 using the Bourne shell script @file{gdbarch.sh}.
 
+@menu
+* OS ABI Variant Handling::
+* Initialize New Architecture::
+* Registers and Memory::
+* Pointers and Addresses::
+* Address Classes::
+* Register Representation::
+* Frame Interpretation::
+* Inferior Call Setup::
+* Adding support for debugging core files::
+* Defining Other Architecture Features::
+* Adding a New Target::
+@end menu
+
+@node  OS ABI Variant Handling
 @section Operating System ABI Variant Handling
 @cindex OS ABI variants
 
@@ -2299,10 +2857,14 @@ A @dfn{handler} is used to fine-tune the @code{gdbarch} structure for the
 selected OS ABI.  There may be only one handler for a given OS ABI
 for each BFD architecture.
 
-The following OS ABI variants are defined in @file{osabi.h}:
+The following OS ABI variants are defined in @file{defs.h}:
 
 @table @code
 
+@findex GDB_OSABI_UNINITIALIZED
+@item GDB_OSABI_UNINITIALIZED
+Used for struct gdbarch_info if ABI is still uninitialized.
+
 @findex GDB_OSABI_UNKNOWN
 @item GDB_OSABI_UNKNOWN
 The ABI of the inferior is unknown.  The default @code{gdbarch}
@@ -2310,69 +2872,85 @@ settings for the architecture will be used.
 
 @findex GDB_OSABI_SVR4
 @item GDB_OSABI_SVR4
-UNIX System V Release 4
+UNIX System V Release 4.
 
 @findex GDB_OSABI_HURD
 @item GDB_OSABI_HURD
-GNU using the Hurd kernel
+GNU using the Hurd kernel.
 
 @findex GDB_OSABI_SOLARIS
 @item GDB_OSABI_SOLARIS
-Sun Solaris
+Sun Solaris.
 
 @findex GDB_OSABI_OSF1
 @item GDB_OSABI_OSF1
-OSF/1, including Digital UNIX and Compaq Tru64 UNIX
+OSF/1, including Digital UNIX and Compaq Tru64 UNIX.
 
 @findex GDB_OSABI_LINUX
 @item GDB_OSABI_LINUX
-GNU using the Linux kernel
+GNU using the Linux kernel.
 
 @findex GDB_OSABI_FREEBSD_AOUT
 @item GDB_OSABI_FREEBSD_AOUT
-FreeBSD using the a.out executable format
+FreeBSD using the @code{a.out} executable format.
 
 @findex GDB_OSABI_FREEBSD_ELF
 @item GDB_OSABI_FREEBSD_ELF
-FreeBSD using the ELF executable format
+FreeBSD using the ELF executable format.
 
 @findex GDB_OSABI_NETBSD_AOUT
 @item GDB_OSABI_NETBSD_AOUT
-NetBSD using the a.out executable format
+NetBSD using the @code{a.out} executable format.
 
 @findex GDB_OSABI_NETBSD_ELF
 @item GDB_OSABI_NETBSD_ELF
-NetBSD using the ELF executable format
+NetBSD using the ELF executable format.
+
+@findex GDB_OSABI_OPENBSD_ELF
+@item GDB_OSABI_OPENBSD_ELF
+OpenBSD using the ELF executable format.
 
 @findex GDB_OSABI_WINCE
 @item GDB_OSABI_WINCE
-Windows CE
+Windows CE.
 
 @findex GDB_OSABI_GO32
 @item GDB_OSABI_GO32
-DJGPP
+DJGPP.
+
+@findex GDB_OSABI_IRIX
+@item GDB_OSABI_IRIX
+Irix.
+
+@findex GDB_OSABI_INTERIX
+@item GDB_OSABI_INTERIX
+Interix (Posix layer for MS-Windows systems).
+
+@findex GDB_OSABI_HPUX_ELF
+@item GDB_OSABI_HPUX_ELF
+HP/UX using the ELF executable format.
 
-@findex GDB_OSABI_NETWARE
-@item GDB_OSABI_NETWARE
-Novell NetWare
+@findex GDB_OSABI_HPUX_SOM
+@item GDB_OSABI_HPUX_SOM
+HP/UX using the SOM executable format.
 
-@findex GDB_OSABI_ARM_EABI_V1
-@item GDB_OSABI_ARM_EABI_V1
-ARM Embedded ABI version 1
+@findex GDB_OSABI_QNXNTO
+@item GDB_OSABI_QNXNTO
+QNX Neutrino.
 
-@findex GDB_OSABI_ARM_EABI_V2
-@item GDB_OSABI_ARM_EABI_V2
-ARM Embedded ABI version 2
+@findex GDB_OSABI_CYGWIN
+@item GDB_OSABI_CYGWIN
+Cygwin.
 
-@findex GDB_OSABI_ARM_APCS
-@item GDB_OSABI_ARM_APCS
-Generic ARM Procedure Call Standard
+@findex GDB_OSABI_AIX
+@item GDB_OSABI_AIX
+AIX.
 
 @end table
 
 Here are the functions that make up the OS ABI framework:
 
-@deftypefun const char *gdbarch_osabi_name (enum gdb_osabi @var{osabi})
+@deftypefun {const char *} gdbarch_osabi_name (enum gdb_osabi @var{osabi})
 Return the name of the OS ABI corresponding to @var{osabi}.
 @end deftypefun
 
@@ -2392,7 +2970,7 @@ be generic, and is allowed to examine @var{flavour}-flavoured files for
 any architecture.
 @end deftypefun
 
-@deftypefun enum gdb_osabi gdbarch_lookup_osabi (bfd *@var{abfd})
+@deftypefun {enum gdb_osabi} gdbarch_lookup_osabi (bfd *@var{abfd})
 Examine the file described by @var{abfd} to determine its OS ABI.
 The value @code{GDB_OSABI_UNKNOWN} is returned if the OS ABI cannot
 be determined.
@@ -2406,6 +2984,199 @@ architecture, a warning will be issued and the debugging session will continue
 with the defaults already established for @var{gdbarch}.
 @end deftypefun
 
+@deftypefun void generic_elf_osabi_sniff_abi_tag_sections (bfd *@var{abfd}, asection *@var{sect}, void *@var{obj})
+Helper routine for ELF file sniffers.  Examine the file described by
+@var{abfd} and look at ABI tag note sections to determine the OS ABI
+from the note.  This function should be called via
+@code{bfd_map_over_sections}.
+@end deftypefun
+
+@node Initialize New Architecture
+@section Initializing a New Architecture
+
+@menu
+* How an Architecture is Represented::
+* Looking Up an Existing Architecture::
+* Creating a New Architecture::
+@end menu
+
+@node How an Architecture is Represented
+@subsection How an Architecture is Represented
+@cindex architecture representation
+@cindex representation of architecture
+
+Each @code{gdbarch} is associated with a single @sc{bfd} architecture,
+via a @code{bfd_arch_@var{arch}} in the @code{bfd_architecture}
+enumeration.  The @code{gdbarch} is registered by a call to
+@code{register_gdbarch_init}, usually from the file's
+@code{_initialize_@var{filename}} routine, which will be automatically
+called during @value{GDBN} startup.  The arguments are a @sc{bfd}
+architecture constant and an initialization function.
+
+@findex _initialize_@var{arch}_tdep
+@cindex @file{@var{arch}-tdep.c}
+A @value{GDBN} description for a new architecture, @var{arch} is created by
+defining a global function @code{_initialize_@var{arch}_tdep}, by
+convention in the source file @file{@var{arch}-tdep.c}.  For example,
+in the case of the OpenRISC 1000, this function is called
+@code{_initialize_or1k_tdep} and is found in the file
+@file{or1k-tdep.c}.
+
+@cindex @file{configure.tgt}
+@cindex @code{gdbarch}
+@findex gdbarch_register
+The resulting object files containing the implementation of the
+@code{_initialize_@var{arch}_tdep} function are specified in the @value{GDBN}
+@file{configure.tgt} file, which includes a large case statement
+pattern matching against the @code{--target} option of the
+@code{configure} script.  The new @code{struct gdbarch} is created
+within the @code{_initialize_@var{arch}_tdep} function by calling
+@code{gdbarch_register}:
+
+@smallexample
+void gdbarch_register (enum bfd_architecture    @var{architecture},
+                       gdbarch_init_ftype      *@var{init_func},
+                       gdbarch_dump_tdep_ftype *@var{tdep_dump_func});
+@end smallexample
+
+The @var{architecture} will identify the unique @sc{bfd} to be
+associated with this @code{gdbarch}.  The @var{init_func} funciton is
+called to create and return the new @code{struct gdbarch}.  The
+@var{tdep_dump_func} function will dump the target specific details
+associated with this architecture.
+
+For example the function @code{_initialize_or1k_tdep} creates its
+architecture for 32-bit OpenRISC 1000 architectures by calling:
+
+@smallexample
+gdbarch_register (bfd_arch_or32, or1k_gdbarch_init, or1k_dump_tdep);
+@end smallexample
+
+@node Looking Up an Existing Architecture
+@subsection Looking Up an Existing Architecture
+@cindex @code{gdbarch} lookup
+
+The initialization function has this prototype:
+
+@smallexample
+static struct gdbarch *
+@var{arch}_gdbarch_init (struct gdbarch_info @var{info},
+                         struct gdbarch_list *@var{arches})
+@end smallexample
+
+The @var{info} argument contains parameters used to select the correct
+architecture, and @var{arches} is a list of architectures which
+have already been created with the same @code{bfd_arch_@var{arch}}
+value.
+
+The initialization function should first make sure that @var{info}
+is acceptable, and return @code{NULL} if it is not.  Then, it should
+search through @var{arches} for an exact match to @var{info}, and
+return one if found.  Lastly, if no exact match was found, it should
+create a new architecture based on @var{info} and return it.
+
+@findex gdbarch_list_lookup_by_info
+@cindex @code{gdbarch_info}
+The lookup is done using @code{gdbarch_list_lookup_by_info}.  It is
+passed the list of existing architectures, @var{arches}, and the
+@code{struct gdbarch_info}, @var{info}, and returns the first matching
+architecture it finds, or @code{NULL} if none are found.  If an
+architecture is found it can be returned as the result from the
+initialization function, otherwise a new @code{struct gdbach} will need
+to be created.
+
+The struct gdbarch_info has the following components:
+
+@smallexample
+struct gdbarch_info
+@{
+   const struct bfd_arch_info *bfd_arch_info;
+   int                         byte_order;
+   bfd                        *abfd;
+   struct gdbarch_tdep_info   *tdep_info;
+   enum gdb_osabi              osabi;
+   const struct target_desc   *target_desc;
+@};
+@end smallexample
+
+@vindex bfd_arch_info
+The @code{bfd_arch_info} member holds the key details about the
+architecture.  The @code{byte_order} member is a value in an
+enumeration indicating the endianism.  The @code{abfd} member is a
+pointer to the full @sc{bfd}, the @code{tdep_info} member is
+additional custom target specific information, @code{osabi} identifies
+which (if any) of a number of operating specific ABIs are used by this
+architecture and the @code{target_desc} member is a set of name-value
+pairs with information about register usage in this target.
+
+When the @code{struct gdbarch} initialization function is called, not
+all the fields are provided---only those which can be deduced from the
+@sc{bfd}.  The @code{struct gdbarch_info}, @var{info} is used as a
+look-up key with the list of existing architectures, @var{arches} to
+see if a suitable architecture already exists.  The @var{tdep_info},
+@var{osabi} and @var{target_desc} fields may be added before this
+lookup to refine the search.
+
+Only information in @var{info} should be used to choose the new
+architecture.  Historically, @var{info} could be sparse, and
+defaults would be collected from the first element on @var{arches}.
+However, @value{GDBN} now fills in @var{info} more thoroughly,
+so new @code{gdbarch} initialization functions should not take
+defaults from @var{arches}.
+
+@node Creating a New Architecture
+@subsection Creating a New Architecture
+@cindex @code{struct gdbarch} creation
+
+@findex gdbarch_alloc
+@cindex @code{gdbarch_tdep} when allocating new @code{gdbarch}
+If no architecture is found, then a new architecture must be created,
+by calling @code{gdbarch_alloc} using the supplied @code{@w{struct
+gdbarch_info}} and any additional custom target specific
+information in a @code{struct gdbarch_tdep}.  The prototype for
+@code{gdbarch_alloc} is:
+
+@smallexample
+struct gdbarch *gdbarch_alloc (const struct gdbarch_info *@var{info},
+                               struct gdbarch_tdep       *@var{tdep}); 
+@end smallexample
+
+@cindex @code{set_gdbarch} functions
+@cindex @code{gdbarch} accessor functions
+The newly created struct gdbarch must then be populated.  Although
+there are default values, in most cases they are not what is
+required.
+
+For each element, @var{X}, there is are a pair of corresponding accessor
+functions, one to set the value of that element,
+@code{set_gdbarch_@var{X}}, the second to either get the value of an
+element (if it is a variable) or to apply the element (if it is a
+function), @code{gdbarch_@var{X}}.  Note that both accessor functions
+take a pointer to the @code{@w{struct gdbarch}} as first
+argument.  Populating the new @code{gdbarch} should use the
+@code{set_gdbarch} functions.
+
+The following sections identify the main elements that should be set
+in this way.  This is not the complete list, but represents the
+functions and elements that must commonly be specified for a new
+architecture.  Many of the functions and variables are described in the
+header file @file{gdbarch.h}.
+
+This is the main work in defining a new architecture.  Implementing the
+set of functions to populate the @code{struct gdbarch}.
+
+@cindex @code{gdbarch_tdep} definition
+@code{struct gdbarch_tdep} is not defined within @value{GDBN}---it is up
+to the user to define this struct if it is needed to hold custom target
+information that is not covered by the standard @code{@w{struct
+gdbarch}}. For example with the OpenRISC 1000 architecture it is used to
+hold the number of matchpoints available in the target (along with other
+information).
+
+If there is no additional target specific information, it can be set to
+@code{NULL}.
+
+@node Registers and Memory
 @section Registers and Memory
 
 @value{GDBN}'s model of the target machine is rather simple.
@@ -2416,10 +3187,11 @@ block of memory.  Each register may have a different size.
 compiler's idea of which registers are which; however, it is critical
 that they do match up accurately.  The only way to make this work is
 to get accurate information about the order that the compiler uses,
-and to reflect that in the @code{REGISTER_NAME} and related macros.
+and to reflect that in the @code{gdbarch_register_name} and related functions.
 
 @value{GDBN} can handle big-endian, little-endian, and bi-endian architectures.
 
+@node Pointers and Addresses
 @section Pointers Are Not Always Addresses
 @cindex pointer representation
 @cindex address representation
@@ -2439,6 +3211,8 @@ However, architectures with smaller word sizes are often cramped for
 address space, so they may choose a pointer representation that breaks this
 identity, and allows a larger code address space.
 
+@c D10V is gone from sources - more current example?
+
 For example, the Renesas D10V is a 16-bit VLIW processor whose
 instructions are 32 bits long@footnote{Some D10V instructions are
 actually pairs of 16-bit sub-instructions.  However, since you can't
@@ -2529,28 +3303,29 @@ This function performs architecture-specific conversions as described
 above for @code{store_typed_address}.
 @end deftypefun
 
-Here are some macros which architectures can define to indicate the
+Here are two functions which architectures can define to indicate the
 relationship between pointers and addresses.  These have default
 definitions, appropriate for architectures on which all pointers are
 simple unsigned byte addresses.
 
-@deftypefn {Target Macro} CORE_ADDR POINTER_TO_ADDRESS (struct type *@var{type}, char *@var{buf})
+@deftypefun CORE_ADDR gdbarch_pointer_to_address (struct gdbarch *@var{gdbarch}, struct type *@var{type}, char *@var{buf})
 Assume that @var{buf} holds a pointer of type @var{type}, in the
 appropriate format for the current architecture.  Return the byte
 address the pointer refers to.
 
 This function may safely assume that @var{type} is either a pointer or a
 C@t{++} reference type.
-@end deftypefn
+@end deftypefun
 
-@deftypefn {Target Macro} void ADDRESS_TO_POINTER (struct type *@var{type}, char *@var{buf}, CORE_ADDR @var{addr})
+@deftypefun void gdbarch_address_to_pointer (struct gdbarch *@var{gdbarch}, struct type *@var{type}, char *@var{buf}, CORE_ADDR @var{addr})
 Store in @var{buf} a pointer of type @var{type} representing the address
 @var{addr}, in the appropriate format for the current architecture.
 
 This function may safely assume that @var{type} is either a pointer or a
 C@t{++} reference type.
-@end deftypefn
+@end deftypefun
 
+@node Address Classes
 @section Address Classes
 @cindex address classes
 @cindex DW_AT_byte_size
@@ -2566,32 +3341,32 @@ following macros should be defined in order to disambiguate these
 types within @value{GDBN} as well as provide the added information to
 a @value{GDBN} user when printing type expressions.
 
-@deftypefn {Target Macro} int ADDRESS_CLASS_TYPE_FLAGS (int @var{byte_size}, int @var{dwarf2_addr_class})
+@deftypefun int gdbarch_address_class_type_flags (struct gdbarch *@var{gdbarch}, int @var{byte_size}, int @var{dwarf2_addr_class})
 Returns the type flags needed to construct a pointer type whose size
 is @var{byte_size} and whose address class is @var{dwarf2_addr_class}.
 This function is normally called from within a symbol reader.  See
 @file{dwarf2read.c}.
-@end deftypefn
+@end deftypefun
 
-@deftypefn {Target Macro} char *ADDRESS_CLASS_TYPE_FLAGS_TO_NAME (int @var{type_flags})
+@deftypefun {char *} gdbarch_address_class_type_flags_to_name (struct gdbarch *@var{gdbarch}, int @var{type_flags})
 Given the type flags representing an address class qualifier, return
 its name.
-@end deftypefn
-@deftypefn {Target Macro} int ADDRESS_CLASS_NAME_to_TYPE_FLAGS (int @var{name}, int *var{type_flags_ptr})
-Given an address qualifier name, set the @code{int} refererenced by @var{type_flags_ptr} to the type flags
+@end deftypefun
+@deftypefun int gdbarch_address_class_name_to_type_flags (struct gdbarch *@var{gdbarch}, int @var{name}, int *@var{type_flags_ptr})
+Given an address qualifier name, set the @code{int} referenced by @var{type_flags_ptr} to the type flags
 for that address class qualifier.
-@end deftypefn
+@end deftypefun
 
 Since the need for address classes is rather rare, none of
-the address class macros defined by default.  Predicate
-macros are provided to detect when they are defined.
+the address class functions are defined by default.  Predicate
+functions are provided to detect when they are defined.
 
 Consider a hypothetical architecture in which addresses are normally
 32-bits wide, but 16-bit addresses are also supported.  Furthermore,
 suppose that the @w{DWARF 2} information for this architecture simply
 uses a @code{DW_AT_byte_size} value of 2 to indicate the use of one
 of these "short" pointers.  The following functions could be defined
-to implement the address class macros:
+to implement the address class functions:
 
 @smallexample
 somearch_address_class_type_flags (int byte_size,
@@ -2627,9 +3402,10 @@ somearch_address_class_name_to_type_flags (char *name,
 @end smallexample
 
 The qualifier @code{@@short} is used in @value{GDBN}'s type expressions
-to indicate the presence of one of these "short" pointers.  E.g, if
-the debug information indicates that @code{short_ptr_var} is one of these
-short pointers, @value{GDBN} might show the following behavior:
+to indicate the presence of one of these ``short'' pointers.  For
+example if the debug information indicates that @code{short_ptr_var} is
+one of these short pointers, @value{GDBN} might show the following
+behavior:
 
 @smallexample
 (gdb) ptype short_ptr_var
@@ -2637,131 +3413,288 @@ type = int * @@short
 @end smallexample
 
 
-@section Raw and Virtual Register Representations
-@cindex raw register representation
-@cindex virtual register representation
-@cindex representations, raw and virtual registers
-
-@emph{Maintainer note: This section is pretty much obsolete.  The
-functionality described here has largely been replaced by
-pseudo-registers and the mechanisms described in @ref{Target
-Architecture Definition, , Using Different Register and Memory Data
-Representations}.  See also @uref{http://www.gnu.org/software/gdb/bugs/,
-Bug Tracking Database} and
-@uref{http://sources.redhat.com/gdb/current/ari/, ARI Index} for more
-up-to-date information.}
-
-Some architectures use one representation for a value when it lives in a
-register, but use a different representation when it lives in memory.
-In @value{GDBN}'s terminology, the @dfn{raw} representation is the one used in
-the target registers, and the @dfn{virtual} representation is the one
-used in memory, and within @value{GDBN} @code{struct value} objects.
-
-@emph{Maintainer note: Notice that the same mechanism is being used to
-both convert a register to a @code{struct value} and alternative
-register forms.}
-
-For almost all data types on almost all architectures, the virtual and
-raw representations are identical, and no special handling is needed.
-However, they do occasionally differ.  For example:
+@node Register Representation
+@section Register Representation
 
-@itemize @bullet
-@item
-The x86 architecture supports an 80-bit @code{long double} type.  However, when
-we store those values in memory, they occupy twelve bytes: the
-floating-point number occupies the first ten, and the final two bytes
-are unused.  This keeps the values aligned on four-byte boundaries,
-allowing more efficient access.  Thus, the x86 80-bit floating-point
-type is the raw representation, and the twelve-byte loosely-packed
-arrangement is the virtual representation.
+@menu
+* Raw and Cooked Registers::
+* Register Architecture Functions & Variables::
+* Register Information Functions::
+* Register and Memory Data::
+* Register Caching::
+@end menu
 
-@item
-Some 64-bit MIPS targets present 32-bit registers to @value{GDBN} as 64-bit
-registers, with garbage in their upper bits.  @value{GDBN} ignores the top 32
-bits.  Thus, the 64-bit form, with garbage in the upper 32 bits, is the
-raw representation, and the trimmed 32-bit representation is the
-virtual representation.
-@end itemize
+@node Raw and Cooked Registers
+@subsection Raw and Cooked Registers
+@cindex raw register representation
+@cindex cooked register representation
+@cindex representations, raw and cooked registers
+
+@value{GDBN} considers registers to be a set with members numbered
+linearly from 0 upwards.  The first part of that set corresponds to real
+physical registers, the second part to any @dfn{pseudo-registers}.
+Pseudo-registers have no independent physical existence, but are useful
+representations of information within the architecture.  For example the
+OpenRISC 1000 architecture has up to 32 general purpose registers, which
+are typically represented as 32-bit (or 64-bit) integers.  However the
+GPRs are also used as operands to the floating point operations, and it
+could be convenient to define a set of pseudo-registers, to show the
+GPRs represented as floating point values.
+
+For any architecture, the implementer will decide on a mapping from
+hardware to @value{GDBN} register numbers.  The registers corresponding to real
+hardware are referred to as @dfn{raw} registers, the remaining registers are
+@dfn{pseudo-registers}.  The total register set (raw and pseudo) is called
+the @dfn{cooked} register set.
+
+
+@node Register Architecture Functions & Variables
+@subsection Functions and Variables Specifying the Register Architecture
+@cindex @code{gdbarch} register architecture functions
+
+These @code{struct gdbarch} functions and variables specify the number
+and type of registers in the architecture.
+
+@deftypefn {Architecture Function} CORE_ADDR read_pc (struct regcache *@var{regcache})
+@end deftypefn
+@deftypefn {Architecture Function} void write_pc (struct regcache *@var{regcache}, CORE_ADDR @var{val})
 
-In general, the raw representation is determined by the architecture, or
-@value{GDBN}'s interface to the architecture, while the virtual representation
-can be chosen for @value{GDBN}'s convenience.  @value{GDBN}'s register file,
-@code{registers}, holds the register contents in raw format, and the
-@value{GDBN} remote protocol transmits register values in raw format.
+Read or write the program counter.  The default value of both
+functions is @code{NULL} (no function available).  If the program
+counter is just an ordinary register, it can be specified in
+@code{struct gdbarch} instead (see @code{pc_regnum} below) and it will
+be read or written using the standard routines to access registers.  This
+function need only be specified if the program counter is not an
+ordinary register.
 
-Your architecture may define the following macros to request
-conversions between the raw and virtual format:
+Any register information can be obtained using the supplied register
+cache, @var{regcache}.  @xref{Register Caching, , Register Caching}.
 
-@deftypefn {Target Macro} int REGISTER_CONVERTIBLE (int @var{reg})
-Return non-zero if register number @var{reg}'s value needs different raw
-and virtual formats.
+@end deftypefn
 
-You should not use @code{REGISTER_CONVERT_TO_VIRTUAL} for a register
-unless this macro returns a non-zero value for that register.
+@deftypefn {Architecture Function} void pseudo_register_read (struct gdbarch *@var{gdbarch}, struct regcache *@var{regcache}, int @var{regnum}, const gdb_byte *@var{buf})
 @end deftypefn
+@deftypefn {Architecture Function} void pseudo_register_write (struct gdbarch *@var{gdbarch}, struct regcache *@var{regcache}, int @var{regnum}, const gdb_byte *@var{buf})
+
+These functions should be defined if there are any pseudo-registers.
+The default value is @code{NULL}.  @var{regnum} is the number of the
+register to read or write (which will be a @dfn{cooked} register
+number) and @var{buf} is the buffer where the value read will be
+placed, or from which the value to be written will be taken.  The
+value in the buffer may be converted to or from a signed or unsigned
+integral value using one of the utility functions (@pxref{Register and
+Memory Data, , Using Different Register and Memory Data
+Representations}).
+
+The access should be for the specified architecture,
+@var{gdbarch}.  Any register information can be obtained using the
+supplied register cache, @var{regcache}.  @xref{Register Caching, ,
+Register Caching}.
 
-@deftypefn {Target Macro} int DEPRECATED_REGISTER_RAW_SIZE (int @var{reg})
-The size of register number @var{reg}'s raw value.  This is the number
-of bytes the register will occupy in @code{registers}, or in a @value{GDBN}
-remote protocol packet.
 @end deftypefn
 
-@deftypefn {Target Macro} int DEPRECATED_REGISTER_VIRTUAL_SIZE (int @var{reg})
-The size of register number @var{reg}'s value, in its virtual format.
-This is the size a @code{struct value}'s buffer will have, holding that
-register's value.
+@deftypevr {Architecture Variable} int sp_regnum
+@vindex sp_regnum
+@cindex stack pointer
+@cindex @kbd{$sp}
+
+This specifies the register holding the stack pointer, which may be a
+raw or pseudo-register.  It defaults to -1 (not defined), but it is an
+error for it not to be defined.
+
+The value of the stack pointer register can be accessed withing
+@value{GDBN} as the variable @kbd{$sp}.
+
+@end deftypevr
+
+@deftypevr {Architecture Variable} int pc_regnum
+@vindex pc_regnum
+@cindex program counter
+@cindex @kbd{$pc}
+
+This specifies the register holding the program counter, which may be a
+raw or pseudo-register.  It defaults to -1 (not defined).  If
+@code{pc_regnum} is not defined, then the functions @code{read_pc} and
+@code{write_pc} (see above) must be defined.
+
+The value of the program counter (whether defined as a register, or
+through @code{read_pc} and @code{write_pc}) can be accessed withing
+@value{GDBN} as the variable @kbd{$pc}.
+
+@end deftypevr
+
+@deftypevr {Architecture Variable} int ps_regnum
+@vindex ps_regnum
+@cindex processor status register
+@cindex status register
+@cindex @kbd{$ps}
+
+This specifies the register holding the processor status (often called
+the status register), which may be a raw or pseudo-register.  It
+defaults to -1 (not defined).
+
+If defined, the value of this register can be accessed withing
+@value{GDBN} as the variable @kbd{$ps}.
+
+@end deftypevr
+
+@deftypevr {Architecture Variable} int fp0_regnum
+@vindex fp0_regnum
+@cindex first floating point register
+
+This specifies the first floating point register.  It defaults to
+0.  @code{fp0_regnum} is not needed unless the target offers support
+for floating point.
+
+@end deftypevr
+
+@node Register Information Functions
+@subsection Functions Giving Register Information
+@cindex @code{gdbarch} register information functions
+
+These functions return information about registers.
+
+@deftypefn {Architecture Function} {const char *} register_name (struct gdbarch *@var{gdbarch}, int @var{regnum})
+
+This function should convert a register number (raw or pseudo) to a
+register name (as a C @code{const char *}).  This is used both to
+determine the name of a register for output and to work out the meaning
+of any register names used as input.  The function may also return
+@code{NULL}, to indicate that @var{regnum} is not a valid register.
+
+For example with the OpenRISC 1000, @value{GDBN} registers 0-31 are the
+General Purpose Registers, register 32 is the program counter and
+register 33 is the supervision register (i.e.@: the processor status
+register), which map to the strings @code{"gpr00"} through
+@code{"gpr31"}, @code{"pc"} and @code{"sr"} respectively. This means
+that the @value{GDBN} command @kbd{print $gpr5} should print the value of
+the OR1K general purpose register 5@footnote{
+@cindex frame pointer
+@cindex @kbd{$fp}
+Historically, @value{GDBN} always had a concept of a frame pointer
+register, which could be accessed via the @value{GDBN} variable,
+@kbd{$fp}.  That concept is now deprecated, recognizing that not all
+architectures have a frame pointer.  However if an architecture does
+have a frame pointer register, and defines a register or
+pseudo-register with the name @code{"fp"}, then that register will be
+used as the value of the @kbd{$fp} variable.}.
+
+The default value for this function is @code{NULL}, meaning
+undefined. It should always be defined.
+
+The access should be for the specified architecture, @var{gdbarch}.
+
 @end deftypefn
 
-@deftypefn {Target Macro} struct type *DEPRECATED_REGISTER_VIRTUAL_TYPE (int @var{reg})
-This is the type of the virtual representation of register number
-@var{reg}.  Note that there is no need for a macro giving a type for the
-register's raw form; once the register's value has been obtained, @value{GDBN}
-always uses the virtual form.
+@deftypefn {Architecture Function} {struct type *} register_type (struct gdbarch *@var{gdbarch}, int @var{regnum})
+
+Given a register number, this function identifies the type of data it
+may be holding, specified as a @code{struct type}.  @value{GDBN} allows
+creation of arbitrary types, but a number of built in types are
+provided (@code{builtin_type_void}, @code{builtin_type_int32} etc),
+together with functions to derive types from these.
+
+Typically the program counter will have a type of ``pointer to
+function'' (it points to code), the frame pointer and stack pointer
+will have types of ``pointer to void'' (they point to data on the stack)
+and all other integer registers will have a type of 32-bit integer or
+64-bit integer.
+
+This information guides the formatting when displaying register
+information.  The default value is @code{NULL} meaning no information is
+available to guide formatting when displaying registers.
+
 @end deftypefn
 
-@deftypefn {Target Macro} void REGISTER_CONVERT_TO_VIRTUAL (int @var{reg}, struct type *@var{type}, char *@var{from}, char *@var{to})
-Convert the value of register number @var{reg} to @var{type}, which
-should always be @code{DEPRECATED_REGISTER_VIRTUAL_TYPE (@var{reg})}.  The buffer
-at @var{from} holds the register's value in raw format; the macro should
-convert the value to virtual format, and place it at @var{to}.
+@deftypefn {Architecture Function} void print_registers_info (struct gdbarch *@var{gdbarch}, struct ui_file *@var{file}, struct frame_info *@var{frame}, int @var{regnum}, int @var{all})
 
-Note that @code{REGISTER_CONVERT_TO_VIRTUAL} and
-@code{REGISTER_CONVERT_TO_RAW} take their @var{reg} and @var{type}
-arguments in different orders.
+Define this function to print out one or all of the registers for the
+@value{GDBN} @kbd{info registers} command.  The default value is the
+function @code{default_print_registers_info}, which uses the register
+type information (see @code{register_type} above) to determine how each
+register should be printed.  Define a custom version of this function
+for fuller control over how the registers are displayed.
+
+The access should be for the specified architecture, @var{gdbarch},
+with output to the the file specified by the User Interface
+Independent Output file handle, @var{file} (@pxref{UI-Independent
+Output, , UI-Independent Output---the @code{ui_out}
+Functions}).
+
+The registers should show their values in the frame specified by
+@var{frame}.  If @var{regnum} is -1 and @var{all} is zero, then all
+the ``significant'' registers should be shown (the implementer should
+decide which registers are ``significant''). Otherwise only the value of
+the register specified by @var{regnum} should be output.  If
+@var{regnum} is -1 and @var{all} is non-zero (true), then the value of
+all registers should be shown.
+
+By default @code{default_print_registers_info} prints one register per
+line, and if @var{all} is zero omits floating-point registers.
 
-You should only use @code{REGISTER_CONVERT_TO_VIRTUAL} with registers
-for which the @code{REGISTER_CONVERTIBLE} macro returns a non-zero
-value.
 @end deftypefn
 
-@deftypefn {Target Macro} void REGISTER_CONVERT_TO_RAW (struct type *@var{type}, int @var{reg}, char *@var{from}, char *@var{to})
-Convert the value of register number @var{reg} to @var{type}, which
-should always be @code{DEPRECATED_REGISTER_VIRTUAL_TYPE (@var{reg})}.  The buffer
-at @var{from} holds the register's value in raw format; the macro should
-convert the value to virtual format, and place it at @var{to}.
+@deftypefn {Architecture Function} void print_float_info (struct gdbarch *@var{gdbarch}, struct ui_file *@var{file}, struct frame_info *@var{frame}, const char *@var{args})
+
+Define this function to provide output about the floating point unit and
+registers for the @value{GDBN} @kbd{info float} command respectively.
+The default value is @code{NULL} (not defined), meaning no information
+will be provided.
+
+The @var{gdbarch} and @var{file} and @var{frame} arguments have the same
+meaning as in the @code{print_registers_info} function above. The string
+@var{args} contains any supplementary arguments to the @kbd{info float}
+command.
+
+Define this function if the target supports floating point operations.
 
-Note that REGISTER_CONVERT_TO_VIRTUAL and REGISTER_CONVERT_TO_RAW take
-their @var{reg} and @var{type} arguments in different orders.
 @end deftypefn
 
+@deftypefn {Architecture Function} void print_vector_info (struct gdbarch *@var{gdbarch}, struct ui_file *@var{file}, struct frame_info *@var{frame}, const char *@var{args})
 
-@section Using Different Register and Memory Data Representations
+Define this function to provide output about the vector unit and
+registers for the @value{GDBN} @kbd{info vector} command respectively.
+The default value is @code{NULL} (not defined), meaning no information
+will be provided.
+
+The @var{gdbarch}, @var{file} and @var{frame} arguments have the
+same meaning as in the @code{print_registers_info} function above.  The
+string @var{args} contains any supplementary arguments to the @kbd{info
+vector} command.
+
+Define this function if the target supports vector operations.
+
+@end deftypefn
+
+@deftypefn {Architecture Function} int register_reggroup_p (struct gdbarch *@var{gdbarch}, int @var{regnum}, struct reggroup *@var{group})
+
+@value{GDBN} groups registers into different categories (general,
+vector, floating point etc).  This function, given a register,
+@var{regnum}, and group, @var{group}, returns 1 (true) if the register
+is in the group and 0 (false) otherwise.
+
+The information should be for the specified architecture,
+@var{gdbarch}
+
+The default value is the function @code{default_register_reggroup_p}
+which will do a reasonable job based on the type of the register (see
+the function @code{register_type} above), with groups for general
+purpose registers, floating point registers, vector registers and raw
+(i.e not pseudo) registers.
+
+@end deftypefn
+
+@node Register and Memory Data
+@subsection Using Different Register and Memory Data Representations
 @cindex register representation
 @cindex memory representation
 @cindex representations, register and memory
 @cindex register data formats, converting
 @cindex @code{struct value}, converting register contents to
 
-@emph{Maintainer's note: The way GDB manipulates registers is undergoing
-significant change.  Many of the macros and functions refered to in this
-section are likely to be subject to further revision.  See
-@uref{http://sources.redhat.com/gdb/current/ari/, A.R. Index} and
-@uref{http://www.gnu.org/software/gdb/bugs, Bug Tracking Database} for
-further information.  cagney/2002-05-06.}
-
-Some architectures can represent a data object in a register using a
-form that is different to the objects more normal memory representation.
-For example:
+Some architectures have different representations of data objects,
+depending whether the object is held in a register or memory.  For
+example:
 
 @itemize @bullet
 
@@ -2771,8 +3704,8 @@ floating-point registers.
 
 @item
 The x86 architecture supports 80-bit floating-point registers.  The
-@code{long double} data type occupies 96 bits in memory but only 80 bits
-when stored in a register.
+@code{long double} data type occupies 96 bits in memory but only 80
+bits when stored in a register.
 
 @end itemize
 
@@ -2783,76 +3716,748 @@ Interface.
 
 For almost all data types on almost all architectures, the two
 representations are identical, and no special handling is needed.
-However, they do occasionally differ.  Your architecture may define the
-following macros to request conversions between the register and memory
-representations of a data type:
+However, they do occasionally differ.  An architecture may define the
+following @code{struct gdbarch} functions to request conversions
+between the register and memory representations of a data type:
 
-@deftypefn {Target Macro} int CONVERT_REGISTER_P (int @var{reg})
-Return non-zero if the representation of a data value stored in this
-register may be different to the representation of that same data value
-when stored in memory.
+@deftypefn {Architecture Function} int gdbarch_convert_register_p (struct gdbarch *@var{gdbarch}, int @var{reg})
 
-When non-zero, the macros @code{REGISTER_TO_VALUE} and
-@code{VALUE_TO_REGISTER} are used to perform any necessary conversion.
+Return non-zero (true) if the representation of a data value stored in
+this register may be different to the representation of that same data
+value when stored in memory.  The default value is @code{NULL}
+(undefined).
+
+If this function is defined and returns non-zero, the @code{struct
+gdbarch} functions @code{gdbarch_register_to_value} and
+@code{gdbarch_value_to_register} (see below) should be used to perform
+any necessary conversion.
+
+If defined, this function should return zero for the register's native
+type, when no conversion is necessary.
 @end deftypefn
 
-@deftypefn {Target Macro} void REGISTER_TO_VALUE (int @var{reg}, struct type *@var{type}, char *@var{from}, char *@var{to})
-Convert the value of register number @var{reg} to a data object of type
-@var{type}.  The buffer at @var{from} holds the register's value in raw
-format; the converted value should be placed in the buffer at @var{to}.
+@deftypefn {Architecture Function} void gdbarch_register_to_value (struct gdbarch *@var{gdbarch}, int @var{reg}, struct type *@var{type}, char *@var{from}, char *@var{to})
+
+Convert the value of register number @var{reg} to a data object of
+type @var{type}.  The buffer at @var{from} holds the register's value
+in raw format; the converted value should be placed in the buffer at
+@var{to}.
+
+@quotation
+@emph{Note:} @code{gdbarch_register_to_value} and
+@code{gdbarch_value_to_register} take their @var{reg} and @var{type}
+arguments in different orders.
+@end quotation
 
-Note that @code{REGISTER_TO_VALUE} and @code{VALUE_TO_REGISTER} take
-their @var{reg} and @var{type} arguments in different orders.
+@code{gdbarch_register_to_value} should only be used with registers
+for which the @code{gdbarch_convert_register_p} function returns a
+non-zero value.
 
-You should only use @code{REGISTER_TO_VALUE} with registers for which
-the @code{CONVERT_REGISTER_P} macro returns a non-zero value.
 @end deftypefn
 
-@deftypefn {Target Macro} void VALUE_TO_REGISTER (struct type *@var{type}, int @var{reg}, char *@var{from}, char *@var{to})
+@deftypefn {Architecture Function} void gdbarch_value_to_register (struct gdbarch *@var{gdbarch}, struct type *@var{type}, int @var{reg}, char *@var{from}, char *@var{to})
+
 Convert a data value of type @var{type} to register number @var{reg}'
 raw format.
 
-Note that @code{REGISTER_TO_VALUE} and @code{VALUE_TO_REGISTER} take
-their @var{reg} and @var{type} arguments in different orders.
+@quotation
+@emph{Note:} @code{gdbarch_register_to_value} and
+@code{gdbarch_value_to_register} take their @var{reg} and @var{type}
+arguments in different orders.
+@end quotation
+
+@code{gdbarch_value_to_register} should only be used with registers
+for which the @code{gdbarch_convert_register_p} function returns a
+non-zero value.
 
-You should only use @code{VALUE_TO_REGISTER} with registers for which
-the @code{CONVERT_REGISTER_P} macro returns a non-zero value.
 @end deftypefn
 
-@deftypefn {Target Macro} void REGISTER_CONVERT_TO_TYPE (int @var{regnum}, struct type *@var{type}, char *@var{buf})
-See @file{mips-tdep.c}.  It does not do what you want.
+@node Register Caching
+@subsection Register Caching
+@cindex register caching
+
+Caching of registers is used, so that the target does not need to be
+accessed and reanalyzed multiple times for each register in
+circumstances where the register value cannot have changed.
+
+@cindex @code{struct regcache}
+@value{GDBN} provides @code{struct regcache}, associated with a
+particular @code{struct gdbarch} to hold the cached values of the raw
+registers.  A set of functions is provided to access both the raw
+registers (with @code{raw} in their name) and the full set of cooked
+registers (with @code{cooked} in their name).  Functions are provided
+to ensure the register cache is kept synchronized with the values of
+the actual registers in the target.
+
+Accessing registers through the @code{struct regcache} routines will
+ensure that the appropriate @code{struct gdbarch} functions are called
+when necessary to access the underlying target architecture.  In general
+users should use the @dfn{cooked} functions, since these will map to the
+@dfn{raw} functions automatically as appropriate.
+
+@findex regcache_cooked_read
+@findex regcache_cooked_write
+@cindex @code{gdb_byte}
+@findex regcache_cooked_read_signed
+@findex regcache_cooked_read_unsigned
+@findex regcache_cooked_write_signed
+@findex regcache_cooked_write_unsigned
+The two key functions are @code{regcache_cooked_read} and
+@code{regcache_cooked_write} which read or write a register from or to
+a byte buffer (type @code{gdb_byte *}).  For convenience the wrapper
+functions @code{regcache_cooked_read_signed},
+@code{regcache_cooked_read_unsigned},
+@code{regcache_cooked_write_signed} and
+@code{regcache_cooked_write_unsigned} are provided, which read or
+write the value using the buffer and convert to or from an integral
+value as appropriate.
+
+@node Frame Interpretation
+@section Frame Interpretation
+
+@menu
+* All About Stack Frames::
+* Frame Handling Terminology::
+* Prologue Caches::
+* Functions and Variable to Analyze Frames::
+* Functions to Access Frame Data::
+* Analyzing Stacks---Frame Sniffers::
+@end menu
+
+@node All About Stack Frames
+@subsection All About Stack Frames
+
+@value{GDBN} needs to understand the stack on which local (automatic)
+variables are stored.  The area of the stack containing all the local
+variables for a function invocation is known as the @dfn{stack frame}
+for that function (or colloquially just as the @dfn{frame}).  In turn the
+function that called the function will have its stack frame, and so on
+back through the chain of functions that have been called.
+
+Almost all architectures have one register dedicated to point to the
+end of the stack (the @dfn{stack pointer}).  Many have a second register
+which points to the start of the currently active stack frame (the
+@dfn{frame pointer}).  The specific arrangements for an architecture are
+a key part of the ABI.
+
+A diagram helps to explain this.  Here is a simple program to compute
+factorials:
+
+@smallexample
+#include <stdio.h>
+int fact (int n)
+@{
+  if (0 == n)
+    @{
+      return 1;
+    @}
+  else
+    @{
+      return n * fact (n - 1);
+    @}
+@}
+
+main ()
+@{
+  int i;
+
+  for (i = 0; i < 10; i++)
+    @{
+      int   f = fact (i);
+      printf ("%d! = %d\n", i, f);
+    @}
+@}
+@end smallexample
+
+Consider the state of the stack when the code reaches line 6 after the
+main program has called @code{fact@w{ }(3)}.  The chain of function
+calls will be @code{main ()}, @code{fact@w{ }(3)}, @code{fact@w{
+}(2)}, @code{@w{fact (1)}} and @code{fact@w{ }(0)}.
+
+In this illustration the stack is falling (as used for example by the
+OpenRISC 1000 ABI).  The stack pointer (SP) is at the end of the stack
+(lowest address) and the frame pointer (FP) is at the highest address
+in the current stack frame.  The following diagram shows how the stack
+looks.
+
+@center @image{stack_frame,14cm}
+
+In each stack frame, offset 0 from the stack pointer is the frame
+pointer of the previous frame and offset 4 (this is illustrating a
+32-bit architecture) from the stack pointer is the return address.
+Local variables are indexed from the frame pointer, with negative
+indexes.  In the function @code{fact}, offset -4 from the frame
+pointer is the argument @var{n}.  In the @code{main} function, offset
+-4 from the frame pointer is the local variable @var{i} and offset -8
+from the frame pointer is the local variable @var{f}@footnote{This is
+a simplified example for illustrative purposes only.  Good optimizing
+compilers would not put anything on the stack for such simple
+functions.  Indeed they might eliminate the recursion and use of the
+stack entirely!}.
+
+It is very easy to get confused when examining stacks.  @value{GDBN}
+has terminology it uses rigorously throughout.  The stack frame of the
+function currently executing, or where execution stopped is numbered
+zero.  In this example frame #0 is the stack frame of the call to
+@code{fact@w{ }(0)}.  The stack frame of its calling function
+(@code{fact@w{ }(1)} in this case) is numbered #1 and so on back
+through the chain of calls.
+
+The main @value{GDBN} data structure describing frames is
+ @code{@w{struct frame_info}}.  It is not used directly, but only via
+its accessor functions.  @code{frame_info} includes information about
+the registers in the frame and a pointer to the code of the function
+with which the frame is associated.  The entire stack is represented as
+a linked list of @code{frame_info} structs.
+
+@node Frame Handling Terminology
+@subsection Frame Handling Terminology
+
+It is easy to get confused when referencing stack frames.  @value{GDBN}
+uses some precise terminology.
+
+@itemize @bullet
+
+@item
+@cindex THIS frame
+@cindex stack frame, definition of THIS frame
+@cindex frame, definition of THIS frame
+@dfn{THIS} frame is the frame currently under consideration.
+
+@item
+@cindex NEXT frame
+@cindex stack frame, definition of NEXT frame
+@cindex frame, definition of NEXT frame
+The @dfn{NEXT} frame, also sometimes called the inner or newer frame is the
+frame of the function called by the function of THIS frame.
+
+@item
+@cindex PREVIOUS frame
+@cindex stack frame, definition of PREVIOUS frame
+@cindex frame, definition of PREVIOUS frame
+The @dfn{PREVIOUS} frame, also sometimes called the outer or older frame is
+the frame of the function which called the function of THIS frame.
+
+@end itemize
+
+So in the example in the previous section (@pxref{All About Stack
+Frames, , All About Stack Frames}), if THIS frame is #3 (the call to
+@code{fact@w{ }(3)}), the NEXT frame is frame #2 (the call to
+@code{fact@w{ }(2)}) and the PREVIOUS frame is frame #4 (the call to
+@code{main@w{ }()}).
+
+@cindex innermost frame
+@cindex stack frame, definition of innermost frame
+@cindex frame, definition of innermost frame
+The @dfn{innermost} frame is the frame of the current executing
+function, or where the program stopped, in this example, in the middle
+of the call to @code{@w{fact (0))}}.  It is always numbered frame #0.
+
+@cindex base of a frame
+@cindex stack frame, definition of base of a frame
+@cindex frame, definition of base of a frame
+The @dfn{base} of a frame is the address immediately before the start
+of the NEXT frame.  For a stack which grows down in memory (a
+@dfn{falling} stack) this will be the lowest address and for a stack
+which grows up in memory (a @dfn{rising} stack) this will be the
+highest address in the frame.
+
+@value{GDBN} functions to analyze the stack are typically given a
+pointer to the NEXT frame to determine information about THIS
+frame.  Information about THIS frame includes data on where the
+registers of the PREVIOUS frame are stored in this stack frame.  In
+this example the frame pointer of the PREVIOUS frame is stored at
+offset 0 from the stack pointer of THIS frame.
+
+@cindex unwinding
+@cindex stack frame, definition of unwinding
+@cindex frame, definition of unwinding
+The process whereby a function is given a pointer to the NEXT
+frame to work out information about THIS frame is referred to as
+@dfn{unwinding}.  The @value{GDBN} functions involved in this typically
+include unwind in their name.
+
+@cindex sniffing
+@cindex stack frame, definition of sniffing
+@cindex frame, definition of sniffing
+The process of analyzing a target to determine the information that
+should go in struct frame_info is called @dfn{sniffing}.  The functions
+that carry this out are called sniffers and typically include sniffer
+in their name.  More than one sniffer may be required to extract all
+the information for a particular frame.
+
+@cindex sentinel frame
+@cindex stack frame, definition of sentinel frame
+@cindex frame, definition of sentinel frame
+Because so many functions work using the NEXT frame, there is an issue
+about addressing the innermost frame---it has no NEXT frame.  To solve
+this @value{GDBN} creates a dummy frame #-1, known as the
+@dfn{sentinel} frame.
+
+@node Prologue Caches
+@subsection Prologue Caches
+
+@cindex function prologue
+@cindex prologue of a function
+All the frame sniffing functions typically examine the code at the
+start of the corresponding function, to determine the state of
+registers.  The ABI will save old values and set new values of key
+registers at the start of each function in what is known as the
+function @dfn{prologue}.
+
+@cindex prologue cache
+For any particular stack frame this data does not change, so all the
+standard unwinding functions, in addition to receiving a pointer to
+the NEXT frame as their first argument, receive a pointer to a
+@dfn{prologue cache} as their second argument.  This can be used to store
+values associated with a particular frame, for reuse on subsequent
+calls involving the same frame.
+
+It is up to the user to define the structure used (it is a
+@code{void@w{ }*} pointer) and arrange allocation and deallocation of
+storage.  However for general use, @value{GDBN} provides
+@code{@w{struct trad_frame_cache}}, with a set of accessor
+routines.  This structure holds the stack and code address of
+THIS frame, the base address of the frame, a pointer to the
+struct @code{frame_info} for the NEXT frame and details of
+where the registers of the PREVIOUS frame may be found in THIS
+frame.
+
+Typically the first time any sniffer function is called with NEXT
+frame, the prologue sniffer for THIS frame will be @code{NULL}.  The
+sniffer will analyze the frame, allocate a prologue cache structure
+and populate it.  Subsequent calls using the same NEXT frame will
+pass in this prologue cache, so the data can be returned with no
+additional analysis.
+
+@node Functions and Variable to Analyze Frames
+@subsection Functions and Variable to Analyze Frames
+
+These struct @code{gdbarch} functions and variable should be defined
+to provide analysis of the stack frame and allow it to be adjusted as
+required.
+
+@deftypefn {Architecture Function} CORE_ADDR skip_prologue (struct gdbarch *@var{gdbarch}, CORE_ADDR @var{pc})
+
+The prologue of a function is the code at the beginning of the
+function which sets up the stack frame, saves the return address
+etc.  The code representing the behavior of the function starts after
+the prologue.
+
+This function skips past the prologue of a function if the program
+counter, @var{pc}, is within the prologue of a function.  The result is
+the program counter immediately after the prologue.  With modern
+optimizing compilers, this may be a far from trivial exercise.  However
+the required information may be within the binary as DWARF2 debugging
+information, making the job much easier.
+
+The default value is @code{NULL} (not defined).  This function should always
+be provided, but can take advantage of DWARF2 debugging information,
+if that is available.
+
 @end deftypefn
 
+@deftypefn {Architecture Function} int inner_than (CORE_ADDR @var{lhs}, CORE_ADDR @var{rhs})
+@findex core_addr_lessthan
+@findex core_addr_greaterthan
 
-@section Frame Interpretation
+Given two frame or stack pointers, return non-zero (true) if the first
+represents the @dfn{inner} stack frame and 0 (false) otherwise.  This
+is used to determine whether the target has a stack which grows up in
+memory (rising stack) or grows down in memory (falling stack).
+@xref{All About Stack Frames, , All About Stack Frames}, for an
+explanation of @dfn{inner} frames.
+
+The default value of this function is @code{NULL} and it should always
+be defined.  However for almost all architectures one of the built-in
+functions can be used: @code{core_addr_lessthan} (for stacks growing
+down in memory) or @code{core_addr_greaterthan} (for stacks growing up
+in memory).
+
+@end deftypefn
+
+@anchor{frame_align}
+@deftypefn {Architecture Function} CORE_ADDR frame_align (struct gdbarch *@var{gdbarch}, CORE_ADDR @var{address})
+@findex align_down
+@findex align_up
+
+The architecture may have constraints on how its frames are
+aligned.  For example the OpenRISC 1000 ABI requires stack frames to be
+double-word aligned, but 32-bit versions of the architecture allocate
+single-word values to the stack.  Thus extra padding may be needed at
+the end of a stack frame.
+
+Given a proposed address for the stack pointer, this function
+returns a suitably aligned address (by expanding the stack frame).
+
+The default value is @code{NULL} (undefined).  This function should be defined
+for any architecture where it is possible the stack could become
+misaligned.  The utility functions @code{align_down} (for falling
+stacks) and @code{align_up} (for rising stacks) will facilitate the
+implementation of this function.
+
+@end deftypefn
+
+@deftypevr {Architecture Variable} int frame_red_zone_size
+
+Some ABIs reserve space beyond the end of the stack for use by leaf
+functions without prologue or epilogue or by exception handlers (for
+example the OpenRISC 1000).
+
+This is known as a @dfn{red zone} (AMD terminology).  The @sc{amd64}
+(nee x86-64) ABI documentation refers to the @dfn{red zone} when
+describing this scratch area.
+
+The default value is 0.  Set this field if the architecture has such a
+red zone.  The value must be aligned as required by the ABI (see
+@code{frame_align} above for an explanation of stack frame alignment).
+
+@end deftypevr
+
+@node Functions to Access Frame Data
+@subsection Functions to Access Frame Data
+
+These functions provide access to key registers and arguments in the
+stack frame.
+
+@deftypefn {Architecture Function} CORE_ADDR unwind_pc (struct gdbarch *@var{gdbarch}, struct frame_info *@var{next_frame})
+
+This function is given a pointer to the NEXT stack frame (@pxref{All
+About Stack Frames, , All About Stack Frames}, for how frames are
+represented) and returns the value of the program counter in the
+PREVIOUS frame (i.e.@: the frame of the function that called THIS
+one).  This is commonly referred to as the @dfn{return address}.
+
+The implementation, which must be frame agnostic (work with any frame),
+is typically no more than:
+
+@smallexample
+ULONGEST pc;
+pc = frame_unwind_register_unsigned (next_frame, @var{ARCH}_PC_REGNUM);
+return gdbarch_addr_bits_remove (gdbarch, pc);
+@end smallexample
+
+@end deftypefn
+
+@deftypefn {Architecture Function} CORE_ADDR unwind_sp (struct gdbarch *@var{gdbarch}, struct frame_info *@var{next_frame})
+
+This function is given a pointer to the NEXT stack frame
+(@pxref{All About Stack Frames, , All About Stack Frames} for how
+frames are represented) and returns the value of the stack pointer in
+the PREVIOUS frame (i.e.@: the frame of the function that called
+THIS one).
+
+The implementation, which must be frame agnostic (work with any frame),
+is typically no more than:
+
+@smallexample
+ULONGEST sp;
+sp = frame_unwind_register_unsigned (next_frame, @var{ARCH}_SP_REGNUM);
+return gdbarch_addr_bits_remove (gdbarch, sp);
+@end smallexample
+
+@end deftypefn
+
+@deftypefn {Architecture Function} int frame_num_args (struct gdbarch *@var{gdbarch}, struct frame_info *@var{this_frame})
+
+This function is given a pointer to THIS stack frame (@pxref{All
+About Stack Frames, , All About Stack Frames} for how frames are
+represented), and returns the number of arguments that are being
+passed, or -1 if not known.
+
+The default value is @code{NULL} (undefined), in which case the number of
+arguments passed on any stack frame is always unknown.  For many
+architectures this will be a suitable default.
+
+@end deftypefn
+
+@node Analyzing Stacks---Frame Sniffers
+@subsection Analyzing Stacks---Frame Sniffers
+
+When a program stops, @value{GDBN} needs to construct the chain of
+struct @code{frame_info} representing the state of the stack using
+appropriate @dfn{sniffers}.
+
+Each architecture requires appropriate sniffers, but they do not form
+entries in @code{@w{struct gdbarch}}, since more than one sniffer may
+be required and a sniffer may be suitable for more than one
+@code{@w{struct gdbarch}}.  Instead sniffers are associated with
+architectures using the following functions.
+
+@itemize @bullet
+
+@item
+@findex frame_unwind_append_sniffer
+@code{frame_unwind_append_sniffer} is used to add a new sniffer to
+analyze THIS frame when given a pointer to the NEXT frame.
+
+@item
+@findex frame_base_append_sniffer
+@code{frame_base_append_sniffer} is used to add a new sniffer
+which can determine information about the base of a stack frame.
+
+@item
+@findex frame_base_set_default
+@code{frame_base_set_default} is used to specify the default base
+sniffer.
+
+@end itemize
+
+These functions all take a reference to @code{@w{struct gdbarch}}, so
+they are associated with a specific architecture.  They are usually
+called in the @code{gdbarch} initialization function, after the
+@code{gdbarch} struct has been set up.  Unless a default has been set, the
+most recently appended sniffer will be tried first.
 
+The main frame unwinding sniffer (as set by
+@code{frame_unwind_append_sniffer)} returns a structure specifying
+a set of sniffing functions:
+
+@cindex @code{frame_unwind}
+@smallexample
+struct frame_unwind
+@{
+   enum frame_type            type;
+   frame_this_id_ftype       *this_id;
+   frame_prev_register_ftype *prev_register;
+   const struct frame_data   *unwind_data;
+   frame_sniffer_ftype       *sniffer;
+   frame_prev_pc_ftype       *prev_pc;
+   frame_dealloc_cache_ftype *dealloc_cache;
+@};
+@end smallexample
+
+The @code{type} field indicates the type of frame this sniffer can
+handle: normal, dummy (@pxref{Functions Creating Dummy Frames, ,
+Functions Creating Dummy Frames}), signal handler or sentinel.  Signal
+handlers sometimes have their own simplified stack structure for
+efficiency, so may need their own handlers.
+
+The @code{unwind_data} field holds additional information which may be
+relevant to particular types of frame.  For example it may hold
+additional information for signal handler frames.
+
+The remaining fields define functions that yield different types of
+information when given a pointer to the NEXT stack frame.  Not all
+functions need be provided.  If an entry is @code{NULL}, the next sniffer will
+be tried instead.
+
+@itemize @bullet
+
+@item
+@code{this_id} determines the stack pointer and function (code
+entry point) for THIS stack frame.
+
+@item
+@code{prev_register} determines where the values of registers for
+the PREVIOUS stack frame are stored in THIS stack frame.
+
+@item
+@code{sniffer} takes a look at THIS frame's registers to
+determine if this is the appropriate unwinder.
+
+@item
+@code{prev_pc} determines the program counter for THIS
+frame.  Only needed if the program counter is not an ordinary register
+(@pxref{Register Architecture Functions & Variables,
+, Functions and Variables Specifying the Register Architecture}).
+
+@item
+@code{dealloc_cache} frees any additional memory associated with
+the prologue cache for this frame (@pxref{Prologue Caches, , Prologue
+Caches}).
+
+@end itemize
+
+In general it is only the @code{this_id} and @code{prev_register}
+fields that need be defined for custom sniffers.
+
+The frame base sniffer is much simpler.  It is a @code{@w{struct
+frame_base}}, which refers to the corresponding @code{frame_unwind}
+struct and whose fields refer to functions yielding various addresses
+within the frame.
+
+@cindex @code{frame_base}
+@smallexample
+struct frame_base
+@{
+   const struct frame_unwind *unwind;
+   frame_this_base_ftype     *this_base;
+   frame_this_locals_ftype   *this_locals;
+   frame_this_args_ftype     *this_args;
+@};
+@end smallexample
+
+All the functions referred to take a pointer to the NEXT frame as
+argument. The function referred to by @code{this_base} returns the
+base address of THIS frame, the function referred to by
+@code{this_locals} returns the base address of local variables in THIS
+frame and the function referred to by @code{this_args} returns the
+base address of the function arguments in this frame.
+
+As described above, the base address of a frame is the address
+immediately before the start of the NEXT frame.  For a falling
+stack, this is the lowest address in the frame and for a rising stack
+it is the highest address in the frame.  For most architectures the
+same address is also the base address for local variables and
+arguments, in which case the same function can be used for all three
+entries@footnote{It is worth noting that if it cannot be determined in any
+other way (for example by there being a register with the name
+@code{"fp"}), then the result of the @code{this_base} function will be
+used as the value of the frame pointer variable @kbd{$fp} in
+@value{GDBN}.  This is very often not correct (for example with the
+OpenRISC 1000, this value is the stack pointer, @kbd{$sp}).  In this
+case a register (raw or pseudo) with the name @code{"fp"} should be
+defined.  It will be used in preference as the value of @kbd{$fp}.}.
+
+@node Inferior Call Setup
 @section Inferior Call Setup
+@cindex calls to the inferior
+
+@menu
+* About Dummy Frames::
+* Functions Creating Dummy Frames::
+@end menu
+
+@node About Dummy Frames
+@subsection About Dummy Frames
+@cindex dummy frames
+
+@value{GDBN} can call functions in the target code (for example by
+using the @kbd{call} or @kbd{print} commands).  These functions may be
+breakpointed, and it is essential that if a function does hit a
+breakpoint, commands like @kbd{backtrace} work correctly.
 
-@section Compiler Characteristics
+This is achieved by making the stack look as though the function had
+been called from the point where @value{GDBN} had previously stopped.
+This requires that @value{GDBN} can set up stack frames appropriate for
+such function calls.
 
-@section Target Conditionals
+@node Functions Creating Dummy Frames
+@subsection Functions Creating Dummy Frames
 
-This section describes the macros that you can use to define the target
-machine.
+The following functions provide the functionality to set up such
+@dfn{dummy} stack frames.
+
+@deftypefn {Architecture Function} CORE_ADDR push_dummy_call (struct gdbarch *@var{gdbarch}, struct value *@var{function}, struct regcache *@var{regcache}, CORE_ADDR @var{bp_addr}, int  @var{nargs}, struct value **@var{args}, CORE_ADDR @var{sp}, int  @var{struct_return}, CORE_ADDR @var{struct_addr})
+
+This function sets up a dummy stack frame for the function about to be
+called.  @code{push_dummy_call} is given the arguments to be passed
+and must copy them into registers or push them on to the stack as
+appropriate for the ABI.
+
+@var{function} is a pointer to the function
+that will be called and @var{regcache} the register cache from which
+values should be obtained.  @var{bp_addr} is the address to which the
+function should return (which is breakpointed, so @value{GDBN} can
+regain control, hence the name).  @var{nargs} is the number of
+arguments to pass and @var{args} an array containing the argument
+values.  @var{struct_return} is non-zero (true) if the function returns
+a structure, and if so @var{struct_addr} is the address in which the
+structure should be returned.
+
+ After calling this function, @value{GDBN} will pass control to the
+target at the address of the function, which will find the stack and
+registers set up just as expected.
+
+The default value of this function is @code{NULL} (undefined).  If the
+function is not defined, then @value{GDBN} will not allow the user to
+call functions within the target being debugged.
+
+@end deftypefn
+
+@deftypefn {Architecture Function} {struct frame_id} unwind_dummy_id (struct gdbarch *@var{gdbarch}, struct frame_info *@var{next_frame}) 
+
+This is the inverse of @code{push_dummy_call} which restores the stack
+pointer and program counter after a call to evaluate a function using
+a dummy stack frame.  The result is a @code{@w{struct frame_id}}, which
+contains the value of the stack pointer and program counter to be
+used.
+
+The NEXT frame pointer is provided as argument,
+@var{next_frame}.  THIS frame is the frame of the dummy function,
+which can be unwound, to yield the required stack pointer and program
+counter from the PREVIOUS frame.
+
+The default value is @code{NULL} (undefined).  If @code{push_dummy_call} is
+defined, then this function should also be defined.
+
+@end deftypefn
+
+@deftypefn {Architecture Function} CORE_ADDR push_dummy_code (struct gdbarch *@var{gdbarch}, CORE_ADDR @var{sp}, CORE_ADDR @var{funaddr}, struct value **@var{args}, int  @var{nargs}, struct type *@var{value_type}, CORE_ADDR *@var{real_pc}, CORE_ADDR *@var{bp_addr}, struct regcache *@var{regcache})
+
+If this function is not defined (its default value is @code{NULL}), a dummy
+call will use the entry point of the currently loaded code on the
+target as its return address.  A temporary breakpoint will be set
+there, so the location must be writable and have room for a
+breakpoint.
+
+It is possible that this default is not suitable.  It might not be
+writable (in ROM possibly), or the ABI might require code to be
+executed on return from a call to unwind the stack before the
+breakpoint is encountered.
+
+If either of these is the case, then push_dummy_code should be defined
+to push an instruction sequence onto the end of the stack to which the
+dummy call should return.
+
+The arguments are essentially the same as those to
+@code{push_dummy_call}.  However the function is provided with the
+type of the function result, @var{value_type}, @var{bp_addr} is used
+to return a value (the address at which the breakpoint instruction
+should be inserted) and @var{real pc} is used to specify the resume
+address when starting the call sequence.  The function should return
+the updated innermost stack address.
+
+@quotation
+@emph{Note:} This does require that code in the stack can be executed.
+Some Harvard architectures may not allow this.
+@end quotation
+
+@end deftypefn
+
+@node Adding support for debugging core files
+@section Adding support for debugging core files
+@cindex core files
+
+The prerequisite for adding core file support in @value{GDBN} is to have
+core file support in BFD.
+
+Once BFD support is available, writing the apropriate
+@code{regset_from_core_section} architecture function should be all
+that is needed in order to add support for core files in @value{GDBN}.
+
+@node Defining Other Architecture Features 
+@section Defining Other Architecture Features 
+
+This section describes other functions and values in @code{gdbarch},
+together with some useful macros, that you can use to define the
+target architecture.
 
 @table @code
 
-@item ADDR_BITS_REMOVE (addr)
-@findex ADDR_BITS_REMOVE
+@item CORE_ADDR gdbarch_addr_bits_remove (@var{gdbarch}, @var{addr})
+@findex gdbarch_addr_bits_remove
 If a raw machine instruction address includes any bits that are not
-really part of the address, then define this macro to expand into an
-expression that zeroes those bits in @var{addr}.  This is only used for
-addresses of instructions, and even then not in all contexts.
+really part of the address, then this function is used to zero those bits in
+@var{addr}.  This is only used for addresses of instructions, and even then not
+in all contexts.
 
 For example, the two low-order bits of the PC on the Hewlett-Packard PA
 2.0 architecture contain the privilege level of the corresponding
 instruction.  Since instructions must always be aligned on four-byte
 boundaries, the processor masks out these bits to generate the actual
-address of the instruction.  ADDR_BITS_REMOVE should filter out these
-bits with an expression such as @code{((addr) & ~3)}.
+address of the instruction.  @code{gdbarch_addr_bits_remove} would then for
+example look like that:
+@smallexample
+arch_addr_bits_remove (CORE_ADDR addr)
+@{
+  return (addr &= ~0x3);
+@}
+@end smallexample
 
-@item ADDRESS_CLASS_NAME_TO_TYPE_FLAGS (@var{name}, @var{type_flags_ptr})
-@findex ADDRESS_CLASS_NAME_TO_TYPE_FLAGS
+@item int address_class_name_to_type_flags (@var{gdbarch}, @var{name}, @var{type_flags_ptr})
+@findex address_class_name_to_type_flags
 If @var{name} is a valid address class qualifier name, set the @code{int}
 referenced by @var{type_flags_ptr} to the mask representing the qualifier
 and return 1.  If @var{name} is not a valid address class qualifier name,
@@ -2863,13 +4468,13 @@ The value for @var{type_flags_ptr} should be one of
 possibly some combination of these values or'd together.
 @xref{Target Architecture Definition, , Address Classes}.
 
-@item ADDRESS_CLASS_NAME_TO_TYPE_FLAGS_P ()
-@findex ADDRESS_CLASS_NAME_TO_TYPE_FLAGS_P
-Predicate which indicates whether @code{ADDRESS_CLASS_NAME_TO_TYPE_FLAGS}
+@item int address_class_name_to_type_flags_p (@var{gdbarch})
+@findex address_class_name_to_type_flags_p
+Predicate which indicates whether @code{address_class_name_to_type_flags}
 has been defined.
 
-@item ADDRESS_CLASS_TYPE_FLAGS (@var{byte_size}, @var{dwarf2_addr_class})
-@findex ADDRESS_CLASS_TYPE_FLAGS (@var{byte_size}, @var{dwarf2_addr_class})
+@item int gdbarch_address_class_type_flags (@var{gdbarch}, @var{byte_size}, @var{dwarf2_addr_class})
+@findex gdbarch_address_class_type_flags
 Given a pointers byte size (as described by the debug information) and
 the possible @code{DW_AT_address_class} value, return the type flags
 used by @value{GDBN} to represent this address class.  The value
@@ -2878,42 +4483,47 @@ returned should be one of @code{TYPE_FLAG_ADDRESS_CLASS_1},
 values or'd together.
 @xref{Target Architecture Definition, , Address Classes}.
 
-@item ADDRESS_CLASS_TYPE_FLAGS_P ()
-@findex ADDRESS_CLASS_TYPE_FLAGS_P
-Predicate which indicates whether @code{ADDRESS_CLASS_TYPE_FLAGS} has
+@item int gdbarch_address_class_type_flags_p (@var{gdbarch})
+@findex gdbarch_address_class_type_flags_p
+Predicate which indicates whether @code{gdbarch_address_class_type_flags_p} has
 been defined.
 
-@item ADDRESS_CLASS_TYPE_FLAGS_TO_NAME (@var{type_flags})
-@findex ADDRESS_CLASS_TYPE_FLAGS_TO_NAME
+@item const char *gdbarch_address_class_type_flags_to_name (@var{gdbarch}, @var{type_flags})
+@findex gdbarch_address_class_type_flags_to_name
 Return the name of the address class qualifier associated with the type
 flags given by @var{type_flags}.
 
-@item ADDRESS_CLASS_TYPE_FLAGS_TO_NAME_P ()
-@findex ADDRESS_CLASS_TYPE_FLAGS_TO_NAME_P
-Predicate which indicates whether @code{ADDRESS_CLASS_TYPE_FLAGS_TO_NAME} has
-been defined.
+@item int gdbarch_address_class_type_flags_to_name_p (@var{gdbarch})
+@findex gdbarch_address_class_type_flags_to_name_p
+Predicate which indicates whether @code{gdbarch_address_class_type_flags_to_name} has been defined.
 @xref{Target Architecture Definition, , Address Classes}.
 
-@item ADDRESS_TO_POINTER (@var{type}, @var{buf}, @var{addr})
-@findex ADDRESS_TO_POINTER
+@item void gdbarch_address_to_pointer (@var{gdbarch}, @var{type}, @var{buf}, @var{addr})
+@findex gdbarch_address_to_pointer
 Store in @var{buf} a pointer of type @var{type} representing the address
 @var{addr}, in the appropriate format for the current architecture.
-This macro may safely assume that @var{type} is either a pointer or a
+This function may safely assume that @var{type} is either a pointer or a
 C@t{++} reference type.
 @xref{Target Architecture Definition, , Pointers Are Not Always Addresses}.
 
-@item BELIEVE_PCC_PROMOTION
-@findex BELIEVE_PCC_PROMOTION
-Define if the compiler promotes a @code{short} or @code{char}
+@item int gdbarch_believe_pcc_promotion (@var{gdbarch})
+@findex gdbarch_believe_pcc_promotion
+Used to notify if the compiler promotes a @code{short} or @code{char}
 parameter to an @code{int}, but still reports the parameter as its
 original type, rather than the promoted type.
 
-@item BITS_BIG_ENDIAN
-@findex BITS_BIG_ENDIAN
-Define this if the numbering of bits in the targets does @strong{not} match the
-endianness of the target byte order.  A value of 1 means that the bits
+@item gdbarch_bits_big_endian (@var{gdbarch})
+@findex gdbarch_bits_big_endian
+This is used if the numbering of bits in the targets does @strong{not} match
+the endianism of the target byte order.  A value of 1 means that the bits
 are numbered in a big-endian bit order, 0 means little-endian.
 
+@item set_gdbarch_bits_big_endian (@var{gdbarch}, @var{bits_big_endian})
+@findex set_gdbarch_bits_big_endian
+Calling set_gdbarch_bits_big_endian with a value of 1 indicates that the
+bits in the target are numbered in a big-endian bit order, 0 indicates
+little-endian.
+
 @item BREAKPOINT
 @findex BREAKPOINT
 This is the character array initializer for the bit pattern to put into
@@ -2923,7 +4533,7 @@ pattern could be an invalid instruction.  The breakpoint must be no
 longer than the shortest instruction of the architecture.
 
 @code{BREAKPOINT} has been deprecated in favor of
-@code{BREAKPOINT_FROM_PC}.
+@code{gdbarch_breakpoint_from_pc}.
 
 @item BIG_BREAKPOINT
 @itemx LITTLE_BREAKPOINT
@@ -2932,56 +4542,50 @@ longer than the shortest instruction of the architecture.
 Similar to BREAKPOINT, but used for bi-endian targets.
 
 @code{BIG_BREAKPOINT} and @code{LITTLE_BREAKPOINT} have been deprecated in
-favor of @code{BREAKPOINT_FROM_PC}.
-
-@item DEPRECATED_REMOTE_BREAKPOINT
-@itemx DEPRECATED_LITTLE_REMOTE_BREAKPOINT
-@itemx DEPRECATED_BIG_REMOTE_BREAKPOINT
-@findex DEPRECATED_BIG_REMOTE_BREAKPOINT
-@findex DEPRECATED_LITTLE_REMOTE_BREAKPOINT
-@findex DEPRECATED_REMOTE_BREAKPOINT
-Specify the breakpoint instruction sequence for a remote target.
-@code{DEPRECATED_REMOTE_BREAKPOINT},
-@code{DEPRECATED_BIG_REMOTE_BREAKPOINT} and
-@code{DEPRECATED_LITTLE_REMOTE_BREAKPOINT} have been deprecated in
-favor of @code{BREAKPOINT_FROM_PC} (@pxref{BREAKPOINT_FROM_PC}).
-
-@item BREAKPOINT_FROM_PC (@var{pcptr}, @var{lenptr})
-@findex BREAKPOINT_FROM_PC
-@anchor{BREAKPOINT_FROM_PC} Use the program counter to determine the
+favor of @code{gdbarch_breakpoint_from_pc}.
+
+@item const gdb_byte *gdbarch_breakpoint_from_pc (@var{gdbarch}, @var{pcptr}, @var{lenptr})
+@findex gdbarch_breakpoint_from_pc
+@anchor{gdbarch_breakpoint_from_pc} Use the program counter to determine the
 contents and size of a breakpoint instruction.  It returns a pointer to
-a string of bytes that encode a breakpoint instruction, stores the
+a static string of bytes that encode a breakpoint instruction, stores the
 length of the string to @code{*@var{lenptr}}, and adjusts the program
 counter (if necessary) to point to the actual memory location where the
-breakpoint should be inserted.
+breakpoint should be inserted.  May return @code{NULL} to indicate that
+software breakpoints are not supported.
 
 Although it is common to use a trap instruction for a breakpoint, it's
 not required; for instance, the bit pattern could be an invalid
 instruction.  The breakpoint must be no longer than the shortest
 instruction of the architecture.
 
+Provided breakpoint bytes can be also used by @code{bp_loc_is_permanent} to
+detect permanent breakpoints.  @code{gdbarch_breakpoint_from_pc} should return
+an unchanged memory copy if it was called for a location with permanent
+breakpoint as some architectures use breakpoint instructions containing
+arbitrary parameter value.
+
 Replaces all the other @var{BREAKPOINT} macros.
 
-@item MEMORY_INSERT_BREAKPOINT (@var{addr}, @var{contents_cache})
-@itemx MEMORY_REMOVE_BREAKPOINT (@var{addr}, @var{contents_cache})
-@findex MEMORY_REMOVE_BREAKPOINT
-@findex MEMORY_INSERT_BREAKPOINT
+@item int gdbarch_memory_insert_breakpoint (@var{gdbarch}, @var{bp_tgt})
+@itemx gdbarch_memory_remove_breakpoint (@var{gdbarch}, @var{bp_tgt})
+@findex gdbarch_memory_remove_breakpoint
+@findex gdbarch_memory_insert_breakpoint
 Insert or remove memory based breakpoints.  Reasonable defaults
 (@code{default_memory_insert_breakpoint} and
 @code{default_memory_remove_breakpoint} respectively) have been
-provided so that it is not necessary to define these for most
-architectures.  Architectures which may want to define
-@code{MEMORY_INSERT_BREAKPOINT} and @code{MEMORY_REMOVE_BREAKPOINT} will
-likely have instructions that are oddly sized or are not stored in a
+provided so that it is not necessary to set these for most
+architectures.  Architectures which may want to set
+@code{gdbarch_memory_insert_breakpoint} and @code{gdbarch_memory_remove_breakpoint} will likely have instructions that are oddly sized or are not stored in a
 conventional manner.
 
 It may also be desirable (from an efficiency standpoint) to define
 custom breakpoint insertion and removal routines if
-@code{BREAKPOINT_FROM_PC} needs to read the target's memory for some
+@code{gdbarch_breakpoint_from_pc} needs to read the target's memory for some
 reason.
 
-@item ADJUST_BREAKPOINT_ADDRESS (@var{address})
-@findex ADJUST_BREAKPOINT_ADDRESS
+@item CORE_ADDR gdbarch_adjust_breakpoint_address (@var{gdbarch}, @var{bpaddr})
+@findex gdbarch_adjust_breakpoint_address
 @cindex breakpoint address adjusted
 Given an address at which a breakpoint is desired, return a breakpoint
 address adjusted to account for architectural constraints on
@@ -3005,7 +4609,7 @@ instruction on any instruction other than the first one in the bundle.
 in parallel, so the @emph{first} instruction is the instruction
 at the lowest address and has nothing to do with execution order.)
 
-The FR-V's @code{ADJUST_BREAKPOINT_ADDRESS} method will adjust a
+The FR-V's @code{gdbarch_adjust_breakpoint_address} method will adjust a
 breakpoint's address by scanning backwards for the beginning of
 the bundle, returning the address of the bundle.
 
@@ -3013,35 +4617,39 @@ Since the adjustment of a breakpoint may significantly alter a user's
 expectation, @value{GDBN} prints a warning when an adjusted breakpoint
 is initially set and each time that that breakpoint is hit.
 
-@item CALL_DUMMY_LOCATION
-@findex CALL_DUMMY_LOCATION
+@item int gdbarch_call_dummy_location (@var{gdbarch})
+@findex gdbarch_call_dummy_location
 See the file @file{inferior.h}.
 
-This method has been replaced by @code{push_dummy_code}
-(@pxref{push_dummy_code}).
+This method has been replaced by @code{gdbarch_push_dummy_code}
+(@pxref{gdbarch_push_dummy_code}).
 
-@item CANNOT_FETCH_REGISTER (@var{regno})
-@findex CANNOT_FETCH_REGISTER
-A C expression that should be nonzero if @var{regno} cannot be fetched
-from an inferior process.  This is only relevant if
-@code{FETCH_INFERIOR_REGISTERS} is not defined.
+@item int gdbarch_cannot_fetch_register (@var{gdbarch}, @var{regum})
+@findex gdbarch_cannot_fetch_register
+This function should return nonzero if @var{regno} cannot be fetched
+from an inferior process.
 
-@item CANNOT_STORE_REGISTER (@var{regno})
-@findex CANNOT_STORE_REGISTER
-A C expression that should be nonzero if @var{regno} should not be
+@item int gdbarch_cannot_store_register (@var{gdbarch}, @var{regnum})
+@findex gdbarch_cannot_store_register
+This function should return nonzero if @var{regno} should not be
 written to the target.  This is often the case for program counters,
-status words, and other special registers.  If this is not defined,
-@value{GDBN} will assume that all registers may be written.
+status words, and other special registers.  This function returns 0 as
+default so that @value{GDBN} will assume that all registers may be written.
 
-@item int CONVERT_REGISTER_P(@var{regnum})
-@findex CONVERT_REGISTER_P
-Return non-zero if register @var{regnum} can represent data values in a
-non-standard form.
+@item int gdbarch_convert_register_p (@var{gdbarch}, @var{regnum}, struct type *@var{type})
+@findex gdbarch_convert_register_p
+Return non-zero if register @var{regnum} represents data values of type
+@var{type} in a non-standard form.
 @xref{Target Architecture Definition, , Using Different Register and Memory Data Representations}.
 
-@item DECR_PC_AFTER_BREAK
-@findex DECR_PC_AFTER_BREAK
-Define this to be the amount by which to decrement the PC after the
+@item int gdbarch_fp0_regnum (@var{gdbarch})
+@findex gdbarch_fp0_regnum
+This function returns the number of the first floating point register,
+if the machine has such registers.  Otherwise, it returns -1.
+
+@item CORE_ADDR gdbarch_decr_pc_after_break (@var{gdbarch})
+@findex gdbarch_decr_pc_after_break
+This function shall return the amount by which to decrement the PC after the
 program encounters a breakpoint.  This is often the number of bytes in
 @code{BREAKPOINT}, though not always.  For most targets this value will be 0.
 
@@ -3050,212 +4658,15 @@ program encounters a breakpoint.  This is often the number of bytes in
 If defined, this should evaluate to 1 if @var{addr} is in a shared
 library in which breakpoints cannot be set and so should be disabled.
 
-@item PRINT_FLOAT_INFO()
-@findex PRINT_FLOAT_INFO
-If defined, then the @samp{info float} command will print information about
-the processor's floating point unit.
-
-@item print_registers_info (@var{gdbarch}, @var{frame}, @var{regnum}, @var{all})
-@findex print_registers_info
-If defined, pretty print the value of the register @var{regnum} for the
-specified @var{frame}.  If the value of @var{regnum} is -1, pretty print
-either all registers (@var{all} is non zero) or a select subset of
-registers (@var{all} is zero).
-
-The default method prints one register per line, and if @var{all} is
-zero omits floating-point registers.
-
-@item PRINT_VECTOR_INFO()
-@findex PRINT_VECTOR_INFO
-If defined, then the @samp{info vector} command will call this function
-to print information about the processor's vector unit.
-
-By default, the @samp{info vector} command will print all vector
-registers (the register's type having the vector attribute).
-
-@item DWARF_REG_TO_REGNUM
-@findex DWARF_REG_TO_REGNUM
-Convert DWARF register number into @value{GDBN} regnum.  If not defined,
-no conversion will be performed.
-
-@item DWARF2_REG_TO_REGNUM
-@findex DWARF2_REG_TO_REGNUM
-Convert DWARF2 register number into @value{GDBN} regnum.  If not
-defined, no conversion will be performed.
-
-@item ECOFF_REG_TO_REGNUM
-@findex ECOFF_REG_TO_REGNUM
-Convert ECOFF register number into @value{GDBN} regnum.  If not defined,
-no conversion will be performed.
-
-@item END_OF_TEXT_DEFAULT
-@findex END_OF_TEXT_DEFAULT
-This is an expression that should designate the end of the text section.
-@c (? FIXME ?)
-
-@item EXTRACT_RETURN_VALUE(@var{type}, @var{regbuf}, @var{valbuf})
-@findex EXTRACT_RETURN_VALUE
-Define this to extract a function's return value of type @var{type} from
-the raw register state @var{regbuf} and copy that, in virtual format,
-into @var{valbuf}.
-This method has been deprecated in favour of @code{gdbarch_return_value}
-(@pxref{gdbarch_return_value}).
-
-@item DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS(@var{regbuf})
-@findex DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS
-@anchor{DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS}
-When defined, extract from the array @var{regbuf} (containing the raw
-register state) the @code{CORE_ADDR} at which a function should return
-its structure value.
-
-@xref{gdbarch_return_value}.
-
-@item DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS_P()
-@findex DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS_P
-Predicate for @code{DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS}.
-
-@item DEPRECATED_FP_REGNUM
-@findex DEPRECATED_FP_REGNUM
-If the virtual frame pointer is kept in a register, then define this
-macro to be the number (greater than or equal to zero) of that register.
-
-This should only need to be defined if @code{DEPRECATED_TARGET_READ_FP}
-is not defined.
-
-@item DEPRECATED_FRAMELESS_FUNCTION_INVOCATION(@var{fi})
-@findex DEPRECATED_FRAMELESS_FUNCTION_INVOCATION
-Define this to an expression that returns 1 if the function invocation
-represented by @var{fi} does not have a stack frame associated with it.
-Otherwise return 0.
+@item int gdbarch_dwarf2_reg_to_regnum (@var{gdbarch}, @var{dwarf2_regnr})
+@findex gdbarch_dwarf2_reg_to_regnum
+Convert DWARF2 register number @var{dwarf2_regnr} into @value{GDBN} regnum.
+If not defined, no conversion will be performed.
 
-@item frame_align (@var{address})
-@anchor{frame_align}
-@findex frame_align
-Define this to adjust @var{address} so that it meets the alignment
-requirements for the start of a new stack frame.  A stack frame's
-alignment requirements are typically stronger than a target processors
-stack alignment requirements (@pxref{DEPRECATED_STACK_ALIGN}).
-
-This function is used to ensure that, when creating a dummy frame, both
-the initial stack pointer and (if needed) the address of the return
-value are correctly aligned.
-
-Unlike @code{DEPRECATED_STACK_ALIGN}, this function always adjusts the
-address in the direction of stack growth.
-
-By default, no frame based stack alignment is performed.
-
-@item int frame_red_zone_size
-
-The number of bytes, beyond the innermost-stack-address, reserved by the
-@sc{abi}.  A function is permitted to use this scratch area (instead of
-allocating extra stack space).
-
-When performing an inferior function call, to ensure that it does not
-modify this area, @value{GDBN} adjusts the innermost-stack-address by
-@var{frame_red_zone_size} bytes before pushing parameters onto the
-stack.
-
-By default, zero bytes are allocated.  The value must be aligned
-(@pxref{frame_align}).
-
-The @sc{amd64} (nee x86-64) @sc{abi} documentation refers to the
-@emph{red zone} when describing this scratch area.
-@cindex red zone
-
-@item DEPRECATED_FRAME_CHAIN(@var{frame})
-@findex DEPRECATED_FRAME_CHAIN
-Given @var{frame}, return a pointer to the calling frame.
-
-@item DEPRECATED_FRAME_CHAIN_VALID(@var{chain}, @var{thisframe})
-@findex DEPRECATED_FRAME_CHAIN_VALID
-Define this to be an expression that returns zero if the given frame is an
-outermost frame, with no caller, and nonzero otherwise.  Most normal
-situations can be handled without defining this macro, including @code{NULL}
-chain pointers, dummy frames, and frames whose PC values are inside the
-startup file (e.g.@: @file{crt0.o}), inside @code{main}, or inside
-@code{_start}.
-
-@item DEPRECATED_FRAME_INIT_SAVED_REGS(@var{frame})
-@findex DEPRECATED_FRAME_INIT_SAVED_REGS
-See @file{frame.h}.  Determines the address of all registers in the
-current stack frame storing each in @code{frame->saved_regs}.  Space for
-@code{frame->saved_regs} shall be allocated by
-@code{DEPRECATED_FRAME_INIT_SAVED_REGS} using
-@code{frame_saved_regs_zalloc}.
-
-@code{FRAME_FIND_SAVED_REGS} is deprecated.
-
-@item FRAME_NUM_ARGS (@var{fi})
-@findex FRAME_NUM_ARGS
-For the frame described by @var{fi} return the number of arguments that
-are being passed.  If the number of arguments is not known, return
-@code{-1}.
-
-@item DEPRECATED_FRAME_SAVED_PC(@var{frame})
-@findex DEPRECATED_FRAME_SAVED_PC
-@anchor{DEPRECATED_FRAME_SAVED_PC} Given @var{frame}, return the pc
-saved there.  This is the return address.
-
-This method is deprecated. @xref{unwind_pc}.
-
-@item CORE_ADDR unwind_pc (struct frame_info *@var{this_frame})
-@findex unwind_pc
-@anchor{unwind_pc} Return the instruction address, in @var{this_frame}'s
-caller, at which execution will resume after @var{this_frame} returns.
-This is commonly refered to as the return address.
-
-The implementation, which must be frame agnostic (work with any frame),
-is typically no more than:
-
-@smallexample
-ULONGEST pc;
-frame_unwind_unsigned_register (this_frame, D10V_PC_REGNUM, &pc);
-return d10v_make_iaddr (pc);
-@end smallexample
-
-@noindent
-@xref{DEPRECATED_FRAME_SAVED_PC}, which this method replaces.
-
-@item CORE_ADDR unwind_sp (struct frame_info *@var{this_frame})
-@findex unwind_sp
-@anchor{unwind_sp} Return the frame's inner most stack address.  This is
-commonly refered to as the frame's @dfn{stack pointer}.
-
-The implementation, which must be frame agnostic (work with any frame),
-is typically no more than:
-
-@smallexample
-ULONGEST sp;
-frame_unwind_unsigned_register (this_frame, D10V_SP_REGNUM, &sp);
-return d10v_make_daddr (sp);
-@end smallexample
-
-@noindent
-@xref{TARGET_READ_SP}, which this method replaces.
-
-@item FUNCTION_EPILOGUE_SIZE
-@findex FUNCTION_EPILOGUE_SIZE
-For some COFF targets, the @code{x_sym.x_misc.x_fsize} field of the
-function end symbol is 0.  For such targets, you must define
-@code{FUNCTION_EPILOGUE_SIZE} to expand into the standard size of a
-function's epilogue.
-
-@item DEPRECATED_FUNCTION_START_OFFSET
-@findex DEPRECATED_FUNCTION_START_OFFSET
-An integer, giving the offset in bytes from a function's address (as
-used in the values of symbols, function pointers, etc.), and the
-function's first genuine instruction.
-
-This is zero on almost all machines: the function's address is usually
-the address of its first instruction.  However, on the VAX, for
-example, each function starts with two bytes containing a bitmask
-indicating which registers to save upon entry to the function.  The
-VAX @code{call} instructions check this value, and save the
-appropriate registers automatically.  Thus, since the offset from the
-function's address to its first instruction is two bytes,
-@code{DEPRECATED_FUNCTION_START_OFFSET} would be 2 on the VAX.
+@item int gdbarch_ecoff_reg_to_regnum (@var{gdbarch}, @var{ecoff_regnr})
+@findex gdbarch_ecoff_reg_to_regnum
+Convert ECOFF register number  @var{ecoff_regnr} into @value{GDBN} regnum.  If
+not defined, no conversion will be performed.
 
 @item GCC_COMPILED_FLAG_SYMBOL
 @itemx GCC2_COMPILED_FLAG_SYMBOL
@@ -3264,109 +4675,45 @@ function's address to its first instruction is two bytes,
 If defined, these are the names of the symbols that @value{GDBN} will
 look for to detect that GCC compiled the file.  The default symbols
 are @code{gcc_compiled.} and @code{gcc2_compiled.},
-respectively.  (Currently only defined for the Delta 68.)
-
-@item @value{GDBN}_MULTI_ARCH
-@findex @value{GDBN}_MULTI_ARCH
-If defined and non-zero, enables support for multiple architectures
-within @value{GDBN}.
-
-This support can be enabled at two levels.  At level one, only
-definitions for previously undefined macros are provided; at level two,
-a multi-arch definition of all architecture dependent macros will be
-defined.
+respectively.  (Currently only defined for the Delta 68.)
 
-@item @value{GDBN}_TARGET_IS_HPPA
-@findex @value{GDBN}_TARGET_IS_HPPA
-This determines whether horrible kludge code in @file{dbxread.c} and
-@file{partial-stab.h} is used to mangle multiple-symbol-table files from
-HPPA's.  This should all be ripped out, and a scheme like @file{elfread.c}
-used instead.
-
-@item GET_LONGJMP_TARGET
-@findex GET_LONGJMP_TARGET
-For most machines, this is a target-dependent parameter.  On the
-DECstation and the Iris, this is a native-dependent parameter, since
-the header file @file{setjmp.h} is needed to define it.
-
-This macro determines the target PC address that @code{longjmp} will jump to,
-assuming that we have just stopped at a @code{longjmp} breakpoint.  It takes a
-@code{CORE_ADDR *} as argument, and stores the target PC value through this
-pointer.  It examines the current state of the machine as needed.
-
-@item DEPRECATED_GET_SAVED_REGISTER
-@findex DEPRECATED_GET_SAVED_REGISTER
-Define this if you need to supply your own definition for the function
-@code{DEPRECATED_GET_SAVED_REGISTER}.
+@item gdbarch_get_longjmp_target
+@findex gdbarch_get_longjmp_target
+This function determines the target PC address that @code{longjmp}
+will jump to, assuming that we have just stopped at a @code{longjmp}
+breakpoint.  It takes a @code{CORE_ADDR *} as argument, and stores the
+target PC value through this pointer.  It examines the current state
+of the machine as needed, typically by using a manually-determined
+offset into the @code{jmp_buf}.  (While we might like to get the offset
+from the target's @file{jmpbuf.h}, that header file cannot be assumed
+to be available when building a cross-debugger.)
 
 @item DEPRECATED_IBM6000_TARGET
 @findex DEPRECATED_IBM6000_TARGET
 Shows that we are configured for an IBM RS/6000 system.  This
 conditional should be eliminated (FIXME) and replaced by
-feature-specific macros.  It was introduced in haste and we are
+feature-specific macros.  It was introduced in haste and we are
 repenting at leisure.
 
 @item I386_USE_GENERIC_WATCHPOINTS
 An x86-based target can define this to use the generic x86 watchpoint
 support; see @ref{Algorithms, I386_USE_GENERIC_WATCHPOINTS}.
 
-@item SYMBOLS_CAN_START_WITH_DOLLAR
-@findex SYMBOLS_CAN_START_WITH_DOLLAR
-Some systems have routines whose names start with @samp{$}.  Giving this
-macro a non-zero value tells @value{GDBN}'s expression parser to check for such
-routines when parsing tokens that begin with @samp{$}.
-
-On HP-UX, certain system routines (millicode) have names beginning with
-@samp{$} or @samp{$$}.  For example, @code{$$dyncall} is a millicode
-routine that handles inter-space procedure calls on PA-RISC.
-
-@item DEPRECATED_INIT_EXTRA_FRAME_INFO (@var{fromleaf}, @var{frame})
-@findex DEPRECATED_INIT_EXTRA_FRAME_INFO
-If additional information about the frame is required this should be
-stored in @code{frame->extra_info}.  Space for @code{frame->extra_info}
-is allocated using @code{frame_extra_info_zalloc}.
-
-@item DEPRECATED_INIT_FRAME_PC (@var{fromleaf}, @var{prev})
-@findex DEPRECATED_INIT_FRAME_PC
-This is a C statement that sets the pc of the frame pointed to by
-@var{prev}.  [By default...]
-
-@item INNER_THAN (@var{lhs}, @var{rhs})
-@findex INNER_THAN
-Returns non-zero if stack address @var{lhs} is inner than (nearer to the
-stack top) stack address @var{rhs}. Define this as @code{lhs < rhs} if
-the target's stack grows downward in memory, or @code{lhs > rsh} if the
-stack grows upward.
-
-@item gdbarch_in_function_epilogue_p (@var{gdbarch}, @var{pc})
+@item gdbarch_in_function_epilogue_p (@var{gdbarch}, @var{addr})
 @findex gdbarch_in_function_epilogue_p
-Returns non-zero if the given @var{pc} is in the epilogue of a function.
+Returns non-zero if the given @var{addr} is in the epilogue of a function.
 The epilogue of a function is defined as the part of a function where
 the stack frame of the function already has been destroyed up to the
 final `return from function call' instruction.
 
-@item DEPRECATED_SIGTRAMP_START (@var{pc})
-@findex DEPRECATED_SIGTRAMP_START
-@itemx DEPRECATED_SIGTRAMP_END (@var{pc})
-@findex DEPRECATED_SIGTRAMP_END
-Define these to be the start and end address of the @code{sigtramp} for the
-given @var{pc}.  On machines where the address is just a compile time
-constant, the macro expansion will typically just ignore the supplied
-@var{pc}.
-
-@item IN_SOLIB_CALL_TRAMPOLINE (@var{pc}, @var{name})
-@findex IN_SOLIB_CALL_TRAMPOLINE
-Define this to evaluate to nonzero if the program is stopped in the
-trampoline that connects to a shared library.
-
-@item IN_SOLIB_RETURN_TRAMPOLINE (@var{pc}, @var{name})
-@findex IN_SOLIB_RETURN_TRAMPOLINE
-Define this to evaluate to nonzero if the program is stopped in the
+@item int gdbarch_in_solib_return_trampoline (@var{gdbarch}, @var{pc}, @var{name})
+@findex gdbarch_in_solib_return_trampoline
+Define this function to return nonzero if the program is stopped in the
 trampoline that returns from a shared library.
 
-@item IN_SOLIB_DYNSYM_RESOLVE_CODE (@var{pc})
-@findex IN_SOLIB_DYNSYM_RESOLVE_CODE
-Define this to evaluate to nonzero if the program is stopped in the
+@item target_so_ops.in_dynsym_resolve_code (@var{pc})
+@findex in_dynsym_resolve_code
+Define this to return nonzero if the program is stopped in the
 dynamic linker.
 
 @item SKIP_SOLIB_RESOLVER (@var{pc})
@@ -3377,8 +4724,8 @@ function.  A zero value indicates that it is not important or necessary
 to set a breakpoint to get through the dynamic linker and that single
 stepping will suffice.
 
-@item INTEGER_TO_ADDRESS (@var{type}, @var{buf})
-@findex INTEGER_TO_ADDRESS
+@item CORE_ADDR gdbarch_integer_to_address (@var{gdbarch}, @var{type}, @var{buf})
+@findex gdbarch_integer_to_address
 @cindex converting integers to addresses
 Define this when the architecture needs to handle non-pointer to address
 conversions specially.  Converts that value to an address according to
@@ -3394,80 +4741,25 @@ conversions in clever and useful ways.  It has, however, been pointed
 out that users aren't complaining about how @value{GDBN} casts integers
 to pointers; they are complaining that they can't take an address from a
 disassembly listing and give it to @code{x/i}.  Adding an architecture
-method like @code{INTEGER_TO_ADDRESS} certainly makes it possible for
+method like @code{gdbarch_integer_to_address} certainly makes it possible for
 @value{GDBN} to ``get it right'' in all circumstances.}
 
 @xref{Target Architecture Definition, , Pointers Are Not Always
 Addresses}.
 
-@item NO_HIF_SUPPORT
-@findex NO_HIF_SUPPORT
-(Specific to the a29k.)
-
-@item POINTER_TO_ADDRESS (@var{type}, @var{buf})
-@findex POINTER_TO_ADDRESS
+@item CORE_ADDR gdbarch_pointer_to_address (@var{gdbarch}, @var{type}, @var{buf})
+@findex gdbarch_pointer_to_address
 Assume that @var{buf} holds a pointer of type @var{type}, in the
 appropriate format for the current architecture.  Return the byte
 address the pointer refers to.
 @xref{Target Architecture Definition, , Pointers Are Not Always Addresses}.
 
-@item REGISTER_CONVERTIBLE (@var{reg})
-@findex REGISTER_CONVERTIBLE
-Return non-zero if @var{reg} uses different raw and virtual formats.
-@xref{Target Architecture Definition, , Raw and Virtual Register Representations}.
-
-@item REGISTER_TO_VALUE(@var{regnum}, @var{type}, @var{from}, @var{to})
-@findex REGISTER_TO_VALUE
+@item void gdbarch_register_to_value(@var{gdbarch}, @var{frame}, @var{regnum}, @var{type}, @var{fur})
+@findex gdbarch_register_to_value
 Convert the raw contents of register @var{regnum} into a value of type
 @var{type}.
 @xref{Target Architecture Definition, , Using Different Register and Memory Data Representations}.
 
-@item DEPRECATED_REGISTER_RAW_SIZE (@var{reg})
-@findex DEPRECATED_REGISTER_RAW_SIZE
-Return the raw size of @var{reg}; defaults to the size of the register's
-virtual type.
-@xref{Target Architecture Definition, , Raw and Virtual Register Representations}.
-
-@item register_reggroup_p (@var{gdbarch}, @var{regnum}, @var{reggroup})
-@findex register_reggroup_p
-@cindex register groups
-Return non-zero if register @var{regnum} is a member of the register
-group @var{reggroup}.
-
-By default, registers are grouped as follows:
-
-@table @code
-@item float_reggroup
-Any register with a valid name and a floating-point type.
-@item vector_reggroup
-Any register with a valid name and a vector type.
-@item general_reggroup
-Any register with a valid name and a type other than vector or
-floating-point.  @samp{float_reggroup}.
-@item save_reggroup
-@itemx restore_reggroup
-@itemx all_reggroup
-Any register with a valid name.
-@end table
-
-@item DEPRECATED_REGISTER_VIRTUAL_SIZE (@var{reg})
-@findex DEPRECATED_REGISTER_VIRTUAL_SIZE
-Return the virtual size of @var{reg}; defaults to the size of the
-register's virtual type.
-Return the virtual size of @var{reg}.
-@xref{Target Architecture Definition, , Raw and Virtual Register Representations}.
-
-@item DEPRECATED_REGISTER_VIRTUAL_TYPE (@var{reg})
-@findex REGISTER_VIRTUAL_TYPE
-Return the virtual type of @var{reg}.
-@xref{Target Architecture Definition, , Raw and Virtual Register Representations}.
-
-@item struct type *register_type (@var{gdbarch}, @var{reg})
-@findex register_type
-If defined, return the type of register @var{reg}.  This function
-superseeds @code{DEPRECATED_REGISTER_VIRTUAL_TYPE}.  @xref{Target Architecture
-Definition, , Raw and Virtual Register Representations}.
-
 @item REGISTER_CONVERT_TO_VIRTUAL(@var{reg}, @var{type}, @var{from}, @var{to})
 @findex REGISTER_CONVERT_TO_VIRTUAL
 Convert the value of register @var{reg} from its raw form to its virtual
@@ -3490,110 +4782,66 @@ Return the appropriate register set for a core file section with name
 Define this as 1 if the target does not have a hardware single-step
 mechanism.  The macro @code{SOFTWARE_SINGLE_STEP} must also be defined.
 
-@item SOFTWARE_SINGLE_STEP(@var{signal}, @var{insert_breapoints_p})
+@item SOFTWARE_SINGLE_STEP(@var{signal}, @var{insert_breakpoints_p})
 @findex SOFTWARE_SINGLE_STEP
 A function that inserts or removes (depending on
-@var{insert_breapoints_p}) breakpoints at each possible destinations of
-the next instruction. See @file{sparc-tdep.c} and @file{rs6000-tdep.c}
+@var{insert_breakpoints_p}) breakpoints at each possible destinations of
+the next instruction.  See @file{sparc-tdep.c} and @file{rs6000-tdep.c}
 for examples.
 
-@item SOFUN_ADDRESS_MAYBE_MISSING
-@findex SOFUN_ADDRESS_MAYBE_MISSING
+@item set_gdbarch_sofun_address_maybe_missing (@var{gdbarch}, @var{set})
+@findex set_gdbarch_sofun_address_maybe_missing
 Somebody clever observed that, the more actual addresses you have in the
 debug information, the more time the linker has to spend relocating
 them.  So whenever there's some other way the debugger could find the
 address it needs, you should omit it from the debug info, to make
 linking faster.
 
-@code{SOFUN_ADDRESS_MAYBE_MISSING} indicates that a particular set of
-hacks of this sort are in use, affecting @code{N_SO} and @code{N_FUN}
-entries in stabs-format debugging information.  @code{N_SO} stabs mark
-the beginning and ending addresses of compilation units in the text
-segment.  @code{N_FUN} stabs mark the starts and ends of functions.
+Calling @code{set_gdbarch_sofun_address_maybe_missing} with a non-zero
+argument @var{set} indicates that a particular set of hacks of this sort
+are in use, affecting @code{N_SO} and @code{N_FUN} entries in stabs-format
+debugging information.  @code{N_SO} stabs mark the beginning and ending
+addresses of compilation units in the text segment.  @code{N_FUN} stabs
+mark the starts and ends of functions.
 
-@code{SOFUN_ADDRESS_MAYBE_MISSING} means two things:
+In this case, @value{GDBN} assumes two things:
 
 @itemize @bullet
 @item
-@code{N_FUN} stabs have an address of zero.  Instead, you should find the
-addresses where the function starts by taking the function name from
-the stab, and then looking that up in the minsyms (the
-linker/assembler symbol table).  In other words, the stab has the
-name, and the linker/assembler symbol table is the only place that carries
-the address.
+@code{N_FUN} stabs have an address of zero.  Instead of using those
+addresses, you should find the address where the function starts by
+taking the function name from the stab, and then looking that up in the
+minsyms (the linker/assembler symbol table).  In other words, the stab
+has the name, and the linker/assembler symbol table is the only place
+that carries the address.
 
 @item
 @code{N_SO} stabs have an address of zero, too.  You just look at the
-@code{N_FUN} stabs that appear before and after the @code{N_SO} stab,
-and guess the starting and ending addresses of the compilation unit from
-them.
+@code{N_FUN} stabs that appear before and after the @code{N_SO} stab, and
+guess the starting and ending addresses of the compilation unit from them.
 @end itemize
 
-@item PC_LOAD_SEGMENT
-@findex PC_LOAD_SEGMENT
-If defined, print information about the load segment for the program
-counter.  (Defined only for the RS/6000.)
-
-@item PC_REGNUM
-@findex PC_REGNUM
-If the program counter is kept in a register, then define this macro to
-be the number (greater than or equal to zero) of that register.
-
-This should only need to be defined if @code{TARGET_READ_PC} and
-@code{TARGET_WRITE_PC} are not defined.
-
-@item PARM_BOUNDARY
-@findex PARM_BOUNDARY
-If non-zero, round arguments to a boundary of this many bits before
-pushing them on the stack.
-
-@item stabs_argument_has_addr (@var{gdbarch}, @var{type})
-@findex stabs_argument_has_addr
-@findex DEPRECATED_REG_STRUCT_HAS_ADDR
-@anchor{stabs_argument_has_addr} Define this to return nonzero if a
-function argument of type @var{type} is passed by reference instead of
-value.
-
-This method replaces @code{DEPRECATED_REG_STRUCT_HAS_ADDR}
-(@pxref{DEPRECATED_REG_STRUCT_HAS_ADDR}).
-
-@item PROCESS_LINENUMBER_HOOK
-@findex PROCESS_LINENUMBER_HOOK
-A hook defined for XCOFF reading.
-
-@item PROLOGUE_FIRSTLINE_OVERLAP
-@findex PROLOGUE_FIRSTLINE_OVERLAP
-(Only used in unsupported Convex configuration.)
+@item int gdbarch_stabs_argument_has_addr (@var{gdbarch}, @var{type})
+@findex gdbarch_stabs_argument_has_addr
+@anchor{gdbarch_stabs_argument_has_addr} Define this function to return
+nonzero if a function argument of type @var{type} is passed by reference
+instead of value.
 
-@item PS_REGNUM
-@findex PS_REGNUM
-If defined, this is the number of the processor status register.  (This
-definition is only used in generic code when parsing "$ps".)
-
-@item DEPRECATED_POP_FRAME
-@findex DEPRECATED_POP_FRAME
-@findex frame_pop
-If defined, used by @code{frame_pop} to remove a stack frame.  This
-method has been superseeded by generic code.
-
-@item push_dummy_call (@var{gdbarch}, @var{function}, @var{regcache}, @var{pc_addr}, @var{nargs}, @var{args}, @var{sp}, @var{struct_return}, @var{struct_addr})
-@findex push_dummy_call
-@findex DEPRECATED_PUSH_ARGUMENTS.
-@anchor{push_dummy_call} Define this to push the dummy frame's call to
-the inferior function onto the stack.  In addition to pushing
-@var{nargs}, the code should push @var{struct_addr} (when
-@var{struct_return}), and the return address (@var{bp_addr}).
+@item CORE_ADDR gdbarch_push_dummy_call (@var{gdbarch}, @var{function}, @var{regcache}, @var{bp_addr}, @var{nargs}, @var{args}, @var{sp}, @var{struct_return}, @var{struct_addr})
+@findex gdbarch_push_dummy_call
+@anchor{gdbarch_push_dummy_call} Define this to push the dummy frame's call to
+the inferior function onto the stack.  In addition to pushing @var{nargs}, the
+code should push @var{struct_addr} (when @var{struct_return} is non-zero), and
+the return address (@var{bp_addr}).
 
 @var{function} is a pointer to a @code{struct value}; on architectures that use
 function descriptors, this contains the function descriptor value.
 
 Returns the updated top-of-stack pointer.
 
-This method replaces @code{DEPRECATED_PUSH_ARGUMENTS}.
-
-@item CORE_ADDR push_dummy_code (@var{gdbarch}, @var{sp}, @var{funaddr}, @var{using_gcc}, @var{args}, @var{nargs}, @var{value_type}, @var{real_pc}, @var{bp_addr})
-@findex push_dummy_code
-@anchor{push_dummy_code} Given a stack based call dummy, push the
+@item CORE_ADDR gdbarch_push_dummy_code (@var{gdbarch}, @var{sp}, @var{funaddr}, @var{using_gcc}, @var{args}, @var{nargs}, @var{value_type}, @var{real_pc}, @var{bp_addr}, @var{regcache})
+@findex gdbarch_push_dummy_code
+@anchor{gdbarch_push_dummy_code} Given a stack based call dummy, push the
 instruction sequence (including space for a breakpoint) to which the
 called function should return.
 
@@ -3605,34 +4853,12 @@ By default, the stack is grown sufficient to hold a frame-aligned
 (@pxref{frame_align}) breakpoint, @var{bp_addr} is set to the address
 reserved for that breakpoint, and @var{real_pc} set to @var{funaddr}.
 
-This method replaces @code{CALL_DUMMY_LOCATION},
-@code{DEPRECATED_REGISTER_SIZE}.
-
-@item REGISTER_NAME(@var{i})
-@findex REGISTER_NAME
-Return the name of register @var{i} as a string.  May return @code{NULL}
-or @code{NUL} to indicate that register @var{i} is not valid.
+This method replaces @w{@code{gdbarch_call_dummy_location (@var{gdbarch})}}.
 
-@item DEPRECATED_REG_STRUCT_HAS_ADDR (@var{gcc_p}, @var{type})
-@findex DEPRECATED_REG_STRUCT_HAS_ADDR
-@anchor{DEPRECATED_REG_STRUCT_HAS_ADDR}Define this to return 1 if the
-given type will be passed by pointer rather than directly.
-
-This method has been replaced by @code{stabs_argument_has_addr}
-(@pxref{stabs_argument_has_addr}).
-
-@item SAVE_DUMMY_FRAME_TOS (@var{sp})
-@findex SAVE_DUMMY_FRAME_TOS
-@anchor{SAVE_DUMMY_FRAME_TOS} Used in @samp{call_function_by_hand} to
-notify the target dependent code of the top-of-stack value that will be
-passed to the the inferior code.  This is the value of the @code{SP}
-after both the dummy frame and space for parameters/results have been
-allocated on the stack.  @xref{unwind_dummy_id}.
-
-@item SDB_REG_TO_REGNUM
-@findex SDB_REG_TO_REGNUM
-Define this to convert sdb register numbers into @value{GDBN} regnums.  If not
-defined, no conversion will be done.
+@item int gdbarch_sdb_reg_to_regnum (@var{gdbarch}, @var{sdb_regnr})
+@findex gdbarch_sdb_reg_to_regnum
+Use this function to convert sdb register @var{sdb_regnr} into @value{GDBN}
+regnum.  If not defined, no conversion will be done.
 
 @item enum return_value_convention gdbarch_return_value (struct gdbarch *@var{gdbarch}, struct type *@var{valtype}, struct regcache *@var{regcache}, void *@var{readbuf}, const void *@var{writebuf})
 @findex gdbarch_return_value
@@ -3655,9 +4881,6 @@ non-@code{NULL}, also copy the return value from @var{regcache} into
 @var{readbuf} (@var{regcache} contains a copy of the registers from the
 just returned function).
 
-@xref{DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS}, for a description of how
-return-values that use the struct convention are handled.
-
 @emph{Maintainer note: This method replaces separate predicate, extract,
 store methods.  By having only one method, the logic needed to determine
 the return-value convention need only be implemented in one place.  If
@@ -3669,73 +4892,39 @@ return-value extract and store.}
 parameter, and such a parameter should not be added.  If an architecture
 that requires per-compiler or per-function information be identified,
 then the replacement of @var{rettype} with @code{struct value}
-@var{function} should be persued.}
+@var{function} should be pursued.}
 
 @emph{Maintainer note: The @var{regcache} parameter limits this methods
 to the inner most frame.  While replacing @var{regcache} with a
 @code{struct frame_info} @var{frame} parameter would remove that
 limitation there has yet to be a demonstrated need for such a change.}
 
-@item SKIP_PERMANENT_BREAKPOINT
-@findex SKIP_PERMANENT_BREAKPOINT
+@item void gdbarch_skip_permanent_breakpoint (@var{gdbarch}, @var{regcache})
+@findex gdbarch_skip_permanent_breakpoint
 Advance the inferior's PC past a permanent breakpoint.  @value{GDBN} normally
 steps over a breakpoint by removing it, stepping one instruction, and
 re-inserting the breakpoint.  However, permanent breakpoints are
 hardwired into the inferior, and can't be removed, so this strategy
-doesn't work.  Calling @code{SKIP_PERMANENT_BREAKPOINT} adjusts the processor's
-state so that execution will resume just after the breakpoint.  This
-macro does the right thing even when the breakpoint is in the delay slot
+doesn't work.  Calling @code{gdbarch_skip_permanent_breakpoint} adjusts the
+processor's state so that execution will resume just after the breakpoint.
+This function does the right thing even when the breakpoint is in the delay slot
 of a branch or jump.
 
-@item SKIP_PROLOGUE (@var{pc})
-@findex SKIP_PROLOGUE
-A C expression that returns the address of the ``real'' code beyond the
-function entry prologue found at @var{pc}.
-
-@item SKIP_TRAMPOLINE_CODE (@var{pc})
-@findex SKIP_TRAMPOLINE_CODE
+@item CORE_ADDR gdbarch_skip_trampoline_code (@var{gdbarch}, @var{frame}, @var{pc})
+@findex gdbarch_skip_trampoline_code
 If the target machine has trampoline code that sits between callers and
-the functions being called, then define this macro to return a new PC
+the functions being called, then define this function to return a new PC
 that is at the start of the real function.
 
-@item SP_REGNUM
-@findex SP_REGNUM
-If the stack-pointer is kept in a register, then define this macro to be
-the number (greater than or equal to zero) of that register, or -1 if
-there is no such register.
-
-@item STAB_REG_TO_REGNUM
-@findex STAB_REG_TO_REGNUM
-Define this to convert stab register numbers (as gotten from `r'
-declarations) into @value{GDBN} regnums.  If not defined, no conversion will be
-done.
-
-@item DEPRECATED_STACK_ALIGN (@var{addr})
-@anchor{DEPRECATED_STACK_ALIGN}
-@findex DEPRECATED_STACK_ALIGN
-Define this to increase @var{addr} so that it meets the alignment
-requirements for the processor's stack.
-
-Unlike @ref{frame_align}, this function always adjusts @var{addr}
-upwards.
-
-By default, no stack alignment is performed.
-
-@item STEP_SKIPS_DELAY (@var{addr})
-@findex STEP_SKIPS_DELAY
-Define this to return true if the address is of an instruction with a
-delay slot.  If a breakpoint has been placed in the instruction's delay
-slot, @value{GDBN} will single-step over that instruction before resuming
-normally.  Currently only defined for the Mips.
-
-@item STORE_RETURN_VALUE (@var{type}, @var{regcache}, @var{valbuf})
-@findex STORE_RETURN_VALUE
-A C expression that writes the function return value, found in
-@var{valbuf}, into the @var{regcache}.  @var{type} is the type of the
-value that is to be returned.
-
-This method has been deprecated in favour of @code{gdbarch_return_value}
-(@pxref{gdbarch_return_value}).
+@item int gdbarch_deprecated_fp_regnum (@var{gdbarch})
+@findex gdbarch_deprecated_fp_regnum
+If the frame pointer is in a register, use this function to return the
+number of that register.
+
+@item int gdbarch_stab_reg_to_regnum (@var{gdbarch}, @var{stab_regnr})
+@findex gdbarch_stab_reg_to_regnum
+Use this function to convert stab register @var{stab_regnr} into @value{GDBN}
+regnum.  If not defined, no conversion will be done.
 
 @item SYMBOL_RELOADING_DEFAULT
 @findex SYMBOL_RELOADING_DEFAULT
@@ -3746,8 +4935,8 @@ current sources.)
 @findex TARGET_CHAR_BIT
 Number of bits in a char; defaults to 8.
 
-@item TARGET_CHAR_SIGNED
-@findex TARGET_CHAR_SIGNED
+@item int gdbarch_char_signed (@var{gdbarch})
+@findex gdbarch_char_signed
 Non-zero if @code{char} is normally signed on this architecture; zero if
 it should be unsigned.
 
@@ -3757,138 +4946,80 @@ character in the standard execution set is supposed to be positive.
 Most compilers treat @code{char} as signed, but @code{char} is unsigned
 on the IBM S/390, RS6000, and PowerPC targets.
 
-@item TARGET_COMPLEX_BIT
-@findex TARGET_COMPLEX_BIT
-Number of bits in a complex number; defaults to @code{2 * TARGET_FLOAT_BIT}.
+@item int gdbarch_double_bit (@var{gdbarch})
+@findex gdbarch_double_bit
+Number of bits in a double float; defaults to @w{@code{8 * TARGET_CHAR_BIT}}.
 
-At present this macro is not used.
+@item int gdbarch_float_bit (@var{gdbarch})
+@findex gdbarch_float_bit
+Number of bits in a float; defaults to @w{@code{4 * TARGET_CHAR_BIT}}.
 
-@item TARGET_DOUBLE_BIT
-@findex TARGET_DOUBLE_BIT
-Number of bits in a double float; defaults to @code{8 * TARGET_CHAR_BIT}.
+@item int gdbarch_int_bit (@var{gdbarch})
+@findex gdbarch_int_bit
+Number of bits in an integer; defaults to @w{@code{4 * TARGET_CHAR_BIT}}.
 
-@item TARGET_DOUBLE_COMPLEX_BIT
-@findex TARGET_DOUBLE_COMPLEX_BIT
-Number of bits in a double complex; defaults to @code{2 * TARGET_DOUBLE_BIT}.
+@item int gdbarch_long_bit (@var{gdbarch})
+@findex gdbarch_long_bit
+Number of bits in a long integer; defaults to @w{@code{4 * TARGET_CHAR_BIT}}.
 
-At present this macro is not used.
+@item int gdbarch_long_double_bit (@var{gdbarch})
+@findex gdbarch_long_double_bit
+Number of bits in a long double float;
+defaults to @w{@code{2 * gdbarch_double_bit (@var{gdbarch})}}.
 
-@item TARGET_FLOAT_BIT
-@findex TARGET_FLOAT_BIT
-Number of bits in a float; defaults to @code{4 * TARGET_CHAR_BIT}.
+@item int gdbarch_long_long_bit (@var{gdbarch})
+@findex gdbarch_long_long_bit
+Number of bits in a long long integer; defaults to
+@w{@code{2 * gdbarch_long_bit (@var{gdbarch})}}.
 
-@item TARGET_INT_BIT
-@findex TARGET_INT_BIT
-Number of bits in an integer; defaults to @code{4 * TARGET_CHAR_BIT}.
+@item int gdbarch_ptr_bit (@var{gdbarch})
+@findex gdbarch_ptr_bit
+Number of bits in a pointer; defaults to
+@w{@code{gdbarch_int_bit (@var{gdbarch})}}.
 
-@item TARGET_LONG_BIT
-@findex TARGET_LONG_BIT
-Number of bits in a long integer; defaults to @code{4 * TARGET_CHAR_BIT}.
+@item int gdbarch_short_bit (@var{gdbarch})
+@findex gdbarch_short_bit
+Number of bits in a short integer; defaults to @w{@code{2 * TARGET_CHAR_BIT}}.
 
-@item TARGET_LONG_DOUBLE_BIT
-@findex TARGET_LONG_DOUBLE_BIT
-Number of bits in a long double float;
-defaults to @code{2 * TARGET_DOUBLE_BIT}.
-
-@item TARGET_LONG_LONG_BIT
-@findex TARGET_LONG_LONG_BIT
-Number of bits in a long long integer; defaults to @code{2 * TARGET_LONG_BIT}.
-
-@item TARGET_PTR_BIT
-@findex TARGET_PTR_BIT
-Number of bits in a pointer; defaults to @code{TARGET_INT_BIT}.
-
-@item TARGET_SHORT_BIT
-@findex TARGET_SHORT_BIT
-Number of bits in a short integer; defaults to @code{2 * TARGET_CHAR_BIT}.
-
-@item TARGET_READ_PC
-@findex TARGET_READ_PC
-@itemx TARGET_WRITE_PC (@var{val}, @var{pid})
-@findex TARGET_WRITE_PC
-@anchor{TARGET_WRITE_PC}
-@itemx TARGET_READ_SP
-@findex TARGET_READ_SP
-@itemx TARGET_READ_FP
-@findex TARGET_READ_FP
-@findex read_pc
-@findex write_pc
-@findex read_sp
-@findex read_fp
-@anchor{TARGET_READ_SP} These change the behavior of @code{read_pc},
-@code{write_pc} and @code{read_sp}.  For most targets, these may be
-left undefined.  @value{GDBN} will call the read and write register
-functions with the relevant @code{_REGNUM} argument.
-
-These macros are useful when a target keeps one of these registers in a
-hard to get at place; for example, part in a segment register and part
-in an ordinary register.
-
-@xref{unwind_sp}, which replaces @code{TARGET_READ_SP}.
-
-@item TARGET_VIRTUAL_FRAME_POINTER(@var{pc}, @var{regp}, @var{offsetp})
-@findex TARGET_VIRTUAL_FRAME_POINTER
-Returns a @code{(register, offset)} pair representing the virtual frame
-pointer in use at the code address @var{pc}.  If virtual frame pointers
-are not used, a default definition simply returns
-@code{DEPRECATED_FP_REGNUM}, with an offset of zero.
+@item void gdbarch_virtual_frame_pointer (@var{gdbarch}, @var{pc}, @var{frame_regnum}, @var{frame_offset})
+@findex gdbarch_virtual_frame_pointer
+Returns a @code{(@var{register}, @var{offset})} pair representing the virtual
+frame pointer in use at the code address @var{pc}.  If virtual frame
+pointers are not used, a default definition simply returns
+@code{gdbarch_deprecated_fp_regnum} (or @code{gdbarch_sp_regnum}, if
+no frame pointer is defined), with an offset of zero.
+
+@c need to explain virtual frame pointers, they are recorded in agent
+@c expressions for tracepoints
 
 @item TARGET_HAS_HARDWARE_WATCHPOINTS
 If non-zero, the target has support for hardware-assisted
 watchpoints.  @xref{Algorithms, watchpoints}, for more details and
 other related macros.
 
-@item TARGET_PRINT_INSN (@var{addr}, @var{info})
-@findex TARGET_PRINT_INSN
+@item int gdbarch_print_insn (@var{gdbarch}, @var{vma}, @var{info})
+@findex gdbarch_print_insn
 This is the function used by @value{GDBN} to print an assembly
-instruction.  It prints the instruction at address @var{addr} in
-debugged memory and returns the length of the instruction, in bytes.  If
-a target doesn't define its own printing routine, it defaults to an
-accessor function for the global pointer
-@code{deprecated_tm_print_insn}.  This usually points to a function in
-the @code{opcodes} library (@pxref{Support Libraries, ,Opcodes}).
-@var{info} is a structure (of type @code{disassemble_info}) defined in
-@file{include/dis-asm.h} used to pass information to the instruction
-decoding routine.
-
-@item struct frame_id unwind_dummy_id (struct frame_info *@var{frame})
-@findex unwind_dummy_id
-@anchor{unwind_dummy_id} Given @var{frame} return a @code{struct
-frame_id} that uniquely identifies an inferior function call's dummy
+instruction.  It prints the instruction at address @var{vma} in
+debugged memory and returns the length of the instruction, in bytes.
+This usually points to a function in the @code{opcodes} library
+(@pxref{Support Libraries, ,Opcodes}).  @var{info} is a structure (of
+type @code{disassemble_info}) defined in the header file
+@file{include/dis-asm.h}, and used to pass information to the
+instruction decoding routine.
+
+@item frame_id gdbarch_dummy_id (@var{gdbarch}, @var{frame})
+@findex gdbarch_dummy_id
+@anchor{gdbarch_dummy_id} Given @var{frame} return a @w{@code{struct
+frame_id}} that uniquely identifies an inferior function call's dummy
 frame.  The value returned must match the dummy frame stack value
-previously saved using @code{SAVE_DUMMY_FRAME_TOS}.
-@xref{SAVE_DUMMY_FRAME_TOS}.
-
-@item DEPRECATED_USE_STRUCT_CONVENTION (@var{gcc_p}, @var{type})
-@findex DEPRECATED_USE_STRUCT_CONVENTION
-If defined, this must be an expression that is nonzero if a value of the
-given @var{type} being returned from a function must have space
-allocated for it on the stack.  @var{gcc_p} is true if the function
-being considered is known to have been compiled by GCC; this is helpful
-for systems where GCC is known to use different calling convention than
-other compilers.
-
-This method has been deprecated in favour of @code{gdbarch_return_value}
-(@pxref{gdbarch_return_value}).
-
-@item VALUE_TO_REGISTER(@var{type}, @var{regnum}, @var{from}, @var{to})
-@findex VALUE_TO_REGISTER
-Convert a value of type @var{type} into the raw contents of register
-@var{regnum}'s.
+previously saved by @code{call_function_by_hand}.
+
+@item void gdbarch_value_to_register (@var{gdbarch}, @var{frame}, @var{type}, @var{buf})
+@findex gdbarch_value_to_register
+Convert a value of type @var{type} into the raw contents of a register.
 @xref{Target Architecture Definition, , Using Different Register and Memory Data Representations}.
 
-@item VARIABLES_INSIDE_BLOCK (@var{desc}, @var{gcc_p})
-@findex VARIABLES_INSIDE_BLOCK
-For dbx-style debugging information, if the compiler puts variable
-declarations inside LBRAC/RBRAC blocks, this should be defined to be
-nonzero.  @var{desc} is the value of @code{n_desc} from the
-@code{N_RBRAC} symbol, and @var{gcc_p} is true if @value{GDBN} has noticed the
-presence of either the @code{GCC_COMPILED_SYMBOL} or the
-@code{GCC2_COMPILED_SYMBOL}.  By default, this is 0.
-
-@item OS9K_VARIABLES_INSIDE_BLOCK (@var{desc}, @var{gcc_p})
-@findex OS9K_VARIABLES_INSIDE_BLOCK
-Similarly, for OS/9000.  Defaults to 1.
 @end table
 
 Motorola M68K target conditionals.
@@ -3901,229 +5032,206 @@ not defined, it will default to @code{0xf}.
 @item REMOTE_BPT_VECTOR
 Defaults to @code{1}.
 
-@item NAME_OF_MALLOC
-@findex NAME_OF_MALLOC
-A string containing the name of the function to call in order to
-allocate some memory in the inferior. The default value is "malloc".
-
 @end ftable
 
+@node Adding a New Target
 @section Adding a New Target
 
 @cindex adding a target
 The following files add a target to @value{GDBN}:
 
 @table @file
-@vindex TDEPFILES
-@item gdb/config/@var{arch}/@var{ttt}.mt
-Contains a Makefile fragment specific to this target.  Specifies what
-object files are needed for target @var{ttt}, by defining
-@samp{TDEPFILES=@dots{}} and @samp{TDEPLIBS=@dots{}}.  Also specifies
-the header file which describes @var{ttt}, by defining @samp{TM_FILE=
-tm-@var{ttt}.h}.
-
-You can also define @samp{TM_CFLAGS}, @samp{TM_CLIBS}, @samp{TM_CDEPS},
-but these are now deprecated, replaced by autoconf, and may go away in
-future versions of @value{GDBN}.
+@cindex target dependent files
 
 @item gdb/@var{ttt}-tdep.c
 Contains any miscellaneous code required for this target machine.  On
-some machines it doesn't exist at all.  Sometimes the macros in
-@file{tm-@var{ttt}.h} become very complicated, so they are implemented
-as functions here instead, and the macro is simply defined to call the
-function.  This is vastly preferable, since it is easier to understand
-and debug.
+some machines it doesn't exist at all.
 
 @item gdb/@var{arch}-tdep.c
 @itemx gdb/@var{arch}-tdep.h
-This often exists to describe the basic layout of the target machine's
-processor chip (registers, stack, etc.).  If used, it is included by
-@file{@var{ttt}-tdep.h}.  It can be shared among many targets that use
-the same processor.
-
-@item gdb/config/@var{arch}/tm-@var{ttt}.h
-(@file{tm.h} is a link to this file, created by @code{configure}).  Contains
-macro definitions about the target machine's registers, stack frame
-format and instructions.
-
-New targets do not need this file and should not create it.
-
-@item gdb/config/@var{arch}/tm-@var{arch}.h
-This often exists to describe the basic layout of the target machine's
-processor chip (registers, stack, etc.).  If used, it is included by
-@file{tm-@var{ttt}.h}.  It can be shared among many targets that use the
-same processor.
-
-New targets do not need this file and should not create it.
+This is required to describe the basic layout of the target machine's
+processor chip (registers, stack, etc.).  It can be shared among many
+targets that use the same processor architecture.
 
 @end table
 
-If you are adding a new operating system for an existing CPU chip, add a
-@file{config/tm-@var{os}.h} file that describes the operating system
-facilities that are unusual (extra symbol table info; the breakpoint
-instruction needed; etc.).  Then write a @file{@var{arch}/tm-@var{os}.h}
-that just @code{#include}s @file{tm-@var{arch}.h} and
-@file{config/tm-@var{os}.h}.
+(Target header files such as
+@file{gdb/config/@var{arch}/tm-@var{ttt}.h},
+@file{gdb/config/@var{arch}/tm-@var{arch}.h}, and
+@file{config/tm-@var{os}.h} are no longer used.)
+
+@findex _initialize_@var{arch}_tdep
+A @value{GDBN} description for a new architecture, arch is created by
+defining a global function @code{_initialize_@var{arch}_tdep}, by
+convention in the source file @file{@var{arch}-tdep.c}.  For
+example, in the case of the OpenRISC 1000, this function is called
+@code{_initialize_or1k_tdep} and is found in the file
+@file{or1k-tdep.c}.
+
+The object file resulting from compiling this source file, which will
+contain the implementation of the
+@code{_initialize_@var{arch}_tdep} function is specified in the
+@value{GDBN} @file{configure.tgt} file, which includes a large case
+statement pattern matching against the @code{--target} option of the
+@kbd{configure} script.
+
+@quotation
+@emph{Note:} If the architecture requires multiple source files, the
+corresponding binaries should be included in
+@file{configure.tgt}. However if there are header files, the
+dependencies on these will not be picked up from the entries in
+@file{configure.tgt}. The @file{Makefile.in} file will need extending to
+show these dependencies.
+@end quotation
+
+@findex gdbarch_register
+A new struct gdbarch, defining the new architecture, is created within
+the @code{_initialize_@var{arch}_tdep} function by calling
+@code{gdbarch_register}:
 
+@smallexample
+void gdbarch_register (enum bfd_architecture    architecture,
+                       gdbarch_init_ftype      *init_func,
+                       gdbarch_dump_tdep_ftype *tdep_dump_func);
+@end smallexample
 
-@section Converting an existing Target Architecture to Multi-arch
-@cindex converting targets to multi-arch
+This function has been described fully in an earlier
+section.  @xref{How an Architecture is Represented, , How an
+Architecture is Represented}.
+
+The new @code{@w{struct gdbarch}} should contain implementations of
+the necessary functions (described in the previous sections) to
+describe the basic layout of the target machine's processor chip
+(registers, stack, etc.).  It can be shared among many targets that use
+the same processor architecture.
+
+@node Target Descriptions
+@chapter Target Descriptions
+@cindex target descriptions
+
+The target architecture definition (@pxref{Target Architecture Definition})
+contains @value{GDBN}'s hard-coded knowledge about an architecture.  For
+some platforms, it is handy to have more flexible knowledge about a specific
+instance of the architecture---for instance, a processor or development board.
+@dfn{Target descriptions} provide a mechanism for the user to tell @value{GDBN}
+more about what their target supports, or for the target to tell @value{GDBN}
+directly.
+
+For details on writing, automatically supplying, and manually selecting
+target descriptions, see @ref{Target Descriptions, , , gdb,
+Debugging with @value{GDBN}}.  This section will cover some related
+topics about the @value{GDBN} internals.
 
-This section describes the current accepted best practice for converting
-an existing target architecture to the multi-arch framework.
+@menu
+* Target Descriptions Implementation::
+* Adding Target Described Register Support::
+@end menu
 
-The process consists of generating, testing, posting and committing a
-sequence of patches.  Each patch must contain a single change, for
-instance:
+@node Target Descriptions Implementation
+@section Target Descriptions Implementation
+@cindex target descriptions, implementation
+
+Before @value{GDBN} connects to a new target, or runs a new program on
+an existing target, it discards any existing target description and
+reverts to a default gdbarch.  Then, after connecting, it looks for a
+new target description by calling @code{target_find_description}.
+
+A description may come from a user specified file (XML), the remote
+@samp{qXfer:features:read} packet (also XML), or from any custom
+@code{to_read_description} routine in the target vector.  For instance,
+the remote target supports guessing whether a MIPS target is 32-bit or
+64-bit based on the size of the @samp{g} packet.
+
+If any target description is found, @value{GDBN} creates a new gdbarch
+incorporating the description by calling @code{gdbarch_update_p}.  Any
+@samp{<architecture>} element is handled first, to determine which
+architecture's gdbarch initialization routine is called to create the
+new architecture.  Then the initialization routine is called, and has
+a chance to adjust the constructed architecture based on the contents
+of the target description.  For instance, it can recognize any
+properties set by a @code{to_read_description} routine.  Also
+see @ref{Adding Target Described Register Support}.
+
+@node Adding Target Described Register Support
+@section Adding Target Described Register Support
+@cindex target descriptions, adding register support
+
+Target descriptions can report additional registers specific to an
+instance of the target.  But it takes a little work in the architecture
+specific routines to support this.
+
+A target description must either have no registers or a complete
+set---this avoids complexity in trying to merge standard registers
+with the target defined registers.  It is the architecture's
+responsibility to validate that a description with registers has
+everything it needs.  To keep architecture code simple, the same
+mechanism is used to assign fixed internal register numbers to
+standard registers.
+
+If @code{tdesc_has_registers} returns 1, the description contains
+registers.  The architecture's @code{gdbarch_init} routine should:
 
 @itemize @bullet
 
 @item
-Directly convert a group of functions into macros (the conversion does
-not change the behavior of any of the functions).
-
-@item
-Replace a non-multi-arch with a multi-arch mechanism (e.g.,
-@code{FRAME_INFO}).
+Call @code{tdesc_data_alloc} to allocate storage, early, before
+searching for a matching gdbarch or allocating a new one.
 
 @item
-Enable multi-arch level one.
+Use @code{tdesc_find_feature} to locate standard features by name.
 
 @item
-Delete one or more files.
-
-@end itemize
-
-@noindent
-There isn't a size limit on a patch, however, a developer is strongly
-encouraged to keep the patch size down.
-
-Since each patch is well defined, and since each change has been tested
-and shows no regressions, the patches are considered @emph{fairly}
-obvious.  Such patches, when submitted by developers listed in the
-@file{MAINTAINERS} file, do not need approval.  Occasional steps in the
-process may be more complicated and less clear.  The developer is
-expected to use their judgment and is encouraged to seek advice as
-needed.
-
-@subsection Preparation
-
-The first step is to establish control.  Build (with @option{-Werror}
-enabled) and test the target so that there is a baseline against which
-the debugger can be compared.
-
-At no stage can the test results regress or @value{GDBN} stop compiling
-with @option{-Werror}.
-
-@subsection Add the multi-arch initialization code
-
-The objective of this step is to establish the basic multi-arch
-framework.  It involves
-
-@itemize @bullet
+Use @code{tdesc_numbered_register} and @code{tdesc_numbered_register_choices}
+to locate the expected registers in the standard features.
 
 @item
-The addition of a @code{@var{arch}_gdbarch_init} function@footnote{The
-above is from the original example and uses K&R C.  @value{GDBN}
-has since converted to ISO C but lets ignore that.} that creates
-the architecture:
-@smallexample
-static struct gdbarch *
-d10v_gdbarch_init (info, arches)
-     struct gdbarch_info info;
-     struct gdbarch_list *arches;
-@{
-  struct gdbarch *gdbarch;
-  /* there is only one d10v architecture */
-  if (arches != NULL)
-    return arches->gdbarch;
-  gdbarch = gdbarch_alloc (&info, NULL);
-  return gdbarch;
-@}
-@end smallexample
-@noindent
-@emph{}
+Return @code{NULL} if a required feature is missing, or if any standard
+feature is missing expected registers.  This will produce a warning that
+the description was incomplete.
 
 @item
-A per-architecture dump function to print any architecture specific
-information:
-@smallexample
-static void
-mips_dump_tdep (struct gdbarch *current_gdbarch,
-                struct ui_file *file)
-@{
-   @dots{} code to print architecture specific info @dots{}
-@}
-@end smallexample
+Free the allocated data before returning, unless @code{tdesc_use_registers}
+is called.
 
 @item
-A change to @code{_initialize_@var{arch}_tdep} to register this new
-architecture:
-@smallexample
-void
-_initialize_mips_tdep (void)
-@{
-  gdbarch_register (bfd_arch_mips, mips_gdbarch_init,
-                    mips_dump_tdep);
-@end smallexample
+Call @code{set_gdbarch_num_regs} as usual, with a number higher than any
+fixed number passed to @code{tdesc_numbered_register}.
 
 @item
-Add the macro @code{GDB_MULTI_ARCH}, defined as 0 (zero), to the file@*
-@file{config/@var{arch}/tm-@var{arch}.h}.
+Call @code{tdesc_use_registers} after creating a new gdbarch, before
+returning it.
 
 @end itemize
 
-@subsection Update multi-arch incompatible mechanisms
-
-Some mechanisms do not work with multi-arch.  They include:
-
-@table @code
-@item FRAME_FIND_SAVED_REGS
-Replaced with @code{DEPRECATED_FRAME_INIT_SAVED_REGS}
-@end table
-
-@noindent
-At this stage you could also consider converting the macros into
-functions.
-
-@subsection Prepare for multi-arch level to one
+After @code{tdesc_use_registers} has been called, the architecture's
+@code{register_name}, @code{register_type}, and @code{register_reggroup_p}
+routines will not be called; that information will be taken from
+the target description.  @code{num_regs} may be increased to account
+for any additional registers in the description.
 
-Temporally set @code{GDB_MULTI_ARCH} to @code{GDB_MULTI_ARCH_PARTIAL}
-and then build and start @value{GDBN} (the change should not be
-committed).  @value{GDBN} may not build, and once built, it may die with
-an internal error listing the architecture methods that must be
-provided.
+Pseudo-registers require some extra care:
 
-Fix any build problems (patch(es)).
-
-Convert all the architecture methods listed, which are only macros, into
-functions (patch(es)).
-
-Update @code{@var{arch}_gdbarch_init} to set all the missing
-architecture methods and wrap the corresponding macros in @code{#if
-!GDB_MULTI_ARCH} (patch(es)).
-
-@subsection Set multi-arch level one
-
-Change the value of @code{GDB_MULTI_ARCH} to GDB_MULTI_ARCH_PARTIAL (a
-single patch).
-
-Any problems with throwing ``the switch'' should have been fixed
-already.
-
-@subsection Convert remaining macros
-
-Suggest converting macros into functions (and setting the corresponding
-architecture method) in small batches.
-
-@subsection Set multi-arch level to two
+@itemize @bullet
 
-This should go smoothly.
+@item
+Using @code{tdesc_numbered_register} allows the architecture to give
+constant register numbers to standard architectural registers, e.g.@:
+as an @code{enum} in @file{@var{arch}-tdep.h}.  But because
+pseudo-registers are always numbered above @code{num_regs},
+which may be increased by the description, constant numbers
+can not be used for pseudos.  They must be numbered relative to
+@code{num_regs} instead.
 
-@subsection Delete the TM file
+@item
+The description will not describe pseudo-registers, so the
+architecture must call @code{set_tdesc_pseudo_register_name},
+@code{set_tdesc_pseudo_register_type}, and
+@code{set_tdesc_pseudo_register_reggroup_p} to supply routines
+describing pseudo registers.  These routines will be passed
+internal register numbers, so the same routines used for the
+gdbarch equivalents are usually suitable.
 
-The @file{tm-@var{arch}.h} can be deleted.  @file{@var{arch}.mt} and
-@file{configure.in} updated.
+@end itemize
 
 
 @node Target Vector Definition
@@ -4137,16 +5245,64 @@ actually exercises control over a process or a serial port.
 @value{GDBN} includes some 30-40 different target vectors; however,
 each configuration of @value{GDBN} includes only a few of them.
 
-@section File Targets
+@menu
+* Managing Execution State::
+* Existing Targets::
+@end menu
+
+@node Managing Execution State
+@section Managing Execution State
+@cindex execution state
+
+A target vector can be completely inactive (not pushed on the target
+stack), active but not running (pushed, but not connected to a fully
+manifested inferior), or completely active (pushed, with an accessible
+inferior).  Most targets are only completely inactive or completely
+active, but some support persistent connections to a target even
+when the target has exited or not yet started.
+
+For example, connecting to the simulator using @code{target sim} does
+not create a running program.  Neither registers nor memory are
+accessible until @code{run}.  Similarly, after @code{kill}, the
+program can not continue executing.  But in both cases @value{GDBN}
+remains connected to the simulator, and target-specific commands
+are directed to the simulator.
+
+A target which only supports complete activation should push itself
+onto the stack in its @code{to_open} routine (by calling
+@code{push_target}), and unpush itself from the stack in its
+@code{to_mourn_inferior} routine (by calling @code{unpush_target}).
+
+A target which supports both partial and complete activation should
+still call @code{push_target} in @code{to_open}, but not call
+@code{unpush_target} in @code{to_mourn_inferior}.  Instead, it should
+call either @code{target_mark_running} or @code{target_mark_exited}
+in its @code{to_open}, depending on whether the target is fully active
+after connection.  It should also call @code{target_mark_running} any
+time the inferior becomes fully active (e.g.@: in
+@code{to_create_inferior} and @code{to_attach}), and
+@code{target_mark_exited} when the inferior becomes inactive (in
+@code{to_mourn_inferior}).  The target should also make sure to call
+@code{target_mourn_inferior} from its @code{to_kill}, to return the
+target to inactive state.
+
+@node Existing Targets
+@section Existing Targets
+@cindex targets
+
+@subsection File Targets
 
 Both executables and core files have target vectors.
 
-@section Standard Protocol and Remote Stubs
+@subsection Standard Protocol and Remote Stubs
 
-@value{GDBN}'s file @file{remote.c} talks a serial protocol to code
-that runs in the target system.  @value{GDBN} provides several sample
+@value{GDBN}'s file @file{remote.c} talks a serial protocol to code that
+runs in the target system.  @value{GDBN} provides several sample
 @dfn{stubs} that can be integrated into target programs or operating
-systems for this purpose; they are named @file{*-stub.c}.
+systems for this purpose; they are named @file{@var{cpu}-stub.c}.  Many
+operating systems, embedded targets, emulators, and simulators already
+have a @value{GDBN} stub built into them, and maintenance of the remote
+protocol must be careful to preserve compatibility.
 
 The @value{GDBN} user's manual describes how to put such a stub into
 your target code.  What follows is a discussion of integrating the
@@ -4186,13 +5342,13 @@ of the debugger/stub.
 From reading the stub, it's probably not obvious how breakpoints work.
 They are simply done by deposit/examine operations from @value{GDBN}.
 
-@section ROM Monitor Interface
+@subsection ROM Monitor Interface
 
-@section Custom Protocols
+@subsection Custom Protocols
 
-@section Transport Layer
+@subsection Transport Layer
 
-@section Builtin Simulator
+@subsection Builtin Simulator
 
 
 @node Native Debugging
@@ -4211,7 +5367,7 @@ native-dependent object files, by defining @samp{NATDEPFILES=@dots{}}.
 Also specifies the header file which describes native support on
 @var{xyz}, by defining @samp{NAT_FILE= nm-@var{xyz}.h}.  You can also
 define @samp{NAT_CFLAGS}, @samp{NAT_ADD_FILES}, @samp{NAT_CLIBS},
-@samp{NAT_CDEPS}, etc.; see @file{Makefile.in}.
+@samp{NAT_CDEPS}, @samp{NAT_GENERATED_FILES}, etc.; see @file{Makefile.in}.
 
 @emph{Maintainer's note: The @file{.mh} suffix is because this file
 originally contained @file{Makefile} fragments for hosting @value{GDBN}
@@ -4259,64 +5415,6 @@ This is the low level interface to inferior processes for systems using
 the Unix @code{ptrace} call in a vanilla way.
 @end table
 
-@section Native core file Support
-@cindex native core files
-
-@table @file
-@findex fetch_core_registers
-@item core-aout.c::fetch_core_registers()
-Support for reading registers out of a core file.  This routine calls
-@code{register_addr()}, see below.  Now that BFD is used to read core
-files, virtually all machines should use @code{core-aout.c}, and should
-just provide @code{fetch_core_registers} in @code{@var{xyz}-nat.c} (or
-@code{REGISTER_U_ADDR} in @code{nm-@var{xyz}.h}).
-
-@item core-aout.c::register_addr()
-If your @code{nm-@var{xyz}.h} file defines the macro
-@code{REGISTER_U_ADDR(addr, blockend, regno)}, it should be defined to
-set @code{addr} to the offset within the @samp{user} struct of @value{GDBN}
-register number @code{regno}.  @code{blockend} is the offset within the
-``upage'' of @code{u.u_ar0}.  If @code{REGISTER_U_ADDR} is defined,
-@file{core-aout.c} will define the @code{register_addr()} function and
-use the macro in it.  If you do not define @code{REGISTER_U_ADDR}, but
-you are using the standard @code{fetch_core_registers()}, you will need
-to define your own version of @code{register_addr()}, put it into your
-@code{@var{xyz}-nat.c} file, and be sure @code{@var{xyz}-nat.o} is in
-the @code{NATDEPFILES} list.  If you have your own
-@code{fetch_core_registers()}, you may not need a separate
-@code{register_addr()}.  Many custom @code{fetch_core_registers()}
-implementations simply locate the registers themselves.@refill
-@end table
-
-When making @value{GDBN} run native on a new operating system, to make it
-possible to debug core files, you will need to either write specific
-code for parsing your OS's core files, or customize
-@file{bfd/trad-core.c}.  First, use whatever @code{#include} files your
-machine uses to define the struct of registers that is accessible
-(possibly in the u-area) in a core file (rather than
-@file{machine/reg.h}), and an include file that defines whatever header
-exists on a core file (e.g. the u-area or a @code{struct core}).  Then
-modify @code{trad_unix_core_file_p} to use these values to set up the
-section information for the data segment, stack segment, any other
-segments in the core file (perhaps shared library contents or control
-information), ``registers'' segment, and if there are two discontiguous
-sets of registers (e.g.  integer and float), the ``reg2'' segment.  This
-section information basically delimits areas in the core file in a
-standard way, which the section-reading routines in BFD know how to seek
-around in.
-
-Then back in @value{GDBN}, you need a matching routine called
-@code{fetch_core_registers}.  If you can use the generic one, it's in
-@file{core-aout.c}; if not, it's in your @file{@var{xyz}-nat.c} file.
-It will be passed a char pointer to the entire ``registers'' segment,
-its length, and a zero; or a char pointer to the entire ``regs2''
-segment, its length, and a 2.  The routine should suck out the supplied
-register values and install them into @value{GDBN}'s ``registers'' array.
-
-If your system uses @file{/proc} to control processes, and uses ELF
-format core files, then you may be able to use the same routines for
-reading the registers out of processes and out of core files.
-
 @section ptrace
 
 @section /proc
@@ -4335,97 +5433,14 @@ undefined) in @file{nm-@var{system}.h}.
 
 @table @code
 
-@item CHILD_PREPARE_TO_STORE
-@findex CHILD_PREPARE_TO_STORE
-If the machine stores all registers at once in the child process, then
-define this to ensure that all values are correct.  This usually entails
-a read from the child.
-
-[Note that this is incorrectly defined in @file{xm-@var{system}.h} files
-currently.]
-
-@item FETCH_INFERIOR_REGISTERS
-@findex FETCH_INFERIOR_REGISTERS
-Define this if the native-dependent code will provide its own routines
-@code{fetch_inferior_registers} and @code{store_inferior_registers} in
-@file{@var{host}-nat.c}.  If this symbol is @emph{not} defined, and
-@file{infptrace.c} is included in this configuration, the default
-routines in @file{infptrace.c} are used for these functions.
-
-@item FILES_INFO_HOOK
-@findex FILES_INFO_HOOK
-(Only defined for Convex.)
-
-@item FP0_REGNUM
-@findex FP0_REGNUM
-This macro is normally defined to be the number of the first floating
-point register, if the machine has such registers.  As such, it would
-appear only in target-specific code.  However, @file{/proc} support uses this
-to decide whether floats are in use on this target.
-
-@item GET_LONGJMP_TARGET
-@findex GET_LONGJMP_TARGET
-For most machines, this is a target-dependent parameter.  On the
-DECstation and the Iris, this is a native-dependent parameter, since
-@file{setjmp.h} is needed to define it.
-
-This macro determines the target PC address that @code{longjmp} will jump to,
-assuming that we have just stopped at a longjmp breakpoint.  It takes a
-@code{CORE_ADDR *} as argument, and stores the target PC value through this
-pointer.  It examines the current state of the machine as needed.
-
 @item I386_USE_GENERIC_WATCHPOINTS
 An x86-based machine can define this to use the generic x86 watchpoint
 support; see @ref{Algorithms, I386_USE_GENERIC_WATCHPOINTS}.
 
-@item KERNEL_U_ADDR
-@findex KERNEL_U_ADDR
-Define this to the address of the @code{u} structure (the ``user
-struct'', also known as the ``u-page'') in kernel virtual memory.  @value{GDBN}
-needs to know this so that it can subtract this address from absolute
-addresses in the upage, that are obtained via ptrace or from core files.
-On systems that don't need this value, set it to zero.
-
-@item KERNEL_U_ADDR_HPUX
-@findex KERNEL_U_ADDR_HPUX
-Define this to cause @value{GDBN} to determine the address of @code{u} at
-runtime, by using HP-style @code{nlist} on the kernel's image in the
-root directory.
-
-@item ONE_PROCESS_WRITETEXT
-@findex ONE_PROCESS_WRITETEXT
-Define this to be able to, when a breakpoint insertion fails, warn the
-user that another process may be running with the same executable.
-
-@item PROC_NAME_FMT
-@findex PROC_NAME_FMT
-Defines the format for the name of a @file{/proc} device.  Should be
-defined in @file{nm.h} @emph{only} in order to override the default
-definition in @file{procfs.c}.
-
-@item PTRACE_ARG3_TYPE
-@findex PTRACE_ARG3_TYPE
-The type of the third argument to the @code{ptrace} system call, if it
-exists and is different from @code{int}.
-
-@item REGISTER_U_ADDR
-@findex REGISTER_U_ADDR
-Defines the offset of the registers in the ``u area''.
-
-@item SHELL_COMMAND_CONCAT
-@findex SHELL_COMMAND_CONCAT
-If defined, is a string to prefix on the shell command used to start the
-inferior.
-
-@item SHELL_FILE
-@findex SHELL_FILE
-If defined, this is the name of the shell to use to run the inferior.
-Defaults to @code{"/bin/sh"}.
-
 @item SOLIB_ADD (@var{filename}, @var{from_tty}, @var{targ}, @var{readsyms})
 @findex SOLIB_ADD
 Define this to expand into an expression that will cause the symbols in
-@var{filename} to be added to @value{GDBN}'s symbol table. If
+@var{filename} to be added to @value{GDBN}'s symbol table.  If
 @var{readsyms} is zero symbols are not read but any necessary low level
 processing for @var{filename} is still done.
 
@@ -4442,39 +5457,8 @@ the shell execs, and once when the program itself execs.  If the actual
 number of traps is something other than 2, then define this macro to
 expand into the number expected.
 
-@item SVR4_SHARED_LIBS
-@findex SVR4_SHARED_LIBS
-Define this to indicate that SVR4-style shared libraries are in use.
-
-@item USE_PROC_FS
-@findex USE_PROC_FS
-This determines whether small routines in @file{*-tdep.c}, which
-translate register values between @value{GDBN}'s internal
-representation and the @file{/proc} representation, are compiled.
-
-@item U_REGS_OFFSET
-@findex U_REGS_OFFSET
-This is the offset of the registers in the upage.  It need only be
-defined if the generic ptrace register access routines in
-@file{infptrace.c} are being used (that is, @file{infptrace.c} is
-configured in, and @code{FETCH_INFERIOR_REGISTERS} is not defined).  If
-the default value from @file{infptrace.c} is good enough, leave it
-undefined.
-
-The default value means that u.u_ar0 @emph{points to} the location of
-the registers.  I'm guessing that @code{#define U_REGS_OFFSET 0} means
-that @code{u.u_ar0} @emph{is} the location of the registers.
-
-@item CLEAR_SOLIB
-@findex CLEAR_SOLIB
-See @file{objfiles.c}.
-
-@item DEBUG_PTRACE
-@findex DEBUG_PTRACE
-Define this to debug @code{ptrace} calls.
 @end table
 
-
 @node Support Libraries
 
 @chapter Support Libraries
@@ -4517,8 +5501,9 @@ The opcodes library provides @value{GDBN}'s disassembler.  (It's a separate
 library because it's also used in binutils, for @file{objdump}).
 
 @section readline
-
-@section mmalloc
+@cindex readline library
+The @code{readline} library provides a set of functions for use by applications
+that allow users to edit command lines as they are typed in.
 
 @section libiberty
 @cindex @code{libiberty} library
@@ -4544,7 +5529,7 @@ The obstack mechanism provides a convenient way to allocate and free
 chunks of memory.  Each obstack is a pool of memory that is managed
 like a stack.  Objects (of any nature, size and alignment) are
 allocated and freed in a @acronym{LIFO} fashion on an obstack (see
-@code{libiberty}'s documenatation for a more detailed explanation of
+@code{libiberty}'s documentation for a more detailed explanation of
 @code{obstacks}).
 
 The most noticeable use of the @code{obstacks} in @value{GDBN} is in
@@ -4553,7 +5538,7 @@ representation of an object file.  Lots of things get allocated on
 these @code{obstacks}: dictionary entries, blocks, blockvectors,
 symbols, minimal symbols, types, vectors of fundamental types, class
 fields of types, object files section lists, object files section
-offets lists, line tables, symbol tables, partial symbol tables,
+offset lists, line tables, symbol tables, partial symbol tables,
 string tables, symbol table private data, macros tables, debug
 information sections and entries, import and export lists (som),
 unwind information (hppa), dwarf2 location expressions data.  Plus
@@ -4562,7 +5547,7 @@ names of types.
 
 An essential and convenient property of all data on @code{obstacks} is
 that memory for it gets allocated (with @code{obstack_alloc}) at
-various times during a debugging sesssion, but it is released all at
+various times during a debugging session, but it is released all at
 once using the @code{obstack_free} function.  The @code{obstack_free}
 function takes a pointer to where in the stack it must start the
 deletion from (much like the cleanup chains have a pointer to where to
@@ -4605,6 +5590,181 @@ Regex conditionals.
 @item sparc
 @end table
 
+@section Array Containers
+@cindex Array Containers
+@cindex VEC
+
+Often it is necessary to manipulate a dynamic array of a set of
+objects.  C forces some bookkeeping on this, which can get cumbersome
+and repetitive.  The @file{vec.h} file contains macros for defining
+and using a typesafe vector type.  The functions defined will be
+inlined when compiling, and so the abstraction cost should be zero.
+Domain checks are added to detect programming errors.
+
+An example use would be an array of symbols or section information.
+The array can be grown as symbols are read in (or preallocated), and
+the accessor macros provided keep care of all the necessary
+bookkeeping.  Because the arrays are type safe, there is no danger of
+accidentally mixing up the contents.  Think of these as C++ templates,
+but implemented in C.
+
+Because of the different behavior of structure objects, scalar objects
+and of pointers, there are three flavors of vector, one for each of
+these variants.  Both the structure object and pointer variants pass
+pointers to objects around --- in the former case the pointers are
+stored into the vector and in the latter case the pointers are
+dereferenced and the objects copied into the vector.  The scalar
+object variant is suitable for @code{int}-like objects, and the vector
+elements are returned by value.
+
+There are both @code{index} and @code{iterate} accessors.  The iterator
+returns a boolean iteration condition and updates the iteration
+variable passed by reference.  Because the iterator will be inlined,
+the address-of can be optimized away.
+
+The vectors are implemented using the trailing array idiom, thus they
+are not resizeable without changing the address of the vector object
+itself.  This means you cannot have variables or fields of vector type
+--- always use a pointer to a vector.  The one exception is the final
+field of a structure, which could be a vector type.  You will have to
+use the @code{embedded_size} & @code{embedded_init} calls to create
+such objects, and they will probably not be resizeable (so don't use
+the @dfn{safe} allocation variants).  The trailing array idiom is used
+(rather than a pointer to an array of data), because, if we allow
+@code{NULL} to also represent an empty vector, empty vectors occupy
+minimal space in the structure containing them.
+
+Each operation that increases the number of active elements is
+available in @dfn{quick} and @dfn{safe} variants.  The former presumes
+that there is sufficient allocated space for the operation to succeed
+(it dies if there is not).  The latter will reallocate the vector, if
+needed.  Reallocation causes an exponential increase in vector size.
+If you know you will be adding N elements, it would be more efficient
+to use the reserve operation before adding the elements with the
+@dfn{quick} operation.  This will ensure there are at least as many
+elements as you ask for, it will exponentially increase if there are
+too few spare slots.  If you want reserve a specific number of slots,
+but do not want the exponential increase (for instance, you know this
+is the last allocation), use a negative number for reservation.  You
+can also create a vector of a specific size from the get go.
+
+You should prefer the push and pop operations, as they append and
+remove from the end of the vector.  If you need to remove several items
+in one go, use the truncate operation.  The insert and remove
+operations allow you to change elements in the middle of the vector.
+There are two remove operations, one which preserves the element
+ordering @code{ordered_remove}, and one which does not
+@code{unordered_remove}.  The latter function copies the end element
+into the removed slot, rather than invoke a memmove operation.  The
+@code{lower_bound} function will determine where to place an item in
+the array using insert that will maintain sorted order.
+
+If you need to directly manipulate a vector, then the @code{address}
+accessor will return the address of the start of the vector.  Also the
+@code{space} predicate will tell you whether there is spare capacity in the
+vector.  You will not normally need to use these two functions.
+
+Vector types are defined using a
+@code{DEF_VEC_@{O,P,I@}(@var{typename})} macro.  Variables of vector
+type are declared using a @code{VEC(@var{typename})} macro.  The
+characters @code{O}, @code{P} and @code{I} indicate whether
+@var{typename} is an object (@code{O}), pointer (@code{P}) or integral
+(@code{I}) type.  Be careful to pick the correct one, as you'll get an
+awkward and inefficient API if you use the wrong one.  There is a
+check, which results in a compile-time warning, for the @code{P} and
+@code{I} versions, but there is no check for the @code{O} versions, as
+that is not possible in plain C.
+
+An example of their use would be,
+
+@smallexample
+DEF_VEC_P(tree);   // non-managed tree vector.
+
+struct my_struct @{
+  VEC(tree) *v;      // A (pointer to) a vector of tree pointers.
+@};
+
+struct my_struct *s;
+
+if (VEC_length(tree, s->v)) @{ we have some contents @}
+VEC_safe_push(tree, s->v, decl); // append some decl onto the end
+for (ix = 0; VEC_iterate(tree, s->v, ix, elt); ix++)
+  @{ do something with elt @}
+
+@end smallexample
+
+The @file{vec.h} file provides details on how to invoke the various
+accessors provided.  They are enumerated here:
+
+@table @code
+@item VEC_length
+Return the number of items in the array,
+
+@item VEC_empty
+Return true if the array has no elements.
+
+@item VEC_last
+@itemx VEC_index
+Return the last or arbitrary item in the array.
+
+@item VEC_iterate
+Access an array element and indicate whether the array has been
+traversed.
+
+@item VEC_alloc
+@itemx VEC_free
+Create and destroy an array.
+
+@item VEC_embedded_size
+@itemx VEC_embedded_init
+Helpers for embedding an array as the final element of another struct.
+
+@item VEC_copy
+Duplicate an array.
+
+@item VEC_space
+Return the amount of free space in an array.
+
+@item VEC_reserve
+Ensure a certain amount of free space.
+
+@item VEC_quick_push
+@itemx VEC_safe_push
+Append to an array, either assuming the space is available, or making
+sure that it is.
+
+@item VEC_pop
+Remove the last item from an array.
+
+@item VEC_truncate
+Remove several items from the end of an array.
+
+@item VEC_safe_grow
+Add several items to the end of an array.
+
+@item VEC_replace
+Overwrite an item in the array.
+
+@item VEC_quick_insert
+@itemx VEC_safe_insert
+Insert an item into the middle of the array.  Either the space must
+already exist, or the space is created.
+
+@item VEC_ordered_remove
+@itemx VEC_unordered_remove
+Remove an item from the array, preserving order or not.
+
+@item VEC_block_remove
+Remove a set of items from the array.
+
+@item VEC_address
+Provide the address of the first element.
+
+@item VEC_lower_bound
+Binary search the array.
+
+@end table
+
 @section include
 
 @node Coding
@@ -4709,7 +5869,7 @@ discard_cleanups (old);
 return file;
 @end smallexample
 
-Some functions, e.g. @code{fputs_filtered()} or @code{error()}, specify
+Some functions, e.g., @code{fputs_filtered()} or @code{error()}, specify
 that they ``should not be called when cleanups are not in place''.  This
 means that any actions you need to reverse in the case of an error or
 interruption must be on the cleanup chain before you call these
@@ -4727,15 +5887,15 @@ architecture object.
 
 A module registers one or more per-architecture data-pointers using:
 
-@deftypefun struct gdbarch_data *gdbarch_data_register_pre_init (gdbarch_data_pre_init_ftype *@var{pre_init})
+@deftypefn {Architecture Function} {struct gdbarch_data *} gdbarch_data_register_pre_init (gdbarch_data_pre_init_ftype *@var{pre_init})
 @var{pre_init} is used to, on-demand, allocate an initial value for a
 per-architecture data-pointer using the architecture's obstack (passed
 in as a parameter).  Since @var{pre_init} can be called during
 architecture creation, it is not parameterized with the architecture.
 and must not call modules that use per-architecture data.
-@end deftypefun
+@end deftypefn
 
-@deftypefun struct gdbarch_data *gdbarch_data_register_post_init (gdbarch_data_post_init_ftype *@var{post_init})
+@deftypefn {Architecture Function} {struct gdbarch_data *} gdbarch_data_register_post_init (gdbarch_data_post_init_ftype *@var{post_init})
 @var{post_init} is used to obtain an initial value for a
 per-architecture data-pointer @emph{after}.  Since @var{post_init} is
 always called after architecture creation, it both receives the fully
@@ -4743,21 +5903,21 @@ initialized architecture and is free to call modules that use
 per-architecture data (care needs to be taken to ensure that those
 other modules do not try to call back to this module as that will
 create in cycles in the initialization call graph).
-@end deftypefun
+@end deftypefn
 
 These functions return a @code{struct gdbarch_data} that is used to
 identify the per-architecture data-pointer added for that module.
 
 The per-architecture data-pointer is accessed using the function:
 
-@deftypefun void *gdbarch_data (struct gdbarch *@var{gdbarch}, struct gdbarch_data *@var{data_handle})
+@deftypefn {Architecture Function} {void *} gdbarch_data (struct gdbarch *@var{gdbarch}, struct gdbarch_data *@var{data_handle})
 Given the architecture @var{arch} and module data handle
 @var{data_handle} (returned by @code{gdbarch_data_register_pre_init}
 or @code{gdbarch_data_register_post_init}), this function returns the
 current value of the per-architecture data-pointer.  If the data
 pointer is @code{NULL}, it is first initialized by calling the
 corresponding @var{pre_init} or @var{post_init} method.
-@end deftypefun
+@end deftypefn
 
 The examples below assume the following definitions:
 
@@ -4793,7 +5953,7 @@ set_gdbarch_nozel (struct gdbarch *gdbarch, int total)
 @}
 @end smallexample
 
-A module can on-demand create architecture dependant data structures
+A module can on-demand create architecture dependent data structures
 using @code{post_init}.
 
 In the below, the nozel's total is computed on-demand by
@@ -4908,76 +6068,57 @@ errors.}
 @subsection Compiler Warnings
 @cindex compiler warnings
 
-With few exceptions, developers should include the configuration option
-@samp{--enable-gdb-build-warnings=,-Werror} when building @value{GDBN}.
-The exceptions are listed in the file @file{gdb/MAINTAINERS}.
+With few exceptions, developers should avoid the configuration option
+@samp{--disable-werror} when building @value{GDBN}.  The exceptions
+are listed in the file @file{gdb/MAINTAINERS}.  The default, when
+building with @sc{gcc}, is @samp{--enable-werror}.
 
 This option causes @value{GDBN} (when built using GCC) to be compiled
 with a carefully selected list of compiler warning flags.  Any warnings
-from those flags being treated as errors.
+from those flags are treated as errors.
 
 The current list of warning flags includes:
 
 @table @samp
-@item -Wimplicit
-Since @value{GDBN} coding standard requires all functions to be declared
-using a prototype, the flag has the side effect of ensuring that
-prototyped functions are always visible with out resorting to
-@samp{-Wstrict-prototypes}.
+@item -Wall
+Recommended @sc{gcc} warnings.
 
-@item -Wreturn-type
-Such code often appears to work except on instruction set architectures
-that use register windows.
+@item -Wdeclaration-after-statement
 
-@item -Wcomment
+@sc{gcc} 3.x (and later) and @sc{c99} allow declarations mixed with
+code, but @sc{gcc} 2.x and @sc{c89} do not.
 
-@item -Wtrigraphs
+@item -Wpointer-arith
 
-@item -Wformat
-@itemx -Wformat-nonliteral
+@item -Wformat-nonliteral
+Non-literal format strings, with a few exceptions, are bugs - they
+might contain unintended user-supplied format specifiers.
 Since @value{GDBN} uses the @code{format printf} attribute on all
-@code{printf} like functions these check not just @code{printf} calls
+@code{printf} like functions this checks not just @code{printf} calls
 but also calls to functions such as @code{fprintf_unfiltered}.
 
-@item -Wparentheses
-This warning includes uses of the assignment operator within an
-@code{if} statement.
-
-@item -Wpointer-arith
-
-@item -Wuninitialized
-
-@item -Wunused-label
-This warning has the additional benefit of detecting the absence of the
-@code{case} reserved word in a switch statement:
-@smallexample
-enum @{ FD_SCHEDULED, NOTHING_SCHEDULED @} sched;
-@dots{}
-switch (sched)
-  @{
-  case FD_SCHEDULED:
-    @dots{};
-    break;
-  NOTHING_SCHEDULED:
-    @dots{};
-    break;
-  @}
-@end smallexample
-
-@item -Wunused-function
-@end table
-
-@emph{Pragmatics: Due to the way that @value{GDBN} is implemented most
-functions have unused parameters.  Consequently the warning
-@samp{-Wunused-parameter} is precluded from the list.  The macro
+@item -Wno-pointer-sign
+In version 4.0, GCC began warning about pointer argument passing or
+assignment even when the source and destination differed only in
+signedness.  However, most @value{GDBN} code doesn't distinguish
+carefully between @code{char} and @code{unsigned char}.  In early 2006
+the @value{GDBN} developers decided correcting these warnings wasn't
+worth the time it would take.
+
+@item -Wno-unused-parameter
+Due to the way that @value{GDBN} is implemented many functions have
+unused parameters.  Consequently this warning is avoided.  The macro
 @code{ATTRIBUTE_UNUSED} is not used as it leads to false negatives ---
 it is not an error to have @code{ATTRIBUTE_UNUSED} on a parameter that
-is being used.  The options @samp{-Wall} and @samp{-Wunused} are also
-precluded because they both include @samp{-Wunused-parameter}.}
+is being used.
+
+@item -Wno-unused
+@itemx -Wno-switch
+@itemx -Wno-char-subscripts
+These are warnings which might be useful for @value{GDBN}, but are
+currently too noisy to enable with @samp{-Werror}.
 
-@emph{Pragmatics: @value{GDBN} has not simply accepted the warnings
-enabled by @samp{-Wall -Werror -W...}.  Instead it is selecting warnings
-when and where their benefits can be demonstrated.}
+@end table
 
 @subsection Formatting
 
@@ -5118,7 +6259,7 @@ error and issued an @code{internal_error}.}
 @subsection File Names
 
 Any file used when building the core of @value{GDBN} must be in lower
-case. Any file used when building the core of @value{GDBN} must be 8.3
+case.  Any file used when building the core of @value{GDBN} must be 8.3
 unique.  These requirements apply to both source and generated files.
 
 @emph{Pragmatics: The core of @value{GDBN} must be buildable on many
@@ -5321,164 +6462,311 @@ messages.  Use @code{fprintf_unfiltered(gdb_stdlog, ...}.  Do not use
 @cindex porting to new machines
 
 Most of the work in making @value{GDBN} compile on a new machine is in
-specifying the configuration of the machine.  This is done in a
-dizzying variety of header files and configuration scripts, which we
-hope to make more sensible soon.  Let's say your new host is called an
-@var{xyz} (e.g.,  @samp{sun4}), and its full three-part configuration
-name is @code{@var{arch}-@var{xvend}-@var{xos}} (e.g.,
-@samp{sparc-sun-sunos4}).  In particular:
+specifying the configuration of the machine.  Porting a new
+architecture to @value{GDBN} can be broken into a number of steps.
 
 @itemize @bullet
-@item
-In the top level directory, edit @file{config.sub} and add @var{arch},
-@var{xvend}, and @var{xos} to the lists of supported architectures,
-vendors, and operating systems near the bottom of the file.  Also, add
-@var{xyz} as an alias that maps to
-@code{@var{arch}-@var{xvend}-@var{xos}}.  You can test your changes by
-running
 
-@smallexample
-./config.sub @var{xyz}
-@end smallexample
-
-@noindent
-and
+@item
+Ensure a @sc{bfd} exists for executables of the target architecture in
+the @file{bfd} directory.  If one does not exist, create one by
+modifying an existing similar one.
 
-@smallexample
-./config.sub @code{@var{arch}-@var{xvend}-@var{xos}}
-@end smallexample
+@item
+Implement a disassembler for the target architecture in the @file{opcodes}
+directory.
 
-@noindent
-which should both respond with @code{@var{arch}-@var{xvend}-@var{xos}}
-and no error messages.
+@item
+Define the target architecture in the @file{gdb} directory
+(@pxref{Adding a New Target, , Adding a New Target}).  Add the pattern
+for the new target to @file{configure.tgt} with the names of the files
+that contain the code.  By convention the target architecture
+definition for an architecture @var{arch} is placed in
+@file{@var{arch}-tdep.c}.
+
+Within @file{@var{arch}-tdep.c} define the function
+@code{_initialize_@var{arch}_tdep} which calls
+@code{gdbarch_register} to create the new @code{@w{struct
+gdbarch}} for the architecture.
 
-@noindent
-You need to port BFD, if that hasn't been done already.  Porting BFD is
-beyond the scope of this manual.
+@item
+If a new remote target is needed, consider adding a new remote target
+by defining a function
+@code{_initialize_remote_@var{arch}}.  However if at all possible
+use the @value{GDBN} @emph{Remote Serial Protocol} for this and implement
+the server side protocol independently with the target.
 
 @item
-To configure @value{GDBN} itself, edit @file{gdb/configure.host} to recognize
-your system and set @code{gdb_host} to @var{xyz}, and (unless your
-desired target is already available) also edit @file{gdb/configure.tgt},
-setting @code{gdb_target} to something appropriate (for instance,
-@var{xyz}).
+If desired implement a simulator in the @file{sim} directory.  This
+should create the library @file{libsim.a} implementing the interface
+in @file{remote-sim.h} (found in the @file{include} directory).
 
-@emph{Maintainer's note: Work in progress.  The file
-@file{gdb/configure.host} originally needed to be modified when either a
-new native target or a new host machine was being added to @value{GDBN}.
-Recent changes have removed this requirement.  The file now only needs
-to be modified when adding a new native configuration.  This will likely
-changed again in the future.}
+@item
+Build and test.  If desired, lobby the @sc{gdb} steering group to
+have the new port included in the main distribution!
 
 @item
-Finally, you'll need to specify and define @value{GDBN}'s host-, native-, and
-target-dependent @file{.h} and @file{.c} files used for your
-configuration.
-@end itemize
+Add a description of the new architecture to the main @value{GDBN} user
+guide (@pxref{Configuration Specific Information, , Configuration
+Specific Information, gdb, Debugging with @value{GDBN}}).
 
-@node Releasing GDB
+@end itemize
 
-@chapter Releasing @value{GDBN}
-@cindex making a new release of gdb
+@node Versions and Branches
+@chapter Versions and Branches
 
-@section Versions and Branches
+@section Versions
 
-@subsection Version Identifiers
+@value{GDBN}'s version is determined by the file
+@file{gdb/version.in} and takes one of the following forms:
 
-@value{GDBN}'s version is determined by the file @file{gdb/version.in}.
+@table @asis
+@item @var{major}.@var{minor}
+@itemx @var{major}.@var{minor}.@var{patchlevel}
+an official release (e.g., 6.2 or 6.2.1)
+@item @var{major}.@var{minor}.@var{patchlevel}.@var{YYYY}@var{MM}@var{DD}
+a snapshot taken at @var{YYYY}-@var{MM}-@var{DD}-gmt (e.g.,
+6.1.50.20020302, 6.1.90.20020304, or 6.1.0.20020308)
+@item @var{major}.@var{minor}.@var{patchlevel}.@var{YYYY}@var{MM}@var{DD}-cvs
+a @sc{cvs} check out drawn on @var{YYYY}-@var{MM}-@var{DD} (e.g.,
+6.1.50.20020302-cvs, 6.1.90.20020304-cvs, or 6.1.0.20020308-cvs)
+@item @var{major}.@var{minor}.@var{patchlevel}.@var{YYYY}@var{MM}@var{DD} (@var{vendor})
+a vendor specific release of @value{GDBN}, that while based on@*
+@var{major}.@var{minor}.@var{patchlevel}.@var{YYYY}@var{MM}@var{DD},
+may include additional changes
+@end table
 
-@value{GDBN}'s mainline uses ISO dates to differentiate between
-versions.  The CVS repository uses @var{YYYY}-@var{MM}-@var{DD}-cvs
-while the corresponding snapshot uses @var{YYYYMMDD}.
+@value{GDBN}'s mainline uses the @var{major} and @var{minor} version
+numbers from the most recent release branch, with a @var{patchlevel}
+of 50.  At the time each new release branch is created, the mainline's
+@var{major} and @var{minor} version numbers are updated.
 
-@value{GDBN}'s release branch uses a slightly more complicated scheme.
-When the branch is first cut, the mainline version identifier is
-prefixed with the @var{major}.@var{minor} from of the previous release
-series but with .90 appended.  As draft releases are drawn from the
-branch, the minor minor number (.90) is incremented.  Once the first
-release (@var{M}.@var{N}) has been made, the version prefix is updated
-to @var{M}.@var{N}.0.90 (dot zero, dot ninety).  Follow on releases have
-an incremented minor minor version number (.0).
+@value{GDBN}'s release branch is similar.  When the branch is cut, the
+@var{patchlevel} is changed from 50 to 90.  As draft releases are
+drawn from the branch, the @var{patchlevel} is incremented.  Once the
+first release (@var{major}.@var{minor}) has been made, the
+@var{patchlevel} is set to 0 and updates have an incremented
+@var{patchlevel}.
 
-Using 5.1 (previous) and 5.2 (current), the example below illustrates a
-typical sequence of version identifiers:
+For snapshots, and @sc{cvs} check outs, it is also possible to
+identify the @sc{cvs} origin:
 
 @table @asis
-@item 5.1.1
-final release from previous branch
-@item 2002-03-03-cvs
-main-line the day the branch is cut
-@item 5.1.90-2002-03-03-cvs
-corresponding branch version
-@item 5.1.91
-first draft release candidate
-@item 5.1.91-2002-03-17-cvs
-updated branch version
-@item 5.1.92
-second draft release candidate
-@item 5.1.92-2002-03-31-cvs
-updated branch version
-@item 5.1.93
-final release candidate (see below)
-@item 5.2
-official release
-@item 5.2.0.90-2002-04-07-cvs
-updated CVS branch version
-@item 5.2.1
-second official release
+@item @var{major}.@var{minor}.50.@var{YYYY}@var{MM}@var{DD}
+drawn from the @sc{head} of mainline @sc{cvs} (e.g., 6.1.50.20020302)
+@item @var{major}.@var{minor}.90.@var{YYYY}@var{MM}@var{DD}
+@itemx @var{major}.@var{minor}.91.@var{YYYY}@var{MM}@var{DD} @dots{}
+drawn from a release branch prior to the release (e.g.,
+6.1.90.20020304)
+@item @var{major}.@var{minor}.0.@var{YYYY}@var{MM}@var{DD}
+@itemx @var{major}.@var{minor}.1.@var{YYYY}@var{MM}@var{DD} @dots{}
+drawn from a release branch after the release (e.g., 6.2.0.20020308)
 @end table
 
-Notes:
+If the previous @value{GDBN} version is 6.1 and the current version is
+6.2, then, substituting 6 for @var{major} and 1 or 2 for @var{minor},
+here's an illustration of a typical sequence:
 
-@itemize @bullet
-@item
-Minor minor minor draft release candidates such as 5.2.0.91 have been
-omitted from the example.  Such release candidates are, typically, never
-made.
-@item
-For 5.1.93 the bziped tar ball @file{gdb-5.1.93.tar.bz2} is just the
-official @file{gdb-5.2.tar} renamed and compressed.
-@end itemize
+@smallexample
+     <HEAD>
+        |
+6.1.50.20020302-cvs
+        |
+        +--------------------------.
+        |                    <gdb_6_2-branch>
+        |                          |
+6.2.50.20020303-cvs        6.1.90 (draft #1)
+        |                          |
+6.2.50.20020304-cvs        6.1.90.20020304-cvs
+        |                          |
+6.2.50.20020305-cvs        6.1.91 (draft #2)
+        |                          |
+6.2.50.20020306-cvs        6.1.91.20020306-cvs
+        |                          |
+6.2.50.20020307-cvs        6.2 (release)
+        |                          |
+6.2.50.20020308-cvs        6.2.0.20020308-cvs
+        |                          |
+6.2.50.20020309-cvs        6.2.1 (update)
+        |                          |
+6.2.50.20020310-cvs         <branch closed>
+        |
+6.2.50.20020311-cvs
+        |
+        +--------------------------.
+        |                     <gdb_6_3-branch>
+        |                          |
+6.3.50.20020312-cvs        6.2.90 (draft #1)
+        |                          |
+@end smallexample
+
+@section Release Branches
+@cindex Release Branches
+
+@value{GDBN} draws a release series (6.2, 6.2.1, @dots{}) from a
+single release branch, and identifies that branch using the @sc{cvs}
+branch tags:
+
+@smallexample
+gdb_@var{major}_@var{minor}-@var{YYYY}@var{MM}@var{DD}-branchpoint
+gdb_@var{major}_@var{minor}-branch
+gdb_@var{major}_@var{minor}-@var{YYYY}@var{MM}@var{DD}-release
+@end smallexample
+
+@emph{Pragmatics: To help identify the date at which a branch or
+release is made, both the branchpoint and release tags include the
+date that they are cut (@var{YYYY}@var{MM}@var{DD}) in the tag.  The
+branch tag, denoting the head of the branch, does not need this.}
+
+@section Vendor Branches
+@cindex vendor branches
 
 To avoid version conflicts, vendors are expected to modify the file
 @file{gdb/version.in} to include a vendor unique alphabetic identifier
 (an official @value{GDBN} release never uses alphabetic characters in
-its version identifer).
+its version identifier).  E.g., @samp{6.2widgit2}, or @samp{6.2 (Widgit
+Inc Patch 2)}.
+
+@section Experimental Branches
+@cindex experimental branches
+
+@subsection Guidelines
 
-Since @value{GDBN} does not make minor minor minor releases (e.g.,
-5.1.0.1) the conflict between that and a minor minor draft release
-identifier (e.g., 5.1.0.90) is avoided.
+@value{GDBN} permits the creation of branches, cut from the @sc{cvs}
+repository, for experimental development.  Branches make it possible
+for developers to share preliminary work, and maintainers to examine
+significant new developments.
 
+The following are a set of guidelines for creating such branches:
 
-@subsection Branches
+@table @emph
+
+@item a branch has an owner
+The owner can set further policy for a branch, but may not change the
+ground rules.  In particular, they can set a policy for commits (be it
+adding more reviewers or deciding who can commit).
+
+@item all commits are posted
+All changes committed to a branch shall also be posted to
+@email{gdb-patches@@sourceware.org, the @value{GDBN} patches
+mailing list}.  While commentary on such changes are encouraged, people
+should remember that the changes only apply to a branch.
+
+@item all commits are covered by an assignment
+This ensures that all changes belong to the Free Software Foundation,
+and avoids the possibility that the branch may become contaminated.
+
+@item a branch is focused
+A focused branch has a single objective or goal, and does not contain
+unnecessary or irrelevant changes.  Cleanups, where identified, being
+be pushed into the mainline as soon as possible.
+
+@item a branch tracks mainline
+This keeps the level of divergence under control.  It also keeps the
+pressure on developers to push cleanups and other stuff into the
+mainline.
+
+@item a branch shall contain the entire @value{GDBN} module
+The @value{GDBN} module @code{gdb} should be specified when creating a
+branch (branches of individual files should be avoided).  @xref{Tags}.
+
+@item a branch shall be branded using @file{version.in}
+The file @file{gdb/version.in} shall be modified so that it identifies
+the branch @var{owner} and branch @var{name}, e.g.,
+@samp{6.2.50.20030303_owner_name} or @samp{6.2 (Owner Name)}.
 
-@value{GDBN} draws a release series (5.2, 5.2.1, @dots{}) from a single
-release branch (gdb_5_2-branch).  Since minor minor minor releases
-(5.1.0.1) are not made, the need to branch the release branch is avoided
-(it also turns out that the effort required for such a a branch and
-release is significantly greater than the effort needed to create a new
-release from the head of the release branch).
+@end table
+
+@subsection Tags
+@anchor{Tags}
+
+To simplify the identification of @value{GDBN} branches, the following
+branch tagging convention is strongly recommended:
+
+@table @code
 
-Releases 5.0 and 5.1 used branch and release tags of the form:
+@item @var{owner}_@var{name}-@var{YYYYMMDD}-branchpoint
+@itemx @var{owner}_@var{name}-@var{YYYYMMDD}-branch
+The branch point and corresponding branch tag.  @var{YYYYMMDD} is the
+date that the branch was created.  A branch is created using the
+sequence: @anchor{experimental branch tags}
+@smallexample
+cvs rtag @var{owner}_@var{name}-@var{YYYYMMDD}-branchpoint gdb
+cvs rtag -b -r @var{owner}_@var{name}-@var{YYYYMMDD}-branchpoint \
+   @var{owner}_@var{name}-@var{YYYYMMDD}-branch gdb
+@end smallexample
 
+@item @var{owner}_@var{name}-@var{yyyymmdd}-mergepoint
+The tagged point, on the mainline, that was used when merging the branch
+on @var{yyyymmdd}.  To merge in all changes since the branch was cut,
+use a command sequence like:
 @smallexample
-gdb_N_M-YYYY-MM-DD-branchpoint
-gdb_N_M-YYYY-MM-DD-branch
-gdb_M_N-YYYY-MM-DD-release
+cvs rtag @var{owner}_@var{name}-@var{yyyymmdd}-mergepoint gdb
+cvs update \
+   -j@var{owner}_@var{name}-@var{YYYYMMDD}-branchpoint
+   -j@var{owner}_@var{name}-@var{yyyymmdd}-mergepoint
 @end smallexample
+@noindent
+Similar sequences can be used to just merge in changes since the last
+merge.
 
-Release 5.2 is trialing the branch and release tags:
+@end table
+
+@noindent
+For further information on @sc{cvs}, see
+@uref{http://www.gnu.org/software/cvs/, Concurrent Versions System}.
+@node Start of New Year Procedure
+@chapter Start of New Year Procedure
+@cindex new year procedure
 
+At the start of each new year, the following actions should be performed:
+
+@itemize @bullet
+@item
+Rotate the ChangeLog file
+
+The current @file{ChangeLog} file should be renamed into
+@file{ChangeLog-YYYY} where YYYY is the year that has just passed.
+A new @file{ChangeLog} file should be created, and its contents should
+contain a reference to the previous ChangeLog.  The following should
+also be preserved at the end of the new ChangeLog, in order to provide
+the appropriate settings when editing this file with Emacs:
 @smallexample
-gdb_N_M-YYYY-MM-DD-branchpoint
-gdb_N_M-branch
-gdb_M_N-YYYY-MM-DD-release
+Local Variables:
+mode: change-log
+left-margin: 8
+fill-column: 74
+version-control: never
+coding: utf-8
+End:
 @end smallexample
 
-@emph{Pragmatics: The branchpoint and release tags need to identify when
-a branch and release are made.  The branch tag, denoting the head of the
-branch, does not have this criteria.}
+@item
+Add an entry for the newly created ChangeLog file (@file{ChangeLog-YYYY})
+in @file{gdb/config/djgpp/fnchange.lst}.
+
+@item
+Update the copyright year in the startup message
+
+Update the copyright year in:
+@itemize @bullet
+@item file @file{top.c}, function @code{print_gdb_version}
+@item file @file{gdbserver/server.c}, function @code{gdbserver_version}
+@item file @file{gdbserver/gdbreplay.c}, function @code{gdbreplay_version}
+@end itemize
+
+@item
+Add the new year in the copyright notices of all source and documentation
+files.  This can be done semi-automatically by running the @code{copyright.sh}
+script.  This script requires Emacs 22 or later to be installed.
+
+@end itemize
+
+@node Releasing GDB
 
+@chapter Releasing @value{GDBN}
+@cindex making a new release of gdb
 
 @section Branch Commit Policy
 
@@ -5527,13 +6815,13 @@ Remember, everything on the Internet takes a week.
 
 @enumerate
 @item
-Post the proposal on @email{gdb@@sources.redhat.com, the GDB mailing
+Post the proposal on @email{gdb@@sourceware.org, the GDB mailing
 list} Creating a bug report to track the task's state, is also highly
 recommended.
 @item
 Wait a week or so.
 @item
-Post the proposal on @email{gdb-announce@@sources.redhat.com, the GDB
+Post the proposal on @email{gdb-announce@@sourceware.org, the GDB
 Announcement mailing list}.
 @item
 Wait a week or so.
@@ -5593,7 +6881,7 @@ file)
 
 @subheading Check the ARI
 
-@uref{http://sources.redhat.com/gdb/ari,,A.R.I.} is an @code{awk} script
+@uref{http://sourceware.org/gdb/ari,,A.R.I.} is an @code{awk} script
 (Awk Regression Index ;-) that checks for a number of errors and coding
 conventions.  The checks include things like using @code{malloc} instead
 of @code{xmalloc} and file naming problems.  There shouldn't be any
@@ -5619,16 +6907,16 @@ $  V=`echo $v | sed 's/\./_/g'`
 $  D=`date -u +%Y-%m-%d`
 $  echo $u $V $D
 5.1 5_2 2002-03-03
-$  echo cvs -f -d :ext:sources.redhat.com:/cvs/src rtag \
--D $D-gmt gdb_$V-$D-branchpoint insight+dejagnu
-cvs -f -d :ext:sources.redhat.com:/cvs/src rtag
--D 2002-03-03-gmt gdb_5_2-2002-03-03-branchpoint insight+dejagnu
+$  echo cvs -f -d :ext:sourceware.org:/cvs/src rtag \
+-D $D-gmt gdb_$V-$D-branchpoint insight
+cvs -f -d :ext:sourceware.org:/cvs/src rtag
+-D 2002-03-03-gmt gdb_5_2-2002-03-03-branchpoint insight
 $  ^echo ^^
 ...
-$  echo cvs -f -d :ext:sources.redhat.com:/cvs/src rtag \
--b -r gdb_$V-$D-branchpoint gdb_$V-branch insight+dejagnu
-cvs -f -d :ext:sources.redhat.com:/cvs/src rtag \
--b -r gdb_5_2-2002-03-03-branchpoint gdb_5_2-branch insight+dejagnu
+$  echo cvs -f -d :ext:sourceware.org:/cvs/src rtag \
+-b -r gdb_$V-$D-branchpoint gdb_$V-branch insight
+cvs -f -d :ext:sourceware.org:/cvs/src rtag \
+-b -r gdb_5_2-2002-03-03-branchpoint gdb_5_2-branch insight
 $  ^echo ^^
 ...
 $
 
 @itemize @bullet
 @item
-by using @kbd{-D YYYY-MM-DD-gmt} the branch is forced to an exact
+By using @kbd{-D YYYY-MM-DD-gmt}, the branch is forced to an exact
 date/time.
 @item
-the trunk is first taged so that the branch point can easily be found
+The trunk is first tagged so that the branch point can easily be found.
 @item
-Insight (which includes GDB) and dejagnu are all tagged at the same time
+Insight, which includes @value{GDBN}, is tagged at the same time.
 @item
-@file{version.in} gets bumped to avoid version number conflicts
+@file{version.in} gets bumped to avoid version number conflicts.
 @item
-the reading of @file{.cvsrc} is disabled using @file{-f}
+The reading of @file{.cvsrc} is disabled using @file{-f}.
 @end itemize
 
 @subheading Update @file{version.in}
@@ -5657,9 +6945,9 @@ $  V=`echo $v | sed 's/\./_/g'`
 $  echo $u $v$V
 5.1 5_2
 $  cd /tmp
-$  echo cvs -f -d :ext:sources.redhat.com:/cvs/src co \
+$  echo cvs -f -d :ext:sourceware.org:/cvs/src co \
 -r gdb_$V-branch src/gdb/version.in
-cvs -f -d :ext:sources.redhat.com:/cvs/src co
+cvs -f -d :ext:sourceware.org:/cvs/src co
  -r gdb_5_2-branch src/gdb/version.in
 $  ^echo ^^
 U src/gdb/version.in
@@ -5673,10 +6961,10 @@ $  cvs -f commit version.in
 @itemize @bullet
 @item
 @file{0000-00-00} is used as a date to pump prime the version.in update
-mechanism
+mechanism.
 @item
 @file{.90} and the previous branch version are used as fairly arbitrary
-initial branch version number
+initial branch version number.
 @end itemize
 
 
@@ -5691,9 +6979,9 @@ This file needs to be updated so that:
 
 @itemize @bullet
 @item
-a daily timestamp is added to the file @file{version.in}
+A daily timestamp is added to the file @file{version.in}.
 @item
-the new branch is included in the snapshot process
+The new branch is included in the snapshot process.
 @end itemize
 
 @noindent
@@ -5720,10 +7008,10 @@ Send an announcement to the mailing lists:
 
 @itemize @bullet
 @item
-@email{gdb-announce@@sources.redhat.com, GDB Announcement mailing list}
+@email{gdb-announce@@sourceware.org, GDB Announcement mailing list}
 @item
-@email{gdb@@sources.redhat.com, GDB Discsussion mailing list} and
-@email{gdb-testers@@sources.redhat.com, GDB Discsussion mailing list}
+@email{gdb@@sourceware.org, GDB Discussion mailing list} and
+@email{gdb-testers@@sourceware.org, GDB Testers mailing list}
 @end itemize
 
 @emph{Pragmatics: The branch creation is sent to the announce list to
@@ -5734,14 +7022,13 @@ The announcement should include:
 
 @itemize @bullet
 @item
-the branch tag
+The branch tag.
 @item
-how to check out the branch using CVS
+How to check out the branch using CVS.
 @item
-the date/number of weeks until the release
+The date/number of weeks until the release.
 @item
-the branch commit policy
-still holds.
+The branch commit policy still holds.
 @end itemize
 
 @section Stabilize the branch
@@ -5766,7 +7053,7 @@ candidate).
 @subsubheading Freeze the branch
 
 Send out an e-mail notifying everyone that the branch is frozen to
-@email{gdb-patches@@sources.redhat.com}.
+@email{gdb-patches@@sourceware.org}.
 
 @subsubheading Establish a few defaults.
 
@@ -5791,16 +7078,15 @@ Notes:
 @itemize @bullet
 @item
 Check the @code{autoconf} version carefully.  You want to be using the
-version taken from the @file{binutils} snapshot directory, which can be
-found at @uref{ftp://sources.redhat.com/pub/binutils/}. It is very
-unlikely that a system installed version of @code{autoconf} (e.g.,
-@file{/usr/bin/autoconf}) is correct.
+version documented in the toplevel @file{README-maintainer-mode} file.
+It is very unlikely that a system installed version of @code{autoconf}
+(e.g., @file{/usr/bin/autoconf}) is correct.
 @end itemize
 
 @subsubheading Check out the relevant modules:
 
 @smallexample
-$  for m in gdb insight dejagnu
+$  for m in gdb insight
 do
 ( mkdir -p $m && cd $m && cvs -q -f -d /cvs/src co -P -r $b $m )
 done
@@ -5844,11 +7130,11 @@ You'll need to update:
 
 @itemize @bullet
 @item
-the version
+The version.
 @item
-the update date
+The update date.
 @item
-who did it
+Who did it.
 @end itemize
 
 @smallexample
@@ -5884,24 +7170,6 @@ $  cp gdb/src/gdb/version.in insight/src/gdb/version.in
 $  cp gdb/src/gdb/ChangeLog insight/src/gdb/ChangeLog 
 @end smallexample
 
-@item dejagnu/src/dejagnu/configure.in
-
-Dejagnu is more complicated.  The version number is a parameter to
-@code{AM_INIT_AUTOMAKE}.  Tweak it to read something like gdb-5.1.91.
-
-Don't forget to re-generate @file{configure}.
-
-Don't forget to include a @file{ChangeLog} entry.
-
-@smallexample
-$  emacs dejagnu/src/dejagnu/configure.in
-...
-c-x 4 a
-...
-c-x c-s c-x c-c
-$  ( cd  dejagnu/src/dejagnu && autoconf )
-@end smallexample
-
 @end table
 
 @subsubheading Do the dirty work
@@ -5913,7 +7181,6 @@ $  for m in gdb insight
 do
 ( cd $m/src && gmake -f src-release $m.tar )
 done
-$  ( m=dejagnu; cd $m/src && gmake -f src-release $m.tar.bz2 )
 @end smallexample
 
 If the top level source directory does not have @file{src-release}
@@ -5924,7 +7191,6 @@ $  for m in gdb insight
 do
 ( cd $m/src && gmake -f Makefile.in $m.tar )
 done
-$  ( m=dejagnu; cd $m/src && gmake -f Makefile.in $m.tar.bz2 )
 @end smallexample
 
 @subsubheading Check the source files
@@ -5951,7 +7217,7 @@ $
 @emph{Don't worry about the @file{gdb.info-??} or
 @file{gdb/p-exp.tab.c}.  They were generated (and yes @file{gdb.info-1}
 was also generated only something strange with CVS means that they
-didn't get supressed).  Fixing it would be nice though.}
+didn't get suppressed).  Fixing it would be nice though.}
 
 @subsubheading Create compressed versions of the release
 
@@ -5959,7 +7225,7 @@ didn't get supressed).  Fixing it would be nice though.}
 $  cp */src/*.tar .
 $  cp */src/*.bz2 .
 $  ls -F
-dejagnu/ dejagnu-gdb-5.2.tar.bz2 gdb/ gdb-5.2.tar insight/ insight-5.2.tar
+gdb/ gdb-5.2.tar insight/ insight-5.2.tar
 $  for m in gdb insight
 do
 bzip2 -v -9 -c $m-$v.tar > $m-$v.tar.bz2
@@ -6017,10 +7283,10 @@ Tweak @file{version.in} (and @file{ChangeLog} to read
 process can restart.
 @item
 Make the release candidate available in
-@uref{ftp://sources.redhat.com/pub/gdb/snapshots/branch}
+@uref{ftp://sourceware.org/pub/gdb/snapshots/branch}
 @item
-Notify the relevant mailing lists ( @email{gdb@@sources.redhat.com} and
-@email{gdb-testers@@sources.redhat.com} that the candidate is available.
+Notify the relevant mailing lists ( @email{gdb@@sourceware.org} and
+@email{gdb-testers@@sourceware.org} that the candidate is available.
 @end enumerate
 
 @subsection Make a formal release available
@@ -6038,7 +7304,7 @@ $  cp *.bz2 *.gz ~ftp/pub/gdb/releases
 
 @noindent
 Clean up the releases directory so that only the most recent releases
-are available (e.g. keep 5.2 and 5.2.1 but remove 5.1):
+are available (e.g.@: keep 5.2 and 5.2.1 but remove 5.1):
 
 @smallexample
 $  cd ~ftp/pub/gdb/releases
@@ -6064,12 +7330,12 @@ $  ln README .message
 This file, which is posted as the official announcement, includes:
 @itemize @bullet
 @item
-General announcement
+General announcement.
 @item
 News.  If making an @var{M}.@var{N}.1 release, retain the news from
 earlier @var{M}.@var{N} release.
 @item
-Errata
+Errata.
 @end itemize
 
 @item htdocs/index.html
@@ -6078,9 +7344,9 @@ Errata
 These files include:
 @itemize @bullet
 @item
-announcement of the most recent release
+Announcement of the most recent release.
 @item
-news entry (remember to update both the top level and the news directory).
+News entry (remember to update both the top level and the news directory).
 @end itemize
 These pages also need to be regenerate using @code{index.sh}.
 
@@ -6127,7 +7393,7 @@ Post the @file{ANNOUNCEMENT} file you created above to:
 
 @itemize @bullet
 @item
-@email{gdb-announce@@sources.redhat.com, GDB Announcement mailing list}
+@email{gdb-announce@@sourceware.org, GDB Announcement mailing list}
 @item
 @email{info-gnu@@gnu.org, General GNU Announcement list} (but delay it a
 day or so to let things get out)
@@ -6167,8 +7433,7 @@ $  ( cd insight/src && cvs -f -q tag gdb_5_2-$d-release )
 @end smallexample
 
 Insight is used since that contains more of the release than
-@value{GDBN} (@code{dejagnu} doesn't get tagged but I think we can live
-with that).
+@value{GDBN}.
 
 @subsubheading Mention the release on the trunk
 
@@ -6192,7 +7457,7 @@ trunk.
 
 @subsubheading Revise the release schedule
 
-Post a revised release schedule to @email{gdb@@sources.redhat.com, GDB
+Post a revised release schedule to @email{gdb@@sourceware.org, GDB
 Discussion List} with an updated announcement.  The schedule can be
 generated by running:
 
@@ -6221,10 +7486,9 @@ this is rarely sufficient; users typically use only a small subset of
 the available commands, and it has proven all too common for a change
 to cause a significant regression that went unnoticed for some time.
 
-The @value{GDBN} testsuite uses the DejaGNU testing framework.
-DejaGNU is built using @code{Tcl} and @code{expect}.  The tests
-themselves are calls to various @code{Tcl} procs; the framework runs all the
-procs and summarizes the passes and fails.
+The @value{GDBN} testsuite uses the DejaGNU testing framework.  The
+tests themselves are calls to various @code{Tcl} procs; the framework
+runs all the procs and summarizes the passes and fails.
 
 @section Using the Testsuite
 
@@ -6247,6 +7511,23 @@ finished, you'll get a summary that looks like this:
 # of untested testcases         5
 @end smallexample
 
+To run a specific test script, type:
+@example
+make check RUNTESTFLAGS='@var{tests}'
+@end example
+where @var{tests} is a list of test script file names, separated by
+spaces.
+
+If you use GNU make, you can use its @option{-j} option to run the
+testsuite in parallel.  This can greatly reduce the amount of time it
+takes for the testsuite to run.  In this case, if you set
+@code{RUNTESTFLAGS} then, by default, the tests will be run serially
+even under @option{-j}.  You can override this and force a parallel run
+by setting the @code{make} variable @code{FORCE_PARALLEL} to any
+non-empty value.  Note that the parallel @kbd{make check} assumes
+that you want to run the entire testsuite, so it is not compatible
+with some dejagnu options, like @option{--directory}.
+
 The ideal test run consists of expected passes only; however, reality
 conspires to keep us from this ideal.  Unexpected failures indicate
 real problems, whether in @value{GDBN} or in the testsuite.  Expected
@@ -6279,6 +7560,36 @@ difficult to test, such as code that handles host OS failures or bugs
 in particular versions of compilers, and it's OK not to try to write
 tests for all of those.
 
+DejaGNU supports separate build, host, and target machines.  However,
+some @value{GDBN} test scripts do not work if the build machine and
+the host machine are not the same.  In such an environment, these scripts
+will give a result of ``UNRESOLVED'', like this:
+
+@smallexample
+UNRESOLVED: gdb.base/example.exp: This test script does not work on a remote host.
+@end smallexample
+
+Sometimes it is convenient to get a transcript of the commands which
+the testsuite sends to @value{GDBN}.  For example, if @value{GDBN}
+crashes during testing, a transcript can be used to more easily
+reconstruct the failure when running @value{GDBN} under @value{GDBN}.
+
+You can instruct the @value{GDBN} testsuite to write transcripts by
+setting the DejaGNU variable @code{TRANSCRIPT} (to any value)
+before invoking @code{runtest} or @kbd{make check}.  The transcripts
+will be written into DejaGNU's output directory.  One transcript will
+be made for each invocation of @value{GDBN}; they will be named
+@file{transcript.@var{n}}, where @var{n} is an integer.  The first
+line of the transcript file will show how @value{GDBN} was invoked;
+each subsequent line is a command sent as input to @value{GDBN}.
+
+@smallexample
+make check RUNTESTFLAGS=TRANSCRIPT=y
+@end smallexample
+
+Note that the transcript is not always complete.  In particular, tests
+of completion can yield partial command lines.
+
 @section Testsuite Organization
 
 @cindex test suite organization
@@ -6346,7 +7657,14 @@ instance, @file{gdb.base/exprs.exp} defines a @code{test_expr} that
 calls @code{gdb_test} multiple times.
 
 Only use @code{send_gdb} and @code{gdb_expect} when absolutely
-necessary, such as when @value{GDBN} has several valid responses to a command.
+necessary.  Even if @value{GDBN} has several valid responses to
+a command, you can use @code{gdb_test_multiple}.  Like @code{gdb_test},
+@code{gdb_test_multiple} recognizes internal errors and unexpected
+prompts.
+
+Do not write tests which expect a literal tab character from @value{GDBN}.
+On some operating systems (e.g.@: OpenBSD) the TTY layer expands tabs to
+spaces, so by the time @value{GDBN}'s output reaches expect the tab is gone.
 
 The source language programs do @emph{not} need to be in a consistent
 style.  Since @value{GDBN} is used to debug programs written in many different
@@ -6540,28 +7858,22 @@ permits, which, since the maintainers have many demands to meet, may not
 be for quite some time.
 
 Please send patches directly to
-@email{gdb-patches@@sources.redhat.com, the @value{GDBN} maintainers}.
-
-@section Obsolete Conditionals
-@cindex obsolete code
+@email{gdb-patches@@sourceware.org, the @value{GDBN} maintainers}.
 
-Fragments of old code in @value{GDBN} sometimes reference or set the following
-configuration macros.  They should not be used by new code, and old uses
-should be removed as those parts of the debugger are otherwise touched.
+@section Build Script
 
-@table @code
-@item STACK_END_ADDR
-This macro used to define where the end of the stack appeared, for use
-in interpreting core file formats that don't record this address in the
-core file itself.  This information is now configured in BFD, and @value{GDBN}
-gets the info portably from there.  The values in @value{GDBN}'s configuration
-files should be moved into BFD configuration files (if needed there),
-and deleted from all of @value{GDBN}'s config files.
+@cindex build script
 
-Any @file{@var{foo}-xdep.c} file that references STACK_END_ADDR
-is so old that it has never been converted to use BFD.  Now that's old!
+The script @file{gdb_buildall.sh} builds @value{GDBN} with flag
+@option{--enable-targets=all} set.  This builds @value{GDBN} with all supported
+targets activated.  This helps testing @value{GDBN} when doing changes that
+affect more than one architecture and is much faster than using
+@file{gdb_mbuild.sh}.
 
-@end table
+After building @value{GDBN} the script checks which architectures are
+supported and then switches the current architecture to each of those to get
+information about the architecture.  The test results are stored in log files
+in the directory the script was called from.
 
 @include observer.texi
 @raisesections
This page took 0.127416 seconds and 4 git commands to generate.