Commit Graph

99051 Commits

Author SHA1 Message Date
Nick Clifton b0531efe2e Updated traditional Chinese translation for the binutils/ subdirectory 2019-10-11 11:58:22 +01:00
GDB Administrator 863a974ed2 Automatic date update in version.in 2019-10-11 00:00:39 +00:00
Christian Biesinger 26344e0c53 Include gdbtk.h to avoid declarations
Once https://sourceware.org/ml/insight/2019-q4/msg00000.html lands,
we can just include gdbtk.h to get the declarations for
external_editor_command and gdbtk_test, instead of having to
declare them here in main.c.

gdb/ChangeLog:

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

	* main.c (captured_main_1): Include gdbtk.h and remove declarations
	for external_editor_command and gdbtk_test.
2019-10-10 12:42:41 -05:00
Christian Biesinger c2c440a903 Move declaration of varobjdebug to header
gdb/ChangeLog:

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

	* mi/mi-cmd-var.c (varobjdebug): Remove declaration.
	* varobj.c (varobjdebug): Move comment to...
	* varobj.h (varobjdebug): ...here, and declare.
2019-10-10 12:37:47 -05:00
Andreas Arnez 6dfc004112 gdb/testsuite: Fix typos in infcall-nested-structs.c
Some of the comparison functions in infcall-nested-structs.c contain
redundant comparisons like a.<some_field> == a.<some_field> instead of
a.<some_field> == b.<some_field>.  They were introduced with this commit:

  36eb4c5f9b - "infcall-nested-structs: Test up to five fields"

Fix the redundant comparisons.

gdb/testsuite/ChangeLog:

	* gdb.base/infcall-nested-structs.c (cmp_struct_02_01)
	(cmp_struct_02_02, cmp_struct_04_01, cmp_struct_04_02)
	(cmp_struct_05_01, cmp_struct_static_02_01)
	(cmp_struct_static_04_01, cmp_struct_static_06_01): Fix redundant
	comparisons.
2019-10-10 12:22:49 +02:00
Tom de Vries abcf2cc85a [gdb/testsuite] Fix ada tests with -fPIE/-pie
When running the gdb testsuite with target board unix/-fPIE/-pie, the
resulting ada executables are not PIE executables, because gnatmake doesn't
recognize -pie, and consequently doesn't pass it to gnatlink.

Fix this by replacing "-pie" with "-largs -pie -margs" in
target_compile_ada_from_dir, and doing the same for -no-pie.

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

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

	PR testsuite/24888
	* lib/ada.exp (target_compile_ada_from_dir): Route -pie/-no-pie to
	gnatlink.
2019-10-10 11:51:34 +02:00
GDB Administrator 61f0556832 Automatic date update in version.in 2019-10-10 00:00:24 +00:00
Tom Tromey a31bff9d2d Don't call erase_data_content from tui_data_window::show_registers
tui_data_window::show_registers currently calls erase_data_content.
However, I think it's better to have fewer calls to this (ideally just
one would suffice).  This refactors that function to remove this call.

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

	* tui/tui-regs.c (tui_data_window::show_registers): Don't call
	erase_data_content.
2019-10-09 16:50:36 -06:00
Tom Tromey 7523da63ca Make TUI window handle a unique_ptr
This changes tui_gen_win_info::handle to be a specialization of
unique_ptr.  This is perhaps mildly uglier in some spots, due to the
proliferation of "get"; but on the other hand it cleans up some manual
management and it allows for the removal of tui_delete_win.

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

	* tui/tui-wingeneral.h (tui_delete_win): Don't declare.
	* tui/tui-stack.c (tui_locator_window::rerender): Update.
	* tui/tui-command.c (tui_cmd_window::resize)
	(tui_refresh_cmd_win): Update.
	* tui/tui-win.c (tui_resize_all, tui_set_focus_command): Update.
	* tui/tui.c (tui_rl_other_window, tui_enable): Update.
	* tui/tui-data.c (~tui_gen_win_info): Remove.
	* tui/tui-layout.c (tui_gen_win_info::resize): Update.
	* tui/tui-io.c (update_cmdwin_start_line, tui_putc, tui_puts)
	(tui_redisplay_readline, tui_mld_flush)
	(tui_mld_erase_entire_line, tui_mld_getc, tui_getc): Update.
	* tui/tui-regs.c (tui_data_window::delete_data_content_windows)
	(tui_data_window::erase_data_content)
	(tui_data_item_window::rerender)
	(tui_data_item_window::refresh_window): Update.
	* tui/tui-wingeneral.c (tui_gen_win_info::refresh_window)
	(box_win, tui_gen_win_info::make_window)
	(tui_gen_win_info::make_visible): Update.
	(tui_delete_win): Remove.
	* tui/tui-winsource.c
	(tui_source_window_base::do_erase_source_content): Update.
	(tui_show_source_line, tui_source_window_base::update_tab_width)
	(tui_source_window_base::update_exec_info): Update.
	* tui/tui-data.h (struct curses_deleter): New.
	(struct tui_gen_win_info) <handle>: Now a unique_ptr.
	(struct tui_gen_win_info) <~tui_gen_win_info>: Define.
2019-10-09 16:50:35 -06:00
Tom Tromey a7798e7f7d Remove declaration from tui-wingeneral.h
tui-wingeneral.h has an unused forward declaration.  This removes it.

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

	* tui/tui-wingeneral.h (struct tui_gen_win_info): Don't declare.
2019-10-09 16:50:35 -06:00
Tom Tromey 5c45899e28 Remove tui_win_is_auxiliary
tui_win_is_auxiliary is not used, so remove it.

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

	* tui/tui-data.c (tui_win_is_auxiliary): Remove.
	* tui/tui-data.h (tui_win_is_auxiliary): Don't declare.
2019-10-09 16:50:34 -06:00
Tom Tromey 6d7fd9aa47 Remove tui_default_win_viewport_height
tui_default_win_viewport_height was only called from a single spot,
for a single type of window.  This patch removes the function and
moves the logic into the sole caller.

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

	* tui/tui-disasm.c (tui_get_low_disassembly_address): Compute
	window height directly.
	* tui/tui-layout.h (tui_default_win_viewport_height): Don't
	declare.
	* tui/tui-layout.c (tui_default_win_height): Remove.
	(tui_default_win_viewport_height): Remove.
2019-10-09 16:50:33 -06:00
Tom Tromey d2dd1084c1 Remove two TUI comments
This removes two comments from tui.h.  These were not useful.

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

	* tui/tui.h: Remove comments.
2019-10-09 16:50:33 -06:00
Tom de Vries a50faaf620 [gdb/testsuite] Add XFAILs in gdb.rust/simple.exp for incorrect DWARF
On openSUSE Leap 15.1 using rustc version 1.36.0 (using llvm 7), I get:
...
(gdb) PASS: gdb.rust/simple.exp: print e2.0
print k^M
$54 = simple::SpaceSaver::Thebox(40, 0x0)^M
(gdb) FAIL: gdb.rust/simple.exp: print k
...
while we're expecting:
...
gdb_test "print k" " = simple::SpaceSaver::Nothing"
...

When using a relatively recent version of Rust with a somewhat older version
of LLVM, the Rust compiler will emit a legacy encoding of enums (see also
quirk_rust_enum in dwarf2read.c).

So, the variable k:
...
 <17><3d58>: Abbrev Number: 15 (DW_TAG_variable)
    <3d59>   DW_AT_location    : 3 byte block: 91 b8 4  (DW_OP_fbreg: 568)
    <3d5d>   DW_AT_name        : (indirect string, offset: 0xf9a): k
    <3d61>   DW_AT_alignment   : 1
    <3d62>   DW_AT_decl_file   : 1
    <3d63>   DW_AT_decl_line   : 129
    <3d64>   DW_AT_type        : <0x4232>
...
has type:
...
 <2><4232>: Abbrev Number: 11 (DW_TAG_union_type)
    <4233>   DW_AT_name        : (indirect string, offset: 0x3037): SpaceSaver
    <4237>   DW_AT_byte_size   : 16
    <4238>   DW_AT_alignment   : 8
 <3><4239>: Abbrev Number: 9 (DW_TAG_member)
    <423a>   DW_AT_name        : (indirect string, offset: 0x29f5): RUST$ENCODED$ENUM$0$Nothing
    <423e>   DW_AT_type        : <0x4245>
    <4242>   DW_AT_alignment   : 8
    <4243>   DW_AT_data_member_location: 0
...

The "RUST$ENCODED$ENUM$0$Nothing" means that field 0 is both a pointer and a
discriminant, and if the value is 0, then the enum is just a data-less variant
named "Nothing".

However, the corresponding type has two fields, where not field 0 but field 1
is a pointer, and field 0 is a byte:
...
 <2><4245>: Abbrev Number: 8 (DW_TAG_structure_type)
    <4246>   DW_AT_name        : (indirect string, offset: 0x2a11): Thebox
    <424a>   DW_AT_byte_size   : 16
    <424b>   DW_AT_alignment   : 8
 <3><424c>: Abbrev Number: 9 (DW_TAG_member)
    <424d>   DW_AT_name        : (indirect string, offset: 0x670): __0
    <4251>   DW_AT_type        : <0x436b>
    <4255>   DW_AT_alignment   : 1
    <4256>   DW_AT_data_member_location: 8
 <3><4257>: Abbrev Number: 9 (DW_TAG_member)
    <4258>   DW_AT_name        : (indirect string, offset: 0x1662): __1
    <425c>   DW_AT_type        : <0x45da>
    <4260>   DW_AT_alignment   : 8
    <4261>   DW_AT_data_member_location: 0
...

Mark this as xfail.

gdb/testsuite/ChangeLog:

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

	PR testsuite/25048
	* gdb.rust/simple.exp: Add xfails for incorrect DWARF.
2019-10-09 23:57:11 +02:00
Tom de Vries cff32449e8 [gdb/target] Fix pretty-printer for MPX bnd registers
I'm seeing this failure:
...
(gdb) print /x $bnd0 = {0x10, 0x20}^M
$23 = {lbound = 0x10, ubound = 0x20}^M
(gdb) FAIL: gdb.arch/i386-mpx.exp: verify size for bnd0
...

The test expects a pretty printer to be actived printing 'size 17':
...
set test_string ".*\\\: size 17.*"
gdb_test "print /x \$bnd0 = {0x10, 0x20}" "$test_string" "verify size for bnd0"
...
but that doesn't happen.

The pretty printer is for the type of the $bnd0 register, which is created
here in i386_bnd_type:
...
      t = arch_composite_type (gdbarch,
                               "__gdb_builtin_type_bound128", TYPE_CODE_STRUCT);

      append_composite_type_field (t, "lbound", bt->builtin_data_ptr);
      append_composite_type_field (t, "ubound", bt->builtin_data_ptr);

      TYPE_NAME (t) = "builtin_type_bound128";
...

And the pretty-printer is registered here in
gdb/python/lib/gdb/printer/bound_registers.py:
...
gdb.printing.add_builtin_pretty_printer ('mpx_bound128',
                                         '^__gdb_builtin_type_bound128',
                                         MpxBound128Printer)
...

Fix the pretty printer by changing the regexp argument of
add_builtin_pretty_printer to match "builtin_type_bound128", the TYPE_NAME.

Tested on x86_64-linux.

gdb/ChangeLog:

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

	* python/lib/gdb/printer/bound_registers.py: Use
	'^builtin_type_bound128' as regexp argument for
	add_builtin_pretty_printer.
2019-10-09 23:52:46 +02:00
Christian Biesinger 6a25e8a290 Mark guile_{extension_,}script_ops as static
This makes it clearer that the structs are only used in this file. It
required moving the definition of extension_language_guile further
down in the file, because static structs can't be forward-declared.

gdb/ChangeLog:

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

	* guile/guile.c (guile_extension_script_ops): Remove forward
	declaration and mark as static.
	(guile_script_ops): Likewise.
	(extension_language_guile): Move further down in the file so
	it can reference the definitions for guile_{extension_,}script_ops.
2019-10-09 13:18:47 -05:00
Nick Clifton 1d3787499d Fix the disassembly of the LDS and STS instructions of the AVR architecture.
PR 25041
opcodes	* avr-dis.c (avr_operand): Fix construction of address for lds/sts
	instructions.

gas	* testsuite/gas/avr/pr25041.s: New test.
	* testsuite/gas/avr/pr25041.d: New test driver.
2019-10-09 13:48:06 +01:00
Alan Modra 8610e0fd93 PR25081, Discrepancy between VMA and LMA after ALIGN
The testcase in the PR has two empty output sections, .sec1 with an
ALIGN and symbol assignment, and .sec2 just with an empty input
section.  The symbol assignment results in .sec1 being kept, but
because it is empty this section doesn't take space from the memory
region as you might expect from the ALIGN.  Instead the next section
.sec2, has vma/lma as if .sec1 wasn't present.  However, .sec2 is
discarded and os->ignored set, which unfortunately meant that dot
wasn't set from .sec2 vma.  That in turn results in .sec2 lma being
set incorrectly.  That vma/lma difference is then propagated to
.sec3 where it is seen as an overlap.

	PR 25081
	* ldlang.c (lang_size_sections_1): Set lma from section vma
	rather than dot.
2019-10-09 21:53:16 +10:30
Andreas Arnez 6d9d6da48e s390: Add record/replay support for arch13 instructions
Enable recording most of the new "arch13" instructions on z/Architecture
targets, except for the specialized-function-assist instructions:

  SORTL - sort lists
  DFLTCC - deflate conversion call
  KDSA - compute digital signature authentication

gdb/ChangeLog:

	* s390-tdep.c (390_process_record): Handle new arch13 instructions
	except SORTL, DFLTCC, and KDSA.
2019-10-09 11:09:22 +02:00
Alan Modra 336bfbeb18 PR25070, SEGV in function _bfd_dwarf2_find_nearest_line
Evil testcase with two debug info sections, with sizes of 2aaaabac4ec1
and ffffd5555453b140 result in a total size of 1.  Reading the first
section of course overflows the buffer and tramples on other memory.

	PR 25070
	* dwarf2.c (_bfd_dwarf2_slurp_debug_info): Catch overflow of
	total_size calculation.
2019-10-09 13:28:20 +10:30
GDB Administrator 41481f9e4e Automatic date update in version.in 2019-10-09 00:00:17 +00:00
Tom Tromey 3abea05d9b Remove two unused items from windows-nat.c
windows_thread_info_struct::sf is unused, as is
struct safe_symbol_file_add_args in windows-nat.c.
This patch removes them both.  Tested by grep and
rebuilding.

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

	* windows-nat.c (struct windows_thread_info_struct) <sf>: Remove.
	(struct safe_symbol_file_add_args): Remove.
2019-10-08 11:21:46 -06:00
Tom Tromey dde996e213 Don't include buildsym-legacy.h in windows-nat.c
I noticed that windows-nat.c includes buildsym-legacy.h -- but there's
no reason to do so, as windows-nat.c doesn't create any symbols.

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

	* windows-nat.c: Don't include buildsym-legacy.h.
2019-10-08 11:17:21 -06:00
Tom Tromey cd6fdaa1ed Let ARI allow gdb %p printf extensions
As pointed out by Simon, this changes ARI to allow the gdb-specific %p
printf extensions.

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

	* contrib/ari/gdb_ari.sh (%p): Allow gdb-specific %p extensions.
2019-10-08 11:16:21 -06:00
Christian Biesinger 79bb1944d6 Move declaration of overload_debug to header
gdb/ChangeLog:

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

	* gdbtypes.c (overload_debug): Move comment to header.
	* gdbtypes.h (overload_debug): Declare.
	* valops.c: Remove declaration of overload_debug, instead
	include gdbtypes.h.
2019-10-08 10:16:48 -05:00
Christian Biesinger 34916edc47 Move declaration of lang_frame_mismatch_warn to header.
Also makes it localizable.

gdb/ChangeLog:

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

	* language.c (show_language_command): Pass lang_frame_mismatch_warn
	through _().
	(lang_frame_mismatch_warn): Make const, mark with N_(), and
	move comment...
	* language.h (lang_frame_mismatch_warn): ... here. Also add
	declaration.
	* top.c (lang_frame_mismatch_warn): Remove declaration.
	(check_frame_language_change): Pass lang_frame_mismatch_warn
	through _().
2019-10-08 10:14:57 -05:00
Alan Modra b7d9d3ee59 PR25079, "ar s" stopped working
's' is both a command and a modifier.  If given as a command then we
aren't lacking an operation.  I think the same goes when mri mode is
selected: any following command line used to be ignored.

	PR 25079
	* ar.c (decode_options): Don't try for command options if
	write_armap or mri_mode is selected.
2019-10-09 00:20:28 +10:30
Alan Modra 063c511bd7 PR25078, stack overflow in function find_abstract_instance
PR 25078
	* dwarf2.c (find_abstract_instance): Delete orig_info_ptr, add
	recur_count.  Error on recur_count reaching 100 rather than
	info_ptr matching orig_info_ptr.  Adjust calls.
2019-10-09 00:20:28 +10:30
Alan Modra 6446511295 PowerPC local got test
This is the one that causes ld segfaults between 2019-10-04 and
2019-10-07.  Bug introduced with f749f26eea, fixed by 93370e8e7b.

	* testsuite/ld-powerpc/localgot.s,
	* testsuite/ld-powerpc/localgot.d: New test.
	* testsuite/ld-powerpc/powerpc.exp: Run it.
2019-10-09 00:20:19 +10:30
Andreas Krebbel 46e292ab0a S/390: Add support for z15 as CPU name.
So far z15 was identified as arch13. After the machine has been
announced we can now add the real name.

gas/ChangeLog:

2019-10-08  Andreas Krebbel  <krebbel@linux.ibm.com>

	* config/tc-s390.c (s390_parse_cpu): Add z15 as alternate CPU
	name.
	* doc/as.texi: Add z15 to CPU string list.
	* doc/c-s390.texi: Likewise.

opcodes/ChangeLog:

2019-10-08  Andreas Krebbel  <krebbel@linux.ibm.com>

	* s390-mkopc.c (main): Enable z15 as CPU string in the opcode
	table.
2019-10-08 11:24:29 +02:00
GDB Administrator f21410c03a Automatic date update in version.in 2019-10-08 00:00:41 +00:00
Christian Biesinger bad5c02618 Move declaration of vtbl_ptr_name to the header.
There are conflicting comments about whether this was
introduced in GCC 2.4.5 or GCC 2.6 and I don't know
which one is correct...

gdb/ChangeLog:

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

	* c-lang.h (vtbl_ptr_name): Declare.
	* cp-valprint.c (vtbl_ptr_name): Remove "extern" now that we get
	it from the header.
	* stabsread.c (define_symbol): Remove declaration of vtbl_ptr_name.
2019-10-07 17:30:22 -05:00
Christian Biesinger 51f1fdc3d2 Use gdb_static_assert in charset.c
It currently has a "manual" static assert.

gdb/ChangeLog:

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

	* charset.c (your_gdb_wchar_t_is_bogus): Replace with a
	gdb_static_assert.
2019-10-07 12:49:26 -05:00
Weimin Pan 606813d5cd Move top-level Makefile.def/Makefile.in to the top-level ChangeLog 2019-10-07 16:22:14 +00:00
Jozef Lawrynowicz c0ea7c52e1 Add support for new functionality in the msp430 backend of GCC.
This functionality will generate a new GNU object attribute for the "data region"
has been added. This object attribute is used
mark whether the compiler has generated code assuming that data could be in the
upper or lower memory regions.

Code which assumes data is always in the lower memory region is incompatible
with code which uses the full memory range for data.

The patch also adds a new assembler directive ".mspabi_attribute" to handle the
existing MSPABI object attributes. GCC will now emit both .gnu_attribute and
.mspabi_attribute directives to indicate what options the source file was
compiled with.

The assembler will now check the values set in these directives against the
options that the it has been invoked with. If there is a discrepancy, the
assembler will exit with an error.

bfd	* elf32-msp430.c (elf32_msp430_merge_mspabi_attributes): Rename to..
	(elf32_msp430_merge_msp430_attributes): Add support for merging the GNU
	object attribute for data region.

binutils* readelf.c (display_msp430_gnu_attribute): New.
	(process_arch_specific): Use msp430 specific handler for GNU
	attributes.

gas	* config/tc-msp430.c (md_parse_option): Set lower_data_region_only to
	FALSE if the data region is set to "upper", "either" or "none".
	(msp430_object_attribute): New.
	(md_pseudo_table): Handle .mspabi_attribute and .gnu_attribute.
	(msp430_md_end): Replace hard-coded attribute values with enums.
	Handle data region object attribute.
	* doc/as.texi: Document MSP430 Data Region object attribute.
	* doc/c-msp430.texi: Document the .mspabi_attribute directive.
	* testsuite/gas/msp430/attr-430-small-bad.d: New test.
	* testsuite/gas/msp430/attr-430-small-bad.l: New test.
	* testsuite/gas/msp430/attr-430-small-good.d: New test.
	* testsuite/gas/msp430/attr-430-small.s: New test.
	* testsuite/gas/msp430/attr-430x-large-any-bad.d: New test.
	* testsuite/gas/msp430/attr-430x-large-any-bad.l: New test.
	* testsuite/gas/msp430/attr-430x-large-any-good.d: New test.
	* testsuite/gas/msp430/attr-430x-large-any.s: New test.
	* testsuite/gas/msp430/attr-430x-large-lower-bad.d: New test.
	* testsuite/gas/msp430/attr-430x-large-lower-bad.l: New test.
	* testsuite/gas/msp430/attr-430x-large-lower-good.d: New test.
	* testsuite/gas/msp430/attr-430x-large-lower.s: New test.
	* testsuite/gas/msp430/msp430.exp: Run new tests.

include	* elf/msp430.h: Add enums for MSPABI and GNU object attribute tag names
	and values.

ld	* testsuite/ld-msp430-elf/attr-gnu-main.s: New test.
	* testsuite/ld-msp430-elf/attr-gnu-obj.s: New test.
	* testsuite/ld-msp430-elf/attr-gnu-region-lower-upper.d: New test.
	* testsuite/ld-msp430-elf/attr-gnu-region-lower.d: New test.
	* testsuite/ld-msp430-elf/attr-gnu-region-upper.d: New test.
	* testsuite/ld-msp430-elf/msp430-elf.exp: Run new tests.
2019-10-07 16:34:31 +01:00
Alan Modra 93370e8e7b Re: PowerPC PIC vs. DLL TLS issues
A bug crept into commit f749f26eea, which could cause linker
segfaults when creating PIEs.  This patch fixes it.

	* elf64-ppc.c (ppc64_elf_size_dynamic_sections): Do allocate
	space for local got non-tls relocs when PIE.
2019-10-07 23:23:21 +10:30
Andrew Burgess 60ff3cd784 gdb/testsuite/ada: Handle missing debug info case
Update a test script to handle the case where missing Ada debug
information means we can't catch exceptions.  This was discussed on
the list here:

  https://sourceware.org/ml/gdb-patches/2019-08/msg00607.html

And is similar to code that already exists in the test scripts
gdb.ada/catch_ex.exp and gdb.ada/mi_catch_ex.exp.

gdb/testsuite/ChangeLog:

	* gdb.ada/catch_ex_std.exp: Handle being unabled to catch Ada
	exceptions due to missing debug information.
2019-10-07 13:17:49 +01:00
Andrew Burgess b2caee6aaa gdb: Rename structures within ctfread.c
Commit:

  commit 30d1f01849
  Date:   Mon Oct 7 00:46:52 2019 +0000

      gdb: CTF support

Introduces some structures with names that are already in use within
GBB, this violates C++'s one-definition rule.  Specifically the
structures 'nextfield' and 'field_info' are now defined in
dwarf2read.c and ctfread.c.

This commit renames the new structures (in ctfread.c), adding a 'ctf_'
prefix.  Maybe we should consider renaming the DWARF versions too in
the future to avoid accidental conflicts.

gdb/ChangeLog:

	* ctfread.c (struct nextfield): Renamed to ...
	(struct ctf_nextfield): ... this.
	(struct field_info): Renamed to ...
	(strut ctf_field_info): ... this.
	(attach_fields_to_type): Update for renamed structures.
	(ctf_add_member_cb): Likewise.
	(ctf_add_enum_member_cb): Likewise.
	(process_struct_members): Likewise.
	(process_enum_type): Likewise.
2019-10-07 13:03:52 +01:00
Tom de Vries dfee856674 [gdb/testsuite] Update expected _gdb_major/_gdb_minor in default.exp
Now that commit "225f296a023 Change gdb/version.in to 9.0.50.DATE-git (new
version numbering scheme)" has changed the gdb version number, we see:
...
FAIL: gdb.base/default.exp: show convenience ($_gdb_major = 8 not found)
...

Fix this by updating the expected _gdb_major/_gdb_minor to 9.1.

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

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

	* gdb.base/default.exp: Expect _gdb_major/_gdb_minor to be 9.1.
2019-10-07 12:50:04 +02:00
Andrew Burgess 3d63690a03 gdb/testsuite: Add gdb_test_name variable
This commit adds a new feature to gdb_test_multiple, an automatically
created variable gdb_test_name.  The idea is to make it easier to
write tests using gdb_test_multiple, and avoid places where the string
passed to pass/fail within an action element is different to the
message passed to the top level gdb_test_multiple.

As an example, previously you might write this:

    gdb_test_multiple "print foo" "test foo" {
       -re "expected output 1" {
           pass "test foo"
       }
       -re "expected output 2" {
           fail "test foo"
       }
    }

This is OK, but it's easy for the pass/fail strings to come out of
sync, or contain a typo.  A better version would look like this:

    set testname "test foo"
    gdb_test_multiple "print foo" $testname {
       -re "expected output 1" {
           pass $testname
       }
       -re "expected output 2" {
           fail $testname
       }
    }

This is better, but its a bit of a drag having to create a new
variable each time.

After this patch you can now write this:

    gdb_test_multiple "print foo" "test foo" {
       -re "expected output 1" {
           pass $gdb_test_name
       }
       -re "expected output 2" {
           fail $gdb_test_name
       }
    }

The $gdb_test_name is setup by gdb_test_multiple, and cleaned up once
the test has completed.  Nested calls to gdb_test_multiple are
supported, though $gdb_test_name will only ever contain the inner most
test message (which is probably what you want).

My only regret is that '$gdb_test_name' is so long, but I wanted
something that was unlikely to clash with any existing variable name,
or anything that a user is likely to want to use.

I've tested this on x86-64/GNU Linux and see no test regressions, and
I've converted one test script over to make use of this new technique
both as an example, and to ensure that the new facility doesn't get
broken.  I have no plans to convert all tests over to this technique,
but I hope others will find this useful for writing tests in the
future.

gdb/testsuite/ChangeLog:

	* lib/gdb.exp (gdb_test_multiple): Add gdb_test_name mechanism.
	* gdb.base/annota1.exp: Update to use gdb_test_name.
2019-10-07 11:26:11 +01:00
Tom de Vries 760f7560fd [gdb/doc] Fix some typos
Fix typos 'prevsiouly -> previously' and 'corresonding -> corresponding' in the
docs.

gdb/doc/ChangeLog:

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

	* gdb.texinfo: Fix typo.
	* guile.texi: Same.
	* python.texi: Same.
2019-10-07 09:51:18 +02:00
Jan Beulich ad7c657b9e add missing ChangeLog entry for d241b91073 2019-10-07 08:40:03 +02:00
Jan Beulich d241b91073 x86/Intel: correct MOVSD and CMPSD handling
First and foremost the EsSeg attribute was misplaced for CMPSD. Then
both it and MOVSD were lacking Dword on both of their operands.
Finally string insns with multiple operands and requiring use of ES:
had the wrong operand number reported in the diagnostic.
2019-10-07 08:38:01 +02:00
Alan Modra 847d518374 Bogus "final link failed" messages
This patch is a result of noticing messages like the following:
tmpdir/tls32.o: in function `_start':
(.text+0x1c): unresolvable R_PPC_REL24 relocation against symbol `__tls_get_addr_opt'
./ld-new: final link failed: symbol needs debug section which does not exist

The "needs debug section" comes from attempting to use debug info to
find source line information to print the first error message.  That
error isn't of interest to the user, and any previous bfd_error value
which might be of interest is overwritten.  So save and restore
bfd_error around the fancy error reporting code.

That still doesn't leave us with a clean bfd_error.  Now we get
./ld-new: final link failed: nonrepresentable section on output
An unresolvable relocation surely doesn't mean there is some bfd
section that ld doesn't know how to output!  Digging into that showed
a _bfd_elf_section_from_bfd_section failure attempting to find an elf
section correcsponding to ".interp".  So don't go looking for elf
sections on linker created bfd sections.

And then fix the linker testsuite which expected the bogus message..

bfd/
	* elflink.c (elf_fixup_link_order): Don't attempt to find
	an elf_section for linker created bfd sections.
ld/
	* ldmisc.c (vfinfo): Save and restore bfd_error around bfd
	function calls that might set it.
	* testsuite/ld-elf/indirect.exp: Don't expect "nonrepresentable
	section" message.
2019-10-07 13:37:23 +10:30
Alan Modra c3614cffc8 PowerPC TLS tests
This patch adds some --no-tls-optimize tests and performs some of the
existing dynamic tests with tls markers in order to catch any
regression in PLT counting.

	* testsuite/ld-powerpc/tlsexe.r: Adjust for added TLSMARK symbol.
	* testsuite/ld-powerpc/tlsexe32.r: Likewise.
	* testsuite/ld-powerpc/tlsso.r: Likewise.
	* testsuite/ld-powerpc/tlsso32.r: Likewise.
	* testsuite/ld-powerpc/tls32no.d,
	* testsuite/ld-powerpc/tls32no.g: New test files.
	* testsuite/ld-powerpc/tlsexe32no.d,
	* testsuite/ld-powerpc/tlsexe32no.g,
	* testsuite/ld-powerpc/tlsexe32no.r: New test files.
	* testsuite/ld-powerpc/tlsexeno.d,
	* testsuite/ld-powerpc/tlsexeno.g,
	* testsuite/ld-powerpc/tlsexeno.r: New test files.
	* testsuite/ld-powerpc/tlsexetocno.d,
	* testsuite/ld-powerpc/tlsexetocno.g: New test files.
	* testsuite/ld-powerpc/tlsno.d,
	* testsuite/ld-powerpc/tlsno.g: New test files.
	* testsuite/ld-powerpc/tlstocno.d,
	* testsuite/ld-powerpc/tlstocno.g: New test files.
	* testsuite/ld-powerpc/powerpc.exp: Run new tests.
2019-10-07 13:34:40 +10:30
Alan Modra 7d04a20ae4 PowerPC TLS miscounting PLT for __tls_get_addr
ppc*_elf_tls_optimize decrements the PLT refcount for __tls_get_addr
when a GD or LD sequence can be optimized.  Without tls marker relocs
this must be done when processing the argument setup relocations.
With marker relocs it's better done when processing the marker reloc.
But don't count them both ways.

Seen as "unresolvable R_PPC_REL24 relocation against symbol
`__tls_get_addr_opt'" (and other branch relocs).

	* elf32-ppc.c (ppc_elf_tls_optimize): Don't process R_PPC_TLSLD
	with non-local symbol.  Don't double count __tls_get_addr calls
	with marker relocs.
	* elf64-ppc.c (ppc64_elf_tls_optimize): Likewise.
2019-10-07 13:21:02 +10:30
Alan Modra 9737e8af48 PowerPC section flag tidy
has_tls_get_addr_call is no longer named correctly as the flag is
only set on finding a __tls_get_addr call without tlsld/tlsgd marker
relocations.

	* elf32-ppc.c (nomark_tls_get_addr): Rename from has_tls_get_addr_call
	throughout.
	* elf64-ppc.c (nomark_tls_get_addr): Likewise.
2019-10-07 13:18:32 +10:30
Alan Modra 8154f49cf4 ld-arm/tls-gdesc-neg test
Fixes a failure on armeb-linuxeabi.

	* testsuite/ld-arm/tls-gdesc-neg.d: Relax target match.
2019-10-07 13:14:11 +10:30
Weimin Pan 30d1f01849 gdb: CTF support
This patch adds the CTF (Compact Ansi-C Type Format) support in gdb.
Two submissions on which this gdb work depends were posted earlier
in May:

 * On the binutils mailing list - adding libctf which creates, updates,
   reads, and manipulates the CTF data.
 * On the gcc mailing list - expanding gcc to directly emit the CFT data
   with a new command line option -gt.

CTF is a reduced form of debugging information whose main purpose is to
describe the type of C entities such as structures, unions, typedefs and
function arguments at the global scope only. It does not contain debug
information about source lines, location expressions, or local variables.
For more information on CTF, see the documentation in the libdtrace-ctf
source tree, available here:

<https://raw.githubusercontent.com/oracle/libdtrace-ctf/master/doc/ctf-format>.

This patch expands struct elfinfo by adding the .ctf section, which
contains CTF debugging info, and modifies elf_symfile_read() to read it.
If both DWARF and CTF exist in a program, only DWARF will be read. CTF data
will be read only when there is no DWARF. The two-stage symbolic reading
and setting strategy, partial and full, was used.

File ctfread.c contains functions to transform CTF data into gdb's internal
symbol table structures by iterately reading entries from CTF sections
of "data objects", "function info", "variable info", and "data types"
when setting up either partial or full symbol table. If the ELF symbol table
is available, e.g. not stripped, the CTF reader will associate the found
type information with these symbol entries. Due to the proximity between DWARF
and CTF (CTF being a much simplified subset of DWARF), some DWARF implementation
was reused to support CTF.

Test cases ctf-constvars.exp, ctf-cvexpr.exp, ctf-ptype.exp, and ctf-whatis.exp
have been added to verify the correctness of this support.

This patch has missing features and limitations which we will add and
address in the future patches.

gdb/ChangeLog
+2019-10-07  Weimin Pan  <weimin.pan@oracle.com>
+
+       * gdb/ctfread.c: New file.
+       * gdb/ctfread.h: New file.
+       * gdb/elfread.c: Include ctfread.h.
+       (struct elfinfo text_p): New member ctfsect.
+       (elf_locate_sections): Mark CTF section.
+       (elf_symfile_read): Call elfctf_build_psymtabs.
+       * gdb/Makefile.in (LIBCTF): Add.
+       (CLIBS): Use it.
+       (CDEPS): Likewise.
+       (DIST): Add ctfread.c.
+       * Makefile.def (dependencies): Add all-libctf to all-gdb
+       * Makefile.in: Add "all-gdb: maybe-all-libctf"
+
gdb/testsuite/ChangeLog
+2019-10-07  Weimin Pan  <weimin.pan@oracle.com>
+
+       * gdb.base/ctf-whatis.exp: New file.
+       * gdb.base/ctf-whatis.c: New file.
+       * gdb.base/ctf-ptype.exp: New file.
+       * gdb.base/ctf-ptype.c: New file.
+       * gdb.base/ctf-constvars.exp: New file.
+       * gdb.base/ctf-constvars.c: New file.
+       * gdb.base/ctf-cvexpr.exp: New file.
+
2019-10-07 02:26:27 +00:00
Weimin Pan 518fe38cd9 Renaming of ctf (the trace format) files 2019-10-07 01:44:45 +00:00