Christian Biesinger [Thu, 31 Oct 2019 19:41:19 +0000 (14:41 -0500)]
Use strerror_r in safe_strerror if available
Also stores the result in a thread-local static variable and
changes the return value to a const char*.
This is already important because Guile creates threads and
Python can create threads, but with the patch series here:
https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/176
GDB itself will create threads, too.
gdb/ChangeLog:
2019-10-31 Christian Biesinger <cbiesinger@google.com>
* configure: Regenerate.
* configure.ac: Check for strerror_r.
* gdbsupport/common-utils.h (safe_strerror): Change return value
to const char * and document that this function is now threadsafe.
* gdbsupport/posix-strerror.c (safe_strerror): Make buf
thread_local and call strerror_r, if available.
* utils.c (perror_string): Update.
(print_sys_errmsg): Update.
Change-Id: I81048fbaf148035c221c528727f7efe58ba528eb
Luis Machado [Thu, 31 Oct 2019 19:30:44 +0000 (16:30 -0300)]
[ARM] Store exception handling information per-bfd instead of per-objfile
Based on feedback from Tromey, update the use of objfile_key in gdb/arm-tdep.c
to use bfd_key instead. That way we don't have to re-create the exception
handling data all over again if it was done before for the same BFD.
gdb/ChangeLog:
2019-10-31 Luis Machado <luis.machado@linaro.org>
* arm-tdep.c (arm_exidx_data_key): Use bfd_key instead of
objfile_key.
(arm_exidx_new_objfile): Adjust to use objfile->obfd instead of
objfile to fetch per-bfd data.
(arm_find_exidx_entry): Likewise.
Change-Id: Ia7b3208ea8d788414600fa6d770ac76db0562859
Christian Biesinger [Wed, 30 Oct 2019 21:19:11 +0000 (16:19 -0500)]
Convert int to bool in agent.c
Also moves an int declaration inside the for loop.
Code cleanup, no change in behavior intended.
gdb/ChangeLog:
2019-10-31 Christian Biesinger <cbiesinger@google.com>
* gdbsupport/agent.c (debug_agent): Change type to bool.
(use_agent): Likewise.
(all_agent_symbols_look_up): Likewise.
(agent_loaded_p): Change return value to bool.
(agent_look_up_symbols): Update.
(agent_capability_check): Change return value to bool.
* gdbsupport/agent.h (agent_loaded_p): Likewise.
(debug_agent): Change type to bool.
(use_agent): Likewise.
(agent_capability_check): Change return value to bool.
gdb/gdbserver/ChangeLog:
2019-10-31 Christian Biesinger <cbiesinger@google.com>
* ax.h (debug_agent): Remove duplicate declaration.
Change-Id: Icb28a65fcc8c7108bcd59287e6be66bf56f8ccb5
H.J. Lu [Thu, 31 Oct 2019 17:42:04 +0000 (10:42 -0700)]
i386; Add .code16gcc fldenv tests
* testsuite/gas/i386/general.s: Add .code16gcc fldenv tests.
* testsuite/gas/i386/general.l: Updated.
Tom de Vries [Thu, 31 Oct 2019 16:37:02 +0000 (17:37 +0100)]
[gdb/testsuite] Remove superfluous 3rd argument from gdb_test call
There's a pattern:
...
gdb_test <command> <pattern> <command>
...
that can be written shorter as:
...
gdb_test <command> <pattern>
...
Detect this pattern in proc gdb_test:
...
global gdb_prompt
upvar timeout timeout
if [llength $args]>2 then {
set message [lindex $args 2]
+ if { $message == [lindex $args 0] } {
+ error "HERE"
+ }
} else {
set message [lindex $args 0]
}
...
and fix all occurences in gdb.ada.
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2019-10-31 Tom de Vries <tdevries@suse.de>
* gdb.ada/array_bounds.exp: Drop superfluous 3rd argument to gdb_test.
* gdb.ada/array_subscript_addr.exp: Same.
* gdb.ada/arrayidx.exp: Same.
* gdb.ada/arrayparam.exp: Same.
* gdb.ada/arrayptr.exp: Same.
* gdb.ada/boolean_expr.exp: Same.
* gdb.ada/call_pn.exp: Same.
* gdb.ada/complete.exp: Same.
* gdb.ada/fixed_cmp.exp: Same.
* gdb.ada/fun_addr.exp: Same.
* gdb.ada/funcall_param.exp: Same.
* gdb.ada/interface.exp: Same.
* gdb.ada/mod_from_name.exp: Same.
* gdb.ada/null_array.exp: Same.
* gdb.ada/packed_array.exp: Same.
* gdb.ada/packed_tagged.exp: Same.
* gdb.ada/print_chars.exp: Same.
* gdb.ada/print_pc.exp: Same.
* gdb.ada/ptype_arith_binop.exp: Same.
* gdb.ada/ptype_field.exp: Same.
* gdb.ada/ptype_tagged_param.exp: Same.
* gdb.ada/rec_return.exp: Same.
* gdb.ada/ref_tick_size.exp: Same.
* gdb.ada/str_ref_cmp.exp: Same.
* gdb.ada/taft_type.exp: Same.
* gdb.ada/tagged.exp: Same.
* gdb.ada/type_coercion.exp: Same.
* gdb.ada/uninitialized_vars.exp: Same.
Change-Id: Ibb84a41573c7f21295f3fd42da9b96534205c5c4
Mihail Ionescu [Thu, 31 Oct 2019 11:22:58 +0000 (11:22 +0000)]
Add support for context sensitive '.arch_extension' to the ARM assembler.
If the extension is not found in the context sensitive table, the legacy
tables are still checked as a fallback. This is particularly useful for
Armv8.1-M as it enables the use of '.arch_extension' with the 'mve' and
'mve.fp' extensions which are not part of the legacy table.
* config/tc-arm.c (selected_ctx_ext_table) New static variable.
(arm_parse_arch): Set context sensitive extension table based on the
chosen base architecture.
(s_arm_arch_extension): Change to lookup extensions in the new context
sensitive tables.
* gas/testsuite/gas/arm/mve-ext.s: New.
* gas/testsuite/gas/arm/mve-ext.d: New.
* gas/testsuite/gas/arm/mvefp-ext.s: New.
* gas/testsuite/gas/arm/mvefp-ext.d: New.
GDB Administrator [Thu, 31 Oct 2019 00:00:22 +0000 (00:00 +0000)]
Automatic date update in version.in
Tom de Vries [Wed, 30 Oct 2019 16:41:03 +0000 (17:41 +0100)]
[gdb/testsuite] Add -early pattern flag for gdb_test_multiple
Proc gdb_test_multiple builds up and executes a gdb_expect expression with
pattern/action clauses. The clauses are either implicit (added by
gdb_test_multiple) or explicit (passed via the gdb_test_multiple parameter
user_code).
However, there are a few implicit clauses which are inserted before the
explicit ones, making sure those take precedence.
Add an -early pattern flag for a gdb_test_multiple user_code clause to specify
that the clause needs to be inserted before any implicit clause.
Using this pattern flag, we can f.i. setup a kfail for an assertion failure
<assert> during gdb_continue_to_breakpoint by the rewrite:
...
gdb_continue_to_breakpoint <msg> <pattern>
...
into:
...
set breakpoint_pattern "(?:Breakpoint|Temporary breakpoint) .* (at|in)"
gdb_test_multiple "continue" "continue to breakpoint: <msg>" {
-early -re "internal-error: <assert>" {
setup_kfail gdb/nnnnn "*-*-*"
exp_continue
}
-re "$breakpoint_pattern <pattern>\r\n$gdb_prompt $" {
pass $gdb_test_name
}
}
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2019-10-30 Tom de Vries <tdevries@suse.de>
* lib/gdb.exp (gdb_test_multiple): Handle -early pattern flag.
Change-Id: I376c636b0812be52e7137634b1a4f50bf2b999b6
Christian Biesinger [Tue, 29 Oct 2019 22:14:48 +0000 (17:14 -0500)]
Only clear the minsym array when necessary
The array starts out initialized to zero:
minimal_symbol *msymbol_hash[MINIMAL_SYMBOL_HASH_SIZE] {};
So we only need to explicitly clear it if there were previous minsyms
added to it. This patch does that.
gdb/ChangeLog:
2019-10-30 Christian Biesinger <cbiesinger@google.com>
* minsyms.c (clear_minimal_symbol_hash_tables): New function.
(build_minimal_symbol_hash_tables): Code to clear the table moved
to clear_minimal_symbol_hash_tables.
(minimal_symbol_reader::install): Call clear_minimal_symbol_hash_tables
when needed.
Change-Id: I7da994fe6747f67714e7efe9fdbb0dbc4d6ea532
Delia Burduv [Wed, 30 Oct 2019 13:23:35 +0000 (13:23 +0000)]
Modify the ARNM assembler to accept the omission of the immediate argument for the writeback form of the LDRAA and LDRAB mnemonics
This is a shorthand for the immediate argument being 0, as described here:
https://developer.arm.com/docs/ddi0596/latest/base-instructions-alphabetic-order/ldraa-ldrab-load-register-with-pointer-authentication
This is because the instructions still have a use with an immediate
argument of 0, unlike loads without the PAC functionality. Currently,
the mnemonics are
LDRAA Xt, [Xn, #<simm10>]!
LDRAB Xt, [Xn, #<simm10>]!
After this patch they become
LDRAA Xt, [Xn {, #<simm10>}]!
LDRAB Xt, [Xn {, #<simm10>}]!
gas * config/tc-aarch64.c (parse_address_main): Accept the omission of
the immediate argument for ldraa and ldrab as a shorthand for the
immediate being 0.
* testsuite/gas/aarch64/ldraa-ldrab-no-offset.d: New test.
* testsuite/gas/aarch64/ldraa-ldrab-no-offset.s: New test.
* testsuite/gas/aarch64/illegal-ldraa.s: Modified to accept the
writeback form with no offset.
* testsuite/gas/aarch64/illegal-ldraa.s: Removed missing offset
error.
opcodes * aarch64-opc.c (print_immediate_offset_address): Don't print the
immediate for the writeback form of ldraa/ldrab if it is 0.
* aarch64-tbl.h: Updated the documentation for ADDR_SIMM10.
* aarch64-opc-2.c: Regenerated.
Keith Seitz [Wed, 30 Oct 2019 12:23:16 +0000 (12:23 +0000)]
Add the ability to the BFD library to read build-ids from core flies.
* elf-bfd.h (elf_backend_data) <elf_backend_core_find_build_id>:
New field.
(_bfd_elf32_core_find_build_id, _bfd_elf64_core_find_build_id):
New functions.
(elf_read_notes): Add declaration.
* elf.c (elf_read_notes): Move elf-bfd.h.
(_bfd_elf_core_find_build_id): New function.
(bfd_section_from_phdr): Scan core file PT_LOAD segments for
build-id if none is known.
(elf_parse_notes): For core files, scan for notes.
* elfcore.h (elf_core_file_matches_executable_p): If both
BFDs have identical build-ids, then they match.
(_bfd_elf_core_find_build_id): New function.
* elfxx-target.h (elf_backend_core_find_build_id): Define.
(elfNN_bed): Add elf_backend_core_find_build_id.
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.