Maciej W. Rozycki [Thu, 29 Mar 2018 13:09:48 +0000 (14:09 +0100)]
PR binutils/22875: MIPS: Remove duplicate unsupported relocation processing
Remove a duplicate `unsupported relocation type' message and the setting
of the `bfd_error_bad_value' error from `mips_elf32_rtype_to_howto',
added with commit
f3185997ac09 ("PR 22875: Stop strip corrupting unknown
relocs"), <https://sourceware.org/ml/binutils/2018-02/msg00445.html>.
This message is already produced and the `bfd_error_bad_value' error set
by `mips_elf32_rtype_to_howto' before a NULL howto is returned, so there
is no need to repeat these actions here.
bfd/
* elf32-mips.c (mips_info_to_howto_rel): Remove the calls to
`_bfd_error_handler' and to set the `bfd_error_bad_value' error.
GDB Administrator [Thu, 29 Mar 2018 00:00:32 +0000 (00:00 +0000)]
Automatic date update in version.in
Maciej W. Rozycki [Wed, 28 Mar 2018 21:42:17 +0000 (22:42 +0100)]
BFD/PA: Remove ATTRIBUTE_UNUSED from `elf_hppa_info_to_howto_rel'
Remove ATTRIBUTE_UNUSED annotation from the `abfd' parameter in
`elf_hppa_info_to_howto' now that commit
f3185997ac09 ("PR 22875: Stop
strip corrupting unknown relocs"),
<https://sourceware.org/ml/binutils/2018-02/msg00445.html>, made it
used.
bfd/
* elf-hppa.h (elf_hppa_info_to_howto_rel): Remove
ATTRIBUTE_UNUSED from `abfd'.
Maciej W. Rozycki [Wed, 28 Mar 2018 21:42:17 +0000 (22:42 +0100)]
BFD/PA: Correct formatting in `elf_hppa_info_to_howto_rel'
Wrap the `_bfd_error_handler' call to fit in 80 columns, fixing commit
e8f5af786c76 ("Use standardized error message for unrecognized relocs.").
bfd/
* elf-hppa.h (elf_hppa_info_to_howto_rel): Correct
`_bfd_error_handler' call formatting.
Maciej W. Rozycki [Wed, 28 Mar 2018 21:42:17 +0000 (22:42 +0100)]
MIPS/BFD: Call `mips_elf32_rtype_to_howto' directly with o32 (ChangeLog)
Correct ChangeLog date for commit
8205a328f8b8 ("MIPS/BFD: Call
`mips_elf32_rtype_to_howto' directly with o32").
Cary Coutant [Wed, 28 Mar 2018 00:49:49 +0000 (17:49 -0700)]
Use top-level config support for enabling plugins.
Also recognizes --plugin options when plugins are disabled.
2018-03-28 Cary Coutant <ccoutant@gmail.com>
gold/
PR gold/21423
PR gold/22500
* configure.ac: Call AC_USE_SYSTEM_EXTENSIONS.
Replace check for --enable-plugins with AC_PLUGINS.
* options.cc (parse_plugin, parse_plugin_opt): Remove #ifdef.
(General_options::finalize): Check if plugins enabled.
* options.h (--plugin, --plugin-opt): Define even if plugins not
enabled.
* Makefile.in: Regenerate.
* aclocal.m4: Regenerate.
* configure: Regenerate.
* testsuite/Makefile.in: Regenerate.
Maciej W. Rozycki [Wed, 28 Mar 2018 20:37:37 +0000 (21:37 +0100)]
MIPS/BFD: Call `mips_elf32_rtype_to_howto' directly with o32
Call `mips_elf32_rtype_to_howto' directly rather than via the
`->elf_backend_mips_rtype_to_howto' method in the o32 backend,
complementing commit
861fb55ab50a ("Defer allocation of R_MIPS_REL32 GOT
slots"), <https://sourceware.org/ml/binutils/2008-08/msg00096.html>, and
reverting the change to `mips_info_to_howto_rel' originally made with
commit
0a44bf6950b3 ("mips-vxworks support"),
<https://sourceware.org/ml/binutils/2006-03/msg00179.html>.
With `mips_vxworks_rtype_to_howto' gone there is a single backend method
used across all o32 targets, so there in no need for the indirection and
the associated extra cost. This also makes the o32 backend consistent
with the n32 and n64 backends.
bfd/
* elf32-mips.c (mips_info_to_howto_rel): Call
`mips_elf32_rtype_to_howto' directly rather than via
`->elf_backend_mips_rtype_to_howto'.
Renlin Li [Wed, 28 Mar 2018 17:06:05 +0000 (18:06 +0100)]
[2/2][LD][AARCH64]Add BFD_RELOC_AARCH64_TLSLE_LDST8/16/32/64_TPREL_LO12 support in LD.
This patch adds the following relocation support into binutils bfd linker.
BFD_RELOC_AARCH64_TLSLE_LDST16_TPREL_LO12,
BFD_RELOC_AARCH64_TLSLE_LDST16_TPREL_LO12_NC,
BFD_RELOC_AARCH64_TLSLE_LDST32_TPREL_LO12,
BFD_RELOC_AARCH64_TLSLE_LDST32_TPREL_LO12_NC,
BFD_RELOC_AARCH64_TLSLE_LDST64_TPREL_LO12,
BFD_RELOC_AARCH64_TLSLE_LDST64_TPREL_LO12_NC,
BFD_RELOC_AARCH64_TLSLE_LDST8_TPREL_LO12,
BFD_RELOC_AARCH64_TLSLE_LDST8_TPREL_LO12_NC.
Those relocations includes both ip64 and ilp32 variant.
Renlin Li [Wed, 28 Mar 2018 17:03:55 +0000 (18:03 +0100)]
[1/2][GAS][AARCH64]Add BFD_RELOC_AARCH64_TLSLE_LDST8/16/32/64_TPREL_LO12 support in GAS.
This patch adds the following relocation support into binutils gas.
BFD_RELOC_AARCH64_TLSLE_LDST16_TPREL_LO12,
BFD_RELOC_AARCH64_TLSLE_LDST16_TPREL_LO12_NC,
BFD_RELOC_AARCH64_TLSLE_LDST32_TPREL_LO12,
BFD_RELOC_AARCH64_TLSLE_LDST32_TPREL_LO12_NC,
BFD_RELOC_AARCH64_TLSLE_LDST64_TPREL_LO12,
BFD_RELOC_AARCH64_TLSLE_LDST64_TPREL_LO12_NC,
BFD_RELOC_AARCH64_TLSLE_LDST8_TPREL_LO12,
BFD_RELOC_AARCH64_TLSLE_LDST8_TPREL_LO12_NC.
Those relocations includes both ip64 and ilp32 variant.
Cary Coutant [Wed, 28 Mar 2018 01:24:48 +0000 (18:24 -0700)]
Add support for R_AARCH64_TLSLE_LDST8_TPREL_LO12, etc.
elfcpp/
PR gold/22969
* aarch64.h: Fix spelling of R_AARCH64_TLSLE_LDST16_TPREL_LO12_NC.
gold/
PR gold/22969
* aarch64-reloc.def: Add TLSLE_LDST* relocations.
* aarch64.cc (Target_aarch64::optimize_tls_reloc): Likewise.
(Target_aarch64::Scan::local): Likewise.
(Target_aarch64::Scan::global): Likewise.
(Target_aarch64::Relocate::relocate): Likewise.
(Target_aarch64::Relocate::relocate_tls): Likewise.
Jan Beulich [Wed, 28 Mar 2018 12:25:07 +0000 (14:25 +0200)]
x86: drop VecESize
It again can be inferred from other information.
The vpopcntd templates all need to have Dword added to their memory
operands; the lack thereof was actually a bug preventing certain Intel
syntax code to assemble, so test cases get extended.
Jan Beulich [Wed, 28 Mar 2018 12:24:05 +0000 (14:24 +0200)]
x86: convert broadcast insn attribute to boolean
The (only) valid broadcast type for an insn can be inferred from other
information.
Jan Beulich [Wed, 28 Mar 2018 12:22:56 +0000 (14:22 +0200)]
x86: fold to-scalar-int conversion insns
Jan Beulich [Wed, 28 Mar 2018 12:22:00 +0000 (14:22 +0200)]
x86: don't show suffixes for to-scalar-int conversion insns
In the course of folding their patterns (possible now that the pointless
and partly even bogus VecESize are no longer in the way) I've noticed
that vcvt*2usi, other than their vcvt*2si counterparts, don't allow for
any suffixes. As that is supposedly intentional, make the disassembler
consistently omit suffixes for all to-scalar-int conversion insns.
Eric Botcazou [Wed, 28 Mar 2018 10:17:15 +0000 (12:17 +0200)]
PR ld/22972 on SPARC.
This is a regression for the corner case of a hidden symbol in a PIC/PIE
binary which is subject to both a new-style GOTDATA relocation and an
old-style GOT relocation. In this case, depending on the link order,
the R_SPARC_RELATIVE dynamic relocation for the GOT slot needed because
of the old-style relocation can be replaced with R_SPARC_NONE coming
from the GOTDATA relocation.
The fix simply records whether an old-style GOT relocation is seen for a
symbol and prevents the R_SPARC_NONE from being generated in this case.
bfd/
* elfxx-sparc.c (struct _bfd_sparc_elf_link_hash_entry): Add new flag
has_old_style_got_reloc.
(_bfd_sparc_elf_check_relocs) <GOT relocations>: Set it for old-style
relocations. Fix a couple of long lines.
(_bfd_sparc_elf_relocate_section) <R_SPARC_GOTDATA_OP>: Do not generate
a R_SPARC_NONE for the GOT slot if the symbol is also subject to
old-style GOT relocations.
ld/
* testsuite/ld-sparc/sparc.exp: Add test for mixed GOTDATA/GOT relocs.
* testsuite/ld-sparc/gotop-hidden.c: New file.
* testsuite/ld-sparc/got-hidden32.s: Likewise.
* testsuite/ld-sparc/got-hidden64.s: Likewise.
* testsuite/ld-sparc/pass.out: Likewise.
Nick Clifton [Wed, 28 Mar 2018 08:44:45 +0000 (09:44 +0100)]
Enhance the AARCH64 assembler to support LDFF1xx instructions which use REG+REG addressing with an assumed offset register.
PR 22988
opcode * opcode/aarch64.h (enum aarch64_opnd): Add
AARCH64_OPND_SVE_ADDR_R.
opcodes * aarch64-tbl.h (aarch64_opcode_table): Add entries for LDFF1xx
instructions with only a base address register.
* aarch64-opc.c (operand_general_constraint_met_p): Add code to
handle AARHC64_OPND_SVE_ADDR_R.
(aarch64_print_operand): Likewise.
* aarch64-asm-2.c: Regenerate.
* aarch64_dis-2.c: Regenerate.
* aarch64-opc-2.c: Regenerate.
gas * config/tc-aarch64.c (parse_operands): Add code to handle
AARCH64_OPN_SVE_ADDR_R.
* testsuite/gas/aarch64/sve.s: Add tests for LDFF1xx instructions
with an assumed XZR offset address register.
* testsuite/gas/aarch64/sve.d: Update expected disassembly.
Roland McGrath [Tue, 27 Mar 2018 23:27:03 +0000 (16:27 -0700)]
gold/testsuite: Fix bad regexp in split_x86_64.sh
gold/
* testsuite/split_x86_64.sh: Fix bad regexp.
GDB Administrator [Wed, 28 Mar 2018 00:00:30 +0000 (00:00 +0000)]
Automatic date update in version.in
Tom Tromey [Thu, 22 Mar 2018 16:41:58 +0000 (10:41 -0600)]
Remove cleanups from prompt_for_continue
This removes the cleanups from prompt_for_continue by the use of
unique_xmalloc_ptr.
gdb/ChangeLog
2018-03-27 Tom Tromey <tom@tromey.com>
* utils.c (prompt_for_continue): Use unique_xmalloc_ptr.
Tom Tromey [Thu, 22 Mar 2018 16:31:41 +0000 (10:31 -0600)]
Remove cleanups from gdb_readline_wrapper
This removes some cleanups from gdb_readline_wrapper by changing the
existing gdb_readline_wrapper_cleanup struct to have a constructor and
destructor, and then changing gdb_readline_wrapper to simply
instantiate it on the stack.
gdb/ChangeLog
2018-03-27 Pedro Alves <palves@redhat.com>
Tom Tromey <tom@tromey.com>
* top.c (class gdb_readline_wrapper_cleanup): Add constructor,
destructor. Now a class.
(gdb_readline_wrapper_cleanup): Remove function.
(gdb_readline_wrapper): Remove cleanups.
Tom Tromey [Wed, 14 Mar 2018 22:38:02 +0000 (16:38 -0600)]
C++-ify typedef hash
This changes the typedef_hash_table structure to be a C++ class. It
adds constructors and destructors and changes some functions to be
methods of the class. Then it changes the various users of this class
to adapt. This allows for the removal of some cleanups.
Regression tested by the buildbot.
gdb/ChangeLog
2018-03-27 Tom Tromey <tom@tromey.com>
* typeprint.h (struct type_print_options) <local_typedefs,
global_typedefs>: Remove "struct" keyword.
(class typedef_hash_table): New class.
(recursively_update_typedef_hash, add_template_parameters)
(create_typedef_hash, free_typedef_hash, copy_typedef_hash)
(find_typedef_in_hash): Don't declare.
* typeprint.c (struct typedef_hash_table): Move to typeprint.h.
(typedef_hash_table::recursively_update): Rename from
recursively_update_typedef_hash. Now a member.
(typedef_hash_table::add_template_parameters): Rename from
add_template_parameters. Now a member.
(typedef_hash_table::typedef_hash_table): Now a constructor;
rename from create_typedef_hash.
(typedef_hash_table::~typedef_hash_table): Now a destructor;
rename from free_typedef_hash.
(do_free_typedef_hash, make_cleanup_free_typedef_hash)
(do_free_global_table): Remove.
(typedef_hash_table::typedef_hash_table): New constructor; renamed
from copy_type_recursive.
(create_global_typedef_table): Remove.
(typedef_hash_table::find_global_typedef): Now a member of
typedef_hash_table.
(typedef_hash_table::find_typedef): Rename from
find_typedef_in_hash; now a member.
(whatis_exp): Update.
* extension.h (struct ext_lang_type_printers): Add constructor and
destructor.
(start_ext_lang_type_printers, free_ext_lang_type_printers): Don't
declare.
* extension.c (ext_lang_type_printers::ext_lang_type_printers):
Now a constructor; rename from start_ext_lang_type_printers.
(ext_lang_type_printers): Now a destructor; rename from
free_ext_lang_type_printers.
* c-typeprint.c (find_typedef_for_canonicalize, c_print_type_1):
Update.
(c_type_print_base_struct_union): Update. Remove cleanups.
Tom Tromey [Tue, 27 Mar 2018 14:55:13 +0000 (08:55 -0600)]
Include <cmath> in dwarf-index-write.c
On x86-64 Fedora 26, when building with the system gcc, I get:
../../binutils-gdb/gdb/dwarf-index-write.c: In member function ‘void debug_names::build()’:
../../binutils-gdb/gdb/dwarf-index-write.c:705:13: error: ‘pow’ is not a member of ‘std’
There are actually more messages, but this is sufficient to show the
problem.
The fix is to include <cmath>.
I'm checking this in as obvious. Tested by building.
gdb/ChangeLog
2018-03-27 Tom Tromey <tom@tromey.com>
* dwarf-index-write.c: Include <cmath>.
Joel Brobecker [Tue, 27 Mar 2018 14:17:45 +0000 (09:17 -0500)]
set varsize-limit: New GDB setting for maximum dynamic object size
This is a command we somehow forgot to contribute at the time the Ada
language was first contributed to the FSF. This command allows
the user to change the maximum size we allow when reading memory
from dynamic objects (the default is 65536 bytes).
At the moment, this limit is only used by Ada, and so the implementation
is kept inside ada-lang.c. However, it is conceivable that other language
might want to use it also to handle the same kind of issues; for instance,
this might be useful when handling dynamic types in C. So the name
of the setting was made language-neutral, to allow for this.
Note that an alias for "set var" needs to be introduced as well.
We are not adding a test for that, since this is a feature that is
already exercized by numerous existing tests.
gdb/ChangeLog
* NEWS: Add entry describing new "set|show varsize-limit" command.
* ada-lang.c (_initialize_ada_language): Add "set/show varsize-limit"
command.
* printcmd.c (_initialize_printcmd): Add "set var" alias of
"set variable".
gdb/doc/ChangeLog:
* gdb.texinfo (Ada Settings): New subsubsection.
gdb/testsuite/ChangeLog:
* gdb.ada/varsize_limit: New testcase.
Tested on x86_64-linux.
Simon Marchi [Tue, 27 Mar 2018 14:07:44 +0000 (10:07 -0400)]
Move DWARF index-related things to a separate file
I want to add a DWARF index-related feature (automatically produce index
files when loading objfiles in GDB), but I don't want to add many
hundred lines to the already too big dwarf2read.c. I thought it would
be a logical split to move everything related to the DWARF index to its
own file.
I first tried to move everything that reads and writes DWARF indices to
a separate file, but found that the "read" part is a little bit
entangled with the rest of dwarf2read.c, so the line is hard to draw
about where to split. The write part is quite isolated though, so I
moved this part to a new file, dwarf-index-write.c. Some things are
necessary to both reading and writing indices, so I placed them in
dwarf-index-common.{c,h}. The idea would be to have a
dwarf-index-read.c eventually that would use it too (for now that code
is still in dwarf2read.c).
This required moving some things to a new dwarf2read.h header, so they
can be read by the code that writes the index.
The patch is big in number of lines, but it's all existing code being
moved around. The only changes are that some functions are not static
anymore, a declaration is added in a .h file, and therefore the comment
is moved there.
I built-tested it with a little and big endian target.
This patch is also available on the users/simark/split-dwarf2read
branch.
gdb/ChangeLog:
* Makefile.in (COMMON_SFILES): Add dwarf-index-common.c and
dwarf-index-write.c
(HFILES_NO_SRCDIR): Add dwarf-index-common.h and dwarf2read.h.
* dwarf-index-common.c: New file.
* dwarf-index-common.h: New file.
* dwarf-index-write.c: New file.
* dwarf2read.c: Include dwarf2read.h and dwarf-index-common.h.
(struct dwarf2_section_info): Move from here.
(dwarf2_section_info_def): Likewise.
(DEF_VEC_O (dwarf2_section_info_def)): Likewise.
(offset_type): Likewise.
(DW2_GDB_INDEX_SYMBOL_STATIC_SET_VALUE): Likewise.
(DW2_GDB_INDEX_SYMBOL_KIND_SET_VALUE): Likewise.
(DW2_GDB_INDEX_CU_SET_VALUE): Likewise.
(byte_swap): Likewise.
(MAYBE_SWAP): Likewise.
(dwarf2_per_cu_ptr): Likewise.
(DEF_VEC_P (dwarf2_per_cu_ptr)): Likewise.
(struct tu_stats): Likewise.
(struct dwarf2_per_objfile): Likewise.
(struct dwarf2_per_cu_data): Likewise.
(struct signatured_type): Likewise.
(sig_type_ptr): Likewise.
(DEF_VEC_P (sig_type_ptr)): Likewise.
(INDEX4_SUFFIX): Likewise.
(INDEX5_SUFFIX): Likewise.
(DEBUG_STR_SUFFIX): Likewise.
(dwarf2_read_section): Make non-static.
(mapped_index_string_hash): Move from here.
(dwarf5_djb_hash): Likewise.
(file_write): Likewise.
(class data_buf): Likewise.
(struct symtab_index_entry): Likewise.
(struct mapped_symtab): Likewise.
(find_slot): Likewise.
(hash_expand): Likewise.
(add_index_entry): Likewise.
(uniquify_cu_indices): Likewise.
(class c_str_view): Likewise.
(class c_str_view_hasher): Likewise.
(class vector_hasher): Likewise.
(write_hash_table): Likewise.
(psym_index_map): Likewise.
(struct addrmap_index_data): Likewise.
(add_address_entry): Likewise.
(add_address_entry_worker): Likewise.
(write_address_map): Likewise.
(symbol_kind): Likewise.
(write_psymbols): Likewise.
(struct signatured_type_index_data): Likewise.
(write_one_signatured_type): Likewise.
(recursively_count_psymbols): Likewise.
(recursively_write_psymbols): Likewise.
(class debug_names): Likewise.
(check_dwarf64_offsets): Likewise.
(psyms_seen_size): Likewise.
(write_gdbindex): Likewise.
(write_debug_names): Likewise.
(assert_file_size): Likewise.
(write_psymtabs_to_index): Likewise.
(save_gdb_index_command): Likewise.
(_initialize_dwarf2_read): Don't register the "save gdb-index"
command.
* dwarf2read.h: New file.
Joel Brobecker [Tue, 27 Mar 2018 13:57:16 +0000 (08:57 -0500)]
problem looking up some symbols when they have a linkage name
This patch fixes a known failure in gdb.ada/maint_with_ada.exp
(maintenance check-psymtabs). Another way to witness the same
issue is by considering the following Ada declarations...
type Wrapper is record
A : Integer;
end record;
u00045 : constant Wrapper := (A => 16#
060287af#);
pragma Export (C, u00045, "symada__cS");
... which declares a variable name "u00045" but with a linkage
name which is "symada__cS". This variable is a record with one
component, the Ada equivalent of a struct with one field in C.
Trying to print that variable's value currently yields:
(gdb) p /x <symada__cS>
'symada(char, signed)' has unknown type; cast it to its declared type
This indicates that GDB was only able to find the minimal symbol,
but not the full symbol. The expected output is:
(gdb) print /x <symada__cS>
$1 = (a => 0x60287af)
The error message gives a hint about what's happening: We processed
the symbol through gdb_demangle, which in the case of this particular
symbol name, ends up matching the C++ naming scheme. As a result,
the demangler transforms our symbol name into 'symada(char, signed)',
thus breaking Ada lookups.
This patch fixes the issue by first introducing a new language_defn
attribute called la_store_sym_names_in_linkage_form_p, which is a boolean
to be set to true for the few languages that do not want their symbols
to have their names stored in demangled form, and false otherwise.
We then use this language attribute to skip the call to gdb_demangle
for all languages whose la_store_sym_names_in_linkage_form_p is true.
In terms of the selection of languages for which the new attribute
is set to true, the selection errs on the side of preserving the
existing behavior, and only changes the behavior for the languages
where we are certain storing symbol names in demangling form is not
needed. It is conceivable that other languages might be in the same
situation, but I not knowing in detail the symbol name enconding
strategy, I decided to play it safe and let other language maintainers
potentially adjust their language if it makes sense to do so.
gdb/ChangeLog:
PR gdb/22670
* dwarf2read.c (dwarf2_physname): Do not return the demangled
symbol name if the CU's language stores symbol names in linkage
format.
* language.h (struct language_defn)
<la_store_sym_names_in_linkage_form_p>: New field. Adjust
all instances of this struct.
gdb/testsuite/ChangeLog:
* gdb.ada/maint_with_ada.exp: Remove PR gdb/22670 setup_kfail.
* gdb.ada/notcplusplus: New testcase.
* gdb.base/c-linkage-name.c: New file.
* gdb.base/c-linkage-name.exp: New testcase.
Tested on x86_64-linux.
This also passes AdaCore's internal GDB testsuite.
Tom Tromey [Fri, 23 Mar 2018 16:40:00 +0000 (10:40 -0600)]
Remove verbose code from backtrace command
In https://sourceware.org/ml/gdb-patches/2017-06/msg00741.html,
Pedro asks:
> Doesn't the "info verbose on" bit affect frame filters too?
The answer is that yes, it could. However, it's not completely
effective, because the C code can't guess how many frames might need
to be unwound to satisfy the request -- a frame filter will request as
many frames as it needs.
Also, I tried removing this code from backtrace, and I think the
result is better without it. In particular, now the expansion line
occurs just before the frame that caused the expansion, like:
(gdb) bt no-filters
#0 0x00007ffff576cecd in poll () from /lib64/libc.so.6
Reading in symbols for ../../binutils-gdb/gdb/event-loop.c...done.
#1 0x00000000007ecc33 in gdb_wait_for_event (block=1)
at ../../binutils-gdb/gdb/event-loop.c:772
#2 0x00000000007ec006 in gdb_do_one_event ()
at ../../binutils-gdb/gdb/event-loop.c:347
#3 0x00000000007ec03e in start_event_loop ()
at ../../binutils-gdb/gdb/event-loop.c:371
Reading in symbols for ../../binutils-gdb/gdb/main.c...done.
#4 0x000000000086693d in captured_command_loop (
Reading in symbols for ../../binutils-gdb/gdb/exceptions.c...done.
data=0x0) at ../../binutils-gdb/gdb/main.c:325
So, I am proposing this patch to simply remove this code.
gdb/ChangeLog
2018-03-26 Tom Tromey <tom@tromey.com>
* stack.c (backtrace_command_1): Remove verbose code.
Tom Tromey [Fri, 23 Mar 2018 16:32:26 +0000 (10:32 -0600)]
Simplify exception handling in py-framefilter.c
This patch changes py-framefilter.c as suggested by Pedro in:
https://sourceware.org/ml/gdb-patches/2017-06/msg00748.html
In particular, gdb exceptions are now caught at the outermost layer,
rather than in each particular function. This simplifies much of the
code.
gdb/ChangeLog
2018-03-26 Tom Tromey <tom@tromey.com>
* python/py-framefilter.c (py_print_type): Don't catch
exceptions. Return void.
(py_print_value): Likewise.
(py_print_single_arg): Likewise.
(enumerate_args): Don't catch exceptions.
(py_print_args): Likewise.
(py_print_frame): Likewise.
(gdbpy_apply_frame_filter): Catch exceptions here.
Tom Tromey [Fri, 23 Mar 2018 16:29:28 +0000 (10:29 -0600)]
Improve "backtrace" help text
This improves help text in stack.c in two ways. First, it removes
trailing newlines from various help strings. I think these are never
needed. Second, it adds a "Usage" line to the "backtrace" text, as
suggested by Pedro.
gdb/ChangeLog
2018-03-26 Tom Tromey <tom@tromey.com>
* stack.c (_initialize_stack): Remove trailing newlines from help
text. Add "Usage" line to "backtrace" help.
Tom Tromey [Tue, 25 Apr 2017 03:59:43 +0000 (21:59 -0600)]
Call wrap_hint in one more spot in py-framefilter.c
PR python/16486 notes that "bt" output is still wrapped differently
when a frame filter is in use. This patch brings it a bit closer by
adding one more wrap_hint call, in a place where stack.c does this as
well.
gdb/ChangeLog
2018-03-26 Tom Tromey <tom@tromey.com>
PR python/16486:
* python/py-framefilter.c (py_print_args): Call wrap_hint.
Tom Tromey [Tue, 25 Apr 2017 03:41:56 +0000 (21:41 -0600)]
Return EXT_LANG_BT_ERROR in one more spot in py-framefilter.c
While reading py-framefilter.c, I found one spot where an exception
could be caught but then not be turned into EXT_LANG_BT_ERROR. This
patch fixes this spot.
gdb/ChangeLog
2018-03-26 Tom Tromey <tom@tromey.com>
* python/py-framefilter.c (py_print_single_arg): Return
EXT_LANG_BT_ERROR from catch.
Tom Tromey [Tue, 25 Apr 2017 03:03:22 +0000 (21:03 -0600)]
Move some code later in backtrace_command_1
PR backtrace/15584 notes that some code in backtrace_command_1 is not
useful when frame filters are in use. This patch moves this code into
the no-frame-filters "if". This also removes the unused local
"trailing_level", which I noticed while moving the code around.
gdb/ChangeLog
2018-03-26 Tom Tromey <tom@tromey.com>
PR backtrace/15584:
* stack.c (backtrace_command_1): Move some code into no-filters
"if".
Tom Tromey [Tue, 25 Apr 2017 03:47:59 +0000 (21:47 -0600)]
Throw a "quit" on a KeyboardException in py-framefilter.c
If a C-c comes while the Python code for a frame filter is running, it
will be turned into a Python KeyboardException. It seems good for
this to be treated like a GDB quit, so this patch changes
py-framefilter.c to notice this situation and call throw_quit in this
case.
gdb/ChangeLog
2018-03-26 Tom Tromey <tom@tromey.com>
* python/py-framefilter.c (throw_quit_or_print_exception): New
function.
(gdbpy_apply_frame_filter): Use it.
gdb/testsuite/ChangeLog
2018-03-26 Tom Tromey <tom@tromey.com>
* gdb.python/py-framefilter.exp: Add test for KeyboardInterrupt.
* gdb.python/py-framefilter.py (name_error): New global.
(ErrorInName.function): Use name_error.
Tom Tromey [Tue, 25 Apr 2017 02:59:37 +0000 (20:59 -0600)]
Allow C-c to work in backtrace in more cases
PR cli/17716 notes that it is difficult to C-c (or "q" at a pagination
prompt) while backtracing using a frame filter. One reason for this
is that many places in py-framefilter.c use RETURN_MASK_ALL in a
try/catch.
This patch changes these spots to use RETURN_MASK_ERROR instead. This
is safe to do because this entire file is exception safe now.
gdb/ChangeLog
2018-03-26 Tom Tromey <tom@tromey.com>
PR cli/17716:
* python/py-framefilter.c (py_print_type, py_print_value)
(enumerate_args, py_print_args, gdbpy_apply_frame_filter): Use
RETURN_MASK_ERROR.
Tom Tromey [Sun, 23 Apr 2017 17:23:43 +0000 (11:23 -0600)]
Avoid manual resource management in py-framefilter.c
This patch removes the last bit of manual resource management from
py-framefilter.c. This will be useful in the next patch.
gdb/ChangeLog
2018-03-26 Tom Tromey <tom@tromey.com>
* python/py-framefilter.c (enumerate_args): Use
gdb::unique_xmalloc_ptr.
Tom Tromey [Sun, 23 Apr 2017 17:07:26 +0000 (11:07 -0600)]
Remove EXT_LANG_BT_COMPLETED
While looking at the frame filter code, I noticed that
EXT_LANG_BT_COMPLETED is not really needed. Semantically there is no
difference between the "completed" and "ok" results. So, this patch
removes this constant.
gdb/ChangeLog
2018-03-26 Tom Tromey <tom@tromey.com>
* python/py-framefilter.c (py_print_frame): Return
EXT_LANG_BT_OK.
(gdbpy_apply_frame_filter): Update comment.
* extension.h (enum ext_lang_bt_status) <EXT_LANG_BT_COMPLETED>:
Remove.
<EXT_LANG_BT_NO_FILTERS>: Change value.
Tom Tromey [Sun, 23 Apr 2017 17:03:57 +0000 (11:03 -0600)]
Allow hiding of some filtered frames
When a frame filter elides some frames, they are still printed by
"bt", indented a few spaces. PR backtrace/15582 notes that it would
be nice for users if elided frames could simply be dropped. This
patch adds this capability.
gdb/ChangeLog
2018-03-26 Tom Tromey <tom@tromey.com>
PR backtrace/15582:
* stack.c (backtrace_command): Parse "hide" argument.
* python/py-framefilter.c (py_print_frame): Handle PRINT_HIDE.
* extension.h (enum frame_filter_flags) <PRINT_HIDE>: New
constant.
gdb/doc/ChangeLog
2018-03-26 Tom Tromey <tom@tromey.com>
PR backtrace/15582:
* gdb.texinfo (Backtrace): Mention "hide" argument.
gdb/testsuite/ChangeLog
2018-03-26 Tom Tromey <tom@tromey.com>
PR backtrace/15582:
* gdb.python/py-framefilter.exp: Add "bt hide" test.
Tom Tromey [Sun, 23 Apr 2017 17:02:52 +0000 (11:02 -0600)]
Change backtrace_command_1 calling to use flags
The next patch will add more flags to backtrace_command_1; and rather
than add another boolean argument, this patch changes it to accept a
flags value.
gdb/ChangeLog
2018-03-26 Tom Tromey <tom@tromey.com>
* stack.c (backtrace_command_1): Remove "show_locals" parameter,
add "flags".
(backtrace_command): Remove "fulltrace", add "flags".
Tom Tromey [Sun, 23 Apr 2017 16:54:33 +0000 (10:54 -0600)]
Rationalize "backtrace" command line parsing
The backtrace command has peculiar command-line parsing. In
particular, it splits the command line, then loops over the arguments.
If it sees a word it recognizes, like "full", it effectively drops
this word from the argument vector. Then, it pastes together the
remaining arguments, passing them on to backtrace_command_1, which in
turn passes the resulting string to parse_and_eval_long.
The documentation doesn't mention the parse_and_eval_long at all, so
it is a bit of a hidden feature that you can "bt 3*2". The strange
algorithm above also means you can "bt 3 * no-filters 2" and get 6
frames...
This patch changes backtrace's command line parsing to be a bit more
rational. Now, special words like "full" are only recognized at the
start of the command.
This also updates the documentation to describe the various bt options
individually.
gdb/ChangeLog
2018-03-26 Tom Tromey <tom@tromey.com>
* stack.c (backtrace_command): Rewrite command line parsing.
gdb/doc/ChangeLog
2018-03-26 Tom Tromey <tom@tromey.com>
* gdb.texinfo (Backtrace): Describe options individually.
GDB Administrator [Tue, 27 Mar 2018 00:00:27 +0000 (00:00 +0000)]
Automatic date update in version.in
Simon Marchi [Mon, 26 Mar 2018 19:46:21 +0000 (15:46 -0400)]
Remove DEF_VEC_I(offset_type)
It is unused.
gdb/ChangeLog:
* dwarf2read.c (DEF_VEC_I(offset_type)): Remove.
Simon Marchi [Mon, 26 Mar 2018 19:31:10 +0000 (15:31 -0400)]
Add include guard to filename-seen-cache.h
While moving things around, I stumbled on filename_seen_cache being
re-defined, because filename-seen-cache.h doesn't have an include guard.
gdb/ChangeLog:
* filename-seen-cache.h: Add include guard.
Cary Coutant [Fri, 23 Mar 2018 16:03:34 +0000 (09:03 -0700)]
Fix case where IR file provides symbol visibility but replacement file does not.
In PR 22868, two IR files provide conflicting visibility for a symbol.
When a def with PROTECTED visibility is seen after a def with DEFAULT
visibility, gold does not override the visibility. Later, if the
replacement object define the symbol with DEFAULT visibility, the symbol
remains DEFAULT. This was caused by a recent change to allow multiply-defined
absolute symbols, combined with the fact that the plugin framework was using
SHN_ABS as the section index for placeholder symbols. The solution is to
use a real (but arbitrary) section index.
gold/
PR gold/22868
* plugin.cc (Sized_pluginobj::do_add_symbols): Use a real section
index instead of SHN_ABS for defined symbols.
* testsuite/Makefile.am (plugin_pr22868): New test case.
* testsuite/Makefile.in: Regenerate
* testsuite/plugin_pr22868.sh: New test script.
* testsuite/plugin_pr22868_a.c: New source file.
* testsuite/plugin_pr22868_b.c: New source file.
Keith Seitz [Mon, 26 Mar 2018 17:34:28 +0000 (10:34 -0700)]
Remove struct keyword from section_addr_info
Buildbot pointed out a failiure in windows-nat.c:
../../binutils-gdb/gdb/windows-nat.c:582:10: error: using typedef-name 'section_addr_info' after 'struct'
struct section_addr_info *addrs;
^~~~~~~~~~~~~~~~~
In file included from ../../binutils-gdb/gdb/windows-nat.c:49:0:
../../binutils-gdb/gdb/symfile.h:75:37: note: 'section_addr_info' has a previous declaration here
typedef std::vector<other_sections> section_addr_info;
^~~~~~~~~~~~~~~~~
A recursive grep of the sources for "struct section_addr_info" reveals one
additional reference in a comment. In both cases, this patch simply removes
the struct keyword.
gdb/ChangeLog:
* symfile.c (place_section): Remove "struct" from section_addr_info
in comment.
* windows-nat.c (struct safe_symbol_file_add_args) <addrs>: Remove
"struct" keyword from section_addr_info.
Alan Hayward [Mon, 26 Mar 2018 09:39:24 +0000 (10:39 +0100)]
Make gdbserver reg_defs a vector of objects
gdb/
* regformats/regdef.h (reg): Add constructors.
gdb/gdbserver/
* regcache.c (find_register_by_number): Return a ref.
(find_regno): Use references.
(register_size): Likewise.
(register_data): Likewise.
* tdesc.c (target_desc::~target_desc): Remove free calls.
(target_desc::operator==): Use std::vector compare.
(init_target_desc): Use reference.
(tdesc_create_reg): Use reg constructors.
* tdesc.h (struct target_desc): Replace pointer with object.
GDB Administrator [Mon, 26 Mar 2018 00:01:03 +0000 (00:01 +0000)]
Automatic date update in version.in
Pedro Alves [Sun, 25 Mar 2018 17:02:43 +0000 (18:02 +0100)]
eval.c: reverse minsym and sym
I noticed that in evaluate_funcall, where we handle
OP_VAR_MSYM_VALUE/OP_VAR_VALUE to figure out the symbol's name gets
the minimal_symbol/symbol backwards. Happens to be harmless in
practice because the symbol name is recorded in the common initial
sequence (in the general_symbol_info field).
gdb/ChangeLog:
2018-03-25 Pedro Alves <palves@redhat.com>
* eval.c (evaluate_funcall): Swap OP_VAR_MSYM_VALUE/OP_VAR_VALUE
if then/else bodies in var_func_name extraction.
Pedro Alves [Sun, 25 Mar 2018 17:54:44 +0000 (18:54 +0100)]
Fix date in gdb/ChangeLog
H.J. Lu [Sun, 25 Mar 2018 12:02:17 +0000 (05:02 -0700)]
x86-64: Add ENDBR64 to the TLSDESC PLT entry
The TLSDESC entry in a lazy procedure linkage table is called indirectly
with "callq *(%rax)". This patch adds an ENDBR64 to support indirect
branch tracking in Intel CET. The TLSDESC PLT entry now looks like:
0xf3, 0x0f, 0x1e, 0xfa, /* endbr64 */
0xff, 0x35, 8, 0, 0, 0, /* pushq GOT+8(%rip) */
0xff, 0x25, 16, 0, 0, 0 /* jmpq *GOT+TDG(%rip) */
The BND prefix isn't needed since MPX isn't used for TLSDESC.
bfd/
PR ld/23000
* elf64-x86-64.c (elf_x86_64_finish_dynamic_sections): Add
ENDBR64 to the TLSDESC PLT entry.
ld/
PR ld/23000
* testsuite/ld-x86-64/tlsdesc.pd: Updated.
GDB Administrator [Sun, 25 Mar 2018 00:00:55 +0000 (00:00 +0000)]
Automatic date update in version.in
Cary Coutant [Sat, 24 Mar 2018 06:33:47 +0000 (23:33 -0700)]
Fix warn-unused-return message.
gold/
* plugin.cc (link_or_copy_file): Remove newlines from warning messages.
Add pedantic check for return value from ::write.
Cary Coutant [Sat, 24 Mar 2018 06:29:43 +0000 (23:29 -0700)]
Add missing ChangeLog entry for last commit.
Weimin Pan [Fri, 3 Nov 2017 00:38:36 +0000 (18:38 -0600)]
aarch64: Make "info address" resolve TLS variables
TLS variables can't be resolved on aarch64-linux-gnu
Running the test case with upstream gdb shows two failures:
(1) Receiving different error messages when printing TLS variable before
program runs - because the ARM compiler does not emit dwarf attribute
DW_AT_location for TLS, the result is expected and the baseline may
need to be changed for aarch64.
(2) Using "info address" command on C++ static TLS object resulted in
"symbol unresolved" error - below is a snippet from the test case:
class K {
public:
static __thread int another_thread_local;
};
__thread int K::another_thread_local;
(gdb) info address K::another_thread_local
Symbol "K::another_thread_local" is unresolved.
This patch contains fix for (2).
Function info_address_command() handles the "info address" command and
calls lookup_minimal_symbol_and_objfile() to find sym's symbol entry in
mininal symbol table if SYMBOL_COMPUTED_OPS (sym) is false. Problem is
that function lookup_minimal_symbol_and_objfile() only looked up an
objfile's minsym ordinary hash table, not its demangled hash table, which
was the reason why the C++ name was not found.
The fix is to call lookup_minimal_symbol(), which already looks up entries
in both minsym's hash tables, to find names when traversing the object file
list in lookup_minimal_symbol_and_objfile().
Tested in both aarch64-linux-gnu and amd64-linux-gnu. No regressions.
GDB Administrator [Sat, 24 Mar 2018 00:00:50 +0000 (00:00 +0000)]
Automatic date update in version.in
Keith Seitz [Thu, 22 Mar 2018 23:49:48 +0000 (16:49 -0700)]
Add psymbols for nested types
c++/22968 involves the inability of ptype to find a type definition for
a type defined inside another type. I recently added some additional
support for nested type definitions, but I apparently overlooked psymbols.
The user reports that using -readnow fixes the problem:
$ gdb 22968 -ex "ptype Outer::Inner"
There is no field named Inner
$ gdb -readnow 22968 -ex "ptype Outer::Inner"
type = struct Outer::Inner {
<no data field>
}
We clearly did not find a psymbol for Outer::Inner because it was located
in another CU. This patch addresses this problem by scanning structs
for additional psymbols. Rust is already doing this.
With this patch, the identical result to "-readnow" is given (without
using `-readnow', of course).
gdb/ChangeLog:
PR c++/22968
* dwarf2read.c (scan_partial_symbols): Scan structs/classes for
nested type definitions for C++, too.
gdb/testsuite/ChangeLog:
PR c++/22968
* gdb.cp/subtypes.exp: New file.
* gdb.cp/subtypes.h: New file.
* gdb.cp/subtypes.cc: New file.
* gdb.cp/subtypes-2.cc: New file.
Cary Coutant [Fri, 23 Mar 2018 17:05:38 +0000 (10:05 -0700)]
Add --debug=plugin option to record plugin actions.
With --debug=plugin, gold will log all plugin actions to a log file,
and make copies of plugin-supplied replacement files in a temporary
directory created under the current working directory.
gold/
* debug.h (DEBUG_PLUGIN): New constant.
(DEBUG_ALL): Add DEBUG_PLUGIN.
(debug_string_to_enum): Likewise.
* plugin.cc (make_sized_plugin_object): Add filename parameter.
(Plugin_recorder): New class.
(Plugin_manager::~Plugin_manager): Delete recorder_.
(Plugin_manager::load_plugins): Create and initialize recorder_.
(Plugin_manager::claim_file): Record claimed and unclaimed files.
(Plugin_manager::make_plugin_object): Use object name as name for
plugin object, if available.
(Plugin_manager::add_input_file): Record replacement files.
(Sized_pluginobj::do_add_symbols): Record plugin symbols.
(Plugin_finish::run): Call Plugin_recorder::finish().
(make_sized_plugin_object): Add filename parameter and pass to
Sized_pluginobj constructor.
* plugin.h (Plugin::filename): New method.
(Plugin::recorder): New method.
(Plugin::recorder_): New data member.
Tom Tromey [Fri, 16 Mar 2018 22:44:01 +0000 (16:44 -0600)]
Change machoread.c to use std::vector
This changes machoread.c to use std::vector rather than VEC. This
allows removing some cleanups.
Regression tested by the buildbot, though I don't think anything
actually tests macho reading.
gdb/ChangeLog
2018-03-23 Tom Tromey <tom@tromey.com>
* machoread.c (struct oso_el): Add a constructor. Don't define as
a typedef.
(macho_register_oso): Remove.
(macho_symtab_read): Take a std::vector.
(oso_el_compare_name): Now a std::sort comparator.
(macho_symfile_read_all_oso): Take a std::vector.
(macho_symfile_read): Use std::vector. Remove cleanups.
Alan Hayward [Fri, 23 Mar 2018 11:17:22 +0000 (11:17 +0000)]
Make gdbserver find_register_by_number static
gdbserver/
* regcache.c (find_register_by_number): Make static.
(find_regno): Use find_register_by_number
* regcache.h (struct reg): Remove declaration.
Nick Clifton [Fri, 23 Mar 2018 12:20:03 +0000 (12:20 +0000)]
Improve readelf's selection of a file start symbol when displaying a gnu build attribute.
* readelf.c (get_symbol_for_build_attribute): Skip ARM mapping
symbols.
(print_gnu_build_attribute_description): If no file start symbol
could be found, look for one two bytes into the file.
* testsuite/binutils-all/note-4-64.s: Set the address of the file
start symbol to two bytes into the file.
* testsuite/binutils-all/note-4-32.s: Likewise.
Nick Clifton [Fri, 23 Mar 2018 12:08:54 +0000 (12:08 +0000)]
Add an extra library name template to the list used by the WIN32 targets.
PR 22948
* emultempl/pe.em (open_dynamic_archive): Add libXXX.lib template
to library name list.
* emultempl/pep.em (open_dynamic_archive): Likewise.
* ld.texinfo (WIN32): Update documentation.
Andrew Burgess [Mon, 19 Mar 2018 00:33:50 +0000 (00:33 +0000)]
gdb: Fix testsuite issue in gdb.arch/amd64-disp-step-avx.exp
This test starts up and confirms that $xmm0 has the value 0, it then
modifies $xmm0 (in the inferior) and confirms that the new value can
be read (in GDB).
On some machines I was noticing that this test would occasionally
fail, and on investigation I believe that the reason for this is that
the test is linked as a dynamically linked executable and makes use of
the system libraries during startup. The reason that this causes
problems is that both the runtime linker and the startup code run
before main can, and do (on at least some platforms) make use of the
XMM registers.
In this commit I modify the test program slightly to allow it to be
linked statically, without using the startup libraries. Now by the
time GDB reaches the symbol main we have only executed one 'nop'
instruction, and the XMM registers should all have the value 0. I've
extended the test script to confirm that $xmm0 to $xmm15 are all
initially 0, and I also check that at the point after $xmm0 has been
modified, all the other XMM registers ($xmm1 to $xmm15) are still 0.
The test program is still linked against libc in order that we can
call the exit function, however, we now call _exit rather than exit in
order to avoid all of the usual cleanup that exit does. This clean up
tries to tear down things that are usually setup during the startup
code, but now this isn't called calling exit will just result in a
crash.
gdb/testsuite/ChangeLog:
* gdb.arch/amd64-disp-step-avx.S: Add '_start' label.
(done): Call '_exit' not 'exit' to avoid atexit handlers.
* gdb.arch/amd64-disp-step-avx.exp: Pass -static, and
-nostartfiles when compiling the test. Confirm that all registers
xmm0 to xmm15 are initially 0, and that xmm1 to xmm15 are 0 after.
Andrew Burgess [Mon, 19 Mar 2018 00:37:31 +0000 (00:37 +0000)]
gdb: Minor cleanup in some gdb.arch/* tests
A small number of tests incorrectly tried to pass -Wa,-g through to
GCC as an extra compile time flag, either to gdb_compile or
prepare_for_testing.
The problem is that the syntax used for passing the flags was
incorrect, and as a result these extra flags were being ignored.
Luckily, the 'debug' flag was being passed in each case anyway, which
means that the '-g' flag would already be added.
Given that all these tests pass 'debug', and the invalid flag has been
ignored for some time, I'm just removing the flags in this commit.
I've also changed the tests from using gdb_compile to
prepare_for_testing, which allows some extra code to be removed from a
couple of tests scripts.
There should be no change in the test results after this commit.
gdb/testsuite/ChangeLog:
* gdb.arch/amd64-disp-step-avx.exp: Remove unneeded assembler flag
option, syntax was wrong anyway.
* gdb.arch/arm-disp-step.exp: Likewise.
* gdb.arch/sparc64-regs.exp: Likewise.
* gdb.arch/amd64-disp-step.exp: Remove unneeded assembler flag
option, syntax was wrong anyway, switch to use
prepare_for_testing.
* gdb.arch/i386-disp-step.exp: Likewise.
Alan Hayward [Fri, 23 Mar 2018 09:29:42 +0000 (09:29 +0000)]
Move gdbserver tdesc header funcs to c file
gdbserver/
* tdesc.c (target_desc::~target_desc): Move to here.
(target_desc::operator==): Likewise.
* tdesc.h (target_desc::~target_desc): Move from here.
(target_desc::operator==): Likewise.
Andreas Arnez [Fri, 23 Mar 2018 09:38:23 +0000 (10:38 +0100)]
Testsuite: fully migrate to use_gdb_stub convenience func
In the GDB test suite, there are still multiple invocations of
"target_info exists use_gdb_stub". However, the recommended way of
checking for use_gdb_stub is to call the convenience function of the same
name.
Replace these occurrences and just call "use_gdb_stub" instead.
gdb/testsuite/ChangeLog:
* gdb.ada/exec_changed.exp: Replace "target_info exists
use_gdb_stub" by "use_gdb_stub".
* gdb.ada/start.exp: Likewise.
* gdb.base/async-shell.exp: Likewise.
* gdb.base/attach-pie-misread.exp: Likewise.
* gdb.base/attach-wait-input.exp: Likewise.
* gdb.base/break-entry.exp: Likewise.
* gdb.base/break-interp.exp: Likewise.
* gdb.base/dprintf-detach.exp: Likewise.
* gdb.base/nostdlib.exp: Likewise.
* gdb.base/solib-nodir.exp: Likewise.
* gdb.base/statistics.exp: Likewise.
* gdb.base/testenv.exp: Likewise.
* gdb.mi/mi-exec-run.exp: Likewise.
* gdb.mi/mi-start.exp: Likewise.
* gdb.multi/dummy-frame-restore.exp: Likewise.
* gdb.multi/multi-arch-exec.exp: Likewise.
* gdb.multi/multi-arch.exp: Likewise.
* gdb.multi/tids.exp: Likewise.
* gdb.multi/watchpoint-multi.exp: Likewise.
* gdb.python/py-events.exp: Likewise.
* gdb.threads/attach-into-signal.exp: Likewise.
* gdb.threads/attach-stopped.exp: Likewise.
* gdb.threads/threadapply.exp: Likewise.
* lib/selftest-support.exp: Likewise.
Tom Tromey [Wed, 21 Mar 2018 22:59:28 +0000 (16:59 -0600)]
Remove some cleanups from record-full.c
This removes some cleanups from record-full.c in a straightforward
way.
Tested by the buildbot.
gdb/ChangeLog
2018-03-22 Tom Tromey <tom@tromey.com>
* record-full.c (record_full_exec_insn): Use gdb::byte_vector.
(record_full_goto_bookmark): Use std::string.
GDB Administrator [Fri, 23 Mar 2018 00:00:38 +0000 (00:00 +0000)]
Automatic date update in version.in
Pedro Franco de Carvalho [Thu, 22 Mar 2018 13:22:45 +0000 (10:22 -0300)]
ppc: Fix stwux and stdux masks in skip_prologue
This patch merges the masks for matching the stwux and stdux
instructions in rs6000-tdep.c:skip_prologue into a single mask that
only matches these two instructions.
Commit
72dd273062 fixed the warning described in PR tdep/18295, this
patch addresses the comment in the same PR indicating that the mask
was too permissive.
gdb/Changelog:
PR tdep/18295
* rs6000-tdep.c (skip_prologue): Match both stwux and stdux
a single mask.
Pedro Franco de Carvalho [Thu, 22 Mar 2018 13:22:45 +0000 (10:22 -0300)]
ppc: Detect when LR is saved through frame pointer
This patch extends rs6000-tdep.c:skip_prologue so that it can detect
when the Link Register is saved using the frame pointer (usually r31)
in adition to the stack pointer (r1).
The frame pointer offset from the frame base is tracked separately
from the stack pointer offset for cases when the frame pointer is not
in synch with the stack pointer at the moment of the LR save.
Previously, "stq" could also be detected as an instruction that saves
LR or CR. Because this was likely unintentional, this patch also
restricts the matches to stw/stwu/std/stdu.
gdb/ChangeLog:
* rs6000-tdep.c (store_insn_p): New function.
(skip_prologue): New variable alloca_reg_offset. Set lr_reg
and cr_reg to their unshifted values. Use store_insn_p to
match LR saves using either R1 or fdata->alloca_reg. Use
store_insn_p to match CR saves. Set alloca_reg_offset
when alloca_reg and framep are set. Remove lr_reg shift
when assigning to fdata->lr_register.
Andreas Arnez [Thu, 22 Mar 2018 09:02:18 +0000 (10:02 +0100)]
Make "info proc cmdline" show args on GNU/Linux
Currently "info proc cmdline" on GNU/Linux does not show the full command
line, but only argument 0. And even a warning is shown if there are more.
This was discussed in 2014 already:
https://sourceware.org/ml/gdb-patches/2014-04/msg00212.html
Follow the advice there and avoid target_fileio_read_stralloc. Instead,
use target_fileio_read_alloc to read the whole command line and then
replace NUL characters by spaces. Also add an appropriate test case.
Note that gdbserver already handles this correctly.
gdb/ChangeLog:
* linux-tdep.c (linux_info_proc): For "info proc cmdline", print
command line args instead of emitting a warning.
gdb/testsuite/ChangeLog:
* gdb.base/info-proc.exp: Add test for "info proc cmdline".
Andreas Arnez [Thu, 22 Mar 2018 09:02:18 +0000 (10:02 +0100)]
S390: Correct brace style in s390_get_wordsize
This corrects bad formatting in the newly introduced function
s390_get_wordsize.
gdb/gdbserver/ChangeLog:
* linux-s390-low.c (s390_get_wordsize): Correct brace style.
Jan Beulich [Thu, 22 Mar 2018 07:47:16 +0000 (08:47 +0100)]
x86: use local variable in check_VecOperands()
This is just to make a subsequent change a little easier to read.
Jan Beulich [Thu, 22 Mar 2018 07:46:25 +0000 (08:46 +0100)]
x86: drop pointless VecESize
The attribute is meaningful only in templates allowing embedded
broadcast. Drop them everywhere else.
Jan Beulich [Thu, 22 Mar 2018 07:34:24 +0000 (08:34 +0100)]
x86: drop remaining redundant DispN
A few of them were missed in commit
7ac2002247 ("x86: derive DispN
from BaseIndex") and also couldn't be removed by subsequent commits
touching certain templates anyway.
Jan Beulich [Thu, 22 Mar 2018 07:33:38 +0000 (08:33 +0100)]
ix86: allow HLE store of accumulator to absolute address
Since they're shorter to encode, the 0xa0...0xa3 encodings are preferred
for moves between accumulator and absolute address outside of 64-bit
mode. With HLE release semantics this encoding is unsupported though,
with the assembler raising an error. The operation is valid though, we
merely need to pick the longer encoding in that case.
Jan Beulich [Thu, 22 Mar 2018 07:32:50 +0000 (08:32 +0100)]
x86: fix swapped operand handling for BNDMOV
The wrong placement of the Load attribute in the templates prevented
this from working. The disassembler also didn't handle this consistently
with other similar dual-encoding insns.
Jan Beulich [Thu, 22 Mar 2018 07:31:43 +0000 (08:31 +0100)]
x86/Intel: fix fallout from earlier template folding
While many templates allowing multiple suitably matching XMM/YMM/ZMM
operand sizes can be folded, a few need to be split in order to not
wrongly accept "xmmword ptr" operands when only XMM registers are
permitted (and memory operands are more narrow). Add a test case
validating this.
Jan Beulich [Thu, 22 Mar 2018 07:29:45 +0000 (08:29 +0100)]
x86: fold a few XOP templates
Also add a new test case verifying that mixed operands of SIMD insns
with a size-less memory operand in the middle are properly rejected.
Simon Marchi [Thu, 22 Mar 2018 04:27:19 +0000 (00:27 -0400)]
Get rid of VEC(static_tracepoint_marker_p)
This patch replaces VEC(static_tracepoint_marker_p) with std::vector,
and does some c++ification around that. I thought a new overload of
hex2str was useful, so I added it as well as corresponding unit tests.
I also added an overload of ui_out::field_string that takes an
std::string directly.
gdb/ChangeLog:
* tracepoint.h (struct static_tracepoint_marker): Initialize
fields, define default constructor, move constructor and move
assignment, disable the rest.
<str_id, extra>: Make std::string.
(release_static_tracepoint_marker): Remove.
(free_current_marker): Remove.
* tracepoint.c (free_current_marker): Remove.
(parse_static_tracepoint_marker_definition): Adjust to
std::string, use new hex2str overload.
(release_static_tracepoint_marker): Remove.
(print_one_static_tracepoint_marker): Get marker by reference
and adjust to std::string.
(info_static_tracepoint_markers_command): Adjust to std::vector
changes
* target.h (static_tracepoint_marker_p): Remove typedef.
(DEF_VEC_P(static_tracepoint_marker_p)): Remove.
(struct target_ops) <to_static_tracepoint_marker_at>: Return
bool.
<to_static_tracepoint_markers_by_strid>: Return std::vector.
* target-debug.h
(target_debug_print_VEC_static_tracepoint_marker_p_p): Remove.
(target_debug_print_std_vector_static_tracepoint_marker): New.
(target_debug_print_struct_static_tracepoint_marker_p): Rename
to...
(target_debug_print_static_tracepoint_marker_p): ... this.
* target-delegates.c: Re-generate.
* breakpoint.h (struct tracepoint) <static_trace_marker_id>:
Make std::string.
* breakpoint.c (init_breakpoint_sal): Adjust to std::string.
(decode_static_tracepoint_spec): Adjust to std::vector.
(tracepoint_print_one_detail): Adjust to std::string.
(strace_marker_decode_location): Adjust to std::string.
(update_static_tracepoint): Adjust to std::string, remove call
to release_static_tracepoint_marker.
* linux-nat.c (linux_child_static_tracepoint_markers_by_strid):
Adjust to std::vector.
* remote.c (remote_static_tracepoint_marker_at): Return bool.
(remote_static_tracepoint_markers_by_strid): Adjust to
std::vector.
* common/rsp-low.h (hex2str): New overload with explicit count
of bytes.
* common/rsp-low.c (hex2str): New overload with explicit count
of bytes.
* unittests/rsp-low-selftests.c (test_hex2str): New function.
(_initialize_rsp_low_selftests): Add test_hex2str test.
* unittests/tracepoint-selftests.c
(test_parse_static_tracepoint_marker_definition): Adjust to
std::string.
Simon Marchi [Thu, 22 Mar 2018 04:26:37 +0000 (00:26 -0400)]
Make parse_static_tracepoint_marker_definition work with multiple static tracepoint definitions
Since I modify the parse_static_tracepoint_marker_definition function in
the next patch, I wanted to write a unit test for it. Doing so showed
that it doesn't handle multiple consecutive static tracepoint
definitions separated by commas. However, the RSP documentation [1]
states that servers may return multiple definitions, like:
1234:
6d61726b657231:
6578747261207374756666,abba:
6d61726b657232:
The problem is that the function uses strlen to compute the length of
the last field (the extra field). If there are additional definitions
in addition to the one we are currently parsing, the returned length
will include those definitions, and we'll try to hex-decode past the
extra field.
This patch changes parse_static_tracepoint_marker_definition to consider
the case where the current definition is followed by a comma and more
definitions. It also adds the unit test that found the issue in the
first place.
I don't think this causes any backwards compatibility issues, because
the previous code only handled single static tracepoint definitions, and
the new code handles that correctly.
gdb/ChangeLog:
* tracepoint.c (parse_static_tracepoint_marker_definition):
Consider case where the definition is followed by more
definitions.
* Makefile.in (SUBDIR_UNITTESTS_SRCS): Add
tracepoint-selftests.c.
* unittests/tracepoint-selftests.c: New.
[1] https://sourceware.org/gdb/onlinedocs/gdb/Tracepoint-Packets.html#qTfSTM
GDB Administrator [Thu, 22 Mar 2018 00:00:35 +0000 (00:00 +0000)]
Automatic date update in version.in
Pedro Franco de Carvalho [Wed, 21 Mar 2018 20:24:02 +0000 (17:24 -0300)]
Add myself as a write-after-approval GDB maintainer.
gdb/ChangeLog:
2018-03-21 Pedro Franco de Carvalho <pedromfc@linux.vnet.ibm.com>
* MAINTAINERS (Write After Approval): Add Pedro Franco de
Carvalho.
H.J. Lu [Wed, 21 Mar 2018 19:55:40 +0000 (12:55 -0700)]
DT_FLAGS_1: Add Solaris bits
The following bits in DT_FLAGS_1 are used by Solaris:
#define DF_1_KMOD 0x10000000 /* kernel module */
#define DF_1_WEAKFILTER 0x20000000 /* apply weak binding to DT_FILTER */
#define DF_1_NOCOMMON 0x40000000 /* no COMMON symbols exist */
binutils/
* readelf.c (process_dynamic_section): Also dump DF_1_KMOD,
DF_1_WEAKFILTER and DF_1_NOCOMMON.
include/
* elf/common.h (DF_1_KMOD): New.
(DF_1_WEAKFILTER): Likewise.
(DF_1_NOCOMMON): Likewise.
Andreas Arnez [Wed, 21 Mar 2018 16:41:45 +0000 (17:41 +0100)]
S390: Make IPA recognize tdescs with guarded storage
The in-process agent does not handle tdescs with guarded storage yet.
This is fixed.
gdb/gdbserver/ChangeLog:
* linux-s390-ipa.c (get_ipa_tdesc): Add handling for
S390_TDESC_GS.
* linux-s390-low.c (s390_get_ipa_tdesc_idx): Likewise.
(initialize_low_tracepoint): Call init_registers_s390x_gs_linux64
and init_registers_s390_gs_linux64.
Andreas Arnez [Wed, 21 Mar 2018 16:41:45 +0000 (17:41 +0100)]
S390: gdbserver: Don't write guarded storage registers
On S390, the guarded storage register set is only valid if guarded storage
is active. Reading/writing the register set yields errors if this is not
the case. Then gdbserver emits warnings like these:
Warning: ptrace(regsets_store_inferior_registers): No data available
Apart from confusing the user, this can also lead to test case failures
due to unexpected output. To suppress this, make the guarded storage
regsets read-only for now.
gdb/gdbserver/ChangeLog:
* linux-s390-low.c (s390_fill_gs): Remove function.
(s390_fill_gsbc): Remove function.
(s390_regsets): Set fill functions for the guarded storage regsets
to NULL.
Andreas Arnez [Wed, 21 Mar 2018 16:41:44 +0000 (17:41 +0100)]
S390: Enable re-attaching with native-extended-gdbserver
On s390x, when running attach.exp with native-extended-gdbserver,
gdbserver crashes in find_regno like this:
.../regcache.c:252: A problem internal to GDBserver has been detected.
Unknown register tdb0 requested
On the GDB side it looks like this:
(gdb) attach 31568
Attaching to process 31568
Remote connection closed
The test case attempts to attach to a new process via the already running
gdbserver. Thus s390_arch_setup is called a second time, and that's where
the problem occurs. In order to determine the word width (32 or 64 bits),
s390_arch_setup reads the pswm register through the regcache. For that it
uses a temporary tdesc which is supposed to work for all s390 targets,
since the actual tdesc has not been determined yet. But in this second
round this doesn't work, because s390_regsets has been updated already and
now contains regsets not described by the temporary tdesc, such as the one
containing tdb0.
This is fixed by rearranging the logic in s390_arch_setup.
gdb/gdbserver/ChangeLog:
* linux-s390-low.c (s390_get_hwcap): Replace tdesc parameter by
the word size. Add comment.
(s390_get_wordsize): New function.
(s390_arch_setup): No longer select a temporary tdesc to fetch the
pswm with it. Instead, use s390_get_wordsize to determine the
word size first and derive the correct tdesc from that directly.
Alan Modra [Wed, 21 Mar 2018 02:52:26 +0000 (13:22 +1030)]
PowerPC64 synthetic symbols
STT_FILE and a bunch of other symbol types aren't proper symbols to
mark the start of a function's code.
* elf64-ppc.c (ppc64_elf_get_synthetic_symtab): Trim uninteresting
symbols. Use size_t counts. Delete redundant opd test.
Alan Modra [Mon, 19 Mar 2018 09:49:50 +0000 (20:19 +1030)]
Delete unused elf32-ppc.c code
Local symbols were being read but not used.
* elf32-ppc.c (ppc_elf_tls_optimize): Delete locsyms.
Alan Modra [Mon, 19 Mar 2018 09:44:05 +0000 (20:14 +1030)]
Make tls_mask unsigned in elf32-ppc.c
* elf32-ppc.c (struct ppc_elf_link_hash_entry): Make tls_mask
field unsigned.
(update_local_sym_info): Likewise for local_got_tls_masks.
(ppc_elf_tls_optimize): Likewise for lgot_masks.
Alan Modra [Sat, 17 Mar 2018 06:52:39 +0000 (17:22 +1030)]
Correct multi-toc tprel relocs
Commit
f15d0b545b trimmed some unnecessary TPREL relocs, but missed
changing another place where they are allocated.
* elf64-ppc.c (ppc_size_one_stub): Fix comment typo.
(ppc64_elf_layout_multitoc): Allocate relocs for tprel as we
do in size_dynamic_sections.
Alan Modra [Sat, 17 Mar 2018 07:19:12 +0000 (17:49 +1030)]
Don't exceed reloc array bounds
* elf64-ppc.c (ppc64_elf_relocate_section): Don't access rel[1]
without first checking array bounds.
* elf32-ppc.c (ppc_elf_relocate_section): Likewise.
GDB Administrator [Wed, 21 Mar 2018 00:00:41 +0000 (00:00 +0000)]
Automatic date update in version.in
Roland McGrath [Tue, 20 Mar 2018 20:31:05 +0000 (13:31 -0700)]
ld/testsuite: XFAIL pr20995-2 on aarch64*-*-elf*
ld/
* testsuite/ld-elf/shared.exp (pr20995-2): XFAIL on aarch64*-*-elf*,
another target without RELRO.
Stephen Roberts [Tue, 20 Mar 2018 16:24:37 +0000 (16:24 +0000)]
Fix misleading indentation error.
This patch fixes a compile error introduced by my previous change, which
caused the indentation of the following code block to become incorrect.
ChangeLog:
2018-03-20 Stephen Roberts <stephen.roberts@arm.com>
* gdb/symtab.c (find_pc_sect_line): fixed indentation.
H.J. Lu [Tue, 20 Mar 2018 16:20:57 +0000 (09:20 -0700)]
Adjust testsuite/ld-plugin/pr22983.d
* testsuite/ld-plugin/pr22983.d: Allow leading underscore as
well as extra lines between symbols.
Stephen Roberts [Tue, 20 Mar 2018 13:54:54 +0000 (13:54 +0000)]
Replace the linear search in find_pc_sect_line with a binary search.
This patch addresses slowness when setting breakpoints, especially in
heavily templatized code. Profiling showed that find_pc_sect_line in
symtab.c was the performance bottleneck. The original logic performed a
linear search over ordered data. This patch uses a binary search, as
suggested by comments around the function. There are no behavioural
changes, but gdb is now faster at setting breakpoints in template code.
Tested using on make check on an x86 target. The optimisation speeds up
the included template-breakpoints.py performance test by a factor of 7
on my machine.
ChangeLog:
2018-03-20 Stephen Roberts <stephen.roberts@arm.com>
* gdb/symtab.c (find_pc_sect_line): now uses binary search.
gdb/testsuite/
* gdb.perf/template-breakpoints.cc: New file.
* gdb.perf/template-breakpoints.exp: New file.
* gdb.perf/template-breakpoints.py: New file.
Maciej W. Rozycki [Tue, 20 Mar 2018 11:48:59 +0000 (11:48 +0000)]
gc.exp: Remove extraneous LD flags from the personality test
Complement commit
8988502d7534 ("MIPS/LD/testsuite: Correct dynamic
links with VR4100, VR4300 and VR5000") and commit
bf48520113c4 ("gc.exp:
Fix a typo: $LFLAGS -> $LDFLAGS"), and remove extraneous additional LD
flags explicitly passed to the personality test on invocation. This
passing has accidentally leaked from a WIP version of the former change.
With the actual version committed the $LDFLAGS global variable is used
instead for `run_dump_test' to use implicitly, so that `-call_shared'
precedes `-lpersonality' on the linker's command line, as otherwise a
shared `libpersonality.so' library wouldn't be considered for linking,
causing the test to fail.
ld/
* testsuite/ld-gc/gc.exp: Remove extraneous LD flags from the
personality test.
Nick Clifton [Tue, 20 Mar 2018 11:05:18 +0000 (11:05 +0000)]
Updated Russian and Spanish translations for the binutils/ sub-directory.
* po/es.po: Updated Spanish translation.
* po/ru.po: Updated Russian translation.
H.J. Lu [Tue, 20 Mar 2018 10:51:26 +0000 (03:51 -0700)]
Set non_ir_ref_dynamic if a symbol is made dynamic
If a symbol is made dynamic by --dynamic-list, it has non-IR reference.
bfd/
PR ld/22983
* elflink.c (bfd_elf_link_mark_dynamic_symbol): Set
non_ir_ref_dynamic if a symbol is made dynamic by --dynamic-list.
ld/
PR ld/22983
* testsuite/ld-plugin/lto.exp: Run PR ld/22983 test.
* testsuite/ld-plugin/pr22983.d: New file.
* testsuite/ld-plugin/pr22983.t: Likewise.
* testsuite/ld-plugin/pr22983a.c: Likewise.
* testsuite/ld-plugin/pr22983b.c: Likewise.
GDB Administrator [Tue, 20 Mar 2018 00:00:38 +0000 (00:00 +0000)]
Automatic date update in version.in
Tom Tromey [Mon, 19 Mar 2018 16:25:05 +0000 (10:25 -0600)]
Support bare-identifier field initializers in Rust
In Rust one can initialize a struct member from an identically-named
local variable by simply mentioning the member name in the
initializer, like:
let x = 0;
let y = Struct { x };
This initializes "Struct::x" from "x".
This patch adds this form of initializer to the Rust expression parser
and adds a test.
Tested on x86-64 Fedora 26 using rustc 1.23.
2018-03-19 Tom Tromey <tom@tromey.com>
* rust-exp.y (struct_expr_tail, struct_expr_list): Add plain
"IDENT" production.
2018-03-19 Tom Tromey <tom@tromey.com>
* gdb.rust/simple.rs (main): Add local variables field1, field2,
y0.
* gdb.rust/simple.exp: Test bare identifier form of struct
initializer.
Tom Tromey [Sun, 2 Oct 2016 16:50:20 +0000 (10:50 -0600)]
Convert observers to C++
This converts observers from using a special source-generating script
to be plain C++. This version of the patch takes advantage of C++11
by using std::function and variadic templates; incorporates Pedro's
patches; and renames the header file to "observable.h" (this change
eliminates the need for a clean rebuild).
Note that Pedro's patches used a template lambda in tui-hooks.c, but
this failed to compile on some buildbot instances (presumably due to
differing C++ versions); I replaced this with an ordinary template
function.
Regression tested on the buildbot.
gdb/ChangeLog
2018-03-19 Pedro Alves <palves@redhat.com>
Tom Tromey <tom@tromey.com>
* unittests/observable-selftests.c: New file.
* common/observable.h: New file.
* observable.h: New file.
* ada-lang.c, ada-tasks.c, agent.c, aix-thread.c, annotate.c,
arm-tdep.c, auto-load.c, auxv.c, break-catch-syscall.c,
breakpoint.c, bsd-uthread.c, cli/cli-interp.c, cli/cli-setshow.c,
corefile.c, dummy-frame.c, event-loop.c, event-top.c, exec.c,
extension.c, frame.c, gdbarch.c, guile/scm-breakpoint.c,
infcall.c, infcmd.c, inferior.c, inflow.c, infrun.c, jit.c,
linux-tdep.c, linux-thread-db.c, m68klinux-tdep.c,
mi/mi-cmd-break.c, mi/mi-interp.c, mi/mi-main.c, objfiles.c,
ppc-linux-nat.c, ppc-linux-tdep.c, printcmd.c, procfs.c,
python/py-breakpoint.c, python/py-finishbreakpoint.c,
python/py-inferior.c, python/py-unwind.c, ravenscar-thread.c,
record-btrace.c, record-full.c, record.c, regcache.c, remote.c,
riscv-tdep.c, sol-thread.c, solib-aix.c, solib-spu.c, solib.c,
spu-multiarch.c, spu-tdep.c, stack.c, symfile-mem.c, symfile.c,
symtab.c, thread.c, top.c, tracepoint.c, tui/tui-hooks.c,
tui/tui-interp.c, valops.c: Update all users.
* tui/tui-hooks.c (tui_bp_created_observer)
(tui_bp_deleted_observer, tui_bp_modified_observer)
(tui_inferior_exit_observer, tui_before_prompt_observer)
(tui_normal_stop_observer, tui_register_changed_observer):
Remove.
(tui_observers_token): New global.
(attach_or_detach, tui_attach_detach_observers): New functions.
(tui_install_hooks, tui_remove_hooks): Use
tui_attach_detach_observers.
* record-btrace.c (record_btrace_thread_observer): Remove.
(record_btrace_thread_observer_token): New global.
* observer.sh: Remove.
* observer.c: Rename to observable.c.
* observable.c (namespace gdb_observers): Define new objects.
(observer_debug): Move into gdb_observers namespace.
(struct observer, struct observer_list, xalloc_observer_list_node)
(xfree_observer_list_node, generic_observer_attach)
(generic_observer_detach, generic_observer_notify): Remove.
(_initialize_observer): Update.
Don't include observer.inc.
* Makefile.in (generated_files): Remove observer.h, observer.inc.
(clean mostlyclean): Likewise.
(observer.h, observer.inc): Remove targets.
(SUBDIR_UNITTESTS_SRCS): Add observable-selftests.c.
(COMMON_SFILES): Use observable.c, not observer.c.
* .gitignore: Remove observer.h.
gdb/doc/ChangeLog
2018-03-19 Tom Tromey <tom@tromey.com>
* observer.texi: Remove.
gdb/testsuite/ChangeLog
2018-03-19 Tom Tromey <tom@tromey.com>
* gdb.gdb/observer.exp: Remove.
This page took 0.049823 seconds and 4 git commands to generate.