~ubuntu-support-team/binutils/+git/binutils-gdb:users/simark/update-gnulib

Last commit made on 2021-01-22
Get this branch:
git clone -b users/simark/update-gnulib https://git.launchpad.net/~ubuntu-support-team/binutils/+git/binutils-gdb

Branch merges

Branch information

Name:
users/simark/update-gnulib
Repository:
lp:~ubuntu-support-team/binutils/+git/binutils-gdb

Recent commits

636b2c3... by "Paul E. Murphy" <email address hidden>

gnulib: update to 776af40e0

This fixes PR27184, a failure to compile gdb due to
cdefs.h being out of sync with glibc on ppc64le targets
which are compiled with -mabi=ieeelongdouble and glibc
2.32.

Likewise, update usage of _GL_ATTRIBUTE_FORMAT_PRINTF to
_GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD.

Likewise, disable newly added rpl_free gnulib api in
gdbserver support libraries.

Likewise, undefine read/write macros before redefining them
on mingw targets.

Likewise, wrap C++ usage of free with GNULIB_NAMESPACE namespace
as needed.

Change-Id: I86517613c0d8ac8f5ea45bbc4ebe2b54a3aef29f

9d2d8a1... by Andrew Burgess <email address hidden>

gdb: add new version style

This commit adds a new 'version' style, which replaces the hard coded
styling currently used for GDB's version string. GDB's version number
is displayed:

  1. In the output of 'show version', and

  2. When GDB starts up (without the --quiet option).

This new style can only ever affect the first of these two cases as
the second case is printed before GDB has processed any initialization
files, or processed any GDB commands passed on the command line.

However, because the first case exists I think this commit makes
sense, it means the style is no longer hard coded into GDB, and we can
add some tests that the style can be enabled/disabled correctly.

This commit is an alternative to a patch Tom posted here:

  https://sourceware.org/pipermail/gdb-patches/2020-June/169820.html

I've used the style name 'version' instead of 'startup' to reflect
what the style is actually used for. If other parts of the startup
text end up being highlighted I imagine they would get their own
styles based on what is being highlighted. I feel this is more inline
with the other style names that are already in use within GDB.

I also decoupled adding this style from the idea of startup options,
and the possibility of auto-saving startup options. Those ideas can
be explored in later patches.

This commit should probably be considered only a partial solution to
issue PR cli/25956. The colours of the style are no longer hard
coded, however, it is still impossible to change the styling of the
version string displayed during startup, so in one sense, the styling
of that string is still "hard coded". A later patch will hopefully
extend GDB to allow it to adjust the version styling before the
initial version string is printed.

gdb/ChangeLog:

 PR cli/25956
 * cli/cli-style.c: Add 'cli/cli-setshow.h' include.
 (version_style): Define.
 (cli_style_option::cli_style_option): Add intensity parameter, and
 use as appropriate.
 (_initialize_cli_style): Register version style set/show commands.
 * cli/cli-style.h (cli_style_option): Add intensity parameter.
 (version_style): Declare.
 * top.c (print_gdb_version): Use version_stype, and styled_string
 to print the GDB version string.

gdb/doc/ChangeLog:

 PR cli/25956
 * gdb.texinfo (Output Styling): Document version style.

gdb/testsuite/ChangeLog:

 PR cli/25956
 * gdb.base/style.exp (run_style_tests): Add version string test.
 (test_startup_version_string): Use version style name.
 * lib/gdb-utils.exp (style): Handle version style name.

e7b4307... by Andrew Burgess <email address hidden>

gdb: don't print escape characters when a style is disabled

While working on another patch I noticed that if I disable a single
style with, for example:

  set style filename background none
  set style filename foreground none
  set style filename intensity normal

Then in some places escape characters are still injected into the
output stream. This is a bit of an edge case, and I can't think when
this would actually cause problems, but it still felt like a bit of an
annoyance.

One place where this does impact is in testing, where it becomes
harder to write tight test patterns if it is not obvious when GDB will
decide to inject escape sequences.

It's especially annoying because depending on how something is printed
then GDB might, or might not, add escape characters. So this would
not add escape characters if the filename style was disabled:

  fprintf_filtered (file, "%ps",
                    styled_string (file_name_style.style (),
                                   "This is a test"));

But this would add escape characters:

  fprintf_styled (file, file_name_style.style (),
                  "%s", "This is a test");

I tracked this down to some calls to set_output_style in utils.c.
Currently some calls to set_output_style (in utils.c) are guarded like
this:

  if (!STYLE.is_default ())
    set_output_style (stream, STYLE);

But some calls are not. It is the calls that are NOT guarded that
cause the extra escape sequences to be emitted.

My initial proposal to resolve this issue was simply to ensure that
all calls to set_output_style were guarded. The patch I posted for
this can be found here:

  https://sourceware.org/pipermail/gdb-patches/2021-January/175096.html

The feedback on this proposal was that it might be better to guard
against the escape sequences being emitted at a later lever, right
down at emit_style_escape.

So this is what this version does. In emit_style_escape we already
track the currently applied style, so if the style we are being asked
to switch to is the same as the currently applied style then no escape
sequence needs to be emitted.

Making this change immediately exposed some issues in
fputs_maybe_filtered related to line wrapping. The best place to start
to understand what's going on with the styling and wrapping is look at
the test:

  gdb.base/style.exp: all styles enabled: frame when width=20

If you run this test and then examine the output in an editor so the
escape sequences can be seen you'll see the duplicate escape sequences
that are emitted before this patch, the compare to after this patch
you'll see the set of escape sequences should be the minimum required.

In order to test these changes I have rewritten the gdb.base/style.exp
test script. The core of the script is now run multiple times. The
first time the test is run things are as they were before, all styles
are on.

After that the test is rerun multiple times. Each time through a
single style is disabled using the 3 explicit set calls listed above.
I then repeat all the tests, however, I arrange so that the patterns
for the disabled style now require no escape sequences.

gdb/ChangeLog:

 * utils.c (emit_style_escape): Only emit an escape sequence if the
 requested style is different than the current applied style.
 (fputs_maybe_filtered): Adjust the juggling of the wrap_style, and
 current applied_style.
 (fputs_styled): Remove is_default check.
 (fputs_styled_unfiltered): Likewise.
 (vfprintf_styled_no_gdbfmt): Likewise.

gdb/testsuite/ChangeLog:

 * gdb.base/style.exp (limited_style): New proc.
 (clean_restart_and_disable): New proc.
 (run_style_tests): New proc. Most of the old tests from this file
 are now in this proc.
 (test_startup_version_string): New proc. Reamining test from the
 old file is in this proc.

d8c4766... by Andrew Burgess <email address hidden>

gdb/doc: don't rely on @menu item within the docs

The node 'Auto-loading extensions' currently relies on a @menu item to
provide a set of cross-references to different parts of the manual.
Additionally the menu is placed part way through the node and the text
prior to the menu seems (to me) to assume that the menu will be
formatted into the document.

This is a bad idea as the menus are not always part of the final
document (e.g. pdf output does not include the menu), when compared to
the info page the pdf version of this node is less helpful as it lacks
proper cross references. Menus should always be placed at the end of
a node.

In this commit I rewrite a paragraph to add extra cross references
inline within the text. I then move the menu to the end of the node.

gdb/doc/ChangeLog:

 * gdb.texinfo (Auto-loading extensions): Add additional cross
 references and move @menu to the end of the node.

2189c31... by Simon Marchi

gdb: add remote_debug_printf

This is the next in the new-style debug macro series.

For this one, I decided to omit the function name from the "Sending packet" /
"Packet received" kind of prints, just because it's not very useful in that
context and hinders readability more than anything else. This is completely
arbitrary.

This is with:

  [remote] putpkt_binary: Sending packet: $qTStatus#49...
  [remote] getpkt_or_notif_sane_1: Packet received: T0;tnotrun:0;tframes:0;tcreated:0;tfree:500000;tsize:500000;circular:0;disconn:0;starttime:0;stoptime:0;username:;notes::

and without:

  [remote] Sending packet: $qTStatus#49...
  [remote] Packet received: T0;tnotrun:0;tframes:0;tcreated:0;tfree:500000;tsize:500000;circular:0;disconn:0;starttime:0;stoptime:0;username:;notes::

A difference is that previously, the query packet and its reply would be
printed on the same line, like this:

  Sending packet: $qTStatus#49...Packet received: T0;tnotrun:0;tframes:0;tcreated:0;tfree:500000;tsize:500000;circular:0;disconn:0;starttime:0;stoptime:0;username:;notes::

Now, they are printed on two lines, since each remote_debug_printf{,_nofunc}
prints its own complete message including an end of line. It's probably
a matter of taste, but I prefer the two-line version, it's easier to
follow, especially when the query packet is long.

As a result, lib/range-stepping-support.exp needs to be updated, as it
currently expects the vCont packet and the reply to be on the same line.
I think it's sufficient in that context to just expect the vCont packet
and not the reply, since the goal is just to count how many vCont;r GDB
sends.

gdb/ChangeLog:

 * remote.h (remote_debug_printf): New.
 (remote_debug_printf_nofunc): New.
 (REMOTE_SCOPED_DEBUG_ENTER_EXIT): New.
 * remote.c: Use above macros throughout file.

gdbsupport/ChangeLog:

 * common-debug.h (debug_prefixed_printf_cond_nofunc): New.
 * common-debug.c (debug_prefixed_vprintf): Handle a nullptr
 func.

gdb/testsuite/ChangeLog:

 * lib/range-stepping-support.exp (exec_cmd_expect_vCont_count):
 Adjust to "set debug remote" changes.

Change-Id: Ica6dead50d3f82e855c7d763f707cef74bed9fee

0234980... by Simon Marchi

gdb: change remote_debug to bool

As far as I can see, there are no more spots looking for a remote_debug
other than true/false. If we ever want to revert to an int, we can
always change it back later, but this makes things simpler for now.

gdb/ChangeLog:

 * remote.h (remote_debug): Change to bool.
 * remote.c (remote_debug): Change to bool.
 (_initialize_remote): Adjust.

Change-Id: I21aac5b4cff9dc4f75c8efaf47c23583ecabd2a6

cda09ec... by Simon Marchi

gdb: move remote_debug to remote.{h,c}

remote_debug is currently declared in target.h and defined in top.c.
Move them to remote.h and remote.c.

Include remote.h in remote-sim.c, as it uses remote_debug.

gdb/ChangeLog:

 * target.h (remote_debug): Move to...
 * remote.h (remote_debug): ... here.
 * top.c (remote_debug): Move to...
 * remote.c (remote_debug): ... here.
 * remote-sim.c: Include remote.h.

Change-Id: Iae632d12ff8900b23eee6b2529d6a3cd339a8caa

baf2b57... by Simon Marchi

gdb: move set remote commands to remote.c

Commands "set debug remote" and "set remotetimeout" are defined in
cli/cli-cmds.c, I think it would make more sense for them to be in
remote.c.

gdb/ChangeLog:

 * cli/cli-cmds.c (show_remote_debug): Remove.
 (show_remote_timeout): Remove.
 (_initialize_cli_cmds): Don't register commands.
 * remote.c (show_remote_debug): Move here.
 (show_remote_timeout): Move here.
 (_initialize_remote): Register commands.

Change-Id: Ic4d81888aa4f8dde89d1d29397ef19a08951b80b

344e984... by Simon Marchi

gdb: remove TYPE_OBJFILE macro

Change all users to use the type::objfile method instead.

gdb/ChangeLog:

 * gdbtypes.h (TYPE_OBJFILE): Remove, change all users to use the
 type::objfile method instead.

Change-Id: I6b3f580913fb1fb0cf986b176dba8db68e1fabf9

3062502... by Simon Marchi

gdb: remove TYPE_OBJFILE_OWNED macro

Update all users to use the type::is_objfile_owned method.

gdb/ChangeLog:

 * gdbtypes.h (TYPE_OBJFILE_OWNED): Remove, update all users to
 use the type::is_objfile_owned method.

Change-Id: Icae84d136393ab9f756f50a33ac3cedda13c5ba2