Tom Tromey [Fri, 17 Nov 2017 19:05:58 +0000 (12:05 -0700)]
Use an enum to represent subclasses of symbol
This changes struct symbol to use an enum to encode the concrete
subclass of a particular symbol. Note that "enum class" doesn't work
properly with bitfields, so a plain enum is used.
2017-11-17 Tom Tromey <tom@tromey.com>
* symtab.h (enum symbol_subclass_kind): New.
(struct symbol) <is_cplus_template_function, is_rust_vtable>:
Remove.
<subclass>: New member.
(SYMBOL_IS_CPLUS_TEMPLATE_FUNCTION): Update.
* rust-lang.c (rust_get_trait_object_pointer): Update.
* dwarf2read.c (read_func_scope): Update.
(read_variable): Update.
Tom Tromey [Fri, 17 Nov 2017 18:55:38 +0000 (11:55 -0700)]
Make template_symbol derive from symbol
This changes template_symbol to derive from symbol, which seems a bit
cleaner; and also more consistent with rust_vtable_symbol.
2017-11-17 Tom Tromey <tom@tromey.com>
* dwarf2read.c (read_func_scope): Update.
* symtab.h (struct template_symbol): Derive from symbol.
<base>: Remove.
Tom Tromey [Thu, 6 Jul 2017 12:44:38 +0000 (06:44 -0600)]
Handle dereferencing Rust trait objects
In Rust, virtual tables work a bit differently than they do in C++. In
C++, as you know, they are connected to a particular class hierarchy.
Rust, instead, can generate a virtual table for potentially any type --
in fact, one such virtual table for each trait (a trait is similar to an
abstract class or to a Java interface) that a type implements.
Objects that are referenced via a trait can't currently be inspected by
gdb. This patch implements the Rust equivalent of "set print object".
gdb relies heavily on the C++ ABI to decode virtual tables; primarily to
make "set print object" work; but also "info vtbl". However, Rust does
not currently have a specified ABI, so this approach seems unwise to
emulate.
Instead, I've changed the Rust compiler to emit some DWARF that
describes trait objects (previously their internal structure was
opaque), vtables (currently just a size -- but I hope to expand this in
the future), and the concrete type for which a vtable was emitted.
The concrete type is expressed as a DW_AT_containing_type on the
vtable's type. This is a small extension to DWARF.
This patch adds a new entry to quick_symbol_functions to return the
symtab that holds a data address. Previously there was no way in gdb to
look up a full (only minimal) non-text symbol by address. The psymbol
implementation of this method works by lazily filling in a map that is
added to the objfile. This avoids slowing down psymbol reading for a
feature that is likely to not be used too frequently.
I did not update .gdb_index. My thinking here is that the DWARF 5
indices will obsolete .gdb_index soon-ish, meaning that adding a new
feature to them is probably wasted work. If necessary I can update the
DWARF 5 index code when it lands in gdb.
Regression tested on x86-64 Fedora 25.
2017-11-17 Tom Tromey <tom@tromey.com>
* symtab.h (struct symbol) <is_rust_vtable>: New member.
(struct rust_vtable_symbol): New.
(find_symbol_at_address): Declare.
* symtab.c (find_symbol_at_address): New function.
* symfile.h (struct quick_symbol_functions)
<find_compunit_symtab_by_address>: New member.
* symfile-debug.c (debug_qf_find_compunit_symtab_by_address): New
function.
(debug_sym_quick_functions): Link to
debug_qf_find_compunit_symtab_by_address.
* rust-lang.c (rust_get_trait_object_pointer): New function.
(rust_evaluate_subexp) <case UNOP_IND>: New case. Call
rust_get_trait_object_pointer.
* psymtab.c (psym_relocate): Clear psymbol_map.
(psym_fill_psymbol_map, psym_find_compunit_symtab_by_address): New
functions.
(psym_functions): Link to psym_find_compunit_symtab_by_address.
* objfiles.h (struct objfile) <psymbol_map>: New member.
* dwarf2read.c (dwarf2_gdb_index_functions): Update.
(process_die) <DW_TAG_variable>: New case. Call read_variable.
(rust_containing_type, read_variable): New functions.
2017-11-17 Tom Tromey <tom@tromey.com>
* gdb.rust/traits.rs: New file.
* gdb.rust/traits.exp: New file.
Simon Marchi [Fri, 17 Nov 2017 18:02:25 +0000 (13:02 -0500)]
Remove DEF_VEC_I (int)
Now that all its usages are removed, we can get rid of DEF_VEC_I (int).
gdb/ChangeLog:
* common/gdb_vecs.h (DEF_VEC_I (int)): Remove.
Simon Marchi [Fri, 17 Nov 2017 18:02:25 +0000 (13:02 -0500)]
Make process_info::syscalls_to_catch an std::vector
This patch makes the syscalls_to_catch field of process_info an
std::vector<int>. The process_info structure must now be
newed/deleted.
In handle_extended_wait, the code that handles exec events destroys the
existing process_info and creates a new one. It moves the content of
syscalls_to_catch from the old to the new vector. I used std::move for
that (through an intermediary variable), which should have the same
behavior as the old code.
gdb/gdbserver/ChangeLog:
* inferiors.h (struct process_info): Add constructor, initialize
fields..
<syscalls_to_catch>: Change type to std::vector<int>.
* inferiors.c (add_process): Allocate process_info with new.
(remove_process): Free process_info with delete.
* linux-low.c (handle_extended_wait): Adjust.
(gdb_catching_syscalls_p, gdb_catch_this_syscall_p): Adjust.
* server.c (handle_general_set): Adjust.
Simon Marchi [Fri, 17 Nov 2017 18:02:24 +0000 (13:02 -0500)]
Make open_fds an std::vector
Simple replacement of VEC with std::vector.
gdb/ChangeLog:
* common/filestuff.c: Include <algorithm>.
(open_fds): Change type to std::vector<int>.
(do_mark_open_fd): Adjust.
(unmark_fd_no_cloexec): Adjust.
(do_close): Adjust.
Simon Marchi [Fri, 17 Nov 2017 18:02:23 +0000 (13:02 -0500)]
Make output_thread_groups take an std::vector<int>
A simple replacement of VEC with std::vector.
gdb/ChangeLog:
* breakpoint.c (output_thread_groups): Take an std::vector.
(print_one_breakpoint_location): Adjust.
Joel Brobecker [Thu, 16 Nov 2017 00:02:33 +0000 (19:02 -0500)]
(Ada) fix handling of minimal symbols (UNOP_CAST and UNOP_ADDR)
Consider a program which provides a symbol without debugging
information. For instance, compiling the following code without -g:
Some_Minimal_Symbol : Integer := 1234;
pragma Export (C, Some_Minimal_Symbol, "some_minsym");
Trying to print this variable with GDB now causes an error, which
is now expected:
(gdb) p some_minsym
'some_minsym' has unknown type; cast it to its declared type
However, trying to cast this symbol, or to take its address
does not work:
(gdb) p integer(some_minsym)
'some_minsym' has unknown type; cast it to its declared type
(gdb) p &some_minsym
'some_minsym' has unknown type; cast it to its declared type
Another manisfestation of this issue can be seen when trying to
insert an Ada exception catchpoint for a specific standard exception
(this only occurs if the Ada runtime is built without debugging
information, which is the default). For instance:
$ (gdb) catch exception constraint_error
warning: failed to reevaluate internal exception condition for catchpoint 0: 'constraint_error' has unknown type; cast it to its declared type
This is because, internally, the cachtpoint uses a condition referencing
a minimal symbol, more precisely:
long_integer (e) = long_integer (&constraint_error)
This patch fixes all issues listed above:
1. resolve_subexp: Special-case the handling of OP_VAR_MSYM_VALUE
expression elements, where there are no ambiguities to be resolved
in that situation;
2. ada_evaluate_subexp: Enhance the handling of the UNOP_CAST
handling so as to process the case where the target of
the cast is a minimal symbol (as well as a symbol with debugging
information). This mimics what's done in C.
gdb/ChangeLog:
* ada-lang.c (resolve_subexp): Add handling of OP_VAR_MSYM_VALUE.
(ada_evaluate_subexp_for_cast): New function.
(ada_evaluate_subexp) <UNOP_CAST>: Replace code by call to
ada_evaluate_subexp_for_cast.
(ada_evaluate_subexp) <nosideret>: Replace code by call to
eval_skip_value.
* eval.c (evaluate_var_value): Make non-static.
(evaluate_var_msym_value, eval_skip_value): Likewise.
* value.h (evaluate_var_value, evaluate_var_msym_value)
(eval_skip_value): Declare.
gdb/testsuite/ChangeLog:
* gdb.ada/minsyms: New testcase.
Tested on x86_64-linux. No regression. Fixes the following failures:
catch_ex.exp: continuing to Program_Error exception
catch_ex.exp: continuing to failed assertion
catch_ex.exp: continuing to unhandled exception
catch_ex.exp: continuing to program completion
complete.exp: p <Exported_Capitalized>
complete.exp: p Exported_Capitalized
complete.exp: p exported_capitalized
mi_catch_ex.exp: catch Program_Error (unexpected output)
mi_catch_ex.exp: continue to exception catchpoint hit (unknown output after running)
mi_catch_ex.exp: continue to assert failure catchpoint hit (unknown output after running)
mi_catch_ex.exp: continue to unhandled exception catchpoint hit (unknown output after running)
mi_ex_cond.exp: catch C_E if i = 2 (unexpected output)
Nick Clifton [Fri, 17 Nov 2017 12:44:16 +0000 (12:44 +0000)]
Fix a memory leak when processing archives.
PR 22449
* ar.c (write_archive): Free the temporary file name.
H.J. Lu [Fri, 17 Nov 2017 12:09:12 +0000 (04:09 -0800)]
x86: Pass "%F%P:" to linker callback in case of error
We should pass "%F%P:" to linker callback in case of error. Otherwise,
linker will report:
: failed to create GNU property section
* elfxx-x86.c (_bfd_x86_elf_link_setup_gnu_properties): Pass
"%F%P:", instead of "%F:", to linker callback in case of error.
Nick Clifton [Fri, 17 Nov 2017 12:05:34 +0000 (12:05 +0000)]
Fix a snafu in a previous update to readelf that stopped it from printing archive member names along with the archive file name.
--
This patch causes problems for glibc linknamespace tests because of how it
changes the output format of readelf on .a files.
Previously, "readelf -W -s libc.a" would produce output starting e.g.:
File: /scratch/jmyers/glibc/many8/build/glibcs/x86_64-linux-gnu/glibc/libc.a(init-first.o)
Symbol table '.symtab' contains 30 entries:
and continuing with symbol information for each object in that .a file.
After this commit, instead it starts:
File: /scratch/jmyers/glibc/many8/build/glibcs/x86_64-linux-gnu/glibc/libc.a
Symbol table '.symtab' contains 30 entries:
and every object's symbol information starts with the same File: line,
missing any information about which object's symbols (within libc.a) are
being listed.
I think the previous File: lines that said libc.a(init-first.o) etc.,
identifying the particular object within libc.a, were clearly preferable,
and the glibc linknamespace tests rely on having that information about
the individual object within libc.a.
--
binutils * readelf.c (process_archive): Include member name in the
file_name of the filedata structure.
Joel Brobecker [Fri, 17 Nov 2017 00:15:13 +0000 (16:15 -0800)]
ada-lang.c::ada_value_cast: remove unused parameter noside
gdb/ChangeLog:
* ada-lang.c (ada_value_cast): Remove parameter "noside".
Update all callers.
GDB Administrator [Fri, 17 Nov 2017 00:00:18 +0000 (00:00 +0000)]
Automatic date update in version.in
Pedro Alves [Thu, 16 Nov 2017 18:44:44 +0000 (18:44 +0000)]
Test breakpoint commands w/ "continue" + Ctrl-C
This adds the testcase that exposed the multiple problems with Ctrl-C
handling fixed by the previous patches, when run against both native
and gdbserver GNU/Linux.
gdb/ChangeLog:
2017-11-16 Pedro Alves <palves@redhat.com>
* gdb.base/bp-cmds-continue-ctrl-c.c: New file.
* gdb.base/bp-cmds-continue-ctrl-c.exp: New file.
Pedro Alves [Thu, 16 Nov 2017 18:44:44 +0000 (18:44 +0000)]
Python unwinder sniffer: PyExc_KeyboardInterrupt -> Quit
If you happen to press Ctrl-C while GDB is running the Python unwinder
machinery, the Ctrl-C is swallowed by the Python unwinder machinery.
For example, with:
break foo
commands
> c
> end
and
while (1)
foo ();
and then let the inferior hit "foo" repeatedly, sometimes Ctrl-C
results in:
~~~
23 usleep (100);
Breakpoint 2, foo () at gdb.base/bp-cmds-continue-ctrl-c.c:23
23 usleep (100);
^C
Breakpoint 2, Python Exception <class 'KeyboardInterrupt'> <class 'KeyboardInterrupt'>:
foo () at gdb.base/bp-cmds-continue-ctrl-c.c:23
23 usleep (100);
Breakpoint 2, foo () at gdb.base/bp-cmds-continue-ctrl-c.c:23
23 usleep (100);
Breakpoint 2, foo () at gdb.base/bp-cmds-continue-ctrl-c.c:23
23 usleep (100);
~~~
Notice the Python exception above. The interesting thing here is that
GDB continues as if nothing happened, doesn't really stop and give
back control to the user. Instead, the Ctrl-C aborted the Python
unwinder sniffer and GDB moved on to just use another unwinder.
Fix this by translating a PyExc_KeyboardInterrupt back into a Quit
exception once back in GDB.
This was exposed by the new gdb.base/bp-cmds-continue-ctrl-c.exp
testcase added later in the series.
gdb/ChangeLog:
2017-11-16 Pedro Alves <palves@redhat.com>
* python/py-unwind.c (pyuw_sniffer): Translate
PyExc_KeyboardInterrupt to a GDB Quit exception.
Pedro Alves [Thu, 16 Nov 2017 18:44:43 +0000 (18:44 +0000)]
Don't ever Quit out of resume
If you have a breakpoint command that re-resumes the target, like:
break foo
commands
> c
> end
and then let the inferior run, hitting the breakpoint, and then press
Ctrl-C at just the right time, between GDB processing the stop at
"foo", and re-resuming the target, you'll hit the QUIT call in
infrun.c:resume.
With this hack, we can reproduce the bad case consistently:
--- a/gdb/inf-loop.c
+++ b/gdb/inf-loop.c
@@ -31,6 +31,8 @@
#include "top.h"
#include "observer.h"
+bool continue_hack;
+
/* General function to handle events in the inferior. */
void
@@ -64,6 +66,8 @@ inferior_event_handler (enum inferior_event_type event_type,
{
check_frame_language_change ();
+ continue_hack = true;
+
/* Don't propagate breakpoint commands errors. Either we're
stopping or some command resumes the inferior. The user will
be informed. */
diff --git a/gdb/infrun.c b/gdb/infrun.c
index
d425664..
c74b14c 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -2403,6 +2403,10 @@ resume (enum gdb_signal sig)
gdb_assert (!tp->stop_requested);
gdb_assert (!thread_is_in_step_over_chain (tp));
+ extern bool continue_hack;
+
+ if (continue_hack)
+ set_quit_flag ();
QUIT;
The GDB backtrace looks like this:
(top-gdb) bt
...
#3 0x0000000000612e8b in throw_quit(char const*, ...) (fmt=0xaf84a1 "Quit") at src/gdb/common/common-exceptions.c:408
#4 0x00000000007fc104 in quit() () at src/gdb/utils.c:748
#5 0x00000000006a79d2 in default_quit_handler() () at src/gdb/event-top.c:954
#6 0x00000000007fc134 in maybe_quit() () at src/gdb/utils.c:762
#7 0x00000000006f66a3 in resume(gdb_signal) (sig=GDB_SIGNAL_0) at src/gdb/infrun.c:2406
#8 0x0000000000700c3d in keep_going_pass_signal(execution_control_state*) (ecs=0x7ffcf3744e60) at src/gdb/infrun.c:7793
#9 0x00000000006f5fcd in start_step_over() () at src/gdb/infrun.c:2145
#10 0x00000000006f7b1f in proceed(unsigned long, gdb_signal) (addr=
18446744073709551615, siggnal=GDB_SIGNAL_DEFAULT)
at src/gdb/infrun.c:3135
#11 0x00000000006ebdd4 in continue_1(int) (all_threads=0) at src/gdb/infcmd.c:842
#12 0x00000000006ec097 in continue_command(char*, int) (args=0x0, from_tty=0) at src/gdb/infcmd.c:938
#13 0x00000000004b5140 in do_cfunc(cmd_list_element*, char*, int) (c=0x2d18570, args=0x0, from_tty=0)
at src/gdb/cli/cli-decode.c:106
#14 0x00000000004b8219 in cmd_func(cmd_list_element*, char*, int) (cmd=0x2d18570, args=0x0, from_tty=0)
at src/gdb/cli/cli-decode.c:1952
#15 0x00000000007f1532 in execute_command(char*, int) (p=0x7ffcf37452b1 "", from_tty=0) at src/gdb/top.c:608
#16 0x00000000004bd127 in execute_control_command(command_line*) (cmd=0x3a88ef0) at src/gdb/cli/cli-script.c:485
#17 0x00000000005cae0c in bpstat_do_actions_1(bpstat*) (bsp=0x37edcf0) at src/gdb/breakpoint.c:4513
#18 0x00000000005caf67 in bpstat_do_actions() () at src/gdb/breakpoint.c:4563
#19 0x00000000006e8798 in inferior_event_handler(inferior_event_type, void*) (event_type=INF_EXEC_COMPLETE, client_data=0x0)
at src/gdb/inf-loop.c:72
#20 0x00000000006f9447 in fetch_inferior_event(void*) (client_data=0x0) at src/gdb/infrun.c:3970
#21 0x00000000006e870e in inferior_event_handler(inferior_event_type, void*) (event_type=INF_REG_EVENT, client_data=0x0)
at src/gdb/inf-loop.c:43
#22 0x0000000000494d58 in remote_async_serial_handler(serial*, void*) (scb=0x3585ca0, context=0x2cd1b80)
at src/gdb/remote.c:13820
#23 0x000000000044d682 in run_async_handler_and_reschedule(serial*) (scb=0x3585ca0) at src/gdb/ser-base.c:137
#24 0x000000000044d767 in fd_event(int, void*) (error=0, context=0x3585ca0) at src/gdb/ser-base.c:188
#25 0x00000000006a5686 in handle_file_event(file_handler*, int) (file_ptr=0x45997d0, ready_mask=1)
at src/gdb/event-loop.c:733
#26 0x00000000006a5c29 in gdb_wait_for_event(int) (block=1) at src/gdb/event-loop.c:859
#27 0x00000000006a4aa6 in gdb_do_one_event() () at src/gdb/event-loop.c:347
#28 0x00000000006a4ade in start_event_loop() () at src/gdb/event-loop.c:371
and when that happens, you end up with GDB's run control in quite a
messed up state. Something like this:
thread_function1 (arg=0x1) at threads.c:107
107 usleep (SLEEP); /* Loop increment. */
Quit
(gdb) c
Continuing.
** nothing happens, time passes..., press ctrl-c again **
^CQuit
(gdb) info threads
Id Target Id Frame
1 Thread 1462.1462 "threads" (running)
* 2 Thread 1462.1466 "threads" (running)
3 Thread 1462.1465 "function0" (running)
(gdb) c
Cannot execute this command while the selected thread is running.
(gdb)
The first "Quit" above is thrown from within "resume", and cancels run
control while GDB is in the middle of stepping over a breakpoint.
with step_over_info_valid_p() true. The next "c" didn't actually
resume anything, because GDB throught that the step-over was still in
progress. It wasn't, because the thread that was supposed to be
stepping over the breakpoint wasn't actually resumed.
So at this point, we press Ctrl-C again, and this time, the default
quit handler is called directly from the event loop
(event-top.c:default_quit_handler -> quit()), because gdb was left
owning the terminal (because the previous resume was cancelled before
we reach target_resume -> target_terminal::inferior()).
Note that the exception called from within resume ends up calling
normal_stop via resume_cleanups. That's very borked though, because
normal_stop is going to re-handle whatever was the last reported
event, possibly even re-running a hook stop... I think that the only
sane way to safely cancel the run control state machinery is to push
an event via handle_inferior_event like all other events.
The fix here does two things, and either alone would fix the problem
at hand:
#1 - passes the terminal to the inferior earlier, so that any QUIT
call from the point we declare the target as running goes to the
inferior directly, protecting run control from unsafe QUIT calls.
#2 - gets rid of this QUIT call in resume and of its related unsafe
resume_cleanups.
Aboout #2, the comment describing resume says:
/* Resume the inferior, but allow a QUIT. This is useful if the user
wants to interrupt some lengthy single-stepping operation
(for child processes, the SIGINT goes to the inferior, and so
we get a SIGINT random_signal, but for remote debugging and perhaps
other targets, that's not true).
but that's a really old comment that predates a lot of fixes to Ctrl-C
handling throughout both GDB core and the remote target, that made
sure that a Ctrl-C isn't ever lost. In any case, if some target
depended on this, a much better fix would be to make the target return
a SIGINT stop out of target_wait the next time that is called.
This was exposed by the new gdb.base/bp-cmds-continue-ctrl-c.exp
testcase added later in the series.
gdb/ChangeLog:
2017-11-16 Pedro Alves <palves@redhat.com>
* infrun.c (resume_cleanups): Delete.
(resume): No longer install a resume_cleanups cleanup nor call
QUIT.
(proceed): Pass the terminal to the inferior.
(keep_going_pass_signal): No longer install a resume_cleanups
cleanup.
Pedro Alves [Thu, 16 Nov 2017 18:44:43 +0000 (18:44 +0000)]
Fix stdin ending up not registered after a Quit
If you press Ctrl-C while GDB is processing breakpoint commands the
TRY/CATCH in inferior_event_handler catches the Quit exception and
prints it, and then if the interpreter was running a foreground
execution command, nothing re-adds stdin back in the event loop,
meaning the debug session ends up busted, because the user can't type
anything...
This was exposed by the new gdb.base/bp-cmds-continue-ctrl-c.exp
testcase added later in the series.
gdb/ChangeLog:
2017-11-16 Pedro Alves <palves@redhat.com>
* inf-loop.c (inferior_event_handler): Don't swallow the exception
if the prompt is blocked.
Pedro Alves [Thu, 16 Nov 2017 18:44:42 +0000 (18:44 +0000)]
Fix swallowed "Quit" when inserting breakpoints
If GDB is inserting a breakpoint and you type Ctrl-C at the exact
"right" time, you'll hit a QUIT call in target_read, and the
breakpoint insertion is cancelled. However, the related TRY/CATCH
code in insert_bp_location does:
CATCH (e, RETURN_MASK_ALL)
{
bp_err = e.error;
bp_err_message = e.message;
}
The problem with that is that a RETURN_QUIT exception has e.error ==
0, which means that further below, in the places that check for error
with:
if (bp_err != GDB_NO_ERROR)
because GDB_NO_ERROR == 0, GDB continues as if the breakpoint was
inserted succesfully, and resumes the inferior. Since the breakpoint
wasn't inserted the inferior runs free, out of our control...
Fix this by having insert_bp_location store a copy of the whole
exception instead of just a error/message parts, and then checking
"gdb_exception::reason" instead.
This was exposed by the new gdb.base/bp-cmds-continue-ctrl-c.exp
testcase added later in the series.
gdb/ChangeLog:
2017-11-16 Pedro Alves <palves@redhat.com>
* breakpoint.c (insert_bp_location): Replace bp_err and
bp_err_message locals by a gdb_exception local.
Pedro Alves [Thu, 16 Nov 2017 18:44:42 +0000 (18:44 +0000)]
gdb/inflow.c: Move SIGTTOU temporary ignoring to a RAII class
I expect to use this in more places (in inflow.c) in follow up
patches, but I think this is still good on its own.
gdb/ChangeLog:
2017-11-16 Pedro Alves <palves@redhat.com>
* inflow.c (scoped_ignore_sigttou): New class.
(child_terminal_ours_1, new_tty): Use it.
Pedro Alves [Thu, 16 Nov 2017 18:07:41 +0000 (18:07 +0000)]
Fix testing gdb.rust/modules.exp against gdbserver
Currently several tests in gdb.rust/modules.exp fail with
--target_board=native-gdbserver:
Running src/gdb/testsuite/gdb.rust/modules.exp ...
FAIL: gdb.rust/modules.exp: call f3()
FAIL: gdb.rust/modules.exp: call self::f2()
FAIL: gdb.rust/modules.exp: call self::super::f2()
FAIL: gdb.rust/modules.exp: call super::f2()
FAIL: gdb.rust/modules.exp: call self::super::super::f2()
FAIL: gdb.rust/modules.exp: call super::super::f2()
FAIL: gdb.rust/modules.exp: call ::f2()
FAIL: gdb.rust/modules.exp: call extern modules::mod1::f2()
This is because these tests rely on matching inferior output.
However, when testing with gdbserver, inferior output goes to a
separate terminal instead of to gdb's terminal, and so gdb_test won't
cut it, as that is only reading from gdb's pty/gdb_spawn_id:
(gdb) call f3()
(gdb) FAIL: gdb.rust/modules.exp: call f3()
call self::f2()
(gdb) FAIL: gdb.rust/modules.exp: call self::f2()
Fix this by using gdb_test_stdio instead, which handles output coming
out of gdbserver's pty.
Also, skip the tests if the target/board doesn't support inferior I/O
at all.
gdb/ChangeLog:
2017-11-16 Pedro Alves <palves@redhat.com>
* gdb.rust/modules.exp: Skip tests that rely on inferior I/O if
gdb,noinferiorio is set, and use gdb_test_stdio otherwise.
Ulrich Weigand [Thu, 16 Nov 2017 17:49:11 +0000 (18:49 +0100)]
Refactor endian handling in DFP routines
This patch moves endian conversion into the decimal_from_number and
decimal_to_number routines, and removes it from all their callers,
making the code simpler overall. No functional change.
gdb/ChangeLog:
2017-11-16 Ulrich Weigand <uweigand@de.ibm.com>
* target-float.c (decimal_from_number): Add byte_order argument and
call match_endianness. Error if unknown floating-point type.
(decimal_to_number): Add byte_order argument and call match_endianness.
(decimal_from_longest): Update call. Do not call match_endianness.
(decimal_from_ulongest): Likewise.
(decimal_binop): Likewise.
(decimal_is_zero): Likewise.
(decimal_compare): Likewise.
(decimal_convert): Likewise.
Tamar Christina [Thu, 16 Nov 2017 16:19:37 +0000 (16:19 +0000)]
Add new AArch64 FP16 FM{A|S} instructions.
This patch separates the new FP16 instructions backported from Armv8.4-a to Armv8.2-a
into a new flag order to distinguish them from the rest of the already existing optional
FP16 instructions in Armv8.2-a.
The new flag "+fp16fml" is available from Armv8.2-a and implies +fp16 and is mandatory on
Armv8.4-a.
gas/
* config/tc-aarch64.c (fp16fml): New.
* doc/c-aarch64.texi (fp16fml): New.
* testsuite/gas/aarch64/armv8_2-a-crypto-fp16.d (fp16): Make fp16fml.
* testsuite/gas/aarch64/armv8_3-a-crypto-fp16.d (fp16): Make fp16fml.
include/
* opcode/aarch64.h: (AARCH64_FEATURE_F16_FML): New.
(AARCH64_ARCH_V8_4): Enable AARCH64_FEATURE_F16_FML by default.
opcodes/
* aarch64-tbl.h (aarch64_feature_fp_16_v8_2): Require AARCH64_FEATURE_F16_FML
and AARCH64_FEATURE_F16.
Tamar Christina [Thu, 16 Nov 2017 16:15:51 +0000 (16:15 +0000)]
Correct AArch64 crypto dependencies.
The crypto options depend on SIMD and FP, the documentation states so but the dependency is not there the code.
We have mostly gotten away with this due to the default flags
for the architectures (e.g. Armv8.2-a implies +simd) but this
discrepancy needs to be addressed.
gas/
2017-11-16 Tamar Christina <tamar.christina@arm.com>
* opcodes/aarch64-tbl.h
(aarch64_feature_crypto): Add ARCH64_FEATURE_SIMD and AARCH64_FEATURE_FP.
(aarch64_feature_crypto_v8_2, aarch64_feature_sm4): Likewise.
(aarch64_feature_sha3): Likewise.
Tamar Christina [Thu, 16 Nov 2017 16:13:01 +0000 (16:13 +0000)]
Update documentation for Arvm8.4-A changes to AArch64.
gas/
2017-11-16 Tamar Christina <tamar.christina@arm.com>
* doc/c-aarch64.texi (armv8.4-a, sha2, sha3, sm4): New.
(dotprod): Update default note.
Tamar Christina [Thu, 16 Nov 2017 16:07:07 +0000 (16:07 +0000)]
Add assembler and disassembler support for the new Armv8.4-a instructions for AArch64.
Some of these instructions have been back-ported as optional extensions to
Armv8.2-a and higher, but others are only available for Armv8.4-a.
opcodes/
* aarch64-tbl.h (sha512h, sha512h2, sha512su0, sha512su1, eor3): New.
(rax1, xar, bcax, sm3ss1, sm3tt1a, sm3tt1b, sm3tt2a, sm3tt2b): New.
(sm3partw1, sm3partw2, sm4e, sm4ekey, fmlal, fmlsl): New.
(fmlal2, fmlsl2, cfinv, rmif, setf8, setf16, stlurb): New.
(ldapurb, ldapursb, stlurh, ldapurh, ldapursh, stlur): New.
(ldapur, ldapursw, stlur): New.
* aarch64-dis-2.c: Regenerate.
gas/
* testsuite/gas/aarch64/armv8_4-a-illegal.d: New.
* testsuite/gas/aarch64/armv8_4-a-illegal.l: New.
* testsuite/gas/aarch64/armv8_4-a-illegal.s: New.
* testsuite/gas/aarch64/armv8_4-a.d: New.
* testsuite/gas/aarch64/armv8_4-a.s: New.
* testsuite/gas/aarch64/armv8_2-a-crypto-fp16.s: New.
* testsuite/gas/aarch64/armv8_2-a-crypto-fp16.d: New.
* testsuite/gas/aarch64/armv8_3-a-crypto-fp16.d: New.
* testsuite/gas/aarch64/armv8_4-a-crypto-fp16.d: New.
* testsuite/gas/aarch64/armv8_2-a-crypto-fp16-illegal.s: New.
* testsuite/gas/aarch64/armv8_2-a-crypto-fp16-illegal.l: New.
* testsuite/gas/aarch64/armv8_2-a-crypto-fp16-illegal.d: New.
Pedro Alves [Thu, 16 Nov 2017 14:58:51 +0000 (14:58 +0000)]
GDBserver: Fix ignored Ctrl-C after reconnection
This fixes the issue reported by Dmitry Antipov <dantipov@nvidia.com>
here:
https://sourceware.org/ml/gdb/2017-10/msg00048.html
The problem is that GDBserver stops listening to Ctrl-C/interrupt
requests if you disconnect and reconnect back.
Dmitry wrote:
~~~
Currently gdbserver installs SIGIO handler just once, in
initialize_async_io() called from captured_main(), and this handler is
removed when remote_desc is closed in remote_close(). Next, when a
new instance of remote_desc is fetched from accept() and has '\003'
arrived, input_interrupt() is never called because it is not
registered as SIGIO handler.
~~~
The fix here is not remove the SIGIO handler in the first place, thus
going back to the original before-first-connection state.
(I haven't gone back to try it, but I think this was a regression
caused by commit
8b2073398477 ("[GDBserver] Block and unblock SIGIO"),
which was what made remote_close remove the signal handler.)
New test included.
gdb/gdbserver/ChangeLog:
2017-11-16 Pedro Alves <palves@redhat.com>
* remote-utils.c (remote_close): Block SIGIO signals instead of
uninstalling the SIGIO handler.
gdb/testsuite/ChangeLog:
2017-11-16 Pedro Alves <palves@redhat.com>
* gdb.server/reconnect-ctrl-c.c: New file.
* gdb.server/reconnect-ctrl-c.exp: New file.
Nick Clifton [Thu, 16 Nov 2017 14:53:32 +0000 (14:53 +0000)]
Prevent illegal memory accesses when parsing incorrecctly formated core notes.
PR 22421
* elf.c (elfcore_grok_netbsd_procinfo): Check that the note is big enough.
(elfcore_grok_openbsd_procinfo): Likewise.
(elfcore_grok_nto_status): Likewise.
Phil Muldoon [Thu, 16 Nov 2017 14:14:03 +0000 (14:14 +0000)]
Add Python rbreak command.
gdb/Changelog
2017-11-16 Phil Muldoon <pmuldoon@redhat.com>
* python/python.c (gdbpy_rbreak): New function.
* NEWS: Document Python rbreak feature.
testsuite/Changelog
2017-11-16 Phil Muldoon <pmuldoon@redhat.com>
* gdb.python/py-rbreak.exp: New file.
* gdb.python/py-rbreak.c: New file.
* gdb.python/py-rbreak-func2.c: New file.
doc/Changelog
2017-11-16 Phil Muldoon <pmuldoon@redhat.com>
* python.texi (Basic Python): Add rbreak documentation.
Nick Clifton [Thu, 16 Nov 2017 13:06:22 +0000 (13:06 +0000)]
Prevent a possible seg-fault in the section merging code, by always creating a padding buffer.
* merge.c (sec_merge_emit): Always create padding buffer. Add
asserts to make sure that the buffer is long enough.
Jan Beulich [Thu, 16 Nov 2017 12:56:45 +0000 (13:56 +0100)]
x86: ignore high register select bit(s) in 32- and 16-bit modes
While commits
9889cbb14e ("Check invalid mask registers") and
abfcb414b9 ("X86: Ignore REX_B bit for 32-bit XOP instructions") went a
bit into the right direction, this wasn't quite enough:
- VEX.vvvv has its high bit ignored
- EVEX.vvvv has its high bit ignored together with EVEX.v'
- the high bits of {,E}VEX.vvvv should not be prematurely zapped, to
allow proper checking of them when the fields has to hold al ones
- when the high bits of an immediate specify a register, bit 7 is
ignored
Pedro Alves [Thu, 16 Nov 2017 11:57:01 +0000 (11:57 +0000)]
Fix gdb.base/starti.exp racy test
This commit fixes a couple problems with gdb.base/starti.exp, causing
spurious FAILs.
The first is a double-prompt problem:
~~~
(gdb) PASS: gdb.base/starti.exp: hook-stop
starti
[....]
gdb_expect_list pattern: /\$1 = 0/
$1 = 0
gdb_expect_list pattern: //
0x00007ffff7ddcc80 in _start () from /lib64/ld-linux-x86-64.so.2
(gdb) # EXPECTED PROMPT
(gdb) PASS: gdb.base/starti.exp: starti # ANOTHER PROMPT!
break main
~~~
This happens because the test uses gdb_test_sequence with no command,
like this:
gdb_test_sequence "" "starti" {
"Program stopped."
"\\$1 = 0"
}
but gdb_test_sequence doesn't have a check for empty command like
gdb_test_multiple does, and so sends "\n" to GDB:
proc gdb_test_sequence { command test_name expected_output_list } {
global gdb_prompt
if { $test_name == "" } {
set test_name $command
}
lappend expected_output_list ""; # implicit ".*" before gdb prompt
send_gdb "$command\n"
return [gdb_expect_list $test_name "$gdb_prompt $" $expected_output_list]
}
"starti" is a no-repeat command, so pressing <ret> just makes another
prompt appear, confusing the following gdb_test/gdb_test_multiple/etc.
Even with that fixed, the testcase is still racy though.
The second problem is that sometimes the "continue" test times out
here:
~~~
continue
Continuing.
$2 = 1
gdb_expect_list pattern: /.*Breakpoint .*main \(\) at .*starti.c.*/
Breakpoint 1, main () at /home/pedro/src/gdb/testsuite/gdb.base/starti.c:29
29 return 0;
(gdb) gdb_expect_list pattern: //
* hung here *
~~~
The problem is that the too-greedy ".*" trailing match in
gdb_expect_list's pattern ends up consuming GDB's prompt too soon.
Fix that by removing the unnecessary trailing ".*". While at it,
remove all ".*"s to be stricter.
Tested on x86_64 GNU/Linux.
gdb/testsuite/ChangeLog:
2017-11-16 Pedro Alves <palves@redhat.com>
* gdb.base/starti.exp ("continue" test): Remove ".*"s from
pattern.
* lib/gdb.exp (gdb_test_sequence): Don't send empty command to
GDB.
Jan Beulich [Thu, 16 Nov 2017 11:28:06 +0000 (12:28 +0100)]
ix86/Intel: don't require memory operand size specifier for PTWRITE
Other than in 64-bit mode, in 32- and 16-bit modes operand size isn't
ambiguous.
H.J. Lu [Thu, 16 Nov 2017 10:50:33 +0000 (02:50 -0800)]
i386: Replace .code64/.code32 with .byte
Since .code64 directive isn't available for 32-bit BFD and ELF directive
isn't available for non-ELF directive, we should avoid them.
* testsuite/gas/i386/noextreg.s: Replace .code64/.code32 and
64-bit instructions with .byte. Remove ELF directive.
Yao Qi [Thu, 16 Nov 2017 10:17:25 +0000 (10:17 +0000)]
Remove non-linux tic6x target descriptions
They are not used by GDB nor by GDBserver. This patch removes them.
gdb:
2017-11-16 Yao Qi <yao.qi@linaro.org>
* features/tic6x-c62x.xml: Remove.
* features/tic6x-c64x.xml: Remove.
* features/tic6x-c64xp.xml: Remove.
Alan Hayward [Thu, 16 Nov 2017 10:05:21 +0000 (10:05 +0000)]
Allow osabi to be optional in target descriptions
gdbserver/
* tdesc.c (tdesc_get_features_xml): Allow null osabi.
Yao Qi [Thu, 16 Nov 2017 10:05:27 +0000 (10:05 +0000)]
Fix tic6x-uclinux GDBserver build failure
I can't find a c6x-uclinux c++ compiler, so I use my host g++ to build
tic6x-uclinux GDBserver, and find the following build failures. They are
not target specific, so I believe they are real errors. This patch fixes
them.
../binutils-gdb/gdb/gdbserver/linux-tic6x-low.c:313:34: error: invalid
conversion from 'void*' to 'tic6x_register*' [-fpermissive]
union tic6x_register *regset = buf;
^
../binutils-gdb/gdb/gdbserver/linux-tic6x-low.c: In function 'void tic6x_store_gregset(regcache*, const void*)':
../binutils-gdb/gdb/gdbserver/linux-tic6x-low.c:324:40: error: invalid
conversion from 'const void*' to 'const tic6x_register*' [-fpermissive]
const union tic6x_register *regset = buf;
^
../binutils-gdb/gdb/gdbserver/linux-tic6x-low.c: At global scope:
../binutils-gdb/gdb/gdbserver/linux-tic6x-low.c:359:28: error: redefinition of 'usrregs_info tic6x_usrregs_info'
static struct usrregs_info tic6x_usrregs_info =
^
../binutils-gdb/gdb/gdbserver/linux-tic6x-low.c:186:28: note: 'usrregs_info tic6x_usrregs_info' previously declared here
static struct usrregs_info tic6x_usrregs_info;
^
gdb/gdbserver:
2017-11-16 Yao Qi <yao.qi@linaro.org>
* linux-tic6x-low.c (tic6x_fill_gregset): Cast buf.
(tic6x_store_gregset): Likewise.
(tic6x_usrregs_info): Move it up.
GDB Administrator [Thu, 16 Nov 2017 00:00:23 +0000 (00:00 +0000)]
Automatic date update in version.in
John Baldwin [Wed, 15 Nov 2017 19:36:42 +0000 (11:36 -0800)]
Include <array> to declare std::array<>.
gdb/ChangeLog:
* symtab.h: Include <array>.
John Baldwin [Wed, 15 Nov 2017 19:35:15 +0000 (11:35 -0800)]
Constify the 'arg' passed to commands in bsd-kvm.c.
gdb/ChangeLog:
* bsd-kvm.c (bsd_kvm_cmd): Constify 'arg'.
(bsd_kvm_proc_cmd): Likewise.
Simon Marchi [Wed, 15 Nov 2017 14:22:48 +0000 (09:22 -0500)]
tui-win: Replace VEC with std::vector
This patch replaces an instance of VEC (const_char_ptr) with
std::vector<const char *>. Tested by running gdb.tui/completion.exp,
which exercises this function.
gdb/ChangeLog:
* tui/tui-win.c (window_name_completer): Replace VEC with
std::vector.
Simon Marchi [Wed, 15 Nov 2017 16:07:02 +0000 (11:07 -0500)]
Fix gdb.tui/completion.exp test
When I run it locally, the test gdb.tui/completion.exp test fails
because of a timeout:
Running /home/emaisin/src/binutils-gdb/gdb/testsuite/gdb.tui/completion.exp ...
FAIL: gdb.tui/completion.exp: completion of layout names: tab completion (timeout)
The problem seems to be this regex, which confirms that after doing
layout<TAB>, "layout" is printed again after the gdb prompt:
-re "^$input_line$"
The problem is that there's a trailing space in the output after
"layout". Since the regex has an anchored end (the $), it doesn't
match. Adding a space fixes the test.
gdb/testsuite/ChangeLog:
* gdb.tui/completionn.exp (test_tab_completion): Add space in
regex.
Tamar Christina [Wed, 15 Nov 2017 15:56:23 +0000 (15:56 +0000)]
Separate the new FP16 instructions backported from Armv8.4-a to Armv8.2-a into a new flag order to distinguish them from the rest of the already existing optional FP16 instructions in Armv8.2-a.
The new flag "+fp16fml" is available from Armv8.2-a and implies +fp16 and is mandatory
from Armv8.4-a.
gas/
* config/tc-arm.c (arm_ext_fp16_fml, fp16fml): New.
(do_neon_fmac_maybe_scalar_long): Use arm_ext_fp16_fml.
* doc/c-arm.texi (fp16, fp16fml): New.
* testsuite/gas/arm/armv8_2-a-fp16.d (fp16): Make fp16fml.
* testsuite/gas/arm/armv8_3-a-fp16.d (fp16): Make fp16fml.
* testsuite/gas/arm/armv8_2-a-fp16-illegal.d (fp16): Make fp16fml.
* testsuite/gas/arm/armv8_2-a-fp16-thumb2.d (fp16): Make fp16fml.
include/
* opcode/arm.h: (ARM_EXT2_FP16_FML): New.
(ARM_AEXT2_V8_4A): Add ARM_EXT2_FP16_FML.
Andrew Cagney [Wed, 15 Nov 2017 15:26:59 +0000 (10:26 -0500)]
Remove no-longer applicable maintainer entries
2017-11-15 Andrew Cagney <cagney@gnu.org>
* MAINTAINERS: Remove no-longer applicable entries.
Andrew Cagney [Wed, 15 Nov 2017 15:12:12 +0000 (10:12 -0500)]
Move self to Past Maintainers.
2017-11-15 Andrew Cagney <cagney@gnu.org>
* MAINTAINERS: Move self to Past Maintainers.
Yao Qi [Wed, 15 Nov 2017 12:03:03 +0000 (12:03 +0000)]
Remove features/nios2-linux.c
tdesc_nios2_linux is not used at all. Remove features/nios2-linux.c,
and don't generate it anymore.
gdb:
2017-11-15 Yao Qi <yao.qi@linaro.org>
* features/Makefile (XMLTOC): Remove nios2-linux.xml.
* features/nios2-linux.c: Remove.
* nios2-linux-tdep.c (_initialize_nios2_linux_tdep): Don't call
initialize_tdesc_nios2_linux.
Alan Modra [Wed, 15 Nov 2017 11:53:22 +0000 (22:23 +1030)]
objcopy memory leak
PR 22426
* objcopy.c (copy_main): Free tmpname.
Alan Modra [Wed, 15 Nov 2017 11:46:08 +0000 (22:16 +1030)]
Handle ' and I format flags
Also a little tidying and error checking.
* bfd.c (union _bfd_doprnt_args): Add "Bad".
(_bfd_doprnt): Handle more flags.
(_bfd_doprnt_scan): Likewise. Tidy setting of args array.
(error_handler_internal): Init args type to Bad.
Nick Clifton [Wed, 15 Nov 2017 11:34:03 +0000 (11:34 +0000)]
Add support to readelf and objdump for following links to separate debug information files.
Hi Guys,
I am applying the rather large patch attached to this email to enhance
the readelf and objdump programs so that they now have the ability to
follow links to separate debug info files. (As requested by PR
15152). So for example whereas before we had this output:
$ readelf -wi main.exe
Contents of the .debug_info section:
[...]
<15> DW_AT_comp_dir : (alt indirect string, offset: 0x30c)
[...]
With the new option enabled we get:
$ readelf -wiK main.exe
main.exe: Found separate debug info file: dwz.debug
Contents of the .debug_info section (loaded from main.exe):
[...]
<15> DW_AT_comp_dir : (alt indirect string, offset: 0x30c) /home/nickc/Downloads/dwzm
[...]
The link following feature also means that we can get two lots of
output if the same section exists in both the main file and the
separate debug info file:
$ readelf -wiK main.exe
main.exe: Found separate debug info file: dwz.debug
Contents of the .debug_info section (loaded from main.exe):
[...]
Contents of the .debug_info section (loaded from dwz.debug):
[...]
The patch also adds the ability to display the contents of debuglink
sections:
$ readelf -wk main.exe
Contents of the .gnu_debugaltlink section:
Separate debug info file: dwz.debug
Build-ID (0x14 bytes):
c4 a8 89 8d 64 cf 70 8a 35 68 21 f2 ed 24 45 3e 18 7a 7a 93
Naturally there are long versions of these options (=follow-links and
=links). The documentation has been updated as well, and since both
readelf and objdump use the same set of debug display options, I have
moved the text into a separate file. There are also a couple of new
binutils tests to exercise the new behaviour.
There are a couple of missing features in the current patch however,
although I do intend to address them in follow up submissions:
Firstly the code does not check the build-id inside separate debug
info files when it is searching for a file specified by a
.gnu_debugaltlink section. It just assumes that if the file is there,
then it contains the information being sought.
Secondly I have not checked the DWARF-5 version of these link
features, so there will probably be code to add there.
Thirdly I have only implemented link following for the
DW_FORM_GNU_strp_alt format. Other alternate formats (eg
DW_FORM_GNU_ref_alt) have yet to be implemented.
Lastly, whilst implementing this feature I found it necessary to move
some of the global variables used by readelf (eg section_headers) into
a structure that can be passed around. I have moved all of the global
variables that were necessary to get the patch working, but I need to
complete the operation and move the remaining, file-specific variables
(eg dynamic_strings).
Cheers
Nick
binutils PR 15152
* dwarf.h (enum dwarf_section_display_enum): Add gnu_debuglink,
gnu_debugaltlink and separate_debug_str.
(struct dwarf_section): Add filename field.
Add prototypes for load_separate_debug_file, close_debug_file and
open_debug_file.
* dwarf.c (do_debug_links): New.
(do_follow_links): New.
(separate_debug_file, separate_debug_filename): New.
(fetch_alt_indirect_string): New function. Retrieves a string
from the debug string table in the separate debug info file.
(read_and_display_attr_value): Use it with DW_FORM_GNU_strp_alt.
(load_debug_section_with_follow): New function. Like
load_debug_section, but if the first attempt fails, then tries
again in the separate debug info file.
(introduce): New function.
(process_debug_info): Use load_debug_section_with_follow and
introduce.
(load_debug_info): Likewise.
(display_debug_lines_raw): Likewise.
(display_debug_lines_decoded): Likewise.
(display_debug_macinfo): Likewise.
(display_debug_macro): Likewise.
(display_debug_abbrev): Likewise.
(display_debug_loc): Likewise.
(display_debug_str): Likewise.
(display_debug_aranges): Likewise.
(display_debug_addr); Likewise.
(display_debug_frames): Likewise.
(display_gdb_index): Likewise.
(process_cu_tu_index): Likewise.
(load_cu_tu_indexes): Likewise.
(display_debug_links): New function. Displays the contents of a
.gnu_debuglink or .gnu_debugaltlink section.
(calc_gnu_debuglink_ctc32):New function. Calculates a CRC32
value.
(check_gnu_debuglink): New function. Checks the CRC of a
potential separate debug info file.
(parse_gnu_debuglink): New function. Reads a CRC value out of a
.gnu_debuglink section.
(check_gnu_debugaltlink): New function.
(parse_gnu_debugaltlink): New function. Reads the build-id value
out of a .gnu_debugaltlink section.
(load_separate_debug_info): New function. Finds and loads a
separate debug info file.
(load_separate_debug_file): New function. Attempts to find and
follow a link to a separate debug info file.
(free_debug_memory): Free the separate debug info file
information.
(opts_table): Add "follow-links" and "links".
(dwarf_select_sections_by_letters): Add "k" and "K".
(debug_displays): Reformat. Add .gnu-debuglink and
.gnu_debugaltlink.
Add an extra entry for .debug_str in a separate debug info file.
* doc/binutils.texi: Move description of debug dump features
common to both readelf and objdump into...
* objdump.c (usage): Add -Wk and -WK.
(load_specific_debug_section): Initialise the filename field in
the dwarf_section structure.
(close_debug_file): New function.
(open_debug_file): New function.
(dump_dwarf): Load and dump the separate debug info sections.
* readelf.c (struct filedata): New structure. Contains various
variables that used to be global:
(current_file_size, string_table, string_table_length, elf_header)
(section_headers, program_headers, dump_sects, num_dump_sects):
Move into filedata structure.
(cmdline): New global variable. Contains list of sections to dump
by number, as specified on the command line.
Add filedata parameter to most functions.
(load_debug_section): Load the string table if it has not already
been retrieved.
(close_file): New function.
(close_debug_file): New function.
(open_file): New function.
(open_debug_file): New function.
(process_object): Process sections in any separate debug info files.
* doc/debug.options.texi: New file. Add description of =links and
=follow-links options.
* NEWS: Mention the new feature.
* elfcomm.c: Have the byte gte functions take a const pointer.
* elfcomm.h: Update prototypes.
* testsuite/binutils-all/dw5.W: Update expected output.
* testsuite/binutils-all/objdump.WL: Update expected output.
* testsuite/binutils-all/objdump.exp: Add test of -WK and -Wk.
* testsuite/binutils-all/readelf.exp: Add test of -wK and -wk.
* testsuite/binutils-all/readelf.k: New file.
* testsuite/binutils-all/objdump.Wk: New file.
* testsuite/binutils-all/objdump.WK2: New file.
* testsuite/binutils-all/linkdebug.s: New file.
* testsuite/binutils-all/debuglink.s: New file.
gas * testsuite/gas/avr/large-debug-line-table.d: Update expected
output.
* testsuite/gas/elf/dwarf2-11.d: Likewise.
* testsuite/gas/elf/dwarf2-12.d: Likewise.
* testsuite/gas/elf/dwarf2-13.d: Likewise.
* testsuite/gas/elf/dwarf2-14.d: Likewise.
* testsuite/gas/elf/dwarf2-15.d: Likewise.
* testsuite/gas/elf/dwarf2-16.d: Likewise.
* testsuite/gas/elf/dwarf2-17.d: Likewise.
* testsuite/gas/elf/dwarf2-18.d: Likewise.
* testsuite/gas/elf/dwarf2-5.d: Likewise.
* testsuite/gas/elf/dwarf2-6.d: Likewise.
* testsuite/gas/elf/dwarf2-7.d: Likewise.
ld * testsuite/ld-avr/gc-section-debugline.d: Update expected
output.
Alan Hayward [Wed, 15 Nov 2017 09:59:12 +0000 (09:59 +0000)]
Better make rule for arch/ files built for IPA
gdbserver/
* Makefile.in: Update arch rules.
* configure.srv: Explicitly mark arch/ files.
Yao Qi [Wed, 15 Nov 2017 09:36:51 +0000 (09:36 +0000)]
Fix M68HC11_NUM_REGS
M68HC11_LAST_HARD_REG is 8, but m68hc11 register number is started from 0,
so there are 9 raw registers, but M68HC11_NUM_REGS is 8 by mistake.
My following unit test can find this issue (GDB is built with asan)
=================================================================
==15555==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x602000113150 at pc 0x51393f bp 0x7fffcec36f60 sp 0x7fffcec36f58
WRITE of size 2 at 0x602000113150 thread T0
#0 0x51393e in m68hc11_pseudo_register_read gdb/m68hc11-tdep.c:320
#1 0xc4b620 in gdbarch_pseudo_register_read(gdbarch*, regcache*, int, unsigned char*) gdb/gdbarch.c:1974
#2 0xddad88 in regcache::cooked_read(int, unsigned char*) gdb/regcache.c:710
#3 0xddff2b in cooked_read_test gdb/regcache.c:1850
#4 0xdf8cfb in selftests::gdbarch_selftest::operator()() const gdb/selftest-arch.c:73
gdb:
2017-11-15 Yao Qi <yao.qi@linaro.org>
* m68hc11-tdep.c (M68HC11_NUM_REGS): Change it to
M68HC11_LAST_HARD_REG + 1.
Jan Beulich [Wed, 15 Nov 2017 07:52:05 +0000 (08:52 +0100)]
x86: use correct register names
VEX.W may be legitimately set (and is then ignored by the CPU) for
non-64-bit code. Don't print 64-bit register names in such a case, by
utilizing that REX_W would never be set for non-64-bit code, and that
it is being set from VEX.W by generic decoding.
A test for this is going to be introduced in the next patch of this
series.
Jan Beulich [Wed, 15 Nov 2017 07:51:03 +0000 (08:51 +0100)]
x86: drop VEXI4_Fixup()
The low four bits of an immediate being set when the high bits specify a
fourth register operand is not a problem: CPUs ignore these bits rather
than raising #UD. Take care of incrementing codep in OP_EX_VexW()
instead.
Jan Beulich [Wed, 15 Nov 2017 07:48:51 +0000 (08:48 +0100)]
x86-64: don't allow use of %axl as accumulator
Just like %cxl can't be used as shift count register. Otherwise for
consistency %cxl would need to gain "ShiftCount" and use of both ought
to properly cause REX prefixes to be emitted.
Alan Modra [Wed, 15 Nov 2017 01:05:21 +0000 (11:35 +1030)]
ld einfo positional arg support
To allow translators to reorder values in translated strings. This
should mean that all binutils messages now have support for
reordering.
Note to translators: Not all % letters take arguments, so for example
the following only has two arguments, the two %s strings.
"%P%F: output format %s cannot represent section called %s: %E\n"
You could reorder this if you liked to:
"%P%F: %E: section %2$s cannot be represented in output format %1$s\n"
einfo lacks support for flags, field width, precision and length
modifier (apart from %ld and %lu) so don't try to use them in
translations. Both ld and bfd lack support to use a positional arg
twice. These features could be added if needed..
* ldmisc.c (vfinfo): Support up to 9 positional args.
Jim Wilson [Wed, 15 Nov 2017 01:23:14 +0000 (17:23 -0800)]
First part of fix for riscv gas lns-common-1 failure.
gas/
* testsuite/gas/lns/lns.exp (lns-common-1): Add riscv*-*-* to alt list.
Jim Wilson [Wed, 15 Nov 2017 01:07:32 +0000 (17:07 -0800)]
Add modified file I missed in last commit.
Jim Wilson [Wed, 15 Nov 2017 01:02:43 +0000 (17:02 -0800)]
Fix riscv ld testsuite failure for compressed1d.
ld/
* testsuite/ld-elf/compress1-alt.s: New.
* testsuite/ld-elf/compressed1d-alt.d: New.
* testsuite/ld-elf/compressed1d.d: Add riscv*-*-* to notarget list.
GDB Administrator [Wed, 15 Nov 2017 00:00:25 +0000 (00:00 +0000)]
Automatic date update in version.in
Paul Carroll [Tue, 14 Nov 2017 22:37:37 +0000 (17:37 -0500)]
Fix 'xfered>0' assertion in target.c for remote connection
We have a customer who is using a Corelis gdb server to connect to gdb.
Occasionally, the gdb server will send a 0-byte block of memory for a
read. When this happens, gdb gives an assertion from target.c:
internal-error: target_xfer_partial: Assertion `*xfered_len > 0' failed.
This problem is almost identical to that fixed in
https://sourceware.org/ml/gdb-patches/2014-02/msg00636.html
In this case, remote.c needs to be modified to return TARGET_XFER_EOF
instead of TARGET_XFER_OK or TARGET_XFER_UNAVAILABLE when 0 bytes are
transferred.
gdb/ChangeLog:
PR gdb/22388
* remote.c (remote_write_bytes_aux, remote_read_bytes_1,
remote_read_bytes, remote_write_qxfer, remote_xfer_partial):
Return TARGET_XFER_EOF if size of returned data is 0.
Simon Marchi [Tue, 14 Nov 2017 21:42:08 +0000 (16:42 -0500)]
Fix mem region parsing regression and add test
In my patch
Get rid of VEC (mem_region)
a664f67e50eff30198097d51cec0ec4690abb2a1
I introduced a regression, where the length of the memory region is
assigned to the "hi" field. It should obviously be computed as "start +
length". To my defense, no test had caught this :). As a penance, I
wrote one.
gdb/ChangeLog:
* Makefile.in (SUBDIR_UNITTESTS_SRCS): Add
memory-map-selftests.c.
(SUBDIR_UNITTESTS_OBS): Add memory-map-selftests.o.
* memory-map.c (memory_map_start_memory): Fix computation of hi
address.
* unittests/memory-map-selftests.c: New file.
Alan Modra [Tue, 14 Nov 2017 08:17:34 +0000 (18:47 +1030)]
PR22431, powerpc64 ld segfault when .plt discarded
The fix for the PR is to not use input_section->output_section->owner
to get to the output bfd, but use the output bfd directly since it is
available nowadays in struct bfd_link_info.
I thought it worth warning when non-empty dynamic sections are
discarded too, which meant a tweak to one of the ld tests to avoid the
warning.
bfd/
PR 22431
* elf64-ppc.c (ppc64_elf_size_dynamic_sections): Warn on discarding
non-empty dynamic section.
(ppc_build_one_stub): Take elf_gp from output bfd, not output
section owner.
(ppc_size_one_stub, ppc64_elf_next_toc_section): Likewise.
ld/
* testsuite/ld-elf/note-3.t: Don't discard .got.
Alan Modra [Sun, 12 Nov 2017 07:11:50 +0000 (17:41 +1030)]
ld-ifunc non-PIC tests
* testsuite/ld-ifunc/ifunc.exp: Ensure non-PIC tests are really
not PIE by default gcc options.
Jan Beulich [Tue, 14 Nov 2017 07:43:26 +0000 (08:43 +0100)]
x86: add disassembler support for XOP VPCOM* pseudo-ops
Matching up with the assembler, which already supports them.
Jan Beulich [Tue, 14 Nov 2017 07:42:26 +0000 (08:42 +0100)]
x86: add support for AVX-512 VPCMP*{B,W} pseudo-ops
... matching up with VPCMP*{D,Q}.
Jan Beulich [Tue, 14 Nov 2017 07:40:48 +0000 (08:40 +0100)]
x86: string insns don't allow displacements
Remove the misleading indicators from the table.
Alan Modra [Tue, 14 Nov 2017 00:32:57 +0000 (11:02 +1030)]
Inconsistent .eh_frame_hdr on powerpc64
There is code in bfd/elf-eh-frame.c and ld/emultempl/elf32.em that
checks for the presence of eh_frame info by testing for a section
named .eh_frame sized more than 8 bytes. The size test is to exclude
a zero terminator. A similar check in elf64-ppc.c wrongly just tested
for non-zero size before creating the linker generated .eh_frame
describing plt call and other linkage stubs. The intention was to not
generate that info unless there was some user .eh_frame. (No user
.eh_frame implies the user doesn't care about exception handling.)
Because the test in elf64-ppc.c was wrong, ld generated the stub
.eh_frame just on finding a zero .eh_frame terminator in crtend.o, but
didn't generate the corresponding .eh_frame_hdr.
* elf64-ppc.c (ppc64_elf_size_stubs): Correct test for user
.eh_frame info.
Simon Marchi [Tue, 14 Nov 2017 03:06:02 +0000 (22:06 -0500)]
gdb.opt/inline-locals.exp: Remove trailing parentheses in test names
Test names should not end with parentheses, since the buildbot strips
those.
gdb/testsuite/ChangeLog:
* gdb.opt/inline-locals.exp: Remove trailing parentheses from
test names.
GDB Administrator [Tue, 14 Nov 2017 00:00:24 +0000 (00:00 +0000)]
Automatic date update in version.in
H.J. Lu [Mon, 13 Nov 2017 16:19:10 +0000 (08:19 -0800)]
ld: Replace exp_dataseg_none with exp_seg_none
* emultempl/ppc32elf.em (ppc_before_allocation): Replace
exp_dataseg_none with exp_seg_none.
* emultempl/ppc64elf.em (prelim_size_sections): Likewise.
* emultempl/spuelf.em (spu_before_allocation): Likewise.
Andreas Schwab [Mon, 13 Nov 2017 14:46:09 +0000 (15:46 +0100)]
Enable hardware single step for m68k in GDBServer
* linux-m68k-low.c (m68k_supports_hardware_single_step): New
function.
(struct linux_target_ops) <supports_hardware_single_step>: Initialize.
Jan Beulich [Mon, 13 Nov 2017 11:27:45 +0000 (12:27 +0100)]
gas/arm64: don't emit stack pointer symbol table entries
Without this change, all of
mov z0.b, p0/m, wsp
mov z0.b, wsp
mov z0.d, p0/m, sp
mov z0.d, sp
insert stray symbols into the symbol table.
Jan Beulich [Mon, 13 Nov 2017 11:26:48 +0000 (12:26 +0100)]
gas/ia64: fix testsuite failures
Commit
dd90581873 ("Place .shstrtab section after .symtab and .strtab,
thus restoring monotonically incre... ") adjusted section numbers, but
forgot to adjust sh_link references from relocation and group section
table entries.
Additionally some other (perhaps subsequent) change appears to have
added .rel.* and .rela.* sections to their respective groups, which
requires some further adjustments to group-2.d. I assume this additional
breakage wasn't noticed because the test was already failing at that
time.
This makes the gas testsuite complete successfully again for me in a
cross build on ix86-linux; there continue to be quite a few ld failures.
Jan Beulich [Mon, 13 Nov 2017 11:26:12 +0000 (12:26 +0100)]
PE: don't corrupt section flags when linking from ELF objects
Linking EFI executables from ELF object files can result in corrupted
COFF section flags if the section's alignment is too high. Issue a
diagnostic in that case, erroring out if this is not a final link, and
make sure only in-range values get written to the output image.
While doing this also make tic80 use the generic alignment macros
instead of custom #ifdef-ary.
No testsuite regressions for the range of COFF/PE targets that actually
cross-build in the first place on x86-64-linux.
Jan Beulich [Mon, 13 Nov 2017 11:22:21 +0000 (12:22 +0100)]
x86: don't default variable shift count insns to 8-bit operand size
Just like %dx in I/O instructions isn't suitable to derive operand size
information, %cl source operands of shift instructions aren't.
Jan Beulich [Mon, 13 Nov 2017 11:21:29 +0000 (12:21 +0100)]
x86: {f,}xsave64 / {f,}xrstor64 / xsaveopt64 should not allow q suffix
Just like is the case for xsave{s,c}64 and xrstors64 already. I wonder
though why xsave{s,c} and xrstors don't allow for the q suffix, other
than the other insns without the "64" suffix do.
Jan Beulich [Mon, 13 Nov 2017 11:20:30 +0000 (12:20 +0100)]
x86/Intel: don't mistake riz/eiz as base register
Just like we make rsp/esp a base register even if it comes second, make
riz/eiz an index register even if it comes first.
Jan Beulich [Mon, 13 Nov 2017 11:19:34 +0000 (12:19 +0100)]
x86-64/Intel: issue diagnostic for out of range displacement
... rather than silently dropping it altogether.
i386_finalize_displacement() expects baseindex to already be set, so
the respective statement needs to be moved up. This then also allows a
subsequent conditional to be simplified.
For this to not regress on 32-bit addressing, break out address size
guessing from i386_index_check(), invoking the new function earlier so
that i386_finalize_displacement() has i.prefix[ADDR_PREFIX] available.
i386_addressing_mode () in turn needs i.base_reg / i.index_reg set
earlier.
H.J. Lu [Sat, 11 Nov 2017 15:02:30 +0000 (07:02 -0800)]
ld: Add ldlang_check_relro_region/update lang_find_relro_sections_1
Extract GNU_RELRO region check into a new funtion and pass a pointer to
seg_align_type to lang_find_relro_sections_1 so that they can also be
used for text-only LOAD segment.
* ldlang.c (lang_size_sections_1): Extract GNU_RELRO region check
into ...
(ldlang_check_relro_region): New function.
(lang_find_relro_sections_1): Add an argument for pointer to
seg_align_type and replace expld.dataseg with the pointer.
(lang_find_relro_sections): Pass address of expld.dataseg to
lang_find_relro_sections_1.
H.J. Lu [Mon, 13 Nov 2017 01:23:22 +0000 (17:23 -0800)]
cl
H.J. Lu [Mon, 13 Nov 2017 01:22:15 +0000 (17:22 -0800)]
ld: Add lang_size_relro_segment
Break lang_size_sections down into separate functions so that they can
also be used for text-only LOAD segment. lang_size_relro_segment will
call lang_size_relro_segment_1 and lang_size_segment for both GNU_RELRO
segment and text-only LOAD segment.
* ldlang.c (lang_size_segment): New function.
(lang_size_relro_segment_1): Likewise.
(lang_size_relro_segment): Likewise.
(lang_size_sections): Rewrite to call lang_size_relro_segment.
H.J. Lu [Mon, 13 Nov 2017 01:20:09 +0000 (17:20 -0800)]
ld: Add fold_segment_align/fold_segment_relro_end/fold_segment_end
Extract DATA_SEGMENT_END/DATA_SEGMENT_ALIGN/DATA_SEGMENT_RELRO_END cases
for GNU_RELRO segment into separate functions so that they can also be
used for text-only LOAD segment.
* ldexp.c (fold_unary): Extract the DATA_SEGMENT_END case to ...
(fold_segment_end): New function.
(fold_binary): Extract the DATA_SEGMENT_ALIGN case to ...
(fold_segment_align): New function.
(fold_binary): Extract the DATA_SEGMENT_RELRO_END case to ...
(fold_segment_relro_end): New function.
H.J. Lu [Mon, 13 Nov 2017 01:17:47 +0000 (17:17 -0800)]
ld: Update phase_enum/relro_enum and add seg_align_type
Update GNU_RELRO date type so that they can also be used for text-only
LOAD segment.
* ldexp.h (phase_enum): Rename exp_dataseg_none,
exp_dataseg_align_seen, exp_dataseg_relro_seen,
exp_dataseg_end_seen, exp_dataseg_relro_adjust,
exp_dataseg_adjust and exp_dataseg_done to exp_seg_none,
exp_seg_align_seen, exp_seg_relro_seen, exp_seg_end_seen,
exp_seg_relro_adjust, exp_seg_adjust and exp_seg_done.
(relro_enum): Rename exp_dataseg_relro_none,
exp_dataseg_relro_start and exp_dataseg_relro_end to
exp_seg_relro_none, exp_seg_relro_start and exp_seg_relro_end.
(seg_align_type): New struct type.
(ldexp_control): Use seg_align_type.
* ldexp.c (fold_unary): Updated.
(fold_binary): Likewise.
* ldlang.c (strip_excluded_output_sections): Likewise.
(lang_size_sections_1): Likewise.
(lang_size_sections): Likewise.
H.J. Lu [Mon, 13 Nov 2017 01:03:50 +0000 (17:03 -0800)]
ld: Remove PF_X from PT_PHDR segment
It was reasonable to mark PT_PHDR segment with PF_X for compatibility
with UnixWare and Solaris linkers 20 years ago. But it is inappropriate
today when the primary OS of GNU ld is Linux. This patch removes PF_X
from PT_PHDR segment as gold does.
Tested natively on Linux/x86 as well as crosss-binutils for alpha-linux,
ia64-linux, powerpc64-linux, powerpc-linux, s390-linux, s390x-linux,
sparc64-linux and sparc-linux.
bfd/
PR ld/22423
* elf.c (_bfd_elf_map_sections_to_segments): Remove PF_X from
PT_PHDR segment.
ld/
PR ld/22423
* testsuite/ld-alpha/tlsbin.rd: Replace "R E " with "R +" for
PT_PHDR segment.
* testsuite/ld-alpha/tlsbinr.rd: Likewise.
* testsuite/ld-ia64/tlsbin.rd: Likewise.
* testsuite/ld-powerpc/tlsexe.r: Likewise.
* testsuite/ld-powerpc/tlsexe32.r: Likewise.
* testsuite/ld-powerpc/tlsexetoc.r: Likewise.
* testsuite/ld-s390/tlsbin.rd: Likewise.
* testsuite/ld-s390/tlsbin_64.rd: Likewise.
* testsuite/ld-sparc/tlssunbin32.rd: Likewise.
* testsuite/ld-sparc/tlssunbin64.rd: Likewise.
* testsuite/ld-elf/pr22423.d: New test.
GDB Administrator [Mon, 13 Nov 2017 00:00:24 +0000 (00:00 +0000)]
Automatic date update in version.in
H.J. Lu [Sun, 12 Nov 2017 15:25:26 +0000 (07:25 -0800)]
ld: Add OTHER_PLT_SECTIONS
OTHER_PLT_SECTIONS contains sections which should be placed right after
.plt section.
* emulparams/elf32_x86_64.sh (TINY_READONLY_SECTION): Renamed
to ...
(OTHER_PLT_SECTIONS): This.
* emulparams/elf_i386.sh: Likewise.
* emulparams/elf_iamcu.sh: Likewise.
* emulparams/elf_x86_64.sh: Likewise.
* scripttempl/elf.sc: Place ${OTHER_PLT_SECTIONS} just after
.plt.
Alan Modra [Sun, 12 Nov 2017 03:42:41 +0000 (14:12 +1030)]
weakdef list handling
The existing code allowed common and indirect symbols to pass an
assert, but then read root.u.def which is not valid for anything
besides defined and weakdef symbols. The garbage root.u.def.section
pointer read can't possibly match pointers stored at the same location
for indirect and common symbols, so we would always have left
u.weakdef NULL.
* elflink.c (elf_link_add_object_symbols): Ignore anything but
defined and defweak symbols when setting up weakdefs.
Alan Modra [Sun, 12 Nov 2017 07:14:15 +0000 (17:44 +1030)]
non_got_ref after adjust_dynamic_relocs
This patch was aimed at a FIXME in elf32-hppa.c, the ludicrous and
confusing fact that non_got_ref after adjust_dynamic_relocs in that
backend means precisely the inverse of what it means before
adjust_dynamic_relocs. Before, when non_got_ref is set it means there
are dynamic relocs, after, if non_got_ref is clear it means "keep
dynamic relocs" and later, "has dynamic relocs". There is a reason
why it was done that way.. Some symbols that may have dynamic
relocations pre-allocated in check_relocs turn out to not be dynamic,
and then are not seen by the backend adjust_dynamic_symbols. We want
those symbols to lose their dynamic relocs when non-pic, so it's handy
that non_got_ref means the opposite after adjust_dynamic_relocs. But
it's really confusing.
Most other targets, like ppc32, don't always set non_got_ref on
non-GOT references that have dynamic relocations. This is because the
primary purpose of non_got_ref before adjust_dynamic_relocs is to flag
symbols that might need to be copied to .dynbss, and there are
relocation types that may require dyn_relocs but clearly cannot have
symbols copied into .dynbss, for example, TLS relocations.
Why do we need a flag after adjust_dynamic_relocs to say "keep
dynamic relocations"? Well, you can discard most unwanted dyn_relocs
in the backend adjust_dynamic_relocs, and for those symbols that
aren't seen by the backend adjust_dynamic_relocs, in
allocate_dynrelocs based on a flag set by adjust_dynamic relocs,
dynamic_adjusted. That doesn't solve all our difficulties though.
relocate_section needs to know whether a symbol has dyn_relocs, and
many targets transfer dyn_relocs to a weakdef if the symbol has one.
The transfer means relocate_section can't test dyn_relocs itself and
the weakdef field has been overwritten by that time. So non_got_ref
is used to flag "this symbol has dynamic relocations" for
relocate_section.
Confused still? Well, let's hope the comments I've added help clarify
things.. The patch also fixes a case where we might wrongly emit
dynamic relocations in an executable for common and undefined symbols.
* elf32-hppa.c (elf32_hppa_adjust_dynamic_symbol): Set non_got_ref
to keep dyn_relocs, clear to discard. Comment.
(allocate_dynrelocs): Always clear non_got_ref when clearing
dyn_relocs in non-pic case. Invert non_got_ref test. Also test
dynamic_adjusted and ELF_COMMON_DEF_P. Move code deleting
dyn_relocs on undefined syms to handle for non-pic too.
(elf32_hppa_relocate_section): Simplify test for non-pic dyn relocs.
* elf32-ppc.c (ppc_elf_adjust_dynamic_symbol): Set non_got_ref
to keep dyn_relocs, clear to discard. Comment.
(allocate_dynrelocs): Always clear non_got_ref when clearing
dyn_relocs in non-pic case. Invert non_got_ref test. Also test
dynamic_adjusted and ELF_COMMON_DEF_P. Move code deleting
dyn_relocs on undefined syms to handle for non-pic too.
(ppc_elf_relocate_section): Simplify test for non-pic dyn relocs.
* elf64-ppc.c (ppc64_elf_adjust_dynamic_symbol): Discard
dyn_relocs here. Don't bother setting non_got_ref. Comment.
(allocate_dynrelocs): Delete special handling of non-pic ELFv2
ifuncs. Move code deleting dyn_relocs on undefined symbols to
handle for non-pic too. Don't test non_got_ref. Do test
dynamic_adjusted and ELF_COMMON_DEF_P.
GDB Administrator [Sun, 12 Nov 2017 00:00:18 +0000 (00:00 +0000)]
Automatic date update in version.in
Jim Wilson [Sat, 11 Nov 2017 03:24:45 +0000 (19:24 -0800)]
Fix riscv binutils xfail for debug_ranges test.
binutils/
* testsuite/binutils-all/objdump.exp: Expect the debug_ranges test to
pass.
GDB Administrator [Sat, 11 Nov 2017 00:00:20 +0000 (00:00 +0000)]
Automatic date update in version.in
GDB Administrator [Fri, 10 Nov 2017 00:00:28 +0000 (00:00 +0000)]
Automatic date update in version.in
Pedro Alves [Thu, 9 Nov 2017 22:44:10 +0000 (22:44 +0000)]
Fix racy output matching in gdb.tui/tui-completion.exp
'make check-read1 TESTS="gdb.tui/tui-completion.exp"' exposes this test race:
(gdb) PASS: gdb.tui/completion.exp: set max-completions unlimited
layout ^G
asm next prev regs split src
(gdb) FAIL: gdb.tui/completion.exp: completion of layout names: tab completion
Quit
(gdb) PASS: gdb.tui/completion.exp: completion of layout names: quit command input
focus ^G
cmd next prev src
(gdb) FAIL: gdb.tui/completion.exp: completion of focus command: tab completion
Quit
This is caused by expecting "$gdb_prompt layout $".
gdb_test_multiple's internal prompt regexp can match first if expect's
internal buffer is filled with partial output. Fix that by splitting
the gdb_test_multiple in question in two. Since the same problem/code
appears twice in the file, factor out a common procedure.
gdb/testsuite/ChangeLog:
2017-11-09 Pedro Alves <palves@redhat.com>
* gdb.tui/tui-completion.exp (test_tab_completion): New procedure,
factored out from ...
(top level): ... here, and adjusted to avoid expecting beyond the
prompt in a single gdb_test_multiple.
Pedro Alves [Thu, 9 Nov 2017 22:44:09 +0000 (22:44 +0000)]
Fix racy output matching in gdb.base/multi-attach.exp, gdb.server/ext-{attach, restart, ext-run}.exp
This commit fixes this same problem in several places:
(gdb) PASS: gdb.multi/multi-attach.exp: backtrace 2
kill
Kill the program being debugged? (y or n) y
(gdb) FAIL: gdb.multi/multi-attach.exp: kill inferior 2 (got interactive prompt)
This is just another case of the gdb_test_multiple's internal "got
interactive prompt" pattern matching because the testcase misses
matching enough.
gdb/testsuite/ChangeLog:
2017-11-09 Pedro Alves <palves@redhat.com>
* gdb.multi/multi-attach.exp ("kill" test): Match the whole query
output.
* gdb.server/ext-attach.exp ("kill" test): Likewise.
* gdb.server/ext-restart.exp ("kill" test): Likewise.
* gdb.server/ext-run.exp ("kill" test): Likewise.
* gdb.server/ext-wrapper.exp ("kill" test): Likewise.
Pedro Alves [Thu, 9 Nov 2017 22:44:09 +0000 (22:44 +0000)]
Fix racy output matching in gdb.base/cpcompletion.exp
With:
$ make check-read1 TESTS="gdb.cp/cpcompletion.exp"
we get (from gdb.log):
(gdb) complete break Foo::
break Foo::Foo()
break Foo::Foofoo()
break Foo::get_foo()
break Foo::set_foo(int)
break Foo::~Foo()
(gdb) FAIL: gdb.cp/cpcompletion.exp: complete class methods (Foo not found)
The problem is that the
"break ${class}::\[A-Za-z0-9_~\]+"
regexp patches partial input, like:
break Foo::F
break Foo::Fo
break Foo::Foo
etc.
Fix that by expecting each whole line.
gdb/testsuite/ChangeLog:
2017-11-09 Pedro Alves <palves@redhat.com>
* gdb.cp/cpcompletion.exp (test_class_complete): Tighten regex to
match till end of line.
Pedro Alves [Thu, 9 Nov 2017 22:44:08 +0000 (22:44 +0000)]
Fix racy output matching in gdb.base/memattr.exp
Testing with:
$ make check-read1 TESTS="gdb.base/memattr.exp"
Exposes a testcase bug that can result in racy fails:
info mem
Using user-defined memory regions.
Num Enb Low Addr High Addr Attrs
1 y 0x0000000000601060 0x0000000000601160 wo nocache
2 y 0x0000000000601180 0x0000000000601280 ro nocache
4 y 0x0000000000601280 0x0000000000601380 rw nocache
3 y 0x0000000000601380 0x0000000000601480 rw nocache
5 y 0x0000000000601480 0x0000000000601580 rw nocache
(gdb) FAIL: gdb.base/memattr.exp: info mem (1)
The problem is that:
"Attrs\[^\n\r]*.."
matches:
"Attrs \r"
when the output buffer is filled with partial output like this:
"info mem\r\nUsing user-defined memory regions.\r\nNum Enb Low Addr High Addr Attrs \r"
gdb/testsuite/ChangeLog:
2017-11-09 Pedro Alves <palves@redhat.com>
* gdb.base/memattr.exp: Tighten regexes to match the end line.
Pedro Alves [Thu, 9 Nov 2017 22:44:08 +0000 (22:44 +0000)]
Fix racy output matching in gdb.base/completion.exp
Testing with:
$ make check-read1 TESTS="gdb.base/completion.exp"
Exposes a testcase bug that can result in racy fails:
FAIL: gdb.base/completion.exp: command-name completion limiting using tab character
ERROR: Undefined command "".
FAIL: gdb.base/completion.exp: symbol-name completion limiting using tab character
FAIL: gdb.base/completion.exp: symbol-name completion limiting using complete command
testsuite/gdb.log shows:
(gdb) PASS: gdb.base/completion.exp: set max-completions 5
p^G
passcount path print print-object printf
*** List may be truncated, max-completions reached. ***
(gdb) FAIL: gdb.base/completion.exp: command-name completion limiting using tab character
pcomplete p
Undefined command: "pcomplete". Try "help".
(gdb) ERROR: Undefined command "".
The problem is that the expect buffer can get filled with partial
output that ends in the gdb prompt, and so the default FAIL inside
gdb_test_multiple matches.
Fix that by splitting the gdb_test_multiple in two stages. Since that
is done in more than one place in the testcase, move the otherwise
duplicate code to helper procedures.
gdb/testsuite/ChangeLog:
2017-11-09 Pedro Alves <palves@redhat.com>
* gdb.base/completion.exp (ignore_and_resync, test_tab_complete):
New procedures, factored out from ...
(top level): ... here, and adjusted to avoid expecting beyond the
prompt in one go.
Pedro Alves [Thu, 9 Nov 2017 22:44:08 +0000 (22:44 +0000)]
Fix racy output matching in gdb.asm/asm-source.exp
Testing with:
$ make check-read1 TESTS="gdb.asm/asm-source.exp"
Exposes a testcase bug that can result in racy fails:
(gdb) PASS: gdb.asm/asm-source.exp: next over foo3
return
Make selected stack frame return now? (y or n) y
n
#0 main () at /home/pedro/gdb/mygit/src/gdb/testsuite/gdb.asm/asmsrc1.s:53
53 gdbasm_exit0
(gdb) FAIL: gdb.asm/asm-source.exp: return from foo2 (got interactive prompt)
n
The problem is that the "return now\?.*" regex can match partial
output like this:
"Make selected stack frame return no"
and then we send the 'y' too early, and then the next time around we
hit gdb_test_multiple's internal "got interactive prompt" regex.
Also, note we match "return no" instead of "return now" because the
regex is missing one quote level.
gdb/testsuite/ChangeLog:
2017-11-09 Pedro Alves <palves@redhat.com>
* gdb.asm/asm-source.exp ("kill" test): Match the whole query
output. Fix '?' match.
H.J. Lu [Thu, 9 Nov 2017 22:36:51 +0000 (14:36 -0800)]
ld: Reformat emultempl/elf32.em
Reformat emultempl/elf32.em to generate consistent codes.
* emultempl/elf32.em (gld${EMULATION_NAME}_get_script): Reformat
to generate consistent codes.
Joel Brobecker [Thu, 9 Nov 2017 19:58:37 +0000 (11:58 -0800)]
fix typos in ada-lang.c comment
gdb/ChangeLog:
* ada-lang.c: Fix some typos in the general command documenting
how Ada expressions are being evaluated and how their result
is printed.
Jim Wilson [Thu, 9 Nov 2017 17:43:59 +0000 (09:43 -0800)]
Fix riscv dwarf2-10 gas testsuite failure.
gas/
* testsuite/gas/elf/dwarf2-10.l: Accept optional line number in error.