summaryrefslogtreecommitdiff
path: root/gdb/record-full.c
Commit message (Collapse)AuthorAgeFilesLines
* fix regressions with target-asyncTom Tromey2014-03-121-19/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A patch in the target cleanup series caused a regression when using record with target-async. Version 4 of the patch is here: https://sourceware.org/ml/gdb-patches/2014-03/msg00159.html The immediate problem is that record supplies to_can_async_p and to_is_async_p methods, but does not supply a to_async method. So, when target-async is set, record claims to support async -- but if the underlying target does not support async, then the to_async method call will end up in that method's default implementation, namely tcomplain. This worked previously because the record target used to provide a to_async method; one that (erroneously, only at push time) checked the other members of the target stack, and then simply dropped to_async calls in the "does not implement async" case. My first thought was to simply drop tcomplain as the default for to_async. This works, but Pedro pointed out that the only reason record has to supply to_can_async_p and to_is_async_p is that these default to using the find_default_run_target machinery -- and these defaults are only needed by "run" and "attach". So, a nicer solution presents itself: change run and attach to explicitly call into the default run target when needed; and change to_is_async_p and to_can_async_p to default to "return 0". This makes the target stack simpler to use and lets us remove the method implementations from record. This is also in harmony with other plans for the target stack; namely trying to reduce the impact of find_default_run_target. This approach makes it clear that find_default_is_async_p is not needed -- it is asking whether a target that may not even be pushed is actually async, which seems like a nonsensical question. While an improvement, this approach proved to introduce the same bug when using the core target. Looking a bit deeper, the issue is that code in "attach" and "run" may need to use either the current target stack or the default run target -- but different calls into the target API in those functions could wind up querying different targets. This new patch makes the target to use more explicit in "run" and "attach". Then these commands explicitly make the needed calls against that target. This ensures that a single target is used for all relevant operations. This lets us remove a couple find_default_* functions from various targets, including the dummy target. I think this is a decent understandability improvement. One issue I see with this patch is that the new calls in "run" and "attach" are not very much like the rest of the target API. I think fundamentally this is due to bad factoring in the target API, which may need to be fixed for multi-target. Tackling that seemed ambitious for a regression fix. While working on this I noticed that there don't seem to be any test cases that involve both target-async and record, so this patch changes break-precsave.exp to add some. It also changes corefile.exp to add some target-async tests; these pass with current trunk and with this patch applied, but fail with the v1 patch. This patch differs from v4 in that it moves initialization of to_can_async_p and to_supports_non_stop into inf-child, adds some assertions to complete_target_initialization, and adds some comments to target.h. Built and regtested on x86-64 Fedora 20. 2014-03-12 Tom Tromey <tromey@redhat.com> * inf-child.c (return_zero): New function. (inf_child_target): Set to_can_async_p, to_supports_non_stop. * aix-thread.c (aix_thread_inferior_created): New function. (aix_thread_attach): Remove. (init_aix_thread_ops): Don't set to_attach. (_initialize_aix_thread): Register inferior_created observer. * corelow.c (init_core_ops): Don't set to_attach or to_create_inferior. * exec.c (init_exec_ops): Don't set to_attach or to_create_inferior. * infcmd.c (run_command_1): Use find_run_target. Make direct target calls. (attach_command): Use find_attach_target. Make direct target calls. * record-btrace.c (init_record_btrace_ops): Don't set to_create_inferior. * record-full.c (record_full_can_async_p, record_full_is_async_p): Remove. (init_record_full_ops, init_record_full_core_ops): Update. Don't set to_create_inferior. * target.c (complete_target_initialization): Add assertion. (target_create_inferior): Remove. (find_default_attach, find_default_create_inferior): Remove. (find_attach_target, find_run_target): New functions. (find_default_is_async_p, find_default_can_async_p) (target_supports_non_stop, target_attach): Remove. (init_dummy_target): Don't set to_create_inferior or to_supports_non_stop. * target.h (struct target_ops) <to_attach>: Add comment. Remove TARGET_DEFAULT_FUNC. <to_create_inferior>: Add comment. <to_can_async_p, to_is_async_p, to_supports_non_stop>: Use TARGET_DEFAULT_RETURN. <to_can_async_p, to_supports_non_stop, to_can_run>: Add comments. (find_attach_target, find_run_target): Declare. (target_create_inferior): Remove. (target_has_execution_1): Update comment. (target_supports_non_stop): Remove. * target-delegates.c: Rebuild. 2014-03-12 Tom Tromey <tromey@redhat.com> * gdb.base/corefile.exp (corefile_test_run, corefile_test_attach): New procs. Add target-async tests. * gdb.reverse/break-precsave.exp (precsave_tests): New proc. Add target-async tests.
* Add target_ops argument to to_goto_recordTom Tromey2014-02-191-1/+1
| | | | | | | | | 2014-02-19 Tom Tromey <tromey@redhat.com> * target.h (struct target_ops) <to_goto_record>: Add argument. * target.c (target_goto_record): Add argument. * record-full.c (record_full_goto): Add 'self' argument. * record-btrace.c (record_btrace_goto): Add 'self' argument.
* Add target_ops argument to to_goto_record_endTom Tromey2014-02-191-1/+1
| | | | | | | | | 2014-02-19 Tom Tromey <tromey@redhat.com> * target.h (struct target_ops) <to_goto_record_end>: Add argument. * target.c (target_goto_record_end): Add argument. * record-full.c (record_full_goto_end): Add 'self' argument. * record-btrace.c (record_btrace_goto_end): Add 'self' argument.
* Add target_ops argument to to_goto_record_beginTom Tromey2014-02-191-1/+1
| | | | | | | | | | | 2014-02-19 Tom Tromey <tromey@redhat.com> * target.h (struct target_ops) <to_goto_record_begin>: Add argument. * target.c (target_goto_record_begin): Add argument. * record-full.c (record_full_goto_begin): Add 'self' argument. * record-btrace.c (record_btrace_goto_begin): Add 'self' argument.
* Add target_ops argument to to_record_is_replayingTom Tromey2014-02-191-1/+1
| | | | | | | | | | | | | | | | 2014-02-19 Tom Tromey <tromey@redhat.com> * target.h (struct target_ops) <to_record_is_replaying>: Add argument. * target.c (target_record_is_replaying): Add argument. * record-full.c (record_full_is_replaying): Add 'self' argument. * record-btrace.c (record_btrace_is_replaying): Add 'self' argument. (record_btrace_xfer_partial, record_btrace_store_registers) (record_btrace_prepare_to_store, record_btrace_resume) (record_btrace_wait, record_btrace_decr_pc_after_break) (record_btrace_find_new_threads, record_btrace_thread_alive): Update.
* Add target_ops argument to to_delete_recordTom Tromey2014-02-191-1/+1
| | | | | | | | 2014-02-19 Tom Tromey <tromey@redhat.com> * target.h (struct target_ops) <to_delete_record>: Add argument. * target.c (target_delete_record): Add argument. * record-full.c (record_full_delete): Add 'self' argument.
* Add target_ops argument to to_save_recordTom Tromey2014-02-191-2/+3
| | | | | | | | | 2014-02-19 Tom Tromey <tromey@redhat.com> * target.h (struct target_ops) <to_save_record>: Add argument. * target.c (target_save_record): Add argument. * record-full.c (record_full_save): Add 'self' argument. (record_full_save): Add 'self' argument.
* Add target_ops argument to to_info_recordTom Tromey2014-02-191-1/+1
| | | | | | | | | | 2014-02-19 Tom Tromey <tromey@redhat.com> * target.h (struct target_ops) <to_info_record>: Add argument. * target.c (target_info_record): Add argument. * record.c (info_record_command): Add argument. * record-full.c (record_full_info): Add 'self' argument. * record-btrace.c (record_btrace_info): Add 'self' argument.
* Add target_ops argument to to_execution_directionTom Tromey2014-02-191-1/+1
| | | | | | | | | | | 2014-02-19 Tom Tromey <tromey@redhat.com> * target.h (struct target_ops) <to_execution_direction>: Add argument. (target_execution_direction): Add argument. * target.c (default_execution_direction): Add 'self' argument. * record-full.c (record_full_execution_direction): Add 'self' argument.
* Add target_ops argument to to_can_execute_reverseTom Tromey2014-02-191-1/+1
| | | | | | | | | | | | | 2014-02-19 Tom Tromey <tromey@redhat.com> * target.h (struct target_ops) <to_can_execute_reverse>: Add argument. (target_can_execute_reverse): Add argument. * remote.c (remote_can_execute_reverse): Add 'self' argument. * record-full.c (record_full_can_execute_reverse): Add 'self' argument. * record-btrace.c (record_btrace_can_execute_reverse): Add 'self' argument.
* Add target_ops argument to to_goto_bookmarkTom Tromey2014-02-191-1/+2
| | | | | | | | | 2014-02-19 Tom Tromey <tromey@redhat.com> * target.h (struct target_ops) <to_goto_bookmark>: Add argument. (target_goto_bookmark): Add argument. * target.c (dummy_goto_bookmark): Add 'self' argument. * record-full.c (record_full_goto_bookmark): Add 'self' argument.
* Add target_ops argument to to_get_bookmarkTom Tromey2014-02-191-1/+1
| | | | | | | | | 2014-02-19 Tom Tromey <tromey@redhat.com> * target.h (struct target_ops) <to_get_bookmark>: Add argument. (target_get_bookmark): Add argument. * target.c (dummy_get_bookmark): Add 'self' argument. * record-full.c (record_full_get_bookmark): Add 'self' argument.
* Add target_ops argument to to_closeTom Tromey2014-02-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | 2014-02-19 Tom Tromey <tromey@redhat.com> * windows-nat.c (windows_close): Add 'self' argument. * tracepoint.c (tfile_close): Add 'self' argument. * target.h (struct target_ops) <to_close>: Add argument. * target.c (target_close): Add argument. (update_current_target): Update. * remote.c (remote_close): Add 'self' argument. * remote-sim.c (gdbsim_close): Add 'self' argument. * remote-mips.c (mips_close): Add 'self' argument. * remote-m32r-sdi.c (m32r_close): Add 'self' argument. * record-full.c (record_full_close): Add 'self' argument. * record-btrace.c (record_btrace_close): Add 'self' argument. * monitor.h (monitor_close): Add 'self' argument. * monitor.c (monitor_close): Add 'self' argument. * mips-linux-nat.c (mips_linux_close): Add 'self' argument. * linux-nat.c (linux_nat_close): Add argument. * go32-nat.c (go32_close): Add 'self' argument. * exec.c (exec_close_1): Add 'self' argument. * ctf.c (ctf_close): Add 'self' argument. * corelow.c (core_close): Add 'self' argument. (core_close_cleanup): Update. * bsd-uthread.c (bsd_uthread_close): Add 'self' argument. * bsd-kvm.c (bsd_kvm_close): Add 'self' argument.
* add target method delegationTom Tromey2014-02-191-200/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch replaces some code in the record targets with target method delegation. record-full.c stores pointers to many target methods when the record target is pushed. Then it later delegates some calls via these. This is wrong because it violates the target stack contract. In particular it is ok to unpush a target at any stratum, but record-full does not keep track of this, so it could potentially call into an unpushed target. This patch fixes the problem by using the newly-introduced generic approach to target delegation for the methods in question. 2014-02-19 Tom Tromey <tromey@redhat.com> * record-full.c (record_full_beneath_to_resume_ops) (record_full_beneath_to_resume, record_full_beneath_to_wait_ops) (record_full_beneath_to_wait) (record_full_beneath_to_store_registers_ops) (record_full_beneath_to_store_registers) (record_full_beneath_to_xfer_partial_ops) (record_full_beneath_to_xfer_partial) (record_full_beneath_to_insert_breakpoint_ops) (record_full_beneath_to_insert_breakpoint) (record_full_beneath_to_remove_breakpoint_ops) (record_full_beneath_to_remove_breakpoint) (record_full_beneath_to_stopped_by_watchpoint) (record_full_beneath_to_stopped_data_address) (record_full_beneath_to_async, tmp_to_resume_ops, tmp_to_resume) (tmp_to_wait_ops, tmp_to_wait, tmp_to_store_registers_ops) (tmp_to_store_registers, tmp_to_xfer_partial_ops) (tmp_to_xfer_partial, tmp_to_instmp_to_insert_breakpoint_ops) (tmp_to_insert_breakpoint, tmp_to_remove_breakpoint_ops) (tmp_to_remove_breakpoint, tmp_to_stopped_by_watchpoint) (tmp_to_stopped_data_address, tmp_to_async): Remove. (record_full_open_1, record_full_open): Update. Use RECORD_IS_USED. (record_full_resume, record_full_wait_1) (record_full_stopped_by_watchpoint, record_full_stopped_data_address) (record_full_store_registers, record_full_xfer_partial) (record_full_insert_breakpoint, record_full_remove_breakpoint) (record_full_async, record_full_core_xfer_partial): Use target delegation. * target-delegates.c: Rebuild. * target.c (current_xfer_partial): Remove. (update_current_target): Do not INHERIT or de_fault to_insert_breakpoint, to_remove_breakpoint, to_stopped_data_address, to_stopped_by_watchpoint, to_can_async_p, to_is_async_p, to_async. Do not set to_xfer_partial field. (default_xfer_partial): Simplify. (current_xfer_partial): Remove. (target_wait, target_resume): Simplify. (find_default_can_async_p, find_default_is_async_p): Update. (init_dummy_target): Don't set to_can_async_p, to_is_async_p, to_xfer_partial, to_stopped_by_watchpoint, to_stopped_data_address. (target_store_registers): Simplify. (forward_target_remove_breakpoint) (forward_target_insert_breakpoint): Remove. (target_remove_breakpoint, target_insert_breakpoint) (debug_to_insert_breakpoint, debug_to_remove_breakpoint): Update. * target.h (struct target_ops) <to_resume, to_wait, to_store_registers, to_insert_breakpoint, to_remove_breakpoint, to_stopped_by_watchpoint, to_stopped_data_address, to_can_async_p, to_is_async_p, to_async, to_xfer_partial>: Add TARGET_DEFAULT markup. (forward_target_remove_breakpoint) (forward_target_insert_breakpoint): Remove. * record-btrace.c (record_btrace_remove_breakpoint): Delegate directly. (record_btrace_insert_breakpoint): Delegate directly.
* add "this" pointers to more target APIsTom Tromey2014-02-191-11/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A subsequent pass introduces delegation helper functions to the target API. This delegation is much cleaner if the target_ops pointer is directly available at delegation time. This patch adds the "this" pointer to various to_* methods for this purpose. This updates a number of ports which I am unable to test. Please give them a look-over. Any possible problem here is trivial, though, as all that is required is adding an argument to a function. 2014-02-19 Tom Tromey <tromey@redhat.com> * aarch64-linux-nat.c (aarch64_linux_stopped_by_watchpoint): Add 'ops' argument. * arm-linux-nat.c (arm_linux_stopped_by_watchpoint): Add 'ops' argument. * i386-nat.c (i386_stopped_by_watchpoint): Add 'ops' argument. * ia64-linux-nat.c (ia64_linux_stopped_by_watchpoint): Add 'ops' argument. * inf-ttrace.c (inf_ttrace_stopped_by_watchpoint): Add 'ops' argument. * linux-nat.c (save_sigtrap): Update. (linux_nat_stopped_by_watchpoint, linux_nat_is_async_p) (linux_nat_can_async_p, linux_nat_async): Add 'ops' argument. (linux_nat_close): Update. * mips-linux-nat.c (mips_linux_stopped_by_watchpoint): Add 'ops' argument. * ppc-linux-nat.c (ppc_linux_stopped_by_watchpoint): Add 'ops' argument. * procfs.c (procfs_stopped_by_watchpoint): Add 'ops' argument. * record-full.c (record_full_beneath_to_stopped_by_watchpoint) (record_full_beneath_to_async, tmp_to_stopped_by_watchpoint) (tmp_to_async): Add 'ops' argument. (record_full_stopped_by_watchpoint, record_full_async) (record_full_can_async_p, record_full_is_async_p): Add 'ops' argument. * remote-m32r-sdi.c (m32r_insert_breakpoint, m32r_remove_breakpoint) (m32r_stopped_by_watchpoint): Add 'ops' argument. * remote-mips.c (mips_stopped_by_watchpoint): Add 'ops' argument. * remote.c (remote_stopped_by_watchpoint_p, remote_can_async_p) (remote_is_async_p, remote_async): Add 'ops' argument. (remote_stopped_data_address): Update. * s390-nat.c (s390_stopped_by_watchpoint): Add 'ops' argument. * target.c (update_current_target) (find_default_can_async_p, find_default_is_async_p): Update. (init_dummy_target): Update. (debug_to_stopped_by_watchpoint): Add 'ops' argument. * target.h (struct target_ops) <to_stopped_by_watchpoint, to_can_async_p, to_is_async_p, to_async>: Add 'ops' argument. (target_can_async_p, target_is_async_p, target_async) (target_stopped_by_watchpoint): Update.
* Return target_xfer_status in to_xfer_partialYao Qi2014-02-111-10/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch does the conversion of to_xfer_partial from LONGEST (*to_xfer_partial) (struct target_ops *ops, enum target_object object, const char *annex, gdb_byte *readbuf, const gdb_byte *writebuf, ULONGEST offset, ULONGEST len); to enum target_xfer_status (*to_xfer_partial) (struct target_ops *ops, enum target_object object, const char *annex, gdb_byte *readbuf, const gdb_byte *writebuf, ULONGEST offset, ULONGEST len, ULONGEST *xfered_len); It changes to_xfer_partial return the transfer status and the transfered length by *XFERED_LEN. Generally, the return status has three stats, - TARGET_XFER_OK, - TARGET_XFER_EOF, - TARGET_XFER_E_XXXX, See the comments to them in 'enum target_xfer_status'. Note that Pedro suggested not name TARGET_XFER_DONE, as it is confusing, compared with "TARGET_XFER_OK". We finally name it TARGET_XFER_EOF. With this change, GDB core can handle unavailable data in a convenient way. The rationale behind this change was mentioned here https://sourceware.org/ml/gdb-patches/2013-10/msg00761.html Consider an object/value like this: 0 100 150 200 512 DDDDDDDDDDDxxxxxxxxxDDDDDD...DDIIIIIIIIIIII..III where D is valid data, and xxx is unavailable data, and I is beyond the end of the object (Invalid). Currently, if we start the xfer at 0, requesting, say 512 bytes, we'll first get back 100 bytes. The xfer machinery then retries fetching [100,512), and gets back TARGET_XFER_E_UNAVAILABLE. That's sufficient when you're either interested in either having the whole of the 512 bytes available, or erroring out. But, in this scenario, we're interested in the data at [150,512). The problem is that the last TARGET_XFER_E_UNAVAILABLE gives us no indication where to start the read next. We'd need something like: get me [0,512) >>> <<< here's [0,100), *xfered_len is 100, returns TARGET_XFER_OK get me [100,512) >>> (**1) <<< [100,150) is unavailable, *xfered_len is 50, return TARGET_XFER_E_UNAVAILABLE. get me [150,512) >>> <<< here's [150,200), *xfered_len is 50, return TARGET_XFER_OK. get me [200,512) >>> <<< no more data, return TARGET_XFER_EOF. This naturally implies pushing down the decision of whether to return TARGET_XFER_E_UNAVAILABLE or something else down to the target. (Which kinds of leads back to tfile itself reading from RO memory from file (though we could export a function in exec.c for that that tfile delegates to, instead of re-adding the old code). Beside this change, we also add a macro TARGET_XFER_STATUS_ERROR_P to check whether a status is an error or not, to stop using "status < 0". This patch also eliminates the comparison between status and 0. No target implementations to to_xfer_partial adapts this new interface. The interface still behaves as before. gdb: 2014-02-11 Yao Qi <yao@codesourcery.com> * target.h (enum target_xfer_error): Rename to ... (enum target_xfer_status): ... it. New. All users updated. (enum target_xfer_status) <TARGET_XFER_OK>, <TARGET_XFER_EOF>: New. (TARGET_XFER_STATUS_ERROR_P): New macro. (target_xfer_error_to_string): Remove declaration. (target_xfer_status_to_string): Declare. (target_xfer_partial_ftype): Adjust it. (struct target_ops) <to_xfer_partial>: Return target_xfer_status. Add argument xfered_len. Update comments. * target.c (target_xfer_error_to_string): Rename to ... (target_xfer_status_to_string): ... it. New. All callers updated. (target_read_live_memory): Likewise. Call target_xfer_partial instead of target_read. (memory_xfer_live_readonly_partial): Return target_xfer_status. Add argument xfered_len. (raw_memory_xfer_partial): Likewise. (memory_xfer_partial_1): Likewise. (memory_xfer_partial): Likewise. (target_xfer_partial): Likewise. Check *XFERED_LEN is set properly. Update debug message. (default_xfer_partial, current_xfer_partial): Likewise. (target_write_partial): Likewise. (target_read_partial): Likewise. All callers updated. (read_whatever_is_readable): Likewise. (target_write_with_progress): Likewise. (target_read_alloc_1): Likewise. * aix-thread.c (aix_thread_xfer_partial): Likewise. * auxv.c (procfs_xfer_auxv): Likewise. (ld_so_xfer_auxv, memory_xfer_auxv): Likewise. * bfd-target.c (target_bfd_xfer_partial): Likewise. * bsd-kvm.c (bsd_kvm_xfer_partial): Likewise. * bsd-uthread.c (bsd_uthread_xfer_partia): Likewise. * corefile.c (read_memory): Adjust. * corelow.c (core_xfer_partial): Likewise. * ctf.c (ctf_xfer_partial): Likewise. * darwin-nat.c (darwin_read_dyld_info): Likewise. All callers updated. (darwin_xfer_partial): Likewise. * exec.c (section_table_xfer_memory_partial): Likewise. All callers updated. (exec_xfer_partial): Likewise. * exec.h (section_table_xfer_memory_partial): Update declaration. * gnu-nat.c (gnu_xfer_memory): Likewise. Assert 'res' is not negative. (gnu_xfer_partial): Likewise. * ia64-hpux-nat.c (ia64_hpux_xfer_memory_no_bs): Likewise. (ia64_hpux_xfer_memory, ia64_hpux_xfer_uregs): Likewise. (ia64_hpux_xfer_solib_got): Likewise. * inf-ptrace.c (inf_ptrace_xfer_partial): Likewise. Change type of 'partial_len' to ULONGEST. * inf-ttrace.c (inf_ttrace_xfer_partial): Likewise. * linux-nat.c (linux_xfer_siginfo ): Likewise. (linux_nat_xfer_partial): Likewise. (linux_proc_xfer_partial, linux_xfer_partial): Likewise. (linux_proc_xfer_spu, linux_nat_xfer_osdata): Likewise. * monitor.c (monitor_xfer_memory): Likewise. (monitor_xfer_partial): Likewise. * procfs.c (procfs_xfer_partial): Likewise. * record-btrace.c (record_btrace_xfer_partial): Likewise. * record-full.c (record_full_xfer_partial): Likewise. (record_full_core_xfer_partial): Likewise. * remote-sim.c (gdbsim_xfer_memory): Likewise. (gdbsim_xfer_partial): Likewise. * remote.c (remote_write_bytes_aux): Likewise. All callers updated. (remote_write_bytes, remote_read_bytes): Likewise. All callers updated. (remote_flash_erase): Likewise. All callers updated. (remote_write_qxfer): Likewise. All callers updated. (remote_read_qxfer): Likewise. All callers updated. (remote_xfer_partial): Likewise. * rs6000-nat.c (rs6000_xfer_partial): Likewise. (rs6000_xfer_shared_libraries): Likewise. * sol-thread.c (sol_thread_xfer_partial): Likewise. (sol_thread_xfer_partial): Likewise. * sparc-nat.c (sparc_xfer_wcookie): Likewise. (sparc_xfer_partial): Likewise. * spu-linux-nat.c (spu_proc_xfer_spu): Likewise. All callers updated. (spu_xfer_partial): Likewise. * spu-multiarch.c (spu_xfer_partial): Likewise. * tracepoint.c (tfile_xfer_partial): Likewise. * windows-nat.c (windows_xfer_memory): Likewise. (windows_xfer_shared_libraries): Likewise. (windows_xfer_partial): Likewise. * valprint.c: Replace 'target_xfer_error' with 'target_xfer_status' in comments.
* Replace -1 with TARGET_XFER_E_IOYao Qi2014-02-071-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Hi, This patch replaces -1 with TARGET_XFER_E_IO in the implementations of to_xfer_partial and their callees. This change is quite mechanical, and makes the next patch shorter. gdb: 2014-02-07 Yao Qi <yao@codesourcery.com> * auxv.c (procfs_xfer_auxv): Replace -1 with TARGET_XFER_E_IO. (ld_so_xfer_auxv): Likewise. * bfd-target.c (target_bfd_xfer_partial): Likewise. * bsd-kvm.c (bsd_kvm_xfer_partial): Likewise. * corelow.c (core_xfer_partial): Likewise. * ctf.c (ctf_xfer_partial): Likewise. * darwin-nat.c (darwin_read_dyld_info): Likewise. (darwin_xfer_partial): Likewise. * exec.c (exec_xfer_partial): Likewise. * gnu-nat.c (gnu_xfer_partial): Likewise. * ia64-hpux-nat.c (ia64_hpux_xfer_uregs): Likewise. * inf-ptrace.c (inf_ptrace_xfer_partial): Likewise. * inf-ttrace.c (inf_ttrace_xfer_partial): Likewise. * linux-nat.c (linux_xfer_siginfo): Likewise. (linux_proc_xfer_spu): Likewise. * procfs.c (procfs_xfer_partial): Likewise. * record-full.c (record_full_xfer_partial): Likewise. (record_full_core_xfer_partial): Likewise. * remote-sim.c (gdbsim_xfer_partial): Likewise. * remote.c (remote_write_qxfer): Likewise. (remote_write_qxfer, remote_read_qxfer): Likewise. (remote_xfer_partial): Likewise. * rs6000-nat.c (rs6000_xfer_partial): Likewise. (rs6000_xfer_shared_libraries): Likewise. * sparc-nat.c (sparc_xfer_wcookie): Likewise. * spu-linux-nat.c (spu_proc_xfer_spu): Likewise. (spu_xfer_partial): Likewise. * target.c (memory_xfer_partial_1): Likewise. * tracepoint.c (tfile_xfer_partial): Likewise. * windows-nat.c (windows_xfer_shared_libraries): Likewise. (windows_xfer_partial): Likewise.
* target: allow decr_pc_after_break to be defined by the targetMarkus Metzger2014-01-161-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | Allow the target to define which value to use in decr_pc_after_break. It defaults to gdbarch_decr_pc_after_break (GDBARCH). 2014-01-16 Markus Metzger <markus.t.metzger@intel.com> * target.h (struct target_ops) <to_decr_pc_after_break>: New. (forward_target_decr_pc_after_break) (target_decr_pc_after_break): New. * target.c (forward_target_decr_pc_after_break) (target_decr_pc_after_break): New. * aix-thread.c (aix_thread_wait): Call target_decr_pc_after_break instead of gdbarch_decr_pc_after_break. * darwin-nat.c (cancel_breakpoint): Call target_decr_pc_after_break instead of gdbarch_decr_pc_after_break. * infrun.c (adjust_pc_after_break): Call target_decr_pc_after_break instead of gdbarch_decr_pc_after_break. * linux-nat.c (cancel_breakpoint): Call target_decr_pc_after_break instead of gdbarch_decr_pc_after_break. * linux-thread-db.c (check_event): Call target_decr_pc_after_break instead of gdbarch_decr_pc_after_break. * record-full.c (record_full_wait_1): Call target_decr_pc_after_break instead of gdbarch_decr_pc_after_break.
* target, breakpoint: allow insert/remove breakpoint to be forwardedMarkus Metzger2014-01-161-12/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2014-01-16 Markus Metzger <markus.t.metzger@intel.com> * target.h (target_ops) <to_insert_breakpoint> <to_remove_breakpoint>: Add target_ops parameter. (forward_target_insert_breakpoint): New. (forward_target_remove_breakpoint): New. (memory_remove_breakpoint, memory_insert_breakpoint): Add target_ops parameter. * target.c (target_insert_breakpoint): Split into this and ... (forward_target_insert_breakpoint): ... this. (target_remove_breakpoint): Split into this and ... (forward_target_remove_breakpoint): ... this. (debug_to_insert_breakpoint): Add target_ops parameter. Call forward_target_insert_breakpoint. (debug_to_remove_breakpoint): Add target_ops parameter. Call forward_target_remove_breakpoint. (update_current_target): Do not inherit or default to_insert_breakpoint and to_remove_breakpoint. * corelow.c (ignore): Add target_ops parameter. * exec.c (ignore): Add target_ops parameter. * mem-break.c (memory_insert_breakpoint, memory_remove_breakpoint): Add target_ops parameter. * monitor.c (monitor_insert_breakpoint, monitor_remove_breakpoint): Add target_ops parameter. * nto-procfs.c (procfs_insert_breakpoint, procfs_remove_breakpoint): Add target_ops parameter. * record-full.c (record_full_beneath_to_insert_breakpoint) (record_full_beneath_to_remove_breakpoint, tmp_to_insert_breakpoint) (tmp_to_remove_breakpoint, record_full_insert_breakpoint) (record_full_remove_breakpoint, record_full_core_insert_breakpoint) (record_full_core_remove_breakpoint): Add target_ops parameter. Update users. (record_full_beneath_to_insert_breakpoint_ops) (record_full_beneath_to_remove_breakpoint_ops) (tmp_to_insert_breakpoint_ops, tmp_to_remove_breakpoint_ops): New. (record_full_open): Initialize tmp_to_insert_breakpoint_ops, tmp_to_remove_breakpoint_ops, record_full_beneath_to_insert_breakpoint_ops, and record_full_beneath_to_remove_breakpoint_ops. * remote-m32r-sdi.c (m32r_insert_breakpoint) (m32r_remove_breakpoint): Add target_ops parameter. * remote-mips.c (mips_insert_breakpoint, mips_remove_breakpoint): Add target_ops parameter. * remote.c (remote_insert_breakpoint, remote_remove_breakpoint): Add target_ops parameter.
* Add target_ops argument to to_prepare_to_storeMarkus Metzger2014-01-161-1/+2
| | | | | | | | | | | | | | | | | | | | | | 2013-12-17 Tom Tromey <tromey@redhat.com> * windows-nat.c (windows_prepare_to_store): Add 'self' argument. * target.h (struct target_ops) <to_prepare_to_store>: Add argument. (target_prepare_to_store): Add argument. * target.c (debug_to_prepare_to_store): Add argument. (update_current_target): Update. * remote.c (remote_prepare_to_store): Add 'self' argument. * remote-sim.c (gdbsim_prepare_to_store): Add 'self' argument. * remote-mips.c (mips_prepare_to_store): Add 'self' argument. * remote-m32r-sdi.c (m32r_prepare_to_store): Add 'self' argument. * record-full.c (record_full_core_prepare_to_store): Add 'self' argument. * ravenscar-thread.c (ravenscar_prepare_to_store): Add argument. * nto-procfs.c (procfs_prepare_to_store): Add 'self' argument. * monitor.c (monitor_prepare_to_store): Add 'self' argument. * inf-child.c (inf_child_prepare_to_store): Add 'self' argument. * go32-nat.c (go32_prepare_to_store): Add 'self' argument.
* Fix "is a record target open" checks.Pedro Alves2014-01-141-4/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | RECORD_IS_USED and record_full_open look at current_target.to_stratum to determine whether a record target is in use. This is wrong because arch_stratum is greater than record_stratum, so if an arch_stratum target is pushed, RECORD_IS_USED and record_full_open will miss it. To fix this, we can use the existing find_record_target instead, which looks up for a record stratum target across the target stack. Since that means exporting find_record_target in record.h, RECORD_IS_USED ends up redundant, so the patch eliminates it. That exercise then reveals other issues: - adjust_pc_after_break is gating record_full_... calls based on RECORD_IS_USED. But, record_full_ calls shouldn't be made when recording with the record-btrace target. So this adds a new record_full_is_used predicate to be used in that spot. - record_full_open says "Process record target already running", even if the recording target is record-btrace ("process record" is the original complete name of the record-full target). record_btrace_open only says "The process is already being recorded." and does not suggest "record stop", like record-full does. The patch factors out and merges that error to a new record_preopen function that all record targets call in their open routine. Tested on x86_64 Fedora 17. gdb/ 2014-01-14 Pedro Alves <palves@redhat.com> Tom Tromey <tromey@redhat.com> * infrun.c (use_displaced_stepping): Use find_record_target instead of RECORD_IS_USED. (adjust_pc_after_break): Use record_full_is_used instead of RECORD_IS_USED. * record-btrace.c (record_btrace_open): Call record_preopen instead of checking RECORD_IS_USED. * record-full.c (record_full_shortname) (record_full_core_shortname): New globals. (record_full_is_used): New function. (find_full_open): Call record_preopen instead of checking RECORD_IS_USED. (init_record_full_ops): Set the target's shortname to record_full_shortname. (init_record_full_core_ops): Set the target's shortname to record_full_core_shortname. * record-full.h (record_full_is_used): Declare. * record.c (find_record_target): Make extern. (record_preopen): New function. * record.h (RECORD_IS_USED): Delete macro. (find_record_target, record_preopen): Declare functions.
* Change to_xfer_partial 'len' type to ULONGEST.Yao Qi2014-01-141-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch changes to_xfer_partial's len's type to ULONGEST, and adjust its implementations. gdb: 2014-01-14 Yao Qi <yao@codesourcery.com> * target.h (target_xfer_partial_ftype): Update. (struct target_ops) <to_xfer_partial>: Change 'len' type to ULONGEST. * aix-thread.c (aix_thread_xfer_partial): Change type of argument 'len' to ULONGEST. * auxv.c (procfs_xfer_auxv): Likewise. (ld_so_xfer_auxv): Likewise. (memory_xfer_auxv): Likewise. * bfd-target.c (target_bfd_xfer_partial): Likewise. * bsd-kvm.c (bsd_kvm_xfer_partial): Likewise. * bsd-uthread.c (bsd_uthread_xfer_partial): Likewise. * corelow.c (core_xfer_partial): Likewise. * ctf.c (ctf_xfer_partial): Likewise. * darwin-nat.c (darwin_read_write_inferior): Likewise. Use '%u'. (darwin_read_dyld_info): Likewise. (darwin_xfer_partial): Likewise. * exec.c (section_table_xfer_memory_partial): Likewise. (exec_xfer_partial): Likewise. * exec.h (section_table_xfer_memory_partial): Update declaration. * gnu-nat.c (gnu_xfer_memory): Likewise. Call pulongest instead of plongest. (gnu_xfer_partial): Likewise. * ia64-hpux-nat.c (ia64_hpux_xfer_memory): Likewise. (ia64_hpux_xfer_solib_got): Likewise. (ia64_hpux_xfer_partial): Likewise. * ia64-linux-nat.c (ia64_linux_xfer_partial): * inf-ptrace.c (inf_ptrace_xfer_partial): * inf-ttrace.c (inf_ttrace_xfer_partial): * linux-nat.c (linux_xfer_siginfo): Likewise. (linux_nat_xfer_partial): Likewise. (spu_enumerate_spu_ids, linux_proc_xfer_spu): Likewise. (linux_nat_xfer_osdata, linux_xfer_partial): Likewise. * monitor.c (monitor_xfer_memory): Likewise. (monitor_xfer_partial): Likewise. * procfs.c (procfs_xfer_partial): Likewise. * record-full.c (record_full_xfer_partial): Likewise. (record_full_core_xfer_partial): Likewise. * remote-sim.c (gdbsim_xfer_memory): Likewise. Call pulongest instead of plongest. (gdbsim_xfer_partial): Likewise. * remote.c (remote_xfer_partial): Likewise. * rs6000-aix-tdep.c (rs6000_aix_ld_info_to_xml): Likewise. * rs6000-aix-tdep.h (rs6000_aix_ld_info_to_xml): Update declaration. * rs6000-nat.c (rs6000_xfer_partial): Likewise. (rs6000_xfer_shared_libraries): Likewise. * sol-thread.c (sol_thread_xfer_partial): Likewise. * sparc-nat.c (sparc_xfer_wcookie): Likewise. (sparc_xfer_partial): Likewise. * spu-linux-nat.c (spu_proc_xfer_spu): Likewise. (spu_xfer_partial): Likewise. * spu-multiarch.c (spu_xfer_partial): Likewise. * target.c (target_read_live_memory): Likewise. (memory_xfer_live_readonly_partial): Likewise. (memory_xfer_partial, memory_xfer_partial_1): Likewise. (target_xfer_partial, default_xfer_partial): Likewise. (current_xfer_partial): Likewise. * tracepoint.c (tfile_xfer_partial): Likewise. * windows-nat.c (windows_xfer_memory): Likewise. Call pulongest instead of plongest. (windows_xfer_partial): Likewise. (windows_xfer_shared_libraries): Likewise.
* Update Copyright year range in all files maintained by GDB.Joel Brobecker2014-01-011-1/+1
|
* Add target_xfer_partial_ftypeYao Qi2013-12-181-15/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds a typedef target_xfer_partial_ftype. When we change the signature of xfer_partial functions (for example, adding a new parameter), we don't have to modify all of their declarations. This patch also updates the type of parameters of target_xfer_partial from "void *" to "gdb_byte *". gdb: 2013-12-18 Yao Qi <yao@codesourcery.com> * target.h (target_xfer_partial_ftype): New typedef. (target_xfer_partial): Update declaration. * auxv.h (memory_xfer_auxv): Likewise. * ia64-hpux-nat.c (super_xfer_partial): Likewise. * ia64-linux-nat.c (super_xfer_partial): Likewise. * linux-nat.c (super_xfer_partial): Likewise. * procfs.c (procfs_xfer_partial): Likewise. * record-full.c (record_full_beneath_to_xfer_partial): (tmp_to_xfer_partial): Likewise. * sparc-nat.c (inf_ptrace_xfer_partial): Likewise. * target.c (default_xfer_partial): Likewise. (current_xfer_partial): Likewise. (target_xfer_partial): Change parameter type to 'gdb_byte *'.
* PR gdb/15911: "info threads" changes the default source and line (for ↵Pedro Alves2013-09-171-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | "break", "list") "info threads" changes the default source for "break" and "list", to whatever the location of the first/bottom thread in the thread list is... (gdb) b start (gdb) c ... (gdb) list *lists "start"* (gdb) b 23 Breakpoint 3 at 0x400614: file test.c, line 23. (gdb) info threads Id Target Id Frame * 2 Thread 0x7ffff7fcb700 (LWP 1760) "test" start (arg=0x0) at test.c:23 1 Thread 0x7ffff7fcc740 (LWP 1748) "test" 0x000000323dc08e60 in pthread_join (threadid=140737353922304, thread_return=0x0) at pthread_join.c:93 (gdb) b 23 Breakpoint 4 at 0x323dc08d90: file pthread_join.c, line 23. ^^^^^^^^^^^^^^^ (gdb) list 93 lll_wait_tid (pd->tid); 94 95 96 /* Restore cancellation mode. */ 97 CANCEL_RESET (oldtype); 98 99 /* Remove the handler. */ 100 pthread_cleanup_pop (0); 101 102 The issue is that print_stack_frame always sets the current sal to the frame's sal. print_frame_info (which print_stack_frame calls to do most of the work) also sets the last displayed sal, but only if print_what isn't LOCATION. Now the call in question, from within thread.c:print_thread_info, does pass in LOCATION as print_what, but print_stack_frame doesn't have the same check print_frame_info has. We could consider adding it, but setting these globals depending on print_what isn't very clean, IMO. What we have is two logically distinct operations mixed in the same function(s): #1 - print frame, in the format specified by {print_what, print_level and print_args}. #2 - We're displaying a frame to the user, and I want the default sal to point here, because the program stopped here, or the user did some context-changing command (up, down, etc.). So I added a new parameter to print_stack_frame & friends for point #2, and went through all calls in the tree adjusting as necessary. Tested on x86_64 Fedora 17. gdb/ 2013-09-17 Pedro Alves <palves@redhat.com> PR gdb/15911 * ada-tasks.c (task_command_1): Adjust call to print_stack_frame. * bsd-kvm.c (bsd_kvm_open, bsd_kvm_proc_cmd, bsd_kvm_pcb_cmd): * corelow.c (core_open): * frame.h (print_stack_frame, print_frame_info): New 'set_current_sal' parameter. * infcmd.c (finish_command, kill_command): Adjust call to print_stack_frame. * inferior.c (inferior_command): Likewise. * infrun.c (normal_stop): Likewise. * linux-fork.c (linux_fork_context): Likewise. * record-full.c (record_full_goto_entry, record_full_restore): Likewise. * remote-mips.c (common_open): Likewise. * stack.c (print_stack_frame): New 'set_current_sal' parameter. Use it. (print_frame_info): New 'set_current_sal' parameter. Set the last displayed sal depending on the new paremeter instead of looking at print_what. (backtrace_command_1, select_and_print_frame, frame_command) (current_frame_command, up_command, down_command): Adjust call to print_stack_frame. * thread.c (print_thread_info, restore_selected_frame) (do_captured_thread_select): Adjust call to print_stack_frame. * tracepoint.c (tfind_1): Likewise. * mi/mi-cmd-stack.c (mi_cmd_stack_list_frames) (mi_cmd_stack_info_frame): Likewise. * mi/mi-interp.c (mi_on_normal_stop): Likewise. * mi/mi-main.c (mi_cmd_exec_return, mi_cmd_trace_find): Likewise. gdb/testsuite/ * gdb.threads/info-threads-cur-sal-2.c: New file. * gdb.threads/info-threads-cur-sal.c: New file. * gdb.threads/info-threads-cur-sal.exp: New file.
* * target.h (struct target_section): Delete member bfd.Doug Evans2013-07-161-3/+4
| | | | | | | | | | | | | | | | | All users updated to use the_bfd_section->owner instead. * exec.c (add_to_section_table): Assert bfd is expected value. Remove initialization of target_section.bfd. (remove_target_sections): Update. (section_table_available_memory): Update. (section_table_xfer_memory_partial): Update. (print_section_info): Update. (exec_set_section_address): Update. * record-full.c (record_full_core_xfer_partial): Update. * solib-svr4.c (svr4_relocate_section_addresses): Update. * solib-target.c (solib_target_relocate_section_addresses): Update. * symfile.c (build_section_addr_info_from_section_table): Update. * target.c (memory_xfer_live_readonly_partial): Update. (memory_xfer_partial_1): Update.
* * gcore.c (create_gcore_bfd): Make 'filename' const.Tom Tromey2013-05-141-2/+2
| | | | | | | | | * gcore.h (create_gcore_bfd): Make 'filename' const. * record-full.c (record_full_save): Make 'recfilename' const. * target.c (target_save_record): Make 'filename' const. * target.h (struct target_ops) <to_save_record>: Make 'filename' const. (target_save_record): Likewise.
* -Wpointer-sign: bookmarks.Pedro Alves2013-04-191-4/+6
| | | | | | | | | | | | | | | | | Bookmarks are opaque to the core code -- by design, the target is free to use any sort of blob as bookmark identifier. The record target chooses to use strings for bookmarks. This adds casts following that direction, fixing -Wpointer-sign warnings. gdb/ 2013-04-19 Pedro Alves <palves@redhat.com> * record-full.c (record_full_get_bookmark): Change local 'ret' type to char * and add cast to gdb_byte *. (record_full_goto_bookmark): Handle 'bookmark' argument as a string. * reverse.c (goto_bookmark_command): Add casts to gdb_byte *.
* Accept "set foo unlimited" in integer/uinteger/zuinteger_unlimited commands.Pedro Alves2013-04-101-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, several commands take "0" or "-1" to mean "unlimited". "show" knows when to print "unlimited": (gdb) show height Number of lines gdb thinks are in a page is 45. (gdb) set height 0 (gdb) show height Number of lines gdb thinks are in a page is unlimited. However, the user can't herself specify "unlimited" directly: (gdb) set height unlimited No symbol table is loaded. Use the "file" command. (gdb) This patch addresses that, by adjusting the set handler for all integer/uinteger/zuinteger_unlimited commands to accept literal "unlimited". It also installs a completer. Presently, we complete on symbols by default, and at <http://sourceware.org/ml/gdb-patches/2013-03/msg00864.html> I've shown a WIP prototype that tried to keep that half working in these commands. In the end, it turned out to be more complicated than justifiable, IMO. It's super rare to want to pass the value of a variable/symbol in the program to a GDB set/show knob. That'll still work, it's just that we won't assist with completion anymore. This patch just sticks with the simple, and completes on "unlimited", and nothing else. This simplification means that "set he<tab><tab>" is all it takes to get to: "set height unlimited" The patch then goes through all integer/uinteger/zuinteger_unlimited commands in the tree, and updates both the online help and the manual to mention that "unlimited" is accepted in addition to 0/-1. In the cases where the command had no online help text at all, this adds it. I've tried to make the texts read in a way that "unlimited" is suggested before "0" or "-1" is. Tested on x86_64 Fedora 17. gdb/ 2013-04-10 Pedro Alves <palves@redhat.com> * cli/cli-decode.c (integer_unlimited_completer): New function. (add_setshow_integer_cmd, add_setshow_uinteger_cmd) (add_setshow_zuinteger_unlimited_cmd): Install the "unlimited" completer. * cli/cli-setshow.c: Include "cli/cli-utils.h". (is_unlimited_literal): New function. (do_set_command): Handle literal "unlimited" arguments. * frame.c (_initialize_frame) <set backtrace limit>: Document "unlimited". * printcmd.c (_initialize_printcmd) <set print max-symbolic-offset>: Add help text. * record-full.c (_initialize_record_full) <set record full insn-number-max>: Likewise. * record.c (_initialize_record) <set record instruction-history-size, set record function-call-history-size>: Add help text. * ser-tcp.c (_initialize_ser_tcp) <set tcp connect-timeout>: Add help text. * tracepoint.c (_initialize_tracepoint) <set trace-buffer-size>: Likewise. * source.c (_initialize_source) <set listsize>: Add help text. * utils.c (initialize_utils) <set height, set width>: Likewise. <set pagination>: Mention "set height unlimited". * valprint.c (_initialize_valprint) <set print elements, set print repeats>: Document "unlimited". gdb/doc/ 2013-04-10 Pedro Alves <palves@redhat.com> * gdb.texinfo (Process Record and Replay): Document that "set record full insn-number-max", "set record instruction-history-size" and "set record function-call-history-size" accept "unlimited". (Backtrace): Document that "set backtrace limit" accepts "unlimited". (List): Document that "set listsize" accepts "unlimited". (Print Settings)" Document that "set print max-symbolic-offset", "set print elements" and "set print repeats" accept "unlimited". (Starting and Stopping Trace Experiments): Document that "set trace-buffer-size" accepts "unlimited". (Remote Configuration): Document that "set tcp connect-timeout" accepts "unlimited". (Command History): Document that "set history size" accepts "unlimited". (Screen Size): Document that "set height" and "set width" accepts "unlimited". Adjust "set pagination"'s description to suggest "set height unlimited" instead of "set height 0". gdb/testsuite/ 2013-04-10 Pedro Alves <palves@redhat.com> * gdb.base/completion.exp: Test "set height", "set listsize" and "set trace-buffer-size" completion. * gdb.base/setshow.exp: Test "set height unlimited". * gdb.trace/trace-buffer-size.exp: Test "set trace-buffer-size unlimited".
* record-full.c: Remove always true checks.Pedro Alves2013-03-261-32/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The "set record full insn-number-max" command is an uinteger command. If the variable that holds the maximum count of logged instructions is unsigned, it's better if the variable that holds the current number of logged instructions is also unsigned. Looking over the code, there's no case the variable could end up negative. Then, tests like "if (record_full_insn_max_num)" are always true, because being a uinteger command means that "set record full insn-number-max 0" is actually mapped to UINT_MAX internally. IOW, the command's variable is never 0. The checks might make some sense if 0 wasn't mapped to UINT_MAX, and 0 meant unlimited, but, that's not how things work. Tested on x86_64 Fedora 17. gdb/ 2013-03-26 Pedro Alves <palves@redhat.com> * record-full.c (record_full_insn_num): Make it unsigned. (record_full_check_insn_num, record_full_message) (record_full_registers_change, record_full_xfer_partial): Remove record_full_insn_max_num check (it's always != 0). (record_full_info, record_full_restore): Use %u as format string. (): Use %u as format string. (set_record_full_insn_max_num): Remove record_full_insn_max_num check (it's always != 0).
* gdb/Jan Kratochvil2013-03-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Code cleanup. * bfd-target.c (target_bfd_xclose): Remove parameter quitting. * bsd-kvm.c (bsd_kvm_close): Likewise. * bsd-uthread.c (bsd_uthread_close): Likewise. * corelow.c (core_close): Likewise. (core_close_cleanup): Remove parameter quitting from a caller. * event-top.c (async_disconnect): Likewise. * exec.c (exec_close_1): Remove parameter quitting. * go32-nat.c (go32_close): Likewise. * linux-nat.c (linux_nat_close): Remove parameter quitting. Remove parameter quitting from a caller. * mips-linux-nat.c (super_close): Remove parameter quitting from the variable. (mips_linux_close): Remove parameter quitting. Remove parameter quitting from a caller. * monitor.c (monitor_close): Remove parameter quitting. * monitor.h (monitor_close): Likewise. * record-btrace.c (record_btrace_close): Likewise. * record-full.c (record_full_close): Likewise. * remote-m32r-sdi.c (m32r_close): Remove parameter quitting and remove it also from fprintf_unfiltered. * remote-mips.c (mips_close): Remove parameter quitting. (mips_detach): Remove parameter quitting from a caller. * remote-sim.c (gdbsim_close): Remove parameter quitting. (gdbsim_close): Remove duplicate function comment. Remove parameter quitting and remove it also from printf_filtered. * remote.c (remote_close): Remove parameter quitting. * solib-svr4.c (enable_break): Remove parameter quitting from a caller. * target.c (update_current_target): Remove parameter int from to_close de_fault. (push_target, unpush_target, pop_target): Remove parameter quitting from a caller. (pop_all_targets_above, pop_all_targets): Remove parameter quitting. Remove parameter quitting from a caller. (target_preopen): Remove parameter quitting from a caller. (target_close): Remove parameter quitting. Remove parameter quitting from a caller two times. Remove parameter quitting also from fprintf_unfiltered. * target.h (struct target_ops): Remove parameter quitting and as int from fields to_xclose and to_close. (extern struct target_ops current_target): (target_close, pop_all_targets): Remove parameter quitting. Update the comment. (pop_all_targets_above): Remove parameter quitting. * top.c (quit_target): Remove parameter quitting from a caller. * tracepoint.c (tfile_close): Remove parameter quitting. * windows-nat.c (windows_close): Remove parameter quitting.
* Provide default target methods for record targets that are likely to be sharedMarkus Metzger2013-03-111-54/+4
| | | | | | | | | | | | | | | | | | | | | | | between different record targets. gdb/ * record.h (record_disconnect): New. (record_detach): New. (record_mourn_inferior): New. (record_kill): New. * record-full.c (record_disconnect, record_detach, record_mourn_inferior, record_kill): Move to... * record.c: ...here. (DEBUG): New. (record_stop): New. (record_unpush): New. (cmd_record_stop): Call record_stop. Replace unpush_target call with record_unpush call. (record_disconnect, record_detach): Assert that the target is of record stratum. Call record_unpush, record_stop, and DEBUG. (record_mourn_inferior, record_kill): Assert that the target is of record stratum. Call record_unpush and DEBUG.
* Rename record_ prefixes in record-full.h into record_full_.Markus Metzger2013-03-111-16/+16
| | | | | | | | | | | | | | | | gdb/ * record-full.h, record-full.c (record_memory_query): Rename to ... (record_full_memory_query): ...this. Update all users. (record_arch_list_add_reg): Rename to ... (record_full_arch_list_add_reg): ...this. Update all users. (record_arch_list_add_mem): Rename to ... (record_full_arch_list_add_mem): ...this. Update all users. (record_arch_list_add_end): Rename to ... (record_full_arch_list_add_end): ...this. Update all users. (record_gdb_operation_disable_set): Rename to ... (record_full_gdb_operation_disable_set): ...this. Update all users.
* Rename record_ prefixes in record-full.c into record_full_.Markus Metzger2013-03-111-754/+799
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | gdb/ * record-full.c (DEFAULT_RECORD_INSN_MAX_NUM): Renamed to ... (DEFAULT_RECORD_FULL_INSN_MAX_NUM): ... this. Updated all users. (RECORD_IS_REPLAY): Renamed to ... (RECORD_FULL_IS_REPLAY): ... this. Updated all users. (RECORD_FILE_MAGIC): Renamed to ... (RECORD_FULL_FILE_MAGIC): ... this. Updated all users. (record_mem_entry): Renamed to ... (record_full_mem_entry): ... this. Updated all users. (record_reg_entry): Renamed to ... (record_full_reg_entry): ... this. Updated all users. (record_end_entry): Renamed to ... (record_full_end_entry): ... this. Updated all users. (record_type) <record_end, record_reg, record_mem>: Renamed to ... (record_full_type) <record_full_end, record_full_reg, record_full_mem>: ... this. Updated all users. (record_entry): Renamed to ... (record_full_entry): ... this. Updated all users. (record_core_buf_entry): Renamed to ... (record_full_core_buf_entry): ... this. Updated all users. (record_core_regbuf): Renamed to ... (record_full_core_regbuf): ... this. Updated all users. (record_core_start): Renamed to ... (record_full_core_start): ... this. Updated all users. (record_core_end): Renamed to ... (record_full_core_end): ... this. Updated all users. (record_core_buf_list): Renamed to ... (record_full_core_buf_list): ... this. Updated all users. (record_first): Renamed to ... (record_full_first): ... this. Updated all users. (record_list): Renamed to ... (record_full_list): ... this. Updated all users. (record_arch_list_head): Renamed to ... (record_full_arch_list_head): ... this. Updated all users. (record_arch_list_tail): Renamed to ... (record_full_arch_list_tail): ... this. Updated all users. (record_stop_at_limit): Renamed to ... (record_full_stop_at_limit): ... this. Updated all users. (record_insn_max_num): Renamed to ... (record_full_insn_max_num): ... this. Updated all users. (record_insn_num): Renamed to ... (record_full_insn_num): ... this. Updated all users. (record_insn_count): Renamed to ... (record_full_insn_count): ... this. Updated all users. (record_ops): Renamed to ... (record_full_ops): ... this. Updated all users. (record_core_ops): Renamed to ... (record_full_core_ops): ... this. Updated all users. (set_record_cmdlist): Renamed to ... (set_record_full_cmdlist): ... this. Updated all users. (show_record_cmdlist): Renamed to ... (show_record_full_cmdlist): ... this. Updated all users. (record_cmdlist): Renamed to ... (record_full_cmdlist): ... this. Updated all users. (record_beneath_to_resume_ops): Renamed to ... (record_full_beneath_to_resume_ops): ... this. Updated all users. (record_beneath_to_resume): Renamed to ... (record_full_beneath_to_resume): ... this. Updated all users. (record_beneath_to_wait_ops): Renamed to ... (record_full_beneath_to_wait_ops): ... this. Updated all users. (record_beneath_to_wait): Renamed to ... (record_full_beneath_to_wait): ... this. Updated all users. (record_beneath_to_store_registers_ops): Renamed to ... (record_full_beneath_to_store_registers_ops): ... this. Updated all users. (record_beneath_to_store_registers): Renamed to ... (record_full_beneath_to_store_registers): ... this. Updated all users. (record_beneath_to_xfer_partial_ops): Renamed to ... (record_full_beneath_to_xfer_partial_ops): ... this. Updated all users. (record_beneath_to_xfer_partial): Renamed to ... (record_full_beneath_to_xfer_partial): ... this. Updated all users. (record_beneath_to_insert_breakpoint): Renamed to ... (record_full_beneath_to_insert_breakpoint): ... this. Updated all users. (record_beneath_to_stopped_by_watchpoint): Renamed to ... (record_full_beneath_to_stopped_by_watchpoint): ... this. Updated all users. (record_beneath_to_stopped_data_address): Renamed to ... (record_full_beneath_to_stopped_data_address): ... this. Updated all users. (record_beneath_to_async): Renamed to ... (record_full_beneath_to_async): ... this. Updated all users. (record_goto_insn): Renamed to ... (record_full_goto_insn): ... this. Updated all users. (record_save): Renamed to ... (record_full_save): ... this. Updated all users. (record_reg_alloc): Renamed to ... (record_full_reg_alloc): ... this. Updated all users. (record_reg_release): Renamed to ... (record_full_reg_release): ... this. Updated all users. (record_mem_alloc): Renamed to ... (record_full_mem_alloc): ... this. Updated all users. (record_mem_release): Renamed to ... (record_full_mem_release): ... this. Updated all users. (record_end_alloc): Renamed to ... (record_full_end_alloc): ... this. Updated all users. (record_end_release): Renamed to ... (record_full_end_release): ... this. Updated all users. (record_entry_release): Renamed to ... (record_full_entry_release): ... this. Updated all users. (record_list_release): Renamed to ... (record_full_list_release): ... this. Updated all users. (record_list_release_following): Renamed to ... (record_full_list_release_following): ... this. Updated all users. (record_list_release_first): Renamed to ... (record_full_list_release_first): ... this. Updated all users. (record_arch_list_add): Renamed to ... (record_full_arch_list_add): ... this. Updated all users. (record_get_loc): Renamed to ... (record_full_get_loc): ... this. Updated all users. (record_check_insn_num): Renamed to ... (record_full_check_insn_num): ... this. Updated all users. (record_arch_list_cleanups): Renamed to ... (record_full_arch_list_cleanups): ... this. Updated all users. (record_message): Renamed to ... (record_full_message): ... this. Updated all users. (record_message_wrapper): Renamed to ... (record_full_message_wrapper): ... this. Updated all users. (record_message_wrapper_safe): Renamed to ... (record_full_message_wrapper_safe): ... this. Updated all users. (record_gdb_operation_disable): Renamed to ... (record_full_gdb_operation_disable): ... this. Updated all users. (record_hw_watchpoint): Renamed to ... (record_full_hw_watchpoint): ... this. Updated all users. (record_exec_insn): Renamed to ... (record_full_exec_insn): ... this. Updated all users. (record_restore): Renamed to ... (record_full_restore): ... this. Updated all users. (record_async_inferior_event_token): Renamed to ... (record_full_async_inferior_event_token): ... this. Updated all users. (record_async_inferior_event_handler): Renamed to ... (record_full_async_inferior_event_handler): ... this. Updated all users. (record_core_open_1): Renamed to ... (record_full_core_open_1): ... this. Updated all users. (record_open_1): Renamed to ... (record_full_open_1): ... this. Updated all users. (record_open): Renamed to ... (record_full_open): ... this. Updated all users. (record_close): Renamed to ... (record_full_close): ... this. Updated all users. (record_resume_step): Renamed to ... (record_full_resume_step): ... this. Updated all users. (record_resumed): Renamed to ... (record_full_resumed): ... this. Updated all users. (record_execution_dir): Renamed to ... (record_full_execution_dir): ... this. Updated all users. (record_resume): Renamed to ... (record_full_resume): ... this. Updated all users. (record_get_sig): Renamed to ... (record_full_get_sig): ... this. Updated all users. (record_sig_handler): Renamed to ... (record_full_sig_handler): ... this. Updated all users. (record_wait_cleanups): Renamed to ... (record_full_wait_cleanups): ... this. Updated all users. (record_wait_1): Renamed to ... (record_full_wait_1): ... this. Updated all users. (record_wait): Renamed to ... (record_full_wait): ... this. Updated all users. (record_stopped_by_watchpoint): Renamed to ... (record_full_stopped_by_watchpoint): ... this. Updated all users. (record_disconnect): Renamed to ... (record_full_disconnect): ... this. Updated all users. (record_detach): Renamed to ... (record_full_detach): ... this. Updated all users. (record_mourn_inferior): Renamed to ... (record_full_mourn_inferior): ... this. Updated all users. (record_kill): Renamed to ... (record_full_kill): ... this. Updated all users. (record_stopped_data_address): Renamed to ... (record_full_stopped_data_address): ... this. Updated all users. (record_registers_change): Renamed to ... (record_full_registers_change): ... this. Updated all users. (record_store_registers): Renamed to ... (record_full_store_registers): ... this. Updated all users. (record_xfer_partial): Renamed to ... (record_full_xfer_partial): ... this. Updated all users. (record_breakpoint): Renamed to ... (record_full_breakpoint): ... this. Updated all users. (record_breakpoint_p): Renamed to ... (record_full_breakpoint_p): ... this. Updated all users. (record_breakpoints): Renamed to ... (record_full_breakpoints): ... this. Updated all users. (record_sync_record_breakpoints): Renamed to ... (record_full_sync_record_breakpoints): ... this. Updated all users. (record_init_record_breakpoints): Renamed to ... (record_full_init_record_breakpoints): ... this. Updated all users. (record_insert_breakpoint): Renamed to ... (record_full_insert_breakpoint): ... this. Updated all users. (record_remove_breakpoint): Renamed to ... (record_full_remove_breakpoint): ... this. Updated all users. (record_can_execute_reverse): Renamed to ... (record_full_can_execute_reverse): ... this. Updated all users. (record_get_bookmark): Renamed to ... (record_full_get_bookmark): ... this. Updated all users. (record_goto_bookmark): Renamed to ... (record_full_goto_bookmark): ... this. Updated all users. (record_async): Renamed to ... (record_full_async): ... this. Updated all users. (record_can_async_p): Renamed to ... (record_full_can_async_p): ... this. Updated all users. (record_is_async_p): Renamed to ... (record_full_is_async_p): ... this. Updated all users. (record_execution_direction): Renamed to ... (record_full_execution_direction): ... this. Updated all users. (record_info): Renamed to ... (record_full_info): ... this. Updated all users. (record_delete): Renamed to ... (record_full_delete): ... this. Updated all users. (record_is_replaying): Renamed to ... (record_full_is_replaying): ... this. Updated all users. (record_goto_entry): Renamed to ... (record_full_goto_entry): ... this. Updated all users. (record_goto_begin): Renamed to ... (record_full_goto_begin): ... this. Updated all users. (record_goto_end): Renamed to ... (record_full_goto_end): ... this. Updated all users. (record_goto): Renamed to ... (record_full_goto): ... this. Updated all users. (init_record_ops): Renamed to ... (init_record_full_ops): ... this. Updated all users. (record_core_resume): Renamed to ... (record_full_core_resume): ... this. Updated all users. (record_core_kill): Renamed to ... (record_full_core_kill): ... this. Updated all users. (record_core_fetch_registers): Renamed to ... (record_full_core_fetch_registers): ... this. Updated all users. (record_core_prepare_to_store): Renamed to ... (record_full_core_prepare_to_store): ... this. Updated all users. (record_core_store_registers): Renamed to ... (record_full_core_store_registers): ... this. Updated all users. (record_core_xfer_partial): Renamed to ... (record_full_core_xfer_partial): ... this. Updated all users. (record_core_insert_breakpoint): Renamed to ... (record_full_core_insert_breakpoint): ... this. Updated all users. (record_core_remove_breakpoint): Renamed to ... (record_full_core_remove_breakpoint): ... this. Updated all users. (record_core_has_execution): Renamed to ... (record_full_core_has_execution): ... this. Updated all users. (init_record_core_ops): Renamed to ... (init_record_full_core_ops): ... this. Updated all users. (cmd_record_restore): Renamed to ... (cmd_record_full_restore): ... this. Updated all users. (record_save_cleanups): Renamed to ... (record_full_save_cleanups): ... this. Updated all users. (cmd_record_start): Renamed to ... (cmd_record_full_start): ... this. Updated all users. (set_record_insn_max_num): Renamed to ... (set_record_full_insn_max_num): ... this. Updated all users. (set_record_command): Renamed to ... (set_record_full_command): ... this. Updated all users. (show_record_command): Renamed to ... (show_record_full_command): ... this. Updated all users. (_initialize_record): Renamed to ... (_initialize_record_full): ... this. Updated all users.
* Split record.h into record.h and record-full.h.Markus Metzger2013-03-111-0/+3019
Split record.c into record.c and record-full.c. The split leaves the command part in record.c and moves the target part into record-full.c. gdb/ * record.h: Split into this and ... * record-full.h: ... this. * record.c: Split into this and ... * record-full.c: ... this. * target.h (target_ops): Add new fields to_info_record, to_save_record, to_delete_record, to_record_is_replaying, to_goto_record_begin, to_goto_record_end, to_goto_record. (target_info_record): New. (target_save_record): New. (target_supports_delete_record): New. (target_delete_record): New. (target_record_is_replaying): New. (target_goto_record_begin): New. (target_goto_record_end): New. (target_goto_record): New. * target.c (target_info_record): New. (target_save_record): New. (target_supports_delete_record): New. (target_delete_record): New. (target_record_is_replaying): New. (target_goto_record_begin): New. (target_goto_record_end): New. (target_goto_record): New. * record.h: Declare struct cmd_list_element. (record_cmdlist): New declaration. (set_record_cmdlist): New declaration. (show_record_cmdlist): New declaration. (info_record_cmdlist): New declaration. (cmd_record_goto): New declaration. * record.c: Remove unnecessary includes. Include inferior.h. (cmd_record_goto): Remove declaration. (record_cmdlist): Now extern. Initialize. (set_record_cmdlist): Now extern. Initialize. (show_record_cmdlist): Now extern. Initialize. (info_record_cmdlist): Now extern. Initialize. (find_record_target): New. (require_record_target): New. (cmd_record_start): Update. (cmd_record_delete): Remove target-specific code. Call target_delete_record. (cmd_record_stop): Unpush any record target. (set_record_insn_max_num): Move to record-full.c (set_record_command): Add comment. (show_record_command): Add comment. (info_record_command): Update comment. Remove target-specific code. Call the record target's to_info_record. (cmd_record_start): New. (cmd_record_goto): Now extern. Remove target-specific code. Call target_goto_begin, target_goto_end, or target_goto. (_initialize_record): Move record target ops initialization to record-full.c. Change "record" command help text. Move "record restore", "record set", and "record show" commands to record-full.c. * Makefile.in (SFILES): Add record-full.c. (HFILES_NO_SRCDIR): Add record-full.h. (COMMON_OBS): Add record-full.o. * amd64-linux-tdep.c: Include record-full.h instead of record.h. * arm-tdep.c: Include record-full.h. * i386-linux-tdep.c: Include record-full.h instead of record.h. * i386-tdep.c: Include record-full.h. * infrun.c: Include record-full.h. * linux-record.c: Include record-full.h. * moxie-tdep.c: Include record-full.h. * record-full.c: Include record-full.h. Change module comment. (set_record_full_cmdlist): New. (show_record_full_cmdlist): New. (record_full_cmdlist): New. (record_goto_insn): New declaration. (record_save): New declaration. (record_check_insn_num): Change query string. (record_info): New. (record_delete): New. (record_is_replaying): New. (record_goto_entry): New. (record_goto_begin): New. (record_goto_end): New. (record_goto): New. (init_record_ops): Update. (init_record_core_ops): Update. (cmd_record_save): Rename to record_save. Remove target and arg checks. (cmd_record_start): New. (set_record_insn_max_num): Moved from record.c (set_record_full_command): New. (show_record_full_command): New. (_initialize_record_full): New.