external/binutils.git
10 years agoAdd readelf support for dumping gold version note sections.
Cary Coutant [Wed, 5 Feb 2014 18:29:24 +0000 (10:29 -0800)]
Add readelf support for dumping gold version note sections.

binutils/
PR binutils/16444
* readelf.c (print_gnu_note): Add support for NT_GNU_GOLD_VERSION.

10 years ago PR target/59788
Rainer Orth [Thu, 6 Feb 2014 10:01:57 +0000 (11:01 +0100)]
PR target/59788
* ltmain.sh (opt_duplicate_compiler_generated_deps): Enable on
*solaris2*.

10 years agoFix issues with gold undefined symbol diagnostics.
Cary Coutant [Thu, 6 Feb 2014 06:59:02 +0000 (22:59 -0800)]
Fix issues with gold undefined symbol diagnostics.

PR binutils/15435 complains that gold issues a visibility error for an
weak undefined symbol with hidden visibility. The message should be
suppressed if the symbol is a weak undef.

An earlier patch to add an extra note about key functions when a class's
vtable symbol is undefined missed a case where the reference to the
vtable came from a shared library. This patch moves the check to a
lower-level routine that catches both cases.

gold/

2014-02-05  Cary Coutant  <ccoutant@google.com>

* errors.cc (Errors::undefined_symbol): Move undef vtable symbol
check to here.
* target-reloc.h (is_strong_undefined): New function.
(relocate_section): Move undef vtable symbol check from here.
Check for is_strong_undefined.

10 years agoAdd missing gold/ChangeLog entry.
Cary Coutant [Thu, 6 Feb 2014 06:57:51 +0000 (22:57 -0800)]
Add missing gold/ChangeLog entry.

10 years agofix copyright year in new files in previous checkin
Doug Evans [Thu, 6 Feb 2014 04:17:30 +0000 (20:17 -0800)]
fix copyright year in new files in previous checkin

10 years agoExtension Language API
Doug Evans [Thu, 6 Feb 2014 03:27:58 +0000 (19:27 -0800)]
Extension Language API

* configure.ac (libpython checking): Remove all but python.o from
CONFIG_OBS.  Remove all but python.c from CONFIG_SRCS.
* configure: Regenerate.

* Makefile.in (SFILES): Add extension.c.
(HFILES_NO_SRCDIR): Add extension.h, extension-priv.h
(COMMON_OBS): Add extension.o.
* extension.h: New file.
* extension-priv.h: New file.
* extension.c: New file.

* python/python-internal.h: #include "extension.h".
(gdbpy_auto_load_enabled): Declare.
(gdbpy_apply_val_pretty_printer): Declare.
(gdbpy_apply_frame_filter): Declare.
(gdbpy_preserve_values): Declare.
(gdbpy_breakpoint_cond_says_stop): Declare.
(gdbpy_breakpoint_has_cond): Declare.
(void source_python_script_for_objfile): Delete.
* python/python.c: #include "extension-priv.h".
Delete inclusion of "observer.h".
(extension_language_python): Moved here and renamed from
script_language_python in py-auto-load.c.
Redefined to be of type extension_language_defn.
(python_extension_script_ops): New global.
(python_extension_ops): New global.
(struct python_env): New member previous_active.
(restore_python_env): Call restore_active_ext_lang.
(ensure_python_env): Call set_active_ext_lang.
(gdbpy_clear_quit_flag): Renamed from clear_quit_flag, made static.
New arg extlang.
(gdbpy_set_quit_flag): Renamed from set_quit_flag, made static.
New arg extlang.
(gdbpy_check_quit_flag): Renamed from check_quit_flag, made static.
New arg extlang.
(gdbpy_eval_from_control_command): Renamed from
eval_python_from_control_command, made static.  New arg extlang.
(gdbpy_source_script) Renamed from source_python_script, made static.
New arg extlang.
(gdbpy_before_prompt_hook): Renamed from before_prompt_hook.  Change
result to int.  New arg extlang.
(gdbpy_source_objfile_script): Renamed from
source_python_script_for_objfile, made static.  New arg extlang.
(gdbpy_start_type_printers): Renamed from start_type_printers, made
static.  New args extlang, extlang_printers.  Change result type to
"void".
(gdbpy_apply_type_printers): Renamed from apply_type_printers, made
static.  New arg extlang.  Rename arg printers to extlang_printers
and change type to ext_lang_type_printers *.
(gdbpy_free_type_printers): Renamed from free_type_printers, made
static.  Replace argument arg with extlang, extlang_printers.
(!HAVE_PYTHON, eval_python_from_control_command): Delete.
(!HAVE_PYTHON, source_python_script): Delete.
(!HAVE_PYTHON, gdbpy_should_stop): Delete.
(!HAVE_PYTHON, gdbpy_breakpoint_has_py_cond): Delete.
(!HAVE_PYTHON, start_type_printers): Delete.
(!HAVE_PYTHON, apply_type_printers): Delete.
(!HAVE_PYTHON, free_type_printers): Delete.
(_initialize_python): Delete call to observer_attach_before_prompt.
(finalize_python): Set/restore active extension language.
(gdbpy_finish_initialization) Renamed from
finish_python_initialization, made static.  New arg extlang.
(gdbpy_initialized): New function.
* python/python.h: #include "extension.h".  Delete #include
"value.h", "mi/mi-cmds.h".
(extension_language_python): Declare.
(GDBPY_AUTO_FILE_NAME): Delete.
(enum py_bt_status): Moved to extension.h and renamed to
ext_lang_bt_status.
(enum frame_filter_flags): Moved to extension.h.
(enum py_frame_args): Moved to extension.h and renamed to
ext_lang_frame_args.
(finish_python_initialization): Delete.
(eval_python_from_control_command): Delete.
(source_python_script): Delete.
(apply_val_pretty_printer): Delete.
(apply_frame_filter): Delete.
(preserve_python_values): Delete.
(gdbpy_script_language_defn): Delete.
(gdbpy_should_stop, gdbpy_breakpoint_has_py_cond): Delete.
(start_type_printers, apply_type_printers, free_type_printers): Delete.

* auto-load.c: #include "extension.h".
(GDB_AUTO_FILE_NAME): Delete.
(auto_load_gdb_scripts_enabled): Make public.  New arg extlang.
(script_language_gdb): Delete, moved to extension.c and renamed to
extension_language_gdb.
(source_gdb_script_for_objfile): Delete.
(auto_load_pspace_info): New member unsupported_script_warning_printed.
(loaded_script): Change type of language member to
struct extension_language_defn *.
(init_loaded_scripts_info): Initialize
unsupported_script_warning_printed.
(maybe_add_script): Make static.  Change type of language arg to
struct extension_language_defn *.
(clear_section_scripts): Reset unsupported_script_warning_printed.
(auto_load_objfile_script_1): Rewrite to use extension language API.
(auto_load_objfile_script): Make public.  Remove support-compiled-in
and auto-load-enabled checks, moved to auto_load_scripts_for_objfile.
(source_section_scripts): Rewrite to use extension language API.
(load_auto_scripts_for_objfile): Rewrite to use
auto_load_scripts_for_objfile.
(collect_matching_scripts_data): Change type of language member to
struct extension_language_defn *.
(auto_load_info_scripts): Change type of language arg to
struct extension_language_defn *.
(unsupported_script_warning_print): New function.
(script_not_found_warning_print): Make static.
(_initialize_auto_load): Rewrite construction of scripts-directory
help.
* auto-load.h (struct objfile): Add forward decl.
(struct script_language): Delete.
(struct auto_load_pspace_info): Add forward decl.
(struct extension_language_defn): Add forward decl.
(maybe_add_script): Delete.
(auto_load_objfile_script): Declare.
(script_not_found_warning_print): Delete.
(auto_load_info_scripts): Update prototype.
(auto_load_gdb_scripts_enabled): Declare.
* python/py-auto-load.c (gdbpy_auto_load_enabled): Renamed from
auto_load_python_scripts_enabled and made public.
(script_language_python): Delete, moved to python.c.
(gdbpy_script_language_defn): Delete.
(info_auto_load_python_scripts): Update to use
extension_language_python.

* breakpoint.c (condition_command): Replace call to
gdbpy_breakpoint_has_py_cond with call to get_breakpoint_cond_ext_lang.
(bpstat_check_breakpoint_conditions): Replace call to gdbpy_should_stop
with call to breakpoint_ext_lang_cond_says_stop.
* python/py-breakpoint.c (gdbpy_breakpoint_cond_says_stop): Renamed
from gdbpy_should_stop.  Change result type to enum scr_bp_stop.
New arg slang.  Return SCR_BP_STOP_UNSET if py_bp_object is NULL.
(gdbpy_breakpoint_has_cond): Renamed from gdbpy_breakpoint_has_py_cond.
New arg slang.
(local_setattro): Print name of extension language with existing
stop condition.

* valprint.c (val_print, value_print): Update to call
apply_ext_lang_val_pretty_printer.
* cp-valprint.c (cp_print_value): Update call to
apply_ext_lang_val_pretty_printer.
* python/py-prettyprint.c: Remove #ifdef HAVE_PYTHON.
(gdbpy_apply_val_pretty_printer): Renamed from
apply_val_pretty_printer.  New arg extlang.
(!HAVE_PYTHON, apply_val_pretty_printer): Delete.

* cli/cli-cmds.c (source_script_from_stream): Rewrite to use
extension language API.
* cli/cli-script.c (execute_control_command): Update to call
eval_ext_lang_from_control_command.

* mi/mi-cmd-stack.c (mi_cmd_stack_list_frames): Update to use
enum ext_lang_bt_status values.  Update call to
apply_ext_lang_frame_filter.
(mi_cmd_stack_list_locals): Ditto.
(mi_cmd_stack_list_args): Ditto.
(mi_cmd_stack_list_variables): Ditto.
* mi/mi-main.c: Delete #include "python/python-internal.h".
Add #include "extension.h".
(mi_cmd_list_features): Replace reference to python internal variable
gdb_python_initialized with call to ext_lang_initialized_p.

* stack.c (backtrace_command_1): Update to use enum ext_lang_bt_status.
Update to use enum ext_lang_frame_args.  Update to call
apply_ext_lang_frame_filter.
* python/py-framefilter.c (extract_sym): Update to use enum
ext_lang_bt_status.
(extract_value, py_print_type, py_print_value): Ditto.
(py_print_single_arg, enumerate_args, enumerate_locals): Ditto.
(py_mi_print_variables, py_print_locals, py_print_args): Ditto.
(py_print_frame): Ditto.
(gdbpy_apply_frame_filter): Renamed from apply_frame_filter.
New arg extlang.  Update to use enum ext_lang_bt_status.

* top.c (gdb_init): Delete #ifdef HAVE_PYTHON call to
finish_python_initialization.  Replace with call to
finish_ext_lang_initialization.

* typeprint.c (do_free_global_table): Update to call
free_ext_lang_type_printers.
(create_global_typedef_table): Update to call
start_ext_lang_type_printers.
(find_global_typedef): Update to call apply_ext_lang_type_printers.
* typeprint.h (struct ext_lang_type_printers): Add forward decl.
(type_print_options): Change type of global_printers from "void *"
to "struct ext_lang_type_printers *".

* value.c (preserve_values): Update to call preserve_ext_lang_values.
* python/py-value.c: Remove #ifdef HAVE_PYTHON.
(gdbpy_preserve_values): Renamed from preserve_python_values.
New arg extlang.
(!HAVE_PYTHON, preserve_python_values): Delete.

* utils.c (quit_flag): Delete, moved to extension.c.
(clear_quit_flag, set_quit_flag, check_quit_flag): Delete, moved to
extension.c.

* eval.c: Delete #include "python/python.h".
* main.c: Delete #include "python/python.h".

* defs.h: Update comment.

testsuite/

* gdb.python/py-breakpoint.exp (test_bkpt_eval_funcs): Update expected
output.

* gdb.gdb/python-interrupts.exp: New file.

10 years agoDocument the GDB 7.7 release in gdb/ChangeLog
Joel Brobecker [Thu, 6 Feb 2014 02:48:24 +0000 (06:48 +0400)]
Document the GDB 7.7 release in gdb/ChangeLog

gdb/ChangeLog:

GDB 7.7 released.

10 years agoFix problems with the --dynamic-list option.
Cary Coutant [Wed, 5 Feb 2014 22:01:52 +0000 (14:01 -0800)]
Fix problems with the --dynamic-list option.

PR gold/13577 complains that even though symbols listed in
the --dynamic-list script are exported, they are still bound symbolically
if -Bsymbolic is also used. There are two underlying problems here.
First, -Bsymbolic should be overridden by --dynamic-list, since the
dynamic list provides an explicit list of symbols that are not bound
within the library, and if we go ahead and set DT_SYMBOLIC, then the
dynamic loader will bind it within the library anyway. Second, gold
did not properly identify the symbols listed in the file as preemptible.

PR gold/16530 complains that symbols listed in the --dynamic-list script
can still be garbage collected. I've fixed this by checking the symbols
as they're added to the symbol table. (Unlike the --export-dynamic-symbol
option, we can't iterate over the list, because the --dynamic-list script
can have wildcards in it.)

gold/

2014-02-05  Cary Coutant  <ccoutant@google.com>

PR gold/13577
* options.cc (General_options::parse_dynamic_list):
Set have_dynamic_list_.
(General_options::General_options): Initialize have_dynamic_list_.
(General_options::finalize): Turn off -Bsymbolic and
-Bsymbolic-functions if --dynamic-list provided.
* options.h (General_options::have_dynamic_list): New function.
(General_options::have_dynamic_list_): New data member.
* symtab.h (Symbol::is_preemptible): Handle --dynamic-list
correctly.

PR gold/16530
* symtab.cc (Symbol_table::add_from_relobj): If symbol is named
in --dynamic-list, mark it.

* testsuite/Makefile.am (gc_dynamic_list_test.sh): New test case.
(dynamic_list_2): New test case.
* testsuite/Makefile.in: Regenerate.
* testsuite/dynamic_list_2.cc: New file.
* testsuite/dynamic_list_2.t: New file.
* testsuite/dynamic_list_lib1.cc: New file.
* testsuite/dynamic_list_lib2.cc: New file.
* testsuite/gc_dynamic_list_test.c: New file.
* testsuite/gc_dynamic_list_test.sh: New file.
* testsuite/gc_dynamic_list_test.t: New file.

10 years agoKeep current_inferior in sync with event_child.
Doug Evans [Thu, 6 Feb 2014 00:08:59 +0000 (16:08 -0800)]
Keep current_inferior in sync with event_child.

* linux-low.c (linux_wait_for_event): Improve comment.
(linux_wait_1): Keep current_inferior in sync with event_child.

10 years agodaily update
Alan Modra [Wed, 5 Feb 2014 23:01:11 +0000 (09:31 +1030)]
daily update

10 years agoAvoid bison-isms when using yacc.
Mark Kettenis [Wed, 5 Feb 2014 12:30:33 +0000 (13:30 +0100)]
Avoid bison-isms when using yacc.

YYPRINT is a bison-ism so c_print_token() ends up being unused when yacc is
used which makes gcc unhappy.  Make sure we only define YYPRINT and
c_print_token() when bison is used to generate the parser.

gdb/ChangeLog:

        * c-exp.y (YYPRINT, c_print_token): Only define if YYBISON is
        defined.

10 years agoUse rs->buf after getpkt
Yao Qi [Mon, 20 Jan 2014 12:56:13 +0000 (20:56 +0800)]
Use rs->buf after getpkt

Hi,
The following code snippet looks wrong to me

 char *buf = rs->buf;

 getpkt (&rs->buf, &rs->buf_size, 0);
 packet_ok (buf, );

if rs->buf is reallocated in getpkt, buf points to an out of dated
memory.  This patch removes local 'buf' and uses rs->buf.

gdb:

2014-02-05  Yao Qi  <yao@codesourcery.com>

* remote.c (remote_pass_signals): Remove local 'buf' and use
rs->buf.
(remote_program_signals): Likewise.

10 years agoCreate inferior for ctf target.
Yao Qi [Thu, 30 Jan 2014 02:09:11 +0000 (10:09 +0800)]
Create inferior for ctf target.

This patch creates inferior when GDB opens a ctf trace data, to be
consistent with tfile target.  A test case is added to test for
live target, tfile and ctf target.

gdb:

2014-02-05  Yao Qi  <yao@codesourcery.com>

* ctf.c: Include "inferior.h" and "gdbthread.h".
(CTF_PID): A new macro.
(ctf_open): Call inferior_appeared and add_thread_silent.
(ctf_close): Call exit_inferior_silent and set inferior_ptid.
(ctf_thread_alive): New function.
(init_ctf_ops): Install ctf_thread_alive to to_thread_alive.

gdb/testsuite:

2014-02-05  Yao Qi  <yao@codesourcery.com>

* gdb.trace/report.exp (use_collected_data): Test the output
of "info threads" and "info inferiors".

10 years agoCreate inferior for tfile target
Yao Qi [Thu, 30 Jan 2014 00:37:05 +0000 (08:37 +0800)]
Create inferior for tfile target

When a trace file is loaded in Eclipse, it is expected to see thread
and process (=thread-group-started and =thread-created).  Create an
inferior and add a thread for this purpose.

This patch just reverts my previous patch.

gdb/testsuite:

2014-02-05  Yao Qi  <yao@codesourcery.com>

Revert this patch:

2013-05-24  Yao Qi  <yao@codesourcery.com>

* gdb.trace/tfile.exp: Test inferior and thread.

gdb:

2014-02-05  Yao Qi  <yao@codesourcery.com>

Revert this patch:

2013-05-24  Yao Qi  <yao@codesourcery.com>

* tracepoint.c (TFILE_PID): Remove.
(tfile_open): Don't add thread and inferior.
(tfile_close): Don't set 'inferior_ptid'.  Don't call
exit_inferior_silent.
(tfile_thread_alive): Remove.
(init_tfile_ops): Don't set field 'to_thread_alive' of
tfile_ops.

10 years agodaily update
Alan Modra [Tue, 4 Feb 2014 23:00:41 +0000 (09:30 +1030)]
daily update

10 years agoCall remote_check_symbols even if only symbol-file (not file) has been given
Christian Eggers [Tue, 4 Feb 2014 19:42:12 +0000 (19:42 +0000)]
Call remote_check_symbols even if only symbol-file (not file) has been given

The Eclipse "C/C++ GDB Hardware Debugging" plugin runs only the
"symbol-file" command.  In this case, remote_check_symbols is not
called and no qSymbol:: packet is sent to the server (OpenOCD in my
case).

gdb/
2014-02-04  Christian Eggers  <ceggers@gmx.de>  (tiny change)

* remote.c (remote_start_remote): Call remote_check_symbols even
if only symbol-file (not file) has been given.

10 years agoFix PowerPC targets minor memory leaks found by Coverity
Jan Kratochvil [Tue, 4 Feb 2014 19:17:16 +0000 (20:17 +0100)]
Fix PowerPC targets minor memory leaks found by Coverity

bfd/
2014-02-04  Jan Kratochvil  <jan.kratochvil@redhat.com>

* coff-rs6000.c (xcoff_write_archive_contents_big): Free OFFSETS in
return paths.  Three times.
* elf64-ppc.c (ppc64_elf_link_hash_table_create): Free HTAB in all
return paths.
(ppc64_elf_tls_optimize): Free TOC_REF in return path.
(ppc64_elf_edit_toc): Free USED in return path.

10 years agoPowerPC64 ELFv2 ABI: skip global entry point code
Ulrich Weigand [Tue, 4 Feb 2014 17:44:14 +0000 (18:44 +0100)]
PowerPC64 ELFv2 ABI: skip global entry point code

This patch handles another aspect of the ELFv2 ABI, which unfortunately
requires common code changes.

In ELFv2, functions may provide both a global and a local entry point.
The global entry point (where the function symbol points to) is intended
to be used for function-pointer or cross-module (PLT) calls, and requires
r12 to be set up to the entry point address itself.   The local entry
point (which is found at a fixed offset after the global entry point,
as defined by bits in the symbol table entries' st_other field), instead
expects r2 to be set up to the current TOC.

Now, when setting a breakpoint on a function by name, you really want
that breakpoint to trigger either way, no matter whether the function
is called via its local or global entry point.  Since the global entry
point will always fall through into the local entry point, the way to
achieve that is to simply set the breakpoint at the local entry point.

One way to do that would be to have prologue parsing skip the code
sequence that makes up the global entry point.  Unfortunately, this
does not work reliably, since -for optimized code- GDB these days
will not actuall invoke the prologue parsing code but instead just
set the breakpoint at the symbol address and rely on DWARF being
correct at any point throughout the function ...

Unfortunately, I don't really see any way to express the notion of
local entry points with the current set of gdbarch callbacks.

Thus this patch adds a new callback, skip_entrypoint, that is
somewhat analogous to skip_prologue, but is called every time
GDB needs to determine a function start address, even in those
cases where GDB decides to not call skip_prologue.

As a side effect, the skip_entrypoint implementation on ppc64
does not need to perform any instruction parsing; it can simply
rely on the local entry point flags in the symbol table entry.

With this implemented, two test cases would still fail to set
the breakpoint correctly, but that's because they use the construct:

 gdb_test "break *hello"

Now, using "*hello" explicitly instructs GDB to set the breakpoint
at the numerical value of "hello" treated as function pointer, so
it will by definition only hit the global entry point.

I think this behaviour is unavoidable, but acceptable -- most people
do not use this construct, and if they do, they get what they
asked for ...

In one of those two test cases, use of this construct is really
not appropriate.  I think this was added way back when as a means
to work around prologue skipping problems on some platforms.  These
days that shouldn't really be necessary any more ...

For the other (step-bt), we really want to make sure backtracing
works on the very first instruction of the routine.  To enable that
test also on powerpc64le-linux, we can modify the code to call the
test function via function pointer (which makes it use the global
entry point in the ELFv2 ABI).

gdb/ChangeLog:

* gdbarch.sh (skip_entrypoint): New callback.
* gdbarch.c, gdbarch.h: Regenerate.
* symtab.c (skip_prologue_sal): Call gdbarch_skip_entrypoint.
* infrun.c (fill_in_stop_func): Likewise.
* ppc-linux-tdep.c: Include "elf/ppc64.h".
(ppc_elfv2_elf_make_msymbol_special): New function.
(ppc_elfv2_skip_entrypoint): Likewise.
(ppc_linux_init_abi): Install them for ELFv2.

gdb/testsuite/ChangeLog:

* gdb.base/sigbpt.exp: Do not use "*" when setting breakpoint
on a function.
* gdb.base/step-bt.c: Call hello via function pointer to make
sure its first instruction is executed on powerpc64le-linux.

10 years agoPowerPC64 ELFv2 ABI: structure passing / return
Ulrich Weigand [Tue, 4 Feb 2014 17:42:35 +0000 (18:42 +0100)]
PowerPC64 ELFv2 ABI: structure passing / return

Another significant difference in the ELFv2 ABI is that "homogeneous"
floating-point and vector aggregates, i.e. aggregates the consist
(recursively) only of members of the same floating-point or vector type,
are passed in a series of floating-point / vector registers, as if they
were seperate parameters.  (This is similar to the ARM ABI.)  This
applies to both calls and returns.

In addition when returning any aggregate of up to 16 bytes, ELFv2 now
used general-purpose registers.

This patch adds support for these aspects of the ABI, which is relatively
straightforward after the refactoring patch to ppc-sysv-tdep.c.

gdb/ChangeLog:

* ppc-sysv-tdep.c (ppc64_aggregate_candidate): New routine.
(ppc64_elfv2_abi_homogeneous_aggregate): Likewise.
(ppc64_sysv_abi_push_param): Handle ELFv2 homogeneous structs.
(ppc64_sysv_abi_return_value): Likewise.  Also, handle small
structures returned in GPRs.

10 years agoPowerPC64 ELFv2 ABI: stack frame layout changes
Ulrich Weigand [Tue, 4 Feb 2014 17:41:36 +0000 (18:41 +0100)]
PowerPC64 ELFv2 ABI: stack frame layout changes

This implementes another change in ELFv2: the stack frame no longer
contains the reserved double words for linker and compiler use
(which weren't really used for much of anything anyway).  This
affects placement of on-stack parameters in inferior calls.

gdb/ChangeLog:

* ppc-sysv-tdep.c (ppc64_sysv_abi_push_dummy_call): Use correct
offset to the stack parameter list for the ELFv2 ABI.

10 years agoPowerPC64 ELFv2 ABI: no function descriptors
Ulrich Weigand [Tue, 4 Feb 2014 17:40:16 +0000 (18:40 +0100)]
PowerPC64 ELFv2 ABI: no function descriptors

This implements the most significant difference with the ELFv2 ABI:
we no longer use function descriptors.  The patch consists mostly
of switching off code to deal with descriptors :-)

In addition, when calling an inferior function, we no longer need
to provide its TOC in r2.  Instead, ELFv2 code expects to be called
with r12 pointing to the code address itself.

gdb/ChangeLog:

* ppc-linux-tdep.c (ppc_linux_init_abi): Only call
set_gdbarch_convert_from_func_ptr_addr and
set_gdbarch_elf_make_msymbol_special for ELFv1.
* ppc-sysv-tdep.c (ppc64_sysv_abi_push_param): Only handle
function descriptors on ELFv1.
(ppc64_sysv_abi_push_dummy_call): Likewise.  On ELFv2,
set up r12 at function entry.

10 years agoPowerPC64 ELFv2 ABI: base support
Ulrich Weigand [Tue, 4 Feb 2014 17:38:56 +0000 (18:38 +0100)]
PowerPC64 ELFv2 ABI: base support

This is the first patch of a series to implement support for the
PowerPC ELFv2 ABI.  While powerpc64le-linux will use ELFv2, and
the existing powerpc64-linux code will continue to use ELFv1,
in theory ELFv2 is also defined for big-endian systems (and
ELFv1 was also defined for little-endian systems).

Therefore this patch adds a new tdep->elf_abi variable to decide
which ABI version to use.  This is detected from the ELF header
e_flags value; if this is not present, we default to ELFv2 on
little-endian and ELFv1 otherwise.

This patch does not yet introduce any actual difference in GDB's
handling of the two ABIs.  Those will be added by the remainder
of this patch series.

For an overview of the changes in ELFv2, have a look at the
comments in the patch series that added ELFv2 to GCC, starting at:
http://gcc.gnu.org/ml/gcc-patches/2013-11/msg01144.html

gdb/ChangeLog:

* ppc-tdep.h (enum powerpc_elf_abi): New data type.
(struct gdbarch_tdep): New member elf_abi.

* rs6000-tdep.c: Include "elf/ppc64.h".
(rs6000_gdbarch_init): Detect ELF ABI version.

10 years agoPowerPC64 little-endian fixes: 128-bit DFP parameters / registers
Ulrich Weigand [Tue, 4 Feb 2014 17:34:19 +0000 (18:34 +0100)]
PowerPC64 little-endian fixes: 128-bit DFP parameters / registers

The powerpc64le-linux ABI specifies that when a 128-bit DFP value is
passed in a pair of floating-point registers, the first register holds
the most-significant part of the value.  This is as opposed to the
usual rule on little-endian systems, where the first register would
hold the least-significant part.

This affects two places in GDB, the read/write routines for the
128-bit DFP pseudo-registers, and the function call / return
sequence.  For the former, current code already distinguishes
between big- and little-endian targets, but gets the latter
wrong.  This is presumably because *GCC* also got it wrong,
and GDB matches the old GCC behavior.  But GCC is now fixed:
http://gcc.gnu.org/ml/gcc-patches/2013-11/msg02145.html
so GDB needs to be fixed too.  (Old code shouldn't really be
an issue since there is no code "out there" so far that uses
dfp128 on little-endian ...)

gdb/ChangeLog:

* ppc-sysv-tdep.c (ppc64_sysv_abi_push_freg): Use correct order
within a register pair holding a DFP 128-bit value on little-endian.
(ppc64_sysv_abi_return_value_base): Likewise.
* rs6000-tdep.c (dfp_pseudo_register_read): Likewise.
(dfp_pseudo_register_write): Likewise.

gdb/testsuite/ChangeLog:

* gdb.arch/powerpc-d128-regs.exp: Enable on powerpc64*-*.

10 years agoPowerPC64 little-endian fixes: 32-bit DFP parameters
Ulrich Weigand [Tue, 4 Feb 2014 17:33:04 +0000 (18:33 +0100)]
PowerPC64 little-endian fixes: 32-bit DFP parameters

Passing a 32-bit DFP in register needs to use the least-significant part
of the register.  Like with a previous patch that addressed the same
issue for small structs, this patch makes sure the appropriate offset
is used on little-endian systems.

gdb/ChangeLog:

* ppc-sysv-tdep.c (ppc64_sysv_abi_push_freg): Use correct
offset on little-endian when passing _Decimal32.
(ppc64_sysv_abi_return_value_base): Likewise for return values.

10 years agoPowerPC64 little-endian fixes: VSX tests and pseudo-regs
Ulrich Weigand [Tue, 4 Feb 2014 17:31:38 +0000 (18:31 +0100)]
PowerPC64 little-endian fixes: VSX tests and pseudo-regs

Many VSX test were failing on powerpc64le-linux, since -as opposed to the
AltiVec tests- there never were little-endian versions of the test patterns.

This patch adds such patterns, along the lines of altivec-regs.exp.

In addition, there is an actual code change required: For those VSX
registers that overlap a floating-point register, the FP register
overlaps the most-significant half of the VSX register both on big-
and little-endian systems.  However, on little-endian systems, that
half is stored at an offset of 8 bytes (not 0).  This works already
for the "real" FP registers, but current code gets it wrong for
the "extended" pseudo FP register GDB generates for the second
half of the VSX register bank.

This patch updates the corresponding pseudo read/write routines
to take the appropriate offset into consideration.

gdb/ChangeLog:

* rs6000-tdep.c (efpr_pseudo_register_read): Use correct offset
of the overlapped FP register within the VSX register on little-
endian platforms.
(efpr_pseudo_register_write): Likewise.

gdb/testsuite/ChangeLog:

* gdb.arch/vsx-regs.exp: Check target endianness.  Provide variants
of the test patterns for use on little-endian systems.

10 years agoPowerPC64 little-endian fixes: AltiVec tests
Ulrich Weigand [Tue, 4 Feb 2014 17:28:24 +0000 (18:28 +0100)]
PowerPC64 little-endian fixes: AltiVec tests

A couple of AltiVec tests fail spuriously on powerpc64le-linux, because
they compare against an incorrect pattern.  Note that those tests already
contain little-endian variants of the patterns, but those seem to have
bit-rotted a bit: when outputting a vector, GDB no longer omits trailing
zero elements (as it used to do in the past).

This patch updates the pattern to the new GDB output behavior.

In addition, the patch updates the endian test to use the new
gdb_test_multiple logic instead of gdb_expect.

gdb/testsuite/ChangeLog:

* gdb.arch/altivec-regs.exp: Use gdb_test_multiple for endian test.
(decimal_vector): Fix for little-endian.

10 years agoPowerPC64 little-endian fixes: structure passing
Ulrich Weigand [Tue, 4 Feb 2014 17:26:26 +0000 (18:26 +0100)]
PowerPC64 little-endian fixes: structure passing

When passing a small structure in a GPR, the ABI specifies that it
should be passed in the least-significant bytes of the register
(or stack slot).  On big-endian systems, this means the value
needs to be stored at an offset, which is what current code does.

However, on little-endian systems, the least-significant bytes are
addresses with offset 0.  This patch fixes that.

gdb/ChangeLog:

* ppc-sysv-tdep.c (ppc64_sysv_abi_push_val): Use correct
offset on little-endian when passing small structures.

10 years agoRefactor ppc64 function call and return value handling
Ulrich Weigand [Tue, 4 Feb 2014 17:24:42 +0000 (18:24 +0100)]
Refactor ppc64 function call and return value handling

This patch refactors the ppc64 function call and return value handling code
in ppc-sysv-tdep.c.  The main problem to be addressed by this refactoring
is the code duplication caused by certain aggregate types:

According to the ABI, some types are to be decomposed into component types
for parameter and return value handling.  For example, complex types are
to be passed as if the real and imaginary component were separate arguments.
Similarly, certain OpenCL vector types are passed as if they were multiple
separate arguments of the vector element type.  With the new ELFv2 ABI,
there is another case: "homogeneous aggregates" (e.g. a struct containing
4 floats) are passed in multiple floating point registers as well.

Unfortunately, the current code is not structured to easily model these
ABI properties.  For example, code to pass complex values re-implements
code to pass the underlying (floating-point) type.  This has already
led to some unfortunate code duplication, and with the addition of
ELFv2 ABI support, I would have had to add yet more such duplication.

To avoid that, I've decided to refactor the code in order to re-use
subroutines that handle the "base" types when handling those aggregate
types.  This was not intended to cause any difference on current
(ELFv1) ABI code, but in fact it fixes a bug:

FAIL: gdb.base/varargs.exp: print find_max_float_real(4, fc1, fc2, fc3, fc4)

This was caused by the old code in ppc64_sysv_abi_push_float incorrectly
handling floating-point arguments to vararg routines, which just happens
to work out correctly automatically in the refactored code ...

gdb/ChangeLog:

* ppc-sysv-tdep.c (get_decimal_float_return_value): Update comment.
(struct ppc64_sysv_argpos): New data structure.
(ppc64_sysv_abi_push_float): Remove.
(ppc64_sysv_abi_push_val): New function.
(ppc64_sysv_abi_push_integer): Likewise.
(ppc64_sysv_abi_push_freg): Likewise.
(ppc64_sysv_abi_push_vreg): Likewise.
(ppc64_sysv_abi_push_param): Likewise.
(ppc64_sysv_abi_push_dummy_call): Refactor to use those new routines.
(ppc64_sysv_abi_return_value_base): New function.
(ppc64_sysv_abi_return_value): Refactor to use it.

10 years agoDocument support for powerpc64le-*-linux* target
Ulrich Weigand [Tue, 4 Feb 2014 17:19:51 +0000 (18:19 +0100)]
Document support for powerpc64le-*-linux* target

gdb/ChangeLog:

* NEWS: Document new target powerpc64le-*-linux*.

10 years agoAdd support for ELF core files on OpenBSD/sparc64.
Mark Kettenis [Tue, 4 Feb 2014 12:18:15 +0000 (13:18 +0100)]
Add support for ELF core files on OpenBSD/sparc64.

gdb/ChangeLog:

        * sparc64obsd-tdep.c (sparc64obsd_gregset): New variable.
        (sparc64obsd_supply_gregset): Handle registers sets used in ELF
        core dumps.
        (sparc64obsd_init_abi): Adjust minimum size of the general purpose
        register set used in ELF core dumps.  Add floating-point register set.

10 years agoUpdate mn10300 dwarf register map
Kevin Buettner [Tue, 4 Feb 2014 04:52:59 +0000 (21:52 -0700)]
Update mn10300 dwarf register map

This change updates the mn10300 dwarf register map.  It reduces the
failure count when doing simulator testing against the default
multilib from 788 to 99.

gdb/ChangeLog:

* mn10300-tdep.c (mn10300_dwarf2_reg_to_regnum): Rewrite
dwarf2_to_gdb[] table using symbolic constants.  Adjust
penultimate entry from number representing the PC register
to symbolic constant representing the MDR register.  Add
constant for the PC register to the end of the table.

10 years agodaily update
Alan Modra [Mon, 3 Feb 2014 23:00:46 +0000 (09:30 +1030)]
daily update

10 years agoNios II large-GOT relocations
Sandra Loosemore [Mon, 3 Feb 2014 16:42:42 +0000 (08:42 -0800)]
Nios II large-GOT relocations

2014-02-03  Sandra Loosemore  <sandra@codesourcery.com>

include/elf/
* nios2.h (R_NIOS2_GOT_LO, R_NIOS2_GOT_HA): New.
(R_NIOS2_CALL_LO, R_NIOS2_CALL_HA): New.
(R_NIOS2_ILLEGAL): Adjust.

gas/
* config/tc-nios2.c (md_apply_fix): Test for new relocs.
(nios2_special_reloc): Add %call_lo, %call_hiadj, %got_lo,
%got_hiadj relocation operators.  Sort table and add comment
to explain ordering.
(nios2_fix_adjustable): Test for new relocs.
* doc/c-nios2.texi (Nios II Relocations): Document new relocation
operators.

bfd/
* reloc.c (BFD_RELOC_NIOS2_GOT_LO, BFD_RELOC_NIOS2_GOT_HA): New.
(BFD_RELOC_NIOS2_CALL_LO, BFD_RELOC_NIOS2_CALL_HA): New.
* libbfd.h: Regenerated.
* bfd-in2.h: Regenerated.
* elf32-nios2.c (elf_nios2_howto_table_rel): Add new relocations.
(nios2_reloc_map): Likewise.
(GOT_USED, CALL_USED): Renamed from GOT16_USED and CALL16_USED.
Fixed all references.
(nios2_elf32_relocate_section): Add new relocations.
(nios2_elf32_check_relocs): Likewise.
(nios2_elf32_gc_sweep_hook): Likewise.

10 years agoFix build on recent versions of OpenBSD.
Mark Kettenis [Mon, 3 Feb 2014 13:38:59 +0000 (14:38 +0100)]
Fix build on recent versions of OpenBSD.

gdb/ChangeLog:

        * bsd-kvm.c: Include <sys/param.h>

10 years agoFix build on OpenBSD/sparc64.
Mark Kettenis [Mon, 3 Feb 2014 13:29:28 +0000 (14:29 +0100)]
Fix build on OpenBSD/sparc64.

gdb/ChangeLog:

        * sparc64nbsd-nat.c (sparc64nbsd_supply_fpregset): Fix prototype.

10 years agoppc476 icache bug workaround
Alan Modra [Wed, 29 Jan 2014 21:56:02 +0000 (08:26 +1030)]
ppc476 icache bug workaround

This implements a work-around for an icache bug on 476 that can cause
execution of stale instructions when control falls through from one
page to the next.  The idea is to prevent such fall-through by
replacing the last instruction on a page with a branch to a patch
area containing the instruction, then branch to the next page.

The patch also fixes a number of bugs in the existing support for long
branch trampolines.

bfd/
* elf32-ppc.c (struct ppc_elf_link_hash_table): Add params.
Delete emit_stub_syms, no_tls_get_addr_opt.  Update all uses.
(ppc_elf_link_params): New function.
(ppc_elf_create_glink): Align .glink to 64 bytes for ppc476
workaround.
(ppc_elf_select_plt_layout): Remove plt_style and emit_stub_syms
parameters.  Use htab->params instead.
(ppc_elf_tls_setup): Remove no_tls_get_addr_opt parameter.
(ppc_elf_size_dynamic_sections): Align __glink_PLTresolve to
64 bytes for ppc476 workaround.
(struct ppc_elf_relax_info): New.
(ppc_elf_relax_section): Exclude linker created sections and
those too small to hold one instruction.  Don't add another
branch  around trampolines on later relax passes.  Don't
generate trampolines for undefined symbols when !relocatable,
nor for plugin symbols.  Allocate space for ppc476 workaround
patch area.  Free fixups on error return path.
(ppc_elf_relocate_section): Handle ppc476 workaround patching.
* elf32-ppc.h (struct ppc_elf_params): New.
(ppc_elf_select_plt_layout, ppc_elf_tls_setup): Update prototype.
(ppc_elf_link_params): Declare.
* section.c (SEC_INFO_TYPE_TARGET): Define.
* bfd-in2.h: Regenerate.
ld/
* emultempl/ppc32elf.em (no_tls_get_addr_opt, emit_stub_syms)
plt_style): Delete.  Adjust all refs to instead use..
(params): ..this.  New variable.
(ppc_after_open_output): New function.  Tweak params and pass to
ppc_elf_link_params.
(ppc_after_open): Adjust ppc_elf_select_plt_layout call.
(ppc_before_allocation): Adjust ppc_elf_tls_setup call.  Enable
relaxation for ppc476 workaround.
(PARSE_AND_LIST_*): Add --{no-,}ppc476-workaround support.
(LDEMUL_CREATE_OUTPUT_SECTION_STATEMENTS): Define.

10 years agodaily update
Alan Modra [Sun, 2 Feb 2014 23:00:43 +0000 (09:30 +1030)]
daily update

10 years agoCorrect Nios II GOT pointer initialization.
Sandra Loosemore [Sun, 2 Feb 2014 18:57:52 +0000 (10:57 -0800)]
Correct Nios II GOT pointer initialization.

2014-02-02  Sandra Loosemore  <sandra@codesourcery.com>

bfd/
* elf32-nios2.c (struct elf32_nios2_link_hash_table): Add
h_gp_got field.
(nios2_elf32_relocate_section): Use got_base to adjust
GOT-pointer-relative relocations relative to _gp_got.
(create_got_section): Create _gp_got symbol.
(nios2_elf32_finish_dynamic_symbol): Make _gp_got absolute.
(nios2_elf32_size_dynamic_sections): Set _gp_got offset.

10 years agoFix ALIGN_WITH_INPUT
Sebastian Huber [Sun, 2 Feb 2014 14:39:39 +0000 (06:39 -0800)]
Fix ALIGN_WITH_INPUT

ld/

2014-02-02  Sebastian Huber  <sebastian.huber@embedded-brains.de>

* ld/ld.texinfo: Change ALIGN_WITH_INPUT documentation.
* ld/ldlang.c (lang_size_sections_1): Add dotdelta
variable which reflects the VMA change due to alignment
requirements.  Use dotdelta do change the LMA if
ALIGN_WITH_INPUT is requested.

ld/testsuite/ChangeLog

2014-02-02  Sebastian Huber  <sebastian.huber@embedded-brains.de>

* ld-scripts/rgn-at9.d: New file.
* ld-scripts/rgn-at9.t: Likewise.
* ld-scripts/rgn-at10.d: Likewise.
* ld-scripts/rgn-at10.s: Likewise.
* ld-scripts/rgn-at10.t: Likewise.
* ld-scripts/rgn-at11.d: Likewise.
* ld-scripts/rgn-at11.t: Likewise.

10 years agodaily update
Alan Modra [Sat, 1 Feb 2014 23:00:42 +0000 (09:30 +1030)]
daily update

10 years agoFix MMIX build breakage from bfd_set_section_vma change.
Hans-Peter Nilsson [Sat, 1 Feb 2014 00:11:28 +0000 (01:11 +0100)]
Fix MMIX build breakage from bfd_set_section_vma change.

* emultempl/mmix-elfnmmo.em (mmix_after_allocation): Fix typo in
call to bfd_set_section_vma exposed by recent bfd_set_section_vma
change.

10 years agodaily update
Alan Modra [Fri, 31 Jan 2014 23:00:51 +0000 (09:30 +1030)]
daily update

10 years agoAdd gather/scatter tests with incorrect memory operand
Michael Zolotukhin [Fri, 31 Jan 2014 16:13:06 +0000 (08:13 -0800)]
Add gather/scatter tests with incorrect memory operand

2014-01-31  Michael Zolotukhin  <michael.v.zolotukhin@gmail.com>

PR gas/16488
* gas/i386/inval-avx512f.s: Add test for incorrect memory operand
for gather/scatter instructions.
* gas/i386/x86-64-inval-avx512f.s: Likewise.
* gas/i386/inval-avx512f.l: Adjust correspondingly.
* gas/i386/x86-64-inval-avx512f.l: Likewise.

10 years agoDelete ada-lang.h::clear_ada_sym_cache (nonexistant function).
Joel Brobecker [Fri, 31 Jan 2014 11:30:02 +0000 (15:30 +0400)]
Delete ada-lang.h::clear_ada_sym_cache (nonexistant function).

I happen to notice this extern function declaration in ada-lang.h
which does not actually exist...

gdb/ChangeLog:

        * ada-lang.h (clear_ada_sym_cache): Delete.

10 years agoNios II CALL26 linker relaxation
Sandra Loosemore [Fri, 31 Jan 2014 01:47:07 +0000 (17:47 -0800)]
Nios II CALL26 linker relaxation

2014-01-30  Sandra Loosemore  <sandra@codesourcery.com>

bfd/
* bfd-in2.h: Update from reloc.c.
* elf32-nios2.c: Include elf32-nios2.h.
(elf_nios2_howto_table_rel): Add entry for R_NIOS2_CALL26_NOAT.
(nios2_reloc_map): Likewise.
(enum elf32_nios2_stub_type): Declare.
(struct elf32_nios2_stub_hash_entry): Declare.
(nios2_stub_hash_entry, nios2_stub_hash_lookup): New macros.
(struct elf32_nios2_link_hash_entry): Add hsh_cache field.
(struct elf32_nios2_link_hash_table): Add new fields bstab,
stub_bfd, add_stub_section, layout_sections_again, stub_group,
bfd_count, top_index, input_list, all_local_syms.
(nios2_call26_stub_entry): New.
(nios2_elf32_install_imm16): Move up in file.
(nios2_elf32_install_data): Move up in file.
(hiadj): Move up in file.
(stub_hash_newfunc): New.
(link_hash_newfunc): Initialize hsh_cache field.
(STUB_SUFFIX): New.
(nios2_stub_name): New.
(nios2_get_stub_entry): New.
(nios2_add_stub): New.
(nios2_elf32_setup_section_lists): New.
(nios2_elf32_next_input_section): New.
(CALL26_SEGMENT): New.
(MAX_STUB_SECTION_SIZE): New.
(group_sections): New.
(nios2_type_of_stub): New.
(nios2_build_one_stub): New.
(nios2_size_one_stub): New.
(get_local_syms): New.
(nios2_elf32_size_stubs): New.
(nios2_elf32_build_stubs): New.
(nios2_elf32_do_call26_relocate): Correct CALL26 overflow test.
(nios2_elf32_relocate_section): Handle R_NIOS2_CALL26_NOAT.  Add
trampolines for R_NIOS2_CALL26 stubs.
(nios2_elf32_check_relocs): Handle R_NIOS2_CALL26_NOAT.
(nios2_elf32_gc_sweep_hook): Likewise.
(nios2_elf32_link_hash_table_create): Initialize the stub hash table.
(nios2_elf32_link_hash_table_free): New.
(bfd_elf32_bfd_link_hash_table_free): Define.
* elf32-nios2.h: New file.
* libbfd.h: Update from reloc.c.
* reloc.c (BFD_RELOC_NIOS2_CALL26_NOAT): New.

gas/
* config/tc-nios2.c (md_apply_fix): Handle BFD_RELOC_NIOS2_CALL26_NOAT.
(nios2_assemble_args_m): Likewise.
(md_assemble): Likewise.

gas/testsuite/
* gas/nios2/call26_noat.d: New.
* gas/nios2/call26_noat.s: New.
* gas/nios2/call_noat.d: New.
* gas/nios2/call_noat.s: New.

include/elf/
* nios2.h (elf_nios2_reloc_type): Add R_NIOS2_CALL26_NOAT.

ld/
* Makefile.am (enios2elf.c, enios2linux.c): Update dependencies.
* Makefile.in: Regenerated.
* emulparams/nios2elf.sh (EXTRA_EM_FILE): Set.
* emulparams/nios2linux.sh (EXTRA_EM_FILE): Set.
* emultempl/nios2elf.em: New file.
* gen-doc.texi (NIOSII): Set.
* ld.texinfo (NIOSII): Set.

ld/testsuite/
* ld-nios2/relax_call26.s: New.
* ld-nios2/relax_call26_boundary.ld: New.
* ld-nios2/relax_call26_boundary.s: New.
* ld-nios2/relax_call26_boundary_c8.d: New.
* ld-nios2/relax_call26_boundary_cc.d: New.
* ld-nios2/relax_call26_boundary_d0.d: New.
* ld-nios2/relax_call26_boundary_d4.d: New.
* ld-nios2/relax_call26_boundary_d8.d: New.
* ld-nios2/relax_call26_boundary_dc.d: New.
* ld-nios2/relax_call26_boundary_f0.d: New.
* ld-nios2/relax_call26_boundary_f4.d: New.
* ld-nios2/relax_call26_boundary_f8.d: New.
* ld-nios2/relax_call26_boundary_fc.d: New.
* ld-nios2/relax_call26_cache.d: New.
* ld-nios2/relax_call26_cache.ld: New.
* ld-nios2/relax_call26_cache.s: New.
* ld-nios2/relax_call26_multi.d: New.
* ld-nios2/relax_call26_multi.ld: New.
* ld-nios2/relax_call26_norelax.d: New.
* ld-nios2/relax_call26_shared.d: New.
* ld-nios2/relax_call26_shared.ld: New.

10 years agodaily update
Alan Modra [Thu, 30 Jan 2014 23:00:43 +0000 (09:30 +1030)]
daily update

10 years agoAdd support for AT_HWCAP2 auxv entry
Ulrich Weigand [Thu, 30 Jan 2014 18:12:35 +0000 (19:12 +0100)]
Add support for AT_HWCAP2 auxv entry

Recent ppc64 Linux kernels provide a new auxv entry AT_HWCAP2,
which is currently not recognized by GDB, causing every use of
"info auxv" to show an error.

This commit adds the AT_HWCAP2 define to include/elf/common.h
and handles it in GDB.

include/elf/ChangeLog:

* common.h (AT_HWCAP2): Define.

gdb/ChangeLog:

* auxv.c (fprint_target_auxv): Handle AT_HWCAP2.

10 years agoFix shift for AVX512F gather/scatter instructions
Michael Zolotukhin [Thu, 30 Jan 2014 15:38:09 +0000 (07:38 -0800)]
Fix shift for AVX512F gather/scatter instructions

opcodes/

2014-01-30  Michael Zolotukhin  <michael.v.zolotukhin@gmail.com>
    Jan Beulich  <jbeulich@suse.com>

PR binutils/16490
* i386-dis.c (OP_E_memory): Fix shift computation for
vex_vsib_q_w_dq_mode.

gas/testsuite/

2014-01-30  Michael Zolotukhin  <michael.v.zolotukhin@gmail.com>
    Jan Beulich  <jbeulich@suse.com>

PR binutils/16490
* gas/i386/avx512f.d: Fix test output.
* gas/i386/avx512f-intel.d: Likewise.
* gas/i386/x86-64-avx512f.d: Likewise.
* gas/i386/x86-64-avx512f-intel.d: Likewise.

10 years agodaily update
Alan Modra [Wed, 29 Jan 2014 23:00:42 +0000 (09:30 +1030)]
daily update

10 years agoAdd rdynamic-1 test
H.J. Lu [Wed, 29 Jan 2014 22:30:41 +0000 (14:30 -0800)]
Add rdynamic-1 test

It is added for

commit 409ff343a402799563f71f938138b29f8baf7a1c
Author: Alan Modra <amodra@gmail.com>
Date:   Tue Nov 8 13:49:11 2011 +0000

      * elflink.c (bfd_elf_gc_mark_dynamic_ref_symbol): Mark syms in
      executables when export_dynamic.

* ld-elf/rdynamic-1.c: New file.
* ld-elf/rdynamic-1.rd: Likewise.

* ld-elf/shared.exp (build_tests): Add rdynamic-1.

10 years agoThis changeset makes sparc64_linux_step_trap to return 0 when a
Jose E. Marchesi [Wed, 29 Jan 2014 15:15:05 +0000 (07:15 -0800)]
This changeset makes sparc64_linux_step_trap to return 0 when a
breakpoint is set in a `ta 0x6d´ which is not a sigreturn syscall.  In
these cases no rt_frame exists in the stack and thus the read PC is
wrong.

ChangeLog
2014-01-29  Jose E. Marchesi  <jose.marchesi@oracle.com>

* sparc64-linux-tdep.c (sparc64_linux_step_trap): Get PC from
          the sigreturn register save area only if the syscall is
          sigreturn.

testsuite/ChangeLog
2014-01-29  Jose E. Marchesi  <jose.marchesi@oracle.com>

* gdb.arch/sparc-sysstep.exp: New file.
* gdb.arch/sparc-sysstep.c: Likewise.

* gdb.arch/Makefile.in (EXECUTABLES): Add sparc-sysstep.

10 years agoMy patch to the binutils strip-10.d test was wrong. The osabi field should always...
Nick Clifton [Wed, 29 Jan 2014 14:01:54 +0000 (14:01 +0000)]
My patch to the binutils strip-10.d test was wrong.  The osabi field should always be set to
ELFOSABI_GNU for binaries containing unique symbols.  So I am reverting that patch and
instead applying the patch below to fix up the targets that were triggering the test failure.

bfd/ChangeLog
2014-01-29  Nick Clifton  <nickc@redhat.com>

* elf32-metag.c (elf_metag_post_process_headers): Call
_bfd_elf_post_process_headers.
* elf32-sh64.c (sh64_elf_copy_private_data): Call
_bfd_elf_copy_private_data.
* elf64-sh64.c (sh_elf64_copy_private_data_internal): Likewise.

binutils/testsuite/ChangeLog
2014-01-29  Nick Clifton  <nickc@redhat.com>

* binutils-all/strip-10.d: Revert previous delta.

10 years agoFollowing up on Tom's suggestion I am checking in a patch to replace the various
Nick Clifton [Wed, 29 Jan 2014 13:46:39 +0000 (13:46 +0000)]
Following up on Tom's suggestion I am checking in a patch to replace the various
bfd_xxx_set macros with static inline functions, so that we can avoid compile time
warnings about comma expressions with unused values.

* bfd-in.h (bfd_set_section_vma): Delete.
(bfd_set_section_alignment): Delete.
(bfd_set_section_userdata): Delete.
(bfd_set_cacheable): Delete.
* bfd.c (bfd_set_cacheable): New static inline function.
* section.c (bfd_set_section_userdata): Likewise.
(bfd_set_section_vma): Likewise.
(bfd_set_section_alignment): Likewise.
* bfd-in2.h: Regenerate.

10 years agoMinor reformatting in valops.c::value_slice
Joel Brobecker [Wed, 29 Jan 2014 10:25:18 +0000 (14:25 +0400)]
Minor reformatting in valops.c::value_slice

I noticed that a small lexical block was over indented by 2 characters.
So this patch starts by reducing the indentation.

While looking at this area of the code, I also noticed a couple of lines
that had trailing spaces, so this patch also removes them.

And finally, it fixes one tiny to put the assignment operator at
the start of the next line, rather than at the end of the first line.

gdb/ChangeLog:

        * valops.c (value_slice): Minor reformatting.

10 years agoAdd .gdb_index version 7 support.
Cary Coutant [Tue, 28 Jan 2014 23:35:47 +0000 (15:35 -0800)]
Add .gdb_index version 7 support.

This patch adds support for .gdb_index version 7, which adds several
flag bits to the symbol index.  It also fixes a problem where it did
not handle compressed debug sections correctly.

Tested with a google/gcc-4_8 branch compiler, which supports
the -ggnu-pubnames option to generate .debug_gnu_pubnames/pubtypes
tables. (We will submit that patch to GCC when stage 1 reopens.)

2014-01-28  Cary Coutant  <ccoutant@google.com>

* gold/dwarf_reader.cc: include <utility> (for make_pair).
(Dwarf_abbrev_table::do_read_abbrevs): Check for compressed
debug sections.
(Dwarf_ranges_table::read_ranges_table): Likewise.
(Dwarf_pubnames_table::read_section): Check for GNU-style
sections, and for compressed debug sections.
(Dwarf_pubnames_table::read_header): Compute end address of table.
(Dwarf_pubnames_table::next_name): Return flag_byte.  Check
for end of list by offset, not by offset == 0.
(Dwarf_info_reader::do_read_string_table): Check for compressed
debug sections.
* gold/dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
Initialize new data members.
(Dwarf_pubnames_table::next_name): return flag_byte.
(Dwarf_pubnames_table::end_of_table_): New data member.
(Dwarf_pubnames_table::is_gnu_style_): New data member.
* gold/gdb-index.cc (gdb_index_version): Update to version 7.
(Gdb_index_info_reader::read_pubtable): Read flag_byte.
(Gdb_index_info_reader::read_pubnames_and_pubtypes): Don't
read skeleton type unit DIEs.
(Gdb_index::add_symbol): Add flag_byte; adjust all callers.
(Gdb_index::do_write): Write flag_byte.
* gold/gdb-index.h (Gdb_index::add_symbol): Add flags parameter.
(Gdb_index::Cu_vector): Store flags along with cu indexes.
* gold/testsuite/gdb_index_test_3.sh: Allow versions 4-7.
* gold/testsuite/gdb_index_test_comm.sh: Likewise.

10 years agoFix info-shared.exp testcase to expect the leading `.' found on ppc64's symbols.
Edjunior Barbosa Machado [Tue, 28 Jan 2014 17:31:23 +0000 (15:31 -0200)]
Fix info-shared.exp testcase to expect the leading `.' found on ppc64's symbols.

gdb/testsuite/
2014-01-28  Edjunior Barbosa Machado  <emachado@linux.vnet.ibm.com>

* gdb.base/info-shared.exp: Expect leading `.' on ppc64's symbols.

10 years agoFix typo in ppc64_standard_linkage7
Ulrich Weigand [Tue, 28 Jan 2014 16:49:13 +0000 (17:49 +0100)]
Fix typo in ppc64_standard_linkage7

The ppc64_standard_linkage7 pattern added by Alan's recent patch:
https://sourceware.org/ml/gdb-patches/2013-11/msg00274.html
contains a typo: the ELFv2 TOC slot offset is 24, not 40.
This was correct in the comment, but not the actual code.

ChangeLog:

* ppc64-tdep.c (ppc64_standard_linkage7): Fix typo.

10 years agoWhen parsing a DW_FORM_ref_addr attribute the CU containing the
Nick Clifton [Tue, 28 Jan 2014 13:43:35 +0000 (13:43 +0000)]
When parsing a DW_FORM_ref_addr attribute the CU containing the
abbreviation may not be the current CU.  Thus we need to make sure
that when we read the abbreviation we use the correct CU.

* dwarf2.c (find_abstract_instance_name): For DW_FORM_ref_addr
attributes select the CU containing the abbreviation, which may not
be the current CU.

10 years agoA recent change to the BFD library has meant that the osabi field in
Nick Clifton [Tue, 28 Jan 2014 13:33:29 +0000 (13:33 +0000)]
A recent change to the BFD library has meant that the osabi field in
ELF headers will be copied from input files.  This in turn has broken
the strip-10 test in the binutils testsuite, so this patch updates the
expected output.

PR binutils/16318
* binutils-all/strip-10.d: Allow "System V" in the osabi field.

10 years agoThe MSP430 linker contains emulations for old and obsolete MCU types.
Nick Clifton [Tue, 28 Jan 2014 12:25:48 +0000 (12:25 +0000)]
The MSP430 linker contains emulations for old and obsolete MCU types.
Since all MCUs now have their own specific linker script (courtesy of
TI) there is no need for these emulations and so this patch removes
them.

* Makefile.am: Remove obsolete MSP430 emulations.
* configure.tgt: Likewise.
* emulparams/msp430all.sh: Likewise.
* Makefile.in: Regenerate.

10 years agoA recent update to the binutils means that RELA sections now have the
Nick Clifton [Tue, 28 Jan 2014 12:18:01 +0000 (12:18 +0000)]
A recent update to the binutils means that RELA sections now have the
SHF_INFO_LINK bit set, which shows up in readelf section dumps.  This
has broken a couple of IA64 testcases in the gas testsuite, which are
fixed by this patch.

PR binutils/16317
* gas/ia64/group-2.d: Expect I attribute with RELA sections.
* gas/ia64/xdata.d: Likewise.

10 years agoUpdate the tic6x linker tests to match the current behaviour of the linker and readelf.
Nick Clifton [Tue, 28 Jan 2014 11:56:13 +0000 (11:56 +0000)]
Update the tic6x linker tests to match the current behaviour of the linker and readelf.

PR binutils/16317
* ld-tic6x/shlib-1.rd: Expect I attribute with RELA sections.
* ld-tic6x/shlib-1b.rd: Likewise.
* ld-tic6x/shlib-1r.rd: Likewise.
* ld-tic6x/shlib-1rb.rd: Likewise.
* ld-tic6x/shlib-app-1rd: Likewise.
* ld-tic6x/shlib-app-1b.rd: Likewise.
* ld-tic6x/shlib-app-1r.rd: Likewise.
* ld-tic6x/shlib-app-1rb.rd: Likewise.
* ld-tic6x/shlib-noindex.rd: Likewise.
* ld-tic6x/static-app-1.rd: Likewise.
* ld-tic6x/static-app-1b.rd: Likewise.
* ld-tic6x/static-app-1r.rd: Likewise.
* ld-tic6x/static-app-1rb.rd: Likewise.

PR binutils/16318
* ld-tic6x/tic6x.exp: Expect C6000 osabi value in relocatable
objects.

10 years agoNew Ada maintenance command to ignore descriptive types (DWARF).
Joel Brobecker [Thu, 16 Jan 2014 11:08:16 +0000 (15:08 +0400)]
New Ada maintenance command to ignore descriptive types (DWARF).

Currently, Ada debugging requires the use of certain GNAT-specific
encodings, which are generated by the compiler. These encodings
were created a long time ago to work around the fairly limited
capabilities of the stabs debugging format. With DWARF, the vast
majority of the encodings could be abandoned in favor of a pure
DWARF approach.

In order to make it easier to evaluate the quality of the DWARF
debugging information generated by the compiler, and how the debugger
handles it, we are introducing a small Ada-specific maintenance
setting which changes the debugger's behavior to ignore descriptive
types. Descriptive types are artificial types generated by the
compiler purely to give the debugger hints as to how to properly
decode certain properties of a type.  For instance, for array
types, it generates a parallel type whose name is the name of
the array suffixed with ___XA, whose contents tells us what
the array's index type is, and possibly its bounds. See GCC's
gcc/ada/exp_dbug.ads for the full description of all encodings.

This is only a first step, as this setting does not deactivate
all encodings; More settings dedicated to each type of encoding
will likely be implemented in the future, as we make progress.

gdb/ChangeLog:

        * ada-lang.c (maint_set_ada_cmdlist, maint_show_ada_cmdlist):
        New static globals.
        (maint_set_ada_cmd, maint_show_ada_cmd): New functions.
        (ada_ignore_descriptive_types_p): New static global.
        (find_parallel_type_by_descriptive_type): Return immediately
        if ada_ignore_descriptive_types_p is set.
        (_initialize_ada_language): Register new commands "maintenance
        set ada", "maintenance show ada", "maintenance set ada
        ignore-descriptive-types" and "maintenance show ada
        ignore-descriptive-types".
        * NEWS: Add entry for new "maint ada set/show
        ignore-descriptive-types" commands.

gdb/doc/ChangeLog:

        * gdb.texinfo (Ada Glitches): Document the new "maint ada set/show
        ignore-descriptive-types". commands.

10 years agodaily update
Alan Modra [Mon, 27 Jan 2014 23:00:42 +0000 (09:30 +1030)]
daily update

10 years agobtrace: initiate teardown when closing record btrace target
Markus Metzger [Tue, 3 Dec 2013 09:20:47 +0000 (10:20 +0100)]
btrace: initiate teardown when closing record btrace target

The to_teardown_btrace target method is used to free btrace resources
during shutdown when target record has already been unpushed and we
can't reliably talk to a remote target to disable branch tracing.

Tracing resources are freed for each thread when the thread is removed;
both on the GDB side and on the gdbserver side.

In the remote case, the remote target that provides to_teardown_btrace
to free the GDB side resources has already been unpushed when threads
are destroyed.  This results in a complaint "You can't do this ..." and
in a few bytes of memory leaked for each thread.

Initiate btrace teardown in record_btrace_close, so the remote target is
still in place.

2014-01-27  Markus Metzger  <markus.t.metzger@intel.com>

* record-btrace.c (record_btrace_close): Call btrace_teardown
for all threads.

10 years agoada-lang.c: Really include "ui-out.h".
Joel Brobecker [Wed, 22 Jan 2014 07:42:27 +0000 (11:42 +0400)]
ada-lang.c: Really include "ui-out.h".

Currently, ada-lang.c pretends to include "ui-out.h" as follow:

    #ifdef UI_OUT
    #include "ui-out.h"
    #endif

However, UI_OUT is never defined as far as I can tell. This is confirmed
by rebuilding with a #error pragma inside the #ifdef UI_OUT block,
which never triggers.

Since this unit makes references to declarations from ui-out.h,
this patch simply removes the #ifdef/#endif condition.  This has not
been an error so far because "ui-out.h" indirectly gets included,
via one of the other .h files being included.

gdb/ChangeLog:

        * ada-lang.c: Remove "#ifdef UI_OUT" condition for including
        "ui-out.h".

10 years agoTry printing array range using the name of its index type
Joel Brobecker [Wed, 15 Jan 2014 16:00:05 +0000 (20:00 +0400)]
Try printing array range using the name of its index type

   type Char_Table is array (Character range Character'First .. Character'Last)
     of Natural;

Trying to print the type description of this type currently yields:

   (gdb) ptype char_table
   type = array ('["00"]' .. '["ff"]') of natural

Although technically correct, it seemed more useful to print the array
range as:

   (gdb) ptype char_table
   type = array (character) of natural

This patch implements this suggestion.

gdb/ChangeLog:

        * ada-typeprint (type_is_full_subrange_of_target_type):
        New function.
        (print_range): Add parameter bounds_prefered_p.  If not set,
        try printing range types using the name of their base type.
        (print_range_type): Add parameter bounds_prefered_p.
        Use it in call to print_range.
        (print_array_type, ada_print_type): Update calls to print_range
        and print_range_type.

gdb/testsuite/ChangeLog:

        * gdb.ada/array_char_idx: New testcase.

10 years agoRemove unncessary function declarations in ada-typeprint.c.
Joel Brobecker [Wed, 15 Jan 2014 15:14:15 +0000 (19:14 +0400)]
Remove unncessary function declarations in ada-typeprint.c.

These declarations are unncessary, and make it extra work when trying
to change the profile of one of these functions. This patch just
removes them.

Note that one of them (print_dynamic_range_bound), was improperly
indented.

gdb/ChangeLog:

        * ada-typeprint.c (print_array_type, print_choices, print_range)
        (print_range_bound, print_dynamic_range_bound, print_range_type):
        Remove declaration.

10 years agoAdd missing empty line after declaration in ada-typeprint.c:print_range.
Joel Brobecker [Wed, 15 Jan 2014 14:27:09 +0000 (18:27 +0400)]
Add missing empty line after declaration in ada-typeprint.c:print_range.

gdb/ChangeLog:

        * ada-typeprint.c (print_range): Add missing empty line
        after local declaration.

10 years ago[Ada] Array bound incorrectly printed for array indexed by enum subrange
Joel Brobecker [Thu, 9 Jan 2014 13:30:39 +0000 (17:30 +0400)]
[Ada] Array bound incorrectly printed for array indexed by enum subrange

Consider the following declarations:

   type Range_Type is (One, Two, Three);
   type Array_Type is array (Range_Type range One .. Two) of Integer;
   A : Array_Type := (1, 2);

Trying to print A can yield:

   (gdb) print a
   $1 = (one => 1, 2)

The bound of the first element should not have been printed, since
"one" is the first enumerate of type Range_Type. Similarly, with
the following declarations:

   type Array2_Type is array (Range_Type range Two .. Three) of Integer;
   A2 : Array2_Type := (2, 3);

GDB is failing to print the bound of the first element of "A2":

   (gdb) print a2
   $2 = (2, 3)

This is because the index type for both types Array_Type and Array2_Type
are subranges (by DWARF definition for arrays), of an anonymous subrange
type. When deciding whether to print the bound of the first element,
we handle subranges, but only up to one level. This patch enhanced
the code to handle any number of subrange levels.

gdb/ChangeLog:

        * ada-valprint.c (print_optional_low_bound): Get index_type's
        target type for as long as it is a TYPE_CODE_RANGE.

No testcase with this patch, but this will be tested via the testcase
of another patch, which uses the DWARF assembler to generate debugging
info for an array indexed by an enum.

10 years agoRemove assert in procfs.c::procfs_make_note_section (x86-solaris)
Joel Brobecker [Mon, 20 Jan 2014 15:18:58 +0000 (16:18 +0100)]
Remove assert in procfs.c::procfs_make_note_section (x86-solaris)

On x86-solaris, the gcore command sometimes triggers the following
internal error:

    (gdb) gcore
    /[...]/procfs.c:5523: internal-error: procfs_make_note_section: Assertion `thread_args.note_data != note_data' failed.

The problem is extremely elusive, for reasons that will become clearer
as I explain what is going on.

The program used to produce this issue was really simple:

    | void break_me (void) { }
    |
    | int
    | main (void)
    | {
    |   break_me ();
    |   return 0;
    | }

The procfs_make_note_section builds a buffer incrementally with
the contents of the core's notes section.  The interesting bits are:

  char *note_data = NULL;
  [...]
  note_data = (char *) elfcore_write_prpsinfo (obfd,
                                               note_data,
                                               note_size,
                                               fname,
                                               psargs);

This is the first call to bfd's elfcore which initializes note_data.
After that, we have a few more calls, which keep updating notes_data
and note_size, but our interest lies in the following part of
the function:

  thread_args.note_data = note_data;
  [...]
  proc_iterate_over_threads (pi, procfs_corefile_thread_callback,
                             &thread_args);
  /* There should be always at least one thread.  */
  gdb_assert (thread_args.note_data != note_data);

The comment implies that the assert is to verify that our loop
iterated over at least one thread. The check is relying on the
fact that the notes_data returned by the elfcore module changes
at each iteration, via (in procfs_corefile_thread_callback):

      args->note_data = procfs_do_thread_registers (args->obfd, ptid,
                                                    args->note_data,
                                                    args->note_size,
                                                    args->stop_signal);

(which calls elfcore_write_lwpstatus).

But, while it happens most of the time, thanks to a call to realloc
in elfcore_write_note (the function that actually appends the data
at the end of the notes buffer),...

       buf = (char *) realloc (buf, *bufsiz + newspace);

... this is by no means guarantied. In fact, under the right
circumstances, the buffer was grown twice without changing
addresses. Unfortunately, the circumstances are very sensitive,
thus making this bug very elusive.

This patch fixes the problem by simply removing the assert.
This means we're losing the assertion that there is at least one
thread, but I think that's OK. If we still want to keep the
assertion, we have the option of either checking the buffer
size, or else adding a boolean flag in the context structure
that we'd set to true as soon as we have a thread.

gdb/ChangeLog:

        * procfs.c (procfs_make_note_section): Remove assertion and
        associated comment.

10 years agodaily update
Alan Modra [Sun, 26 Jan 2014 23:00:42 +0000 (09:30 +1030)]
daily update

10 years agodaily update
Alan Modra [Sat, 25 Jan 2014 23:01:04 +0000 (09:31 +1030)]
daily update

10 years agodaily update
Alan Modra [Fri, 24 Jan 2014 23:01:10 +0000 (09:31 +1030)]
daily update

10 years agoAdd .data and .bss refsym symbols
DJ Delorie [Fri, 24 Jan 2014 19:43:58 +0000 (14:43 -0500)]
Add .data and .bss refsym symbols

For each object, if it has a nonempty .data or .bss section,
emit a symbol that could cause the startup code to selectively
link in the code to initialize those sections.

* config/tc-msp430.c (msp430_section): Always flag data sections,
regardless of -md.
(msp430_frob_section): New.  Make sure all sections are noticed if
they have content.
(msp430_lcomm): New.  Flag bss if .lcomm is seen.
(msp430_comm): New.  Likewise.
(md_pseudo_table): Add them.
* config/tc-msp430.h (msp430_frob_section): Declare.
(tc_frob_section): Define.

10 years agoReplace .align with .p2align
H.J. Lu [Fri, 24 Jan 2014 18:01:56 +0000 (10:01 -0800)]
Replace .align with .p2align

* ld-elf/pr16498a.s: Replace .align with .p2align.

10 years agoAdd another testcase for PR ld/16498
H.J. Lu [Fri, 24 Jan 2014 17:03:21 +0000 (09:03 -0800)]
Add another testcase for PR ld/16498

PR ld/16498
* ld-elf/pr16498b.d: New file.
* ld-elf/pr16498b.t: Likewise.

10 years agoImprove orphaned TLS section handling
H.J. Lu [Wed, 22 Jan 2014 19:24:12 +0000 (11:24 -0800)]
Improve orphaned TLS section handling

ld/

PR ld/16498
* emultempl/elf32.em (gld${EMULATION_NAME}_place_orphan): Improve
orphaned TLS section handling.

ld/testsuite/

PR ld/16498
* ld-elf/pr16498a.d: New file.
* ld-elf/pr16498a.s: Likewise.
* ld-elf/pr16498a.t: Likewise.

10 years agoChange len's type to ULONGEST: remote_read_bytes and get_core_siginfo
Yao Qi [Fri, 10 Jan 2014 06:11:59 +0000 (14:11 +0800)]
Change len's type to ULONGEST: remote_read_bytes and get_core_siginfo

Functions remote_read_bytes and get_core_siginfo are the callees of
target to_xfer_partial interface, so argument 'len' should be changed
to type ULONGEST.

gdb:

2014-01-24  Yao Qi  <yao@codesourcery.com>

* remote.c (remote_read_bytes): Change type of len to ULONGEST.
* corelow.c (get_core_siginfo): Likewise.

10 years agoChange len's type to ULONGEST: remote_write_bytes_aux
Yao Qi [Fri, 10 Jan 2014 05:59:26 +0000 (13:59 +0800)]
Change len's type to ULONGEST: remote_write_bytes_aux

Hi,
This patch changes the type of 'len' from ssize_t to ULONGEST.

At the beginning Siddhesh Poyarekar proposed this patch

  [PATCH] Memory reads and writes should have size_t length
  https://sourceware.org/ml/gdb-patches/2012-05/msg01073.html

to change type of 'len' to size_t.  However, after Jan's review, we
decide to change it to ssize_t, because callers of these functions
may pass signed type to them.

AFAICS, the target layer is a boundary.  In one side, we pass size_t
or ssize_t to target related APIs, and in the other side, the
implementation side, we used LONGEST (ULONGEST in latest code) because
of to_xfer_partial.

Since remote_write_bytes_aux and remote_write_bytes belong to the
implementation of remote target, we should use ULONGEST for len, IMO.

Regression tested on x86_64-linux.  Is it OK?

gdb:

2014-01-24  Yao Qi  <yao@codesourcery.com>

* remote.c (remote_write_bytes_aux): Change type of 'len' to
ULONGEST.  Don't check 'len' is negative.
(remote_write_bytes):  Change type of 'len' to ULONGEST.

10 years agoTLS orphan section placement
Alan Modra [Fri, 24 Jan 2014 12:47:28 +0000 (23:17 +1030)]
TLS orphan section placement

Ensures TLS orphans are placed adjacent to existing TLS sections,
and fixes places where the output_section_statement flags (which might
not be set) were tested when bfd_section flags were available.

* ldlang.c (lang_output_section_find_by_flags): Be careful to
test look->bfd_section->flags if available rather than
look->flags.  Separate SEC_THREAD_LOCAL handling from
SEC_READONLY loop, and rewrite.

10 years agoFixes powerpc64le ld segfaults when --emit-relocs is used.
Alan Modra [Fri, 24 Jan 2014 03:52:10 +0000 (14:22 +1030)]
Fixes powerpc64le ld segfaults when --emit-relocs is used.

ELFv2 needs fewer relocs to annotate plt call stubs.  I correctly
allocated a smaller buffer and wrote the proper relocs, but stupidly
bumped the reloc count as for ELFv1.

* elf64-ppc.c (ppc_build_one_stub): Correct reloc count passed
to get_relocs for ELFv2.

10 years agodaily update
Alan Modra [Thu, 23 Jan 2014 23:00:59 +0000 (09:30 +1030)]
daily update

10 years agoRemove the display of known MCU names from the MSP430 port of GAS.
Nick Clifton [Thu, 23 Jan 2014 17:08:24 +0000 (17:08 +0000)]
Remove the display of known MCU names from the MSP430 port of GAS.

New MSP430 MCU parts are being created by TI all the time and the
list is basically always out of date.  Instead any name will be
accepted by the -mmcu= command line option.  ISA selection is now
based upon the -mcpu= command line option, just as is done for GCC.

gas/ChangeLog
* config/tc-msp430.c (show_mcu_list): Delete.
(md_parse_option): Accept any MCU name.  Accept several more
variants for the -mcpu option.
(md_show_usage): Do not call show_mcu_list.

10 years agoIssue a linker error if TLS sections are not adjacent
H.J. Lu [Thu, 23 Jan 2014 16:15:17 +0000 (08:15 -0800)]
Issue a linker error if TLS sections are not adjacent

Bad linker script may lead to TLS sections separated by non-TLS sections
in output.  This patch changes linker assert to a linker error to
provide better linker diagnosis.

PR ld/16498
* elf.c (_bfd_elf_map_sections_to_segments): Issue a linker error
if TLS sections are not adjacent.

10 years agoavoid python exception in FrameDecorator.py
Tom Tromey [Wed, 22 Jan 2014 15:52:15 +0000 (08:52 -0700)]
avoid python exception in FrameDecorator.py

This fixes a bug in FrameDecorator.py.

FrameVars seems to assume that Frame.block can return None if there is
no block.  However, it actually throws an exception.

I saw this bug while developing a frame filter, but unfortunately I
don't know how to reproduce it.  It seems to me that the SAL tests in
_is_limited_frame should exclude the bad cases; and in my attempts to
write a test they do.

Nevertheless I think the fix is reasonably obvious and ought to go in.

2014-01-23  Tom Tromey  <tromey@redhat.com>

PR python/16485:
* python/lib/gdb/FrameDecorator.py: (FrameVars.fetch_frame_args):
Handle exception from frame.block.
(FrameVars.fetch_frame_locals): Likewise.

10 years agofix erroneous error-handling in frame filter code
Tom Tromey [Wed, 22 Jan 2014 15:44:41 +0000 (08:44 -0700)]
fix erroneous error-handling in frame filter code

This fixes PR python/16487.

The bug here is that the function-name-handling code in py_print_frame
had a small logic error (really a misplaced closing brace).  This
error could lead to a Py_DECREF(NULL), which crashes.

This patch fixes the bug in the obvious way.

Built and regtested on x86-64 Fedora 18.  New test case included.

2014-01-23  Tom Tromey  <tromey@redhat.com>

PR python/16487:
* python/py-framefilter.c (py_print_frame): Don't call Py_DECREF
on a NULL pointer.  Move "goto error" to correct place.

2014-01-23  Tom Tromey  <tromey@redhat.com>

PR python/16487:
* gdb.python/py-framefilter.exp: Add test using "Error" filter.
* gdb.python/py-framefilter.py (ErrorInName, ErrorFilter): New
classes.

10 years agofix crash in frame filters
Tom Tromey [Wed, 22 Jan 2014 15:10:01 +0000 (08:10 -0700)]
fix crash in frame filters

apply_frame_filter calls ensure_python_env before computing the
gdbarch to use.  This means that python_gdbarch can be NULL while in
Python code, and if a frame filter depends on this somehow (easy to
do), gdb will crash.

The fix is to compute the gdbarch first.

Built and regtested on x86-64 Fedora 18.
New test case included.

2014-01-23  Tom Tromey  <tromey@redhat.com>

PR python/16491:
* python/py-framefilter.c (apply_frame_filter): Call
ensure_python_env after computing gdbarch.

2014-01-23  Tom Tromey  <tromey@redhat.com>

PR python/16491:
* gdb.python/py-framefilter.py (Reverse_Function.function): Read a
string from an inferior frame.
* gdb.python/py-framefilter-mi.exp: Update.

10 years agoUse gdb_byte * instead of void *
Yao Qi [Mon, 16 Dec 2013 06:39:12 +0000 (14:39 +0800)]
Use gdb_byte * instead of void *

This patch changes the argument type to gdb_byte * in order to align
with the to_xfer_partial interface.

gdb:

2014-01-23  Yao Qi  <yao@codesourcery.com>

* target.c (raw_memory_xfer_partial): Change argument type
from void * to gdb_byte *.
(memory_xfer_partial_1, memory_xfer_partial): Likewise.

10 years ago * gdbthread.h (gdb_id_to_thread): Delete, unused.
Doug Evans [Thu, 23 Jan 2014 00:39:29 +0000 (16:39 -0800)]
* gdbthread.h (gdb_id_to_thread): Delete, unused.

10 years agodaily update
Alan Modra [Wed, 22 Jan 2014 23:01:08 +0000 (09:31 +1030)]
daily update

10 years ago New gdbserver option --debug-format=timestamp.
Doug Evans [Wed, 22 Jan 2014 22:17:39 +0000 (14:17 -0800)]
New gdbserver option --debug-format=timestamp.
* NEWS: Mention it.

gdbserver/
* configure.ac (AC_CHECK_FUNCS): Add test for gettimeofday.
* configure: Regenerate.
* config.in: Regenerate.
* Makefile.in (SFILES): Add debug.c.
(OBS): Add debug.o.
* debug.c: New file.
* debug.h: New file.
* linux-aarch64-low.c (*): Update all debugging printfs to use
debug_printf instead of fprintf.
* linux-arm-low.c (*): Ditto.
* linux-cris-low.c (*): Ditto.
* linux-crisv32-low.c (*): Ditto.
* linux-m32r-low.c (*): Ditto.
* linux-sparc-low.c (*): Ditto.
* linux-x86.c (*): Ditto.
* linux-low.c (*): Ditto.
(linux_wait_1): Add calls to debug_enter, debug_exit.
(linux_wait): Remove redundant debugging printf.
(stop_all_lwps): Add calls to debug_enter, debug_exit.
(linux_resume, unstop_all_lwps): Ditto.
* mem-break.c (*): Update all debugging printfs to use
debug_printf instead of fprintf.
* remote-utils.c (*): Ditto.
* thread-db.c (*): Ditto.
* server.c #include <ctype.h>, "gdb_vecs.h".
(debug_threads): Moved to debug.c.
(*): Update all debugging printfs to use debug_printf instead of
fprintf.
(start_inferior): Replace call to fflush with call to debug_flush.
(monitor_show_help): Mention set debug-format.
(parse_debug_format_options): New function.
(handle_monitor_command): Handle "monitor set debug-format".
(gdbserver_usage): Mention --debug-format.
(main): Parse --debug-format.
* server.h (debug_threads): Declaration moved to debug.h.
#include "debug.h".
* tracepoint.c (trace_debug_1) [!IN_PROCESS_AGENT]: Add version of
trace_debug_1 that uses debug_printf.
(tracepoint_look_up_symbols): Update all debugging printfs to use
debug_printf instead of fprintf.

doc/
* gdb.texinfo (Server): Mention --debug-format=all|none|timestamp.
(gdbserver man): Ditto.

testsuite/
* gdb.server/server-mon.exp: Add tests for "set debug-format".

10 years agoAdd .refsym to msp430 backend
DJ Delorie [Wed, 22 Jan 2014 21:41:13 +0000 (16:41 -0500)]
Add .refsym to msp430 backend

* config/tc-msp430.c (msp430_refsym): New: ".refsym <symbol>"
* doc/c-msp430.texi (MSP430 Directives): Document it.

The purpose of this patch is to provide a way for one object file
to require the inclusion of another object, without having to
allocate space for a .word address reference.

10 years agoRemove regzmm from AVX2 gather assert
Michael Zolotukhin [Wed, 22 Jan 2014 19:39:02 +0000 (11:39 -0800)]
Remove regzmm from AVX2 gather assert

Since regzmm can't be used in AVX2 gather instructions, there is no need
to check regzmm in AVX2 gather assert.

2014-01-22  Michael Zolotukhin  <michael.v.zolotukhin@gmail.com>

* config/tc-i386.c (check_VecOperands): Remove regzmm from AVX2
gather assert.

10 years agoAdd check for invalid register in AVX512 gathers
Michael Zolotukhin [Wed, 22 Jan 2014 17:57:31 +0000 (09:57 -0800)]
Add check for invalid register in AVX512 gathers

AVX512 gather instructions shouldn't accept the same register for both
destination and index.

gas/

2014-01-22  Michael Zolotukhin  <michael.v.zolotukhin@gmail.com>

PR gas/16489
* config/tc-i386.c (check_VecOperands): Add check for invalid
register set in AVX512 gathers.

gas/testsuite/

2014-01-22  Michael Zolotukhin  <michael.v.zolotukhin@gmail.com>

PR gas/16489
* gas/i386/vgather-check.s: Add tests for AVX512 gathers.
* gas/i386/x86-64-vgather-check.s: Likewise.
* gas/i386/vgather-check-error.l: Update correspondingly.
* gas/i386/vgather-check-none.d: Likewise.
* gas/i386/vgather-check-warn.d: Likewise.
* gas/i386/vgather-check-warn.e: Likewise.
* gas/i386/vgather-check.d: Likewise.
* gas/i386/x86-64-vgather-check-error.l: Likewise.
* gas/i386/x86-64-vgather-check-none.d: Likewise.
* gas/i386/x86-64-vgather-check-warn.d: Likewise.
* gas/i386/x86-64-vgather-check-warn.e: Likewise.
* gas/i386/x86-64-vgather-check.d: Likewise.

10 years agogdb/ChangeLog:
Andreas Arnez [Wed, 22 Jan 2014 17:54:43 +0000 (18:54 +0100)]
gdb/ChangeLog:
* syscalls/s390x-linux.xml: New file.
* syscalls/s390-linux.xml: New file.
* s390-linux-tdep.c (XML_SYSCALL_FILENAME_S390): New macro.
(XML_SYSCALL_FILENAME_S390X): Likewise.
(op_svc): New enum value for SVC opcode.
(s390_sigtramp_frame_sniffer): Replace literal by 'op_svc'.
(s390_linux_get_syscall_number): New function.
(s390_gdbarch_init): Register '*get_syscall_number' and the
syscall xml file name.
* data-directory/Makefile.in (SYSCALLS_FILES): Add
"s390-linux.xml" and "s390x-linux.xml".
* NEWS: Announce new feature.

gdb/testsuite/ChangeLog:
* gdb.base/catch-syscall.exp: Activate test on s390*-linux.

10 years agoFix regression on s390x with entry-values.exp.
Andreas Arnez [Wed, 22 Jan 2014 15:37:41 +0000 (15:37 +0000)]
Fix regression on s390x with entry-values.exp.

The trace-specific test case 'entry-values' concludes fairly late in
the process that this platform doesn't support trace.  Before that,
there are some platform specifics that don't work on s390x.  The fix
addresses two aspects:

(1) Removal of an excess space character in the regex for the
    disassembly.  This is needed when there is a function alignment
    gap, because then the hex address is immediately followed by a
    colon, like in the first 'nopr' line below:

    (gdb) disassemble foo+50,+10
    Dump of assembler code from 0x32 to 0x3c:
       0x0000000000000032 <foo+50>: br      %r4
       0x0000000000000034:  nopr    %r7
       0x0000000000000036:  nopr    %r7
       0x0000000000000038 <bar+0>:  stmg    %r11,%r15,88(%r15)
    End of assembler dump.

(2) Handling for the s390-specific call instruction.

gdb/testsuite/ChangeLog:
* gdb.trace/entry-values.exp: Remove excess space character from
regex patterns.  Handle s390 call instruction.

10 years agoRe-introduce '_start' labels and add alignment in dw2-dir-file-name test case.
Andreas Arnez [Wed, 22 Jan 2014 15:33:00 +0000 (15:33 +0000)]
Re-introduce '_start' labels and add alignment in dw2-dir-file-name test case.

On ppc64-linux a function symbol does not point to code, but to the
function descriptor.  Thus the previous change for this test case
broke it:

      https://sourceware.org/ml/gdb-patches/2014-01/msg00275.html

This patch reverts to the original method, re-introducing '_start'
symbols.  In addition, it adds sufficient alignment before the label,
such that the label never points into an alignment gap.

gdb/testsuite/ChangeLog:
* gdb.dwarf2/dw2-dir-file-name.c (FUNC): Insert alignment and
define "*_start" label.  Make "name" static.
* gdb.dwarf2/dw2-dir-file-name.exp: Replace references to
${name} by references to ${name}_start.

10 years agoPrevent appending "-g" after "-g3" to compile options in info-macros.exp.
Andreas Arnez [Wed, 22 Jan 2014 15:31:10 +0000 (15:31 +0000)]
Prevent appending "-g" after "-g3" to compile options in info-macros.exp.

When upstream gcc is given a command line with the "-g" option after
"-g3", it doesn't generate a ".debug_macro" section.  This is because
the last option wins, thus downgrading the debug level again.  Without
any macro debug information in the executable, info-macros.exp
obviously produces many failures.

Since the "-g" option is appended by DejaGnu's target_compile whenever
the "debug" option is set, the fix just removes that option.

gdb/testsuite/ChangeLog:
* gdb.base/info-macros.exp: Remove "debug" from the compile
options.

10 years agogdb: xtensa: fix on 64-bit hosts
Baruch Siach [Wed, 22 Jan 2014 13:02:29 +0000 (15:02 +0200)]
gdb: xtensa: fix on 64-bit hosts

On 64-bit hosts unsigned long is 64 bit.  Use uint32_t instead.

gdb/
2014-01-22  Baruch Siach  <baruch@tkos.co.il>

* xtensa-tdep.h (xtensa_elf_greg_t): Change type to uint32_t.