~ubuntu-support-team/binutils/+git/binutils-gdb:users/palves/make_function_view

Last commit made on 2022-07-22
Get this branch:
git clone -b users/palves/make_function_view https://git.launchpad.net/~ubuntu-support-team/binutils/+git/binutils-gdb

Branch merges

Branch information

Name:
users/palves/make_function_view
Repository:
lp:~ubuntu-support-team/binutils/+git/binutils-gdb

Recent commits

37c2487... by Pedro Alves <email address hidden>

Introduce gdb::make_function_view

This adds gdb::make_function_view, which lets you create a function
view from a callable without specifying the function_view's template
parameter. For example, this:

    auto lambda = [&] (int) { ... };
    auto fv = gdb::make_function_view (lambda);

instead of:

    auto lambda = [&] (int) { ... };
    gdb::function_view<void (int)> fv = lambda;

It is particularly useful if you have a template function with an
optional function_view parameter, whose type depends on the function's
template parameters. Like:

    template<typename T>
    void my_function (T v, gdb::function_view<void(T)> callback = nullptr);

For such a function, the type of the callback argument you pass must
already be a function_view. I.e., this wouldn't compile:

    auto lambda = [&] (int) { ... };
    my_function (1, lambda);

With gdb::make_function_view, you can write the call like so:

    auto lambda = [&] (int) { ... };
    my_function (1, gdb::make_function_view (lambda));

Unit tests included.

Tested by building with GCC 9.4, Clang 10, and GCC 4.8.5, on x86_64
GNU/Linux, and running the unit tests.

Change-Id: I5c4b3b4455ed6f0d8878cf1be189bea3ee63f626

6577f36... by Alan Modra

PR17122, OSX 10.9 build failure

sbrk hasn't been used in binutils/ or ld/ for quite some time (so the
PR was fixed a while ago). Tidy up configury.

 PR 17122
binutils/
 * configure.ac: Don't check for sbrk.
 * sysdep.h (sbrk): Don't supply fallback declaration.
 * config.in: Regenerate.
 * configure: Regenerate.
ld/
 * configure.ac: Don't check for sbrk.
 * config.in: Regenerate.
 * configure: Regenerate.

4686f81... by Jiangshuai Li <email address hidden>

gdb/csky modify registers list for general_reggroup

There are two modification points here:
1. For the debugging of csky architecture, after executing "info register",
   we hope to print out GPRs, PC and the registers related to exceptions.
2. With tdesc-xml, users can view the register groups described in XML.

b5375c5... by Alan Modra

PR15951, binutils testsuite builds status wrapper unconditionally

 PR 15951
 * testsuite/binutils-all/objcopy.exp: Build testglue.o when
 needs_status_wrapper.

13391ff... by GDB Administrator <email address hidden>

Automatic date update in version.in

c07ec96... by Peter Bergner

Add ChangeLog entry from previous commit

0a24685... by Peter Bergner

PowerPC: Create new MMA instruction masks and use them

The MMA instructions use XX3_MASK|3<<21 as an instruction mask, but that
misses the RC bit/bit 31, so if we disassemble a .long that represents an
MMA instruction except that it also has bit 31 set, we will erroneously
disassemble it to that MMA instruction. We create new masks defines that
contain bit 31 so that doesn't happen anymore.

opcodes/
 * ppc-opc.c (XACC_MASK, XX3ACC_MASK): New defines.
 (P_GER_MASK, xxmfacc, xxmtacc, xxsetaccz, xvi8ger4pp, xvi8ger4,
 xvf16ger2pp, xvf16ger2, xvf32gerpp, xvf32ger, xvi4ger8pp, xvi4ger8,
 xvi16ger2spp, xvi16ger2s, xvbf16ger2pp, xvbf16ger2, xvf64gerpp,
 xvf64ger, xvi16ger2, xvf16ger2np, xvf32gernp, xvi8ger4spp, xvi16ger2pp,
 xvbf16ger2np, xvf64gernp, xvf16ger2pn, xvf32gerpn, xvbf16ger2pn,
 xvf64gerpn, xvf16ger2nn, xvf32gernn, xvbf16ger2nn, xvf64gernn: Use them.

8f29211... by "H.J. Lu" <email address hidden>

i386: Don't allow GOTOFF relocation against IFUNC symbol for PIC

We can't use the PLT entry as the function address for PIC since the PIC
register may not be set up properly for indirect call.

bfd/

 PR ld/27998
 * elf32-i386.c (elf_i386_relocate_section): Don't allow GOTOFF
 relocation against IFUNC symbol for PIC.

ld/

 PR ld/27998
 * testsuite/ld-i386/pr27998a.d: Replace -shared with -e bar.
 * testsuite/ld-i386/pr27998b.d: Expect a linker error.
 * testsuite/ld-ifunc/ifunc-2-i386-now.d: Updated.
 * testsuite/ld-ifunc/ifunc-2-local-i386-now.d: Likewise.
 * testsuite/ld-ifunc/ifunc-2-i386.s: Replace @GOTOFF with @GOT.
 * testsuite/ld-ifunc/ifunc-2-local-i386.s: Likewise.

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

gdb: ensure the cast in gdbarch_tdep is valid

This commit makes use of gdb::checked_static_cast when casting the
generic gdbarch_tdep pointer to a specific sub-class type. This means
that, when compiled in developer mode, GDB will validate that the cast
is correct.

In order to use gdb::checked_static_cast the types involved must have
RTTI, which is why the gdbarch_tdep base class now has a virtual
destructor.

Assuming there are no bugs in GDB where we cast a gdbarch_tdep pointer
to the wrong type, then there should be no changes after this commit.

If any bugs do exist, then GDB will now assert (in a developer build).

11da1b1... by Andrew Burgess <email address hidden>

gdbsupport: add checked_static_cast

This commit was inspired by these mailing list posts:

  https://sourceware.org/pipermail/gdb-patches/2022-June/190323.html
  https://sourceware.org/pipermail/gdb-patches/2022-April/188098.html

The idea is to add a new function gdb::checked_static_cast, which can,
in some cases, be used as a drop-in replacement for static_cast. And
so, if I previously wrote this:

  BaseClass *base = get_base_class_pointer ();
  DerivedClass *derived = static_cast<DerivedClass *> (base);

I can now write:

  BaseClass *base = get_base_class_pointer ();
  DerivedClass *derived = gdb::checked_static_cast<DerivedClass *> (base);

The requirement is that BaseClass and DerivedClass must be
polymorphic.

The benefit of making this change is that, when GDB is built in
developer mode, a run-time check will be made to ensure that `base`
really is of type DerivedClass before the cast is performed. If
`base` is not of type DerivedClass then GDB will assert.

In a non-developer build gdb::checked_static_cast is equivalent to a
static_cast, and there should be no performance difference.

This commit adds the support function, but does not make use of this
function, a use will be added in the next commit.

Co-Authored-By: Pedro Alves <email address hidden>
Co-Authored-By: Tom Tromey <email address hidden>