Commit Graph

2896 Commits

Author SHA1 Message Date
Joel Brobecker
3666a04883 Update copyright year range in all GDB files
This commits the result of running gdb/copyright.py as per our Start
of New Year procedure...

gdb/ChangeLog

        Update copyright year range in copyright header of all GDB files.
2021-01-01 12:12:21 +04:00
Hannes Domani
6596a5d4f6 Fix wrong method name
The objects returned by FrameDecorator.frame_args need to implement a
method named symbol, not argument.

gdb/doc/ChangeLog:

2020-12-29  Hannes Domani  <ssbssa@yahoo.de>

	* python.texi (Frame Decorator API): Fix method name.
2020-12-29 18:35:50 +01:00
Alex Bennée
f37059ea22 Clarify language for the '?' packet
Both QEMU and kgdb make the assumption that the '?' packet is only
sent during the initial setup of a gdbstub connection. Both use that
knowledge to reset breakpoints and ensure the gdbstub is in a
clean-state on a resumed connection. This can cause confusion for
others implementing clients that speak to gdbstub devices. To avoid
that make the language clearer that this is a start-up query packet
that you only expect to see once.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

gdb/doc/ChangeLog:

	* gdb.texinfo (Packets): Clarify language for ? packet.

Change-Id: Iae25d3110fe28b8d2467704962a6889e55224ca5
2020-12-23 16:36:48 -05:00
Joel Brobecker
904cb749cf gdb.texinfo: Document GMP as mandatory requirement to build GDB
gdb/doc/ChangeLog

        * gdb.texinfo (Requirements): Add GMP to list of requirements.
2020-12-21 06:21:41 +04:00
Hannes Domani
e846045952 Remove erroneous 'a' in gdb.register_window_type documentation
gdb/doc/ChangeLog:

2020-12-18  Hannes Domani  <ssbssa@yahoo.de>

	* python.texi (TUI Windows In Python): Remove erroneous 'a'.
2020-12-18 22:05:14 +01:00
Hannes Domani
4aea001fd8 Add address keyword to Value.format_string
This makes it possible to disable the address in the result string:

const char *str = "alpha";

(gdb) py print(gdb.parse_and_eval("str").format_string())
0x404000 "alpha"
(gdb) py print(gdb.parse_and_eval("str").format_string(address=False))
"alpha"

gdb/ChangeLog:

2020-12-18  Hannes Domani  <ssbssa@yahoo.de>

	* python/py-value.c (valpy_format_string): Implement address keyword.

gdb/doc/ChangeLog:

2020-12-18  Hannes Domani  <ssbssa@yahoo.de>

	* python.texi (Values From Inferior): Document the address keyword.

gdb/testsuite/ChangeLog:

2020-12-18  Hannes Domani  <ssbssa@yahoo.de>

	* gdb.python/py-format-string.exp: Add tests for address keyword.
2020-12-18 22:04:16 +01:00
Simon Marchi
85be4f5a8c gdb/doc: fix "show check range" command name
gdb/doc/ChangeLog:

	PR gdb/27088
	* gdb.texinfo (Range Checking): Fix "show check range" command
	name.

Change-Id: I0248ef76d205ac49ed71b813aafe3e630c2ffc2e
2020-12-17 09:42:35 -05:00
Andrew Burgess
ee9812a001 gdb: new command 'maint flush dcache'
Add a new command to flush the dcache.

gdb/ChangeLog:

	* NEWS: Mention new commands.
	* target-dcache.c: Add 'cli/cli-cmds.h' include.
	(maint_flush_dcache_command): New function.
	(_initialize_target_dcache): Create new 'maint flush dcache'
	command.

gdb/doc/ChangeLog:

	* gdb.texinfo (Caching Target Data): Document 'maint flush
	dcache'.

gdb/testsuite/ChangeLog:

	* gdb.base/dcache-flush.c: New file.
	* gdb.base/dcache-flush.exp: New file.
2020-12-13 12:36:16 +00:00
Andrew Burgess
50a5f1878e gdb: introduce new 'maint flush ' prefix command
We currently have two flushing commands 'flushregs' and 'maint
flush-symbol-cache'.  I'm planning to add at least one more so I
thought it might be nice if we bundled these together into one place.

And so I created the 'maint flush ' command prefix.  Currently there
are two commands:

  (gdb) maint flush symbol-cache
  (gdb) maint flush register-cache

Unfortunately, even though both of the existing flush commands are
maintenance commands, I don't know how keen we about deleting existing
commands for fear of breaking things in the wild.  So, both of the
existing flush commands 'maint flush-symbol-cache' and 'flushregs' are
still around as deprecated aliases to the new commands.

I've updated the testsuite to use the new command syntax, and updated
the documentation too.

gdb/ChangeLog:

	* NEWS: Mention new commands, and that the old commands are now
	deprecated.
	* cli/cli-cmds.c (maintenanceflushlist): Define.
	* cli/cli-cmds.h (maintenanceflushlist): Declare.
	* maint.c (_initialize_maint_cmds): Initialise
	maintenanceflushlist.
	* regcache.c: Add 'cli/cli-cmds.h' include.
	(reg_flush_command): Add header comment.
	(_initialize_regcache): Create new 'maint flush register-cache'
	command, make 'flushregs' an alias.
	* symtab.c: Add 'cli/cli-cmds.h' include.
	(_initialize_symtab): Create new 'maint flush symbol-cache'
	command, make old command an alias.

gdb/doc/ChangeLog:

	* gdb.texinfo (Symbols): Document 'maint flush symbol-cache'.
	(Maintenance Commands): Document 'maint flush register-cache'.

gdb/testsuite/ChangeLog:

	* gdb.base/c-linkage-name.exp: Update to use new 'maint flush ...'
	commands.
	* gdb.base/killed-outside.exp: Likewise.
	* gdb.opt/inline-bt.exp: Likewise.
	* gdb.perf/gmonster-null-lookup.py: Likewise.
	* gdb.perf/gmonster-print-cerr.py: Likewise.
	* gdb.perf/gmonster-ptype-string.py: Likewise.
	* gdb.python/py-unwind.exp: Likewise.
2020-12-13 12:36:15 +00:00
Bernd Edlinger
ab954e4a53 Fix building gdb release from tar file without makeinfo
Add GDBvn.texi and version.subst to the release tar file,
so the gdb.info does not need makeinfo.

This avoids the need for makeinfo to be available.

2020-12-04  Bernd Edlinger  <bernd.edlinger@hotmail.de>

	* Makefile.in: Delete GDBvn.texi and version.subst only in
	the maintainer-clean target.
2020-12-04 16:34:55 +01:00
Hannes Domani
9f1212394f Fix Value.format_string docu for static members argument
The argument is called static_members, not static_fields.

gdb/doc/ChangeLog:

2020-11-29  Hannes Domani  <ssbssa@yahoo.de>

	PR python/26974
	* python.texi: Fix docu for static members argument.
2020-11-29 19:07:30 +01:00
Andrew Burgess
a5c641b57b gdb/fortran: Add support for Fortran array slices at the GDB prompt
This commit brings array slice support to GDB.

WARNING: This patch contains a rather big hack which is limited to
Fortran arrays, this can be seen in gdbtypes.c and f-lang.c.  More
details on this below.

This patch rewrites two areas of GDB's Fortran support, the code to
extract an array slice, and the code to print an array.

After this commit a user can, from the GDB prompt, ask for a slice of
a Fortran array and should get the correct result back.  Slices can
(optionally) have the lower bound, upper bound, and a stride
specified.  Slices can also have a negative stride.

Fortran has the concept of repacking array slices.  Within a compiled
Fortran program if a user passes a non-contiguous array slice to a
function then the compiler may have to repack the slice, this involves
copying the elements of the slice to a new area of memory before the
call, and copying the elements back to the original array after the
call.  Whether repacking occurs will depend on which version of
Fortran is being used, and what type of function is being called.

This commit adds support for both packed, and unpacked array slicing,
with the default being unpacked.

With an unpacked array slice, when the user asks for a slice of an
array GDB creates a new type that accurately describes where the
elements of the slice can be found within the original array, a
value of this type is then returned to the user.  The address of an
element within the slice will be equal to the address of an element
within the original array.

A user can choose to select packed array slices instead using:

  (gdb) set fortran repack-array-slices on|off
  (gdb) show fortran repack-array-slices

With packed array slices GDB creates a new type that reflects how the
elements of the slice would look if they were laid out in contiguous
memory, allocates a value of this type, and then fetches the elements
from the original array and places then into the contents buffer of
the new value.

One benefit of using packed slices over unpacked slices is the memory
usage, taking a small slice of N elements from a large array will
require (in GDB) N * ELEMENT_SIZE bytes of memory, while an unpacked
array will also include all of the "padding" between the
non-contiguous elements.  There are new tests added that highlight
this difference.

There is also a new debugging flag added with this commit that
introduces these commands:

  (gdb) set debug fortran-array-slicing on|off
  (gdb) show debug fortran-array-slicing

This prints information about how the array slices are being built.

As both the repacking, and the array printing requires GDB to walk
through a multi-dimensional Fortran array visiting each element, this
commit adds the file f-array-walk.h, which introduces some
infrastructure to support this process.  This means the array printing
code in f-valprint.c is significantly reduced.

The only slight issue with this commit is the "rather big hack" that I
mentioned above.  This hack allows us to handle one specific case,
array slices with negative strides.  This is something that I don't
believe the current GDB value contents model will allow us to
correctly handle, and rather than rewrite the value contents code
right now, I'm hoping to slip this hack in as a work around.

The problem is that, as I see it, the current value contents model
assumes that an object base address will be the lowest address within
that object, and that the contents of the object start at this base
address and occupy the TYPE_LENGTH bytes after that.

( We do have the embedded_offset, which is used for C++ sub-classes,
such that an object can start at some offset from the content buffer,
however, the assumption that the object then occupies the next
TYPE_LENGTH bytes is still true within GDB. )

The problem is that Fortran arrays with a negative stride don't follow
this pattern.  In this case the base address of the object points to
the element with the highest address, the contents of the array then
start at some offset _before_ the base address, and proceed for one
element _past_ the base address.

As the stride for such an array would be negative then, in theory the
TYPE_LENGTH for this type would also be negative.  However, in many
places a value in GDB will degrade to a pointer + length, and the
length almost always comes from the TYPE_LENGTH.

It is my belief that in order to correctly model this case the value
content handling of GDB will need to be reworked to split apart the
value's content buffer (which is a block of memory with a length), and
the object's in memory base address and length, which could be
negative.

Things are further complicated because arrays with negative strides
like this are always dynamic types.  When a value has a dynamic type
and its base address needs resolving we actually store the address of
the object within the resolved dynamic type, not within the value
object itself.

In short I don't currently see an easy path to cleanly support this
situation within GDB.  And so I believe that leaves two options,
either add a work around, or catch cases where the user tries to make
use of a negative stride, or access an array with a negative stride,
and throw an error.

This patch currently goes with adding a work around, which is that
when we resolve a dynamic Fortran array type, if the stride is
negative, then we adjust the base address to point to the lowest
address required by the array.  The printing and slicing code is aware
of this adjustment and will correctly slice and print Fortran arrays.

Where this hack will show through to the user is if they ask for the
address of an array in their program with a negative array stride, the
address they get from GDB will not match the address that would be
computed within the Fortran program.

gdb/ChangeLog:

	* Makefile.in (HFILES_NO_SRCDIR): Add f-array-walker.h.
	* NEWS: Mention new options.
	* f-array-walker.h: New file.
	* f-lang.c: Include 'gdbcmd.h' and 'f-array-walker.h'.
	(repack_array_slices): New static global.
	(show_repack_array_slices): New function.
	(fortran_array_slicing_debug): New static global.
	(show_fortran_array_slicing_debug): New function.
	(value_f90_subarray): Delete.
	(skip_undetermined_arglist): Delete.
	(class fortran_array_repacker_base_impl): New class.
	(class fortran_lazy_array_repacker_impl): New class.
	(class fortran_array_repacker_impl): New class.
	(fortran_value_subarray): Complete rewrite.
	(set_fortran_list): New static global.
	(show_fortran_list): Likewise.
	(_initialize_f_language): Register new commands.
	(fortran_adjust_dynamic_array_base_address_hack): New function.
	* f-lang.h (fortran_adjust_dynamic_array_base_address_hack):
	Declare.
	* f-valprint.c: Include 'f-array-walker.h'.
	(class fortran_array_printer_impl): New class.
	(f77_print_array_1): Delete.
	(f77_print_array): Delete.
	(fortran_print_array): New.
	(f_value_print_inner): Update to call fortran_print_array.
	* gdbtypes.c: Include 'f-lang.h'.
	(resolve_dynamic_type_internal): Call
	fortran_adjust_dynamic_array_base_address_hack.

gdb/testsuite/ChangeLog:

        * gdb.fortran/array-slices-bad.exp: New file.
        * gdb.fortran/array-slices-bad.f90: New file.
        * gdb.fortran/array-slices-sub-slices.exp: New file.
        * gdb.fortran/array-slices-sub-slices.f90: New file.
        * gdb.fortran/array-slices.exp: Rewrite tests.
        * gdb.fortran/array-slices.f90: Rewrite tests.
        * gdb.fortran/vla-sizeof.exp: Correct expected results.

gdb/doc/ChangeLog:

        * gdb.texinfo (Debugging Output): Document 'set/show debug
        fortran-array-slicing'.
        (Special Fortran Commands): Document 'set/show fortran
        repack-array-slices'.
2020-11-19 11:23:23 +00:00
Andrew Burgess
ab33b15255 gdb: add an option flag to 'maint print c-tdesc'
GDB has two approaches to generating the target descriptions found in
gdb/features/, the whole description approach, where the XML file
contains a complete target description which is then used to generate
a single C file that builds that target description.  Or, the split
feature approach, where the XML files contain a single target feature,
each feature results in a single C file to create that one feature,
and then a manually written C file is used to build a complete target
description from individual features.

There's a Makefile, gdb/features/Makefile, which is responsible for
managing the regeneration of the C files from the XML files.

However, some of the logic that selects between the whole description
approach, or the split feature approach, is actually hard-coded into
GDB, inside target-descriptions.c:maint_print_c_tdesc_cmd we check the
path to the incoming XML file and use this to choose which type of C
file we should generate.

This commit removes this hard coding from GDB, and makes the Makefile
entirely responsible for choosing the approach.  This makes sense as
the Makefile already has the XML files partitioned based on which
approach they should use.

In order to allow this change the 'maint print c-tdesc' command is
given a new command option '-single-feature', which tells GDB which
type of C file should be created.  The makefile now supplies this flag
to GDB.

This did reveal a bug in features/Makefile, the rx.xml file was in the
wrong list, this didn't matter previously as the actual choice of
which approach to use was done in GDB.  Now the Makefile decides, so
placing each XML file in the correct list is critical.

Tested this by doing 'make GDB=/path/to/gdb clean-cfiles cfiles' to
regenerate all the C files from their XML source.  There are no
changes after this commit.

gdb/ChangeLog:

	* features/Makefile (XMLTOC): Add rx.xml.
	(FEATURE_XMLFILES): Remove rx.xml.
	(FEATURE_CFILES rule): Pass '-single-feature' flag.
	* features/rx.c: Regenerate.
	* features/rx.xml: Wrap in `target` tags, and reindent.
	* target-descriptions.c (struct maint_print_c_tdesc_options): New
	structure.
	(maint_print_c_tdesc_opt_def): New typedef.
	(maint_print_c_tdesc_opt_defs): New static global.
	(make_maint_print_c_tdesc_options_def_group): New function.
	(maint_print_c_tdesc_cmd): Make use of command line flags, only
	print single feature C file for target descriptions containing a
	single feature.
	(maint_print_c_tdesc_cmd_completer): New function.
	(_initialize_target_descriptions): Update call to register command
	completer, and include command line flag in help text.

gdb/doc/ChangeLog:

	* gdb.texinfo (Maintenance Commands): Update description of 'maint
	print c-tdesc'.
2020-11-12 09:44:00 +00:00
Andrew Burgess
64aaad6349 gdb: use get_standard_config_dir when looking for .gdbinit
This commit effectively changes the default location of the .gdbinit
file, while maintaining backward compatibility.

For non Apple hosts the .gdbinit file will now be looked for in the
following locations:

  $XDG_CONFIG_HOME/gdb/gdbinit
  $HOME/.config/gdb/gdbinit
  $HOME/.gdbinit

On Apple hosts the search order is instead:

  $HOME/Library/Preferences/gdb/gdbinit
  $HOME/.gdbinit

I've performed an extensive rewrite of the documentation, moving all
information about initialization files and where to find them into a
new @node, text from other areas has been moved into this one
location, and other areas cross-reference to this new @node as much as
possible.

gdb/ChangeLog:

	* NEWS: Mention changes to config file search path.
	* main.c

gdb/doc/ChangeLog:

	* gdb.texinfo (Mode Options): Descriptions of initialization files
	has been moved to 'Initialization Files'.
	(Startup): Likewise.
	(Initialization Files): New node.
	(gdb man): Update to mention alternative file paths.
	(gdbinit man): Likewise.
2020-11-02 17:42:11 +00:00
Tankut Baris Aktemur
733d554a46 gdb/breakpoint: add flags to 'condition' and 'break' commands to force condition
The previous patch made it possible to define a condition if it's
valid at some locations.  If the condition is invalid at all of the
locations, it's rejected.  However, there may be cases where the user
knows the condition *will* be valid at a location in the future,
e.g. due to a shared library load.

To make it possible that such condition can be defined, this patch
adds an optional '-force' flag to the 'condition' command, and,
respectively, a '-force-condition' flag to the 'break'command.  When
the force flag is passed, the condition is not rejected even when it
is invalid for all the current locations (note that all the locations
would be internally disabled in this case).

For instance:

  (gdb) break test.c:5
  Breakpoint 1 at 0x1155: file test.c, line 5.
  (gdb) cond 1 foo == 42
  No symbol "foo" in current context.

Defining the condition was not possible because 'foo' is not
available.  The user can override this behavior with the '-force'
flag:

  (gdb) cond -force 1 foo == 42
  warning: failed to validate condition at location 1.1, disabling:
    No symbol "foo" in current context.
  (gdb) info breakpoints
  Num     Type           Disp Enb Address            What
  1       breakpoint     keep y   <MULTIPLE>
          stop only if foo == 42
  1.1                         N   0x0000000000001155 in main at test.c:5

Now the condition is accepted, but the location is automatically
disabled.  If a future location has a context in which 'foo' is
available, that location would be enabled.

For the 'break' command, -force-condition has the same result:

  (gdb) break test.c:5 -force-condition if foo == 42
  warning: failed to validate condition at location 0x1169, disabling:
    No symbol "foo" in current context.
  Breakpoint 1 at 0x1169: file test.c, line 5.

gdb/ChangeLog:
2020-10-27  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

	* breakpoint.h (set_breakpoint_condition): Add a new bool parameter.
	* breakpoint.c: Update the help text of the 'condition' and 'break'
	commands.
	(set_breakpoint_condition): Take a new bool parameter
	to control whether condition definition should be forced even when
	the condition expression is invalid in all of the current locations.
	(condition_command): Update the call to 'set_breakpoint_condition'.
	(find_condition_and_thread): Take the "-force-condition" flag into
	account.
        * linespec.c (linespec_keywords): Add "-force-condition" as an
	element.
        (FORCE_KEYWORD_INDEX): New #define.
        (linespec_lexer_lex_keyword): Update to consider "-force-condition"
	as a keyword.
	* ada-lang.c (create_ada_exception_catchpoint): Ditto.
	* guile/scm-breakpoint.c (gdbscm_set_breakpoint_condition_x): Ditto.
	* python/py-breakpoint.c (bppy_set_condition): Ditto.
	* NEWS: Mention the changes to the 'break' and 'condition' commands.

gdb/testsuite/ChangeLog:
2020-10-27  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

	* gdb.base/condbreak-multi-context.exp: Expand to test forcing
	the condition.
	* gdb.linespec/cpcompletion.exp: Update to consider the
	'-force-condition' keyword.
	* gdb.linespec/explicit.exp: Ditto.
	* lib/completion-support.exp: Ditto.

gdb/doc/ChangeLog:
2020-10-27  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

	* gdb.texinfo (Set Breaks): Document the '-force-condition' flag
	of the 'break'command.
	* gdb.texinfo (Conditions): Document the '-force' flag of the
	'condition' command.
2020-10-27 11:00:57 +01:00
Tankut Baris Aktemur
b5fa468fef gdb/breakpoint: disable a bp location if condition is invalid at that location
Currently, for a conditional breakpoint, GDB checks if the condition
can be evaluated in the context of the first symtab and line (SAL).
In case of an error, defining the conditional breakpoint is aborted.
This prevents having a conditional breakpoint whose condition may
actually be meaningful for some of the location contexts.  This patch
makes it possible to define conditional BPs by checking all location
contexts.  If the condition is meaningful for even one context, the
breakpoint is defined.  The locations for which the condition gives
errors are disabled.

The bp_location struct is introduced a new field, 'disabled_by_cond'.
This field denotes whether the location is disabled automatically
because the condition was non-evaluatable.  Disabled-by-cond locations
cannot be enabled by the user.  But locations that are not
disabled-by-cond can be enabled/disabled by the user manually as
before.

For a concrete example, consider 3 contexts of a function 'func'.

  class Base
  {
  public:
    int b = 20;

    void func () {}
  };

  class A : public Base
  {
  public:
    int a = 10;

    void func () {}
  };

  class C : public Base
  {
  public:
    int c = 30;

    void func () {}
  };

Note that

* the variable 'a' is defined only in the context of A::func.
* the variable 'c' is defined only in the context of C::func.
* the variable 'b' is defined in all the three contexts.

With the existing GDB, it's not possible to define a conditional
breakpoint at 'func' if the condition refers to 'a' or 'c':

  (gdb) break func if a == 10
  No symbol "a" in current context.
  (gdb) break func if c == 30
  No symbol "c" in current context.
  (gdb) info breakpoints
  No breakpoints or watchpoints.

With this patch, it becomes possible:

  (gdb) break func if a == 10
  warning: failed to validate condition at location 1, disabling:
    No symbol "a" in current context.
  warning: failed to validate condition at location 3, disabling:
    No symbol "a" in current context.
  Breakpoint 1 at 0x11b6: func. (3 locations)
  (gdb) break func if c == 30
  Note: breakpoint 1 also set at pc 0x11ce.
  Note: breakpoint 1 also set at pc 0x11c2.
  Note: breakpoint 1 also set at pc 0x11b6.
  warning: failed to validate condition at location 1, disabling:
    No symbol "c" in current context.
  warning: failed to validate condition at location 2, disabling:
    No symbol "c" in current context.
  Breakpoint 2 at 0x11b6: func. (3 locations)
  (gdb) info breakpoints
  Num     Type           Disp Enb Address            What
  1       breakpoint     keep y   <MULTIPLE>
          stop only if a == 10
  1.1                         N*  0x00000000000011b6 in Base::func() at condbreak-multi-context.cc:23
  1.2                         y   0x00000000000011c2 in A::func() at condbreak-multi-context.cc:31
  1.3                         N*  0x00000000000011ce in C::func() at condbreak-multi-context.cc:39
  2       breakpoint     keep y   <MULTIPLE>
          stop only if c == 30
  2.1                         N*  0x00000000000011b6 in Base::func() at condbreak-multi-context.cc:23
  2.2                         N*  0x00000000000011c2 in A::func() at condbreak-multi-context.cc:31
  2.3                         y   0x00000000000011ce in C::func() at condbreak-multi-context.cc:39
  (*): Breakpoint condition is invalid at this location.

Here, uppercase 'N' denotes that the location is disabled because of
the invalid condition, as mentioned with a footnote in the legend of
the table.  Locations that are disabled by the user are still denoted
with lowercase 'n'.  Executing the code hits the breakpoints 1.2 and
2.3 as expected.

Defining a condition on an unconditional breakpoint gives the same
behavior above:

  (gdb) break func
  Breakpoint 1 at 0x11b6: func. (3 locations)
  (gdb) cond 1 a == 10
  warning: failed to validate condition at location 1.1, disabling:
    No symbol "a" in current context.
  warning: failed to validate condition at location 1.3, disabling:
    No symbol "a" in current context.
  (gdb) info breakpoints
  Num     Type           Disp Enb Address            What
  1       breakpoint     keep y   <MULTIPLE>
          stop only if a == 10
  1.1                         N*  0x00000000000011b6 in Base::func() at condbreak-multi-context.cc:23
  1.2                         y   0x00000000000011c2 in A::func() at condbreak-multi-context.cc:31
  1.3                         N*  0x00000000000011ce in C::func() at condbreak-multi-context.cc:39
  (*): Breakpoint condition is invalid at this location.

Locations that are disabled because of a condition cannot be enabled
by the user:

  ...
  (gdb) enable 1.1
  Breakpoint 1's condition is invalid at location 1, cannot enable.

Resetting the condition enables the locations back:

  ...
  (gdb) cond 1
  Breakpoint 1's condition is now valid at location 1, enabling.
  Breakpoint 1's condition is now valid at location 3, enabling.
  Breakpoint 1 now unconditional.
  (gdb) info breakpoints
  Num     Type           Disp Enb Address            What
  1       breakpoint     keep y   <MULTIPLE>
  1.1                         y   0x00000000000011b6 in Base::func() at condbreak-multi-context.cc:23
  1.2                         y   0x00000000000011c2 in A::func() at condbreak-multi-context.cc:31
  1.3                         y   0x00000000000011ce in C::func() at condbreak-multi-context.cc:39

If a location is disabled by the user, a condition can still be defined
but the location will remain disabled even if the condition is meaningful
for the disabled location:

  ...
  (gdb) disable 1.2
  (gdb) cond 1 a == 10
  warning: failed to validate condition at location 1.1, disabling:
    No symbol "a" in current context.
  warning: failed to validate condition at location 1.3, disabling:
    No symbol "a" in current context.
  (gdb) info breakpoints
  Num     Type           Disp Enb Address            What
  1       breakpoint     keep y   <MULTIPLE>
          stop only if a == 10
  1.1                         N*  0x00000000000011b6 in Base::func() at condbreak-multi-context.cc:23
  1.2                         n   0x00000000000011c2 in A::func() at condbreak-multi-context.cc:31
  1.3                         N*  0x00000000000011ce in C::func() at condbreak-multi-context.cc:39
  (*): Breakpoint condition is invalid at this location.

The condition of a breakpoint can be changed.  Locations'
enable/disable states are updated accordingly.

  ...
  (gdb) cond 1 c == 30
  warning: failed to validate condition at location 1.1, disabling:
    No symbol "c" in current context.
  Breakpoint 1's condition is now valid at location 3, enabling.
  (gdb) info breakpoints
  Num     Type           Disp Enb Address            What
  1       breakpoint     keep y   <MULTIPLE>
          stop only if c == 30
  1.1                         N*  0x00000000000011b6 in Base::func() at condbreak-multi-context.cc:23
  1.2                         N*  0x00000000000011c2 in A::func() at condbreak-multi-context.cc:31
  1.3                         y   0x00000000000011ce in C::func() at condbreak-multi-context.cc:39
  (*): Breakpoint condition is invalid at this location.

  (gdb) cond 1 b == 20
  Breakpoint 1's condition is now valid at location 1, enabling.
  (gdb) info breakpoints
  Num     Type           Disp Enb Address            What
  1       breakpoint     keep y   <MULTIPLE>
          stop only if b == 20
  1.1                         y   0x00000000000011b6 in Base::func() at condbreak-multi-context.cc:23
  1.2                         n   0x00000000000011c2 in A::func() at condbreak-multi-context.cc:31
  1.3                         y   0x00000000000011ce in C::func() at condbreak-multi-context.cc:39
  # Note that location 1.2 was disabled by the user previously.

If the condition expression is bad for all the locations, it will be
rejected.

  (gdb) cond 1 garbage
  No symbol "garbage" in current context.

For conditions that are invalid or valid for all the locations of a
breakpoint, the existing behavior is preserved.

Regression-tested on X86_64 Linux.

gdb/ChangeLog:
2020-10-27  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

	* breakpoint.h (class bp_location) <disabled_by_cond>: New field.
	* breakpoint.c (set_breakpoint_location_condition): New function.
	(set_breakpoint_condition): Disable a breakpoint location if parsing
	the condition string gives an error.
	(should_be_inserted): Update to consider the 'disabled_by_cond' field.
	(build_target_condition_list): Ditto.
	(build_target_command_list): Ditto.
	(build_bpstat_chain): Ditto.
	(print_one_breakpoint_location): Ditto.
	(print_one_breakpoint): Ditto.
	(breakpoint_1): Ditto.
	(bp_location::bp_location): Ditto.
	(locations_are_equal): Ditto.
	(update_breakpoint_locations): Ditto.
	(enable_disable_bp_num_loc): Ditto.
	(init_breakpoint_sal): Use set_breakpoint_location_condition.
	(find_condition_and_thread_for_sals): New static function.
	(create_breakpoint): Call find_condition_and_thread_for_sals.
	(location_to_sals): Call find_condition_and_thread_for_sals instead
	of find_condition_and_thread.

gdb/testsuite/ChangeLog:
2020-10-27  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

	* gdb.base/condbreak-multi-context.cc: New file.
	* gdb.base/condbreak-multi-context.exp: New file.

gdb/doc/ChangeLog:
2020-10-27  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

	* gdb.texinfo (Set Breaks): Document disabling of breakpoint
	locations for which the breakpoint condition is invalid.
2020-10-27 10:58:45 +01:00
Michael Forney
4b136f6f9a gdb: Fix installation of gcore.1 on some platforms
gcore is installed on NetBSD, FreeBSD, Solaris (HAVE_NATIVE_GCORE_HOST=1)
and Linux (HAVE_NATIVE_GCORE_TARGET=1). However, even though gcore.1
is installed conditional on those variables, HAVE_NATIVE_GCORE_HOST
was missing from gdb/doc/Makefile.in, so manual installation was
skipped on NetBSD, FreeBSD, and Solaris.

gdb/doc/ChangeLog:
2020-10-06  Michael Forney  <mforney@mforney.org>

        * Makefile.in (HAVE_NATIVE_GCORE_HOST): Add for gcore.1
        install condition.

Change-Id: I17c3ce2ecdfb806ece17f05ba78356b25ffa865e
2020-10-06 22:31:13 -04:00
Simon Marchi
8d378f27ba gdb: add doc for "set/show debug event-loop"
I forgot that "set/show debug" commands are listed in the doc and in
NEWS, so here they are.

gdb/doc/ChangeLog:

	* gdb.texinfo (Debugging Output): Add set/show debug event-loop.

gdb/ChangeLog:

	* NEWS: Mention set/show debug event-loop.

Change-Id: If30b80177049006578280a06912ee2b97bd03a75
2020-10-04 12:41:56 -04:00
Simon Marchi
7b085b1c1c gdb/doc: space out list entries, fix one type
I want to add an item to this list, but it's so packed I have trouble
finding where one item ends and the next starts.  Add a few empty lines
to make it a bit more readable.

Doing this, I also noticed that an "aix-thread" should in fact be
"aix-solib".

gdb/doc/ChangeLog:

	* gdb.texinfo (Debugging Output): Add empty lines, fix typo.

Change-Id: I7ef211f9e3988cfbc6ec94124d23a5f2412f3c82
2020-10-04 12:36:02 -04:00
Pedro Alves
6791b1172a Add MI "-break-insert --qualified"
Currently -break-insert always creates a wildmatching breakpoint, and
there's no way to ask for a fullname match.  To address that, this
patch adds the equivalent of "break -qualified" to MI:

  "-break-insert --qualified".

For the testcase, curiously, it doesn't look like we have _any_
testcase that tests a breakpoint with multiple locations, and, the
existing mi_create_breakpoint / mi_make_breakpoint procedures are only
good for breakpoints with a single location.  This patch thus adds a
few new companion routines to mi-support.exp for breakpoints with
multiple locations: mi_create_breakpoint_multi,
mi_make_breakpoint_loc, mi_make_breakpoint_multi.

gdb/ChangeLog:

	* NEWS: Document "-break-insert --qualified".
	* mi/mi-cmd-break.c (mi_cmd_break_insert_1): Handle "--qualified".

gdb/doc/ChangeLog:

	* gdb.texinfo (GDB/MI Breakpoint Commands): Document
	"-break-insert --qualified" and "-dprintf-insert --qualified".

gdb/testsuite/ChangeLog:

	* gdb.mi/mi-break-qualified.cc: New file.
	* gdb.mi/mi-break-qualified.exp: New file.
	* lib/mi-support.exp (mi_create_breakpoint_multi)
	(mi_make_breakpoint_loc, mi_make_breakpoint_multi): New
	procedures.
	(mi_create_breakpoint_1): New, factored out from
	mi_create_breakpoint.
2020-09-13 18:02:19 +01:00
Shahab Vahedi
fdd8731bd1 arc: Add hardware loop detection
For ARC there are registers that are not part of a required set in XML
target descriptions by default, but are almost always present on ARC
targets and are universally exposed by the ptrace interface.  Hardware
loop registers being one of them.

LP_START and LP_END auxiliary registers are hardware loop start and end.
Formally, they are optional, but it is hard to find an ARC configuration
that doesn't have them.  They are always present in processors that can
run GNU/Linux.  GDB needs to know about those registers to implement
proper software single stepping, since they affect  what instruction
will be next.

This commit adds the code to check for the existance of "lp_start" and
"lp_end" in XML target descriptions. If they exist, then the function
reports that the target supports hardware loops.

gdb/ChangeLog:

	* arc-tdep.c (arc_check_for_hardware_loop): New.
	* arc-tdep.h (gdbarch_tdep): New field has_hw_loops.

gdb/doc/ChangeLog:

	* gdb.texinfo (Synopsys ARC): Document LP_START, LP_END and BTA.
2020-08-25 17:31:29 +02:00
Shahab Vahedi
995d3a197d arc: Add ARCv2 XML target along with refactoring
A few changes have been made to make the register support simpler,
more flexible and extendible.  The trigger for most of these changes
are the remarks [1] made earlier for v2 of this patch.  The noticeable
improvements are:

- The arc XML target features are placed under gdb/features/arc
- There are two cores (based on ISA) and one auxiliary feature:
  v1-core: ARC600, ARC601, ARC700
  v2-core: ARC EM, ARC HS
  aux: common in both
- The XML target features represent a minimalistic sane set of
  registers irrespective of application (baremetal or linux).
- A concept of "feature" class has been introduced in the code.
  The "feature" object is constructed from BFD and GDBARCH data.
  It contains necessary information (ISA and register size) to
  determine which XML target feature to use.
- A new structure (ARC_REGISTER_FEATURE) is added that allows
  providing index, names, and the necessity of registers. This
  simplifies the sanity checks and future extendibility.
- Documnetation has been updated to reflect ARC features better.
- Although the feature names has changed, there still exists
  backward compatibility with older names through
  find_obsolete_[core,aux]_names() functions.

The last two points were inspired from RiscV port.

[1]
https://sourceware.org/pipermail/gdb-patches/2020-May/168511.html

gdb/ChangeLog:

	* arch/arc.h
	  (arc_gdbarch_features): New class to stir the selection of target XML.
	  (arc_create_target_description): Use FEATURES to choose XML target.
	  (arc_lookup_target_description): Use arc_create_target_description
	  to create _new_ target descriptions or return the already created
	  ones if the FEATURES is the same.
	* arch/arc.c: Implementation of prototypes described above.
	* gdb/arc-tdep.h (arc_regnum enum): Add more registers.
	  (arc_gdbarch_features_init): Initialize the FEATURES struct.
	* arc-tdep.c (*_feature_name): Make feature names consistent.
	  (arc_register_feature): A new struct to hold information about
	  registers of a particular target/feature.
	  (arc_check_tdesc_feature): Check if XML provides registers in
	  compliance with ARC_REGISTER_FEATURE structs.
	  (arc_update_acc_reg_names): Add aliases for r58 and r59.
	  (determine_*_reg_feature_set): Which feature name to look for.
	  (arc_gdbarch_features_init): Given MACH and ABFD, initialize FEATURES.
	  (mach_type_to_arc_isa): Convert from a set of binutils machine types
	  to expected ISA enums to be used in arc_gdbarch_features structs.
	* features/Makefile (FEATURE_XMLFILES): Add new files.
	* gdb/features/arc/v1-aux.c: New file.
	* gdb/features/arc/v1-aux.xml: Likewise.
	* gdb/features/arc/v1-core.c: Likewise.
	* gdb/features/arc/v1-core.xml: Likewise.
	* gdb/features/arc/v2-aux.c: Likewise.
	* gdb/features/arc/v2-aux.xml: Likewise.
	* gdb/features/arc/v2-core.c: Likewise.
	* gdb/features/arc/v2-core.xml: Likewise.
	* NEWS (Changes since GDB 9): Announce obsolence of old feature names.

gdb/doc/ChangeLog:

	* gdb.texinfo (Synopsys ARC): Update the documentation for ARC
	Features.

gdb/testsuite/ChangeLog:

	* gdb.arch/arc-tdesc-cpu.xml: Use new feature names.
2020-08-25 17:31:26 +02:00
Tom Tromey
e09eef98a6 Update Ravenscar documentation
This documents some recent Ravenscar changes, and further documents
the known limitation where stepping through the runtime initialization
code does not work properly.

gdb/doc/ChangeLog
2020-08-07  Tom Tromey  <tromey@adacore.com>

	* gdb.texinfo (Ravenscar Profile): Add examples.
	Document runtime initialization limitation.
2020-08-07 10:26:46 -06:00
Jose E. Marchesi
39791af2a2 gdb: support for eBPF
This patch adds basic support for the eBPF target: tdep and build
machinery.  The accompanying simulator is introduced in subsequent
patches.

gdb/ChangeLog:

2020-08-04  Weimin Pan <weimin.pan@oracle.com>
	    Jose E. Marchesi  <jose.marchesi@oracle.com>

	* configure.tgt: Add entry for bpf-*-*.
	* Makefile.in (ALL_TARGET_OBS): Add bpf-tdep.o
	(ALLDEPFILES): Add bpf-tdep.c.
	* bpf-tdep.c: New file.
	* MAINTAINERS: Add bpf target and maintainer.

gdb/doc/ChangeLog:

2020-08-04  Jose E. Marchesi  <jose.marchesi@oracle.com>

	* gdb.texinfo (Contributors): Add information for the eBPF
	support.
	(BPF): New section.
2020-08-04 18:01:55 +02:00
Andrew Burgess
43d5901ded gdb/python: make more use of RegisterDescriptors
This commit unifies all of the Python register lookup code (used by
Frame.read_register, PendingFrame.read_register, and
gdb.UnwindInfo.add_saved_register), and adds support for using a
gdb.RegisterDescriptor for register lookup.

Currently the register unwind code (PendingFrame and UnwindInfo) allow
registers to be looked up either by name, or by GDB's internal
number.  I suspect the number was added for performance reasons, when
unwinding we don't want to repeatedly map from name to number for
every unwind.  However, this kind-of sucks, it means Python scripts
could include GDB's internal register numbers, and if we ever change
this numbering in the future users scripts will break in unexpected
ways.

Meanwhile, the Frame.read_register method only supports accessing
registers using a string, the register name.

This commit unifies all of the register to register-number lookup code
in our Python bindings, and adds a third choice into the mix, the use
of gdb.RegisterDescriptor.

The register descriptors can be looked up by name, but once looked up,
they contain GDB's register number, and so provide all of the
performance benefits of using a register number directly.  However, as
they are looked up by name we are no longer tightly binding the Python
API to GDB's internal numbering scheme.

As we may already have scripts in the wild that are using the register
numbers directly I have kept support for this in the API, but I have
listed this method last in the manual, and I have tried to stress that
this is NOT a good method to use and that users should use either a
string or register descriptor approach.

After this commit all existing Python code should function as before,
but users now have new options for how to identify registers.

gdb/ChangeLog:

	* python/py-frame.c: Remove 'user-regs.h' include.
	(frapy_read_register): Rewrite to make use of
	gdbpy_parse_register_id.
	* python/py-registers.c (gdbpy_parse_register_id): New function,
	moved here from python/py-unwind.c.  Updated the return type, and
	also accepts register descriptor objects.
	* python/py-unwind.c: Remove 'user-regs.h' include.
	(pyuw_parse_register_id): Moved to python/py-registers.c.
	(unwind_infopy_add_saved_register): Update to use
	gdbpy_parse_register_id.
	(pending_framepy_read_register): Likewise.
	* python/python-internal.h (gdbpy_parse_register_id): Declare.

gdb/testsuite/ChangeLog:

	* gdb.python/py-unwind.py: Update to make use of a register
	descriptor.

gdb/doc/ChangeLog:

	* python.texi (Unwinding Frames in Python): Update descriptions
	for PendingFrame.read_register and
	gdb.UnwindInfo.add_saved_register.
	(Frames In Python): Update description of Frame.read_register.
2020-07-28 10:27:54 +01:00
Andrew Burgess
14fa8fb307 gdb: Add a find method for RegisterDescriptorIterator
Adds a new method 'find' to the gdb.RegisterDescriptorIterator class,
this allows gdb.RegisterDescriptor objects to be looked up directly by
register name rather than having to iterate over all registers.

This will be of use for a later commit.

I've documented the new function in the manual, but I don't think a
NEWS entry is required here, as, since the last release, the whole
register descriptor mechanism is new, and is already mentioned in the
NEWS file.

gdb/ChangeLog:

	* python/py-registers.c: Add 'user-regs.h' include.
	(register_descriptor_iter_find): New function.
	(register_descriptor_iterator_object_methods): New static global
	methods array.
	(register_descriptor_iterator_object_type): Add pointer to methods
	array.

gdb/testsuite/ChangeLog:

	* gdb.python/py-arch-reg-names.exp: Add additional tests.

gdb/doc/ChangeLog:

	* python.texi (Registers In Python): Document new find function.
2020-07-28 10:27:53 +01:00
Kevin Buettner
b089853a22 Add documentation for "maint print core-file-backed-mappings"
gdb/ChangeLog:

	* NEWS (New commands): Mention new command
	"maintenance print core-file-backed-mappings".

gdb/doc/ChangeLog:

	* gdb.texinfo (Maintenance Commands): Add documentation for
	new command "maintenance print core-file-backed-mappings".
2020-07-22 12:52:31 -07:00
Reuben Thomas
c9fe1b583c Correct an error in the remote protocol specification
The list of commands that a stub must implement was wrong.

gdb/ChangeLog:
2020-07-22  Reuben Thomas  <rrt@sc3d.org>

	* gdb.texinfo (Remote Protocol, Overview): Correct the description
	of which remote protocol commands are mandatory for a stub to
	implement.
2020-07-22 16:15:29 +01:00
Ludovic Courtès
ae5369e773 guile: Add support for Guile 3.0.
gdb/ChangeLog
2020-06-28  Ludovic Courtès  <ludo@gnu.org>

	* guile/scm-math.c (vlscm_integer_fits_p): Use 'uintmax_t'
	and 'intmax_t' instead of 'scm_t_uintmax' and 'scm_t_intmax',
	which are deprecated in Guile 3.0.
	* configure.ac (try_guile_versions): Add "guile-3.0".
	* configure (try_guile_versions): Regenerate.
	* NEWS: Update entry.

gdb/testsuite/ChangeLog
2020-06-28  Ludovic Courtès  <ludo@gnu.org>

	* gdb.guile/source2.scm: Add #f first argument to 'format'.
	* gdb.guile/types-module.exp: Remove "ERROR:" from
	regexps since Guile 3.0 no longer prints that.

gdb/doc/ChangeLog
2020-06-28  Ludovic Courtès  <ludo@gnu.org>

	* doc/guile.texi (Guile Introduction): Mention Guile 3.0.

Change-Id: Iff116c2e40f334e4e0ca4e759a097bfd23634679
2020-07-20 11:00:55 -04:00
Ludovic Courtès
68cf161c24 guile: Add support for Guile 2.2.
This primarily updates code that uses the I/O port API of Guile.

gdb/ChangeLog
2020-06-28  Ludovic Courtès  <ludo@gnu.org>
            Doug Evans  <dje@google.com>

	PR gdb/21104
	* guile/scm-ports.c (USING_GUILE_BEFORE_2_2): New macro.
	(ioscm_memory_port)[read_buf_size, write_buf_size]: Wrap in #if
	USING_GUILE_BEFORE_2_2.
	(stdio_port_desc, memory_port_desc) [!USING_GUILE_BEFORE_2_2]:
	Change type to 'scm_t_port_type *'.
	(natural_buffer_size) [!USING_GUILE_BEFORE_2_2]: New variable.
	(ioscm_open_port) [USING_GUILE_BEFORE_2_2]: Add 'stream'
	parameter and honor it.  Update callers.
	(ioscm_open_port) [!USING_GUILE_BEFORE_2_2]: New function.
	(ioscm_read_from_port, ioscm_write) [!USING_GUILE_BEFORE_2_2]: New
	functions.
	(ioscm_fill_input, ioscm_input_waiting, ioscm_flush): Wrap in #if
	USING_GUILE_BEFORE_2_2.
	(ioscm_init_gdb_stdio_port) [!USING_GUILE_BEFORE_2_2]: Use
	'ioscm_read_from_port'.  Call 'scm_set_port_read_wait_fd'.
	(ioscm_init_stdio_buffers) [!USING_GUILE_BEFORE_2_2]: New function.
	(gdbscm_stdio_port_p) [!USING_GUILE_BEFORE_2_2]: Use 'SCM_PORTP'
	and 'SCM_PORT_TYPE'.
	(gdbscm_memory_port_end_input, gdbscm_memory_port_seek)
	(ioscm_reinit_memory_port): Wrap in #if USING_GUILE_BEFORE_2_2.
	(gdbscm_memory_port_read, gdbscm_memory_port_write)
	(gdbscm_memory_port_seek, gdbscm_memory_port_close)
	[!USING_GUILE_BEFORE_2_2]: New functions.
	(gdbscm_memory_port_print): Remove use of 'SCM_PTOB_NAME'.
	(ioscm_init_memory_port_type) [!USING_GUILE_BEFORE_2_2]: Use
	'gdbscm_memory_port_read'.
	Wrap 'scm_set_port_end_input', 'scm_set_port_flush', and
	'scm_set_port_free' calls in #if USING_GUILE_BEFORE_2_2.
	(gdbscm_get_natural_buffer_sizes) [!USING_GUILE_BEFORE_2_2]: New
	function.
	(ioscm_init_memory_port): Remove.
	(ioscm_init_memory_port_stream): New function
	(ioscm_init_memory_port_buffers) [USING_GUILE_BEFORE_2_2]: New
	function.
	(gdbscm_memory_port_read_buffer_size) [!USING_GUILE_BEFORE_2_2]:
	Return scm_from_uint (0).
	(gdbscm_set_memory_port_read_buffer_size_x)
	[!USING_GUILE_BEFORE_2_2]: Call 'scm_setvbuf'.
	(gdbscm_memory_port_write_buffer_size) [!USING_GUILE_BEFORE_2_2]:
	Return scm_from_uint (0).
	(gdbscm_set_memory_port_write_buffer_size_x)
	[!USING_GUILE_BEFORE_2_2]: Call 'scm_setvbuf'.
	* configure.ac (try_guile_versions): Add "guile-2.2".
	* configure: Regenerate.
	* NEWS: Add entry.

gdb/testsuite/ChangeLog
2020-06-28  Ludovic Courtès  <ludo@gnu.org>

	* gdb.guile/scm-error.exp ("source $remote_guile_file_1"): Relax
	error regexp to match on Guile 2.2.

gdb/doc/ChangeLog
2020-06-28  Ludovic Courtès  <ludo@gnu.org>

	* guile.texi (Memory Ports in Guile): Mark
	'memory-port-read-buffer-size',
	'set-memory-port-read-buffer-size!',
	'memory-port-write-buffer-size',
	'set-memory-port-read-buffer-size!' as deprecated.
	* doc/guile.texi (Guile Introduction): Clarify which Guile
	versions are supported.

Change-Id: Ib119b10a2787446e0ae482a5e1b36d809c44bb31
2020-07-20 10:59:47 -04:00
Paul Carroll
ed788fee02 Fix frame-apply.html collision in GDB manual.
The addition of an anchor for the "frame apply" command was causing
the HTML documentation to include files named both "frame-apply.html"
and "Frame-Apply.html", which collide on case-insensitive file
systems.  This patch removes the redundant anchor and adjusts the two
xrefs to it.

2020-07-13 Paul Carroll <pcarroll@codesourcery.com>

	PR gdb/25716

	gdb/doc/
	* gdb.texinfo (Frame Apply): Remove anchor for 'frame
	apply' and adjust xrefs to it.
2020-07-13 12:31:05 -07:00
Philippe Waroquiers
0a278aa755 Fine tune exec-file-mismatch help and documentation.
It was deemed better to explicitly mention in help and doc that build IDs
are used for comparison, and that symbols are loaded when asking to
load the exec-file.

This is V2, fixing 2 typos and replacing 'If the user asks to load'
by 'If the user confirms loading', as suggested by Pedro.

gdb/ChangeLog
2020-07-11  Philippe Waroquiers  <philippe.waroquiers@skynet.be>

	* exec.c (_initialize_exec): Update exec-file-mismatch help.

gdb/doc/ChangeLog
2020-07-11  Philippe Waroquiers  <philippe.waroquiers@skynet.be>

	* gdb.texinfo (Attach): Update exec-file-mismatch doc.
2020-07-11 14:21:05 +02:00
Hannes Domani
6e2469ff7a Handle Windows drives in auto-load script paths
Fixes this testsuite fail on Windows:
FAIL: gdb.base/auto-load.exp: print $script_loaded

Converts the debugfile path from c:/dir/file to /c/dir/file, so it can be
appended to the auto-load path.

gdb/ChangeLog:

2020-07-08  Hannes Domani  <ssbssa@yahoo.de>

	* auto-load.c (auto_load_objfile_script_1): Convert drive part
	of debugfile path on Windows.

gdb/doc/ChangeLog:

2020-07-08  Hannes Domani  <ssbssa@yahoo.de>

	* gdb.texinfo: Document Windows drive conversion of
	'set auto-load scripts-directory'.
2020-07-08 20:50:43 +02:00
Andrew Burgess
64cb3757a9 gdb/python: New method to access list of register groups
Add a new method gdb.Architecture.register_groups which returns a new
object of type gdb.RegisterGroupsIterator.  This new iterator then
returns objects of type gdb.RegisterGroup.

Each gdb.RegisterGroup object just wraps a single reggroup pointer,
and (currently) has just one read-only property 'name' that is a
string, the name of the register group.

As with the previous commit (adding gdb.RegisterDescriptor) I made
gdb.RegisterGroup an object rather than just a string in case we want
to add additional properties in the future.

gdb/ChangeLog:

	* NEWS: Mention additions to Python API.
	* python/py-arch.c (archpy_register_groups): New function.
	(arch_object_methods): Add 'register_groups' method.
	* python/py-registers.c (reggroup_iterator_object): New struct.
	(reggroup_object): New struct.
	(gdbpy_new_reggroup): New function.
	(gdbpy_reggroup_to_string): New function.
	(gdbpy_reggroup_name): New function.
	(gdbpy_reggroup_iter): New function.
	(gdbpy_reggroup_iter_next): New function.
	(gdbpy_new_reggroup_iterator): New function
	(gdbpy_initialize_registers): Register new types.
	(reggroup_iterator_object_type): Define new Python type.
	(gdbpy_reggroup_getset): New static global.
	(reggroup_object_type): Define new Python type.
	* python/python-internal.h

gdb/testsuite/ChangeLog:

	* gdb.python/py-arch-reg-groups.exp: New file.

gdb/doc/ChangeLog:

	* gdb.texi (Registers): Add @anchor for 'info registers
	<reggroup>' command.
	* python.texi (Architectures In Python): Document new
	register_groups method.
	(Registers In Python): Document two new object types related to
	register groups.
2020-07-06 15:06:06 +01:00
Andrew Burgess
0f767f942b gdb/python: Add gdb.Architecture.registers method
This commit adds a new method gdb.Architecture.registers that returns
an object of the new type gdb.RegisterDescriptorIterator.  This
iterator returns objects of the new type gdb.RegisterDescriptor.

A RegisterDescriptor is not a way to read the value of a register,
this is already covered by Frame.read_register, a RegisterDescriptor
is simply a way to discover from Python, which registers are
available for a given architecture.

I did consider just returning a string, the name of each register,
instead of a RegisterDescriptor, however, I'm aware that it we don't
want to break the existing Python API in any way, so if I return just
a string now, but in the future we want more information about a
register then we would have to add a second API to get that
information.  By going straight to a descriptor object now, it is easy
to add additional properties in the future should we wish to.

Right now the only property of a register that a user can access is
the name of the register.

In future we might want to be able to ask the register about is
register groups, or its type.

gdb/ChangeLog:

	* Makefile.in (SUBDIR_PYTHON_SRCS): Add py-registers.c
	* python/py-arch.c (archpy_registers): New function.
	(arch_object_methods): Add 'registers' method.
	* python/py-registers.c: New file.
	* python/python-internal.h
	(gdbpy_new_register_descriptor_iterator): Declare.
	(gdbpy_initialize_registers): Declare.
	* python/python.c (do_start_initialization): Call
	gdbpy_initialize_registers.
	* NEWS: Mention additions to the Python API.

gdb/testsuite/ChangeLog:

	* gdb.python/py-arch-reg-names.exp: New file.

gdb/doc/ChangeLog:

	* python.texi (Python API): Add new section the menu.
	(Frames In Python): Add new @anchor.
	(Architectures In Python): Document new registers method.
	(Registers In Python): New section.
2020-07-06 15:06:06 +01:00
Andrew Burgess
87dbc77459 gdb/python: Add architecture method to gdb.PendingFrame
It could be useful to determine the architecture of a frame being
unwound during the frame unwind process, that is, before we have a
gdb.Frame, but when we only have a gdb.PendingFrame.

The PendingFrame already has a pointer to the gdbarch internally, this
commit just exposes an 'architecture' method to Python, and has this
return a gdb.Architecture object (list gdb.Frame.architecture does).

gdb/ChangeLog:

	* NEWS: Mention new Python API method.
	* python/py-unwind.c (pending_framepy_architecture): New function.
	(pending_frame_object_methods): Add architecture method.

gdb/testsuite/ChangeLog:

	* gdb.python/py-unwind.py (TestUnwinder::__call__): Add test for
	gdb.PendingFrame.architecture method.

gdb/doc/ChangeLog:

	* python.texi (Unwinding Frames in Python): Document
	PendingFrame.architecture method.
2020-07-06 15:06:05 +01:00
Eli Zaretskii
edf92af0fb Improve documentation of which shell is used by GDB's shell commands
gdb/doc/ChangeLog:

2020-06-26  Eli Zaretskii  <eliz@gnu.org>

	* gdb.texinfo (Shell Commands): More accurate description of use
	of $SHELL.  Reported by Sandra Loosemore <sandra@codesourcery.com>.
2020-06-26 09:51:45 +03:00
Andrew Burgess
caa7fd04f6 gdb: New maintenance command to print XML target description
This commit adds a new maintenance command that dumps the current
target description as an XML document.  This is a maintenance command
as I currently only see this being useful for GDB developers, or for
people debugging a new remote target.

By default the command will print whatever the current target
description is, whether this was delivered by the remote, loaded by
the user from a file, or if it is a built in target within GDB.

The command can also take an optional filename argument.  In this case
GDB loads a target description from the file, and then reprints it.
This could be useful for testing GDB's parsing of target descriptions,
or to check that GDB can successfully parse a particular XML
description.

It is worth noting that the XML description printed will not be an
exact copy of the document fed into GDB.  For example this minimal
input file:

  <target>
    <feature name="abc">
      <reg name="r1" bitsize="32"/>
    </feature>
  </target>

Will produce this output:

  (gdb) maint print xml-tdesc path/to/file.xml
  <?xml version="1.0"?>
  <!DOCTYPE target SYSTEM "gdb-target.dtd">
  <target>
    <feature name="abc">
      <reg name="r1" bitsize="32" type="int" regnum="0"/>
    </feature>
  </target>

Notice that GDB filled in both the 'type' and 'regnum' fields of the
<reg>.  I think this is actually a positive as it means we get to
really understand how GDB processed the document, if GDB made some
assumptions that differ to those the user expected then hopefully this
will bring those issues to the users attention.

To implement this I have tweaked the output produced by the
print_xml_feature which is defined within the gdbsupport/ directory.
The changes I have made to this class are:

  1. The <architecture>...</architecture> tags are now not produced if
  the architecture name is NULL.

  2. The <osabi>...</osabi> tags get a newline at the end.

  3. And, the whole XML document is indented using white space in a
  nested fashion (as in the example output above).

I think that these changes should be fine, the print_xml_feature class
is used:

  1. In gdbserver to generate an XML document to send as the target
  description to GDB.

  2. In GDB as part of a self-check function, a target_desc is
  converted to XML then parsed back into a target_desc.  We then check
  the before and after target_desc objects are the same.

  3. In the new 'maint print xml-tdesc' command.

In all of these use cases adding the extra white space should be fine.

gdbsupport/ChangeLog:

	* tdesc.cc (print_xml_feature::visit_pre): Use add_line to add
	output content, and call indent as needed in all overloaded
	variants.
	(print_xml_feature::visit_post): Likewise.
	(print_xml_feature::visit): Likewise.
	(print_xml_feature::add_line): Two new overloaded functions.
	* tdesc.h (print_xml_feature::indent): New member function.
	(print_xml_feature::add_line): Two new overloaded member
	functions.
	(print_xml_feature::m_depth): New member variable.

gdb/ChangeLog:

	* target-descriptions.c (tdesc_architecture_name): Protect against
	NULL pointer dereference.
	(maint_print_xml_tdesc_cmd): New function.
	(_initialize_target_descriptions): Register new 'maint print
	xml-tdesc' command and give it the filename completer.
	* NEWS: Mention new 'maint print xml-tdesc' command.

gdb/testsuite/ChangeLog:

	* gdb.xml/tdesc-reload.c: New file.
	* gdb.xml/tdesc-reload.exp: New file.
	* gdb.xml/maint-xml-dump-01.xml: New file.
	* gdb.xml/maint-xml-dump-02.xml: New file.
	* gdb.xml/maint-xml-dump.exp: New file.

gdb/doc/ChangeLog:

	* gdb.texinfo (Maintenance Commands): Document new 'maint print
	xml-desc' command.
2020-06-23 22:17:20 +01:00
Philippe Waroquiers
5b860c93e3 NEWS and documentation for alias default-args related concept and commands.
gdb/ChangeLog
2020-06-22  Philippe Waroquiers  <philippe.waroquiers@skynet.be>

	* NEWS: Mention change to the alias command.

gdb/doc/ChangeLog
2020-06-22  Philippe Waroquiers  <philippe.waroquiers@skynet.be>

	* gdb.texinfo (Command aliases default args): New node documenting
	how to use default args for a command using aliases.
	(Aliases): Document the new 'DEFAULT-ARGS...' option.
	(Help): Update help aliases text and describe when full alias
	definition is provided.
2020-06-22 21:16:25 +02:00
Tom Tromey
914592f9ff Update documentation for Ada .gdb_index
.gdb_index now supports Ada, so update the documentation to reflect
this.

gdb/doc/ChangeLog
2020-06-11  Tom Tromey  <tromey@adacore.com>

	* gdb.texinfo (Index Files): Reword.  Remove Ada limitation.
2020-06-11 11:24:48 -06:00
Jonny Grant
c5a6a07f2a gdb/doc: remove broken links Previous and Up from contents
gdb/doc/ChangeLog:

	* gdb.texinfo: Remove broken links Previous and Up from
	contents.

Signed-off-by: Jonny Grant <jg@jguk.org>
Change-Id: Iad7323580a3c0c7f00eab1264d66f39e8d156e38
2020-06-10 22:56:31 -04:00
Tom Tromey
0a4f5f8cae Revert "Add completion styling"
This reverts commit eca1f90cf4.  Several
changes were requested, and it seemed simplest to revert it.

gdb/ChangeLog
2020-05-23  Tom Tromey  <tom@tromey.com>

	Revert commit eca1f90c:
	* NEWS: Remove entry for completion styling.
	* completer.c (_rl_completion_prefix_display_length): Move
	declaration later.
	(gdb_fnprint): Revert.
	(gdb_display_match_list_1): Likewise.
	* cli/cli-style.c (completion_prefix_style)
	(completion_difference_style, completion_suffix_style): Remove.
	(_initialize_cli_style): Revert.
	* cli/cli-style.h (completion_prefix_style)
	(completion_difference_style, completion_suffix_style): Don't
	declare.

gdb/doc/ChangeLog
2020-05-23  Tom Tromey  <tom@tromey.com>

	* gdb.texinfo (Output Styling): Don't mention completion styling.
	(Editing): Don't mention readline completion styling.

gdb/testsuite/ChangeLog
2020-05-23  Tom Tromey  <tom@tromey.com>

	* gdb.base/style.exp: Remove completion styling test.
	* lib/gdb-utils.exp (style): Remove completion styles.
2020-05-24 20:27:48 -06:00
Tom Tromey
eca1f90cf4 Add completion styling
Readline has a styling feature for completion -- if it is enabled, the
common prefix of completions will be displayed in a different style.
This doesn't work in gdb, because gdb implements its own completer.

This patch implements the feature.  However, it doesn't directly use
the Readline feature, because gdb can do a bit better: it can let the
user control the styling using the existing mechanisms.

This version incorporates an Emacs idea, via Eli: style the prefix,
the "difference character", and the suffix differently.

gdb/ChangeLog
2020-05-23  Tom Tromey  <tom@tromey.com>

	* NEWS: Add entry for completion styling.
	* completer.c (_rl_completion_prefix_display_length): Move
	declaration earlier.
	(gdb_fnprint): Use completion_style.
	(gdb_display_match_list_1): Likewise.
	* cli/cli-style.c (completion_prefix_style)
	(completion_difference_style, completion_suffix_style): New
	globals.
	(_initialize_cli_style): Register new globals.
	* cli/cli-style.h (completion_prefix_style)
	(completion_difference_style, completion_suffix_style): Declare.

gdb/doc/ChangeLog
2020-05-23  Tom Tromey  <tom@tromey.com>

	* gdb.texinfo (Output Styling): Mention completion styling.
	(Editing): Mention readline completion styling.

gdb/testsuite/ChangeLog
2020-05-23  Tom Tromey  <tom@tromey.com>

	* gdb.base/style.exp: Add completion styling test.
	* lib/gdb-utils.exp (style): Add completion styles.
2020-05-23 14:53:33 -06:00
Pedro Alves
98c59b527b Make exec-file-mismatch compare build IDs
The patch makes GDB do exec-file-mismatch validation by comparing
build IDs instead of the current method of comparing filenames.

Currently, the exec-file-mismatch feature simply compares filenames to
decide whether the exec file loaded in gdb and the exec file the
target reports is running match.  This causes false positives when
remote debugging, because it'll often be the case that the paths in
the host and the target won't match.  And of course misses the case of
the files having the same name but being actually different files
(e.g., different builds).

This also broke many testcases when running against gdbserver, causing
tests to be skipped like (here native-extended-gdbserver):

  (gdb) run
  Starting program: /home/pedro/gdb/binutils-gdb/build/gdb/testsuite/outputs/gdb.base/argv0-symlink/argv0-symlink-filelink
  warning: Mismatch between current exec-file /home/pedro/gdb/binutils-gdb/build/gdb/testsuite/outputs/gdb.base/argv0-symlink/argv0-symlink-filelink
  and automatically determined exec-file /home/pedro/gdb/binutils-gdb/build/gdb/testsuite/outputs/gdb.base/argv0-symlink/argv0-symlink
  exec-file-mismatch handling is currently "ask"
  Load new symbol table from "/home/pedro/gdb/binutils-gdb/build/gdb/testsuite/outputs/gdb.base/argv0-symlink/argv0-symlink"? (y or n) UNTESTED: gdb.base/argv0-symlink.exp: could not run to main

or to fail like (here native-gdbserver):

 (gdb) spawn /home/pedro/gdb/binutils-gdb/build/gdb/testsuite/../../gdbserver/gdbserver --once localhost:2346 /home/pedro/gdb/binutils-gdb/build/gdb/te
 stsuite/outputs/gdb.btrace/buffer-size/skip_btrace_tests-19968.x
 Process /home/pedro/gdb/binutils-gdb/build/gdb/testsuite/outputs/gdb.btrace/buffer-size/skip_btrace_tests-19968.x created; pid = 20040
 Listening on port 2346
 target remote localhost:2346
 Remote debugging using localhost:2346
 warning: Mismatch between current exec-file /home/pedro/gdb/binutils-gdb/build/gdb/testsuite/temp/19968/skip_btrace_tests-19968.x
 and automatically determined exec-file /home/pedro/gdb/binutils-gdb/build/gdb/testsuite/outputs/gdb.btrace/buffer-size/skip_btrace_tests-19968.x
 exec-file-mismatch handling is currently "ask"
 Load new symbol table from "/home/pedro/gdb/binutils-gdb/build/gdb/testsuite/outputs/gdb.btrace/buffer-size/skip_btrace_tests-19968.x"? (y or n) Quit
 (gdb) UNSUPPORTED: gdb.btrace/buffer-size.exp: target does not support record-btrace

The former case is about GDB not realizing the two files are the same,
because one of the them is a symlink to the other.  The latter case is
about GDB realizing that one file is a copy of the other.

Over the years, the toolchain has settled on build ID matching being
the canonical method to match core dumps to executables, and
executables with no debug info to their debug info.

This patch makes us use build IDs to match the running image of a
binary with its version loaded in gdb, which may or may not have debug
info.  This is very much like the core dump/executable matching.

The change to gdb_bfd_open is necessary to get rid of the "transfers
from remote targets can be slow" warning when we open the remote file
to read its build ID:

 (gdb) r
 Starting program: /home/pedro/gdb/binutils-gdb/build/gdb/testsuite/outputs/gdb.base/break/break
 Reading /home/pedro/gdb/binutils-gdb/build/gdb/testsuite/outputs/gdb.base/argv0-symlink/argv0-symlink from remote target...
 warning: File transfers from remote targets can be slow. Use "set sysroot" to access files locally instead.
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 warning: Mismatch between current exec-file /home/pedro/gdb/binutils-gdb/build/gdb/testsuite/outputs/gdb.base/break/break
 and automatically determined exec-file /home/pedro/gdb/binutils-gdb/build/gdb/testsuite/outputs/gdb.base/argv0-symlink/argv0-symlink
 exec-file-mismatch handling is currently "ask"
 Load new symbol table from "/home/pedro/gdb/binutils-gdb/build/gdb/testsuite/outputs/gdb.base/argv0-symlink/argv0-symlink"? (y or n)

While trying this out, I was worried that bfd would read a lot of
stuff from the binary in order to extract the build ID, making it
potentially slow, but turns out we don't read all that much.  Maybe a
couple hundred bytes, and most of it seemingly is the read-ahead
cache.  So I'm not worried about that.  Otherwise I'd consider whether
a new qXfer:buildid:read would be better.  But I'm happy that we
seemingly don't need to worry about it.

gdb/ChangeLog:
2020-05-19  Pedro Alves  <palves@redhat.com>

	* NEWS (set exec-file-mismatch): Adjust entry.
	* exec.c: Include "build-id.h".
	(validate_exec_file): Try to match build IDs instead of filenames.
	* gdb_bfd.c (struct gdb_bfd_open_closure): New.
	(gdb_bfd_iovec_fileio_open): Adjust to use gdb_bfd_open_closure
	and pass down 'warn_if_slow'.
	(gdb_bfd_open): Add 'warn_if_slow' parameter.  Use
	gdb_bfd_open_closure to pass it down.
	* gdb_bfd.h (gdb_bfd_open): Add 'warn_if_slow' parameter.

gdb/doc/ChangeLog:
2020-05-19  Pedro Alves  <palves@redhat.com>

	* gdb.texinfo (Attach): Update exec-file-mismatch description to
	mention build IDs.
	(Separate Debug Files): Add "build id" anchor.
2020-05-19 18:37:15 +01:00
Philippe Waroquiers
5b4a1a8dbe Update NEWS and documentation for help and apropos changes.
gdb/ChangeLog

2020-05-15  Philippe Waroquiers  <philippe.waroquiers@skynet.be>

	* NEWS: Mention changes to help and apropos.

gdb/doc/ChangeLog

2020-05-15  Philippe Waroquiers  <philippe.waroquiers@skynet.be>

	* gdb.texinfo (Help): Document the help and apropos changes.
	(Aliases): Document new meaning of -a abbreviation flag.
2020-05-15 22:17:46 +02:00
Kamil Rytarowski
aa8509b4ed Mention the NetBSD support in "info proc" documentation
gdb/doc/ChangeLog:

        * gdb.texinfo (info proc, info proc cmdline, info proc cwd)
        (info proc exe, info proc mappings, info proc stat): Mention
        NetBSD support.
2020-05-05 17:41:57 +02:00
Tom Tromey
2b2fbab8ef Allow Python commands to be in class_tui
Now that Python code can create TUI windows, it seemed appropriate to
allow Python commands to appear in the "TUI" help class.  This patch
adds this capability.

gdb/ChangeLog
2020-04-28  Tom Tromey  <tom@tromey.com>

	* NEWS: Update.
	* python/py-cmd.c (gdbpy_initialize_commands): Add COMMAND_TUI.
	(cmdpy_init): Allow class_tui.

gdb/doc/ChangeLog
2020-04-28  Tom Tromey  <tom@tromey.com>

	* python.texi (Commands In Python): Document gdb.COMMAND_TUI.
2020-04-28 08:54:17 -06:00
Tom Tromey
45fc7c9968 Expand dynamic type documentation
This expands the Python dynamic type documentation, as suggested by
Christian.

gdb/doc/ChangeLog
2020-04-27  Tom Tromey  <tromey@adacore.com>

	* python.texi (Types In Python): Mention missing fields.  Add
	dynamic type example.
2020-04-27 08:28:16 -06:00
Tom Tromey
1acda8039b Add Python support for dynamic types
This changes the gdb Python API to add support for dynamic types.  In
particular, this adds an attribute to gdb.Type, and updates some
attributes to reflect dynamic sizes and field offsets.

There's still no way to get the dynamic type from one of its concrete
instances.  This could perhaps be added if needed.

gdb/ChangeLog
2020-04-24  Tom Tromey  <tromey@adacore.com>

	PR python/23662:
	* python/py-type.c (convert_field): Handle
	FIELD_LOC_KIND_DWARF_BLOCK.
	(typy_get_sizeof): Handle TYPE_HAS_DYNAMIC_LENGTH.
	(typy_get_dynamic): Nw function.
	(type_object_getset): Add "dynamic".
	* NEWS: Add entry.

gdb/doc/ChangeLog
2020-04-24  Tom Tromey  <tromey@adacore.com>

	PR python/23662:
	* python.texi (Types In Python): Document new features.

gdb/testsuite/ChangeLog
2020-04-24  Tom Tromey  <tromey@adacore.com>

	PR python/23662:
	* gdb.ada/variant.exp: Add Python checks.
	* gdb.rust/simple.exp: Add dynamic type checks.
2020-04-24 13:40:33 -06:00
Artur Shepilko
0ca4866abe Fix makeinfo warnings in gdb.texinfo and python.texi docs
Building gdb-9.1 on a system that has an older version of makeinfo
(4.8) shows the following warnings:

-----------------
make[4]: Entering directory '/home/tester/gdb-9.1/build/gdb/doc'
makeinfo --split-size=5000000 --split-size=5000000   -I
../../../gdb/doc/../../readline/readline/doc -I ../../../gdb/doc/../mi
-I ../../../gdb/doc \
    -o gdb.info ../../../gdb/doc/gdb.texinfo
../../../gdb/doc/gdb.texinfo:21867: warning: unlikely character [ in @var.
../../../gdb/doc/gdb.texinfo:21867: warning: unlikely character ] in @var.
../../../gdb/doc/gdb.texinfo:21868: warning: unlikely character [ in @var.
../../../gdb/doc/gdb.texinfo:21868: warning: unlikely character ] in @var.
../../../gdb/doc/gdb.texinfo:21869: warning: unlikely character [ in @var.
../../../gdb/doc/gdb.texinfo:21869: warning: unlikely character ] in @var.
../../../gdb/doc/gdb.texinfo:21872: warning: unlikely character [ in @var.
../../../gdb/doc/gdb.texinfo:21872: warning: unlikely character ] in @var.
../../../gdb/doc/gdb.texinfo:21874: warning: unlikely character [ in @var.
../../../gdb/doc/gdb.texinfo:21874: warning: unlikely character ] in @var.
../../../gdb/doc/gdb.texinfo:21876: warning: unlikely character [ in @var.
../../../gdb/doc/gdb.texinfo:21876: warning: unlikely character ] in @var.
../../../gdb/doc/gdb.texinfo:21879: warning: unlikely character [ in @var.
../../../gdb/doc/gdb.texinfo:21879: warning: unlikely character ] in @var.
../../../gdb/doc/gdb.texinfo:21931: warning: unlikely character [ in @var.
../../../gdb/doc/gdb.texinfo:21931: warning: unlikely character ] in @var.
../../../gdb/doc/gdb.texinfo:21933: warning: unlikely character [ in @var.
../../../gdb/doc/gdb.texinfo:21933: warning: unlikely character ] in @var.
../../../gdb/doc/gdb.texinfo:21936: warning: unlikely character [ in @var.
../../../gdb/doc/gdb.texinfo:21936: warning: unlikely character ] in @var.
../../../gdb/doc/gdb.texinfo:21939: warning: unlikely character [ in @var.
../../../gdb/doc/gdb.texinfo:21939: warning: unlikely character ] in @var.
../../../gdb/doc//python.texi:3297: warning: `.' or `,' must follow
@xref, not `A'.
make[4]: Leaving directory '/home/tester/gdb-9.1/build/gdb/doc'
-----------------

These are thrown by expressions like `@var{[host]}`, intended to
produce `[HOST]`.

In that context this should instead be changed to `[@var{host}]`, which
has the same effect but without the warnings.

As for the warning in `python.texi`, there's period missing at the end
of one `@xref{}` clause.  Added.

gdb/doc/ChangeLog:

2020-04-15  Artur Shepilko  <nomadbyte@gmail.com>

	* gdb.texinfo: Transform @var{[host]} to [@var{host}]; this
	clears makeinfo warnings.
	* python.texi: Add a missing period trailing an @xref{} clause;
	this clears a makeinfo warning.
2020-04-15 09:44:12 +02:00