GDB: Upgrade version from 7.0 to 7.2
authorJohn Marino <draco@marino.st>
Tue, 3 May 2011 22:11:24 +0000 (00:11 +0200)
committerJohn Marino <draco@marino.st>
Sat, 7 May 2011 08:24:47 +0000 (10:24 +0200)
commita938cc155ad1f09b3b79fb918a26dddb08ece598
tree69c2c8139f33f30cb0a082b5f725960a2c22e043
parent70cb1f6609adc0d95831f70602e4c6f7d6fccb3c
GDB: Upgrade version from 7.0 to 7.2

It was thought that an minor point upgrade of gdb would be a straight-
forward task, but that wasn't the case.  There was an architectural change
between version 7.0 and 7.2 that introduced the concept of separate program
spaces and address spaces for each "inferior" (process being debugged) that
required a rework of the kernel debugger to make it work properly.

One ramification from this change is now GDB 7.2 starts off with one
inferior with process ID of 0.  GDB 7.0 started off with no inferiors
pre-defined.  However, there is a legitimate process with PID 0, and that's
the swapper.  GDB 7.2 had to be modified to behave one way as gdb and
differently as kgdb.  An undocumented command-line option "--kernel" was
added, which prevents the initial inferior from being created, and disables
all asserts and checks for pid 0.  There is no reason for a normal user to
use the --kernel option; it's only for kgdb to signal to gdb to operate
differently.

The major required change to kgdb was to create an unique program space and
address space for each inferior.  The trick to get threading symbols to
display was to copy the object file and target section data from the
initial program space over to each additionally created one.  There are
some other minor changed required by function prototype changes and some
minor improvements were borrowed from FreeBSD.

GDB 7.3 should be released relatively soon.  This update to GDB 7.2 is
considered a stepping-stone upgrade.  There are no apparently design
changes between versions 7.2 and 7.3, so the update to 7.3 is expected
to be very easy, and will occur after the 7.3 release, assuming there are
no issues found with the 7.2 upgrade.

=============================================
 Changes by GDB 7.1 (Released 18 March 2010)
=============================================

* C++ Improvements

  ** Namespace Support

  GDB now supports importing of namespaces in C++.  This enables the
  user to inspect variables from imported namespaces.  Support for
  namepace aliasing has also been added.  So, if a namespace is
  aliased in the current scope (e.g. namepace C=A; ) the user can
  print variables using the alias (e.g. (gdb) print C::x).

  ** Bug Fixes

  All known bugs relating to the printing of virtual base class were
  fixed.  It is now possible to call overloaded static methods using a
  qualified name.

  ** Cast Operators

  The C++ cast operators static_cast<>, dynamic_cast<>, const_cast<>,
  and reinterpret_cast<> are now handled by the C++ expression parser.

* New targets

Xilinx MicroBlaze microblaze-*-*
Renesas RX rx-*-elf

* New Simulators

Xilinx MicroBlaze microblaze
Renesas RX rx

* Multi-program debugging.

  GDB now has support for multi-program (a.k.a. multi-executable or
  multi-exec) debugging.  This allows for debugging multiple inferiors
  simultaneously each running a different program under the same GDB
  session.  See "Debugging Multiple Inferiors and Programs" in the
  manual for more information.  This implied some user visible changes
  in the multi-inferior support.  For example, "info inferiors" now
  lists inferiors that are not running yet or that have exited
  already.  See also "New commands" and "New options" below.

* New tracing features

  GDB's tracepoint facility now includes several new features:

  ** Trace state variables

  GDB tracepoints now include support for trace state variables, which
  are variables managed by the target agent during a tracing
  experiment.  They are useful for tracepoints that trigger each
  other, so for instance one tracepoint can count hits in a variable,
  and then a second tracepoint has a condition that is true when the
  count reaches a particular value.  Trace state variables share the
  $-syntax of GDB convenience variables, and can appear in both
  tracepoint actions and condition expressions.  Use the "tvariable"
  command to create, and "info tvariables" to view; see "Trace State
  Variables" in the manual for more detail.

  ** Fast tracepoints

  GDB now includes an option for defining fast tracepoints, which
  targets may implement more efficiently, such as by installing a jump
  into the target agent rather than a trap instruction.  The resulting
  speedup can be by two orders of magnitude or more, although the
  tradeoff is that some program locations on some target architectures
  might not allow fast tracepoint installation, for instance if the
  instruction to be replaced is shorter than the jump.  To request a
  fast tracepoint, use the "ftrace" command, with syntax identical to
  the regular trace command.

  ** Disconnected tracing

  It is now possible to detach GDB from the target while it is running
  a trace experiment, then reconnect later to see how the experiment
  is going.  In addition, a new variable disconnected-tracing lets you
  tell the target agent whether to continue running a trace if the
  connection is lost unexpectedly.

  ** Trace files

  GDB now has the ability to save the trace buffer into a file, and
  then use that file as a target, similarly to you can do with
  corefiles.  You can select trace frames, print data that was
  collected in them, and use tstatus to display the state of the
  tracing run at the moment that it was saved.  To create a trace
  file, use "tsave <filename>", and to use it, do "target tfile
  <name>".

  ** Circular trace buffer

  You can ask the target agent to handle the trace buffer as a
  circular buffer, discarding the oldest trace frames to make room for
  newer ones, by setting circular-trace-buffer to on.  This feature may
  not be available for all target agents.

* Changed commands

disassemble
  The disassemble command, when invoked with two arguments, now requires
  the arguments to be comma-separated.

info variables
  The info variables command now displays variable definitions.  Files
  which only declare a variable are not shown.

source
  The source command is now capable of sourcing Python scripts.
  This feature is dependent on the debugger being build with Python
  support.

  Related to this enhancement is also the introduction of a new command
  "set script-extension" (see below).

* New commands (for set/show, see "New options" below)

record save [<FILENAME>]
  Save a file (in core file format) containing the process record
  execution log for replay debugging at a later time.

record restore <FILENAME>
  Restore the process record execution log that was saved at an
  earlier time, for replay debugging.

add-inferior [-copies <N>] [-exec <FILENAME>]
  Add a new inferior.

clone-inferior [-copies <N>] [ID]
  Make a new inferior ready to execute the same program another
  inferior has loaded.

remove-inferior ID
  Remove an inferior.

maint info program-spaces
  List the program spaces loaded into GDB.

set remote interrupt-sequence [Ctrl-C | BREAK | BREAK-g]
show remote interrupt-sequence
  Allow the user to select one of ^C, a BREAK signal or BREAK-g
  as the sequence to the remote target in order to interrupt the execution.
  Ctrl-C is a default.  Some system prefers BREAK which is high level of
  serial line for some certain time.  Linux kernel prefers BREAK-g, a.k.a
  Magic SysRq g.  It is BREAK signal and character 'g'.

set remote interrupt-on-connect [on | off]
show remote interrupt-on-connect
  When interrupt-on-connect is ON, gdb sends interrupt-sequence to
  remote target when gdb connects to it.  This is needed when you debug
  Linux kernel.

set remotebreak [on | off]
show remotebreak
Deprecated.  Use "set/show remote interrupt-sequence" instead.

tvariable $NAME [ = EXP ]
  Create or modify a trace state variable.

info tvariables
  List trace state variables and their values.

delete tvariable $NAME ...
  Delete one or more trace state variables.

teval EXPR, ...
  Evaluate the given expressions without collecting anything into the
  trace buffer. (Valid in tracepoint actions only.)

ftrace FN / FILE:LINE / *ADDR
  Define a fast tracepoint at the given function, line, or address.

* New expression syntax

  GDB now parses the 0b prefix of binary numbers the same way as GCC does.
  GDB now parses 0b101010 identically with 42.

* New options

set follow-exec-mode new|same
show follow-exec-mode
  Control whether GDB reuses the same inferior across an exec call or
  creates a new one.  This is useful to be able to restart the old
  executable after the inferior having done an exec call.

set default-collect EXPR, ...
show default-collect
   Define a list of expressions to be collected at each tracepoint.
   This is a useful way to ensure essential items are not overlooked,
   such as registers or a critical global variable.

set disconnected-tracing
show disconnected-tracing
   If set to 1, the target is instructed to continue tracing if it
   loses its connection to GDB.  If 0, the target is to stop tracing
   upon disconnection.

set circular-trace-buffer
show circular-trace-buffer
   If set to on, the target is instructed to use a circular trace buffer
   and discard the oldest trace frames instead of stopping the trace due
   to a full trace buffer.  If set to off, the trace stops when the buffer
   fills up.  Some targets may not support this.

set script-extension off|soft|strict
show script-extension
   If set to "off", the debugger does not perform any script language
   recognition, and all sourced files are assumed to be GDB scripts.
   If set to "soft" (the default), files are sourced according to
   filename extension, falling back to GDB scripts if the first
   evaluation failed.
   If set to "strict", files are sourced according to filename extension.

set ada trust-PAD-over-XVS on|off
show ada trust-PAD-over-XVS
   If off, activate a workaround against a bug in the debugging information
   generated by the compiler for PAD types (see gcc/exp_dbug.ads in
   the GCC sources for more information about the GNAT encoding and
   PAD types in particular).  It is always safe to set this option to
   off, but this introduces a slight performance penalty.  The default
   is on.

* Python API Improvements

  ** GDB provides the new class gdb.LazyString.  This is useful in
     some pretty-printing cases.  The new method gdb.Value.lazy_string
     provides a simple way to create objects of this type.

  ** The fields returned by gdb.Type.fields now have an
     `is_base_class' attribute.

  ** The new method gdb.Type.range returns the range of an array type.

  ** The new method gdb.parse_and_eval can be used to parse and
     evaluate an expression.

* New remote packets

QTDV
   Define a trace state variable.

qTV
   Get the current value of a trace state variable.

QTDisconnected
   Set desired tracing behavior upon disconnection.

QTBuffer:circular
   Set the trace buffer to be linear or circular.

qTfP, qTsP
   Get data about the tracepoints currently in use.

* Bug fixes

Process record now works correctly with hardware watchpoints.

Multiple bug fixes have been made to the mips-irix port, making it
much more reliable. In particular:
  - Debugging threaded applications is now possible again.  Previously,
    GDB would hang while starting the program, or while waiting for
    the program to stop at a breakpoint.
  - Attaching to a running process no longer hangs.
  - An error occurring while loading a core file has been fixed.
  - Changing the value of the PC register now works again.  This fixes
    problems observed when using the "jump" command, or when calling
    a function from GDB, or even when assigning a new value to $pc.
  - With the "finish" and "return" commands, the return value for functions
    returning a small array is now correctly printed.
  - It is now possible to break on shared library code which gets executed
    during a shared library init phase (code executed while executing
    their .init section).  Previously, the breakpoint would have no effect.
  - GDB is now able to backtrace through the signal handler for
    non-threaded programs.

PIE (Position Independent Executable) programs debugging is now supported.
This includes debugging execution of PIC (Position Independent Code) shared
libraries although for that, it should be possible to run such libraries as an
executable program.

=================================================
 Changes by GDB 7.2 (Released 02 September 2010)
=================================================

* Shared library support for remote targets by default

  When GDB is configured for a generic, non-OS specific target, like
  for example, --target=arm-eabi or one of the many *-*-elf targets,
  GDB now queries remote stubs for loaded shared libraries using the
  `qXfer:libraries:read' packet.  Previously, shared library support
  was always disabled for such configurations.

* C++ Improvements:

  ** Argument Dependent Lookup (ADL)

  In C++ ADL lookup directs function search to the namespaces of its
  arguments even if the namespace has not been imported.
  For example:
    namespace A
      {
        class B { };
        void foo (B) { }
      }
    ...
    A::B b
    foo(b)
  Here the compiler will search for `foo' in the namespace of 'b'
  and find A::foo.  GDB now supports this.  This construct is commonly
  used in the Standard Template Library for operators.

  ** Improved User Defined Operator Support

  In addition to member operators, GDB now supports lookup of operators
  defined in a namespace and imported with a `using' directive, operators
  defined in the global scope, operators imported implicitly from an
  anonymous namespace, and the ADL operators mentioned in the previous
  entry.
  GDB now also supports proper overload resolution for all the previously
  mentioned flavors of operators.

  ** static const class members

  Printing of static const class members that are initialized in the
  class definition has been fixed.

* Windows Thread Information Block access.

  On Windows targets, GDB now supports displaying the Windows Thread
  Information Block (TIB) structure.  This structure is visible either
  by using the new command `info w32 thread-information-block' or, by
  dereferencing the new convenience variable named `$_tlb', a
  thread-specific pointer to the TIB.  This feature is also supported
  when remote debugging using GDBserver.

* Static tracepoints

  Static tracepoints are calls in the user program into a tracing
  library.  One such library is a port of the LTTng kernel tracer to
  userspace --- UST (LTTng Userspace Tracer, http://lttng.org/ust).
  When debugging with GDBserver, GDB now supports combining the GDB
  tracepoint machinery with such libraries.  For example: the user can
  use GDB to probe a static tracepoint marker (a call from the user
  program into the tracing library) with the new "strace" command (see
  "New commands" below).  This creates a "static tracepoint" in the
  breakpoint list, that can be manipulated with the same feature set
  as fast and regular tracepoints.  E.g., collect registers, local and
  global variables, collect trace state variables, and define
  tracepoint conditions.  In addition, the user can collect extra
  static tracepoint marker specific data, by collecting the new
  $_sdata internal variable.  When analyzing the trace buffer, you can
  inspect $_sdata like any other variable available to GDB.  For more
  information, see the "Tracepoints" chapter in GDB user manual.  New
  remote packets have been defined to support static tracepoints, see
  the "New remote packets" section below.

* Better reconstruction of tracepoints after disconnected tracing

  GDB will attempt to download the original source form of tracepoint
  definitions when starting a trace run, and then will upload these
  upon reconnection to the target, resulting in a more accurate
  reconstruction of the tracepoints that are in use on the target.

* Observer mode

  You can now exercise direct control over the ways that GDB can
  affect your program.  For instance, you can disallow the setting of
  breakpoints, so that the program can run continuously (assuming
  non-stop mode).  In addition, the "observer" variable is available
  to switch all of the different controls; in observer mode, GDB
  cannot affect the target's behavior at all, which is useful for
  tasks like diagnosing live systems in the field.

* The new convenience variable $_thread holds the number of the
  current thread.

* New remote packets

qGetTIBAddr

  Return the address of the Windows Thread Information Block of a given thread.

qRelocInsn

  In response to several of the tracepoint packets, the target may now
  also respond with a number of intermediate `qRelocInsn' request
  packets before the final result packet, to have GDB handle
  relocating an instruction to execute at a different address.  This
  is particularly useful for stubs that support fast tracepoints.  GDB
  reports support for this feature in the qSupported packet.

qTfSTM, qTsSTM

  List static tracepoint markers in the target program.

qTSTMat

  List static tracepoint markers at a given address in the target
  program.

qXfer:statictrace:read

  Read the static trace data collected (by a `collect $_sdata'
  tracepoint action).  The remote stub reports support for this packet
  to gdb's qSupported query.

QAllow

  Send the current settings of GDB's permission flags.

QTDPsrc

  Send part of the source (textual) form of a tracepoint definition,
  which includes location, conditional, and action list.

* The source command now accepts a -s option to force searching for the
  script in the source search path even if the script name specifies
  a directory.

* New features in the GDB remote stub, GDBserver

  - GDBserver now support tracepoints (including fast tracepoints, and
    static tracepoints).  The feature is currently supported by the
    i386-linux and amd64-linux builds.  See the "Tracepoints support
    in gdbserver" section in the manual for more information.

    GDBserver JIT compiles the tracepoint's conditional agent
    expression bytecode into native code whenever possible for low
    overhead dynamic tracepoints conditionals.  For such tracepoints,
    an expression that examines program state is evaluated when the
    tracepoint is reached, in order to determine whether to capture
    trace data.  If the condition is simple and false, processing the
    tracepoint finishes very quickly and no data is gathered.

    GDBserver interfaces with the UST (LTTng Userspace Tracer) library
    for static tracepoints support.

  - GDBserver now supports x86_64 Windows 64-bit debugging.

* GDB now sends xmlRegisters= in qSupported packet to indicate that
  it understands register description.

* The --batch flag now disables pagination and queries.

* X86 general purpose registers

  GDB now supports reading/writing byte, word and double-word x86
  general purpose registers directly.  This means you can use, say,
  $ah or $ax to refer, respectively, to the byte register AH and
  16-bit word register AX that are actually portions of the 32-bit
  register EAX or 64-bit register RAX.

* The `commands' command now accepts a range of breakpoints to modify.
  A plain `commands' following a command that creates multiple
  breakpoints affects all the breakpoints set by that command.  This
  applies to breakpoints set by `rbreak', and also applies when a
  single `break' command creates multiple breakpoints (e.g.,
  breakpoints on overloaded c++ functions).

* The `rbreak' command now accepts a filename specification as part of
  its argument, limiting the functions selected by the regex to those
  in the specified file.

* Support for remote debugging Windows and SymbianOS shared libraries
  from Unix hosts has been improved.  Non Windows GDB builds now can
  understand target reported file names that follow MS-DOS based file
  system semantics, such as file names that include drive letters and
  use the backslash character as directory separator.  This makes it
  possible to transparently use the "set sysroot" and "set
  solib-search-path" on Unix hosts to point as host copies of the
  target's shared libraries.  See the new command "set
  target-file-system-kind" described below, and the "Commands to
  specify files" section in the user manual for more information.

* New commands

eval template, expressions...
  Convert the values of one or more expressions under the control
  of the string template to a command line, and call it.

set target-file-system-kind unix|dos-based|auto
show target-file-system-kind
  Set or show the assumed file system kind for target reported file
  names.

save breakpoints <filename>
  Save all current breakpoint definitions to a file suitable for use
  in a later debugging session.  To read the saved breakpoint
  definitions, use the `source' command.

`save tracepoints' is a new alias for `save-tracepoints'.  The latter
is now deprecated.

info static-tracepoint-markers
  Display information about static tracepoint markers in the target.

strace FN | FILE:LINE | *ADDR | -m MARKER_ID
  Define a static tracepoint by probing a marker at the given
  function, line, address, or marker ID.

set observer on|off
show observer
  Enable and disable observer mode.

set may-write-registers on|off
set may-write-memory on|off
set may-insert-breakpoints on|off
set may-insert-tracepoints on|off
set may-insert-fast-tracepoints on|off
set may-interrupt on|off
  Set individual permissions for GDB effects on the target.  Note that
  some of these settings can have undesirable or surprising
  consequences, particularly when changed in the middle of a session.
  For instance, disabling the writing of memory can prevent
  breakpoints from being inserted, cause single-stepping to fail, or
  even crash your program, if you disable after breakpoints have been
  inserted.  However, GDB should not crash.

set record memory-query on|off
show record memory-query
  Control whether to stop the inferior if memory changes caused
  by an instruction cannot be recorded.

* Changed commands

disassemble
  The disassemble command now supports "start,+length" form of two arguments.

* Python scripting

** GDB now provides a new directory location, called the python directory,
   where Python scripts written for GDB can be installed.  The location
   of that directory is <data-directory>/python, where <data-directory>
   is the GDB data directory.  For more details, see section `Scripting
   GDB using Python' in the manual.

** The GDB Python API now has access to breakpoints, symbols, symbol
   tables, program spaces, inferiors, threads and frame's code blocks.
   Additionally, GDB Parameters can now be created from the API, and
   manipulated via set/show in the CLI.

** New functions gdb.target_charset, gdb.target_wide_charset,
   gdb.progspaces, gdb.current_progspace, and gdb.string_to_argv.

** New exception gdb.GdbError.

** Pretty-printers are now also looked up in the current program space.

** Pretty-printers can now be individually enabled and disabled.

** GDB now looks for names of Python scripts to auto-load in a
   special section named `.debug_gdb_scripts', in addition to looking
   for a OBJFILE-gdb.py script when OBJFILE is read by the debugger.

* Tracepoint actions were unified with breakpoint commands. In particular,
there are no longer differences in "info break" output for breakpoints and
tracepoints and the "commands" command can be used for both tracepoints and
regular breakpoints.

* New targets

ARM Symbian arm*-*-symbianelf*

* D language support.
  GDB now supports debugging programs written in the D programming
  language.

* GDB now supports the extended ptrace interface for PowerPC which is
  available since Linux kernel version 2.6.34.  This automatically enables
  any hardware breakpoints and additional hardware watchpoints available in
  the processor.  The old ptrace interface exposes just one hardware
  watchpoint and no hardware breakpoints.

* GDB is now able to use the Data Value Compare (DVC) register available on
  embedded PowerPC processors to implement in hardware simple watchpoint
  conditions of the form:

  watch ADDRESS|VARIABLE if ADDRESS|VARIABLE == CONSTANT EXPRESSION

  This works in native GDB running on Linux kernels with the extended ptrace
  interface mentioned above.
23 files changed:
contrib/gdb-7/README.DELETED
contrib/gdb-7/README.DRAGONFLY
contrib/gdb-7/gdb/defs.h
contrib/gdb-7/gdb/inferior.c
contrib/gdb-7/gdb/infrun.c
contrib/gdb-7/gdb/main.c
gnu/usr.bin/gdb/Makefile.inc
gnu/usr.bin/gdb/gdb/ada-lex.c [new file with mode: 0644]
gnu/usr.bin/gdb/gdb/doc/Makefile
gnu/usr.bin/gdb/kgdb/kgdb.c
gnu/usr.bin/gdb/kgdb/kgdb.h
gnu/usr.bin/gdb/kgdb/kld.c
gnu/usr.bin/gdb/kgdb/kthr.c
gnu/usr.bin/gdb/kgdb/trgt.c
gnu/usr.bin/gdb/libbfd/Makefile
gnu/usr.bin/gdb/libbfd/bfdver.h [new file with mode: 0644]
gnu/usr.bin/gdb/libdecnumber/Makefile
gnu/usr.bin/gdb/libdecnumber/config.h
gnu/usr.bin/gdb/libdecnumber/gstdint.h [new file with mode: 0644]
gnu/usr.bin/gdb/libgdb/Makefile
gnu/usr.bin/gdb/libgdb/config.h
gnu/usr.bin/gdb/libgdb/gstdint.h [new file with mode: 0644]
gnu/usr.bin/gdb/libiberty/Makefile