deliverable/binutils-gdb.git
4 years agoAutomatic date update in version.in
GDB Administrator [Mon, 11 Nov 2019 00:00:24 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agogdb/python: Introduce gdb.lookup_static_symbols
Andrew Burgess [Tue, 15 Oct 2019 15:18:26 +0000 (16:18 +0100)] 
gdb/python: Introduce gdb.lookup_static_symbols

If gdb.lookup_static_symbol is going to return a single symbol then it
makes sense (I think) for it to return a context sensitive choice of
symbol, that is the global static symbol that would be visible to the
program at that point.

However, if the user of the python API wants to instead get a
consistent set of global static symbols, no matter where they stop,
then they have to instead consider all global static symbols with a
given name - there could be many.  That is what this new API function
offers, it returns a list (possibly empty) of all global static
symbols matching a given name (and optionally a given symbol domain).

gdb/ChangeLog:

* python/py-symbol.c (gdbpy_lookup_static_symbols): New
function.
* python/python-internal.h (gdbpy_lookup_static_symbols):
Declare new function.
* python/python.c (python_GdbMethods): Add
gdb.lookup_static_symbols method.
* NEWS: Mention gdb.lookup_static_symbols.

gdb/testsuite/ChangeLog:

* gdb.python/py-symbol.exp: Add test for
gdb.lookup_static_symbols.

gdb/doc/ChangeLog:

* python.texi (Symbols In Python): Add documentation for
gdb.lookup_static_symbols.

Change-Id: I1153b0ae5bcbc43b3dcf139043c7a48bf791e1a3

4 years agogdb/python: smarter symbol lookup for gdb.lookup_static_symbol
Andrew Burgess [Mon, 23 Sep 2019 15:59:08 +0000 (16:59 +0100)] 
gdb/python: smarter symbol lookup for gdb.lookup_static_symbol

When using gdb.lookup_static_symbol I think that GDB should find
static symbols (global symbol with static linkage) from the current
object file ahead of static symbols from other object files.

This means that if we have two source files f1.c and f2.c, and both
files contains 'static int foo;', then when we are stopped in f1.c a
call to 'gdb.lookup_static_symbol ("foo")' will find f1.c::foo, and if
we are stopped in f2.c we would find 'f2.c::foo'.

Given that gdb.lookup_static_symbol always returns a single symbol,
but there can be multiple static symbols with the same name GDB is
always making a choice about which symbols to return.  I think that it
makes sense for the choice GDB makes in this case to match what a user
would get on the command line if they asked to 'print foo'.

gdb/testsuite/ChangeLog:

* gdb.python/py-symbol.c: Declare and call function from new
py-symbol-2.c file.
* gdb.python/py-symbol.exp: Compile both source files, and add new
tests for gdb.lookup_static_symbol.
* gdb.python/py-symbol-2.c: New file.

gdb/doc/ChangeLog:

* python.texi (Symbols In Python): Extend documentation for
gdb.lookup_static_symbol.

gdb/ChangeLog:

* python/py-symbol.c (gdbpy_lookup_static_symbol): Lookup in
static block of current object file first.  Also fix typo in
header comment.

Change-Id: Ie55dbeb8806f35577b46015deecde27a0ca2ab64

4 years agogdb: Add a class to track last display symtab and line information
Andrew Burgess [Fri, 8 Nov 2019 16:18:43 +0000 (16:18 +0000)] 
gdb: Add a class to track last display symtab and line information

In stack.c we currently have a set of static global variables to track
the last displayed symtab and line.  This commit moves all of these
into a class and adds an instance of the class to track the same
information.

The API into stack.c is unchanged after this cleanup.

There should be no user visible changes after this commit.

gdb/ChangeLog:

* stack.c (set_last_displayed_sal): Delete.
(last_displayed_sal_valid): Delete.
(last_displayed_pspace): Delete.
(last_displayed_addr): Delete.
(last_displayed_symtab): Delete.
(last_displayed_line): Delete.
(class last_displayed_symtab_info_type): New.
(last_displayed_symtab_info): New static global variable.
(print_frame_info): Call methods on last_displayed_symtab_info.
(clear_last_displayed_sal): Update header comment, and make use of
last_displayed_symtab_info.
(last_displayed_sal_is_valid): Likewise.
(get_last_displayed_pspace): Likewise.
(get_last_displayed_addr): Likewise.
(get_last_displayed_symtab): Likewise.
(get_last_displayed_line): Likewise.
(get_last_displayed_sal): Likewise.
* stack.h (clear_last_displayed_sal): Update header comment.
(last_displayed_sal_is_valid): Likewise.
(get_last_displayed_pspace): Likewise.
(get_last_displayed_addr): Likewise.
(get_last_displayed_symtab): Likewise.
(get_last_displayed_line): Likewise.
(get_last_displayed_sal): Likewise.

Change-Id: Ia3dbfe267feec03108c5c8ed8bd94fc0a030c3ed

4 years agogdb: Convert frame_show_address to return a bool
Andrew Burgess [Fri, 8 Nov 2019 15:15:29 +0000 (15:15 +0000)] 
gdb: Convert frame_show_address to return a bool

Just a clean up, should be no user visible changes after this commit.

gdb/ChangeLog:

* stack.c (frame_show_address): Convert return type to bool.
* stack.h (frame_show_address): Likewise, and update header
comment.

Change-Id: Iaaa9ebd4ff6534db19c5329f1c604932c747bd7f

4 years agogdb_vecs.h: Avoid self move assign
Andrew Burgess [Fri, 8 Nov 2019 23:39:14 +0000 (23:39 +0000)] 
gdb_vecs.h: Avoid self move assign

While working on another patch I ran into an issue with
unordered_remove (in gdb_vecs.h), where removing the last item of the
vector can cause a self move assign.

When compiling the C++ standard library in debug mode (with
-D_GLIBCXX_DEBUG=1) this causes an error to trigger.

I've fixed the issue in this patch and provided a unit test.

The provided unit test includes an assignment operator which checks
for self move assign, this removes the need to compile with
-D_GLIBCXX_DEBUG=1 in order to spot the bug.  If you're keen to see
the error reported from the C++ standard library then remove operator=
from the unit test and recompile GDB with -D_GLIBCXX_DEBUG=1.

gdb/ChangeLog:

* Makefile.in (SUBDIR_UNITTESTS_SRCS): Add new file to the list.
* unittests/vec-utils-selftests.c: New file.
* gdbsupport/gdb_vecs.h (unordered_remove): Avoid self move assign.

Change-Id: I80247b20cd5212038117db7412865f5e6a9257cd

4 years agoRemove can_highlight from TUI windows
Tom Tromey [Sun, 10 Nov 2019 17:33:07 +0000 (10:33 -0700)] 
Remove can_highlight from TUI windows

Each TUI window has a "can_highlight" member.  However, this has the
same meaning as "can_box" -- a window can be highlighted if and only
if it can be boxed.  So, this patch removes can_highlight in favor of
simply using can_box.

gdb/ChangeLog
2019-11-10  Tom Tromey  <tom@tromey.com>

* tui/tui-wingeneral.c (tui_unhighlight_win): Use can_box.
(tui_highlight_win): Likewise.
(tui_win_info::check_and_display_highlight_if_needed): Likewise.
* tui/tui-data.h (struct tui_win_info) <can_highlight>: Remove.
* tui/tui-command.h (struct tui_cmd_window) <tui_cmd_window>:
Don't set can_highlight.

Change-Id: I35916859070efcdfcc6e692c71cc6070956dcfce

4 years agoRemove unused constructor declaration from cli_style_option
Tom Tromey [Sun, 10 Nov 2019 16:48:42 +0000 (09:48 -0700)] 
Remove unused constructor declaration from cli_style_option

I noticed that cli_style_option declares a constructor that is never
defined.  This removes it.

gdb/ChangeLog
2019-11-10  Tom Tromey  <tom@tromey.com>

* cli/cli-style.h (class cli_style_option) <cli_style_option>:
Remove unused declaration.

Change-Id: Ic59ec7eab4d7183d9392b58709354b2d4449b7be

4 years agoAutomatic date update in version.in
GDB Administrator [Sun, 10 Nov 2019 00:01:10 +0000 (00:01 +0000)] 
Automatic date update in version.in

4 years agoAutomatic date update in version.in
GDB Administrator [Sat, 9 Nov 2019 00:00:20 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoi386: Only check suffix in instruction mnemonic
H.J. Lu [Fri, 8 Nov 2019 17:31:06 +0000 (09:31 -0800)] 
i386: Only check suffix in instruction mnemonic

We should check suffix in instruction mnemonic when matching instruction.
In Intel syntax, normally we check for memory operand size.  But the same
mnemonic with 2 different encodings can have the same memory operand
size and i.suffix is set to LONG_DOUBLE_MNEM_SUFFIX from memory operand
size in Intel syntax to distinguish them.  When there is no suffix in
mnemonic, we check LONG_DOUBLE_MNEM_SUFFIX in i.suffix for mnemonic
suffix.

gas/

PR gas/25167
* config/tc-i386.c (match_template): Don't check instruction
suffix set from operand.
* testsuite/gas/i386/code16.d: New file.
* testsuite/gas/i386/code16.s: Likewise.
* testsuite/gas/i386/i386.exp: Run code16.
* testsuite/gas/i386/x86-64-branch-4.l: Updated.

opcodes/

PR gas/25167
* i386-opc.tbl: Remove IgnoreSize from cmpsd and movsd.
* i386-tbl.h: Regenerated.

4 years agoConstify command_line_input
Tom Tromey [Tue, 22 Oct 2019 19:32:39 +0000 (13:32 -0600)] 
Constify command_line_input

This changes command_line_input to return a "const char *", which is
appropriate because the memory is owned by command_line_input.  Then
it fixes up the users.

I looked at making command_line_input transfer ownership to its caller
instead, but this is complicated due to the way read_next_line is
called, so I decided against it.

Tested by rebuilding.

gdb/ChangeLog
2019-11-08  Tom Tromey  <tromey@adacore.com>

* top.c (read_command_file): Update.
(command_line_input): Make return type const.
* python/py-gdb-readline.c: Update.
* linespec.c (decode_line_2): Update.
* defs.h (command_line_input): Make return type const.
* cli/cli-script.c (read_next_line): Make return type const.
* ada-lang.c (get_selections): Update.

Change-Id: I27e6c9477fd1005ab5b16e0d337e4c015b6e6248

4 years agoRevert "GENERATE_SHLIB_SCRIPT vs. EMBEDDED."
Alan Modra [Fri, 8 Nov 2019 10:27:07 +0000 (20:57 +1030)] 
Revert "GENERATE_SHLIB_SCRIPT vs. EMBEDDED."

This reverts commit f2aaebdb97977ee7a5c83c02af871e758e7d594b.
My reasons for making that change were just plain wrong.

4 years agox86: convert RegMask and RegBND from bitfield to enumerator
Jan Beulich [Fri, 8 Nov 2019 08:06:24 +0000 (09:06 +0100)] 
x86: convert RegMask and RegBND from bitfield to enumerator

This is to further shrink the operand type representation.

4 years agox86: convert RegSIMD and RegMMX from bitfield to enumerator
Jan Beulich [Fri, 8 Nov 2019 08:05:36 +0000 (09:05 +0100)] 
x86: convert RegSIMD and RegMMX from bitfield to enumerator

This is to further shrink the operand type representation.

4 years agox86: convert Control/Debug/Test from bitfield to enumerator
Jan Beulich [Fri, 8 Nov 2019 08:04:53 +0000 (09:04 +0100)] 
x86: convert Control/Debug/Test from bitfield to enumerator

This is to further shrink the operand type representation.

4 years agox86: convert SReg from bitfield to enumerator
Jan Beulich [Fri, 8 Nov 2019 08:04:09 +0000 (09:04 +0100)] 
x86: convert SReg from bitfield to enumerator

This is to further shrink the operand type representation.

4 years agox86: introduce operand type "class"
Jan Beulich [Fri, 8 Nov 2019 08:03:23 +0000 (09:03 +0100)] 
x86: introduce operand type "class"

Many operand types, in particular the various kinds of registers, can't
be combined with one another (neither in templates nor in register
entries), and hence it is not a good use of resources (memory as well as
execution time) to represent them as individual bits of a bit field.

4 years agoPR25172, Wrong description of --stop-address=ADDR switch
Alan Modra [Fri, 8 Nov 2019 03:32:05 +0000 (14:02 +1030)] 
PR25172, Wrong description of --stop-address=ADDR switch

PR 25172
* objdump.c (usage): Correct --stop-address description.

4 years agoAutomatic date update in version.in
GDB Administrator [Fri, 8 Nov 2019 00:00:14 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years ago[gas][aarch64] Add the v8.6 Data Gathering Hint mnemonic [10/X]
Matthew Malcomson [Thu, 7 Nov 2019 17:22:45 +0000 (17:22 +0000)] 
[gas][aarch64] Add the v8.6 Data Gathering Hint mnemonic [10/X]

Hi,

This patch is part of a series that adds support for Armv8.6-A
to binutils.

In this last patch, the new Data Gathering Hint mnemonic is introduced.

Committed on behalf of Mihail Ionescu.

gas/ChangeLog:

2019-11-07  Mihail Ionescu  <mihail.ionescu@arm.com>

* testsuite/gas/aarch64/dgh.s: New test.
* testsuite/gas/aarch64/dgh.d: New test.

opcodes/ChangeLog:

2019-11-07  Mihail Ionescu  <mihail.ionescu@arm.com>

* opcodes/aarch64-tbl.h (V8_6_INSN): New macro for v8.6 instructions.
(aarch64_opcode_table): Add data gathering hint mnemonic.
* opcodes/aarch64-dis-2.c: Account for new instruction.

Is it ok for trunk?

Regards,
Mihail

4 years ago[Patch][binutils][arm] Armv8.6-A Matrix Multiply extension [9/10]
Matthew Malcomson [Thu, 7 Nov 2019 17:20:08 +0000 (17:20 +0000)] 
[Patch][binutils][arm]  Armv8.6-A Matrix Multiply extension [9/10]

Hi,

This patch is part of a series that adds support for Armv8.6-A
(Matrix Multiply and BFloat16 extensions) to binutils.

This patch introduces the Matrix Multiply (Int8, F32, F64) extensions
to the arm backend.

The following Matrix Multiply instructions are added: vummla, vsmmla,
vusmmla, vusdot, vsudot[1].

[1]https://developer.arm.com/docs/ddi0597/latest/simd-and-floating-point-instructions-alphabetic-order

Committed on behalf of Mihail Ionescu.

gas/ChangeLog:

2019-11-07  Mihail Ionescu  <mihail.ionescu@arm.com>

* config/tc-arm.c (arm_ext_i8mm): New feature set.
(do_vusdot): New.
(do_vsudot): New.
(do_vsmmla): New.
(do_vummla): New.
(insns): Add vsmmla, vummla, vusmmla, vusdot, vsudot mnemonics.
(armv86a_ext_table): Add i8mm extension.
(arm_extensions): Move bf16 extension to context sensitive table.
(armv82a_ext_table, armv84a_ext_table, armv85a_ext_table):
Move bf16 extension to context sensitive table.
(armv86a_ext_table): Add i8mm extension.
* doc/c-arm.texi: Document i8mm extension.
* testsuite/gas/arm/i8mm.s: New test.
* testsuite/gas/arm/i8mm.d: New test.
* testsuite/gas/arm/bfloat17-cmdline-bad-3.d: Update test.

include/ChangeLog:

2019-11-07  Mihail Ionescu  <mihail.ionescu@arm.com>

* opcode/arm.h (ARM_EXT2_I8MM): New feature macro.

opcodes/ChangeLog:

2019-11-07  Mihail Ionescu  <mihail.ionescu@arm.com>

* arm-dis.c (neon_opcodes): Add i8mm SIMD instructions.

Regression tested on arm-none-eabi.
Is this ok for trunk?

Regards,
Mihail

4 years ago[binutils][aarch64] Matrix Multiply extension enablement [8/X]
Matthew Malcomson [Thu, 7 Nov 2019 17:10:01 +0000 (17:10 +0000)] 
[binutils][aarch64] Matrix Multiply extension enablement [8/X]

Hi,

This patch is part of a series that adds support for Armv8.6-A
(Matrix Multiply and BFloat16 extensions) to binutils.

This patch introduces the Matrix Multiply (Int8, F32, F64) extensions
to the aarch64 backend.

The following instructions are added: {s/u}mmla, usmmla, {us/su}dot,
fmmla, ld1rob, ld1roh, d1row, ld1rod, uzip{1/2}, trn{1/2}.

Committed on behalf of Mihail Ionescu.

gas/ChangeLog:

2019-11-07  Mihail Ionescu  <mihail.ionescu@arm.com>

* config/tc-aarch64.c: Add new arch fetures to suppport the mm extension.
(parse_operands): Add new operand.
* testsuite/gas/aarch64/i8mm.s: New test.
* testsuite/gas/aarch64/i8mm.d: New test.
* testsuite/gas/aarch64/f32mm.s: New test.
* testsuite/gas/aarch64/f32mm.d: New test.
* testsuite/gas/aarch64/f64mm.s: New test.
* testsuite/gas/aarch64/f64mm.d: New test.
* testsuite/gas/aarch64/sve-movprfx-mm.s: New test.
* testsuite/gas/aarch64/sve-movprfx-mm.d: New test.

include/ChangeLog:

2019-11-07  Mihail Ionescu  <mihail.ionescu@arm.com>

* opcode/aarch64.h (AARCH64_FEATURE_I8MM): New.
(AARCH64_FEATURE_F32MM): New.
(AARCH64_FEATURE_F64MM): New.
(AARCH64_OPND_SVE_ADDR_RI_S4x32): New.
(enum aarch64_insn_class): Add new instruction class "aarch64_misc" for
instructions that do not require special handling.

opcodes/ChangeLog:

2019-11-07  Mihail Ionescu  <mihail.ionescu@arm.com>

* aarch64-tbl.h (aarch64_feature_i8mm_sve, aarch64_feature_f32mm_sve,
aarch64_feature_f64mm_sve, aarch64_feature_i8mm, aarch64_feature_f32mm,
aarch64_feature_f64mm): New feature sets.
(INT8MATMUL_INSN, F64MATMUL_SVE_INSN, F64MATMUL_INSN,
F32MATMUL_SVE_INSN, F32MATMUL_INSN): New macros to define matrix multiply
instructions.
(I8MM_SVE, F32MM_SVE, F64MM_SVE, I8MM, F32MM, F64MM): New feature set
macros.
(QL_MMLA64, OP_SVE_SBB): New qualifiers.
(OP_SVE_QQQ): New qualifier.
(INT8MATMUL_SVE_INSNC, F64MATMUL_SVE_INSNC,
F32MATMUL_SVE_INSNC): New feature set for bfloat16 instructions to support
the movprfx constraint.
(aarch64_opcode_table): Support for SVE_ADDR_RI_S4x32.
(aarch64_opcode_table): Define new instructions smmla,
ummla, usmmla, usdot, sudot, fmmla, ld1rob, ld1roh, ld1row, ld1rod
uzip{1/2}, trn{1/2}.
* aarch64-opc.c (operand_general_constraint_met_p): Handle
AARCH64_OPND_SVE_ADDR_RI_S4x32.
(aarch64_print_operand): Handle AARCH64_OPND_SVE_ADDR_RI_S4x32.
* aarch64-dis-2.c (aarch64_opcode_lookup_1, aarch64_find_next_opcode):
Account for new instructions.
* opcodes/aarch64-asm-2.c (aarch64_insert_operand): Support the new
S4x32 operand.
* aarch64-opc-2.c (aarch64_operands): Support the new S4x32 operand.

Regression tested on arm-none-eabi.

Is it ok for trunk?

Regards,
Mihail

4 years ago[Patch][binutils][aarch64] .bfloat16 directive for AArch64 [7/10]
Matthew Malcomson [Thu, 7 Nov 2019 17:07:32 +0000 (17:07 +0000)] 
[Patch][binutils][aarch64] .bfloat16 directive for AArch64 [7/10]

Hi,

This patch is part of a series that adds support for Armv8.6-A
(Matrix Multiply and BFloat16 extensions) to binutils.

This patch implements the '.bfloat' directive for the AArch64 backend.

The syntax for the directive is:
  .bfloat16 <0-n numbers>
e.g.
  .bfloat16 12.0
  .bfloat16 0.123, 1.0, NaN, 5

This is implemented by utilizing the ieee_atof_detail function in order
to encode the slightly
different bfloat16 format.

Added testcases to verify the correct encoding for various bfloat16
values (NaN, Infinity (+ & -), normals, subnormals etc...).

Cross compiled and tested on aarch64-none-elf and aarch64-none-linux-gnu
with no issues.

Committed on behalf of Mihail Ionescu.

gas/ChangeLog:

2019-10-29  Mihail Ionescu  <mihail.ionescu@arm.com>
2019-10-29  Barnaby Wilks  <barnaby.wilks@arm.com>

* config/tc-aarch64.c (md_atof): Add encoding for the bfloat16 format.
* testsuite/gas/aarch64/bfloat16-directive-le.d: New test.
* testsuite/gas/aarch64/bfloat16-directive-be.d: New test.
* testsuite/gas/aarch64/bfloat16-directive.s: New test.

Is it ok for trunk?

Regards,
Mihail

4 years ago[Patch][binutils][arm] .bfloat16 directive for Arm [6/X]
Matthew Malcomson [Thu, 7 Nov 2019 17:03:54 +0000 (17:03 +0000)] 
[Patch][binutils][arm] .bfloat16 directive for Arm [6/X]

Hi,

This patch is part of a series that adds support for Armv8.6-A
(Matrix Multiply and BFloat16 extensions) to binutils.

This patch implements the '.bfloat16' directive for the Arm backend.

The syntax for the directive is:
  .bfloat16 <0-n numbers>
e.g.
  .bfloat16 12.0
  .bfloat16 0.123, 1.0, NaN, 5

This is implemented by utilizing the ieee_atof_detail function (included
in the previous patch) in order to encode the slightly different
bfloat16 format.

Added testcases to verify the correct encoding for various bfloat16
values (NaN, Infinity (+ & -), normals, subnormals etc...).

Cross compiled and tested on arm-none-eabi and arm-none-linux-gnueabihf
with no issues.

Committed on behalf of Mihail Ionescu.

gas/ChangeLog:

2019-10-21  Mihail Ionescu  <mihail.ionescu@arm.com>
2019-10-21  Barnaby Wilks  <barnaby.wilks@arm.com>

* config/tc-arm.c (md_atof): Add encoding for bfloat16
* testsuite/gas/arm/bfloat16-directive-le.d: New test.
* testsuite/gas/arm/bfloat16-directive-be.d: New test.
* testsuite/gas/arm/bfloat16-directive.s: New test.

Is it ok for trunk?

Regards,
Mihail

4 years ago[Patch][binutils] Generic support for parsing numbers in bfloat16 format [5/X]
Matthew Malcomson [Thu, 7 Nov 2019 17:01:04 +0000 (17:01 +0000)] 
[Patch][binutils] Generic support for parsing numbers in bfloat16 format [5/X]

Hi,

This patch is part of a series that adds support for Armv8.6-A
(Matrix Multiply and BFloat16 extensions).

This patch contains some general refactoring of the atof_ieee
function, exposing a function that allows a higher level of control
over the format of IEEE-like floating point numbers.
This has been done in order to be able to add a directive for assembling
floating point literals in the bfloat16 format in the following patches.

Committed on behalf of Mihail Ionescu.

Tested on arm-none-eabi, arm-none-linux-gnueabihf, aarch64-none-elf
and aarch64-none-linux-gnuwith no issues.

gas/ChangeLog:

2019-10-21  Mihail Ionescu  <mihail.ionescu@arm.com>
2019-10-21  Barnaby Wilks  <barnaby.wilks@arm.com>

* as.h (atof_ieee_detail): Add prototype for atof_ieee_detail function.
(atof_ieee): Move some code into the atof_ieee_detail function.
(atof_ieee_detail): Add function that provides a higher level of control over generating
IEEE-like numbers.

Is it ok for trunk?

Regards,
Mihail

4 years ago[binutils][arm] BFloat16 enablement [4/X]
Matthew Malcomson [Thu, 7 Nov 2019 16:56:12 +0000 (16:56 +0000)] 
[binutils][arm] BFloat16 enablement [4/X]

Hi,

This patch is part of a series that adds support for Armv8.6-A
(Matrix Multiply and BFloat16 extensions) to binutils.

This patch introduces BFloat16 instructions to the arm backend.
The following BFloat16 instructions are added: vdot, vfma{l/t},
vmmla, vfmal{t/b}, vcvt, vcvt{t/b}.

gas/ChangeLog:

2019-11-07  Mihail Ionescu  <mihail.ionescu@arm.com>
2019-11-07  Matthew Malcomson  <matthew.malcomson@arm.com>

* config/tc-arm.c (arm_archs): Add armv8.6-a option.
(cpu_arch_ver): Add TAG_CPU_ARCH_V8 tag for Armv8.6-a.
* doc/c-arm.texi (-march): New armv8.6-a arch.
* config/tc-arm.c (arm_ext_bf16): New feature set.
(enum neon_el_type): Add NT_bfloat value.
(B_MNEM_vfmat, B_MNEM_vfmab): New bfloat16 encoder
helpers.
(BAD_BF16): New message.
(parse_neon_type): Add bf16 type specifier.
(enum neon_type_mask): Add N_BF16 type.
(type_chk_of_el_type): Account for NT_bfloat.
(el_type_of_type_chk): Account for N_BF16.
(neon_three_args): Split out from neon_three_same.
(neon_three_same): Part split out into neon_three_args.
(CVT_FLAVOUR_VAR): Add bf16_f32 cvt flavour.
(do_neon_cvt_1): Account for vcvt.bf16.f32.
(do_bfloat_vmla): New.
(do_mve_vfma): New function to deal with the mnemonic clash between the BF16
vfmat and the MVE vfma in a VPT block with a 't'rue condition.
(do_neon_cvttb_1): Account for vcvt{t,b}.bf16.f32.
(do_vdot): New
(do_vmmla): New
(insns): Add vdot and vmmla mnemonics.
(arm_extensions): Add "bf16" extension.
* doc/c-arm.texi: Document "bf16" extension.
* testsuite/gas/arm/attr-march-armv8_6-a.d: New test.
* testsuite/gas/arm/bfloat16-bad.d: New test.
* testsuite/gas/arm/bfloat16-bad.l: New test.
* testsuite/gas/arm/bfloat16-bad.s: New test.
* testsuite/gas/arm/bfloat16-cmdline-bad-2.d: New test.
* testsuite/gas/arm/bfloat16-cmdline-bad-3.d: New test.
* testsuite/gas/arm/bfloat16-cmdline-bad.d: New test.
* testsuite/gas/arm/bfloat16-neon.s: New test.
* testsuite/gas/arm/bfloat16-non-neon.s: New test.
* testsuite/gas/arm/bfloat16-thumb-bad.d: New test.
* testsuite/gas/arm/bfloat16-thumb-bad.l: New test.
* testsuite/gas/arm/bfloat16-thumb.d: New test.
* testsuite/gas/arm/bfloat16-vfp.d: New test.
* testsuite/gas/arm/bfloat16.d: New test.
* testsuite/gas/arm/bfloat16.s: New test.

include/ChangeLog:

2019-11-07  Mihail Ionescu  <mihail.ionescu@arm.com>
2019-11-07  Matthew Malcomson  <matthew.malcomson@arm.com>

* opcode/arm.h (ARM_EXT2_V8_6A, ARM_AEXT2_V8_6A,
ARM_ARCH_V8_6A): New.
* opcode/arm.h (ARM_EXT2_BF16): New feature macro.
(ARM_AEXT2_V8_6A): Include above macro in definition.

opcodes/ChangeLog:

2019-11-07  Mihail Ionescu  <mihail.ionescu@arm.com>
2019-11-07  Matthew Malcomson  <matthew.malcomson@arm.com>

* arm-dis.c (select_arm_features): Update bfd_march_arm_8 with
Armv8.6-A.
(coprocessor_opcodes): Add bfloat16 vcvt{t,b}.
(neon_opcodes): Add bfloat SIMD instructions.
(print_insn_coprocessor): Add new control character %b to print
condition code without checking cp_num.
(print_insn_neon): Account for BFloat16 instructions that have no
special top-byte handling.

Regression tested on arm-none-eabi.

Is it ok for trunk?

Regards,
Mihail

4 years ago[Patch][binutils][arm] Create a new generic coprocessor array [3/10]
Matthew Malcomson [Thu, 7 Nov 2019 16:53:40 +0000 (16:53 +0000)] 
[Patch][binutils][arm] Create a new generic coprocessor array [3/10]

Hi,

This patch is part of a series that adds support for Armv8.6-A
(Matrix Multiply and BFloat16 extensions) to binutils.

Some generic instructions match a large range of encoding space (e.g.
stc, mcr, mrc).
Currently these instructions are in the coprocessor_opcodes array, which
means they are checked before many other instructions when disassembling
arm and thumb32 codes.

This patch moves the generic instructions into a separate array to be
checked later on.
This is done in order to avoid instruction conflict between the generic
instructions and newer ones -- this has already been seen with MVE, and
is also a problem with BFloat16.

One way to avoid the conflict could be to swap the search order between
coprocessor_opcodes and neon_opcodes.
We avoid this since it's a larger change that may introduce extra bugs
(that aren't caught by the testsuite).

We have decided against searching the generic array after searching the
arm specific and thumb32 specific arrays with a similar reasoning about
keeping the change small.

Regression tested with arm-none-linux-gnueabihf.

Committed on behalf of Mihail Ionescu.

opcodes/ChangeLog:

2019-10-29  Mihail Ionescu  <mihail.ionescu@arm.com>
2019-10-29  Matthew Malcomson  <matthew.malcomson@arm.com>

* arm-dis.c (print_insn_coprocessor,
print_insn_generic_coprocessor): Create wrapper functions around
the implementation of the print_insn_coprocessor control codes.
(print_insn_coprocessor_1): Original print_insn_coprocessor
function that now takes which array to look at as an argument.
(print_insn_arm): Use both print_insn_coprocessor and
print_insn_generic_coprocessor.
(print_insn_thumb32): As above.

Is it ok for trunk?

Regards,
Mihail

4 years ago[binutils][aarch64] Bfloat16 enablement [2/X]
Matthew Malcomson [Thu, 7 Nov 2019 16:38:59 +0000 (16:38 +0000)] 
[binutils][aarch64] Bfloat16 enablement [2/X]

Hi,

This patch is part of a series that adds support for Armv8.6-A
(Matrix Multiply and BFloat16 extensions) to binutils.

This patch introduces the following BFloat16 instructions to the
aarch64 backend: bfdot, bfmmla, bfcvt, bfcvtnt, bfmlal[t/b],
bfcvtn2.

Committed on behalf of Mihail Ionescu.

gas/ChangeLog:

2019-11-07  Mihail Ionescu  <mihail.ionescu@arm.com>
2019-11-07  Matthew Malcomson  <matthew.malcomson@arm.com>

* config/tc-aarch64.c (vectype_to_qualifier): Special case the
S_2H operand qualifier.
* doc/c-aarch64.texi: Document bf16 and bf16mmla4 extensions.
* testsuite/gas/aarch64/bfloat16.d: New test.
* testsuite/gas/aarch64/bfloat16.s: New test.
* testsuite/gas/aarch64/illegal-bfloat16.d: New test.
* testsuite/gas/aarch64/illegal-bfloat16.l: New test.
* testsuite/gas/aarch64/illegal-bfloat16.s: New test.
* testsuite/gas/aarch64/sve-bfloat-movprfx.s: New test.
* testsuite/gas/aarch64/sve-bfloat-movprfx.d: New test.

include/ChangeLog:

2019-11-07  Mihail Ionescu  <mihail.ionescu@arm.com>
2019-11-07  Matthew Malcomson  <matthew.malcomson@arm.com>

* opcode/aarch64.h (AARCH64_FEATURE_BFLOAT16): New feature macros.
(AARCH64_ARCH_V8_6): Include BFloat16 feature macros.
(enum aarch64_opnd_qualifier): Introduce new operand qualifier
AARCH64_OPND_QLF_S_2H.
(enum aarch64_insn_class): Introduce new class "bfloat16".
(BFLOAT16_SVE_INSNC): New feature set for bfloat16
instructions to support the movprfx constraint.

opcodes/ChangeLog:

2019-11-07  Mihail Ionescu  <mihail.ionescu@arm.com>
2019-11-07  Matthew Malcomson  <matthew.malcomson@arm.com>

* aarch64-asm.c (aarch64_ins_reglane): Use AARCH64_OPND_QLF_S_2H
in reglane special case.
* aarch64-dis-2.c (aarch64_opcode_lookup_1,
aarch64_find_next_opcode): Account for new instructions.
* aarch64-dis.c (aarch64_ext_reglane): Use AARCH64_OPND_QLF_S_2H
in reglane special case.
* aarch64-opc.c (struct operand_qualifier_data): Add data for
new AARCH64_OPND_QLF_S_2H qualifier.
* aarch64-tbl.h (QL_BFDOT QL_BFDOT64, QL_BFDOT64I, QL_BFMMLA2,
QL_BFCVT64, QL_BFCVTN64, QL_BFCVTN2_64): New qualifiers.
(aarch64_feature_bfloat16, aarch64_feature_bfloat16_sve,
aarch64_feature_bfloat16_bfmmla4): New feature sets.
(BFLOAT_SVE, BFLOAT): New feature set macros.
(BFLOAT_SVE_INSN, BFLOAT_BFMMLA4_INSN, BFLOAT_INSN): New macros
to define BFloat16 instructions.
(aarch64_opcode_table): Define new instructions bfdot,
bfmmla, bfcvt, bfcvtnt, bfdot, bfdot, bfcvtn, bfmlal[b/t]
bfcvtn2, bfcvt.

Regression tested on aarch64-elf.

Is it ok for trunk?

Regards,
Mihail

4 years ago[gas][aarch64] Armv8.6-a option [1/X]
Matthew Malcomson [Thu, 7 Nov 2019 16:18:51 +0000 (16:18 +0000)] 
[gas][aarch64] Armv8.6-a option [1/X]

Hi,

This patch is part of a series that adds support for Armv8.6-A
to binutils.
This first patch adds the Armv8.6-A flag to binutils.
No instructions are behind it at the moment.

Commited on behalf of Mihail Ionescu.

gas/ChangeLog:

2019-11-07  Mihail Ionescu  <mihail.ionescu@arm.com>
2019-11-07  Matthew Malcomson  <matthew.malcomson@arm.com>

* config/tc-aarch64.c (armv8.6-a): New arch.
* doc/c-aarch64.texi (armv8.6-a): Document new arch.

include/ChangeLog:

2019-11-07  Mihail Ionescu  <mihail.ionescu@arm.com>
2019-11-07  Matthew Malcomson  <matthew.malcomson@arm.com>

* opcode/aarch64.h (AARCH64_FEATURE_V8_6): New.
(AARCH64_ARCH_V8_6): New.

opcodes/ChangeLog:

2019-11-07  Mihail Ionescu  <mihail.ionescu@arm.com>
2019-11-07  Matthew Malcomson  <matthew.malcomson@arm.com>

* aarch64-tbl.h (ARMV8_6): New macro.

Is it ok for trunk?

Regards,
Mihail

4 years agoAllow the --output option of the "ar" prorgam to extract files to locations outside...
Nick Clifton [Thu, 7 Nov 2019 11:56:54 +0000 (11:56 +0000)] 
Allow the --output option of the "ar" prorgam to extract files to locations outside of the current directory.

* ar.c (open_output_file): Check for filename validity before
prefixing with output directory.
Display the constructed output filename if in verbose mode.
(extract_file): Let open_output_file display the filename.

4 years agoFix bug merging notes with objcopy when no merging results in zeroes being written...
Nick Clifton [Thu, 7 Nov 2019 11:36:06 +0000 (11:36 +0000)] 
Fix bug merging notes with objcopy when no merging results in zeroes being written back into the note section.

* objcopy.c (copy_object): Skip note sections that do not have
an output section.  Always copy note sections, even if no
changes are made.

4 years ago[gdb/contrib] Add words.sh script
Tom de Vries [Thu, 7 Nov 2019 09:49:56 +0000 (10:49 +0100)] 
[gdb/contrib] Add words.sh script

Add a script that takes a list of files as arguments and output a list of
words from the C comments with their frequencies.

For:
...
$ ./gdb/contrib/words.sh $(find gdb -type f -name "*.c" -o -name "*.h")
...
it generates a list of ~15000 words prefixed with frequency.

This could be used to generate a dictionary that is kept as part of the
sources, against which new code can be checked, generating a warning or
error.  The hope is that misspellings would trigger this frequently, and rare
words rarely, otherwise the burden of updating the dictionary would be too
much.

And for:
...
$ ./gdb/contrib/words.sh -f 1 $(find gdb -type f -name "*.c" -o -name "*.h")
...
it generates a list of ~5000 words with frequency 1.

This can be used to scan for misspellings manually.

Change-Id: I7b119c9a4519cdbf62a3243d1df2927c80813e8b

4 years agoRemove CR16C support
Alan Modra [Thu, 7 Nov 2019 03:02:16 +0000 (13:32 +1030)] 
Remove CR16C support

I think it is past time to remove CR16C support.  CR16C was added in
2004, and only for ld.  gas and binutils support is lacking, and there
have been no commits to bfd/elf32-cr16c.c other than warning fixes or
global maintainers making changes to all targets.  I see no maintainer
listed for CR16C, and no commits from anyone at NSC supporting the
target.  Furthermore, at the time the CR16 support was added in 2007,
config.sub was changed upstream to no longer recognise cr16c as a
valid cpu.  That means the CR16C ld support is only available as a
secondary target by configuring with, for example,
--enable-targets=all or --enable-targets=cr16c-unknown-elf.  No
testing of the CR16C target is possible.

include/
* elf/cr16c.h: Delete.
bfd/
* cpu-cr16c.c: Delete.
* elf32-cr16c.c: Delete.
* Makefile.am,
* archures.c,
* config.bfd,
* configure.ac,
* reloc.c,
* targets.c: Remove cr16c support.
* Makefile.in,
* bfd-in2.h,
* configure,
* libbfd.h,
* po/SRC-POTFILES.in: Regenerate.
ld/
* emulparams/elf32cr16c.sh: Delete.
* scripttempl/elf32cr16c.sc: Delete.
* Makefile.am,
* configure.tgt: Remove cr16c support.
* NEWS: Mention removal of cr16c.
* Makefile.in,
* po/BLD-POTFILES.in: Regenerate.

4 years agoOrder targets in ld/configure.tgt
Alan Modra [Wed, 6 Nov 2019 07:20:27 +0000 (17:50 +1030)] 
Order targets in ld/configure.tgt

The target list was supposed to be more or less alphabetically sorted,
but this wasn't anywhere near the case.  The comment about keeping
architecture variants together seems odd to me, and is no doubt the
reason why ix86 and x86_64 were grouped together, so I removed that
comment.  The patch doesn't change order of entries for a given cpu.

* configure.tgt: Order targets by cpu.

4 years agox86: support further AMD Zen2 instructions
Jan Beulich [Thu, 7 Nov 2019 08:29:14 +0000 (09:29 +0100)] 
x86: support further AMD Zen2 instructions

Both RDPRU and MCOMMIT have been publicly documented meanwhile:
https://www.amd.com/system/files/TechDocs/24594.pdf.

4 years agox86: adjust register names printed for MONITOR/MWAIT
Jan Beulich [Thu, 7 Nov 2019 08:28:20 +0000 (09:28 +0100)] 
x86: adjust register names printed for MONITOR/MWAIT

As the comments (here: almost, in the opcode table: fully) correctly
state - all register operands except MONITOR's address one are fixed
at 32 bit size. Don't print 64-bit registers there.

Also adjust x86-64-suffix.d's name such that it wouldn't be identical to
x86-64-rep-suffix.d's, but instead resemble that of its sibling
x86-64-suffix-intel.d.

4 years agox86/Intel: drop IgnoreSize from operand-less MOVSD/CMPSD again
Jan Beulich [Thu, 7 Nov 2019 08:27:16 +0000 (09:27 +0100)] 
x86/Intel: drop IgnoreSize from operand-less MOVSD/CMPSD again

These were mistakenly added by d241b91073 ("x86/Intel: correct MOVSD and
CMPSD handling"). This addresses part of PR/gas 25167.

4 years agoaarch64 and arm testsuite fixes for targets lacking shared libs
Alan Modra [Thu, 7 Nov 2019 00:30:26 +0000 (11:00 +1030)] 
aarch64 and arm testsuite fixes for targets lacking shared libs

* testsuite/ld-aarch64/aarch64-elf.exp: Run tests requiring pie
or shared library support only when check_shared_lib_support.
* testsuite/ld-aarch64/bti-pac-plt-1.d: Likewise.
* testsuite/ld-aarch64/bti-pac-plt-2.d: Likewise.
* testsuite/ld-aarch64/bti-plt-1.d: Likewise.
* testsuite/ld-aarch64/bti-plt-2.d: Likewise.
* testsuite/ld-aarch64/bti-plt-3.d: Likewise.
* testsuite/ld-aarch64/bti-plt-4.d: Likewise.
* testsuite/ld-aarch64/bti-plt-6.d: Likewise.
* testsuite/ld-aarch64/bti-plt-7.d: Likewise.
* testsuite/ld-aarch64/bti-warn.d: Likewise.
* testsuite/ld-aarch64/dt_textrel.d: Likewise.
* testsuite/ld-aarch64/emit-relocs-258-dyn-bad.d: Likewise.
* testsuite/ld-aarch64/emit-relocs-259-dyn-bad.d: Likewise.
* testsuite/ld-aarch64/emit-relocs-264-bad.d: Likewise.
* testsuite/ld-aarch64/emit-relocs-266-bad.d: Likewise.
* testsuite/ld-aarch64/emit-relocs-268-bad.d: Likewise.
* testsuite/ld-aarch64/emit-relocs-269-bad.d: Likewise.
* testsuite/ld-aarch64/emit-relocs-515-be.d: Likewise.
* testsuite/ld-aarch64/emit-relocs-515.d: Likewise.
* testsuite/ld-aarch64/emit-relocs-516-be.d: Likewise.
* testsuite/ld-aarch64/emit-relocs-516.d: Likewise.
* testsuite/ld-aarch64/farcall-b-plt.d: Likewise.
* testsuite/ld-aarch64/farcall-bl-plt.d: Likewise.
* testsuite/ld-aarch64/gc-plt-relocs.d: Likewise.
* testsuite/ld-aarch64/gc-relocs-257-dyn.d: Likewise.
* testsuite/ld-aarch64/ifunc-1-local.d: Likewise.
* testsuite/ld-aarch64/ifunc-1.d: Likewise.
* testsuite/ld-aarch64/ifunc-12.d: Likewise.
* testsuite/ld-aarch64/ifunc-13.d: Likewise.
* testsuite/ld-aarch64/ifunc-14a.d: Likewise.
* testsuite/ld-aarch64/ifunc-14b.d: Likewise.
* testsuite/ld-aarch64/ifunc-14c.d: Likewise.
* testsuite/ld-aarch64/ifunc-14d.d: Likewise.
* testsuite/ld-aarch64/ifunc-14e.d: Likewise.
* testsuite/ld-aarch64/ifunc-14f.d: Likewise.
* testsuite/ld-aarch64/ifunc-15.d: Likewise.
* testsuite/ld-aarch64/ifunc-16.d: Likewise.
* testsuite/ld-aarch64/ifunc-18a.d: Likewise.
* testsuite/ld-aarch64/ifunc-18b.d: Likewise.
* testsuite/ld-aarch64/ifunc-19a.d: Likewise.
* testsuite/ld-aarch64/ifunc-19b.d: Likewise.
* testsuite/ld-aarch64/ifunc-2-local.d: Likewise.
* testsuite/ld-aarch64/ifunc-2.d: Likewise.
* testsuite/ld-aarch64/ifunc-20.d: Likewise.
* testsuite/ld-aarch64/ifunc-21.d: Likewise.
* testsuite/ld-aarch64/ifunc-3a.d: Likewise.
* testsuite/ld-aarch64/ifunc-3b.d: Likewise.
* testsuite/ld-aarch64/ifunc-5b-local.d: Likewise.
* testsuite/ld-aarch64/ifunc-5b.d: Likewise.
* testsuite/ld-aarch64/ifunc-6b.d: Likewise.
* testsuite/ld-aarch64/ifunc-7b.d: Likewise.
* testsuite/ld-aarch64/ifunc-7c.d: Likewise.
* testsuite/ld-aarch64/pac-plt-1.d: Likewise.
* testsuite/ld-aarch64/pac-plt-2.d: Likewise.
* testsuite/ld-aarch64/pcrel_pic_defined.d: Likewise.
* testsuite/ld-aarch64/pcrel_pic_undefined.d: Likewise.
* testsuite/ld-aarch64/pie-bind-locally.d: Likewise.
* testsuite/ld-aarch64/plt_mapping_symbol.d: Likewise.
* testsuite/ld-aarch64/pr20402.d: Likewise.
* testsuite/ld-aarch64/pr22764.d: Likewise.
* testsuite/ld-aarch64/property-bti-pac1.d: Likewise.
* testsuite/ld-aarch64/protected-data.d: Likewise.
* testsuite/ld-aarch64/rela-abs-relative-be.d: Likewise.
* testsuite/ld-aarch64/rela-abs-relative-opt.d: Likewise.
* testsuite/ld-aarch64/rela-abs-relative.d: Likewise.
* testsuite/ld-aarch64/relasz.d: Likewise.
* testsuite/ld-aarch64/relocs-1027-symbolic-func.d: Likewise.
* testsuite/ld-aarch64/tls-desc-ie-ilp32.d: Likewise.
* testsuite/ld-aarch64/tls-desc-ie.d: Likewise.
* testsuite/ld-aarch64/tls-large-desc-be.d: Likewise.
* testsuite/ld-aarch64/tls-large-desc.d: Likewise.
* testsuite/ld-aarch64/tls-large-ie-be.d: Likewise.
* testsuite/ld-aarch64/tls-large-ie.d: Likewise.
* testsuite/ld-aarch64/tls-relax-gdesc-le-now.d: Likewise.
* testsuite/ld-aarch64/tls-small-ld.d: Likewise.
* testsuite/ld-aarch64/tls-tiny-desc.d: Likewise.
* testsuite/ld-aarch64/tls-tiny-gd.d: Likewise.
* testsuite/ld-aarch64/tls-tiny-ie.d: Likewise.
* testsuite/ld-aarch64/tls-tiny-ld.d: Likewise.
* testsuite/ld-aarch64/tlsle-symbol-offset.d: Likewise.
* testsuite/ld-aarch64/tlsle.d: Likewise.
* testsuite/ld-aarch64/variant_pcs-now.d: Likewise.
* testsuite/ld-aarch64/variant_pcs-shared.d: Likewise.
* testsuite/ld-arm/arm-elf.exp: Likewise.  Remove --hash-style=sysv
from static tests.  Consolidate armelftests_common_* vars into one.
* testsuite/ld-arm/gc-hidden-1.d: Require check_shared_lib_support.
* testsuite/ld-arm/movw-shared-1.d: Likewise.
* testsuite/ld-arm/movw-shared-2.d: Likewise.
* testsuite/ld-arm/movw-shared-3.d: Likewise.
* testsuite/ld-arm/movw-shared-4.d: Likewise.
* testsuite/ld-arm/pie-bind-locally.d: Likewise.
* testsuite/ld-arm/protected-data.d: Likewise.
* testsuite/ld-arm/rel32-reject-pie.d: Likewise.
* testsuite/ld-arm/rel32-reject.d: Likewise.
* testsuite/ld-arm/thumb2-bl-undefweak.d: Likewise.
* testsuite/ld-arm/thumb2-bl-undefweak1.d: Likewise.

4 years agoAutomatic date update in version.in
GDB Administrator [Thu, 7 Nov 2019 00:00:32 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoUse strtok_r instead of strtok
Christian Biesinger [Sat, 2 Nov 2019 17:09:31 +0000 (12:09 -0500)] 
Use strtok_r instead of strtok

Improves threadsafety. This will be important when the patch series at
https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/176
lands.

gdb/ChangeLog:

2019-11-06  Christian Biesinger  <cbiesinger@google.com>

* linux-tdep.c (linux_info_proc): Use strtok_r instead of strtok.
* mi/mi-main.c (output_cores): Likewise.
* nat/linux-osdata.c (linux_xfer_osdata_cpus): Likewise.
(linux_xfer_osdata_modules): Likewise.
* remote.c (register_remote_support_xml): Likewise.
* sparc64-tdep.c (adi_is_addr_mapped): Likewise.
* xml-syscall.c (syscall_create_syscall_desc): Likewise.

gdb/gdbserver/ChangeLog:

2019-11-06  Christian Biesinger  <cbiesinger@google.com>

* linux-x86-low.c (x86_linux_process_qsupported): Use strtok_r
instead of strtok.
* server.c (handle_query): Likewise.
(captured_main): Likewise.

Change-Id: Ief6138965a24398e5fc064598cd8f2abd3b5047c

4 years agoRegenerate gnulib files
Christian Biesinger [Wed, 6 Nov 2019 18:24:04 +0000 (12:24 -0600)] 
Regenerate gnulib files

It looks like autoheader and automake weren't run for commit
73cc72729a184f00bf6fc4d74684a8516ba6b683.

Note, it looks like the installed gettext version affects the
generated output here, I used 0.19.8.1 to get no diff.

gnulib/ChangeLog:

2019-11-06  Christian Biesinger  <cbiesinger@google.com>

* config.in: Regenerate.
* import/Makefile.in: Regenerate.

Change-Id: Iadd43023713a77921b0f850184a19afb1517be02

4 years agoRemove some includes of readline.h
Tom Tromey [Sun, 27 Oct 2019 21:50:54 +0000 (15:50 -0600)] 
Remove some includes of readline.h

I went through most of the spots that include readline.h and, when
appropriate, either removed the include or changed it to include
tilde.h.

Note that remote-sim.c and bsd-kvm.c could probably include tilde.h
instead, but I did not change these.  I think I can't build the
latter, and I didn't want to set up a sim build for the former.

Tested by rebuilding.

gdb/ChangeLog
2019-11-06  Tom Tromey  <tom@tromey.com>

* tui/tui-interp.c: Don't include readline.h.
* tui/tui-hooks.c: Don't include readline.h.
* symmisc.c: Include tilde.h, not readline.h.
* symfile.c: Include tilde.h, not readline.h.
* source.c: Include tilde.h, not readline.h.
* solib.c: Include tilde.h, not readline.h.
* psymtab.c: Include tilde.h, not readline.h.
* exec.c: Include tilde.h, not readline.h.
* corelow.c: Include tilde.h, not readline.h.
* cli/cli-dump.c: Include tilde.h, not readline.h.
* cli/cli-cmds.c: Don't include readline.h.

Change-Id: I60487a190c43128b800ef77517d1ab42957571d7

4 years agoFix an off-by-one error in the IN_RANGE macro used by readelf. Add another use of...
Christian Eggers [Wed, 6 Nov 2019 12:29:23 +0000 (12:29 +0000)] 
Fix an off-by-one error in the IN_RANGE macro used by readelf.  Add another use of the macro.

* readelf.c (IN_RANGE): Rename parameter OFF to NELEM. Add
comment.  Catch potential integer overflow and fix off by one
error whilst checking reloc location against section size.
(apply_relocations): Use IN_RANGE macro.

4 years agold: Fix printed sizes in map file
Christian Eggers [Mon, 4 Nov 2019 07:34:54 +0000 (08:34 +0100)] 
ld: Fix printed sizes in map file

For targets with octets_per_byte > 1, testsuite/ld-scripts/rgn-over*
produce wrong sizes in the generated map files:

.text           0x0000000000001000        0x6
                                          ^^^ # correct
 *(.txt)
 .txt           0x0000000000001000        0xc tmpdir/rgn-over.o
                                          ^^^ # should also be 0x6

* ldlang.c (print_input_section): Shift printed size by opb_shift.

4 years agoFix regression from TUI disassembly style patch
Tom Tromey [Wed, 6 Nov 2019 01:12:49 +0000 (18:12 -0700)] 
Fix regression from TUI disassembly style patch

My previous patch to add styling to the TUI disassembly failed to
correctly fix a bug that Simon had pointed out in review.  This patch
fixes the bug.

gdb/ChangeLog
2019-11-05  Tom Tromey  <tom@tromey.com>

* tui/tui-disasm.c (struct tui_asm_line) <addr_size>: New member.
(tui_disassemble): Set addr_size.
(tui_disasm_window::set_contents): Use addr_size.

Change-Id: Ic0152f3b82a2f79be28ae46d590096661f271580

4 years agoAutomatic date update in version.in
GDB Administrator [Wed, 6 Nov 2019 00:00:41 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoRemove la_get_string member
Tom Tromey [Thu, 3 Oct 2019 22:59:17 +0000 (16:59 -0600)] 
Remove la_get_string member

The la_get_string member of struct language_defn was intended to
provide a way to fetch string data from a "string" object in a
language-dependent way.  However, it turned out that this was never
needed, and was only ever implemented for C.  This patch removes the
language hook entirely.

gdb/ChangeLog
2019-11-05  Tom Tromey  <tom@tromey.com>

* rust-lang.c (rust_language_defn): Update.
* python/py-value.c (valpy_string): Call c_get_string.
* p-lang.c (pascal_language_defn): Update.
* opencl-lang.c (opencl_language_defn): Update.
* objc-lang.c (objc_language_defn): Update.
* m2-lang.c (m2_language_defn): Update.
* language.c (unknown_language_defn, auto_language_defn): Update.
(default_get_string): Remove.
* guile/scm-value.c (gdbscm_value_to_string): Use c_get_string.
* go-lang.c (go_language_defn): Update.
* f-lang.c (f_language_defn): Update.
* d-lang.c (d_language_defn): Update.
* c-lang.c (c_language_defn, cplus_language_defn)
(asm_language_defn, minimal_language_defn): Update.
* ada-lang.c (ada_language_defn): Update.
* language.h (struct language_defn) <la_get_string>: Remove.
(LA_GET_STRING): Remove.
(default_get_string): Don't declare.

Change-Id: Ia97763dfe34dc8ecb46587f7a651f8af9be8fdbd

4 years agoStyle disassembly in the TUI
Tom Tromey [Mon, 21 Oct 2019 17:21:14 +0000 (11:21 -0600)] 
Style disassembly in the TUI

This patch changes the TUI disassembly window to style its contents.
The styling should be identical to what is seen in the CLI.  This
involved a bit of rearrangement, so that the source and disassembly
windows could share both the copy_source_line utility function, and
the ability to react to changes in "set style enabled".

This version introduces a new function to strip the styling from the
address string when computing the length.  As a byproduct, it also
removes the unused "insn_size" computation from
tui_disasm_window::set_contents.

gdb/ChangeLog
2019-11-05  Tom Tromey  <tom@tromey.com>

* tui/tui-source.h (struct tui_source_window): Inline
constructor.  Remove destructor.
<style_changed, m_observable>: Move to superclass.
* tui/tui-winsource.h (tui_copy_source_line): Declare.
(struct tui_source_window_base): Move private members to end.
<style_changed, m_observable>: Move from tui_source_window.
* tui/tui-winsource.c (tui_copy_source_line): Move from
tui-source.c.  Rename from copy_source_line.  Add special handling
for negative line number.
(tui_source_window_base::style_changed): Move from
tui_source_window.
(tui_source_window_base): Register observer.
(~tui_source_window_base): New.
* tui/tui-source.c (copy_source_line): Move to tui-winsource.c;
rename.
(tui_source_window::set_contents): Use tui_copy_source_line.
(tui_source_window::tui_source_window): Move to tui-source.h.
(tui_source_window::~tui_source_window): Remove.
(tui_source_window::style_changed): Move to superclass.
* tui/tui-disasm.c (tui_disassemble): Create string file with
styling, when possible.  Add "addr_size" parameter.
(tui_disasm_window::set_contents): Use tui_copy_source_line.
Don't compute maximum size.
(len_without_escapes): New function

Change-Id: I8722635eeecbbb1633d943a65b856404c2d467b0

4 years agoChange tui_source_element::line to have type std::string
Tom Tromey [Mon, 21 Oct 2019 16:58:08 +0000 (10:58 -0600)] 
Change tui_source_element::line to have type std::string

This changes tui_source_element::line to be of type std::string.  This
reduces the number of copies made.

gdb/ChangeLog
2019-11-05  Tom Tromey  <tom@tromey.com>

* tui/tui-winsource.h (struct tui_source_element) <line>: Now a
std::string.
* tui/tui-winsource.c (tui_show_source_line): Update.
* tui/tui-source.c (tui_source_window::set_contents): Update.
* tui/tui-disasm.c (tui_disasm_window::set_contents): Update.

Change-Id: Id600f3e1d386a2911f187366e05e2ec599068dd2

4 years agoFix ARI warning in symtab.h
Christian Biesinger [Tue, 5 Nov 2019 20:52:59 +0000 (14:52 -0600)] 
Fix ARI warning in symtab.h

gdb/ChangeLog:

2019-11-05  Christian Biesinger  <cbiesinger@google.com>

* symtab.h (gdb_static_assert): Put && operator at the beginning
of the line instead of the end.

Change-Id: I6d05c2f5e46c3f317ba97458509b2da9fd03464b

4 years agoFix memory allocation and release problems in the bfd documentation processor.
Tim R?hsen [Tue, 5 Nov 2019 16:03:07 +0000 (16:03 +0000)] 
Fix memory allocation and release problems in the bfd documentation processor.

* doc/chew.c (add_to_definition): Use correct type when
calculating size of array reallocation.
(nextword): Always initialise the word return parameter.
(compile): Check return value of nextword().

4 years agox86: fold OP_Mwaitx() into OP_Mwait()
Jan Beulich [Tue, 5 Nov 2019 08:19:50 +0000 (09:19 +0100)] 
x86: fold OP_Mwaitx() into OP_Mwait()

There's no need to have separate functions, the difference can easily be
expressed using the function arguments.

4 years agox86: split MONITORX/MWAITX entries
Jan Beulich [Tue, 5 Nov 2019 08:19:10 +0000 (09:19 +0100)] 
x86: split MONITORX/MWAITX entries

Both encodings do not ignore the 66/F3/F2 prefixes, so don't have the
disassembler ignore them either.

4 years agox86: consolidate disassembler enum naming a little
Jan Beulich [Tue, 5 Nov 2019 08:18:23 +0000 (09:18 +0100)] 
x86: consolidate disassembler enum naming a little

The original idea looks to have been for names to be composed in the
order that decoding gets done, which helps both reading and modifying
the code. Switch (back) to this model for some of the affected non-
vector insn enumerators.

4 years agoGENERATE_SHLIB_SCRIPT vs. EMBEDDED.
Alan Modra [Fri, 1 Nov 2019 03:15:25 +0000 (13:45 +1030)] 
GENERATE_SHLIB_SCRIPT vs. EMBEDDED.

A target that sets EMBEDDED non-empty is one that doesn't want to put
the ELF file header or program header in a memory image.  Likely the
target isn't interested in supporting dynamically loaded executables,
shared libraries, or PIEs, because loaders for such binaries generally
require program headers to be present.  This isn't 100% true though.
The target might be one where the loader accesses the file system in
order to retrieve headers.

Also, note that not all "shared libraries" require gcc -shared or the
shared library support in the linker.  I believe one implementation of
shared libraries on uclinux is like this.

So, this patch removes GENERATE_SHLIB_SCRIPT and GENERATE_PIE_SCRIPT
in most emulparams files where EMBEDDED is set, restoring the shared
lib and pie support in emulparams files that unset EMBEDDED after
including a file where the support is removed.

Exceptions to the general rule that EMBEDDED disables shared libs are:
  arm*-*-symbianelf*, where the OS wants shared library support
  without ELF program headers in the image, and

  sh*-*-uclinux*, where I've left things as they were, ie. both
  EMBEDDED and GENERATE_SHLIB_SCRIPT because I'm unsure as to the
  shared library scheme.

* emulparams/aarch64elf.sh (GENERATE_SHLIB_SCRIPT),
(GENERATE_PIE_SCRIPT): Don't set.
* emulparams/aarch64elf32.sh (GENERATE_SHLIB_SCRIPT),
(GENERATE_PIE_SCRIPT): Don't set.
* emulparams/arcelf.sh (GENERATE_SHLIB_SCRIPT): Don't set.
* emulparams/armelf.sh (GENERATE_SHLIB_SCRIPT),
(GENERATE_PIE_SCRIPT): Don't set.
* emulparams/armelf_fbsd.sh (GENERATE_SHLIB_SCRIPT): Set.
* emulparams/armelf_nbsd.sh (GENERATE_SHLIB_SCRIPT),
(GENERATE_PIE_SCRIPT): Set.
* emulparams/armelf_vxworks.sh (GENERATE_SHLIB_SCRIPT): Set.
* emulparams/armsymbian.sh (GENERATE_SHLIB_SCRIPT): Set.
* emulparams/elf32bfin.sh (GENERATE_SHLIB_SCRIPT): Don't set.
* emulparams/elf32microblaze.sh (GENERATE_SHLIB_SCRIPT): Don't set.
* emulparams/score3_elf.sh (GENERATE_SHLIB_SCRIPT): Don't set.
* emulparams/shelf.sh (GENERATE_SHLIB_SCRIPT): Don't set.
* emulparams/shelf_nbsd.sh (GENERATE_SHLIB_SCRIPT),
(GENERATE_PIE_SCRIPT): Set.
* emulparams/shelf_uclinux.sh (GENERATE_SHLIB_SCRIPT): Set.

4 years agoUnset EMBEDDED rather than assigning as empty
Alan Modra [Fri, 1 Nov 2019 03:11:50 +0000 (13:41 +1030)] 
Unset EMBEDDED rather than assigning as empty

No real changes here, just making it that much easier to find targets
that set EMBEDDED to a non-empty string.

* emulparams/elf32bfinfd.sh: Unset EMBEDDED rather assigning as empty.
* emulparams/elf32frvfd.sh: Likewise.
* emulparams/elf32lm32fd.sh: Likewise.
* emulparams/i386lynx.sh: Likewise.

4 years agoAutomatic date update in version.in
GDB Administrator [Tue, 5 Nov 2019 00:00:18 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoAdd static_asserts for the sizes of space-critical structs
Christian Biesinger [Fri, 25 Oct 2019 18:40:27 +0000 (13:40 -0500)] 
Add static_asserts for the sizes of space-critical structs

Specifically the three structs mentioned in symtab.h:
- general_symbol_info
- symbol
- partial_symbol

This ensures that those structs won't accidentally get bigger.

gdb/ChangeLog:

2019-11-04  Christian Biesinger  <cbiesinger@google.com>

* psympriv.h: Add static_asserts for sizeof (general_symbol_info)
and sizeof (symbol).
* symtab.h: Add a static_assert for sizeof (partial_symbol).

Change-Id: Idd68320aa3e79ee7cc749019724636a58ce4b9c6

4 years agoObsolete Solaris 10 support
Rainer Orth [Mon, 4 Nov 2019 17:13:14 +0000 (18:13 +0100)] 
Obsolete Solaris 10 support

Here's the patch corresponding to the Solaris 10 obsoletion announcement

https://sourceware.org/ml/gdb/2019-10/msg00008.html

Right now it doesn't remove any code, but obviates the need to test on
that ancient platform.  Besides, some of the patches I have in my queue
would require different solutions for Solaris 10 and 11.

There are a few comment-only references that I've kept since they are
still correct as is, even when GDB doesn't support Solaris 10 any
longer.  The only code fragment I've left in is support for
/proc/<pid/path/a.out in procfs.c (procfs_target::pid_to_exec_file):
while current Solaris 11 updates provide /proc/<pid>/execname, that
wasn't present in Solaris 11.0 and still isn't in current Illumos and I
didn't want to make live harder for them.

Tested on i386-pc-solaris2.10 (obsolete configuration rejected) and
x86_64-pc-linux-gnu x sparc64-solaris2.10 (likewise)
resp. x86_64-pc-linux-gnu x sparcv9-solaris2.11 (still builds; I'm using
the sparcv9 form for 64-bit SPARC customary on Solaris in the
MAINTAINERS file now).

* NEWS (Changes since GDB 8.3): Document Solaris 10 removal.
* configure.host: Mark *-*-solaris2.10* obsolete.
* configure.tgt: Mark Solaris < 11 obsolete.
* MAINTAINERS (Target Instruction Set Architectures) <sparc>:
Update target triplet.

4 years agox86: re-arrange process_operands()
Jan Beulich [Mon, 4 Nov 2019 14:48:38 +0000 (15:48 +0100)] 
x86: re-arrange process_operands()

Alter the sequence of conditions evaluated, without affecting the
overall result. This is going to help subsequent changes (and as a nice
side effect also slightly reduces overall indentation depth).

While doing this take the liberty of simplifying the calculation of the
operand index of the register operand in ShortForm handling.

4 years agoFix potential array overruns when disassembling corrupt v850 binaries.
Nick Clifton [Mon, 4 Nov 2019 12:02:20 +0000 (12:02 +0000)] 
Fix potential array overruns when disassembling corrupt v850 binaries.

* v850-dis.c (get_v850_sreg_name): New function.  Returns the name
of a v850 system register.  Move the v850_sreg_names array into
this function.
(get_v850_reg_name): Likewise for ordinary register names.
(get_v850_vreg_name): Likewise for vector register names.
(get_v850_cc_name): Likewise for condition codes.
* get_v850_float_cc_name): Likewise for floating point condition
codes.
(get_v850_cacheop_name): Likewise for cache-ops.
(get_v850_prefop_name): Likewise for pref-ops.
(disassemble): Use the new accessor functions.

4 years agoImplement objcopy/strip --keep-section=<sectionpattern>
Fāng-ruì Sòng [Fri, 1 Nov 2019 21:47:55 +0000 (14:47 -0700)] 
Implement objcopy/strip --keep-section=<sectionpattern>

llvm-objcopy and llvm-strip support an option --keep-section that
keeps some sections from being removed.

* objcopy.c (enum option_values): Add OPTION_KEEP_SECTION.
(SECTION_CONTEXT_KEEP): Define.  Adjust other SECTION_CONTEXT macros.
(copy_usage): Describe --keep-section.
(strip_usage): Likewise.
(copy_main): Handle SECTION_CONTEXT_KEEP.
(strip_main): Likewise.
(is_strip_section_1): Likewise.
* testsuite/binutils-all/objcopy.exp: Add tests.
* testsuite/binutils-all/keep-section-1.d: New test driver file.
* testsuite/binutils-all/keep-section-2.d: Likewise.
* doc/binutils.texi: Document the new feature.
* NEWS: Mention the new feature.

4 years agoAutomatic date update in version.in
GDB Administrator [Mon, 4 Nov 2019 00:00:16 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoAutomatic date update in version.in
GDB Administrator [Sun, 3 Nov 2019 00:01:13 +0000 (00:01 +0000)] 
Automatic date update in version.in

4 years ago[gdb/testsuite] Remove superfluous 3rd argument from gdb_test call (4)
Tom de Vries [Sat, 2 Nov 2019 05:55:10 +0000 (06:55 +0100)] 
[gdb/testsuite] Remove superfluous 3rd argument from gdb_test call (4)

There's a pattern:
...
gdb_test <command> <pattern> <command>
...
that can be written shorter as:
...
gdb_test <command> <pattern>
...

Detect this pattern in proc gdb_test:
...
     global gdb_prompt
     upvar timeout timeout

     if [llength $args]>2 then {
        set message [lindex $args 2]
+       if { $message == [lindex $args 0] && [llength $args] == 3 } {
+           error "HERE"
+       }
     } else {
         set message [lindex $args 0]
     }
...
and fix all occurrences in the testsuite/gdb.base subdir.

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

2019-11-02  Tom de Vries  <tdevries@suse.de>

* gdb.base/advance.exp: Drop superfluous 3rd argument to gdb_test.
* gdb.base/anon.exp: Same.
* gdb.base/auto-connect-native-target.exp: Same.
* gdb.base/call-ar-st.exp: Same.
* gdb.base/catch-syscall.exp: Same.
* gdb.base/commands.exp: Same.
* gdb.base/default.exp: Same.
* gdb.base/display.exp: Same.
* gdb.base/float.exp: Same.
* gdb.base/foll-fork.exp: Same.
* gdb.base/help.exp: Same.
* gdb.base/info-macros.exp: Same.
* gdb.base/info-proc.exp: Same.
* gdb.base/info-target.exp: Same.
* gdb.base/long_long.exp: Same.
* gdb.base/macscp.exp: Same.
* gdb.base/memattr.exp: Same.
* gdb.base/nofield.exp: Same.
* gdb.base/pointers.exp: Same.
* gdb.base/printcmds.exp: Same.
* gdb.base/ptype.exp: Same.
* gdb.base/restore.exp: Same.
* gdb.base/return.exp: Same.
* gdb.base/scope.exp: Same.
* gdb.base/set-noassign.exp: Same.
* gdb.base/setshow.exp: Same.
* gdb.base/shlib-call.exp: Same.
* gdb.base/signals.exp: Same.
* gdb.base/sigstep.exp: Same.
* gdb.base/skip.exp: Same.
* gdb.base/solib-symbol.exp: Same.
* gdb.base/stap-probe.exp: Same.
* gdb.base/step-line.exp: Same.
* gdb.base/step-test.exp: Same.
* gdb.base/style.exp: Same.
* gdb.base/varargs.exp: Same.
* gdb.base/vla-datatypes.exp: Same.
* gdb.base/vla-ptr.exp: Same.
* gdb.base/vla-sideeffect.exp: Same.
* gdb.base/volatile.exp: Same.
* gdb.base/watch-cond-infcall.exp: Same.
* gdb.base/watchpoint.exp: Same.

Change-Id: Ifd24dc13d552e7dd03f9049db419b08c6adc4112

4 years ago[gdb/testsuite] Remove superfluous 3rd argument from gdb_test call (3)
Tom de Vries [Sat, 2 Nov 2019 05:55:10 +0000 (06:55 +0100)] 
[gdb/testsuite] Remove superfluous 3rd argument from gdb_test call (3)

There's a pattern:
...
gdb_test <command> <pattern> <command>
...
that can be written shorter as:
...
gdb_test <command> <pattern>
...

Detect this pattern in proc gdb_test:
...
     global gdb_prompt
     upvar timeout timeout

     if [llength $args]>2 then {
        set message [lindex $args 2]
+       if { $message == [lindex $args 0] && [llength $args] == 3 } {
+           error "HERE"
+       }
     } else {
         set message [lindex $args 0]
     }
...
and fix all occurrences in the testsuite/gdb.cp subdir.

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

2019-11-02  Tom de Vries  <tdevries@suse.de>

* gdb.cp/anon-union.exp: Drop superfluous 3rd argument to gdb_test.
* gdb.cp/cpexprs.exp: Same.
* gdb.cp/except-multi-location.exp: Same.
* gdb.cp/exceptprint.exp: Same.
* gdb.cp/gdb2384.exp: Same.
* gdb.cp/inherit.exp: Same.
* gdb.cp/m-static.exp: Same.
* gdb.cp/meth-typedefs.exp: Same.
* gdb.cp/misc.exp: Same.
* gdb.cp/namespace.exp: Same.
* gdb.cp/non-trivial-retval.exp: Same.
* gdb.cp/overload.exp: Same.
* gdb.cp/pr17132.exp: Same.
* gdb.cp/re-set-overloaded.exp: Same.
* gdb.cp/rvalue-ref-types.exp: Same.
* gdb.cp/templates.exp: Same.

Change-Id: I0254d0cea71e7376aedb078166188a8010eeaebe

4 years agoAutomatic date update in version.in
GDB Administrator [Sat, 2 Nov 2019 00:00:15 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoSimplify print_sys_errmsg
Tom Tromey [Thu, 31 Oct 2019 22:46:16 +0000 (16:46 -0600)] 
Simplify print_sys_errmsg

On irc, Christian pointed out that print_sys_errmsg could be
simplified by avoiding alloca entirely.  This patch implements this.

gdb/ChangeLog
2019-11-01  Tom Tromey  <tromey@adacore.com>

* utils.c (print_sys_errmsg): Simplify.

Change-Id: Ic399dade274ea61b63ef0540b3a3be2f0f80160a

4 years agoFix up safe_strerror constification
Tom Tromey [Thu, 31 Oct 2019 18:44:27 +0000 (12:44 -0600)] 
Fix up safe_strerror constification

The earlier patch to constify safe_strerror missed a couple of spots,
corrected here.

gdb/ChangeLog
2019-11-01  Tom Tromey  <tromey@adacore.com>

* gdbsupport/mingw-strerror.c (safe_strerror): Constify result.

Change-Id: I36d5ced144d27b1a6734d9ab9a10a7b9f339ae88

4 years agoMove check for strerror_r to common.m4 where it belongs
Christian Biesinger [Thu, 31 Oct 2019 23:24:07 +0000 (18:24 -0500)] 
Move check for strerror_r to common.m4 where it belongs

gdb/ChangeLog:

2019-11-01  Christian Biesinger  <cbiesinger@google.com>

* configure: Regenerate.
* configure.ac: Remove check for strerror_r.
* gdbsupport/common.m4: Check for strerror_r.

gdb/gdbserver/ChangeLog:

2019-11-01  Christian Biesinger  <cbiesinger@google.com>

* configure: Regenerate.
* configure.ac: Remove check for strerror_r.

Change-Id: Ibc290c3f84b1db23e998cffdbe2c1f97651d2a8d

4 years ago[ARM, thumb] Fix disassembling bug after reloading a symbol file
Luis Machado [Fri, 1 Nov 2019 13:11:17 +0000 (10:11 -0300)] 
[ARM, thumb] Fix disassembling bug after reloading a symbol file

The speed optimization from commit 5f6cac4085c95c5339b9549dc06d4f9184184fa6
made GDB skip reloading all symbols when the same symbol file is reloaded.

As a result, ARM targets only read the mapping symbols the first time we
load a symbol file. When reloaded, the speed optimization above will
cause an early return and gdbarch_record_special_symbol won't be called to
save mapping symbol data, which in turn affects disassembling of thumb
instructions.

First load and correct disassemble output:

Dump of assembler code for function main:
    0x0000821c <+0>:     bx      pc
    0x0000821e <+2>:     nop
    0x00008220 <+4>:     mov     r0, #0
    0x00008224 <+8>:     bx      lr

Second load and incorrect disassemble output:

Dump of assembler code for function main:
    0x0000821c <+0>:     bx      pc
    0x0000821e <+2>:     nop
    0x00008220 <+4>:     movs    r0, r0
    0x00008222 <+6>:     b.n     0x8966
    0x00008224 <+8>:     vrhadd.u16      d14, d14, d31

This happens because the mapping symbol data is stored in an objfile_key-based
container, and that data isn't preserved across the two symbol loading
operations.

The following patch fixes this by storing the mapping symbol data in a
bfd_key-based container, which doesn't change as long as the bfd is the same.

I've also added a new test to verify the correct disassemble output.

gdb/ChangeLog:

2019-11-01  Luis Machado  <luis.machado@linaro.org>

PR gdb/25124

* arm-tdep.c (arm_per_objfile): Rename to ...
(arm_per_bfd): ... this.
(arm_objfile_data_key): Rename to ...
(arm_bfd_data_key): ... this.
(arm_find_mapping_symbol): Adjust access to new bfd_key-based
data.
(arm_record_special_symbol): Likewise.

gdb/testsuite/ChangeLog:

2019-11-01  Luis Machado  <luis.machado@linaro.org>

PR gdb/25124

* gdb.arch/pr25124.S: New file.
* gdb.arch/pr25124.exp: New file.

Change-Id: I22c3e6ebe9bfedad66d56fe9656994fa1761c485

4 years agoAutomatic date update in version.in
GDB Administrator [Fri, 1 Nov 2019 00:00:27 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agogdb: Don't print a newline in language la_print_typedef methods
Andrew Burgess [Tue, 24 Sep 2019 22:01:14 +0000 (23:01 +0100)] 
gdb: Don't print a newline in language la_print_typedef methods

When calling the language la_print_typedef method, don't include a
newline at the end, instead print the newline from the users of
la_print_typedef.

This change will be useful in a later commit when the output from
la_print_typedef will be placed into an MI output field, in which case
the trailing newline is not required.

There should be no user visible changes after this commit.

gdb/ChangeLog:

* ada-typeprint.c (ada_print_typedef): Don't print newline at the
end.
* c-typeprint.c (c_print_typedef): Likewise.
* f-typeprint.c (f_print_typedef): Likewise.
* m2-typeprint.c (m2_print_typedef): Likewise.
* p-typeprint.c (pascal_print_typedef): Likewise.
* rust-lang.c (rust_print_typedef): Likewise.
* symtab.c (print_symbol_info): Print a newline after calling
typedef_print.

Change-Id: I6e697ea1ec0eadaa31aefaea959b2055188d680d

4 years agogdb: Add new commands to list module variables and functions
Andrew Burgess [Wed, 10 Jul 2019 14:54:03 +0000 (15:54 +0100)] 
gdb: Add new commands to list module variables and functions

This patch adds two new commands "info module functions" and "info
module variables".  These commands list all of the functions and
variables grouped by module and then by file.

For example:

  (gdb) info module functions
  All functions in all modules:

  Module "mod1":

  File /some/path/gdb/testsuite/gdb.fortran/info-types.f90:
  35: void mod1::__copy_mod1_M1t1(Type m1t1, Type m1t1);
  25: void mod1::sub_m1_a(integer(kind=4));
  31: integer(kind=4) mod1::sub_m1_b(void);

  Module "mod2":

  File /some/path/gdb/testsuite/gdb.fortran/info-types.f90:
  41: void mod2::sub_m2_a(integer(kind=4), logical(kind=4));
  49: logical(kind=4) mod2::sub_m2_b(real(kind=4));

The new commands take set of flags that allow the output to be
filtered, the user can filter by variable/function name, type, or
containing module.

As GDB doesn't currently track the relationship between a module and
the variables or functions within it in the symbol table, so I filter
based on the module prefix in order to find the functions or variables
in each module.  What this makes clear is that a user could get this
same information using "info variables" and simply provide the prefix
themselves, for example:

  (gdb) info module functions -m mod1 _a
  All functions matching regular expression "_a",
   in all modules matching regular expression "mod1":

  Module "mod1":

  File /some/path/gdb/testsuite/gdb.fortran/info-types.f90:
  25: void mod1::sub_m1_a(integer(kind=4));

Is similar to:

  (gdb) info functions mod1::.*_a.*
  All functions matching regular expression "mod1::.*_a":

  File /some/path/gdb/testsuite/gdb.fortran/info-types.f90:
  25: void mod1::sub_m1_a(integer(kind=4));

The benefits I see for a separate command are that the user doesn't
have to think (or know) about the module prefix format, nor worry
about building a proper regexp.  The user can also easily scan across
modules without having to build complex regexps.

The new function search_module_symbols is extern in this patch despite
only being used within symtab.c, this is because a later patch in this
series will also be using this function from outside symtab.c.

This patch is a new implementation of an idea originally worked on by
Mark O'Connor, Chris January, David Lecomber, and Xavier Oro from ARM.

gdb/ChangeLog:

* symtab.c (info_module_cmdlist): New variable.
(info_module_command): New function.
(search_module_symbols): New function.
(info_module_subcommand): New function.
(struct info_modules_var_func_options): New struct.
(info_modules_var_func_options_defs): New variable.
(make_info_modules_var_func_options_def_group): New function.
(info_module_functions_command): New function.
(info_module_variables_command): New function.
(info_module_var_func_command_completer): New function.
(_initialize_symtab): Register new 'info module functions' and
'info module variables' commands.
* symtab.h (typedef symbol_search_in_module): New typedef.
(search_module_symbols): Declare new function.
* NEWS: Mention new commands.

gdb/doc/ChangeLog:

* gdb.texinfo (Symbols): Document new 'info module variables' and
'info module functions' commands.

gdb/testsuite/ChangeLog:

* gdb.fortran/info-modules.exp: Update expected results, and add
additional tests for 'info module functinos', and 'info module
variables'.
* gdb.fortran/info-types.exp: Update expected results.
* gdb.fortran/info-types.f90: Extend testcase with additional
module variables and functions.

Change-Id: I8c2960640e2e101b77eff54027d687e21ec22e2b

4 years agogdb/fortran: Add new 'info modules' command
Andrew Burgess [Tue, 9 Jul 2019 20:38:59 +0000 (21:38 +0100)] 
gdb/fortran: Add new 'info modules' command

Add a new command 'info modules' that lists all of the modules GDB
knows about from the debug information.

A module is a debugging entity in the DWARF defined with
DW_TAG_module, currently Fortran is known to use this tag for its
modules.  I'm not aware of any other language that currently makes use
of DW_TAG_module.

The output style is similar to the 'info type' output:

    (gdb) info modules
    All defined modules:

    File info-types.f90:
    16:     mod1
    24:     mod2
    (gdb)

Where the user is told the file the module is defined in and, on the
left hand side, the line number at which the module is defined along
with the name of the module.

This patch is a new implementation of an idea originally worked on by
Mark O'Connor, Chris January, David Lecomber, and Xavier Oro from ARM.

gdb/ChangeLog:

* dwarf2read.c (dw2_symtab_iter_next): Handle MODULE_DOMAIN.
(dw2_expand_marked_cus): Handle MODULES_DOMAIN.
(dw2_debug_names_iterator::next): Handle MODULE_DOMAIN and
MODULES_DOMAIN.
(scan_partial_symbols): Only create partial module symbols for non
declarations.
* psymtab.c (recursively_search_psymtabs): Handle MODULE_DOMAIN
and MODULES_DOMAIN.
* symtab.c (search_domain_name): Likewise.
(search_symbols): Likewise.
(print_symbol_info): Likewise.
(symtab_symbol_info): Likewise.
(info_modules_command): New function.
(_initialize_symtab): Register 'info modules' command.
* symtab.h (enum search_domain): Add MODULES_DOMAIN.
* NEWS: Mention new 'info modules' command.

gdb/doc/ChangeLog:

* gdb.texinfo (Symbols): Document new 'info modules' command.

gdb/testsuite/ChangeLog:

* gdb.fortran/info-modules.exp: New file.
* gdb.fortran/info-types.exp: Build with new file.
* gdb.fortran/info-types.f90: Include and use new module.
* gdb.fortran/info-types-2.f90: New file.

Change-Id: I2b781dd5a06bcad04620ccdc45f01a0f711adfad

4 years agoNEWS and documentation for $_gdb_setting and $_gdb_setting_str.
Philippe Waroquiers [Sun, 28 Apr 2019 12:44:44 +0000 (14:44 +0200)] 
NEWS and documentation for $_gdb_setting and $_gdb_setting_str.

gdb/ChangeLog
2019-10-31  Philippe Waroquiers  <philippe.waroquiers@skynet.be>

* NEWS: Mention $_gdb_setting, $_gdb_setting_str, $_gdb_maint_setting
and $_gdb_maint_setting_str.

gdb/doc/ChangeLog
2019-10-31  Philippe Waroquiers  <philippe.waroquiers@skynet.be>

* gdb.texinfo (Convenience Funs): Document the new
$_gdb_setting_str, $_gdb_maint_setting and $_gdb_maint_setting_str
convenience functions.

4 years agoTest the convenience functions $_gdb_setting and $_gdb_setting_str.
Philippe Waroquiers [Sun, 28 Apr 2019 12:40:50 +0000 (14:40 +0200)] 
Test the convenience functions $_gdb_setting and $_gdb_setting_str.

gdb/testsuite/ChangeLog
2019-10-31  Philippe Waroquiers  <philippe.waroquiers@skynet.be>

* gdb.base/setshow.exp: Test $_gdb_setting and $_gdb_setting_str.
* gdb.base/settings.exp: Test all settings types using
$_gdb_maint_setting and $_gdb_maint_setting_str in proc_show_setting,
that now verifies that the value of "maint show" is the same as
returned by the settings functions.  Test the type of the
maintenance settings.
* gdb.base/default.exp: Update show_conv_list.

4 years agoImplement convenience functions to examine GDB settings.
Philippe Waroquiers [Sun, 28 Apr 2019 12:38:18 +0000 (14:38 +0200)] 
Implement convenience functions to examine GDB settings.

The new convenience functions $_gdb_setting and $_gdb_setting_str
provide access to the GDB settings in user-defined commands.
Similarly, $_gdb_maint_setting and $_gdb_maint_setting_str
provide access to the GDB maintenance settings.

The patch was developed following a comment of Eli about the
'set may-call-functions'.  Eli said that user-defined functions
should have a way to change their behavior according to this setting.
Rather than have a specialized $_may_call_functions, this patch
implements a general way to access any GDB setting.

Compared to doing such access via Python 'gdb.parameter' and/or
'gdb.execute("set somesetting tosomevalue"):
* The 'with' command is much better than the above python usage:
  if the user types C-c or an error happens between the set pagination off
  and the python "set pagination on", the above python
  does not restore the original setting.

* Effectively, with the "gdb.parameter" python one liner, it is possible to do
  simple 'if' conditions, such as set and restore pagination.
  But mixing the "python if" within canned
  sequence of commands is cumbersome for non trivial combinations.
  E.g. if several commands have to be done for a certain condition
  accessed from python, I guess something like will be needed:
     python if __some_setting: gdb.execute("some command")
     python if __some_setting: gdb.execute("some other command")
     python if __some_setting: gdb.execute("some different command")
  (without speaking about nested "if-s").

  With the convenience function:
     if $_gdb_setting("some_setting")
        some command
        some other command
        some different command
     end
  Integer settings (for example print elements) will also be more difficult
  to use.
  For example, a user defined function that scans and prints a linked list
  might want to use the value of "set print elements" to stop printing
  the linked list.
  Doing that by mixing python expression/if is likely doable, but seems
  not easy with the above one liners.

So, in summary, the $_gdb_setting and $_gdb_setting_str avoids to have the
heterogeneous mix of python and GDB commands in one single script
(and of course, it works even if python is not configured, but that
must be an unusual setup I guess).

gdb/ChangeLog
2019-10-31  Philippe Waroquiers  <philippe.waroquiers@skynet.be>

* cli/cli-cmds.c (setting_cmd, value_from_setting)
(gdb_setting_internal_fn, gdb_maint_setting_internal_fn)
(str_value_from_setting, gdb_setting_str_internal_fn)
(gdb_maint_setting_str_internal_fn): New functions.
(_initialize_cli_cmds): Define the new convenience functions.
* gdb/cli/cli-setshow.h (get_setshow_command_value_string): Constify.
* gdb/cli/cli-setshow.c (get_setshow_command_value_string): Constify.

4 years agoAlso check for strerror_r in gdbserver
Christian Biesinger [Thu, 31 Oct 2019 22:02:05 +0000 (17:02 -0500)] 
Also check for strerror_r in gdbserver

I forgot to do this in b231e86ac9608056ea837e24d42a878927f5787a

Since safe_strerror is in gdbsupport, gdbserver also needs to
check for strerror_r, although it's less critical since gdbserver
does not use threads as much.

gdb/gdbserver/ChangeLog:

2019-10-31  Christian Biesinger  <cbiesinger@google.com>

* config.in: Regenerate.
* configure: Regenerate.
* configure.ac: Also check for strerror_r.

Change-Id: I6a67c8543cd7a28d6dc94f5986f56abcb55727fe

4 years ago[gdb/testsuite] Remove superfluous 3rd argument from gdb_test call (2)
Tom de Vries [Thu, 31 Oct 2019 22:03:25 +0000 (23:03 +0100)] 
[gdb/testsuite] Remove superfluous 3rd argument from gdb_test call (2)

There's a pattern:
...
gdb_test <command> <pattern> <command>
...
that can be written shorter as:
...
gdb_test <command> <pattern>
...

Detect this pattern in proc gdb_test:
...
     global gdb_prompt
     upvar timeout timeout

     if [llength $args]>2 then {
        set message [lindex $args 2]
+       if { $message == [lindex $args 0] && [llength $args] == 3 } {
+           error "HERE"
+       }
     } else {
         set message [lindex $args 0]
     }
...
and fix all occurrences in some gdb testsuite subdirs.

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

2019-10-31  Tom de Vries  <tdevries@suse.de>

* gdb.arch/amd64-disp-step-avx.exp: Drop superfluous 3rd argument to
gdb_test.
* gdb.arch/amd64-disp-step.exp: Same.
* gdb.asm/asm-source.exp: Same.
* gdb.btrace/buffer-size.exp: Same.
* gdb.btrace/cpu.exp: Same.
* gdb.btrace/enable.exp: Same.
* gdb.dwarf2/count.exp: Same.
* gdb.dwarf2/dw2-ranges-func.exp: Same.
* gdb.dwarf2/dw2-ranges-psym.exp: Same.
* gdb.fortran/vla-datatypes.exp: Same.
* gdb.fortran/vla-history.exp: Same.
* gdb.fortran/vla-ptype.exp: Same.
* gdb.fortran/vla-value.exp: Same.
* gdb.fortran/whatis_type.exp: Same.
* gdb.guile/guile.exp: Same.
* gdb.multi/tids.exp: Same.
* gdb.python/py-finish-breakpoint.exp: Same.
* gdb.python/py-framefilter.exp: Same.
* gdb.python/py-pp-registration.exp: Same.
* gdb.python/py-xmethods.exp: Same.
* gdb.python/python.exp: Same.
* gdb.server/connect-with-no-symbol-file.exp: Same.
* gdb.server/no-thread-db.exp: Same.
* gdb.server/run-without-local-binary.exp: Same.
* gdb.stabs/weird.exp: Same.
* gdb.threads/attach-many-short-lived-threads.exp: Same.
* gdb.threads/thread-find.exp: Same.
* gdb.threads/tls-shared.exp: Same.
* gdb.threads/tls.exp: Same.
* gdb.threads/wp-replication.exp: Same.
* gdb.trace/ax.exp: Same.
* lib/gdb.exp (gdb_test_exact, help_test_raw): Same.

Change-Id: I2fa544c68f8c0099a77e03ff04ddc010eb2b6c7c

4 years agoDon't read agent symbols when disabled
Christian Biesinger [Thu, 31 Oct 2019 00:10:13 +0000 (19:10 -0500)] 
Don't read agent symbols when disabled

This avoids unnecessary work, and becomes important with the patch in
https://sourceware.org/ml/gdb-patches/2019-10/msg01143.html

gdb/ChangeLog:

2019-10-31  Christian Biesinger  <cbiesinger@google.com>

* agent.c (set_can_use_agent): When the setting is turned on,
look up agent symbols if we don't have them yet.
(agent_new_objfile): Don't look up agent symbols when the agent
setting is off.

Change-Id: I6523a5640c95d38299998050a6c620e51096e8ed

4 years agoRegenerate config.in
Christian Biesinger [Thu, 31 Oct 2019 20:38:25 +0000 (15:38 -0500)] 
Regenerate config.in

I forgot to do this in the last commit
(b231e86ac9608056ea837e24d42a878927f5787a)

gdb/ChangeLog:

2019-10-31  Christian Biesinger  <cbiesinger@google.com>

* config.in: Regenerate.

Change-Id: I60946ffd853a59469c35f19ef8012ac6ea88a31c

4 years agoUse strerror_r in safe_strerror if available
Christian Biesinger [Thu, 31 Oct 2019 19:41:19 +0000 (14:41 -0500)] 
Use strerror_r in safe_strerror if available

Also stores the result in a thread-local static variable and
changes the return value to a const char*.

This is already important because Guile creates threads and
Python can create threads, but with the patch series here:
https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/176
GDB itself will create threads, too.

gdb/ChangeLog:

2019-10-31  Christian Biesinger  <cbiesinger@google.com>

* configure: Regenerate.
* configure.ac: Check for strerror_r.
* gdbsupport/common-utils.h (safe_strerror): Change return value
to const char * and document that this function is now threadsafe.
* gdbsupport/posix-strerror.c (safe_strerror): Make buf
thread_local and call strerror_r, if available.
* utils.c (perror_string): Update.
(print_sys_errmsg): Update.

Change-Id: I81048fbaf148035c221c528727f7efe58ba528eb

4 years ago[ARM] Store exception handling information per-bfd instead of per-objfile
Luis Machado [Thu, 31 Oct 2019 19:30:44 +0000 (16:30 -0300)] 
[ARM] Store exception handling information per-bfd instead of per-objfile

Based on feedback from Tromey, update the use of objfile_key in gdb/arm-tdep.c
to use bfd_key instead. That way we don't have to re-create the exception
handling data all over again if it was done before for the same BFD.

gdb/ChangeLog:

2019-10-31  Luis Machado  <luis.machado@linaro.org>

* arm-tdep.c (arm_exidx_data_key): Use bfd_key instead of
objfile_key.
(arm_exidx_new_objfile): Adjust to use objfile->obfd instead of
objfile to fetch per-bfd data.
(arm_find_exidx_entry): Likewise.

Change-Id: Ia7b3208ea8d788414600fa6d770ac76db0562859

4 years agoConvert int to bool in agent.c
Christian Biesinger [Wed, 30 Oct 2019 21:19:11 +0000 (16:19 -0500)] 
Convert int to bool in agent.c

Also moves an int declaration inside the for loop.

Code cleanup, no change in behavior intended.

gdb/ChangeLog:

2019-10-31  Christian Biesinger  <cbiesinger@google.com>

* gdbsupport/agent.c (debug_agent): Change type to bool.
(use_agent): Likewise.
(all_agent_symbols_look_up): Likewise.
(agent_loaded_p): Change return value to bool.
(agent_look_up_symbols): Update.
(agent_capability_check): Change return value to bool.
* gdbsupport/agent.h (agent_loaded_p): Likewise.
(debug_agent): Change type to bool.
(use_agent): Likewise.
(agent_capability_check): Change return value to bool.

gdb/gdbserver/ChangeLog:

2019-10-31  Christian Biesinger  <cbiesinger@google.com>

* ax.h (debug_agent): Remove duplicate declaration.

Change-Id: Icb28a65fcc8c7108bcd59287e6be66bf56f8ccb5

4 years agoi386; Add .code16gcc fldenv tests
H.J. Lu [Thu, 31 Oct 2019 17:42:04 +0000 (10:42 -0700)] 
i386; Add .code16gcc fldenv tests

* testsuite/gas/i386/general.s: Add .code16gcc fldenv tests.
* testsuite/gas/i386/general.l: Updated.

4 years ago[gdb/testsuite] Remove superfluous 3rd argument from gdb_test call
Tom de Vries [Thu, 31 Oct 2019 16:37:02 +0000 (17:37 +0100)] 
[gdb/testsuite] Remove superfluous 3rd argument from gdb_test call

There's a pattern:
...
gdb_test <command> <pattern> <command>
...
that can be written shorter as:
...
gdb_test <command> <pattern>
...

Detect this pattern in proc gdb_test:
...
     global gdb_prompt
     upvar timeout timeout

     if [llength $args]>2 then {
  set message [lindex $args 2]
+ if { $message == [lindex $args 0] } {
+     error "HERE"
+ }
     } else {
  set message [lindex $args 0]
     }
...
and fix all occurences in gdb.ada.

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

2019-10-31  Tom de Vries  <tdevries@suse.de>

* gdb.ada/array_bounds.exp: Drop superfluous 3rd argument to gdb_test.
* gdb.ada/array_subscript_addr.exp: Same.
* gdb.ada/arrayidx.exp: Same.
* gdb.ada/arrayparam.exp: Same.
* gdb.ada/arrayptr.exp: Same.
* gdb.ada/boolean_expr.exp: Same.
* gdb.ada/call_pn.exp: Same.
* gdb.ada/complete.exp: Same.
* gdb.ada/fixed_cmp.exp: Same.
* gdb.ada/fun_addr.exp: Same.
* gdb.ada/funcall_param.exp: Same.
* gdb.ada/interface.exp: Same.
* gdb.ada/mod_from_name.exp: Same.
* gdb.ada/null_array.exp: Same.
* gdb.ada/packed_array.exp: Same.
* gdb.ada/packed_tagged.exp: Same.
* gdb.ada/print_chars.exp: Same.
* gdb.ada/print_pc.exp: Same.
* gdb.ada/ptype_arith_binop.exp: Same.
* gdb.ada/ptype_field.exp: Same.
* gdb.ada/ptype_tagged_param.exp: Same.
* gdb.ada/rec_return.exp: Same.
* gdb.ada/ref_tick_size.exp: Same.
* gdb.ada/str_ref_cmp.exp: Same.
* gdb.ada/taft_type.exp: Same.
* gdb.ada/tagged.exp: Same.
* gdb.ada/type_coercion.exp: Same.
* gdb.ada/uninitialized_vars.exp: Same.

Change-Id: Ibb84a41573c7f21295f3fd42da9b96534205c5c4

4 years agoAdd support for context sensitive '.arch_extension' to the ARM assembler.
Mihail Ionescu [Thu, 31 Oct 2019 11:22:58 +0000 (11:22 +0000)] 
Add support for context sensitive '.arch_extension' to the ARM assembler.

If the extension is not found in the context sensitive table, the legacy
tables are still checked as a fallback.  This is particularly useful for
Armv8.1-M as it enables  the use of '.arch_extension' with the 'mve' and
'mve.fp' extensions which are not part of the legacy table.

* config/tc-arm.c (selected_ctx_ext_table) New static variable.
(arm_parse_arch): Set context sensitive extension table based on the
chosen base architecture.
(s_arm_arch_extension): Change to lookup extensions in the new context
sensitive tables.
* gas/testsuite/gas/arm/mve-ext.s: New.
* gas/testsuite/gas/arm/mve-ext.d: New.
* gas/testsuite/gas/arm/mvefp-ext.s: New.
* gas/testsuite/gas/arm/mvefp-ext.d: New.

4 years agoAutomatic date update in version.in
GDB Administrator [Thu, 31 Oct 2019 00:00:22 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years ago[gdb/testsuite] Add -early pattern flag for gdb_test_multiple
Tom de Vries [Wed, 30 Oct 2019 16:41:03 +0000 (17:41 +0100)] 
[gdb/testsuite] Add -early pattern flag for gdb_test_multiple

Proc gdb_test_multiple builds up and executes a gdb_expect expression with
pattern/action clauses.  The clauses are either implicit (added by
gdb_test_multiple) or explicit (passed via the gdb_test_multiple parameter
user_code).

However, there are a few implicit clauses which are inserted before the
explicit ones, making sure those take precedence.

Add an -early pattern flag for a gdb_test_multiple user_code clause to specify
that the clause needs to be inserted before any implicit clause.

Using this pattern flag, we can f.i. setup a kfail for an assertion failure
<assert> during gdb_continue_to_breakpoint by the rewrite:
...
gdb_continue_to_breakpoint <msg> <pattern>
...
into:
...
set breakpoint_pattern "(?:Breakpoint|Temporary breakpoint) .* (at|in)"
gdb_test_multiple "continue" "continue to breakpoint: <msg>"  {
   -early -re "internal-error: <assert>" {
       setup_kfail gdb/nnnnn "*-*-*"
       exp_continue
   }
   -re "$breakpoint_pattern <pattern>\r\n$gdb_prompt $" {
       pass $gdb_test_name
   }
}

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

2019-10-30  Tom de Vries  <tdevries@suse.de>

* lib/gdb.exp (gdb_test_multiple): Handle -early pattern flag.

Change-Id: I376c636b0812be52e7137634b1a4f50bf2b999b6

4 years agoOnly clear the minsym array when necessary
Christian Biesinger [Tue, 29 Oct 2019 22:14:48 +0000 (17:14 -0500)] 
Only clear the minsym array when necessary

The array starts out initialized to zero:
  minimal_symbol *msymbol_hash[MINIMAL_SYMBOL_HASH_SIZE] {};

So we only need to explicitly clear it if there were previous minsyms
added to it. This patch does that.

gdb/ChangeLog:

2019-10-30  Christian Biesinger  <cbiesinger@google.com>

* minsyms.c (clear_minimal_symbol_hash_tables): New function.
(build_minimal_symbol_hash_tables): Code to clear the table moved
to clear_minimal_symbol_hash_tables.
(minimal_symbol_reader::install): Call clear_minimal_symbol_hash_tables
when needed.

Change-Id: I7da994fe6747f67714e7efe9fdbb0dbc4d6ea532

4 years agoModify the ARNM assembler to accept the omission of the immediate argument for the...
Delia Burduv [Wed, 30 Oct 2019 13:23:35 +0000 (13:23 +0000)] 
Modify the ARNM assembler to accept the omission of the immediate argument for the writeback form of the LDRAA and LDRAB mnemonics

This is a shorthand for the immediate argument being 0, as described here:
  https://developer.arm.com/docs/ddi0596/latest/base-instructions-alphabetic-order/ldraa-ldrab-load-register-with-pointer-authentication

This is because the instructions still have a use with an immediate
argument of 0, unlike loads without the PAC functionality. Currently,
the mnemonics are

  LDRAA Xt, [Xn, #<simm10>]!
  LDRAB Xt, [Xn, #<simm10>]!

After this patch they become

  LDRAA Xt, [Xn {, #<simm10>}]!
  LDRAB Xt, [Xn {, #<simm10>}]!

gas * config/tc-aarch64.c (parse_address_main): Accept the omission of
the immediate argument for ldraa and ldrab as a shorthand for the
immediate being 0.
* testsuite/gas/aarch64/ldraa-ldrab-no-offset.d: New test.
* testsuite/gas/aarch64/ldraa-ldrab-no-offset.s: New test.
* testsuite/gas/aarch64/illegal-ldraa.s: Modified to accept the
writeback form with no offset.
* testsuite/gas/aarch64/illegal-ldraa.s: Removed missing offset
error.

opcodes * aarch64-opc.c (print_immediate_offset_address): Don't print the
immediate for the writeback form of ldraa/ldrab if it is 0.
* aarch64-tbl.h: Updated the documentation for ADDR_SIMM10.
* aarch64-opc-2.c: Regenerated.

4 years agoAdd the ability to the BFD library to read build-ids from core flies.
Keith Seitz [Wed, 30 Oct 2019 12:23:16 +0000 (12:23 +0000)] 
Add the ability to the BFD library to read build-ids from core flies.

* elf-bfd.h (elf_backend_data) <elf_backend_core_find_build_id>:
New field.
(_bfd_elf32_core_find_build_id, _bfd_elf64_core_find_build_id):
New functions.
(elf_read_notes): Add declaration.
* elf.c (elf_read_notes): Move elf-bfd.h.
(_bfd_elf_core_find_build_id): New function.
(bfd_section_from_phdr): Scan core file PT_LOAD segments for
build-id if none is known.
(elf_parse_notes): For core files, scan for notes.
* elfcore.h (elf_core_file_matches_executable_p): If both
BFDs have identical build-ids, then they match.
(_bfd_elf_core_find_build_id): New function.
* elfxx-target.h (elf_backend_core_find_build_id): Define.
(elfNN_bed): Add elf_backend_core_find_build_id.

4 years agoUpdate email address for Palmer Dabbelt.
Nick Clifton [Wed, 30 Oct 2019 10:52:15 +0000 (10:52 +0000)] 
Update email address for Palmer Dabbelt.

      * MAINTAINERS: Change palmer@sifive.com to palmer@dabbelt.com.

4 years agoAdd a --output=<DIR> option to ar to allow the specifying of an output directory.
Fangrui Song [Wed, 30 Oct 2019 10:50:23 +0000 (10:50 +0000)] 
Add a --output=<DIR> option to ar to allow the specifying of an output directory.

* ar.c (emum long option numbers): Declare.  Use to provide
numerical values for long options.
(long_options): Add --output option.
(usage): Mention the --output option.
(open_output_file): New function.  Create a filepath for an output
file and open it.
(extract_file): Use open_output_file().
(open_output_file):
* testsuite/binutils-all/ar.exp: Add a test of the new feature.
* doc/binutils.texi: Document the new feature.
* NEWS: Mention the new feature.

4 years agox86: add tests to cover defaulting of operand sizes for ambiguous insns
Jan Beulich [Wed, 30 Oct 2019 08:09:13 +0000 (09:09 +0100)] 
x86: add tests to cover defaulting of operand sizes for ambiguous insns

Prior to changing the logic in the assembler install tests to make sure
the present defaulting of operand sizes won't get broken. There are a
few anomalies pointed out by this:
- arithmetic insns (add, sub, etc) allow defaulting when their immediate
  fits in (signed) 8 bits, but they fail to assemble with larger values,
- mov, other than arithmetic insns, doesn't allow any defaulting,
- movsx/movzx default to byte sources (in AT&T mode), and their special
  casing needs to be adjusted first
- bt and friends allow defaulting, while shl and friends don't,
- ambiguous AVX and AVX512 insns don't allow defaulting.
This should ultimately all become consistent (perhaps with the exception
some of the SIMD insns); respective tests will be added to the test
cases here as the issues get addressed.

4 years agox86: re-do "shorthand" handling
Jan Beulich [Wed, 30 Oct 2019 08:07:40 +0000 (09:07 +0100)] 
x86: re-do "shorthand" handling

Now that the opcode table gets preprocessed, undo parts of commit
dc821c5f9a ("x86: replace Reg8, Reg16, Reg32, and Reg64"): Have the
preprocessor handle the expansion there, while making the expansions
explicit in i386-gen and the register table.

4 years agox86: slightly rearrange struct insn_template
Jan Beulich [Wed, 30 Oct 2019 08:06:42 +0000 (09:06 +0100)] 
x86: slightly rearrange struct insn_template

This avoids holes between the individual fields, (potentially) shrinking
the overall template table size by 4 bytes per entry.

4 years agox86: drop stray W
Jan Beulich [Wed, 30 Oct 2019 08:05:46 +0000 (09:05 +0100)] 
x86: drop stray W

The flag is used to indicate opcodes which can be switched between byte
and word/dword/qword forms (in a "canonical" way). Obviously it's quite
odd then to see it on insns not allowing for byte operands in the first
place. As a result the opcode bytes need to be adjusted accordingly,
which includes comparisons done in optimize_encoding().

To make re-introduction of such issues less likely have i386-gen
diagnose it (in a generally non-fatal way for now).

This page took 0.05867 seconds and 4 git commands to generate.