Nick Clifton [Wed, 30 Oct 2019 10:52:15 +0000 (10:52 +0000)]
Update email address for Palmer Dabbelt.
* MAINTAINERS: Change palmer@sifive.com to palmer@dabbelt.com.
Fangrui Song [Wed, 30 Oct 2019 10:50:23 +0000 (10:50 +0000)]
Add a --output=<DIR> option to ar to allow the specifying of an output directory.
* ar.c (emum long option numbers): Declare. Use to provide
numerical values for long options.
(long_options): Add --output option.
(usage): Mention the --output option.
(open_output_file): New function. Create a filepath for an output
file and open it.
(extract_file): Use open_output_file().
(open_output_file):
* testsuite/binutils-all/ar.exp: Add a test of the new feature.
* doc/binutils.texi: Document the new feature.
* NEWS: Mention the new feature.
Jan Beulich [Wed, 30 Oct 2019 08:09:13 +0000 (09:09 +0100)]
x86: add tests to cover defaulting of operand sizes for ambiguous insns
Prior to changing the logic in the assembler install tests to make sure
the present defaulting of operand sizes won't get broken. There are a
few anomalies pointed out by this:
- arithmetic insns (add, sub, etc) allow defaulting when their immediate
fits in (signed) 8 bits, but they fail to assemble with larger values,
- mov, other than arithmetic insns, doesn't allow any defaulting,
- movsx/movzx default to byte sources (in AT&T mode), and their special
casing needs to be adjusted first
- bt and friends allow defaulting, while shl and friends don't,
- ambiguous AVX and AVX512 insns don't allow defaulting.
This should ultimately all become consistent (perhaps with the exception
some of the SIMD insns); respective tests will be added to the test
cases here as the issues get addressed.
Jan Beulich [Wed, 30 Oct 2019 08:07:40 +0000 (09:07 +0100)]
x86: re-do "shorthand" handling
Now that the opcode table gets preprocessed, undo parts of commit
dc821c5f9a ("x86: replace Reg8, Reg16, Reg32, and Reg64"): Have the
preprocessor handle the expansion there, while making the expansions
explicit in i386-gen and the register table.
Jan Beulich [Wed, 30 Oct 2019 08:06:42 +0000 (09:06 +0100)]
x86: slightly rearrange struct insn_template
This avoids holes between the individual fields, (potentially) shrinking
the overall template table size by 4 bytes per entry.
Jan Beulich [Wed, 30 Oct 2019 08:05:46 +0000 (09:05 +0100)]
x86: drop stray W
The flag is used to indicate opcodes which can be switched between byte
and word/dword/qword forms (in a "canonical" way). Obviously it's quite
odd then to see it on insns not allowing for byte operands in the first
place. As a result the opcode bytes need to be adjusted accordingly,
which includes comparisons done in optimize_encoding().
To make re-introduction of such issues less likely have i386-gen
diagnose it (in a generally non-fatal way for now).
GDB Administrator [Wed, 30 Oct 2019 00:01:25 +0000 (00:01 +0000)]
Automatic date update in version.in
Simon Marchi [Tue, 29 Oct 2019 21:54:35 +0000 (17:54 -0400)]
Remove unused includes in infcmd.c and infrun.c
include-what-you-use reported this:
../../../src/binutils-gdb/gdb/infcmd.c should remove these lines:
- #include <signal.h> // lines 22-22
- #include "cli/cli-decode.h" // lines 48-48
- #include "cli/cli-utils.h" // lines 56-56
- #include "event-top.h" // lines 38-38
- #include "infcall.h" // lines 57-57
- #include "parser-defs.h" // lines 39-39
../../../src/binutils-gdb/gdb/infrun.c should remove these lines:
- #include <signal.h> // lines 37-37
- #include "cli/cli-script.h" // lines 31-31
- #include "continuations.h" // lines 54-54
- #include "dictionary.h" // lines 45-45
- #include "gdbsupport/gdb_wait.h" // lines 28-28
- #include "interps.h" // lines 55-55
Remove those includes.
Tested by rebuilding, and by quick inspection that the include fields
were indeed unnecessary.
gdb/ChangeLog:
* infcmd.c: Remove includes.
* infrun.c: Remove includes.
Change-Id: I5e25af54ecd2235960c4127add8f604ddbb19153
Simon Marchi [Tue, 29 Oct 2019 21:52:24 +0000 (17:52 -0400)]
Clean up ada-lang.h
This patch cleans up ada-lang.h:
- Some functions just don't exist anymore, remove their declaration
- Some functions are implemented in ada-lang.c and only used there, make
them static to that file.
I moved some functions higher in the file to avoid having to
forward-declare them, but the implementations are unchanged.
gdb/ChangeLog:
* ada-lang.h (GROW_VECT): Move to ada-lang.c.
(grow_vect): Remove declaration.
(ada_type_of_array): Remove declaration.
(ada_update_initial_language): Remove declaration.
(ada_fold_name): Remove declaration.
(ada_fill_in_ada_prototype): Remove declaration.
(user_select_syms): Remove declaration.
(get_selections): Remove declaration.
(ada_tag_type): Remove declaration.
(ada_value_tag): Remove declaration.
(ada_is_others_clause): Remove declaration.
(ada_in_variant): Remove declaration.
(ada_value_struct_elt): Remove declaration.
(ada_attribute_name): Remove declaration.
(ada_system_address_type): Remove declaration.
* ada-lang.c (ada_watch_location_expression): Make static.
(GROW_VECT): Move here from ada-lang.h.
(grow_vect): Make static.
(ada_update_initial_language): Make static.
(ada_fold_name): Make static.
(ada_type_of_array): Make static.
(encoded_ordered_before): Move up.
(sort_choices): Move up.
(print_signatures): Move up.
(ada_print_symbol_signature): Move up.
(get_selections): Move up and make static.
(user_select_syms): Move up and make static.
(ada_value_struct_elt): Move up and make static.
(ada_tag_type): Make static.
(ada_value_tag): Make static.
(ada_is_others_clause): Make static.
(ada_in_variant): Make static.
(ada_attribute_name): Make static.
Change-Id: If0d46ba87d6585ab674c87244068a19e84718fc9
Simon Marchi [Tue, 29 Oct 2019 21:52:15 +0000 (17:52 -0400)]
Remove unused includes in ada-*.c files
include-what-you-use reports:
../../../src/binutils-gdb/gdb/ada-lang.c should remove these lines:
- #include <sys/stat.h> // lines 43-43
- #include <map> // lines 66-66
- #include "c-lang.h" // lines 33-33
- #include "demangle.h" // lines 23-23
- #include "dictionary.h" // lines 47-47
- #include "gdbsupport/gdb_vecs.h" // lines 53-53
- #include "psymtab.h" // lines 58-58
../../../src/binutils-gdb/gdb/ada-lang.c should remove these lines:
- #include <sys/stat.h> // lines 43-43
- #include <map> // lines 66-66
- #include "c-lang.h" // lines 33-33
- #include "demangle.h" // lines 23-23
- #include "dictionary.h" // lines 47-47
- #include "gdbsupport/gdb_vecs.h" // lines 53-53
- #include "psymtab.h" // lines 58-58
../../../src/binutils-gdb/gdb/ada-valprint.c should remove these lines:
- #include "c-lang.h" // lines 31-31
- #include "demangle.h" // lines 26-26
- #include "infcall.h" // lines 32-32
- #include "objfiles.h" // lines 33-33
- #include "symtab.h" // lines 22-22
Remove these includes. Adding an include for gdbarch.h in
ada-valprint.c was necessary, because gdbarch_byte_order wouldn't be
found anymore.
gdb/ChangeLog:
* ada-lang.c: Remove includes.
* ada-typeprint.c: Remove includes.
* ada-valprint.c: Remove includes.
Change-Id: I07c2f2237ef0ed5fd9aa855d33711d780794fce2
Simon Marchi [Tue, 29 Oct 2019 21:51:36 +0000 (17:51 -0400)]
addrmap: use gdb_static_assert for type size assertions
These assertions can be done at compile time instead of at runtime.
gdb/ChangeLog:
* addrmap.c: Add static assertions of type size, moved from
_initialize_addrmap.
(_initialize_addrmap): Remove.
Change-Id: If089fc5d620a7168bdcdf967c6c4fecd6696b670
Christian Biesinger [Sun, 13 Oct 2019 11:57:14 +0000 (06:57 -0500)]
Change some arguments to gdb::string_view instead of name+len
Just some code cleanup. This change has a few benefits:
- Shorter argument list in the functions
- If the caller needs to calculate the string, they no longer
need to explicitly call strlen
- It is easy to pass std::string to this (done in one place
currently)
This also updates a couple of places that were passing 0/1 to
a bool parameter.
gdb/ChangeLog:
2019-10-29 Christian Biesinger <cbiesinger@google.com>
* coffread.c (record_minimal_symbol): Update.
(process_coff_symbol): Update.
* dbxread.c (read_dbx_symtab): Update.
* dwarf2read.c (add_partial_symbol): Update.
(fixup_go_packaging): Update.
(load_partial_dies): Update.
(new_symbol): Update.
* elfread.c (record_minimal_symbol): Change signature to use
gdb::string_view instead of name+len.
(elf_symtab_read): Update.
(elf_rel_plt_read): Update.
* mdebugread.c (parse_partial_symbols): Update.
(handle_psymbol_enumerators): Update.
(new_symbol): Update.
* minsyms.c (minimal_symbol_reader::record_full): Change signature
to use gdb::string_view instead of name+len.
* minsyms.h (class minimal_symbol_reader) <record_full>: Likewise.
* psympriv.h (add_psymbol_to_list): Likewise.
* psymtab.c (add_psymbol_to_bcache): Likewise.
(add_psymbol_to_list): Likewise.
* stabsread.c (define_symbol): Update.
* symtab.c (symbol_set_names): Change signature to use gdb::string_view.
* symtab.h (SYMBOL_SET_NAMES): Likewise.
(symbol_set_names): Likewise.
* xcoffread.c (scan_xcoff_symtab): Update.
Change-Id: I2675c6865e0368f9c755a1081088a53aa54dda4c
Christian Biesinger [Tue, 22 Oct 2019 22:25:50 +0000 (17:25 -0500)]
Only make a nullterminated string if we need to
As of
7bb43059820c5febb4509b15202a93efde442bc6, we no longer need
a nullterminated linkage_name to look up the entry in the hash table.
So this patch makes it so we only make the copy if the entry was
not found.
By auditing all callers of symbol_set_names, I found out that all cases
where the string may not be nullterminated already pass true for COPY_NAME.
So here, I am documenting that as a requirement and am removing the code
that relies on undefined behavior in symbol_set_names (it accessed the string
past the provided length to check for nulltermination). Note that the Ada
case at the beginning of symbol_set_names was already relying on this.
gdb/ChangeLog:
2019-10-29 Christian Biesinger <cbiesinger@google.com>
* symtab.h (symbol_set_names): Document that copy_name must be
set to true for non-nullterminated strings.
* symtab.c (symbol_set_names): Only make a nullterminated copy of
linkage_name if the entry was not found and we need to demangle.
Change-Id: I183302e1f51483ff6dff0fd5c3b0f32f0f04a5d2
Christian Biesinger [Mon, 21 Oct 2019 18:08:03 +0000 (13:08 -0500)]
Replace bsearch with a std::lower_bound-based search
This is more type-safe and can be faster due to inlining and
avoiding overhead from calling through a function pointer.
gdb/ChangeLog:
2019-10-29 Christian Biesinger <cbiesinger@google.com>
* Makefile.in (HFILES_NO_SRCDIR): Add gdb_binary_search.h.
* dwarf2-frame.c (bsearch_fde_cmp): Update.
(dwarf2_frame_find_fde): Replace bsearch with gdb::binary_search.
* gdbsupport/gdb_binary_search.h: New file.
Change-Id: I07e0a0e333f4062b27fc68d3a3f24881ebc68fd4
Christian Biesinger [Sun, 13 Oct 2019 12:12:34 +0000 (07:12 -0500)]
Load system gdbinit files from a directory
Adds a configure option --with-system-gdbinit-dir to specify a directory
in which to look for gdbinit files. All files in this directory are
loaded on startup (subject to -n/-nx as usual) as long as the extension
matches a known and enabled scripting language (.gdb/.py/.scm).
This also changes get_ext_lang_of_file to support ".gdb" files, similar
to get_ext_lang_defn's handling of EXT_LANG_GDB.
gdb/ChangeLog:
2019-10-29 Christian Biesinger <cbiesinger@google.com>
* NEWS: Mention new --with-system-gdbinit-dir option.
* config.in: Regenerate.
* configure: Regenerate.
* configure.ac: Add new option --with-system-gdbinit-dir.
* extension.c (get_ext_lang_of_file): Return extension_language_gdb
for a ".gdb" suffix.
* main.c (get_init_files): Change system_gdbinit argument to
a vector and return the files in SYSTEM_GDBINIT_DIR in
addition to SYSTEM_GDBINIT.
(captured_main_1): Update.
(print_gdb_help): Update.
* top.c (print_gdb_configuration): Also print the value of
SYSTEM_GDBINIT_DIR.
gdb/doc/ChangeLog:
2019-10-29 Christian Biesinger <cbiesinger@google.com>
* Makefile.in: Also set SYSTEM_GDBINIT_DIR for the info manual
generation.
* gdb.texinfo (many sections): Document new --with-system-gdbinit-dir
option.
Change-Id: If233859ecc21bc6421d589b37cd658a3c7d030f2
Andrew Eikum [Tue, 29 Oct 2019 17:07:03 +0000 (17:07 +0000)]
When copying pe format files, copy the dos_message array, rather than re-initiialising it.
* libcoff-in.h (struct pe_tdata): Add dos_message field.
* libcoff.h: Regenerate.
* peXXigen.c (_bfd_XXi_only_swap_filehdr_out): Copy the
dos_message field rather than initialising it.
(_bfd_XX_bfd_copy_private_bfd_data_common): Copy the dos_message
field.
* peicode.h (pe_mkobject): Initialise the dos_message field.
(pe_mkobject_hook): Copy the dos_message field.
(pe_bfd_object_p): Copy the dos_message field.
Nick Clifton [Tue, 29 Oct 2019 15:35:30 +0000 (15:35 +0000)]
Fix array overrun when disassembling corrupt TIC30 binaries.
* tic30-dis.c (print_branch): Correct size of operand array.
Nick Clifton [Tue, 29 Oct 2019 10:25:09 +0000 (10:25 +0000)]
Fix a potential illegal array access in the D30V disassembler.
* d30v-dis.c (print_insn): Check that operand index is valid
before attempting to access the operands array.
Nick Clifton [Tue, 29 Oct 2019 10:01:27 +0000 (10:01 +0000)]
Prevent a left shift by a negative value when disassembling IA64 binaries.
* ia64-opc.c (locate_opcode_ent): Prevent a negative shift when
locating the bit to be tested.
Nick Clifton [Tue, 29 Oct 2019 09:17:39 +0000 (09:17 +0000)]
Fix array overruns in the S12Z disassembler.
* s12z-dis.c (opr_emit_disassembly): Check for illegal register
values.
(shift_size_table): Use a fixed size defined as S12Z_N_SIZES.
(print_insn_s12z): Check for illegal size values.
Andrew Eikum [Tue, 29 Oct 2019 08:02:34 +0000 (08:02 +0000)]
Fix the size of the dos_message field in the internal_extra_pe_filehdr structure on hosts where sizeof(long) == 8.
* coff/internal.h (struct internal_extra_pe_filehdr): Use ints
instead of longs to hold dos_message.
Alan Modra [Tue, 29 Oct 2019 01:05:05 +0000 (11:35 +1030)]
Re: Optimise away eh_frame advance_loc 0
If we happen to get the fixed and variable parts of the advance_loc
in different frags, bad things happen when subtracting one from a
fr_fix of zero.
PR 25125
* dw2gencfi.c (output_cfi_insn): Don't allow DW_CFA_advance_loc4
to be placed in a different frag to the rs_cfa.
GDB Administrator [Tue, 29 Oct 2019 00:00:34 +0000 (00:00 +0000)]
Automatic date update in version.in
Christian Biesinger [Tue, 1 Oct 2019 18:41:58 +0000 (13:41 -0500)]
Add a string_view version of startswith
Makes sure that the string is longer than prefix, so that strncmp will
do the right thing even if the string is not null-terminated.
For use in my string_view conversion patch:
https://sourceware.org/ml/gdb-patches/2019-10/msg00030.html
https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/125
gdb/ChangeLog:
2019-10-28 Christian Biesinger <cbiesinger@google.com>
* gdbsupport/common-utils.h (startswith): Add an overloaded version
that takes gdb::string_view arguments.
Change-Id: I5389855de2fd70e7065a789a79374b0693651b71
Nick Clifton [Mon, 28 Oct 2019 16:45:55 +0000 (16:45 +0000)]
Fix potentially illegal shift and assign operation in CSKY disassembler.
* csky-dis.c (csky_chars_to_number): Check for a negative
count. Use an unsigned integer to construct the return value.
Nick Clifton [Mon, 28 Oct 2019 16:15:34 +0000 (16:15 +0000)]
Fix buffer overrun in TIC30 disassembler.
* tic30-dis.c (OPERAND_BUFFER_LEN): Define. Use as length of
operand buffer. Set value to 15 not 13.
(get_register_operand): Use OPERAND_BUFFER_LEN.
(get_indirect_operand): Likewise.
(print_two_operand): Likewise.
(print_three_operand): Likewise.
(print_oar_insn): Likewise.
Nick Clifton [Mon, 28 Oct 2019 15:44:23 +0000 (15:44 +0000)]
Stop potential illegal memory access in the NS32K disassembler.
* ns32k-dis.c (bit_extract): Add sanitiy check of parameters.
(bit_extract_simple): Likewise.
(bit_copy): Likewise.
(pirnt_insn_ns32k): Ensure that uninitialised elements in the
index_offset array are not accessed.
Nick Clifton [Mon, 28 Oct 2019 15:06:32 +0000 (15:06 +0000)]
Prevent an illegal memory access in the xgate disassembler.
* xgate-dis.c (print_insn): Fix decoding of the XGATE_OP_DYA
operand.
GDB Administrator [Mon, 28 Oct 2019 00:00:43 +0000 (00:00 +0000)]
Automatic date update in version.in
GDB Administrator [Sun, 27 Oct 2019 00:02:01 +0000 (00:02 +0000)]
Automatic date update in version.in
John David Anglin [Sat, 26 Oct 2019 20:48:59 +0000 (16:48 -0400)]
Add some missing casts to suppress implicit cast warnings
PR gas/25121
* config/tc-hppa.c (tc_gen_reloc): Cast some enums to int.
(md_assemble): Likewise.
Alan Modra [Sat, 26 Oct 2019 08:08:26 +0000 (18:38 +1030)]
Optimise away eh_frame advance_loc 0
These can be generated when multiple cfi directives are emitted for an
instruction and the insn frag is closed off between directives, as
happens when listings are enabled. No doubt the advance_loc of zero
could be avoided by backtracking over frags in dw2gencfi.c before
calling cfi_add_advance_loc, but that seems like more work than
cleaning up afterwards as this patch does.
Noticed when looking at the testcase in PR25125.
PR 25125
* dw2gencfi.c (output_cfi_insn): Don't output DW_CFA_advance_loc+0.
* ehopt.c (eh_frame_estimate_size_before_relax): Return -1 for
an advance_loc of zero.
(eh_frame_relax_frag): Translate fr_subtype of 7 to size -1.
(eh_frame_convert_frag): Handle fr_subtype of 7. Abort on
unexpected fr_subtype.
Tom de Vries [Sat, 26 Oct 2019 07:55:32 +0000 (09:55 +0200)]
[gdb] Fix more typos in comments (2)
Fix typos in comments. NFC.
Tested on x86_64-linux.
gdb/ChangeLog:
2019-10-26 Tom de Vries <tdevries@suse.de>
* aarch64-linux-tdep.c: Fix typos in comments.
* aarch64-tdep.c: Same.
* ada-lang.c: Same.
* amd64-nat.c: Same.
* arc-tdep.c: Same.
* arch/aarch64-insn.c: Same.
* block.c: Same.
* breakpoint.h: Same.
* btrace.h: Same.
* c-varobj.c: Same.
* cli/cli-decode.c: Same.
* cli/cli-script.c: Same.
* cli/cli-utils.h: Same.
* coff-pe-read.c: Same.
* coffread.c: Same.
* compile/compile-cplus-symbols.c: Same.
* compile/compile-object-run.c: Same.
* completer.c: Same.
* corelow.c: Same.
* cp-support.c: Same.
* demangle.c: Same.
* dwarf-index-write.c: Same.
* dwarf2-frame.c: Same.
* dwarf2-frame.h: Same.
* eval.c: Same.
* frame-base.h: Same.
* frame.h: Same.
* gdbcmd.h: Same.
* gdbtypes.h: Same.
* gnu-nat.c: Same.
* guile/scm-objfile.c: Same.
* i386-tdep.c: Same.
* i386-tdep.h: Same.
* infcall.c: Same.
* infcall.h: Same.
* linux-nat.c: Same.
* m68k-tdep.c: Same.
* macroexp.c: Same.
* memattr.c: Same.
* mi/mi-cmd-disas.c: Same.
* mi/mi-getopt.h: Same.
* mi/mi-main.c: Same.
* minsyms.c: Same.
* nat/aarch64-sve-linux-sigcontext.h: Same.
* objfiles.h: Same.
* ppc-linux-nat.c: Same.
* ppc-linux-tdep.c: Same.
* ppc-tdep.h: Same.
* progspace.h: Same.
* prologue-value.h: Same.
* python/py-evtregistry.c: Same.
* python/py-instruction.h: Same.
* record-btrace.c: Same.
* record-full.c: Same.
* remote.c: Same.
* rs6000-tdep.c: Same.
* ser-tcp.c: Same.
* sol-thread.c: Same.
* sparc-sol2-tdep.c: Same.
* sparc64-tdep.c: Same.
* stabsread.c: Same.
* symfile.c: Same.
* symtab.h: Same.
* target.c: Same.
* tracepoint.c: Same.
* tui/tui-data.h: Same.
* tui/tui-io.c: Same.
* tui/tui-win.c: Same.
* tui/tui.c: Same.
* unittests/rsp-low-selftests.c: Same.
* user-regs.h: Same.
* utils.c: Same.
* utils.h: Same.
* valarith.c: Same.
* valops.c: Same.
* valprint.c: Same.
* valprint.h: Same.
* value.c: Same.
* value.h: Same.
* varobj.c: Same.
* x86-nat.h: Same.
* xtensa-tdep.c: Same.
gdb/gdbserver/ChangeLog:
2019-10-26 Tom de Vries <tdevries@suse.de>
* linux-aarch64-low.c: Fix typos in comments.
* linux-arm-low.c: Same.
* linux-low.c: Same.
* linux-ppc-low.c: Same.
* proc-service.c: Same.
* regcache.h: Same.
* server.c: Same.
* tracepoint.c: Same.
* win32-low.c: Same.
gdb/stubs/ChangeLog:
2019-10-26 Tom de Vries <tdevries@suse.de>
* ia64vms-stub.c: Fix typos in comments.
* m32r-stub.c: Same.
* m68k-stub.c: Same.
* sh-stub.c: Same.
gdb/testsuite/ChangeLog:
2019-10-26 Tom de Vries <tdevries@suse.de>
* gdb.base/bigcore.c: Fix typos in comments.
* gdb.base/ctf-ptype.c: Same.
* gdb.base/long_long.c: Same.
* gdb.dwarf2/dw2-op-out-param.S: Same.
* gdb.python/py-evthreads.c: Same.
* gdb.reverse/i387-stack-reverse.c: Same.
* gdb.trace/tfile.c: Same.
* lib/compiler.c: Same.
* lib/compiler.cc: Same.
Change-Id: I8573d84a577894270179ae30f46c48d806fc1beb
Alan Modra [Sat, 26 Oct 2019 02:39:44 +0000 (13:09 +1030)]
sort_gnu_build_notes fix
* objcopy.c (sort_gnu_build_notes): Correct sort of deleted
note2.
GDB Administrator [Sat, 26 Oct 2019 00:00:44 +0000 (00:00 +0000)]
Automatic date update in version.in
H.J. Lu [Fri, 25 Oct 2019 22:13:21 +0000 (15:13 -0700)]
elfedit: Report unknown x86 feature
Report unknown x86 feature:
$ ./elfedit --disable-x86-feature foo a.out
elfedit: Error: Unknown x86 feature: foo
$
* elfedit.c (elf_x86_feature): Report unknown x86 feature.
H.J. Lu [Fri, 25 Oct 2019 22:06:39 +0000 (15:06 -0700)]
elfedit.c: Replace BYTE_PUT with byte_put
Since BYTE_PUT is defined as
#define BYTE_PUT(field, val) byte_put (field, val, sizeof (field))
use byte_put, instead of BYTE_PUT, to put 4-byte bitmask at ptr with
"byte_put (ptr, bitmask, 4)", instead of "BYTE_PUT (ptr, bitmask)", to
work with "unsigned char *ptr".
* elfedit.c (update_gnu_property): Replace BYTE_PUT with byte_put.
Ali Tamur [Mon, 21 Oct 2019 23:34:19 +0000 (16:34 -0700)]
Fix find_charset_names.
The patch
f2aec7f6d14 changed the return type of relocate_gdb_directory to
std::string, but the change is not reflected in find_charset_names function.
(Probably missed because the broken code is behind an #ifdef).
gdb/ChangeLog
* charset.c (find_charset_names): Reflect API change.
Christian Biesinger [Fri, 25 Oct 2019 19:46:40 +0000 (14:46 -0500)]
Revert unintentional change in symtab.c
In the previous commit, I accidentally changed the wrong line;
this reverts it to what it should be.
gdb/ChangeLog:
2019-10-25 Christian Biesinger <cbiesinger@google.com>
* symtab.c (symbol_set_names): Revert unintentional change in the
Ada case.
Change-Id: I9abf174927687e74c7435bd4607aab7f248c6e79
Christian Biesinger [Sun, 13 Oct 2019 11:56:58 +0000 (06:56 -0500)]
Don't make an extra copy + allocation of the demangled name
We can just keep around the malloc()-ed name we got from bfd and free
it later.
gdb/ChangeLog:
2019-10-25 Christian Biesinger <cbiesinger@google.com>
* symtab.c (struct demangled_name_entry): Change demangled name
to a unique_xmalloc_ptr<char>, now that we don't allocate it as
part of the struct anymore.
(symbol_set_names): No longer obstack allocate + copy the demangled
name, just store the allocated name from bfd.
Change-Id: Ie6ad50e1e1e73509f55d756f0a437897bb93e3b0
Nick Clifton [Fri, 25 Oct 2019 15:46:07 +0000 (16:46 +0100)]
Improve objcopy's note mergeing capabilities.
* objcopy.c (struct merged_note_section): New structure. Used to
chain together details of mergeable note sections.
(is_merged_note_section): Rename to is_megreable_note_section and
return true for note sections that use GNU_BUILD_ATTRS_SECTION_NAME
as a prefix.
(num_bytes): Delete
(objcoopy_internal_note): Add padded_namesz field.
(DEBUG_MERGE): New macro. Set to non-zero to enable debugging of
the note merging code.
(gap_exists): Rename to overlaps_or_adjoins and return TRUE for
overlapping notes or adjoining notes.
(contained_by, is_deleted_note, is_version_note)
(compare_gnu_build_notes, sort_gnu_build_notes): New functions.
(merge_gnu_build_notes): Rework. Sort notes into a mergeable
order first. Merge them. Then sort them into an ascending
address order before writing them out.
(copy_object): Handle more than one mergeable note section.
* testsuite/binutils-all/note-2-32.d: Update for new merging
behaviour.
* testsuite/binutils-all/note-2-32.s: Likewise.
* testsuite/binutils-all/note-2-64.d: Likewise.
* testsuite/binutils-all/note-2-64.s: Likewise.
* testsuite/binutils-all/note-3-32.d: Likewise.
* testsuite/binutils-all/note-3-32.s: Likewise.
* testsuite/binutils-all/note-3-64.d: Likewise.
* testsuite/binutils-all/note-3-64.s: Likewise.
* testsuite/binutils-all/note-4-32.d: Likewise.
* testsuite/binutils-all/note-4-32.s: Likewise.
* testsuite/binutils-all/note-4-64.d: Likewise.
* testsuite/binutils-all/note-4-64.s: Likewise.
* testsuite/binutils-all/note-6-32.s: New test source file.
* testsuite/binutils-all/note-6-64.s: New test source file.
* testsuite/binutils-all/note-6-32.d: New test driver file.
* testsuite/binutils-all/note-6-64.d: New test driver file.
* testsuite/binutils-all/objcopy.exp: Run the new test.
Nick Clifton [Fri, 25 Oct 2019 15:10:04 +0000 (16:10 +0100)]
Fix potential undefined behaviour in the RX disassembler.
* rx-dis.c (print_insn_rx): Use parenthesis to ensure correct
access to opcodes.op array element.
Tom Tromey [Tue, 8 Oct 2019 20:35:24 +0000 (14:35 -0600)]
Allow out-of-order reads of CIEs
Currently gdb has an assertion that requires CIEs to be read in the
order in which they appear in the debug info:
gdb_assert (n < 1
|| cie_table->entries[n - 1]->cie_pointer < cie->cie_pointer);
This assertion ensures that the table will be sorted, which is
important because it is later searched using bsearch.
However, a customer provided an executable that causes this assertion
to trigger. This executable causes decode_frame_entry_1 to call
decode_frame_entry to find the CIE, resulting in an out-of-order read.
I don't know a good way to construct a reproducer, but this can happen
if the FDE appears before its CIE. See
https://sourceware.org/bugzilla/show_bug.cgi?id=16563
This patch fixes the problem by storing CIEs in an unordered map. The
CIE table is discarded after the frame section is parsed, so this
seemed both simple and straightforward.
gdb/ChangeLog
2019-10-25 Tom Tromey <tromey@adacore.com>
* dwarf2-frame.c (dwarf2_cie_table): Now a typedef.
(bsearch_cie_cmp, add_cie): Remove.
(find_cie): Reimplement.
(decode_frame_entry_1, decode_frame_entry): Change type. Update.
(dwarf2_build_frame_info): Update.
Change-Id: I4a99597fa4b1398a9d105b683a36d992d506485c
Tom Tromey [Thu, 29 Aug 2019 14:45:06 +0000 (10:45 -0400)]
gdbserver does not need xstrdup
gdbserver has its own implementation of xstrdup. However, because
gdbserver links against libiberty now, I think this is not needed.
This patch removes it.
gdb/gdbserver/ChangeLog
2019-10-25 Tom Tromey <tromey@adacore.com>
* utils.c (xstrdup): Remove.
Change-Id: I2aa56d18d0f9af8e70a00dff431d2fda5705a5d5
Alan Modra [Fri, 25 Oct 2019 09:16:24 +0000 (19:46 +1030)]
PR25125, relaxation chooses wrong branch size
The patch I made for PR12049 didn't test for a "negative" branch
properly. "if (target < address)" ought to have been
"if (target < address + fragP->fr_fix)". Rather than making that
change, this patch adds fragP->fr_fix into address earlier. The patch
also avoids running into a bad interaction with the m68k
md_prepare_relax_scan by returning zero growth immediately, since the
adjusted target expression would result in a zero "aim".
PR gas/25125
PR gas/12049
* write.c (relax_frag): Correct calculation of delta for
positive branches where "stretch" would make the branch
negative. Return zero immediately in that case. Correct
TC_PCREL_ADJUST comment.
Tom de Vries [Fri, 25 Oct 2019 08:48:12 +0000 (10:48 +0200)]
[gdb/testsuite] Use -wrap and $gdb_test_name in gdb_test_multiple calls (2)
Make gdb_test_multiple calls shorter by using new gdb_test_multiple variable
$gdb_test_name and new gdb_test_multiple pattern flag -wrap.
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2019-10-25 Tom de Vries <tdevries@suse.de>
* gdb.reverse/sigall-precsave.exp: Use -wrap and $gdb_test_name in
gdb_test_multiple calls.
* gdb.reverse/sigall-reverse.exp: Same.
* gdb.reverse/solib-precsave.exp: Same.
* gdb.reverse/solib-reverse.exp: Same.
* gdb.reverse/until-precsave.exp: Same.
* gdb.reverse/until-reverse.exp: Same.
Change-Id: I67bb327d069dbc439410996bcfe6c7f905b2ca52
Alan Modra [Wed, 23 Oct 2019 07:10:51 +0000 (17:40 +1030)]
PR4499, assign file positions assumes segment offsets increasing
This rewrites much of assign_file_positions_for_non_load_sections to
allow objcopy and strip to handle cases like that in PR4499 where
program headers were not in their usual position immediately after the
ELF file header, and PT_LOAD headers were not sorted by paddr.
PR 4499
include/
* elf/internal.h (struct elf_segment_map): Delete header_size.
Add no_sort_lma and idx.
bfd/
* elf-nacl.c (nacl_modify_segment_map): Set no_sort_lma for all
PT_LOAD segments.
* elf32-spu.c (spu_elf_modify_segment_map): Likewise on overlay
PT_LOAD segments.
* elf.c (elf_sort_segments): New function.
(assign_file_positions_except_relocs): Use shortcuts to elfheader
and elf_tdata. Seek to e_phoff not sizeof_ehdr to write program
headers. Move PT_PHDR check..
(assign_file_positions_for_non_load_sections): ..and code setting
PT_PHDR p_vaddr and p_paddr, and code setting __ehdr_start value..
(assign_file_positions_for_load_sections): ..to here. Sort
PT_LOAD headers. Delete header_pad code. Use actual number of
headers rather than allocated in calculating size for program
headers. Don't assume program headers follow ELF file header.
Simplify pt_load_count code. Only set "off" for PT_LOAD or
PT_NOTE in cores.
(rewrite_elf_program_header): Set p_vaddr_offset for segments
that include file and program headers.
(copy_elf_program_header): Likewise, replacing header_size code.
Alan Modra [Fri, 25 Oct 2019 01:51:35 +0000 (12:21 +1030)]
readelf PT_PHDR check
When PT_PHDR isn't covered by a PT_LOAD header, p_vaddr in PT_PHDR
isn't valid but the value might just pass a vaddr test. So test
p_offset as well.
* readelf.c (process_program_headers): Check PT_PHDR p_offset
as well as p_vaddr. Use p_filesz, not p_memsz, in vaddr test.
GDB Administrator [Fri, 25 Oct 2019 00:01:28 +0000 (00:01 +0000)]
Automatic date update in version.in
H.J. Lu [Thu, 24 Oct 2019 22:43:21 +0000 (15:43 -0700)]
Call forget_cached_source_info to clear the stale source cache
Clear the stale source cache when re-reading symbols.
PR gdb/25126
* symfile.c (reread_symbols): Call forget_cached_source_info to
clear the stale source cache.
Christian Biesinger [Thu, 24 Oct 2019 18:51:55 +0000 (13:51 -0500)]
Remove python_has_threads check in configure.ac
The only use of python_has_threads has been removed in
commit
404f29021abaef86a341663444fb069eb1f0282a
gdb/ChangeLog:
2019-10-24 Christian Biesinger <cbiesinger@google.com>
* configure: Rebuild.
* configure.ac: Remove code that sets python_has_threads.
Change-Id: I75f1b873562bc2abc6f2db17699a3e82fcfd2de3
Christian Biesinger [Wed, 23 Oct 2019 22:00:51 +0000 (17:00 -0500)]
Simplify Python checks in configure.ac
The version checking code is not necessary. It is only used to define
HAVE_LIBPYTHON2_6 or HAVE_LIBPYTHON2_7, which is not used anywhere.
If a version check is desired, the PY_{MAJOR,MINOR}_VERSION macro from
the Python headers can be (and is) used, which does not require updating
configure.ac whenever a new Python version is released.
gdb/ChangeLog:
2019-10-24 Christian Biesinger <cbiesinger@google.com>
* config.in: Regenerate.
* configure: Regenerate.
* configure.ac: Remove the code that uses sed to get the python
version and defines HAVE_LIBPYTHON2_6 / HAVE_LIBPYTHON2_7.
Change-Id: I07073870d9040c2bc8519882c8b3c1368edd4513
Tom de Vries [Thu, 24 Oct 2019 16:43:46 +0000 (18:43 +0200)]
[gdb/testsuite] Add -wrap pattern flag to gdb_test_multiple
Currently, in order to rewrite:
...
gdb_test <command> <pattern> <message>
...
using gdb_test_multiple, we get:
...
gdb_test_multiple <command> <message> {
-re "\[\r\n\]*(?:<pattern>)\[\r\n\]+$gdb_prompt $" {
pass $gdb_test_name
}
}
...
Add a '-wrap pattern flag to gdb_test_multiple, that wraps the regexp
pattern as gdb_test wraps its message argument.
This allows us to rewrite into the more compact:
...
gdb_test_multiple <command> <message> {
-re -wrap <pattern> {
pass $gdb_test_name
}
}
...
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2019-10-24 Tom de Vries <tdevries@suse.de>
* lib/gdb.exp (gdb_test_multiple): Add -wrap pattern flag.
* gdb.reverse/step-precsave.exp: Rewrite gdb_test_multiple containing
kfail using -wrap pattern flag and convenience variable
gdb_test_name.
Change-Id: Ie42c97d5ab7acf6db351299ccd23a83540fe6e1a
Andrew Burgess [Wed, 23 Oct 2019 12:24:02 +0000 (13:24 +0100)]
gdb/python: Return None from Progspace.block_for_pc on error
The documentation for Progspace.block_for_pc says:
Return the innermost gdb.Block containing the given pc value. If the
block cannot be found for the pc value specified, the function will
return None.
However, the implementation actually throws an error for invalid
addresses, like this:
(gdb) python print gdb.current_progspace ().block_for_pc (1)
Traceback (most recent call last):
File "<string>", line 1, in <module>
RuntimeError: Cannot locate object file for block.
Error while executing Python code.
(gdb)
This has been the behaviour since the command was first added (when
the documentation was still as above) in this commit:
commit
f3e9a8177c41893858fce2bdf339dbe90b3a4ef5
Date: Wed Feb 24 21:18:28 2010 +0000
Since that commit the code in question has moved around, but the
important parts are largely unchanged. The function in question is
now in py-progspace.c:pspy_block_for_pc.
Examining the code shows that the real state is more complex than just
the function throws an error instead of returning None, instead the
real situation is:
1. If we can't find a compilation unit for the $pc value then we
throw an error, but
2. If we can find a compilation unit, but can't find a block within
the compilation unit for the $pc then return None.
I suspect for most users of the Python API this distinction is
irrelevant, and I propose that we standardise on one single failure
mechanism.
Given the function can currently return None in some cases, and is
documented to return None on error, I propose we make that the case
for all error paths, which is what this patch does.
As the Progspace.block_for_pc method is currently untested, I've added
some basic tests including for a call with an invalid $pc.
This is potentially an API breaking change, though an undocumented
part of the API. Also, users should have been checking and handling a
None return value anyway, so my hope is that this shouldn't be too
disruptive.
gdb/ChangeLog:
* python/py-progspace.c (pspy_block_for_pc): Return None for all
error paths.
gdb/testsuite/ChangeLog:
* gdb.python/py-progspace.exp: Add tests for the
Progspace.block_for_pc method.
Change-Id: I9cea8d2132902bcad0013d1fd39080dd5423cc57
GDB Administrator [Thu, 24 Oct 2019 00:00:24 +0000 (00:00 +0000)]
Automatic date update in version.in
Tom Tromey [Sun, 6 Oct 2019 00:27:29 +0000 (18:27 -0600)]
Fix opcodes includes
Now that gdb can unconditionally use a -I pointing at the top of the
source tree, we can remove the ugly "../opcodes/" formulation that was
needed earlier. This patch adds the -I and cleans up these includes.
gdb/ChangeLog
2019-10-23 Tom Tromey <tom@tromey.com>
* arc-tdep.c: Remove ".." from include.
* frv-tdep.c: Remove ".." from include.
* lm32-tdep.c: Remove ".." from include.
* microblaze-tdep.c: Remove ".." from include.
* or1k-tdep.h: Remove ".." from include.
* s12z-tdep.c: Remove ".." from include.
* Makefile.in (OPCODES_CFLAGS): Add comment.
(TOP_CFLAGS): New variable.
(INTERNAL_CFLAGS_BASE): Add TOP_CFLAGS.
Change-Id: I21428726d55f9fab0c9da90b56f6664f258cf91a
Tom Tromey [Sat, 5 Oct 2019 22:39:44 +0000 (16:39 -0600)]
Move readline to the readline/readline subdirectory
readline turns out to be a bit of a stumbling block for the project to
move gdbsupport (and then gdbserver) to the top-level.
The issue is that readline headers are intended to be included with
names like "readline/readline.h". To support this, gdb effectively
adds a -I option pointing to the top-level source directory -- but,
importantly, this option is not used when the system readline is used.
For gdbsupport, a -I option like this would always be needed, but that
in turn would break the system readline case. This was PR build/17077,
fixed in commit
a8a5dbcab8df0b3a9e04745d4fe8d64740acb323.
Previously, we had discussed this on the gdb-patches list in terms of
removing readline from the tree
https://sourceware.org/ml/gdb-patches/2019-09/msg00317.html
However, Eli expressed some concerns, and Joel did as well (off-list).
Given those concerns, and the fact that a patch-free local readline is
relatively new in gdb (it was locally patched for years), I changed my
mind and decided to handle this situation by moving the readline
sources down a level.
That is, upstream readline is now in readline/readline, and the
top-level readline directory just contains the minimal configury
needed to build that.
This fixes the problem because, when gdb unconditionally adds a
-I$(top_srcdir), this will not find readline headers. A separate -I
will be needed instead, which is exactly what's needed for
--with-system-readline.
gdb/ChangeLog
2019-10-23 Tom Tromey <tom@tromey.com>
* Makefile.in (READLINE_DIR): Update.
gdb/doc/ChangeLog
2019-10-23 Tom Tromey <tom@tromey.com>
* Makefile.in (READLINE_DIR): Update.
readline/ChangeLog
2019-10-23 Tom Tromey <tom@tromey.com>
Move old contents to readline/ subdirectory.
* aclocal.m4, configure, configure.ac, .gitignore, Makefile.am,
Makefile.in, README: New files.
Change-Id: Ice156a2ee09ea68722b48f64d97146d7428ea9e4
Tankut Baris Aktemur [Wed, 23 Oct 2019 18:58:42 +0000 (20:58 +0200)]
infcall: refactor 'call_function_by_hand_dummy'
Extract out the code region that reserves stack space to a separate
function.
Fix the comment of 'call_function_by_hand_dummy' to remove reference
to the NARGS argument that was removed in commit (
e71585ffe2e "Use
gdb:array_view in call_function_by_hand & friends").
gdb/ChangeLog:
2019-10-23 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
* infcall.c (call_function_by_hand_dummy): Fix the function
comment. And extract out a code section into...
(reserve_stack_space): ...this new function.
Change-Id: I8938ef4134aff68a0a21724aaa2406bfe453438a
Tankut Baris Aktemur [Wed, 23 Oct 2019 18:40:02 +0000 (20:40 +0200)]
infcall: remove unused parameter in 'value_arg_coerce'
Remove the unused SP parameter from the auxiliary function
'value_arg_coerce'.
gdb/ChangeLog:
2019-10-23 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
* infcall.c (value_arg_coerce): Remove an unused parameter.
(call_function_by_hand_dummy): Update the call to
'value_arg_coerce'.
Change-Id: If324a1dda3fa5d4c145790b92bd3f656c00296f4
Tankut Baris Aktemur [Wed, 23 Oct 2019 18:40:02 +0000 (20:40 +0200)]
infcall: move assertions in 'call_function_by_hand_dummy' to an earlier spot
This is a refactoring that performs type assertions on the callee
function at the beginning of 'call_function_by_hand_dummy' rather than
at a later point so that
- the checks are grouped together at the beginning of the function for
improved readability, and
- we don't have to align and push things on the stack only to find out
later that the function call is illegal.
gdb/ChangeLog:
2019-10-23 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
* infcall.c (call_function_by_hand_dummy): Refactor.
Change-Id: I411ac083ac6a9ee6eb93c4b82393a81a4fc927be
Tankut Baris Aktemur [Wed, 23 Oct 2019 18:40:01 +0000 (20:40 +0200)]
Add myself to the gdb/MAINTAINERS write-after-approval list
gdb/ChangeLog:
2019-10-23 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
* MAINTAINERS (Write After Approval): Add Tankut Baris Aktemur.
Christian Biesinger [Tue, 22 Oct 2019 23:17:24 +0000 (18:17 -0500)]
Add a note for how to get the list of threads
It's not immediately obvious how to get the list of threads,
so add a note about that in the "Threads in Python" section.
gdb/doc/ChangeLog:
2019-10-23 Christian Biesinger <cbiesinger@google.com>
* python.texi (Threads In Python): Add a note for how to get the
list of threads.
Change-Id: I0fef8a7aff161fc347c09052319048c907a6e8c3
Tom Tromey [Fri, 18 Oct 2019 02:51:44 +0000 (20:51 -0600)]
Check for sigprocmask in common.m4
I noticed that gdbsupport uses HAVE_SIGPROCMASK, but common.m4 does
not check for it. This means that gdbserver may not compile some
gdbsupport code properly. This patch fixes this error.
gdb/ChangeLog
2019-10-23 Tom Tromey <tom@tromey.com>
* configure: Rebuild.
* configure.ac: Don't check for sigprocmask.
* gdbsupport/common.m4 (GDB_AC_COMMON): Check for sigprocmask.
gdb/gdbserver/ChangeLog
2019-10-23 Tom Tromey <tom@tromey.com>
* configure, config.in: Rebuild.
Change-Id: I2c0a4dd2c376507b9483b38707a242382faa8163
Tom Tromey [Sat, 28 Sep 2019 12:02:06 +0000 (06:02 -0600)]
Use m4_include, not sinclude in .m4 files
Pedro pointed out that sinclude does not error if a file is missing.
This patch changes gdb to only use m4_include, which seems more
correct.
gdb/ChangeLog
2019-10-23 Tom Tromey <tom@tromey.com>
* configure: Rebuild.
* acinclude.m4: Use m4_include, not sinclude.
gdb/gdbserver/ChangeLog
2019-10-23 Tom Tromey <tom@tromey.com>
* configure: Rebuild.
* acinclude.m4: Use m4_include, not sinclude.
gdb/testsuite/ChangeLog
2019-10-23 Tom Tromey <tom@tromey.com>
* configure: Rebuild.
* aclocal.m4: Use m4_include, not sinclude.
Change-Id: I970362e0af7875f9f72796401126acf0ff6dba11
Nick Clifton [Wed, 23 Oct 2019 09:17:21 +0000 (10:17 +0100)]
Fix typo in RX disassembler error messages.
* rx-dis.c (get_register_name): Fix spelling typo in error
message.
(get_condition_name, get_flag_name, get_double_register_name)
(get_double_register_high_name, get_double_register_low_name)
(get_double_control_register_name, get_double_condition_name)
(get_opsize_name, get_size_name): Likewise.
Tom de Vries [Wed, 23 Oct 2019 07:33:46 +0000 (09:33 +0200)]
[gdb/breakpoints] Fix fullname.exp when run from symlink dir
I run into this error with gdb.base/fullname.exp:
...
(gdb) file /data/gdb_versions/devel/build/gdb/testsuite/outputs/\
gdb.base/fullname/fullname
Reading symbols from /data/gdb_versions/devel/build/gdb/testsuite/outputs/\
gdb.base/fullname/fullname...
(gdb) break /data/gdb_versions/devel/build/gdb/testsuite/\
outputs/gdb.base/fullname/tmp-fullname.c:21
No source file named /data/gdb_versions/devel/build/gdb/testsuite/outputs/\
gdb.base/fullname/tmp-fullname.c.
Make breakpoint pending on future shared library load? (y or [n]) n
(gdb) FAIL: gdb.base/fullname.exp: set breakpoint by full path before loading symbols - built relative
...
The FAIL is due to this comparison in iterate_over_some_symtabs failing:
...
481 if (FILENAME_CMP (real_path, fullname) == 0)
(gdb) p real_path
$2 = 0x1a201f0 "/data/gdb_versions/devel/build/gdb/testsuite/outputs/\
gdb.base/fullname/tmp-fullname.c"
(gdb) p fullname
$3 = 0x1a1de80 "/home/vries/gdb_versions/devel/build/gdb/testsuite/outputs/\
gdb.base/fullname/tmp-fullname.c"
...
The difference in pathnames is due to having a symlink dir:
...
$ ls -la /home/vries/gdb_versions
lrwxrwxrwx 1 vries users 18 26 jun 2018 /home/vries/gdb_versions -> /data/gdb_versions
...
and the test passses when eliminating it:
...
$ ( cd $(pwd -P); make check RUNTESTFLAGS=gdb.base/fullname.exp )
...
The FAIL is a regression from commit
a0c1ffedcf1 "Only compute realpath when
basenames_may_differ is set". Before, find_and_open_source was returning a
real-path, resulting in variable 'fullname' being the same as varible
'real_path' in the comparison listed above. But after, that's no longer the
case.
Fix the FAIL by applying gdb_realpath on the fullname variable before the
comparison.
Tested on x86_64-linux.
I wasn't able to write a test-case. The FAIL starts at:
...
$ cd build/gdb
$ mv testsuite testsuite.bla
$ ln -s testsuite.bla testsuite
...
but already this doesn't trigger it anymore:
...
$ cd build/gdb/outputs
$ mv outputs outputs.bla
$ ln -s outputs.bla outputs
...
gdb/ChangeLog:
2019-10-23 Tom de Vries <tdevries@suse.de>
PR breakpoints/24687
* symtab.c (iterate_over_some_symtabs): Apply gdb_realpath on fullname.
Change-Id: I1ace62a234458781e958980f3b425edf1490df27
GDB Administrator [Wed, 23 Oct 2019 00:00:20 +0000 (00:00 +0000)]
Automatic date update in version.in
Christian Biesinger [Tue, 22 Oct 2019 19:58:45 +0000 (14:58 -0500)]
Make demangled_name_entry::language not a bitfield
Having it as a bitfield causes extra work, and this is not memory-sensitive.
Furthermore, once https://sourceware.org/ml/gdb-patches/2019-10/msg00812.html
lands, the bitfield won't even save any memory at all.
gdb/ChangeLog:
2019-10-22 Christian Biesinger <cbiesinger@google.com>
* symtab.c (struct demangled_name_entry) <language>: Change from
bitfield to regular variable.
Change-Id: I4ea31d1cfcbe0f09a09bd058cd304862308dc388
Christian Biesinger [Tue, 22 Oct 2019 18:37:37 +0000 (13:37 -0500)]
Fix compile error & incorrect push
I accidentally pushed the wrong version of the patch for commit
7bb43059820c5febb4509b15202a93efde442bc6 (where the review
comments were not fixed), and I did a bad conflict resolution
for
ccb1ba62299edce72053dd567b9d384814e11885 leading to a
compile error when libxxhash is available. This fixes both
issues.
gdb/ChangeLog:
2019-10-22 Christian Biesinger <cbiesinger@google.com>
* symtab.c (struct demangled_name_entry): Add a constructor.
(free_demangled_name_entry): New function to call the destructor
for demangled_name_entry.
(create_demangled_names_hash): Pass free_demangled_name_entry to
htab_create_alloc.
(symbol_set_names): Call placement new for demangled_name_entry.
* utils.c: No longer include xxhash.h here, now that fast_hash
is inlined in the header.
* utils.h: Instead, include it here.
Change-Id: If776099d39a65a12733d42efcb859feca1b07a39
Christian Biesinger [Fri, 27 Sep 2019 18:32:07 +0000 (13:32 -0500)]
Use libxxhash for hashing, if present
XXHash is faster than htab_hash_string:
------------------------------------------------------------
Benchmark Time CPU Iterations
------------------------------------------------------------
BM_xxh3 11 ns 11 ns
65887249
BM_xxh32 19 ns 19 ns
36511877
BM_xxh64 16 ns 16 ns
42964585
BM_hash_string 182 ns 182 ns
3853125
BM_iterative_hash 77 ns 77 ns
9087638
Unfortunately, XXH3 is still experimental (see
https://github.com/Cyan4973/xxHash#user-content-new-experimental-hash-algorithm)
However, regular XXH64 is still a lot faster than
htab_hash_string per my benchmark above. I used the
following string for the benchmark:
static constexpr char str[] = "_ZZZL13make_gdb_typeP7gdbarchP10tdesc_typeEN16gdb_type_creator19make_gdb_type_flagsEPK22tdesc_type_with_fieldsE19__PRETTY_FUNCTION__";
htab_hash_string is currently 4.35% + 7.98% (rehashing) of gdb
startup when attaching to Chrome's content_shell.
An additional 5.21% is spent in msymbol_hash, which does not use
this hash function. Unfortunately, since it has to lowercase the
string, it can't use this hash function.
BM_msymbol_hash 52 ns 52 ns
13281495
It may be worth investigating if strlen+XXHash is still faster than
htab_hash_string, which would make it easier to use in more places.
Debian ships xxhash as libxxhash{0,-dev}. Fedora ships it as xxhash-devel.
gdb/ChangeLog:
2019-10-22 Christian Biesinger <cbiesinger@google.com>
* Makefile.in: Link with libxxhash.
* config.in: Regenerate.
* configure: Regenerate.
* configure.ac: Search for libxxhash.
* utils.c (fast_hash): Use xxhash if present.
Change-Id: Icab218388b9f829522ed3977f04301ae6d4fc4ca
Christian Biesinger [Fri, 27 Sep 2019 18:08:25 +0000 (13:08 -0500)]
Add a fast_hash function in common-utils
Also updates a caller in symtab.c. For now this just calls htab_hash_string
but the next patch will change it to xxhash, if available.
gdb/ChangeLog:
2019-10-22 Christian Biesinger <cbiesinger@google.com>
* utils.h (fast_hash): New function.
* symtab.c (hash_demangled_name_entry): Call new function
fast_hash.
Change-Id: I77cac0d9aa78fc65316a2af449f52edcae72dc9b
Christian Biesinger [Fri, 27 Sep 2019 17:40:04 +0000 (12:40 -0500)]
Store the mangled name as a string_view
This should be a bit faster (because we can compare the size first),
but it is also a dependency for the next patch.
(3.47% of gdb startup time is spent in eq_demangled_name_entry when
attaching to Chrome's content_shell binary)
gdb/ChangeLog:
2019-10-22 Christian Biesinger <cbiesinger@google.com>
* symtab.c (struct demangled_name_entry): Change type of mangled
to gdb::string_view. Also adds a constructor that takes the
mangled name.
(hash_demangled_name_entry): Update.
(eq_demangled_name_entry): Update.
(free_demangled_name_entry): New function to call the destructor
now that this is not a POD anymore.
(create_demangled_names_hash): Pass free_demangled_name_entry to
htab_create_alloc.
(symbol_set_names): Update.
Change-Id: I24711ae2bcaa9e79ca89a6f8fda385d400419175
Nick Clifton [Tue, 22 Oct 2019 11:01:45 +0000 (12:01 +0100)]
Prevent more potential illegal memory accesses in the RX disassembler.
* rx-dis.c (get_size_name): New function. Provides safe
access to name array.
(get_opsize_name): Likewise.
(print_insn_rx): Use the accessor functions.
Alan Modra [Mon, 21 Oct 2019 21:12:58 +0000 (07:42 +1030)]
Don't allow RELATIVE relocs in pr22269 testcase
At least, not in the GOT. R_PPC64_RELATIVE is fine for powerpc64 in
the .opd section.
PR 22269
* testsuite/ld-elf/pr22269-1.rd: Look for GOT section NONE and
RELATIVE relocs.
* testsuite/ld-elf/shared.exp (pr22269-1): Give test a better
name. Use -z nocombreloc.
GDB Administrator [Tue, 22 Oct 2019 00:00:22 +0000 (00:00 +0000)]
Automatic date update in version.in
Ali Tamur [Tue, 27 Aug 2019 02:22:09 +0000 (19:22 -0700)]
DWARF 5 support: Handle line table and file indexes
* Fix handling of file and directory indexes in line tables; in DWARF 5 the
indexes are zero-based. Make file_names field private to abstract this detail
from the clients. Introduce file_names, is_valid_file_index and
file_names_size methods. Reflect these changes in clients.
* Handle DW_FORM_data16 in read_formatted_entries; it is used to record MD5
of the file entries in DWARF 5.
* Fix a bug in line header parsing that calculates the length of the header
incorrectly. (Seemingly this manifests itself only in DWARF 5).
Tested with CC=/usr/bin/gcc (version 8.3.0) against master branch (also with
-gsplit-dwarf and -gdwarf-4 flags) and there was no increase in the set of
tests that fails. (gdb still cannot debug a 'hello world' program with DWARF 5,
so for the time being, this is all we care about).
This is part of an effort to support DWARF 5 in gdb.
gdb/ChangeLog:
* dwarf2read.c (dir_index): Change type.
(file_name_index): Likewise.
(line_header::include_dir_at): Change comment and implementation on
whether it is DWARF 5.
(line_header::is_valid_file_index): New function.
(line_header::file_name_at): Change comment and implementation on
whether it is DWARF 5.
(line_header::file_names): Change to private field renamed as
m_file_names and introduce a new accessor method.
(line_header::file_names_size): New method.
(line_header::include_dirs): Change to private field and rename as
m_include_dirs.
(dw2_get_file_names_reader): Define local var at a smaller scope and
reflect API change.
(dwarf2_cu::setup_type_unit_groups): Reflect API change.
(process_structure_scope): Likewise.
(line_header::add_include_dir): Change message and reflect renaming.
(line_header::add_file_name): Likewise.
(read_formatted_entries): Handle DW_FORM_data16.
(dwarf_decode_line_header): Fix line header length calculation.
(psymtab_include_file_name): Change comment and API.
(lnp_state_machine::m_file): Update comment and reflect type change.
(lnp_state_machine::record_line): Reflect type change.
(dwarf_decode_lines): Reflect API change.
(file_file_name): Likewise.
(file_full_name): Likewise.
Andrew Burgess [Mon, 21 Oct 2019 15:39:51 +0000 (16:39 +0100)]
gdb: Ensure that !(a < a) is true in sort_cmp on obj_section objects
After the switch to use std::sort, if GDB is compiled with the
-D_GLIBCXX_DEBUG=1 flag then we see an error when using sort_cmp (in
objfiles.c) to sort obj_section objects.
The problem is that std::sort checks that the condition !(a < a)
holds, and currently this is not true. GDB's sort_cmp is really
designed to sort lists in which no obj_section repeats, however, there
is some code in place to try and ensure we get a stable sort order if
there is a bug in GDB, unfortunately this code fails the above check.
By reordering some of the checks inside sort_cmp, it is pretty easy to
ensure that the !(a < a) condition holds.
I've not bothered to make this condition check optimal, like I said
this code is only in place to ensure that we get stable results if GDB
goes wrong, so I've made the smallest change needed to get the correct
behaviour.
After this commit I see no regressions when running GDB compiled with
-D_GLIBCXX_DEBUG=1.
gdb/ChangeLog:
* objfiles.c (sort_cmp): Ensure that !(a < a) holds true.
Change-Id: I4b1e3e1640865104c0896cbb6c3fdbbc04d9645b
Tom Tromey [Mon, 21 Oct 2019 15:26:39 +0000 (09:26 -0600)]
Remove tui_exec_info_content
I happened to notice that the tui_exec_info_content typedef is unused.
This patch removes it. Tested by rebuilding.
gdb/ChangeLog
2019-10-21 Tom Tromey <tom@tromey.com>
* tui/tui-winsource.h (tui_exec_info_content): Remove typedef.
Change-Id: I768edc482366e830eb4528c799686bb27518cdcb
Andrew Burgess [Mon, 21 Oct 2019 13:52:37 +0000 (14:52 +0100)]
contrib: Update dg-extract-results.* from gcc
The dg-extract-results scripts have been updated in the gcc
repository. This commit copies the updated versions of the scripts in
to the binutils-gdb repository.
There are two changes, these are:
1. Improved detection of timeout lines, though I suspect this only
applies to gcc results, and
2. Detection of KPASS results, this is of interest to gdb, where
these results would not be included in the final .sum file.
A grep over binutils-gdb shows the dg-extract-results is not used by
ld, gas, or binutils, however I tested these anyway and saw no changes
in the final .sum files (tested on x86-64 GNU/Linux).
On gdb when running tests in parallel dg-extract-results is used, and
the final .sum file now includes the KPASS results.
contrib/ChangeLog:
* dg-extract-results.py: Update from gcc repo.
* dg-extract-results.sh: Likewise.
Change-Id: I54abd07f4e8f5cf88a6db74519674f6939860157
Tom Tromey [Sat, 19 Oct 2019 21:42:34 +0000 (15:42 -0600)]
Fix creation of nm.h when configure is changed
My earlier patch -- commit
c5adaa192 ("Fix creation of stamp-h by
gdb's configure script") -- broke the creation of nm.h. In
particular, configure removes nm.h, so if you touch configure and
rebuild, nothing will re-create the link, breaking the build.
This patch fixes the bug, and also updates configure.ac to use
AC_CONFIG_LINKS, rather than the obsolete AC_LINK_FILES.
Finally, I noticed that gcore is in generated_files in the
Makefile.in. I think this is incorrect, as generated_files is only
needed for files that can be the target of a #include. So, this patch
removes it.
gdb/ChangeLog
2019-10-21 Tom Tromey <tom@tromey.com>
* configure.ac (nm.h): Conditionally create nm.h link. Subst
NM_H. Use AC_CONFIG_LINKS.
* configure: Rebuild.
* Makefile.in (NM_H): New variable.
(generated_files): Add NM_H. Remove gcore.
(nm.h, stamp-nmh): New targets.
Change-Id: I8dd539785d52455e85389425e4bb996c8a127a0e
Tom de Vries [Mon, 21 Oct 2019 13:08:54 +0000 (15:08 +0200)]
[gdb/testsuite] Compile infcall-nested-structs.exp with -O2
As mentioned in commit
745ff14e6e1 "[gdb/tdep] Fix 'Unexpected register class'
assert in amd64_push_arguments", of the 12 KFAILs added there, 3 are KPASSing
with g++ 4.8.5.
The KPASSes are due to:
- gdb incorrectly expecting the second half of the result of function
rtn_str_struct_02_01 in register %rdx.
- rtn_str_struct_02_01 using %rdx as a temporary, thereby accidentally setting
it to the expected value.
Reduce the chance of hiding errors due accidental register settings by
compiling the test-case with -O2.
This fixes the KPASSes when applied on top of commit
745ff14e6e1.
Tested on x86_64-linux.
Tested with g++ 4.8.5, 7.4.1, 8.3.1, 9.2.1.
gdb/testsuite/ChangeLog:
2019-10-21 Tom de Vries <tdevries@suse.de>
* gdb.base/infcall-nested-structs.c: Add
__attribute__((noinline,noclone)) to all functions.
(call_all): Add missing variable initialization. Simplify return value.
(breakpt): Increment volatile variable, to prevent call from being
optimized out.
* gdb.base/infcall-nested-structs.exp: Compile with -O2.
Change-Id: Ic027e1c957fecd6686345639db99f5eaee3cdf05
Alan Modra [Mon, 21 Oct 2019 02:24:06 +0000 (12:54 +1030)]
ar P support
This patch extends "ar P" to allow creation of normal (as distinct
from thin) archives with full path names.
PR 452
PR 25104
bfd/
* archive.c (normalize): Return file unchanged when
BFD_ARCHIVE_FULL_PATH.
(_bfd_construct_extended_name_table): Pass abfd, the output
bfd, to normalize.
(_bfd_archive_bsd44_construct_extended_name_table): Likewise.
* bfd.c (struct bfd): Make flags a full flagword.
(BFD_ARCHIVE_FULL_PATH): Define.
* bfd-in2.h: Regenerate.
binutils/
* ar.c (write_archive): Set BFD_ARCHIVE_FULL_PATH.
* doc/binutils.texi (extract from archive): Mention
restrictions when extracting from archives with full paths.
(ar P): Update to current P support.
(ar -X32_64): Fix spelling.
Tom Tromey [Mon, 21 Oct 2019 02:41:20 +0000 (20:41 -0600)]
Make unlink_objfile and put_objfile_before static
I noticed an obsolete comment just before unlink_objfile, and then I
noticed that both unlink_objfile and put_objfile_before could be
static. This patch makes these changes, and also moves unlink_objfile
earlier, so that a forward declaration is not needed.
Tested by rebuilding.
gdb/ChangeLog
2019-10-20 Tom Tromey <tom@tromey.com>
* objfiles.h (unlink_objfile, put_objfile_before): Don't declare.
* objfiles.c (unlink_objfile): Move earlier. Now static. Remove
obsolete comment.
(put_objfile_before): Now static.
Change-Id: I1b5927a60fd1cc59bfc9c6761f61652a01ef13e0
GDB Administrator [Mon, 21 Oct 2019 00:00:52 +0000 (00:00 +0000)]
Automatic date update in version.in
John David Anglin [Sun, 20 Oct 2019 16:01:58 +0000 (12:01 -0400)]
[bfd] Provide 8-byte minimum alignment for .plt section
This change increases the default alignment for the .plt section
from 4 bytes to 8 bytes. When function descriptors are 8-byte
aligned, they can be updated atomically on 32-bit hppa. This
helps with ordering issues on SMP machines. It also ensures
that descriptors reside on the same cache line. This reduces
the probability of a double TLB miss in a call.
2019-10-20 John David Anglin <danglin@gcc.gnu.org>
* elf32-hppa.c (elf32_hppa_size_dynamic_sections): Provide 8-byte
minimum alignment for .plt section.
GDB Administrator [Sun, 20 Oct 2019 00:01:57 +0000 (00:01 +0000)]
Automatic date update in version.in
Simon Marchi [Sat, 19 Oct 2019 21:00:35 +0000 (17:00 -0400)]
gdb: Make startswith return a bool
gdb/ChangeLog:
* gdbsupport/common-utils.h (startswith): Change return type to
bool.
Change-Id: I1c11b9bb7f89b3885c1bb55097adb5be6d333ad4
Christian Biesinger [Thu, 3 Oct 2019 05:36:35 +0000 (00:36 -0500)]
Replace some more qsort calls with std::sort
This has better typesafety, avoids a function pointer indirection,
and can benefit from inlining.
gdb/ChangeLog:
2019-10-19 Christian Biesinger <cbiesinger@google.com>
* bcache.c (bcache::print_statistics): Use std::sort instead of qsort.
* breakpoint.c (bp_locations_compare): Rename to...
(bp_location_is_less_than): ...this, and change to std::sort semantics.
(update_global_location_list): Use std::sort instead of qsort.
* buildsym.c (compare_line_numbers): Rename to...
(lte_is_less_than): ...this, and change to std::sort semantics.
(buildsym_compunit::end_symtab_with_blockvector): Use std::sort
instead of qsort.
* disasm.c (compare_lines): Rename to...
(line_is_less_than): ...this, and change to std::sort semantics.
(do_mixed_source_and_assembly_deprecated): Call std::sort instead
of qsort.
* dwarf2-frame.c (qsort_fde_cmp): Rename to...
(fde_is_less_than): ...this, and change to std::sort semantics.
(dwarf2_build_frame_info): Call std::sort instead of qsort.
* mdebugread.c (compare_blocks):
(block_is_less_than): ...this, and change to std::sort semantics.
(sort_blocks): Call std::sort instead of qsort.
* objfiles.c (qsort_cmp): Rename to...
(sort_cmp): ...this, and change to std::sort semantics.
(update_section_map): Call std::sort instead of qsort.
* remote.c (compare_pnums): Remove.
(map_regcache_remote_table): Call std::sort instead of qsort.
* utils.c (compare_positive_ints): Remove.
* utils.h (compare_positive_ints): Remove.
* xcoffread.c (compare_lte): Remove.
(arrange_linetable): Call std::sort instead of qsort.
Change-Id: Ibcddce12a3d07448701e731b7150fa23611d86de
John David Anglin [Sat, 19 Oct 2019 17:41:36 +0000 (13:41 -0400)]
[bfd] Revise import stubs on hppa.
This commit updates the import stubs to leave the pointer to the
function descriptor in register %r22. This provides a backup
mechanism for _dl_runtime_resolve to fixup descriptors during
lazy binding.
bfd/ChangeLog
2019-10-19 John David Anglin <danglin@gcc.gnu.org>
* elf32-hppa.c: Revise import stub sequences.
(LONG_BRANCH_STUB_SIZE): Define.
(LONG_BRANCH_SHARED_STUB_SIZE): Define.
(IMPORT_STUB_SIZE): Define.
(IMPORT_SHARED_STUB_SIZE): Define.
(EXPORT_STUB_SIZE): Define.
(plt_stub): Revise to not use register %r22.
(LDO_R1_R22): Define.
(LDW_R22_R21): Define.
(LDW_R22_R19): Define.
(hppa_build_one_stub): Update stub generation and use new defines.
(hppa_size_one_stub): Likewise.
John David Anglin [Sat, 19 Oct 2019 17:01:29 +0000 (13:01 -0400)]
[ld] Fix failure of pr19161 on hppa*-*linux*.
ld/ChangeLog
2019-10-19 Alan Modra <amodra@gmail.com>
PR ld/25110
* testsuite/ld-gc/gc.exp: Adjust LDFLAGS for pr19161 dump test on
hppa*-*-linux*.
Sergio Durigan Junior [Sat, 19 Oct 2019 04:59:59 +0000 (00:59 -0400)]
Fix typos in symfile.c and i386-darwin-tdep.c
This commit fixes two simple typos, one in gdb/symfile.c and the other
in gdb/i386-darwin-tdep.c. s/wether/whether/.
2019-10-19 Sergio Durigan Junior <sergiodj@redhat.com>
* symfile.c (init_entry_point_info): Fix typo.
* i386-darwin-tdep.c (darwin_dwarf_signal_frame_p): Fix typo.
Change-Id: I1fbb39c32009c61c862b6bd56ce12f24a9edb2c4
GDB Administrator [Sat, 19 Oct 2019 00:00:34 +0000 (00:00 +0000)]
Automatic date update in version.in
Tom de Vries [Fri, 18 Oct 2019 00:48:08 +0000 (02:48 +0200)]
[gdb] Fix more typos in comments
Fix typos in comments. NFC.
Tested on x86_64-linux.
gdb/ChangeLog:
2019-10-18 Tom de Vries <tdevries@suse.de>
* aarch64-tdep.c: Fix typos in comments.
* ada-lang.c: Same.
* ada-tasks.c: Same.
* alpha-tdep.c: Same.
* alpha-tdep.h: Same.
* amd64-nat.c: Same.
* amd64-windows-tdep.c: Same.
* arc-tdep.c: Same.
* arc-tdep.h: Same.
* arch-utils.c: Same.
* arm-nbsd-tdep.c: Same.
* arm-tdep.c: Same.
* ax-gdb.c: Same.
* blockframe.c: Same.
* btrace.c: Same.
* c-varobj.c: Same.
* coff-pe-read.c: Same.
* coffread.c: Same.
* cris-tdep.c: Same.
* darwin-nat.c: Same.
* dbxread.c: Same.
* dcache.c: Same.
* disasm.c: Same.
* dtrace-probe.c: Same.
* dwarf-index-write.c: Same.
* dwarf2-frame-tailcall.c: Same.
* dwarf2-frame.c: Same.
* dwarf2read.c: Same.
* eval.c: Same.
* exceptions.c: Same.
* fbsd-tdep.c: Same.
* findvar.c: Same.
* frame.c: Same.
* frv-tdep.c: Same.
* gnu-v3-abi.c: Same.
* go32-nat.c: Same.
* h8300-tdep.c: Same.
* hppa-tdep.c: Same.
* i386-linux-tdep.c: Same.
* i386-tdep.c: Same.
* ia64-libunwind-tdep.c: Same.
* ia64-tdep.c: Same.
* infcmd.c: Same.
* infrun.c: Same.
* linespec.c: Same.
* linux-nat.c: Same.
* linux-thread-db.c: Same.
* machoread.c: Same.
* mdebugread.c: Same.
* mep-tdep.c: Same.
* mn10300-tdep.c: Same.
* namespace.c: Same.
* objfiles.c: Same.
* opencl-lang.c: Same.
* or1k-tdep.c: Same.
* osabi.c: Same.
* ppc-linux-nat.c: Same.
* ppc-linux-tdep.c: Same.
* ppc-sysv-tdep.c: Same.
* printcmd.c: Same.
* procfs.c: Same.
* record-btrace.c: Same.
* record-full.c: Same.
* remote-fileio.c: Same.
* remote.c: Same.
* rs6000-tdep.c: Same.
* s12z-tdep.c: Same.
* score-tdep.c: Same.
* ser-base.c: Same.
* ser-go32.c: Same.
* skip.c: Same.
* sol-thread.c: Same.
* solib-svr4.c: Same.
* solib.c: Same.
* source.c: Same.
* sparc-nat.c: Same.
* sparc-sol2-tdep.c: Same.
* sparc-tdep.c: Same.
* sparc64-tdep.c: Same.
* stabsread.c: Same.
* stack.c: Same.
* symfile.c: Same.
* symtab.c: Same.
* target-descriptions.c: Same.
* target-float.c: Same.
* thread.c: Same.
* utils.c: Same.
* valops.c: Same.
* valprint.c: Same.
* value.c: Same.
* varobj.c: Same.
* windows-nat.c: Same.
* xcoffread.c: Same.
* xstormy16-tdep.c: Same.
* xtensa-tdep.c: Same.
Change-Id: I5175f1b107bfa4e1cdd4a3361ccb4739e53c75c4
GDB Administrator [Fri, 18 Oct 2019 00:00:20 +0000 (00:00 +0000)]
Automatic date update in version.in
Jim Wilson [Thu, 17 Oct 2019 22:38:27 +0000 (15:38 -0700)]
RISC-V: Report unresolved relocation error via linker's callback function.
Two patches from Nelson Chu.
It is better to use the linker's callback functions to handle the link time
error when relocating. The unresolved relocation error can be regarded as
an unsupported relocation. To make user easier to understand different errors,
we need to extend the current error message format of the callback function
since the format is fixed.
bfd/
* elfnn-riscv.c (riscv_elf_relocate_section): Use asprintf to extend
the error message if needed, and then store the result into the
`msg_buf`. Finally, remember to free the unused `msg_buf`. All error
message for the dangerous relocation should be set before we call the
callback function. If we miss the error message since linker runs out
of memory, we should set the default error message for the error.
ld/
* testsuite/ld-riscv-elf/lib-nopic-01a.s: Create the shared library
lib-nopic-01a.so, it will be linked with lib-nopic-01b.s.
* testsuite/ld-riscv-elf/lib-nopic-01b.s: Add new test for the
unresolved relocation. Link the non-pic code into a shared library
may cause the error.
* testsuite/ld-riscv-elf/lib-nopic-01b.d: Likewise.
* testsuite/ld-riscv-elf/ld-riscv-elf.exp: Run the new test only when
the shared library is supported.
R_RISCV_CALL, R_RISCV_JAL and R_RISCV_RVC_JUMP are pc-relative relocation.
For now, we do not allow the object with these relocation links into a shared
library since the referenced symbols may be loaded to the places that too far
from the pc. We can improve the error message for these unsupported relocation
to notice user that they should recompile their code with `fPIC`.
bfd/
* elfnn-riscv.c (riscv_elf_relocate_section): Report the error message
that user should recompile their code with `fPIC` when linking non-pic
code into shared library.
ld/
* testsuite/ld-riscv-elf/lib-nopic-01b.d: Update the error message.
Change-Id: Ib3347a0a6fa1c2b20a9647c314d5bec2c322ff04
Tom Tromey [Thu, 29 Aug 2019 14:39:57 +0000 (10:39 -0400)]
Fix creation of stamp-h by gdb's configure script
I happened to notice that "make" would always print:
CONFIG_HEADERS=config.h:config.in \
CONFIG_COMMANDS="default depdir" \
CONFIG_FILES= \
CONFIG_LINKS= \
/bin/sh config.status
config.status: creating config.h
config.status: config.h is unchanged
on every rebuild. This seems to have changed due to an autoconf
upgrade at some point in the past. In the autoconf gdb uses now, it
works to use AC_CONFIG_HEADERS and then create the stamp file via the
"commands" argument.
This patch also fixes up Makefile.in to use the new-style
config.status invocation. It's no longer necessary to pass the output
file names via environment variables.
gdb/ChangeLog
2019-10-17 Tom Tromey <tromey@adacore.com>
* configure: Rebuild.
* configure.ac: Use AC_CONFIG_HEADERS. Create stamp-h there, not
in AC_CONFIG_FILES invocation.
* Makefile.in (Makefile, data-directory/Makefile, stamp-h): Use
new-style config.status invocation.
gdb/gdbserver/ChangeLog
2019-10-17 Tom Tromey <tromey@adacore.com>
* configure: Rebuild.
* configure.ac: Use AC_CONFIG_HEADERS. Create stamp-h there, not
in AC_CONFIG_FILES invocation.
* Makefile.in (stamp-h, Makefile): Use new-style config.status
invocation.
Change-Id: Ia0530d1c5b9756812d29ddb8dc1062326155e61e
Sergio Durigan Junior [Wed, 16 Oct 2019 20:47:33 +0000 (16:47 -0400)]
Add libctf to src-release.sh:GDB_SUPPORT_DIRS
We're forgetting to include the libctf directory when creating the
snapshot. This commit changes src-release.sh and adds it to
GDB_SUPPORT_DIRS.
2019-10-17 Sergio Durigan Junior <sergiodj@redhat.com>
* src-release.sh (GDB_SUPPORT_DIRS): Add libctf.
Change-Id: Iada82e5c9e4f8d5a0a5e467d2a628f1fba66002e
Tom de Vries [Thu, 17 Oct 2019 16:06:36 +0000 (18:06 +0200)]
[gdb] Fix typos in comments
Fix typos in comments. NFC.
Tested on x86_64-linux.
gdb/ChangeLog:
2019-10-17 Tom de Vries <tdevries@suse.de>
* arm-nbsd-nat.c: Fix typos in comments.
* arm-tdep.c: Same.
* darwin-nat-info.c: Same.
* dwarf2read.c: Same.
* elfread.c: Same.
* event-top.c: Same.
* findvar.c: Same.
* gdbtypes.c: Same.
* hppa-tdep.c: Same.
* i386-tdep.c: Same.
* jit.c: Same.
* main.c: Same.
* mdebugread.c: Same.
* moxie-tdep.c: Same.
* nto-procfs.c: Same.
* osabi.c: Same.
* ppc-linux-tdep.c: Same.
* remote.c: Same.
* riscv-tdep.c: Same.
* s390-tdep.c: Same.
* sh-tdep.c: Same.
* sparc-linux-tdep.c: Same.
* sparc-nat.c: Same.
* stack.c: Same.
* target-descriptions.c: Same.
* top.c: Same.
* varobj.c: Same.
Change-Id: I6047967abd2d51c9000dea15184d19f4e952c3ff
Tom de Vries [Thu, 17 Oct 2019 08:07:05 +0000 (10:07 +0200)]
[gdb/testsuite] Fix gdb.fortran/module.exp for debug info from other files
On openSUSE Leap 15.1, I get:
...
FAIL: gdb.fortran/module.exp: info variables -n
...
because the info variables command prints info also for init.c:
...
File init.c:^M
24: const int _IO_stdin_used;^M
...
while the regexps in the test-case only expect info for module.f90.
Fix this by extending the regexps.
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2019-10-17 Tom de Vries <tdevries@suse.de>
* gdb.fortran/module.exp: Allow info variables to print info for files
other than module.f90.
Change-Id: I401d8018b121fc7343f6bc8b671900349462457f
Alan Modra [Thu, 17 Oct 2019 05:55:38 +0000 (16:25 +1030)]
PR29, Coreutils POSIX2_VERSION as 200112L
As of today we have just the following oddities left
./gnulib/update-gnulib.sh:ver=`autoconf --version 2>&1 | head -1 | sed 's/.*) //'`
./gnulib/update-gnulib.sh:ver=`automake --version 2>&1 | head -1 | sed 's/.*) //'`
./gnulib/update-gnulib.sh:ver=`aclocal --version 2>&1 | grep -v "called too early to check prototype" | head -1 | sed 's/.*) //'`
./src-release.sh: head -1 $tool/version.in
./contrib/dg-extract-results.sh:tail -2 $FIRST_SUM | $GREP '^#' > /dev/null || tail -2 $FIRST_SUM
gnulib and contrib (from gcc) are outside of binutils control, so with
this patch I'm going to declare this 15 year old bug fixed.
PR 29
* src-release.sh (getver): Replace "head -1" with "head -n 1".