binutils-gdb.git
9 years agoPR ld/17973 LTO file syms
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.

9 years agoAutomatic date update in version.in
GDB Administrator [Sat, 14 Feb 2015 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agomisc cp-namespace.c cleanups
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.

9 years agosim/common/gentmap.c: Include "string.h".
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".

9 years agoMention support for LLVM plugin in NEWS
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.

9 years agoFixes for memory access violations triggered by running readelf on fuzzed binaries.
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.

9 years agoFix illegal memory access errors triggered by running srconv on fuzzed binaries.
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.

9 years agoFix mistake in recent code to check for an unterminated leb128 number.
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.

9 years agoUpdate Yao Qi's email address in MAINTAINERS
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.

9 years agobinutils/dwarf.c white space
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.

9 years agoCorrect ld.texinfo cross reference
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.

9 years agoPowerPC64 offset check should test entire 64-bit value is in section
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.

9 years agoAutomatic date update in version.in
GDB Administrator [Fri, 13 Feb 2015 00:00:07 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agoAdd missing TLSLE relocations for gold aarch64 backend.
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.

9 years agocompleter.c (completion_list_add_name): Fix memory leak.
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.

9 years agoFix documentation of the QTDV packet
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.

9 years agocompleter.c (complete_line): Remove incorrect comment.
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.

9 years agoFix memory access violations triggered by running addr2line on fuzzed binaries.
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.

9 years agooops - changelog entry accidentally omitted from previous delta.
Nick Clifton [Thu, 12 Feb 2015 16:32:28 +0000 (16:32 +0000)]
oops - changelog entry accidentally omitted from previous delta.

9 years agoReplace elf_i386 with elf_i386_nacl for nacl
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.

9 years agoAutomatic date update in version.in
GDB Administrator [Thu, 12 Feb 2015 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agoAdd --[no-]map-whole-files for gold compatibility
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.

9 years agoOutput "warning:" or "error:" in plugin messages
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.

9 years agoRemove unused dump_tv_tag
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.

9 years agoFixes a problem with the RL78 disassembler which would incorrectly disassemble [HL...
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.

9 years ago[AArch64] Fix code formatting in the cpu-table
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.

9 years agoframefilter quit: New test
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.

9 years agoframefilter quit: Use RETURN_MASK_ERROR
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.

9 years agosim/mcore/interp.c: Include "unistd.h".
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".

9 years agoframefilter quit: Make it exception safe
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.

9 years agoframefilter quit: Code cleanup: Avoid gotos
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.

9 years agoframefilter quit: Code cleanup: Reindentation
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.

9 years agoframefilter quit: Obvious whitespacing fixes
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.

9 years agoAdd ChangeLogs for 439b7f41b
H.J. Lu [Wed, 11 Feb 2015 13:16:40 +0000 (05:16 -0800)]
Add ChangeLogs for 439b7f41b

9 years agoAdd ChangeLogs for commit 5ae0078cd
H.J. Lu [Wed, 11 Feb 2015 13:14:11 +0000 (05:14 -0800)]
Add ChangeLogs for commit 5ae0078cd

9 years agoFixes for invalid memory accesses triggered by running readelf on fuzzed binaries.
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.

9 years agoAdd tests for non-object IR file
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.

9 years agoMerge linker plugin handling into BFD plugin support
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

9 years agoxcoffread.c: delete 'within_function' definition
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.

9 years agoFix redefinition errors in C++ mode
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.

9 years ago[ARM] Add support for Cortex-A72
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.

9 years agoWrap BFD headers in extern "C"
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".

9 years agoFix adjust_pc_after_break, remove still current thread check
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.

9 years agogold/arm.cc: Output mapping symbol for PLT code
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.

9 years agolib/gdb.exp (gdb_load): Always return a result.
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.

9 years agointernal_type_self_type: Handle TYPE_SPECIFIC_NONE.
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.

9 years agoInitialize use_mmap
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.

9 years agoUnmap the buffer if plugin didn't claim the file
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.

9 years agoRename new_symfile_objfile, make static.
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.

9 years agoFix a pair of screen-resizing issues in TUI
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().

9 years agoFix truncation of TUI command history
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.

9 years agoAutomatic date update in version.in
GDB Administrator [Wed, 11 Feb 2015 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agogdb producer_is_gcc fix bool return value.
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.

9 years agoChange producer_is_gcc function return type to bool.
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.

9 years agoAdd "signal SIGTRAP" test
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.

9 years agodisplaced_step_fixup may access memory from the wrong inferior/thread
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.

9 years agogdbserver: Fix crash when QTinit is handled with no inferior process attached
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.

9 years agoAdd myself as write-after-approval GDB maintainer
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.

9 years agoopcodes/microblaze: Rename 'or', 'and', 'xor' to avoid C++ conflict
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.

9 years agoFinish constification of varobj interface
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.

9 years agoFix memory access violations discovered by running readelf compiled with undefined...
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.

9 years agoFixes for memory access violations triggered by running readelf on fuzzed binaries.
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.

9 years agoFix memory access violations triggered by running objdump compiled with out-of-bounds...
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.

9 years agoAdd the missing HAVE_GETPAGESIZE check in get_view
H.J. Lu [Tue, 10 Feb 2015 13:46:38 +0000 (05:46 -0800)]
Add the missing HAVE_GETPAGESIZE check in get_view

9 years agoAlign offset passed to mmap
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.

9 years agoRelax ARM prologue unwinder assumption
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.

9 years agoRecognize new DWARF5/GCC5 DW_LANG Fortran 2003 and Fortran 2008 standards.
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

9 years agoRecognize new DWARF5/GCC5 DW_LANG constants for Fortran 03 and Fortran 08.
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

9 years agoPR remote/17946: Fix wrong comparison of pointer against char
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.

9 years agoAutomatic date update in version.in
GDB Administrator [Tue, 10 Feb 2015 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agoAvoid incrementing uninitialized variable
Ed Maste [Mon, 9 Feb 2015 21:55:34 +0000 (13:55 -0800)]
Avoid incrementing uninitialized variable

* elf32-i386.c (elf_i386_get_plt_sym_val): Avoid incrementing
uninitialized and unused variable.
* elf64-x86-64.c (elf_x86_64_get_plt_sym_val): Likewise.

9 years agoGCC5/DWARFv5 Handle DW_TAG_atomic_type for C11 _Atomic type qualifier.
Mark Wielaard [Mon, 9 Feb 2015 13:58:25 +0000 (14:58 +0100)]
GCC5/DWARFv5 Handle DW_TAG_atomic_type for C11 _Atomic type qualifier.

gdb/ChangeLog

* c-typeprint.c (cp_type_print_method_args): Handle '_Atomic'.
(c_type_print_modifier): Likewise.
* dwarf2read.c (read_tag_atomic_type): New function.
(read_type_die_1): Handle DW_TAG_atomic_type.
* gdbtypes.c (make_atomic_type): New function.
(recursive_dump_type): Handle TYPE_ATOMIC.
* gdbtypes.h (enum type_flag_values): Renumber.
(enum type_instance_flag_value): Add TYPE_INSTANCE_FLAG_ATOMIC.
(TYPE_ATOMIC): New macro.
(make_atomic_type): Declare.

gdb/testsuite/ChangeLog

* gdb.dwarf2/atomic.c: New file.
* gdb.dwarf2/atomic-type.exp: Likewise.

include/ChangeLog

* dwarf2.def: Add DW_TAG_atomic_type.

9 years agoReplace two_file_shared_2.so with two_file_shared_1.so
H.J. Lu [Mon, 9 Feb 2015 13:33:19 +0000 (05:33 -0800)]
Replace two_file_shared_2.so with two_file_shared_1.so

There are

two_file_shared_2_pic_1_test_LDADD = two_file_test_2_pic.o two_file_shared_1.so

There should be two_file_shared_1.so, not two_file_shared_2.so in
two_file_shared_2_pic_1_test_DEPENDENCIES.

* testsuite/Makefile.am (two_file_shared_2_pic_1_test_DEPENDENCIES):
Replace two_file_shared_2.so with two_file_shared_1.so.
* testsuite/Makefile.in: Regenerated.

9 years ago[ARM][gas] Use as_tsktsk instead of as_warn for deprecation messages.
Kyrylo Tkachov [Mon, 9 Feb 2015 11:20:30 +0000 (11:20 +0000)]
[ARM][gas] Use as_tsktsk instead of as_warn for deprecation messages.

* config/tc-arm.c (warn_deprecated_sp): Use as_tsktsk instead
of as_warn for deprecation messages.
(encode_arm_addr_mode_2): Likewise.
(check_obsolete): Likewise.
(do_rd_rm_rn): Likewise.
(do_co_reg): Likewise.
(do_setend): Likewise.
(do_t_mov_cmp): Likewise.
(do_neon_ldr_str): Likewise.
(opcode_lookup): Likewise.
(if_fsm_post_encode): Likewise.
(md_assemble): Likewise.

* gas/arm/armv1.l: Remove 'Warning: ' from expected messages
for deprecations.
* gas/arm/armv8-a-bad.l: Likewise.
* gas/arm/armv8-a-it-bad.l: Likewise.
* gas/arm/depr-swp.l: Likewise.
* gas/arm/ldsgeb.l: Likewise.
* gas/arm/ldsgeh.l: Likewise.
* gas/arm/thumb2_bad_reg.l: Likewise.
* gas/arm/thumb32.l: Likewise.
* gas/arm/udf.l: Likewise.
* gas/arm/vstr-arm-bad.l: Likewise.

9 years agorecord-btrace: indicate gaps
Markus Metzger [Thu, 30 Jan 2014 08:51:10 +0000 (09:51 +0100)]
record-btrace: indicate gaps

Indicate gaps in the trace due to decode errors.  Internally, a gap is
represented as a btrace function segment without instructions and with a
non-zero format-specific error code.

Show the gap when traversing the instruction or function call history.
Also indicate gaps in "info record".

It looks like this:

  (gdb) info record
  Active record target: record-btrace
  Recording format: Branch Trace Store.
  Buffer size: 64KB.
  Recorded 32 instructions in 5 functions (1 gaps) for thread 1 (process 7182).
  (gdb) record function-call-history /cli
  1 fib inst 1,9 at src/fib.c:9,14
  2   fib inst 10,20 at src/fib.c:6,14
  3 [decode error (1): instruction overflow]
  4 fib inst 21,28 at src/fib.c:11,14
  5   fib inst 29,33 at src/fib.c:6,9
  (gdb) record instruction-history 20,22
  20    0x000000000040062f <fib+47>: sub    $0x1,%rax
  [decode error (1): instruction overflow]
  21    0x0000000000400613 <fib+19>: add    $0x1,%rax
  22    0x0000000000400617 <fib+23>: mov    %rax,0x200a3a(%rip)
  (gdb)

Gaps are ignored during reverse execution and replay.

2015-02-09  Markus Metzger  <markus.t.metzger@intel.com>

* btrace.c (ftrace_find_call): Skip gaps.
(ftrace_new_function): Initialize level.
(ftrace_new_call, ftrace_new_tailcall, ftrace_new_return)
(ftrace_new_switch): Update
level computation.
(ftrace_new_gap): New.
(ftrace_update_function): Create new function after gap.
(btrace_compute_ftrace_bts): Create gap on error.
(btrace_stitch_bts): Update parameters.  Clear trace if it
becomes empty.
(btrace_stitch_trace): Update parameters.  Update callers.
(btrace_clear): Reset the number of gaps.
(btrace_insn_get): Return NULL if the iterator points to a gap.
(btrace_insn_number): Return zero if the iterator points to a gap.
(btrace_insn_end): Allow gaps at the end.
(btrace_insn_next, btrace_insn_prev, btrace_insn_cmp): Handle gaps.
(btrace_find_insn_by_number): Assert that the found iterator does
not point to a gap.
(btrace_call_next, btrace_call_prev): Assert that the last function
is not a gap.
* btrace.h (btrace_bts_error): New.
(btrace_function): Update comment.
(btrace_function) <insn, insn_offset, number>: Update comment.
(btrace_function) <errcode>: New.
(btrace_thread_info) <ngaps>: New.
(btrace_thread_info) <replay>: Update comment.
(btrace_insn_get): Update comment.
* record-btrace.c (btrace_ui_out_decode_error): New.
(record_btrace_info): Print number of gaps.
(btrace_insn_history, btrace_call_history): Call
btrace_ui_out_decode_error for gaps.
(record_btrace_step_thread, record_btrace_start_replaying): Skip gaps.

testsuite/
* gdb.btrace/buffer-size.exp: Update "info record" output.
* gdb.btrace/delta.exp: Update "info record" output.
* gdb.btrace/enable.exp: Update "info record" output.
* gdb.btrace/finish.exp: Update "info record" output.
* gdb.btrace/instruction_history.exp: Update "info record" output.
* gdb.btrace/next.exp: Update "info record" output.
* gdb.btrace/nexti.exp: Update "info record" output.
* gdb.btrace/step.exp: Update "info record" output.
* gdb.btrace/stepi.exp: Update "info record" output.
* gdb.btrace/nohist.exp: Update "info record" output.

9 years agobtrace: identify cpu
Markus Metzger [Fri, 14 Feb 2014 08:25:40 +0000 (09:25 +0100)]
btrace: identify cpu

Add a struct for identifying a processor and use it in linux-btrace.c when
identifying the processor we're running on.

We will need this feature for the new btrace format.

2015-02-09  Markus Metzger  <markus.t.metzger@intel.com>

* common/btrace-common.h (btrace_cpu_vendor, btrace_cpu): New.
* nat/linux-btrace.c: (btrace_this_cpu): New.
(cpu_supports_bts): Call btrace_this_cpu.
(intel_supports_bts): Add cpu parameter.

9 years agobtrace: extend struct btrace_insn
Markus Metzger [Wed, 29 Jan 2014 11:56:09 +0000 (12:56 +0100)]
btrace: extend struct btrace_insn

Add the instruction's size as well as a coarse classification to struct
btrace_insn.  Use the information in ftrace_update_function and
ftrace_find_call.

2015-02-09  Markus Metzger  <markus.t.metzger@intel.com>

* btrace.h (btrace_insn_class): New.
(btrace_insn) <size, iclass>: New.
* btrace.c (ftrace_find_call): Update parameters.  Update users.
Use instruction classification.
(ftrace_new_return): Update parameters.  Update users.
(ftrace_update_function): Update parameters.  Update users.  Use
instruction classification.
(ftrace_update_insns): Update parameters.  Update users.
(ftrace_classify_insn): New.
(btrace_compute_ftrace_bts): Fill in new btrace_insn fields.  Add
TRY_CATCH around call to gdb_insn_length.

9 years agobtrace: update btrace_compute_ftrace parameters
Markus Metzger [Wed, 29 Jan 2014 10:12:06 +0000 (11:12 +0100)]
btrace: update btrace_compute_ftrace parameters

Pass thread_info instead of btrace_thread_info to btrace_compute_ftrace.
We will need the thread_info in subsequent patches.

2015-02-09  Markus Metzger  <markus.t.metzger@intel.com>

* btrace.c (btrace_compute_ftrace_bts, btrace_compute_ftrace):
Update parameters.  Update users.

9 years agorecord-btrace: add bts buffer size configuration option
Markus Metzger [Thu, 28 Nov 2013 15:39:12 +0000 (16:39 +0100)]
record-btrace: add bts buffer size configuration option

Allow the size of the branch trace ring buffer to be defined by the
user.  The specified buffer size will be used when BTS tracing is
enabled for new threads.

The obtained buffer size may differ from the requested size.  The
actual buffer size for the current thread is shown in the "info record"
command.

Bigger buffers mean longer traces, but also longer processing time.

2015-02-09  Markus Metzger  <markus.t.metzger@intel.com>

* btrace.c (parse_xml_btrace_conf_bts): Add size.
(btrace_conf_bts_attributes): New.
(btrace_conf_children): Add attributes.
* common/btrace-common.h (btrace_config_bts): New.
(btrace_config)<bts>: New.
(btrace_config): Update comment.
* nat/linux-btrace.c (linux_enable_btrace, linux_enable_bts):
Use config.
* features/btrace-conf.dtd: Increment version.  Add size
attribute to bts element.
* record-btrace.c (set_record_btrace_bts_cmdlist,
show_record_btrace_bts_cmdlist): New.
(record_btrace_adjust_size, record_btrace_print_bts_conf,
record_btrace_print_conf, cmd_set_record_btrace_bts,
cmd_show_record_btrace_bts): New.
(record_btrace_info): Call record_btrace_print_conf.
(_initialize_record_btrace): Add commands.
* remote.c: Add PACKET_Qbtrace_conf_bts_size enum.
(remote_protocol_features): Add Qbtrace-conf:bts:size packet.
(btrace_sync_conf): Synchronize bts size.
(_initialize_remote): Add Qbtrace-conf:bts:size packet.
* NEWS: Announce new commands and new packets.

doc/
* gdb.texinfo (Branch Trace Configuration Format): Add size.
(Process Record and Replay): Describe new set|show commands.
(General Query Packets): Describe Qbtrace-conf:bts:size packet.

testsuite/
* gdb.btrace/buffer-size: New.

gdbserver/
* linux-low.c (linux_low_btrace_conf): Print size.
* server.c (handle_btrace_conf_general_set): New.
(hanle_general_set): Call handle_btrace_conf_general_set.
(handle_query): Report Qbtrace-conf:bts:size as supported.

9 years agorecord btrace: add configuration struct
Markus Metzger [Thu, 28 Nov 2013 14:44:13 +0000 (15:44 +0100)]
record btrace: add configuration struct

Add a struct to describe the branch trace configuration and use it for
enabling branch tracing.

The user will be able to set configuration fields for each tracing format
to be used for new threads.

The actual configuration that is active for a given thread will be shown
in the "info record" command.

At the moment, the configuration struct only contains a format field
that is set to the only available format.

The format is the only configuration option that can not be set via set
commands.  It is given as argument to the "record btrace" command when
starting recording.

2015-02-09  Markus Metzger  <markus.t.metzger@intel.com>

* Makefile.in (XMLFILES): Add btrace-conf.dtd.
* x86-linux-nat.c (x86_linux_enable_btrace): Update parameters.
(x86_linux_btrace_conf): New.
(x86_linux_create_target): Initialize to_btrace_conf.
* nat/linux-btrace.c (linux_enable_btrace): Update parameters.
Check format.  Split into this and ...
(linux_enable_bts): ... this.
(linux_btrace_conf): New.
(perf_event_skip_record): Renamed into ...
(perf_event_skip_bts_record): ... this.  Updated users.
(linux_disable_btrace): Split into this and ...
(linux_disable_bts): ... this.
(linux_read_btrace): Check format.
* nat/linux-btrace.h (linux_enable_btrace): Update parameters.
(linux_btrace_conf): New.
(btrace_target_info)<ptid>: Moved.
(btrace_target_info)<conf>: New.
(btrace_target_info): Split into this and ...
(btrace_tinfo_bts): ... this.  Updated users.
* btrace.c (btrace_enable): Update parameters.
(btrace_conf, parse_xml_btrace_conf_bts, parse_xml_btrace_conf)
(btrace_conf_children, btrace_conf_attributes)
(btrace_conf_elements): New.
* btrace.h (btrace_enable): Update parameters.
(btrace_conf, parse_xml_btrace_conf): New.
* common/btrace-common.h (btrace_config): New.
* feature/btrace-conf.dtd: New.
* record-btrace.c (record_btrace_conf): New.
(record_btrace_cmdlist): New.
(record_btrace_enable_warn, record_btrace_open): Pass
&record_btrace_conf.
(record_btrace_info): Print recording format.
(cmd_record_btrace_bts_start): New.
(cmd_record_btrace_start): Call cmd_record_btrace_bts_start.
(_initialize_record_btrace): Add "record btrace bts" subcommand.
Add "record bts" alias command.
* remote.c (remote_state)<btrace_config>: New.
(remote_btrace_reset, PACKET_qXfer_btrace_conf): New.
(remote_protocol_features): Add qXfer:btrace-conf:read.
(remote_open_1): Call remote_btrace_reset.
(remote_xfer_partial): Handle TARGET_OBJECT_BTRACE_CONF.
(btrace_target_info)<conf>: New.
(btrace_sync_conf, btrace_read_config): New.
(remote_enable_btrace): Update parameters.  Call btrace_sync_conf and
btrace_read_conf.
(remote_btrace_conf): New.
(init_remote_ops): Initialize to_btrace_conf.
(_initialize_remote): Add qXfer:btrace-conf packet.
* target.c (target_enable_btrace): Update parameters.
(target_btrace_conf): New.
* target.h (target_enable_btrace): Update parameters.
(target_btrace_conf): New.
(target_object)<TARGET_OBJECT_BTRACE_CONF>: New.
(target_ops)<to_enable_btrace>: Update parameters and comment.
(target_ops)<to_btrace_conf>: New.
* target-delegates: Regenerate.
* target-debug.h (target_debug_print_const_struct_btrace_config_p)
(target_debug_print_const_struct_btrace_target_info_p): New.
NEWS: Announce new command and new packet.

doc/
* gdb.texinfo (Process Record and Replay): Describe the "record
btrace bts" command.
(General Query Packets): Describe qXfer:btrace-conf:read packet.
(Branch Trace Configuration Format): New.

gdbserver/
* linux-low.c (linux_low_enable_btrace): Update parameters.
(linux_low_btrace_conf): New.
(linux_target_ops)<to_btrace_conf>: Initialize.
* server.c (current_btrace_conf): New.
(handle_btrace_enable): Rename to ...
(handle_btrace_enable_bts): ... this.  Pass &current_btrace_conf
to target_enable_btrace.  Update comment.  Update users.
(handle_qxfer_btrace_conf): New.
    (qxfer_packets): Add btrace-conf entry.
(handle_query): Report qXfer:btrace-conf:read as supported packet.
* target.h (target_ops)<enable_btrace>: Update parameters and comment.
(target_ops)<read_btrace_conf>: New.
(target_enable_btrace): Update parameters.
(target_read_btrace_conf): New.

testsuite/
* gdb.btrace/delta.exp: Update "info record" output.
* gdb.btrace/enable.exp: Update "info record" output.
* gdb.btrace/finish.exp: Update "info record" output.
* gdb.btrace/instruction_history.exp: Update "info record" output.
* gdb.btrace/next.exp: Update "info record" output.
* gdb.btrace/nexti.exp: Update "info record" output.
* gdb.btrace/step.exp: Update "info record" output.
* gdb.btrace/stepi.exp: Update "info record" output.
* gdb.btrace/nohist.exp: Update "info record" output.

9 years agobtrace, linux: add perf event buffer abstraction
Markus Metzger [Fri, 17 Jan 2014 13:40:02 +0000 (14:40 +0100)]
btrace, linux: add perf event buffer abstraction

Collect perf event buffer related fields from btrace_target_info into
a new struct perf_event_buffer.  Update functions that operated on the
buffer to take a struct perf_event_buffer pointer rather than a
btrace_target_info pointer.

2015-02-09  Markus Metzger  <markus.t.metzger@intel.com>

* nat/linux-btrace.h (perf_event_buffer): New.
(btrace_target_info) <buffer, size, data_head>: Replace with ...
<bts>: ... this.
* nat/linux-btrace.c (perf_event_header, perf_event_mmap_size)
(perf_event_buffer_size, perf_event_buffer_begin)
(perf_event_buffer_end, linux_btrace_has_changed): Removed.
Updated users.
(perf_event_new_data): New.

9 years agobtrace: add format argument to supports_btrace
Markus Metzger [Fri, 17 Jan 2014 12:29:19 +0000 (13:29 +0100)]
btrace: add format argument to supports_btrace

Add a format argument to the various supports_btrace functions to check
for support of a specific btrace format.  This is to prepare for a new
format.

Removed two redundant calls.  The check will be made in the subsequent
btrace_enable call.

2015-02-09  Markus Metzger  <markus.t.metzger@intel.com>

* btrace.c (btrace_enable): Pass BTRACE_FORMAT_BTS.
* record-btrace.c (record_btrace_open): Remove call to
target_supports_btrace.
* remote.c (remote_supports_btrace): Update parameters.
* target.c (target_supports_btrace): Update parameters.
* target.h (to_supports_btrace, target_supports_btrace): Update
parameters.
* target-delegates.c: Regenerate.
* target-debug.h (target_debug_print_enum_btrace_format): New.
* nat/linux-btrace.c
(kernel_supports_btrace): Rename into ...
(kernel_supports_bts): ... this.  Update users.  Update warning text.
(intel_supports_btrace): Rename into ...
(intel_supports_bts): ... this.  Update users.
(cpu_supports_btrace): Rename into ...
(cpu_supports_bts): ... this.  Update users.
(linux_supports_btrace): Update parameters.  Split into this and ...
(linux_supports_bts): ... this.
* nat/linux-btrace.h (linux_supports_btrace): Update parameters.

gdbserver/
* server.c (handle_btrace_general_set): Remove call to
target_supports_btrace.
(supported_btrace_packets): New.
(handle_query): Call supported_btrace_packets.
* target.h: include btrace-common.h.
(btrace_target_info): Removed.
(supports_btrace, target_supports_btrace): Update parameters.

9 years agobtrace: add struct btrace_data
Markus Metzger [Wed, 13 Nov 2013 14:31:07 +0000 (15:31 +0100)]
btrace: add struct btrace_data

Add a structure to hold the branch trace data and an enum to describe
the format of that data.  So far, only BTS is supported.  Also added
a NONE format to indicate that no branch trace data is available.

This will make it easier to support different branch trace formats in
the future.

2015-02-09  Markus Metzger  <markus.t.metzger@intel.com>

* Makefile.in (SFILES): Add common/btrace-common.c.
(COMMON_OBS): Add common/btrace-common.o.
(btrace-common.o): Add build rules.
* btrace.c (parse_xml_btrace): Update parameters.
(parse_xml_btrace_block): Set format field.
(btrace_add_pc, btrace_fetch): Use struct btrace_data.
(do_btrace_data_cleanup, make_cleanup_btrace_data): New.
(btrace_compute_ftrace): Split into this and...
(btrace_compute_ftrace_bts): ...this.
(btrace_stitch_trace): Split into this and...
(btrace_stitch_bts): ...this.
* btrace.h (parse_xml_btrace): Update parameters.
(make_cleanup_btrace_data): New.
* common/btrace-common.c: New.
* common/btrace-common.h: Include common-defs.h.
(btrace_block_s): Update comment.
(btrace_format): New.
(btrace_format_string): New.
(btrace_data_bts): New.
(btrace_data): New.
(btrace_data_init, btrace_data_fini, btrace_data_empty): New.
* remote.c (remote_read_btrace): Update parameters.
* target.c (target_read_btrace): Update parameters.
* target.h (target_read_btrace): Update parameters.
(target_ops)<to_read_btrace>: Update parameters.
* x86-linux-nat.c (x86_linux_read_btrace): Update parameters.
* target-delegates.c: Regenerate.
* target-debug (target_debug_print_struct_btrace_data_p): New.
* nat/linux-btrace.c (linux_read_btrace): Split into this and...
(linux_read_bts): ...this.
* nat/linux-btrace.h (linux_read_btrace): Update parameters.

gdbserver/
* Makefile.in (SFILES): Add common/btrace-common.c.
(OBS): Add common/btrace-common.o.
(btrace-common.o): Add build rules.
* linux-low: Include btrace-common.h.
(linux_low_read_btrace): Use struct btrace_data.  Call
btrace_data_init and btrace_data_fini.

9 years agoDon't segfault or assert on NULL tls_sec
Alan Modra [Thu, 29 Jan 2015 09:08:28 +0000 (19:38 +1030)]
Don't segfault or assert on NULL tls_sec

Real code won't hit these, but it's possible to contrive a testcase..

* elf32-ppc.c (ppc_elf_relocate_section): Don't segfault on NULL
tls_sec.
* elf64-ppc.c (ppc64_elf_relocate_section): Likewise.
* elflink.c (elf_link_output_extsym): Don't assert on NULL tls_sec.

9 years agoelflink.c whitespace, formatting and a plugin symbol tweak
Alan Modra [Thu, 5 Feb 2015 07:00:57 +0000 (17:30 +1030)]
elflink.c whitespace, formatting and a plugin symbol tweak

* elflink.c: Whitespace, formatting fixes.
(elf_link_input_bfd): Clarify comment.
(elf_link_output_extsym): Exclude symbols in linker created
sections when testing for plugin symbols.

9 years agoGold testsuite make clean
Alan Modra [Fri, 6 Feb 2015 07:50:49 +0000 (18:20 +1030)]
Gold testsuite make clean

* testsuite/Makefile.am (MOSTLYCLEANFILES): Add libweak_undef_2.a,
plugin_test_thin.a and defsym_test.
* testsuite/Makefile.in: Regenerate.

9 years agoAutomatic date update in version.in
GDB Administrator [Mon, 9 Feb 2015 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agoDon't bfd_check_format if not needed
H.J. Lu [Sun, 8 Feb 2015 23:00:34 +0000 (15:00 -0800)]
Don't bfd_check_format if not needed

When plugin isn't active or there is no thing more to claim, we don't
need to call bfd_check_format.

* ldfile.c (ldfile_try_open_bfd): Don't call bfd_check_format
if plugin isn't active or there is no thing more to claim.

9 years agoCheck format against bfd_object directly
H.J. Lu [Sun, 8 Feb 2015 16:45:23 +0000 (08:45 -0800)]
Check format against bfd_object directly

There is no need to call bfd_check_format.  We should just check format
against bfd_object directly.

* plugin.c (plugin_maybe_claim): Check format against bfd_object
directly.

9 years agoAutomatic date update in version.in
GDB Administrator [Sun, 8 Feb 2015 00:00:12 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agoReplace entry->the_bfd with ibfd
H.J. Lu [Sat, 7 Feb 2015 20:50:17 +0000 (12:50 -0800)]
Replace entry->the_bfd with ibfd

* plugin.c (plugin_maybe_claim): Replace entry->the_bfd with
ibfd.

9 years agoUpdate plugin_maybe_claim
H.J. Lu [Sat, 7 Feb 2015 19:01:22 +0000 (11:01 -0800)]
Update plugin_maybe_claim

This patch removes the argument of pointer to struct ld_plugin_input_file.
This is the first step to extract a plugin_object_p out of
plugin_maybe_claim for BFD.

* plugin.c: Include "libbfd.h".
(plugin_strdup): New.
(plugin_maybe_claim): Remove the argument of pointer to struct
ld_plugin_input_file.  Open and handle input entry.
* plugin.h (plugin_maybe_claim): Updated.
* ldfile.c (ldfile_try_open_bfd): Call plugin_maybe_claim directly
without passing a pointer to struct ld_plugin_input_file.
* ldmain.c: Don't include "libbfd.h".
(add_archive_element): Call plugin_maybe_claim directly without
passing a pointer to struct ld_plugin_input_file.

9 years agoIssue relocation in RO section warning for -z text
H.J. Lu [Sat, 7 Feb 2015 13:28:06 +0000 (05:28 -0800)]
Issue relocation in RO section warning for -z text

This patch changes linker to issue a warning for relocation in readonly
section for -z text.

bfd/

PR ld/17935
* elf32-i386.c (elf_i386_readonly_dynrelocs): Also issue a
warning for relocation in readonly section for -z text.
(elf_i386_size_dynamic_sections): Likewise.
* elf64-x86-64.c (elf_x86_64_readonly_dynrelocs): Likewise.
(elf_x86_64_size_dynamic_sections): Likewise.

ld/testsuite/

PR ld/17935
* ld-i386/i386.exp: Run pr17935-1 and pr17935-2.
* ld-x86-64/x86-64.exp: Likewise.

* ld-i386/pr17935-1.d: New file.
* ld-i386/pr17935-1.s: Likewise.
* ld-i386/pr17935-2.d: Likewise.
* ld-i386/pr17935-2.s: Likewise.
* ld-x86-64/pr17935-1.d: Likewise.
* ld-x86-64/pr17935-1.s: Likewise.
* ld-x86-64/pr17935-2.d: Likewise.
* ld-x86-64/pr17935-2.s: Likewise.

9 years agoAutomatic date update in version.in
GDB Administrator [Sat, 7 Feb 2015 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agoremote-m32r-sdi.c: Include symfile.h.
Doug Evans [Fri, 6 Feb 2015 20:17:21 +0000 (12:17 -0800)]
remote-m32r-sdi.c: Include symfile.h.

gdb/ChangeLog:

* remote-m32r-sdi.c: Include symfile.h.

9 years agoMove clear_symtab_users, deduce_language_from_filename decls to better place.
Doug Evans [Fri, 6 Feb 2015 19:32:01 +0000 (11:32 -0800)]
Move clear_symtab_users, deduce_language_from_filename decls to better place.

gdb/ChangeLog:

* symtab.h (clear_symtab_users, deduce_language_from_filename): Move
* symfile.h (clear_symtab_users, deduce_language_from_filename): ...
to here.

9 years agoDocument -z text, -z notext and -z textoff
H.J. Lu [Fri, 6 Feb 2015 18:01:35 +0000 (10:01 -0800)]
Document -z text, -z notext and -z textoff

* ld.texinfo: Document -z text, -z notext and -z textoff.
* emultempl/elf32.em (gld${EMULATION_NAME}_list_options): Add
-z text, -z notext and -z textoff.

9 years agoUse mmap and cache the view buffer for get_view
H.J. Lu [Fri, 6 Feb 2015 17:05:35 +0000 (09:05 -0800)]
Use mmap and cache the view buffer for get_view

This patch uses mmap if it is available and works.  It also caches the
view buffer for get_view.

* configure.ac: Add AC_FUNC_MMAP.
* config.in: Regenerated.
* configure: Likewise.
* plugin.c: Include <sys/mman.h>.
(MAP_FAILED): New.  Defined if not defined.
(PROT_READ): Likewise.
(MAP_PRIVATE): Likewise.
(view_buffer_t): New.
(plugin_input_file_t): Add view_buffer.
(get_view): Try mmap and cache the view buffer.
(plugin_maybe_claim): Initialize view_buffer.

9 years agolibthread_db: attaching to terminated/joined threads, debug output
Pedro Alves [Mon, 26 Jan 2015 17:52:25 +0000 (17:52 +0000)]
libthread_db: attaching to terminated/joined threads, debug output

Add a bit of debug output that made things a bit easier for me before.

gdb/
2015-02-06  Pedro Alves  <palves@redhat.com>

* linux-thread-db.c (find_new_threads_callback): Add debug output.

gdb/gdbserver/
2015-02-06  Pedro Alves  <palves@redhat.com>

* thread-db.c (find_new_threads_callback): Add debug output.

9 years ago"enable count" user input error handling (PR gdb/15678)
Simon Marchi [Mon, 2 Feb 2015 19:57:31 +0000 (14:57 -0500)]
"enable count" user input error handling (PR gdb/15678)

Typing "enable count" by itself crashes GDB. Also, if you omit the
breakpoint number/range, the error message is not very clear:

(gdb) enable count 2
warning: bad breakpoint number at or near ''
(gdb) enable count
Segmentation fault (core dumped)

With this patch, the error messages are slightly more helpful:

(gdb) enable count 2
Argument required (one or more breakpoint numbers).
(gdb) enable count
Argument required (hit count).

gdb/ChangeLog:

PR gdb/15678
* breakpoint.c (map_breakpoint_numbers): Check for empty args
string.
(enable_count_command): Check args for NULL value.

gdb/testsuite/ChangeLog:

PR gdb/15678
* gdb.base/ena-dis-br.exp: Test "enable count" for bad user input.