aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2015-04-13sim: options: add --version supportMike Frysinger2-0/+18
The old run frontend had a --version option, but the new common sim-options file does not. Restore support for that so we can get version info out of `run` when using the new frontend.
2015-04-13sim: switch to gdb version scriptMike Frysinger3-40/+8
Since the local create-version.sh already points directly into the gdb source tree, we might as well use the gdb script directly too.
2015-04-13sim: mn10300: convert to sim-cpuMike Frysinger4-10/+47
Make cpu allocation fully dynamic so we can leverage the common sim-cpu and its APIs.
2015-04-13sim: v850: convert to sim-cpuMike Frysinger4-9/+42
Make cpu allocation fully dynamic so we can leverage the common sim-cpu and its APIs.
2015-04-13sim: mips: convert to sim-cpuMike Frysinger4-11/+44
Make cpu allocation fully dynamic so we can leverage the common sim-cpu and its APIs.
2015-04-13sim: m68hc11: convert to sim-cpuMike Frysinger4-11/+48
Make cpu allocation fully dynamic so we can leverage the common sim-cpu and its APIs.
2015-04-13sim: mips: fix prototype warningsMike Frysinger2-63/+43
Convert a bunch of old style prototypes and tweak various casts to match the function signatures.
2015-04-13sim: ft32: fix ft32_pc_get logicMike Frysinger2-1/+5
2015-04-13Automatic date update in version.inGDB Administrator1-1/+1
2015-04-13Do unset_currtarget_info ldscript for all simulator testsuites.Hans-Peter Nilsson4-6/+18
sim/testsuite: * sim-defs.exp (sim_init): Unset target ldscript here. sim/testsuite/sim/mips: * basic.exp: Don't unset target ldscript here.
2015-04-12sim: arm/mips: fix sim_read/sim_write linkage errorsMike Frysinger4-2/+11
With sim-hrw.o being built & linked in the common list, some people are getting linking errors now for these targets. Move the main objects that provide these functions before the common list to avoid that.
2015-04-12sim: ft32: delete sim_read/sim_write funcsMike Frysinger2-22/+4
The common sim-hrw.o provides both of these, so simply use them.
2015-04-11Revert the last 2 commits on pagesize_m1H.J. Lu2-14/+4
2015-04-12Automatic date update in version.inGDB Administrator1-1/+1
2015-04-11Don't call getpagesize more than onceH.J. Lu1-1/+2
2015-04-11Initialize pagesize_m1 in bfd_cache_initH.J. Lu2-4/+13
There is no need to check and initialize pagesize_m1 in cache_bmmap. * cache.c (cache_bmmap): Move pagesize_m1 ... to (pagesize_m1): Here. (bfd_cache_init): Initialize pagesize_m1.
2015-04-11Remove an extra ';'H.J. Lu2-1/+5
* plugin.c (plugin_load_plugins): Removed an extra ';'.
2015-04-11Remove --xdbJan Kratochvil22-444/+53
Pedro Alves: The commands that enables aren't even documented in the manual. Judging from that, I assume that only wdb users would ever really be using the --xdb switch. I think it's time to drop "support" for the --xdb switch too. I looked through the commands that that exposes, the only that looked potentially interesting was "go", but then it's just an alias for "tbreak+jump", which can easily be done with "define go...end". I'd rather free up the "go" name for something potentially more interesting (either run control, or maybe even unrelated, e.g., for golang). gdb/ChangeLog 2015-04-11 Jan Kratochvil <jan.kratochvil@redhat.com> * NEWS (Changes since GDB 7.9): Add removed -xdb. * breakpoint.c (command_line_is_silent): Remove xdb_commands conditional. (_initialize_breakpoint): Remove xdb_commands for bc, ab, sb, db, ba and lb. * cli/cli-cmds.c (_initialize_cli_cmds): Remove xdb_commands for v and va. * cli/cli-decode.c (find_command_name_length): Remove xdb_commands conditional. * defs.h (xdb_commands): Remove declaration. * f-valprint.c (_initialize_f_valprint): Remove xdb_commands for lc. * guile/scm-cmd.c (command_classes): Remove xdb from comment. * infcmd.c (run_no_args_command, go_command): Remove. (_initialize_infcmd): Remove xdb_commands for S, go, g, R and lr. * infrun.c (xdb_handle_command): Remove. (_initialize_infrun): Remove xdb_commands for lz and z. * main.c (xdb_commands): Remove variable. (captured_main): Remove "xdb" from long_options. (print_gdb_help): Remove --xdb from help. * python/py-cmd.c (gdbpy_initialize_commands): Remove xdb from comment. * source.c (_initialize_source): Remove xdb_commands for D, ld, / and ?. * stack.c (backtrace_full_command, args_plus_locals_info) (current_frame_command): Remove. (_initialize_stack): Remove xdb_commands for t, T and l. * symtab.c (_initialize_symtab): Remove xdb_commands for lf and lg. * thread.c (_initialize_thread): Remove xdb_commands condition. * tui/tui-layout.c (tui_toggle_layout_command) (tui_toggle_split_layout_command, tui_handle_xdb_layout): Remove. (_initialize_tui_layout): Remove xdb_commands for td and ts. * tui/tui-regs.c (tui_scroll_regs_forward_command) (tui_scroll_regs_backward_command): Remove. (_initialize_tui_regs): Remove xdb_commands for fr, gr, sr, +r and -r. * tui/tui-win.c (tui_xdb_set_win_height_command): Remove. (_initialize_tui_win): Remove xdb_commands for U and w. * utils.c (pagination_on_command, pagination_off_command): Remove. (initialize_utils): Remove xdb_commands for am and sm. gdb/doc/ChangeLog 2015-04-11 Jan Kratochvil <jan.kratochvil@redhat.com> * gdb.texinfo (Mode Options): Remove -xdb.
2015-04-11Replace SYMBOLIC_BIND with SYMBOL_REFERENCES_LOCALH.J. Lu12-18/+96
When checking R_386_GOTOFF/R_X86_64_GOTOFF64 for building shared library, we should check SYMBOL_REFERENCES_LOCAL instead of SYMBOLIC_BIND to cover more cases. bfd/ * elf32-i386.c (elf_i386_relocate_section): Replace SYMBOLIC_BIND with SYMBOL_REFERENCES_LOCAL when checking R_386_GOTOFF against protected data symbol when building shared library. * elf64-x86-64.c (elf_x86_64_relocate_section): Check R_X86_64_GOTOFF64 against undefined symbol and replace SYMBOLIC_BIND with SYMBOL_REFERENCES_LOCAL when checking R_X86_64_GOTOFF64 against protected data symbol when building shared library. ld/testsuite/ * ld-i386/i386.exp: Run protected6a. * ld-i386/protected6.d: Renamed to ... * ld-i386/protected6a.d: This. * ld-x86-64/hidden4.d: New file. * ld-x86-64/hidden4.s: Likewise. * ld-x86-64/hidden5.d: Likewise. * ld-x86-64/hidden5.s: Likewise. * ld-x86-64/protected6.d: Renamed to ... * ld-x86-64/protected6a.d: This. * ld-x86-64/x86-64.exp: Run hidden4, hidden5, protected6a, protected7a and protected7b.
2015-04-11Automatic date update in version.inGDB Administrator1-1/+1
2015-04-10Check GOTOFF reloc against protected data on x86H.J. Lu13-13/+100
R_386_GOTOFF/R_X86_64_GOTOFF64 relocation shouldn't be used against protected data symbol on x86 since with copy relocation, address of protected data defined in the shared library may be external. This patch will break building shared libraries with protected data symbols using GCCs older than GCC 5 without the bug fix for https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65248 GCC backport request should be made in the GCC bug report above. bfd/ PR ld/pr17709 * elf32-i386.c (elf_i386_relocate_section): Also check R_386_GOTOFF against protected data symbol when building shared library. * elf64-x86-64.c (elf_x86_64_relocate_section): Also check R_X86_64_GOTOFF64 against protected data symbol when building shared library. ld/testsuite/ PR ld/pr17709 * ld-i386/protected6.d: New file. * ld-i386/protected6.s: Likewise. * ld-x86-64/protected6.d: Likewise. * ld-x86-64/protected6.s: Likewise. * ld-x86-64/protected7.d: Likewise. * ld-x86-64/protected7.s: Likewise. * ld-x86-64/protected7a.d: Likewise. * ld-x86-64/protected7b.d: Likewise.
2015-04-10Cleanup signal-while-stepping-over-bp-other-thread.expPedro Alves2-10/+15
gdb/testsuite/ChangeLog: 2015-04-10 Pedro Alves <palves@redhat.com> * gdb.threads/signal-while-stepping-over-bp-other-thread.exp: Use gdb_test_sequence and gdb_assert.
2015-04-10step-over-trips-on-watchpoint.exp: Don't put addresses in test messagesPedro Alves2-2/+10
Diffing test results, I noticed: -PASS: gdb.threads/step-over-trips-on-watchpoint.exp: displaced=on: with thread-specific bp: next: b *0x0000000000400811 thread 1 +PASS: gdb.threads/step-over-trips-on-watchpoint.exp: displaced=on: with thread-specific bp: next: b *0x00000000004007d1 thread 1 gdb/testsuite/ChangeLog: 2015-04-10 Pedro Alves <palves@redhat.com> * gdb.threads/step-over-trips-on-watchpoint.exp (do_test): Use test messages that don't include the breakpoint address.
2015-04-10Add extern_protected_data and set it for x86H.J. Lu21-8/+112
Re-apply: commit ca3fe95e469b9daec153caa2c90665f5daaec2b5 With copy relocation, address of protected data defined in the shared library may be external. This patch adds extern_protected_data and changes _bfd_elf_symbol_refs_local_p to return false for protected data if extern_protected_data is true. This patch will break building shared libraries with protected data symbols using GCCs older than GCC 5 without the bug fix for https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65248 GCC backport request should be made in the GCC bug report above. To get correct run-time behavior on Linux, glibc 2.22 or above are required, which have the bug fix for https://sourceware.org/bugzilla/show_bug.cgi?id=17711 Backports for glibc 2.21, 2.20, 2.19 and 2.18 are on hjl/pr17711/2.21, hjl/pr17711/2.20, hjl/pr17711/2.19 and hjl/pr17711/2.18 branches, respectively, at https://sourceware.org/git/?p=glibc.git;a=summary bfd/ PR ld/pr15228 PR ld/pr17709 * elf-bfd.h (elf_backend_data): Add extern_protected_data. * elf32-i386.c (elf_backend_extern_protected_data): New. Defined to 1. * elf64-x86-64.c (elf_backend_extern_protected_data): Likewise. * elflink.c (_bfd_elf_adjust_dynamic_copy): Don't error on copy relocs against protected symbols if extern_protected_data is true. (_bfd_elf_symbol_refs_local_p): Don't return true on protected non-function symbols if extern_protected_data is true. * elfxx-target.h (elf_backend_extern_protected_data): New. Default to 0. (elfNN_bed): Initialize extern_protected_data with elf_backend_extern_protected_data. ld/testsuite/ PR ld/pr15228 PR ld/pr17709 * ld-i386/i386.exp (i386tests): Add a test for PR ld/17709. * ld-i386/pr17709-nacl.rd: New file. * ld-i386/pr17709.rd: Likewise. * ld-i386/pr17709a.s: Likewise. * ld-i386/pr17709b.s: Likewise. * ld-i386/protected3.d: Updated. * ld-i386/protected3.s: Likewise. * ld-x86-64/pr17709-nacl.rd: New file. * ld-x86-64/pr17709.rd: Likewise. * ld-x86-64/pr17709a.s: Likewise. * ld-x86-64/pr17709b.s: Likewise. * ld-x86-64/protected3.d: Updated. * ld-x86-64/protected3.s: Likewise. * ld-x86-64/x86-64.exp (x86_64tests): Add a test for PR ld/17709.
2015-04-10[arm] watchpoint-reuse-slot.exp: skip setting HW points on some addressYao Qi2-0/+33
Hi, ARM linux kernel has some requirements on the address/length setting for HW breakpoints/watchpoints, but watchpoint-reuse-slot.exp doesn't consider them and sets HW points on various addresses. Many fails are causes as a result: stepi^M Warning:^M Could not insert hardware watchpoint 20.^M Could not insert hardware breakpoints:^M You may have requested too many hardware breakpoints/watchpoints.^M ^M (gdb) FAIL: gdb.base/watchpoint-reuse-slot.exp: always-inserted off: watch x watch: : width 2, iter 2: base + 1: stepi advanced watch *(buf.byte + 2 + 1)@2^M Hardware watchpoint 388: *(buf.byte + 2 + 1)@2^M Warning:^M Could not insert hardware watchpoint 388.^M Could not insert hardware breakpoints:^M You may have requested too many hardware breakpoints/watchpoints.^M ^M (gdb) FAIL: gdb.base/watchpoint-reuse-slot.exp: always-inserted on: watch x watch: : width 2, iter 2: base + 1: watch *(buf.byte + 2 + 1)@2 This patch is to reflect kernel requirements in watchpoint-reuse-slot.exp in order to skip some tests. gdb/testsuite: 2015-04-10 Yao Qi <yao.qi@linaro.org> * gdb.base/watchpoint-reuse-slot.exp (valid_addr_p): Return false for some offset and width combinations which aren't supported by linux kernel.
2015-04-10PPC64: Fix step-over-trips-on-watchpoint.exp with displaced stepping onPedro Alves2-7/+27
PPC64 currently fails this test like: FAIL: gdb.threads/step-over-trips-on-watchpoint.exp: displaced=on: no thread-specific bp: step: step FAIL: gdb.threads/step-over-trips-on-watchpoint.exp: displaced=on: no thread-specific bp: next: next FAIL: gdb.threads/step-over-trips-on-watchpoint.exp: displaced=on: no thread-specific bp: continue: continue (the program exited) FAIL: gdb.threads/step-over-trips-on-watchpoint.exp: displaced=on: with thread-specific bp: step: step FAIL: gdb.threads/step-over-trips-on-watchpoint.exp: displaced=on: with thread-specific bp: next: next FAIL: gdb.threads/step-over-trips-on-watchpoint.exp: displaced=on: with thread-specific bp: continue: continue (the program exited) The problem is that PPC is a non-continuable watchpoints architecture and the displaced stepping code isn't coping with that correctly. On such targets/architectures, a watchpoint traps _before_ the instruction executes/completes. On a watchpoint trap, the PC points at the instruction that triggers the watchpoint (side effects haven't happened yet). In order to move past the watchpoint, GDB needs to remove the watchpoint, single-step, and reinsert the watchpoint, just like when stepping past a breakpoint. The trouble is that if GDB is stepping over a breakpoint with displaced stepping, and the instruction under the breakpoint triggers a watchpoint, we get the watchpoint SIGTRAP, expecting a finished (hard or software) step trap. Even though the thread's PC hasn't advanced yet (must remove watchpoint for that), since we get a SIGTRAP, displaced_step_fixup thinks the single-step finished successfuly anyway, and calls gdbarch_displaced_step_fixup, which then adjusts the thread's registers incorrectly. The fix is to cancel the displaced step if we trip on a watchpoint. handle_inferior_event then processes the watchpoint event, and starts a new step-over, here: ... /* At this point, we are stopped at an instruction which has attempted to write to a piece of memory under control of a watchpoint. The instruction hasn't actually executed yet. If we were to evaluate the watchpoint expression now, we would get the old value, and therefore no change would seem to have occurred. ... ecs->event_thread->stepping_over_watchpoint = 1; keep_going (ecs); return; ... but this time, since we have a watchpoint to step over, watchpoints are removed from the target, so the step-over succeeds. The keep_going/resume changes are necessary because if we're stepping over a watchpoint, we need to remove it from the target - displaced stepping doesn't help, the copy of the instruction in the scratch pad reads/writes to the same addresses, thus triggers the watchpoint too... So without those changes we keep triggering the watchpoint forever, never making progress. With non-stop that means we'll need to pause all threads momentarily, which we can't today. We could avoid that by removing the watchpoint _only_ from the thread that is moving past the watchpoint, but GDB is not prepared for that today either. For remote targets, that would need new packets, so good to be able to step over it in-line as fallback anyway. gdb/ChangeLog: 2015-04-10 Pedro Alves <palves@redhat.com> * infrun.c (displaced_step_fixup): Switch to the event ptid earlier. If the thread stopped for a watchpoint and the target/arch has non-continuable watchpoints, cancel the displaced step. (resume): Don't start a displaced step if in-line step-over info is valid.
2015-04-10Test step-over-{lands-on-breakpoint|trips-on-watchpoint}.exp with displaced ↵Pedro Alves3-10/+46
stepping These tests exercise the infrun.c:proceed code that needs to know to start new step overs (along with switch_back_to_stepped_thread, etc.). That code is tricky to get right in the multitude of possible combinations (at least): (native | remote) X (all-stop | all-stop-but-target-always-in-non-stop) X (displaced-stepping | in-line step-over). The first two above are properties of the target, but the different step-over-breakpoint methods should work with any target that supports them. This patch makes sure we always test both methods on all targets. Tested on x86-64 Fedora 20. gdb/testsuite/ChangeLog: 2015-04-10 Pedro Alves <palves@redhat.com> * gdb.threads/step-over-lands-on-breakpoint.exp (do_test): New procedure, factored out from ... (top level): ... here. Add "set displaced-stepping" testing axis. * gdb.threads/step-over-trips-on-watchpoint.exp (do_test): New parameter "displaced". Use it. (top level): Use foreach and add "set displaced-stepping" testing axis.
2015-04-10Make gdb.threads/step-over-trips-on-watchpoint.exp effective on !x86Pedro Alves3-6/+49
This test is currently failing like this on (at least) PPC64 and s390x: FAIL: gdb.threads/step-over-trips-on-watchpoint.exp: no thread-specific bp: step: step FAIL: gdb.threads/step-over-trips-on-watchpoint.exp: no thread-specific bp: next: next FAIL: gdb.threads/step-over-trips-on-watchpoint.exp: with thread-specific bp: step: step FAIL: gdb.threads/step-over-trips-on-watchpoint.exp: with thread-specific bp: next: next gdb.log: (gdb) PASS: gdb.threads/step-over-trips-on-watchpoint.exp: no thread-specific bp: step: set scheduler-locking off step wait_threads () at ../../../src/gdb/testsuite/gdb.threads/step-over-trips-on-watchpoint.c:49 49 return 1; /* in wait_threads */ (gdb) FAIL: gdb.threads/step-over-trips-on-watchpoint.exp: no thread-specific bp: step: step The problem is that the test assumes that both the "watch_me = 1;" and the "other = 1;" lines compile to a single instruction each, which happens to be true on x86, but no necessarily true everywhere else. The result is that the test doesn't really test what it wants to test. Fix it by looking for the instruction that triggers the watchpoint. gdb/ChangeLog: 2015-04-10 Pedro Alves <palves@redhat.com> * gdb.threads/step-over-trips-on-watchpoint.c (child_function): Remove comment. * gdb.threads/step-over-trips-on-watchpoint.exp (do_test): Find both the address of the instruction that triggers the watchpoint and the address of the instruction immediately after, and use those addresses for the test. Fix comment.
2015-04-10Add a testcase for PR ld/18223H.J. Lu4-0/+21
PR ld/18223 * ld-gc/gc.exp: Run pr18223. * ld-gc/pr18223.d: New file. * ld-gc/pr18223.s: Likewise.
2015-04-10Use bfd_alloc for compressed section contentsH.J. Lu2-3/+12
Compressed section contents should be bfd_alloced to avoid memory leak. This patch replaces bfd_malloc and free with bfd_alloc and bfd_release on compressed buffer in bfd_compress_section_contents. There is still a very small memory leak when compressed section isn't smaller. * compress.c (bfd_compress_section_contents): Replace bfd_malloc and free with bfd_alloc and bfd_release on compressed buffer. Release buffer if compressed section isn't smaller.
2015-04-10Fix gdb.base/sigstep.exp with displaced stepping on software single-step targetsPedro Alves4-28/+114
TL;DR: When stepping over a breakpoint with displaced stepping, the core must be notified of all signals, otherwise the displaced step fixup code confuses a breakpoint trap in the signal handler for the expected trap indicating the displaced instruction was single-stepped normally/successfully. Detailed version: Running sigstep.exp with displaced stepping on, against my x86 software single-step branch, I got: FAIL: gdb.base/sigstep.exp: step on breakpoint, to handler: performing step FAIL: gdb.base/sigstep.exp: next on breakpoint, to handler: performing next FAIL: gdb.base/sigstep.exp: continue on breakpoint, to handler: performing continue Turning on debug logs, we see: (gdb) step infrun: clear_proceed_status_thread (process 32147) infrun: proceed (addr=0xffffffffffffffff, signal=GDB_SIGNAL_DEFAULT) infrun: resume (step=1, signal=GDB_SIGNAL_0), trap_expected=1, current thread [process 32147] at 0x400842 displaced: stepping process 32147 now displaced: saved 0x400622: 49 89 d1 5e 48 89 e2 48 83 e4 f0 50 54 49 c7 c0 displaced: %rip-relative addressing used. displaced: using temp reg 2, old value 0x3615eafd37, new value 0x40084c displaced: copy 0x400842->0x400622: c7 81 1c 08 20 00 00 00 00 00 displaced: displaced pc to 0x400622 displaced: run 0x400622: c7 81 1c 08 LLR: Preparing to resume process 32147, 0, inferior_ptid process 32147 LLR: PTRACE_CONT process 32147, 0 (resume event thread) linux_nat_wait: [process -1], [TARGET_WNOHANG] LLW: enter LNW: waitpid(-1, ...) returned 32147, No child processes LLW: waitpid 32147 received Alarm clock (stopped) LLW: PTRACE_CONT process 32147, Alarm clock (preempt 'handle') LNW: waitpid(-1, ...) returned 0, No child processes LLW: exit (ignore) sigchld infrun: target_wait (-1.0.0, status) = infrun: -1.0.0 [process -1], infrun: status->kind = ignore infrun: TARGET_WAITKIND_IGNORE infrun: prepare_to_wait linux_nat_wait: [process -1], [TARGET_WNOHANG] LLW: enter LNW: waitpid(-1, ...) returned 32147, No child processes LLW: waitpid 32147 received Trace/breakpoint trap (stopped) CSBB: process 32147 stopped by software breakpoint LNW: waitpid(-1, ...) returned 0, No child processes LLW: trap ptid is process 32147. LLW: exit infrun: target_wait (-1.0.0, status) = infrun: 32147.32147.0 [process 32147], infrun: status->kind = stopped, signal = GDB_SIGNAL_TRAP infrun: TARGET_WAITKIND_STOPPED displaced: restored process 32147 0x400622 displaced: fixup (0x400842, 0x400622), insn = 0xc7 0x81 ... displaced: restoring reg 2 to 0x3615eafd37 displaced: relocated %rip from 0x400717 to 0x400937 infrun: stop_pc = 0x400937 infrun: delayed software breakpoint trap, ignoring infrun: no line number info infrun: stop_waiting 0x0000000000400937 in __dso_handle () 1: x/i $pc => 0x400937: and %ah,0xa0d64(%rip) # 0x4a16a1 (gdb) FAIL: gdb.base/sigstep.exp: displaced=on: step on breakpoint, to handler: performing step What should have happened is that the breakpoint hit in the signal handler should have been presented to the user. But note that "preempt 'handle'" -- what happened instead is that displaced_step_fixup confused the breakpoint in the signal handler for the expected SIGTRAP indicating the displaced instruction was single-stepped normally/successfully. This should be affecting all software single-step targets in the same way. The fix is to make sure the core sees all signals when displaced stepping, just like we already must see all signals when doing an stepping over a breakpoint in-line. We now get: infrun: target_wait (-1.0.0, status) = infrun: 570.570.0 [process 570], infrun: status->kind = stopped, signal = GDB_SIGNAL_ALRM infrun: TARGET_WAITKIND_STOPPED displaced: restored process 570 0x400622 infrun: stop_pc = 0x400842 infrun: random signal (GDB_SIGNAL_ALRM) infrun: signal arrived while stepping over breakpoint infrun: inserting step-resume breakpoint at 0x400842 infrun: resume (step=0, signal=GDB_SIGNAL_ALRM), trap_expected=0, current thread [process 570] at 0x400842 LLR: Preparing to resume process 570, Alarm clock, inferior_ptid process 570 LLR: PTRACE_CONT process 570, Alarm clock (resume event thread) infrun: prepare_to_wait linux_nat_wait: [process -1], [TARGET_WNOHANG] LLW: enter LNW: waitpid(-1, ...) returned 0, No child processes LLW: exit (ignore) infrun: target_wait (-1.0.0, status) = infrun: -1.0.0 [process -1], infrun: status->kind = ignore sigchld infrun: TARGET_WAITKIND_IGNORE infrun: prepare_to_wait linux_nat_wait: [process -1], [TARGET_WNOHANG] LLW: enter LNW: waitpid(-1, ...) returned 570, No child processes LLW: waitpid 570 received Trace/breakpoint trap (stopped) CSBB: process 570 stopped by software breakpoint LNW: waitpid(-1, ...) returned 0, No child processes LLW: trap ptid is process 570. LLW: exit infrun: target_wait (-1.0.0, status) = infrun: 570.570.0 [process 570], infrun: status->kind = stopped, signal = GDB_SIGNAL_TRAP infrun: TARGET_WAITKIND_STOPPED infrun: stop_pc = 0x400717 infrun: BPSTAT_WHAT_STOP_NOISY infrun: stop_waiting Breakpoint 3, handler (sig=14) at /home/pedro/gdb/mygit/src/gdb/testsuite/gdb.base/sigstep.c:35 35 done = 1; Hardware single-step targets already behave this way, because the Linux backends (both native and gdbserver) always report signals to the core if the thread was single-stepping. As mentioned in the new comment in do_target_resume, we can't fix this by instead making the displaced_step_fixup phase skip fixing up the PC if the single step stopped somewhere we didn't expect. Here's what the backtrace would look like if we did that: Breakpoint 3, handler (sig=14) at /home/pedro/gdb/mygit/src/gdb/testsuite/gdb.base/sigstep.c:35 35 done = 1; 1: x/i $pc => 0x400717 <handler+7>: movl $0x1,0x200943(%rip) # 0x601064 <done> (gdb) bt #0 handler (sig=14) at /home/pedro/gdb/mygit/src/gdb/testsuite/gdb.base/sigstep.c:35 #1 <signal handler called> #2 0x0000000000400622 in _start () (gdb) FAIL: gdb.base/sigstep.exp: displaced=on: step on breakpoint, to handler: backtrace gdb/ChangeLog: 2015-04-10 Pedro Alves <palves@redhat.com> * infrun.c (displaced_step_in_progress): New function. (do_target_resume): Advise target to report all signals if displaced stepping. gdb/testsuite/ChangeLog: 2015-04-10 Pedro Alves <palves@redhat.com> * gdb.base/sigstep.exp (breakpoint_to_handler) (breakpoint_to_handler_entry): New parameter 'displaced'. Use it. Test "backtrace" in handler. (breakpoint_over_handler): New parameter 'displaced'. Use it. (top level): Add new "displaced" test axis to breakpoint_to_handler, breakpoint_to_handler_entry and breakpoint_over_handler.
2015-04-10Downgrade linker error on protected symbols in .dynbss to a warningAlan Modra2-7/+9
PR ld/18222 * elflink.c (_bfd_elf_adjust_dynamic_copy): Don't report an error on adding a protected visibility variable to .dynbss.
2015-04-10Revert "Add extern_protected_data and set it for x86"Alan Modra21-75/+42
This reverts commit ca3fe95e469b9daec153caa2c90665f5daaec2b5.
2015-04-10gdb/18216: displaced step+deliver signal, a thread needs step-over, crashPedro Alves4-8/+13
The problem is that with hardware step targets and displaced stepping, "signal FOO" when stopped at a breakpoint steps the breakpoint instruction at the same time it delivers a signal. This results in tp->stepped_breakpoint set, but no step-resume breakpoint set. When the next stop event arrives, GDB crashes. Irrespective of whether we should do something more/different to step past the breakpoint in this scenario (e.g., PR 18225), it's just wrong to assume there'll be a step-resume breakpoint set (and was not the original intention). gdb/ChangeLog: 2015-04-10 Pedro Alves <palves@redhat.com> PR gdb/18216 * infrun.c (process_event_stop_test): Don't assume a step-resume is set if tp->stepped_breakpoint is true. gdb/testsuite/ChangeLog: 2015-04-10 Pedro Alves <palves@redhat.com> PR gdb/18216 * gdb.threads/multiple-step-overs.exp: Remove expected eof.
2015-04-10[arm] Fix displaced stepping for thumb alu reg instructionYao Qi5-10/+83
Recent patch series "V2 All-stop on top of non-stop" causes a SIGSEGV in the test case, > -PASS: gdb.base/info-shared.exp: continue to breakpoint: library function #4 > +FAIL: gdb.base/info-shared.exp: continue to breakpoint: library function #4 > > continue^M > Continuing.^M > ^M > Program received signal SIGSEGV, Segmentation fault.^M > 0x40021564 in ?? () gdb/testsuite/gdb.base/info-shared-solib1.so^M > (gdb) FAIL: gdb.base/info-shared.exp: continue to breakpoint: library function #4 and an ARM displaced stepping bug is exposed. It can be reproduced by the modified gdb.arch/arm-disp-step.exp as below, continue^M Continuing.^M ^M Program received signal SIGSEGV, Segmentation fault.^M 0xa713cfcc in ?? ()^M (gdb) FAIL: gdb.arch/arm-disp-step.exp: continue to breakpoint: continue to test_add_rn_pc_end This patch is to fix it. gdb: 2015-04-10 Yao Qi <yao.qi@linaro.org> * arm-tdep.c (install_alu_reg): Update comment. (thumb_copy_alu_reg): Remove local variable rn. Update debugging message. Use r2 instead of r1 in the modified instruction. gdb/testsuite: 2015-04-10 Yao Qi <yao.qi@linaro.org> * gdb.arch/arm-disp-step.S (main): Call test_add_rn_pc. (test_add_rn_pc): New function. * gdb.arch/arm-disp-step.exp (test_add_rn_pc): New proc. (top level): Invoke test_add_rn_pc.
2015-04-10PR13858 - Can't do displaced stepping with no symbolsPedro Alves10-54/+162
Running break-interp.exp with the target always in non-stop mode trips on PR13858, as enabling non-stop also enables displaced stepping. The problem is that when GDB doesn't know where the entry point is, it doesn't know where to put the displaced stepping scratch pad. The test added by this commit exercises this. Without the fix, we get: (gdb) PASS: gdb.base/step-over-no-symbols.exp: displaced=on: break *$pc set displaced-stepping on (gdb) PASS: gdb.base/step-over-no-symbols.exp: displaced=on: set displaced-stepping on stepi 0x00000000004005be in ?? () Entry point address is not known. (gdb) PASS: gdb.base/step-over-no-symbols.exp: displaced=on: stepi p /x $pc $2 = 0x4005be (gdb) PASS: gdb.base/step-over-no-symbols.exp: displaced=on: get after PC FAIL: gdb.base/step-over-no-symbols.exp: displaced=on: advanced The fix switches all GNU/Linux ports to get the entry point from AT_ENTRY in the target auxiliary vector instead of from symbols. This is currently only done by PPC when Cell debugging is enabled, but I think all archs should be able to do the same. Note that ppc_linux_displaced_step_location cached the result, I'm guessing to avoid constantly re-fetching the auxv out of remote targets, but that's no longer necessary nowadays, as the auxv blob is itself cached in the inferior object. The ppc_linux_entry_point_addr global is obviously bad for multi-process too nowadays. Tested on x86-64 (-m64/-m32), PPC64 (-m64/-m32) and S/390 GNU/Linux. Yao tested the new test on ARM as well. gdb/ChangeLog: 2015-04-10 Pedro Alves <palves@redhat.com> PR gdb/13858 * amd64-linux-tdep.c (amd64_linux_init_abi_common): Install linux_displaced_step_location as gdbarch_displaced_step_location hook. * arm-linux-tdep.c (arm_linux_init_abi): Likewise. * i386-linux-tdep.c (i386_linux_init_abi): Likewise. * linux-tdep.c (linux_displaced_step_location): New function, based on ppc_linux_displaced_step_location. * linux-tdep.h (linux_displaced_step_location): New declaration. * ppc-linux-tdep.c (ppc_linux_entry_point_addr): Delete. (ppc_linux_inferior_created, ppc_linux_displaced_step_location): Delete. (ppc_linux_init_abi): Install linux_displaced_step_location as gdbarch_displaced_step_location hook, even without Cell/B.E.. (_initialize_ppc_linux_tdep): Don't install ppc_linux_inferior_created as inferior_created observer. * s390-linux-tdep.c (s390_gdbarch_init): Install linux_displaced_step_location as gdbarch_displaced_step_location hook. gdb/testsuite/ 2015-04-10 Pedro Alves <palves@redhat.com> PR gdb/13858 * gdb.base/step-over-no-symbols.exp: New file.
2015-04-10Correct setting of elf_list_optionsAlan Modra3-14/+17
* configure.ac: Set elf_list_options etc. in proper case. * configure: Regenerate.
2015-04-10doc patch: compile: missing bitsJan Kratochvil2-0/+86
gdb/doc/ChangeLog 2015-04-10 Jan Kratochvil <jan.kratochvil@redhat.com> Eli Zaretskii <eliz@gnu.org> * gdb.texinfo (Compiling and Injecting Code): Describe set debug compile, show debug compile. New subsection Compilation options for the compile command. New subsection Compiler search for the compile command.
2015-04-10Add documentation about the interation of the ARM assembler's -EB option and ↵Nick Clifton4-2/+22
the linker's --be8 option. PR binutils/18198 * ld.texinfo (--be8): Add a note about the interaction of this option with the assembler's -EB option. * doc/c-arm.texi (ARM Options): Add a note about the interaction of the -EB option with the linker's --be8 option.
2015-04-10Mark _init and _fini for --gc-sectionsAlan Modra2-0/+21
gold marks _init and _fini via symbol, ld marks them via section (default scripts set .init and .fini section KEEP). This makes it possible for people to write their own _init and not bother to put the function into the right section. PR ld/18223 * ldlang.c (lang_process): Add _init and _fini to gc_sym_list.
2015-04-10Automatic date update in version.inGDB Administrator1-1/+1
2015-04-09Allow gold to resolve defined TLS symbols in a PIE link.Cary Coutant5-148/+378
This patch fixes Symbol::final_value_is_known so that a defined TLS symbol in a PIE link is treated as having a known final value, thus allowing GD->LE TLS optimization, eliminating an unnecessary GOT entry and dynamic relocation. gold/ * symtab.cc (Symbol::final_value_is_known): Check for TLS symbol in a PIE link. * testsuite/Makefile.am (tls_pie_test.sh): New test. * testsuite/Makefile.in: Regenerate. * testsuite/tls_pie_test.sh: New.
2015-04-09Update comments in compress.cH.J. Lu2-6/+9
* compress.c (bfd_compress_section_contents): Update comments. (bfd_init_section_decompress_status): Likewise. (bfd_init_section_compress_status): Likewise.
2015-04-09doc/c-rx.texi: Fix markup typos in last change.Hans-Peter Nilsson2-2/+6
2015-04-09Improve ODR checking in gold.Cary Coutant5-17/+57
gold/ * debug.h (DEBUG_LOCATION): New. (DEBUG_ALL): Include DEBUG_LOCATION. (debug_string_to_enum): Add DEBUG_LOCATION. * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Fix debug output to print correct context. (Sized_dwarf_line_info::do_addr2line): Add debug output. Return up to 4 more locations at the beginning of the function. * symtab.cc (Symbol_table::detect_odr_violations): Get canonical result before sorting list of line numbers. * testsuite/debug_msg.sh: Allow range of line numbers for canonical results on optimized code.
2015-04-09Properly check --compress-debug-sections=XXXH.J. Lu4-16/+36
We can't check if input is ELF in copy_file since some targets may only set xvec after bfd_check_format_matches is called. This patch moves this check to copy_object. bfd/ * elfxx-target.h (TARGET_BIG_SYM): Add BFD_COMPRESS_GABI to object_flags. (TARGET_LITTLE_SYM): Likewise. binutils/ * objcopy.c (do_debug_sections): Use bit patterns. (copy_object): Return FALSE for compress_zlib, compress_gnu_zlib and compress_gabi_zlib on non-ELF input. (copy_file): Don't check non-ELF input here.
2015-04-09xtensa: update bfd/ChangelogMax Filippov1-0/+75
2015-04-09xtensa: replace action list with splay treeMax Filippov1-206/+282
text_action_add uses linear list search to order text actions list by action VMA. The list is used at the first relaxation pass, when it's not fixed yet. Replace the list with splay tree from libiberty. Original profile: % time self children called name ----------------------------------------- 0.00 0.00 14/158225 compute_text_actions 3.62 0.00 25211/158225 remove_dead_literal 8.42 0.00 58645/158225 coalesce_shared_literal 10.68 0.00 74355/158225 text_action_add_proposed 38.8 22.73 0.00 158225 text_action_add 0.00 0.00 144527/293246 bfd_zmalloc ----------------------------------------- Same data, after optimization: % time self children called name ----------------------------------------- 0.00 0.00 14/158225 compute_text_actions 0.00 0.00 25211/158225 remove_dead_literal 0.00 0.01 58645/158225 coalesce_shared_literal 0.00 0.01 74355/158225 text_action_add_proposed 0.1 0.00 0.02 158225 text_action_add 0.01 0.00 144527/144527 splay_tree_insert 0.00 0.00 144527/195130 splay_tree_lookup 0.00 0.00 144527/293246 bfd_zmalloc ----------------------------------------- 2015-04-03 Max Filippov <jcmvbkbc@gmail.com> bfd/ * elf32-xtensa.c (splay-tree.h): include header. (text_action_struct): drop next pointer. (text_action_list_struct): drop head pointer, add count and tree fields. (find_fill_action): instead of linear search in text_action_list search in the tree. (text_action_compare, action_first, action_next): new functions. (text_action_add, text_action_add_literal): instead of linear search and insertion insert new node into the tree. (removed_by_actions): pass additional parameter: action_list, use it to traverse the tree. (offset_with_removed_text): pass additional action_list parameter to removed_by_actions. (map_action_fn_context): new typedef. (map_action_fn_context_struct): new structure. (map_action_fn): new function. (map_removal_by_action): use splay_tree_foreach to build map. (find_insn_action): replace linear search in text_action_list with series of splay_tree_lookups. (print_action, print_action_list_fn): new functions. (print_action_list): use splay_tree_foreach. (init_xtensa_relax_info): drop action_list.head initialization. Initialize the tree. (compute_text_actions): use non-zero action_list_count instead of non-NULL action list. (xlate_map_context): new typedef. (xlate_map_context_struct): new structure. (xlate_map_fn): new function. (build_xlate_map): use splay_tree_foreach to build map. (action_remove_bytes_fn): new function. (relax_section): use zero action_list_count instead of NULL action list. Use splay_tree_foreach to count final section size. Drop unused variable 'removed'.
2015-04-09xtensa: optimize find_removed_literalMax Filippov1-6/+58
find_removed_literal uses linear search to find removed literal by its VMA. The list of literals is fixed at that point, build an ordered index array and use binary search instead. Original profile: % time self children called name ----------------------------------------- 56.72 0.00 297578/669392 translate_reloc 70.86 0.00 371814/669392 relax_section 67.9 127.58 0.00 669392 find_removed_literal ----------------------------------------- Same data, after optimization: % time self children called name ----------------------------------------- 0.00 0.00 297578/669392 translate_reloc 0.00 0.00 371814/669392 relax_section 0.0 0.00 0.00 669392 find_removed_literal 0.00 0.00 23838/23838 map_removed_literal ----------------------------------------- 2015-04-03 Max Filippov <jcmvbkbc@gmail.com> bfd/ * elf32-xtensa.c (removed_literal_map_entry): new typedef. (removed_literal_map_entry_struct): new structure. (removed_literal_list_struct): add new fields: n_map and map. (map_removed_literal, removed_literal_compare): new functions. (find_removed_literal): build index array for literals ordered by VMA, use binary search to find removed literal.
2015-04-09xtensa: optimize removed_by_actionsMax Filippov1-25/+156
The function removed_by_actions iterates through text actions to calculate an offset applied by text actions to a given VMA. Although it has a parameter p_start_action that allows for incremental offset calculation, in many places it's used with p_start_action explicitly set to the first action. After the first relaxation pass when the list of text actions is finalized, an array of offsets sorted by VMA may be used to speed up this function. Original profile: % time self children called name ----------------------------------------- 0.35 0.00 33872/4808961 relax_section_symbols 3.32 0.00 326022/4808961 relax_property_section 12.83 0.00 1259379/4808961 offset_with_removed_text 32.50 0.00 3189688/4808961 translate_reloc 71.5 49.00 0.00 4808961 removed_by_actions ----------------------------------------- Same data, after optimization: % time self children called name ----------------------------------------- 0.00 0.00 33872/4808537 relax_section_symbols 0.01 0.00 326022/4808537 relax_property_section 0.05 0.00 1258955/4808537 offset_with_removed_text_map 0.13 0.00 3189688/4808537 translate_reloc 1.0 0.20 0.00 4808537 removed_by_actions_map 0.00 0.00 120/120 map_removal_by_action ----------------------------------------- 2015-04-01 Max Filippov <jcmvbkbc@gmail.com> bfd/ * elf32-xtensa.c (removal_by_action_entry_struct, removal_by_action_map_struct): new structures. (removal_by_action_entry, removal_by_action_map): new typedefs. (text_action_list_struct): add new field: map. (map_removal_by_action, removed_by_actions_map, offset_with_removed_text_map): new functions. (relax_section): replace offset_with_removed_text with offset_with_removed_text_map. (translate_reloc, relax_property_section, relax_section_symbols): replace removed_by_actions with removed_by_actions_map.