Commit Graph

83711 Commits

Author SHA1 Message Date
H.J. Lu 00923338de Remove i386_elf_emit_arch_note
This x86 assembler patch:

https://sourceware.org/ml/binutils/2001-11/msg00344.html

generates a .note section for .arch directive so that GDB can tell which
architecture an i386 binary belongs:

https://sourceware.org/ml/binutils/2001-11/msg00271.html

However, x86 assembly code can have any instructions.  A .note section
doesn't help.  This patch removes it.

gas/

	* config/tc-i386.c (i386_elf_emit_arch_note): Removed.
	* config/tc-i386.h (md_end): Likewise.
	(i386_elf_emit_arch_note): Likewise.

gas/testsuite/

	* gas/i386/i386.exp: Run note.
	* gas/i386/note.d: New file.
	* gas/i386/note.s: Likewise.
2015-05-01 08:29:16 -07:00
H.J. Lu b633b7258d Support ix86-*-elf*
bfd/

	* config.bfd: Support i[3-7]86-*-elf*.

gas/

	* configure.tgt: Support i386-*-elf*.
2015-05-01 05:02:30 -07:00
GDB Administrator d6ad735147 Automatic date update in version.in 2015-05-01 00:00:08 +00:00
DJ Delorie 0952813b0b Make RL78 disassembler and simulator respect ISA for mul/div
[gas]
	* config/rl78-defs.h (rl78_isa_g10): New.
	(rl78_isa_g13): New.
	(rl78_isa_g14): New.
	* config/rl78-parse.y (ISA_G10): New.
	(ISA_G13): New.
	(ISA_G14): New.
	(MULHU, MULH, MULU, DIVHU, DIVWU, MACHU, MACH): Use them.
	* config/tc-rl78.c (rl78_isa_g10): New.
	(rl78_isa_g13): New.
	(rl78_isa_g14): New.

[gdb]
	* rl78-tdep.c (rl78_analyze_prologue): Pass RL78_ISA_DEFAULT to
	rl78_decode_opcode

[include]
	* dis-asm.h (print_insn_rl78_g10): New.
	(print_insn_rl78_g13): New.
	(print_insn_rl78_g14): New.
	(rl78_get_disassembler): New.
	* opcode/rl78.h (RL78_Dis_Isa): New.
	(rl78_decode_opcode): Add ISA parameter.

[opcodes]
	* disassemble.c (disassembler): Choose suitable disassembler based
	on E_ABI.
	* rl78-decode.opc (rl78_decode_opcode): Take ISA parameter.  Use
	it to decode mul/div insns.
	* rl78-decode.c: Regenerate.
	* rl78-dis.c (print_insn_rl78): Rename to...
	(print_insn_rl78_common): ...this, take ISA parameter.
	(print_insn_rl78): New.
	(print_insn_rl78_g10): New.
	(print_insn_rl78_g13): New.
	(print_insn_rl78_g14): New.
	(rl78_get_disassembler): New.

[sim]
	* rl78/cpu.c (g14_multiply): New.
	* rl78/cpu.h (g14_multiply): New.
	* rl78/load.c (rl78_load): Decode ISA completely.
	* rl78/main.c (main): Expand -M to include other ISAs.
	* rl78/rl78.c (decode_opcode): Decode based on ISA.
	* rl78/trace.c (rl78_disasm_fn): New.
	(sim_disasm_init): Reset it.
	(sim_disasm_one): Get correct disassembler for ISA.
2015-04-30 15:25:49 -04:00
H.J. Lu b49f93f699 Use "else if" on cpu_arch_isa
* config/tc-i386.c (i386_target_format): Use "else if" on
	cpu_arch_isa.
2015-04-30 08:36:17 -07:00
Nick Clifton 153a27763c Fix handling of relocs for the MeP target.
bfd	PR 18317
	* elf32-mep.c (MEPREL): Use bfd_elf_generic_reloc instead of
	mep_reloc.
	(mep_reloc): Delete unused function.

bin	* readelf.c (get_machine_flags): Add description of MeP flags.

tests	* binutils-all/objdump.exp (cpus_expected): Add MeP CPU names.
2015-04-30 15:57:41 +01:00
H.J. Lu 914082d11b Undef elf_backend_post_process_headers for Solaris
* elf32-i386.c (elf_backend_post_process_headers): Undef for
	Solaris 2.
2015-04-30 06:52:34 -07:00
Nick Clifton 8b2d793ce5 GAS ARM: Warn if the user creates a symbol with the same name as an instruction.
PR gas/18347
gas	* config/tc-arm.c (md_undefined_symbol): Issue a warning message
	(if enabled) when the user creates a symbol with the same name as
	an ARM instruction.
	(flag_warn_syms): New static variable.
	(arm_opts): Add mwarn-syms and mno-warn-syms.
	* doc/c-arm.texi (ARM Options): Document the -m[no-]warn-syms
	options.

tests	* gas/arm/pr18347.s: New file: Test case.
	* gas/arm/pr18347.l: New file: Expected assembler output.
	* gas/arm/pr18347.d: New file: Test driver.
2015-04-30 11:17:55 +01:00
Nick Clifton 7ce98c164e Adds documentation of GAS's .zero directive.
PR gas/18353
	* doc/as.texinfo (Zero): Add documentation of the .zero pseudo-op.
2015-04-30 10:13:53 +01:00
Yao Qi 5fccc63539 Skip setting HW watchpoint if skip_hw_watchpoint_multi_tests in gdb.base/break-idempotent.exp
Hi,
I see this fails below on arm linux native testing and remote testing
with "set remote hardware-watchpoint-limit 1",

 rwatch global^M
 There are not enough available hardware resources for this watchpoint.^M
 (gdb) FAIL: gdb.base/break-idempotent.exp: always-inserted off: rwatch: twice: rwatch global

gdb.base/break-idempotent.exp sets two breakpoints/watchpoints on the
same address.  GDB isn't smart enough calculate these two HW
watchpoints can fit in one HW debug register, so the error message
above isn't necessary (there is one HW watchpoint register on arm).
Because target_ops interface can_use_hardware_watchpoint doesn't
pass enough information to the target backend.

Note that if I don't "set remote hardware-watchpoint-limit 1" in
remote testing, this test passes without fails.  However without
"set remote hardware-watchpoint-limit 1", many other watchpoint
tests fail.

This patch is to add a check to skip_hw_watchpoint_multi_tests
for rwatch and awatch.  We can add such check for watch as well,
but GDB is able to switch to software watchpoint if HW resource
isn't available, it doesn't cause any fail, I decide not to skip.

gdb/testsuite:

2015-04-30  Yao Qi  <yao.qi@linaro.org>

	* gdb.base/break-idempotent.exp: If
	skip_hw_watchpoint_multi_tests returns true, skip the tests
	on "rwatch" and "awatch".
2015-04-30 10:08:10 +01:00
Yao Qi 42d38f42dc Skip gdb.base/relativedebug.exp if libc doesn't have debug info
Hi,
I see the fail in gdb.base/relativedebug.exp on aarch64 box on which
glibc doesn't have debug info,

 bt^M
 #0 0x0000002000061a88 in raise () from /lib/aarch64-linux-gnu/libc.so.6^M
 #1 0x0000002000064efc in abort () from /lib/aarch64-linux-gnu/libc.so.6^M
 #2 0x0000000000400640 in handler (signo=14) at ../../../binutils-gdb/gdb/testsuite/gdb.base/relativedebug.c:25^M
 #3 <signal handler called>^M
 #4 0x00000020000cc478 in ?? () from /lib/aarch64-linux-gnu/libc.so.6^M
 #5 0x0000000000400664 in main () at ../../../binutils-gdb/gdb/testsuite/gdb.base/relativedebug.c:32^M
 (gdb) FAIL: gdb.base/relativedebug.exp: pause found in backtrace

if glibc has debug info, this test doesn't fail.

In sysdeps/unix/sysv/linux/generic/pause.c, __libc_pause calls
__syscall_pause,

  static int
  __syscall_pause (void)
  {
    sigset_t set;

    int rc =
      INLINE_SYSCALL (rt_sigprocmask, 4, SIG_BLOCK, NULL, &set, _NSIG / 8);
    if (rc == 0)
      rc = INLINE_SYSCALL (rt_sigsuspend, 2, &set, _NSIG / 8);

    return rc;
  }

  int
  __libc_pause (void)
  {
    if (SINGLE_THREAD_P)
      return __syscall_pause ();     <--- tail call

    int oldtype = LIBC_CANCEL_ASYNC ();

    int result = __syscall_pause ();

    LIBC_CANCEL_RESET (oldtype);

    return result;
  }

and GDB unwinder is confused by the GCC optimized code,

(gdb) disassemble pause
Dump of assembler code for function pause:
   0x0000007fb7f274c4 <+0>:     stp     x29, x30, [sp,#-32]!
   0x0000007fb7f274c8 <+4>:     mov     x29, sp
   0x0000007fb7f274cc <+8>:     adrp    x0, 0x7fb7fd2000
   0x0000007fb7f274d0 <+12>:    ldr     w0, [x0,#364]
   0x0000007fb7f274d4 <+16>:    stp     x19, x20, [sp,#16]
   0x0000007fb7f274d8 <+20>:    cbnz    w0, 0x7fb7f274e8 <pause+36>

   0x0000007fb7f274dc <+24>:    ldp     x19, x20, [sp,#16]
   0x0000007fb7f274e0 <+28>:    ldp     x29, x30, [sp],#32
   0x0000007fb7f274e4 <+32>:    b       0x7fb7f27434    <---- __syscall_pause

   0x0000007fb7f274e8 <+36>:    bl      0x7fb7f5e080

Note that the program stops in __syscall_pause, but its symbol is
stripped in glibc, so GDB doesn't know where the program stops.
__syscall_pause is a tail call in __libc_pause, so it returns to main
instead of __libc_pause.  As a result, the backtrace is like,

 #0  0x0000007fb7ebca88 in raise () from /lib/aarch64-linux-gnu/libc.so.6
 #1  0x0000007fb7ebfefc in abort () from /lib/aarch64-linux-gnu/libc.so.6
 #2  0x0000000000400640 in handler (signo=14) at ../../../binutils-gdb/gdb/testsuite/gdb.base/relativedebug.c:25
 #3  <signal handler called>
 #4  0x0000007fb7f27478 in ?? () from /lib/aarch64-linux-gnu/libc.so.6   <-- [in __syscall_pause]
 #5  0x0000000000400664 in main () at ../../../binutils-gdb/gdb/testsuite/gdb.base/relativedebug.c:32

looks GDB does nothing wrong here.  I looked back at the test case
gdb.base/relativedebug.exp, which was added
https://sourceware.org/ml/gdb-patches/2006-10/msg00305.html
This test was indented to test the problem that "backtraces no longer
display some libc functions" after separate debug info is installed.
IOW, it makes few sense to test against libc which doesn't have debug
info at all, such as my case.

This patch is to tweak the test case to catch the output of
"info shared", if "(*)" is found for libc.so, which means libc doesn't
have debug info, then skip the test.

gdb/testsuite:

2015-04-30  Yao Qi  <yao.qi@linaro.org>

	* gdb.base/relativedebug.exp: Invoke gdb command
	"info sharedlibrary", and if libc.so doesn't have debug info,
	skip the test.
2015-04-30 09:55:06 +01:00
GDB Administrator 97bf273d5d Automatic date update in version.in 2015-04-30 00:00:08 +00:00
Doug Evans 2ce1cdbf84 PR python/18285
gdb/ChangeLog:

	PR python/18285
	* NEWS: Document new gdb.XMethodWorker.get_result_type method.
	* eval.c (evaluate_subexp_standard) <OP_FUNCALL>: Handle
	EVAL_AVOID_SIDE_EFFECTS for xmethods.
	* extension-priv.h (struct extension_language_ops)
	<get_xmethod_result_type>: New member.
	* extension.c (get_xmethod_result_type): New function.
	* extension.h (get_xmethod_result_type): Declare.
	* python/py-xmethods.c (get_result_type_method_name): New static
	global.
	(py_get_result_type_method_name): Ditto.
	(gdbpy_get_xmethod_result_type): New function.
	(gdbpy_initialize_xmethods): Initialize py_get_result_type_method_name.
	* python/python-internal.h (gdbpy_get_xmethod_result_type): Declare.
	* python/python.c (python_extension_ops): Add
	gdbpy_get_xmethod_result_type.
	* python/lib/gdb/xmethod.py (XMethodWorker): Add get_result_type.
	* valarith.c (value_x_binop): Handle EVAL_AVOID_SIDE_EFFECTS for
	xmethods.
	(value_x_unop): Ditto.
	* value.c (result_type_of_xmethod): New function.
	* value.h (result_type_of_xmethod): Declare.

gdb/testsuite/ChangeLog:

	* gdb.python/py-xmethods.exp: Add ptype tests.
	* gdb.python/py-xmethods.py (E_method_char_worker): Add
	get_result_type method.

gdb/doc/ChangeLog:

	* python.texi (Xmethod API) <gdb.XMethodWorker.get_result_type>:
	Document.
	(Writing an Xmethod): Add get_result_type to example.
2015-04-29 13:24:21 -07:00
Nick Clifton 99b2a2dd3c Fix an internal error in GAS when assembling a bogus piece of source code.
gas	PR 18256
	* config/tc-arm.c (encode_arm_cp_address): Issue an error message
	if the operand is neither a register nor a vector.

tests	* gas/arm/pr18256.s: New file: Test case.
	* gas/arm/pr18256.l: New file: Expected assembler output.
	* gas/arm/pr18256.d: New file: Test driver.
2015-04-29 17:09:05 +01:00
H.J. Lu 43c1d34c31 Link the last *normal against libfoozlib.so
Link the last zlibnormal gnunormal and gabinormal against libfoozlib.so
so that their only differences are DWARF debug sections.

	PR ld/18354
	* ld-elf/compress.exp (run_tests): Link the last zlibnormal,
	gnunormal and gabinormal against libfoozlib.so.
2015-04-29 08:43:22 -07:00
H.J. Lu 716f14132a Fix 18354 2015-04-29 08:40:31 -07:00
Nick Clifton f9d3ecaa78 Updated translations for various binutils components.
gold	* po/fi.po: Updated Finnish translation.

opcodes	* po/fr.po: Updated French translation.

gprof	* po/da.po: Update Danish translation.
2015-04-29 16:26:14 +01:00
Luis Machado f24a38c514 Use software watchpoints if hardware watchpoints are not available when testing gdb.base/watch-bitfields.exp
There are targets GDB thinks support hardware watchpoints, but in reality they
don't.  Though it may seem that hardware watchpoint creation was successful,
the actual insertion of such watchpoint will fail when GDB moves the inferior.

(gdb) watch -location q.a^M
Hardware watchpoint 2: -location q.a^M
(gdb) PASS: gdb.base/watch-bitfields.exp: -location watch against bitfields: watch -location q.a
watch -location q.e^M
Hardware watchpoint 3: -location q.e^M
(gdb) PASS: gdb.base/watch-bitfields.exp: -location watch against bitfields: watch -location q.e
print q.a^M
$1 = 0^M
(gdb) PASS: gdb.base/watch-bitfields.exp: -location watch against bitfields: q.a: 0->1: print expression before
continue^M
Continuing.^M
Warning:^M
Could not insert hardware watchpoint 2.^M
Could not insert hardware watchpoint 3.^M
Could not insert hardware breakpoints:^M
You may have requested too many hardware breakpoints/watchpoints.^M
^M
(gdb) FAIL: gdb.base/watch-bitfields.exp: -location watch against bitfields: q.a: 0->1: continue

This leads to a number of FAILs:

FAIL: gdb.base/watch-bitfields.exp: -location watch against bitfields: q.a: 0->1: continue
FAIL: gdb.base/watch-bitfields.exp: -location watch against bitfields: q.a: 0->1: print expression after
FAIL: gdb.base/watch-bitfields.exp: -location watch against bitfields: q.e: 0->5: continue
FAIL: gdb.base/watch-bitfields.exp: -location watch against bitfields: q.e: 0->5: print expression after
FAIL: gdb.base/watch-bitfields.exp: -location watch against bitfields: q.a: 1->0: print expression before
FAIL: gdb.base/watch-bitfields.exp: -location watch against bitfields: q.a: 1->0: continue
FAIL: gdb.base/watch-bitfields.exp: -location watch against bitfields: q.e: 5->4: print expression before
FAIL: gdb.base/watch-bitfields.exp: -location watch against bitfields: q.e: 5->4: continue
FAIL: gdb.base/watch-bitfields.exp: -location watch against bitfields: q.e: 5->4: print expression after
FAIL: gdb.base/watch-bitfields.exp: -location watch against bitfields: continue until exit
FAIL: gdb.base/watch-bitfields.exp: regular watch against bitfields: q.d + q.f + q.g: 0->4: continue
FAIL: gdb.base/watch-bitfields.exp: regular watch against bitfields: q.d + q.f + q.g: 0->4: print expression after
FAIL: gdb.base/watch-bitfields.exp: regular watch against bitfields: q.d + q.f + q.g: 4->10: print expression before
FAIL: gdb.base/watch-bitfields.exp: regular watch against bitfields: q.d + q.f + q.g: 4->10: continue
FAIL: gdb.base/watch-bitfields.exp: regular watch against bitfields: q.d + q.f + q.g: 4->10: print expression after
FAIL: gdb.base/watch-bitfields.exp: regular watch against bitfields: q.d + q.f + q.g: 10->3: print expression before
FAIL: gdb.base/watch-bitfields.exp: regular watch against bitfields: q.d + q.f + q.g: 10->3: continue
FAIL: gdb.base/watch-bitfields.exp: regular watch against bitfields: q.d + q.f + q.g: 10->3: print expression after
FAIL: gdb.base/watch-bitfields.exp: regular watch against bitfields: q.d + q.f + q.g: 3->2: print expression before
FAIL: gdb.base/watch-bitfields.exp: regular watch against bitfields: q.d + q.f + q.g: 3->2: continue
FAIL: gdb.base/watch-bitfields.exp: regular watch against bitfields: q.d + q.f + q.g: 3->2: print expression after
FAIL: gdb.base/watch-bitfields.exp: regular watch against bitfields: q.d + q.f + q.g: 2->1: print expression before
FAIL: gdb.base/watch-bitfields.exp: regular watch against bitfields: q.d + q.f + q.g: 2->1: continue
FAIL: gdb.base/watch-bitfields.exp: regular watch against bitfields: q.d + q.f + q.g: 2->1: print expression after
FAIL: gdb.base/watch-bitfields.exp: regular watch against bitfields: q.d + q.f + q.g: 1->0: print expression before
FAIL: gdb.base/watch-bitfields.exp: regular watch against bitfields: q.d + q.f + q.g: 1->0: continue
FAIL: gdb.base/watch-bitfields.exp: regular watch against bitfields: continue until exit

We can avoid these errors/FAILs by checking the board data and switching to
software watchpoints if the board does not support hardware watchpoints.

gdb/testsuite/ChangeLog:

2015-04-29  Luis Machado  <lgustavo@codesourcery.com>

	* gdb.base/watch-bitfields.exp: Switch to software watchpoints if
	the target does not support hardware watchpoints.
2015-04-29 12:22:24 -03:00
Luis Machado ecbf2b3c4f Handle memory write errors on gdb.base/break-always.exp
This is another case of the testcase not handling memory write errors that
happen on some targets (QEMU) when GDB attempts to modify an address that
should contain a breakpoint, for example.

The following patch handles this and prevents spurious failures from
happening. It also adds a foreach loop to avoid duplication of code
and hardcoded patterns.

gdb/testsuite/ChangeLog:

2015-04-29  Luis Machado  <lgustavo@codesourcery.com>

	* gdb.base/break-always.exp: Abort testing if writing to memory
	causes an error.
2015-04-29 12:09:40 -03:00
Nick Clifton 0a13382c8e Fix problems in the sim sources discovered by running the cppcheck static analysis tool.
erc32	PR 18273
	* sis.c (main): Remove unreachable code.

m68hc11	* gencode.c (gen_fetch_operands): Remove unreachable code.

ppc	* hw_htab.c (htab_map_binary): Fix overlap check.

common	* sim-fpu.c (INLINE_SIM_FPU): Fix static analysis warning by
	increasing parenthesis around casts to signed values.
2015-04-29 16:02:02 +01:00
Gary Benson 998d2a3ef3 Allow passing fd == NULL to exec_file_find and solib_find
This commit allows NULL to be passed as the int *fd argument
to exec_file_find and solib_find to simplify use cases where
the caller does not require the file to be opened.

gdb/ChangeLog:

	* solib.c (solib_find_1): Allow fd argument to be NULL.
	(exec_file_find): Update comment.
	(solib_find): Likewise.
	* exec.c (exec_file_locate_attach): Use NULL as fd
	argument to exec_file_find to avoid having to close
	the opened file.
	* infrun.c (follow_exec): Likewise.
2015-04-29 15:20:22 +01:00
Nick Clifton a93d5cb197 Add support for absolute PE/x86 relocations.
PR 17099
	* coff-i386.c (coff_i386_rtype_to_howto): Allow absolute PCRLONG
	relocs.
2015-04-29 12:26:46 +01:00
Nick Clifton 5d239759c0 Updates the description of GAS's .set directive, to note that for some targets a symbolic value can only be set once.
* doc/as.texinfo (Set): Note that a symbol cannot be set multiple
	times if the expression is not constant and the target uses linker
	relaxation.
2015-04-29 11:10:45 +01:00
Jiong Wang 9081b64dc1 [ARM] Update ld testcases
2015-04-29  Renlin Li  <renlin.li@arm.com>
ld/testsuite/
  * ld-arm/ifunc-10.dd: Adjust expected output.
  * ld-arm/ifunc-2.dd: Likewise.
2015-04-29 11:04:17 +01:00
Doug Evans 34f5f757b3 PR python/18299
gdb/ChangeLog:

	PR python/18299
	* python/lib/gdb/printing.py (register_pretty_printer): Handle
	name or __name__ attributes.  Handle gdb module as first argument.

gdb/testsuite/ChangeLog:

	* gdb.python/py-pp-maint.py: Move "replace" testing to ...
	* gdb.python/py-pp-registration.exp: ... here.  New file.
	* gdb.python/py-pp-registration.c: New file.
	* gdb.python/py-pp-registration.py: New file.
2015-04-28 22:14:23 -07:00
Doug Evans 69b4374a87 PR python/18089
gdb/ChangeLog:

	PR python/18089
	* python/py-prettyprint.c (print_children): Verify result of children
	iterator.  Provide better error message.
	* python/python-internal..h (gdbpy_print_python_errors_p): Declare.
	* python/python.c (gdbpy_print_python_errors_p): New function.

gdb/testsuite/ChangeLog:

	* gdb.python/py-bad-printers.c: New file.
	* gdb.python/py-bad-printers.py: New file.
	* gdb.python/py-bad-printers.exp: New file.
2015-04-28 21:53:54 -07:00
Doug Evans 5e7cf0784c * gdbtypes.h (struct cplus_struct_type) <n_baseclasses>: Fix comment.
gdb/ChangeLog:

	* gdbtypes.h (struct cplus_struct_type) <n_baseclasses>: Fix comment.
2015-04-28 21:23:24 -07:00
Sasha Smundak 59fb7612dd Add gdb.Type.optimized_out method.
gdb/ChangeLog:

	* NEWS: Mention gdb.Type.optimized_out method.
	* python/py-type.c (typy_optimized_out):  New function.

gdb/doc/ChangeLog:

	* python.texi: New method documented.

gdb/testsuite/ChangeLog:

	* gdb.python/py-type.exp: New test.
2015-04-28 17:41:09 -07:00
GDB Administrator 521f2feb98 Automatic date update in version.in 2015-04-29 00:00:08 +00:00
Andreas Schwab a13eab064f Eat newlines inside INPUT statements in linker scripts
ld/
	PR ld/18344
	* ldlex.l (INPUTLIST): Increment lineno on newline.
2015-04-28 21:55:28 +02:00
John Baldwin cea6e4f13a Use "gdb_wait.h" instead of <sys/wait.h>.
gdb/ChangeLog:
	* fbsd-nat.c: Include "gdb_wait.h" instead of <sys/wait.h>.
2015-04-28 14:44:07 -04:00
Renlin Li f9c1b181a7 [ARM]Positively emit symbols for alignment
2015-04-28  Renlin Li  <renlin.li@arm.com>
  gas/
    * config/tc-arm.c (arm_init_frag): Always emit mapping symbols.

  gas/testsuite/
    * gas/arm/thumb2_vpool_be.d: Adjust the desired output.
    * gas/arm/vldconst_be.d: Ditto.
2015-04-28 17:10:26 +01:00
Patrick Palka 24b73f8e74 Disable readline's SIGWINCH handler
We no longer need it as we handle SIGWINCH ourselves.  Also move the
call to init_page_info() from initialize_utils() to the latter
function's only caller, gdb_init().

gdb/ChangeLog:

	* utils.c (init_page_info): Set rl_catch_sigwinch to zero.
	(initialize_utils): Move call of init_page_info() to ...
	* top.c (gdb_init): ... here.
2015-04-28 08:51:03 -04:00
Patrick Palka a88d0bb33c Update our idea of our terminal's dimensions even outside of TUI
When in the CLI, GDB's "width" and "height" variables are not kept in sync
when the underlying terminal gets resized.

This patch fixes this issue by making sure sure to update GDB's "width"
and "height" variables in the !tui_active case of our SIGWINCH handler.

gdb/ChangeLog:

	* tui/tui-win.c (tui_sigwinch_handler): Remove now-stale comment.
	(tui_sigwinch_handler): Still update our idea of
	the terminal's width and height even when TUI is not active.
2015-04-28 08:50:11 -04:00
Patrick Palka d6e5e7f7fd Introduce function for directly updating GDB's screen dimensions
... to replace the roundabout pattern of

  execute_command ("set width %d");
  execute_command ("set height %d");

for doing the same thing.

gdb/ChangeLog:

	* utils.h (set_screen_width_and_height): Declare.
	* utils.c (set_screen_width_and_height): Define.
	* tui/tui-win.c (tui_update_gdb_sizes): Use it.
2015-04-28 08:46:28 -04:00
Gary Benson ff862be47e Use exec_file_find to prepend gdb_sysroot in follow_exec
This commit updates follow_exec to use exec_file_find to prefix
the new executable's filename with gdb_sysroot rather than doing
it longhand.

gdb/ChangeLog:

	* infrun.c (solist.h): New include.
	(follow_exec): Use exec_file_find to prefix execd_pathname
	with gdb_sysroot.
2015-04-28 12:21:32 +01:00
Nick Clifton da7119c99c Fix compile time warnings about a local variable being used before it is set.
PR 18313
	* cond.c (s_if): Stop compile time warning about stopc being used
	before it is set.
	(s_ifc): Likewise.
2015-04-28 11:22:57 +01:00
Andy Wingo 2631b16a57 Fix py-parameter.exp and scm-parameter.exp path matching
gdb/testsuite/ChangeLog:

	* gdb.python/py-parameter.exp:
	* gdb.guile/scm-parameter.exp: Escape the path that we are
	matching against, as it might contain characters that are special
	to regular expressions.
2015-04-28 11:15:47 +02:00
Alan Modra faa2211d4d Tidy PowerPC gold find_global_entry uses
Completely removing the assert probably wasn't the best idea, so
reinstate it for allocated sections.  Also cope with debug info
potentially referring to a missing plt call stub.

And a tidy.  find_global_entry now returns an Address, so make temps
holding the return value of type Address, and compare against
invalid_address.

	* powerpc.cc (Target_powerpc::do_dynsym_value): Use Address rather
	than unsigned int for find_global_entry result temp.  Compare
	against invalid_address.
	(Target_powerpc::do_plt_address_for_global): Likewise.
	(Target_powerpc::Relocate::relocate): Likewise.  Don't assert
	on plt call stub existence for debug info.  Do assert for plt
	and global entry stub existence if an alloc section.
2015-04-28 16:55:38 +09:30
Alan Modra 6ec65f28db PowerPC gold assertion on missing global entry stub
Global entry stubs are used on ELFv2 to provide addresses for
functions not defined in a non-PIC executable but whose address is
taken, in much the same way as PLT stub code is used on other
targets to provide function addresses.  We don't want to insert a
global entry stub just because (bogus) debug info refers to the
address of a non-local function, but we also don't want gold to die.

	* powerpc.cc (Target_powerpc::Relocate::relocate): Don't assert
	on missing global entry stub due to bogus debug info.
2015-04-28 13:38:56 +09:30
Patrick Palka 2eb639cbe4 TUI: avoid calling strcpy() on identical string objects
In tui_set_source_content(), when offset == 0 the source and destination
pointers of the call to strcpy() are actually the same.  In this case
not only is strcpy() unnecessary but it is also UB when the two strings
overlap.

gdb/ChangeLog:

	* tui/tui-source.c (tui_set_source_content): Avoid calling
	strcpy() when offset is 0.
2015-04-27 21:19:58 -04:00
Patrick Palka 9720679936 Fix PR gdb/18155
For no good reason the function tui_free_window() is freeing the locator
window when we pass it an SRC_WIN or a DISASSEM_WIN.  This behavior
doesn't make much sense because the locator window is always visible and
its contents do not change when the main window changes.

This behavior triggers the above PR because when we switch from one TUI
window to another (in the PR, from the src window to the asm window) we
call tui_free_window() on the previously active window (in the PR, the
src window).  The function then frees the src window along with the
locator window and later we segfault when the now-active asm window
tries to query the locator window about the inferior's PC.

This patch fixes this apparently wrong behavior by changing
tui_free_window() to not free the locator window when we pass it an
SRC_WIN or a DISASSEM_WIN.

gdb/ChangeLog:

	PR gdb/18155
	* tui/tui-data.c (tui_free_window): Don't free the locator
	window when passed an SRC_WIN or a DISASSEM_WIN.
2015-04-27 21:19:58 -04:00
Patrick Palka 63ed81829e Make type-safe the 'content' field of struct tui_gen_win_info
The 'content' field of struct tui_gen_win_info currently has type
void ** but the field always stores an object of type tui_win_content.
Instead of unnecessarily casting to and from void ** we should just give
the field the type tui_win_content in the first place.

This patch does this and also eliminates all now-redundant casts
involving the 'content' struct field that I could find.

gdb/ChangeLog:

	* tui/tui-data.h (struct tui_win_element): Forward-declare.
	(tui_win_content): Move declaration.
	(struct tui_gen_win_info): Give 'content' field the
	type tui_win_content.
	* tui/tui-data.c (init_content_element): Remove redundant and
	erroneous casts.
	(tui_add_content_elements): Remove erroneous cast.
	* tui/tui-disasm.c (tui_set_disassem_content): Remove redundant
	casts.
	(tui_get_begin_asm_address): Likewise.
	* tui/tui-regs.c (tui_show_registers): Likewise.
	(tui_show_register_group): Likewise.
	(tui_display_registers_from): Likewise.
	(tui_check_register_values): Likewise.
	* tui/tui-source.c (tui_set_source_content): Likewise.
	(tui_set_source_content_nil): Likewise.
	(tui_source_is_displayed): Likewise.
	* tui/tui-stack.c (tui_show_locator_content): Likewise.
	(tui_set_locator_fullname): Likewise.
	(tui_set_locator_info): Likewise.
	(tui_show_frame_info): Likewise.
	* tui/tui-winsource.c (tui_clear_source_content): Likewise.
	(tui_show_source_line): Likewise.
	(tui_horizontal_source_scroll): Likewise.
	(tui_update_breakpoint_info): Likewise.
	(tui_set_exec_info_content): Likewise.
	(tui_show_exec_info_content): Likewise.
	(tui_alloc_source_buffer): Likewise.
	(tui_line_is_displayed): Likewise.
	(tui_addr_is_displayed): Likewise.
2015-04-27 21:19:53 -04:00
GDB Administrator d84f2dd325 Automatic date update in version.in 2015-04-28 00:00:08 +00:00
John Baldwin d2b41ca0f9 Add support for catching exec events on FreeBSD.
FreeBSD kernels that support fork tracing always stop a process to
report events for exec.  Such a process will have the PL_FLAG_EXEC
flag set in the pl_flags field of the ptrace_lwpinfo struct returned
by PT_LWPINFO.  The structure does not include the pathname passed to
exec, so use fbsd_pid_to_exec_file to query the pathname of the
process' executable.

gdb/ChangeLog:

	* fbsd-nat.c: (fbsd_wait) [PL_FLAG_EXEC]: Report TARGET_WAITKIND_EXECD
	event if PL_FLAG_EXEC is set.
	[PL_FLAG_EXEC] (fbsd_insert_exec_catchpoint): New function.
	[PL_FLAG_EXEC] (fbsd_remove_exec_catchpoint): New function.
	(fbsd_nat_add_target) [PL_FLAG_EXEC]: Set
	"to_insert_exec_catchpoint" to "fbsd_insert_exec_catchpoint".
	Set "to_remove_exec_catchpoint" to "fbsd_remove_exec_catchpoint".
2015-04-27 19:27:04 -04:00
John Baldwin e58e05d677 Enable fork tracing for native FreeBSD targets.
Enable PT_FOLLOW_FORK on all processes.  When this is enabled, both
the parent and child process stop when a fork or vfork occurs.

A target operation for wait uses PT_LWPINFO to fetch more detailed
information about the state of a stopped process.  A parent process
sets the PL_FLAG_FORKED flag in the pl_flags field of the structure
returned by PT_LWPINFO as well as the pid of the new child process.
The child process sets the PL_FLAG_CHILD flag in the pl_flags field.

When a fork is detected, the wait hook waits for both processes to
report their respective events.  It then reports the fork to GDB as
a single TARGET_WAITKIND_FORKED or TARGET_WAITKIND_VFORKED event.
The kernel does not guarantee the order the events are reported in.
If the parent process' event is reported first, then the wait hook
explicitly waits for the child process.  If the child process' event
is reported first, the event is recorded on an internal list of
pending child events and the wait hook waits for another event.
Later when the parent process' event is reported, the parent will
use the previously-recorded child process event instead of explicitly
waiting on the child process.

To distinguish vfork events from fork events, the external process
structure for the child process is extracted from the kernel.  The
P_PPWAIT flag is set in the ki_flags field of this structure if the
process was created via vfork, but it is not set for a regular fork.

gdb/ChangeLog:

	* fbsd-nat.c: [PT_LWPINFO] New variable super_wait.
	[TDP_RFPPWAIT] New variable fbsd_pending_children.
	[TDP_RFPPWAIT] (fbsd_remember_child): New function.
	[TDP_RFPPWAIT] (fbsd_is_child_pending): New function.
	[TDP_RFPPWAIT] (fbsd_fetch_kinfo_proc): New function.
	[PT_LWPINFO] (fbsd_wait): New function.
	[TDP_RFPPWAIT] (fbsd_follow_fork): New function.
	[TDP_RFPPWAIT] (fbsd_insert_fork_catchpoint): New function.
	[TDP_RFPPWAIT] (fbsd_remove_fork_catchpoint): New function.
	[TDP_RFPPWAIT] (fbsd_insert_vfork_catchpoint): New function.
	[TDP_RFPPWAIT] (fbsd_remove_vfork_catchpoint): New function.
	[TDP_RFPPWAIT] (fbsd_enable_follow_fork): New function.
	[TDP_RFPPWAIT] (fbsd_post_startup_inferior): New function.
	[TDP_RFPPWAIT] (fbsd_post_attach): New function.
	(fbsd_nat_add_target) [PT_LWPINFO] Set "to_wait" to
	"fbsd_wait".
	[TDP_RFPPWAIT] Set "to_follow_fork" to "fbsd_follow_fork".
	Set "to_insert_fork_catchpoint" to "fbsd_insert_fork_catchpoint".
	Set "to_remove_fork_catchpoint" to "fbsd_remove_fork_catchpoint".
	Set "to_insert_vfork_catchpoint" to "fbsd_insert_vfork_catchpoint".
	Set "to_remove_vfork_catchpoint" to "fbsd_remove_vfork_catchpoint".
	Set "to_post_startup_inferior" to "fbsd_post_startup_inferior".
	Set "to_post_attach" to "fbsd_post_attach".
2015-04-27 19:26:17 -04:00
John Baldwin 8f60fe014d Add fbsd_nat_add_target.
Add a wrapper for add_target in fbsd-nat.c to override target operations
common to all native FreeBSD targets.

gdb/ChangeLog:

	* fbsd-nat.c (fbsd_pid_to_exec_file): Mark static.
	(fbsd_find_memory_regions): Mark static.
	(fbsd_nat_add_target): New function.
	* fbsd-nat.h: Export fbsd_nat_add_target and remove prototypes for
	fbsd_pid_to_exec_file and fbsd_find_memory_regions.
	* amd64fbsd-nat.c (_initialize_amd64fbsd_nat): Use fbsd_nat_add_target.
	* i386fbsd-nat.c (_initialize_i386fbsd_nat): Likewise.
	* ppcfbsd-nat.c (_initialize_ppcfbsd_nat): Likewise.
	* sparc64fbsd-nat.c (_initialize_sparc64fbsd_nat): Likewise.
2015-04-27 19:24:18 -04:00
Han Shen 7a2a1c7935 [gold] Rename '--fix-cortex-a53' to '--fix-cortex-a53-843419'.
Keep gold consistent with bfd erratum-fixing option names, so as to
ease life in Makefile/scripts.

gold/

	* options.h (--fix-cortex-a53-843419): Rename option.
	* aarch64.cc (AArch64_relobj::do_count_local_symbols): Use renamed
	option.
	(AArch64_relobj::scan_sections_for_stubs): Use renamed option.
2015-04-27 15:49:41 -07:00
Rafael Ávila de Espíndola cfbf0e3c5b If a range is missing, assume the input address is mapped.
When Output_section::is_input_address_mapped is called we have entries for
all dropped ranges, but not for all ranges.
2015-04-27 14:35:17 -04:00
Peter Bergner 4fff86c517 opcodes/
* ppc-opc.c (DCBT_EO): New define.
	(powerpc_opcodes) <lbarx>: Enable for POWER8 and later.
	<lharx>: Likewise.
	<stbcx.>: Likewise.
	<sthcx.>: Likewise.
	<waitrsv>: Do not enable for POWER7 and later.
	<waitimpl>: Likewise.
	<dcbt>: Default to the two operand form of the instruction for all
	"old" cpus.  For "new" cpus, use the operand ordering that matches
	whether the cpu is server or embedded.
	<dcbtst>: Likewise.

gas/testsuite/

	* gas/ppc/a2.s: Fixup test case due to dcbt/dcbtst embedded operand
	ordering change.
	* gas/ppc/a2.d: Likewise.
	* gas/ppc/476.d: Likewise.
	* gas/ppc/booke.s: Remove invalid 3 operand dcbt tests.
	* gas/ppc/booke.d: Likewise.
	* gas/ppc/power7.s: Remove lbarx, lharx, stbcx., sthcx., waitrsv
	and waitimpl tests.
	* gas/ppc/power7.d: Likewise.
2015-04-27 11:06:54 -05:00