Tom Tromey [Sun, 21 Jul 2019 14:13:58 +0000 (08:13 -0600)]
Add test that "file" shows "main"
This adds a new test that checks that the "file" command will show the
program's "main".
gdb/testsuite/ChangeLog
2019-07-27 Tom Tromey <tom@tromey.com>
* gdb.tui/main.exp: New file.
Tom Tromey [Sat, 20 Jul 2019 20:46:29 +0000 (14:46 -0600)]
Add test case for empty TUI windows
My original intent here was to add a test case to test that empty TUI
windows re-render their contents after a resize. However, this seems
pretty broken at the moment, so a lot of the test is actually
disabled.
gdb/testsuite/ChangeLog
2019-07-27 Tom Tromey <tom@tromey.com>
* lib/tuiterm.exp (Term::clean_restart): Make "executable"
optional.
* gdb.tui/empty.exp: New file.
Tom Tromey [Fri, 19 Jul 2019 22:15:58 +0000 (16:15 -0600)]
Add TUI resizing test
This adds a test case that resizes the terminal and then checks that
the TUI updates properly.
gdb/testsuite/ChangeLog
2019-07-27 Tom Tromey <tom@tromey.com>
* lib/tuiterm.exp (spawn): New proc.
(Term::resize): New proc.
* gdb.tui/resize.exp: New file.
Tom Tromey [Sat, 20 Jul 2019 20:49:29 +0000 (14:49 -0600)]
Add TUI test for "list"
This adds a test to check that the "list" command will update the TUI
source window.
gdb/testsuite/ChangeLog
2019-07-27 Tom Tromey <tom@tromey.com>
* gdb.tui/list.exp: New file.
Tom Tromey [Fri, 19 Jul 2019 00:07:59 +0000 (18:07 -0600)]
Add TUI register window test
This adds a very simple test of the TUI register window.
gdb/testsuite/ChangeLog
2019-07-27 Tom Tromey <tom@tromey.com>
* gdb.tui/regs.exp: New file.
Tom Tromey [Thu, 18 Jul 2019 22:54:32 +0000 (16:54 -0600)]
Add "layout split" test
This adds a test of "layout split" to the TUI test suite.
gdb/testsuite/ChangeLog
2019-07-27 Tom Tromey <tom@tromey.com>
* gdb.tui/basic.exp: Add "layout split" test.
Tom Tromey [Thu, 18 Jul 2019 22:21:45 +0000 (16:21 -0600)]
Add test for "layout asm"
This adds a very simple test for "layout asm".
gdb/testsuite/ChangeLog
2019-07-27 Tom Tromey <tom@tromey.com>
* gdb.tui/basic.exp: Add "layout asm" test.
Tom Tromey [Mon, 1 Jul 2019 22:01:58 +0000 (16:01 -0600)]
A virtual terminal for the test suite
This patch implements a simple ANSI terminal emulator for the test
suite. It is still quite basic, but it is good enough to allow some
simple TUI testing to be done.
gdb/testsuite/ChangeLog
2019-07-27 Tom Tromey <tom@tromey.com>
* lib/tuiterm.exp: New file.
* gdb.tui/basic.exp: New file.
GDB Administrator [Sun, 28 Jul 2019 00:00:51 +0000 (00:00 +0000)]
Automatic date update in version.in
Kevin Buettner [Fri, 26 Jul 2019 01:27:20 +0000 (18:27 -0700)]
Fix gdb.python/py-thrhandle.exp failures for -m32 multilib
This patch fixes the following failures when testing with
"target_board unix/-m32" using a x86_64-pc-linux-gnu native GDB.
FAIL: gdb.python/py-thrhandle.exp: print thread for bogus handle thrs[3]
FAIL: gdb.python/py-thrhandle.exp: print thread for bogus handle thrs[4]
FAIL: gdb.python/py-thrhandle.exp: print thread id for thrs[0]
FAIL: gdb.python/py-thrhandle.exp: print thread id for thrs[1]
FAIL: gdb.python/py-thrhandle.exp: print thread id for thrs[2]
FAIL: gdb.python/py-thrhandle.exp: thread 0: fetch thread handle from thread
FAIL: gdb.python/py-thrhandle.exp: thread 0: verify that handles are the same
FAIL: gdb.python/py-thrhandle.exp: thread 1: fetch thread handle from thread
FAIL: gdb.python/py-thrhandle.exp: thread 1: verify that handles are the same
FAIL: gdb.python/py-thrhandle.exp: thread 2: fetch thread handle from thread
FAIL: gdb.python/py-thrhandle.exp: thread 2: verify that handles are the same
I've written it so that it might work for other 64-bit host / 32-bit target
combos too.
gdb/ChangeLog:
* linux-thread-db.c (thread_db_target::thread_handle_to_thread_info):
Add case for debugging 32-bit target on 64-bit host. Revise
comment.
Kevin Buettner [Sat, 13 Jul 2019 22:59:44 +0000 (15:59 -0700)]
Fix stepping bug associated with non-contiguous blocks
I recently noticed the following behavior while debugging
dw2-ranges-func-low-cold. This is one of the test programs associated
with the test gdb.dwarf2/dw2-ranges-func.exp.
(gdb) b 70
Breakpoint 1 at 0x401129: file dw2-ranges-func-lo-cold.c, line 70.
(gdb) run
Starting program: dw2-ranges-func-lo-cold
Breakpoint 1, foo ()
at dw2-ranges-func-lo-cold.c:70
70 if (e) foo_cold (); /* foo foo_cold call */
(gdb) set var e=1
(gdb) step
[Inferior 1 (process 12545) exited normally]
This is incorrect. When stepping, we expect a step to occur. We do not
expect the program to exit. Instead, we should see the following behavior:
...
(gdb) set var e=1
(gdb) step
foo ()
at dw2-ranges-func-lo-cold.c:54
54 baz (); /* foo_cold baz call */
(Note that I've shortened the paths in the above sessions to improve
readability.)
The bug is in fill_in_stop_func() in infrun.c. While working on
non-contiguous address range improvements in 2018, I replaced the
call to find_pc_partial_function() with a call to
find_function_entry_range_from_pc(). Although this seemed like the
right thing to do at the time, I now think that calling
find_pc_partial_function (along with some other tweaks) is the right
thing to do.
For blocks with a single contiguous range, these functions do pretty
much the same thing: when the function succeeds, the function name,
start address, and end address are all filled in. Additionally,
find_pc_partial_function contains an additional output parameter
which is set to the block containing that PC.
For blocks with non-contiguous ranges, find_pc_partial_function
sets the start and end addresses to the start and end addresses
of the range containing the pc. find_function_entry_range_from_pc
does what it says; it sets the start and end addresses to those
of the range containing the entry pc.
The reason that I had thought that using the entry pc range was
correct is due to the fact that fill_in_stop_func() contains some
code for advancing past the function start and entry point. To do
this, we'd need the range that contains the entry pc.
However, when stepping, we actually want the range that contains the
stop pc. If that range also contains the entry pc, we should then
attempt to advance stop_func_start past the start offset and entry
point. (I haven't thought very hard about the reason for advancing
the stop_func_start in this manner. Since it's been there for quite
a while, I'm assuming that it's still a good idea.)
Back when I wrote the test case, I had included a test for doing the
step shown in the example above. I had problems with it, however. At
the time, I thought it was due to differing compiler versions, so I
disabled that portion of the test. I have now reenabled those tests,
but have left in place the logic which may be used to disable it.
The changes to dw2-ranges-func.exp depend on my other recent changes
to the file which have not been pushed yet.
Finally, I'll note that the only caller of
find_function_entry_range_from_pc() is/was fill_in_stop_func(). Once
this commit goes in, it'll be dead code. I considered removing it,
but I think that it ought to be used (instead of
find_pc_partial_function) for determining the correct range to scan
for prologue analysis, so I'm going to leave it in place for now.
gdb/ChangeLog:
* infrun.c (fill_in_stop_func): Use find_pc_partial_function
instead of find_function_entry_range_from_pc.
testsuite/ChangeLog:
* gdb.dwarf2/dw2-ranges-func.exp (enable_foo_cold_stepping):
Enable tests associated with this flag. Adjust regex
referencing "foo_low" to now refer to "foo_cold" instead.
Kevin Buettner [Mon, 3 Jun 2019 01:31:22 +0000 (18:31 -0700)]
Improve test gdb.dwarf2/dw2-ranges-func.exp
The original dw2-ranges-func.exp test caused a function named foo to be
created with two non-contiguous address ranges. In the C source file,
a function named foo_low was incorporated into the function foo which
was also defined in that file. The DWARF assembler is used to do this
manipulation. The source file had been laid out so that foo_low would
likely be placed (by the compiler and linker) at a lower address than
foo().
The case where a range at a higher set of addresses (than foo) was not
being tested. In a recent discussion on gdb-patches, it became clear
that performing such tests are desirable because bugs were discovered
which only became evident when the other range was located at high(er)
addresses than the range containing the entry point for the function.
This other (non entry pc) address range is typically used for "cold"
code which executes less frequently. Thus, I renamed foo_low to
foo_cold and renamed the C source file from dw-ranges-func.c to
dw-ranges-func-lo.c. I then made a copy of this file, naming it
dw-ranges-func-hi.c. (That was my intent anyway. According to git,
I renamed dw-ranges-func.c to dw-ranges-func-hi.c and then modified it.
dw-ranges-func-lo.c shows up as an entirely new file.)
Within dw-ranges-func-hi.c, I changed the placement of foo_cold()
along with some of the other functions so that foo_cold() would be at
a higher address than foo() while also remaining non-contiguous. The
two files, dw-ranges-func-lo.c and dw-ranges-func-hi.c, are
essentially the same except for the placement of some of the functions
therein.
The tests in dw2-ranges-func.exp where then wrapped in a new proc named
do_test which was then called in a loop from the outermost level. The
loop causes each of the source files to have the same tests run upon
them.
I also added a few new tests which test functionality fixed by the other
commits to this patch series. Due to the reorganization of the file,
it's hard to identify these changes in the patch. So, here are the
tests which were added:
with_test_prefix "no-cold-names" {
# Due to the calling sequence, this backtrace would normally
# show function foo_cold for frame #1. However, we don't want
# this to be the case due to placing it in the same block
# (albeit at a different range) as foo. Thus it is correct to
# see foo for frames #1 and #2. It is incorrect to see
# foo_cold at frame #1.
gdb_test_sequence "bt" "backtrace from baz" {
"\[\r\n\]#0 .*? baz \\(\\) "
"\[\r\n\]#1 .*? foo \\(\\) "
"\[\r\n\]#2 .*? foo \\(\\) "
"\[\r\n\]#3 .*? main \\(\\) "
}
# Doing x/2i foo_cold should show foo_cold as the first symbolic
# address and an offset from foo for the second. We also check to
# make sure that the offset is not too large - we don't GDB to
# display really large offsets that would (try to) wrap around the
# address space.
set foo_cold_offset 0
set test "x/2i foo_cold"
gdb_test_multiple $test $test {
-re " (?:$hex) <foo_cold>.*?\n (?:$hex) <foo\[+-\](\[0-9\]+)>.*${gdb_prompt}" {
set foo_cold_offset $expect_out(1,string)
pass $test
}
}
gdb_assert {$foo_cold_offset <= 10000} "offset to foo_cold is not too large"
# Likewise, verify that second address shown by "info line" is at
# and offset from foo instead of foo_cold.
gdb_test "info line *foo_cold" "starts at address $hex <foo_cold> and ends at $hex <foo\[+-\].*?>.*"
}
When run against a GDB without the requisite bug fixes (from this patch
series), these 6 failures should be seen:
FAIL: gdb.dwarf2/dw2-ranges-func.exp: lo-cold: no-cold-names: backtrace from baz (pattern 4)
FAIL: gdb.dwarf2/dw2-ranges-func.exp: lo-cold: no-cold-names: x/2i foo_cold
FAIL: gdb.dwarf2/dw2-ranges-func.exp: lo-cold: no-cold-names: info line *foo_cold
FAIL: gdb.dwarf2/dw2-ranges-func.exp: hi-cold: no-cold-names: backtrace from baz (pattern 3)
FAIL: gdb.dwarf2/dw2-ranges-func.exp: hi-cold: no-cold-names: x/2i foo_cold
FAIL: gdb.dwarf2/dw2-ranges-func.exp: hi-cold: no-cold-names: info line *foo_cold
gdb/testsuite/ChangeLog:
* gdb.dwarf2/dw2-ranges-func.c: Rename to...
* gdb.dwarf2/dw2-ranges-func-lo-cold.c: ...this.
* gdb.dwarf2/dw2-ranges-func-lo-cold.c (foo_low): Change name to
foo_cold. Revise comments to match.
* gdb.dwarf2/dw2-ranges-func-hi-cold.c: New file.
* gdb.dwarf2/dw2-ranges-func.exp (do_test): New proc. Existing tests
were wrapped into this proc; Call do_test in loop from outermost
level.
(foo_low): Rename all occurrences to "foo_cold".
(backtrace from baz): New test.
(x2/i foo_cold): New test.
(info line *foo_cold): New test.
Kevin Buettner [Sat, 1 Jun 2019 20:42:29 +0000 (13:42 -0700)]
dwarf2-frame.c: Fix FDE processing bug involving non-contiguous ranges
In the course of revising the test case for
gdb.dwarf2/dw2-ranges-func.exp, I added a new .c file which would
cause the "cold" range to be at a higher address than the rest of the
function. In these tests, the range in question isn't really cold in
the sense that a compiler has determined that it'll be executed less
frequently. Instead, it's simply the range that does not include the
entry pc. These tests are intended to mimic the output of such a
compiler, so I'll continue to refer to this range as "cold" in the
following discussion.
The original test case had only tested a cold range placed
at lower addresses than the rest of the function. During testing of the
new code where the cold range was placed at higher addresses, I found
that I could produce the following backtrace:
(gdb) bt
#0 0x0000000000401138 in baz ()
at dw2-ranges-func-hi-cold.c:72
#1 0x0000000000401131 in foo_cold ()
at dw2-ranges-func-hi-cold.c:64
#2 0x000000000040111e in foo ()
at dw2-ranges-func-hi-cold.c:50
#3 0x0000000000401144 in main ()
at dw2-ranges-func-hi-cold.c:78
This is correct, except that we'd like to see foo() listed instead
of foo_cold(). (I handle that problem in another patch.)
Now look at what happens for a similar backtrace where the cold range
is at a lower address than the foo's entry pc:
(gdb) bt
#0 0x000000000040110a in baz ()
at dw2-ranges-func-lo-cold.c:48
#1 0x0000000000401116 in foo ()
at dw2-ranges-func-lo-cold.c:54
#2 0x00007fffffffd4c0 in ?? ()
#3 0x0000000000401138 in foo ()
at dw2-ranges-func-lo-cold.c:70
Note that the backtrace doesn't go all the way back to main(). Moreover,
frame #2 is messed up.
I had seen this behavior when I had worked on the non-contiguous
address problem last year. At the time I convinced myself that the
mangled backtrace was "okay" since we're doing strange things with
the DWARF assembler. We're taking a function called foo_cold (though
it was originally called foo_low - my recent changes to the test case
changed the name) and via the magic of the DWARF assembler, we're
combining it into a separate (non-contiguous) range for foo. Thus,
it was a surprise to me when I got a good and complete backtrace when
the cold symbol is placed at an address that's greater than entry pc.
The function dwarf2_frame_cache (in dwarf2-frame.c) is making this
call:
if (get_frame_func_if_available (this_frame, &entry_pc)) ...
If that call succeeds (returns a true value), the FDE is then
processed up to the entry pc. It doesn't make sense to do this,
however, when the FDE in question does not contain the entry pc. This
can happen when the function in question is comprised of more than one
(non-contiguous) address range.
My fix is to add some comparisons to the test above to ensure that
ENTRY_PC is within the address range covered by the FDE.
gdb/ChangeLog:
* dwarf2-frame.c (dwarf2_frame_cache): Don't decode FDE instructions
for entry pc when entry pc is out of range for that FDE.
Kevin Buettner [Thu, 4 Jul 2019 00:35:21 +0000 (17:35 -0700)]
Restrict use of minsym names when printing addresses in disassembled code
build_address_symbolic contains some code which causes it to
prefer the minsym over the the function symbol in certain cases.
The cases where this occurs are the same as the "certain pathological
cases" that used to exist in find_frame_funname().
This commit largely disables that code; it will only prefer the
minsym when the address of minsym is identical to that of the address
under consideration AND the function address for the symbtab sym is
not the same as the address under consideration.
So, without this change, when using the dw2-ranges-func-lo-cold
executable from the gdb.dwarf2/dw2-ranges-func.exp test, GDB exhibits
the following behavior:
(gdb) x/5i foo_cold
0x40110d <foo+
4294967277>: push %rbp
0x40110e <foo+
4294967278>: mov %rsp,%rbp
0x401111 <foo+
4294967281>: callq 0x401106 <baz>
0x401116 <foo+
4294967286>: nop
0x401117 <foo+
4294967287>: pop %rbp
On the other hand, still without this change, using the
dw2-ranges-func-hi-cold executable from the same test, GDB
does this instead:
(gdb) x/5i foo_cold
0x401128 <foo_cold>: push %rbp
0x401129 <foo_cold+1>: mov %rsp,%rbp
0x40112c <foo_cold+4>: callq 0x401134 <baz>
0x401131 <foo_cold+9>: nop
0x401132 <foo_cold+10>: pop %rbp
This is inconsistent behavior. When foo_cold is at a lower
address than the function's entry point, the symtab symbol (foo)
is displayed along with a large positive offset which would wrap
around the address space if the address space were only 32 bits wide.
(A later patch fixes this problem by displaying negative offsets.)
This commit makes the behavior uniform for both the "lo-cold" and
"hi-cold" cases:
lo-cold:
(gdb) x/5i foo_cold
0x40110d <foo_cold>: push %rbp
0x40110e <foo-18>: mov %rsp,%rbp
0x401111 <foo-15>: callq 0x401106 <baz>
0x401116 <foo-10>: nop
0x401117 <foo-9>: pop %rbp
hi-cold:
(gdb) x/5i foo_cold
0x401128 <foo_cold>: push %rbp
0x401129 <foo+35>: mov %rsp,%rbp
0x40112c <foo+38>: callq 0x401134 <baz>
0x401131 <foo+43>: nop
0x401132 <foo+44>: pop %rbp
In both cases, the symbol shown for the address at which foo_cold
resides is shown as <foo_cold>. Subsequent offsets are shown as
either negative or positive offsets from the entry pc for foo.
When disassembling a function, care must be taken to NOT display
<+0> as the offset for the second range. For this reason, I found
it necessary to add the "prefer_sym_over_minsym" parameter to
build_address_symbolic. The type of this flag is a bool; do_demangle
ought to be a bool also, so I made this change at the same time.
gdb/ChangeLog:
* valprint.h (build_address_symbolic): Add "prefer_sym_over_minsym"
parameter. Change type of "do_demangle" to bool.
* disasm.c (gdb_pretty_print_disassembler::pretty_print_insn):
Pass suitable "prefer_sym_over_minsym" flag to
build_address_symbolic(). Don't output "+" for negative offsets.
* printcmd.c (print_address_symbolic): Update invocation of
build_address_symbolic to include a "prefer_sym_over_minsym"
flag.
(build_address_symbolic): Add "prefer_sym_over_minsym" parameter.
Restrict cases in which use of minimal symbol is preferred to that
of a found symbol. Update comments.
Kevin Buettner [Thu, 4 Jul 2019 00:32:21 +0000 (17:32 -0700)]
Prefer symtab symbol over minsym for function names in non-contiguous blocks
The discussion on gdb-patches which led to this patch may be found
here:
https://www.sourceware.org/ml/gdb-patches/2019-05/msg00018.html
Here's a brief synopsis/analysis:
Eli Zaretskii, while debugging a Windows emacs executable, found
that functions comprised of more than one (non-contiguous)
address range were not being displayed correctly in a backtrace. This
is the example that Eli provided:
(gdb) bt
#0 0x76a63227 in KERNELBASE!DebugBreak ()
from C:\Windows\syswow64\KernelBase.dll
#1 0x012e7b89 in emacs_abort () at w32fns.c:10768
#2 0x012e1f3b in print_vectorlike.cold () at print.c:1824
#3 0x011d2dec in print_object (obj=<optimized out>, printcharfun=XIL(0),
escapeflag=true) at print.c:2150
The function print_vectorlike consists of two address ranges, one of
which contains "cold" code which is expected to not execute very often.
There is a minimal symbol, print_vectorlike.cold.65, which is the address
of the "cold" range.
GDB is prefering this minsym over the the name provided by the
DWARF info due to some really old code in GDB which handles
"certain pathological cases". This comment reads as follows:
/* In certain pathological cases, the symtabs give the wrong
function (when we are in the first function in a file which
is compiled without debugging symbols, the previous function
is compiled with debugging symbols, and the "foo.o" symbol
that is supposed to tell us where the file with debugging
symbols ends has been truncated by ar because it is longer
than 15 characters). This also occurs if the user uses asm()
to create a function but not stabs for it (in a file compiled
with -g).
So look in the minimal symbol tables as well, and if it comes
up with a larger address for the function use that instead.
I don't think this can ever cause any problems; there
shouldn't be any minimal symbols in the middle of a function;
if this is ever changed many parts of GDB will need to be
changed (and we'll create a find_pc_minimal_function or some
such). */
In an earlier version of this patch, I had left the code for the
pathological case intact, but those who reviwed that patch recommended
removing it. So that's what I've done - I've removed it.
gdb/ChangeLog:
* stack.c (find_frame_funname): Remove code which preferred
minsym over symtab sym in "certain pathological cases".
GDB Administrator [Sat, 27 Jul 2019 00:00:25 +0000 (00:00 +0000)]
Automatic date update in version.in
Brian Callahan [Fri, 26 Jul 2019 18:48:15 +0000 (14:48 -0400)]
Fix return type typo in obsd-nat.c that breaks build on OpenBSD
To recap the bug report:
Commit a068643 introduced a small typo that breaks the gdb build on OpenBSD.
Line 38 of obsd-nat.c needs to be changed from std::sring to std::string.
gdb/ChangeLog
2019-07-26 Brian Callahan <bcallah@openbsd.org>
PR gdb/24839:
* gdb/obsd-nat.c (obsd_nat_target::pid_to_str): Fix typo in return
type.
Tom de Vries [Fri, 26 Jul 2019 19:49:45 +0000 (21:49 +0200)]
[gdb/testsuite] Fix unterminated string in i386-pkru.exp
I ran into this error:
...
ERROR: tcl error sourcing gdb/testsuite/gdb.arch/i386-pkru.exp.
ERROR: missing "
while executing
"untested ""
invoked from within
"if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \
[list debug additional_flags=${comp_flags}]] } {
untested "failed to c..."
(file "gdb/testsuite/gdb.arch/i386-pkru.exp" line 25)
invoked from within
...
caused by:
...
untested "failed to compile x86 PKEYS test.
...
Fix the unterminated string.
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2019-07-26 Tom de Vries <tdevries@suse.de>
* gdb.arch/i386-pkru.exp: Fix unterminated string.
Alan Modra [Fri, 26 Jul 2019 03:28:52 +0000 (12:58 +0930)]
PR24798, buffer overflow in process_cu_tu_index
PR 24798
* dwarf.c (process_cu_tu_index): Avoid integer overflow on 64-bit
systems by casting ncols and nslots expressions to size_t. Display
number of columns and slots before giving up due to buffer overflow.
Use %u to display unsigned ints. Perform more pointer wrap tests.
Alan Modra [Fri, 26 Jul 2019 00:32:12 +0000 (10:02 +0930)]
Begone elf_linker
This field effectively became usused a long time ago, perhaps as early
as 1994.
* elf-bfd.h (struct output_elf_obj_tdata): Delete "linker" field.
(elf_linker): Don't define.
* elflink.c (bfd_elf_final_link): Don't set elf_linker.
Alan Modra [Fri, 26 Jul 2019 00:24:18 +0000 (09:54 +0930)]
Ajdust lto-3r and lto-5r tests for powerpc64
* testsuite/ld-plugin/lto-3r.d: Accept D for powerpc64 descriptors.
* testsuite/ld-plugin/lto-5r.d: Likewise.
GDB Administrator [Fri, 26 Jul 2019 00:00:23 +0000 (00:00 +0000)]
Automatic date update in version.in
Christian Biesinger [Thu, 25 Jul 2019 22:17:49 +0000 (17:17 -0500)]
Fix comment about the signature of add_separate_debug_file
Also fixes the date in the changelog of my last commit.
gdb/ChangeLog:
2019-07-25 Christian Biesinger <cbiesinger@google.com>
* python/py-objfile.c (add_separate_debug_file): Fix comment about
this function's Python signature.
Tom de Vries [Thu, 25 Jul 2019 16:39:31 +0000 (18:39 +0200)]
[gdb/testsuite] Test skip_libstdcxx_probe_tests in mi-catch-cpp-exceptions.exp
On a system without SDT probes in libstdc++, we run into:
...
FAIL: gdb.mi/mi-catch-cpp-exceptions.exp: all with invalid regexp: run until \
breakpoint in main (unknown output after running)
...
The test-case uses a regexp argument for the catch throw/rethrow/catch
command, which is only supported on systems with SDT probes in libstdc++.
Fix this by marking the portions of the test-case that use a regexp argument
as unsupported on a system without SDT probes.
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2019-07-25 Tom de Vries <tdevries@suse.de>
PR testsuite/24830
* gdb.mi/mi-catch-cpp-exceptions.exp: Call
mi_skip_libstdcxx_probe_tests, and skip unsupported tests.
* lib/gdb.exp (skip_libstdcxx_probe_tests_prompt): Factor out of ...
(skip_libstdcxx_probe_tests): ... here.
* lib/mi-support.exp (mi_skip_libstdcxx_probe_tests): New proc.
Nick Clifton [Thu, 25 Jul 2019 16:29:01 +0000 (17:29 +0100)]
Fix attributation of DWARF augmentation patch.
Tom de Vries [Thu, 25 Jul 2019 16:24:22 +0000 (17:24 +0100)]
Have readelf and objdump display the contents of the DWARF augmentation data as a string, if it is printable.
PR 24809
* dwarf.c (display_debug_names): Display the contents of the
augmentation string, if it is printable.
YunQiang Su [Thu, 25 Jul 2019 15:34:58 +0000 (16:34 +0100)]
When linking binary files into MIPS executables, default to MIPS 3 emaulation for 64-bit objects.
PR 24832
* elfxx-mips.c (mips_set_isa_flags): Default to MIPS 3 for 64-bit
mips inputs.
Nick Clifton [Thu, 25 Jul 2019 12:05:27 +0000 (13:05 +0100)]
Stop an illegal memory access by readelf when parsing a corrupt MIPS binary file.
PR 24837
* readelf.c (process_mips_specific): Check for buffer overflow
before reading reginfo information.
Christian Biesinger [Tue, 25 Jun 2019 20:45:41 +0000 (15:45 -0500)]
Allow passing a block to lookup_global_symbol_from_objfile
This has no behavior change in itself, but allows a future patch
to add a function to the Python API to look up symbols in the
static block.
gdb/ChangeLog:
2019-07-24 Christian Biesinger <cbiesinger@google.com>
* compile/compile-object-load.c (compile_object_load): Pass GLOBAL_SCOPE.
* solib-spu.c (spu_lookup_lib_symbol): Pass GLOBAL_SCOPE.
* solib-svr4.c (elf_lookup_lib_symbol): Pass GLOBAL_SCOPE.
* symtab.c (lookup_global_symbol_from_objfile): Add a scope parameter.
* symtab.h (lookup_global_symbol_from_objfile): Likewise.
GDB Administrator [Thu, 25 Jul 2019 00:00:42 +0000 (00:00 +0000)]
Automatic date update in version.in
Tom de Vries [Wed, 24 Jul 2019 17:01:59 +0000 (19:01 +0200)]
[gdb/testsuite] Fix implicit declaration of printf in gdb.objc/*.m
When running gdb.objc/objcdecode.exp we get:
...
objcdecode.m: In function '-[Decode multipleDef]':
objcdecode.m:14:3: warning: incompatible implicit declaration of built-in \
function 'printf'
printf("method multipleDef\n");
^~~~~~
objcdecode.m:14:3: note: include '<stdio.h>' or provide a declaration of \
'printf'
...
Fix this in the three gdb.objc/*.m test-cases by including stdio.h.
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2019-07-24 Tom de Vries <tdevries@suse.de>
PR testsuite/24807
* gdb.objc/basicclass.m: Include stdio.h.
* gdb.objc/nondebug.m: Same.
* gdb.objc/objcdecode.m: Same.
H.J. Lu [Wed, 24 Jul 2019 15:15:56 +0000 (08:15 -0700)]
Revert "Remove tests that test __gnu_lto_v1 symbol."
Revert
commit
8c728a9d93e2342c57039fcdd6e4a502875b9e09
Author: Martin Liska <mliska@suse.cz>
Date: Mon Jul 22 14:23:32 2019 +0200
Remove tests that test __gnu_lto_v1 symbol.
since outputs of these tests are used by later tests. Check the normal
symbol, foo, instead of __gnu_lto_v.*, which GCC stopped emitting after
r273662.
* testsuite/ld-plugin/lto-3r.d: Restored. Check foo instead
of __gnu_lto_v.*.
* testsuite/ld-plugin/lto-5r.d: Likewise.
* testsuite/ld-plugin/lto.exp: Run lto-3r and lto-5r tests.
Tom de Vries [Wed, 24 Jul 2019 15:16:01 +0000 (17:16 +0200)]
[gdb/testsuite] Fix infoline-reloc-main-from-zero.exp compilation
When running gdb.base/infoline-reloc-main-from-zero.exp, I see:
...
Running gdb/testsuite/gdb.base/infoline-reloc-main-from-zero.exp ...
gdb compile failed, ld: infoline-reloc-main-from-zero: \
not enough room for program headers, try linking with -N
ld: final link failed: bad value
collect2: error: ld returned 1 exit status
UNTESTED: gdb.base/infoline-reloc-main-from-zero.exp: infoline-reloc-main-from-zero.exp
UNTESTED: gdb.base/infoline-reloc-main-from-zero.exp: failed to compile
...
Fix this by following the suggestion:
...
-set opts {debug "additional_flags=-nostdlib -emain -Wl,-Ttext=0x00"}
+set opts {debug "additional_flags=-nostdlib -emain -Wl,-Ttext=0x00 -Wl,-N"}
...
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2019-07-24 Tom de Vries <tdevries@suse.de>
PR testsuite/24612
* gdb.base/infoline-reloc-main-from-zero.exp: Add -Wl,-N to
additional_flags.
Claudiu Zissulescu [Wed, 24 Jul 2019 14:53:00 +0000 (17:53 +0300)]
[ARC] [COMMITTED] Fix formatting.
Small formatting fixes.
2019-07-24 Claudiu Zissulescu <claziss@synopsys.com>
* elf32-arc.c (bfd_get_32_me): Add a small description, fix
formatting.
(reloc_type_to_name): Fix formatting.
(arc_elf_object_p): Likewise.
(debug_arc_reloc): Likewise.
(arc_do_relocation): Likewise.
Nick Clifton [Wed, 24 Jul 2019 14:21:24 +0000 (15:21 +0100)]
Update the Swedish translation for the gas sub-directory.
Claudiu Zissulescu [Wed, 24 Jul 2019 13:52:23 +0000 (16:52 +0300)]
[ARC] Update disassembler opcode selection
New instruction are added, and some of them are overlapping. Update
disassembler to correctly recognize them. Introduce nps400 option.
opcodes/
xxxx-xx-xx Claudiu Zissulescu <claziss@synopsys.com>
* arc-dis.c (skip_this_opcode): Check also for 0x07 major opcodes,
and MPY class instructions.
(parse_option): Add nps400 option.
(print_arc_disassembler_options): Add nps400 info.
gas/
xxxx-xx-xx Claudiu Zissulescu <claziss@synopsys.com>
* testsuite/gas/arc/nps400-6.d: Update test.
Claudiu Zissulescu [Wed, 24 Jul 2019 13:46:01 +0000 (16:46 +0300)]
[ARC] Update ARC opcode table
Update ARC opcode table by cleaning up invalid instructions, and fixing wrong encodings.
opcodes/
xxxx-xx-xx Claudiu Zissulescu <claziss@synopsys.com>
* arc-ext-tbl.h (bspeek): Remove it, added to main table.
(bspop): Likewise.
(modapp): Likewise.
* arc-opc.c (RAD_CHK): Add.
* arc-tbl.h: Regenerate.
include/
xxxx-xx-xx Claudiu Zissulescu <claziss@synopsys.com>
* include/opcode/arc.h (FASTMATH): Add.
(SWITCH): Likewise.
Claudiu Zissulescu [Wed, 24 Jul 2019 13:33:29 +0000 (16:33 +0300)]
[ARC] Add linker relaxation.
Add linker relaxation. The first relaxation added is converting
GOTPC32 to PCREL relocations. This relaxation doesn't change the size of
the binary.
bfd/
xxxx-xx-xx Claudiu Zissulescu <claziss@synopsys.com>
* elf32-arc.c (bfd_get_32_me): New function.
(bfd_put_32_me): Likewise.
(arc_elf_relax_section): Likewise.
(bfd_elf32_bfd_relax_section): Define.
ld/testsuite/
xxxx-xx-xx Claudiu Zissulescu <claziss@synopsys.com>
* ld-arc/relax-local-pic.d: New test.
* ld-arc/relax-local-pic.s: New file.
Yoshinori Sato [Wed, 24 Jul 2019 11:51:52 +0000 (20:51 +0900)]
gdb/h8300-tdep.c: Fix register name in h8300h machine.
H8/300H general register name "ER0" - "ER7".
But gdb using "R0" - "R7".
This changes register name "ER0" - "ER7" in h8300h machine mode.
gdb/ChangeLog:
* h8300-tdep.c (h8300_register_name_common): New.
h8300_register_name): Use h8300_register_name_common.
(h8300s_register_name): Likewise.
(h8300sx_register_name): Likewise.
(h8300h_register_nam): New.
(h8300_gdbarch_init): Use h8300h_register_name in h8300h machine.
Nick Clifton [Wed, 24 Jul 2019 11:17:37 +0000 (12:17 +0100)]
Fix ar so that it can correctly detect non-dash prefixed options that appear after dash prefixed options.
PR 13256
* ar.c (decode_options): Restart option scanning if no operation
is detected and argument remain to be scanned.
Alan Modra [Wed, 24 Jul 2019 00:13:30 +0000 (09:43 +0930)]
Complain about mbind, ifunc, and unique in final_write
It's not as good as complaining in gas/config/obj-elf.c since you lose
any reference to the source file.
bfd/
* elf-bfd.h (struct elf_backend_data): Return bfd_boolean from
elf_backend_final_write_processing, don't pass linker arg.
(_bfd_elf_final_write_processing): Update prototype.
* elf.c (_bfd_elf_write_object_contents): Adjust call.
(_bfd_elf_final_write_processing): Return error on incompatible
OSABI and has_gnu_osabi. Remove linker arg.
* elf-nacl.h (nacl_final_write_processing): Update prototype.
* elf-vxworks.h (elf_vxworks_final_write_processing): Likewise.
* elfxx-mips.h (_bfd_mips_final_write_processing): Likewise.
(_bfd_mips_elf_final_write_processing): Likewise.
* elf-hppa.h (elf_hppa_final_write_processing): Return status
and remove linker arg.
* elf-m10300.c (_bfd_mn10300_elf_final_write_processing): Likewise.
* elf-nacl.c (nacl_final_write_processing): Likewise.
* elf-vxworks.c (elf_vxworks_final_write_processing): Likewise.
* elf32-arc.c (arc_elf_final_write_processing): Likewise.
* elf32-arm.c (arm_final_write_processing): Likewise.
(elf32_arm_final_write_processing): Likewise.
(elf32_arm_nacl_final_write_processing): Likewise.
(elf32_arm_vxworks_final_write_processing): Likewise.
* elf32-avr.c (bfd_elf_avr_final_write_processing): Likewise.
* elf32-bfin.c (elf32_bfin_final_write_processing): Likewise.
* elf32-cr16.c (_bfd_cr16_elf_final_write_processing): Likewise.
* elf32-cris.c (cris_elf_final_write_processing): Likewise.
* elf32-h8300.c (elf32_h8_final_write_processing): Likewise.
* elf32-lm32.c (lm32_elf_final_write_processing): Likewise.
* elf32-m32r.c (m32r_elf_final_write_processing): Likewise.
* elf32-m68k.c (elf_m68k_final_write_processing): Likewise.
* elf32-mips.c (mips_vxworks_final_write_processing): Likewise.
* elf32-msp430.c (bfd_elf_msp430_final_write_processing): Likewise.
* elf32-nds32.c (nds32_elf_final_write_processing): Likewise.
* elf32-or1k.c (or1k_elf_final_write_processing): Likewise.
* elf32-pj.c (pj_elf_final_write_processing): Likewise.
* elf32-ppc.c (ppc_final_write_processing): Likewise.
(ppc_elf_final_write_processing): Likewise.
(ppc_elf_vxworks_final_write_processing): Likewise.
* elf32-sparc.c (sparc_final_write_processing): Likewise.
(elf32_sparc_final_write_processing): Likewise.
(elf32_sparc_vxworks_final_write_processing): Likewise.
* elf32-v850.c (v850_elf_final_write_processing): Likewise.
* elf32-xc16x.c (elf32_xc16x_final_write_processing): Likewise.
* elf32-xtensa.c (elf_xtensa_final_write_processing): Likewise.
* elf64-ia64-vms.c (elf64_vms_final_write_processing): Likewise.
* elfnn-ia64.c (elfNN_ia64_final_write_processing): Likewise.
* elfxx-mips.c (_bfd_mips_final_write_processing): Likewise.
(_bfd_mips_elf_final_write_processing): Likewise.
gas/
* config/obj-elf.c (obj_elf_section, obj_elf_type): Set has_gnu_osabi.
* testsuite/gas/elf/section12a.d: Update xfails.
* testsuite/gas/elf/section12b.d: Likewise.
Alan Modra [Wed, 24 Jul 2019 00:41:08 +0000 (10:11 +0930)]
Re: ELF final_write_processing
I missed some early exits from final_write_processing that mean
_bfd_elf_final_write_processing could be missed.
* elf-vxworks.c (elf_vxworks_final_write_processing): Don't return
early.
* elf32-arc.c (arc_elf_final_write_processing): Likewise.
* elf32-xtensa.c (elf_xtensa_final_write_processing): Likewise.
Alan Modra [Wed, 24 Jul 2019 01:21:56 +0000 (10:51 +0930)]
Define ELF_OSABI for visium
and update expected results for gas mbind tests.
bfd/
* elf32-visium.c (visium_elf_post_process_headers): Don't set
EI_OSABI header byte here.
(ELF_OSABI): Define.
gas/
* testsuite/gas/elf/section12a.d: xfail visium and cloudabi.
* testsuite/gas/elf/section12b.d: Likewise.
* testsuite/gas/elf/section13.d: Likewise.
Alan Modra [Wed, 24 Jul 2019 05:33:49 +0000 (15:03 +0930)]
PT_GNU_MBIND section mapping
* elf/internal.h (ELF_SECTION_IN_SEGMENT_1): Exclude non-alloc
sections in GNU_MBIND segments.
Tom de Vries [Wed, 24 Jul 2019 06:36:17 +0000 (08:36 +0200)]
Update expected info threads error messages in gdb.multi/tids.exp
We currently have these FAILs:
...
FAIL: gdb.multi/tids.exp: two inferiors: info threads -1
FAIL: gdb.multi/tids.exp: two inferiors: info threads -$one
...
because we're expecting:
...
Invalid thread ID: -1
...
but instead we have:
...
Unrecognized option at: -1
...
This error message for info threads has changed since commit
54d6600669
'Make "info threads" use the gdb::option framework'.
Update the test accordingly.
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2019-07-24 Tom de Vries <tdevries@suse.de>
PR testsuite/24831
* gdb.multi/tids.exp: Update error messages for info threads.
Tom de Vries [Wed, 24 Jul 2019 06:04:59 +0000 (08:04 +0200)]
[gdb/testsuite] Fix info-types.exp for debug info from more than one file
On openSUSE Leap 15.0, I get:
...
FAIL: gdb.base/info-types.exp: l=c: info types
FAIL: gdb.base/info-types.exp: l=c++: info types
...
because the info type command prints info for files info-types.c, stddef.h,
elf-init.c and init.c, while the regexp in the test-case expect only info for
info-types.c.
Fix this by extending the regexp.
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2019-07-24 Tom de Vries <tdevries@suse.de>
* gdb.base/info-types.exp: Allow info types to print info for more than
one file.
GDB Administrator [Wed, 24 Jul 2019 00:00:22 +0000 (00:00 +0000)]
Automatic date update in version.in
Nick Clifton [Tue, 23 Jul 2019 16:54:32 +0000 (17:54 +0100)]
Fix objdump's display of indirect strings in object files, which was broken by the link following code.
PR 24818
* objdump.c (is_relocateable): Delete.
(load_specific_debug_section): Test the abfd for relocations
directly, rather than relying upon is_relocateable.
(dump_dwarf): Delete initlialization of is_relocateable.
H.J. Lu [Tue, 23 Jul 2019 15:40:23 +0000 (08:40 -0700)]
Add missing ChangeLog entries for
commit
8c728a9d93e2342c57039fcdd6e4a502875b9e09
Author: Martin Liska <mliska@suse.cz>
Date: Mon Jul 22 14:23:32 2019 +0200
Remove tests that test __gnu_lto_v1 symbol.
Kyrylo Tkachov [Tue, 23 Jul 2019 14:54:54 +0000 (15:54 +0100)]
[AArch64] Add support for GMID_EL1 register for +memtag
We're missing support for the GMID_EL1 system register from the Memory Tagging Extension in binutils.
This is specified at:
https://developer.arm.com/docs/ddi0595/latest/aarch64-system-registers/gmid_el1
This simple patch adds the support for this read-only register.
Tested make check on gas.
Tom de Vries [Tue, 23 Jul 2019 13:15:20 +0000 (15:15 +0200)]
[gdb/testsuite] Add missing initial prompt read in multidictionary.exp
When running multidictionary.exp in conjunction with:
...
$ stress -c $(($(cat /proc/cpuinfo | grep -c "^processor") + 1))
...
we get:
...
Running gdb/testsuite/gdb.dwarf2/multidictionary.exp ...
ERROR: Couldn't load multidictionary into gdb.
=== gdb Summary ===
nr of unresolved testcases 1
...
The multidictionary test-case needs -readnow, and achieves this using:
...
gdb_spawn_with_cmdline_opts "-readnow"
gdb_load
...
but the initial gdb prompt is not read. Usually, the following gdb_load
command accidentally consumes that initial prompt (at the gdb_expect for the
kill command in gdb_file_cmd). But under high load, that doesn't happen and
we run into the error.
Fix this by consuming the initial gdb prompt after spawning gdb.
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2019-07-23 Tom de Vries <tdevries@suse.de>
PR testsuite/24842
* gdb.dwarf2/multidictionary.exp: Consume initial prompt after
gdb_spawn_with_cmdline_opts.
Srinath Parvathaneni [Tue, 23 Jul 2019 10:21:11 +0000 (11:21 +0100)]
[gdb][Arm]: gdb cannot step across CMSE secure entry function code.
GDB is not able to execute "step" command on function calls of Armv8-M cmse secure entry functions.
Everytime GNU linker come across definition of any cmse secure entry function in object file(s),
it creates two new instructions secure gateway (sg) and original branch destination (b.w),
place those two instructions in ".gnu.sgstubs" section of executable.
Any function calls to these cmse secure entry functions is re-directed through secure gateway (sg)
present in ".gnu.sgstubs" section.
Example:
Following is a function call to cmse secure entry function "foo":
...
bl xxxx <foo> --->(a)
...
<foo>
xxxx: push {r7, lr}
GNU linker on finding out "foo" is a cmse secure entry function, created sg and b.w instructions and
place them in ".gnu.sgstubs" section (marked by c).
The "bl" instruction (marked by a) which is a call to cmse secure entry function is modified by GNU linker
(as marked by b) and call flow is re-directly through secure gateway (sg) in ".gnu.sgstubs" section.
...
bl yyyy <foo> ---> (b)
...
section .gnu.sgstubs: ---> (c)
yyyy <foo>
yyyy: sg // secure gateway
b.w xxxx <__acle_se_foo> // original_branch_dest
...
0000xxxx <__acle_se_foo>
xxxx: push {r7, lr} ---> (d)
On invoking GDB, when the control is at "b" and we pass "step" command, the pc returns "yyyy"
(sg address) which is a trampoline and which does not exist in source code. So GDB jumps
to next line without jumping to "__acle_se_foo" (marked by d).
The above details are published on the Arm website [1], please refer to section 5.4 (Entry functions)
and section 3.4.4 (C level development flow of secure code).
[1] https://developer.arm.com/architectures/cpu-architecture/m-profile/docs/ecm0359818/latest/armv8-m-security-extensions-requirements-on-development-tools-engineering-specification
This patch fixes above problem by returning target pc "xxxx" to GDB on executing "step"
command at "b", so that the control jumps to "__acle_se_foo" (marked by d).
gdb/ChangeLog:
* arm-tdep.c (arm_skip_cmse_entry): New function.
(arm_is_sgstubs_section): New function.
(arm_skip_stub): Add call to arm_skip_cmse_entry function.
gdb/testsuite/ChangeLog:
* gdb.arch/arm-cmse-sgstubs.c: New test.
* gdb.arch/arm-cmse-sgstubs.exp: New file.
Martin Liska [Mon, 22 Jul 2019 12:23:32 +0000 (14:23 +0200)]
Remove tests that test __gnu_lto_v1 symbol.
ld/ChangeLog:
2019-07-22 Martin Liska <mliska@suse.cz>
* testsuite/ld-plugin/lto-3r.d: Remove.
* testsuite/ld-plugin/lto-5r.d: Remove.
* testsuite/ld-plugin/lto.exp: Do not run lto-3r and lto-5r
tests.
Alan Modra [Tue, 23 Jul 2019 08:24:42 +0000 (17:54 +0930)]
SHF_GNU_MBIND requires ELFOSABI_GNU
When SHF_GNU_MBIND was added in the SHF_LOOS to SHF_HIOS range, it
should have required ELFOSABI_GNU since these flags are already in use
by other OSes. HPUX SHF_HP_TLS in fact has the same value. That
means no place in binutils should test SHF_GNU_MBIND without first
checking OSABI, and SHF_GNU_MBIND should not be set without also
setting OSABI. At least, that's the ideal, but the patch accepts
SHF_GNU_MBIND on ELFOSABI_NONE object files since gas didn't always
set OSABI. However, to reinforce the fact that SHF_GNU_MBIND isn't
proper without a non-zero OSABI, readelf will display the flag as
LOOS+0 if OSABI isn't set.
The clash with SHF_HP_TLS means that hppa64-linux either has that flag
on .tbss sections or supports GNU_MBIND, not both. (hppa64-linux
users, if there are any, may have noticed that GNU ld since 2017
mysteriously aligned their .tbss sections to a 4k boundary. That was
one consequence of SHF_HP_TLS being blindly interpreted as
SHF_GNU_MBIND.) Since it seems that binutils, gdb, gcc, glibc, and
the linux kernel don't care about SHF_HP_TLS I took that flag out of
.tbss for hppa64-linux.
bfd/
* elf-bfd.h (enum elf_gnu_osabi): Add elf_gnu_osabi_mbind.
* elf.c (_bfd_elf_make_section_from_shdr): Set elf_gnu_osabi_mbind.
(get_program_header_size): Formatting. Only test SH_GNU_MBIND
when elf_gnu_osabi_mbind is set.
(_bfd_elf_map_sections_to_segments): Likewise.
(_bfd_elf_init_private_section_data): Likewise.
(_bfd_elf_final_write_processing): Update comment.
* elf64-hppa.c (elf64_hppa_special_sections): Move .tbss entry.
(elf_backend_special_sections): Define without .tbss for linux.
binutils/
* readelf.c (get_parisc_segment_type): Split off hpux entries..
(get_ia64_segment_type): ..and these..
(get_hpux_segment_type): ..to here.
(get_segment_type): Condition GNU_MBIND on osabi. Use
get_hpux_segment_type.
(get_symbol_binding): Do not print UNIQUE for ELFOSABI_NONE.
(get_symbol_type): Do not print IFUNC for ELFOSABI_NONE.
gas/
* config/obj-elf.c (obj_elf_change_section): Don't emit a fatal
error for non-SHF_ALLOC SHF_GNU_MBIND here.
(obj_elf_parse_section_letters): Return SHF_GNU_MBIND in new
gnu_attr param.
(obj_elf_section): Adjust obj_elf_parse_section_letters call.
Formatting. Set SHF_GNU_MBIND and elf_osabi from gnu_attr.
Emit normal error for non-SHF_ALLOC SHF_GNU_MBIND and wrong osabi.
(obj_elf_type): Set elf_osabi for ifunc.
* testsuite/gas/elf/section12a.d: xfail msp430 and hpux.
* testsuite/gas/elf/section12b.d: Likewise.
* testsuite/gas/elf/section13.d: Likewise.
* testsuite/gas/elf/section13.l: Adjust expected error.
ld/
* emultempl/elf32.em (gld${EMULATION_NAME}_place_orphan): Condition
SHF_GNU_MBIND on osabi. Set output elf_gnu_osabi_mbind.
Alan Modra [Tue, 23 Jul 2019 08:16:38 +0000 (17:46 +0930)]
ELF final_write_processing
Move setting of OSABI to final_write_processing, after symbols are
written. This allows OSABI to be set based on symbols actually
written to the output rather than assuming input symbols will be
output.
Corrects object files such as the one generated on powerpc64le-linux
by ld-powerpc/pr23927.s which has a local STT_GNU_IFUNC symbol but
prior to this patch the file was marked ELFOSABI_NONE.
* elf-bfd.h (enum elf_gnu_osabi): Rename from elf_gnu_symbols.
Remove none, any, all enums.
(struct elf_obj_tdata): Rename has_gnu_symbols field to has_gnu_osabi.
(_bfd_elf_final_write_processing): Declare.
* elf.c (_bfd_elf_write_object_contents): Unconditionally call
elf_backend_final_write_processing.
(_bfd_elf_post_process_headers): Move body of function to..
(_bfd_elf_final_write_processing): ..here, but set EI_OSABI byte
only when not already set. Adjust for rename.
* elfxx-target.h (elf_backend_final_write_processing): Default to
_bfd_elf_final_write_processing.
* elf-hppa.h (elf_hppa_final_write_processing): Call
_bfd_elf_final_write_processing.
* elf-m10300.c (_bfd_mn10300_elf_final_write_processing): Likewise.
* elf-nacl.c (nacl_final_write_processing): Likewise.
* elf-vxworks.c (elf_vxworks_final_write_processing): Likewise.
* elf32-arc.c (arc_elf_final_write_processing): Likewise.
* elf32-avr.c (bfd_elf_avr_final_write_processing): Likewise.
* elf32-bfin.c (elf32_bfin_final_write_processing): Likewise.
* elf32-cr16.c (_bfd_cr16_elf_final_write_processing): Likewise.
* elf32-cris.c (cris_elf_final_write_processing): Likewise.
* elf32-h8300.c (elf32_h8_final_write_processing): Likewise.
* elf32-lm32.c (lm32_elf_final_write_processing): Likewise.
* elf32-m32r.c (m32r_elf_final_write_processing): Likewise.
* elf32-m68k.c (elf_m68k_final_write_processing): Likewise.
* elf32-msp430.c (bfd_elf_msp430_final_write_processing): Likewise.
* elf32-nds32.c (nds32_elf_final_write_processing): Likewise.
* elf32-or1k.c (or1k_elf_final_write_processing): Likewise.
* elf32-pj.c (pj_elf_final_write_processing): Likewise.
* elf32-v850.c (v850_elf_final_write_processing): Likewise.
* elf32-xc16x.c (elf32_xc16x_final_write_processing): Likewise.
* elf32-xtensa.c (elf_xtensa_final_write_processing): Likewise.
* elf64-ia64-vms.c (elf64_vms_final_write_processing): Likewise.
* elfnn-ia64.c (elfNN_ia64_final_write_processing): Likewise.
* elf32-arm.c (arm_final_write_processing): Split out from..
(elf32_arm_final_write_processing): ..here. Call
_bfd_elf_final_write_processing.
(elf32_arm_nacl_final_write_processing): Adjust.
* elfxx-mips.c (_bfd_mips_final_write_processing): Split out from..
(_bfd_mips_elf_final_write_processing): ..here. Call
_bfd_elf_final_write_processing.
* elfxx-mips.h (_bfd_mips_final_write_processing): Declare.
* elf32-mips.c (mips_vxworks_final_write_processing): Adjust.
* elf32-ppc.c (ppc_final_write_processing): Split out from..
(ppc_elf_final_write_processing): ..here. Call
_bfd_elf_final_write_processing.
(ppc_elf_vxworks_final_write_processing): Adjust.
* elf32-sparc.c (sparc_final_write_processing): Split out from..
(elf32_sparc_final_write_processing): ..here. Call
_bfd_elf_final_write_processing.
(elf32_sparc_vxworks_final_write_processing): Adjust.
* elf32-d10v.c (elf_backend_final_write_processing): Don't define.
* elf32-d30v.c (elf_backend_final_write_processing): Don't define.
* elf32-m68hc11.c (elf_backend_final_write_processing): Don't define.
* elf32-m68hc12.c (elf_backend_final_write_processing): Don't define.
* elf32-s12z.c (elf_backend_final_write_processing): Don't define.
* elf32-i386.c (elf_i386_check_relocs): Don't set has_gnu_symbols.
* elf64-x86-64.c (elf_x86_64_check_relocs): Likewise.
* elflink.c (elf_link_add_object_symbols): Likewise.
(elf_link_output_symstrtab): Set has_gnu_osabi for symbols here
instead.
Alan Modra [Tue, 23 Jul 2019 08:15:25 +0000 (17:45 +0930)]
Move ld-scripts size tests
Also restore them somewhat closer to the original. They originally
failed on many targets, and a month later I "simplified" them as part
of a larger patch fixing other failing tests. That unfortunately lost
their main purpose, which was to test TLS layout.
* testsuite/ld-elf/size-1.d,
* testsuite/ld-elf/size-1.s,
* testsuite/ld-elf/size-1.t: New test.
* testsuite/ld-elf/size-2.d,
* testsuite/ld-elf/size-2.s,
* testsuite/ld-elf/size-2.t: New test.
* testsuite/ld-scripts/size-1.d,
* testsuite/ld-scripts/size-1.s,
* testsuite/ld-scripts/size-1.t,
* testsuite/ld-scripts/size-2.s,
* testsuite/ld-scripts/size-2.d,
* testsuite/ld-scripts/size-2.t,
* testsuite/ld-scripts/size.exp: Delete.
Alan Modra [Tue, 23 Jul 2019 08:14:19 +0000 (17:44 +0930)]
binutils testsuite test for ELF32 vs ELF64
* testsuite/binutils-all/objcopy.exp (elf64): Correct object
file used to set this variable.
Alan Modra [Tue, 23 Jul 2019 08:13:28 +0000 (17:43 +0930)]
gas "mbind sections" test
Doesn't fail on rx-elf
* testsuite/gas/elf/section12a.d: Don't skip for rx.
Nick Clifton [Tue, 23 Jul 2019 08:47:06 +0000 (09:47 +0100)]
Add Changelog entry missing from previous delta.
2019-07-22 Barnaby Wilks <barnaby.wilks@arm.com>
* arm-dis.c (is_mve_unpredictable): Stop marking some MVE
instructions as UNPREDICTABLE.
Omar Majid [Tue, 23 Jul 2019 08:44:57 +0000 (09:44 +0100)]
Allow objdump to recognise the System.Runtime.dll files that get shipped with .NET Core 2.1.
include * coff/i386.h (IMAGE_FILE_MACHINE_NATIVE_APPLE_OVERRIDE): Define.
(IMAGE_FILE_MACHINE_NATIVE_FREEBSD_OVERRIDE): Define.
(IMAGE_FILE_MACHINE_NATIVE_LINUX_OVERRIDE): Define.
(IMAGE_FILE_MACHINE_NATIVE_NETBSD_OVERRIDE): Define.
(I386_APPLE_MAGIC): Define.
(I386_FREEBSD_MAGIC): Define.
(I386_LINUX_MAGIC): Define.
(I386_NETBSD_MAGIC): Define.
(I386BADMAG): Extend macro to allow new magic numbers.
* coff/x86_64.h (IMAGE_FILE_MACHINE_NATIVE_APPLE_OVERRIDE): Define.
(IMAGE_FILE_MACHINE_NATIVE_FREEBSD_OVERRIDE): Define.
(IMAGE_FILE_MACHINE_NATIVE_LINUX_OVERRIDE): Define.
(IMAGE_FILE_MACHINE_NATIVE_NETBSD_OVERRIDE): Define.
(AMD64_APPLE_MAGIC): Define.
(AMD64_FREEBSD_MAGIC): Define.
(AMD64_LINUX_MAGIC): Define.
(AMD64_NETBSD_MAGIC): Define.
(AMD64BADMAG): Extend macro to allow new magic numbers.
bfd * coffcode.h (coff_set_arch_mach_hook): Handle I386_APPLE_MAGIC,
I386_FREEBSD_MAGIC, I386_LINUX_MAGIC, I386_NETBSD_MAGIC,
AMD64_APPLE_MAGIC, AMD64_FREEBSD_MAGIC, AMD64_LINUX_MAGIC,
AMD64_NETBSD_MAGIC.
* peXXigen.c: Add comment about source of .NET magic numbers.
binutils* Makefile.am (AUTOMAKE_OPTIONS): Add subdir-objects
(GENTESTDLLSPROG): Define.
(TEST_PROGS): Add GENTESTDLLSPROG.
* Makefile.in: Regenerate.
* testsuite/binutils-all/objdump.exp
(test_objdump_dotnet_assemblies): New proc.
Run the new proc.
* testsuite/gentestdlls.c: New source file.
Tom de Vries [Tue, 23 Jul 2019 08:38:33 +0000 (10:38 +0200)]
[gdb/testsuite] Fix command result testing in mi-complete.exp
When running gdb.mi/mi-complete.exp in conjunction with:
...
$ stress -c $(($(cat /proc/cpuinfo | grep -c "^processor") + 1))
...
we get less than 50% full passes:
...
$ for n in $(seq 1 100); do \
make V=1 -O check \
'RUNTESTFLAGS=gdb.mi/mi-complete.exp --target_board=unix'; \
done 2>&1 \
| grep "expected passes" | sort | uniq -c
45 # of expected passes 7
9 # of expected passes 8
46 # of expected passes 9
...
A diff between a passing and failing gdb.log shows this difference:
...
-&"set max-completions 1\n"
2-complete br
+&"set max-completions 1\n"
...
The problem is that the test-case issues the "set max-completion <n>" command,
and without waiting for the output issues a next command, and tries to parse
the results of both commands, expecting a specific interleaving of the various
output streams.
Fix the FAIL by waiting for the result of the "set max-completion <n>" command
before issuing another command.
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2019-07-23 Tom de Vries <tdevries@suse.de>
PR testsuite/24711
* gdb.mi/mi-complete.exp: Wait for "set max-completions" result before
issuing next command.
GDB Administrator [Tue, 23 Jul 2019 00:00:36 +0000 (00:00 +0000)]
Automatic date update in version.in
Tom Tromey [Mon, 22 Jul 2019 14:34:25 +0000 (08:34 -0600)]
Remove self-assign from make_invisible_and_set_new_height
In https://sourceware.org/ml/gdb-patches/2019-07/msg00509.html, Jan
pointed out that clang points out that
make_invisible_and_set_new_height self-assigns "height".
This patch fixes the bug by renaming the formal parameter.
gdb/ChangeLog
2019-07-22 Tom Tromey <tom@tromey.com>
* tui/tui-win.c (tui_win_info::make_invisible_and_set_new_height):
Don't self-assign.
Srinath Parvathaneni [Mon, 22 Jul 2019 13:46:11 +0000 (14:46 +0100)]
Fixes the linker testcase "Secure gateway veneers:cmse functions debug information missing" which was failing due to output regular expression mismatch on arm-none-linux-gnueabihf targets.
* ld/testsuite/ld-arm/cmse_main_sec_debug.d: Modify regexps to
allow for output from a arm-none-linux-gnueabihf target.
Barnaby Wilks [Mon, 22 Jul 2019 12:18:27 +0000 (13:18 +0100)]
This patch addresses the change in the June Armv8.1-M Mainline specification, that marks certain MVE instructions as no longer UNPREDICTABLE when a source operand is the same as a destination operand for a 32-bit element size.
The instructions that this change apply to are:
VQDMLADH, VQRDMLADH, VQDMLSDH, VQRDMLSDH
The updated documentation is here: https://static.docs.arm.com/ddi0553/bh/DDI0553B_h_armv8m_arm.pdf
Fixed this by removing the check for this warning from GAS as well as opcodes.
Added testcases to test that the warning is not generated for the instructions that have a 32-bit element size
and the same source and destination operand. Also fixed tests that would previously check for this warning.
gas * config/tc-arm.c (do_mve_vqdmladh): Remove check for UNPREDICTABLE.
* testsuite/gas/arm/mve-vqdmladh-bad.l: Remove tests.
* testsuite/gas/arm/mve-vqdmladh-bad.s: Remove tests.
* testsuite/gas/arm/mve-vqdmladh.d: New tests.
* testsuite/gas/arm/mve-vqdmladh.s: New tests.
* testsuite/gas/arm/mve-vqdmlsdh-bad.l: Remove tests.
* testsuite/gas/arm/mve-vqdmlsdh-bad.s: Remove tests.
* testsuite/gas/arm/mve-vqdmlsdh.d: New tests.
* testsuite/gas/arm/mve-vqdmlsdh.s: New tests.
opcodes * arm-dis.c (is_mve_unpredictable): Stop marking some MVE
instructions as UNPREDICTABLE.
Andrew Burgess [Fri, 12 Jul 2019 10:26:32 +0000 (11:26 +0100)]
gdb: Show type summary for anonymous structures from c_print_typedef
Currently each language has a la_print_typedef method, this is only
used for the "info types" command.
The documentation for "info types" says:
Print a brief description of all types whose names match the regular
expression @var{regexp} (or all types in your program, if you supply
no argument).
However, if we consider this C code:
typedef struct {
int a;
} my_type;
Then currently with "info types" this will be printed like this:
3: typedef struct {
int a;
} my_type;
I see two problems with this, first the indentation is clearly broken,
second, if the struct contained more fields then it feels like the
actual type names could easily get lost in the noise.
Given that "info types" is about discovering type names, I think there
is an argument to be made that we should focus on giving _only_ the
briefest summary for "info types", and if the user wants to know more
they can take the type name and plug it into "ptype". As such, I
propose that a better output would be:
3: typedef struct {...} my_type;
The user understands that there is a type called `my_type`, and that
it's an alias for an anonymous structure type.
The change to achieve this turns out to be pretty simple, but only
effects languages that make use of c_print_typedef, which are C, C++,
asm, minimal, d, go, objc, and opencl. Other languages will for now
do whatever they used to do.
The patch to change how anonymous structs are displayed also changes
the display of anonymous enums, consider this code sample:
typedef enum {
AA, BB, CC
} anon_enum_t;
This used to be displayed like this:
3: typedef enum {AA, BB, CC} anon_enum_t;
Which will quickly become cluttered for enums with a large number of
values. The modified output looks like this:
3: typedef enum {...} anon_enum_t;
Again, the user can always make use of ptype if they want to see the
details of the anon_enum_t type.
It is worth pointing out that this change (to use {...}) only effects
anonymous structs and enums, named types don't change with this patch,
consider this code:
struct struct_t {
int i;
};
enum enum_t {
AA, BB, CC
};
The output from 'info types' remains unchanged, like this:
4: enum enum_t;
1: struct struct_t;
An additional area of interest is how C++ handles anonymous types used
within a typedef; enums are handled basically inline with how C
handles them, but structs (and classes) are slightly different. The
behaviour before the patch is different, and is unchanged by this
patch. Consider this code compiled for C++:
typedef struct {
int i;
} struct_t;
Both before and after this patch, this is show by 'info types' as:
3: typedef struct_t struct_t;
Unions are displayed similarly to structs in both C and C++, the
handling of anonymous unions changes for C in the same way that
it changes for anonymous structs.
I did look at ada, as this is the only language to actually have some
tests for "info types", however, as I understand it ada doesn't really
support typedefs, however, by forcing the language we can see what ada
would print. So, if we 'set language ada', then originally we printed
this:
3: record
a: int;
end record
Again the indentation is clearly broken, but we also have no mention
of the type name at all, which is odd, but understandable given the
lack of typedefs. If I make a similar change as I'm proposing for C,
then we now get this output:
3: record ... end record
Which is even less informative I think. However, the original output
_is_ tested for in gdb.ada/info_auto_lang.exp, and its not clear to me
if the change is a good one or not, so for now I have left this out.
gdb/ChangeLog:
* c-typeprint.c (c_print_typedef): Pass -1 instead of 0 to
type_print.
gdb/testsuite/ChangeLog:
* gdb.ada/info_auto_lang.exp: Update expected results.
* gdb.base/info-types.c: Add additional types to check.
* gdb.base/info-types.exp: Update expected results.
Andrew Burgess [Tue, 9 Jul 2019 17:05:59 +0000 (18:05 +0100)]
gdb: Improve output from "info types" commad
This commit makes two changes to the "info types" command:
First, only use typedef_print for printing typedefs, and use
type_print for printing non-typedef scalar (non-struct) types. The
result of this is the output for builtin types goes from this:
typedef double;
typedef float;
typedef int;
to this:
double;
float;
int;
which seems to make more sense.
Next GDB no longer matches msymbols as possible type names. When
looking for function symbols it makes sense to report matching
msymbols from the text sections, and for variables msymbols from the
data/bss sections, but when reporting types GDB would match msymbols
of type absolute. But I don't see why these are likely to indicate
type names. As such I've updated the msymbol matching lists in
symtab.c:search_symbols so that when searching in the TYPES_DOMAIN, we
never match any msymbols.
gdb/ChangeLog:
* symtab.c (search_symbols): Adjust msymbol matching type arrays
so that GDB doesn't match any msymbols when searching in the
TYPES_DOMAIN.
(print_symbol_info): Print using typedef_print or type_print based
on the type of the symbol. Add updated FIXME comment moved from...
(_initialize_symtab): ... move and update FIXME comment to above.
gdb/testsuite/ChangeLog:
* gdb.base/info-types.c: New file.
* gdb.base/info-types.exp: New file.
Andrew Burgess [Thu, 11 Jul 2019 20:02:59 +0000 (21:02 +0100)]
gdb: Switch "info types" over to use the gdb::options framework
Adds a new -q flag to "info types" using the gdb::option framework.
This -q flag is similar to the -q flag already present for "info
variables" and "info functions".
gdb/ChangeLog:
* NEWS: Mention adding -q option to "info types".
* symtab.c (struct info_types_options): New struct.
(info_types_options_defs): New variable.
(make_info_types_options_def_group): New function.
(info_types_command): Use gdb::option framework to parse options.
(info_types_command_completer): New function.
(_initialize_symtab): Extend the help text on "info types" and
register command completer.
gdb/doc/ChangeLog:
* gdb.texinfo (Symbols): Add information about -q flag to "info
types".
Christian Biesinger [Mon, 22 Jul 2019 03:27:07 +0000 (22:27 -0500)]
Add ChangeLog entry for the last commit
Forgot to commit before pushing :(
Christian Biesinger [Thu, 11 Jul 2019 18:35:13 +0000 (13:35 -0500)]
Use block_enum instead of int for better typesafety
gdb/ChangeLog:
2019-07-21 Christian Biesinger <cbiesinger@google.com>
* symtab.c (lookup_symbol_in_objfile_symtabs): Change int to block_enum.
(lookup_symbol_in_objfile): Change int to block_enum and add a
gdb_assert to make sure block_index is GLOBAL_BLOCK or STATIC_BLOCK.
Christian Biesinger [Sat, 20 Jul 2019 16:55:32 +0000 (11:55 -0500)]
[FYI] Add myself to gdb/MAINTAINERS
gdb/Changelog:
* MAINTAINERS (Write After Approval): Add myself.
GDB Administrator [Mon, 22 Jul 2019 00:00:29 +0000 (00:00 +0000)]
Automatic date update in version.in
Kevin Buettner [Thu, 27 Jun 2019 02:38:24 +0000 (19:38 -0700)]
Make documentation of "python" command match actual behavior
The example in the documentation for the "python" command shows GDB
outputting instructions for how to terminate a sequence of python
commands entered from the command line. The documentation shows that
the following two lines are being output, though this does not occur
when actually using the "python" command from GDB:
Type python script
End with a line saying just "end".
While display of this text might be helpful, GDB has several other
commands which also use the "end" terminator that offer no such text.
Examples include the "if" and "while" commands. For example,
(gdb) if 1==1
>print "a"
>end
$1 = "a"
This seems similar to doing:
(gdb) python
>print 23
>end
23
If we decide that we want the "python" command to print such a message,
we should also adjust the behavior for other GDB commands which also use
"end" to terminate a command list. I.e, if this decision is made, the
"if" and "while" commands ought to also print similar messages.
So, for the moment anyway, this commit adjusts the documentation of the
python command to match its implementation.
This patch was taken from a larger body of work originating from the
Archer project. I haven't been able to determine its original author,
though I did find a commit log from Jan Kratochvil (in the Archer
repository) which suggests that the change had originally been made to
gdb.texinfo, but got inadvertently dropped when the python related
documentation was split out to python.texi.
gdb/doc/ChangeLog:
* python.texi (python command): Revise example to match
command behavior.
GDB Administrator [Sun, 21 Jul 2019 00:00:45 +0000 (00:00 +0000)]
Automatic date update in version.in
Alan Modra [Sat, 20 Jul 2019 01:17:20 +0000 (10:47 +0930)]
PR24827, Linker loops forever if unterminated multi-line comment in script
YY_INPUT returns 0 on end of input, not EOF.
PR 24827
* ldlex.l (comment): Check for 0 return from input(), not EOF.
GDB Administrator [Sat, 20 Jul 2019 00:00:24 +0000 (00:00 +0000)]
Automatic date update in version.in
Andrew Burgess [Fri, 19 Jul 2019 09:34:47 +0000 (10:34 +0100)]
gdb/riscv: Write 4-byte nop to dummy code region before inferior calls
When making inferior function calls GDB sets up a dummy code region on
the stack, and places a breakpoint within that region. If the random
stack contents appear to be a compressed instruction then GDB will
place a compressed breakpoint, which can cause problems if the target
doesn't support compressed instructions.
This commit prevents this issue by writing a 4-byte nop instruction to
the dummy region at the time the region is allocated. With this nop
instruction in place, when we come to insert the breakpoint then an
uncompressed breakpoint will be used.
This is similar to other targets, for example mips.
gdb/ChangeLog:
* riscv-tdep.c (riscv_push_dummy_code): Write a 4-byte nop
instruction to the dummy code region.
gdb/testsuite/ChangeLog:
* gdb.arch/riscv-bp-infcall.c: New file.
* gdb.arch/riscv-bp-infcall.exp: New file.
H.J. Lu [Fri, 19 Jul 2019 18:07:59 +0000 (11:07 -0700)]
x86: Pass -O0 to assembler in noextreg.d
* testsuite/gas/i386/noextreg.d: Pass -O0 to assembler.
Tom Tromey [Mon, 15 Jul 2019 16:41:18 +0000 (10:41 -0600)]
Change ARI to mention C++11, and remove some rules
I noticed that ARI mentions "ISO C 90", but now gdb uses C++11. This
patch updates some text to reflect this change.
I also noticed that a few rules can be removed now. ARGSUSED doesn't
seem to be an issue any more (there's no code mentioning this and I
doubt most of us even remember this convention); PARAMS was specific
to K&R C; and __func__ is available in C++11.
gdb/ChangeLog
2019-07-19 Tom Tromey <tromey@adacore.com>
* contrib/ari/gdb_ari.sh: Mention C++11, not ISO C 90.
(ARGSUSED, PARAMS, __func__): Remove rules.
Alan Hayward [Fri, 19 Jul 2019 14:06:38 +0000 (15:06 +0100)]
Arm: Remove unused feature files and tests
Remove the xml tests. Now that it has been proven the new descriptions
are identical, there is no need to keep testing that. Also, it would
prevent the old xml files from being removed.
Remove the old xml files from gdbserver and delete them.
gdb/ChangeLog:
* arm-tdep.c (_initialize_arm_tdep): Remove xml tests.
* features/arm/arm-with-iwmmxt.c: Remove.
* features/arm/arm-with-iwmmxt.xml: Remove.
* features/arm/arm-with-m-fpa-layout.c: Remove.
* features/arm/arm-with-m-fpa-layout.xml: Remove.
* features/arm/arm-with-m-vfp-d16.c: Remove.
* features/arm/arm-with-m-vfp-d16.xml: Remove.
* features/arm/arm-with-m.c: Remove.
* features/arm/arm-with-m.xml: Remove.
* features/arm/arm-with-neon.c: Remove.
* features/arm/arm-with-neon.xml: Remove.
* features/arm/arm-with-vfpv2.c: Remove.
* features/arm/arm-with-vfpv2.xml: Remove.
* features/arm/arm-with-vfpv3.c: Remove.
* features/arm/arm-with-vfpv3.xml: Remove.
gdb/gdbserver/ChangeLog:
2019-07-05 Alan Hayward <alan.hayward@arm.com>
* configure.srv: Remove Arm xml files.
Alan Hayward [Fri, 19 Jul 2019 14:04:48 +0000 (15:04 +0100)]
Arm: Use read_description funcs in gdbserver
Switch gdbserver over to using feature target descriptions.
Add a function for determining the type of a given target description,
and use where required.
gdb/gdbserver/ChangeLog:
* configure.srv: Add new files. Remove xml generated files.
* linux-aarch32-low.c (initialize_low_arch_aarch32): Don't init
registers.
* linux-aarch32-low.h (tdesc_arm_with_neon): Remove.
* linux-aarch32-tdesc.c: New file.
* linux-aarch32-tdesc.h: New file.
* linux-aarch64-low.c (aarch64_arch_setup): Call aarch32_linux_read_description.
* linux-arm-low.c (init_registers_arm, tdesc_arm)
(init_registers_arm_with_iwmmxt, tdesc_arm_with_iwmmxt)
(init_registers_arm_with_vfpv2, tdesc_arm_with_vfpv2)
(init_registers_arm_with_vfpv3, tdesc_arm_with_vfpv3): Remove.
(arm_fill_wmmxregset, arm_store_wmmxregset, arm_fill_vfpregset)
(arm_store_vfpregset): Call arm_linux_get_tdesc_fp_type.
(arm_read_description): Call arm_linux_read_description.
(initialize_low_arch): Don't init registers.
* linux-arm-tdesc.c: New file.
* linux-arm-tdesc.h: New file.
Alan Hayward [Fri, 19 Jul 2019 14:02:41 +0000 (15:02 +0100)]
Arm: Add xml unit tests
Use the record_xml_tdesc tests to prove the new target descriptions
are identical to the previous xml file ones.
This is tested as part of gdb.gdb/unittest.exp.
gdb/ChangeLog:
* arm-tdep.c (_initialize_arm_tdep): Add xml regression tests.
Alan Hayward [Fri, 19 Jul 2019 14:01:11 +0000 (15:01 +0100)]
Arm: Use feature target descriptions
In arm arm_create_target_description and
aarch32_create_target_description create feature based target descriptions
instead of returning the old style descriptions.
Ensure the descriptions are created in exactly the same way as the old xml
files.
Remove the old initialize calls.
gdb/ChangeLog:
* arch/aarch32.c (aarch32_create_target_description): Create
target descriptions using features.
* arch/arm.c (arm_create_target_description)
(arm_create_mprofile_target_description): Likewise.
* arm-tdep.c (_initialize_arm_tdep): Remove tdesc init calls.
Alan Hayward [Fri, 19 Jul 2019 13:59:10 +0000 (14:59 +0100)]
Arm: Add read_description read funcs and use in GDB
Switch the Arm target to get target descriptions via arm_read_description
and aarch32_read_description, in the same style as other feature targets.
Add an enum to specify the different types - this will also be of use to
gdbserver in a later patch.
Under the hood return the same existing pre-feature target descriptions.
gdb/ChangeLog:
* Makefile.in: Add new files.
* aarch32-tdep.c: New file.
* aarch32-tdep.h: New file.
* aarch64-linux-nat.c (aarch64_linux_nat_target::read_description):
Call aarch32_read_description.
* arch/aarch32.c: New file.
* arch/aarch32.h: New file.
* arch/arm.c (arm_create_target_description)
(arm_create_mprofile_target_description): New function.
* arch/arm.h (arm_fp_type, arm_m_profile_type): New enum.
(arm_create_target_description)
(arm_create_mprofile_target_description): New declaration.
* arm-fbsd-tdep.c (arm_fbsd_read_description_auxv): Call
read_description functions.
* arm-linux-nat.c (arm_linux_nat_target::read_description):
Likewise.
* arm-linux-tdep.c (arm_linux_core_read_description): Likewise.
* arm-tdep.c (tdesc_arm_list): New variable.
(arm_register_g_packet_guesses): Call create description functions.
(arm_read_description) (arm_read_mprofile_description): New
function.
* arm-tdep.h (arm_read_description)
(arm_read_mprofile_description): Add declaration.
* configure.tgt: Add new files.
Jose E. Marchesi [Fri, 19 Jul 2019 13:35:43 +0000 (15:35 +0200)]
cpu,opcodes,gas: use %r0 and %r6 instead of %a and %ctf in eBPF disassembler
This patch changes the eBPF CPU description to prefer the register
names %r0 and %r6 instead of %a and %ctx when disassembling. This
matches better with the current practice, vs. cBPF.
It also updates the GAS tests in order to reflect this change.
Tested in a x86_64 host.
cpu/ChangeLog:
2019-07-19 Jose E. Marchesi <jose.marchesi@oracle.com>
* bpf.cpu (h-gpr): when disassembling, use %r0 and %r6 instead of
%a and %ctx.
opcodes/ChangeLog:
2019-07-19 Jose E. Marchesi <jose.marchesi@oracle.com>
* bpf-desc.c: Regenerated.
gas/ChangeLog:
2019-07-19 Jose E. Marchesi <jose.marchesi@oracle.com>
* testsuite/gas/bpf/alu.d: Use %r6 instead of %ctx.
* testsuite/gas/bpf/lddw-be.d: Likewise.
* testsuite/gas/bpf/lddw.d: Likewise.
* testsuite/gas/bpf/alu-be.d: Likewise.
* testsuite/gas/bpf/alu32.d: Likewise.
Jose E. Marchesi [Fri, 19 Jul 2019 13:35:02 +0000 (15:35 +0200)]
gas: make .lcomm to accept an optional aligmnet in eBPF targets
Tested in a x86_64 host.
gas/ChangeLog:
2019-07-19 Jose E. Marchesi <jose.marchesi@oracle.com>
* config/tc-bpf.c (pe_lcomm_internal): Adapted from tc-i386.c.
(pe_lcomm): Likewise.
(md_pseudo_table): Use pe_lcomm to implement .lcomm.
Richard Sandiford [Fri, 19 Jul 2019 11:18:02 +0000 (12:18 +0100)]
[AArch64] Rename +bitperm to +sve2-bitperm
After some discussion, we've decided to rename the +bitperm feature
flag to +sve2-bitperm, so that it's consistent with the other SVE2
feature flags. The associated internal macros already used
"SVE2_BITPERM", so only the feature flag itself needs to change.
2019-07-19 Richard Sandiford <richard.sandiford@arm.com>
gas/
* doc/c-aarch64.texi: Remame the +bitperm extension to +sve2-bitperm.
* config/tc-aarch64.c (aarch64_features): Likewise.
* testsuite/gas/aarch64/illegal-sve2-aes.d: Update accordingly.
* testsuite/gas/aarch64/illegal-sve2-sha3.d: Likewise.
* testsuite/gas/aarch64/illegal-sve2-sm4.d: Likewise.
* testsuite/gas/aarch64/illegal-sve2.d: Likewise.
* testsuite/gas/aarch64/sve2.d: Likewise.
Alan Modra [Fri, 19 Jul 2019 06:06:58 +0000 (15:36 +0930)]
[PowerPC64] pc-relative TLS relocations
This patch supports using pcrel instructions in TLS code sequences. A
number of new relocations are needed, gas operand modifiers to
generate those relocations, and new TLS optimisation. For
optimisation it turns out that the new pcrel GD and LD sequences can
be distinguished from the non-pcrel GD and LD sequences by there being
different relocations on the new sequence. The final "add ra,rb,13"
on IE sequences similarly needs a new relocation, or as I chose, a
modification of R_PPC64_TLS. On pcrel IE code, the R_PPC64_TLS points
one byte into the "add" instruction rather than being on the
instruction boundary.
GD:
pla 3,z@got@tlsgd@pcrel # R_PPC64_GOT_TLSGD34
bl __tls_get_addr@notoc(z@tlsgd) # R_PPC64_TLSGD and R_PPC64_REL24_NOTOC
edited to IE
pld 3,z@got@tprel@pcrel
add 3,3,13
edited to LE
paddi 3,13,z@tprel
nop
LD:
pla 3,z@got@tlsld@pcrel # R_PPC64_GOT_TLSLD34
bl __tls_get_addr@notoc(z@tlsld) # R_PPC64_TLSLD and R_PPC64_REL24_NOTOC
..
paddi 9,3,z2@dtprel
pld 10,z3@got@dtprel@pcrel
add 10,10,3
edited to LE
paddi 3,13,0x1000
nop
IE:
pld 9,z@got@tprel@pcrel # R_PPC64_GOT_TPREL34
add 3,9,z@tls@pcrel # R_PPC64_TLS at insn+1
ldx 4,9,z@tls@pcrel
lwax 5,9,z@tls@pcrel
stdx 5,9,z@tls@pcrel
edited to LE
paddi 9,13,z@tprel
nop
ld 4,0(9)
lwa 5,0(9)
std 5,0(9)
LE:
paddi 10,13,z@tprel
include/
* elf/ppc64.h (R_PPC64_TPREL34, R_PPC64_DTPREL34),
(R_PPC64_GOT_TLSGD34, R_PPC64_GOT_TLSLD34),
(R_PPC64_GOT_TPREL34, R_PPC64_GOT_DTPREL34): Define.
(IS_PPC64_TLS_RELOC): Include new tls relocs.
bfd/
* reloc.c (BFD_RELOC_PPC64_TPREL34, BFD_RELOC_PPC64_DTPREL34),
(BFD_RELOC_PPC64_GOT_TLSGD34, BFD_RELOC_PPC64_GOT_TLSLD34),
(BFD_RELOC_PPC64_GOT_TPREL34, BFD_RELOC_PPC64_GOT_DTPREL34),
(BFD_RELOC_PPC64_TLS_PCREL): New pcrel tls relocs.
* elf64-ppc.c (ppc64_elf_howto_raw): Add howtos for pcrel tls relocs.
(ppc64_elf_reloc_type_lookup): Translate pcrel tls relocs.
(must_be_dyn_reloc, dec_dynrel_count): Add R_PPC64_TPREL64.
(ppc64_elf_check_relocs): Support pcrel tls relocs.
(ppc64_elf_tls_optimize, ppc64_elf_relocate_section): Likewise.
* bfd-in2.h: Regenerate.
* libbfd.h: Regenerate.
gas/
* config/tc-ppc.c (ppc_elf_suffix): Map "tls@pcrel", "got@tlsgd@pcrel",
"got@tlsld@pcrel", "got@tprel@pcrel", and "got@dtprel@pcrel".
(fixup_size, md_assemble): Handle pcrel tls relocs.
(ppc_force_relocation, ppc_fix_adjustable): Likewise.
(md_apply_fix, tc_gen_reloc): Likewise.
ld/
* testsuite/ld-powerpc/tlsgd.d,
* testsuite/ld-powerpc/tlsgd.s,
* testsuite/ld-powerpc/tlsie.d,
* testsuite/ld-powerpc/tlsie.s,
* testsuite/ld-powerpc/tlsld.d,
* testsuite/ld-powerpc/tlsld.s: New tests.
* testsuite/ld-powerpc/powerpc.exp: Run them.
Alan Modra [Fri, 19 Jul 2019 05:00:36 +0000 (14:30 +0930)]
[PowerPC] Rename testcase
Just making room for a new tlsld test.
* testsuite/ld-powerpc/tlsldopt.d: Rename from tlsld.d.
* testsuite/ld-powerpc/tlsldopt.s: Rename from tlsld.s.
* testsuite/ld-powerpc/tlsldopt32.d: Rename from tlsld32.d.
* testsuite/ld-powerpc/tlsldopt32.s: Rename from tlsld32.s.
* testsuite/ld-powerpc/powerpc.exp: Update.
Alan Modra [Fri, 19 Jul 2019 07:37:36 +0000 (17:07 +0930)]
Re: ld -r: Don't merge with member of output section group
PR 24819
* testsuite/ld-elf/pr24819.d: xfail for genelf targets.
GDB Administrator [Fri, 19 Jul 2019 00:00:39 +0000 (00:00 +0000)]
Automatic date update in version.in
Nick Alcock [Thu, 18 Jul 2019 17:44:21 +0000 (18:44 +0100)]
libctf: introduce ctf_func_type_{info,args}, ctf_type_aname_raw
The first two of these allow you to get function type info and args out
of the types section give a type ID: astonishingly, this was missing
from libctf before now: so even though types of kind CTF_K_FUNCTION were
supported, you couldn't find out anything about them. (The existing
ctf_func_info and ctf_func_args only allow you to get info about
functions in the function section, i.e. given symbol table indexes, not
type IDs.)
The second of these allows you to get the raw undecorated name out of
the CTF section (strdupped for safety) without traversing subtypes to
build a full C identifier out of it. It's useful for things that are
already tracking the type kind etc and just need an unadorned name.
include/
* ctf-api.h (ECTF_NOTFUNC): Fix description.
(ctf_func_type_info): New.
(ctf_func_type_args): Likewise.
libctf/
* ctf-types.c (ctf_type_aname_raw): New.
(ctf_func_type_info): Likewise.
(ctf_func_type_args): Likewise.
* ctf-error.c (_ctf_errlist): Fix description.
Guillaume LABARTHE [Thu, 18 Jul 2019 16:20:04 +0000 (17:20 +0100)]
Fix for using named pipes on Windows
On Windows, passing a named pipe as terminal argument to the new-ui
command does not work.
The problem is that the new_ui_command function in top.c opens the
same tty three times, for stdin, stdout and stderr. With Windows
named pipes, the second and third calls to open fail.
Opening the file only once and passing the same stream for stdin,
stdout and stderr makes it work.
Pedro says:
I tried it on GNU/Linux and things still work.
I ran all the MI tests with forced new-ui, with:
$ make check TESTS="gdb.mi/*.exp" RUNTESTFLAGS="FORCE_MI_SEPARATE_UI=1"
and saw no regressions.
gdb/ChangeLog:
2019-07-18 Guillaume LABARTHE <guillaume.labarthe@gmail.com>
* top.c (new_ui_command): Open specified terminal just once.
Tom Tromey [Thu, 18 Jul 2019 15:29:15 +0000 (09:29 -0600)]
Constify main_name
This patch constifies the return type of main_name. There is a
comment indicating that this wasn't possible at some point in the
past, but whatever the barrier was, it is gone now.
Tested by rebuilding.
gdb/ChangeLog
2019-07-18 Tom Tromey <tromey@adacore.com>
* symtab.c (main_name): Constify return type.
* symfile.c (set_initial_language): Update.
* symtab.h (main_name): Constify return type.
H.J. Lu [Thu, 18 Jul 2019 15:01:45 +0000 (08:01 -0700)]
ld -r: Don't merge with member of output section group
When doing a relocatable link, members of input section group are
placed in their own output sections. We need to make sure that no
input sections are merged with member of output section group.
PR ld/24819
* emultempl/elf32.em (elf_orphan_compatible): Return FALSE for
member of output section group when doing a relocatable link.
* testsuite/ld-elf/pr24819.d: New file.
* testsuite/ld-elf/pr24819.s: Likewise.
Alan Modra [Thu, 18 Jul 2019 01:42:40 +0000 (11:12 +0930)]
[PowerPC64] Use STN_UNDEF internally for edited relocs
It's not correct to use non-STT_TLS symbols with TLS relocation, not
that it matters much when editing relocs, but this edited reloc can be
output by --emit-relocs. So don't use a symbol on the reloc.
* elf64-ppc.c (ppc64_elf_relocate_section): Don't bother selecting
a TLS section symbol for edited relocs. Tighten TLS symbol/reloc
match test.
Alan Modra [Thu, 18 Jul 2019 01:34:06 +0000 (11:04 +0930)]
[PowerPC64] Don't store TLS_EXPLICIT in tls_mask
This saves a bit in tls_mask, and fixes a bug that could be triggered
in the unlikely case that both @got (usual ELF style) and @toc
(PowerOpen style) code was used to set up args for __tls_get_addr.
* elf64-ppc.c (TLS_EXPLICIT): Define as 256.
(ppc64_elf_check_relocs): Don't store TLS_EXPLICIT even if char
is more than 8 bits.
(ppc64_elf_tls_optimize): Likewise. Make tls_set, tls_clear, and
tls_type vars unsigned int.
(ppc64_elf_relocate_section): Use r_type rather than TLS_EXPLICIT
to select r_type edit.
Alan Modra [Thu, 18 Jul 2019 01:28:01 +0000 (10:58 +0930)]
[PowerPC] Rename TLS_TPRELGD to TLS_GDIE
Choose a better name, that reflects why the flag is set (GD to IE
optimisation) rather than what the flag produces (TPREL64 reloc on
a single GOT entry replacing a tls_index pair).
* elf32-ppc.c (TLS_GDIE): Rename from TLS_TPRELGD throughout file.
Correct comment.
* elf64-ppc.c (TLS_GDIE): Likewise.
Alan Modra [Thu, 18 Jul 2019 01:01:44 +0000 (10:31 +0930)]
[PowerPC64] correct tprel offset limit
I don't expect anyone will have hit this bug. You'd need a TLS
segment of 2G before you'd notice.
* elf64-ppc.c (ppc64_elf_tls_optimize): Correct test for allowed
range of tp-relative offsets.
Jose E. Marchesi [Wed, 17 Jul 2019 21:18:41 +0000 (23:18 +0200)]
gas: .lcomm gets an alignment argument in eBPF
gas/ChangeLog:
2019-07-17 Jose E. Marchesi <jose.marchesi@oracle.com>
* config/tc-bpf.c: Make .lcomm to get a third argument with the
alignment.