Commit Graph

83785 Commits

Author SHA1 Message Date
GDB Administrator fb4048adf7 Automatic date update in version.in 2015-05-12 00:00:07 +00:00
H.J. Lu 70cead0767 Remove Disp16|Disp32 from 64-bit direct branches
Disp16 and Disp32 aren't supported by direct branches in 64-bit mode.
This patch removes them from 64-bit direct branches.

	* opcodes/i386-opc.tbl (call): Remove Disp16|Disp32 from 64-bit
	direct branch.
	(jmp): Likewise.
	* i386-tbl.h: Regenerated.
2015-05-11 14:20:37 -07:00
H.J. Lu e83c417475 Allow mixing target and not-target directives
Mixing target and not-target directives can be used to run for x86_64-*-*
target while skipping x86_64-*-gnux32 target.  This patch allows mixing
target and not-target directives. It is used to skip elfedit-1 for
x86_64-*-gnux32.

	* binutils-all/elfedit-1.d: Skip x86_64-*-gnux32.
	* lib/utils-lib.exp (run_dump_test): Allow mixing target and
	not-target directives.
2015-05-11 12:29:27 -07:00
H.J. Lu 5197d47436 Default e_machine to EM_IAMCU for i?86-*-elfiamcu
This patch sets the default ELF output format of assembler and linker to
EM_IAMCU when binutils is configured to i?86-*-elfiamcu target.

gas/

	* configure.tgt (arch): Set to iamcu for i386-*-elfiamcu target.
	* config/tc-i386.c (i386_mach): Support iamcu.
	(i386_target_format): Likewise.

ld/

	* configure.tgt: Support i[3-7]86-*-elfiamcu target.

ld/testsuite/

	* ld-i386/i386.exp (iamcu_tests): Run iamcu-4.
	* ld-i386/iamcu-4.d: New file.
2015-05-11 12:06:33 -07:00
H.J. Lu 7e0a81123d Add Intel MCU support to ld
-m elf_iamcu must be passed to i386 linker to generate Intel MCU binary.

ld/

	* Makefile.am (ALL_EMULATION_SOURCES): Add eelf_iamcu.c.
	(eelf_iamcu.c): New.
	* configure.tgt (targ_extra_emuls): Add elf_iamcu if elf_i386 is
	enabled in BFD.
	* Makefile.in: Regenerated.
	* emulparams/elf_iamcu.sh: New file.

ld/testsuite/

	* ld-i386/abs-iamcu.d: New file.
	* ld-i386/dummy.s: Likewise.
	* ld-i386/foo.s: Likewise.
	* ld-i386/iamcu-1.d: Likewise.
	* ld-i386/iamcu-2.d: Likewise.
	* ld-i386/iamcu-3.d: Likewise.
	* ld-i386/start.s: Likewise.
	* ld-i386/i386.exp (iamcu_tests): New.
	Run iamcu_tests.
2015-05-11 11:29:03 -07:00
H.J. Lu 814860358c Add Intel MCU support to gas
-march=iamcu must be passed to i386 assembler to generate Intel MCU object
file.

gas/

	* config/tc-i386.c (cpu_arch): Add iamcu.
	(i386_align_code): Handle PROCESSOR_IAMCU.
	(i386_arch): Likewise.
	(i386_mach): Likewise.
	(i386_target_format): Likewise.
	(valid_iamcu_cpu_flags): New function.
	(check_cpu_arch_compatible): Only allow Intel MCU instructions
	when targeting Intel MCU.
	(set_cpu_arch): Call valid_iamcu_cpu_flags to check if CPU flags
	are valid for Intel MCU.
	(md_parse_option): Likewise.
	* tc-i386.h (ELF_TARGET_IAMCU_FORMAT): New.
	(processor_type): Add PROCESSOR_IAMCU.
	* doc/c-i386.texi: Document iamcu.

gas/testsuite/

	* gas/i386/i386.exp: Run iamcu-1, iamcu-2, iamcu-3, iamcu-inval-1,
	iamcu-inval-2 and iamcu-inval-3.
	* gas/i386/iamcu-1.d: New file.
	* gas/i386/iamcu-1.s: Likewise.
	* gas/i386/iamcu-2.d: Likewise.
	* gas/i386/iamcu-2.s: Likewise.
	* gas/i386/iamcu-3.d: Likewise.
	* gas/i386/iamcu-3.s: Likewise.
	* gas/i386/iamcu-inval-1.l: Likewise.
	* gas/i386/iamcu-inval-1.s: Likewise.
	* gas/i386/iamcu-inval-2.l: Likewise.
	* gas/i386/iamcu-inval-2.s: Likewise.
	* gas/i386/iamcu-inval-3.l: Likewise.
	* gas/i386/iamcu-inval-3.s: Likewise.
2015-05-11 11:12:39 -07:00
H.J. Lu 7b6d09fbc6 Add Intel MCU support to opcodes
* configure.ac: Support bfd_iamcu_arch.
	* disassemble.c (disassembler): Support bfd_iamcu_arch.
	* i386-gen.c (cpu_flag_init): Add CPU_IAMCU_FLAGS and
	CPU_IAMCU_COMPAT_FLAGS.
	(cpu_flags): Add CpuIAMCU.
	* i386-opc.h (CpuIAMCU): New.
	(i386_cpu_flags): Add cpuiamcu.
	* configure: Regenerated.
	* i386-init.h: Likewise.
	* i386-tbl.h: Likewise.
2015-05-11 10:48:21 -07:00
H.J. Lu 3d875af575 Add init_dwarf_regnames_iamcu
* dwarf.c (dwarf_regnames_iamcu): New.
	(init_dwarf_regnames_iamcu): Likewise.
	(init_dwarf_regnames): Call init_dwarf_regnames_iamcu for EM_IAMCU.
	* dwarf.h (init_dwarf_regnames_iamcu): New.
	* objdump.c (dump_dwarf): Call init_dwarf_regnames_iamcu for
	bfd_arch_iamcu.
2015-05-11 10:41:44 -07:00
H.J. Lu bf64a9511f Add Intel MCU support to bfd
bfd/

	* Makefile.am (ALL_MACHINES): Add cpu-iamcu.lo.
	(ALL_MACHINES_CFILES): Likewise.
	* archures.c (bfd_mach_iamcu): New.
	(bfd_mach_i386_iamcu): Likewise.
	(bfd_mach_i386_iamcu_intel_syntax): Likewise.
	(bfd_iamcu_arch): Likewise.
	(bfd_archures_list): Add &bfd_iamcu_arch.
	* config.bfd (targ_selvecs): Add iamcu_elf32_vec to
	i386_elf32_vec.
	(targ_archs): Add bfd_iamcu_arch if needed.
	* configure.ac: Support iamcu_elf32_vec.
	* cpu-iamcu.c: New file.
	* elf32-i386.c (elf32_iamcu_elf_object_p): New function.
	Add support for iamcu_elf32_vec and elf32_iamcu_bed.
	* targets.c (iamcu_elf32_vec): New.
	(_bfd_target_vector): Add iamcu_elf32_vec.
	* Makefile.in: Regenerated.
	* bfd-in2.h: Likewise.
	* configure: Likewise.

binutils/testsuite/

	* binutils-all/objdump.exp (cpus_expected): Append iamcu.
2015-05-11 10:31:00 -07:00
H.J. Lu 6c14750f48 Add EM_386/EM_IAMCU support to elfedit.c
binutils/

	* elfedit.c (enum elfclass): New.
	(input_elf_class): Change type to enum elfclass.
	(output_elf_class): New.
	(elf_class): Change return type to enum elfclass.  Support EM_386
	and EM_IAMCU.
	(update_elf_header): Check if input and output ELF classes match.
	(elf_machine): Support EM_386 and EM_IAMCU.
	(main): Update input_elf_class.  Set output_elf_class.
	* doc/binutils.texi: Update elfedit.

binutils/testsuite/

	* binutils-all/elfedit-5.d: New file.
	* binutils-all/elfedit.exp: Run elfedit-5.
2015-05-11 09:57:21 -07:00
H.J. Lu 22abe5566a Rename EM_486 to EM_IAMCU
bfd/

	* elfcode.h (elf_object_p): Replace EM_486 with EM_IAMCU.

binutils/

	* dwarf.c (init_dwarf_regnames): Replace EM_486 with EM_IAMCU.
	* readelf.c (guess_is_rela): Likewise.
	(dump_relocations): Likewise.
	(get_machine_name): Likewise.
	(get_elf_section_flags): Likewise.
	(process_section_headers): Likewise.
	(is_32bit_abs_reloc): Likewise.
	(is_32bit_pcrel_reloc): Likewise.

include/elf/

	* common.h (EM_486): Renamed to ...
	(EM_IAMCU): This.
2015-05-11 08:53:05 -07:00
GDB Administrator 415158ef39 Automatic date update in version.in 2015-05-11 00:00:08 +00:00
H.J. Lu 4b71eec627 Replace input_bfd and output_bfd with abfd
The first argument to bfd_get_8/bfd_put_8 isn't used.  But we should
use something real.  Replace input_bfd and output_bfd with abfd.

	* elf32-i386.c (elf_i386_convert_mov_to_lea): Replace input_bfd
	and output_bfd with abfd.
	* elf64-x86-64.c (elf_x86_64_convert_mov_to_lea): Likewise.
2015-05-10 06:44:12 -07:00
Siva Chandra 4c082a81df [Python] Add methods reference_value and const_value to gdb.Value.
gdb/ChangeLog:

	* NEWS (Python Scripting): Mention the new gdb.Value methods.
	* python/py-value.c (valpy_reference_value): New function.
	(valpy_const_value): Likewise.
	(value_object_methods): Add new methods.
	* value.c (make_cv_value): New function.
	* value.h (make_cv_value): Declare.

gdb/doc/ChangeLog:

	* python.texi (Values From Inferior): Add descriptions of new
	methods gdb.Value.reference_value and gdb.Value.const_value.

gdb/testsuite/ChangeLog:

	* gdb.python/py-xmethods.cc: Enhance test case.
	* gdb.python/py-xmethods.exp: New tests.
	* gdb.python/py-xmethods.py (A_indexoper): New xmethod worker
	function.
	(B_indexoper): Likewise.
	(global_dm_list) : Add new xmethod worker functions.
2015-05-09 17:30:35 -07:00
GDB Administrator 10a52f094e Automatic date update in version.in 2015-05-10 00:00:08 +00:00
H.J. Lu a72d2af2c7 Ignore 0x66 prefix for call/jmp/jcc in 64-bit mode
The operand size prefix (0x66) is ignored for 32-bit PC-relative call,
jmp and jcc in 64-bit mode.

gas/testsuite/

	PR binutis/18386
	* gas/i386/i386.exp: Run x86-64-jump.
	* gas/i386/x86-64-branch.d: Updated.
	* gas/i386/ilp32/x86-64-branch.d: Likewise.
	* gas/i386/x86-64-branch.s: Add tests for the operand size prefix
	with call, jmp and jb.
	* gas/i386/x86-64-jump.d: New file.
	* gas/i386/x86-64-jump.s: Likewise.

ld/testsuite/

	PR binutis/18386
	* ld-x86-64/tlsgdesc.dd: Updated.
	* ld-x86-64/tlspic.dd: Likewise.

opcodes/

	PR binutis/18386
	* i386-dis.c (X86_64_E8): New.
	(X86_64_E9): Likewise.
	Update comments on 'T', 'U', 'V'.  Add comments for '^'.
	(dis386): Replace callT/jmpT with X86_64_E8/X86_64_E9.
	(x86_64_table): Add X86_64_E8 and X86_64_E9.
	(mod_table): Replace {T|} with ^ on Jcall/Jmp.
	(putop): Handle '^'.
	(OP_J): Ignore the operand size prefix in 64-bit.  Don't check
	REX_W.
2015-05-09 06:44:29 -07:00
GDB Administrator 504374b503 Automatic date update in version.in 2015-05-09 00:00:08 +00:00
Sandra Loosemore afa6c9abf2 Avoid segfault on missing directory table.
2015-05-08  Yao Qi  <yao@codesourcery.com>
	    Sandra Loosemore  <sandra@codesourcery.com>

	gdb/
	* dwarf2read.c (setup_type_unit_groups): Do NULL pointer check
	to 'lh->include_dirs' before accessing to it.
	(psymtab_include_file_name): Likewise.
	(dwarf_decode_lines_1): Likewise.
	(dwarf_decode_lines): Likewise.
	(file_file_name): Likewise.
2015-05-08 12:43:39 -07:00
Sandra Loosemore 35d54293c3 Fix register save offset for nios2 signal handler trampolines.
2015-05-08  Sandra Loosemore  <sandra@codesourcery.com>

	gdb/
	* nios2-linux-tdep.c (NIOS2_SIGRETURN_TRAMP_ADDR): Define.
	(NIOS2_SIGRETURN_REGSAVE_OFFSET): Define.
	(nios2_linux_rt_sigreturn_init): Adjust base address of
	register save area.
2015-05-08 12:34:52 -07:00
Sandra Loosemore 21e94bd9f0 Use PTRACE_GETREGSET/SETREGSET in nios2 gdbserver.
2015-05-08  Sandra Loosemore  <sandra@codesourcery.com>

	gdb/gdbserver/
	* linux-nios2-low.c: Include elf/common.h.  Adjust comments.
	Remove HAVE_PTRACE_GETREGS conditionals.
	(nios2_regsets): Use PTRACE_GETREGSET and PTRACE_SETREGSET
	instead of PTRACE_GETREGS and PTRACE_SETREGS.
2015-05-08 12:32:43 -07:00
Sandra Loosemore b73c49b7f6 Revert to using "trap 31" for breakpoints on nios2.
2015-05-08  Sandra Loosemore  <sandra@codesourcery.com>

	gdb/
	* nios2-tdep.c (nios2_breakpoint_from_pc): Revert to using
	"trap 31" as the breakpoint instruction on all targets.
2015-05-08 12:24:41 -07:00
Sergio Durigan Junior f7797074a5 Fix coredump-filter.exp by correctly unsetting array
In my last commit to make gdb.base/coredump-filter.exp be more robust
regarding using arrays in the global namespace, I cleared the
"coredump_var_addr" array like this:

  set coredump_var_addr ""
  # use coredump_var_addr as an array...

This causes DejaGNU to complain because the variable is first set as
non-array, and the used as an array.  The correct way to do this is to
unset the variable using:

  unset -nocomplain coredump_var_addr
  # use coredump_var_addr as an array...

The "-nocomplain" part is necessary because if the variable doesn't
exist "unset" will not error.

Tested on Fedora 20 x86_64.

gdb/testsuite/ChangeLog:
2015-05-08  Sergio Durigan Junior  <sergiodj@redhat.com>

	* gdb.base/coredump-filter.exp: Correctly unset
	"coredump_var_addr" array.
2015-05-08 13:19:19 -04:00
Joel Brobecker 519b5f619b libiberty/mkstemps.c: Include <time.h> if <sys/time.h> not available.
Attempting to build libiberty on LynxOS-178 fails trying to compile
mkstemps.c with the following error:

    mkstemps.c:84:18: error: storage size of 'tv' isn't known
       struct timeval tv;
                      ^

This file would normally include <sys/time.h> to get the type's
definition, but unfortunately LynxOS-178 does not want us to use
<sys/time.h>, only <time.h>. The configure script correctly finds
this out and generates a config.h file where HAVE_SYS_TIME_H is
undefined:

/* Define to 1 if you have the <sys/time.h> header file. */
/* #undef HAVE_SYS_TIME_H */

This patch fixes the build issue by falling back on including <time.h>
if <sys/time.h> could not be included (and provided that HAVE_TIME_H
is defined, of course).

libiberty/ChangeLog:

        * mkstemps.c: #include <time.h> if HAVE_TIME_H is defined
        but not HAVE_SYS_TIME_H.
2015-05-08 10:15:28 -07:00
Pedro Alves a4674e4efc Fix sequential gdb test runs
Sequential test runs are stopping prematurely like this:

 $ make check RUNTESTFLAGS="non-existing-program.exp server-exec-info.exp"

 Running /home/pedro/gdb/mygit/src/gdb/testsuite/gdb.server/non-existing-program.exp ...
 Running /home/pedro/gdb/mygit/src/gdb/testsuite/gdb.server/server-exec-info.exp ...
 can not find channel named "exp6"
     while executing
 "match_max [match_max -d]"
     (procedure "default_gdb_init" line 26)
     invoked from within
 "default_gdb_init $test_file_name"
     (procedure "gdb_init" line 83)
     invoked from within
 "${tool}_init $test_file_name"
     (procedure "runtest" line 18)
     invoked from within
 "runtest $test_name"
     ("foreach" body line 42)
     invoked from within
 ...
 make[2]: *** [check-single] Error 1
 make[2]: Leaving directory `/home/pedro/gdb/mygit/build/gdb/testsuite'
 make[1]: *** [check] Error 2
 make[1]: Leaving directory `/home/pedro/gdb/mygit/build/gdb/testsuite'
 make: *** [check] Error 2

default_gdb_init has this:

    # Unlike most tests, we have a small number of tests that generate
    # a very large amount of output.  We therefore increase the expect
    # buffer size to be able to contain the entire test output.  This
    # is especially needed by gdb.base/info-macros.exp.
    match_max -d 65536
    # Also set this value for the currently running GDB.
    match_max [match_max -d]

It's the second match_max that is erroring.  As that call does not
specify an explicit channel name with -i, expect defaults to
$spawn_id, which is pointing at a channel that is already gone.  (If
the spawn_id variable is not set, match_max defaults to
$user_spawn_id / stdin/out).

gdb/testsuite/ChangeLog:
2015-05-08  Pedro Alves  <palves@redhat.com>

	* gdb.server/non-existing-program.exp: Unset spawn_id.
2015-05-08 18:06:46 +01:00
Nick Clifton ae8714c271 Change ARM symbol name verification code so that it only triggers when the form "name = val" is used.
PR gas/18347
	* config/tc-arm.h (TC_EQUAL_IN_INSN): Define.
	* config/tc-arm.c (arm_tc_equal_in_insn): New function.  Move
	the symbol name checking code to here from...
	(md_undefined_symbo): ... here.
2015-05-08 17:28:26 +01:00
Jan Kratochvil dd9f02a0ca Remove unused declaration of print_return_value.
gdb/ChangeLog
2015-05-08  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* infcmd.c (print_return_value): Remove unused declaration.
2015-05-08 17:59:15 +02:00
Joel Brobecker 6ad395a7a6 Problem printing record with array whose upper bound is record component
Consider the following declarations...

  type Obj_T (Selected_Flights_Length : Natural) is
     record
      Selected_Flights : Flights.List.T (1 .. Selected_Flights_Length);
    end record;
  Broken : Obj_T;

... which defines a variable named "broken" which is a discrimated
record where broken.Selected_Flights is an array whose upper bound
is stored in the record's Selected_Flights_Length component.

Trying to print the value of that object currently fails:

    (gdb) print broken
    cannot find reference address for offset property

Looking at the debugging info, we see that variable "Broken" is
a reference...

 <1><8e3>: Abbrev Number: 21 (DW_TAG_const_type)
    <8e4>   DW_AT_type        : <0x8e8>
 <1><8e8>: Abbrev Number: 22 (DW_TAG_reference_type)
    <8e9>   DW_AT_byte_size   : 8
    <8ea>   DW_AT_type        : <0x7ec>

... to ...

 <1><7ec>: Abbrev Number: 12 (DW_TAG_structure_type)
    <7ed>   DW_AT_name        : (indirect string, offset: 0xc6d): reprod__obj_t
    <7f1>   DW_AT_decl_file   : 2
    <7f2>   DW_AT_decl_line   : 15
    <7f3>   DW_AT_GNAT_descriptive_type: <0x87e>
    <7f7>   DW_AT_sibling     : <0x87e>

... which has 2 members, the first one being the discriminant...

 <2><7fb>: Abbrev Number: 9 (DW_TAG_member)
    <7fc>   DW_AT_name        : (indirect string, offset: 0xc98): selected_flights_length
    <800>   DW_AT_decl_file   : 2
    <801>   DW_AT_decl_line   : 15
    <802>   DW_AT_type        : <0x807>
    <806>   DW_AT_data_member_location: 0

... and the second one being the one that causes trouble...

 <2><83d>: Abbrev Number: 9 (DW_TAG_member)
    <83e>   DW_AT_name        : (indirect string, offset: 0xd17): selected_flights
    <842>   DW_AT_decl_file   : 2
    <843>   DW_AT_decl_line   : 17
    <844>   DW_AT_type        : <0x815>
    <848>   DW_AT_data_member_location: 4

The second field's type is an array....

 <2><815>: Abbrev Number: 14 (DW_TAG_array_type)
    <816>   DW_AT_name        : (indirect string, offset: 0xd2f): reprod__obj_t__T5sP
    <81a>   DW_AT_GNAT_descriptive_type: <0x7e1>
    <81e>   DW_AT_type        : <0x748>
    <822>   DW_AT_sibling     : <0x830>

... whose uppper bound is a reference to <0x7fb>...

 <3><826>: Abbrev Number: 15 (DW_TAG_subrange_type)
    <827>   DW_AT_type        : <0x830>
    <82b>   DW_AT_upper_bound : <0x7fb>
 <3><82f>: Abbrev Number: 0

Because the upper bound is dynamic, we try to resolve it.
As it happens, the upper-bound resolution for this range type
works fine. What breaks is when we try to resolve this range
type's target type, which is:

        <2><830>: Abbrev Number: 16 (DW_TAG_subrange_type)
           <831>   DW_AT_upper_bound : <0x7fb>
           <835>   DW_AT_name        : (indirect string, offset: 0xc7b): reprod__obj_t__T4s___XDLU_1__selected_flights_length
           <839>   DW_AT_type        : <0x766>
           <83d>   DW_AT_artificial  : 1

It is actually pretty much the same as the first subrange type,
so you might ask why this is causing trouble, when the resolution
of the previous DIE worked like a charm???

Well, for that, we need to backtrack a bit, and notice that, ahead
of the DW_TAG_structure_type's DIE, there is the following DIE:

 <1><7e1>: Abbrev Number: 6 (DW_TAG_typedef)
    <7e2>   DW_AT_name        : (indirect string, offset: 0xbae): reprod__obj_t__T5s
    <7e6>   DW_AT_decl_file   : 2
    <7e7>   DW_AT_decl_line   : 17
    <7e8>   DW_AT_type        : <0x849>

... and that DIE references an array type...

 <2><849>: Abbrev Number: 14 (DW_TAG_array_type)
    <84a>   DW_AT_name        : (indirect string, offset: 0xbae): reprod__obj_t__T5s
    <84e>   DW_AT_GNAT_descriptive_type: <0x864>
    <852>   DW_AT_type        : <0x748>
    <856>   DW_AT_sibling     : <0x864>

... whose subrange is...

 <3><85a>: Abbrev Number: 15 (DW_TAG_subrange_type)
    <85b>   DW_AT_type        : <0x830>
    <85f>   DW_AT_upper_bound : <0x7fb>

... where the subrange's base type is the DW_TAG_subrange_type DIE
that is causing problem.

In summary, we process the typedef first, which causes us to process
the second subrange BEFORE we process the struct DIE itself, and
therefore the struct's discriminent (DW_TAG_member #1). As a result,
while trying to handle the reference to that DW_TAG_member #1 as
the upper bound of the second range type, we do...

          case DW_AT_data_member_location:
            {
              [...]
              baton->referenced_type = get_die_type (target_die->parent,
                                                     target_cu);

... where target_die->parent (DW_TAG_member #1) hasn't been processed
yet, and thus get_die_type returns NULL.

This is what later causes us problems trying to find the right address
to use as the base address for our field, which then triggers the
error message we are seeing.

This patch fixes the issue by calling read_type_die instead of
get_die_type.  If the DIE has already been processed, then this
is the same as get_die_type. If not, the it'll get the parent
die to be read, and then get its type.

gdb/ChangeLog:

        * dwarf2read.c (attr_to_dynamic_prop)
        <DW_AT_data_member_location>: Use read_type_die isntead of
        get_die_type.

Tested on x86_64-linux, no regression.

No testcase, unfortunately, as the reproducer was given to us by
a customer, and it's been otherwise surprisingly difficult to
reproduce the same error outside of that reproducer.
2015-05-08 08:57:33 -07:00
Joel Brobecker 8344af1e7b [Ada] error trying to call function when parameter is aligner type.
We observed on x86-windows that trying to call a function from
GDB leads to a mysterious "Invalid cast" error. This can be
observed in gdb.ada/float_param.exp:

   (gdb) call set_long_double(1, global_small_struct, 4.0)
   Invalid cast.

This happens because the 3rd parameter, a Long_Long_Float, is
actually passed wrapped inside a PAD structure. As documented
in GNAT's exp_dbug.ads, PAD types are simple wrappers that GNAT
uses to handle types with size or alignment constraints.

We already support those when printing an object encapsulated
in a PAD type, but not when trying to pass an argument that
is wrapped inside a PAD type.  As a result, what happens is that
call_function_by_hand ends up with an argument with a type
that looks incompatible with the expected type of the argument.
The error comes when trying to push the arguments in inferior
memory, while trying to coerce each one of them to their expected
types (in value_arg_coerce).

Note that the problem is not specific to Windows, but so far, this is
the only platform where we've seen this happen.

gdb/ChangeLog:

	* ada-lang.c (ada_convert_actual): Add handling of formals
	passed inside an aligner type.

Tested on x86-windows (AdaCore testsuite) and x86_64-linux (official
testsuite as well as AdaCore's testsuite).
2015-05-08 08:51:43 -07:00
Joel Brobecker 80b0912bff gdb/copyright.py: Remove sim/erc32 files from NOT_FSF_LIST.
Now that the erc32 files have been updated to contain an FSF copyright
header, these files should no longer be in the exclude list.

gdb/ChangeLog:

        * copyright.py (NOT_FSF_LIST): Remove sim/erc32 entries.
2015-05-08 07:24:13 -07:00
Joel Brobecker 17d88f73c0 Switch erc32 simulator copyright headers to FSF.
Permission was granted by Jiri Gaisler, who has a copyright assignment
on file for GDB.

sim/erc32/ChangeLog:

        * configure.ac: Add copyright header.
        * erc32.c: Change copyright holder to FSF.  Reformat.
        * exec.c, float.c, func.c, interf.c, sis.c, sis.h: Likewise.
        * help.c, startsim: Add copyright header.
2015-05-08 07:23:15 -07:00
Siva Chandra df2eb078c0 [PR python/18291] Fix printing of "disabled" status of xmethod matchers.
gdb/ChangeLog:

	PR python/18291
	* python/lib/gdb/command/xmethods.py (print_xm_info): Fix typo.
	Print xmethod matcher status.

gdb/testsuite/ChangeLog:

	PR python/18291
	* gdb.python/py-xmethods.exp: Add tests.
2015-05-08 07:20:04 -07:00
H.J. Lu 573cc2e57d Add -mno-shared to x86 assembler
On ELF target, the assembler normally generates code which can go into a
shared library where non-weak symbols can be preempted.  The -mno-shared
option tells the assembler to generate code not for a shared library,
where non-weak symbols won't be preempted.  The resulting code is slightly
smaller.  This option mainly affects the handling of branch instructions.

gas/

	* config/tc-i386.c (no_shared): New.
	(OPTION_MNO_SHARED): Likewise.
	(elf_symbol_resolved_in_segment_p): Check no_shared.
	(md_longopts): Add mno-shared.
	(md_parse_option): Handle OPTION_MNO_SHARED.
	(md_show_usage): Add -mno-shared.
	* doc/c-i386.texi: Document -mno-shared.

gas/testsuite/

	* gas/i386/i386.exp: Run relax-4 and x86-64-relax-3.
	* gas/i386/relax-4.d: New file.
	* gas/i386/x86-64-relax-3.d: Likewise.
2015-05-08 05:05:49 -07:00
Yao Qi 422349a385 Fix PR 18208: update /proc/pid/coredump_filter by c code
Hi,
We see some fails in gdb.base/coredump-filter.exp when we do remote
gdbserver testing, like what I did for arm/aarch64 linux testing or
run it with board file remote-gdbserver-on-localhost

 $ make check RUNTESTFLAGS='--target_board=remote-gdbserver-on-localhost coredump-filter.exp'

we find that this line in the test doesn't work as expected,

 remote_exec target "sh -c \"echo $filter_flag > /proc/$ipid/coredump_filter\""

although such pattern has been used in gdb testsuite somewhere else,
but the special thing here is that we redirect the output to
/proc/$ipid/coredump_filter on the remote target.  DejaGNU will
redirect the output from the remote target to local, and looks tcl
gets confused by these two redirection.

After trying pass different parameters to remote_exec and hacking
remote_exec/rsh_exec/local_exec, I got no success, I decide
to give up, and try to update /proc/$ipid/coredump_filter by the c
code directly.

This patch adds a c function set_coredump_filter to update
coredump_filter, and GDB calls it.

gdb/testsuite:

2015-05-08  Yao Qi  <yao.qi@linaro.org>

	PR gdb/18208
	* gdb.base/coredump-filter.c (set_coredump_filter): New function.
	* gdb.base/coredump-filter.exp (do_save_core): Call inferior
	function set_coredump_filter, and remove remote_exec call.
	Remove argument ipid.  Callers update.
	(top level): Don't get inferior's PID.
2015-05-08 12:37:48 +01:00
Yao Qi 45614f1534 [gdbserver] Disable conditional breakpoints on no-hardware-single-step targets
GDBserver steps over breakpoint if the condition is false, but if target
doesn't support hardware single step, the step over is very simple, if
not incorrect, in linux-arm-low.c:

/* We only place breakpoints in empty marker functions, and thread locking
   is outside of the function.  So rather than importing software single-step,
   we can just run until exit.  */
static CORE_ADDR
arm_reinsert_addr (void)
{
  struct regcache *regcache = get_thread_regcache (current_thread, 1);
  unsigned long pc;
  collect_register_by_name (regcache, "lr", &pc);
  return pc;
}

and linux-mips-low.c does the same.  GDBserver sets a breakpoint at the
return address of the current function, resume and wait the program hits
the breakpoint in order to achieve "breakpoint step over".  What if
program hits other user breakponits during this "step over"?

It is worse if the arm/thumb interworking is considered.  Nowadays,
GDBserver arm backend unconditionally inserts arm breakpoint,

  /* Define an ARM-mode breakpoint; we only set breakpoints in the C
     library, which is most likely to be ARM.  If the kernel supports
     clone events, we will never insert a breakpoint, so even a Thumb
     C library will work; so will mixing EABI/non-EABI gdbserver and
     application.  */
  (const unsigned char *) &arm_breakpoint,
  (const unsigned char *) &arm_eabi_breakpoint,

note that the comments are no longer valid as C library can be compiled
in thumb mode.

When GDBserver steps over a breakpoint in arm mode function, which
returns to thumb mode, GDBserver will insert arm mode breakpoint by
mistake and the program will crash.  GDBserver alone is unable to
determine the arm/thumb mode given a PC address.  See how GDB does
it in arm-tdep.c:arm_pc_is_thumb.

After thinking about how to teach GDBserver inserting right breakpoint
(arm or thumb) for a while, I reconsider it from a different direction
that it may be unreasonable to run target-side conditional breakpoint for
targets without hardware single step.  Pedro also pointed this out here
https://sourceware.org/ml/gdb-patches/2015-04/msg00337.html

This patch is to add a new target_ops hook
supports_conditional_breakpoints, and only reply
";ConditionalBreakpoints+" if it is true.  On linux targets,
supports_conditional_breakpoints returns true if target has hardware
single step, on other targets, (win32, lynx, nto, spu), set it to NULL,
because conditional breakpoint is a linux-specific feature.

gdb/gdbserver:

2015-05-08  Yao Qi  <yao.qi@linaro.org>

	* linux-low.c (linux_supports_conditional_breakpoints): New
	function.
	(linux_target_ops): Install new target method.
	* lynx-low.c (lynx_target_ops): Install NULL hook for
	supports_conditional_breakpoints.
	* nto-low.c (nto_target_ops): Likewise.
	* spu-low.c (spu_target_ops): Likewise.
	* win32-low.c (win32_target_ops): Likewise.
	* server.c (handle_query): Check
	target_supports_conditional_breakpoints.
	* target.h (struct target_ops) <supports_conditional_breakpoints>:
	New field.
	(target_supports_conditional_breakpoints): New macro.
2015-05-08 12:29:13 +01:00
Andreas Arnez 2492f0d005 S390: Fix for inadvertently setting 24-bit mode in fill_gregset
On 64-bit S390 platforms, for programs compiled with -m31, it could
happen that GDB inadvertently cleared the inferior's 31-bit addressing
mode bit and left the inferior running in 24-bit addressing mode.  In
particular this occurred with checkpoint.exp, when the "restore"
command needed to create a new regcache copy: At the time when the
PSWM register was copied over, the addressing mode bit was taken from
the PSWA register, which was still zero since it had not been copied
yet.  And when the PSWA register was copied, the addressing mode was
not updated again.

The fix affects fill_gregset, where the bits "belonging" to each of
the PSWA and PSWM registers are now carefully separated.  The
addressing mode bit is no longer touched when writing PSWM, and --
more importantly -- it *is* written when writing PSWA.

gdb/ChangeLog:

	* s390-linux-nat.c (fill_gregset): Avoid relying on the PSWA
	register in the regcache when treating the PSWM register, and vice
	versa.
2015-05-08 12:50:47 +02:00
Andreas Arnez 63fc80ce17 Skip watch_thread_num.exp on targets without access watchpoints
Since watch_thread_num.exp was changed to use access watchpoints, the
test case fails on s390 and s390x, since those targets do not support
access watchpoints.  This patch skips the test case on such targets.

gdb/testsuite/ChangeLog:

	* gdb.base/watch_thread_num.exp: Skip test on targets without
	access watchpoints.
2015-05-08 12:50:47 +02:00
GDB Administrator 7a261c91c8 Automatic date update in version.in 2015-05-08 00:00:08 +00:00
H.J. Lu b084df0b8d Optimize branches to non-weak symbols with visibility
Branches to global non-weak symbols defined in the same segment with
non-default visibility can be optimized the same way as branches to
local symbols.

gas/

	* config/tc-i386.c (elf_symbol_resolved_in_segment_p): New.
	(md_estimate_size_before_relax): Use it.

gas/testsuite/

	* gas/i386/i386.exp: Run relax-3 and x86-64-relax-2.
	* gas/i386/relax-3.d: New file.
	* gas/i386/relax-3.s: Likewise.
	* gas/i386/x86-64-relax-2.d: Likewise.
2015-05-07 09:19:16 -07:00
Gary Benson 1c56a84d9b Remove unused td_ta_map_id2thr code
linux-thread-db.c initializes td_ta_map_id2thr but never uses it.
This commit removes this dead code.

gdb/ChangeLog:

	* linux-thread-db.c (struct thread_db_info)
	<td_ta_map_id2thr_p>: Remove field.
	(try_thread_db_load_1): Remove initialization for the above.
2015-05-07 15:41:43 +01:00
Gary Benson 74850322e4 Remove unused td_thr_validate code
linux-thread-db.c initializes td_thr_validate but never uses it.
This commit removes this dead code.

gdb/ChangeLog:

	* linux-thread-db.c (struct thread_db_info)
	<td_thr_validate_p>: Remove field.
	(try_thread_db_load_1): Remove initialization for the above.
2015-05-07 14:52:59 +01:00
GDB Administrator 187032dbb8 Automatic date update in version.in 2015-05-07 00:00:08 +00:00
Jan Kratochvil e26efa4066 compile: Support relocation to GNU-IFUNCs
Calling memcpy() could fail as memcpy() from libc is GNU-IFUNC.

gdb/ChangeLog
2015-05-06  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* compile/compile-object-load.c (compile_object_load): Support
	mst_text_gnu_ifunc.
2015-05-06 20:59:19 +02:00
Jan Kratochvil 851c90917f Code cleanup: compile: Constify some parameters
gdb/ChangeLog
2015-05-06  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* compile/compile.c (compile_to_object): Make the cmd_string parameter
	const.  Use new variables for the const compatibility.
	(eval_compile_command): Make the cmd_string parameter const.
	* compile/compile.h (eval_compile_command): Make the cmd_string
	parameter const.
2015-05-06 20:57:41 +02:00
Pedro Alves 80ad801e90 PR server/18081: gdbserver crashes when providing an unexisting binary
$ ./gdbserver :1234 blah
 Process blah created; pid = 16471
 Cannot exec blah: No such file or directory.

 Child exited with status 127
 Killing process(es): 16471
 ../../../../src/binutils-gdb/gdb/gdbserver/linux-low.c:920: A problem internal to GDBserver has been detected.
 kill_wait_lwp: Assertion `res > 0' failed.

GDBserver shouldn't even be trying to kill that process.  GDBserver
kills or detaches from all processes on exit, and due to a missing
mourn_inferior call, GDBserver tries to kill the process that it had
already seen exit.

Tested on x86_64 Fedora 20.  New test included.  I emulated what
Windows outputs by hacking an error call in linux_create_inferior.

gdb/gdbserver/ChangeLog:
2015-05-06  Pedro Alves  <palves@redhat.com>

	PR server/18081
	* server.c (start_inferior): If the process exits, mourn it.

gdb/testsuite/ChangeLog:
2015-05-06  Pedro Alves  <palves@redhat.com>

	PR server/18081
	* gdb.server/non-existing-program.exp: New file.
2015-05-06 18:50:03 +01:00
Joel Brobecker f218b647aa Get rid of deprecated_init_ui_hook
This hook is no longer used, and can therefore be eliminated.

gdb/ChangeLog:

        * defs.h (deprecated_init_ui_hook): Delete.  Remove associated
        comment.
        * top.c (deprecated_init_ui_hook): Delete.
        (gdb_init): Remove handling of deprecated_init_ui_hook.
        * interps.c (clear_interpreter_hooks): Remove handling of
        deprecated_init_ui_hook.
        * main.c (captured_main): Update comment.
2015-05-06 10:48:59 -07:00
Joel Brobecker b30a0bc387 Make the "info dll" command available on all platform.
The "info dll", an alias of the "info sharedlibrary" command, is
currently only defined in windows native versions. This patch makes
it universally available by moving the alias declaration to solib.c,
and adjusts the documentation accordingly.

Making it universally available has two benefits:
  - Windows users moving to a Unix platforms are still able to use
    the same command for getting the list of shared libraries;
  - Unix to Windows cross debuggers now provide that command also.

gdb/ChangeLog:

        * solib.c (_initialize_solib): Add "info dll" alias creation.
        * windows-nat.c (set_windows_aliases): Delete.
        (_initialize_windows_nat): Remove deprecated_init_ui_hook
        assignment.
        * NEWS: Add news entry about "info dll" now being available
        on all platforms.

gdb/doc/ChangeLog:

        * gdb.texinfo (Files): Add "info dll" documentation.
        (Cygwin Native): Remove "info dll" documentation.
2015-05-06 10:47:20 -07:00
Jose E. Marchesi 0d495746bb gas: typo in comment fixed.
gas/ChangeLog:

2015-05-06  Jose E. Marchesi  <jose.marchesi@oracle.com>

	* config/tc-sparc.c: Typo in comment fixed.
2015-05-06 09:28:22 -07:00
Jose E. Marchesi 9e85c798e3 gas: added tests for the sparc natural instructions.
gas/ChangeLog:

2015-05-06  Jose E. Marchesi  <jose.marchesi@oracle.com>

	* gas/sparc/natural-32.d: Test ldn, ldna, stn, stna, slln, srln,
	sran, casn, casna and clrn.
	* gas/sparc/natural-32.s: Likewise.
	* gas/sparc/natural.s: Likewise.
	* gas/sparc/natural.d: Likewise.
2015-05-06 09:27:52 -07:00
Jose E. Marchesi f9911bebca gas: support for the sparc %ncc condition codes register.
gas/ChangeLog:

2015-05-06  Jose E. Marchesi  <jose.marchesi@oracle.com>

	* config/tc-sparc.c (sparc_ip): Support the %ncc "natural"
	condition codes
	* doc/c-sparc.texi (Sparc-Regs): Document %ncc.

gas/testsuite/ChangeLog:

2015-05-06  Jose E. Marchesi  <jose.marchesi@oracle.com>

	* gas/sparc/natural.s: New file.
	* gas/sparc/natural-32.s: Likewise.
	* gas/sparc/natural.d: Likewise.
	* gas/sparc/natural-32.d: Likewise.
	* gas/sparc/sparc.exp (sparc_elf_setup): Run the tests natural and
	natural-32.
2015-05-06 09:26:23 -07:00
Toni Spets 9ac47a43ff Skip discarded resource sections when building a PE resource table.
PR ld/18372
	* peXXigen.c (rsrc_process_section): Skip discarded resource
	sections.
2015-05-06 14:18:34 +01:00