aboutsummaryrefslogtreecommitdiff
path: root/gdb
AgeCommit message (Collapse)AuthorFilesLines
2016-02-25[PR gdb/13808] gdb.trace: Pass tdesc selected in gdbserver to IPA.Marcin Kościelnicki15-70/+298
If gdbserver and IPA are using different tdesc, they will disagree about 'R' trace packet size. This results in mangled traces. To make sure they pick the same tdesc, gdbserver pokes the tdesc (specified as an index in a target-specific list) into a global variable in IPA. In theory, IPA could find out the tdesc on its own, but that may be complex (in particular, I don't know how to tell whether we have LAST_BREAK on s390 without messing with ptrace), and we'd have to duplicate the logic. Tested on i386 and x86_64. On i386, it fixes two FAILs in ftrace.exp. On x86_64, these failures have been KFAILed - one of them works now, but the other now fails due to an unrelated reason (ugh). gdb/gdbserver/ChangeLog: PR gdb/13808 * Makefile.in: Add i386-*-linux-ipa.o and amd64-*-linux-ipa.o. * configure.srv: Ditto. * linux-aarch64-ipa.c (get_ipa_tdesc): New function. (initialize_low_tracepoint): Remove ipa_tdesc assignment. * linux-amd64-ipa.c: Add "linux-x86-tdesc.h" include. (init_registers_amd64_linux): Remove prototype. (tdesc_amd64_linux): Remove declaration. (get_ipa_tdesc): New function. (initialize_low_tracepoint): Remove ipa_tdesc assignment, initialize remaining tdescs. * linux-i386-ipa.c: Add "linux-x86-tdesc.h" include. (init_registers_i386_linux): Remove prototype. (tdesc_i386_linux): Remove declaration. (get_ipa_tdesc): New function. (initialize_low_tracepoint): Remove ipa_tdesc assignment, initialize remaining tdescs. * linux-low.c (linux_get_ipa_tdesc_idx): New function. (linux_target_ops): wire in linux_get_ipa_tdesc_idx. * linux-low.h (struct linux_target_ops): Add get_ipa_tdesc_idx. * linux-x86-low.c: Move tdesc declarations to linux-x86-tdesc.h. (x86_get_ipa_tdesc_idx): New function. (the_low_target): Wire in x86_get_ipa_tdesc_idx. * linux-x86-tdesc.h: New file. * target.h (struct target_ops): Add get_ipa_tdesc_idx. (target_get_ipa_tdesc_idx): New macro. * tracepoint.c (ipa_tdesc_idx): New macro. (struct ipa_sym_addresses): Add addr_ipa_tdesc_idx. (symbol_list): Add ipa_tdesc_idx. (cmd_qtstart): Write ipa_tdesc_idx in the target. (ipa_tdesc): Remove. (ipa_tdesc_idx): New variable. (get_context_regcache): Use get_ipa_tdesc. (gdb_collect): Ditto. (gdb_probe): Ditto. * tracepoint.h (get_ipa_tdesc): New prototype. (ipa_tdesc): Remove. gdb/testsuite/ChangeLog: PR gdb/13808 * gdb.trace/ftrace.exp (test_fast_tracepoints): Remove kfail.
2016-02-25Initialize variables in i386_linux_handle_segmentation_faultSimon Marchi2-1/+7
We see this error when building with gcc 4.3. ../../gdb/i386-linux-tdep.c: In function ‘i386_linux_handle_segmentation_fault’: ../../gdb/i386-linux-tdep.c:399: error: ‘access’ may be used uninitialized in this function ../../gdb/i386-linux-tdep.c:399: error: ‘upper_bound’ may be used uninitialized in this function ../../gdb/i386-linux-tdep.c:399: error: ‘lower_bound’ may be used uninitialized in this function It's a false positive, since the variables will always get initialized in the TRY clause, and the CATCH returns. gdb/ChangeLog: * i386-linux-tdep.c (i386_linux_handle_segmentation_fault): Initialize variables.
2016-02-25gdb.trace: Remove unnecessary target check from ftrace.exp.Marcin Kościelnicki2-69/+70
The check used hardcoded targets and wasn't doing anything useful anyway, since unsupported architectures blow up on link due to missing the IPA library before they ever get to that check. gdb/testsuite/ChangeLog: * gdb.trace/ftrace.exp: Remove unnecessary target check.
2016-02-25gdb.trace: Surround $call_insn with \y in entry-values.expMarcin Kościelnicki2-1/+8
The PPC64 tracepoint patch added \y at the end of the call_insn pattern - without that, it embarassed itself and matched the 'bl' in "Dump of assem*bl*er code for function" as the powerpc call opcode. Since that sounds like a generally good idea, I've added \y before and after call_insn for every target. As a result, I had to change x86_64's mnemonic to 'callq'. gdb/testsuite/ChangeLog: * gdb.trace/entry-values.exp: Surround $call_insn with '\y', change x86_64 call_insn to 'callq'.
2016-02-25Map registers to remote numbers when encoding an ax_reg or ax_reg_mask operationAntoine Tremblay2-1/+13
When encoding the agent expression operation ax_reg or ax_reg_mask, the register number used is internal to GDB. However GDBServer expects a tdesc based number. This usually does not cause a problem since at the moment, for raw registers GDBServer R trace action ignores the register mask and just collects all registers. It can be a problem, however with pseudo registers on some platforms if the tdesc number doesn't match the GDB internal register number. This is the case with ARM, the upcoming ARM tracepoint support, fails these test cases without this patch: gdb.trace/collection.exp: collect register locals collectively:* GDBSever would exit with: unhandled register size Since the register number is not mapped. This patch fixes these issues by calling gdbarch_remote_register_number before encoding the register number in the ax_reg or ax_reg_mask operation. Tested on x86 native-gdbserver no regressions observed. gdb/ChangeLog: * ax-general.c (ax_reg): Call gdbarch_remote_register_number. (ax_reg_mask): Likewise.
2016-02-24Handle MIPS Linux SIGTRAP siginfo.si_code valuesPedro Alves5-185/+203
This unbreaks pending/delayed breakpoints handling, as well as hardware watchpoints, on MIPS. Ref: https://sourceware.org/ml/gdb-patches/2016-02/msg00681.html The MIPS kernel reports SI_KERNEL for all kernel generated traps, instead of TRAP_BRKPT / TRAP_HWBKPT, but GDB isn't aware of this. Basically, this commit: - Folds watchpoints logic into check_stopped_by_breakpoint, and renames it to save_stop_reason. - Adds GDB_ARCH_IS_TRAP_HWBKPT. - Makes MIPS set both GDB_ARCH_IS_TRAP_BRPT and GDB_ARCH_IS_TRAP_HWBKPT to SI_KERNEL. In save_stop_reason, we handle the case of the same si_code returning true for both TRAP_BRPT and TRAP_HWBKPT by looking at what the debug registers say. Tested on x86-64 Fedora 20, native and gdbserver. gdb/ChangeLog: 2016-02-24 Pedro Alves <palves@redhat.com> * linux-nat.c (save_sigtrap) Delete. (stop_wait_callback): Call save_stop_reason instead of save_sigtrap. (check_stopped_by_breakpoint): Rename to ... (save_stop_reason): ... this. Bits of save_sigtrap folded here. Use GDB_ARCH_IS_TRAP_HWBKPT and handle ambiguous GDB_ARCH_IS_TRAP_BRKPT / GDB_ARCH_IS_TRAP_HWBKPT. Factor out common code between the USE_SIGTRAP_SIGINFO and !USE_SIGTRAP_SIGINFO blocks. (linux_nat_filter_event): Call save_stop_reason instead of save_sigtrap. * nat/linux-ptrace.h: Check for both SI_KERNEL and TRAP_BRKPT si_code for MIPS. * nat/linux-ptrace.h: Fix "TRAP_HWBPT" typo in x86 table. Add comments on MIPS behavior. (GDB_ARCH_IS_TRAP_HWBKPT): Define for all archs. gdb/gdbserver/ChangeLog: 2016-02-24 Pedro Alves <palves@redhat.com> * linux-low.c (check_stopped_by_breakpoint): Rename to ... (save_stop_reason): ... this. Use GDB_ARCH_IS_TRAP_HWBKPT and handle ambiguous GDB_ARCH_IS_TRAP_BRKPT / GDB_ARCH_IS_TRAP_HWBKPT. Factor out common code between the USE_SIGTRAP_SIGINFO and !USE_SIGTRAP_SIGINFO blocks. (linux_low_filter_event): Call save_stop_reason instead of check_stopped_by_breakpoint and check_stopped_by_watchpoint. Update comments. (linux_wait_1): Update comments.
2016-02-24[OBV] gdb/rs6000: Fix maybe-uninitialized warning.Marcin Kościelnicki2-1/+6
Introduced by 657f9cde9d531c9929bef9e02a8064101d568f50. gdb/ChangeLog: * rs6000-tdep.c (rs6000_frame_cache): Initialize frame and pc to 0 to avoid spurious warnings.
2016-02-24Move tfile-avx.exp to tracefile-pseudo-reg.expAntoine Tremblay3-0/+7
As it is planned to add more architectures to this test, rename to a more generic name. gdb/testsuite/ChangeLog: * gdb.trace/tfile-avx.c: Move to... * gdb.trace/tracefile-pseudo-reg.c: Here. * gdb.trace/tfile-avx.exp: Move to... * gdb.trace/tracefile-pseudo-reg.exp: Here.
2016-02-24Move new skip features to proper section (post 7.11).Doug Evans1-8/+10
2016-02-24powerpc: Support z-point type in gdbserver.Wei-cheng Wang2-3/+73
Support z-point, so tracepoints and breakpoints can be inserted at the same location. gdb/gdbserver/ChangeLog: 2016-02-24 Wei-cheng Wang <cole945@gmail.com> * linux-ppc-low.c (ppc_supports_z_point_type): New function: (ppc_insert_point, ppc_remove_point): Insert/remove z-packet breakpoints. (ppc64_emit_ops_vector): Add target ops - ppc_supports_z_point_type, ppc_insert_point, ppc_remove_point.
2016-02-24Fix logic in exec_file_locate_attachGary Benson4-4/+17
This commit fixes an error in exec_file_locate_attach where the main executable could be loaded from outside the sysroot if a nonempty, non-"target:" sysroot was set but the discovered executable filename did not exist in that sysroot and did exist on the main filesystem. gdb/ChangeLog: * exec.c (exec_file_locate_attach): Do not attempt to locate main executable locally if not found in sysroot. gdb/testsuite/ChangeLog: * gdb.base/attach-pie-noexec.exp: Do not expect an error message on attach.
2016-02-24Document the GDB 7.11 release in gdb/ChangeLogJoel Brobecker1-0/+4
gdb/ChangeLog: GDB 7.11 released.
2016-02-24Build unavailable-stack frames for tracepoint.Wei-cheng Wang2-13/+45
gdb/ChangeLog: 2016-02-24 Wei-cheng Wang <cole945@gmail.com> * rs6000-tdep.c (rs6000_frame_cache, rs6000_frame_this_id): Handle unavailable PC/SP to build unavailable frame.
2016-02-23Extend "skip" command to support -file, -gfile, -function, -rfunction.Doug Evans17-183/+1085
gdb/ChangeLog: Extend "skip" command to support -file, -gfile, -function, -rfunction. * NEWS: Document new features. * skip.c: #include "fnmatch.h", "gdb_regex.h". (skiplist_entry) <file>: Renamed from filename. <function>: Renamed from function_name. <file_is_glob, function_is_regexp>: New members. <compiled_function_regexp, compiled_function_regexp_is_valid>: New members. (make_skip_entry): New function. (free_skiplist_entry, free_skiplist_entry_cleanup): New functions. (make_free_skiplist_entry_cleanup): New function. (skip_file_command): Update. (skip_function, skip_function_command): Update. (compile_skip_regexp): New functions. (skip_command): Add support for new options. (skip_info): Update. (skip_file_p, skip_gfile_p): New functions. (skip_function_p, skip_rfunction_p): New functions. (function_name_is_marked_for_skip): Update and simplify. (_initialize_step_skip): Update. * symtab.c: #include "fnmatch.h". (compare_glob_filenames_for_search): New function. * symtab.h (compare_glob_filenames_for_search): Declare. * utils.c (count_path_elements): New function. (strip_leading_path_elements): New function. * utils.h (count_path_elements): Declare. (strip_leading_path_elements): Declare. gdb/doc/ChangeLog: * gdb.texinfo (Skipping Over Functions and Files): Document new options to "skip" command. Update docs of output of "info skip". gdb/testsuite/ChangeLog: * gdb.base/skip.c (test_skip): New function. (end_test_skip_file_and_function): New function. (test_skip_file_and_function): New function. * gdb.base/skip1.c (test_skip): New function. (skip1_test_skip_file_and_function): New function. * gdb.base/skip.exp: Add tests for new skip options. * gdb.base/skip-solib.exp: Update expected output. * gdb.perf/skip-command.cc: New file. * gdb.perf/skip-command.exp: New file. * gdb.perf/skip-command.py: New file.
2016-02-23arm-tdep.c: Remove unused "to" parametersSimon Marchi2-4/+10
gdb/ChangeLog: * arm-tdep.c (arm_decode_svc_copro): Remove "to" parameter. (thumb_process_displaced_insn): Likewise. (arm_process_displaced_insn): Adjust calls.
2016-02-23Process record for aarch64-linux syscallYao Qi2-11/+77
This patch updates the syscalls in sync with syscalls/aarch64-linux.xml. Some syscalls are still not supported by gdb/linux-record.c yet. Mark them UNSUPPORTED_SYSCALL_MAP. This patch fixes the following test fail, Process record and replay target doesn't support syscall number 56^M Process record: failed to record execution log.^M ^M Program stopped.^M 0x00000020000e9dfc in open () from /lib/aarch64-linux-gnu/libc.so.6^M (gdb) FAIL: gdb.reverse/fstatat-reverse.exp: continue to breakpoint: marker2 gdb: 2016-02-23 Yao Qi <yao.qi@linaro.org> * aarch64-linux-tdep.c (enum aarch64_syscall) <aarch64_sys_mknod>: Remove. <aarch64_sys_mkdir, aarch64_sys_unlink, aarch64_sys_symlink>: Remove. <aarch64_sys_link, aarch64_sys_rename, aarch64_sys_faccess>: Remove. <aarch64_sys_mknodat, aarch64_sys_mkdirat>: New. <aarch64_sys_unlinkat, aarch64_sys_symlinkat>: New. <aarch64_sys_linkat, aarch64_sys_renameat, aarch64_sys_faccessat>: New. <aarch64_sys_open, aarch64_sys_readlink, aarch64_sys_fstatat>: Remove. <aarch64_sys_openat, aarch64_sys_readlinkat>: New. <aarch64_sys_newfstatat>: New. (UNSUPPORTED_SYSCALL_MAP): New macro. (aarch64_canonicalize_syscall): Add missing syscalls.
2016-02-22gdb.trace: Fix unavailable.exp if last register happens to be PC.Marcin Kościelnicki2-1/+6
unavailable.exp executes "info registers", expecting to find at least two instances of "<unavailable>". However, it uses "<unavailable>.*<unavailable>" as the pattern, which doesn't match when the last register happens to be available (eg. PC). Change it to ".*<unavailable>.*<unavailable>.*" instead. Noticed on s390, no regression on x86_64. gdb/testsuite/ChangeLog: * gdb.trace/unavailable.exp (gdb_unavailable_registers_test_1): Fix info registers pattern.
2016-02-22gdb-gdb.py: SyntaxError: Missing parentheses in call to 'print'Jan Kratochvil2-4/+8
After building GDB --with-python=/usr/bin/python3 and for example stripping ./gdb and running: ./gdb -data-directory data-directory/ -iex "add-auto-load-safe-path $PWD/gdb-gdb.gdb" -iex "add-auto-load-safe-path $PWD/gdb-gdb. py" ./gdb I get: Make breakpoint pending on future shared library load? (y or [n]) [answered N; input not from terminal] File "/home/jkratoch/redhat/gdb-test-python3/gdb/gdb-gdb.py", line 91 print "Warning: Cannot find enum type_flag_value type." ^ SyntaxError: Missing parentheses in call to 'print' (top-gdb) q gdb/ChangeLog 2016-02-22 Jan Kratochvil <jan.kratochvil@redhat.com> * gdb-gdb.py (class TypeFlagsPrinter): Use parentheses for print.
2016-02-22Fix arm process record code formatYao Qi2-136/+140
This patch fixes the various code format issues in arm process record in arm-tdep.c, such as using tab instead of spaces. gdb: 2016-02-22 Yao Qi <yao.qi@linaro.org> * arm-tdep.c: Fix code format issues.
2016-02-21Also update recursive call to d_lookup_symbol_imports.Iain Buclaw1-2/+2
2016-02-21Remove search_parents parameter from d_lookup_symbol_imports.Iain Buclaw2-31/+11
gdb/ChangeLog: * d-namespace.c (d_lookup_symbol_imports): Remove argument 'search_parents'. All callers updated.
2016-02-18Add D support to gdb_default_target_compile.Iain Buclaw2-0/+51
gdb/testsuite/ChangeLog: * lib/future.exp: Add D support. (gdb_find_gdc): New proc. (gdb_default_target_compile): Add D support.
2016-02-18Determine the iteration count based on wallclock instead of user+system time.Wei-cheng Wang2-10/+13
gdb/testsuite/ChangeLog: 2016-02-18 Wei-cheng Wang <cole945@gmail.com> * gdb.trace/tspeed.c (myclock): Return wallclock instead of user+system time. (trace_speed_test): Determine the iteration count for a time between 15..30 seconds.
2016-02-18gdb/s390: Fill guess_tracepoint_registers hook.Marcin Kościelnicki2-0/+40
gdb/ChangeLog: * s390-linux-tdep.c (s390_guess_tracepoint_registers): New function. (s390_gdbarch_init): Fill guess_tracepoint_registers hook.
2016-02-18Intel MPX bound violation handlingWalfred Tedeschi18-3/+619
With Intel Memory Protection Extensions it was introduced the concept of boundary violation. A boundary violations is presented to the inferior as a segmentation fault having SIGCODE 3. This patch adds a handler for a boundary violation extending the information displayed when a bound violation is presented to the inferior. In the stop mode case the debugger will also display the kind of violation: "upper" or "lower", bounds and the address accessed. On no stop mode the information will still remain unchanged. Additional information about bound violations are not meaningful in that case user does not know the line in which violation occurred as well. When the segmentation fault handler is stop mode the out puts will be changed as exemplified below. The usual output of a segfault is: Program received signal SIGSEGV, Segmentation fault 0x0000000000400d7c in upper (p=0x603010, a=0x603030, b=0x603050, c=0x603070, d=0x603090, len=7) at i386-mpx-sigsegv.c:68 68 value = *(p + len); In case it is a bound violation it will be presented as: Program received signal SIGSEGV, Segmentation fault Upper bound violation while accessing address 0x7fffffffc3b3 Bounds: [lower = 0x7fffffffc390, upper = 0x7fffffffc3a3] 0x0000000000400d7c in upper (p=0x603010, a=0x603030, b=0x603050, c=0x603070, d=0x603090, len=7) at i386-mpx-sigsegv.c:68 68 value = *(p + len); In mi mode the output of a segfault is: *stopped,reason="signal-received",signal-name="SIGSEGV", signal-meaning="Segmentation fault", frame={addr="0x0000000000400d7c", func="upper",args=[{name="p", value="0x603010"},{name="a",value="0x603030"} ,{name="b",value="0x603050"}, {name="c",value="0x603070"}, {name="d",value="0x603090"},{name="len",value="7"}], file="i386-mpx-sigsegv.c",fullname="i386-mpx-sigsegv.c",line="68"}, thread-id="1",stopped-threads="all",core="6" in the case of a bound violation: *stopped,reason="signal-received",signal-name="SIGSEGV", signal-meaning="Segmentation fault", sigcode-meaning="Upper bound violation", lower-bound="0x603010",upper-bound="0x603023",bound-access="0x60302f", frame={addr="0x0000000000400d7c",func="upper",args=[{name="p", value="0x603010"},{name="a",value="0x603030"},{name="b",value="0x603050"}, {name="c",value="0x603070"},{name="d",value="0x603090"}, {name="len",value="7"}],file="i386-mpx-sigsegv.c", fullname="i386-mpx-sigsegv.c",line="68"},thread-id="1", stopped-threads="all",core="6" 2016-02-18 Walfred Tedeschi <walfred.tedeschi@intel.com> gdb/ChangeLog: * NEWS: Add entry for bound violation. * amd64-linux-tdep.c (amd64_linux_init_abi_common): Add handler for segmentation fault. * gdbarch.sh (handle_segmentation_fault): New. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * i386-linux-tdep.c (i386_linux_handle_segmentation_fault): New. (SIG_CODE_BONDARY_FAULT): New define. (i386_linux_init_abi): Use i386_mpx_bound_violation_handler. * i386-linux-tdep.h (i386_linux_handle_segmentation_fault) New. * i386-tdep.c (i386_mpx_enabled): Add as external. * i386-tdep.c (i386_mpx_enabled): Add as external. * infrun.c (handle_segmentation_fault): New function. (print_signal_received_reason): Use handle_segmentation_fault. gdb/testsuite/ChangeLog: * gdb.arch/i386-mpx-sigsegv.c: New file. * gdb.arch/i386-mpx-sigsegv.exp: New file. * gdb.arch/i386-mpx-simple_segv.c: New file. * gdb.arch/i386-mpx-simple_segv.exp: New file. gdb/doc/ChangeLog: * gdb.texinfo (Signals): Add bound violation display hints for a SIGSEGV.
2016-02-18gdb: Add guess_tracepoint_registers hook to gdbarch.Marcin Kościelnicki7-39/+95
When we're looking at a tracefile trace frame where registers are not available, and the tracepoint has only one location, we supply the location's address as the PC register. However, this only works if PC is not a pseudo register, and individual architectures may want to guess more registers. Add a gdbarch hook that will handle that. gdb/ChangeLog: * arch-utils.c (default_guess_tracepoint_registers): New function. * arch-utils.h (default_guess_tracepoint_registers): New prototype. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh: Add guess_tracepoint_registers hook. * tracefile.c (tracefile_fetch_registers): Use the new gdbarch hook.
2016-02-18Remove setup_kfail server/13796 in disp-step-syscall.expYao Qi2-6/+5
This patch series add fork support in target remote, [PATCH v2 0/3] Target remote mode fork and exec support https://sourceware.org/ml/gdb-patches/2015-12/msg00144.html so GDB can be informed about the child, and adjust child correctly in displaced stepping. The PR server/13796 was fixed by this patch series actually. Test results on buildbot show this KFAIL->KPASS change https://sourceware.org/ml/gdb-testers/2015-q4/msg10128.html gdb/testsuite: 2016-02-18 Yao Qi <yao.qi@linaro.org> * gdb.base/disp-step-syscall.exp (disp_step_cross_syscall): Don't call setup_kfail.
2016-02-18Set breakpoint condition-evaluation in forking-threads-plus-breakpoint.expYao Qi2-0/+20
Proc do_test in forking-threads-plus-breakpoint.exp has an argument cond_bp_target, but the test doesn't use it to set "breakpoint condition-evaluation", which is an oversight in the test. This patch fixes it by setting "breakpoint condition-evaluation" per $cond_bp_target. gdb/testsuite: 2016-02-18 Yao Qi <yao.qi@linaro.org> * gdb.threads/forking-threads-plus-breakpoint.exp (do_test): Set "set breakpoint condition-evaluation" per $cond_bp_target.
2016-02-18gdb/doc: Add documentation for tfile description section lines.Marcin Kościelnicki2-1/+37
gdb/doc/ChangeLog: * gdb.texinfo (Trace File Format): Add documentation for description section lines.
2016-02-17Add missing cleanup in exec_file_locate_attachGary Benson2-0/+9
exec_file_locate_attach allocates memory for full_exec_path (using either exec_file_find, source_full_path_of or xstrdup) but this memory is never freed. This commit adds the necessary cleanup. gdb/ChangeLog: * exec.c (exec_file_locate_attach): Add missing cleanup.
2016-02-17gdbserver/s390: Advertise Z0 packet support.Marcin Kościelnicki2-1/+22
This is necessary for upcoming tracepoint support - otherwise, setting a tracepoint and a breakpoint on the same address will fail, since gdbserver won't know about gdb's breakpoint. Tested on s390x-ibm-linux-gnu and s390-ibm-linux-gnu, RHEL 7.2. gdb/gdbserver/ChangeLog: * linux-s390-low.c (s390_supports_z_point_type): New function. (struct linux_target_ops): Wire s390_supports_z_point_type in.
2016-02-16Whitespace cleanup for skip testcase.Doug Evans4-31/+65
gdb/testsuite/ChangeLog: * gdb.base/skip.c: Add copyright. Whitespace cleanup. * gdb.base/skip1.c: Ditto. * gdb.base/skip.exp: Whitespace cleanup.
2016-02-16PR remote/19496, internal err forking-threads-plus-bkptDon Breazeal4-7/+18
This patch fixes an internal error that occurs in gdb.threads/forking-threads-plus-breakpoint.exp: /blah/binutils-gdb/gdb/target.c:2723: internal-error: Can't determine the current address space of thread Thread 3170.3170 In default_thread_address_space, find_inferior_ptid couldn't find 3170.3170 because it had been overwritten in inferior_appeared, called as follows: inferior_appeared remote_add_inferior remote_notice_new_inferior remote_update_thread_list The cause of the problem was the following sequence of events: * GDB knows only about the main thread * the first fork event is reported to GDB, saved as pending_event * qXfer:threads:read gets the threads from the remote. remove_new_fork_children id's the fork child from the pending event and removes it from the list reported to GDB. All the rest of the threads, including the fork parent, are added to the GDB thread list. * GDB stops all the threads. All the stop events are pushed onto the stop reply queue behind the pending fork event. The fork waitstatus is saved in the fork parent thread's pending status field thread_info.suspend. * remote_wait_ns calls queued_stop_reply and process_stop_reply to remove the fork event from the front of the stop reply queue and save event information in the thread_info structure for the fork parent thread. Unfortunately, none of the information saved in this way is the fork-specific information. * A subsequent qXfer:threads:read packet gets the thread list including the fork parent and fork child. remove_new_fork_children checks the thread list to see if there is a fork parent, doesn't find one, checks the stop reply queue for a pending fork event, doesn't find one, and allows the fork child thread to be reported to GDB before the fork event has been handled. remote_update_thread_list calls remote_notice_new_thread and overwrites the current (main) thread in inferior_appeared. So the fork event has been reported out of target_wait but it was left pending on the infrun side (infrun.c:save_waitstatus). IOW, the fork event hasn't been processed by handle_inferior_event yet, so it hasn't made it to tp->pending_follow yet. The fix is to check thread_info.suspend along with the thread_info.pending_follow in remote.c:remove_new_fork_children, to prevent premature reporting of the fork child thread creation. gdb/ChangeLog: PR remote/19496 * remote.c (remove_new_fork_children): Check for pending fork status in thread_info.suspend. gdb/testsuite/ChangeLog: PR remote/19496 * gdb.threads/forking-threads-plus-breakpoint.exp (do_test): Remove kfail for PR remote/19496.
2016-02-16testsuite: Make standard_temp_file use invocation-specific directoriesSimon Marchi2-7/+11
Just like standard_output_file, standard_temp_file should use multiple directories to make the tests parallel-safe. However, standard_temp_file is sometimes called in some procedures that are not test-specific. For example, gdb_init uses it, but is called once before all test files are ran. Therefore, we can't organize it in a temp/gdb.subdir/testname layout, like standard_output_file. Because it's just meant for temporary files that don't really need to be inspected after the test, we can just put them in a directory based on the runtest pid. There is always a single exp file being executed by a particular runtest invocation at any given time, so it should be safe. gdb/testsuite/ChangeLog: * lib/gdb.exp (standard_temp_file): Return a path specific to the runtest invocation.
2016-02-16testsuite: Fix save-trace.exp writing outside standard output directorySimon Marchi2-1/+17
In save-trace.exp, we want to test loading of a tracepoint definition file with a relative path (I am not sure why in fact). We currently use "savetrace-relative.tr", which ends up directly in testsuite/. If we use [standard_output_file] on that path, it becomes absolute. I decided to just replace [pwd] with . (a dot) in the path given by standard_output_file to make it relative. However, this trick only works because [pwd] is a prefix of the standard output directory. So I added a check to verify that precondition. gdb/testsuite/ChangeLog: * gdb.trace/save-trace.exp: Change relative path to be in the standard output directory.
2016-02-16Fix cleanup in arm_linux_software_single_stepYao Qi2-1/+8
I see the following error in testing aarch64 GDB debugging arm program. (gdb) PASS: gdb.reverse/readv-reverse.exp: set breakpoint at marker2 continue Continuing. ================================================================= ==32273==ERROR: AddressSanitizer: attempting free on address which was not malloc()-ed: 0x000000ce4c00 in thread T0 #0 0x2ba5615645c7 in __interceptor_free (/usr/lib/x86_64-linux-gnu/libasan.so.1+0x545c7)^M #1 0x4be8b5 in VEC_CORE_ADDR_cleanup /home/yao/SourceCode/gnu/gdb/git/gdb/common/gdb_vecs.h:34^M #2 0x5e6d95 in do_my_cleanups /home/yao/SourceCode/gnu/gdb/git/gdb/common/cleanups.c:154^M #3 0x64c99a in fetch_inferior_event /home/yao/SourceCode/gnu/gdb/git/gdb/infrun.c:3975^M #4 0x678437 in inferior_event_handler /home/yao/SourceCode/gnu/gdb/git/gdb/inf-loop.c:44^M #5 0x5078f6 in remote_async_serial_handler /home/yao/SourceCode/gnu/gdb/git/gdb/remote.c:13223^M #6 0x4cecfd in run_async_handler_and_reschedule /home/yao/SourceCode/gnu/gdb/git/gdb/ser-base.c:137^M #7 0x676864 in gdb_wait_for_event /home/yao/SourceCode/gnu/gdb/git/gdb/event-loop.c:834^M #8 0x676a27 in gdb_do_one_event /home/yao/SourceCode/gnu/gdb/git/gdb/event-loop.c:323^M #9 0x676aed in start_event_loop /home/yao/SourceCode/gnu/gdb/git/gdb/event-loop.c:347^M #10 0x6706d2 in captured_command_loop /home/yao/SourceCode/gnu/gdb/git/gdb/main.c:318^M #11 0x66db8c in catch_errors /home/yao/SourceCode/gnu/gdb/git/gdb/exceptions.c:240^M #12 0x6716dd in captured_main /home/yao/SourceCode/gnu/gdb/git/gdb/main.c:1157^M #13 0x66db8c in catch_errors /home/yao/SourceCode/gnu/gdb/git/gdb/exceptions.c:240^M #14 0x671b7a in gdb_main /home/yao/SourceCode/gnu/gdb/git/gdb/main.c:1165^M #15 0x467684 in main /home/yao/SourceCode/gnu/gdb/git/gdb/gdb.c:32^M #16 0x2ba563ed7ec4 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21ec4)^M #17 0x4676b2 (/scratch/yao/gdb/build-git/aarch64-linux-gnu/gdb/gdb+0x4676b2) looks we should discard cleanup if function arm_linux_software_single_step returns early, or create cleanup when it is needed. gdb: 2016-02-16 Yao Qi <yao.qi@linaro.org> * arm-linux-tdep.c (arm_linux_software_single_step): Assign 'old_chain' later.
2016-02-16Remove PC from syscall_next_pcYao Qi7-14/+25
Method syscall_next_pc of struct arm_get_next_pcs_ops has an argument PC, which is not necessary, because PC can be got from regcache in 'struct arm_get_next_pcs'. This patch removes the PC argument of syscall_next_pc. gdb: 2016-02-16 Yao Qi <yao.qi@linaro.org> * arch/arm-get-next-pcs.h (struct arm_get_next_pcs_ops) <syscall_next_pc>: Remove argument PC. Callers updated. * arm-linux-tdep.c (arm_linux_get_next_pcs_syscall_next_pc): Remove argument PC. Get pc from regcache_read_pc. * arm-tdep.c (arm_get_next_pcs_syscall_next_pc): Remove argument PC. gdb/gdbserver: 2016-02-16 Yao Qi <yao.qi@linaro.org> * linux-arm-low.c (get_next_pcs_syscall_next_pc): Remove argument PC. Get pc from regcache_read_pc.
2016-02-15Add missing gdb.arch/i386-prologue.c prototypesJan Kratochvil2-0/+8
The testfile has not ran because: gdb.arch/i386-prologue.c:34:3: warning: implicit declaration of function 'standard' [-Wimplicit-function-declaration] standard (); ^ gdb.arch/i386-prologue.c:35:3: warning: implicit declaration of function 'stack_align_ecx' [-Wimplicit-function-declaration] stack_align_ecx (); ^ gdb.arch/i386-prologue.c:36:3: warning: implicit declaration of function 'stack_align_edx' [-Wimplicit-function-declaration] stack_align_edx (); ^ gdb.arch/i386-prologue.c:37:3: warning: implicit declaration of function 'stack_align_eax' [-Wimplicit-function-declaration] stack_align_eax (); ^ gdb/testsuite/ChangeLog 2016-02-15 Jan Kratochvil <jan.kratochvil@redhat.com> * gdb.arch/i386-prologue.c: Add missing prototypes.
2016-02-15Fix more testcases with standard_output_file.Jan Kratochvil4-3/+9
Since commit 2151ccc56c74b55a8f0debf0724a495368f92591 Author: Simon Marchi <simon.marchi@ericsson.com> Date: Mon Feb 8 14:02:36 2016 -0500 Always organize test artifacts in a directory hierarchy these testfiles could not build. gdb/testsuite/ChangeLog 2016-02-15 Jan Kratochvil <jan.kratochvil@redhat.com> * gdb.arch/i386-gnu-cfi.exp: Use standard_output_file. * gdb.arch/i386-prologue.exp: Likewise. * gdb.arch/i386-size.exp: Likewise.
2016-02-15testsuite: Fix some tests that write outside of the standard output directorySimon Marchi4-4/+15
gdb/testsuite/ChangeLog: * gdb.base/wrong_frame_bt_full.exp: Use standard_output_file to define object file path. * gdb.btrace/gcore.exp: Use standard_output_file to define core file path. * lib/opencl.exp (gdb_compile_opencl_hostapp): Use standard_output_file to define binfile.
2016-02-15Don't print 0x for core_addr_to_string_nzYao Qi2-2/+6
core_addr_to_string_nz returns string which has "0x" prefix, so don't need to print "0x" again. This patch is to remove the "0x". gdb: 2016-02-15 Yao Qi <yao.qi@linaro.org> * aarch64-tdep.c (aarch64_analyze_prologue): Remove "0x".
2016-02-14testsuite: Fix false Fortran regressions with recent gccJan Kratochvil3-12/+18
gcc-4.9.2-6.fc21.x86_64 -> gcc-5.3.1-2.fc23.x86_64 -PASS: gdb.fortran/vla-ptype.exp: ptype pvla not initialized +FAIL: gdb.fortran/vla-ptype.exp: ptype pvla not initialized -PASS: gdb.fortran/vla-history.exp: print vla1 allocated +FAIL: gdb.fortran/vla-history.exp: print vla1 allocated -PASS: gdb.fortran/vla-history.exp: print $2 +FAIL: gdb.fortran/vla-history.exp: print $2 -PASS: gdb.fortran/vla-value.exp: print undefined pvla +FAIL: gdb.fortran/vla-value.exp: print undefined pvla -PASS: gdb.fortran/vla-value.exp: print non-associated &pvla +FAIL: gdb.fortran/vla-value.exp: print non-associated &pvla -PASS: gdb.fortran/vla-value.exp: print undefined pvla(1,3,8) +FAIL: gdb.fortran/vla-value.exp: print undefined pvla(1,3,8) These issues get fixed (or removed if no longer applicable) by attached patch. It is based on Googled: http://www.cs.rpi.edu/~szymansk/OOF90/bugs.html#5 When a pointer is declared its status is undefined, and cannot be safely queried with the associated intrinsic. -> nullify(VARNAME) + https://software.intel.com/en-us/forums/intel-fortran-compiler-for-linux-and-mac-os-x/topic/268786 ALLOCATE is not supposed to initialize the array. -> Remove checks like an initial print is: \\( *0, *0, *0...\\) These regressions remain: -PASS: gdb.fortran/library-module.exp: print var_i in lib +FAIL: gdb.fortran/library-module.exp: print var_i in lib -PASS: gdb.fortran/library-module.exp: print var_i in main +FAIL: gdb.fortran/library-module.exp: print var_i in main I believe it is more a GDB bug (in a code contributed by me), filed: gdb.fortran/library-module.exp false regression on GCC upgrade https://sourceware.org/bugzilla/show_bug.cgi?id=19635 gdb/testsuite/ChangeLog 2016-02-14 Jan Kratochvil <jan.kratochvil@redhat.com> Fix compatibility with recent gfortran-5.3.1. * gdb.fortran/vla-history.exp (print vla1 allocated) (print vla2 allocated, print $2, print $3): Remove (print $4): Rename to ... (print $2): ... here. (print $9): Rename to ... (print $5): ... here. (print $10): Rename to ... (print $6): ... here. * gdb.fortran/vla.f90: Add pvla initialization.
2016-02-14testsuite regression: gdb.fortran/vla-value-sub.exp ↵Jan Kratochvil3-0/+10
gdb.fortran/vla-value-sub-finish.exp > +static int max_value_size = 65536; /* 64k bytes */ FAIL: gdb.fortran/vla-value-sub.exp: print array2 in foo after it was filled (passed fixed array) FAIL: gdb.fortran/vla-value-sub.exp: print array2 in foo after it was mofified in debugger (passed fixed array) FAIL: gdb.fortran/vla-value-sub-finish.exp: print array2 in foo after it was filled FAIL: gdb.fortran/vla-value-sub-finish.exp: print array2 in foo after it was mofified in debugger print array2 value requires 296352 bytes, which is more than max-value-size (gdb) FAIL: gdb.fortran/vla-value-sub.exp: print array2 in foo after it was filled (passed fixed array) gdb/testsuite/ChangeLog 2016-02-14 Jan Kratochvil <jan.kratochvil@redhat.com> * gdb.fortran/vla-value-sub-finish.exp (set max-value-size 1024*1024): New test. * gdb.fortran/vla-value-sub.exp: Likewise.
2016-02-12gdb.trace/tfile-avx.c: Change ymm15 to xmm15 for old gcc.Marcin Kościelnicki2-1/+7
gcc older than 4.9 doesn't understand ymm15 as a register name. Use xmm15 instead. gdb/testsuite/ChangeLog: * gdb.trace/tfile-avx.c (main): Change ymm15 to xmm15.
2016-02-12i386-biarch-core.exp: Use standard_output_fileSimon Marchi2-1/+6
Fix the core file path to use the standard output directory. gdb/testsuite/ChangeLog: * i386-biarch-core.exp: Define corefile using standard_output_file.
2016-02-12[gdbserver, aarch64] Use linux_{set,get}_pc_{64,32}bitYao Qi2-24/+10
We can use shared functions linux_{set,get}_pc_{64,32}bit in linux-aarch64-low.c to write and read pc. gdb/gdbserver: 2016-02-12 Yao Qi <yao.qi@linaro.org> * linux-aarch64-low.c (aarch64_get_pc): Call linux_get_pc_64bit or linux_get_pc_32bit. (aarch64_set_pc): Call linux_set_pc_64bit or linux_set_pc_32bit.
2016-02-12[ARM] Software single step cross kernel helpersYao Qi5-4/+203
GDB step cross kernel helpers only works if the kernel helpers are tail called, which is the case how it is used in glibc. See __aeabi_read_tp in sysdeps/unix/sysv/linux/arm/aeabi_read_tp.S. In __aeabi_read_tp, branch/jump to the kernel helper is the last instruction, and the next instruction address is in LR, which is in caller function. GDB can handle this correctly. For example, glibc function __GI___ctype_init calls __aeabi_read_tp 0xb6e19b30 <__GI___ctype_init+4>: ldr r3, [pc, #80] ; 0xb6e19b34 <__GI___ctype_init+8>: bl 0xb6e0a6e0 <__aeabi_read_tp> 0xb6e19b38 <__GI___ctype_init+12>: ldr r3, [pc, r3] and __aeabi_read_tp calls kernel helper, (gdb) disassemble __aeabi_read_tp 0xb6fef5d0 <+0>: mvn r0, #61440 ; 0xf000 0xb6fef5d4 <+4>: sub pc, r0, #31 once GDB or GDBserver single step instruction on 0xb6fef5d4, LR is 0xb6e19b38, which is right address of next instruction to set breakpoint on. However, if the kernel helpers are not tail-called, the LR is still the address in the caller function of kernel helper's caller, which isn't the right address of next instruction to set breakpoint on. For example, we use kernel helper in main, (gdb) disassemble main .... 0x00008624 <+32>: mov r3, #4064 ; 0xfe0^M 0x00008628 <+36>: movt r3, #65535 ; 0xffff^M 0x0000862c <+40>: blx r3 0x00008630 <+44>: ldr r3, [r11, #-8] kernel helper is called on 0x0000862c and the expected next instruction address is 0x00008630, but the LR now is the return address of main. The problem here is LR may not have the right address because when we single step the instruction, it isn't executed yet, so the LR isn't updated. This patch fix this problem by decoding instruction, if the instruction updates LR (BL and BLX), the next instruction address is PC + INSN_SIZE, otherwise, get the address of next instruction from LR. gdb: 2016-02-12 Yao Qi <yao.qi@linaro.org> * arch/arm-linux.c (arm_linux_get_next_pcs_fixup): Calculate nextpc according to instruction. gdb/testsuite: 2016-02-12 Yao Qi <yao.qi@linaro.org> * gdb.arch/arm-single-step-kernel-helper.c: New. * gdb.arch/arm-single-step-kernel-helper.exp: New.
2016-02-12[ARM] Fixup PC in software single stepYao Qi9-15/+67
When I exercise GDBserver software single step, I see the following error, which has been already handled by GDB properly. In GDBserver log, we can see, GDBserver tries to single step instruction on 0xb6e0a6e4, and destination address is 0xffff0fe0, stop pc is 0xb6e0a6e4 Writing f001f0e7 to 0xffff0fe0 in process 7132 Failed to insert breakpoint at 0xffff0fe0 (Input/output error). Failed to insert breakpoint at 0xffff0fe0 (-1). (gdb) disassemble __aeabi_read_tp,+8 Dump of assembler code from 0xb6e0a6e0 to 0xb6e0a6e8: 0xb6e0a6e0 <__aeabi_read_tp+0>: mvn r0, #61440 ; 0xf000 0xb6e0a6e4 <__aeabi_read_tp+4>: sub pc, r0, #31 however, it fails inserting breakpoint there. This problem has already fixed by GDB, see comments in arm-linux-tdep.c:arm_linux_software_single_step /* The Linux kernel offers some user-mode helpers in a high page. We can not read this page (as of 2.6.23), and even if we could then we couldn't set breakpoints in it, and even if we could then the atomic operations would fail when interrupted. They are all called as functions and return to the address in LR, so step to there instead. */ so we need to do the same thing in GDB side as well. This patch adds a new field fixup in arm_get_next_pcs_ops, so that we can fix up PC for arm-linux target. In this way, both GDB and GDBserver can single step instructions going to kernel helpers. gdb: 2016-02-12 Yao Qi <yao.qi@linaro.org> * arch/arm-get-next-pcs.c (arm_get_next_pcs): Call self->ops->fixup if it isn't NULL. * arch/arm-get-next-pcs.h: Include gdb_vecs.h. (struct arm_get_next_pcs_ops) <fixup>: New field. * arch/arm-linux.c: Include common-regcache.h and arch/arm-get-next-pcs.h. (arm_linux_get_next_pcs_fixup): New function. * arch/arm-linux.h (arm_linux_get_next_pcs_fixup): Declare. * arm-linux-tdep.c (arm_linux_get_next_pcs_ops): Initialize it with arm_linux_get_next_pcs_fixup. (arm_linux_software_single_step): Move code to arm_linux_get_next_pcs_fixup. * arm-tdep.c (arm_get_next_pcs_ops): Initialize it. gdb/gdbserver: 2016-02-12 Yao Qi <yao.qi@linaro.org> * linux-arm-low.c (get_next_pcs_ops): Initialize it with arm_linux_get_next_pcs_fixup.
2016-02-12gdb.trace: Deduplicate write_inferior_data_ptr.Marcin Kościelnicki2-53/+53
This function is now basically identical to write_inferior_data_pointer, remove it and change all references. gdb/gdbserver/ChangeLog: * tracepoint.c (x_tracepoint_action_download): Change write_inferior_data_ptr to write_inferior_data_pointer. (cmd_qtstart): Likewise. (write_inferior_data_ptr): Remove. (download_agent_expr): Change write_inferior_data_ptr to write_inferior_data_pointer. (download_tracepoint_1): Likewise. (download_tracepoint): Likewise. (download_trace_state_variables): Likewise.
2016-02-12gdb: Fix build failure in xml-tdesc.c without expat.Marcin Kościelnicki2-0/+18
Introduced by 18d3cec54e1b4fce278dba436484846f8048d7d6. gdb/ChangeLog: * xml-tdesc.c (target_fetch_description_xml) [!HAVE_LIBEXPAT]: Warn and return NULL.