Jim Wilson [Tue, 9 Jan 2018 18:08:47 +0000 (10:08 -0800)]
Add explicit shared check to eh-frame-hdr test.
ld/
* testsuite/ld-elf/eh-frame-hdr.d (#xfail): Delete
(#alltargets): Renamed from #target. Add shared.
* testsuite/lib/ld-lib.exp (run_dump_test): Document shared target.
Document alltargets option. Add support for alltargets option.
(istarget): Add support for shared target.
James Greenhalgh [Tue, 9 Jan 2018 14:15:00 +0000 (14:15 +0000)]
[Arm] Add CSDB instruction
CSDB is a new instruction which Arm has defined. As it shares the
encoding space with NOP instructions, it is available from Armv3 in
Arm mode, and Armv6T2 in Thumb mode.
OK? If so, please commit on my behalf as I don't have commit rights
over here.
Thanks, James
---
opcodes/
2018-01-09 James Greenhalgh <james.greenhalgh@arm.com>
* arm-dis.c (arm_opcodes): Add csdb.
(thumb32_opcodes): Add csdb.
gas/
2018-01-09 James Greenhalgh <james.greenhalgh@arm.com>
* config/tc-arm.c (insns): Add csdb, enable for Armv3 and above
in Arm execution state, and Armv6T2 and above in Thumb execution
state.
* testsuite/gas/arm/csdb.s: New.
* testsuite/gas/arm/csdb.d: New.
* testsuite/gas/arm/thumb2_it_bad.l: Add csdb.
* testsuite/gas/arm/thumb2_it_bad.s: Add csdb.
James Greenhalgh [Tue, 9 Jan 2018 11:28:04 +0000 (11:28 +0000)]
Add support for the AArch64's CSDB instruction.
CSDB is a new instruction which Arm has defined. It has the same encoding as
HINT #0x14 and is available at all architecture levels.
opcodes * aarch64-tbl.h (aarch64_opcode_table): Add "csdb".
* aarch64-asm-2.c: Regenerate.
* aarch64-dis-2.c: Regenerate.
* aarch64-opc-2.c: Regenerate.
gas * testsuite/gas/aarch64/system.d: Update expected results to expect
CSDB.
Xavier Roirand [Mon, 11 Dec 2017 09:03:45 +0000 (10:03 +0100)]
Fix breakpoint add on inlined function using function name.
Using this Ada example:
package B is
procedure Read_Small with Inline_Always;
end B;
package body B is
Total : Natural := 0;
procedure Read_Small is
begin
Total := Total + 1;
end Read_Small;
end B;
and
with B;
procedure M is
begin
B.Read_Small;
end M;
% gnatmake -g -O0 -m m.adb -cargs -gnatn
% gdb m
Inserting a breakpoint on Read_Small inlined function does not work:
(gdb) b read_small
Breakpoint 1 at 0x40250e: file b.adb, line 5.
(gdb) info b
Num Type Disp Enb Address What
1 breakpoint keep y 0x000000000040250e in b.doit at b.adb:5
(gdb)
In this exemple we should have two breakpoints set, one in package B and
the other one in the inlined instance inside procedure M), like below:
(gdb) b read_small
Breakpoint 1 at 0x40250e: b.adb:5. (2 locations)
(gdb) info b
Num Type Disp Enb Address What
1 breakpoint keep y <MULTIPLE>
1.1 y 0x000000000040250e in b.doit at b.adb:5
1.2 y 0x0000000000402540 in m at b.adb:5
(gdb)
Looking at the DWARF info for inlined instance of Read_Small:
<1><1526>: Abbrev Number: 2 (DW_TAG_subprogram)
<1527> DW_AT_name : ([...], offset: 0x1e82): b__read_small
<152b> DW_AT_decl_file : 2
<152c> DW_AT_decl_line : 3
<152d> DW_AT_inline : 3 (declared as inline and inlined)
[...]
<2><1547>: Abbrev Number: 4 (DW_TAG_inlined_subroutine)
<1548> DW_AT_abstract_origin: <0x1526>
<154c> DW_AT_low_pc : 0x402552
<1554> DW_AT_high_pc : 0x2b
<155c> DW_AT_call_file : 1
<155d> DW_AT_call_line : 5
<2><155e>: Abbrev Number: 0
During the parsing of DWARF info in order to produce partial DIE linked
list, the DW_TAG_inlined_subroutine were skipped thus not present in the
final partial dies.
Taking DW_TAG_inlined_subroutine in account during the parsing process
fixes the problem.
gdb/ChangeLog:
* dwarf2read.c (scan_partial_symbols, add_partial_symbol)
(add_partial_subprogram, load_partial_dies): Add
DW_TAG_inlined_subroutine handling.
gdb/testsuite/ChangeLog:
* gdb.ada/bp_inlined_func: New testcase.
Kuan-Lin Chen [Tue, 9 Jan 2018 08:04:58 +0000 (16:04 +0800)]
PR22662, nds32: Fix a typographical error.
Jim Wilson [Tue, 9 Jan 2018 01:55:29 +0000 (17:55 -0800)]
RISC-V: Fix accidental embedded -shared regressions.
ld/
* testsuite/ld-riscv-elf/c-lui.d: Don't use -shared. Check for _start
instead of .text.
* testsuite/ld-riscv-elf/c-lui.s: Add _start label.
* testsuite/ld-riscv-elf/ld-riscv-elf.exp: Before __global_pointer$
tests, add call to check_shared_lib_support.
GDB Administrator [Tue, 9 Jan 2018 00:00:33 +0000 (00:00 +0000)]
Automatic date update in version.in
Samuel Thibault [Mon, 8 Jan 2018 15:30:16 +0000 (10:30 -0500)]
hurd: Add enough auxv support for AT_ENTRY for PIE binaries
Add PIE support for hurd, by faking an AT_ENTRY auxv entry. That value
is expected to be read by svr4_exec_displacement, which will propagate
the executable displacement.
gdb/ChangeLog:
* gdb/gnu-nat.c: Include <elf.h> and <link.h>.
(gnu_xfer_auxv): New function.
(gnu_xfer_partial): Call gnu_xfer_auxv when `object' is
TARGET_OBJECT_AUXV.
H.J. Lu [Mon, 8 Jan 2018 12:36:59 +0000 (04:36 -0800)]
x86: Properly encode vmovd with 64-bit memeory
For historical reason, we allow movd/vmovd with 64-bit register and
memeory operands. But for vmovd, we failed to handle 64-bit memeory
operand. This has been gone unnoticed since AT&T syntax always treats
memory operand as 32-bit memory. This patch properly encodes vmovd
with 64-bit memeory operands. It also removes AVX512 vmovd with 64-bit
operands since GCC has
case TYPE_SSEMOV:
switch (get_attr_mode (insn))
{
case MODE_DI:
/* Handle broken assemblers that require movd instead of movq. */
if (!HAVE_AS_IX86_INTERUNIT_MOVQ
&& (GENERAL_REG_P (operands[0]) || GENERAL_REG_P (operands[1])))
return "%vmovd\t{%1, %0|%0, %1}";
return "%vmovq\t{%1, %0|%0, %1}";
and all AVX512 GNU assemblers set HAVE_AS_IX86_INTERUNIT_MOVQ, GCC won't
generate AVX512 vmovd with 64-bit operand.
gas/
PR gas/22681
* testsuite/gas/i386/i386.exp: Run x86-64-movd and
x86-64-movd-intel.
* testsuite/gas/i386/x86-64-movd-intel.d: New file.
* testsuite/gas/i386/x86-64-movd.d: Likewise.
* testsuite/gas/i386/x86-64-movd.s: Likewise.
opcodes/
PR gas/22681
* i386-opc.tbl: Properly encode vmovd with Qword memeory operand.
Remove AVX512 vmovd with 64-bit operands.
* i386-tbl.h: Regenerated.
Yao Qi [Mon, 8 Jan 2018 10:09:33 +0000 (10:09 +0000)]
Fix GDBserver build failure when $development is false
When we set bfd/development.sh:$development to false, GDBserver failed to
build,
selftest.o: In function `selftests::run_tests(char const*)':
binutils-gdb/gdb/gdbserver/../common/selftest.c:97:undefined reference to `selftests::reset()'
collect2: error: ld returned 1 exit status
selftest.o shouldn't be compiled and linked when $development is false.
With this patch, in release mode, GDBserver doesn't nothing with option
--selftest,
$ ./gdbserver --selftest=foo
Selftests are not available in a non-development build.
$ ./gdbserver --selftest
Selftests are not available in a non-development build.
gdb/gdbserver:
2018-01-08 Yao Qi <yao.qi@linaro.org>
Simon Marchi <simon.marchi@ericsson.com>
* Makefile.in (OBS): Remove selftest.o.
* configure.ac: Set srv_selftest_objs if $development is true.
(GDBSERVER_DEPFILES): Append $srv_selftest_objs.
* configure: Re-generated.
* server.c (captured_main): Wrap variable selftest_filter with
GDB_SELF_TEST.
gdb/testsuite:
2018-01-08 Simon Marchi <simon.marchi@ericsson.com>
* gdb.server/unittest.exp: Match the output in non-development
mode.
Yao Qi [Mon, 8 Jan 2018 10:09:32 +0000 (10:09 +0000)]
Fix GDB build failure when $development is false
We don't build GDB selftests bits when $development is false. However, if
we turn bfd/development.sh:$development to false, common/selftest.c is
compiled which is not expected. It causes the build failure,
selftest.o: In function `selftests::run_tests(char const*)':
binutils-gdb/gdb/common/selftest.c:97: undefined reference to `selftests::reset()'
collect2: error: ld returned 1 exit status
I fix this issue by putting selftest.o selftest-arch.o into CONFIG_OBS
only when $development is true. After this is fixed, there are other
build failures in maint.c, this patch fixes them as well.
In the release mode, the output of these commands are:
(gdb) maintenance selftest
Selftests are not available in a non-development build.
(gdb) maintenance selftest foo
Selftests are not available in a non-development build.
(gdb) maintenance info selftests
Selftests are not available in a non-development build.
gdb:
2018-01-08 Yao Qi <yao.qi@linaro.org>
Simon Marchi <simon.marchi@ericsson.com>
* Makefile.in (COMMON_SFILES): Remove selftest-arch.c and
common/selftest.c.
(COMMON_OBS): Remove selftest.o.
* configure.ac: Append selftest-arch.c and common/selftest.c to
CONFIG_SRCS. Append selftest-arch.o and selftest.o to COMMON_OBS.
* configure: Re-generated.
* maint.c (maintenance_selftest): Wrap selftests::run_tests with
GDB_SELF_TEST.
(maintenance_info_selftests): Likewise.
gdb/testsuite:
2018-01-08 Simon Marchi <simon.marchi@ericsson.com>
* gdb.gdb/unittest.exp: Match output in non-development mode.
Joel Brobecker [Mon, 8 Jan 2018 09:39:23 +0000 (04:39 -0500)]
Fix second-to-last gdb/testsuite/ChangeLog entry.
Joel Brobecker [Mon, 8 Jan 2018 09:26:52 +0000 (04:26 -0500)]
Relax expected output in gdb.ada/access_tagged_param.exp test
One of the tests in gdb.ada/access_tagged_param.exp verifies
the value of the parameters being printed by GDB when stopping
at a breakpoint inside procedure Pck.Inspect.
In particular, one of these parameters is actually generated
internally by the compiler, and does only indirectly depend
on the user-level code. A recent change in AdaCore's compiler
caused the code expansion to change a little bit, and as a result,
the value of that parameter has changed from 2 to 3. This can be
evindenced by looking at the code post expansion, using the -gnatDG
command-line switch to generate the .dg files:
$ gnatmake -g -gnatDG foo.adb
$ vi foo.adb.dg
We can see that the call to pck.inspect used to be:
pck__inspect (P8b, objL => 2);
With a recent version of GNAT Pro, it is now:
pck__inspect (P9b, objL => 3);
This change causes a spurious FAIL when running this testcase.
The objL parameter being, at heart, a simple counter of the nesting
level, this commit relaxes the expected output to accept any single-
digit number. We could accept any decimal, but given the example
program, I dout that number will reach double-digit level. If it
does, we'll double-check that this is normal, and relax the expected
output further.
gdb/testsuite/ChangeLog:
* gdb.ada/access_tagged_param.exp: Relax expected output
for value of "ObjL" in "continue" to pck.inspect breakpoint
test.
Tested on x86_64-linux.
Nick Clifton [Mon, 8 Jan 2018 09:29:17 +0000 (09:29 +0000)]
Add a description of the X86_64 assembler's .largcomm pseudo-op.
PR 22553
* doc/c-i386.texi (i386-Directives): Document the .largecomm
directive.
Xavier Roirand [Mon, 8 Jan 2018 04:56:36 +0000 (23:56 -0500)]
(Ada) Fix print of array using non-contiguous enumeration indexes
Consider the following code:
type Index is (Index1, Index2);
Size : constant Integer := 10;
for Index use (Index1 => 1, Index2 => Size);
type Array_Index_Enum is array (Index) of Integer;
my_table : Array_Index_Enum :=(others => 42);
When compiling the code above with a compiler where the GNAT encodings
are turned off (which can be temporarily emulated by using the compiler
switch -fgnat-encodings=minimal), printing this table in gdb leads to:
(gdb) p my_table
$1 = (42, 42, 4203344, 10, -8320, 32767, 4203465, 0, 0, 0)
The displayed content is wrong since the handling part believes
that the length of the array is max index value (10) minus the
first index value (1) i+ 1 = 10 which is wrong since index are not
contiguous in this case.
The right behavior is to detect that the array is using enumeration
index hence parse the enumeration values in order to get the number
of indexes in this array (2 indexes here).
This patch fixes this issue and changes the output as follow:
(gdb) p my_table
$1 = (42, 42)
gdb/ChangeLog:
* ada-valprint.c (val_print_packed_array_elements): Use
proper number of elements when printing an array indexed
by an enumeration type.
gdb/testsuite/ChangeLog (Joel Brobecker <brobecker@adacore.com>):
* gdb.ada/arr_enum_idx_w_gap.exp
* gdb.ada/arr_enum_idx_w_gap/foo_q418_043.adb
Tested on x86_64-linux.
GDB Administrator [Mon, 8 Jan 2018 00:00:33 +0000 (00:00 +0000)]
Automatic date update in version.in
Simon Marchi [Sun, 7 Jan 2018 16:22:46 +0000 (11:22 -0500)]
Remove dwarf2_cu::dwarf2_per_objfile
This patch removes the dwarf2_per_objfile field of dwarf2_cu. It is
redundant, since we can access dwarf2_per_objfile through
dwarf2_per_objfile, which is guaranteed to be set.
gdb/ChangeLog:
* dwarf2read.c (struct dwarf2_cu) <dwarf2_per_objfile>: Remove.
(dw2_get_file_names_reader): Adjust.
(lookup_dwo_signatured_type): Adjust.
(lookup_dwp_signatured_type): Adjust.
(lookup_signatured_type): Adjust.
(create_type_unit_group): Adjust.
(get_type_unit_group): Adjust.
(process_psymtab_comp_unit_reader): Adjust.
(build_type_psymtabs_reader): Adjust.
(scan_partial_symbols): Adjust.
(add_partial_symbol): Adjust.
(add_partial_subprogram): Adjust.
(peek_die_abbrev): Adjust.
(fixup_go_packaging): Adjust.
(process_imported_unit_die): Adjust.
(dwarf2_compute_name): Adjust.
(dwarf2_physname): Adjust.
(read_import_statement): Adjust.
(handle_DW_AT_stmt_list): Adjust.
(read_file_scope): Adjust.
(read_func_scope): Adjust.
(read_lexical_block_scope): Adjust.
(read_call_site_scope): Adjust.
(read_variable): Adjust.
(dwarf2_rnglists_process): Adjust.
(dwarf2_ranges_process): Adjust.
(dwarf2_ranges_read): Adjust.
(dwarf2_get_pc_bounds): Adjust.
(dwarf2_record_block_ranges): Adjust.
(dwarf2_add_field): Adjust.
(dwarf2_add_member_fn): Adjust.
(read_structure_type): Adjust.
(process_structure_scope): Adjust.
(read_enumeration_type): Adjust.
(read_array_type): Adjust.
(mark_common_block_symbol_computed): Adjust.
(read_common_block): Adjust.
(read_namespace_type): Adjust.
(read_namespace): Adjust.
(read_module_type): Adjust.
(read_tag_pointer_type): Adjust.
(read_tag_ptr_to_member_type): Adjust.
(read_tag_string_type): Adjust.
(read_subroutine_type): Adjust.
(read_typedef): Adjust.
(read_base_type): Adjust.
(attr_to_dynamic_prop): Adjust.
(read_subrange_type): Adjust.
(read_unspecified_type): Adjust.
(dwarf2_read_abbrevs): Adjust.
(load_partial_dies): Adjust.
(read_partial_die): Adjust.
(find_partial_die): Adjust.
(guess_partial_die_structure_name): Adjust.
(fixup_partial_die): Adjust.
(read_attribute_value): Adjust.
(read_addr_index): Adjust.
(read_addr_index_from_leb128): Adjust.
(read_str_index): Adjust.
(dwarf2_string_attr): Adjust.
(get_debug_line_section): Adjust.
(dwarf_decode_line_header): Adjust.
(lnp_state_machine::check_line_address): Adjust.
(dwarf_decode_lines_1): Adjust.
(dwarf_decode_lines): Adjust.
(dwarf2_start_symtab): Adjust.
(var_decode_location): Adjust.
(new_symbol_full): Adjust.
(dwarf2_const_value_data): Adjust.
(dwarf2_const_value_attr): Adjust.
(dwarf2_const_value): Adjust.
(die_type): Adjust.
(die_containing_type): Adjust.
(build_error_marker_type): Adjust.
(lookup_die_type): Adjust.
(guess_full_die_structure_name): Adjust.
(anonymous_struct_prefix): Adjust.
(determine_prefix): Adjust.
(dwarf2_name): Adjust.
(follow_die_ref_or_sig): Adjust.
(follow_die_offset): Adjust.
(follow_die_ref): Adjust.
(follow_die_sig_1): Adjust.
(follow_die_sig): Adjust.
(get_signatured_type): Adjust.
(get_DW_AT_signature_type): Adjust.
(decode_locdesc): Adjust.
(dwarf_decode_macros): Adjust.
(cu_debug_loc_section): Adjust.
(fill_in_loclist_baton): Adjust.
(dwarf2_symbol_mark_computed): Adjust.
(init_one_comp_unit): Don't assign
dwarf2_cu::dwarf2_per_objfile.
(set_die_type): Adjust.
Simon Marchi [Sun, 7 Jan 2018 16:22:46 +0000 (11:22 -0500)]
Remove dwarf2_per_objfile global
This patch removes the global variable dwarf2_per_objfile. This global
variable is set at the various entry points of dwarf2read.c (using
dw2_setup), and is referred to throughout the file. Instead of passing
data between functions in global variables like this one, it would be
better if the functions that depend on it either received it as argument
or got it from the existing arguments they receive. For example, a
function receiving a reference to a dwarf2_per_cu_data can access it
from dwarf2_per_cu_data::dwarf2_per_objfile.
This patch has been tested on the buildbot.
gdb/ChangeLog:
* dwarf2read.c (struct mapped_debug_names): Add constructor.
<dwarf2_per_objfile>: New field.
(dwarf2_per_objfile): Remove global.
(get_dwarf2_per_objfile): New function.
(set_dwarf2_per_objfile): New function.
(dwarf2_build_psymtabs_hard): Change objfile parameter to
dwarf2_per_objfile.
(abbrev_table_read_table): Add dwarf2_per_objfile parameter.
(read_abbrev_offset): Likewise.
(read_indirect_string): Likewise.
(read_indirect_line_string): Likewise.
(read_indirect_string_at_offset): Likewise.
(read_indirect_string_from_dwz): Likewise.
(dwarf2_find_containing_comp_unit): Change objfile parameter to
dwarf2_per_objfile.
(age_cached_comp_units): Add dwarf2_per_objfile parameter.
(create_all_comp_units): Change objfile parameter to
dwarf2_per_objfile.
(create_all_type_units): Likewise.
(process_queue): Add dwarf2_per_objfile parameter.
(read_and_check_comp_unit_head): Likewise.
(lookup_dwo_unit_in_dwp): Likewise.
(get_dwp_file): Likewise.
(process_cu_includes): Likewise.
(struct free_dwo_file_cleanup_data): New struct.
(dwarf2_has_info): Use get_dwarf2_per_objfile and
set_dwarf2_per_objfile.
(dwarf2_get_dwz_file): Add dwarf2_per_objfile parameter.
(dw2_do_instantiate_symtab): Get dwarf2_per_objfile from
context, adjust calls.
(dw2_instantiate_symtab): Likewise.
(dw2_get_cutu): Add dwarf2_per_objfile parameter.
(dw2_get_cu): Likewise.
(create_cu_from_index_list): Change objfile parameter to
dwarf2_per_objfile.
(create_cus_from_index_list): Get dwarf2_per_objfile from
context, adjust calls.
(create_cus_from_index): Likewise.
(create_signatured_type_table_from_index): Change objfile
parameter to dwarf2_per_objfile.
(create_signatured_type_table_from_debug_names): Change objfile
parameter to dwarf2_per_objfile.
(create_addrmap_from_index): Likewise.
(create_addrmap_from_aranges): Likewise.
(dwarf2_read_index): Use get_dwarf2_per_objfile, adjust calls.
(dw2_setup): Remove.
(dw2_get_file_names_reader): Get dwarf2_per_objfile from
context.
(dw2_find_last_source_symtab): Get dwarf2_per_objfile using
get_dwarf2_per_objfile.
(dw2_forget_cached_source_info): Likewise.
(dw2_map_symtabs_matching_filename): Likewise.
(struct dw2_symtab_iterator) <index>: Remove.
<dwarf2_per_objfile>: New field.
(dw2_symtab_iter_init): Replace index parameter with
dwarf2_per_objfile.
(dw2_symtab_iter_next): Use dwarf2_per_objfile from iter.
(dw2_lookup_symbol): Use get_dwarf2_per_objfile and adjust.
(dw2_print_stats): Likewise.
(dw2_dump): Likewise.
(dw2_expand_symtabs_for_function): Likewise.
(dw2_expand_all_symtabs): Likewise.
(dw2_expand_symtabs_with_fullname): Likewise.
(dw2_expand_marked_cus): Replace index and objfile parameters
with dwarf2_per_objfile.
(dw_expand_symtabs_matching_file_matcher): Add
dwarf2_per_objfile parameter and adjust calls.
(dw2_expand_symtabs_matching): Use get_dwarf2_per_objfile and
adjust calls.
(dw2_find_pc_sect_compunit_symtab): Don't call dw2_setup.
(dw2_map_symbol_filenames): Use get_dwarf2_per_objfile and
adjust calls.
(create_cus_from_debug_names_list): Replace objfile parameter
with dwarf2_per_objfile and adjust calls.
(create_cus_from_debug_names): Likewise.
(dwarf2_read_debug_names): Likewise.
(mapped_debug_names::namei_to_name): Adjust call.
(dw2_debug_names_iterator::next): Likewise.
(dw2_debug_names_iterator::find_vec_in_debug_names): Likewise.
(dw2_debug_names_lookup_symbol): Use get_dwarf2_per_objfile.
(dw2_debug_names_dump): Likewise.
(dw2_debug_names_expand_symtabs_for_function): Likewise.
(dw2_debug_names_expand_symtabs_matching): Likewise.
(dwarf2_initialize_objfile): Likewise.
(dwarf2_build_psymtabs): Likewise.
(get_abbrev_section_for_cu): Get dwarf2_per_objfile from
this_cu.
(error_check_comp_unit_head): Add dwarf2_per_objfile parameter.
(read_and_check_comp_unit_head): Likewise.
(read_abbrev_offset): Likewise.
(create_debug_type_hash_table): Likewise.
(create_debug_types_hash_table): Likewise.
(create_all_type_units): Replace objfile parameter with
dwarf2_per_objfile.
(add_type_unit): Add dwarf2_per_objfile parameter.
(fill_in_sig_entry_from_dwo_entry): Replace objfile parameter
with dwarf2_per_objfile.
(lookup_dwo_signatured_type): Get dwarf2_per_objfile from cu.
(lookup_dwp_signatured_type): Likewise.
(lookup_signatured_type): Likewise.
(read_cutu_die_from_dwo): Likewise.
(init_tu_and_read_dwo_dies): Likewise.
(init_cutu_and_read_dies): Likewise.
(init_cutu_and_read_dies_no_follow): Likewise.
(allocate_type_unit_groups_table): Add objfile parameter.
(create_type_unit_group): Use dwarf2_per_objfile from cu.
(get_type_unit_group): Likewise.
(process_psymtab_comp_unit): Update call.
(build_type_psymtabs_reader): Use dwarf2_per_objfile from cu.
(build_type_psymtabs_1): Add dwarf2_per_objfile parameter.
(print_tu_stats): Likewise.
(build_type_psymtab_dependencies): Use dwarf2_per_objfile passed
in void* parameter.
(build_type_psymtabs): Change objfile parameter to
dwarf2_per_objfile.
(process_skeletonless_type_unit): Use dwarf2_per_objfile
passed in void* parameter.
(process_skeletonless_type_units): Change objfile parameter to
dwarf2_per_objfile.
(set_partial_user): Likewise.
(dwarf2_build_psymtabs_hard): Likewise.
(read_comp_units_from_section): Likewise.
(create_all_comp_units): Likewise.
(scan_partial_symbols): Update calls.
(add_partial_symbol): Likewise.
(dwarf2_read_symtab): Use get_dwarf2_per_objfile.
(maybe_queue_comp_unit): Use dwarf2_read_symtab from cu.
(process_queue): Add dwarf2_per_objfile parameter.
(get_compunit_symtab): Use dwarf2_per_objfile from cu.
(compute_compunit_symtab_includes): Likewise.
(process_cu_includes): Add dwarf2_per_objfile parameter.
(process_full_comp_unit): Use dwarf2_per_objfile from cu.
(process_full_type_unit): Likewise.
(process_imported_unit_die): Update call.
(handle_DW_AT_stmt_list): Use dwarf2_per_objfile from cu.
(read_file_scope): Likewise.
(allocate_dwo_file_hash_table): Add objfile parameter.
(lookup_dwo_file_slot): Add dwarf2_per_objfile parameter.
(create_cus_hash_table): Likewise.
(create_dwp_hash_table): Likewise.
(create_dwo_unit_in_dwp_v1): Likewise.
(create_dwp_v2_section): Likewise.
(create_dwo_unit_in_dwp_v2): Likewise.
(lookup_dwo_unit_in_dwp): Likewise.
(try_open_dwop_file): Likewise.
(open_dwo_file): Likewise. Use dwarf2_per_objfile from cu.
(open_and_init_dwo_file): Use dwarf2_per_objfile from cu, update
cleanup to include a reference to dwarf2_per_objfile.
(open_dwp_file): Add dwarf2_per_objfile parameter.
(open_and_init_dwp_file): Likewise.
(get_dwp_file): Likewise.
(lookup_dwo_cutu): Use dwarf2_per_objfile from cu.
(queue_and_load_all_dwo_tus): Update call.
(free_dwo_file_cleanup): Use dwarf2_per_objfile from cleanup
data.
(dwarf2_rnglists_process): Use dwarf2_per_objfile from cu.
(dwarf2_ranges_process): Likewise.
(dwarf2_get_pc_bounds): Likewise.
(mark_common_block_symbol_computed): Likewise.
(abbrev_table_read_table): Add dwarf2_per_objfile parameter.
(dwarf2_read_abbrevs): Update call.
(read_partial_die): Use dwarf2_per_objfile from cu.
(find_partial_die): Likewise.
(fixup_partial_die): Likewise.
(read_attribute_value): Likewise.
(read_indirect_string_at_offset_from): Add objfile parameter.
(read_indirect_string_at_offset): Add dwarf2_per_objfile
parameter.
(read_indirect_string_from_dwz): Add objfile parameter.
(read_indirect_string): Add objfile parameter.
(read_addr_index_1): Add dwarf2_per_objfile parameter.
(read_addr_index): Use dwarf2_per_objfile from cu.
(dwarf2_read_addr_index): Use dwarf2_per_objfile from cu, don't
call dw2_setup.
(read_str_index): Use dwarf2_per_objfile from cu.
(get_debug_line_section): Likewise.
(read_formatted_entries): Add dwarf2_per_objfile parameter.
(dwarf_decode_line_header): Use dwarf2_per_objfile from cu.
(new_symbol_full): Use dwarf2_per_objfile from cu.
(build_error_marker_type): Likewise.
(lookup_die_type): Likewise.
(determine_prefix): Likewise.
(follow_die_offset): Likewise.
(dwarf2_fetch_die_loc_sect_off): Use get_dwarf2_per_objfile.
(dwarf2_fetch_constant_bytes): Don't call dw2_setup.
(dwarf2_fetch_die_type_sect_off): Likewise.
(dwarf2_get_die_type): Likewise.
(follow_die_sig_1): Use dwarf2_per_objfile from cu.
(get_signatured_type): Likewise.
(get_DW_AT_signature_type): Likewise.
(dwarf_decode_macro_bytes): Add dwarf2_per_objfile parameter.
(dwarf_decode_macros): Use dwarf2_per_objfile from cu.
(cu_debug_loc_section): Likewise.
(fill_in_loclist_baton): Likewise.
(dwarf2_symbol_mark_computed): Likewise.
(dwarf2_find_containing_comp_unit): Change objfile parameter to
dwarf2_per_objfile.
(free_cached_comp_units): Use dwarf2_per_objfile passed in void*
parameter.
(age_cached_comp_units): Add dwarf2_per_objfile parameter.
(free_one_cached_comp_unit): Use dwarf2_per_objfile from cu.
(dwarf2_free_objfile): Use get_dwarf2_per_objfile.
(set_die_type): Use dwarf2_free_objfile from cu.
(get_die_type_at_offset): Likewise.
(dwarf2_per_objfile_free): Don't assign global variable.
(debug_names) <constructor>: Add dwarf2_per_objfile
parameter, update m_debugstrlookup construction.
(debug_names::debug_str_lookup): Add dwarf2_per_objfile
parameter.
<m_dwarf2_per_objfile>: New field.
<lookup>: Use m_dwarf2_per_objfile.
(check_dwarf64_offsets): Add dwarf2_per_objfile parameter.
(psyms_seen_size): Likewise.
(write_gdbindex): Replace objfile parameter with
dwarf2_per_objfile.
(write_debug_names): Likewise.
(write_psymtabs_to_index): Likewise.
(save_gdb_index_command): Use get_dwarf2_per_objfile, update
calls.
Simon Marchi [Sun, 7 Jan 2018 16:22:45 +0000 (11:22 -0500)]
Replace objfile field in dwarf2_cu and dwarf2_per_cu_data with dwarf2_per_objfile
The next patch aims to remove the dwarf2_per_objfile global. In many
functions, we need to find a way to get a reference to the current
dwarf2_per_objfile through the objects passed in parameters. Often, we have
access to a dwarf2_cu or a dwarf2_per_cu_data. These objects have a reference
to the objfile, through which we can get the dwarf2_per_objfile:
dwarf2_per_objfile = ((struct dwarf2_per_objfile *)
objfile_data (objfile, dwarf2_objfile_data_key));
However, this is a bit cumbersome to do all over the place. It would be
more logical if the dwarf2_cu and dwarf2_per_cu_data had a reference to
their dwarf2_per_objfile, which would then have a reference to the
objfile. It would be more in line with the object hierarchy, where
dwarf2_per_objfile owns the dwarf2_per_cu_data instances. We could
even remove the reference dwarf2_cu has to dwarf2_per_objfile, since we
can access dwarf2_per_objfile through dwarf2_cu::per_cu.
In a graphical way, references would look like this after the current
patch:
objfile <--- dwarf2_per_objfile <--- dwarf2_per_cu_data
| ^
| |
`- dwarf2_cu
This patch has been tested on the buildbot.
gdb/ChangeLog:
* dwarf2read.c (struct dwarf2_cu) <objfile>: Remove.
<dwarf2_per_objfile>: New field.
(struct dwarf2_per_cu_data) <objfile>: Remove.
<dwarf2_per_objfile>: New field.
(create_cu_from_index_list): Assign dwarf2_per_objfile instead
of objfile.
(create_signatured_type_table_from_index): Likewise.
(create_debug_type_hash_table): Likewise.
(fill_in_sig_entry_from_dwo_entry): Likewise.
(lookup_dwo_unit): Access objfile through dwarf2_per_objfile.
(create_type_unit_group): Assign dwarf2_per_objfile instead of
objfile.
(create_partial_symtab): Access objfile through
dwarf2_per_objfile.
(process_psymtab_comp_unit_reader): Likewise.
(read_comp_units_from_section): Likewise.
(scan_partial_symbols): Likewise.
(add_partial_symbol): Likewise.
(add_partial_subprogram): Likewise.
(peek_die_abbrev): Likewise.
(fixup_go_packaging): Likewise.
(process_full_comp_unit): Likewise.
(process_full_type_unit): Likewise.
(process_imported_unit_die): Likewise.
(dwarf2_compute_name): Likewise.
(dwarf2_physname): Likewise.
(read_import_statement): Likewise.
(create_cus_hash_table): Assign dwarf2_physname instead of
objfile.
(read_func_scope): Access objfile through dwarf2_per_objfile.
(read_lexical_block_scope): Likewise.
(read_call_site_scope): Likewise.
(read_variable): Likewise.
(dwarf2_rnglists_process): Likewise.
(dwarf2_ranges_process): Likewise.
(dwarf2_ranges_read): Likewise.
(dwarf2_record_block_ranges): Likewise.
(dwarf2_add_field): Likewise.
(dwarf2_add_member_fn): Likewise.
(read_structure_type): Likewise.
(process_structure_scope): Likewise.
(read_enumeration_type): Likewise.
(read_array_type): Likewise.
(read_common_block): Likewise.
(read_namespace_type): Likewise.
(read_namespace): Likewise.
(read_module_type): Likewise.
(read_tag_pointer_type): Likewise.
(read_tag_ptr_to_member_type): Likewise.
(read_tag_string_type): Likewise.
(read_subroutine_type): Likewise.
(read_typedef): Likewise.
(read_base_type): Likewise.
(attr_to_dynamic_prop): Likewise.
(read_subrange_type): Likewise.
(read_unspecified_type): Likewise.
(load_partial_dies): Likewise.
(read_partial_die): Likewise.
(find_partial_die): Likewise.
(guess_partial_die_structure_name): Likewise.
(fixup_partial_die): Likewise.
(read_attribute_value): Likewise.
(read_addr_index_from_leb128): Likewise.
(dwarf2_read_addr_index): Likewise.
(dwarf2_string_attr): Likewise.
(lnp_state_machine::check_line_address): Likewise.
(dwarf_decode_lines_1): Likewise.
(dwarf_decode_lines): Likewise.
(dwarf2_start_symtab): Likewise.
(var_decode_location): Likewise.
(new_symbol_full): Likewise.
(dwarf2_const_value_data): Likewise.
(dwarf2_const_value_attr): Likewise.
(dwarf2_const_value): Likewise.
(die_type): Likewise.
(die_containing_type): Likewise.
(lookup_die_type): Likewise.
(guess_full_die_structure_name): Likewise.
(anonymous_struct_prefix): Likewise.
(dwarf2_name): Likewise.
(follow_die_ref_or_sig): Likewise.
(follow_die_offset): Likewise.
(follow_die_ref): Likewise.
(dwarf2_fetch_die_loc_sect_off): Likewise.
(dwarf2_fetch_constant_bytes): Likewise.
(dwarf2_fetch_die_type_sect_off): Likewise.
(dwarf2_get_die_type): Likewise.
(follow_die_sig): Likewise.
(decode_locdesc): Likewise.
(dwarf2_per_cu_objfile): Likewise.
(dwarf2_per_cu_text_offset): Likewise.
(init_one_comp_unit): Assign dwarf2_per_objfile instead of
objfile.
(set_die_type): Access objfile through
dwarf2_per_objfile.
Simon Marchi [Sun, 7 Jan 2018 15:50:48 +0000 (10:50 -0500)]
Make parse_debug_format_options return an std::string
This avoid having to manually free the return value.
gdb/gdbserver/ChangeLog:
* server.c (parse_debug_format_options): Return std::string.
(handle_monitor_command, captured_main): Adjust.
Simon Marchi [Sun, 7 Jan 2018 15:48:21 +0000 (10:48 -0500)]
Replace VEC(converted_character_d) with std::vector
This patch changes the usage of VEC(converted_character_d) to use an
std::vector instead. This allows getting rid of a cleanup.
gdb/ChangeLog:
* valprint.c (converted_character_d): Remove typedef.
(DEF_VEC_O (converted_character_d)): Remove.
(count_next_character): Use std::vector.
(print_converted_chars_to_obstack): Likewise.
(generic_printstr): Likewise.
Simon Marchi [Sun, 7 Jan 2018 14:29:52 +0000 (09:29 -0500)]
Replace VEC(gdb_xml_value_s) with std::vector
This patch replaces VEC(gdb_xml_value_s), which is passed to XML
visitors, with an std::vector. In order to be able to remove the
cleanup in gdb_xml_parser::start_element, the gdb_xml_parser structure
is made to own the value with a gdb::unique_xmalloc_ptr.
This patch has been tested on the buildbot.
gdb/ChangeLog:
* xml-support.h (struct gdb_xml_value): Add constructor.
<value>: Change type to unique_xmalloc_ptr.
(gdb_xml_value_s): Remove typedef.
(DEF_VEC_O (gdb_xml_value_s)): Remove.
(gdb_xml_element_start_handler): Change parameter type to
std::vector.
(xml_find_attribute): Likewise.
* xml-support.c (xml_find_attribute): Change parameter type to
std::vector and adjust.
(gdb_xml_values_cleanup): Remove.
(gdb_xml_parser::start_element): Adjust to std::vector.
(xinclude_start_include): Change paraeter type to std::vector
and adjust.
* btrace.c (check_xml_btrace_version): Likewise.
(parse_xml_btrace_block): Likewise.
(parse_xml_btrace_pt_config_cpu): Likewise.
(parse_xml_btrace_pt): Likewise.
(parse_xml_btrace_conf_bts): Likewise.
(parse_xml_btrace_conf_pt): Likewise.
* memory-map.c (memory_map_start_memory): Likewise.
(memory_map_start_property): Likewise.
* osdata.c (osdata_start_osdata): Likewise.
(osdata_start_item): Likewise.
(osdata_start_column): Likewise.
* remote.c (start_thread): Likewise.
* solib-aix.c (library_list_start_library): Likewise.
(library_list_start_list): Likewise.
* solib-svr4.c (library_list_start_library): Likewise.
(svr4_library_list_start_list): Likewise.
* solib-target.c (library_list_start_segment): Likewise.
(library_list_start_section): Likewise.
(library_list_start_library): Likewise.
(library_list_start_list): Likewise.
* tracepoint.c (traceframe_info_start_memory): Likewise.
(traceframe_info_start_tvar): Likewise.
* xml-syscall.c (syscall_start_syscall): Likewise.
* xml-tdesc.c (tdesc_start_target): Likewise.
(tdesc_start_feature): Likewise.
(tdesc_start_reg): Likewise.
(tdesc_start_union): Likewise.
(tdesc_start_struct): Likewise.
(tdesc_start_flags): Likewise.
(tdesc_start_enum): Likewise.
(tdesc_start_field): Likewise.
(tdesc_start_enum_value): Likewise.
(tdesc_start_vector): Likewise.
Simon Marchi [Sun, 7 Jan 2018 14:25:33 +0000 (09:25 -0500)]
Remove xmethod_worker::clone
I think that the clone method of xmethod_worker can be removed. It is
only used in find_overload_match, to clone an xmethod we want to
keep. Instead, we can just std::move it out of the vector and into
value_from_xmethod. value_from_xmethod creates a value that will own
the xmethod_worker from that point. Other xmethod_workers left in the
vector will get destroyed when the vector gets destroyed, but the chosen
one will keep living inside the value struct.
gdb/ChangeLog:
* extension.h (struct xmethod_worker) <clone>: Remove.
* python/py-xmethods.c (struct python_xmethod_worker) <clone>:
Remove.
(python_xmethod_worker::clone): Remove.
* valops.c (find_overload_match): Use std::move instead of
clone.
Simon Marchi [Sun, 7 Jan 2018 14:25:32 +0000 (09:25 -0500)]
C++ify xmethod_worker, get rid of VEC(xmethod_worker_ptr)
The initial goal of this patch was to remove the usage of
VEC(xmethod_worker_ptr) and corresponding cleanups. I ended up having
to C++ify the xmethod_worker code, to be able to have xmethod_workers
free their data in destructors, and therefore be able to use vectors of
xmethod_worker unique_ptr.
The operations in extension_language_ops that act on one instance of
xmethod_worker (get result type, get args type, invoke) are transformed
to methods of xmethod_worker. xmethod_worker becomes an abstract base
class with virtual pure methods which python_xmethod_worker implements.
The only xmethod-related operation left in extension_language_ops is
get_matching_xmethod_workers, which returns a list of xmethod_workers.
The changes are relatively straightforward, but here are some notes on
things that may raise eyebrows:
- I was not really comfortable with the value_of_xmethod function. At
first it looks like a simple getter, so I considered making it a
method of xmethod_worker. But actually it creates a value and
transfers the ownership of the xmethod_worker to it. It would be a
bit weird and error-prone if calling a method on an object silently
removed the ownership of the object from the caller. To reflect the
behavior more accurately, I renamed it to value_from_xmethod and made
it accept an rvalue-reference (so the caller knows it gives away the
ownership). I noticed the backlink from xmethod_worker to its owning
value was not used, so I removed it.
- Some code, like get_matching_xmethod_workers, made each callee fill
a new vector, which was then merged in the result vector. I think
it's safe if we always pass the same vector around, and each
implementation just appends to it.
- The clone operation does not seem particularly useful, it is removed
in the following patch.
gdb/ChangeLog:
* extension-priv.h (enum ext_lang_rc): Remove, move to extension.h.
(struct extension_language_ops) <clone_xmethod_worker_data>: Remove.
<free_xmethod_worker_data>: Remove.
<get_matching_xmethod_workers>: Chance VEC to std::vector.
<get_xmethod_arg_types>: Remove.
<get_xmethod_result_type>: Remove.
<invoke_xmethod>: Remove.
* extension.c (new_xmethod_worker): Remove.
(clone_xmethod_worker): Remove.
(get_matching_xmethod_workers): Return void, pass std::vector by
pointer.
(get_xmethod_arg_types): Rename to...
(xmethod_worker::get_arg_types): ... this, and adjust.
(get_xmethod_result_type): Rename to...
(xmethod_worker::get_result_type): ... this, and adjust.
(invoke_xmethod): Remove.
(free_xmethod_worker): Remove.
(free_xmethod_worker_vec): Remove.
* extension.h (enum ext_lang_rc): Move here from
extension-priv.h.
(struct xmethod_worker): Add constructor and destructor.
<data>: Remove.
<value>: Remove.
<invoke, clone, do_get_result_type, do_get_arg_types>: New
virtual pure methods.
<get_arg_types, get_result_type>: New methods.
(xmethod_worker_ptr): Remove typedef.
(DEF_VEC_P (xmethod_worker_ptr)): Remove.
(xmethod_worker_vec): Remove typedef.
(xmethod_worker_up): New typedef.
(invoke_xmethod): Remove.
(clone_xmethod_worker): Remove.
(free_xmethod_worker): Remove.
(free_xmethod_worker_vec): Remove.
(get_xmethod_arg_types): Remove.
(get_xmethod_result_type): Remove.
* valops.c (find_method_list): Use std::vector, don't use
intermediate vector.
(value_find_oload_method_list): Use std::vector.
(find_overload_match): Use std::vector.
(find_oload_champ): Use std::vector.
* value.c (value_free): Use operator delete.
(value_of_xmethod): Rename to...
(value_from_xmethod): ... this. Don't assign
xmethod_worker::value, take rvalue-reference.
(result_type_of_xmethod): Adjust.
(call_xmethod): Adjust.
* value.h: Include extension.h.
(struct xmethod_worker): Don't forward-declare.
(value_of_xmethod): Rename to...
(value_from_xmethod): ... this, take rvalue-reference.
* python/py-xmethods.c (struct gdbpy_worker_data): Rename to...
(struct python_xmethod_worker): ... this, add constructor and
destructor.
<invoke, clone, do_get_arg_types, do_get_result_type>: Implement.
(gdbpy_free_xmethod_worker_data): Rename to...
(python_xmethod_worker::~python_xmethod_worker): ... this and
adjust.
(gdbpy_clone_xmethod_worker_data): Rename to...
(python_xmethod_worker::clone): ... this and adjust.
(gdbpy_get_matching_xmethod_workers): Use std::vector, don't use
temporary vector.
(gdbpy_get_xmethod_arg_types): Rename to...
(python_xmethod_worker::do_get_arg_types): ... this and adjust.
(gdbpy_get_xmethod_result_type): Rename to...
(python_xmethod_worker::do_get_result_type): ... this and
adjust.
(gdbpy_invoke_xmethod): Rename to...
(python_xmethod_worker::invoke): ... this and adjust.
(new_python_xmethod_worker): Rename to...
(python_xmethod_worker::python_xmethod_worker): ... this and
adjust.
* python/python-internal.h (gdbpy_clone_xmethod_worker_data):
Remove.
(gdbpy_free_xmethod_worker_data): Remove.
(gdbpy_get_matching_xmethod_workers): Use std::vector.
(gdbpy_get_xmethod_arg_types): Remove.
(gdbpy_get_xmethod_result_type): Remove.
(gdbpy_invoke_xmethod): Remove.
* python/python.c (python_extension_ops): Remove obsolete
callbacks.
GDB Administrator [Sun, 7 Jan 2018 00:00:33 +0000 (00:00 +0000)]
Automatic date update in version.in
Jim Wilson [Sat, 6 Jan 2018 01:51:23 +0000 (17:51 -0800)]
RISC-V: Print symbol address for jalr w/ zero offset.
ld/
* testsuite/ld-riscv-elf/disas-jalr.d: New.
* testsuite/ld-riscv-elf/disas-jalr.s: New.
* testsuite/ld-riscv-elf/ld-riscv-elf.exp: Run new testcase.
opcodes/
* riscv-dis.c (print_insn_args) <'s'>: Call maybe_print_address for a
jalr.
GDB Administrator [Sat, 6 Jan 2018 00:00:28 +0000 (00:00 +0000)]
Automatic date update in version.in
Jim Wilson [Fri, 5 Jan 2018 22:29:49 +0000 (14:29 -0800)]
RISC-V: Disable shared library support for embedded elf.
ld/
* emulparams/elf32lriscv-defs.sh (GENERATE_SHLIB_SCRIPT): Move inside
case on $target, and don't set for riscv*-elf targets.
(GENERATE_PIE_SCRIPT): Likewise.
Pedro Alves [Fri, 5 Jan 2018 18:26:18 +0000 (18:26 +0000)]
Fix regression: cannot start with LD_PRELOAD=libSegFault.so (PR gdb/18653#c7)
At https://sourceware.org/bugzilla/show_bug.cgi?id=18653#c7, Andrew
reports that the fix for PR gdb/18653 made GDB useless if you preload
libSegFault.so, because GDB internal-errors on startup:
$ LD_PRELOAD=libSegFault.so gdb
src/gdb/common/signals-state-save-restore.c:64: internal-error: unexpected signal handler
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Aborted (core dumped)
$
The internal error comes from the code saving the signal dispositions
inherited from gdb's parent:
(top-gdb) bt
#0 0x000000000056b001 in internal_error(char const*, int, char const*, ...) (file=0xaf5f38 "src/gdb/common/signals-state-save-restore.c", line=64, fmt=0xaf5f18 "unexpected signal handler") at src/gdb/common/errors.c:54
#1 0x00000000005752c9 in save_original_signals_state() () at src/gdb/common/signals-state-save-restore.c:64
#2 0x00000000007425de in captured_main_1(captured_main_args*) (context=0x7fffffffd860)
at src/gdb/main.c:509
#3 0x0000000000743622 in captured_main(void*) (data=0x7fffffffd860) at src/gdb/main.c:1145
During symbol reading, cannot get low and high bounds for subprogram DIE at 24065.
#4 0x00000000007436f9 in gdb_main(captured_main_args*) (args=0x7fffffffd860) at src/gdb/main.c:1171
#5 0x0000000000413acd in main(int, char**) (argc=1, argv=0x7fffffffd968) at src/gdb/gdb.c:32
This commit downgrades the internal error to a warning. You'll get
instead:
~~~
$ LD_PRELOAD=libSegFault.so gdb
warning: Found custom handler for signal 11 (Segmentation fault) preinstalled.
Some signal dispositions inherited from the environment (SIG_DFL/SIG_IGN)
won't be propagated to spawned programs.
GNU gdb (GDB) 8.0.50.
20171213-git
Copyright (C) 2017 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
(gdb)
~~~
This also moves the location where save_original_signals_state is
called a bit further below (to after option processing), so that "-q"
disables the warning:
~~~
$ LD_PRELOAD=libSegFault.so gdb -q
(gdb)
~~~
New testcase included.
gdb/ChangeLog:
2018-01-05 Pedro Alves <palves@redhat.com>
PR gdb/18653
* common/signals-state-save-restore.c
(save_original_signals_state): New parameter 'quiet'. Warn if we
find a custom handler preinstalled, instead of internal erroring.
But only warn if !quiet.
* common/signals-state-save-restore.h
(save_original_signals_state): New parameter 'quiet'.
* main.c (captured_main_1): Move save_original_signals_state call
after option handling, and pass QUIET.
gdb/gdbserver/ChangeLog:
2018-01-05 Pedro Alves <palves@redhat.com>
PR gdb/18653
* server.c (captured_main): Pass quiet=false to
save_original_signals_state.
gdb/testsuite/ChangeLog:
2018-01-05 Pedro Alves <palves@redhat.com>
PR gdb/18653
* gdb.base/libsegfault.exp: New.
Pedro Alves [Fri, 5 Jan 2018 17:56:33 +0000 (17:56 +0000)]
Fix gdb/spu-tdep.c build breakage
Commit
de63c46b549d ("Fix regresssion(internal-error) printing
subprogram argument (PR gdb/22670)") missed updating spu-tdep.c for
the block_lookup_symbol interface change, resulting in:
../../binutils-gdb/gdb/spu-tdep.c: In function void spu_catch_start(objfile*):
../../binutils-gdb/gdb/spu-tdep.c:1969:59: error: cannot convert domain_enum_tag to symbol_name_match_type for argument 3 to symbol* block_lookup_symbol(const block*, const char*, symbol_name_match_type, domain_enum)
sym = block_lookup_symbol (block, "main", VAR_DOMAIN);
^
gdb/ChangeLog:
2018-01-05 Pedro Alves <palves@redhat.com>
* spu-tdep.c (spu_catch_start): Pass
symbol_name_match_type::SEARCH_NAME to block_lookup_symbol.
Pedro Alves [Fri, 5 Jan 2018 14:04:09 +0000 (14:04 +0000)]
Fix regresssion(internal-error) printing subprogram argument (PR gdb/22670)
At <https://sourceware.org/ml/gdb-patches/2017-12/msg00298.html>, Joel
wrote:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Consider the following code which first declares a tagged type (the
equivalent of a class in Ada), and then a procedure which takes a
pointer (access) to this type's 'Class.
package Pck is
type Top_T is tagged record
N : Integer := 1;
end record;
procedure Inspect (Obj: access Top_T'Class);
end Pck;
Putting a breakpoint in that procedure and then running to it triggers
an internal error:
(gdb) break inspect
(gdb) continue
Breakpoint 1, pck.inspect (obj=0x63e010
/[...]/gdb/stack.c:621: internal-error: void print_frame_args(symbol*, frame_info*, int, ui_file*): Assertion `nsym != NULL' failed.
What's special about this subprogram is that it takes an access to
what we call a 'Class type, and for implementation reasons, the
compiler adds an extra argument named "objL". If you are curious why,
it allows the compiler for perform dynamic accessibility checks that
are mandated by the language.
If we look at the location where we get the internal error (in
stack.c), we find that we are looping over the symbol of each
parameter, and for each parameter, we do:
/* We have to look up the symbol because arguments can have
two entries (one a parameter, one a local) and the one we
want is the local, which lookup_symbol will find for us.
[...]
nsym = lookup_symbol (SYMBOL_LINKAGE_NAME (sym),
b, VAR_DOMAIN, NULL).symbol;
gdb_assert (nsym != NULL);
The lookup_symbol goes through the lookup structure, which means the
symbol's linkage name ("objL") gets transformed into a
lookup_name_info object (in block_lookup_symbol), before it gets fed
to the block symbol dictionary iterators. This, in turn, triggers the
symbol matching by comparing the "lookup" name which, for Ada, means
among other things, lowercasing the given name to "objl". It is this
transformation that causes the lookup find no matches, and therefore
trip this assertion.
Going back to the "offending" call to lookup_symbol in stack.c, what
we are trying to do, here, is do a lookup by linkage name. So, I
think what we mean to be doing is a completely literal symbol lookup,
so maybe not even strcmp_iw, but actually just plain strcmp???
In the past, in practice, you could get that effect by doing a lookup
using the C language. But that doesn't work, because we still end up
somehow using Ada's lookup_name routine which transforms "objL".
So, ideally, as I hinted before, I think what we need is a way to
perform a literal lookup so that searches by linkage names like the
above can be performed.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This commit fixes the problem by implementing something similar to
Joel's literal idea, but with some important differences.
I considered adding a symbol_name_match_type::LINKAGE and supporting
searching by linkage name for any language, but the problem with that
is that the dictionaries only work with SYMBOL_SEARCH_NAME, because
that's what is used for hashing. We'd need separate dictionaries for
hashed linkage names.
So with the current symbol tables infrastructure, it's not literal
linkage names that we want to pass down, but instead literal _search_
names (SYMBOL_SEARCH_NAME, etc.).
However, psymbols have no overload/function parameter info in C++, so
a straight strcmp doesn't work properly for C++ name matching.
So what we do is be a little less aggressive then and add a new
symbol_name_match_type::SEARCH_SYMBOL instead that takes as input a
non-user-input search symbol, and then we skip any decoding/demangling
steps and make:
- Ada treat that as a verbatim match,
- other languages treat it as symbol_name_match_type::FULL.
This also fixes the new '"maint check-psymtabs" for Ada' testcase for
me (gdb.ada/maint_with_ada.exp). I've not removed the kfail yet
because Joel still sees that testcase failing with this patch.
That'll be fixed in follow up patches.
gdb/ChangeLog:
2018-01-05 Pedro Alves <palves@redhat.com>
PR gdb/22670
* ada-lang.c (literal_symbol_name_matcher): New function.
(ada_get_symbol_name_matcher): Use it for
symbol_name_match_type::SEARCH_NAME.
* block.c (block_lookup_symbol): New parameter 'match_type'. Pass
it down instead of assuming symbol_name_match_type::FULL.
* block.h (block_lookup_symbol): New parameter 'match_type'.
* c-valprint.c (print_unpacked_pointer): Use
lookup_symbol_search_name instead of lookup_symbol.
* compile/compile-object-load.c (get_out_value_type): Pass down
symbol_name_match_type::SEARCH_NAME.
* cp-namespace.c (cp_basic_lookup_symbol): Pass down
symbol_name_match_type::FULL.
* cp-support.c (cp_get_symbol_name_matcher): Handle
symbol_name_match_type::SEARCH_NAME.
* infrun.c (insert_exception_resume_breakpoint): Use
lookup_symbol_search_name.
* p-valprint.c (pascal_val_print): Use lookup_symbol_search_name.
* psymtab.c (maintenance_check_psymtabs): Use
symbol_name_match_type::SEARCH_NAME and SYMBOL_SEARCH_NAME.
* stack.c (print_frame_args): Use lookup_symbol_search_name and
SYMBOL_SEARCH_NAME.
* symtab.c (lookup_local_symbol): Don't demangle the lookup name
if symbol_name_match_type::SEARCH_NAME.
(lookup_symbol_in_language): Pass down
symbol_name_match_type::FULL.
(lookup_symbol_search_name): New.
(lookup_language_this): Pass down
symbol_name_match_type::SEARCH_NAME.
(lookup_symbol_aux, lookup_local_symbol): New parameter
'match_type'. Pass it down.
* symtab.h (symbol_name_match_type::SEARCH_NAME): New enumerator.
(lookup_symbol_search_name): New declaration.
(lookup_symbol_in_block): New 'match_type' parameter.
gdb/testsuite/ChangeLog:
2018-01-05 Joel Brobecker <brobecker@adacore.com>
PR gdb/22670
* gdb.ada/access_tagged_param.exp: New file.
* gdb.ada/access_tagged_param/foo.adb: New file.
Pedro Alves [Fri, 5 Jan 2018 16:01:57 +0000 (16:01 +0000)]
Fix gdb.ada/info_addr_mixed_case.exp (PR gdb/22670)
The comments about mixed case in the testcase are actually a red
herring. The problem here is that we'd get to
ada_lookup_encoded_symbol with "my_table", which wraps the looked up
name in "<>"s to force a verbatim match, and that in turn disables
wild matching.
Fix this by swapping around the internals of ada_lookup_encoded_symbol
and ada_lookup_symbol, thus avoiding the encoding and
verbatim-wrapping in the ada_lookup_symbol case, the case that starts
with a user-provided lookup name.
Ada encoding is still done of course, in the ada_lookup_name_info
ctor. This could be also seen as avoiding the double-encoding problem
in a different way.
gdb/ChangeLog:
2018-01-05 Pedro Alves <palves@redhat.com>
PR gdb/22670
* ada-lang.c (ada_lookup_encoded_symbol): Reimplement in terms of
ada_lookup_symbol.
(ada_lookup_symbol): Reimplement in terms of
ada_lookup_symbol_list, bits factored out from
ada_lookup_encoded_symbol.
gdb/testsuite/ChangeLog:
2018-01-05 Pedro Alves <palves@redhat.com>
PR gdb/22670
* gdb.ada/info_addr_mixed_case.exp: Remove kfail. Extend test to
exercise lower case too, and to exercise both full matching and
wild matching.
Joel Brobecker [Fri, 5 Jan 2018 09:29:54 +0000 (04:29 -0500)]
(Ada) problem printing renaming which references a subprogram parameter
Consider the following code, which creates a local variable B
which is a renaming whose expression references a subprogram
parameter:
procedure Flip (Bits : in out Bits_Type; I : Natural) is
begin
declare
B : Boolean renames Bits (I);
begin
B := not B; -- BREAK
end;
end Flip;
Trying to print the value of B when at the "BREAK" line currently
does not work:
(gdb) p b
Could not find i
What happens is the following: For the renaming, GNAT generates
a variable whose name is encoded as follow:
b___XR_bits___XEXSi
GDB properly detects that variable, determines that, to compute
the variable's value, we start from the symbol "Bits", which
we then have to subscript (XS) using 'i' as the index. The error
occurs while trying to find 'i'.
This is because we forgot to pass the block in the call to
ada_lookup_encoded_symbol, which this patch fixes.
gdb/ChangeLog:
* ada-exp.y (write_object_renaming): When subscripting an array
using a symbol as the index, pass the block in call to
ada_lookup_encoded_symbol when looking that symbol up.
gdb/testsuite/ChangeLog:
* gdb.ada/rename_subscript_param: New testcase.
Tested on x86_64-linux.
Note: This requires the following GCC patch:
| 2017-04-25 Pierre-Marie de Rodat <derodat@adacore.com>
|
| * exp_dbug.adb: In Debug_Renaming_Declaration,
| when dealing with indexed component, accept to produce a renaming
| symbol when the index is an IN parameter or when it is a name
| defined in an outer scope.
Jerome Guitton [Fri, 5 Jan 2018 08:03:59 +0000 (03:03 -0500)]
(Ada) Fix Length attribute on array access
Consider the following variable "Indexed_By_Enum", declared as
an access to an array whose index type is an enumerated type
whose underlying values have "gaps":
type Enum_With_Gaps is (LIT0, LIT1, LIT2, LIT3, LIT4);
for Enum_With_Gaps use (LIT0 => 3,
LIT1 => 5,
LIT2 => 8,
LIT3 => 13,
LIT4 => 21);
for Enum_With_Gaps'size use 16;
type MyWord is range 0 .. 16#FFFF# ;
for MyWord'Size use 16;
type AR is array (Enum_With_Gaps range <>) of MyWord;
type AR_Access is access AR;
Indexed_By_Enum : AR_Access :=
new AR'(LIT1 => 1, LIT2 => 43, LIT3 => 42, LIT4 => 41);
Trying to print the length (number of elements) of this array using
the 'Length attribute does not work:
(gdb) print indexed_by_enum'length
'POS only defined on discrete types
The problem occurs while trying to get the array's index type.
It was using TYPE_INDEX_TYPE for that. It does not work for Ada arrays
in general; use ada_index_type instead.
gdb/ChangeLog:
* ada-lang.c (ada_array_length): Use ada_index_type instead of
TYPE_INDEX_TYPE.
gdb/testsuite/ChangeLog:
* gdb.ada/arr_acc_idx_w_gap: New testcase.
Tested on x86_64-linux.
Joel Brobecker [Fri, 5 Jan 2018 07:37:38 +0000 (02:37 -0500)]
memory error printing component of record from convenience variable
Consider the following situation Ada code:
type Kind_T is (One, Two, Three);
type Time_Set_T is array (Kind_T) of Integer;
type T is record
Started : Time_Set_T;
end record;
Null_T : constant T := (Started => (others => 0));
My_Item : Pck.T := Pck.Null_T;
Trying to print the value of My_Item.Started is no problem:
(gdb) p item.started
$1 = (0, 0, 0)
However, if you save My_Item into a convenience variable first,
and then try to print a component of that record, you get
an unexpected memory error, instead of getting the same result.
For instance:
(gdb) set variable $item := item
(gdb) p $item.started
Cannot access memory at address 0x0
The issue occurs when, after we extracted the component from
the convenience variable, we next try to "fix" it (which is
ada-lang speak for resolving the type into a static type).
This is done in ada_to_fixed_value, which delegates to
ada_to_fixed_value_create via:
val = ada_to_fixed_value_create (value_type (val),
value_address (val), val);
And looking at ada_to_fixed_value_create, we see that:
struct type *type = ada_to_fixed_type (type0, 0, address, NULL, 1);
if (type == type0 && val0 != NULL)
return val0;
else
return value_from_contents_and_address (type, 0, address);
The part that interests us, in this case, is the "else" branch,
where we obviously make the implicit assumption that our object
has an address, which is not true, in this case, because we are
actually dealing with a convenience variable.
This patch plugs that hole by adding special handing for situations
where val does not live in memory. In that case, we just create
a not_lval value using val's contents.
gdb/ChangeLog:
* ada-lang.c (ada_to_fixed_value_create): Add handling of
the case where VALUE_LVAL (val0) is not lval_memory.
gdb/testsuite/ChangeLog:
* gdb.ada/convvar_comp: New testcase.
Tested on x86_64-linux.
Joel Brobecker [Fri, 5 Jan 2018 07:39:10 +0000 (02:39 -0500)]
fix date of latest gdb/ChangeLog entry
Joel Brobecker [Fri, 5 Jan 2018 04:51:55 +0000 (23:51 -0500)]
Fix email address in latest gdb/testsuite/ChangeLog entry
Xavier Roirand [Fri, 5 Jan 2018 04:47:05 +0000 (23:47 -0500)]
(Ada) Remove printing of array's first index when unneeded
Consider the following code:
type Table is array (Character) of Natural;
My_Table : Table := (others => 4874);
Printing this table in gdb leads to:
(gdb) p my_table
$1 = ('["00"]' => 4874 <repeats 256 times>)
In this case, the index of the first element in this array is also
the first element of the index type (character type). Similar to what
we do we enumeration types, we do not need to print the index of the
first element when printing the array.
This patch fixes this issue and changes the output as follow:
(gdb) p my_table
$1 = (4874 <repeats 256 times>)
gdb/ChangeLog:
* ada-valprint.c (print_optional_low_bound): Handle
character-indexed array printing like boolean-indexed array
printing.
gdb/testuite/ChangeLog:
* testsuite/gdb.ada/array_char_idx/pck.ads (Table): New type.
(My_Table): New global variable.
* testsuite/gdb.ada/array_char_idx.exp: Add test.
Tested on x86_64-linux.
Joel Brobecker [Fri, 5 Jan 2018 04:18:05 +0000 (08:18 +0400)]
Update NEWS post GDB 8.1 branch creation.
gdb/ChangeLog:
* NEWS: Create a new section for the next release branch.
Rename the section of the current branch, now that it has
been cut.
Joel Brobecker [Fri, 5 Jan 2018 04:08:09 +0000 (08:08 +0400)]
Bump version to 8.1.50.DATE-git.
Now that the GDB 8.1 branch has been created, we can
bump the version number.
gdb/ChangeLog:
GDB 8.1 branch created (
5219ac6237c272b938c28517bf371429260c71e7):
* version.in: Bump version to 8.1.50.DATE-git.
GDB Administrator [Fri, 5 Jan 2018 00:00:35 +0000 (00:00 +0000)]
Automatic date update in version.in
Jim Wilson [Thu, 4 Jan 2018 22:17:53 +0000 (14:17 -0800)]
RISC-V: Add 2 missing privileged registers.
gas/
* testsuite/gas/riscv/priv-reg.s: Add missing stval and mtval.
* testsuite/gas/riscv/priv-reg.d: Likewise.
include/
* opcode/riscv-opc.h (CSR_SBADADDR): Rename to CSR_STVAL. Rename
DECLARE_CSR entry. Add alias to map sbadaddr to CSR_STVAL.
(CSR_MBADADDR): Rename to CSR_MTVAL. Rename DECLARE_CSR entry.
Add alias to map mbadaddr to CSR_MTVAL.
Joel Brobecker [Thu, 4 Jan 2018 09:40:17 +0000 (04:40 -0500)]
gdb.ada/maint_with_ada.exp: New testcase
This commit adds a new testcase testing the "check-psymtabs" and
"check-symtabs" maintenance commands.
The "maintenance check-psymtabs" commands is currently known to
produce some errors. While the situation was admetedly made worse
by the following patch...
commit
b5ec771e60c1a0863e51eb491c85c674097e9e13
Date: Wed Nov 8 14:22:32 2017 +0000
Subject: Introduce lookup_name_info and generalize Ada's FULL/WILD name matching
... hence the reference to PR gdb/22670, the command was already
spotting one inconsistency prior to it:
(gdb) maintenance check-psymtabs
Global symbol `interfaces__cS' only found in /[...]/b~var_arr_typedef.adb psymtab
For now, the "check-psymtab" test is KFAIL-ed.
gdb/testsuite/ChangeLog:
PR gdb/22670
* gdb.ada/maint_with_ada: New testcase.
Tested on x86_64-linux.
Joel Brobecker [Thu, 4 Jan 2018 08:10:34 +0000 (03:10 -0500)]
Add new gdb.ada/bp_c_mixed_case testcase for PR gdb/22670
This patch adds a new testcase to demonstrate a regression introduced by:
commit
b5ec771e60c1a0863e51eb491c85c674097e9e13
Date: Wed Nov 8 14:22:32 2017 +0000
Subject: Introduce lookup_name_info and generalize Ada's FULL/WILD name matching
The purpose of the testcase is to verify that a user can insert
a breakpoint on a C function while debugging Ada, even if the name
of the function includes uppercase letters, requiring us to use
Ada's "<...>" notation to tell the GDB that the symbol name should
be looked up verbatim.
As of the commit above, GDB is no longer finding the function:
(gdb) break <MixedCaseFunc>
Function "<MixedCaseFunc>" not defined.
Make breakpoint pending on future shared library load? (y or [n])
Before the patch, the breakpoint was inserted without problem.
gdb/testsuite/ChangeLog:
PR gdb/22670
* gdb.ada/bp_c_mixed_case: New testcase.
Tested on x86_64-linux; generates a KPASS before the regression
was introduced, and now generates a KFAIL.
Joel Brobecker [Thu, 4 Jan 2018 07:39:58 +0000 (02:39 -0500)]
Add "complete break ada" test to gdb.ada/complete.exp
This patch adds a new test to demonstrate a regression introduced by:
commit
b5ec771e60c1a0863e51eb491c85c674097e9e13
Date: Wed Nov 8 14:22:32 2017 +0000
Subject: Introduce lookup_name_info and generalize Ada's FULL/WILD name matching
The original purpose of the new test is to exercise the "complete"
command with an expression for which a large number of matches are
returned and to verify that each match returned is a plausible match.
In this particular case, the commit above causes GDB to generate
additional matches which should in fact not appear in the list
(internally generated symbols, or symbols that should be enclosed
between "<...>"). These extraneous entries are easy to spot, because
they have uppercase characters, such as:
break ada__stringsS
break ada__strings__R11s
[etc]
For now, the new test is KFAIL'ed, to avoid generating a new FAIL
while we work on fixing that regression.
gdb/testsuite/ChangeLog:
PR gdb/22670
* gdb.ada/complete.exp: Add "complete break ada" test.
Tested on x86_64-linux with GDB built before and after the patch
that caused the regression (
b5ec771e60c1a0863e51eb491c85c674097e9e13).
The test passes before the regression, and generates a KFAIL after.
Joel Brobecker [Thu, 4 Jan 2018 04:28:14 +0000 (23:28 -0500)]
Add gdb.ada/info_addr_mixed_case new testcase
This patch adds a new testcase to demonstrate a regression introduced by:
commit
b5ec771e60c1a0863e51eb491c85c674097e9e13
Date: Wed Nov 8 14:22:32 2017 +0000
Subject: Introduce lookup_name_info and generalize Ada's FULL/WILD name matching
The purpose of the testcase is to verify that a user can use any
casing for an Ada symbol name passed to the "info address" command.
After the patch above was applied, GDB was no longer able to find
the symbol:
(gdb) info address My_Table
No symbol "My_Table" in current context.
gdb/testsuite/ChangeLog:
PR gdb/22670
* gdb.ada/info_addr_mixed_case: New testcase.
Tested on x86_64-linux, both before and after the patch.
GDB Administrator [Thu, 4 Jan 2018 00:00:20 +0000 (00:00 +0000)]
Automatic date update in version.in
John Baldwin [Wed, 3 Jan 2018 20:06:26 +0000 (12:06 -0800)]
Create pseudo sections for FreeBSD NT_PROCSTAT_(PROC|FILES|VMMAP) notes.
bfd/ChangeLog:
* elf.c (elfcore_grok_freebsd_note): Handle
NT_FREEBSD_PROCSTAT_PROC, NT_FREEBSD_PROCSTAT_FILES, and
NT_FREEBSD_PROCSTAT_VMMAP.
Nick Clifton [Wed, 3 Jan 2018 17:32:59 +0000 (17:32 +0000)]
Fix compile time warning introduced by previous delta.
* objcopy.c (merge_gnu_build_notes): Add cast to maximum address
constants.
Nick Clifton [Wed, 3 Jan 2018 10:28:33 +0000 (10:28 +0000)]
Add support for v3 binary annotation notes.
I am checking in the attached patch which updates the binutils
support for version 3 binary annotation notes. (Version 3 adds
an end address to the ranges covered by the notes, so that it
is possible to detect gaps in the coverage).
This patch also stops the note merging feature of objcopy from
executing if the notes have relocations against them. This makes the
code simpler, and prevents the problems with architectures which have
unusual relocation management issues.
* objcopy.c (objcopy_internal_note): New structure.
(gap_exists): New function.
(is_open_note): New function.
(is_func_note): New function.
(is_64bit): New function.
(merge_gnu_build_notes): Handle v3 notes. Do not merge
if there are relocations against the notes.
* readelf.c (get_note_type): Use short names for build attribute
notes.
(print_symbol_for_build_attribute): Rename to
get_symbol_for_build_attribute. Returns the found symbol rather
than printing it.
(print_gnu_build_attribute_description): Maintain address ranges
for function notes as well as global notes. Handle v3 notes.
(print_gnu_build_attribute_name): Use more space for printing the
name in wide mode.
* testsuite/binutils-all/note-2-32.s: Use .dc.l instead of .word.
Eliminate symbol references in order to remove the need for
relocations.
* testsuite/binutils-all/note-2-64.s: Likewise.
* testsuite/binutils-all/note-3-32.s: Add a size to the note_1
symbol.
* testsuite/binutils-all/note-3-64.s: Likewise.
* testsuite/binutils-all/mips/mips-note-2r-n32.d: Update expected
output.
* testsuite/binutils-all/mips/mips-note-2r-n64.d: Likewise.
* testsuite/binutils-all/mips/mips-note-2r.d: Likewise.
* testsuite/binutils-all/note-2-32.d: Likewise.
* testsuite/binutils-all/note-2-64.d: Likewise.
* testsuite/binutils-all/note-3-32.d: Likewise.
* testsuite/binutils-all/note-3-64.d: Likewise.
* testsuite/binutils-all/note-4-64.s: New test. Checks v3 notes.
* testsuite/binutils-all/note-4-32.s: New test.
* testsuite/binutils-all/note-4-64.d: New test result file.
* testsuite/binutils-all/note-4-32.d: New test result file.
Xavier Roirand [Wed, 22 Nov 2017 09:40:39 +0000 (10:40 +0100)]
(Ada) New command to stop at start of exception handler.
When using gdb for debugging Ada source code, there are several catchpoint
types you can define in order to stop upon certain conditions. Let's
use this small example:
procedure Foo is
begin
begin
raise Constraint_Error;
exception
when Program_Error =>
null;
when Constraint_Error =>
null;
when others =>
null;
end;
end Foo;
One can stop when the exception is being raised by using the exception
catchpoint like below:
(gdb) catch exception
Catchpoint 1: all Ada exceptions
(gdb)
In that case, when running Foo, gdb will stop at the line where the exception
was raised:
begin
>>> raise Constraint_Error;
exception
This patch introduces new type of catchpoint, when the user wants to stop
at the location of the exception handling.
Imagine we want to stop on any exception handled by the program, we can do:
(gdb) catch handlers
Catchpoint 1: all Ada exceptions handlers
(gdb) r
Starting program: /tmp/foo
By doing so, when running Foo, gdb will stop here:
Catchpoint 1, exception at 0x000000000040255a in foo () at foo.adb:25
25 when Constraint_Error =>
(gdb)
It is also possible to stop when the Constraint_Error exception is being
handled in this program. With this patch, we can use:
(gdb) catch handlers Constraint_Error
Catchpoint 1: `Constraint_Error' Ada exception handlers
(gdb)
Like for other catchpoint, you can set a condition when adding a catchpoint
on exception handlers.
Here the handlers catchpoint checks Global_Var:
(gdb) catch handlers Constraint_Error if Global_Var /= 0
gdb/ChangeLog:
* ada-lang.h (ada_exception_catchpoint_kind) <ada_catch_handlers>:
Add field.
* ada-lang.c (struct exception_support_info) <catch_handlers_sym>:
Add field.
(default_exception_support_info) <catch_handlers_sym>: Add field.
(exception_support_info_fallback) <catch_handlers_sym>: Add field.
(ada_exception_name_addr_1): Add "catch handlers" handling.
(ada_exception_catchpoint_cond_string) <ex>: New parameter.
Update all callers.
(create_excep_cond_exprs) <ex>: Add parameter.
(re_set_exception): Update create_excep_cond_exprs call.
(print_it_exception, print_one_exception, print_mention_exception)
(print_recreate_exception): Add "catch handler" handling.
(allocate_location_catch_handlers, re_set_catch_handlers)
(check_status_catch_handlers, print_it_catch_handlers)
(print_one_catch_handlers, print_mention_catch_handlers)
(print_recreate_catch_handlers): New function.
(catch_handlers_breakpoint_ops): New variable.
(catch_ada_exception_command_split) <is_catch_handlers_cmd>:
Add parameter. Add "catch handler" handling.
(ada_exception_sym_name, ada_exception_breakpoint_ops):
Add "catch handler" handling.
(ada_exception_catchpoint_cond_string): Add "catch handler"
handling.
(create_ada_exception_catchpoint): Update create_excep_cond_exprs
call.
(catch_ada_handlers_command): New function.
(initialize_ada_catchpoint_ops): Initialize "catch handlers"
operations structure.
(_initialize_ada_language): Add "catch handlers" command entry.
* NEWS: Document "catch handlers" feature.
gdb/doc/ChangeLog:
* gdb.texinfo (Set Catchpoints): Add documentation for new
"catch handlers" action.
gdb/testsuite/ChangeLog:
* gdb.ada/excep_handle.exp: New testcase.
* gdb.ada/excep_handle/foo.adb: New file.
* gdb.ada/excep_handle/pck.ads: New file.
Tested on x86_64-linux.
Alan Modra [Wed, 3 Jan 2018 05:17:27 +0000 (15:47 +1030)]
Update year range in copyright notice of binutils files
Alan Modra [Wed, 3 Jan 2018 05:15:17 +0000 (15:45 +1030)]
ChangeLog rotation
Joel Brobecker [Wed, 3 Jan 2018 03:50:38 +0000 (07:50 +0400)]
Unbreak spurious fails in gdb.base/step-line.exp
My copyright year update in the copyright headers of the step-line
testcase caused it to start failing, due to shift in line numbers.
FAIL: gdb.base/step-line.exp: continue to f1
FAIL: gdb.base/step-line.exp: next to dummy 2
FAIL: gdb.base/step-line.exp: next over dummy 2
FAIL: gdb.base/step-line.exp: step into f2
FAIL: gdb.base/step-line.exp: next over dummy 4
FAIL: gdb.base/step-line.exp: next to dummy 5
FAIL: gdb.base/step-line.exp: next to dummy 6
FAIL: gdb.base/step-line.exp: next over dummy 6
FAIL: gdb.base/step-line.exp: next to dummy 7
FAIL: gdb.base/step-line.exp: next to dummy 8
FAIL: gdb.base/step-line.exp: next over dummy 8
FAIL: gdb.base/step-line.exp: next to dummy 9
FAIL: gdb.base/step-line.exp: next to dummy 10
FAIL: gdb.base/step-line.exp: next over dummy 10
This was caused by the copyright.py script after I changed it to
also update this testcase, which made the following transformation:
- Copyright (C) 2001-2017
- Free Software Foundation, Inc.
+ Copyright (C) 2001-2018 Free Software Foundation, Inc.
We can easily unbreak the testcase without having to go back to
manual edits each year by adding an extra line in the header.
gdb/testsuite/ChangeLog:
* gdb.base/step-line.c: Add extra empty line in copyright header.
* gdb.base/step-line.inp: Likewise.
Tested on x86_64-linux.
GDB Administrator [Wed, 3 Jan 2018 00:00:31 +0000 (00:00 +0000)]
Automatic date update in version.in
Nick Clifton [Tue, 2 Jan 2018 17:15:16 +0000 (17:15 +0000)]
Fix compile time warning (in the ARM simulator) about a print statement with insufficient arguments.
PR 22663
* maverick.c (DSPCDP4): Add missing parameter to debug print
statement.
Nick Clifton [Tue, 2 Jan 2018 12:13:17 +0000 (12:13 +0000)]
Fix typo in do_mrs function in ARM assembler.
PR 18119
* config/tc-arm.c (do_mrs): Fix test of bits 16-19 in non-banked
version of ARM MRS instruction.
Jan Beulich [Tue, 2 Jan 2018 10:44:04 +0000 (11:44 +0100)]
x86: partial revert of
10c17abdd0
Other than the variables in tc-i386.c using them, OPERAND_TYPE_REGYMM
and OPERAND_TYPE_REGZMM they aren't entirely unused. No need to update
i386-init.h though, as it mistakenly wasn't updated by the original
commit.
Joel Brobecker [Tue, 2 Jan 2018 03:53:55 +0000 (22:53 -0500)]
[gdb/Ada] slices of arrays with dynamic strides
Consider the following Ada code:
procedure Nested (L, U : Integer) is
subtype Small_Type is Integer range L .. U;
type Record_Type (I : Small_Type := L) is record
S : String (1 .. I);
end record;
type Array_Type is array (Integer range <>) of Record_Type;
A1 : Array_Type :=
(1 => (I => 0, S => <>),
2 => (I => 1, S => "A"),
3 => (I => 2, S => "AB"));
procedure Discard (R : Record_Type) is
begin
null;
end Discard;
begin
Discard (A1 (1)); -- STOP
end;
Trying to print a slice of that array currently yields:
(gdb) p a1(1..3)
$1 = ((i => 0, s => ""), (i => 0, s => ""), (i => 0, s => ""))
We expected instead:
(gdb) p a1(1..3)
$1 = ((i => 0, s => ""), (i => 1, s => "A"), (i => 2, s => "AB"))
This is because the functions we use in ada-lang.c to create the type
of the array slice (ada_value_slice and ada_value_slice_from_ptr) was
not taking into account the stride of the array. This patch fixes this.
gdb/ChangeLog:
* ada-lang.c (ada_value_slice_from_ptr): Take array stride into
account when creating the array type of the slice.
(ada_value_slice): Likewise.
gdb/testsuite/ChangeLog:
* gdb.ada/dyn_stride.exp: Add slice test.
Note that, with the current use of ada_value_slice, the enhancement
to handle dynamic array strides seems unnecessary, because I do not
see how an array with a dynamic stride can be referenced by either
by reference or pointer. Since references are coerced to array pointers,
in both cases, the slice is performed by ada_value_slice_from_ptr.
But ada_value_slice is enhanced nonetheless, in the spirit of making
the code more robust, in case we missed something, and also as similar
as possible with its from_ptr counterpart.
tested on x86_64-linux.
Joel Brobecker [Tue, 2 Jan 2018 03:47:18 +0000 (22:47 -0500)]
Add support for dynamic DW_AT_byte_stride.
This patch adds support for DW_AT_byte_stride, using Ada as one
example of where this would be useful. However, the implementation
is language-agnostic.
Consider the following Ada code:
procedure Nested (L, U : Integer) is
subtype Small_Type is Integer range L .. U;
type Record_Type (I : Small_Type := L) is record
S : String (1 .. I);
end record;
type Array_Type is array (Integer range <>) of Record_Type;
A1 : Array_Type :=
(1 => (I => 0, S => <>),
2 => (I => 1, S => "A"),
3 => (I => 2, S => "AB"));
procedure Discard (R : Record_Type) is
begin
null;
end Discard;
begin
Discard (A1 (1)); -- STOP
end;
It defines an array A1 of Record_Type, which is a variant record
type whose maximum size actually depends on the value of the
parameters passed when calling Nested. As a result, the stride
of the array A1 cannot be known statically, which leads the compiler
to generate a dynamic DW_AT_byte_stride attribute for our type.
Here is what the debugging info looks like with GNAT:
.uleb128 0x10 # (DIE (0x14e) DW_TAG_array_type)
.long .LASF17 # DW_AT_name: "foo__nested__T18b"
.long 0x141 # DW_AT_byte_stride
.long 0xdc # DW_AT_type
.uleb128 0x11 # (DIE (0x15f) DW_TAG_subrange_type)
.long 0x166 # DW_AT_type
.byte 0x3 # DW_AT_upper_bound
.byte 0 # end of children of DIE 0x14e
There DW_AT_byte_stride is a reference to a local (internal)
variable:
.uleb128 0x9 # (DIE (0x141) DW_TAG_variable)
.long .LASF6 # DW_AT_name: "foo__nested__T18b___PAD___XVZ"
This patch enhances GDB to handle this dynamic byte stride attribute
by first adding a new dynamic_prop_node_kind (DYN_PROP_BYTE_STRIDE)
to store the array dynamic stride info (when dynamic). It then enhances
the dynamic type resolver to handle this dynamic property.
Before applying this patch, trying to print the value of some of
A1's elements after having stopped at the "STOP" comment does not
work. For instance:
(gdb) p a1(2)
Cannot access memory at address 0x80000268dec0
With this patch applied, GDB now prints the value of all 3 elements
correctly:
(gdb) print A1(1)
$1 = (i => 0, s => "")
(gdb) print A1(2)
$2 = (i => 1, s => "A")
(gdb) print A1(3)
$3 = (i => 2, s => "AB")
gdb/ChangeLog:
* gdbtypes.h (enum dynamic_prop_node_kind) <DYN_PROP_BYTE_STRIDE>:
New enum value.
(create_array_type_with_stride): Add byte_stride_prop parameter.
* gdbtypes.c (create_array_type_with_stride) <byte_stride_prop>:
New parameter. Update all callers in this file.
(array_type_has_dynamic_stride): New function.
(is_dynamic_type_internal, resolve_dynamic_array): Add handling
of arrays with dynamic byte strides.
* dwarf2read.c (read_array_type): Add support for dynamic
DW_AT_byte_stride attributes.
gdb/testsuite/ChangeLog:
* gdb.ada/dyn_stride: New testcase.
Tested on x86_64-linux.
Joel Brobecker [Tue, 2 Jan 2018 03:41:36 +0000 (22:41 -0500)]
treat Ada DW_TAG_unspecified_type DIEs as stub types
Consider the gdb.ada/taft_type.exp testcase, which exercises
the situation where a variable is defined using a type which
is a pointer to an incomplete type, with the actual type
definition being provided by another unit. Up to now, the
strategy used by GNAT when generating the DWARF debugging info
was to produce a incomplete DW_TAG_enumeration_type DIE with
a DW_AT_declaration flag attached to it:
.uleb128 0x4 # (DIE (0x3e) DW_TAG_enumeration_type)
.long .LASF4 # DW_AT_name: "pck__empty"
# DW_AT_declaration
However, a more standard way for the compiler to describe
this kind of type is to use the DW_TAG_unspecified_type tag.
When the compiler is enhanced to do so, we'll need to treat
such types as stubs -- we only do so with types from Ada units,
however, as the meaning of this TAG is intentionally left
permissive and language-specific by the DWARF standard.
Without this patch, running the testcase above with an enhanced
compiler now yields:
(gdb) print w.e.all
Attempt to dereference a generic pointer.
FAIL: gdb.ada/taft_type.exp: print w.e.all
gdb/ChangeLog:
* dwarf2read.c (read_unspecified_type): Treat
DW_TAG_enumeration_type DIEs from Ada units as stubs.
Tested on x86_64-linux, fixes the FAIL in gdb.ada/taft_type.exp above.
Joel Brobecker [Mon, 1 Jan 2018 04:43:02 +0000 (08:43 +0400)]
Update copyright year range in all GDB files
gdb/ChangeLog:
Update copyright year range in all GDB files
Joel Brobecker [Mon, 1 Jan 2018 04:18:16 +0000 (08:18 +0400)]
gdb/copyright.py: Remove testsuite/gdb.base/step-line.{c,inp} special handling
In the past, these files needed to be handled by hand, because
the testcase was sensitive to the length of the header, which was
potentially changing when new copyright years were added to
the copyright header. Now that we simply maintain and update
a range, the length of the copyright header should not change
as a consequence of the update performed by this script, so
special handling of those files is no longer necessary.
gdb/ChangeLog:
* copyright.py (BY_HAND): Remove gdb/testsuite/gdb.base/step-line.inp
and gdb/testsuite/gdb.base/step-line.c.
Joel Brobecker [Mon, 1 Jan 2018 04:30:28 +0000 (08:30 +0400)]
gdb/copyright.py: Do not forget to remind about MULTIPLE_COPYRIGHT_HEADERS
There is a small logical error in the part of the script that
dumps the list of files in BY_HAND + MULTIPLE_COPYRIGHT_HEADERS
but only checkis the contents of BY_HAND. The issue becomes
apparent as soon as BY_HAND is empty. Prevent this from happening
by treating the two lists separately, as this allows us to provide
a more informative message in the case of MULTIPLE_COPYRIGHT_HEADERS.
gdb/ChangeLog:
* copyright.py (main): Dump the contents of
MULTIPLE_COPYRIGHT_HEADERS (separately) from BY_HAND,
even if BY_HAND is empty.
Joel Brobecker [Mon, 1 Jan 2018 04:12:21 +0000 (08:12 +0400)]
Update copyright year in version message of GDB, GDBserver and GDBreplay
gdb/ChangeLog:
* top.c (print_gdb_version): Update Copyright year in version
message.
gdb/gdbserver/ChangeLog:
* gdbreplay.c (gdbreplay_version): Update copyright year in
version message.
* server.c (gdbserver_version): Likewise.
Joel Brobecker [Mon, 1 Jan 2018 04:07:25 +0000 (08:07 +0400)]
Yearly rotation of the gdb/ChangeLog file
gdb/ChangeLog
* config/djgpp/fnchange.lst: Add entry for gdb/ChangeLog-2017.
GDB Administrator [Tue, 2 Jan 2018 00:00:32 +0000 (00:00 +0000)]
Automatic date update in version.in
GDB Administrator [Mon, 1 Jan 2018 00:00:38 +0000 (00:00 +0000)]
Automatic date update in version.in
Ruslan Kabatsayev [Sat, 30 Dec 2017 19:14:41 +0000 (22:14 +0300)]
Avoid indexing std::vector past the end
The code here wants to find address of an element, and often this
element is one past the end of std::vector. Dereferencing that element
leads to undefined behavior, so it's better to simply use pointer
arithmetic instead of taking address of invalid dereference.
gdb/ChangeLog:
* psymtab.c (recursively_search_psymtabs): Use pointer arithmetic
instead of dereferencing std::vector past the end.
Simon Marchi [Sun, 31 Dec 2017 04:33:26 +0000 (23:33 -0500)]
Only ignore -Wenum-compare-switch if it exists
My patch
dwarf2read: Silence -Wenum-compare-switch warning
132448f8359a268f34f074b0908b5255b568da06
made some parts of dwarf2read.c ignore warnings about switch using enums
of different kinds. What I did not realize was that older Clang
versions (prior to 6) did not have that warning, and therefore give this
error:
/home/emaisin/src/binutils-gdb/gdb/dwarf2read.c:24187:7: error: unknown warning group '-Wenum-compare-switch', ignored [-Werror,-Wunknown-pragmas]
DIAGNOSTIC_IGNORE_SWITCH_DIFFERENT_ENUM_TYPES
^
/home/emaisin/src/binutils-gdb/gdb/common/diagnostics.h:42:3: note: expanded from macro 'DIAGNOSTIC_IGNORE_SWITCH_DIFFERENT_ENUM_TYPES'
DIAGNOSTIC_IGNORE ("-Wenum-compare-switch")
^
/home/emaisin/src/binutils-gdb/gdb/common/diagnostics.h:27:3: note: expanded from macro 'DIAGNOSTIC_IGNORE'
_Pragma (STRINGIFY (GCC diagnostic ignored option))
^
<scratch space>:10:25: note: expanded from here
GCC diagnostic ignored "-Wenum-compare-switch"
^
Clang has a way to test if it knows about a particular warning. This
patch uses that feature to only define
DIAGNOSTIC_IGNORE_SWITCH_DIFFERENT_ENUM_TYPES to something if the
warning is recognized by the Clang version being used. I tested
building dwarf2read.c with clang 4, 5, 6, as well as gcc.
gdb/ChangeLog:
* common/diagnostics.h
(DIAGNOSTIC_IGNORE_SWITCH_DIFFERENT_ENUM_TYPES): Only
define if the compiler knows about -Wenum-compare-switch.
Simon Marchi [Sun, 31 Dec 2017 02:24:29 +0000 (21:24 -0500)]
dwarf2read: Silence -Wenum-compare-switch warning
Compiling with Clang 6 gives:
/home/emaisin/src/binutils-gdb/gdb/dwarf2read.c:24385:14: error: comparison of two values with different enumeration types in switch statement ('enum dwarf_macro_record_type' and 'dwarf_macinfo_record_type') [-Werror,-Wenum-compare-switch]
case DW_MACINFO_vendor_ext:
^~~~~~~~~~~~~~~~~~~~~
/home/emaisin/src/binutils-gdb/gdb/dwarf2read.c:24561:7: error: comparison of two values with different enumeration types in switch statement ('enum dwarf_macro_record_type' and 'dwarf_macinfo_record_type') [-Werror,-Wenum-compare-switch]
case DW_MACINFO_vendor_ext:
^~~~~~~~~~~~~~~~~~~~~
This code uses the two enum types on purpose, because it handles both
.debug_macro and .debug_macinfo sections. Add some pragmas to disable
the warning in these specific cases.
gdb/ChangeLog:
* dwarf2read.c (dwarf_decode_macro_bytes): Ignore
-Wenum-compare-switch warning.
(dwarf_decode_macros): Likewise.
Tom Tromey [Thu, 23 Nov 2017 04:45:53 +0000 (21:45 -0700)]
C++-ify parser_state
This mildly C++-ifies parser_state and stap_parse_info -- just enough
to remove some cleanups.
This version includes the changes implemented by Simon.
Regression tested by the buildbot.
gdb/ChangeLog
2017-12-30 Tom Tromey <tom@tromey.com>
Simon Marchi <simon.marchi@ericsson.com>
* stap-probe.h (struct stap_parse_info): Add constructor,
destructor.
* stap-probe.c (stap_parse_argument): Update.
* rust-exp.y (rust_lex_tests): Update.
* parser-defs.h (struct parser_state): Add constructor,
destructor, release method.
<expout>: Change type to expression_up.
(null_post_parser): Change type.
(initialize_expout, reallocate_expout): Remove.
* parse.c (parser_state::parser_state): Rename from
initialize_expout.
(parser_state::release): Rename from reallocate_expout.
(write_exp_elt, parse_exp_in_context_1, increase_expout_size):
Update.
(null_post_parser): Change type of "exp".
* dtrace-probe.c (dtrace_probe::build_arg_exprs): Update.
* ada-lang.c (resolve, resolve_subexp)
(replace_operator_with_call): Change type of "expp".
* language.h (struct language_defn) <la_post_parser>: Change type
of "expp".
GDB Administrator [Sun, 31 Dec 2017 00:00:27 +0000 (00:00 +0000)]
Automatic date update in version.in
Simon Marchi [Sat, 30 Dec 2017 05:10:05 +0000 (00:10 -0500)]
Make mapped_debug_names and mapped_index final
When compiling with Clang 6, I see these warnings:
/home/emaisin/src/binutils-gdb/gdb/dwarf2read.c:25421:5: error: destructor called on non-final 'mapped_index' that has virtual functions but non-virtual destructor [-Werror,-Wdelete-non-virtual-dtor]
data->index_table->~mapped_index ();
^
In file included from /home/emaisin/src/binutils-gdb/gdb/dwarf2read.c:31:
In file included from /home/emaisin/src/binutils-gdb/gdb/defs.h:28:
In file included from /home/emaisin/src/binutils-gdb/gdb/common/common-defs.h:92:
In file included from /home/emaisin/src/binutils-gdb/gdb/common/gdb_unique_ptr.h:23:
In file included from /usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0/memory:81:
/usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0/bits/unique_ptr.h:76:2: error: delete called on non-final 'mapped_debug_names' that has virtual functions but non-virtual destructor [-Werror,-Wdelete-non-virtual-dtor]
delete __ptr;
^
/usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0/bits/unique_ptr.h:236:4: note: in instantiation of member function 'std::default_delete<mapped_debug_names>::operator()' requested here
get_deleter()(__ptr);
^
/home/emaisin/src/binutils-gdb/gdb/dwarf2read.c:2374:21: note: in instantiation of member function 'std::unique_ptr<mapped_debug_names, std::default_delete<mapped_debug_names> >::~unique_ptr' requested here
dwarf2_per_objfile::dwarf2_per_objfile (struct objfile *objfile_,
^
This patch silences these warnings by making the classes final.
gdb/ChangeLog:
* dwarf2read.c (struct mapped_debug_names): Make final.
(struct mapped_index): Make final.
Simon Marchi [Sat, 30 Dec 2017 04:32:13 +0000 (23:32 -0500)]
Ignore warning about using different types of enums in switch
When compiling with clang 6, I see a bunch of warnings like this:
/home/emaisin/src/binutils-gdb/gdb/amd64-linux-tdep.c:1427:8: error: comparison of two values with different enumeration types in switch statement ('enum amd64_syscall' and 'amd
64_x32_syscall') [-Werror,-Wenum-compare-switch]
case amd64_x32_sys_move_pages:
^~~~~~~~~~~~~~~~~~~~~~~~
In this switch, we indeed use enumerators of both types
amd64_x32_syscall and amd64_syscall. This is done on purpose, and the
enum values are chosen so that they are complementary.
I think it's still a useful warning, so I chose to ignore just that
particular case.
gdb/ChangeLog:
* common/diagnostics.h
(DIAGNOSTIC_IGNORE_SWITCH_DIFFERENT_ENUM_TYPES): New macro.
* amd64-linux-tdep.c (amd64_canonicalize_syscall): Use it.
Simon Marchi [Sat, 30 Dec 2017 02:56:58 +0000 (21:56 -0500)]
Remove unnecessary call to get_thread_db_info
In thread_db_detach, we call get_thread_db_info to first check if there
exists a thread_db_info entry for the pid to detach. If there is, then
we call delete_thread_db_info. It's unnecessary to call
get_thread_db_info in the first place, since delete_thread_db_info
handles the case where no thread_db_info entry exist for the given pid.
gdb/ChangeLog:
* linux-thread-db.c (thread_db_detach): Remove call to
delete_thread_db_info.
GDB Administrator [Sat, 30 Dec 2017 00:00:30 +0000 (00:00 +0000)]
Automatic date update in version.in
GDB Administrator [Fri, 29 Dec 2017 00:00:34 +0000 (00:00 +0000)]
Automatic date update in version.in
Jim Wilson [Thu, 28 Dec 2017 21:21:46 +0000 (13:21 -0800)]
RISC-V: Add missing privileged spec registers.
gas/
* testsuite/gas/riscv/priv-reg.d, testsuite/gas/riscv/priv-reg.s: New.
include/
* opcode/riscv-opc.h (DECLARE_CSR): Add missing privileged registers.
Sort to match privileged spec documentation order.
(DECLARE_CSR_ALIAS): Add ubadaddr, and comments.
Simon Marchi [Thu, 28 Dec 2017 17:29:33 +0000 (12:29 -0500)]
Remove unused HP-UX TARGET_OBJECT_ enums
These two enumerators are unused, remove them.
gdb/ChangeLog:
* target.h (enum target_object) <TARGET_OBJECT_HPUX_UREGS,
TARGET_OBJECT_HPUX_SOLIB_GOT>: Remove.
GDB Administrator [Thu, 28 Dec 2017 00:00:21 +0000 (00:00 +0000)]
Automatic date update in version.in
Stafford Horne [Wed, 27 Dec 2017 14:36:31 +0000 (23:36 +0900)]
tdesc: handle arbitrary strings in tdesc_register_in_reggroup_p
tdesc_register_in_reggroup_p in now able to handle arbitrary
groups. This is useful when groups are created while the
target descriptor file is received from the remote.
This can be the case of a soft core target processor where
registers/groups can change.
gdb/ChangeLog:
yyyy-mm-dd Franck Jullien <franck.jullien@gmail.com>
Stafford Horne <shorne@gmail.com>
* target-descriptions.c (tdesc_register_in_reggroup_p): Support
arbitrary strings.
(tdesc_use_registers): Add logic to register new reggroups.
(tdesc_reg::group): Update comment to indicate we allow
arbitrary strings.
* NEWS (Changes since GDB 8.0): Announce that GDB supports
arbitrary reggroups.
gdb/testsuite/ChangeLog:
yyyy-mm-dd Stafford Horne <shorne@gmail.com>
* gdb.xml/extra-regs.xml: Add example foo reggroup.
* gdb.xml/tdesc-regs.exp: Add test to check for foo reggroup.
gdb/doc/ChangeLog:
yyyy-mm-dd Stafford Horne <shorne@gmail.com>
* gdb.texinfo (Target Description Format): Explain that arbitrary
strings are now allowed for register groups.
Stafford Horne [Wed, 27 Dec 2017 14:36:31 +0000 (23:36 +0900)]
reggroups: Add reggroup_gdbarch_new, reggroup_find for dynamic reggroups
Traditionally reggroups have been created via reggroup_new() during
initialization code and never freed. Now, if we want to initialize
reggroups dynamically (i.e. in target description) we should be able to
free them. Create this function reggroup_gdbarch_new() which will
allocate the reggroup memory onto the passed gdbarch obstack.
Also creating reggroup_find() as a utility to find a gdbarch registered
reggroup object by name.
gdb/ChangeLog:
yyyy-mm-dd Stafford Horne <shorne@gmail.com>
* reggroups.c (reggroup_gdbarch_new): New function.
(reggroup_find): New function.
* reggroups.h (reggroup_gdbarch_new): New function.
(reggroup_find): New function.
Stafford Horne [Wed, 27 Dec 2017 14:36:30 +0000 (23:36 +0900)]
reggroups: Convert reggroups from post_init to pre_init
Currently the reggroups gdbarch_data cannot be manipulated until after
the gdbarch is completely initialized. This is usually done when the
object init depends on architecture specific fields. In the case of
reggroups it only depends on the obstack being available.
Coverting this to pre_init allows using reggroups during gdbarch
initialization. This is needed to allow registering arbitrary reggroups
during gdbarch initializations.
gdb/ChangeLog:
yyyy-mm-dd Stafford Horne <shorne@gmail.com>
* reggroups.c (reggroups_init): Change to depend only on
obstack rather than gdbarch.
(reggroup_add): Remove logic for forcing premature init.
(_initialize_reggroup): Set `reggroups_data` with
gdbarch_data_register_pre_init() rather than
gdbarch_data_register_post_init().
Stafford Horne [Wed, 27 Dec 2017 14:36:30 +0000 (23:36 +0900)]
reggroups: Add test and docs for `info reg $reggroup` feature
Until now this feature has existed but was not documented. Adding docs
and tests.
gdb/ChangeLog:
yyyy-mm-dd Stafford Horne <shorne@gmail.com>
* infcmd.c (_initialize_infcmd): Add help for info reg $reggroup
and info all-registers $reggroup feature.
gdb/doc/ChangeLog:
yyyy-mm-dd Stafford Horne <shorne@gmail.com>
* gdb.texinfo (Registers): Document info reg $reggroup feature.
gdb/testsuite/ChangeLog:
yyyy-mm-dd Stafford Horne <shorne@gmail.com>
* gdb.base/reggroups.c: New file.
* gdb.base/reggroups.exp: New file.
GDB Administrator [Wed, 27 Dec 2017 00:00:21 +0000 (00:00 +0000)]
Automatic date update in version.in
GDB Administrator [Tue, 26 Dec 2017 00:00:28 +0000 (00:00 +0000)]
Automatic date update in version.in
GDB Administrator [Mon, 25 Dec 2017 00:00:30 +0000 (00:00 +0000)]
Automatic date update in version.in
GDB Administrator [Sun, 24 Dec 2017 00:00:39 +0000 (00:00 +0000)]
Automatic date update in version.in
Simon Marchi [Sat, 23 Dec 2017 21:25:06 +0000 (16:25 -0500)]
Add ATTRIBUTE_PRINTF to printf_field_type_assignment
Get rid of:
/home/simark/src/binutils-gdb/gdb/target-descriptions.c:2026:25: error: format string is not a string literal [-Werror,-Wformat-nonliteral]
vprintf_unfiltered (fmt, args);
when building with clang.
gdb/ChangeLog:
* target-descriptions.c (print_c_tdesc)
<printf_field_type_assignment>: Add ATTRIBUTE_PRINTF.
GDB Administrator [Sat, 23 Dec 2017 00:00:31 +0000 (00:00 +0000)]
Automatic date update in version.in
GDB Administrator [Fri, 22 Dec 2017 00:00:31 +0000 (00:00 +0000)]
Automatic date update in version.in
Simon Marchi [Thu, 21 Dec 2017 23:19:17 +0000 (18:19 -0500)]
Do not emit "field_type" var if not needed on "maint print c-tdesc"
While fiddling a bit with -Wunused-variable, Sergio noticed that "maint
print c-tdesc" was always generating code for the "tdesc_type
*field_type" variable, even when it wasn't used. This is caught by GCC
when using -Wunused-variable, of course.
This patch changes the print_c_tdesc class to only output the field
declaration when we actually need it.
It shouldn't be necessary to do the same with the other variable
declarations (type_with_fields and element_type), because they are
always if they are declared.
The C files in features/ are regenerated, some declarations of
field_type are removed, as expected, while some others move to where
they are used for the first time.
gdb/ChangeLog:
* target-descriptions.c (print_c_tdesc) <visit>: Don't output
field_type declaration, use printf_field_type_assignment
instead.
<printf_field_type_assignment>: New method.
* features/aarch64-core.c, features/aarch64-fpu.c
features/arc-arcompact.c, features/arc-v2.c,
features/arm/arm-with-iwmmxt.c, features/i386/32bit-core.c,
features/i386/32bit-mpx.c, features/i386/32bit-sse.c,
features/i386/64bit-avx512.c, features/i386/64bit-core.c,
features/i386/64bit-mpx.c, features/i386/64bit-sse.c,
features/i386/x32-core.c, features/or1k.c,
features/rs6000/powerpc-7400.c,
features/rs6000/powerpc-altivec32.c,
features/rs6000/powerpc-altivec32l.c,
features/rs6000/powerpc-altivec64.c,
features/rs6000/powerpc-altivec64l.c,
features/rs6000/powerpc-cell32l.c,
features/rs6000/powerpc-cell64l.c,
features/rs6000/powerpc-isa205-altivec32l.c,
features/rs6000/powerpc-isa205-altivec64l.c,
features/rs6000/powerpc-isa205-vsx32l.c,
features/rs6000/powerpc-isa205-vsx64l.c,
features/rs6000/powerpc-vsx32.c,
features/rs6000/powerpc-vsx32l.c,
features/rs6000/powerpc-vsx64.c,
features/rs6000/powerpc-vsx64l.c, features/s390-gs-linux64.c,
features/s390-tevx-linux64.c, features/s390-vx-linux64.c,
features/s390x-gs-linux64.c, features/s390x-tevx-linux64.c,
features/s390x-vx-linux64.c: Re-generate.
Uros Bizjak [Thu, 21 Dec 2017 01:42:05 +0000 (20:42 -0500)]
Remove write-only assignment in rs6000-tdep.c
The result of this memory read is never used, so it can be removed.
gdb/ChangeLog:
* rs6000-tdep.c (ppc_deal_with_atomic_sequence): Remove
write-only assignment to "insn" variable.
GDB Administrator [Thu, 21 Dec 2017 00:00:39 +0000 (00:00 +0000)]
Automatic date update in version.in
Jim Wilson [Wed, 20 Dec 2017 21:37:44 +0000 (13:37 -0800)]
RISC-V: Add compressed instruction hints, and a few misc cleanups.
gas/
* config/tc-riscv.c (risc_ip) <o>: Add comment.
* testsuite/gas/riscv/c-nonzero-imm.d,
* testsuite/gas/riscv/c-nonzero-imm.l,
* testsuite/gas/riscv/c-nonzero-imm.s,
* testsuite/gas/riscv/c-nonzero-reg.d,
* testsuite/gas/riscv/c-nonzero-reg.l,
* testsuite/gas/riscv/c-nonzero-reg.s,
* testsuite/gas/riscv/c-zero-imm-64.d,
* testsuite/gas/riscv/c-zero-imm-64.s,
* testsuite/gas/riscv/c-zero-imm.d, testsuite/gas/riscv/c-zero-imm.s,
* testsuite/gas/riscv/c-zero-reg.d,
* testsuite/gas/riscv/c-zero-reg.s: New.
opcodes/
* riscv-opc.c (match_c_add_with_hint, match_c_lui_with_hint): New.
(riscv_opcodes) <li>: Delete "d,0" line. Change Cj to Co.
<andi, and, add, addiw, addw, c.addi>: Change Cj to Co.
<add>: Add explanatory comment for 4-operand add instruction.
<c.nop>: Add support for immediate operand.
<c.mv, c.add>: Use match_c_add_with_hint instead of match_c_add.
<c.lui>: Use match_c_lui_with_hint instead of match_c_lui.
<c.li, c.slli>: Use match_opcode instead of match_rd_nonzero.
Ulrich Weigand [Wed, 20 Dec 2017 12:59:14 +0000 (13:59 +0100)]
[Cell/B.E.] Fix regression due to gdbarch_significant_addr_bit
On Cell/B.E. multi-architecture debugging we use a "merged" address space
that encodes both the main PowerPC address space and the local store address
spaces of all active SPUs. This will always occupy 64 bits.
However, gdbarch_addr_bit is set to 32 on SPU, and may be set to 32 as well
on PowerPC. Since the new gdbarch_significant_addr_bit defaults to the
value of gdbarch_addr_bit, this means addresses may be improperly truncated.
Work around this problem by explicitly setting gdbarch_significant_addr_bit
to 64 both for the SPU target and also for PowerPC target that support
Cell/B.E. execution.
gdb/ChangeLog:
2017-12-20 Ulrich Weigand <uweigand@de.ibm.com>
* spu-tdep.c (spu_gdbarch_init): Set set_gdbarch_significant_addr_bit
to 64 bits.
(ppc_linux_init_abi): Likewise, if Cell/B.E. is supported.
Simon Marchi [Wed, 20 Dec 2017 03:09:40 +0000 (22:09 -0500)]
Fix ChangeLog formatting
Doing some unrelated grepping found that there were some missing
spaces, fix it.
GDB Administrator [Wed, 20 Dec 2017 00:00:21 +0000 (00:00 +0000)]
Automatic date update in version.in
Tamar Christina [Tue, 19 Dec 2017 12:05:20 +0000 (12:05 +0000)]
Correct disassembly of dot product instructions.
Dot products deviate from the normal disassembly rules for lane indexed
instruction. Their canonical representation is in the form of:
v0.2s, v0.8b, v0.4b[0] instead of v0.2s, v0.8b, v0.b[0] to try to denote
that these instructions select 4x 1 byte elements instead of a single 1 byte
element.
Previously we were disassembling them following the normal rules, this patch
corrects the disassembly.
gas/
PR gas/22559
* config/tc-aarch64.c (vectype_to_qualifier): Support AARCH64_OPND_QLF_S_4B.
* gas/testsuite/gas/aarch64/dotproduct.d: Update disassembly.
include/
PR gas/22559
* aarch64.h (aarch64_opnd_qualifier): Add AARCH64_OPND_QLF_S_4B.
opcodes/
PR gas/22559
* aarch64-asm.c (aarch64_ins_reglane): Change AARCH64_OPND_QLF_S_B to
AARCH64_OPND_QLF_S_4B
* aarch64-dis.c (aarch64_ext_reglane): Change AARCH64_OPND_QLF_S_B to
AARCH64_OPND_QLF_S_4B
* aarch64-opc.c (aarch64_opnd_qualifiers): Add 4b variant.
* aarch64-tbl.h (QL_V2DOT): Change S_B to S_4B.