Xavier Roirand [Fri, 15 Dec 2017 03:38:17 +0000 (22:38 -0500)]
(Ada) Handle same component names when searching in tagged types
Consider the following code:
type Top_T is tagged record
N : Integer := 1;
U : Integer := 974;
A : Integer := 48;
end record;
type Middle_T is new Top.Top_T with record
N : Character := 'a';
C : Integer := 3;
end record;
type Bottom_T is new Middle.Middle_T with record
N : Float := 4.0;
C : Character := '5';
X : Integer := 6;
A : Character := 'J';
end record;
Tagged records in Ada provide object-oriented features, and what
is interesting in the code above is that a child tagged record
introduce additional components (fields) which sometimes have
the same name as one of the components in the parent. For instance,
Bottom_T introduces a component named "C", while at the same time
inheriting from Middle_T which also has a component named "C";
so, in essence, type Bottom_T has two components with the same name!
And before people start wondering why the language can possibly
be allowing that, this can only happen if the parent type has
a private definition. In our case, this was brought to our attention
when the parent was a generic paramenter.
With that in mind... Let's say we now have a variable declared
and initialized as follow:
TC : Top_A := new Bottom_T;
And then we use this variable to call this function
procedure Assign (Obj: in out Top_T; TV : Integer);
as follow:
Assign (Top_T (B), 12);
Now, we're in the debugger, and we're inside that procedure
(Top.Assign in our gdb testcase), and we want to print
the value of obj.c:
Usually, the tagged record or one of the parent type owns the
component to print and there's no issue but in this particular
case, what does it mean to ask for Obj.C ? Since the actual
type for object is type Bottom_T, it could mean two things: type
component C from the Middle_T view, but also component C from
Bottom_T. So in that "undefined" case, when the component is
not found in the non-resolved type (which includes all the
components of the parent type), then resolve it and see if we
get better luck once expanded.
In the case of homonyms in the derived tagged type, we don't
guaranty anything, and pick the one that's easiest for us
to program.
This patch fixes the behavior like described above.
gdb/ChangeLog:
* ada-lang.c (ada_value_primitive_field): Handle field search
in case of homonyms.
(find_struct_field): Ditto.
(ada_search_struct_field): Ditto.
(ada_value_struct_elt): Ditto.
(ada_lookup_struct_elt_type): Ditto.
gdb/testsuite/ChangeLog:
* gdb.ada/same_component_name: New testcase.
Tested on x86_64-linux.
GDB Administrator [Fri, 15 Dec 2017 00:00:27 +0000 (00:00 +0000)]
Automatic date update in version.in
Simon Marchi [Thu, 14 Dec 2017 20:46:47 +0000 (15:46 -0500)]
py-breakpoint: Don't use the 'p' PyArg_ParseTupleAndKeywords format specifier
In Python 3, the 'p' format specifier can be passed to
PyArg_ParseTupleAndKeywords to test the argument for truth and convert
it to a boolean value (the p stands for predicate). However, it is not
available in Python 2, causing this error:
Traceback (most recent call last):
File "test.py", line 1, in <module>
b1 = gdb.Breakpoint("foo", qualified=False)
TypeError: argument 10 (impossible<bad format char>)
This patch changes it to the 'O' specifier, which returns the Python
object passed in without transformation, and uses PyObject_IsTrue on it.
This is what is done for the other boolean parameters of this function
(internal and temporary).
This fixes the test gdb.python/py-breakpoint.exp for Python 2.
gdb/ChangeLog:
* python/py-breakpoint.c (bppy_init): Use 'O' format specifier
for "qualified" and use PyObject_IsTrue.
Nick Clifton [Thu, 14 Dec 2017 12:48:55 +0000 (12:48 +0000)]
Update the address of the FSF in the copyright notice of files which were using the old address.
top * COPYING.LIBGLOSS: Update address of FSF in copyright notice.
bfd * cpu-mt.c: Update address of FSF in copyright notice.
* elf32-m32c.c: Likewise.
* elf32-mt.c: Likewise.
* elf32-rl78.c: Likewise.
* elf32-rx.c: Likewise.
* elf32-rx.h: Likewise.
* elf32-spu.h: Likewise.
* hosts/x86-64linux.h: Likewise.
etc * add-log.el: Update address of FSF in copyright notice.
gas * config/tc-m32c.c: Update address of FSF in copyright notice.
* config/tc-m32c.h: Likewise.
* config/tc-mt.c: Likewise.
* config/tc-mt.h: Likewise.
* config/tc-visium.c: Likewise.
* config/tc-visium.h: Likewise.
* testsuite/gas/rx/explode: Likewise.
ld * testsuite/ld-mn10300/mn10300.exp: Update address of FSF in
copyright notice.
Alan Modra [Thu, 14 Dec 2017 08:27:02 +0000 (18:57 +1030)]
binutils nm testsuite tidy
We can run the gnu_unique_object symbol test on all ELF targets.
Those that don't support the symbol type and fail to assemble can just
be resolved as "unsupported". This means binutils_assemble can't
report an error on assembly failure, but it probably should never have
done that anyway.
* testsuite/lib/utils-lib.exp (default_binutils_assemble_flags):
Don't perror on assembler diagnostic output.
* testsuite/binutils-all/nm.exp: Run unique symbol test on all
ELF targets. Resolve as "unsupported" on assembly failure.
Jan Kratochvil [Thu, 14 Dec 2017 09:00:17 +0000 (10:00 +0100)]
DWARF-5 .debug_names DW_IDX_type_unit fix
The .debug_names completely misses its support as it did not even produce
DW_IDX_type_unit.
gdb/ChangeLog
2017-12-14 Jan Kratochvil <jan.kratochvil@redhat.com>
* dwarf2read.c (dw2_debug_names_iterator::next): Support
DW_IDX_type_unit.
(debug_names::dwarf5_offset_size, unit_kind): New.
(debug_names::insert): Add parameter kind.
(debug_names::build): Support DW_IDX_type_unit.
(debug_names::recursively_write_psymbols): Update
(debug_names::write_psymbols caller.
(debug_names::write_one_signatured_type_data)
(debug_names::write_one_signatured_type): New.
(debug_names::index_key, debug_names::symbol_value)
(debug_names::write_psymbols): Add kind.
(debug_names::write_one_signatured_type): New.
(write_debug_names): Move dwarf5_offset_size to debug_names.
Use debug_names::write_one_signatured_type for type units.
Joel Brobecker [Thu, 14 Dec 2017 05:05:24 +0000 (00:05 -0500)]
Ada: unable to compare strings (Attempt to compare array with non-array)
Consider the following Ada Code:
type Str is new String (1 .. 4);
My_str : Str := "ABCD";
This simply declares a 4-character string type. Trying to perform
equality tests using it currently yield an error:
(gdb) p my_str = my_str
Attempt to compare array with non-array
(gdb) p my_str = "ABCD"
Attempt to compare array with non-array
The error occurs because my_str is defined as an object whose
type is a typdef to a TYPE_CODE_ARRAY, which ada_value_equal
is not expecting at all (yet). This patch fixes this oversight.
gdb/ChangeLog:
* ada-lang.c (ada_value_equal): Add handling of typedef types
when comparing array objects.
gdb/testsuite/ChangeLog:
* gdb.ada/str_binop_equal: New testcase.
Tested on x86_64-linux.
Joel Brobecker [Thu, 14 Dec 2017 03:36:42 +0000 (22:36 -0500)]
(Ada) Add support for task switching when debugging core files
The reasons for not supporting task switching when debugging core files
appear to now mostly be OBE. In particular, on GNU/Linux, the thread
layer is now able to retrieve the same thread info as in the live
process. So, this patch is mostly about just removing the guard
that limited the use of task switching to live processes.
gdb/ChangeLog:
* ada-tasks.c (read_atcb): Properly set task_info->ptid
when !target_has_execution as well.
(task_command): Remove error when !target_has_execution.
gdb/testsuite/ChangeLog:
* gdb.ada/task_switch_in_core: New testcase.
GDB Administrator [Thu, 14 Dec 2017 00:00:20 +0000 (00:00 +0000)]
Automatic date update in version.in
Jim Wilson [Wed, 13 Dec 2017 22:59:42 +0000 (14:59 -0800)]
Add missing RISC-V fsrmi and fsflagsi instructions.
PR 22599
gas/
* testsuite/gas/riscv/fsxxi.d, testsuite/gas/riscv/fsxxi.s: New.
opcodes/
* riscv-opc.c (riscv_opcodes) <fsrmi, fsflagsi>: New.
Simon Marchi [Wed, 13 Dec 2017 16:37:09 +0000 (11:37 -0500)]
python: Add qualified parameter to gdb.Breakpoint
This patch adds the possibility to pass a qualified=True|False parameter
when creating a breakpoint in Python. It is equivalent to using
-qualified in a linespec. The parameter actually accepts any Python
value, and converts it to boolean using Python's standard rules for
that (https://docs.python.org/3/library/stdtypes.html#truth).
Unlike the -source/-line/-function/-label parameters, it is possible to
use -qualified with a "normal" (non-explicit) linespec. Therefore, it
is possible (unlike these other parameters) to use this new parameter
along with the spec parameter.
I updated the py-breakpoint.exp test. To be able to test multiple
locations using a namespace, I had to switch the test case to compile as
C++. If we really wanted to, we could run it as both C and C++, but
omit the C++-specific parts when running it as C.
gdb/ChangeLog:
* location.h (string_to_event_location): Add match_type
parameter.
* location.c (string_to_event_location): Likewise.
* python/py-breakpoint.c (bppy_init): Handle qualified
parameter.
gdb/doc/ChangeLog:
* python.texi (Manipulating breakpoints using Python): Document
qualified parameter to gdb.Breakpoint.
gdb/testsuite/ChangeLog:
* gdb.python/py-breakpoint.c (foo_ns::multiply): New function.
* gdb.python/py-breakpoint.exp: Compile the test case as c++,
call test_bkpt_qualified.
(test_bkpt_qualified): New proc.
Pedro Alves [Wed, 13 Dec 2017 16:38:50 +0000 (16:38 +0000)]
Tighten regexp of lib/completion-support.exp:test_gdb_complete_tab_multiple
While writing the tests included in the previous commit, I noticed
that test_gdb_complete_tab_multiple would not FAIL if GDB happens to
show more completions than expected before the expected list.
E.g., with something like this, expecting "p foo" to complete to
"foo2" and "foo3":
test_gdb_complete_tab_multiple "p foo" "" {
"foo2"
"foo3"
}
and then if foo actually completes to:
(gdb) p foo[TAB]
foo1 foo2 foo3
^^^^
we'd still PASS. (Note the spurious "foo1" above.)
This tightens the regexp with a beginning anchor thus making the
completions above cause a FAIL. Other similar functions in
completion-support.exp already do something like this; I had just
missed this one originally. Thankfully, this did not expose any
problems in the gdb.linespec/ tests. Phew.
gdb/testsuite/ChangeLog:
2017-12-13 Pedro Alves <palves@redhat.com>
* lib/completion-support.exp (test_gdb_complete_tab_multiple):
Tighten regexp by matching with an anchor.
Pedro Alves [Wed, 13 Dec 2017 16:38:50 +0000 (16:38 +0000)]
Fix regression: expression completer and scope operator (PR gdb/22584)
I noticed this regression in the expression completer:
"(gdb) p std::[TAB]" => "(gdb) p std::std::"
obviously we should have not completed to "std::std::".
The problem is that in the earlier big completer rework, I missed
taking into account the fact that with expressions, the completion
word point is not always at the start of the symbol name (it is with
linespecs).
The fix is to run the common prefix / LCD string (what readline uses
to expand the input line) through make_completion_match_str too.
New testcase included, exercising both TAB completion and the complete
command.
gdb/ChangeLog:
2017-12-13 Pedro Alves <palves@redhat.com>
* completer.c (completion_tracker::maybe_add_completion): New
'text' and 'word' parameters. Use make_completion_match_str.
(completion_tracker::add_completion): New 'text' and 'word'
parameters. Pass down.
(completion_tracker::recompute_lowest_common_denominator): Change
parameter type to gdb::unique_xmalloc_ptr rval ref. Adjust.
* completer.h (completion_tracker::add_completion): New 'text' and
'word' parameters.
(completion_tracker::recompute_lowest_common_denominator): Change
parameter type to gdb::unique_xmalloc_ptr rval ref.
(completion_tracker::recompute_lowest_common_denominator): Change
parameter type to gdb::unique_xmalloc_ptr rval ref.
* symtab.c (completion_list_add_name): Pass down 'text' and 'word'
as well.
gdb/testsuite/ChangeLog:
2017-12-13 Pedro Alves <palves@redhat.com>
* gdb.cp/cpcompletion.exp: Load completion-support.exp.
("expression with namespace"): New set of tests.
* gdb.cp/pr9594.cc (Test_NS::foo, Test_NS::bar)
(Nested::Test_NS::qux): New.
* lib/completion-support.exp (test_gdb_complete_cmd_multiple): Add
defaults to 'start_quote_char' and 'end_quote_char' parameters.
Pedro Alves [Wed, 13 Dec 2017 16:38:49 +0000 (16:38 +0000)]
Factor out final completion match string building
We have several places doing essentially the same thing; factor them
out to a central place. Some of the places overallocate for no good
reason, or use strcat unnecessarily. The centralized version is more
precise and to the point.
(I considered making the gdb::unique_xmalloc_ptr overload version of
make_completer_match_str try to realloc (not xrealloc) probably
avoiding an allocation in most cases, but that'd be probably overdoing
it, and also, now that I'm writing this I thought I'd try to see how
could we ever get to filename_completer with "text != word", but I
couldn't figure it out. Running the testsuite with 'gdb_assert (text
== word);' never tripped on the assertion either. So post gdb 8.1,
I'll probably propose a patch to simplify filename_completer a bit,
and the gdb::unique_xmalloc_str overload can be removed then.)
gdb/ChangeLog:
2017-12-13 Pedro Alves <palves@redhat.com>
* cli/cli-decode.c (complete_on_cmdlist, complete_on_enum): Use
make_completion_match_str.
* completer.c: Use gdb::unique_xmalloc_ptr and
make_completion_match_str.
(make_completion_match_str_1): New.
(make_completion_match_str(const char *, const char *,
const char *)): New.
(make_completion_match_str(gdb::unique_xmalloc_ptr<char> &&,
const char *, const char *)): New.
* completer.h (make_completion_match_str(const char *,
const char *, const char *)): New.
(make_completion_match_str(gdb::unique_xmalloc_ptr<char> &&,
const char *, const char *)): New.
* interps.c (interpreter_completer): Use make_completion_match_str.
* symtab.c (completion_list_add_name, add_filename_to_list): Use
make_completion_match_str.
Simon Marchi [Wed, 13 Dec 2017 16:26:51 +0000 (11:26 -0500)]
python doc: Rework Breakpoint.__init__ doc
I find the documentation of the gdb.Breakpoint constructor hard to read
and not very informative, especially since we have added the new
linespec parameters. There are multiple problems (some are subjective):
- It's not clear that you should use either the spec string or the
explicit arguments, not both.
- It's not clear what combination of parameters you can use.
- The big block of text describing the arguments is hard to read.
- Currently, it seems like the "spec" argument is mandatory, even though
it is not (if you use explicit linespec).
- The square bracket nesting
[arg1 [, arg2[, arg3]]]
makes it seems like if you specify arg3, you must specify arg1 and
arg2 (it's not the case here).
This patch tries to address these problems.
gdb/doc/ChangeLog:
* python.texi (Manipulating breakpoints using Python): Split doc
of Breakpoint.__init__ in two, split text in multiple
paragraphs, don't nest parameter square brackets.
Renlin Li [Wed, 13 Dec 2017 12:11:25 +0000 (12:11 +0000)]
[BFD][AARCH64]Disallow R_AARCH64_ABS32(LP64) & R_AARCH64_ABS16 in const section of shared object.
R_AARCH64_ABS64, R_AARCH64_ABS32 and R_AARCH64_ABS16 are data relocations
supported in AArch64 elf ABI.
R_AARCH64_ABS64 under LP64 is allowed in shared object and a dynamic relocation entry
will be generated. This allows the dynamic linker to do further symbol resolution.
R_AARCH64_ABS32 likewise is allowed in shared object, however under ILP32 abi.
The original behavior for R_AARCH64_ABS32 under LP64 is that, it's allowed
in shared object and silently resolved at static linking time.
No dynamic relocation entry is generate for it.
R_AARCH64_ABS16 is allowed in shared object under both L64 and ILP32.
It's resolved at static linking time as well.
Under LP64, the address should be 64-bit. R_AARCH64_ABS32 relocation indicates
an address that is only sized 32 bits which is meaningless in LP64 shared object.
It's useful to error out.
I have checked glibc dynamic linker code, R_AARCH64_ABS16 is not supported at all. So
R_AARCH64_ABS16 should be reject in shared object completely.
In this patch, R_AARCH64_ABS32 is rejected under LP64 in constant section of shared object.
R_AARCH64_ABS16 is rejected in constant section of shared object in both ABI.
This will sometimes provide useful information for buggy code.
Stafford Horne [Wed, 13 Dec 2017 15:00:51 +0000 (00:00 +0900)]
gdb: Fix ARI warnings in or1k-tdep.c
Fix a few issues not using the gettext _() wrapper and issues where
we are using %p directly instead of the dedicated host/target functions.
gdb/ChangeLog:
yyyy-mm-dd Stafford Horne <shorne@gmail.com>
* or1k-tdep.c (or1k_analyse_inst): Use _() wrapper for message
strings.
(or1k_unwind_pc): Use paddress() instead of %p.
(or1k_unwind_sp): Likewise.
(or1k_frame_cache): Use host_address_to_string()/paddress()
instead of %p and use _() wrapper for message strings.
Simon Marchi [Wed, 13 Dec 2017 14:33:54 +0000 (09:33 -0500)]
Fix typo in gdb_ari.sh
gdb/ChangeLog:
* contrib/ari/gdb_ari.sh: Fix typo in help.
Dimitar Dimitrov [Wed, 13 Dec 2017 13:08:50 +0000 (13:08 +0000)]
This patch enables disassembler_needs_relocs for PRU. It is needed to print correct symbols when disassembling arguments of "call" instructions with a relocation.
opcodes * disassemble.c: Enable disassembler_needs_relocs for PRU.
gas * testsuite/gas/pru/extern.s: New test for print of U16_PMEMM
relocation.
* testsuite/gas/pru/extern.d: New test driver.
Andreas Krebbel [Fri, 8 Dec 2017 16:23:56 +0000 (17:23 +0100)]
S/390: Fix (some) PIE+undef weak failures
This fixes these failures on 64 bit which currently occur when running
the Binutils testsuite with a default PIE compiler.
< FAIL: Build rdynamic-1
< FAIL: Build dynamic-1
< FAIL: Build pr22269-1
bfd/ChangeLog:
2017-12-13 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
* elf64-s390.c (elf_s390_adjust_dynamic_symbol): Use
UNDEFWEAK_NO_DYNAMIC_RELOC.
(allocate_dynrelocs): Likewise.
(elf_s390_relocate_section): Check resolved_to_zero.
(elf_s390_finish_dynamic_symbol): Don't generate runtime reloc if
UNDEFWEAK_NO_DYNAMIC_RELOC.
Joel Brobecker [Tue, 12 Dec 2017 04:51:29 +0000 (23:51 -0500)]
fix "server" command prefix handling (unexpected confirmation queries)
The "server" command prefix no longer turns confirmation queries off.
We can reproduce this with any program by tring to delete all breakpoints,
for instance:
(gdb) break main
Breakpoint 1 at 0x40049b: file /[...]/break-fun-addr1.c, line 21.
(gdb) server delete breakpoints
Delete all breakpoints? (y or n)
GDB should not be asking "Delete all breakpoints? (y or n)", but
instead just delete all breakpoints without asking for confirmation.
Looking at utils.c::defaulted_query gives a glimpse of how this feature
is expected to work:
/* Automatically answer the default value if the user did not want
prompts or the command was issued with the server prefix. */
if (!confirm || server_command)
return def_value;
So, it relies on the server_command global to be set when the "server "
command prefix is used, which is no longer the case since the following
commit:
commit
b69d38afdea34e4fecab5ea47ffe1e594e0b6233
Date: Wed Mar 9 18:25:00 2016 +0000
Subject: Command line input handling TLC
The patch was simplifying the handling for the command line, and
I believe there was just a small oversight of removing the setting
of the server_command global.
This patch restores that, and adds a testcase to make sure we test
that feature.
gdb/ChangeLog:
* event-top.c (handle_line_of_input): Set server_command.
gdb/testsuite/ChangeLog:
* gdb.base/server-del-break.c: New file.
* gdb.base/server-del-break.exp: New file.
Tested on x86_64-linux, no regression.
GDB Administrator [Wed, 13 Dec 2017 00:00:21 +0000 (00:00 +0000)]
Automatic date update in version.in
Peter Gavin [Fri, 8 Dec 2017 20:57:25 +0000 (05:57 +0900)]
sim: testsuite: add testsuite for or1k sim
This is the testsuite for the or1k sim, it tests running many of the
basic architecture instructions on the openrisc sim.
sim/testsuite/sim/or1k/ChangeLog:
2017-12-12 Peter Gavin <pgavin@gmail.com>
Stafford Horne <shorne@gmail.com>
* add.S: New file.
* alltests.exp: New file.
* and.S: New file.
* basic.S: New file.
* div.S: New file.
* ext.S: New file.
* find.S: New file.
* flag.S: New file.
* fpu.S: New file.
* jump.S: New file.
* load.S: New file.
* mac.S: New file.
* mfspr.S: New file.
* mul.S: New file.
* or.S: New file.
* or1k-asm-test-env.h: New file.
* or1k-asm-test-helpers.h: New file.
* or1k-asm-test.h: New file.
* or1k-asm.h: New file.
* or1k-test.ld: New file.
* ror.S: New file.
* shift.S: New file.
* spr-defs.h: New file.
* sub.S: New file.
* xor.S: New file.
sim/testsuite/ChangeLog:
2017-12-12 Stafford Horne <shorne@gmail.com>
Peter Gavin <pgavin@gmail.com>
* configure: Regenerated.
Stafford Horne [Fri, 8 Dec 2017 20:57:25 +0000 (05:57 +0900)]
sim: or1k: add autoconf generated files
These are separted out to make the patch easier to read and smaller.
sim/ChangeLog:
2017-12-12 Stafford Horne <shorne@gmail.com>
Peter Gavin <pgavin@gmail.com>
* configure: Regenerated.
* or1k/aclocal.m4: Generated.
* or1k/config.in: Generated.
* or1k/configure: Generated.
Stafford Horne [Fri, 8 Dec 2017 20:57:25 +0000 (05:57 +0900)]
sim: or1k: add cgen generated files
These are the simulator files generated by cgen. These are split out
from the main sim patch to make the patch easier to review and smaller.
sim/ChangeLog:
2017-12-12 Stafford Horne <shorne@gmail.com>
Peter Gavin <pgavin@gmail.com>
* or1k/arch.c: Generated.
* or1k/arch.h: Generated.
* or1k/cpu.c: Generated.
* or1k/cpu.h: Generated.
* or1k/cpuall.h: Generated.
* or1k/decode.c: Generated.
* or1k/decode.h: Generated.
* or1k/model.c: Generated.
* or1k/sem-switch.c: Generated.
* or1k/sem.c: Generated.
Stafford Horne [Fri, 8 Dec 2017 20:57:25 +0000 (05:57 +0900)]
sim: or1k: add or1k target to sim
This adds the OpenRISC 32-bit sim target. The OpenRISC sim is a CGEN
based sim so the bulk of the code is generated from the .cpu files by
CGEN. The engine decode and execute logic in mloop uses scache with
pseudo-basic-block extraction and supports both full and fast (switch)
modes.
The sim does not implement an mmu at the moment. The sim does implement
fpu instructions via the common sim-fpu implementation.
sim/ChangeLog:
2017-12-12 Stafford Horne <shorne@gmail.com>
Peter Gavin <pgavin@gmail.com>
* configure.tgt: Add or1k sim.
* or1k/README: New file.
* or1k/Makefile.in: New file.
* or1k/configure.ac: New file.
* or1k/mloop.in: New file.
* or1k/or1k-sim.h: New file.
* or1k/or1k.c: New file.
* or1k/sim-if.c: New file.
* or1k/sim-main.h: New file.
* or1k/traps.c: New file.
Peter Gavin [Fri, 8 Dec 2017 20:57:25 +0000 (05:57 +0900)]
sim: cgen: add MUL2OFSI and MUL1OFSI functions (needed for OR1K l.mul[u])
sim/common/ChangeLog:
2017-12-12 Peter Gavin <pgavin@gmail.com>
Stafford Horne <shorne@gmail.com>
* cgen-ops.h (MUL2OFSI): New function, 2's complement overflow
flag.
(MUL1OFSI): New function, 1's complement overflow flag.
Peter Gavin [Fri, 8 Dec 2017 20:57:25 +0000 (05:57 +0900)]
sim: cgen: add remainder functions (needed for OR1K lf.rem.[sd])
* sim/common/ChangeLog:
2017-12-12 Peter Gavin <pgavin@gmail.com>
Stafford Horne <shorne@gmail.com>
* cgen-accfp.c (remsf, remdf): New function.
(cgen_init_accurate_fpu): Add remsf and remdf.
* cgen-fpu.h (cgen_fp_ops): Add remsf, remdf, remxf and remtf.
* sim-fpu.c (sim_fpu_rem): New function.
* sim-fpu.h (sim_fpu_status_invalid_irx): New enum.
(sim_fpu_rem): New function.
(sim_fpu_print_status): Add case for sim_fpu_status_invalid_irx.
Stafford Horne [Fri, 8 Dec 2017 20:57:25 +0000 (05:57 +0900)]
Add gdb for or1k build
* ChangeLog:
2017-12-12 Stafford Horne <shorne@gmail.com>
* configure.ac: Remove logic adding gdb to noconfigsdirs for or1k.
* configure: Regenerate.
Cc: gcc-patches@gcc.gnu.org
Stafford Horne [Fri, 8 Dec 2017 20:57:25 +0000 (05:57 +0900)]
gdb: testsuite: Add or1k tdesc-regs.exp test support
gdb/testsuite/ChangeLog:
2017-12-12 Stafford Horne <shorne@gmail.com>
* gdb.xml/tdesc-regs.exp: Add or1k support.
Stafford Horne [Fri, 8 Dec 2017 20:57:25 +0000 (05:57 +0900)]
gdb: testsuite: Add or1k l.nop instruction
The test case requires adding a nop instruction. For or1k the
instruction is `l.nop`. This change uses the correct operation.
gdb/testsuite/ChangeLog:
2017-12-12 Stafford Horne <shorne@gmail.com>
* gdb.base/bp-permanent.c: Define nop of or1k.
Franck Jullien [Fri, 8 Dec 2017 20:57:25 +0000 (05:57 +0900)]
gdb: Add OpenRISC or1k and or1knd target support
This patch prepares the current GDB port of the OpenRISC processor from
https://github.com/openrisc/binutils-gdb for upstream merging.
Testing has been done with a cgen sim provided in a separate patch. This
has been tested with 2 toolchains. GCC [1] 5.4.0 from the OpenRISC
project with Newlib [2] and GCC 5.4.0 with Musl [3] 1.1.4.
It supports or1knd (no delay slot target).
The default target is or1k (with delay slot).
You can change the target arch with:
(gdb) set architecture or1knd
The target architecture is assumed to be or1knd
[1] https://github.com/openrisc/or1k-gcc
[2] https://github.com/openrisc/newlib
[3] https://github.com/openrisc/musl-cross
gdb/doc/ChangeLog:
2017-12-12 Stafford Horne <shorne@gmail.com>
Stefan Wallentowitz <stefan@wallentowitz.de>
Franck Jullien <franck.jullien@gmail.com>
Jeremy Bennett <jeremy.bennett@embecosm.com>
* gdb.texinfo: Add OpenRISC documentation.
gdb/ChangeLog:
2017-12-12 Stafford Horne <shorne@gmail.com>
Stefan Wallentowitz <stefan@wallentowitz.de>
Stefan Kristiansson <stefan.kristiansson@saunalahti.fi>
Franck Jullien <franck.jullien@gmail.com>
Jeremy Bennett <jeremy.bennett@embecosm.com>
* configure.tgt: Add targets for or1k and or1knd.
* or1k-tdep.c: New file.
* or1k-tdep.h: New file.
* features/Makefile: Add or1k.xml to build.
* features/or1k.xml: New file.
* features/or1k-core.xml: New file.
* features/or1k.c: Generated.
Alan Modra [Mon, 11 Dec 2017 07:01:11 +0000 (17:31 +1030)]
PR22576, ppc64_skip_trampoline_code uses wrong r2 for EXEC_REVERSE
The TOC pointer register, r2, on powerpc64 is generally not mentioned
in debug info. It is saved and restored by call linkage code, and
set to the callee value either by call stub code (ELFv1) or in the
callee global entry point code (ELFv2). A call stub uses the caller
TOC pointer to access the PLT. So for gdb to read the correct PLT
entry in order to determine the destination of the trampoline, gdb
needs to know the caller r2. When skipping over trampolines in the
normal forward direction, the caller r2 is simply the current value of
r2 (at the start of the trampoline). However, when reversing over
trampolines the current value of r2 is that for the callee. Using
that value results in wild reads of memory rather than the correct PLT
entry.
This patch corrects the value of r2 by using the value saved on the
stack for reverse execution. Note that in reverse execution mode it
isn't really necessary for skip_trampoline_code to return the actual
destination, so we're doing a little more work than needed here. Any
non-zero return value would do (and it would be nicer if the interface
was changed to return the start of the stub).
PR tdep/22576
* ppc64-tdep.c (ppc64_plt_entry_point): Rewrite to take TOC-relative
PLT offset, and retrieve r2 from stack when executing in reverse.
(ppc64_standard_linkage1_target): Drop pc param. Calculate offset
rather than PLT address.
(ppc64_standard_linkage2_target): Likewise.
(ppc64_standard_linkage3_target): Likewise.
(ppc64_standard_linkage4_target): Likewise.
(ppc64_skip_trampoline_code_1): Adjust to suit.
Simon Marchi [Tue, 12 Dec 2017 02:05:30 +0000 (21:05 -0500)]
remote: Return NULL extra_info/name if they are empty
Commit
remote: C++ify thread_item and threads_listing_context
21fe1c752e254167d953fa8c846280f63a3a5290
broke the test gdb.threads/names.exp. The problem is that since we now
use an std::string to hold the extra_info, an empty string is returned
by target_extra_thread_info to print_thread_info_1 when the remote stub
didn't send any extra info, instead of NULL before. Because of that,
print_thread_info_1 prints the extra info between parentheses, which
results in some spurious empty parentheses.
Expected: * 1 Thread 22752.22752 "main" all_threads_ready () at ...
Actual : * 1 Thread 22752.22752 "main" () all_threads_ready () a ...
Since the bug was introduced by a behavior change in the remote target,
I chose to fix it on the remote target side by making it return NULL
when the extra string is empty. This will avoid possibly changing the
behavior of the common code and affecting other targets.
The name field has the same problem. If a remote stub returns no thread
names, remote_thread_name will return an empty string instead of NULL,
so print_thread_info_1 will show empty quotes ("") instead of nothing.
gdb/ChangeLog:
PR gdb/22556
* remote.c (remote_thread_name): Return NULL if name is empty.
(remote_threads_extra_info): Return NULL if extra info is empty.
Alan Modra [Tue, 12 Dec 2017 00:26:23 +0000 (10:56 +1030)]
Don't mask X_add_number containing a register number
It's obviously wrong to mask SPRs to 8 bits.
PR 21118
* config/tc-ppc.c (md_assemble): Don't mask register number.
GDB Administrator [Tue, 12 Dec 2017 00:00:33 +0000 (00:00 +0000)]
Automatic date update in version.in
Stephen Crane [Mon, 11 Dec 2017 22:58:38 +0000 (14:58 -0800)]
Add plugin API for processing plugin-added input files
Gold plugins may wish to further process an input file added by a plugin. For
example, the plugin may need to assign a unique segment for sections in a
plugin-generated input file. This patch adds a plugin callback that the linker
will call when reading symbols from a new input file added after the
all_symbols_read event (i.e. an input file added by a plugin).
2017-12-11 Stephen Crane <sjc@immunant.com>
* plugin-api.h: Add new plugin hook to allow processing of input
files added by a plugin.
(ld_plugin_new_input_handler): New function hook type.
(ld_plugin_register_new_input): New interface.
(LDPT_REGISTER_NEW_INPUT_HOOK): New enum val.
(tv_register_new_input): New member.
* plugin.cc (Plugin::load): Include hooks for register_new_input
in transfer vector.
(Plugin::new_input): New function.
(register_new_input): New function.
(Plugin_manager::claim_file): Call Plugin::new_input if in
replacement phase.
* plugin.h (Plugin::set_new_input_handler): New function.
* testsuite/plugin_new_section_layout.c: New plugin to test
new_input plugin API.
* testsuite/plugin_final_layout.sh: Add new input test.
* testsuite/Makefile.am (plugin_layout_new_file): New test case.
* testsuite/Makefile.in: Regenerate.
Renlin Li [Mon, 11 Dec 2017 15:33:18 +0000 (15:33 +0000)]
[Binutils][Objdump]Check symbol section information while search a mapping symbol backward.
When checking mapping symbols backwardly, the section which defines the symbol
is not considerted. This patch fixes this by moving the section checking code
into get_sym_code_type () function which is shared by forward and backword
mapping symbol searching.
opcodes/
2017-12-11 Petr Pavlu <petr.pavlu@arm.com>
Renlin Li <renlin.li@arm.com>
* aarch64-dis.c (print_insn_aarch64): Move symbol section check ...
(get_sym_code_type): Here.
binutils/
2017-12-11 Renlin Li <renlin.li@arm.com>
* testsuite/binutils-all/aarch64/objdump.d: New.
* testsuite/binutils-all/aarch64/objdump.s: New.
Pedro Alves [Mon, 11 Dec 2017 13:24:32 +0000 (13:24 +0000)]
Unbreak build for non-ELF ports
As reported at
<https://sourceware.org/ml/gdb-patches/2017-12/msg00229.html>, this
commit:
~~~~
commit
abccd1e7b7a37385159610ca4e0bc2632a547e9a
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
AuthorDate: Fri Dec 8 22:44:11 2017 +0000
Change dwarf2_initialize_objfile's return value
dwarf2_initialize_objfile was returning boolean whether it is psymtabs
or .gdb_index while now it needs to return also whether it is
.debug_names.
~~~~
breaks non-ELF-target builds:
dwarf2read.o: In function `dwarf2_initialize_objfile(objfile*)':
/home/yao.qi/SourceCode/gnu/binutils-gdb/gdb/dwarf2read.c:6486:
undefined reference to `elf_sym_fns_gdb_index'
/home/yao.qi/SourceCode/gnu/binutils-gdb/gdb/dwarf2read.c:6490:
undefined reference to `elf_sym_fns_debug_names'
/home/yao.qi/SourceCode/gnu/binutils-gdb/gdb/dwarf2read.c:6495:
undefined reference to `elf_sym_fns_lazy_psyms'
collect2: error: ld returned 1 exit status
Makefile:1920: recipe for target 'gdb' failed
because gdb/elfread.c is not included in the gdb build unless bfd also
includes elf support.
Fix this by reverting the patch mentioned above and at the same time
re-adding .debug_names support by adding a new output parameter to
dwarf2_initialize_objfile to indicate the index variant in use. We
can reuse the new dw_index_kind enum in dwarf2read.c for that.
gdb/ChangeLog:
2017-12-11 Pedro Alves <palves@redhat.com>
* defs.h (elf_sym_fns_lazy_psyms, elf_sym_fns_gdb_index)
(elf_sym_fns_debug_names): Move to elfread.c.
* dwarf2read.c (dwarf2_initialize_objfile): Return a boolean
instead of a sym_fns and add 'index_kind' output parameter. Fill
the latter in with the index variant kind if using an index.
(enum dw_index_kind): Moved to symfile.h.
* elfread.c (elf_sym_fns_gdb_index, elf_sym_fns_debug_names)
(elf_sym_fns_lazy_psyms): Move from defs.h.
(elf_symfile_read): Adjust to new dwarf2_initialize_objfile
interface.
* symfile.h (enum class dw_index_kind): New, moved from
dwarf2read.c.
(dwarf2_initialize_objfile): Change prototype.
Ulrich Weigand [Mon, 11 Dec 2017 14:26:26 +0000 (15:26 +0100)]
[MPFR] Fix regression on 32-bit host systems
When converting parts of the mantissa to MPFR, we need to make sure to do
an *unsigned* conversion. Since we convert at most 32 bits at a time,
stored in an unsigned long, this doesn't matter on systems where "long"
is larger than 32 bits. But on systems where it is 32 bits, we can get
conversion errors.
gdb/ChangeLog
2017-12-11 Ulrich Weigand <uweigand@de.ibm.com>
* target-float.c (mpfr_float_ops::from_target): Use mpfr_set_ui
instead of mpfr_set_si to convert mantissa bits.
Joel Brobecker [Mon, 11 Dec 2017 05:55:36 +0000 (00:55 -0500)]
Adapt gdb.ada/variant_record_packed_array.exp to accept reordered components
Recent versions of GNAT are capable of reordering record components
to make their access for efficient. This patch adapts this test to
accept both cases (reordered or not).
gdb/testsuite/ChangeLog:
* gdb.ada/variant_record_packed_array.exp: Adapt test to accept
output with components being reordered.
Tested on x86_64-linux.
Xavier Roirand [Mon, 11 Dec 2017 05:22:14 +0000 (00:22 -0500)]
(Ada) change tagged types base_address computation
There was a difference between C++ dispatch table and Ada's in the
way the Offset_To_Top field is used to determined the base address
of an object:
* in C++ it is a negative offset, so converting abstract interface to
deriving object requires adding this offset to “this”;
* in Ada, it was a positive offset, so the same conversion required
subtracting the offset value.
So in ada, the base address for a tagged type was computed using this formula:
base_address = value_address (obj) - offset_to_top;
The offset_to_top value was previously set to 0 or a positive value.
With recent version of AdaCore's GNAT compiler, the offset has been
changed to match C++, which means it's set to zero or a negative value
As a result, the new formula has to be:
base_address = value_address (obj) + offset_to_top;
Because we want to support old code compiled before GNAT compiler change
done in 19.0w (
20171023-64) with this version and future versions of gdb,
then we change the sign of the offset_to_top if required. Required here
means if offset_to_top is positive since it indicates that the code has
been compiled with an old GNAT compiler.
This patch changes the formula as described above.
Also, one side-effect of offset_to_top now being negative is that
we now have to worry about the sign when we read its value from the
inferior. Up to now, we have been reading its value using the data
address builtin type. But since addresses are not always signed, we
now need to make sure we use the proper type (type Storage_Offset
from System.Storage_Elements). Ideally, we would be looking this type
up from the inferior, and then use that type. However, it is not
guaranteed that this type always be described in the debugging
information, so this patch just builds our own, adding it to Ada's
list of primitive types.
gdb/ChangeLog:
* ada-lang.c (ada_tag_value_at_base_address): Change the way
tagged type base address is computed.
(enum ada_primitive_types) <ada_primitive_type_storage_offset>:
New enumerate.
(ada_language_arch_info): Set the ada_primitive_type_storage_offset
element of lai->primitive_type_vector.
Tested on x86_64-linux. Fixes the following tests when using the newer
version of the compiler.
gdb.ada/iwide.exp: print My_Drawable
gdb.ada/iwide.exp: print d_access.all
gdb.ada/iwide.exp: print dp_access.all
gdb.ada/mi_interface.exp: create ggg1 varobj (unexpected output)
gdb.ada/mi_interface.exp: list ggg1's children (unexpected output)
gdb.mi/mi-var-rtti.exp: run to mi-var-rtti.cc:63 (set breakpoint) (unexpected output)
gdb.mi/mi-var-rtti.exp: run to mi-var-rtti.cc:63 (set breakpoint)
Joel Brobecker [Mon, 11 Dec 2017 05:16:31 +0000 (00:16 -0500)]
Adapt gdb.ada/pkd_arr_elem.exp to accept reordered components
Recent versions of GNAT are capable of reordering record components
to make their access for efficient. This patch adapts this test to
accept both cases (reordered or not).
gdb/testsuite/ChangeLog:
* gdb.ada/pkd_arr_elem.exp: Adapt "print test" test to accept
output with components being reordered.
GDB Administrator [Mon, 11 Dec 2017 00:00:20 +0000 (00:00 +0000)]
Automatic date update in version.in
Sangamesh Mallayya [Sun, 10 Dec 2017 21:47:15 +0000 (08:17 +1030)]
Typo fix
Entirely the fault of that Alan Modra bloke.
* bfd.c (bfd_get_sign_extend_vma): Correct typo.
GDB Administrator [Sun, 10 Dec 2017 00:00:26 +0000 (00:00 +0000)]
Automatic date update in version.in
GDB Administrator [Sat, 9 Dec 2017 00:00:14 +0000 (00:00 +0000)]
Automatic date update in version.in
Pedro Alves [Fri, 8 Dec 2017 22:44:14 +0000 (22:44 +0000)]
dwarf2read.c: Rewrite/simplify mock_mapped_index
Now that dw2_expand_symtabs_matching_symbol works with the abstract
mapped_index_base, we can make mock_mapped_index inherit
mapped_index_base too instead of having it pretend to be a real
.gdb_index table.
gdb/ChangeLog:
2017-12-08 Pedro Alves <palves@redhat.com>
* dwarf2read.c (mock_mapped_index): Reimplement as an extension of
mapped_index_base.
(check_match): Adjust to use mock_index directly.
(check_find_bounds_finds)
(test_mapped_index_find_name_component_bounds): Adjust to work
with a mapped_index_base.
Pedro Alves [Fri, 8 Dec 2017 22:44:13 +0000 (22:44 +0000)]
Support wildmatching in .debug_names too.
dw2_debug_names_expand_symtabs_matching currently doesn't support
symbol_name_match_type::WILD, it always matches symbol names fully.
The .gdb_index code supports via dw2_expand_symtabs_matching_symbol,
which builds the mapped_index::name_components table on demand, and
then binary searches that table.
The .debug_names names index is pretty much the same as the .gdb_index
names index, i.e., a list of fully-qualified names with no
parameter/overload info. (There's no
what-is-the-language-of-symbol-name info in .debug_names either,
unfortunately.)
So this fixes .debug_names by factoring out the related .gdb_index
code out of the mapped_index class to a base class that is inherited
by both the .gdb_index (mapped_index) and .debug_names
(mapped_debug_names) map classes.
gdb/ChangeLog:
2017-12-08 Pedro Alves <palves@redhat.com>
* dwarf2read.c (struct mapped_index_base): New, partially factored
out from ...
(struct mapped_index): ... this. Inherit mapped_index_base.
(mapped_index::symbol_name_slot_invalid):
(mapped_index::symbol_name_at): Add override marker.
(mapped_index::symbol_name_count): New.
(struct mapped_debug_names): Inherit mapped_index_base.
(mapped_debug_names::symbol_name_at): New.
(mapped_debug_names::symbol_name_count): New.
(mapped_index::find_name_components_bounds): Rename to ...
(mapped_index_base::find_name_components_bounds): ... this.
(mapped_index::build_name_components): Rename to ...
(mapped_index_base::build_name_components): ... this. Adjust to
use mapped_index_base::symbol_name_count and
mapped_index_base::symbol_name_slot_invalid.
(dw2_expand_symtabs_matching_symbol): Take a mapped_index_base
instead of a mapped_index. Use
dw2_expand_symtabs_matching_symbol.
Pedro Alves [Fri, 8 Dec 2017 22:44:13 +0000 (22:44 +0000)]
dwarf2read.c:mapped_index, use gdb::array_view, simplify symbol table
This replaces a couple ptr+size pairs with gdb::array_view in the
.gdb_index code, and simplifies things by using an aggregate for the
type of the symbol table hash bucket instead of having to consider the
distinction between size of table vs number of slots and access name
vs vec by index.
gdb/ChangeLog:
2017-12-08 Pedro Alves <palves@redhat.com>
* dwarf2read.c (mapped_index::symbol_table_slot): New.
(mapped_index::address_table): Now a gdb::array_view of const
gdb_byte.
(mapped_index::symbol_table): Now a gdb::array_view of
symbol_table_slot.
(mapped_index::address_table_size)
(mapped_index::symbol_table_slots): Delete.
(create_addrmap_from_index): Adjust.
(find_slot_in_mapped_hash): Adjust.
(read_index_from_section): Adjust.
(dwarf2_read_index): Adjust.
Jan Kratochvil [Fri, 8 Dec 2017 22:44:12 +0000 (22:44 +0000)]
DWARF-5: .debug_names index consumer
Some testcases needed to be updated as they were missing
.debug_aranges. While that does not matter for no-index (as GDB
builds the mapping internally during dwarf2_build_psymtabs_hard) and
neither for .gdb_index (as GDB uses that internally built mapping
which it stores into .gdb_index) it does matter for .debug_names as
that simply assumes existing .debug_aranges from GCC.
gdb/ChangeLog:
2017-12-08 Jan Kratochvil <jan.kratochvil@redhat.com>
Pedro Alves <palves@redhat.com>
* defs.h (elf_sym_fns_debug_names): New declaration.
* dwarf2read.c: Include "hash_enum.h".
(mapped_debug_names): New.
(struct dwarf2_per_objfile): Add debug_names, debug_aranges and
debug_names_table.
(dwarf2_elf_names): Add ".debug_names" and ".debug_aranges".
(struct dwz_file): Add debug_names.
(dwarf2_per_objfile::locate_sections): Handle debug_names and
debug_aranges.
(locate_dwz_sections): Handle debug_names.
(create_signatured_type_table_from_debug_names)
(create_addrmap_from_aranges): New.
(dwarf2_read_index): Update function comment.
(dwarf5_augmentation): Moved up.
(read_debug_names_from_section, create_cus_from_debug_names_list)
(create_cus_from_debug_names, dwarf2_read_debug_names): New.
(dwarf5_djb_hash): Moved up.
(dw2_debug_names_iterator): New.
(read_indirect_string_at_offset): New declaration.
(mapped_debug_names::namei_to_name)
(dw2_debug_names_iterator::find_vec_in_debug_names)
(dw2_debug_names_iterator::next, dw2_debug_names_lookup_symbol)
(dw2_debug_names_dump, dw2_debug_names_expand_symtabs_for_function)
(dw2_debug_names_expand_symtabs_matching, dwarf2_debug_names_functions):
New.
(dwarf2_initialize_objfile): Return also elf_sym_fns_debug_names.
(debug_names::djb_hash): Rename it to dwarf5_djb_hash.
(debug_names::build): Update djb_hash caller.
(write_debug_names): Move out and rename augmentation to
dwarf5_augmentation.
* elfread.c (elf_sym_fns_debug_names): New.
* psymtab.h (dwarf2_debug_names_functions): New declaration.
* symfile.h (struct dwarf2_debug_sections): Add debug_names and
debug_aranges.
* xcoffread.c (dwarf2_xcoff_names): Add debug_names and debug_aranges.
gdb/testsuite/ChangeLog:
2017-12-08 Jan Kratochvil <jan.kratochvil@redhat.com>
Pedro Alves <palves@redhat.com>
* gdb.base/maint.exp (check for .gdb_index): Check also for
.debug_names.
* gdb.dlang/watch-loc.c (.debug_aranges): New.
* gdb.dwarf2/dw2-case-insensitive-debug.S: Likewise.
* gdb.dwarf2/gdb-index.exp (check if index present, .gdb_index used)
(.gdb_index used after symbol reloading): Support also .debug_names.
* gdb.mi/dw2-ref-missing-frame-func.c (.debug_aranges): New.
Pedro Alves [Fri, 8 Dec 2017 22:44:12 +0000 (22:44 +0000)]
Add gdb::hash_enum
The DWARF-5 .debug_names consumer patch will want to use an
std::unordered_map with an enum as key type, like:
std::unordered_map<sect_offset, dwarf2_per_cu_data*>
That doesn't work in C++11 in non-recent compilers due to a language
defect:
http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2148
~~~
In file included from /usr/include/c++/5.3.1/bits/hashtable.h:35:0,
from /usr/include/c++/5.3.1/unordered_set:47,
from src/gdb/dwarf2read.c:79:
/usr/include/c++/5.3.1/bits/hashtable_policy.h: In instantiation of ‘struct std::__detail::__is_noexcept_hash<sect_offset, std::hash<sect_offset> >’:
/usr/include/c++/5.3.1/type_traits:137:12: required from ‘struct std::__and_<std::__is_fast_hash<std::hash<sect_offset> >, std::__detail::__is_noexcept_hash<sect_offset, std::hash<sect_offset> > >’
/usr/include/c++/5.3.1/type_traits:148:38: required from ‘struct std::__not_<std::__and_<std::__is_fast_hash<std::hash<sect_offset> >, std::__detail::__is_noexcept_hash<sect_offset, std::hash<sect_offset> > > >’
/usr/include/c++/5.3.1/bits/unordered_map.h:100:66: required from ‘class std::unordered_map<sect_offset, dwarf2_per_cu_data*>’
src/gdb/dwarf2read.c:3260:30: required from here
/usr/include/c++/5.3.1/bits/hashtable_policy.h:85:34: error: no match for call to ‘(const std::hash<sect_offset>) (const sect_offset&)’
noexcept(declval<const _Hash&>()(declval<const _Key&>()))>
^
In file included from /usr/include/c++/5.3.1/bits/move.h:57:0,
from /usr/include/c++/5.3.1/bits/stl_pair.h:59,
from /usr/include/c++/5.3.1/bits/stl_algobase.h:64,
from /usr/include/c++/5.3.1/bits/char_traits.h:39,
from /usr/include/c++/5.3.1/string:40,
from /home/pedro/gdb/mygit/src/gdb/common/common-utils.h:23,
from /home/pedro/gdb/mygit/src/gdb/common/common-defs.h:78,
from /home/pedro/gdb/mygit/src/gdb/defs.h:28,
from /home/pedro/gdb/mygit/src/gdb/dwarf2read.c:31:
~~~
This commits adds a helper replacement.
gdb/ChangeLog:
2017-12-08 Pedro Alves <palves@redhat.com>
* common/hash_enum.h: New file.
Jan Kratochvil [Fri, 8 Dec 2017 22:44:11 +0000 (22:44 +0000)]
Refactor: Move some generic code out of .gdb_index code
Preparation for the next patch.
gdb/ChangeLog
2017-12-08 Jan Kratochvil <jan.kratochvil@redhat.com>
* dwarf2read.c (create_cu_from_index_list): New from ...
(create_cus_from_index_list): ... this function, use it.
(dw_expand_symtabs_matching_file_matcher)
(dw2_expand_symtabs_matching_one): New from ...
(dw2_expand_symtabs_matching): ... this function, use them.
Jan Kratochvil [Fri, 8 Dec 2017 22:44:11 +0000 (22:44 +0000)]
Change dwarf2_initialize_objfile's return value
dwarf2_initialize_objfile was returning boolean whether it is psymtabs
or .gdb_index while now it needs to return also whether it is
.debug_names.
gdb/ChangeLog
2017-12-08 Jan Kratochvil <jan.kratochvil@redhat.com>
* defs.h (elf_sym_fns_lazy_psyms, elf_sym_fns_gdb_index): Move here
declarations from elfread.c.
(dwarf2_initialize_objfile): Change return value.
* elfread.c (elf_sym_fns_lazy_psyms, elf_sym_fns_gdb_index): Move these
declarations to defs.h.
(elf_symfile_read): Adjust dwarf2_initialize_objfile caller.
* symfile.h (dwarf2_initialize_objfile): Change return type.
Jan Kratochvil [Fri, 8 Dec 2017 22:44:10 +0000 (22:44 +0000)]
DWARF-5: .debug_names index producer
This adds a new "-dwarf-5" switch to "save gdb-index" that makes it
generate index files with DWARF-5 .debug_names/.debug_str sections
instead of GDB's own .gdb_index.
We should probably add a command line option to
contrib/gdb-add-index.sh (incl. cc-with-tweaks.sh) for the new
-dwarf-5 GDB option, and a new target board to make it more convenient
to exercise this. To be done later.
gdb/ChangeLog
2017-12-08 Jan Kratochvil <jan.kratochvil@redhat.com>
Pedro Alves <palves@redhat.com>
* contrib/gdb-add-index.sh (index): Rename to ...
(index4): ... here.
(index5, debugstr, debugstrmerge, debugstrerr): New variables.
Support also .debug_names and .debug_str.
* dwarf2read.c: Include cmath, set, list.
(INDEX_SUFFIX): Rename to ...
(INDEX4_SUFFIX): ... here.
(INDEX5_SUFFIX, DEBUG_STR_SUFFIX): New.
(file_write(FILE *, const void *, size_t)): New.
(file_write(FILE *, const std::vector<Elem, Alloc> &)): New.
(data_buf::append_unsigned_leb128, data_buf::empty): New.
(data_buf::file_write): Use ::file_write.
(data_buf::c_str, dwarf5_djb_hash, debug_names)
(check_dwarf64_offsets): New.
(psyms_seen_size, write_gdbindex): New from
write_psymtabs_to_index code.
(dwarf5_gdb_augmentation, write_debug_names, assert_file_size)
(enum dw_index_kind): New.
(write_psymtabs_to_index): New parameter index_kind. Support
filename_str and out_file_str. Move code to write_gdbindex,
possibly call write_debug_names.
(save_gdb_index_command): New parameter -dwarf-5.
(_initialize_dwarf2_read): Document the new parameter -dwarf-5.
gdb/doc/ChangeLog
2017-12-08 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.texinfo (Index Files): Document .debug_names and -dwarf-5.
--
gdb/contrib/gdb-add-index.sh | 53 ++
gdb/doc/gdb.texinfo | 24 +
gdb/dwarf2read.c | 919 ++++++++++++++++++++++++++++++++++++++++--
3 files changed, 935 insertions(+), 61 deletions(-)
Jan Kratochvil [Fri, 8 Dec 2017 22:44:10 +0000 (22:44 +0000)]
cc-with-tweaks.sh: Use gdb-add-index.sh
With DWARF-5 .debug_names, the commands to add the index to the symbol
file are more complicated, as now also .debug_str needs to be
modified.
Currently, contrib/cc-with-tweaks.sh calls objcopy to handle the '-i'
option instead of using contrib/gdb-add-index.sh which basically does
the same. To help with .debug_names, this commit makes
contrib/cc-with-tweaks.sh reuse contrib/gdb-add-index.sh instead.
A problem this ran into is whether contrib/cc-with-tweaks.sh should
fail or not when no index is produced.
Currently, contrib/cc-with-tweaks.sh is more quiet (=successful) than
contrib/gdb-add-index.sh and so with no further changes testsuite runs
with an index would "regress". This commit tries to keep the behavior
unchanged. Some cases still error with:
Ada is not currently supported by the index
But some cases (such as some trivial gdb.dwarf2/ testcases with no DWARF data
to index) produce no index while the testcases still PASS now instead of:
-PASS: gdb.arch/i386-bp_permanent.exp: stack pointer value matches
+gdb compile failed, gdb-add-index.sh: No index was created for gdb/testsuite.unix.-m64/outputs/gdb.arch/i386-bp_permanent/i386-bp_permanent
+gdb-add-index.sh: [Was there no debuginfo? Was there already an index?]
+UNTESTED: gdb.arch/i386-bp_permanent.exp: failed to compile
gdb/ChangeLog
2017-12-08 Jan Kratochvil <jan.kratochvil@redhat.com>
Pedro Alves <palves@redhat.com>
* contrib/cc-with-tweaks.sh: Change interpreter to bash, incl. initial
comment.
(GDB_ADD_INDEX): New variable.
<$want_index>: Call $GDB_ADD_INDEX.
Alan Modra [Fri, 8 Dec 2017 01:10:31 +0000 (11:40 +1030)]
Work around sparc glibc bug
* elfxx-sparc.c (_bfd_sparc_elf_relocate_section): When emitting
dynamic R_SPARC_RELATIVE for GOT entries, ensure the section
contents are zeroed.
Sergio Durigan Junior [Fri, 8 Dec 2017 20:33:55 +0000 (15:33 -0500)]
Fix thinko on dtrace-probe.c:dtrace_process_dof_probe
While investigating PR gdb/22557 ("Regression:
gdb.base/dtrace-probe.exp"), I noticed that the code is wrongly
declaring a new "expression_up" variable inside the TRY block in
"dtrace_process_dof_probe". This causes the outter "expr" variable to
be empty, which may have an impact later when evaluating the
expression.
This commit fixes that. Unfortunately the script used to test DTrace
probes (gdb/testsuite/lib/pdtrace.in) is not very reliable so I cannot
say whether this commit fixes the PR mentioned above. Nonetheless,
it's an obvious fix and should go in.
gdb/ChangeLog:
2017-12-08 Sergio Durigan Junior <sergiodj@redhat.com>
* dtrace-probe.c (dtrace_process_dof_probe): Do not declare a new
"expression_up" inside the TRY block.
Yao Qi [Fri, 8 Dec 2017 17:27:03 +0000 (17:27 +0000)]
Clear non-significant bits of address in watchpoint
Nowadays, GDB can't set watchpoint on tagged address on AArch64,
(gdb) p p2
$1 = (int *) 0xf000fffffffff474
(gdb) watch *((int *) 0xf000fffffffff474)
Hardware watchpoint 2: *((int *) 0xf000fffffffff474)
(gdb) c
Continuing.
main () at
binutils-gdb/gdb/testsuite/gdb.arch/aarch64-tagged-pointer.c:45
45 void (*func_ptr) (void) = foo;
Unexpected error setting hardware debug registers
This patch is about setting watchpoint on a tagged address. Unlike
breakpoint, watchpoint record the expression rather than the address, and
when a watchpoint is fired, GDB checks the expression value changed
instead of matching address, so we can mask the watchpoint address by
getting rid of non-significant bits of address.
gdb:
2017-12-08 Yao Qi <yao.qi@linaro.org>
* breakpoint.c (update_watchpoint): Call
address_significant.
gdb/testsuite:
2017-12-08 Yao Qi <yao.qi@linaro.org>
* gdb.arch/aarch64-tagged-pointer.c (main): Update.
* gdb.arch/aarch64-tagged-pointer.exp: Add tests for watchpoint.
Yao Qi [Fri, 8 Dec 2017 17:27:03 +0000 (17:27 +0000)]
Adjust breakpoint address by clearing non-significant bits
Tag in tagged address on AArch64 is treated as a non-significant bits of
address, which can be got by gdbarch method significant_addr_bit, and gdb
can clear these bits.
With this patch, when user sets a breakpoint on tagged address on AArch64,
GDB will drop the top byte of address, and put breakpoint at the new place,
as shown below,
(gdb) hbreak *func_ptr
warning: Breakpoint address adjusted from 0xf000000000400690 to 0x00400690.
Hardware assisted breakpoint 2 at 0x400690
(gdb) break *func_ptr
warning: Breakpoint address adjusted from 0xf000000000400690 to 0x00400690.
Breakpoint 3 at 0x400690
When program hits a breakpoint, the stopped pc reported by Linux kernel is
the address *without* tag, so it is better the address recorded in
breakpoint location is the one without tag too, so we can still match
breakpoint location address and stopped pc reported by Linux kernel, by
simple compare.
gdb:
2017-12-08 Yao Qi <yao.qi@linaro.org>
* breakpoint.c (adjust_breakpoint_address): Call
address_significant.
gdb/testsuite:
2017-12-08 Yao Qi <yao.qi@linaro.org>
* gdb.arch/aarch64-tagged-pointer.c (main): Update.
* gdb.arch/aarch64-tagged-pointer.exp: Add test for breakpoint.
Yao Qi [Fri, 8 Dec 2017 17:27:03 +0000 (17:27 +0000)]
Clear non-significant bits of address on memory access
ARMv8 supports tagged address, that is, the top one byte in address
is ignored. It is always enabled on aarch64-linux. See
https://www.kernel.org/doc/Documentation/arm64/tagged-pointers.txt
The tag in the tagged address is modeled as non-significant bits in
address, so this patch adds a new gdbarch method significant_addr_bit and
clear the non-significant bits (the top byte in ARMv8) of the virtual
address at the point before passing address to target cache layer. IOW,
the address used in the target cache layer is already cleared.
Before this patch,
(gdb) x/x 0x0000000000411030
0x411030 <global>: 0x00000000
(gdb) x/x 0xf000000000411030
0xf000000000411030: Cannot access memory at address 0xf000000000411030
After this patch,
(gdb) x/x 0x0000000000411030
0x411030 <global>: 0x00000000
(gdb) x/x 0xf000000000411030
0xf000000000411030: 0x00000000
Note that I used address_significant in paddress, but it causes a
regression gdb.base/long_long.exp, because gdb clears the non-significant
bits in address, but test still expects them.
p/a val.oct^M
$24 = 0x2ee53977053977^M
(gdb) FAIL: gdb.base/long_long.exp: p/a val.oct
so I defer the change there.
gdb:
2017-12-08 Yao Qi <yao.qi@linaro.org>
* aarch64-tdep.c (aarch64_gdbarch_init): Install gdbarch
significant_addr_bit.
* gdbarch.sh (significant_addr_bit): New.
* gdbarch.c, gdbarch.h: Re-generated.
* target.c (memory_xfer_partial): Call address_significant.
* utils.c (address_significant): New function.
* utils.h (address_significant): Declare.
2017-12-08 Yao Qi <yao.qi@linaro.org>
gdb/testsuite:
* gdb.arch/aarch64-tagged-pointer.c: New file.
* gdb.arch/aarch64-tagged-pointer.exp: New file.
Tom Tromey [Thu, 23 Nov 2017 03:17:28 +0000 (20:17 -0700)]
C++-ify parse_format_string
This replaces parse_format_string with a class, removing some
constructors along the way. While doing this, I found that one
argument to gen_printf is unused, so I removed it.
Also, I am not completely sure, but the use of `release' in
maint_agent_printf_command and parse_cmd_to_aexpr seems like it may
leak expressions.
Regression tested by the buildbot.
ChangeLog
2017-12-08 Tom Tromey <tom@tromey.com>
* printcmd.c (ui_printf): Update. Use std::vector.
* common/format.h (struct format_piece): Add constructor.
<string>: Now const.
(class format_pieces): New class.
(parse_format_string, free_format_pieces)
(free_format_pieces_cleanup): Remove.
* common/format.c (format_pieces::format_pieces): Rename from
parse_format_string. Update.
(free_format_pieces, free_format_pieces_cleanup): Remove.
* breakpoint.c (parse_cmd_to_aexpr): Update. Use std::vector.
* ax-gdb.h (gen_printf): Remove argument.
* ax-gdb.c (gen_printf): Remove "frags" argument.
(maint_agent_printf_command): Update. Use std::vector.
gdbserver/ChangeLog
2017-12-08 Tom Tromey <tom@tromey.com>
* ax.c (ax_printf): Update.
Max Filippov [Thu, 7 Dec 2017 06:52:16 +0000 (22:52 -0800)]
gas: xtensa: fix comparison of trampoline chain symbols
Don't use address where symbol gets resolved, as during section
relaxation symbols will slide, instead canonicalize symbols and check
that they are are the same.
This fixes a bug when a relaxed jump goes into the wrong trampoline.
gas/
2017-12-07 Max Filippov <jcmvbkbc@gmail.com>
* config/tc-xtensa.c (xg_order_trampoline_chain): Replace
xg_order_trampoline_chain_entry call with check for
canonicalized symbol equality and offset equality.
Sergio Durigan Junior [Thu, 7 Dec 2017 23:27:22 +0000 (18:27 -0500)]
Adjust gdb.arch/i386-sse-stack-align.exp print statement
Since:
commit
7022349d5c86bae74b49225515f42d2e221bd368
Author: Pedro Alves <palves@redhat.com>
Date: Mon Sep 4 20:21:13 2017 +0100
Stop assuming no-debug-info functions return int
We now have to explicitly tell GDB the type of the non-debug-info
function we want to print (by casting). This commit adjusts the
"print" statement on gdb.arch/i386-sse-stack-align.exp to do the
proper cast, fixing a failure that started to happen after the
mentioned commit.
gdb/testsuite/ChangeLog:
2017-12-08 Sergio Durigan Junior <sergiodj@redhat.com>
* gdb.arch/i386-sse-stack-align.exp: Cast "print" function call
"int".
Yao Qi [Fri, 8 Dec 2017 15:43:49 +0000 (15:43 +0000)]
Fix PR 22567: set SAL .section in minsym_found
PR 22567 is that breakpoint location can't correct gdbarch from SAL,
because its fields .section and .symtab is NULL. We use to have code
setting .section, but was removed by 4024cf2
- if (msymbol_is_text (msymbol))
+ CORE_ADDR func_addr;
+ if (msymbol_is_function (objfile, msymbol, &func_addr))
{
- sal = find_pc_sect_line (MSYMBOL_VALUE_ADDRESS (objfile, msymbol),
- (struct obj_section *) 0, 0);
- sal.section = MSYMBOL_OBJ_SECTION (objfile, msymbol);
this patch adds this back by moving it to the common place at the bottom
of the function.
gdb:
2017-12-08 Yao Qi <yao.qi@linaro.org>
PR breakpionts/22567
* linespec.c (minsym_found): Set sal.section.
Andreas Arnez [Fri, 8 Dec 2017 13:19:23 +0000 (14:19 +0100)]
S390: Add symfile-mem
For some reason symfile-mem.o is not included in the configuration for
"s390*-*-linux*". It was added to the configuration of most GNU/Linux
targets with a patch from Andrew Cagney:
"Add symfile-mem to all linux targets" --
https://sourceware.org/ml/gdb-patches/2005-02/msg00053.html
But the s390 target was overlooked at that time. Thus the command
"add-symbol-file-from-memory" is missing and VDSO symbols are not loaded.
This is fixed.
gdb/ChangeLog:
* configure.tgt (s390*-*-linux*): Add symfile-mem.o.
Nick Clifton [Fri, 8 Dec 2017 10:07:14 +0000 (10:07 +0000)]
Fix stripping relocs in a file with mergeable notes.
A recent Fedora bug (1520805) exposed a problem with objcopy's reloc
copying code, when a binary also contains mergeable notes. The note
merging code would delete some relocs, but then the reloc copying code
would try to put them back again, which did not work.
So I am checking in the patch below to fix the problem. The patch
also tweaks one of the binutils note merging tests so that it is
skipped for the Sparc64 target, since this has funky relocs.
binutils * objcopy.c (copy_relocations_in_section): Use the orelocations
field of the input section, if it has been initialised.
* testsuite/binutils-all/note-2-64.d: Skip test on Sparc64.
bfd * elfcode.h (elf_write_relocs): Check for an empty howto field.
Sangamesh Mallayya [Fri, 8 Dec 2017 03:17:17 +0000 (13:47 +1030)]
Add aix 64-bit check to bfd_get_sign_extend_vma
* bfd.c (bfd_get_sign_extend_vma): Handle aix5coff64-rs6000.
GDB Administrator [Fri, 8 Dec 2017 00:00:21 +0000 (00:00 +0000)]
Automatic date update in version.in
Keith Seitz [Thu, 7 Dec 2017 20:59:07 +0000 (12:59 -0800)]
Validate explicit locations with early termination
breakpoints/22569 involves an internal error generated by the rather
innocent looking command:
(gdb) break -source test.cpp main
.../linespec.c:3302: internal-error: void decode_line_full(...):
Assertion `result.size () == 1 || canonical->pre_expanded' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Quit this debugging session? (y or n)
The input string is tokenized into "-source", "test.cpp", and "main"
(input parsing breaks on whitespace). create_breakpoint is then called with
the explicit location (containing only the source file name) and "main" as
the extra_string argument.
No SaLs are created for this underspecified explicit location, and the
"result.size () == 1" evaluates false (as does the pre_expanded condition).
This triggers the assertion.
Normally string_to_explicit_location validates the input string. However,
the presence of the string "main" causes the parser to exit early:
802 else
803 {
804 /* End of the explicit location specification.
805 Stop parsing and return whatever explicit location was
806 parsed. */
807 *argp = start;
808 return location;
809 }
This bypasses the validation that is done a few lines down in this function
which would have emitted the expected error. This patch fixes that.
Additionally, this patch also fixes an inconsistency with error reporting
in this use case:
(gdb) b -source foo
Source filename requires function, label, or line offset.
(gdb) b -source foo main
No source file named foo.
These two commands should have elicited the same error message.
gdb/ChangeLog:
PR breakpoints/22569
* location.c (string_to_explicit_location): When terminating
parsing early, break out of enclosing loop instead of returning.
gdb/testsuite/ChangeLog:
PR breakpoints/22569
* gdb.linespec/ls-errs.exp: Change expected result of "break
-source this file has spaces.c -line 3".
Check that an explicit source file followed by whitespace is
identified as an invalid explicit location.
Keith Seitz [Thu, 7 Dec 2017 23:01:30 +0000 (15:01 -0800)]
Record nested types
GDB currently does not track types defined in classes. Consider:
class A
{
public:
class B
{
public:
class C { };
};
};
(gdb) ptype A
type = class A {
<no data fields>
}
This patch changes this behavior so that GDB records these nested types
and displays them to the user when he has set the (new) "print type"
option "nested-type-limit."
Example:
(gdb) set print type nested-type-limit 1
(gdb) ptype A
type = class A {
<no data fields>
class A::B {
<no data fields>
};
}
(gdb) set print type nested-type-limit 2
type = class A {
<no data fields>
class A::B {
<no data fields>
class A::B::C {
<no data fields>
};
};
}
By default, the code maintains the status quo, that is, it will not print
any nested type definitions at all.
Testing is carried out via cp_ptype_class which required quite a bit of
modification to permit recursive calling (for the nested types). This
was most easily facilitated by turning the ptype command output into a
queue. Upshot: the test suite now has stack and queue data structures that
may be used by test writers.
gdb/ChangeLog
* NEWS (New commands): Mention set/show print type nested-type-limit.
* c-typeprint.c (c_type_print_base): Print out nested types.
* dwarf2read.c (struct typedef_field_list): Rename to ...
(struct decl_field_list): ... this. Change all uses.
(struct field_info) <nested_types_list, nested_types_list_count>:
New fields.
(add_partial_symbol): Look for nested type definitions in C++, too.
(dwarf2_add_typedef): Rename to ...
(dwarf2_add_type_defn): ... this.
(type_can_define_types): New function.
Update assertion to use type_can_define_types.
Permit NULL for a field's name.
(process_structure_scope): Handle child DIEs of types that can
define types.
Copy the list of nested types into the type struct.
* gdbtypes.h (struct typedef_field): Rename to ...
(struct decl_field): ... this. Change all uses.
[is_protected, is_private]: New fields.
(struct cplus_struct_type) <nested_types, nested_types_count>: New
fields.
(TYPE_NESTED_TYPES_ARRAY, TYPE_NESTED_TYPES_FIELD)
(TYPE_NESTED_TYPES_FIELD_NAME, TYPE_NESTED_TYPES_FIELD_TYPE)
(TYPE_NESTED_TYPES_COUNT, TYPE_NESTED_TYPES_FIELD_PROTECTED)
(TYPE_NESTED_TYPES_FIELD_PRIVATE): New macros.
* typeprint.c (type_print_raw_options, default_ptype_flags): Add
default value for print_nested_type_limit.
(print_nested_type_limit): New static variable.
(set_print_type_nested_types, show_print_type_nested_types): New
functions.
(_initialize_typeprint): Register new commands for set/show
`print-nested-type-limit'.
* typeprint.h (struct type_print_options) [print_nested_type_limit]:
New field.
gdb/testsuite/ChangeLog
* gdb.cp/nested-types.cc: New file.
* gdb.cp/nested-types.exp: New file.
* lib/cp-support.exp: Load data-structures.exp library.
(debug_cp_test_ptype_class): New global.
(cp_ptype_class_verbose, next_line): New procedures.
(cp_test_ptype_class): Add and document new parameter `recursive_qid'.
Add and document new return value.
Switch the list of lines to a queue.
Add support for new `type' key for nested type definitions.
Add debugging/troubleshooting messages.
* lib/data-structures.exp: New file.
gdb/doc/ChangeLog
* gdb.texinfo (Symbols): Document "set print type nested-type-limit"
and "show print type nested-type-limit".
Simon Marchi [Thu, 7 Dec 2017 22:37:02 +0000 (17:37 -0500)]
Fix wrong prefix in py-breakpoint.exp
The prefix in test_bkpt_explicit_loc is wrong. Instead of using
with_test_prefix directly, define test_bkpt_explicit_loc with
proc_with_prefix.
gdb/testsuite/ChangeLog:
* gdb.python/py-breakpoint.exp (test_bkpt_explicit_loc): Define
with proc_with_prefix, don't use with_test_prefix.
Tom Tromey [Fri, 3 Nov 2017 16:26:11 +0000 (10:26 -0600)]
Fix regression in "commands"
Pedro pointed out a regression in "commands", where trying to clear a
breakpoint's command list would fail:
(top-gdb) commands
Type commands for breakpoint(s) 3, one per line.
End with a line saying just "end".
>end
No breakpoints specified.
(top-gdb)
I believe the bug was introduced by my patch that changes
counted_command_line to be a shared_ptr. This causes the problem
because now the counted_command_line in commands_command_1 can be NULL,
whereas previously it never could be.
After some discussion, we agreed to simply remove the error case from
commands_command_1.
2017-12-07 Tom Tromey <tom@tromey.com>
PR breakpoints/22511:
* breakpoint.c (commands_command_1): Don't throw an exception when
no commands have been read.
2017-12-07 Tom Tromey <tom@tromey.com>
* gdb.base/break.exp: Add test for empty "commands".
Adam Stylinski [Thu, 7 Dec 2017 17:51:03 +0000 (12:51 -0500)]
Fix build with g++ 6.3.1
With g++ 6.3.1:
target-descriptions.c: In member function ‘virtual void
print_c_tdesc::visit_pre(const target_desc*)’:
target-descriptions.c:1836:16: error: types may not be defined in a
for-range-declaration [-Werror]
for (const struct bfd_arch_info *compatible : e->compatible)
^~~~~~
I think at some point the forward declaration of this struct had been
removed and declared as a typedef. This fixes that.
gdb/ChangeLog:
2017-12-07 Adam Stylinski <adam.stylinski@etegent.com>
PR c++/21222
* target-descriptions.c (print_c_tdesc::visit_pre): Change type of
range-for variable.
Yao Qi [Thu, 7 Dec 2017 17:07:01 +0000 (17:07 +0000)]
Initialize target description early in IPA
Target descriptions are allocated lazily, that is fine in GDBserver,
but it is not safe to call malloc in gdb_collect in IPA, because we
can set a fast tracepoint in malloc, and when the tracepoint is hit,
gdb_collect/malloc is called, deadlock or memory corruption may be
triggered.
#0 0xf7cfc200 in malloc ()
#1 0xf7efdc07 in operator new(unsigned int) ()
#2 0xf7ef7636 in allocate_target_description() ()
#3 0xf7efcbe1 in i386_create_target_description(unsigned long long, bool) ()
#4 0xf7efb474 in i386_linux_read_description(unsigned long long) ()
#5 0xf7efb190 in get_ipa_tdesc(int) ()
#6 0xf7ef9baa in gdb_collect ()
The fix is to initialize all target descriptions earlier, when the
IPA is loaded. In order to guarantee malloc is not called in IPA
in gdb_collect, I change the test to set a breakpoint on malloc, if
IPA gdb_collect calls malloc, program will hit the breakpoint, and
test fail.
continue
Continuing.
Thread 1 "" hit Breakpoint 5, 0xf7cfc200 in malloc ()
(gdb) FAIL: gdb.trace/ftrace.exp: advance through tracing
gdb/gdbserver:
2017-12-07 Yao Qi <yao.qi@linaro.org>
* linux-aarch64-ipa.c (initialize_low_tracepoint): Call
aarch64_linux_read_description.
* linux-amd64-ipa.c (idx2mask): New array.
(get_ipa_tdesc): Move idx2mask out.
(initialize_low_tracepoint): Initialize target descriptions.
* linux-i386-ipa.c (idx2mask): New array.
(get_ipa_tdesc): Move idx2mask out.
(initialize_low_tracepoint): Initialize target descriptions.
gdb/testsuite:
2017-12-07 Yao Qi <yao.qi@linaro.org>
* gdb.trace/ftrace.exp (run_trace_experiment): Set breakpoint on
malloc and catch syscall.
Simon Marchi [Thu, 7 Dec 2017 16:48:21 +0000 (11:48 -0500)]
Add virtual destructor to selftest
Clang 6 shows this warning
In file included from /home/emaisin/src/binutils-gdb/gdb/common/selftest.c:19:
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 'selftests::selftest' that is abstract but has 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<selftests::selftest>::operator()' requested here
get_deleter()(__ptr);
^
/home/emaisin/src/binutils-gdb/gdb/common/selftest.c:57:17: note: in instantiation of member function 'std::unique_ptr<selftests::selftest, std::default_delete<selftests::selftest> >::~unique_ptr' requested here
tests[name] = std::unique_ptr<selftest> (test);
^
The error is legitimate, we (the unique_ptr) are deleting selftest
objects through the base pointer, so technically the destructor should
be virtual, so that the destructor of the subclass is invoked.
gdb/ChangeLog:
* common/selftest.h (struct selftest): Add virtual destructor.
Phil Muldoon [Thu, 7 Dec 2017 16:47:33 +0000 (16:47 +0000)]
Implement explicit locations for Python breakpoints.
This introduces several new keywords to the bppy_init constructor.
The spec parameter is now optional but mutually exclusive to the
explicit keywords source, label, function and line.
gdb/ChangeLog
2017-12-07 Phil Muldoon <pmuldoon@redhat.com>
* python/py-breakpoint.c (bppy_init): Use string_to_event_location
over basic location code. Implement explicit location keywords.
(bppy_init_validate_args): New function.
* NEWS: Document Python explicit breakpoint locations.
doc/ChangeLog
2017-12-07 Phil Muldoon <pmuldoon@redhat.com>
* python.texi (Breakpoints In Python): Add text relating
to allowed explicit locations and keywords in gdb.Breakpoints.
testsuite/ChangeLog
2017-12-07 Phil Muldoon <pmuldoon@redhat.com>
* gdb.python/py-breakpoint.exp (test_bkpt_explicit_loc): Add new
tests for explicit locations.
Joel Brobecker [Thu, 7 Dec 2017 13:10:33 +0000 (14:10 +0100)]
gdb/MAINTAINERS: restore m68hc11, score and xstormy16 entries
This patch restores some entries removed by a recent patch whose purpose
was to update the list of active maintainers. I thought that, the target
information was purely to document the scope of the given target, and
thus could be removed is maintainerless. But, in fact, those entries
are still useful, as a number of scripts (eg: gdb_buildall.sh) use
that information to build GDB with all targets enabled.
gdb/ChangeLog:
* MAINTAINERS: Restore target entries for m68hc11-elf,
score-elf and xstormy16-elf, incorrectly removed in a previous
patch meant to only update the list of active maintainers.
Alan Modra [Thu, 7 Dec 2017 11:16:34 +0000 (21:46 +1030)]
Objcopy interleave test
PR 22465
* testsuite/ld-elf/interleave.s: Use .data sections and provide
section attrs.
* testsuite/ld-elf/interleave.ld: Discard other sections. Adjust
for changed section names.
Alan Modra [Thu, 7 Dec 2017 10:07:33 +0000 (20:37 +1030)]
mcore-elf lacks shared lib support
elf32-mcore.c has no backend create_dynamic_sections function so can't
support shared libs.
* emulparams/elf32mcore.sh (GENERATE_SHLIB_SCRIPT): Don't define.
Alan Modra [Thu, 7 Dec 2017 07:20:57 +0000 (17:50 +1030)]
Rewrite check_shared_lib_support
* testsuite/lib/ld-lib.exp (check_shared_lib_support): Ask ld
under test whether -shared is supported.
GDB Administrator [Thu, 7 Dec 2017 00:00:30 +0000 (00:00 +0000)]
Automatic date update in version.in
Pedro Alves [Wed, 6 Dec 2017 22:45:09 +0000 (17:45 -0500)]
target_set_syscall_catchpoint, use gdb::array_view and bool
I noticed that we're passing down a data/size pair to
target_ops::to_set_syscall_catchpoint. This commit makes use of
gdb::array_view instead. While at it, use bool where appropriate as
well.
gdb/ChangeLog:
* break-catch-syscall.c (insert_catch_syscall)
(remove_catch_syscall): Adjust to pass reference to
inf_data->syscalls_counts directly via gdb::array_view.
* fbsd-nat.c (fbsd_set_syscall_catchpoint): Adjust to use bool
and gdb::array_view.
* linux-nat.c (linux_child_set_syscall_catchpoint): Likewise.
* remote.c (remote_set_syscall_catchpoint): Likewise.
* target-debug.h (target_debug_print_bool): New.
(define target_debug_print_gdb_array_view_const_int): New.
* target-delegates.c: Regenerate.
* target.h (target_ops) <to_set_syscall_catchpoint>: Use
gdb::array_view and bool.
(target_set_syscall_catchpoint): Likewise.
Simon Marchi [Wed, 6 Dec 2017 21:27:33 +0000 (16:27 -0500)]
Fix syscall group completion
The test gdb.base/catch-syscall.exp has been failing since commit
3d415c26bad3a15eed00d2ddf85c4268df77a4cc
Remove cleanups from break-catch-syscall.c
The reason is that we are putting into the group_ptr array a pointer to
the buffer of the local string object. If the string is small enough to
fit in the internal string buffer (used for small string optimizations),
the pointer will point to the local object directly. So even if we
std::move the string to the vector, the pointer in group_ptr will still
point to the local object. When we reuse that object (technically a new
instance, but most likely the same memory) for the next syscall, we'll
overwrite the previous string. The result is that we'll get less
results than expected, since there will be duplicates.
We'll also run into problems if we push the string to the vector, and
then record the c_str () pointer using the string object in the vector.
The vector might get reallocated, the string may move in memory, and our
pointer in group_ptr will point to stale memory.
Instead, we have to push all the strings first, then, when we know the
vector won't change anymore, build the group_ptr array. This is what
this patch does.
gdb/ChangeLog:
* break-catch-syscall.c (catch_syscall_completer): Get pointers
to syscall group strings after building the string vector.
Jim Wilson [Wed, 6 Dec 2017 18:34:36 +0000 (10:34 -0800)]
Objcopy interleave fails if section address not multiple of interleave.
PR 22465
binutils/
* objcopy.c (copy_section): New local extra. If isection->lma not
exactly divisible by interleave, then bias from. Also adjust
osection->lma if necessary.
ld/
* testsuite/ld-elf/interleave-0.d, testsuite/ld-elf/interleave-4.d,
* testsuite/ld-elf/interleave.ld, testsuite/ld-elf/interleave.s: New.
Pedro Alves [Wed, 6 Dec 2017 11:28:47 +0000 (11:28 +0000)]
remote: Make qXfer packets respect corresponding "set remote foo-packet"
I've noticed that "set remote target-features-packet off" before
connecting has no effect -- GDB still fetches a target description
anyway.
The problem is that while most "set remote foo-packet" commands were
fixed by:
From
4082afcc3d1af9d8063d1c8e02deb34a8b97a489 Mon Sep 17 00:00:00 2001
From: Pedro Alves <palves@redhat.com>
Date: Fri, 25 Apr 2014 18:07:02 +0100
Subject: [PATCH] Fix several "set remote foo-packet on/off" commands.
<https://sourceware.org/ml/gdb-patches/2014-04/msg00006.html>
the "qXfer" packets where missed. This commit fixes that.
I've changed remote_search_memory too for consistency (seems like
those are the last direct references to packet->support), though the
difference is not observable because the qSearch:memory packet is auto
probed. Note gdb.base/find-unmapped.exp already exercises explicit
"set remote search-memory-packet off".
gdb/ChangeLog:
2017-12-06 Pedro Alves <palves@redhat.com>
* remote.c (remote_query_supported): Don't send "xmlRegisters=" if
"qXfer:features:read"" is disabled.
(remote_write_qxfer, remote_read_qxfer, remote_search_memory):
Check packet_config_support instead of packet->support directly.
gdb/testsuite/ChangeLog:
2017-12-06 Pedro Alves <palves@redhat.com>
* gdb.arch/i386-avx.exp: If testing with a RSP target, check
force-disabling XML descriptions.
--
gdb/remote.c | 16 +++++++++-------
gdb/testsuite/gdb.arch/i386-avx.exp | 25 +++++++++++++++++++++++++
2 files changed, 34 insertions(+), 7 deletions(-)
Nick Clifton [Wed, 6 Dec 2017 10:04:51 +0000 (10:04 +0000)]
Tell the linker testsuite that lm32-rtems toolchains do not support the generation of shared libraries.
* testsuite/lib/ld-lib.exp (check_shared_lib_support): Return
false for lm32-rtems targets.
Alan Modra [Wed, 6 Dec 2017 07:02:48 +0000 (17:32 +1030)]
PR22552, readelf heap buffer overflow in load_debug_section
PR 22552
* readelf.c (process_file_header): Don't assume XINDEX case
value for e_shstrndx is within bounds.
(load_debug_section): Sanity test e_shstrndx before attempting
to read .shstrtab. Wrap long lines.
Alan Modra [Tue, 5 Dec 2017 22:56:00 +0000 (09:26 +1030)]
BFD whitespace fixes
Binutils is supposed to use tabs. In my git config I have
whitespace = indent-with-non-tab,space-before-tab,trailing-space
and I got annoyed enough seeing red in "git diff" output to fix
the problems.
* doc/header.sed: Trim trailing space when splitting lines.
* aix386-core.c, * aout-adobe.c, * aout-arm.c, * aout-cris.c,
* aout-ns32k.c, * aout-target.h, * aout-tic30.c, * aoutf1.h, * aoutx.h,
* arc-got.h, * arc-plt.def, * arc-plt.h, * archive.c, * archive64.c,
* archures.c, * armnetbsd.c, * bfd-in.h, * bfd.c, * bfdio.c, * binary.c,
* bout.c, * cache.c, * cisco-core.c, * coff-alpha.c, * coff-apollo.c,
* coff-arm.c, * coff-h8300.c, * coff-i386.c, * coff-i860.c,
* coff-i960.c, * coff-m68k.c, * coff-m88k.c, * coff-mcore.c,
* coff-mips.c, * coff-ppc.c, * coff-rs6000.c, * coff-sh.c,
* coff-stgo32.c, * coff-tic4x.c, * coff-tic54x.c, * coff-tic80.c,
* coff-we32k.c, * coff-x86_64.c, * coff-z80.c, * coff-z8k.c,
* coff64-rs6000.c, * coffcode.h, * coffgen.c, * cofflink.c,
* coffswap.h, * compress.c, * corefile.c, * cpu-alpha.c, * cpu-arm.c,
* cpu-avr.c, * cpu-bfin.c, * cpu-cr16.c, * cpu-cr16c.c, * cpu-crx.c,
* cpu-d10v.c, * cpu-frv.c, * cpu-ft32.c, * cpu-i370.c, * cpu-i960.c,
* cpu-ia64-opc.c, * cpu-ip2k.c, * cpu-lm32.c, * cpu-m32r.c,
* cpu-mcore.c, * cpu-microblaze.c, * cpu-mips.c, * cpu-moxie.c,
* cpu-mt.c, * cpu-nios2.c, * cpu-ns32k.c, * cpu-or1k.c, * cpu-powerpc.c,
* cpu-pru.c, * cpu-sh.c, * cpu-spu.c, * cpu-v850.c, * cpu-v850_rh850.c,
* cpu-xgate.c, * cpu-z80.c, * dwarf1.c, * dwarf2.c, * ecoff.c,
* ecofflink.c, * ecoffswap.h, * elf-bfd.h, * elf-eh-frame.c,
* elf-hppa.h, * elf-m10200.c, * elf-m10300.c, * elf-s390-common.c,
* elf-strtab.c, * elf-vxworks.c, * elf.c, * elf32-am33lin.c,
* elf32-arc.c, * elf32-arm.c, * elf32-avr.c, * elf32-avr.h,
* elf32-bfin.c, * elf32-cr16.c, * elf32-cr16c.c, * elf32-cris.c,
* elf32-crx.c, * elf32-d10v.c, * elf32-d30v.c, * elf32-dlx.c,
* elf32-epiphany.c, * elf32-fr30.c, * elf32-frv.c, * elf32-ft32.c,
* elf32-h8300.c, * elf32-hppa.c, * elf32-i386.c, * elf32-i860.c,
* elf32-i960.c, * elf32-ip2k.c, * elf32-lm32.c, * elf32-m32c.c,
* elf32-m32r.c, * elf32-m68hc11.c, * elf32-m68hc12.c, * elf32-m68hc1x.c,
* elf32-m68hc1x.h, * elf32-m68k.c, * elf32-m88k.c, * elf32-mcore.c,
* elf32-mep.c, * elf32-metag.c, * elf32-microblaze.c, * elf32-mips.c,
* elf32-moxie.c, * elf32-msp430.c, * elf32-mt.c, * elf32-nds32.c,
* elf32-nds32.h, * elf32-nios2.c, * elf32-or1k.c, * elf32-pj.c,
* elf32-ppc.c, * elf32-ppc.h, * elf32-pru.c, * elf32-rl78.c,
* elf32-rx.c, * elf32-s390.c, * elf32-score.c, * elf32-score.h,
* elf32-score7.c, * elf32-sh-symbian.c, * elf32-sh.c, * elf32-sh64.c,
* elf32-sparc.c, * elf32-spu.c, * elf32-tic6x.c, * elf32-tilegx.c,
* elf32-tilegx.h, * elf32-tilepro.c, * elf32-tilepro.h, * elf32-v850.c,
* elf32-vax.c, * elf32-wasm32.c, * elf32-xc16x.c, * elf32-xgate.c,
* elf32-xgate.h, * elf32-xstormy16.c, * elf32-xtensa.c, * elf64-alpha.c,
* elf64-hppa.c, * elf64-ia64-vms.c, * elf64-mips.c, * elf64-mmix.c,
* elf64-ppc.c, * elf64-s390.c, * elf64-sh64.c, * elf64-sparc.c,
* elf64-tilegx.c, * elf64-tilegx.h, * elf64-x86-64.c, * elfcore.h,
* elflink.c, * elfn32-mips.c, * elfnn-aarch64.c, * elfnn-ia64.c,
* elfnn-riscv.c, * elfxx-aarch64.c, * elfxx-aarch64.h, * elfxx-ia64.c,
* elfxx-ia64.h, * elfxx-mips.c, * elfxx-riscv.c, * elfxx-sparc.c,
* elfxx-tilegx.c, * elfxx-x86.c, * elfxx-x86.h, * freebsd.h, * hash.c,
* host-aout.c, * hp300hpux.c, * hppabsd-core.c, * hpux-core.c,
* i386aout.c, * i386linux.c, * i386lynx.c, * i386mach3.c, * i386msdos.c,
* i386netbsd.c, * ieee.c, * ihex.c, * irix-core.c, * libaout.h,
* libbfd-in.h, * libbfd.c, * libcoff-in.h, * libnlm.h, * libpei.h,
* libxcoff.h, * linker.c, * lynx-core.c, * m68k4knetbsd.c,
* m68klinux.c, * m68knetbsd.c, * m88kmach3.c, * mach-o-aarch64.c,
* mach-o-arm.c, * mach-o-i386.c, * mach-o-target.c, * mach-o-x86-64.c,
* mach-o.c, * mach-o.h, * merge.c, * mipsbsd.c, * mmo.c, * netbsd.h,
* netbsd-core.c, * newsos3.c, * nlm-target.h, * nlm32-ppc.c,
* nlm32-sparc.c, * nlmcode.h, * ns32k.h, * ns32knetbsd.c, * oasys.c,
* opncls.c, * pc532-mach.c, * pdp11.c, * pe-arm.c, * pe-i386.c,
* pe-mcore.c, * pe-mips.c, * pe-x86_64.c, * peXXigen.c, * pef.c,
* pef.h, * pei-arm.c, * pei-i386.c, * pei-mcore.c, * pei-x86_64.c,
* peicode.h, * plugin.c, * ppcboot.c, * ptrace-core.c, * reloc.c,
* riscix.c, * rs6000-core.c, * section.c, * som.c, * som.h,
* sparclinux.c, * sparcnetbsd.c, * srec.c, * stabs.c, * sunos.c,
* syms.c, * targets.c, * tekhex.c, * trad-core.c, * vax1knetbsd.c,
* vaxnetbsd.c, * verilog.c, * versados.c, * vms-alpha.c, * vms-lib.c,
* vms-misc.c, * wasm-module.c, * wasm-module.h, * xcofflink.c,
* xsym.c, * xsym.h: Whitespace fixes.
* bfd-in2.h, * libbfd.h, * libcoff.h: Regenerate.
Alan Modra [Wed, 6 Dec 2017 07:01:15 +0000 (17:31 +1030)]
Fix Common symbol override test fails
Fixes fails on SH and NDS32 introduced by dyn_reloc tidy.
* elf32-lm32.c (lm32_elf_check_relocs): Skip non-ALLOC sections.
* elf32-m32r.c (m32r_elf_check_relocs): Likewise.
* elf32-nds32.c (nds32_elf_check_relocs): Likewise.
* elf32-or1k.c (or1k_elf_check_relocs): Likewise.
* elf32-sh.c (sh_elf_check_relocs): Likewise.
Alan Modra [Tue, 5 Dec 2017 22:34:48 +0000 (09:04 +1030)]
Enable shared lib tests for frv, lm32, m32r, microblaze, nds32 and or1k
These claim to support shared libs when configuring for <target>-linux
(in contrast to <target>-elf which doesn't support shared libs).
* testsuite/lib/ld-lib.exp (check_shared_lib_support): Return true
for frv, lm32, m32r, microblaze, nds32 and or1k linux targets.
Alan Modra [Mon, 4 Dec 2017 23:33:03 +0000 (10:03 +1030)]
dyn_relocs tidy
Many targets define their own dyn_relocs struct when they could use
struct elf_dyn_relocs. This patch tidies that, and uses
readonly_dynrelocs in a few more places.
The SH adjust_dynamic_symbol had some really weird code dating back to
2002 that looked over dynamic relocations for any in SEC_HAS_CONTENTS
or SEC_READONLY sections, rather than just the usual SEC_READONLY
sections. So basically any dynamic relocation. What's more, the SH
relocate_section has no support for emitting dynamic relocations in
non-PIC. In other words, SH has no support for avoiding copy relocs
in non-PIC. I've made that more obvious by using "if (0 && ..)" in
asjust_dynamic_symbol.
Unfortunately, LM32, M32R, NDS32, and OR1K copied the bogus SH
adjust_dynamic_symbol code. So none of those targets would have
avoided copy relocs. LM32, M32R, NDS32 get the "if (0)" treatment
too. (LM32 is even more broken in that non_got_ref is never set.)
OR1K relocate_section looks like it might support dynamic relocs in
non-PIC, so I've enabled the copy reloc avoidance code for that
target.
* elf32-hppa.c (struct elf32_hppa_dyn_reloc_entry): Delete. Use
struct elf_dyn_relocs throughout file instead.
(elf32_hppa_adjust_dynamic_symbol): Comment tidy.
* elf32-lm32.c (struct elf_lm32_dyn_relocs): Delete. Use
struct elf_dyn_relocs throughout file instead.
(lm32_elf_adjust_dynamic_symbol): Use readonly_dynrelocs, but disable.
Disable -z no-copyreloc too.
* elf32-m32r.c (struct elf_m32r_dyn_relocs): Delete. Use
struct elf_dyn_relocs throughout file instead.
(m32r_elf_adjust_dynamic_symbol): Use readonly_dynrelocs, but disable.
Disable -z no-copyreloc too.
* elf32-metag.c (struct elf_metag_dyn_reloc_entry): Delete. Use
struct elf_dyn_relocs throughout file instead.
(elf_metag_adjust_dynamic_symbol): Use readonly_dynrelocs.
* elf32-microblaze.c (struct elf32_mb_dyn_relocs): Delete. Use
struct elf_dyn_relocs throughout file instead.
(readonly_dynrelocs): New function.
(microblaze_elf_adjust_dynamic_symbol): Use it.
* elf32-nds32.c (struct elf_nds32_dyn_relocs): Delete. Use
struct elf_dyn_relocs throughout file instead.
(nds32_elf_adjust_dynamic_symbol): Use readonly_dynrelocs, but disable.
Disable -z no-copyreloc too.
* elf32-nios2.c (struct elf32_nios2_dyn_relocs): Delete. Use
struct elf_dyn_relocs throughout file instead.
* elf32-or1k.c (struct elf_or1k_dyn_relocs): Delete. Use
struct elf_dyn_relocs throughout file instead.
(or1k_elf_adjust_dynamic_symbol): Use readonly_dynrelocs.
* elf32-sh.c (struct elf_sh_dyn_relocs): Delete. Use
struct elf_dyn_relocs throughout file instead.
(sh_elf_adjust_dynamic_symbol): Use readonly_dynrelocs, but disable.
Disable -z no-copyreloc too.
* elf32-tilepro.c (struct tilepro_elf_dyn_relocs): Delete. Use
struct elf_dyn_relocs throughout file instead.
(tilepro_elf_adjust_dynamic_symbol): Use readonly_dynrelocs.
* elfnn-riscv.c (struct riscv_elf_dyn_relocs): Delete. Use
struct elf_dyn_relocs throughout file instead.
(riscv_elf_adjust_dynamic_symbol): Use readonly_dynrelocs.
* elfxx-sparc.c (struct _bfd_sparc_elf_dyn_relocs): Delete. Use
struct elf_dyn_relocs throughout file instead.
(_bfd_sparc_elf_adjust_dynamic_symbol): Use readonly_dynrelocs.
* elfxx-tilegx.c (struct tilegx_elf_dyn_relocs): Delete. Use
struct elf_dyn_relocs throughout file instead.
(tilegx_elf_adjust_dynamic_symbol): Use readonly_dynrelocs.
* elf32-s390.c (elf_s390_adjust_dynamic_symbol): Use readonly_dynrelocs.
* elf64-s390.c (elf_s390_adjust_dynamic_symbol): Use readonly_dynrelocs.
Alan Modra [Mon, 4 Dec 2017 23:35:19 +0000 (10:05 +1030)]
Comment tidy
Past tense is wrong for a comment before some action.
* elf32-ppc.c (ppc_elf_adjust_dynamic_symbol): Comment tidy.
* elf64-ppc.c (ppc64_elf_adjust_dynamic_symbol): Likewise.
* elfnn-aarch64.c (elfNN_aarch64_adjust_dynamic_symbol): Likewise.
GDB Administrator [Wed, 6 Dec 2017 00:00:23 +0000 (00:00 +0000)]
Automatic date update in version.in
Jim Wilson [Tue, 5 Dec 2017 22:42:12 +0000 (14:42 -0800)]
Really fix riscv shared library __global_pointer$ problem.
ld/
* emulparams/elf32lriscv-defs.sh (SDATA_START_SYMBOLS): Remove HIDDEN.
Don't define __global_pointer$ when CREATE_SHLIB.
* testsuite/ld-riscv-elf/gp-hidden-64.rd,
* testsuite/ld-riscv-elf/gp-hidden-lib.rd,
* testsuite/ld-riscv-elf/gp-hidden-lib.s,
* testsuite/ld-riscv-elf/gp-hidden-ver-64.rd,
* testsuite/ld-riscv-elf/gp-hidden-ver.rd,
* testsuite/ld-riscv-elf/gp-hidden-ver.s,
* testsuite/ld-riscv-elf/gp-hidden-ver.ver,
* testsuite/ld-riscv-elf/gp-hidden.rd,
* testsuite/ld-riscv-elf/gp-hidden.s,
* testsuite/ld-riscv-elf/gp-hidden.sd: Delete.
* testsuite/ld-riscv-elf/gp-test-lib.sd,
* testsuite/ld-riscv-elf/gp-test.s,
* testsuite/ld-riscv-elf/gp-test.sd: New.
* testsuite/ld-riscv-elf/ld-riscv-elf.exp: Rewrite gp tests.
Simon Marchi [Tue, 5 Dec 2017 21:39:35 +0000 (16:39 -0500)]
Address review comments for the previous series
I failed at git and missed adding/lost changes on the wrong branch, the
result being that I didn't incorporate fixes resulting from Yao's review
comments. This patch fixes that.
There are two places where we should use the unique pointer typedef, and
ChangeLog entries missing.
gdb/ChangeLog:
* target-descriptions.c (struct tdesc_feature) <registers>: Use
tdesc_reg_up typedef.
(struct target_desc) <features>: Use tdesc_feature_up typedef.
Simon Marchi [Tue, 5 Dec 2017 21:30:28 +0000 (16:30 -0500)]
Split tdesc_type into multiple classes
This patch makes tdesc_type an abstract base class and creates three
subclasses:
- tdesc_type_builtin, for builtin types
- tdesc_type_vector, for vector types
- tdesc_type_with_fields, for struct, union, flag and enum types
This allows getting rid of the union in tdesc_type and to not allow the
std::vector separately. I tried to go further and create separate
classes for struct, union, flag and enum, but it proved too difficult.
One problem is that from the point of the of the target description
code, the types tdesc_type_* are opaque (only forward-declared).
Therefore, it doesn't know about inheritance relationship between those
classes. This makes it impossible to make functions that accept a
pointer to a base class and pass a pointer to a derived class, for
example. I think this patch here is a good compromise, and if somebody
wants to improve things further, the door is open.
A make_gdb_type virtual pure method is added to tdesc_type, which
replaces the current tdesc_gdb_type function. Calling this method on a
tdesc_type returns the corresponding built gdb type.
gdb/ChangeLog:
* target-descriptions.c (struct tdesc_type): Use default
destructor.
<u>: Remove.
<accept>: Remove.
(struct tdesc_type_builtin): New.
(struct tdesc_type_vector): New.
(struct tdesc_type_with_fields): New.
(tdesc_predefined_types): Change type to tdesc_type_builtin[].
(tdesc_gdb_type): Remove.
(tdesc_register_type): Adjust.
(tdesc_create_vector): Create tdesc_type_vector.
(tdesc_create_struct): Create tdesc_type_with_fields.
(tdesc_set_struct_size): Change parameter type.
(tdesc_create_union): Create tdesc_type_with_fields.
(tdesc_create_flags): Likewise.
(tdesc_create_enum): Likewise.
(tdesc_add_field): Change parameter type.
(tdesc_add_typed_bitfield): Likewise.
(tdesc_add_bitfield): Likewise.
(tdesc_add_flag): Likewise.
(tdesc_add_enum_value): Likewise.
(print_c_tdesc) <visit>: Remove overload with tdesc_type
parameter, add overloads for tdesc_type_builtin,
tdesc_type_with_fields and tdesc_type_vector.
<m_printed_type>: Remove.
<m_printed_element_type, m_printed_type_with_fields>: Add.
* target-descriptions.h (tdesc_create_enum): Change return type.
(tdesc_add_typed_bitfield): Change parameter type.
(tdesc_add_enum_value): Change parameter type.
* xml-tdesc.c (struct tdesc_parsing_data) <current_type>: Change
type to tdesc_type_with_fields.
(tdesc_start_struct): Adjust.
(tdesc_start_flags): Adjust.
(tdesc_start_enum): Adjust.
(tdesc_start_field): Adjust.
* arch/tdesc.h (struct tdesc_type_builtin): Forward-declare.
(struct tdesc_type_vector): Forward-declare.
(struct tdesc_type_with_fields): Forward-declare.
(tdesc_create_struct): Change return type.
(tdesc_create_union): Likewise.
(tdesc_create_flags): Likewise.
(tdesc_add_field): Change parameter type.
(tdesc_set_struct_size): Likewise.
(tdesc_add_bitfield): Likewise.
(tdesc_add_flag): Likewise.
* features: Re-generate C files.
gdb/gdbserver/ChangeLog:
* tdesc.c (struct tdesc_type): Change return type.
(tdesc_add_flag): Change parameter type.
(tdesc_add_bitfield): Likewise.
(tdesc_add_field): Likewise.
(tdesc_set_struct_size): Likewise.
Simon Marchi [Tue, 5 Dec 2017 21:30:27 +0000 (16:30 -0500)]
Make tdesc_arch_data::arch_regs an std::vector
Make tdesc_arch_data::arch_regs be an std::vector of tdesc_arch_reg
objects.
On particularity is that the tdesc_arch_data linked to a gdbarch is
allocated on the gdbarch's obstack. To be safe, I did not change it and
called placement-new on the area returned by OBSTACK_ZALLOC.
gdb/ChangeLog:
* target-descriptions.c (tdesc_arch_reg): Remove typedef.
(struct tdesc_arch_reg): Add constructor.
(DEF_VEC_O (tdesc_arch_reg)): Remove.
(struct tdesc_arch_data): Initialize fields.
<arch_regs>: Change type to std::vector.
(target_find_description): Adjust.
(tdesc_find_type): Adjust.
(tdesc_data_init): Call tdesc_arch_data constructor.
(tdesc_data_alloc): Allocate tdesc_arch_data with new.
(tdesc_data_cleanup): Free data with delete.
(tdesc_numbered_register): Adjust.
(tdesc_find_arch_register): Adjust.
(tdesc_use_registers): Adjust.
Simon Marchi [Tue, 5 Dec 2017 21:30:26 +0000 (16:30 -0500)]
Make tdesc_type::u::u::fields an std::vector
This patch makes the tdesc_type::u::u::fields an std::vector of
tdesc_type_field. The difficulty here is that the vector is part of a
union. Because of this, I made fields a pointer to a vector, and
instantiate/destroy the vector if the type is one that uses this member
of the union
The field tdesc_type_field::name is changed to an std::string at the
same time.
gdb/ChangeLog:
* target-descriptions.c (tdesc_type_field): Remove typedef.
(DEF_VEC_O (tdesc_type_field)): Remove.
(struct tdesc_type_field): Add constructor.
<name>: Change type to std::string.
(struct tdesc_type) <tdesc_type>: Instantiate vector if the type
kind uses it.
<~tdesc_type>: Destroy vector if the type kind uses it.
<u::u::fields>: Change type to std::vector.
(tdesc_gdb_type): Adjust.
(tdesc_add_field): Adjust.
(tdesc_add_typed_bitfield): Adjust.
(tdesc_add_field): Adjust.
(tdesc_add_enum_value): Adjust.
(class print_c_tdesc) <visit>: Adjust.
Simon Marchi [Tue, 5 Dec 2017 21:30:26 +0000 (16:30 -0500)]
Make tdesc_type::name an std::string
This patch makes tdesc_type::name an std::string. This way, we don't
need to free it manually in ~tdesc_type. I think the comment on top of
name is not correct, the string is always malloc'ed.
gdb/ChangeLog:
* target-descriptions.c (struct tdesc_type) <name>: Change type
to std::string.
<~tdesc_type>: Don't manually free name.
<operator==>: Adjust.
(tdesc_named_type): Adjust.
(tdesc_find_type): Adjust.
(tdesc_gdb_type): Adjust.
(class print_c_tdesc) <visit>: Adjust.