aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2016-07-06btrace: record stop moves to the end of the traceusers/mmetzger/record-goto-miMarkus Metzger4-7/+147
With the btrace record target the "record stop" command implicitly moves all traced threads to the end of their respective history. Unlike record full, record btrace does not trace data and is therefore not able to resume debugging at the current replay position. We forgot to actually change the replay position before disabling tracing. This resulted in STOP_PC remaining at its old position if the current thread had been replaying, which, in turn, resulted in GDB commands such as list or backtrace using the wrong context. Fix it by moving the selected thread to the end of its recorded history. Together with the preceding patches, this will result in a front-end notification for the selected thread if it had been replaying. Stop replaying other threads silently, i.e. without a front-end notification. If the selected thread isn't replaying, notify front-ends without printing the (unchanged) frame. This results in a *stopped MI notification without any thread information. In non-stop mode, move all replaying threads to the end of their respective histories. This will result in a front-end notification and in the updated location to be printed for each replaying thread. We prefix the output with the thread number like this: (gdb) record stop Thread 1 (Thread 0x7ffff7fcc740 (LWP 66711)) stopped replaying. test (arg=0x0) at gdb.btrace/multi-thread-step.c:34 34 global = 42; /* bp.2 */ Thread 2 (Thread 0x7ffff74fb700 (LWP 66716)) stopped replaying. test (arg=0x0) at gdb.btrace/multi-thread-step.c:34 34 global = 42; /* bp.2 */ Process record is stopped and all execution logs are deleted. Thanks to Marc Khouzam <marc.khouzam@ericsson.com> for reporting this. Signed-off-by: Markus Metzger <markus.t.metzger@intel.com> gdb/ * record-btrace.c (record_btrace_set_replay) (record_btrace_stop_replaying): New declaration. (record_btrace_stop_recording): Call record_btrace_set_replay, record_btrace_stop_replaying, and observer_notify_normal_stop. testsuite/ * gdb.btrace/non-stop.exp: Test "record stop". * gdb.btrace/non-stop.c (test): Add statement to break at. * gdb.btrace/stop.exp: New. Change-Id: I10565a8e4f8bc3c63f79c3ef6595e9f84e3d8100
2016-07-06btrace-btrace: signal record-goto stopMarkus Metzger1-2/+6
When changing a thread's replay position, call record_signal_goto_stop instead of printing the source location directly. This will signal the stop to front-ends and have them print the source location. We update the STOP_PC if the change affects the selected thread. Signed-off-by: Markus Metzger <markus.t.metzger@intel.com> gdb/ * record-btrace.c (record_btrace_set_replay): Check ptid before updating STOP_PC. Call record_signal_goto_stop. Change-Id: If2cb2b9572396a2e5475d6611c7e9f79547c6f61
2016-07-06record-full: signal record-goto stopMarkus Metzger2-1/+10
When changing the replay position call record_signal_goto_stop instead of printing the new source location directly. This will signal the stop to front-ends and have them print the source location. Signed-off-by: Markus Metzger <markus.t.metzger@intel.com> gdb/ * record-full.c (record_full_goto_entry): Call record_signal_goto_stop. testsuite/ * gdb.mi/mi-reverse.exp: Test record goto begin/end. Change-Id: Ibae2736eb0cd3c70ba7d99d18836575eb0d23f33
2016-07-06mi, testsuite: add another EXTRA option to mi_expect_stopMarkus Metzger1-8/+18
Allow the EXTRA argument of mi_expect_stop to contain a third pattern that must occur directly before the GDB prompt at the end of the output. Signed-off-by: Markus Metzger <markus.t.metzger@intel.com> testsuite/ * lib/mi-support.exp (mi_expect_stop): Add third EXTRA field. Change-Id: I7b492b72619265ea81200935adf22d94bb086806
2016-07-06record: signal a record goto stop to front-endsMarkus Metzger2-0/+24
The "record goto" command does not indicate the stop to front-ends. Instead, it prints the new location directly. Add a function to signal a normal stop to observers and have them print the new location. This function temporarily switches to the stopped thread. We use the TARGET_WAITKIND_NO_RESUMED wait status for this purpose. This should result in a stop notification without giving a stop reason. We could also invent a new wait status but this doesn't seem necessary at this point. Signed-off-by: Markus Metzger <markus.t.metzger@intel.com> gdb/ * record.h (record_signal_goto_stop): New. * record.c (record_signal_goto_stop): New. Change-Id: I0b196be68779f9e81abca78df5bc39e917023581
2016-07-06infrun: export clear_proceed_status_threadMarkus Metzger2-3/+5
Signed-off-by: Markus Metzger <markus.t.metzger@intel.com> gdb/ * infrun.h (clear_proceed_status_thread): New. * infrun.c (clear_proceed_status_thread): Export. Change-Id: I23e762997359b9769856450e89626707bad1365e
2016-07-06record: do not allow record goto on a running threadMarkus Metzger1-0/+14
We can't start replaying if the selected thread is currently running. Throw an error in this case. Signed-off-by: Markus Metzger <markus.t.metzger@intel.com> gdb/ * record.c: Include gdbthread.h (require_not_running): New. (record_goto, cmd_record_goto_begin, cmd_record_goto_end): Call require_not_running. Change-Id: I15888d668b6011217337cf3a63d3618fb044c023
2016-07-06btrace: check if we're replaying when setting the replay position to the endMarkus Metzger2-1/+9
When setting the replay position to the end there is nothing to do if we are not replaying. Check that and return immediately. This avoids printing the current location if we're already at the end. Signed-off-by: Markus Metzger <markus.t.metzger@intel.com> gdb/ * record-btrace.c (record_btrace_set_replay): Check if replaying. testsuite/ * gdb.btrace/record_goto.exp: Test "record goto end" twice. Change-Id: I4878892408bab293261bbea40d6af28440ff3ec5
2016-07-06Allow subscripting raw pointersManish Goregaokar5-0/+17
This will be useful for dealing with vectors; regardless of our final solution for the Index trait. 2016-07-06 Manish Goregaokar <manish@mozilla.com> gdb/ChangeLog: * rust-lang.c (rust_subscript): Allow subscripting pointers gdb/testsuite/ChangeLog: * simple.rs: Add test for raw pointer subscripting * simple.exp: Add test expectations
2016-07-06Automatic date update in version.inGDB Administrator1-1/+1
2016-07-05Add -flto to PR ld/20321 testH.J. Lu2-1/+5
Before GCC 4.9, -flto is required for final LTO link. Add -flto to PR ld/20321 test to support older versions of GCC. * testsuite/ld-plugin/lto.exp: Add -flto to PR ld/20321 test.
2016-07-05Fix fail in gdb.mi/mi-reverse.expYao Qi2-1/+5
Commit 38b022b4452f996fb5a8598f80d850b594621bcf adds "method" and "format" fields in =record-started, but doesn't update test case gdb.mi/mi-reverse.exp, so it causes the fail like this, PASS: gdb.mi/mi-reverse.exp: mi runto main Expecting: ^(-interpreter-exec console record[^M ]+)?(=record-started,thread-group="i1"^M \^done[^M ]+[(]gdb[)] ^M [ ]*) -interpreter-exec console record^M =record-started,thread-group="i1",method="full"^M ^done^M (gdb) ^M FAIL: gdb.mi/mi-reverse.exp: Turn on process record and regression was found by buildbot too https://sourceware.org/ml/gdb-testers/2016-q2/msg04492.html gdb/testsuite: 2016-07-05 Yao Qi <yao.qi@linaro.org> * gdb.mi/mi-reverse.exp: Match =record-started output.
2016-07-05[ARM] Purecode compatible long branch veneer for M-profile targets with MOVW.Andre Vieria6-6/+127
2016-07-05 Andre Vieria <andre.simoesdiasvieira@arm.com> * elf32-arm.c (THUMB32_MOVT): New veneer macro. (THUMB32_MOVW): Likewise. (elf32_arm_stub_long_branch_thumb2_only_pure): New. (DEF_STUBS): Define long_branch_thumb2_only_pure. (arm_stub_is_thumb): Add new veneer stub. (arm_type_of_stub): Use new veneer. (arm_stub_required_alignment): Add new veneer. 2016-07-05 Andre Vieria <andre.simoesdiasvieira@arm.com> * testsuite/ld-arm/farcall-thumb2-purecode.d: New test result. * testsuite/ld-arm/farcall-thumb2-purecode.s: New test. * testsuite/ld-arm/arm-elf.exp: Run it.
2016-07-05[ARM] Change noread to purecode.Andre Vieria11-27/+56
bfd/ChangeLog 2016-07-05 Andre Vieria <andre.simoesdiasvieira@arm.com> * bfd-in2.h (SEC_ELF_NOREAD): Rename to ... (SEC_ELF_PURECODE): ... this. * elf32-arm.c (elf32_arm_post_process_headers): Rename SEC_ELF_NOREAD to SEC_ELF_NOREAD. (elf32_arm_fake_sections): Likewise. (elf_32_arm_section_flags): Likewise. (elf_32_arm_lookup_section_flags): Likewise. * section.c (SEC_ELF_NOREAD): Rename to ... (SEC_ELF_PURECODE): ... this. binutils/ChangeLog 2016-07-05 Andre Vieria <andre.simoesdiasvieira@arm.com> * objdump.c (dump_section_header): Rename SEC_ELF_NOREAD to SEC_ELF_NOREAD. * readelf.c (get_elf_section_flags): Rename ARM_NOREAD to ARM_PURECODE and SHF_ARM_NOREAD to SHF_ARM_PURECODE. (process_section_headers): Rename noread to purecode. * section.c (SEC_ELF_NOREAD): Rename to ... (SEC_ELF_PURECODE): ... this. include/ChangeLog 2016-07-05 Andre Vieria <andre.simoesdiasvieira@arm.com> * elf/arm.h (SHF_ARM_NOREAD): Rename to ... (SHF_ARM_PURECODE): ... this. ld/ChangeLog 2016-07-05 Andre Vieria <andre.simoesdiasvieira@arm.com> * testsuite/ld-arm/arm_noread.ld: Renamed to ... testsuite/ld-arm/arm_purecode.ld: ... this, and replaced all noread's by purecode.
2016-07-05ld: track linker-definedness of symbolsJan Beulich3-5/+14
Keep "lineno" as zero while not processing any script, and use it being zero to set the "linker_def" field to true.
2016-07-05x86: fix register check in check_qword_reg()Jan Beulich4-1/+19
A missing 'r' (or wrong 'e') register prefix needs to be complained about if the template allows for a 64-bit register, not a 32-bit one. I assume this was a copy-and-paste type of mistake (from check_long_reg()).
2016-07-05babeltrace compilation regressionJan Kratochvil3-2/+7
Since: commit 2d681be471cf8aff8f296cb7713c39e9aa4fc2bb Author: Andreas Arnez <arnez@linux.vnet.ibm.com> Date: Wed Apr 27 15:52:16 2016 +0200 Avoid non-C++-enabled babeltrace versions tested with: libbabeltrace-devel-1.2.4-4.fc24.x86_64 libbabeltrace-devel-1.4.0-2.fc25.x86_64 it can no longer build due to: configure:16435: gcc -o conftest -m64 -g3 -pipe -Wall -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -fno-diagno stics-show-caret -Werror -static-libstdc++ -static-libgcc conftest.c -ldl -ldl -lncurses -lm -ldl -lbabeltrace -lbabeltrace-ctf >&5 conftest.c: In function 'main': conftest.c:208:7: error: 'pos' is a pointer; did you mean to use '->'? gdb/ChangeLog 2016-07-05 Jan Kratochvil <jan.kratochvil@redhat.com> * configure: Regenerate. * configure.ac (HAVE_LIBBABELTRACE): Fix pos variable dereference.
2016-07-05Automatic date update in version.inGDB Administrator1-1/+1
2016-07-04Warn and return for duplicated pluginH.J. Lu4-0/+28
If a plugin has been loaded already, we should warn and return, instead of adding it on the plugin list. PR ld/20321 * plugin.c (plugin_opt_plugin): Warn and return if plugin has been loaded already. * testsuite/ld-plugin/lto.exp: Run PR ld/20321 test. * testsuite/ld-plugin/pr20321.c: New file.
2016-07-04Allow the flash and ram memory region sizes to be specified in the default ↵Nick Clifton2-4/+14
FT32 linker script. * scripttempl/ft32.sc (__PMSIZE_): If not defined, set to 256K. (__RAMSIZE): If not defined, set to 64K. (MEMORY): Set the flash region size to __PMSIZE and the ram region size to __RAMSIZE.
2016-07-04Automatic date update in version.inGDB Administrator1-1/+1
2016-07-03Automatic date update in version.inGDB Administrator1-1/+1
2016-07-02MIPS/GAS/testsuite: Remove remnants of a.out/ECOFF supportMaciej W. Rozycki27-1822/+1066
Complement: commit 16e5e222b6eae6f110ea72bf627585c095a453a8 Author: Richard Sandiford <rdsandiford@googlemail.com> Date: Sat Jun 22 16:57:42 2013 +0000 <https://sourceware.org/ml/binutils/2013-06/msg00195.html>, ("Make gas/mips/mips.exp ELF-only"), and remove the remaining stale ECOFF test dumps and pieces of a.out/ECOFF support in relocation match patterns. gas/ * testsuite/gas/mips/ecoff@ld.d: Remove test. * testsuite/gas/mips/ecoff@ld-forward.d: Remove test. * testsuite/gas/mips/ecoff@ld-zero-3.d: Remove test. * testsuite/gas/mips/ecoff@sd.d: Remove test. * testsuite/gas/mips/ecoff@sd-forward.d: Remove test. * testsuite/gas/mips/beq.d: Remove a.out and ECOFF support from reloc patterns. * testsuite/gas/mips/mipsr6@beq.d: Likewise. * testsuite/gas/mips/bge.d: Likewise. * testsuite/gas/mips/mipsr6@bge.d: Likewise. * testsuite/gas/mips/bgeu.d: Likewise. * testsuite/gas/mips/mipsr6@bgeu.d: Likewise. * testsuite/gas/mips/blt.d: Likewise. * testsuite/gas/mips/mipsr6@blt.d: Likewise. * testsuite/gas/mips/bltu.d: Likewise. * testsuite/gas/mips/mipsr6@bltu.d: Likewise. * testsuite/gas/mips/branch-likely.d: Likewise. * testsuite/gas/mips/la.d: Likewise. * testsuite/gas/mips/lb.d: Likewise. * testsuite/gas/mips/lifloat.d: Likewise. * testsuite/gas/mips/sb.d: Likewise. * testsuite/gas/mips/uld.d: Likewise. * testsuite/gas/mips/ulh.d: Likewise. * testsuite/gas/mips/ulw.d: Likewise. * testsuite/gas/mips/usd.d: Likewise. * testsuite/gas/mips/ush.d: Likewise. * testsuite/gas/mips/usw.d: Likewise.
2016-07-02MIPS/LD/testsuite: Resurrect `branch-misc-2' testMaciej W. Rozycki3-0/+36
Revert: commit c9c1e416d7dd1a35bd7c1a96d034dca1d5071cd1 Author: Alexandre Oliva <aoliva@redhat.com> Date: Thu Dec 12 04:39:44 2002 +0000 <https://sourceware.org/ml/binutils/2002-11/msg00657.html>, ("mips: branches to external labels are broken"), complementing: commit bad36eacdad37042c4efb1c5fbf48476b47de82b Author: Daniel Jacobowitz <drow@false.org> Date: Wed Nov 23 14:04:18 2005 +0000 <https://sourceware.org/ml/binutils/2005-11/msg00324.html>, ("R_MIPS_PC16, again"). ld/ * testsuite/ld-mips-elf/branch-misc-2.d: New test. * testsuite/ld-mips-elf/mips-elf.exp: Run it.
2016-07-02MIPS/GAS/testsuite: Split `branch-misc-2' tests into twoMaciej W. Rozycki24-148/+313
Move `branch-misc-2' tests for non locally-defined-global symbols into separate files. These tests have been introduced with: commit 6f171daac941741e5fa904f6e462adb75a595495 Author: Alexandre Oliva <aoliva@redhat.com> Date: Thu Dec 12 04:40:22 2002 +0000 <https://sourceware.org/ml/binutils/2002-11/msg00631.html>, ("mips: branches to external labels are broken"), and: commit d17b874b6c14caa2f2ed1b5544a48de9f39a1a65 Author: Alexandre Oliva <aoliva@redhat.com> Date: Wed Mar 12 23:07:22 2003 +0000 <https://sourceware.org/ml/binutils/2003-03/msg00136.html>, ("On resolving the MIPS gas branch reloc issue"), while the test case served a different purpose. With the original intent of the test case brought back with: commit bad36eacdad37042c4efb1c5fbf48476b47de82b Author: Daniel Jacobowitz <drow@false.org> Date: Wed Nov 23 14:04:18 2005 +0000 <https://sourceware.org/ml/binutils/2005-11/msg00324.html>, ("R_MIPS_PC16, again"), these stand in the way for linker testing. gas/ * testsuite/gas/mips/branch-misc-2.s: Move non locally-defined-global symbol tests... * testsuite/gas/mips/branch-misc-5.s: ... to this new test. * testsuite/gas/mips/branch-misc-2.d: Update accordingly. * testsuite/gas/mips/branch-misc-2-64.d: Likewise. * testsuite/gas/mips/branch-misc-2pic.d: Likewise. * testsuite/gas/mips/branch-misc-2pic-64.d: Likewise. * testsuite/gas/mips/mipsr6@branch-misc-2-64.d: Likewise. * testsuite/gas/mips/mipsr6@branch-misc-2pic-64.d: Likewise. * testsuite/gas/mips/micromips@branch-misc-2.d: Likewise. * testsuite/gas/mips/micromips@branch-misc-2-64.d: Likewise. * testsuite/gas/mips/micromips@branch-misc-2pic.d: Likewise. * testsuite/gas/mips/micromips@branch-misc-2pic-64.d: Likewise. * testsuite/gas/mips/branch-misc-5.d: New test. * testsuite/gas/mips/branch-misc-5pic.d: New test. * testsuite/gas/mips/branch-misc-5-64.d: New test. * testsuite/gas/mips/branch-misc-5pic-64.d: New test. * testsuite/gas/mips/mipsr6@branch-misc-5-64.d: New test. * testsuite/gas/mips/mipsr6@branch-misc-5pic-64.d: New test. * testsuite/gas/mips/micromips@branch-misc-5.d: New test. * testsuite/gas/mips/micromips@branch-misc-5pic.d: New test. * testsuite/gas/mips/micromips@branch-misc-5-64.d: New test. * testsuite/gas/mips/micromips@branch-misc-5pic-64.d: New test. * testsuite/gas/mips/mips.exp: Run the new tests.
2016-07-02MIPS/GAS/testsuite: Reenable disabled external BEQ testsMaciej W. Rozycki5-8/+27
Complement: commit bad36eacdad37042c4efb1c5fbf48476b47de82b Author: Daniel Jacobowitz <drow@false.org> Date: Wed Nov 23 14:04:18 2005 +0000 <https://sourceware.org/ml/binutils/2005-11/msg00324.html>, ("R_MIPS_PC16, again"), and reenable external BEQ tests, the remaining subset missed from the set of branch tests previously disabled with: commit 6f171daac941741e5fa904f6e462adb75a595495 Author: Alexandre Oliva <aoliva@redhat.com> Date: Thu Dec 12 04:40:22 2002 +0000 <https://sourceware.org/ml/binutils/2002-11/msg00631.html>, ("mips: branches to external labels are broken"). gas/ * testsuite/gas/mips/beq.s: Uncomment branches to undefined symbols. * testsuite/gas/mips/beq.d: Update accordingly. * testsuite/gas/mips/mipsr6@beq.d: Likewise. * testsuite/gas/mips/micromips@beq.d: Likewise.
2016-07-02MIPS/GAS/testsuite: Restrict 64-bit `branch-mips' tests to NewABI targetsMaciej W. Rozycki2-3/+13
... removing numerous `mips-sgi-irix5' failures. gas/ * testsuite/gas/mips/mips.exp: Restrict 64-bit `branch-mips' tests to NewABI targets.
2016-07-02MIPS/GAS/testsuite: Group `branch-misc' tests togetherMaciej W. Rozycki2-3/+7
gas/ * testsuite/gas/mips/mips.exp: Group `branch-misc' tests together.
2016-07-02Automatic date update in version.inGDB Administrator1-1/+1
2016-07-01Optimize memory_xfer_partial for remoteDon Breazeal5-2/+58
Some analysis we did here showed that increasing the cap on the transfer size in target.c:memory_xfer_partial could give 20% or more improvement in remote load across JTAG. Transfer sizes were capped to 4K bytes because of performance problems encountered with the restore command, documented here: https://sourceware.org/ml/gdb-patches/2013-07/msg00611.html and in commit 67c059c29e1f ("Improve performance of large restore commands"). The 4K cap was introduced because in a case where the restore command requested a 100MB transfer, memory_xfer_partial would repeatedy allocate and copy an entire 100MB buffer in order to properly handle breakpoint shadow instructions, even though memory_xfer_partial would actually only write a small portion of the buffer contents. A couple of alternative solutions were suggested: * change the algorithm for handling the breakpoint shadow instructions * throttle the transfer size up or down based on the previous actual transfer size I tried implementing the throttling approach, and my implementation reduced the performance in some cases. This patch implements a new target function that returns that target's limit on memory transfer size. It defaults to ULONGEST_MAX bytes, because for native targets there is no marshaling and thus no limit is needed. For remote targets it uses get_memory_write_packet_size. gdb/ChangeLog: * remote.c (remote_get_memory_xfer_limit): New function. * target-delegates.c: Regenerate. * target.c (memory_xfer_partial): Call target_ops.to_get_memory_xfer_limit. * target.h (struct target_ops) <to_get_memory_xfer_limit>: New member.
2016-07-01[AArch64] Fix +nofp16 handlingSzabolcs Nagy7-21/+105
Feature flag handling was not perfect, +nofp16 disabled fp instructions too. New feature flag macros were added to check features with multiple bits set (matters for FP_F16 and SIMD_F16 opcode feature tests). The unused AARCH64_OPCODE_HAS_FEATURE was removed, all checks should use one of the AARCH64_CPU_HAS_* macros. AARCH64_CPU_HAS_FEATURE now checks all feature bits. The aarch64_features table now contains the dependencies as a separate field (so when the feature is enabled all dependencies are enabled and when it is disabled everything that depends on it is disabled). Note that armv8-a+foo+nofoo is not equivalent to armv8-a if +foo turns on dependent features that nofoo does not turn off. gas/ * config/tc-aarch64.c (struct aarch64_option_cpu_value_table): Add require field. (aarch64_features): Initialize require fields. (aarch64_parse_features): Handle dependencies. (aarch64_feature_enable_set, aarch64_feature_disable_set): New. (md_assemble): Use AARCH64_CPU_HAS_ALL_FEATURES. * testsuite/gas/aarch64/illegal-nofp16.s: New. * testsuite/gas/aarch64/illegal-nofp16.l: New. * testsuite/gas/aarch64/illegal-nofp16.d: New. include/ * opcode/aarch64.h (AARCH64_CPU_HAS_ALL_FEATURES): New. (AARCH64_CPU_HAS_ANY_FEATURES): New. (AARCH64_CPU_HAS_FEATURE): Define as AARCH64_CPU_HAS_ALL_FEATURES. (AARCH64_OPCODE_HAS_FEATURE): Remove.
2016-07-01Fake VFORK_DONE events when following only the parent after a vfork.John Baldwin2-9/+121
FreeBSD does not currently report a ptrace event for a parent process after it resumes due to the child exiting the shared memory region after a vfork. Take the same approach used in linux-nat.c in this case of sleeping for a while and then reporting a fake VFORK_DONE event. gdb/ChangeLog: * fbsd-nat.c (struct fbsd_fork_child_info): Rename to ... (struct fbsd_fork_info): ... this. (struct fbsd_fork_info) <child>: Rename to ... (struct fbsd_fork_info) <ptid>: ... this. (fbsd_pending_children): Update type. (fbsd_remember_child): Update type and field name. (fbsd_is_child_pending): Likewise. (fbsd_pending_vfork_done): New variable. (fbsd_is_vfork_done_pending): New function. (fbsd_next_vfork_done): New function. (fbsd_resume): Don't resume processes with a pending vfork done event. (fbsd_wait): Report pending vfork done events. (fbsd_follow_fork): Delay and record a pending vfork done event for a vfork parent when detaching the child.
2016-07-01Move fbsd_resume and related functions below fork following helper code.John Baldwin2-64/+70
gdb/ChangeLog: * fbsd-nat.c (super_resume): Move earlier next to "super_wait". (resume_one_thread_cb): Move below fork following helper code. (resume_all_threads_cb): Likewise. (fbsd_resume): Likewise.
2016-07-01Honor detach-on-fork on FreeBSD.John Baldwin2-1/+6
Only detach from the new child process in the follow fork callback if detach_fork is true. gdb/ChangeLog: * fbsd-nat.c (fbsd_follow_fork): Only detach child if "detach_fork" is true.
2016-07-01Fix Thumb-2 BL detectionThomas Preud'homme6-9/+46
2016-07-01 Thomas Preud'homme <thomas.preudhomme@arm.com> bfd/ * elf32-arm.c (using_thumb2_bl): New function. (arm_type_of_stub): Declare thumb2 variable together and change type to bfd_boolean. Use using_thumb2_bl () to determine whether THM_MAX_FWD_BRANCH_OFFSET or THM2_MAX_FWD_BRANCH_OFFSET should be checked for BL range. (elf32_arm_final_link_relocate): Use using_thumb2_bl () to determine the bit size of BL offset. ld/ * testsuite/ld-arm/arm-elf.exp (Thumb-2 BL): Assemble for ARMv7. (Thumb-2 BL on ARMv6-M): New testcase. * testsuite/ld-arm/thumb2-bl.d: Do not try to match testcase filename. * testsuite/ld-arm/thumb2-bl.s: Do not select architecture.
2016-07-01Set debug registers on all threads belonging to the current inferior.John Baldwin2-3/+15
gdb/ChangeLog: * x86bsd-nat.c: Include 'gdbthread.h'. (x86bsd_dr_set): Set debug registers on all threads belonging to the current inferior.
2016-07-01Consolidate x86 debug register code for BSD native targets.John Baldwin15-255/+246
Move the debug register support code from amd64bsd-nat.c and i386bsd-nat.c into a shared x86bsd-nat.c. Instead of setting up x86_dr_low in amd64fbsd-nat.c and i386fbsd-nat.c, add a x86bsd_target function that creates a new target that inherits from inf_ptrace and sets up x86 debug registers if supported. In addition to initializing x86_dr_low, the x86bsd target installs a custom mourn_inferior target operation to clean up the x86 debug register state. Previously this was only done on amd64. Now it will be done for both i386 and amd64. The i386bsd_target and amd64bsd_target functions create targets that inherit from x86bsd rather than inf_ptrace. gdb/ChangeLog: * Makefile.in [HFILES_NO_SRCDIR]: Replace 'amd64bsd-nat.h' with 'x86bsd-nat.h'. * amd64bsd-nat.c: Include 'x86bsd-nat.h' instead of 'amd64bsd-nat.h'. (amd64bsd_xsave_len): Rename and move to x86bsd-nat.c. (amd64bsd_fetch_inferior_registers): Replace 'amd64bsd_xsave_len' with 'x86bsd_xsave_len'. (amd64bsd_store_inferior_registers): Likewise. (amd64bsd_target): Inherit from x86bsd_target. (amd64bsd_dr_get): Rename and move to x86bsd-nat.c. (amd64bsd_dr_set): Likewise. (amd64bsd_dr_set_control): Likewise. (amd64bsd_dr_set_addr): Likewise. (amd64bsd_dr_get_addr): Likewise. (amd64bsd_dr_get_status): Likewise. (amd64bsd_dr_get_control): Likewise. * amd64fbsd-nat.c: Include 'x86bsd-nat.h' instead of 'amd64bsd-nat.h'. (super_mourn_inferior): Move to x86bsd-nat.c. (amd64fbsd_mourn_inferior): Rename and move to x86bsd-nat.c. (amd64fbsd_read_description): Replace 'amd64bsd_xsave_len' with 'x86bsd_xsave_len'. (_initialize_amd64fbsd_nat): Remove x86 watchpoint setup and mourn_inferior' target op. * config/i386/fbsd.mh (NATDEPFILES): Add x86bsd-nat.o. * config/i386/fbsd64.mh: Likewise. * config/i386/nbsd64.mh: Likewise. * config/i386/nbsdelf.mh: Likewise. * config/i386/obsd.mh: Likewise. * config/i386/obsd64.mh: Likewise. * i386bsd-nat.c: Include 'x86bsd-nat.h'. (i386bsd_xsave_len): Rename and move to x86bsd-nat.c. (i386bsd_fetch_inferior_registers): Replace 'i386bsd_xsave_len' with 'x86bsd_xsave_len'. (i386bsd_store_inferior_registers): Likewise. (i386bsd_target): Inherit from x86bsd_target. (i386bsd_dr_get): Rename and move to x86bsd-nat.c. (i386bsd_dr_set): Likewise. (i386bsd_dr_set_control): Likewise. (i386bsd_dr_set_addr): Likewise. (i386bsd_dr_get_addr): Likewise. (i386bsd_dr_get_status): Likewise. (i386bsd_dr_get_control): Likewise. * i386bsd-nat.h (i386bsd_xsave_len): Remove. (i386bsd_dr_set_control): Remove. (i386bsd_dr_set_addr): Remove. (i386bsd_dr_get_addr): Remove. (i386bsd_dr_get_status): Remove. (i386bsd_dr_get_control): Remove. * i386fbsd-nat.c: Include 'x86bsd-nat.h'. (i386fbsd_read_description): Replace 'i386bsd_xsave_len' with 'x86bsd_xsave_len'. (_initialize_i386fbsd_nat): Remove x86 watchpoint setup and mourn_inferior' target op. * x86bsd-nat.c: New file. * x86bsd-nat.h: New file.
2016-07-01Fix potential buffer overflows with sprintf and very large integer values.Nick Clifton4-19/+46
binutuils* prdbg.c (pr_enum_type): Use a buffer big enough to hold an extremely large decimal value. (pr_range_type): Likewise. (pr_array_type): Likewise. (pr_struct_field): Likewise. (pr_class_baseclass): Likewise. (pr_class_method_variant): Likewise. (pr_tag_type): Likewise. (pr_int_constant): Likewise. (pr_typed_constant): Likewise. (pr_variable): Likewise. (pr_function_parameter): Likewise. (pr_start_block): Likewise. (pr_lineno): Likewise. (pr_end_block): Likewise. (tg_enum_type): Likewise. (tg_int_constant): Likewise. (tg_typed_constant): Likewise. (tg_start_block): Likewise. gas * macro.c (macro_expand_body): Use a buffer big enough to hold an extremely large integer.
2016-07-01Extend JIT-reader test and fix GDB problems that exposesPedro Alves9-42/+347
The jit-reader.exp test isn't really exercising the jit-reader's unwinder API at all. This commit address that, and then fixes GDB problems exposed. - The custom JIT reader provided for the jit-reader.exp testcase always rejects the jitted function's frame... This is because the custom JIT reader in the testcase never ever sets state->code_begin/end, so the bounds check in gdb.base/jitreader.c:unwind_frame: if (this_ip >= state->code_end || this_ip < state->code_begin) return GDB_FAIL; tends to fail, unless you're "lucky" (because it references uninitialized data). The result is that GDB is always actually using a built-in unwinder for the jitted function. - The provided unwinder doesn't do anything that GDB's built-in unwinder can't do. IOW, we can't really tell whether the JIT reader's unwinder is working or not. I fixed that by making the jitted function mangle its own stack pointer with a xor, and then teaching the jit unwinder to demangle it back (another xor). So now "backtrace" with GDB's built-in unwinder fails while with the jit unwinder, it succeeds. - GDB crashes after unloading the JIT reader, and flushing frames... I made the testcase use the "flushregs" command after unloading the JIT reader, to force the JIT frames to be flushed. However, that crashes GDB... When reinit_frame_cache tears down a frame's cache, it calls its unwinder's dealloc_cache method, which for JIT frames ends up in jit.c:jit_dealloc_cache. This function calls each of the frame's gdb_reg_value's "free" pointer: for (i = 0; i < gdbarch_num_regs (frame_arch); i++) if (priv_data->registers[i] && priv_data->registers[i]->free) priv_data->registers[i]->free (priv_data->registers[i]); and the problem is these gdb_reg_value instances have been returned by the JIT reader that has been already unloaded, and their "free" function pointers likely point to functions in the DSO that has already been unloaded... A fix for that could be to call reinit_frame_cache in jit_reader_unload_command _before_ unloading the jit reader DSO so that the jit reader is given a chance to clean up the gdb_reg_values before it is unloaded. However, the fix for the point below makes this unnecessary, because it stops jit.c from keeping around gdb_reg_values in the first place. - However, it still makes sense to clear the frame cache when loading or unloading a JIT unwinder. This makes testing a JIT unwinder a bit simpler. - Not only the frame cache actually -- gdb is not unloading the jit-registered objfiles when the JIT reader is unloaded, and not loading the already-registered descriptors when a JIT reader is loaded. The new test exercises unloading the jit reader, loading it back again, and then making sure the JIT reader's unwinder works again. Without the unload/re-load of already-read descriptors, the newly loaded JIT would have no idea where the new function is, because it's stored at symbol read time. - I added a couple "info frame" calls to the test, and that crashes GDB... The problem is that jit_frame_prev_register assumes it'll only be called for raw registers, so when it gets a pseudo register number, the "priv->registers[reg]" access is really an out-of-bounds access. To fix that, I made jit_frame_prev_register use gdbarch_pseudo_register_read_value for reading the pseudo-registers. However, that works with a regcache and we don't have one. To fix that, I made the JIT unwinder store a regcache in its cache instead of an array of gdb_reg_value pointers. gdb/ChangeLog: 2016-07-01 Pedro Alves <palves@redhat.com> Tom Tromey <tom@tromey.com> * jit.c (jit_reader_load_command): Call reinit_frame_cache and jit_inferior_created_hook. (jit_reader_unload_command): Call reinit_frame_cache and jit_inferior_exit_hook. * jit.c (struct jit_unwind_private) <registers>: Delete field. <regcache>: New field. (jit_unwind_reg_set_impl): Set the register's value in the regcache. Free the passed-in gdb_reg_value. (jit_dealloc_cache): Adjust to free the regcache. (jit_frame_sniffer): Allocate a regcache instead of an array of gdb_reg_value pointers. (jit_frame_this_id): Adjust. (jit_frame_prev_register): Read raw registers off of the regcache instead of from the gdb_reg_value pointer array. Use gdbarch_pseudo_register_read_value to read pseudo registers. * regcache.c (regcache_raw_set_cached_value): New function, factored out from ... (regcache_raw_write): ... here. * regcache.h (regcache_raw_set_cached_value): Declare. gdb/testsuite/ChangeLog: 2016-07-01 Pedro Alves <palves@redhat.com> * gdb.base/jit-reader.exp (info_registers_current_frame): New procedure. (jit_reader_test): Test the jit reader's unwinder. * gdb.base/jithost.c (jit_function_00_code): New global. (main): Use memcpy to fill in the mmapped code, instead of poking bytes manually here. * gdb.base/jitreader.c (enum register_mapping) <AMD64_RBP>: New value. (read_debug_info): Save the function's range. (read_sp): New function. (unwind_frame): Use it. Also unwind RBP. (get_frame_id): Use read_sp. (gdb_init_reader): Use calloc instead of malloc. * lib/gdb.exp (get_hexadecimal_valueof): Add optional 'test' parameter. Use gdb_test_multiple.
2016-07-01Fix failure to detach if process exits while detaching on LinuxPedro Alves9-70/+689
This commit fixes detaching on Linux when some thread exits the whole thread group (process) just while we're detaching. On Linux, a ptracer must detach from each LWP individually, with PTRACE_DETACH. Since PTRACE_DETACH sets the thread running free, if one of the already-detached threads causes the whole thread group to exit (e.g., simply calls exit), the kernel force-kills the other threads in the group, making them zombie, just as we're still detaching them. Since PTRACE_DETACH against a zombie thread fails with ESRCH, and gdb/gdbserver are not expecting this, the detach fails with an error like: "Can't detach process: No such process.". This patch detects this detach failure as normal, and instead of erroring out, reaps the now-dead thread. New test included, that exercises several different scenarios that cause GDB/GDBserver to error out when it should not. Tested on x86-64 GNU/Linux with {unix, native-gdbserver, native-extended-gdbserver} Note: without the previous fix, the "single-process + continue" variant of the new test would fail with: (gdb) PASS: gdb.threads/process-dies-while-detaching.exp: single-process: continue: watchpoint: switch to parent continue Continuing. Warning: Could not insert hardware watchpoint 3. Could not insert hardware breakpoints: You may have requested too many hardware breakpoints/watchpoints. Command aborted. (gdb) FAIL: gdb.threads/process-dies-while-detaching.exp: single-process: continue: watchpoint: continue gdb/gdbserver/ChangeLog: 2016-07-01 Pedro Alves <palves@redhat.com> Antoine Tremblay <antoine.tremblay@ericsson.com> * linux-low.c: Change interface to take the target lwp_info pointer directly and return void. Handle detaching from a zombie thread. (linux_detach_lwp_callback): New function. (linux_detach): Detach from the leader thread after detaching from the clone threads. gdb/ChangeLog: 2016-07-01 Pedro Alves <palves@redhat.com> Antoine Tremblay <antoine.tremblay@ericsson.com> * inf-ptrace.c (inf_ptrace_detach_success): New function, factored out from ... (inf_ptrace_detach): ... here. * inf-ptrace.h (inf_ptrace_detach_success): New declaration. * linux-nat.c (get_pending_status): Rename to ... (get_detach_signal): ... this, and return a host signal instead of filling in a wait status. (detach_one_lwp): New function, factored out from detach_callback and adjusted to handle detaching from a zombie thread. (detach_callback): Skip the leader thread. (linux_nat_detach): No longer defer to inf_ptrace_detach to detach the leader thread, nor build a signal string to pass down. Instead, use target_announce_detach, detach_one_lwp and inf_ptrace_detach_success. gdb/testsuite/ChangeLog: 2016-07-01 Pedro Alves <palves@redhat.com> Antoine Tremblay <antoine.tremblay@ericsson.com> * gdb.threads/process-dies-while-detaching.c: New file. * gdb.threads/process-dies-while-detaching.exp: New file.
2016-07-01Forget watchpoint locations when inferior exits or is killed/detachedPedro Alves6-8/+189
If you have two inferiors (or more), set watchpoints in one of the inferiors, and then that inferior exits, until you manually delete the watchpoint (or something forces a breakpoint re-set), you can't resume the other inferior. This is exercised by the test added by this commit. Without the GDB fix, this test fails like this: FAIL: gdb.multi/watchpoint-multi-exit.exp: dispose=kill: continue to marker in inferior 1 FAIL: gdb.multi/watchpoint-multi-exit.exp: dispose=detach: continue to marker in inferior 1 FAIL: gdb.multi/watchpoint-multi-exit.exp: dispose=exit: continue to marker in inferior 1 and gdb.log shows (in all three cases): (gdb) continue Continuing. Warning: Could not insert hardware watchpoint 2. Could not insert hardware breakpoints: You may have requested too many hardware breakpoints/watchpoints. Command aborted. (gdb) FAIL: gdb.multi/watchpoint-multi-exit.exp: dispose=kill: continue to marker in inferior 1 The problem is that GDB doesn't forget about the locations of watchpoints set in the inferior that is now dead. When we try to continue the inferior that is still alive, we reach insert_breakpoint_locations, which has the the loop that triggers the error: /* If we failed to insert all locations of a watchpoint, remove them, as half-inserted watchpoint is of limited use. */ That loop finds locations that are not marked inserted, but which according to should_be_inserted should have been inserted, and so errors out. gdb/ChangeLog: 2016-07-01 Pedro Alves <palves@redhat.com> * breakpoint.c (breakpoint_init_inferior): Discard watchpoint locations. * infcmd.c (detach_command): Call breakpoint_init_inferior. gdb/testsuite/ChangeLog: 2016-07-01 Pedro Alves <palves@redhat.com> * gdb.multi/watchpoint-multi-exit.c: New file. * gdb.multi/watchpoint-multi-exit.exp: New file.
2016-07-01Factor out "Detaching from program" message printingPedro Alves7-36/+41
Several targets have a copy of the same code that prints "Detaching from program ..." in their target_detach implementation. Factor that out to a common function. (For now, I left the couple targets that print this a bit differently alone. Maybe this could be further pulled out into infcmd.c. If we did that, and those targets want to continue printing differently, this new function could be converted to a target method.) gdb/ChangeLog: 2016-07-01 Pedro Alves <palves@redhat.com> * darwin-nat.c (darwin_detach): Use target_announce_detach. * inf-ptrace.c (inf_ptrace_detach): Likewise. * nto-procfs.c (procfs_detach): Likewise. * remote.c (remote_detach_1): Likewise. * target.c (target_announce_detach): New function. * target.h (target_announce_detach): New declaration.
2016-07-01Fix formatting of some previous gdb/testsuite/ChangeLog entriesPedro Alves1-10/+15
2016-07-01Fix formatting of some previous gdb/ChangeLog entriesPedro Alves1-4/+2
2016-07-01Expect the objcopy without global symbols test to fail for ARM and AArch64 ↵Nick Clifton2-0/+11
targets. * testsuite/binutils-all/objcopy.exp (objcopy_test_without_global_symbol): Expect this test to fail on the AArch64 and ARM targets, since they preserve their mapping symbols.
2016-07-01x86-64/MPX: relax no-RIP-relative-addressing testcaseJan Beulich2-4/+8
... for COFF targets.
2016-07-01Add marker for 2.27 branch.Tristan Gingold7-3/+22
binutils/ 2016-07-01 Tristan Gingold <gingold@adacore.com> * NEWS: Add marker for 2.27. gas/ 2016-07-01 Tristan Gingold <gingold@adacore.com> * NEWS: Add marker for 2.27. ld/ 2016-07-01 Tristan Gingold <gingold@adacore.com> * NEWS: Add marker for 2.27.
2016-07-01Fix mis-placement in binutils.texiTristan Gingold2-2/+6
binutils/ * doc/binutils.texi (objdump): Fix mis-placement.
2016-07-01x86-64/MPX: bndmk, bndldx, and bndstx don't allow RIP-relative addressingJan Beulich4-132/+227
Additionally warn about scaling factors other than 1 for the latter two, as those get ignored by the hardware.
2016-07-01x86/MPX: fix address size handlingJan Beulich5-4/+223
While address overrides are ignored in 64-bit mode (and hence shouldn't really result in an error, but upon v1 converting this to a warning I was told otherwise), trying to use 16-bit addressing is documented to result in #UD, and hence the assembler should reject the attempt. (The added test case at once also checks that bndc{l,n,u} won't accept 16-bit register operands.)