Max Filippov [Thu, 24 May 2018 18:22:14 +0000 (11:22 -0700)]
xtensa: use property tables for correct disassembly
xtensa disassembler does not use information from the .xt.prop sections
to switch between code/data disassembly in text sections. This may
result in incorrect disassembly when data is interpreted as code and
disassembler loses synchronization with instruction stream. Use .xt.prop
section information to correctly interpret code and data and synchronize
with instruction stream.
2018-06-04 Max Filippov <jcmvbkbc@gmail.com>
bfd/
* elf32-xtensa.c (xtensa_read_table_entries): Make global.
(compute_fill_extra_space): Drop declaration. Rename function to
xtensa_compute_fill_extra_space.
(compute_ebb_actions, remove_dead_literal): Update references to
compute_fill_extra_space.
include/
* elf/xtensa.h (xtensa_read_table_entries)
(xtensa_compute_fill_extra_space): New declarations.
opcodes/
* xtensa-dis.c (bfd.h, elf/xtensa.h): New includes.
(dis_private): Add new fields for property section tracking.
(xtensa_coalesce_insn_tables, xtensa_find_table_entry)
(xtensa_instruction_fits): New functions.
(fetch_data): Bump minimal fetch size to 4.
(print_insn_xtensa): Make struct dis_private static.
Load and prepare property table on section change.
Don't disassemble literals. Don't disassemble instructions that
cross property table boundaries.
Max Filippov [Wed, 23 May 2018 04:48:09 +0000 (21:48 -0700)]
xtensa: add separate property sections option
It is currently not possible to correctly match .xt.prop information
for sections with identical VMA. Allow creation of separate property
sections in the BFD. Add assembler option --separate-prop-tables to
allow creation of separate property sections.
2018-06-04 Volodymyr Arbatov <arbatov@cadence.com>
bfd/
* elf32-xtensa.c (elf32xtensa_separate_props): New global
variable.
(xtensa_add_names): New function.
(xtensa_property_section_name): Add new parameter
separate_sections, use it to choose property section name.
(xtensa_get_separate_property_section): New function.
(xtensa_get_property_section): Invoke
xtensa_get_separate_property_section to get individual property
section if it exists, common property section otherwise.
(xtensa_make_property_section): Pass elf32xtensa_separate_props
to xtensa_property_section_name.
gas/
* config/tc-xtensa.c (elf32xtensa_separate_props): New
declaration.
(option_separate_props, option_no_separate_props): New
enumeration constants.
(md_longopts): Add separate-prop-tables option.
(md_parse_option): Add cases for option_separate_props and
option_no_separate_props.
(md_show_usage): Add help for [no-]separate-prop-tables options.
H.J. Lu [Mon, 4 Jun 2018 17:01:34 +0000 (10:01 -0700)]
Use DIAGNOSTIC_IGNORE_STRINGOP_TRUNCATION to silence GCC 8.1
GCC 8.1 warns about destination size with -Wstringop-truncation:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85643
Use DIAGNOSTIC_IGNORE_STRINGOP_TRUNCATION to silence it.
bfd/
PR binutils/23146
* bfd-in.h: Include "diagnostics.h".
* bfd-in2.h: Regenerated.
* elf32-arm.c (elf32_arm_nabi_write_core_note): Use
DIAGNOSTIC_PUSH, DIAGNOSTIC_IGNORE_STRINGOP_TRUNCATION and
DIAGNOSTIC_POP to silence GCC 8.1 warnings with
-Wstringop-truncation.
* elf32-ppc.c (ppc_elf_write_core_note): Likewse.
* elf32-s390.c (elf_s390_write_core_note): Likewse.
* elf64-ppc.c (ppc64_elf_write_core_note): Likewse.
* elf64-s390.c (elf_s390_write_core_note): Likewse.
* elfxx-aarch64.c (_bfd_aarch64_elf_write_core_note): Likewse.
include/
* diagnostics.h (DIAGNOSTIC_IGNORE_STRINGOP_TRUNCATION): Always
define for GCC.
Alan Hayward [Mon, 4 Jun 2018 16:21:04 +0000 (17:21 +0100)]
Use ELF_SECTION_IN_SEGMENT to map segments
The macro ELF_SECTION_IN_SEGMENT should be used when calculating if
a section maps to a segment.
gdb/
* elfread.c (elf_symfile_segments): Use ELF_SECTION_IN_SEGMENT.
Simon Marchi [Mon, 4 Jun 2018 14:40:27 +0000 (10:40 -0400)]
Add configure.nat as a dependency of config.status
After pulling Alan's change that added aarch64-sve-linux-ptrace.o to
configure.nat, I got an undefined reference to aarch64_sve_get_vq when
doing a "make clean && make". It turns out that re-running configure
(./config.status --recheck) was needed to re-generate the Makefile with
aarch64-sve-linux-ptrace.o included in the object list. Putting
configure.nat in the dependencies of config.status would make sure that
when we modify configure.nat, the configure script is re-ran. I think
it also makes sense because configure.tgt and configure.host are also
there.
gdb/ChangeLog:
* Makefile.in (config.status): Add configure.nat as a
dependency.
Stan Cox [Mon, 4 Jun 2018 14:20:49 +0000 (10:20 -0400)]
Add client_state struct.
Collect per client specific global data items into struct client_state,
which is similar in purpose to remote.c::remote_state.
gdbserver/ChangeLog
* server.h (struct client_state): New.
* server.c (cont_thread, general_thread, multi_process)
(report_fork_events, report_vfork_events, report_exec_events)
(report_thread_events, swbreak_feature, hwbreak_feature)
(vCont_supported, disable_randomization, pass_signals)
(program_signals, program_signals_p, last_status, last_ptid, own_buf):
Moved to client_state.
* remote-utils.c (remote_debug, noack_mode)
(transport_is_reliable): Moved to client_state.
* tracepoint.c (current_traceframe): Moved to client_state.
Update all callers.
* server.c, remote-utils.c, tracepoint.c, fork-child.c,
linux-low.c, remote-utils.h, target.c: Use client_state.
H.J. Lu [Mon, 4 Jun 2018 13:33:07 +0000 (06:33 -0700)]
Add DIAGNOSTIC_IGNORE_STRINGOP_TRUNCATION
Add DIAGNOSTIC_IGNORE_STRINGOP_TRUNCATION for GCC 8.1 to silence
-Wstringop-truncation warning:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85643
* diagnostics.h (DIAGNOSTIC_STRINGIFY_1): New.
(DIAGNOSTIC_STRINGIFY): Likewise.
(DIAGNOSTIC_IGNORE): Replace STRINGIFY with DIAGNOSTIC_STRINGIFY.
(DIAGNOSTIC_IGNORE_SELF_MOVE): Define empty if not defined.
(DIAGNOSTIC_IGNORE_DEPRECATED_REGISTER): Likewise.
(DIAGNOSTIC_IGNORE_UNUSED_FUNCTION): Likewise.
(DIAGNOSTIC_IGNORE_SWITCH_DIFFERENT_ENUM_TYPES): Likewise.
(DIAGNOSTIC_IGNORE_STRINGOP_TRUNCATION): New.
Tom Tromey [Fri, 1 Jun 2018 17:50:01 +0000 (11:50 -0600)]
Change functions in cp-name-parser.y into methods
Pedro pointed out in an earlier patch that it would be possible to
make some helper functions in cp-name-parser.y into methods on
cpname_state, cleaning up the code a bit. This patch implements this
idea.
Doing this required moving the %union earlier in the .y file, so the
patch is somewhat bigger than you might expect.
Tested by building with both bison and byacc, and then running the
gdb.cp tests.
gdb/ChangeLog
2018-06-04 Tom Tromey <tom@tromey.com>
* cp-name-parser.y (cpname_state): Add method declarations.
(HANDLE_QUAL): Update.
(cpname_state::d_grab, cpname_state::fill_comp)
(cpname_state::make_operator, cpname_state::make_dtor)
(cpname_state::make_builtin_type, cpname_state::make_name)
(cpname_state::d_qualify, cpname_state::d_int_type)
(cpname_state::d_unary, cpname_state::d_binary): Now methods.
(%union): Move earlier.
Alan Hayward [Thu, 26 Apr 2018 13:58:40 +0000 (14:58 +0100)]
Add aarch64 pseudo help functions
Reduce code copy/paste by adding two helper functions for
aarch64_pseudo_read_value and aarch64_pseudo_write
Does not change any functionality.
gdb/
* aarch64-tdep.c (aarch64_pseudo_read_value_1): New helper func.
(aarch64_pseudo_write_1): Likewise.
(aarch64_pseudo_read_value): Use helper.
(aarch64_pseudo_write): Likewise.
Pedro Alves [Mon, 4 Jun 2018 11:26:39 +0000 (12:26 +0100)]
Fix macOS null pointer dereference
<https://sourceware.org/bugzilla/show_bug.cgi?id=22960#c4> reports
that macOS gdb crashes with a null pointer dereference in
push_target(struct target_ops *). This commit fixes that.
The problem is that commit
f6ac5f3d63e0 ("Convert struct target_ops to
C++") left the darwin_ops global uninitialized.
We don't need that global anymore, we can use the (new)
get_native_target function instead for the same effect.
gdb/ChangeLog:
2018-06-04 Pedro Alves <palves@redhat.com>
* darwin-nat.c (darwin_ops): Delete.
(darwin_attach_pid): Use get_native_target.
Alan Hayward [Mon, 4 Jun 2018 11:13:43 +0000 (12:13 +0100)]
Use uint64_t for aarch64 tdep VQ
Alan Hayward [Mon, 4 Jun 2018 10:39:41 +0000 (11:39 +0100)]
Enable SVE for GDB
Enable SVE support for GDB by reading the VQ when creating a
target description.
Also ensurse that SVE is taken into account when creating
the tdep structure, and store the current VQ value directly in tdep.
gdb/
* aarch64-linux-nat.c (aarch64_linux_read_description): Support SVE.
* aarch64-tdep.c (aarch64_get_tdesc_vq): New function.
(aarch64_gdbarch_init): Check for SVE.
* aarch64-tdep.h (gdbarch_tdep::has_sve): New function.
Alan Hayward [Fri, 1 Jun 2018 15:37:45 +0000 (16:37 +0100)]
Use uint64_t for SVE VQ
Previously VQ was of type long. Using uint64_t ensures it always matches the
same type as the VG register.
Note that in the Linux kernel, VQ is 16bits. We cast it up to 64bits
immediately after reading to ensure we always use the same type throughout
the code.
gdb/
* aarch64-tdep.c (aarch64_read_description): Use uint64_t for VQ.
* aarch64-tdep.h (aarch64_read_description): Likewise.
* arch/aarch64.c (aarch64_create_target_description): Likewise.
* arch/aarch64.h (aarch64_create_target_description): Likewise.
* features/aarch64-sve.c (create_feature_aarch64_sve): Likewise.
* nat/aarch64-sve-linux-ptrace.c(aarch64_sve_get_vq): Likewise.
* nat/aarch64-sve-linux-ptrace.h (aarch64_sve_get_vq): Likewise.
GDB Administrator [Mon, 4 Jun 2018 00:00:48 +0000 (00:00 +0000)]
Automatic date update in version.in
Jim Wilson [Sun, 3 Jun 2018 22:42:29 +0000 (15:42 -0700)]
RISC-V: Handle out-of-range calls to undefined weak.
bfd/
PR ld/23244
* elfnn-riscv.c (riscv_elf_relocate_section) <R_RISCV_CALL>: Check
for and handle an undefined weak with no PLT.
ld/
* testsuite/ld-riscv-elf/ld-riscv-elf.exp: Run new weak ref tests.
* testsuite/ld-riscv-elf/weakref.ld: New.
* testsuite/ld-riscv-elf/weakref32.d: New.
* testsuite/ld-riscv-elf/weakref32.s: New.
* testsuite/ld-riscv-elf/weakref64.d: New.
* testsuite/ld-riscv-elf/weakref64.s: New.
Jim Wilson [Sun, 3 Jun 2018 21:44:44 +0000 (14:44 -0700)]
RISC-V: Fix symbol address problem with versioned symbols.
bfd/
PR ld/22756
* elfnn-riscv.c (riscv_relax_delete_bytes): Add versioned_hidden check
to code that ignores duplicate symbols.
GDB Administrator [Sun, 3 Jun 2018 00:00:49 +0000 (00:00 +0000)]
Automatic date update in version.in
Simon Marchi [Sat, 2 Jun 2018 13:17:06 +0000 (09:17 -0400)]
Split value_fetch_lazy
While reading value_fetch_lazy, I thought it would be good to split it
in small functions (especially the part that handles lval_register).
gdb/ChangeLog:
* value.c (value_fetch_lazy_bitfield): New.
(value_fetch_lazy_memory): New.
(value_fetch_lazy_register): New.
(value_fetch_lazy): Factor out to smaller functions.
GDB Administrator [Sat, 2 Jun 2018 00:00:35 +0000 (00:00 +0000)]
Automatic date update in version.in
Tom Tromey [Wed, 30 May 2018 14:19:01 +0000 (08:19 -0600)]
Make two cp-name-parser.y constants "const"
This changes "backslashable" and "represented" in cp-name-parser.y to
be const. This lets the compiler make them read-only (though in my
build it seems that GCC inlines them, which seems even better).
gdb/ChangeLog
2018-06-01 Tom Tromey <tom@tromey.com>
* cp-name-parser.y (backslashable, represented): Now const.
Tom Tromey [Tue, 29 May 2018 18:54:59 +0000 (12:54 -0600)]
Include parser-defs.h in cp-name-parser.y
This changes cp-name-parser.y to include parser-defs.h, removing the
copy-pasted declaration of parser_fprintf. This can be done now that
cp-name-parser.y does not define any global variables.
gdb/ChangeLog
2018-06-01 Tom Tromey <tom@tromey.com>
* cp-name-parser.y: Include parser-defs.h.
(parser_fprintf): Remove declaration.
Tom Tromey [Thu, 24 May 2018 03:46:59 +0000 (21:46 -0600)]
Make cp-name-parser.y a pure parser
This changes cp-name-parser.y to be a pure parser.
Originally I had thought that doing this would mean that gdb would
always require Bison. However, I've learned that Byacc supports some
of the Bison extensions in this area. So, the new code ought to work
reasonably well with both.
Note that the Byacc documentations says:
%pure-parser
Most variables (other than yydebug and yynerrs) are allocated
on the stack within yyparse, making the parser reasonably
reentrant.
In our case this is ok, first because gdb does not yet actualy require
reentrancy, and second because gdb does not use yynerrs.
gdb/ChangeLog
2018-06-01 Tom Tromey <tom@tromey.com>
* cp-name-parser.y: Use %pure-parser, %lex-param, and
%parse-param.
(lexptr, prev_lexptr, error_lexptr, global_errmsg, demangle_info)
(global_result): Remove globals.
(struct cpname_state): New.
(yyparse): Don't declare.
(yylex, yyerror): Move declarations after %union.
(d_grab, fill_comp, make_operator, make_dtor, make_builtin_type)
(make_name): Add state parameter.
Update all callers.
(d_qualify, d_int_type, d_unary, d_binary, parse_number) Add state
parameter.
(HANDLE_QUAL, HANDLE_SPECIAL, HANDLE_TOKEN2, HANDLE_TOKEN3):
Update.
(yylex): Add lvalp, state parameters.
(yyerror): Add state parameter.
(cp_demangled_name_to_comp): Update.
Tom Tromey [Tue, 29 May 2018 18:20:09 +0000 (12:20 -0600)]
Use yy-remap.h in cp-name-parser.y
This changes cp-name-parser.y to use yy-remap.h, rather than its old
manual approach.
This required declaring parser_fprintf in cp-name-parser.y.
parser-defs.h can't be included here because parser-defs.h declares a
global "lexptr", which conflicts with the local one in
cp-name-parser.y. This is only temporary, and will be cleaned up
later in the series.
gdb/ChangeLog
2018-06-01 Tom Tromey <tom@tromey.com>
* cp-name-parser.y (parser_fprintf): Declare.
(GDB_YY_REMAP_PREFIX): Define.
Include yy-remap.h. Don't redefine yy* identifiers.
Tom Tromey [Thu, 24 May 2018 03:05:52 +0000 (21:05 -0600)]
Remove a static buffer from cp-name-parser.y
This removes a static buffer from cp-name-parser.y by replacing the
fixed-sized buffer with a std::string out parameter.
gdb/ChangeLog
2018-06-01 Tom Tromey <tom@tromey.com>
* python/py-type.c (typy_legacy_template_argument): Update.
* cp-support.h (cp_demangled_name_to_comp): Update.
* cp-name-parser.y (cp_demangled_name_to_comp): Change errmsg
parameter to be a "std::string *".
(main): Update.
H.J. Lu [Fri, 1 Jun 2018 16:38:22 +0000 (09:38 -0700)]
Move gdb/common/diagnostics.h to include/diagnostics.h
Move gdb/common/diagnostics.h to include/diagnostics.h so that it can
be used in binutils.
gdb/
* ada-lex.l: Include "diagnostics.h" instead of
"common/diagnostics.h".
* unittests/environ-selftests.c: Likewise.
* common/diagnostics.h: Moved to ../include.
include/
* diagnostics.h: Moved from ../gdb/common/diagnostics.h.
Joel Brobecker [Fri, 1 Jun 2018 16:36:05 +0000 (09:36 -0700)]
inadvertent language switch during breakpoint_re_set_one
Trying to insert a breakpoint using *FUNC'address with an Ada program
and then running the program until reaching that breakpoint currently
yields the following behavior:
(gdb) break *a'address
Breakpoint 1 at 0x40240c: file a.adb, line 1.
(gdb) run
[1] + 27222 suspended (tty output) /[...]/gdb -q simple_main
Unsuspending GDB then shows it was suspended trying to report
the following error:
Starting program: /home/takamaka.a/brobecke/ex/simple/a
Error in re-setting breakpoint 1: Unmatched single quote.
Error in re-setting breakpoint 1: Unmatched single quote.
Error in re-setting breakpoint 1: Unmatched single quote.
[Inferior 1 (process 32470) exited normally]
The "a'address" is Ada speak for function A's address ("A" by
itself means the result of calling A with no arguments). The
transcript above shows that we're having problems trying to
parse the breakpoint location while re-setting it. As a result,
we also fail to stop at the breakpoint.
Normally, breakpoint locations are evaluated with the current_language
being set to the language of the breakpoint. But, unfortunately for us,
what happened in this case is that parse_exp_in_context_1 calls
get_selected_block which eventually leads to a call to select_frame
because the current_frame hadn't been set yet. select_frame then
finds that our language_mode is auto, and therefore changes the
current_language to match the language of the frame we just selected.
In our case, the language chosen was 'c', which of course is not
able to parse an Ada expression, hence the error.
This patch prevents this by forcing the language_mode to manual
before we call breakpoint_re_set_one.
gdb/ChangeLog:
* breakpoint.c (breakpoint_re_set): Temporarily force language_mode
to language_mode_manual while calling breakpoint_re_set_one.
gdb/testsuite/ChangeLog:
* gdb.ada/bp_fun_addr: New testcase.
Tested on x86_64-linux.
H.J. Lu [Fri, 1 Jun 2018 16:34:04 +0000 (09:34 -0700)]
Bump version number to 2.30.52
Bump version number to 2.30.52 since _bfd_link_hide_symbol has been added
to bfd_target.
bfd/
* version.m4: Bump version to 2.30.52
* configure: Regenerated.
binutils/
* configure: Regenerated.
gas/
* configure: Regenerated.
gprof/
* configure: Regenerated.
ld/
* configure: Regenerated.
opcodes/
* configure: Regenerated.
Tom Tromey [Tue, 17 Apr 2018 19:51:25 +0000 (13:51 -0600)]
Remove type_name_no_tag and rename type_name_no_tag_or_error
type_name_no_tag is just a plain wrapper for TYPE_NAME now, so this
patch removes it. And, because tag names no longer exist, this
renames type_name_no_tag_or_error to type_name_or_error.
gdb/ChangeLog
2018-06-01 Tom Tromey <tom@tromey.com>
* valops.c (value_cast_structs, destructor_name_p): Update.
* symtab.c (gdb_mangle_name): Update.
* stabsread.c (define_symbol, read_cpp_abbrev, read_baseclasses):
Update.
* p-valprint.c (pascal_object_is_vtbl_ptr_type)
(pascal_object_print_value_fields, pascal_object_print_value):
Update.
* p-typeprint.c (pascal_type_print_derivation_info): Update.
* linespec.c (find_methods): Update.
* gdbtypes.h (type_name_no_tag): Remove.
(type_name_or_error): Rename from type_name_no_tag_or_error.
* gdbtypes.c (type_name_no_tag): Remove.
(type_name_or_error): Rename from type_name_no_tag_or_error.
(lookup_struct_elt_type, check_typedef): Update.
* expprint.c (print_subexp_standard): Update.
* dwarf2read.c (dwarf2_add_field, load_partial_dies): Update.
* d-namespace.c (d_lookup_nested_symbol): Update.
* cp-valprint.c (cp_is_vtbl_ptr_type, cp_print_value_fields)
(cp_print_class_member): Update.
* cp-namespace.c (cp_lookup_nested_symbol): Update.
* completer.c (add_struct_fields): Update.
* c-typeprint.c (cp_type_print_derivation_info)
(c_type_print_varspec_prefix, c_type_print_base_struct_union):
Update.
* ada-lang.c (parse_old_style_renaming, xget_renaming_scope)
(ada_prefer_type, ada_is_exception_sym): Update.
Tom Tromey [Tue, 17 Apr 2018 19:51:24 +0000 (13:51 -0600)]
Remove TYPE_TAG_NAME
TYPE_TAG_NAME has been an occasional source of confusion and bugs. It
seems to me that it is only useful for C and C++ -- but even there,
not so much, because at least with DWARF there doesn't seem to be any
way to wind up with a type where the name and the tag name are both
non-NULL and different.
So, this patch removes TYPE_TAG_NAME entirely. This should save a
little memory, but more importantly, it simplifies this part of gdb.
A few minor test suite adjustments were needed. In some situations
the new code does not yield identical output to the old code.
gdb/ChangeLog
2018-06-01 Tom Tromey <tom@tromey.com>
* valops.c (enum_constant_from_type, value_namespace_elt)
(value_maybe_namespace_elt): Update.
* valarith.c (find_size_for_pointer_math): Update.
* target-descriptions.c (make_gdb_type): Update.
* symmisc.c (print_symbol): Update.
* stabsread.c (define_symbol, read_type)
(complain_about_struct_wipeout, add_undefined_type)
(cleanup_undefined_types_1): Update.
* rust-lang.c (rust_tuple_type_p, rust_slice_type_p)
(rust_range_type_p, val_print_struct, rust_print_struct_def)
(rust_internal_print_type, rust_composite_type)
(rust_evaluate_funcall, rust_evaluate_subexp)
(rust_inclusive_range_type_p): Update.
* python/py-type.c (typy_get_tag): Update.
* p-typeprint.c (pascal_type_print_base): Update.
* mdebugread.c (parse_symbol, parse_type): Update.
* m2-typeprint.c (m2_long_set, m2_record_fields, m2_enum):
Update.
* guile/scm-type.c (gdbscm_type_tag): Update.
* go-lang.c (sixg_string_p): Update.
* gnu-v3-abi.c (build_gdb_vtable_type, build_std_type_info_type):
Update.
* gdbtypes.h (struct main_type) <tag_name>: Remove.
(TYPE_TAG_NAME): Remove.
* gdbtypes.c (type_name_no_tag): Simplify.
(check_typedef, check_types_equal, recursive_dump_type)
(copy_type_recursive, arch_composite_type): Update.
* f-typeprint.c (f_type_print_base): Update. Print "Type" prefix
in summary mode when needed.
* eval.c (evaluate_funcall): Update.
* dwarf2read.c (fixup_go_packaging, read_structure_type)
(process_structure_scope, read_enumeration_type)
(read_namespace_type, read_module_type, determine_prefix): Update.
* cp-support.c (inspect_type): Update.
* coffread.c (process_coff_symbol, decode_base_type): Update.
* c-varobj.c (c_is_path_expr_parent): Update.
* c-typeprint.c (c_type_print_base_struct_union): Update.
(c_type_print_base_1): Update. Print struct/class/union/enum in
summary when using C language.
* ax-gdb.c (gen_struct_ref, gen_namespace_elt)
(gen_maybe_namespace_elt): Update.
* ada-lang.c (ada_type_name): Simplify.
(empty_record, ada_template_to_fixed_record_type_1)
(template_to_static_fixed_type)
(to_record_with_fixed_variant_part, ada_check_typedef): Update.
gdb/testsuite/ChangeLog
2018-06-01 Tom Tromey <tom@tromey.com>
* gdb.xml/tdesc-regs.exp (load_description): Update expected
results.
* gdb.dwarf2/method-ptr.exp: Set language to C++.
* gdb.dwarf2/member-ptr-forwardref.exp: Set language to C++.
* gdb.cp/typeid.exp (do_typeid_tests): Update type_re.
* gdb.base/maint.exp (maint_pass_if): Update.
Tom Tromey [Tue, 17 Apr 2018 19:51:23 +0000 (13:51 -0600)]
Thread language through c_type_print_args
Currently dwarf2read.c will pass the CU's language to
c_type_print_args -- but this doesn't affect all aspects of type
printing, because some code in c-typeprint.c refers to
current_language.
This patch threads the language through more of the type printing
code, adding an overload to c_type_print. Some uses of
current_language remain, but now they are only in top-level functions.
gdb/ChangeLog
2018-06-01 Tom Tromey <tom@tromey.com>
* dwarf2read.c (dwarf2_compute_name): Pass CU's language to
c_print_type.
* c-typeprint.c (c_print_type_1): Add "language" parameter.
(c_print_type): Update.
(c_print_type): New overload.
(c_type_print_varspec_prefix, c_type_print_args)
(c_type_print_varspec_suffix, c_print_type_no_offsets)
(c_type_print_base_struct_union, c_type_print_base_1)
(cp_type_print_method_args): Add "language" parameter.
(c_type_print_base): Update.
* c-lang.h (c_print_type): Add new overload.
Tom Tromey [Tue, 17 Apr 2018 19:51:22 +0000 (13:51 -0600)]
Make c_type_print_varspec_suffix static
I noticed that c_type_print_varspec_suffix is only called from
c-typeprint.c, so this patch makes it "static".
gdb/ChangeLog
2018-06-01 Tom Tromey <tom@tromey.com>
* typeprint.h (c_type_print_varspec_suffix): Don't declare.
* c-typeprint.c (c_type_print_varspec_suffix): Now static.
Alan Hayward [Fri, 1 Jun 2018 15:02:37 +0000 (16:02 +0100)]
Add SVE register defines
In order to prevent gaps in the register numbering, the Z registers
reuse the V register numbers (which become pseudos on SVE).
2018-06-01 Alan Hayward <alan.hayward@arm.com>
* aarch64-tdep.c (aarch64_sve_register_names): New const
var.
* arch/aarch64.h (enum aarch64_regnum): Add SVE entries.
(AARCH64_SVE_Z_REGS_NUM): New define.
(AARCH64_SVE_P_REGS_NUM): Likewise.
(AARCH64_SVE_NUM_REGS): Likewise.
Alexandre Oliva [Fri, 1 Jun 2018 09:00:25 +0000 (06:00 -0300)]
Drop view when consuming line info
Fix locviews on ia64. If we do not drop the view after copying line
info to slots in the bundle, we may attempt to compute the view more
than once and get very confused.
for gas/ChangeLog
* dwarf2dbg.c (dwarf2_consume_line_info): Drop view.
Jan Beulich [Fri, 1 Jun 2018 06:41:16 +0000 (08:41 +0200)]
x86: fold MOV to/from segment register templates
First of all there's no point in having separate Cpu386 templates - the
respective SReg3 registers can't be specified for pre-386 anyway; see
parse_real_register().
And then we can also make use of D here for the memory forms of the
insn. This cannot be done for the non-64bit GPR forms because of the
IgnoreSize that cannot be dropped from the to-SREG variant.
Jan Beulich [Fri, 1 Jun 2018 06:40:38 +0000 (08:40 +0200)]
x86: don't emit REX.W for SLDT and STR
Just like for other selector register reads, they're unnecessary and
should hence be avoided.
Jan Beulich [Fri, 1 Jun 2018 06:39:54 +0000 (08:39 +0200)]
x86: relax redundant REX prefix check
All REX bits can be specified via individual prefixes. Redundancy should
only be reported on a per-bit basis.
Note that I originally had further checks added to the test case,
checking the effect also on PDEP. I had to strip those, because my patch
to correctly handle those
(https://sourceware.org/ml/binutils/2017-02/msg00280.html) was rejected.
I continue to think that there should not be any new prefix introduced
to handle the VEX case - whether the encoding of an insn requires VEX et
al should not be of immediate interest to the programmer.
Jan Beulich [Fri, 1 Jun 2018 06:39:08 +0000 (08:39 +0200)]
x86: simplify control register check
... as is already done elsewhere: There's no need for the use of
operand_type_equal() here - the bit identifying control registers isn't
used for any other purposes.
Jan Beulich [Fri, 1 Jun 2018 06:38:36 +0000 (08:38 +0200)]
x86: tighten condition for emitting LOCK on control register accesses
The control register is never expressed by REX.B; this bit only affects
the involved GPR. Also only one of the operands can have its "control"
flag set, so only check the correct operand.
Jan Beulich [Fri, 1 Jun 2018 06:37:24 +0000 (08:37 +0200)]
x86/Intel: accept "oword ptr" for INVPCID
The insn is no different in this reagrd from INVEPT and INVVPID.
Alan Modra [Fri, 1 Jun 2018 01:30:46 +0000 (11:00 +0930)]
Make _bfd_error_handler available outside libbfd
Needed when building libopcodes.so.
bfd/
* bfd.c (_bfd_error_handler): Arrange for this function to be
declared in bfd-in2.h.
* libbfd-in.h (_bfd_error_handler): Don't declare.
* libbfd.h: Regenerate.
* bfd-in2.h: Regenerate.
opcodes/
* sysdep.h (_bfd_error_handler): Don't declare.
* msp430-decode.opc: Include bfd.h. Don't include ansidecl.h here.
* rl78-decode.opc: Likewise.
* msp430-decode.c: Regenerate.
* rl78-decode.c: Regenerate.
GDB Administrator [Fri, 1 Jun 2018 00:01:00 +0000 (00:01 +0000)]
Automatic date update in version.in
Tom Tromey [Thu, 26 Apr 2018 22:51:40 +0000 (16:51 -0600)]
Fix "set" handling of Python parameters
It's long bothered me that setting a Python parameter from the CLI
will print the "set" help text by default. I think usually "set"
commands should be silent. And, while you can modify this behavior a
bit by providing a "get_set_string" method, if this method returns an
empty string, a blank line will be printed.
This patch removes the "help" behavior and changes the get_set_string
behavior to avoid printing a blank line. The code has a comment about
preserving API behavior, but I don't think this is truly important;
and in any case the workaround -- implementing get_set_string -- is
trivial.
Regression tested on x86-64 Fedora 26.
2018-04-26 Tom Tromey <tom@tromey.com>
* NEWS: Mention new "set" behavior.
* python/py-param.c (get_set_value): Don't print an empty string.
Don't call get_doc_string.
gdb/doc/ChangeLog
2018-04-26 Tom Tromey <tom@tromey.com>
* python.texi (Parameters In Python): Update get_set_string
documentation.
Tom Tromey [Sun, 22 Apr 2018 21:13:09 +0000 (15:13 -0600)]
Add basic Python API for convenience variables
This adds a basic Python API for accessing convenience variables.
With this, convenience variables can be read and set from Python.
Although gdb supports convenience variables whose value changes at
each call, this is not exposed to Python; it could be, but I think
it's just as good to write a convenience function in this situation.
This is PR python/23080.
Tested on x86-64 Fedora 26.
2018-04-22 Tom Tromey <tom@tromey.com>
PR python/23080:
* NEWS: Update for new functions.
* python/py-value.c (gdbpy_set_convenience_variable)
(gdbpy_convenience_variable): New functions.
* python/python-internal.h (gdbpy_convenience_variable)
(gdbpy_set_convenience_variable): Declare.
* python/python.c (python_GdbMethods): Add convenience_variable,
set_convenience_variable.
doc/ChangeLog
2018-04-22 Tom Tromey <tom@tromey.com>
PR python/23080:
* python.texi (Basic Python): Document gdb.convenience_variable,
gdb.set_convenience_variable.
testsuite/ChangeLog
2018-04-22 Tom Tromey <tom@tromey.com>
PR python/23080:
* gdb.python/python.exp: Add convenience variable tests.
Uros Bizjak [Thu, 31 May 2018 15:18:02 +0000 (11:18 -0400)]
Fix Alpha native GDB build
[Commit log by Simon Marchi]
I get this error:
CXX linux-nat.o
/home/simark/src/binutils-gdb/gdb/linux-nat.c: In function 'void save_stop_reason(lwp_info*)':
/home/simark/src/binutils-gdb/gdb/linux-nat.c:2718:9: error: duplicated 'if' condition [-Werror=duplicated-cond]
else if (GDB_ARCH_IS_TRAP_HWBKPT (siginfo.si_code))
^~
In file included from /home/simark/src/binutils-gdb/gdb/linux-nat.c:31:0:
/home/simark/src/binutils-gdb/gdb/nat/linux-ptrace.h:173:41: note: previously used here
# define GDB_ARCH_IS_TRAP_BRKPT(X) ((X) == TRAP_BRKPT)
~~~~~^~~~~~~~~~~~~~
/home/simark/src/binutils-gdb/gdb/linux-nat.c:2709:13: note: in expansion of macro 'GDB_ARCH_IS_TRAP_BRKPT'
else if (GDB_ARCH_IS_TRAP_BRKPT (siginfo.si_code))
^~~~~~~~~~~~~~~~~~~~~~
For Alpha, we currently define GDB_ARCH_IS_TRAP_BRKPT and
GDB_ARCH_IS_TRAP_HWBKPT both to ((X) == TRAP_BRKPT), which causes the
two if branches to be duplicated.
Alpha doesn't have hardware breakpoints, so the Linux kernel for Alpha
never sets si_code to TRAP_HWBKPT. We can just remove the special
definitions of these macros for __alpha__ and rely on the default ones.
Since the kernel will never report TRAP_HWBKPT, we will just never enter
the "hardware breakpoint" branch on Alpha (which is fine since it
doesn't have them).
gdb/ChangeLog:
* nat/linux-ptrace.h [__alpha__]
(GDB_ARCH_IS_TRAP_BRKPT, GDB_ARCH_IS_TRAP_HWBKPT): Remove
definitions.
Maciej W. Rozycki [Thu, 31 May 2018 14:15:35 +0000 (15:15 +0100)]
arch-utils: Make the last endianness actually chosen sticky
Use the last endianness explicitly selected, either by choosing a binary
file or with the `set endian' command, for future automatic selection.
As observed with the `gdb.base/step-over-no-symbols.exp' test case when
discarding the binary file even while connected to a live target the
endianness automatically selected is reset to the GDB target's default,
even if it does not match the endianness of the target being talked to.
For example with a little-endian MIPS target and the default endianness
being big we get this:
(gdb) file .../gdb/testsuite/outputs/gdb.base/step-over-no-symbols/step-over-no-symbols
Reading symbols from .../gdb/testsuite/outputs/gdb.base/step-over-no-symbols/step-over-no-symbols...done.
(gdb) delete breakpoints
(gdb) info breakpoints
No breakpoints or watchpoints.
(gdb) break main
Breakpoint 1 at 0x400840: file .../gdb/testsuite/gdb.base/start.c, line 34.
[...]
(gdb) continue
Continuing.
Breakpoint 1, main () at .../gdb/testsuite/gdb.base/start.c:34
34 foo();
(gdb) delete breakpoints
Delete all breakpoints? (y or n) y
(gdb) info breakpoints
No breakpoints or watchpoints.
(gdb) file
A program is being debugged already.
Are you sure you want to change the file? (y or n) y
No executable file now.
Discard symbol table from `.../gdb/testsuite/outputs/gdb.base/step-over-no-symbols/step-over-no-symbols'? (y or n) y
No symbol file now.
(gdb) PASS: gdb.base/step-over-no-symbols.exp: displaced=off: purging symbols
p /x $pc
$1 = 0x40084000
(gdb) PASS: gdb.base/step-over-no-symbols.exp: displaced=off: get before PC
break *$pc
Breakpoint 2 at 0x40084000
(gdb) PASS: gdb.base/step-over-no-symbols.exp: displaced=off: break *$pc
set displaced-stepping off
(gdb) PASS: gdb.base/step-over-no-symbols.exp: displaced=off: set displaced-stepping off
stepi
Warning:
Cannot insert breakpoint 2.
Cannot access memory at address 0x40084000
Command aborted.
(gdb) FAIL: gdb.base/step-over-no-symbols.exp: displaced=off: stepi
p /x $pc
$2 = 0x40084000
(gdb) PASS: gdb.base/step-over-no-symbols.exp: displaced=off: get after PC
FAIL: gdb.base/step-over-no-symbols.exp: displaced=off: advanced
Remote debugging from host ...
monitor exit
(gdb) Killing process(es): ...
testcase .../gdb/testsuite/gdb.base/step-over-no-symbols.exp completed in 2 seconds
which shows that with the removal of the executable debugged the
endianness of $pc still at `main' gets swapped and the value in that
register is now incorrectly interpreted as 0x40084000 rather than
0x400840 as shown earlier on with the `break' command. Consequently the
debug session no longer works as expected, until the endianness is
overridden with an explicit `set endian little' command.
This will happen while working with any target hardware whose endianness
does not match the default GDB target's endianness guessed and recorded
for a later use in `initialize_current_architecture'.
Given that within a single run of GDB it is more likely that consecutive
target connections will use the same endianness than that the endianness
will be swapped between connections, it makes sense to preserve the last
endianness explicitly selected as the automatic default. It will make a
session like above, where an executable is removed, work correctly and
will retain the endianness for a further reconnection to the target.
And the new automatic default will still be overridden by subsequently
choosing a binary to debug, or with an explicit `set endian' command.
With the change in place the test case above completes successfully:
(gdb) continue
Continuing.
Breakpoint 1, main () at .../gdb/testsuite/gdb.base/start.c:34
34 foo();
(gdb) delete breakpoints
Delete all breakpoints? (y or n) y
(gdb) info breakpoints
No breakpoints or watchpoints.
(gdb) file
A program is being debugged already.
Are you sure you want to change the file? (y or n) y
No executable file now.
Discard symbol table from `.../gdb/testsuite/outputs/gdb.base/step-over-no-symbols/step-over-no-symbols'? (y or n) y
No symbol file now.
(gdb) PASS: gdb.base/step-over-no-symbols.exp: displaced=off: purging symbols
p /x $pc
warning: GDB can't find the start of the function at 0x400840.
GDB is unable to find the start of the function at 0x400840
and thus can't determine the size of that function's stack frame.
This means that GDB may be unable to access that stack frame, or
the frames below it.
This problem is most likely caused by an invalid program counter or
stack pointer.
However, if you think GDB should simply search farther back
from 0x400840 for code which looks like the beginning of a
function, you can increase the range of the search using the `set
heuristic-fence-post' command.
$1 = 0x400840
(gdb) PASS: gdb.base/step-over-no-symbols.exp: displaced=off: get before PC
break *$pc
Breakpoint 2 at 0x400840
(gdb) PASS: gdb.base/step-over-no-symbols.exp: displaced=off: break *$pc
set displaced-stepping off
(gdb) PASS: gdb.base/step-over-no-symbols.exp: displaced=off: set displaced-stepping off
stepi
warning: GDB can't find the start of the function at 0x4007f8.
0x004007f8 in ?? ()
(gdb) PASS: gdb.base/step-over-no-symbols.exp: displaced=off: stepi
p /x $pc
$2 = 0x4007f8
(gdb) PASS: gdb.base/step-over-no-symbols.exp: displaced=off: get after PC
PASS: gdb.base/step-over-no-symbols.exp: displaced=off: advanced
Remote debugging from host ...
monitor exit
(gdb) Killing process(es): ...
testcase .../gdb/testsuite/gdb.base/step-over-no-symbols.exp completed in 2 seconds
gdb/
* arch-utils.c (gdbarch_info_fill): Set `default_byte_order' to
the endianness selected.
* NEWS: Document `set endian auto' mode operation update.
gdb/doc/
* gdb.texinfo (Choosing Target Byte Order): Document endianness
selection details with the `set endian auto' mode.
gdb/testsuite
* gdb.base/endian.exp: New test.
* gdb.base/endian.c: New test source.
Alan Hayward [Thu, 31 May 2018 13:36:48 +0000 (14:36 +0100)]
Function for reading the Aarch64 SVE vector length
Returns 0 for systems without SVE support.
Note the defines taken from Linux kernel headers
in aarch64-sve-linux-ptrace.h.
gdb/
* Makefile.in: Add new header.
* gdb/arch/aarch64.h (sve_vg_from_vl): New macro.
(sve_vl_from_vg): Likewise.
(sve_vq_from_vl): Likewise.
(sve_vl_from_vq): Likewise.
(sve_vq_from_vg): Likewise.
(sve_vg_from_vq): Likewise.
* configure.nat: Add new c file.
* nat/aarch64-sve-linux-ptrace.c: New file.
* nat/aarch64-sve-linux-ptrace.h: New file.
gdbserver/
* configure.srv: Add new c/h file.
Alan Hayward [Thu, 31 May 2018 12:33:04 +0000 (13:33 +0100)]
Add Aarch64 SVE target description
No code uses the new descriptions yet.
gdb/
* aarch64-linux-nat.c (aarch64_linux_read_description):
Add parmeter zero.
* aarch64-linux-tdep.c (aarch64_linux_core_read_description):
Likewise.
* aarch64-tdep.c (tdesc_aarch64_list): Add.
(aarch64_read_description): Use VQ to index tdesc_aarch64_list.
(aarch64_gdbarch_init): Add parmeter zero.
* aarch64-tdep.h (aarch64_read_description): Add VQ parmeter.
* arch/aarch64.c (aarch64_create_target_description): Check VQ.
* arch/aarch64.h (aarch64_create_target_description): Add VQ.
parmeter.
* doc/gdb.texinfo: Describe SVE feature
* features/aarch64-sve.c: New file.
gdbserver/
* linux-aarch64-tdesc.c (aarch64_linux_read_description): Add
null VQ.
edlinger [Mon, 28 May 2018 18:21:23 +0000 (18:21 +0000)]
include: 2018-05-28 Bernd Edlinger <bernd.edlinger@hotmail.de>
include:
* splay-tree.h (splay_tree_compare_strings,
splay_tree_delete_pointers): Declare new utility functions.
libiberty:
2018-05-28 Bernd Edlinger <bernd.edlinger@hotmail.de>
* splay-tree.c (splay_tree_compare_strings,
splay_tree_delete_pointers): New utility functions.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@260850
138bc75d-0d04-0410-961f-
82ee72b054a4
marxin [Thu, 10 May 2018 10:15:42 +0000 (10:15 +0000)]
Improve boostrap-ubsan config (PR bootstrap/64914).
2018-05-10 Martin Liska <mliska@suse.cz>
PR bootstrap/64914
* md5.c: Use strict alignment with UBSAN_BOOTSTRAP.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@260112
138bc75d-0d04-0410-961f-
82ee72b054a4
law [Mon, 30 Apr 2018 18:00:49 +0000 (18:00 +0000)]
* argv.c (expandargv): Fix memory leak for expanded arguments.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@259775
138bc75d-0d04-0410-961f-
82ee72b054a4
Omair Javaid [Sat, 26 May 2018 00:58:51 +0000 (05:58 +0500)]
Unset gdbarch significant_addr_bit by default
This patch fixes a bug introduced by fix to AArch64 pointer tagging.
In our fix for tagged pointer support our agreed approach was to sign
extend user-space address after clearing tag bits. This is not same
for all architectures and this patch allows sign extension for
addresses on targets which specifically set significant_addr_bit.
More information about patch that caused the issues and discussion
around tagged pointer support can be found in links below:
https://sourceware.org/ml/gdb-patches/2018-05/msg00000.html
https://sourceware.org/ml/gdb-patches/2017-12/msg00159.html
gdb/ChangeLog:
2018-05-31 Omair Javaid <omair.javaid@linaro.org>
PR gdb/23210
* gdbarch.sh (significant_addr_bit): Default to zero when
not set by target architecture.
* gdbarch.c: Re-generated.
* utils.c (address_significant): Update.
Alan Modra [Tue, 29 May 2018 01:23:18 +0000 (10:53 +0930)]
Run a few more binutils tests non-native
Setting CC_FOR_TARGET from the environment CC was just plain wrong,
and no doubt the reason these tests were only run natively.
* testsuite/binutils-all/compress.exp (test_gnu_debuglink): Don't
set CC_FOR_TARGET. Run test non-native.
* testsuite/binutils-all/objdump.exp (test_build_id_debuglink):
Likewise.
(test_follow_debuglink): Run test non-native.
GDB Administrator [Thu, 31 May 2018 00:00:35 +0000 (00:00 +0000)]
Automatic date update in version.in
Joel Brobecker [Wed, 30 May 2018 23:43:02 +0000 (16:43 -0700)]
(ARI) remove trailing newline in call to error in stack.c::func_command
gdb/ChangeLog:
* stack.c (func_command): Remove trailing newline in call to error.
Simon Marchi [Wed, 30 May 2018 18:54:46 +0000 (14:54 -0400)]
Remove regcache_raw_collect
Remove regcache_raw_collect, update callers to use
regcache::raw_collect.
gdb/ChangeLog:
* regcache.h (regcache_raw_collect): Remove, update callers to
use regcache::raw_collect.
* regcache.c (regcache_raw_collect): Remove.
Simon Marchi [Wed, 30 May 2018 18:54:45 +0000 (14:54 -0400)]
Remove regcache_raw_supply
Remove regcache_raw_supply, update callers to use
detached_regcache::raw_supply.
gdb/ChangeLog:
* regcache.h (regcache_raw_supply): Remove, update callers to
use detached_regcache::raw_supply.
* regcache.c (regcache_raw_supply): Remove.
Simon Marchi [Wed, 30 May 2018 18:54:44 +0000 (14:54 -0400)]
Remove regcache_cooked_write_part
Remove regcache_cooked_write_part, update callers to use
regcache::cooked_write_part.
gdb/ChangeLog:
* regcache.h (regcache_cooked_write_part): Remove, update
callers to use regcache::cooked_write_part.
* regcache.c (regcache_cooked_write_part): Remove.
Simon Marchi [Wed, 30 May 2018 18:54:43 +0000 (14:54 -0400)]
Remove regcache_cooked_read_part
Remove regcache_cooked_read_part, update callers to use
readable_regcache::cooked_read_part.
gdb/ChangeLog:
* regcache.h (regcache_cooked_read_part): Remove, update callers
to use readable_regcache::cooked_read_part.
* regcache.c (regcache_cooked_read_part): Remove.
Simon Marchi [Wed, 30 May 2018 18:54:42 +0000 (14:54 -0400)]
Remove regcache_cooked_read_value
Remove regcache_cooked_read_value, update callers to use
readable_regcache::cooked_read_value.
gdb/ChangeLog:
* regcache.h (regcache_cooked_read_value): Remove, update
callers to use readable_regcache::cooked_read_value.
* regcache.c (regcache_cooked_read_value): Remove.
Simon Marchi [Wed, 30 May 2018 18:54:42 +0000 (14:54 -0400)]
Remove regcache_cooked_write
Remove regcache_cooked_write, update callers to use
regcache::cooked_write.
gdb/ChangeLog:
* regcache.h (regcache_cooked_write): Remove, update callers to
use regcache::cooked_write.
* regcache.c (regcache_cooked_write): Remove.
Simon Marchi [Wed, 30 May 2018 18:54:41 +0000 (14:54 -0400)]
Remove regcache_invalidate
Remove regcache_invalidate, update callers to use
detached_regcache::invalidate instead.
gdb/ChangeLog:
* regcache.h (regcache_invalidate): Remove, update callers to
use detached_regcache::invalidate instead.
* regcache.c (regcache_invalidate): Remove.
Simon Marchi [Wed, 30 May 2018 18:54:40 +0000 (14:54 -0400)]
Remove regcache_raw_write_part
Remove regcache_raw_write_part, update callers to use
regcache::raw_write_part instead.
gdb/ChangeLog:
* regcache.h (regcache_raw_write_part): Remove, update callers
to use regcache::raw_write_part instead.
* regcache.c (regcache_raw_write_part): Remove.
Simon Marchi [Wed, 30 May 2018 18:54:39 +0000 (14:54 -0400)]
Remove regcache_raw_read_part
Remove regcache_raw_read_part, update callers to use
readable_regcache::raw_read_part instead.
gdb/ChangeLog:
* regcache.h (regcache_raw_read_part): Remove, update callers to
use readable_regcache::raw_read_part instead.
* regcache.c (regcache_raw_read_part): Remove.
Simon Marchi [Wed, 30 May 2018 18:54:38 +0000 (14:54 -0400)]
Remove regcache_cooked_read
Remove regcache_cooked_read, update callers to use
readable_regcache::cooked_read instead.
gdb/ChangeLog:
* regcache.h (regcache_cooked_read): Remove, update callers to
use readable_regcache::cooked_read instead.
* regcache.c (regcache_cooked_read): Remove.
Simon Marchi [Wed, 30 May 2018 18:54:37 +0000 (14:54 -0400)]
Remove regcache_raw_write
Remove regcache_raw_write, update all callers to use regcache::raw_write
instead.
gdb/ChangeLog:
* regcache.h (regcache_raw_write): Remove, update callers to use
regcache::raw_write instead.
* regcache.c (regcache_raw_write): Remove.
Simon Marchi [Wed, 30 May 2018 18:54:36 +0000 (14:54 -0400)]
Remove regcache_raw_read
Remove regcache_raw_read, update all callers to use
readable_regcache::raw_read instead.
gdb/ChangeLog:
* regcache.h (regcache_raw_read): Remove, update callers to use
readable_regcache::raw_read instead.
* regcache.c (regcache_raw_read): Remove.
Simon Marchi [Wed, 30 May 2018 18:54:36 +0000 (14:54 -0400)]
Remove regcache_raw_update
Remove regcache_raw_update, update callers to use
readable_regcache::raw_update instead.
gdb/ChangeLog:
* regcache.h (regcache_raw_update): Remove, update callers to
use readable_regcache::raw_update instead.
* regcache.c (regcache_raw_update): Remove.
Simon Marchi [Wed, 30 May 2018 18:54:35 +0000 (14:54 -0400)]
Remove regcache_register_status
Remove regcache_register_status, change callers to use
reg_buffer::get_register_status directly.
gdb/ChangeLog:
* regcache.h (regcache_register_status): Remove, update callers
to use reg_buffer::get_register_status directly instead.
* regcache.c (regcache_register_status): Remove.
Simon Marchi [Wed, 30 May 2018 18:54:34 +0000 (14:54 -0400)]
Remove regcache_get_ptid
Remove regcache_get_ptid, change all callers to call the regcache method
directly.
gdb/ChangeLog:
* regcache.h (regcache_get_ptid): Remove, update all callers to
call regcache::ptid instead.
* regcache.c (regcache_get_ptid): Remove.
Ant Bikeneev [Wed, 30 May 2018 16:06:26 +0000 (17:06 +0100)]
Add option to ar's 't' command to display the offset of elements within the archive.
PR 23107
* ar.c (display_offsets): New variable.
(usage): Add description of 'O' operator.
(decode_option): Handle 'O' operator.
(print_descr): Pass display_offsets to print_arelt_descr.
* arsup.c: Update call to printy_arelt_descr.
* objdump.c: Likewise.
* bucomm.c (print_arelt_descr): If offsets parameter is true then
display offset of archive element within the archive.
* bucomm.h: Update prototype for print_arelt_descr.
* doc/binutils.texi: Update description of ar command.
* NEWS: Mention the new feature.
* testsuite/binutils-all/ar.exp: Add text of new feature.
Simon Marchi [Wed, 30 May 2018 16:04:35 +0000 (12:04 -0400)]
Add or1k target to --enable-targets=all
The or1k-tdep.o object is missing from the ALL_TARGET_OBS, which means
it's not currently included in an --enable-targets=all build.
gdb/ChangeLog:
* Makefile.in (ALL_TARGET_OBS): Add or1k-tdep.o.
Amaan Cheval [Fri, 18 May 2018 20:20:40 +0000 (01:50 +0530)]
2018-05-30 Amaan Cheval <amaan.cheval@gmail.com>
* config.bfd (x86_64-*-*): Add pei-x86-64 target to x86_64-*-rtems*
This is needed to generate UEFI application image files from ELFs.
Pedro Alves [Wed, 30 May 2018 13:18:47 +0000 (14:18 +0100)]
Mark END_CATCH as ATTRIBUTE_NORETURN (-Wmaybe-uninitialized warnings)
This commit fixes a set of -Wmaybe-uninitialized warnings in GDB and
GDBserver, seen with GCC 7.3.1 on F27 at -O2. Specifically, all of
these:
src/gdb/breakpoint.c:5040:4: warning: ‘e’ may be used uninitialized in this function [-Wmaybe-uninitialized]
src/gdb/cli/cli-cmds.c:277:71: warning: ‘tracker’ may be used uninitialized in this function [-Wmaybe-uninitialized]
src/gdb/cli/cli-cmds.c:302:22: warning: ‘word’ may be used uninitialized in this function [-Wmaybe-uninitialized]
src/gdb/gdbserver/server.c:1895:7: warning: ‘result’ may be used uninitialized in this function [-Wmaybe-uninitialized]
src/gdb/gdbserver/server.c:1966:7: warning: ‘result’ may be used uninitialized in this function [-Wmaybe-uninitialized]
For example, looking at one of the gdbserver ones in more detail:
../../../src/gdb/gdbserver/server.c: In function ‘int handle_qxfer_btrace_conf(const char*, gdb_byte*, const gdb_byte*, ULONGEST, LONGEST)’:
../../../src/gdb/gdbserver/server.c:1966:7: warning: ‘result’ may be used uninitialized in this function [-Wmaybe-uninitialized]
if (result != 0)
^~
In this case (like the others), the 'result' variable is assigned in
both TRY and CATCH blocks:
TRY
{
result = target_read_btrace_conf (thread->btrace, &cache);
if (result != 0)
memcpy (own_buf, cache.buffer, cache.used_size);
}
CATCH (exception, RETURN_MASK_ERROR)
{
sprintf (own_buf, "E.%s", exception.message);
result = -1;
}
END_CATCH
if (result != 0)
return -3;
so it would seem like the warning is bogus.
However, END_CATCH is really a catch block in disguise, and that path
indeed does not initialize the variable:
#define END_CATCH \
catch (...) \
{ \
exception_rethrow (); \
} \
}
exception_rethrow does not return normally (it rethrows the current
exception after running cleanups), but the compiler can not see that.
If it could return normally, then indeed 'result' could be used
uninitialized if the TRY block threw some non-gdb exception, which
would be caught by END_CATCH.
The fix it to let the compiler know that the exception_rethrow does
not return normally, using ATTRIBUTE_NORETURN.
gdb/ChangeLog:
2018-05-30 Pedro Alves <palves@redhat.com>
* common/common-exceptions.h (exception_rethrow): Use
ATTRIBUTE_NORETURN.
Amit Pawar [Wed, 30 May 2018 06:57:35 +0000 (12:27 +0530)]
Add znver2 support.
gas/
* config/tc-i386.c (cpu_flag_init): Add CPU_ZNVER2_FLAGS.
* doc/c-i386.texi : Document znver2.
* gas/testsuite/gas/i386/arch-13.s: Updated for znver2.
* gas/testsuite/gas/i386/arch-13.d: Updated.
* gas/testsuite/gas/i386/arch-13-znver1.d: Updated.
* gas/testsuite/gas/i386/arch-13-znver2.d: New file.
* gas/testsuite/gas/i386/x86-64-arch-3.s: Updated for znver2.
* gas/testsuite/gas/i386/x86-64-arch-3.d: Updated.
* gas/testsuite/gas/i386/x86-64-arch-3-znver1.d: Updated.
* gas/testsuite/gas/i386/x86-64-arch-3-znver2.d: New file.
* gas/testsuite/gas/i386/i386.exp: Updated for new test.
opcode/
* i386-gen.c (cpu_flag_init): Add CPU_ZNVER2_FLAGS.
* i386-init.h : Regenerated.
Simon Marchi [Wed, 30 May 2018 00:13:04 +0000 (20:13 -0400)]
Remove "struct" keyword in range-based for loops
I get this kind of errors with GCC 6.3.0:
/home/simark/src/binutils-gdb/gdb/breakpoint.c: In function 'void print_solib_event(int)':
/home/simark/src/binutils-gdb/gdb/breakpoint.c:4618:12: error: types may not be defined in a for-range-declaration [-Werror]
for (struct so_list *iter : current_program_space->added_solibs)
^~~~~~
Removing the struct keyword makes it happy.
gdb/ChangeLog:
* breakpoint.c (print_solib_event, check_status_catch_solib):
Remove struct keyword in range-based for loops.
* dbxread.c (find_corresponding_bincl_psymtab): Likewise.
* dwarf2read.c (compute_delayed_physnames, rust_union_quirks);
Likewise.
* linespec.c (find_superclass_methods, search_minsyms_for_name):
Likewise.
* symfile.c (addr_info_make_relative): Likewise.
* thread.c (value_in_thread_stack_temporaries): Likewise.
GDB Administrator [Wed, 30 May 2018 00:01:00 +0000 (00:01 +0000)]
Automatic date update in version.in
Weimin Pan [Tue, 29 May 2018 22:01:34 +0000 (22:01 +0000)]
Removing lookup_minimal_symbol_and_objfile
Function lookup_minimal_symbol_and_objfile iterates on all objfiles and
calls lookup_minimal_symbol for each of them, effectively searching in all
objfiles. lookup_bound_minimal_symbol calls lookup_minimal_symbol with NULL,
which also effectively searches all objfiles. AFAIK, they do exactly the same
thing, so we can get rid of one (and lookup_minimal_symbol_and_objfile happens
to be the most inefficient because it ends up n^2 on the number of objfiles).
Tested in both aarch64-linux-gnu and amd64-linux-gnu. No regressions.
Tom Tromey [Tue, 29 May 2018 03:26:50 +0000 (21:26 -0600)]
Fix fall-through comment in windows-nat.c
Now that the mingw builder in the buildbot is working again, it
pointed out a build failure due to a missing fall-through comment in
windows-nat.c. This patch fixes the problem.
Tested by first triggering the failure with a local mingw build, then
by rebuilding successfully with the patch.
I'm checking this in as obvious.
gdb/ChangeLog
2018-05-29 Tom Tromey <tom@tromey.com>
* windows-nat.c (handle_exception): Update fall-through comment.
Tom Tromey [Tue, 29 May 2018 06:38:23 +0000 (00:38 -0600)]
Change program_space::added_solibs to a std::vector
This changes program_space::added_solibs to a std::vector, removing a
VEC.
Tested by the buildbot.
gdb/ChangeLog
2018-05-29 Tom Tromey <tom@tromey.com>
* progspace.h (so_list_ptr): Remove typedef. Don't declare VEC.
(struct program_space) <added_solibs>: Now a std::vector.
* breakpoint.c (print_solib_event): Update.
(check_status_catch_solib): Update.
* progspace.c (clear_program_space_solib_cache): Update.
* solib.c (update_solib_list): Update.
Tom Tromey [Tue, 29 May 2018 06:29:23 +0000 (00:29 -0600)]
Remove a VEC from type.c
This removes a VEC from type.c, by using std::vector.
While doing this I also took the opportunity to change
types_deeply_equal to return bool. This caught some weird code in
typy_richcompare, now fixed.
And, since I was changing types_deeply_equal, it seemed like a good
idea to also change types_equal, so this patch includes that as well.
Tested by the buildbot.
ChangeLog
2018-05-29 Tom Tromey <tom@tromey.com>
* python/py-type.c (typy_richcompare): Update.
* guile/scm-type.c (tyscm_equal_p_type_smob): Update.
* gdbtypes.h (types_deeply_equal): Return bool.
(types_equal): Likewise.
* gdbtypes.c (type_equality_entry_d): Remove typedef. Don't
declare VEC.
(check_types_equal): Change worklist to std::vector. Return
bool.
(struct type_equality_entry): Add constructor.
(compare_maybe_null_strings): Return bool.
(check_types_worklist): Return bool. Change worklist to
std::vector.
(types_deeply_equal): Use std::vector.
(types_equal): Return bool.
(compare_maybe_null_strings): Simplify.
Tom Tromey [Tue, 29 May 2018 06:16:01 +0000 (00:16 -0600)]
Remove tp_t typedef
The tp_t typedef is no longer used and can be removed.
ChangeLog
2018-05-29 Tom Tromey <tom@tromey.com>
* record-btrace.c (tp_t): Remove typedef. Don't declare VEC.
Tom Tromey [Tue, 29 May 2018 06:14:58 +0000 (00:14 -0600)]
Remove const_char_ptr typedef
The const_char_ptr is no longer used, so it can be removed.
ChangeLog
2018-05-29 Tom Tromey <tom@tromey.com>
* objc-lang.h: Don't include cp-support.h.
* common/gdb_vecs.h (const_char_ptr): Remove typedef. Don't
declare VEC.
GDB Administrator [Tue, 29 May 2018 00:00:36 +0000 (00:00 +0000)]
Automatic date update in version.in
H.J. Lu [Mon, 28 May 2018 17:46:16 +0000 (10:46 -0700)]
x86-64: Add TLSDESC fields to elf_x86_lazy_plt_layout
ENDBR64 is added to the special TLSDESC entry, which is similar to the
PLT0 entry, in the x86-64 lazy procedure linkage table to support Intel
CET. The NaCl PLT is different from the normal PLT. This patch adds
plt_tlsdesc_entry, plt_tlsdesc_entry_size, plt_tlsdesc_got1_offset,
plt_tlsdesc_got2_offset, plt_tlsdesc_got1_insn_end and
plt_tlsdesc_got2_insn_end to elf_x86_lazy_plt_layout to support both
normal and NaCl TLSDESC entries. This fixed
FAIL: TLS descriptor -fpic -shared transitions
for x86_64-nacl.
* elf32-i386.c (elf_i386_lazy_plt): Add plt_tlsdesc_entry,
plt_tlsdesc_entry_size, plt_tlsdesc_got1_offset,
plt_tlsdesc_got2_offset, plt_tlsdesc_got1_insn_end and
plt_tlsdesc_got2_insn_end for TLSDESC entry.
(elf_i386_lazy_ibt_plt): Likewise.
(elf_i386_nacl_plt): Likewise.
* elf64-x86-64.c (tlsdesc_plt_entry): Moved and renamed to ...
(elf_x86_64_tlsdesc_plt_entry): This.
(elf_x86_64_lazy_plt): Add plt_tlsdesc_entry,
plt_tlsdesc_entry_size, plt_tlsdesc_got1_offset,
plt_tlsdesc_got2_offset, plt_tlsdesc_got1_insn_end and
plt_tlsdesc_got2_insn_end for TLSDESC entry.
(elf_x86_64_lazy_bnd_plt): Likewise.
(elf_x86_64_lazy_ibt_plt): Likewise.
(elf_x32_lazy_ibt_plt): Likewise.
(elf_x86_64_nacl_plt): Likewise.
(elf_x86_64_finish_dynamic_sections): Use plt_tlsdesc_entry,
plt_tlsdesc_entry_size, plt_tlsdesc_got1_offset,
plt_tlsdesc_got2_offset, plt_tlsdesc_got1_insn_end and
plt_tlsdesc_got2_insn_end to update TLSDESC entry.
* elfxx-x86.h (elf_x86_lazy_plt_layout): Update comments.
Add plt_tlsdesc_entry, plt_tlsdesc_entry_size,
plt_tlsdesc_got1_offset, plt_tlsdesc_got2_offset,
plt_tlsdesc_got1_insn_end and plt_tlsdesc_got2_insn_end.
(elf_x86_non_lazy_plt_layout): Update comments.
(elf_x86_plt_layout): Likewise.
H.J. Lu [Mon, 28 May 2018 15:15:06 +0000 (08:15 -0700)]
ld: Unify STT_GNU_IFUNC handling
Take STT_GNU_IFUNC handling scattered across targets and gather it in
the generic ELF linker.
bfd/
PR ld/23238
* elf-s390-common.c (elf_s390_add_symbol_hook): Removed.
* elf32-arc.c (elf_arc_add_symbol_hook): Likewise.
(elf_backend_add_symbol_hook): Likewise.
* elf32-m68k.c (elf_m68k_add_symbol_hook): Likewise.
(elf_backend_add_symbol_hook): Likewise.
* elf32-s390.c (elf_backend_add_symbol_hook): Likewise.
* elf32-sparc.c (elf32_sparc_add_symbol_hook): Likewise.
(elf_backend_add_symbol_hook): Likewise.
* elf64-s390.c (elf_backend_add_symbol_hook): Likewise.
* elfxx-aarch64.c (_bfd_aarch64_elf_add_symbol_hook): Likewise.
* elfxx-aarch64.h (_bfd_aarch64_elf_add_symbol_hook): Likewise.
(elf_backend_add_symbol_hook): Likewise.
* elf32-arm.c (elf32_arm_add_symbol_hook): Remove STT_GNU_IFUNC
handling.
* elf32-ppc.c (ppc_elf_add_symbol_hook): Likewise.
* elf64-ppc.c (ppc64_elf_add_symbol_hook): Likewise.
* elf64-sparc.c (elf64_sparc_add_symbol_hook): Likewise.
* elflink.c (elf_link_add_object_symbols): Set
elf_gnu_symbol_ifunc for STT_GNU_IFUNC symbols.
ld/
PR ld/23238
* testsuite/ld-ifunc/ifunc-26.d: New file.
* testsuite/ld-ifunc/ifunc-26.s: Likewise.
* testsuite/ld-ifunc/ifunc.exp: Run *.d tests without a
working compiler.
H.J. Lu [Mon, 28 May 2018 15:05:09 +0000 (08:05 -0700)]
ld: Skip some x86 IFUNC tests for NaCl targets
Since NaCl linker may not support "-m elf_i386" nor "-m elf_x86_64", skip
x86 IFUNC tests for NaCl targets where "-m elf_i386" or "-m elf_x86_64"
are passed to linker.
* testsuite/ld-ifunc/ifunc-10-i386.d: Skip NaCl targets.
* testsuite/ld-ifunc/ifunc-10-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-11-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-11-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-12-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-12-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-13-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-13-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-14a-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-14a-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-14b-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-14b-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-14c-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-14c-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-14d-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-14d-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-14e-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-14e-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-14f-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-14f-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-15-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-15-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-16-i386-now.d: Likewise.
* testsuite/ld-ifunc/ifunc-16-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-16-x86-64-now.d: Likewise.
* testsuite/ld-ifunc/ifunc-16-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-17a-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-17a-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-17b-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-17b-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-18a-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-18a-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-18b-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-18b-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-19a-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-19a-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-19b-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-19b-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-2-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-2-local-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-2-local-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-2-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-20-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-20-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-21-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-21-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-22-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-22-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-5a-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-5a-local-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-5a-local-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-5a-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-5b-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-5b-local-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-5b-local-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-5b-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-5r-local-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-5r-local-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-6a-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-6a-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-6b-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-6b-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-7a-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-7a-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-7b-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-7b-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-8-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-8-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-9-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-9-x86-64.d: Likewise.
* testsuite/ld-ifunc/pr17154-i386.d: Likewise.
* testsuite/ld-ifunc/pr17154-x86-64-now.d: Likewise.
* testsuite/ld-ifunc/pr17154-x86-64.d: Likewise.
Alan Modra [Mon, 28 May 2018 07:00:23 +0000 (16:30 +0930)]
PR23235, make check uses system installed ld
This patch doesn't stop the build-id and debuglink tests using the
installed ld, it just prevents a compiler failure from resulting in a
test fail. We could move the tests to the ld testsuite but it doesn't
seem all that important.
PR 23235
* testsuite/binutils-all/compress.exp (test_gnu_debuglink): Return
unsupported rather than fail on compile errors.
* testsuite/binutils-all/objdump.exp (test_build_id_debuglink):
Likewise. Save and restore CFLAGS_FOR_TARGET.
GDB Administrator [Mon, 28 May 2018 00:00:23 +0000 (00:00 +0000)]
Automatic date update in version.in
Tom Tromey [Sun, 27 May 2018 19:05:03 +0000 (13:05 -0600)]
Remove last reference to REMOTE_OBS
REMOTE_OBS was removed from Makefile.in in
18ca73470a0d7eb96a807c97559cbb9fddb4b461, but one reference remains.
This patch removes the lingerer.
ChangeLog
2018-05-27 Tom Tromey <tom@tromey.com>
* Makefile.in (DEPFILES): Don't reference REMOTE_OBS.
GDB Administrator [Sun, 27 May 2018 00:01:17 +0000 (00:01 +0000)]
Automatic date update in version.in
H.J. Lu [Sat, 26 May 2018 11:27:09 +0000 (04:27 -0700)]
ld: Add _bfd_elf_link_hide_sym_by_version
bfd_hide_sym_by_version can't be used to check if a versioned symbol is
hidden. This patch adds _bfd_elf_link_hide_sym_by_version to support
both versioned and unversioned symbols by extracting versioned symbol
check from _bfd_elf_link_assign_sym_version.
bfd/
PR ld/23194
* elf-bfd.h (_bfd_elf_link_hide_sym_by_version): New.
* elflink.c (_bfd_elf_link_hide_versioned_symbol): New function.
Extracted from _bfd_elf_link_assign_sym_version.
(_bfd_elf_link_hide_sym_by_version): New function.
(_bfd_elf_link_assign_sym_version): Use
_bfd_elf_link_hide_versioned_symbol.
* elfxx-x86.c (_bfd_x86_elf_link_symbol_references_local): Call
_bfd_elf_link_hide_sym_by_version instead of
bfd_hide_sym_by_version. Don't check unversioned symbol.
ld/
PR ld/23194
* testsuite/ld-i386/pr23194.d: Expect only R_386_GLOB_DAT
against foobar.
* testsuite/ld-i386/pr23194.map: Add foobar.
* testsuite/ld-x86-64/pr23194.map: Likewise.
* testsuite/ld-i386/pr23194.s: Add a common foobar symbol.
* testsuite/ld-x86-64/pr23194.s: Likewise.
* testsuite/ld-x86-64/pr23194.d: Expect only R_X86_64_GLOB_DAT
against foobar.
GDB Administrator [Sat, 26 May 2018 00:00:34 +0000 (00:00 +0000)]
Automatic date update in version.in
Tom Tromey [Tue, 10 Apr 2018 14:24:43 +0000 (08:24 -0600)]
Clear entire "location" in value constructor
My recent change to allocate values with "new" may have introduced a
small bug. In particular, the previous code allocated with XCNEW, but
the new code only clears a part of the "location" field in the
constructor. I didn't try very hard to actually trigger a bug here,
the problem remains theoretical.
This patch just arranges to initialize the entire location.
Regression tested by the buildbot.
2018-05-25 Tom Tromey <tom@tromey.com>
* value.c (value::location): Initialize.
Tom Tromey [Fri, 25 May 2018 04:09:24 +0000 (22:09 -0600)]
Remove cleanups from dbxread.c
This removes the remaining cleanups from dbxread.c, via std::vector,
scoped_restore, and unique_xmalloc_ptr.
Tested by the buildbot.
ChangeLog
2018-05-25 Tom Tromey <tom@tromey.com>
* dbxread.c (init_bincl_list): Remove.
(bincl_list): Now a std::vector.
(bincls_allocated, next_bincl): Remove.
(free_bincl_list, do_free_bincl_list_cleanup)
(make_cleanup_free_bincl_list): Remove.
(dbx_read_symtab, elfstab_build_psymtabs): Use scoped_restore,
unique_xmalloc_ptr.
(find_corresponding_bincl_psymtab, read_dbx_symtab): Update.
(struct header_file_location): Add constructor.
(add_bincl_to_list): Remove.
Tom Tromey [Fri, 25 May 2018 18:39:51 +0000 (12:39 -0600)]
Add "name" method to class interp
In a review Pedro pointed out that interp::name is intended to be
read-only, and so an accessor would be a better fit. This patch
renames the field and adds a "name" method that is used instead.
ChangeLog
2018-05-25 Tom Tromey <tom@tromey.com>
* tui/tui.c (tui_enable): Update.
* mi/mi-interp.c (mi_interp::init): Update.
* interps.h (class interp) <name>: New method.
<m_name>: Rename from name.
(~scoped_restore_interp): Update.
* interps.c (interp::interp): Update.
(interp_add, interp_set, interp_lookup_existing)
(current_interp_named_p): Update.
Tom Tromey [Mon, 30 Apr 2018 05:12:07 +0000 (23:12 -0600)]
Remove interp_name
This removes the interp_name function. It is only used a few spots --
one of which was only calling it on "this". It's simpler to remove
it; and should class interp become opaque in the future, it will be
just as easy to update the two remaining spots to use an accessor.
ChangeLog
2018-05-25 Tom Tromey <tom@tromey.com>
* interps.c (interp_name): Remove.
* mi/mi-interp.c (mi_interp::init): Update.
* interps.h (interp_name): Remove.
(~scoped_restore_interp): Update.
* tui/tui.c (tui_enable): Update.
Tom Tromey [Mon, 30 Apr 2018 05:12:06 +0000 (23:12 -0600)]
Remove interp_ui_out
The function interp_ui_out simply calls the interp_ui_out method.
However, if it is passed a NULL interpreter, it first finds the
current interpreter. I believe, though, that NULL is never passed
here, and I think it's simpler to just remove this function and
require callers to be more explicit.
ChangeLog
2018-05-25 Tom Tromey <tom@tromey.com>
* utils.c (fputs_maybe_filtered): Update.
* linespec.c (decode_line_full): Update.
* mi/mi-interp.c (mi_on_normal_stop_1, mi_tsv_modified)
(mi_print_breakpoint_for_event, mi_solib_loaded)
(mi_solib_unloaded, mi_command_param_changed, mi_memory_changed)
(mi_user_selected_context_changed): Update.
* mi/mi-main.c (mi_execute_command): Update.
* cli/cli-script.c (execute_control_command): Update.
* python/python.c (execute_gdb_command): Update.
* solib.c (info_sharedlibrary_command): Update.
* interps.c (interp_ui_out): Remove.
* interps.h (interp_ui_out): Remove.
Tom Tromey [Mon, 30 Apr 2018 05:12:05 +0000 (23:12 -0600)]
Change the as_*_interp functions to use dynamic_cast
This changes the various as_*_interp functions to be implemented using
dynamic_cast. I believe this is a small improvement, because it is
more typesafe -- the C++ runtime does the type-checking for us.
ChangeLog
2018-05-25 Tom Tromey <tom@tromey.com>
* tui/tui-interp.c (as_tui_interp): Use dynamic_cast.
* mi/mi-interp.c (as_mi_interp): Use dynamic_cast.
* cli/cli-interp.c (as_cli_interp): Use dynamic_cast.
Tom Tromey [Mon, 30 Apr 2018 05:12:04 +0000 (23:12 -0600)]
Use scoped_restore in a couple of interp-related places
While looking through the "interp" code I found a couple of spots that
could use scoped_restore.
ChangeLog
2018-05-25 Tom Tromey <tom@tromey.com>
* cli/cli-interp.c (safe_execute_command): Use scoped_restore.
* interps.c (interp_exec): Use scoped_restore.
Tom Tromey [Fri, 25 May 2018 03:52:54 +0000 (21:52 -0600)]
Use gdb::byte_vector in remote.c
This changes a couple of spots in remote.c to use gdb::byte_vector,
allowing for some cleanup removal.
ChangeLog
2018-05-25 Tom Tromey <tom@tromey.com>
* remote.c (remote_target::remote_file_get): Use
gdb::byte_vector.
(remote_target::remote_file_put): Likewise.