Commit Graph

82226 Commits

Author SHA1 Message Date
Cary Coutant e30880c2ee gold/
* powerpc.cc (Target_powerpc::relocate): Fix overflow check.
2014-12-22 10:13:37 -08:00
Doug Evans f953163fe9 cp-namespace.c (cp_lookup_symbol_via_all_imports): New function.
gdb/ChangeLog:

	* cp-namespace.c (cp_lookup_symbol_via_all_imports): New function.
	(cp_lookup_symbol_namespace): Call it.
	(cp_lookup_symbol_nonlocal): Ditto.
2014-12-22 09:29:25 -08:00
Doug Evans 4bd0864e21 cp-namespace.c (cp_lookup_symbol_via_imports): New arg "search_scope_first".
gdb/ChangeLog:

	* cp-namespace.c (cp_lookup_symbol_via_imports): New arg
	"search_scope_first".  All callers updated.
2014-12-22 09:20:50 -08:00
Doug Evans 6f27419a4d cp-namespace.c (cp_lookup_nested_symbol_1): New function.
gdb/ChangeLog:

	* cp-namespace.c (cp_lookup_nested_symbol_1): New function.
	(cp_basic_lookup_symbol): Renamed from lookup_symbol_file.  Delete
	arg "search".  All callers updated.
	(cp_lookup_bare_symbol): New function.
	(cp_search_static_and_baseclasses): New function.
	(cp_lookup_symbol_in_namespace): Rewrite, move more logic here.
	(find_symbol_in_baseclass): Simplify, call cp_lookup_nested_symbol_1.
	(cp_lookup_nested_symbol): Ditto.
2014-12-22 09:11:44 -08:00
Doug Evans d276311738 cp-namespace.c (cp_lookup_symbol_in_namespace): Simplify.
gdb/ChangeLog:

	* cp-namespace.c (cp_lookup_symbol_in_namespace): Simplify.
2014-12-22 08:44:50 -08:00
Doug Evans 791244bea2 cp-namespace.c: Whitespace cleanup.
gdb/ChangeLog:

	* cp-namespace.c: Whitespace cleanup.
2014-12-22 08:42:02 -08:00
GDB Administrator 6232c07d28 Automatic date update in version.in 2014-12-22 00:00:10 +00:00
GDB Administrator 3946f7973c Automatic date update in version.in 2014-12-21 00:00:16 +00:00
Mihail-Marian Nistor 87186c6a5c gdb/17394: cannot put breakpoint only in selected ASM file.
This patch fixes a problem when trying to insert a breakpoint on
a specific symbol defined in a specific file, eg:

    break foo.c:func

This currently works for files in C/C++/Ada, etc, but doesn't always
work for Asm files. Analysis of the problem showed that this related
to a limitation in gas, which does not generate debug info for functions/
symbols.  Thus, we have a symtab for the file ("info sources" shows
the file), but it contains no symbols.

When find_linespec_symbols is called in linespec_parse_basic, it calls
find_function_symbols, which uses add_matching_symbols_to_info to
collect all matching symbols.

That function does [pardon any mangled formatting]:

  for (ix = 0; VEC_iterate (symtab_ptr, info->file_symtabs, ix, elt); ++ix)
    {
      if (elt == NULL)
        {
          iterate_over_all_matching_symtabs (info->state, name, VAR_DOMAIN,
                                             collect_symbols, info,
                                             pspace, 1);
          search_minsyms_for_name (info, name, pspace);
        }
      else if (pspace == NULL || pspace == SYMTAB_PSPACE (elt))
        {
          /* Program spaces that are executing startup should have
             been filtered out earlier.  */
          gdb_assert (!SYMTAB_PSPACE (elt)->executing_startup);
          set_current_program_space (SYMTAB_PSPACE (elt));
          iterate_over_file_blocks (elt, name, VAR_DOMAIN,
                                    collect_symbols, info);
        }
    }

This iterates over the symtabs. In the failing use case, ELT is
non-NULL (points to the symtab for the .s file), so it calls
iterate_over_file_blocks. Herein is where the problem exists: it is
assumed that if NAME exists, it must exist in the given symtab -- a
reasonable assumption for "normal" (non-asm) cases. It never searches
minimal symbols (or in the global default symtab).

This patch fixes the problem by doing so. It is important to note that
iterating over minsyms is fairly expensive, so this patch only adds
that extra search if the language is language_asm and
iterate_over_file_blocks returns no symbols.

gdb/ChangeLog:
2014-12-20  Keith Seitz  <keiths@redhat.com>
            Mihail-Marian Nistor  <mihail.nistor@freescale.com>

        PR gdb/17394
        * linespec.c (struct collect_minsyms): Add new member `symtab'.
        (add_minsym): Handle cases where info.symtab is non-NULL.
        (search_minsyms_for_name): Add new parameter `symtab'.
        Handle limiting searches to a specific symtab.
        (add_matching_symtabs_to_info): Search through minimal symbols
        for language_asm files for which no new symbols are found.

gdb/testsuite/ChangeLog:
2014-12-20  Mihail-Marian Nistor  <mihail.nistor@freescale.com>

        PR gdb/17394
        * gdb.linespec/break-asm-file.c: New file.
        * gdb.linespec/break-asm-file.exp: New file.
        * gdb.linespec/break-asm-file0.s: New file.
        * gdb.linespec/break-asm-file1.s: New file.
2014-12-20 11:32:25 -05:00
H.J. Lu bd040da1db Change SometimesInlineFunction to "return i * i * 3;"
The debug_msg test has 2 implementations of SometimesInlineFunction:

int SometimesInlineFunction(int i) { return i; }
int SometimesInlineFunction(int i) { return i * i; }

and One Definition Rule (ODR) violation detection expects they will be
compiled into functions of different sizes.  Hower, on x86, GCC 4.7 and
newer compile them into functions of the same size and ODR violation
detection test fails.  This patch changes

int SometimesInlineFunction(int i) { return i; }

to

int SometimesInlineFunction(int i) { return i * i * 3; }

so that it will be compiled into a function of larger size.

	PR gold/14608
	* testsuite/debug_msg.cc (SometimesInlineFunction): Changed
	to "return i * i * 3;".
2014-12-20 08:05:45 -08:00
GDB Administrator 13a1997e66 Automatic date update in version.in 2014-12-20 00:00:12 +00:00
Matthew Fortune 0866e94c87 Rework the alignment check for BFD_RELOC_MIPS_18_PCREL_S3.
gas/

	* config/tc-mips.c (md_apply_fix): Apply alignment check
	to the symbol and offset rather than *valP for
	BFD_RELOC_MIPS_18_PCREL_S3.  Also update the error message
	for BFD_RELOC_MIPS_19_PCREL_S2.

gas/testsuite/

	* gas/mips/r6-64.s: Remove .align directives from LDPC
	instructions and add further tests for LDPC.
	* gas/mips/r6-64-n32.d: remove the NOPs from LDPC expected
	output and update for new tests.
	* gas/mips/r6-64-n64.d: Likewise.
	* gas/mips/ldpc-unalign.l: New file.
	* gas/mips/ldpc-unalign.s: Likewise.
	* gas/mips/mips.exp: Run ldpc-unalign test.
2014-12-19 20:24:16 +00:00
Matthew Fortune 13e322759b Fix octeon3 tests for targets with default abi != n32
gas/testsuite/

	* gas/mips/octeon3.d: Switch to use numeric register names.
2014-12-19 14:23:08 +00:00
Matthew Fortune d340a82588 Fix all failing FPXX tests for tx39-elf.
ld/testsuite/

	* ld-mips-elf/attr-gnu-4-00.d: Relax check for ISA extension.
	* ld-mips-elf/attr-gnu-4-01.d: Likewise.
	* ld-mips-elf/attr-gnu-4-02.d: Likewise.
	* ld-mips-elf/attr-gnu-4-03.d: Likewise.
	* ld-mips-elf/attr-gnu-4-08.d: Likewise.
	* ld-mips-elf/attr-gnu-4-10.d: Likewise.
	* ld-mips-elf/attr-gnu-4-11.d: Likewise.
	* ld-mips-elf/attr-gnu-4-18.d: Likewise.
	* ld-mips-elf/attr-gnu-4-20.d: Likewise.
	* ld-mips-elf/attr-gnu-4-22.d: Likewise.
	* ld-mips-elf/attr-gnu-4-28.d: Likewise.
	* ld-mips-elf/attr-gnu-4-30.d: Likewise.
	* ld-mips-elf/attr-gnu-4-33.d: Likewise.
	* ld-mips-elf/attr-gnu-4-38.d: Likewise.
	* ld-mips-elf/attr-gnu-4-44.d: Likewise.
2014-12-19 14:20:17 +00:00
Matthew Fortune 6e8ec71244 Fix undefined weak symbol reloc tests
ld/testsuite/

	* ld-mips-elf/mips-elf.exp: Update undefweak-overflow tests.
	* ld-mips-elf/undefweak-overflow-n32.d: Remove.
	* ld-mips-elf/undefweak-overflow-n64.d: Likewise.
	* ld-mips-elf/undefweak-overflow.s: Set mips64r6, noreorder and
	add a label to mark the micromips region.
	* ld-mips-elf/undefweak-overflow.d: Update expected output.
2014-12-19 14:19:42 +00:00
Yao Qi bb7e3f4d51 MIPS SDE OS ABI support
This patch is to add SDE OS ABI support in GDB, which has been used in
codesourcery gdb tree for some years.

gdb:

2014-12-19  Maciej W. Rozycki  <macro@codesourcery.com>
	    Nigel Stephens  <nigel@mips.com>
	    Chris Dearman  <chris@mips.com>
	    Luis Machado  <lgustavo@codesourcery.com>

	* Makefile.in (ALL_TARGET_OBS): Add mips-sde-tdep.o.
	(ALLDEPFILES): Add mips-sde-tdep.c.
	* mips-sde-tdep.c: New file containg SDE specific code.
	* configure.tgt (mips*-sde*-elf*): Add mips-sde-dep.o to
	gdb_target_obs.
	* defs.h (gdb_osabi): Add GDB_OSABI_SDE.
	* osabi.c (gdb_osabi_names): Add SDE.
	* NEWS: Mention the change.
2014-12-19 13:13:07 +08:00
GDB Administrator ff7609bc46 Automatic date update in version.in 2014-12-19 00:00:12 +00:00
Richard Henderson 04c6a44c7c Set ppc COMMONPAGESIZE to 64k
bfd/
	* elf32-ppc.c (ELF_COMMONPAGESIZE): Set to 64k.
	* elf64-ppc.c (ELF_COMMONPAGESIZE): Likewise.
2014-12-18 15:40:25 -06:00
Simon Marchi db7a9bcd53 A few comment cleanups
I stumbled upon a few comments that I think are outdated.

Comment for elfread.c (elf_symfile_init): As far as history goes in git,
I don't see anything related to that.

Comment for elfread.c (elf_symfile_read): References a parameter that was
removed in 1999.

Comment for struct sym_fns/sym_offsets: References a parameter that was
changed in 1999.

gdb/ChangeLog:

	* elfread.c (elf_symfile_init): Remove stale comment.
	(elf_symfile_read): Same.
	* symfile.h (struct sym_fns): Same.
2014-12-18 11:39:44 -05:00
Yao Qi 1bab73830f MIPS: Provide FPU info and decode FCSR in `info float'
This patch is the V2.  V1 can be found in
https://sourceware.org/ml/gdb-patches/2012-05/msg00938.html
V2 is to address Joel's comment
<https://sourceware.org/ml/gdb-patches/2012-06/msg00289.html> about
keeping dumping floating point registers.  Additionally, command
'info float' prints bits on nan2008 and abs2008.

------------------------------------------------------------------

 The change below provides a MIPS-specific handler for the:

(gdb) info float

command.  It provides information about the FPU type available (if any),
the FPU register width, and decodes the CP1 Floating Point Control and
Status Register (FCSR):

(gdb) print /x $fsr
$1 = 0xff83ffff
(gdb) info float
fpu type: double-precision
reg size: 32 bits
cond    : 0 1 2 3 4 5 6 7
cause   : inexact uflow oflow div0 inval unimp
mask    : inexact uflow oflow div0 inval
flags   : inexact uflow oflow div0 inval
rounding: -inf
flush   : zero

 One point to note about CP1.FCSR are the non-standard Flush-to-Nearest
and Flush-Override bits.  They are not a part of the MIPS architecture and
take two positions reserved for an implementation-dependent use in the
architecture.  They are present in all the FPU implementations made by
MIPS Technologies since the spin-off from SGI.

 I haven't been able to track down a single other MIPS FPU implementation
that would make any use of these bits and they are required to be
hardwired to zero by the architecture specification if unimplemented.
Therefore I think it makes sense to report them in the current way.

 GDB has no guaranteed access to the CP0 Processor Identification (PRId)
register to validate this feature properly and the ID information stored
in the CP1 Floating Point Implementation Register (FIR) is from my
experience not reliable enough (there's no Company ID available there for
once unlike in CP0.PRId and Processor ID is not guaranteed to be unique).

 As a side note we should probably dump CP1.FIR information as well, as
there's useful stuff indicating some FPU features there.  That's material
for another change however.

gdb/

2014-12-18  Nigel Stephens  <nigel@mips.com>
            Maciej W. Rozycki  <macro@codesourcery.com>

	* mips-tdep.c (print_fpu_flags): New function.
	(mips_print_float_info): Likewise.
	(mips_gdbarch_init): Install mips_print_float_info as gdbarch
	print_float_info routine.

gdb/testsuite/

2014-12-18  Nigel Stephens  <nigel@mips.com>
            Maciej W. Rozycki  <macro@codesourcery.com>

	* gdb.base/float.exp: Handle the new output from "info float" on
	MIPS targets.
2014-12-18 20:47:28 +08:00
Yao Qi cc86d1cb95 Refactor gdbarch method print_float_info
This patch is to change print_float_info gdbarch method for the
following two reasons,

 1. we want to add a default implementation of print_float_info to
    dump the float pointer registers.  It can be reused by backend to
    print something more than float point registers.
 2. we want to simplify the caller of print_float_info,
    infcmd.c:print_float_info.

gdb:

2014-12-18  Yao Qi  <yao@codesourcery.com>

 	* gdbarch.sh (print_float_info): Change its type from 'M' to 'm'.
	* gdbarch.c: Re-generated.
	* gdbarch.h: Likewise.
	* infcmd.c (default_print_float_info): New function.
	(print_float_info): Removed.  Move code to
	default_print_float_info.
	(float_info): Adjust to call gdbarch_print_float_info.
	* inferior.h (default_print_float_info): Declare it.
2014-12-18 20:47:28 +08:00
Yao Qi 2ad47ec433 Remove h8300_print_float_info
In infcmd.c:print_float_info, if the architecture doesn't have gdbarch
method print_float_info implemented and doesn't float reggroup, GDB
will prints "No floating-point info available for this processor."
The h8300 port doesn't have float registers, and don't need to
implement print_float_info.  This patch is to remove it.

gdb:

2014-12-18  Yao Qi  <yao@codesourcery.com>

	* h8300-tdep.c (h8300_print_float_info): Remove.
	(h8300_gdbarch_init): Remove the call to
	set_gdbarch_print_float_info.
2014-12-18 20:47:27 +08:00
Doug Evans 253342b8e6 infcmd.c (jump_command): Minor simplification.
gdb/ChangeLog:

	* infcmd.c (jump_command): Minor simplification.
2014-12-18 01:32:59 -08:00
Doug Evans 46b0da1738 language_lookup_primitive_type: Renamed from language_lookup_primitive_type_by_name.
gdb/ChangeLog:

	* language.c (language_lookup_primitive_type): Renamed from
	language_lookup_primitive_type_by_name.  All callers updated.
2014-12-18 01:10:34 -08:00
Doug Evans 99d4b98d4b Fix file name in earlier entry. 2014-12-18 00:52:40 -08:00
Mark Wielaard 6ddfe5b4f9 Display DW_LANG_C11 as (C11).
* dwarf.c (read_and_display_attr_value): Change display name of
	DW_LANG_C11 from (ANSI C11) to (C11).
2014-12-18 13:07:49 +10:30
GDB Administrator e0631a6a2b Automatic date update in version.in 2014-12-18 00:00:09 +00:00
Jan Kratochvil 1bc1068a0c Fix MinGW compilation
On Sun, 14 Dec 2014 07:00:28 +0100, Yao Qi wrote:
The build on mingw host is broken because mingw has no mkdtemp.

../../../git/gdb/compile/compile.c: In function 'get_compile_file_tempdir':
../../../git/gdb/compile/compile.c:194:3: error: implicit declaration of function 'mkdtemp' [-Werror=implicit-function-declaration]
   tempdir_name = mkdtemp (tname);
   ^
../../../git/gdb/compile/compile.c:194:16: error: assignment makes pointer from integer without a cast [-Werror]
   tempdir_name = mkdtemp (tname);
                ^
cc1: all warnings being treated as errors

In the end I have managed to test it by Wine myself:

$ wine build_win32/gdb/gdb.exe -q build_win32/gdb/gdb.exe -ex start -ex 'compile code 1' -ex 'set confirm no' -ex quit
[...]
Temporary breakpoint 1, main (argc=1, argv=0x241418) at ../../gdb/gdb.c:29
29        args.argc = argc;
Could not load libcc1.so: Module not found.

Even if it managed to load libcc1.so (it needs host-dependent name libcc1.dll)
then it would soon end up at least on:

default_infcall_mmap:
  error (_("This target does not support inferior memory allocation by mmap."));

As currently there is only:

linux-tdep.c:
  set_gdbarch_infcall_mmap (gdbarch, linux_infcall_mmap);

While one could debug Linux targets from MS-Windows host I find it somehow
overcomplicated now when we are trying to get it running at least on native
Linux x86*.

The 'compile' project needs a larger port effort to run on MS-Windows.

gdb/ChangeLog
2014-12-17  Jan Kratochvil  <jan.kratochvil@redhat.com>

	Fix MinGW compilation.
	* compile/compile.c (get_compile_file_tempdir): Call error if
	!HAVE_MKDTEMP.
	* config.in: Regenerate.
	* configure: Regenerate.
	* configure.ac (AC_CHECK_FUNCS): Add mkdtemp.

gdb/testsuite/ChangeLog
2014-12-17  Jan Kratochvil  <jan.kratochvil@redhat.com>

	Fix MinGW compilation.
	* gdb.compile/compile-ops.exp: Update untested message if
	!skip_compile_feature_tests.
	* gdb.compile/compile-setjmp.exp: Likewise.
	* gdb.compile/compile-tls.exp: Likewise.
	* gdb.compile/compile.exp: Likewise.
	* lib/gdb.exp (skip_compile_feature_tests): Check also "Command not
	supported on this host".
2014-12-17 20:09:02 +01:00
Doug Evans 5e3c72e6b8 value_maybe_namespace_elt: Remove redundant call to lookup_static_symbol.
Anytime you can remove a symbol lookup that loops over all objfiles
is A Good Thing.

The call to lookup_static_symbol in valops.c:value_maybe_namespace_elt
is redundant with this call in cp_lookup_nested_symbol:

	/* Now search all static file-level symbols.  We have to do this
	   for things like typedefs in the class.  We do not try to
	   guess any imported namespace as even the fully specified
	   namespace search is already not C++ compliant and more
	   assumptions could make it too magic.  */

	size = strlen (parent_name) + 2 + strlen (nested_name) + 1;
	concatenated_name = alloca (size);
	xsnprintf (concatenated_name, size, "%s::%s",
		 parent_name, nested_name);
	sym = lookup_static_symbol (concatenated_name, VAR_DOMAIN);
	if (sym != NULL)
	  return sym;

Earlier in value_maybe_namespace_elt we do this:

  sym = cp_lookup_symbol_namespace (namespace_name, name,
				    get_selected_block (0), VAR_DOMAIN);

That sequence goes like:

value_maybe_namespace_elt
-> cp_lookup_symbol_namespace
-> cp_lookup_symbol_in_namespace
-> lookup_symbol_file
-> cp_lookup_nested_symbol
-> lookup_static_symbol

The call was added in commit 41f62f3939.
https://sourceware.org/ml/gdb-patches/2010-06/msg00663.html
With a part 2 here:
https://sourceware.org/ml/gdb-patches/2010-06/msg00664.html

At the time the call to lookup_static_symbol (spelled
lookup_static_symbol_aux at the time) was needed.

However, this patch, 8dea366bbe,
https://sourceware.org/ml/gdb-patches/2012-11/msg00387.html
augmented lookup_symbol_file to call cp_lookup_nested_symbol
and introduced the redundancy.

It's kinda buried, so it's totally not unexpected that this happened.

gdb/ChangeLog:

	* valops.c (value_maybe_namespace_elt): Remove redundant call to
	lookup_static_symbol.
2014-12-17 00:30:29 -08:00
Doug Evans cc485e6201 New parameter "debug symbol-lookup".
gdb/ChangeLog:

	New parameter "debug symbol-lookup".
	* NEWS: Mention it.
	* cp-namespace.c (cp_lookup_symbol_imports_or_template): Add debug
	output.
	(cp_lookup_symbol_namespace, cp_lookup_symbol_nonlocal): Ditto.
	(cp_lookup_nested_symbol): Ditto.
	* language.c (language_lookup_primitive_type_by_name): Add debug
	output.
	* minsyms.c (lookup_minimal_symbol): Add debug output.
	* objfiles.c (objfile_debug_name): Moved here, and renamed ...
	* symfile-debug.c (debug_objfile_name): ... from here.  All callers
	updated.
	* objfiles.h (objfile_debug_name): Declare.
	* symtab.h (symbol_lookup_debug): Declare.
	* symtab.c (symbol_lookup_debug): New global.
	(lookup_language_this): Add debug output.
	(lookup_symbol_aux, lookup_symbol_in_block): Ditto.
	(lookup_symbol_in_objfile_symtabs, lookup_symbol_via_quick_fns): Ditto.
	(lookup_symbol_in_static_block, lookup_symbol_in_objfile): Ditto.
	(_initialize_symtab): Add new parameter "debug symbol-lookup".

gdb/doc/ChangeLog:

	* gdb.texinfo (Debugging Output): Document "debug symbol-lookup".
2014-12-17 00:17:27 -08:00
Doug Evans 0ab9ce852b Make buildsym set-up/tear-down more consistent, and document it.
gdb/ChangeLog:

	* buildsym.c: Add comments describing how the buildsym machinery
	is used by the various file formats.
	(really_free_pendings): Enhance function comment.
	See pending_macros to NULL.  Simplify resetting pending_addrmap.
	Call free_buildsym_compunit.
	(free_buildsym_compunit): Set current_subfile to NULL.
	(prepare_for_building): New function.
	(start_symtab): Call it.  Remove call to set_last_source_file.
	(restart_symtab): New arg "cust".  All callers updated.
	Simplify, call prepare_for_building.  Re-initialize buildsym_compunit.
	(reset_symtab_globals): Enhance function comment.
	Set local_symbols, file_symbols, global_symbols to NULL.
	Set pending_macros to NULL.  Simplify resetting pending_addrmap.
	Call free_buildysym_compunit.
	(end_symtab_without_blockvector): Delete.  All callers updated.
	(end_symtab_with_blockvector): Remove redundant call to
	free_buildsym_compunit.
	(augment_type_symtab): Remove arg "cust".  All callers updated.
	(buildsym_init): Remove resetting of free_pendings, file_symbols,
	global_symbols, pending_blocks, pending_macros.  Instead make
	handling consistent with pending_addrmap: Assert value was reset
	at end of previous symtab building.  Initialize context_stack here.
2014-12-17 00:00:14 -08:00
Doug Evans b6615d1086 boards/stabs.exp: New file.
gdb/ChangeLog:

	* boards/stabs.exp: New file.
2014-12-16 23:10:54 -08:00
Doug Evans 55accf4a1e cp_lookup_symbol_via_imports: Renamed from cp_lookup_symbol_imports.
gdb/ChangeLog:

	* cp-namespace.c (cp_lookup_symbol_via_imports): Renamed from
	cp_lookup_symbol_imports.  All callers updated.
2014-12-16 22:19:15 -08:00
Doug Evans a07e3e182d cp_find_type_baseclass_by_name: Renamed from find_type_baseclass_by_name.
gdb/ChangeLog:

	* cp-namespace.c (cp_find_type_baseclass_by_name): Renamed from
	find_type_baseclass_by_name.  All callers updated.
2014-12-16 22:13:57 -08:00
Doug Evans d01060f023 symtab.h (struct symbol_search) <symtab>: Delete, unnecessary.
gdb/ChangeLog:

	* symtab.h (struct symbol_search) <symtab>: Delete.  All uses updated.
	* symtab.c (compare_search_syms): Use SYMBOL_SYMTAB accessor.
	(print_symbol_info): Delete arg symtab.  All callers updated.
	(symtab_symbol_info): Use SYMBOL_SYMTAB accessor.
2014-12-16 22:00:13 -08:00
GDB Administrator 64f0601bb4 Automatic date update in version.in 2014-12-17 00:00:08 +00:00
Cary Coutant e02a4046e0 Fix internal error in gold when -Map and --compress-debug-sections are used
together.

gold/
	* mapfile.cc (Mapfile::print_input_section): Print uncompressed sizes.
	(Mapfile::print_output_data): Use current_data_size() to avoid
	assert for sections requiring postprocessing; if address is not valid,
	print 0.
	(Mapfile::print_output_section): Use current_data_size(); print note
	that addresses and sizes are before compression.
2014-12-16 14:58:15 -08:00
Matthew Fortune 15969b63f9 Fix octeon3 testsuite fallout
gas/testsuite/

	* gas/mips/attr-gnu-4-5.d: Ignore ASEs.
	* gas/mips/attr-gnu-4-6.d: Likewise.
	* gas/mips/attr-gnu-4-7.d: Likewise.
	* gas/mips/attr-none-o32-fp64-nooddspreg.d: Likewise.
	* gas/mips/attr-none-o32-fp64.d: Likewise.
	* gas/mips/attr-none-o32-fpxx.d: Likewise.
2014-12-16 22:34:06 +00:00
Matthew Fortune b9121b573e Add in a JALRC alias and fix the NAL instruction.
opcodes/

	* mips-opc.c (mips_builtin_opcodes): Add JALRC alias for JIALC.
	Remove the operand from NAL.

gas/testsuite/

	* gas/mips/r6.s: Test JALRC and NAL
	* gas/mips/r6-n32.d: Add expected output for JALRC and NAL.
	* gas/mips/r6-n64.d: Likewise.
	* gas/mips/r6.d: Likewise.
2014-12-16 22:33:12 +00:00
Andreas Arnez 25dda427ec Fix indentation of "maint print user-registers"
This fixes a failure of the test case "complete 'info registers '" in
completion.exp on architectures where the user registers have numbers
above 99.  In that case the output of "maint print user-registers" was
no longer indented, and the regexp in the test case failed to add them
to the list of expected completion results.  The fix also swaps the
columns "Name" and "Nr", such that the indentation is always the same,
and to be consistent with the output of "maint print registers".

gdb/ChangeLog:

	* user-regs.c (maintenance_print_user_registers): Swap "Nr" and
	"Name" columns.  Assure that the output is always indented.

gdb/testsuite/ChangeLog:

	* gdb.base/completion.exp: Adjust to format changes of "maint
	print user-registers".
2014-12-16 16:06:42 +01:00
Nick Clifton 033539e268 Fix a memory access violation triggeed by a fuzzed binary.
PR binutils/17512
	* format.c (bfd_check_format_matches): Check for a matching vector
	before using match priorities.
	* mach-o.c (bfd_mach_o_canonicalize_one_reloc): Fix off-by-one
	errors with previous delta.
2014-12-16 14:17:15 +00:00
Joel Brobecker beed38b827 [Linux] Ask kernel to kill inferior when GDB terminates
This patch enhances GDB on GNU/Linux systems in the situation where
we are debugging an inferior that was created from GDB (as opposed
to attached to), by asking the kernel to kill the inferior if GDB
terminates without doing it itself.

This would typically happen when GDB encounters a problem and
crashes, or when it gets killed by an external process. This can
be observed by starting a program under GDB, and then killing
GDB with signal 9. After GDB is killed, the inferior still remains.

This patch also fixes GDBserver similarly.

This fix is conditional on the kernel supporting the PTRACE_O_EXITKILL
feature.  On older kernels, the behavior remains unchanged.

gdb/ChangeLog:

        * nat/linux-ptrace.h (PTRACE_O_EXITKILL): Define if not
        already defined.
        (linux_enable_event_reporting): Add parameter "attached".
        * nat/linux-ptrace.c (linux_test_for_exitkill): New forward
        declaration.  New function.
        (linux_check_ptrace_features): Add linux_test_for_exitkill call.
        (linux_enable_event_reporting): Add new parameter "attached".
        Do not call ptrace with the PTRACE_O_EXITKILL if ATTACHED is
        nonzero.
        * linux-nat.c (linux_init_ptrace): Add parameter "attached".
        Use it.  Update function description.
        (linux_child_post_attach, linux_child_post_startup_inferior):
        Update call to linux_enable_event_reporting.

gdb/gdbserver/ChangeLog:

        * linux-low.c (linux_low_filter_event): Update call to
        linux_enable_event_reporting following the addition of
        a new parameter to that function.

Tested on x86_64-linux, native and native-gdbserver.

I also verified by hand that the inferior gets killed when killing
GDB in the "run" case, while the inferior remains in the "attach"
case. Same for GDBserver.
2014-12-16 07:56:46 -05:00
Catalin Udma bf330350c2 aarch64/gdbserver: fix floating point registers display
When using aarch64 gdb with gdbserver, floating point registers are
not correctly displayed, as below:
  (gdb) info registers fpsr fpcr
  fpsr           <unavailable>
  fpcr           <unavailable>

To fix these problems, the missing fpsr and fpcr registers are added
when floating point registers are read/write
Add test for aarch64 floating point
PR server/17457

gdb/gdbserver/

    PR server/17457
    * linux-aarch64-low.c (AARCH64_FPSR_REGNO): New define.
    (AARCH64_FPCR_REGNO): Likewise.
    (AARCH64_NUM_REGS): Update to include fpsr/fpcr registers.
    (aarch64_fill_fpregset): Add missing fpsr/fpcr registers.
    (aarch64_store_fpregset): Likewise.

gdb/testsuite/

    PR server/17457
    * gdb.arch/aarch64-fp.c: New file.
    * gdb.arch/aarch64-fp.exp: New file.

Signed-off-by: Catalin Udma <catalin.udma@freescale.com>
2014-12-16 09:51:42 +02:00
Yao Qi 8fda906819 Move NEWS entries to the right section
gdb:

2014-12-16  Yao Qi  <yao@codesourcery.com>

	* NEWS: Move some entries to "Changes since GDB 7.8" section.
2014-12-16 13:21:49 +08:00
Yao Qi 2a54636794 Replace ARG_MAX with ARG_LAST
We define an enum ARG_MAX in linux_infcall_mmap, but it is conflict
with macro ARG_MAX which is defined in /usr/include/linux/limits.h.
This causes a build failure below,

 gdb/linux-tdep.c: In function 'linux_infcall_mmap':
 gdb/linux-tdep.c:1945:70: error: expected identifier before numeric constant

the enum in the pre-processed source becomes:

  enum
    {
      ARG_ADDR, ARG_LENGTH, ARG_PROT, ARG_FLAGS, ARG_FD, ARG_OFFSET, 131072
    };

This patch is to replace ARG_MAX with ARG_LAST.

gdb:

2014-12-16  Yao Qi  <yao@codesourcery.com>

	* linux-tdep.c (linux_infcall_mmap): Replace ARG_MAX with
	ARG_LAST.
2014-12-16 13:13:17 +08:00
Sergio Durigan Junior 395cf596db Merge dg-extract-results.{sh,py} from GCC upstream
It has been a while since we don't sync this file with GCC upstream,
and in the meantime some interesting things have happened.  The most
interesting is the inclusion of a new dg-extract-results.py which is
apparently faster than its shell equivalent.

This merge will probably fix the bug described in

  <https://sourceware.org/ml/gdb-patches/2014-12/msg00421.html>

Though I am still proposing the patch for upstream GCC.  Once it gets
accepted, I will merge it too.

OK to apply?

gdb/testsuite/ChangeLog:
2014-12-15  Sergio Durigan Junior  <sergiodj@redhat.com>

	Merge dg-extract-results.{sh,py} from GCC upstream (r210243,
	r210637, r210913, r211666, r215400, r215817).

	2014-05-08  Richard Sandiford  <rdsandiford@googlemail.com>
		* dg-extract-results.py: New file.
		* dg-extract-results.sh: Use it if the environment seems
		suitable.

	2014-05-20  Richard Sandiford  <rdsandiford@googlemail.com>

		* dg-extract-results.py (parse_run): Handle warnings that
		are printed before a test harness is run.

	2014-05-25  Richard Sandiford  <rdsandiford@googlemail.com>

		* dg-extract-results.py (Named): Remove __cmp__ method.
		(output_variation): Use a key to sort variation.harnesses.

	2014-06-14  Richard Sandiford  <rdsandiford@googlemail.com>

		* dg-extract-results.py: For Python 3, force sys.stdout to
		handle surrogate escape sequences.
		(safe_open): New function.
		(output_segment, main): Use it.

	2014-09-19  Segher Boessenkool  <segher@kernel.crashing.org>

		* dg-extract-results.py (Prog.result_re): Include options
		in test name.

	2014-10-02  Segher Boessenkool  <segher@kernel.crashing.org>

		* dg-extract-results.py (output_variation): Always sort if
		do_sum.
2014-12-15 19:37:55 -05:00
GDB Administrator c2c0b2c2b0 Automatic date update in version.in 2014-12-16 00:00:09 +00:00
Simon Marchi c9657e708a Introduce utility function find_inferior_ptid
This patch introduces find_inferior_ptid to replace the common idiom

  find_inferior_pid (ptid_get_pid (...));

It replaces all the instances of that idiom that I found with the new
function.

No significant changes before/after the patch in the regression suite
on amd64 linux.

gdb/ChangeLog:

	* inferior.c (find_inferior_ptid): New function.
	* inferior.h (find_inferior_ptid): New declaration.
	* ada-tasks.c (ada_get_task_number): Use find_inferior_ptid.
	* corelow.c (core_pid_to_str): Same.
	* darwin-nat.c (darwin_resume): Same.
	* infrun.c (fetch_inferior_event): Same.
	(get_inferior_stop_soon): Same.
	(handle_inferior_event): Same.
	(handle_signal_stop): Same.
	* linux-nat.c (resume_lwp): Same.
	(stop_wait_callback): Same.
	* mi/mi-interp.c (mi_new_thread): Same.
	(mi_thread_exit): Same.
	* proc-service.c (ps_pglobal_lookup): Same.
	* record-btrace.c (record_btrace_step_thread): Same.
	* remote-sim.c (gdbsim_close_inferior): Same.
	(gdbsim_resume): Same.
	(gdbsim_stop): Same.
	* sol2-tdep.c (sol2_core_pid_to_str): Same.
	* target.c (memory_xfer_partial_1): Same.
	(default_thread_address_space): Same.
	* thread.c (thread_change_ptid): Same.
	(switch_to_thread): Same.
	(do_restore_current_thread_cleanup): Same.
2014-12-15 12:00:55 -05:00
Simon Marchi e882ef3cfc testsuite: expect possible pagination when starting gdb
When gdb starts, the lines that appear before the first prompt may get
paginated if the terminal in which the tests are ran is too small (in
terms of rows). These lines include the welcome/license message and
possibly more, such as "Reading symbols from...". Pagination is disabled
right after gdb is started (with "set height 0"), but this output happens
before we are able to set height.

If these lines get paginated, gdb waits for the user to press enter and
the test harness waits for gdb to print its prompt, resulting in a
deadlock.

My first idea was to launch gdb with --quiet. However, some lines are
still printed ("Reading symbols from...", some more stuff when attaching
with --pid, etc).

The proposed solution simply expects that pagination can occur after
starting gdb. If this is the case, it sends a "\n" and loops.

gdb/testsuite/Changelog:

	* lib/gdb.exp (default_gdb_start): After starting gdb, loop
	as long as we get pagination notifications.
2014-12-15 11:46:44 -05:00
Simon Marchi 38bcc89d48 Fix build with Python 3.4 (PR python/16784)
The type of the function pointer PyOS_ReadlineFunctionPointer (part of the
Python C API), which we use, slightly changed starting with Python 3.4. The
signature went from

PyAPI_DATA(char) *(*PyOS_ReadlineFunctionPointer)(FILE *, FILE *, char *);

to

PyAPI_DATA(char) *(*PyOS_ReadlineFunctionPointer)(FILE *, FILE *, const char *);

The parameter that changed is the prompt text.

This commits adjust gdb accordingly by making the prompt_arg parameter
const, as well as the fallouts of that. I needed to rework how
annotations are added to the prompt, since the it is now const. If
annotations are enabled, it will make a copy of the prompt overwrite the
prompt variable that is used throughout the function. Otherwise, no copy
is done and the original prompt_arg value is passed.

I changed the signature of deprecated_readline_hook. I would've changed any
user of it, but it seems like nothing is using it,

Built-tested with python 2.7.x, 3.3.y and 3.4.z.

gdb/ChangeLog:

	* defs.h (gdb_readline): Constify argument.
	(gdb_readline_wrapper): Same.
	(command_line_input): Same.
	(deprecated_readline_hook): Same.
	* top.c (deprecated_readline_hook): Same.
	(gdb_readline): Same.
	(gdb_readline_wrapper): Same.
	(command_line_input): Constify argument. Pass prompt to
	called functions instead of local_prompt, overwriting prompt
	if using annotations.
	* event-top.h (display_gdb_prompt): Constify argument.
	* event-top.c (display_gdb_prompt): Same.
	* python/py-gdb-readline.c (gdbpy_readline_wrapper): Constify
	argument if building with Python 3.4 and up.

Signed-off-by: Simon Marchi <simon.marchi@ericsson.com>
2014-12-15 11:40:00 -05:00