Rafael Ávila de Espíndola [Tue, 17 Feb 2015 15:47:02 +0000 (10:47 -0500)]
avoid std::vector copy.
Rafael Ávila de Espíndola [Tue, 17 Feb 2015 15:43:20 +0000 (10:43 -0500)]
Use std::upper_bound to simplify code a bit.
With std::upper_bound we don't have to check p->input_offset > input_offset.
Jose E. Marchesi [Tue, 17 Feb 2015 15:43:48 +0000 (16:43 +0100)]
Announce the DTrace USDT probes support in NEWS.
This patch simply adds a small entry to `Changes since GDB 7.8' announcing the
support for dtrace probes.
gdb/ChangeLog:
2015-02-17 Jose E. Marchesi <jose.marchesi@oracle.com>
* NEWS: Announce the support for DTrace SDT probes.
Jose E. Marchesi [Tue, 17 Feb 2015 15:42:15 +0000 (16:42 +0100)]
Documentation for DTrace USDT probes.
This patch modifies the `Static Probe Points' section on the GDB
manual in order to cover the support for DTrace USDT probes, in
addition to SystemTap SDT probes.
gdb/doc/ChangeLog:
2015-02-17 Jose E. Marchesi <jose.marchesi@oracle.com>
* gdb.texinfo (Static Probe Points): Add cindex `static probe
point, DTrace'.
(Static Probe Points): Modified to cover DTrace probes in addition
to SystemTap probes. Also modified to cover the `enable probe'
and `disable probe' commands.
Jose E. Marchesi [Tue, 17 Feb 2015 15:41:16 +0000 (16:41 +0100)]
Simple testsuite for DTrace USDT probes.
This patch adds some simple tests testing the support for DTrace USDT
probes. The testsuite will be skipped as unsupported in case the user
does not have DTrace installed on her system. The tests included in the
test suite test breakpointing on DTrace probes, enabling and disabling
probes, printing of probe arguments of several types and also
breakpointing on several probes with the same name.
gdb/ChangeLog:
2015-02-17 Jose E. Marchesi <jose.marchesi@oracle.com>
* lib/dtrace.exp: New file.
* gdb.base/dtrace-probe.exp: Likewise.
* gdb.base/dtrace-probe.d: Likewise.
* gdb.base/dtrace-probe.c: Likewise.
* lib/pdtrace.in: Likewise.
* configure.ac: Output variables with the transformed names of
the strip, readelf, as and nm tools. AC_SUBST lib/pdtrace.in.
* configure: Regenerated.
Jose E. Marchesi [Tue, 17 Feb 2015 15:04:01 +0000 (16:04 +0100)]
Support for DTrace USDT probes in x86_64 targets.
This patch adds the target-specific code in order to support the
calculation of DTrace probes arguments in x86_64 targets, and also the
enabling and disabling of probes. This is done by implementing the
`dtrace_*' gdbarch handlers.
gdb/ChangeLog:
2015-02-17 Jose E. Marchesi <jose.marchesi@oracle.com>
* amd64-linux-tdep.c: Include "parser-defs.h" and "user-regs.h".
(amd64_dtrace_parse_probe_argument): New function.
(amd64_dtrace_probe_is_enabled): Likewise.
(amd64_dtrace_enable_probe): Likewise.
(amd64_dtrace_disable_probe): Likewise.
(amd64_linux_init_abi): Register the
`gdbarch_dtrace_probe_argument', `gdbarch_dtrace_enable_probe',
`gdbarch_dtrace_disable_probe' and
`gdbarch_dtrace_probe_is_enabled' hooks.
(amd64_dtrace_disabled_probe_sequence_1): New constant.
(amd64_dtrace_disabled_probe_sequence_2): Likewise.
(amd64_dtrace_enable_probe_sequence): Likewise.
(amd64_dtrace_disable_probe_sequence): Likewise.
Jose E. Marchesi [Tue, 17 Feb 2015 15:03:22 +0000 (16:03 +0100)]
New probe type: DTrace USDT probes.
This patch adds a new type of probe to GDB: the DTrace USDT probes. The new
type is added by providing functions implementing all the entries of the
`probe_ops' structure defined in `probe.h'. The implementation is
self-contained and does not depend on DTrace source code in any way.
gdb/ChangeLog:
2015-02-7 Jose E. Marchesi <jose.marchesi@oracle.com>
* breakpoint.c (BREAK_ARGS_HELP): Help string updated to mention
the -probe-dtrace new vpossible value for PROBE_MODIFIER.
* configure.ac (CONFIG_OBS): dtrace-probe.o added if BFD can
handle ELF files.
* Makefile.in (SFILES): dtrace-probe.c added.
* configure: Regenerate.
* dtrace-probe.c: New file.
(SHT_SUNW_dof): New constant.
(dtrace_probe_type): New enum.
(dtrace_probe_arg): New struct.
(dtrace_probe_arg_s): New typedef.
(struct dtrace_probe_enabler): New struct.
(dtrace_probe_enabler_s): New typedef.
(dtrace_probe): New struct.
(dtrace_probe_is_linespec): New function.
(dtrace_dof_sect_type): New enum.
(dtrace_dof_dofh_ident): Likewise.
(dtrace_dof_encoding): Likewise.
(DTRACE_DOF_ENCODE_LSB): Likewise.
(DTRACE_DOF_ENCODE_MSB): Likewise.
(dtrace_dof_hdr): New struct.
(dtrace_dof_sect): Likewise.
(dtrace_dof_provider): Likewise.
(dtrace_dof_probe): Likewise.
(DOF_UINT): New macro.
(DTRACE_DOF_PTR): Likewise.
(DTRACE_DOF_SECT): Likewise.
(dtrace_process_dof_probe): New function.
(dtrace_process_dof): Likewise.
(dtrace_build_arg_exprs): Likewise.
(dtrace_get_arg): Likewise.
(dtrace_get_probes): Likewise.
(dtrace_get_probe_argument_count): Likewise.
(dtrace_can_evaluate_probe_arguments): Likewise.
(dtrace_evaluate_probe_argument): Likewise.
(dtrace_compile_to_ax): Likewise.
(dtrace_probe_destroy): Likewise.
(dtrace_gen_info_probes_table_header): Likewise.
(dtrace_gen_info_probes_table_values): Likewise.
(dtrace_probe_is_enabled): Likewise.
(dtrace_probe_ops): New variable.
(info_probes_dtrace_command): New function.
(_initialize_dtrace_probe): Likewise.
(dtrace_type_name): Likewise.
Jose E. Marchesi [Tue, 17 Feb 2015 14:54:44 +0000 (15:54 +0100)]
New gdbarch functions: dtrace_parse_probe_argument, dtrace_probe_is_enabled, dtrace_enable_probe, dtrace_disable_probe.
This patch adds several gdbarch functions (along with the corresponding
predicates): `dtrace_parse_probe_argument', `dtrace_probe_is_enabled',
`dtrace_enable_probe' and `dtrace_disable_probe'. These functions will
be implemented by target-specific code, and called from the DTrace
probes implementation in order to calculate the value of probe
arguments, and manipulate is-enabled probes.
gdb/ChangeLog:
2015-02-17 Jose E. Marchesi <jose.marchesi@oracle.com>
* gdbarch.sh (dtrace_parse_probe_argument): New.
(dtrace_probe_is_enabled): Likewise.
(dtrace_enable_probe): Likewise.
(dtrace_disable_probe): Likewise.
* gdbarch.c: Regenerate.
* gdbarch.h: Regenerate.
Jose E. Marchesi [Tue, 17 Feb 2015 14:51:07 +0000 (15:51 +0100)]
New commands `enable probe' and `disable probe'.
This patch adds the above-mentioned commands to the generic probe
abstraction implemented in probe.[ch]. The effects associated to
enabling or disabling a probe depend on the type of probe being
handled, and is triggered by invoking two back-end hooks in
`probe_ops'.
In case some particular probe type does not support the notion of
enabling and/or disabling, the corresponding fields on `probe_ops' can
be initialized to NULL. This is the case of SystemTap probes.
gdb/ChangeLog:
2015-02-17 Jose E. Marchesi <jose.marchesi@oracle.com>
* stap-probe.c (stap_probe_ops): Add NULLs in the static
stap_probe_ops for `enable_probe' and `disable_probe'.
* probe.c (enable_probes_command): New function.
(disable_probes_command): Likewise.
(_initialize_probe): Define the cli commands `enable probe' and
`disable probe'.
(parse_probe_linespec): New function.
(info_probes_for_ops): Use parse_probe_linespec.
* probe.h (probe_ops): New hooks `enable_probe' and
`disable_probe'.
gdb/doc/ChangeLog:
2015-02-17 Jose E. Marchesi <jose.marchesi@oracle.com>
* gdb.texinfo (Static Probe Points): Cover the `enable probe' and
`disable probe' commands.
Jose E. Marchesi [Tue, 17 Feb 2015 14:50:19 +0000 (15:50 +0100)]
Move `compute_probe_arg' and `compile_probe_arg' to probe.c
This patch moves the `compute_probe_arg' and `compile_probe_arg' functions
from stap-probe.c to probe.c. The rationale is that it is reasonable to
assume that all backends will provide the `$_probe_argN' convenience
variables, and that the user must be placed on the PC of the probe when
requesting that information. The value and type of the argument can still be
determined by the probe backend via the `pops->evaluate_probe_argument' and
`pops->compile_to_ax' handlers.
Note that a test in gdb.base/stap-probe.exp had to be adjusted because the "No
SystemTap probe at PC" messages are now "No probe at PC".
gdb/ChangeLog:
2015-02-17 Jose E. Marchesi <jose.marchesi@oracle.com>
* probe.c (compute_probe_arg): Moved from stap-probe.c
(compile_probe_arg): Likewise.
(probe_funcs): Likewise.
* stap-probe.c (compute_probe_arg): Moved to probe.c.
(compile_probe_arg): Likewise.
(probe_funcs): Likewise.
gdb/testsuite/ChangeLog:
2015-02-17 Jose E. Marchesi <jose.marchesi@oracle.com>
* gdb.base/stap-probe.exp (stap_test): Remove "SystemTap" from
expected message when trying to access $_probe_* convenience
variables while not on a probe.
Jose E. Marchesi [Tue, 17 Feb 2015 14:49:12 +0000 (15:49 +0100)]
Adapt `info probes' to support printing probes of different types.
A "probe type" (backend for the probe abstraction implemented in
probe.[ch]) can extend the information printed by `info probes' by
defining additional columns. This means that when `info probes' is
used to print all the probes regardless of their types, some of the
columns will be "not applicable" to some of the probes (like, say, the
Semaphore column only makes sense for SystemTap probes). This patch
makes `info probes' fill these slots with "n/a" marks (currently it
breaks the table) and not include headers for which no actual probe
has been found in the list of defined probes.
This patch also adds support for a new generic column "Type", that
displays the type of each probe. SystemTap probes identify themselves
as "stap" probes.
gdb/ChangeLog:
2015-02-17 Jose E. Marchesi <jose.marchesi@oracle.com>
* probe.c (print_ui_out_not_applicables): New function.
(exists_probe_with_pops): Likewise.
(info_probes_for_ops): Do not include column headers for probe
types for which no probe has been actually found on any object.
Also invoke `print_ui_out_not_applicables' in order to match the
column rows with the header when probes of several types are
listed.
Print the "Type" column.
* probe.h (probe_ops): Added a new probe operation `type_name'.
* stap-probe.c (stap_probe_ops): Add `stap_type_name'.
(stap_type_name): New function.
Alan Modra [Mon, 16 Feb 2015 22:44:59 +0000 (09:14 +1030)]
Properly place the NULL STT_FILE symbol revistited
I was having a little closer look at what is going on here and noticed
that HJ unconditionally emits a NULL STT_FILE symbol before emitting
forced local symbols. That means we really don't need a second pass
over forced local symbols. The only reason for two passes is when
some forced local symbol can be emitted before the NULL STT_FILE. So
I set about removing the second pass, updating the testsuite all over
again. It's also unnecessary to emit the NULL STT_FILE when no
previous file symbol has been emitted.
bfd/
PR ld/17975
* elflink.c (struct elf_outext_info): Remove need_second_pass
and second_pass.
(elf_link_output_extsym): Delete code handling second forced
local pass. Move code emitting NULL STT_FILE symbol later, so
that it can be omitted if forced local is stripped. Don't
emit the NULL STT_FILE if no file symbols have been output.
(bfd_elf_final_link): Remove second forced local pass.
* elf32-ppc.c (add_stub_sym): Set linker_def on linker syms.
(ppc_elf_size_dynamic_sections): Likewise.
* elf64-ppc.c (ppc_build_one_stub): Likewise.
(build_global_entry_stubs): Likewise.
(ppc64_elf_build_stubs): Likewise.
ld/testsuite/
PR ld/17975
* ld-aarch64/gc-tls-relocs.d, * ld-alpha/tlspic.rd,
* ld-cris/libdso-2.d, * ld-i386/tlsdesc-nacl.rd, * ld-i386/tlsdesc.rd,
* ld-i386/tlsnopic-nacl.rd, * ld-i386/tlsnopic.rd,
* ld-i386/tlspic-nacl.rd, * ld-i386/tlspic.rd, * ld-ia64/tlspic.rd,
* ld-powerpc/tlsexe.r, * ld-powerpc/tlsexetoc.r,
* ld-powerpc/tlsso.r, * ld-powerpc/tlstocso.r,
* ld-s390/tlspic.rd, * ld-s390/tlspic_64.rd,
* ld-sparc/tlssunnopic32.rd, * ld-sparc/tlssunnopic64.rd,
* ld-sparc/tlssunpic32.rd, * ld-sparc/tlssunpic64.rd,
* ld-tic6x/shlib-1.rd, * ld-tic6x/shlib-1b.rd, * ld-tic6x/shlib-1r.rd,
* ld-tic6x/shlib-1rb.rd, * ld-tic6x/shlib-noindex.rd,
* ld-x86-64/tlsdesc-nacl.rd, * ld-x86-64/tlsdesc.rd,
* ld-x86-64/tlspic-nacl.rd, * ld-x86-64/tlspic.rd: Update.
Patrick Palka [Tue, 17 Feb 2015 13:06:10 +0000 (08:06 -0500)]
Remove superfluous function key_is_command_char()
The function key_is_command_char() is simply a predicate that determines
whether the function tui_dispatch_ctrl_char() will do anything useful.
Since tui_dispatch_ctrl_char() performs the same checks as
key_is_command_char() it is unnecessary to keep key_is_command_char()
around. This patch removes this useless function and instead
unconditionally calls tui_dispatch_ctrl_char() inside its only caller,
tui_getc().
gdb/ChangeLog:
* tui/tui-io.c (tui_getc): Don't call key_is_command_char.
(key_is_command_char): Delete.
Pedro Alves [Tue, 17 Feb 2015 10:05:52 +0000 (10:05 +0000)]
TUI: resize windows to new terminal size before displaying them
If the user:
#1 - disables the TUI
#2 - resizes the terminal
#3 - and then re-enables the TUI
the next wgetch() returns KEY_RESIZE. This indicates to the ncurses
client that ncurses detected that the terminal has been resized. We
don't handle KEY_RESIZE anywhere, so it gets passed on to readline
which interprets it as a multibyte character, and then the end result
is that the first key press after enabling the TUI is misinterpreted.
We shouldn't really need to handle KEY_RESIZE (and not all ncurses
implementations have that). We have our own SIGWINCH handler, and,
when we re-enable the TUI, we explicitly detect terminal resizes and
resize all windows. The reason ncurses currently does detects a
resize is that something within tui_enable forces a refresh/display of
some window before we get to do the actual resizing. Setting a break
on ncurses' 'resizeterm' function helps find the culprit(s):
(top-gdb) bt
#0 resizeterm (ToLines=28, ToCols=114) at ../../ncurses/base/resizeterm.c:462
#1 0x0000003b42812f3f in _nc_update_screensize (sp=0x2674730) at ../../ncurses/tinfo/lib_setup.c:443
#2 0x0000003b0821cbe0 in doupdate () at ../../ncurses/tty/tty_update.c:726
#3 0x0000003b08215539 in wrefresh (win=0x2a7bc00) at ../../ncurses/base/lib_refresh.c:65
#4 0x00000000005257cb in tui_refresh_win (win_info=0xd73d60 <_locator>) at /home/pedro/gdb/mygit/src/gdb/tui/tui-wingeneral.c:60
#5 0x000000000052265b in tui_show_locator_content () at /home/pedro/gdb/mygit/src/gdb/tui/tui-stack.c:269
#6 0x00000000005273a6 in tui_set_key_mode (mode=TUI_COMMAND_MODE) at /home/pedro/gdb/mygit/src/gdb/tui/tui.c:321
#7 0x00000000005278c7 in tui_enable () at /home/pedro/gdb/mygit/src/gdb/tui/tui.c:494
#8 0x0000000000527011 in tui_rl_switch_mode (notused1=1, notused2=1) at /home/pedro/gdb/mygit/src/gdb/tui/tui.c:108
That is, tui_enable calls tui_set_key_mode before we've resized all
windows, and that refreshes a window as side effect.
And if we're already debugging something (there's a frame), then we'll
instead show a window from within tui_show_frame_info:
(top-gdb) bt
#0 resizeterm (ToLines=28, ToCols=114) at ../../ncurses/base/resizeterm.c:462
#1 0x0000003b42812f3f in _nc_update_screensize (sp=0x202e6c0) at ../../ncurses/tinfo/lib_setup.c:443
#2 0x0000003b0821cbe0 in doupdate () at ../../ncurses/tty/tty_update.c:726
#3 0x0000003b08215539 in wrefresh (win=0x2042890) at ../../ncurses/base/lib_refresh.c:65
#4 0x00000000005257cb in tui_refresh_win (win_info=0xd73d60 <_locator>) at /home/pedro/gdb/mygit/src/gdb/tui/tui-wingeneral.c:60
#5 0x000000000052265b in tui_show_locator_content () at /home/pedro/gdb/mygit/src/gdb/tui/tui-stack.c:269
#6 0x0000000000522931 in tui_show_frame_info (fi=0x16b9cc0) at /home/pedro/gdb/mygit/src/gdb/tui/tui-stack.c:364
#7 0x00000000005278ba in tui_enable () at /home/pedro/gdb/mygit/src/gdb/tui/tui.c:491
#8 0x0000000000527011 in tui_rl_switch_mode (notused1=1, notused2=1) at /home/pedro/gdb/mygit/src/gdb/tui/tui.c:108
The fix is to resize windows earlier.
gdb/ChangeLog:
2015-02-17 Pedro Alves <palves@redhat.com>
* tui/tui.c (tui_enable): Resize windows before anything
might show a window.
Maxim Ostapenko [Mon, 16 Feb 2015 16:24:53 +0000 (20:24 +0400)]
Fix GDB build fail on Aarch64 when -fno-common is enabled
Current trunk GDB (and gdb-7.8.1 too) fails to build on Aarch64 when
-fno-common is enabled. It fails during link stage due to multiple
definition of `tdesc_aarch64':
...
[ 199s] aarch64-linux-nat.o: In function `initialize_tdesc_aarch64':
[ 199s]
/home/abuild/rpmbuild/BUILD/gdb-7.8.1/gdb/features/aarch64.c:11:
multiple definition of `tdesc_aarch64'
[ 199s]
aarch64-tdep.o:/home/abuild/rpmbuild/BUILD/gdb-7.8.1/gdb/objfiles.h:540:
first defined here
[ 199s] aarch64-linux-nat.o: In function `initialize_tdesc_aarch64':
[ 199s]
/home/abuild/rpmbuild/BUILD/gdb-7.8.1/gdb/features/aarch64.c:11:
multiple definition of `tdesc_aarch64'
[ 199s]
aarch64-tdep.o:/home/abuild/rpmbuild/BUILD/gdb-7.8.1/gdb/objfiles.h:540:
first defined here
[ 199s] collect2: error: ld returned 1 exit status
[ 199s] make[2]: *** [gdb] Error 1
...
This happens because struct target_desc *tdesc_aarch64 is defined in
gdb/features/aarch64.c, which is included by two files
(gdb/aarch64-linux-nat.c and gdb/aarch64-tdep.c).
gdb/Changelog
2015-02-17 Max Ostapenko <m.ostapenko@partner.samsung.com>
PR gdb/17984
* aarch64-linux-nat.c: Don't include features/aarch64.c anymore.
(aarch64_linux_read_description): Remove initialize_tdesc_aarch64
call.
* aarch64-tdep.h (tdesc_aarch64): Declare.
Mark Wielaard [Mon, 9 Feb 2015 23:02:34 +0000 (00:02 +0100)]
[gold] Recognize DWARF5/GCC5 DW_LANG_Fortran03 and DW_LANG_Fortran08.
DWARFv5 defines and GCC5 may output two new DW_LANG constants for the
Fortran 2003 and Fortran 2008 standards. Recognize both in gold gdb-index
as unsupported.
For consistency also add the other new DWARF5/GCC5 language constants in
the elfcpp::DW_LANG enum to match include/dwarf2.h.
elfcpp/ChangeLog:
* dwarf.h (enum DW_LANG): Add DW_LANG_C_plus_plus_11,
DW_LANG_C11, DW_LANG_C_plus_plus_14, DW_LANG_Fortran03 and
DW_LANG_Fortran08 from ../include/dwarf2.h.
gold/ChangeLog:
* gdb-index.cc (Gdb_index_info_reader::visit_top_die): Recognize
DW_LANG_Fortran03 and DW_LANG_Fortran08.
Cary Coutant [Tue, 17 Feb 2015 06:15:12 +0000 (22:15 -0800)]
Fix --dynamic-list so that symbols not in the list are still exported.
In PR 13577, the complaint was that -Bsymbolic was overriding the binding
behavior for symbols listed in the --dynamic-list by setting the DT_SYMBOLIC
tag in the dynamic table. In reading the Gnu ld manual, I decided that
--dynamic-list should be mutually exclusive of -Bsymbolic, and modified
gold so that --dynamic-list would treat symbols listed as preemptible,
and all other symbols as internally bound. I was wrong.
PR 16992 shows that with --dynamic-list (and not -Bsymbolic), a symbol
not listed in the dynamic list is being internally bound within the
shared library, but because it's still in the dynamic symbol table, we
expose it to a COPY relocation, and things go really bad from there.
(I can reproduce the same failure, simply by turning on -Bsymbolic-functions
with the Gnu linker. Even though the symbol is bound internally, it's
still exported to the dynamic symbol table, and is exposed to a COPY
relocation.)
I've backed out part of the fix for PR 13577, and -Bsymbolic (or
-Bsymbolic-functions) can now be used with --dynamic-list, but if the
two are used together, we do not set DT_SYMBOLIC or DF_SYMBOLIC
(this matches Gnu ld behavior). We now treat symbols listed in the
dynamic list as premptible, but we do not automatically treat symbols
not listed there as non-premptible.
gold/
PR gold/13577
PR gold/16992
* layout.cc (Layout::finish_dynamic_section): Don't set DT_SYMBOLIC or
DF_SYMBOLIC if --dynamic-list option is used.
* options.cc (General_options::finalize): --dynamic-list is not
mutually exclusive with -Bsymbolic.
* symtab.h (Symbol::is_preemptible): Don't exclude dynamic symbols not
listed in --dynamic-list.
* testsuite/Makefile.am (dynamic_list_lib2.so): Add
-Bsymbolic-functions.
* testsuite/Makefile.in: Regenerate.
Cary Coutant [Tue, 17 Feb 2015 04:14:08 +0000 (20:14 -0800)]
Remove redundant include of "output.h".
gold/
PR gold/17971
* incremental.cc: Remove redundant include of "output.h".
GDB Administrator [Tue, 17 Feb 2015 00:00:09 +0000 (00:00 +0000)]
Automatic date update in version.in
H.J. Lu [Mon, 16 Feb 2015 17:07:42 +0000 (09:07 -0800)]
Correct a typo in ld/testsuite/ChangeLog
H.J. Lu [Mon, 16 Feb 2015 16:35:17 +0000 (08:35 -0800)]
Update more ld testcases after PR ld/17975 fix
* ld-alpha/tlspic.rd: Updated.
* ld-powerpc/tlsexe.r: Likewise.
* ld-powerpc/tlsexetoc.r: Likewise.
* ld-powerpc/tlsso.r: Likewise.
* ld-powerpc/tlstocso.r: Likewise.
* ld-s390/tlspic.rd: Likewise.
* ld-s390/tlspic_64.rd: Likewise.
* ld-sparc/gotop32.dd: Likewise.
* ld-sparc/gotop64.dd: Likewise.
* ld-sparc/tlssunnopic32.rd: Likewise.
* ld-sparc/tlssunnopic64.rd: Likewise.
* ld-sparc/tlssunpic32.rd: Likewise.
* ld-sparc/tlssunpic64.rd: Likewise.
* ld-tic6x/shlib-1.rd: Likewise.
* ld-tic6x/shlib-1b.rd: Likewise.
* ld-tic6x/shlib-1r.rd: Likewise.
* ld-tic6x/shlib-1rb.rd: Likewise.
* ld-tic6x/shlib-noindex.rd: Likewise.
H.J. Lu [Mon, 16 Feb 2015 15:31:46 +0000 (07:31 -0800)]
Add ChangeLog entries for PR ld/17975 fix
H.J. Lu [Sun, 15 Feb 2015 04:17:28 +0000 (20:17 -0800)]
Properly place the NULL STT_FILE symbol
We output a NULL STT_FILE symbol for forced local symbols so that they
are not associated with the STT_FILE symbol for real local symbols. This
patch makes sure that the NULL STT_FILE symbol is placed before forced
local symbols.
bfd/
PR ld/17975
* elflink.c (elf_link_output_extsym): Only check filesym_count
when outputting a NULL FILE symbol. Set second_pass_sym to
h->forced_local && !h->root.linker_def.
ld/testsuite/
PR ld/17975
* ld-i386/tlsbin-nacl.rd: Likewise.
* ld-i386/tlsbin.rd: Likewise.
* ld-i386/tlsbindesc-nacl.rd: Likewise.
* ld-i386/tlsbindesc.rd: Likewise.
* ld-i386/tlsdesc-nacl.rd: Likewise.
* ld-i386/tlsdesc.rd: Likewise.
* ld-i386/tlsnopic-nacl.rd: Likewise.
* ld-i386/tlsnopic.rd: Likewise.
* ld-i386/tlspic-nacl.rd: Likewise.
* ld-i386/tlspic.rd: Likewise.
* ld-x86-64/tlsbin-nacl.rd: Likewise.
* ld-x86-64/tlsbin.rd: Likewise.
* ld-x86-64/tlsbindesc-nacl.rd: Likewise.
* ld-x86-64/tlsbindesc.rd: Likewise.
* ld-x86-64/tlsdesc-nacl.rd: Likewise.
* ld-x86-64/tlsdesc.rd: Likewise.
* ld-x86-64/tlspic-nacl.rd: Likewise.
* ld-x86-64/tlspic.rd: Likewise.
Mark Wielaard [Thu, 12 Feb 2015 15:51:53 +0000 (16:51 +0100)]
Remove true and false ARI checks now that we use stdbool.h.
gdb/ChangeLog:
* contrib/ari/gdb_ari.sh: Remove checks for "true" and "false".
GDB Administrator [Mon, 16 Feb 2015 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in
H.J. Lu [Sun, 15 Feb 2015 04:17:10 +0000 (20:17 -0800)]
Set root.linker_def on _TLS_MODULE_BASE_
* elf32-i386.c (elf_i386_always_size_sections): Set root.linker_def
on _TLS_MODULE_BASE_.
* elf64-x86-64.c (elf_x86_64_always_size_sections): Likewise.
Nick Clifton [Sun, 15 Feb 2015 15:05:18 +0000 (15:05 +0000)]
This fixes a bug I introduced to the PDP11 target when I was trying to fix an illegal memory access problem.
* pdp11.c (aout_get_external_symbols): Return TRUE if there are no
symbols - just set the count to zero.
Alan Modra [Sun, 15 Feb 2015 08:32:46 +0000 (19:02 +1030)]
fix
dbb3fbbb dwarf2.c breakage
m68hc11-elf +FAIL: 68HC12 indexed addressing mode with 5, 9 and 16-bit offsets (indexed12)
m68hc12-elf +FAIL: 68HC12 indexed addressing mode with 5, 9 and 16-bit offsets (indexed12)
* dwarf2.c (read_rangelist): Correct buffer overflow check
Whitespace throughout file.
GDB Administrator [Sun, 15 Feb 2015 00:00:07 +0000 (00:00 +0000)]
Automatic date update in version.in
H.J. Lu [Sat, 14 Feb 2015 13:45:08 +0000 (05:45 -0800)]
Add a testcase for PR ld/17973
ld/
PR ld/17973
* testplug2.c (allsymbolsread_silent): New.
(set_register_hook): Handle allsymbolsreadsilent.
(onall_symbols_read): Skip a message if allsymbolsread_silent is
TRUE.
ld/testsuite/
PR ld/17973
* ld-plugin/plugin.exp (regassilent): New.
Compile tmpdir/dummy.s and ld-plugin/pr17973.s.
(plugin_tests): Add a test for PR ld/17973.
* ld-plugin/pr17973.d: New file.
* ld-plugin/pr17973.s: Likewise.
Alan Modra [Sat, 14 Feb 2015 08:08:32 +0000 (18:38 +1030)]
PR ld/17973 LTO file syms
LTO output objects have an STT_FILE symbol using the name of the file,
a temporary file. This results in executables that can't be exactly
reproduced, so the file name needs to be dropped. We don't want to
lose all file symbols when linking a mix of lto and non-lto objects as
a file symbol can be used to figure which source file generated a
given local symbol. So lto output objects need to be marked.
I chose to mark lto output objects with a new bfd flag. This flag is
also used to fix a bug in the link-once handling; An object being
loaded after "loading_lto_outputs" is set might be one extracted from
an archive to satisfy new references from lto objects, not an lto
object itself.
The new flag is copied from archive to elements, and the same done
for no_export. This fixes a bug in that --exclude-libs doesn't work
with thin archives. I'm not completely happy with this part of the
patch and may revist this to avoid the hack in
_bfd_look_for_bfd_in_cache.
PR ld/17973
include/
* bfdlink.h (struct bfd_link_info): Delete loading_lto_outputs.
bfd/
* bfd.c (struct bfd): Add lto_output.
* linker.c (_bfd_handle_already_linked): Explicitly test for
objects added by the lto plugin.
* opncls.c (_bfd_new_bfd_contained_in): Copy lto_output and
no_export flags from archive.
* archive.c (open_nested_file): New function, setting lto_output
and no_export, extracted from..
(find_nested_archive): ..here. Flip params. Rename from
_bfd_find_nested_archive.
(_bfd_get_elt_at_filepos): Correct var typo. Use open_nested_file.
(_bfd_look_for_bfd_in_cache): Copy no_export.
* elflink.c (elf_link_add_object_symbols): Remove now unnecessary
my_archive->no_export test.
(elf_link_input_bfd): Drop existing lto_output STT_FILE syms.
Don't use the file name when adding lto_output STT_FILE sym.
* bfd-in2.h: Regenerate.
ld/
* ldlang.h (struct lang_input_statement_flags): Add lto_output.
* ldlang.c (lang_process): Don't set loading_lto_outputs.
* ldfile.c (ldfile_try_open_bfd): Transfer entry flags.lto_output
to bfd.
* plugin.c (add_input_file, add_input_library): Set flags.lto_output.
GDB Administrator [Sat, 14 Feb 2015 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in
Doug Evans [Fri, 13 Feb 2015 20:03:50 +0000 (12:03 -0800)]
misc cp-namespace.c cleanups
gdb/ChangeLog:
* cp-namespace.c (cp_basic_lookup_symbol): Rename parameter
anonymous_namespace to is_in_anonymous for consistency with the rest
of the file.
(cp_lookup_bare_symbol): Fix typo in comment.
(cp_search_static_and_baseclasses): Ditto.
(search_symbol_list): Use vertical space in comment better.
(reset_directive_searched): Ditto. Fix typo.
(cp_lookup_nested_symbol_1): Clarify contents of NESTED_NAME parameter.
Chen Gang [Thu, 12 Feb 2015 21:32:30 +0000 (05:32 +0800)]
sim/common/gentmap.c: Include "string.h".
The related warnings:
gcc ../../../binutils-gdb/sim/mcore/../common/gentmap.c -o gentmap -g -O -I. -I../../../binutils-gdb/sim/mcore -I../common -I../../../binutils-gdb/sim/mcore/../common -I../../include -I../../../binutils-gdb/sim/mcore/../../include -I../../bfd -I../../../binutils-gdb/sim/mcore/../../bfd -I../../opcodes -I../../../binutils-gdb/sim/mcore/../../opcodes
../../../binutils-gdb/sim/mcore/../common/gentmap.c: In function ‘main’:
../../../binutils-gdb/sim/mcore/../common/gentmap.c:119:7: warning: implicit declaration of function ‘strcmp’ [-Wimplicit-function-declaration]
if (strcmp (argv[1], "-h") == 0)
^
2015-02-13 Chen Gang <gang.chen.5i5j@gmail.com>
* gentmap.c: Include "string.h".
H.J. Lu [Fri, 13 Feb 2015 15:54:21 +0000 (07:54 -0800)]
Mention support for LLVM plugin in NEWS
* NEWS: Mention support for LLVM plugin.
Nick Clifton [Fri, 13 Feb 2015 14:17:18 +0000 (14:17 +0000)]
Fixes for memory access violations triggered by running readelf on fuzzed binaries.
PR binutils/17531
* dwarf.c (display_debug_aranges): Add check for an excessive
ar_length value.
(process_cu_tu_index): Check for a row * columns sum being too
large.
Nick Clifton [Fri, 13 Feb 2015 12:14:05 +0000 (12:14 +0000)]
Fix illegal memory access errors triggered by running srconv on fuzzed binaries.
PR binutils/17512
* dwarf.c (read_leb128): Fix test for shift becoming too large.
* coffgrok.c (do_define): Add check for type size overflow.
* srconv.c (walk_tree_sfile): Check that enough sections are
available before parsing.
(prescan): Likewise.
Nick Clifton [Fri, 13 Feb 2015 11:13:20 +0000 (11:13 +0000)]
Fix mistake in recent code to check for an unterminated leb128 number.
* dwarf.c (read_leb128): Fix test for shift becoming too large.
Yao Qi [Fri, 13 Feb 2015 10:23:16 +0000 (10:23 +0000)]
Update Yao Qi's email address in MAINTAINERS
gdb:
* MAINTAINERS: Update my email address.
Alan Modra [Thu, 12 Feb 2015 03:10:00 +0000 (13:40 +1030)]
binutils/dwarf.c white space
The style fix here is for num_units * sizeof * debug_information.
* dwarf.c: Formatting, whitespace.
(process_debug_info): Style fix.
Alan Modra [Thu, 12 Feb 2015 03:10:33 +0000 (13:40 +1030)]
Correct ld.texinfo cross reference
Fixes
warning: @pxref cross-reference name should not contain `:'
* ld.texinfo (Options <--defsym>): Correct cross reference.
Alan Modra [Thu, 12 Feb 2015 23:46:16 +0000 (10:16 +1030)]
PowerPC64 offset check should test entire 64-bit value is in section
PR binutils/17512
* elf64-ppc.c (opd_entry_value): Tighten offset check. Remove
now redundant assert.
GDB Administrator [Fri, 13 Feb 2015 00:00:07 +0000 (00:00 +0000)]
Automatic date update in version.in
Jing Yu [Thu, 12 Feb 2015 19:22:25 +0000 (11:22 -0800)]
Add missing TLSLE relocations for gold aarch64 backend.
gold/ChangeLog:
* aarch64-reloc.def (TLSLE_MOVW_TPREL_G2, TLSLE_MOVW_TPREL_G1,
TLSLE_MOVW_TPREL_G1_NC, TLSLE_MOVW_TPREL_G0, TLSLE_MOVW_TPREL_G0_NC,):
New relocation.
* aarch64.cc (Target_aarch64::Scan::local): Add cases for new
TLSLE_MOVW_* relocations.
(Target_aarch64::Scan::global): Likewise.
(Target_aarch64::Relocate::relocate): Likewise.
(Target_aarch64::Relocate::relocate_tls): Add cases and handlings
for new TLSLE_MOVW_* relocations.
Doug Evans [Thu, 12 Feb 2015 21:32:36 +0000 (13:32 -0800)]
completer.c (completion_list_add_name): Fix memory leak.
gdb/ChangeLog:
* completer.c (completion_list_add_name): Fix memory leak.
David Taylor [Thu, 12 Feb 2015 20:38:28 +0000 (22:38 +0200)]
Fix documentation of the QTDV packet
gdb/doc/ChangeLog
2015-02-12 David Taylor <dtaylor@emc.com>
* gdb.texinfo (Tracepoint Packets): Document the builtin and name
fields of the QTDV packet.
Doug Evans [Thu, 12 Feb 2015 20:19:31 +0000 (12:19 -0800)]
completer.c (complete_line): Remove incorrect comment.
gdb/ChangeLog:
* completer.c (complete_line): Remove incorrect comment.
Nick Clifton [Thu, 12 Feb 2015 16:45:11 +0000 (16:45 +0000)]
Fix memory access violations triggered by running addr2line on fuzzed binaries.
PR binutils/17512
* dwarf.c (read_1_byte, read_1_signed_byte, read_2_bytes)
(read_4_bytes, read_8_bytes, read_n_bytes, read_string)
(read_indirect_string, read_alt_indirect_string)
(read_alt_indirect_ref, read_address, read_abbrevs)
(read_attribute_value, read_attribute, decode_line_info)
(find_abstract_instance_name, read_rangelist)
(scan_unit_for_symbols, parse_comp_unit)
(_bfd_dwarf2_find_nearest_line): Harden DWARF reading code. Pass
end pointers to reading functions and check for offsets taking
pointers out of range. Replace calls to read_*_leb128 with calls
to safe_read_leb128.
(* elf64-ppc.c (opd_entry_value): Add a check for an overlarge
offset.
* syms.c (_bfd_stab_section_find_nearest_line): Add checks for
computed file_name address being before the start of the string
table.
Nick Clifton [Thu, 12 Feb 2015 16:32:28 +0000 (16:32 +0000)]
oops - changelog entry accidentally omitted from previous delta.
H.J. Lu [Thu, 12 Feb 2015 12:59:57 +0000 (04:59 -0800)]
Replace elf_i386 with elf_i386_nacl for nacl
* ld-i386/i386.exp: Replace elf_i386 with elf_i386_nacl for nacl.
GDB Administrator [Thu, 12 Feb 2015 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in
H.J. Lu [Wed, 11 Feb 2015 20:16:36 +0000 (12:16 -0800)]
Add --[no-]map-whole-files for gold compatibility
Gold supports:
--map-whole-files Map whole files to memory (default on 64-bit hosts)
--no-map-whole-files Map relevant file parts to memory (default on 32-bit hosts)
This patch adds --[no-]map-whole-files command line options for gold
compatibility. They are ignored for ld.
* lexsup.c (ld_options): Add --[no-]map-whole-files for gold
option compatibility.
H.J. Lu [Wed, 11 Feb 2015 20:16:07 +0000 (12:16 -0800)]
Output "warning:" or "error:" in plugin messages
When plugin generates LDPL_WARNING, LDPL_FATAL and LDPL_ERROR messages,
linker should display "warning:" or "error:" in plugin messages like
regular linker messages.
ld/
* plugin.c (message): Output "warning:" for LDPL_WARNING. Output
"error:" for LDPL_FATAL and LDPL_ERROR.
* testplug2.c (parse_option): Handle fatal, error and warning.
ld/testsuite/
* ld-plugin/plugin-27.d: New.
* ld-plugin/plugin-28.d: Likewise.
* ld-plugin/plugin-29.d: Likewise.
* plugin.exp (plugin_tests): Add tests for LDPL_FATAL, LDPL_ERROR
and LDPL_WARNING.
H.J. Lu [Wed, 11 Feb 2015 21:35:07 +0000 (13:35 -0800)]
Remove unused dump_tv_tag
* testplug2.c (dump_tv_tag): Removed.
(onall_symbols_read): Return LDPS_ERR if the file descriptor isn't
closed.
* testplug3.c (dump_tv_tag): Removed.
(onclaim_file): Fix typo.
Nick Clifton [Wed, 11 Feb 2015 14:36:39 +0000 (14:36 +0000)]
Fixes a problem with the RL78 disassembler which would incorrectly disassemble [HL+0] as [HL].
* rl78-decode.opc: Add 'a' attribute to instructions that support
[HL+0] addressing.
* rl78-decode.c: Regenerate.
* rl78-dis.c (print_insn_rl78): Display the offset in [HL+0]
addresses.
Jiong Wang [Wed, 11 Feb 2015 14:35:27 +0000 (14:35 +0000)]
[AArch64] Fix code formatting in the cpu-table
2015-02-11 Matthew Wahab <matthew.wahab@arm.com>
* config/tc-aarch64.c (aarch64_cpus): Fix code formatting.
Jan Kratochvil [Wed, 11 Feb 2015 13:53:14 +0000 (14:53 +0100)]
framefilter quit: New test
It definitely does not test all the RETURN_MASK_ERROR cases. But it tests at
least two of them.
gdb/testsuite/ChangeLog
2015-02-11 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.python/py-framefilter.exp (pagination quit - *): New tests.
Jan Kratochvil [Wed, 11 Feb 2015 13:50:09 +0000 (14:50 +0100)]
framefilter quit: Use RETURN_MASK_ERROR
Now when the code is exception safe we can let RETURN_QUIT to pass through as
all the installed cleanups with handle that.
gdb/ChangeLog
2015-02-11 Jan Kratochvil <jan.kratochvil@redhat.com>
* python/py-framefilter.c (py_print_single_arg, enumerate_locals)
(py_print_frame): Use RETURN_MASK_ERROR.
Chen Gang [Wed, 11 Feb 2015 13:39:01 +0000 (21:39 +0800)]
sim/mcore/interp.c: Include "unistd.h".
The related warnings:
gcc -DHAVE_CONFIG_H -DPROFILE=1 -DWITH_PROFILE=-1 -DDEFAULT_INLINE=0 -I. -I../../../binutils-gdb/sim/mcore -I../common -I../../../binutils-gdb/sim/mcore/../common -I../../include -I../../../binutils-gdb/sim/mcore/../../include -I../../bfd -I../../../binutils-gdb/sim/mcore/../../bfd -I../../opcodes -I../../../binutils-gdb/sim/mcore/../../opcodes -g -O2 -c -o interp.o -MT interp.o -MMD -MP -MF .deps/interp.Tpo ../../../binutils-gdb/sim/mcore/interp.c
../../../binutils-gdb/sim/mcore/interp.c: In function ‘handle_trap1’:
../../../binutils-gdb/sim/mcore/interp.c:559:22: warning: implicit declaration of function ‘link’ [-Wimplicit-function-declaration]
cpu.gr[RET1] = link ((char *) a[0], (char *) a[1]);
^
../../../binutils-gdb/sim/mcore/interp.c:585:22: warning: implicit declaration of function ‘access’ [-Wimplicit-function-declaration]
cpu.gr[RET1] = access ((char *) a[0], a[1]);
^
2015-02-11 Chen Gang <gang.chen.5i5j@gmail.com>
* interp.c: Include "unistd.h".
Jan Kratochvil [Wed, 11 Feb 2015 13:44:00 +0000 (14:44 +0100)]
framefilter quit: Make it exception safe
gdb/ChangeLog
2015-02-11 Jan Kratochvil <jan.kratochvil@redhat.com>
* python/py-framefilter.c (py_print_frame): Mention RETURN_QUIT in
function comment. Wrap all function that can throw in cleanups.
(gdbpy_apply_frame_filter): Wrap all function that can throw in
cleanups.
Jan Kratochvil [Wed, 11 Feb 2015 13:40:14 +0000 (14:40 +0100)]
framefilter quit: Code cleanup: Avoid gotos
goto error patters are sometimes AFAIK used in C for the cases like:
int retval=-1;
if (!(a=malloc())) goto error;
if (!(b=malloc())) goto error_a;
if (!(c=malloc())) goto error_b;
retval=0;
error_c: free(c);
error_b: free(b);
error_a: free(a);
error: return retval;
But here there is single error label with one do_cleanups() which I do not find
it worth the goto complication. Without goto one can then furher merge code in
the exit paths in the next patches and ... after all it is all the same, just
without a goto.
gdb/ChangeLog
2015-02-11 Jan Kratochvil <jan.kratochvil@redhat.com>
* python/py-framefilter.c (py_print_frame): Substitute goto error.
Remove the error label.
Jan Kratochvil [Wed, 11 Feb 2015 13:37:40 +0000 (14:37 +0100)]
framefilter quit: Code cleanup: Reindentation
Nothing significant but I find code more clear with less deep indentation.
gdb/ChangeLog
2015-02-11 Jan Kratochvil <jan.kratochvil@redhat.com>
* python/py-framefilter.c (py_print_frame): Put conditional code paths
with goto first, indent the former else codepath left. Put variable
'elided' to a new inner block.
Jan Kratochvil [Wed, 11 Feb 2015 13:33:48 +0000 (14:33 +0100)]
framefilter quit: Obvious whitespacing fixes
gdb/ChangeLog
2015-02-11 Jan Kratochvil <jan.kratochvil@redhat.com>
* python/py-framefilter.c (py_print_frame): Whitespacing fixes.
H.J. Lu [Wed, 11 Feb 2015 13:16:40 +0000 (05:16 -0800)]
Add ChangeLogs for
439b7f41b
H.J. Lu [Wed, 11 Feb 2015 13:14:11 +0000 (05:14 -0800)]
Add ChangeLogs for commit
5ae0078cd
Nick Clifton [Wed, 11 Feb 2015 13:05:04 +0000 (13:05 +0000)]
Fixes for invalid memory accesses triggered by running readelf on fuzzed binaries.
PR binutils/17531
* dwarf.c (display_debug_pubnames_worker): Work around compiler
bug checking address ranges.
(display_debug_frames): Likewise.
(display_gdb_index): Likewise.
(process_cu_tu_index): Add range check on the ncols value.
H.J. Lu [Wed, 11 Feb 2015 13:01:37 +0000 (05:01 -0800)]
Add tests for non-object IR file
This patch adds linker, nm and ar tests for non-object IR file, including
archive with non-object IR member.
ld/
PR ld/17878
* Makefile.am (noinst_LTLIBRARIES): Add libldtestplug2.la and
libldtestplug3.la.
(libldtestplug2_la_SOURCES): New.
(libldtestplug2_la_CFLAGS): Likewise.
(libldtestplug2_la_LDFLAGS): Likewise.
(libldtestplug3_la_SOURCES): New.
(libldtestplug3_la_CFLAGS): Likewise.
(libldtestplug3_la_LDFLAGS): Likewise.
* Makefile.in: Regenerated.
* testplug2.c: New file.
* testplug3.c: Likewise.
ld/testsuite/
PR ld/17878
* ld-plugin/func.c: Add some comments.
* ld-plugin/plugin-13.d: New file.
* ld-plugin/plugin-14.d: Likewise.
* ld-plugin/plugin-15.d: Likewise.
* ld-plugin/plugin-16.d: Likewise.
* ld-plugin/plugin-17.d: Likewise.
* ld-plugin/plugin-18.d: Likewise.
* ld-plugin/plugin-19.d: Likewise.
* ld-plugin/plugin-20.d: Likewise.
* ld-plugin/plugin-21.d: Likewise.
* ld-plugin/plugin-22.d: Likewise.
* ld-plugin/plugin-23.d: Likewise.
* ld-plugin/plugin-24.d: Likewise.
* ld-plugin/plugin-25.d: Likewise.
* ld-plugin/plugin-26.d: Likewise.
* ld-plugin/plugin.exp (plugin2_name): New.
(plugin3_name): Likewise.
(plugin2_path): Likewise.
(plugin3_path): Likewise.
(testsrcfiles): Likewise.
(testsrcfiles_notext): Likewise.
(plugin_tests): Add tests for non-object IR file.
(plugin_lib_tests): Likewise.
(plugin_extra_elf_tests): Likewise.
(plugin_src_tests): New tests for non-object IR file.
Run nm --plugin test.
Run ar --plugin test.
Run plugin_src_tests.
H.J. Lu [Wed, 11 Feb 2015 13:01:03 +0000 (05:01 -0800)]
Merge linker plugin handling into BFD plugin support
Linker plugin_maybe_claim is the interface of linker plugin support.
This patch extracts linker plugin_maybe_claim into plugin_object_p and
makes it available to BFD via a new function:
void register_ld_plugin_object_p (const bfd_target *(*) (bfd *));
bfd_plugin_object_p calls plugin_object_p registered by linker first. It
adds an enum bfd_plugin_format field and a pointer to plugin dummy BFD so
that plugin_object_p stores plugin dummy BFD to allow plugin_maybe_claim
to retrieve it later.
bfd/
PR ld/17878
* bfd.c (bfd_plugin_format): New.
(bfd): Add plugin_format and plugin_dummy_bfd.
* plugin.c (try_load_plugin): Take a pointer to bfd_boolean
argument to return TRUE if any plugin is found. Set plugin_format.
(has_plugin): New.
(bfd_plugin_target_p): New.
(bfd_plugin_specified_p): Likewise.
(bfd_plugin_target_p): Likewise.
(register_ld_plugin_object_p): Likewise.
(bfd_plugin_set_plugin): Set has_plugin.
(load_plugin): Cache try_load_plugin result.
(bfd_plugin_object_p): Try ld_plugin_object_p first. Check
plugin_format.
* plugin.h (bfd_plugin_target_p): New.
(bfd_plugin_specified_p): Likewise.
(register_ld_plugin_object_p): Likewise.
* bfd-in2.h: Regenerated.
ld/
PR ld/17878
* plugin.c: Include ../bfd/plugin.h.
(plugin_get_ir_dummy_bfd): Call bfd_create with
link_info.output_bfd instead of srctemplate. Copy BFD info
from srctemplate only if it doesn't use BFD plugin target
vector.
(plugin_load_plugins): Call register_ld_plugin_object_p with
(plugin_object_p)
(plugin_maybe_claim): Renamed to ...
(plugin_object_p): This. Return dummy BFD target vector if
input is calimed by plugin library, otherwise return NULL.
Update plugin_format and plugin_dummy_bfd.
(plugin_maybe_claim): New. Use plugin_object_p.
xx
Pedro Alves [Tue, 10 Feb 2015 11:01:21 +0000 (11:01 +0000)]
xcoffread.c: delete 'within_function' definition
Linking GDB as a C++ program, we get:
src/gdb/buildsym.c:226: multiple definition of `within_function'
xcoffread.o:src/gdb/xcoffread.c:181: first defined here
gdb/
2015-02-11 Pedro Alves <palves@redhat.com>
* xcoffread.c (within_function): Delete.
Tom Tromey [Wed, 11 Feb 2015 11:20:21 +0000 (11:20 +0000)]
Fix redefinition errors in C++ mode
In C, we can forward declare static structure instances. That doesn't
work in C++ though. C++ treats these as definitions. So then the
compiler complains about symbol redefinition, like:
src/gdb/elfread.c:1569:29: error: redefinition of ‘const sym_fns elf_sym_fns_lazy_psyms’
src/gdb/elfread.c:53:29: error: ‘const sym_fns elf_sym_fns_lazy_psyms’ previously declared here
The intent of static here is naturally to avoid making these objects
visible outside the compilation unit. The equivalent in C++ would be
to instead define the objects in the anonymous namespace. But given
that it's desirable to leave the codebase compiling as both C and C++
for a while, this just makes the objects extern.
(base_breakpoint_ops is already declared in breakpoint.h, so we can
just remove the forward declare from breakpoint.c)
gdb/ChangeLog:
2015-02-11 Tom Tromey <tromey@redhat.com>
Pedro Alves <palves@redhat.com>
* breakpoint.c (base_breakpoint_ops): Delete.
* dwarf2loc.c (dwarf_expr_ctx_funcs): Make extern.
* elfread.c (elf_sym_fns_gdb_index, elf_sym_fns_lazy_psyms): Make extern.
* guile/guile.c (guile_extension_script_ops, guile_extension_ops): Make extern.
* ppcnbsd-tdep.c (ppcnbsd2_sigtramp): Make extern.
* python/py-arch.c (arch_object_type): Make extern.
* python/py-block.c (block_syms_iterator_object_type): Make extern.
* python/py-bpevent.c (breakpoint_event_object_type): Make extern.
* python/py-cmd.c (cmdpy_object_type): Make extern.
* python/py-continueevent.c (continue_event_object_type)
* python/py-event.h (GDBPY_NEW_EVENT_TYPE): Remove 'qual'
parameter. Update all callers.
* python/py-evtregistry.c (eventregistry_object_type): Make extern.
* python/py-exitedevent.c (exited_event_object_type): Make extern.
* python/py-finishbreakpoint.c (finish_breakpoint_object_type): Make extern.
* python/py-function.c (fnpy_object_type): Make extern.
* python/py-inferior.c (inferior_object_type, membuf_object_type): Make extern.
* python/py-infevents.c (call_pre_event_object_type)
(inferior_call_post_event_object_type).
(memory_changed_event_object_type): Make extern.
* python/py-infthread.c (thread_object_type): Make extern.
* python/py-lazy-string.c (lazy_string_object_type): Make extern.
* python/py-linetable.c (linetable_entry_object_type)
(linetable_object_type, ltpy_iterator_object_type): Make extern.
* python/py-newobjfileevent.c (new_objfile_event_object_type)
(clear_objfiles_event_object_type): Make extern.
* python/py-objfile.c (objfile_object_type): Make extern.
* python/py-param.c (parmpy_object_type): Make extern.
* python/py-progspace.c (pspace_object_type): Make extern.
* python/py-signalevent.c (signal_event_object_type): Make extern.
* python/py-symtab.c (symtab_object_type, sal_object_type): Make extern.
* python/py-type.c (type_object_type, field_object_type)
(type_iterator_object_type): Make extern.
* python/python.c (python_extension_script_ops)
(python_extension_ops): Make extern.
* stap-probe.c (stap_probe_ops): Make extern.
Jiong Wang [Wed, 11 Feb 2015 10:54:50 +0000 (10:54 +0000)]
[ARM] Add support for Cortex-A72
2015-02-11 Matthew Wahab <matthew.wahab@arm.com>
* config/tc-arm.c: Add support for Cortex-A72.
Pedro Alves [Wed, 11 Feb 2015 10:04:47 +0000 (10:04 +0000)]
Wrap BFD headers in extern "C"
These were the BFD changes needed for building a C++ GDB with
--enable-targets=all, on x86_64 Fedora 20.
For libbfd.h and libcoff.h, this does same as already done when
generating bfd.h: open extern "C" in the -in.h header, and close it
from the Makefile.
bfd/doc/ChangeLog:
2015-02-11 Pedro Alves <palves@redhat.com>
* Makefile.am (libbfd.h, libcoff.h): Close extern "C" scope.
* Makefile.in: Regenerate.
bfd/ChangeLog:
2015-02-11 Pedro Alves <palves@redhat.com>
* libbfd-in.h [__cplusplus]: Open extern "C" scope.
* libcoff-in.h [__cplusplus]: Open extern "C" scope.
* libbfd.h: Regenerate.
* libcoff.h: Regenerate.
* elf-bfd.h [__cplusplus]: Wrap in extern "C".
* mach-o.h [__cplusplus]: Wrap in extern "C".
* som.h [__cplusplus]: Wrap in extern "C".
Pedro Alves [Wed, 11 Feb 2015 09:45:41 +0000 (09:45 +0000)]
Fix adjust_pc_after_break, remove still current thread check
On decr_pc_after_break targets, GDB adjusts the PC incorrectly if a
background single-step stops somewhere where PC-$decr_pc has a
breakpoint, and the thread that finishes the step is not the current
thread, like:
ADDR1 nop <-- breakpoint here
ADDR2 jmp PC
IOW, say thread A is stepping ADDR2's line in the background (an
infinite loop), and the user switches focus to thread B. GDB's
adjust_pc_after_break logic confuses the single-step stop of thread A
for a hit of the breakpoint at ADDR1, and thus adjusts thread A's PC
to point at ADDR1 when it should not, and reports a breakpoint hit,
when thread A did not execute the instruction at ADDR1 at all.
The test added by this patch exercises exactly that.
I can't find any reason we'd need the "thread to be examined is still
the current thread" condition in adjust_pc_after_break, at least
nowadays; it might have made sense in the past. Best just remove it,
and rely on currently_stepping().
Here's the test's log of a run with an unpatched GDB:
35 while (1);
(gdb) PASS: gdb.threads/step-bg-decr-pc-switch-thread.exp: next over nop
next&
(gdb) PASS: gdb.threads/step-bg-decr-pc-switch-thread.exp: next& over inf loop
thread 1
[Switching to thread 1 (Thread 0x7ffff7fc2740 (LWP 29027))](running)
(gdb)
PASS: gdb.threads/step-bg-decr-pc-switch-thread.exp: switch to main thread
Breakpoint 2, thread_function (arg=0x0) at ...src/gdb/testsuite/gdb.threads/step-bg-decr-pc-switch-thread.c:34
34 NOP; /* set breakpoint here */
FAIL: gdb.threads/step-bg-decr-pc-switch-thread.exp: no output while stepping
gdb/ChangeLog:
2015-02-11 Pedro Alves <pedro@codesourcery.com>
* infrun.c (adjust_pc_after_break): Don't adjust the PC just
because the event thread is not the current thread.
gdb/testsuite/ChangeLog:
2015-02-11 Pedro Alves <pedro@codesourcery.com>
* gdb.threads/step-bg-decr-pc-switch-thread.c: New file.
* gdb.threads/step-bg-decr-pc-switch-thread.exp: New file.
Will Newton [Mon, 9 Feb 2015 09:11:54 +0000 (17:11 +0800)]
gold/arm.cc: Output mapping symbol for PLT code
Output an ARM state mapping symbol at the start of the PLT. With the
current code objdump will fail to disassemble the PLT that gold
creates.
gold/ChangeLog:
2015-02-11 Will Newton <will.newton@linaro.org>
PR gold/13321
* arm.cc (Target_arm::make_plt_section): Create an ARM
state mapping symbol at the start of the PLT.
Doug Evans [Wed, 11 Feb 2015 06:07:06 +0000 (22:07 -0800)]
lib/gdb.exp (gdb_load): Always return a result.
gdb/testsuite/ChangeLog:
* lib/gdb.exp (gdb_load): Always return a result.
Doug Evans [Wed, 11 Feb 2015 05:18:59 +0000 (21:18 -0800)]
internal_type_self_type: Handle TYPE_SPECIFIC_NONE.
gdb/ChangeLog:
* gdbtypes.c (internal_type_self_type): If TYPE_SPECIFIC_FIELD hasn't
been initialized yet, return NULL.
H.J. Lu [Wed, 11 Feb 2015 03:02:07 +0000 (19:02 -0800)]
Initialize use_mmap
* plugin.c (plugin_maybe_claim): Initialize use_mmap.
H.J. Lu [Wed, 11 Feb 2015 01:01:17 +0000 (17:01 -0800)]
Unmap the buffer if plugin didn't claim the file
If plugin didn't claim the file, unmap the buffer.
* plugin.c (plugin_input_file_t): Add use_mmap.
(plugin_pagesize): New.
(get_view): Use plugin_pagesize. Set use_mmap if mmap is used.
(plugin_load_plugins): Initialize plugin_pagesize.
(plugin_maybe_claim): Unmap the buffer if plugin didn't claim the
file.
Doug Evans [Wed, 11 Feb 2015 01:01:37 +0000 (17:01 -0800)]
Rename new_symfile_objfile, make static.
gdb/ChangeLog:
* symfile.h (new_symfile_objfile): Delete.
* symfile.c (finish_new_objfile): Renamed from new_symfile_objfile.
All callers updated.
Patrick Palka [Tue, 10 Feb 2015 23:45:10 +0000 (18:45 -0500)]
Fix a pair of screen-resizing issues in TUI
This patch fixes a pair of TUI issues related to screen resizing:
1. In tui_handle_resize_during_io(), when the TUI screen gets resized,
we fail to update GDB's idea about the height of the output window.
You can see this bug by doing:
a. Enter TUI mode.
b. "show height"
c. Resize the terminal.
d. "show height"
And observe that despite resizing the terminal, the reported height
remains unchanged. Note that a similar issue exists in the CLI.
The fix for this is simple: call tui_update_gdb_sizes() after performing
a resize, so that the "height" variable remains consistent with the
height of TUI's output window.
2. In tui_enable(), the call to tui_update_gdb_sizes() may clobber
readline's idea of the actual screen dimensions, and a subsequent
pending resize will use bogus terminal dimensions.
You can see this bug by doing:
a. Enter TUI mode.
b. Exit TUI mode.
c. Resize the terminal.
d. Enter TUI mode.
e. Press a key to resize the screen.
And observe that the terminal gets incorrectly resized to the wrong
dimensions. To fix this issue, we should oppurtunistically resize the
screen in tui_enable(). That way we eliminate the possibility of a
pending resize triggering right after we call tui_update_gdb_sizes().
gdb/ChangeLog:
* tui/tui-io.c (tui_handle_resize_during_io): Call
tui_update_gdb_sizes() after resizing the screen.
* tui/tui.c (tui_enable): Resize the terminal before
calling tui_update_gdb_sizes().
Patrick Palka [Tue, 10 Feb 2015 23:44:56 +0000 (18:44 -0500)]
Fix truncation of TUI command history
If we submit a command while the prompt cursor is somewhere other than
at the end of the command line, the command line gets truncated as the
command window gets shifted one line up. This happens because we fail
to properly move the cursor to the end of the command line before
transmitting the newline to ncurses. We need to move the cursor because
when ncurses outputs a newline it truncates any text that appears
past the end of the cursor.
The fix is generic enough to work properly even in multi-line secondary
prompts like the quit prompt.
gdb/ChangeLog:
* tui/tui-io.c (tui_getc): Move cursor to the end of the command
line before printing a newline.
GDB Administrator [Wed, 11 Feb 2015 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in
Mark Wielaard [Tue, 10 Feb 2015 23:45:31 +0000 (00:45 +0100)]
gdb producer_is_gcc fix bool return value.
gdb/ChangeLog:
* utils.c (producer_is_gcc): Return true or false.
Mark Wielaard [Wed, 4 Feb 2015 17:14:33 +0000 (18:14 +0100)]
Change producer_is_gcc function return type to bool.
gdb/ChangeLog:
* utils.h (producer_is_gcc): Change return type to bool. Add major
argument.
* utils.c (producer_is_gcc): Likewise.
(producer_is_gcc_ge_4): Adjust producer_is_gcc call.
* dwarf2read.c (check_producer): Likewise.
Pedro Alves [Mon, 26 Jan 2015 17:52:28 +0000 (17:52 +0000)]
Add "signal SIGTRAP" test
Some local changes I was working on related to SIGTRAP handling
resulted in "signal SIGTRAP" no longer passing the SIGTRAP to the
inferior.
Surprisingly, only annota1.exp catches this. This commit adds a test
that doesn't rely on annotations, so that at the point annotations are
finaly dropped, we still have this use case covered ...
This is a multi-threaded test to also exercise the case of first
needing to do a step-over before delivering the signal.
Tested on x86_64 Fedora 20, native, remote/extended-remote gdbserver.
gdb/testsuite/
2015-02-10 Pedro Alves <palves@redhat.com>
* gdb.threads/signal-sigtrap.c: New file.
* gdb.threads/signal-sigtrap.exp: New file.
Pedro Alves [Tue, 10 Feb 2015 19:13:31 +0000 (19:13 +0000)]
displaced_step_fixup may access memory from the wrong inferior/thread
displaced_step_fixup takes an thread to work with, as argument. OTOH,
gdbarch_displaced_step_fixup fixes up the current thread. The former
calls the latter without making sure the current thread is the one
that was passed in. If it is not, then gdbarch_displaced_step_fixup
may e.g., try reading from a running thread, which doesn't work on
some targets, or worse, read memory from the wrong inferior and
succeed.
This is mostly a latent problem currently, as non-stop switches the
current thread to the event thread early in fetch_inferior_event.
Tested on x86_64 Fedora 20.
gdb/
2015-02-10 Pedro Alves <palves@redhat.com>
* infrun.c (displaced_step_fixup): Switch to the event thread
before calling gdbarch_displaced_step_fixup.
Antoine Tremblay [Mon, 26 Jan 2015 18:08:53 +0000 (13:08 -0500)]
gdbserver: Fix crash when QTinit is handled with no inferior process attached
When gdbserver is called with --multi and attach has not been called yet
and tstart is called on the gdb client, gdbserver would crash.
This patch fixes gdbserver so that it returns E01 to the gdb client.
Also this patch adds a testcase to verify this bug named no-attach-trace.exp
gdb/gdbserver/ChangeLog:
PR breakpoints/15956
* tracepoint.c (cmd_qtinit): Add check for current_thread.
gdb/testsuite/ChangeLog:
* gdb.trace/no-attach-trace.c: New file.
* gdb.trace/no-attach-trace.exp: New file.
Antoine Tremblay [Tue, 10 Feb 2015 18:29:36 +0000 (13:29 -0500)]
Add myself as write-after-approval GDB maintainer
gdb/ChangeLog:
* MAINTAINERS (Write After Approval): Add Antoine Tremblay.
Pedro Alves [Tue, 10 Feb 2015 18:09:39 +0000 (18:09 +0000)]
opcodes/microblaze: Rename 'or', 'and', 'xor' to avoid C++ conflict
Building GDB as a C++ program, we see:
In file included from gdb/microblaze-tdep.c:37:0:
gdb/../opcodes/../opcodes/microblaze-opcm.h: At global scope:
gdb/../opcodes/../opcodes/microblaze-opcm.h:32:51: error: expected identifier before ‘or’ token
ncget, ncput, muli, bslli, bsrai, bsrli, mului, or, and, xor,
^
gdb/../opcodes/../opcodes/microblaze-opcm.h:32:51: error: expected ‘}’ before ‘or’ token
gdb/../opcodes/../opcodes/microblaze-opcm.h:32:51: error: expected unqualified-id before ‘or’ token
gdb/../opcodes/../opcodes/microblaze-opcm.h:60:1: error: expected declaration before ‘}’ token
};
^
opcodes/ChangeLog:
2015-02-10 Pedro Alves <palves@redhat.com>
Tom Tromey <tromey@redhat.com>
* microblaze-opcm.h (or, and, xor): Rename to microblaze_or,
microblaze_and, microblaze_xor.
* microblaze-opc.h (opcodes): Adjust.
Simon Marchi [Tue, 10 Feb 2015 15:46:12 +0000 (10:46 -0500)]
Finish constification of varobj interface
This completes the constification of the struct varobj pointers in the
lang_varobj_ops interface partially done in
b09e2c591f9221d865bfe8425990a6bf9fab24e3. As suggested by Pedro,
varobj_get_path_expr casts away the const to assign the "mutable" struct
member.
gdb/ChangeLog:
* ada-varobj.c (ada_name_of_child): Constify parent.
(ada_path_expr_of_child): Same.
(ada_value_of_child): Same.
(ada_type_of_child): Same.
* c-varobj.c (c_is_path_expr_parent): Same.
(c_describe_child): Same.
(c_name_of_child): Same.
(c_value_of_child): Same.
(c_type_of_child): Same.
(cplus_number_of_children): Same.
(cplus_describe_child): Constify var.
(cplus_name_of_child): Constify parent.
(cplus_value_of_child): Same.
(cplus_type_of_child): Same.
* jv-varobj.c (java_name_of_child): Same.
(java_value_of_child): Same.
(java_type_of_child): Same.
* varobj.c (value_of_child): Same.
(varobj_default_is_path_expr_parent): Constify var, parent and return
value.
(varobj_get_path_expr): Constify var, modify path_expr through
mutable_var.
(install_new_value): Constify parent.
(value_of_child): Constify parent.
* varobj.h (struct varobj): Constify parent.
(struct lang_varobj_ops): Constify name_of_child, value_of_child and
type_of_child.
(varobj_get_path_expr): Constify var.
(varobj_get_path_expr_parent): Constify var and return value.
Nick Clifton [Tue, 10 Feb 2015 17:53:53 +0000 (17:53 +0000)]
Fix memory access violations discovered by running readelf compiled with undefined memory access sanitization on fuzzed binaries.
PR binutils/17531
* dwarf.c (display_debug_pubnames_worker): Use dwarf_vma type for
offset.
* readelf.c (dump_relocations): Handle printing offsets which are
MIN_INT.
(process_corefile_note_segment): Add range check of the namesz
field.
Nick Clifton [Tue, 10 Feb 2015 17:13:31 +0000 (17:13 +0000)]
Fixes for memory access violations triggered by running readelf on fuzzed binaries.
PR binutils/17531
* dwarf.c (process_debug_info): Zero the debug information array
since correct initialisation cannot be relied upon.
(process_cu_tu_index): Improve range checks.
Nick Clifton [Tue, 10 Feb 2015 14:11:00 +0000 (14:11 +0000)]
Fix memory access violations triggered by running objdump compiled with out-of-bounds sanitization checking.
PR binutils/17512
* dwarf.c (eh_addr_size): Use an unsigned type.
(size_of_encoded_value): Return an unsigned type.
(read_leb128): Break if the shift becomes too big.
(process_extended_line_op): Do not read the address if the length
is too long.
(read_cie): Warn and fail if the pointer size or segment size are
too big.
* dwarf.h (DWARF2_External_LineInfo): Delete unused and incorrect
structure definition.
(DWARF2_External_PubNames): Likewise.
(DWARF2_External_CompUnit): Likewise.
(DWARF2_External_ARange): Likewise.
(DWARF2_Internal_LineInfo): Use dwarf_vma type for
li_prologue_length.
(eh_addr_size): Update prototype.
* coffcode.h (styp_to_sec_flags): Use an unsigned long type to
hold the flag bits.
* peXXigen.c (pe_print_reloc): Use unsigned types to hold the
size and number of relocs.
(pe_print_debugdata): Use a 32-bit aligned buffer to store the
codeview record.
* versados.c (process_otr): Check the esdid value before using it
to access the EDATA.
H.J. Lu [Tue, 10 Feb 2015 13:46:38 +0000 (05:46 -0800)]
Add the missing HAVE_GETPAGESIZE check in get_view
H.J. Lu [Tue, 10 Feb 2015 13:28:26 +0000 (05:28 -0800)]
Align offset passed to mmap
Offset passed to mmap must be a multiple of the page size. This patch
aligns offset passed to mmap.
* plugin.c (get_view): Align offset passed to mmap.
Luis Machado [Tue, 10 Feb 2015 11:46:11 +0000 (09:46 -0200)]
Relax ARM prologue unwinder assumption
Modify the ARM prologue unwinder to use the stop_reason hook instead of
returning imprecise frame id's through the arm prologue this_id hook.
gdb/
2015-02-10 Luis Machado <lgustavo@codesourcery.com>
* arm-tdep.c (arm_prologue_unwind_stop_reason): New function.
(arm_prologue_this_id): Move PC and SP limit checks to
arm_prologue_unwind_stop_reason.
(arm_prologue_unwind) <stop_reason> : Set to
arm_prologue_unwind_stop_reason.
Mark Wielaard [Mon, 9 Feb 2015 22:14:38 +0000 (23:14 +0100)]
Recognize new DWARF5/GCC5 DW_LANG Fortran 2003 and Fortran 2008 standards.
DWARFv5 defines and GCC5 may output two new DW_LANG constants for the
Fortran 2003 and Fortran 2008 standards. Recognize both as variants of
language_fortran.
gdb/ChangeLog:
* dwarf2read.c (set_cu_language): Recognize DW_LANG_Fortran03 and
DW_LANG_Fortran08 as language_fortran.
http://dwarfstd.org/ShowIssue.php?issue=141121.1
Mark Wielaard [Mon, 9 Feb 2015 22:36:54 +0000 (23:36 +0100)]
Recognize new DWARF5/GCC5 DW_LANG constants for Fortran 03 and Fortran 08.
DWARFv5 defines and GCC5 may output two new DW_LANG constants for the
Fortran 2003 and Fortran 2008 standards. Handle and display both in
binutils.
binutils/ChangeLog:
* dwarf.c (read_and_display_attr_value): Handle DW_LANG_Fortran03
and DW_LANG_Fortran08.
include/ChangeLog:
* dwarf2.h: Add DW_LANG_Fortran03 and DW_LANG_Fortran08.
http://dwarfstd.org/ShowIssue.php?issue=141121.1
Sergio Durigan Junior [Mon, 9 Feb 2015 23:58:12 +0000 (18:58 -0500)]
PR remote/17946: Fix wrong comparison of pointer against char
We were comparing a pointer against a char on remote.c. 'dcb' filed a
bug to inform us about that. I pushed the following patch under the
obvious rule.
gdb/ChangeLog:
2015-02-09 Sergio Durigan Junior <sergiodj@redhat.com>
PR remote/17946
* gdb/remote.c (remote_parse_stop_reply): Fix wrong comparison
of pointer against char.
GDB Administrator [Tue, 10 Feb 2015 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in