summaryrefslogtreecommitdiff
path: root/gdb/infrun.c
Commit message (Collapse)AuthorAgeFilesLines
* [gdb/16062] stepi sometimes doesn't make progressPedro Alves2013-10-181-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I noticed something odd while doing "stepi" over a fork syscall: ... (gdb) set disassemble-next-line on ... (gdb) si 0x000000323d4ba7c2 131 pid = ARCH_FORK (); 0x000000323d4ba7a4 <__libc_fork+132>: 64 4c 8b 04 25 10 00 00 00 mov %fs:0x10,%r8 0x000000323d4ba7ad <__libc_fork+141>: 31 d2 xor %edx,%edx 0x000000323d4ba7af <__libc_fork+143>: 4d 8d 90 d0 02 00 00 lea 0x2d0(%r8),%r10 0x000000323d4ba7b6 <__libc_fork+150>: 31 f6 xor %esi,%esi 0x000000323d4ba7b8 <__libc_fork+152>: bf 11 00 20 01 mov $0x1200011,%edi 0x000000323d4ba7bd <__libc_fork+157>: b8 38 00 00 00 mov $0x38,%eax => 0x000000323d4ba7c2 <__libc_fork+162>: 0f 05 syscall 0x000000323d4ba7c4 <__libc_fork+164>: 48 3d 00 f0 ff ff cmp $0xfffffffffffff000,%rax 0x000000323d4ba7ca <__libc_fork+170>: 0f 87 2b 01 00 00 ja 0x323d4ba8fb <__libc_fork+475> (gdb) si 0x000000323d4ba7c4 131 pid = ARCH_FORK (); 0x000000323d4ba7a4 <__libc_fork+132>: 64 4c 8b 04 25 10 00 00 00 mov %fs:0x10,%r8 0x000000323d4ba7ad <__libc_fork+141>: 31 d2 xor %edx,%edx 0x000000323d4ba7af <__libc_fork+143>: 4d 8d 90 d0 02 00 00 lea 0x2d0(%r8),%r10 0x000000323d4ba7b6 <__libc_fork+150>: 31 f6 xor %esi,%esi 0x000000323d4ba7b8 <__libc_fork+152>: bf 11 00 20 01 mov $0x1200011,%edi 0x000000323d4ba7bd <__libc_fork+157>: b8 38 00 00 00 mov $0x38,%eax 0x000000323d4ba7c2 <__libc_fork+162>: 0f 05 syscall => 0x000000323d4ba7c4 <__libc_fork+164>: 48 3d 00 f0 ff ff cmp $0xfffffffffffff000,%rax 0x000000323d4ba7ca <__libc_fork+170>: 0f 87 2b 01 00 00 ja 0x323d4ba8fb <__libc_fork+475> (gdb) si 0x000000323d4ba7c4 131 pid = ARCH_FORK (); 0x000000323d4ba7a4 <__libc_fork+132>: 64 4c 8b 04 25 10 00 00 00 mov %fs:0x10,%r8 0x000000323d4ba7ad <__libc_fork+141>: 31 d2 xor %edx,%edx 0x000000323d4ba7af <__libc_fork+143>: 4d 8d 90 d0 02 00 00 lea 0x2d0(%r8),%r10 0x000000323d4ba7b6 <__libc_fork+150>: 31 f6 xor %esi,%esi 0x000000323d4ba7b8 <__libc_fork+152>: bf 11 00 20 01 mov $0x1200011,%edi 0x000000323d4ba7bd <__libc_fork+157>: b8 38 00 00 00 mov $0x38,%eax 0x000000323d4ba7c2 <__libc_fork+162>: 0f 05 syscall => 0x000000323d4ba7c4 <__libc_fork+164>: 48 3d 00 f0 ff ff cmp $0xfffffffffffff000,%rax 0x000000323d4ba7ca <__libc_fork+170>: 0f 87 2b 01 00 00 ja 0x323d4ba8fb <__libc_fork+475> (gdb) si 0x000000323d4ba7ca 131 pid = ARCH_FORK (); 0x000000323d4ba7a4 <__libc_fork+132>: 64 4c 8b 04 25 10 00 00 00 mov %fs:0x10,%r8 0x000000323d4ba7ad <__libc_fork+141>: 31 d2 xor %edx,%edx 0x000000323d4ba7af <__libc_fork+143>: 4d 8d 90 d0 02 00 00 lea 0x2d0(%r8),%r10 0x000000323d4ba7b6 <__libc_fork+150>: 31 f6 xor %esi,%esi 0x000000323d4ba7b8 <__libc_fork+152>: bf 11 00 20 01 mov $0x1200011,%edi 0x000000323d4ba7bd <__libc_fork+157>: b8 38 00 00 00 mov $0x38,%eax 0x000000323d4ba7c2 <__libc_fork+162>: 0f 05 syscall 0x000000323d4ba7c4 <__libc_fork+164>: 48 3d 00 f0 ff ff cmp $0xfffffffffffff000,%rax => 0x000000323d4ba7ca <__libc_fork+170>: 0f 87 2b 01 00 00 ja 0x323d4ba8fb <__libc_fork+475> Notice how the third "si" didn't actually make progress. Turning on infrun and lin-lwp debug, we see: (gdb) infrun: clear_proceed_status_thread (process 5252) infrun: proceed (addr=0xffffffffffffffff, signal=144, step=1) infrun: resume (step=1, signal=0), trap_expected=0, current thread [process 5252] at 0x323d4ba7c4 LLR: Preparing to step process 5252, 0, inferior_ptid process 5252 RC: Not resuming sibling process 5252 (not stopped) LLR: PTRACE_SINGLESTEP process 5252, 0 (resume event thread) sigchld infrun: wait_for_inferior () linux_nat_wait: [process -1], [] LLW: enter LNW: waitpid(-1, ...) returned 5252, No child processes LLW: waitpid 5252 received Child exited (stopped) LLW: Candidate event Child exited (stopped) in process 5252. SEL: Select single-step process 5252 LLW: exit infrun: target_wait (-1, status) = infrun: 5252 [process 5252], infrun: status->kind = stopped, signal = SIGCHLD infrun: infwait_normal_state infrun: TARGET_WAITKIND_STOPPED infrun: stop_pc = 0x323d4ba7c4 infrun: random signal 20 infrun: stepi/nexti infrun: stop_stepping So the inferior got a SIGCHLD (because the fork child exited while we're doing 'si'), and since that signal is set to "nostop noprint pass" (by default), it's considered a random signal, so it should not cause a stop. But, it resulted in an immediate a stop_stepping call anyway. So the single-step never really finished. This is a regression caused by: [[PATCH] Do not respawn signals, take 2.] https://sourceware.org/ml/gdb-patches/2012-06/msg00702.html Specifically, caused by this change (as mentioned in the "the lost step issue first" part of that mail): diff --git a/gdb/infrun.c b/gdb/infrun.c index 53db335..3e8dbc8 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -4363,10 +4363,8 @@ process_event_stop_test: (leaving the inferior at the step-resume-breakpoint without actually executing it). Either way continue until the breakpoint is really hit. */ - keep_going (ecs); - return; } - + else /* Handle cases caused by hitting a breakpoint. */ { That made GDB fall through to the > /* In all-stop mode, if we're currently stepping but have stopped in > some other thread, we need to switch back to the stepped thread. */ > if (!non_stop) part. However, if we don't have a stepped thread to get back to, we'll now also fall through to all the "stepping" tests. For line stepping, that'll turn out okay, as we'll just end up realizing the thread is still in the stepping range, and needs to be re-stepped. However, for stepi/nexti, we'll reach: if (ecs->event_thread->control.step_range_end == 1) { /* It is stepi or nexti. We always want to stop stepping after one instruction. */ if (debug_infrun) fprintf_unfiltered (gdb_stdlog, "infrun: stepi/nexti\n"); ecs->event_thread->control.stop_step = 1; print_end_stepping_range_reason (); stop_stepping (ecs); return; } and stop, even though the thread actually made no progress. The fix is to restore the keep_going call, but put it after the "switch back to the stepped thread" code, and before the stepping tests. Tested on x86_64 Fedora 17, native and gdbserver. New test included. gdb/ 2013-10-18 Pedro Alves <palves@redhat.com> PR gdb/16062 * infrun.c (handle_inferior_event): Keep going if we got a random signal we should not stop for, instead of falling through to the step tests. gdb/testsuite/ 2013-10-18 Pedro Alves <palves@redhat.com> PR gdb/16062 * gdb.threads/stepi-random-signal.c: New file. * gdb.threads/stepi-random-signal.exp: New file.
* This patch adds a new convenience variable called "$_exitsignal", whichsergiodj2013-10-071-1/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | will hold the signal number when the inferior terminates due to the uncaught signal. I've made modifications on infrun.c:handle_inferior_event such that $_exitcode gets cleared when the inferior signalled, and vice-versa. This assumption was made because the variables are mutually exclusive, i.e., when the inferior terminates because of an uncaught signal it is not possible for it to return. I have also made modifications such that when a corefile is loaded, $_exitsignal gets set to the uncaught signal that "killed" the inferior, and $_exitcode is cleared. The patch also adds a NEWS entry, documentation bits, and a testcase. The documentation entry explains how to use $_exitsignal and $_exitcode in a GDB script, by making use of the new $_isvoid convenience function. gdb/ 2013-10-06 Sergio Durigan Junior <sergiodj@redhat.com> * NEWS: Mention new convenience variable $_exitsignal. * corelow.c (core_open): Reset exit convenience variables. Set $_exitsignal to the uncaught signal which generated the corefile. * infrun.c (handle_inferior_event): Reset exit convenience variables. Set $_exitsignal for TARGET_WAITKIND_SIGNALLED. (clear_exit_convenience_vars): New function. * inferior.h (clear_exit_convenience_vars): New prototype. gdb/testsuite/ 2013-10-06 Sergio Durigan Junior <sergiodj@redhat.com> * gdb.base/corefile.exp: Test whether $_exitsignal is set and $_exitcode is void when opening a corefile. * gdb.base/exitsignal.exp: New file. * gdb.base/segv.c: Likewise. * gdb.base/normal.c: Likewise. gdb/doc/ 2013-10-06 Sergio Durigan Junior <sergiodj@redhat.com> * gdb.texinfo (Convenience Variables): Document $_exitsignal. Update entry for $_exitcode.
* * aarch64-linux-nat.c: Replace PIDGET with ptid_get_pid.Luis Machado2013-09-301-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Replace TIDGET with ptid_get_lwp. Replace GET_LWP with ptid_get_lwp. * aix-thread.c (BUILD_THREAD, BUILD_LWP): Remove. Replace BUILD_THREAD with ptid_build. Replace BUILD_LWP with ptid_build. Replace PIDGET with ptid_get_pid. Replace TIDGET with ptid_get_lwp. * alphabsd-nat.c: Replace PIDGET with ptid_get_pid. * amd64-linux-nat.c: Replace PIDGET with ptid_get_pid. Replace TIDGET with ptid_get_lwp. * amd64bsd-nat.c: Replace PIDGET with ptid_get_pid. * arm-linux-nat.c: Replace PIDGET with ptid_get_pid. Replace TIDGET with ptid_get_lwp. Replace GET_LWP with ptid_get_lwp. * armnbsd-nat.c: Replace PIDGET with ptid_get_pid. * auxv.c: Likewise. * breakpoint.c: Likewise. * common/ptid.c (ptid_is_pid): Condense check for null_ptid and minus_one_ptid. (ptid_lwp_p): New function. (ptid_tid_p): New function. * common/ptid.h: Update comments for accessors. (ptid_lwp_p): New prototype. (ptid_tid_p): New prototype. * defs.h (PIDGET, TIDGET, MERGEPID): Do not define. * gcore.c: Replace PIDGET with ptid_get_pid. * gdbthread.h: Likewise. * gnu-nat.c: Likewise. * hppa-linux-nat.c: Replace PIDGET with ptid_get_pid. Replace TIDGET with ptid_get_lwp. * hppabsd-nat.c: Replace PIDGET with ptid_get_pid. * hppanbsd-nat.c: Likewise. * i386-linux-nat.c: Replace PIDGET with ptid_get_pid. Replace TIDGET with ptid_get_lwp. * i386bsd-nat.c: Replace PIDGET with ptid_get_pid. * ia64-linux-nat.c: Replace PIDGET with ptid_get_pid. * infcmd.c: Likewise. * inferior.h: Likewise. * inflow.c: Likewise. * infrun.c: Likewise. * linux-fork.c: Likewise. * linux-nat.c: Replace PIDGET with ptid_get_pid. Replace GET_PID with ptid_get_pid. Replace is_lwp with ptid_lwp_p. Replace GET_LWP with ptid_get_lwp. Replace BUILD_LWP with ptid_build.
* When reverse-stepping, only insert a resume breakpoint at ecs->stop_func_startmmetzger2013-09-181-1/+1
| | | | if the function start is known. Otherwise, keep single-stepping.
* PR gdb/15911: "info threads" changes the default source and line (for ↵Pedro Alves2013-09-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | "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.
* * inf-child.c (inf_child_follow_fork) New parameterLuis Machado2013-09-031-3/+7
| | | | | | | | | | | | | | | | | | detach_fork. * inf-ptrace.c (inf_ptrace_follow_fork): Likewise. * inf-ttrace.c (inf_ttrace_follow_fork): Likewise. * inferior.h (detach_fork): Remove. * infrun.c (detach_fork): Adjust comment and make it static. (follow_fork): Pass detach_fork parameter to target_follow_fork. * linux-nat.c (linux_child_follow_fork): New parameter detach_fork. * target.c (target_follow_fork): New parameter detach_fork. Pass detach_fork as parameter and print its value. * target.h (struct target_ops) <to_follow_fork>: New int parameter. (target_follow_fork): New parameter detach_fork.
* Move pagination_enabled declaration to a proper place.Pedro Alves2013-06-281-2/+0
| | | | | | | | | | | | Declare it close to other related declarations in utils.h, and remove local extern declaration hack. gdb/ 2013-06-28 Pedro Alves <palves@redhat.com> * infrun.c (set_observer_mode): Don't declare pagination_enabled here. * utils.h (pagination_enabled): Declare.
* infrun.c: Move non_stop_1 etc., higher up in file.Pedro Alves2013-06-281-28/+27
| | | | | | | | | | | The "non_stop_1" global is out of place, mixed with the observer bits. This moves all the non-stop user-interface-related bits together. gdb/ 2013-06-28 Pedro Alves <palves@redhat.com> * infrun.c (non_stop, non_stop_1, set_non_stop, show_non_stop): Move higher up in file.
* Move comment on the 'stepping over resolver' mechanism to the internals manual.Pedro Alves2013-06-271-40/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This whole comment is now a bit out of place. I looked into moving it to handle_inferior_event, close to where in_solib_dynsym_resolve_code is used, but then there are 3 such places. I then looked at fragmenting it, pushing bits closer to the definitions of in_solib_dynsym_resolve_code and gdbarch_skip_solib_resolver, but then we'd lose the main advantage which is the overview. In the end, I realized this can fit nicely as internals manual material. This could possibly be a subsection of a new "run control", or "source stepping" or "stepping" or some such a bit more general section, but we can do that when we have more related content... Even the "single stepping" section is presently empty... gdb/doc/ 2013-06-27 Pedro Alves <palves@redhat.com> * gdbint.texinfo (Algorithms) <Stepping over runtime loader dynamic symbol resolution code>: New section, based on infrun.c comment. gdb/ 2013-06-27 Pedro Alves <palves@redhat.com> * infrun.c: Remove comment describing the 'stepping over runtime loader dynamic symbol resolution code' mechanism; moved to gdbint.texinfo.
* Garbage collect SOLIB_IN_DYNAMIC_LINKER.Pedro Alves2013-06-261-12/+0
| | | | | | | | | | This hasn't been used for years. gdb/ 2013-06-26 Pedro Alves <palves@redhat.com> * infrun.c (SOLIB_IN_DYNAMIC_LINKER): Delete macro and describing comment.
* Update comments on stepping over resolver code.Pedro Alves2013-06-261-16/+16
| | | | | | | | | | | | | This updates the comments on the step-over-resolver mechanism a bit, adjusting it to refer to the gdbarch hooks instead of the old macros; to mention the in_dynsym_resolve_code hook of the target_so_ops vector; and to American English spelling (signalling->signaling). gdb/ 2013-06-26 Pedro Alves <palves@redhat.com> * infrun.c: Update comments on stepping over runtime loader dynamic symbol resolution code.
* Fix PR cli/15603Tom Tromey2013-06-181-6/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes PR cli/15603. The bug here is that when a software watchpoint is being used, gdb will stop responding to C-c. This is a regression caused by the "catch signal" patch. The problem is that software watchpoints always end up on the bpstat list. However, this makes bpstat_explains_signal return BPSTAT_SIGNAL_HIDE, causing infrun to think that the signal is not a "random signal". The fix is to change bpstat_explains_signal to handle this better. I chose to do it in a "clean API" way, by passing the signal value to bpstat_explains_signal and then adding an explains_signal method for watchpoints, which handles the specifics. Built and regtested on x86-64 Fedora 18. New test case included. * break-catch-sig.c (signal_catchpoint_explains_signal): Add 'sig' argument. * breakpoint.c (bpstat_explains_signal): Add 'sig' argument. Special case signals other than GDB_SIGNAL_TRAP. (explains_signal_watchpoint): New function. (base_breakpoint_explains_signal): Add 'sig' argument. (initialize_breakpoint_ops): Set 'explains_signal' method for watchpoints. * breakpoint.h (struct breakpoint_ops) <explains_signal>: Add signal argument. (bpstat_explains_signal): Likewise. * infrun.c (handle_syscall_event, handle_inferior_event): Update. * gdb.base/random-signal.c: New file. * gdb.base/random-signal.exp: New file.
* 2013-06-04 Gary Benson <gbenson@redhat.com>gary2013-06-041-1/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * breakpoint.h (handle_solib_event): Moved function declaration to solib.h. * breakpoint.c (handle_solib_event): Moved function to solib.c. (bpstat_stop_status): Pass new argument to handle_solib_event. * solib.h (update_solib_breakpoints): New function declaration. (handle_solib_event): Moved function declaration from breakpoint.h. * solib.c (update_solib_breakpoints): New function. (handle_solib_event): Moved function from breakpoint.c. Updated to call solib_ops->handle_event if not NULL. * solist.h (target_so_ops): New fields "update_breakpoints" and "handle_event". * infrun.c (set_stop_on_solib_events): New function. (_initialize_infrun): Use the above for "set stop-on-solib-events". (handle_inferior_event): Pass new argument to handle_solib_event. * solib-svr4.c (probe.h): New include. (svr4_free_library_list): New forward declaration. (probe_action): New enum. (probe_info): New struct. (probe_info): New static variable. (NUM_PROBES): New definition. (svr4_info): New fields "using_xfer", "probes_table" and "solib_list". (free_probes_table): New function. (free_solib_list): New function. (svr4_pspace_data_cleanup): Free probes table and solib list. (svr4_copy_library_list): New function. (svr4_current_sos_via_xfer_libraries): New parameter "annex". (svr4_read_so_list): New parameter "prev_lm". (svr4_current_sos_direct): Renamed from "svr4_current_sos". (svr4_current_sos): New function. (probe_and_action): New struct. (hash_probe_and_action): New function. (equal_probe_and_action): Likewise. (register_solib_event_probe): Likewise. (solib_event_probe_at): Likewise. (solib_event_probe_action): Likewise. (solist_update_full): Likewise. (solist_update_incremental): Likewise. (disable_probes_interface_cleanup): Likewise. (svr4_handle_solib_event): Likewise. (svr4_update_solib_event_breakpoint): Likewise. (svr4_update_solib_event_breakpoints): Likewise. (svr4_create_solib_event_breakpoints): Likewise. (enable_break): Free probes table before creating breakpoints. Use svr4_create_solib_event_breakpoints to create breakpoints. (svr4_solib_create_inferior_hook): Free the solib list. (_initialize_svr4_solib): Initialise svr4_so_ops.handle_solib_event and svr4_so_ops.update_breakpoints.
* some fixes to infrun.cTom Tromey2013-05-301-4/+3
| | | | | | | | | | This fixes some of the problems in infrun.c that the checker reported. I filed the remaining problems as bugs. This patch is purely stylistic. * infrun.c (adjust_pc_after_break): Introduce an outer null cleanup.
* range stepping: gdbPedro Alves2013-05-231-0/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch teaches GDB to take advantage of target-assisted range stepping. It adds a new 'r ADDR1,ADDR2' action to vCont (vCont;r), meaning, "step once, and keep stepping as long as the thread is in the [ADDR1,ADDR2) range". Rationale: When user issues the "step" command on the following line of source, a = b + c + d * e - a; GDB single-steps every single instruction until the program reaches a new different line. E.g., on x86_64, that line compiles to: 0x08048434 <+65>: mov 0x1c(%esp),%eax 0x08048438 <+69>: mov 0x30(%esp),%edx 0x0804843c <+73>: add %eax,%edx 0x0804843e <+75>: mov 0x18(%esp),%eax 0x08048442 <+79>: imul 0x2c(%esp),%eax 0x08048447 <+84>: add %edx,%eax 0x08048449 <+86>: sub 0x34(%esp),%eax 0x0804844d <+90>: mov %eax,0x34(%esp) 0x08048451 <+94>: mov 0x1c(%esp),%eax and the following is the RSP traffic between GDB and GDBserver: --> vCont;s:p2e13.2e13;c <-- T0505:68efffbf;04:30efffbf;08:3c840408;thread:p2e13.2e13;core:1; --> vCont;s:p2e13.2e13;c <-- T0505:68efffbf;04:30efffbf;08:3e840408;thread:p2e13.2e13;core:2; --> vCont;s:p2e13.2e13;c <-- T0505:68efffbf;04:30efffbf;08:42840408;thread:p2e13.2e13;core:2; --> vCont;s:p2e13.2e13;c <-- T0505:68efffbf;04:30efffbf;08:47840408;thread:p2e13.2e13;core:0; --> vCont;s:p2e13.2e13;c <-- T0505:68efffbf;04:30efffbf;08:49840408;thread:p2e13.2e13;core:0; --> vCont;s:p2e13.2e13;c <-- T0505:68efffbf;04:30efffbf;08:4d840408;thread:p2e13.2e13;core:0; --> vCont;s:p2e13.2e13;c <-- T0505:68efffbf;04:30efffbf;08:51840408;thread:p2e13.2e13;core:0; IOW, a lot of roundtrips between GDB and GDBserver. If we add a new command to the RSP, meaning "keep stepping and don't report a stop until the program goes out of the [0x08048434, 0x08048451) address range", then the RSP traffic can be reduced down to: --> vCont;r8048434,8048451:p2db0.2db0;c <-- T0505:68efffbf;04:30efffbf;08:51840408;thread:p2db0.2db0;core:1; As number of packets is reduced dramatically, the performance of stepping source lines is much improved. In case something is wrong with range stepping on the stub side, the debug info or even gdb, this adds a "set/show range-stepping" command to be able to turn range stepping off. gdb/ 2013-05-23 Yao Qi <yao@codesourcery.com> Pedro Alves <palves@redhat.com> * gdbthread.h (struct thread_control_state) <may_range_step>: New field. * infcmd.c (step_once, until_next_command): Enable range stepping. * infrun.c (displaced_step_prepare): Disable range stepping. (resume): Disable range stepping if stepping over a breakpoint or we have software watchpoints. If range stepping is enabled, assert the thread is in the stepping range. (clear_proceed_status_thread): Clear may_range_step. (handle_inferior_event): Disable range stepping as soon as we know the thread that hit the event. Re-enable it whenever we're going to step with a step range. * remote.c (struct vCont_action_support) <r>: New field. (use_range_stepping): New global. (remote_vcont_probe): Handle 'r' action. (append_resumption): Append an 'r' action if the thread may range step. (show_range_stepping): New function. (set_range_stepping): New function. (_initialize_remote): Call add_setshow_boolean_cmd to register the 'set range-stepping' and 'show range-stepping' commands. * NEWS: Mention range stepping, the new vCont;r action, and the new "set/show range-stepping" commands. gdb/doc/ 2013-05-23 Yao Qi <yao@codesourcery.com> Pedro Alves <palves@redhat.com> * gdb.texinfo (Packets): Document 'vCont;r'. (Continuing and Stepping): Document target-assisted range stepping, and the 'set range-stepping' and 'show range-stepping' commands.
* Factor out in-stepping-range checks.Pedro Alves2013-05-231-4/+2
| | | | | | | | | | | | | | This adds a function for doing within-thread's-stepping-range checks, and converts a couple spots to use it. Following patches will add more uses. gdb/ 2013-05-23 Yao Qi <yao@codesourcery.com> Pedro Alves <palves@redhat.com> * gdbthread.h (pc_in_thread_step_range): New declaration. * thread.c (pc_in_thread_step_range): New function. * infrun.c (handle_inferior_event): Use it.
* Reimplement shared library support on ppc-aix...Joel Brobecker2013-05-061-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ... using the target_so_ops framework. gdb/ChangeLog: * target.h (TARGET_OBJECT_AIX_LIBRARIES): New target_object enum. * features/library-list-aix.dtd: New file. * solib-aix.h, solib-aix.c: New file. * rs6000-aix-tdep.c: #include "solib.h" and "solib-aix.h". (rs6000_find_toc_address_hook): Delete. (rs6000_push_dummy_call): Rewrite code setting the TOC value. (rs6000_aix_init_osabi): Register solib_aix_so_ops. * rs6000-nat.c: Remove "xcoffsolib.h" include. Include "xml-utils.h". (map_vmap, vmap_exec, vmap_ldinfo, add_vmap, objfile_symbol_add) (vmap_symtab, fixup_breakpoints): Delete. (rs6000_xfer_shared_libraries): New function. (rs6000_xfer_partial): Add TARGET_OBJECT_AIX_LIBRARIES handling. (vmap_secs, bss_data_overlap, vmap_add_symbols): Delete. (xcoff_relocate_symtab, xcoff_relocate_core): Delete. (rs6000_ptrace_ldinfo, rs6000_core_ldinfo) (rs6000_xfer_shared_library): New function. (find_toc_address): Delete. (_initialize_rs6000_nat): Do not set rs6000_find_toc_address_hook. * rs6000-tdep.h (rs6000_find_toc_address_hook): Remove. * xcoffread.c (record_minimal_symbol): Reloate symbol address before creating minimal symbol. Adjust function description accordingly. (scan_xcoff_symtab): Replace call to prim_record_minimal_symbol_and_info by call to record_minimal_symbol. (xcoff_symfile_offsets): Reimplement mostly as a wrapper around default_symfile_offsets. * configure.tgt: Add solib-aix.o to gdb_target_obs for powerpc-aix targets. * config/rs6000/nm-rs6000.h: Delete. * config/powerpc/aix.mh (NAT_FILE): Delete. (NATDEPFILES): Remove xcoffsolib.o. * Makefile.in (XMLFILES): Add library-list-aix.dtd. (ALL_TARGET_OBS): Add solib-aix.o. (HFILES_NO_SRCDIR): Remove xcoffsolib.h and config/rs6000/nm-rs6000.h. Add solib-aix.h. (ALLDEPFILES): Add solib-aix.c. Remove xcoffsolib.c. * xcoffsolib.h, xcoffsolib.c: Delete. * solib.c (reload_shared_libraries): Remove reference to SOLIB_CREATE_INFERIOR_HOOK. * breakpoint.c (handle_solib_event): Remove reference to SOLIB_ADD. (disable_breakpoints_in_shlibs): Remove reference to PC_SOLIB. (momentary_bkpt_re_set): Replace SOLIB_ADD by solib_add in comment. * corelow.c (deprecated_core_resize_section_table): Delete. * exec.c: Remove include of xcoffsolib.h". (map_vmap, vmap): Delete. (exec_close_1): Remove references to vmap. (exec_file_attach): Remove vmap handling code, and reference to DEPRECATED_IBM6000_TARGET. (bfdsec_to_vmap): Delete. (exec_files_info): Remove block of code handling VMAP. * infcmd.c (post_create_inferior): Remove reference to SOLIB_CREATE_INFERIOR_HOOK and SOLIB_ADD. * infrun.c (follow_exec): Remove reference to SOLIB_CREATE_INFERIOR_HOOK. * stack.c (print_frame): Remove reference to PC_SOLIB. * solib-dsbt.c (dsbt_current_sos): Adjust comment. (dsbt_relocate_main_executable): Likewise. * solib-frv.c (frv_current_sos): Likewise. gdb/doc/ChangeLog: * gdbint.texinfo (Algorithms): Remove entries documenting DEPRECATED_IBM6000_TARGET, SOLIB_ADD, and SOLIB_CREATE_INFERIOR_HOOK.
* gdb/qiyao2013-04-221-1/+1
| | | | * infrun.c: Fix typo in comment.
* Constify strings in tracepoint.c, lookup_cmd and the completers.Pedro Alves2013-03-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is sort of a continuation of Keith's parse_exp_1 constification patch. It started out by undoing these bits: @@ -754,9 +754,12 @@ validate_actionline (char **line, struct tmp_p = p; for (loc = t->base.loc; loc; loc = loc->next) { - p = tmp_p; - exp = parse_exp_1 (&p, loc->address, + const char *q; + + q = tmp_p; + exp = parse_exp_1 (&q, loc->address, block_for_pc (loc->address), 1); + p = (char *) q; and progressively making more things const upwards, fixing fallout, rinse repeat, until GDB built again (--enable-targets=all). That ended up constifying lookup_cmd/add_cmd and (lots of) friends, and the completers. I didn't try to constify the command hooks themselves, because I know upfront there are commands that write to the command string argument, and I think I managed to stop at a nice non-hacky split point already. I think the only non-really-super-obvious changes are tracepoint.c:validate_actionline, and tracepoint.c:trace_dump_actions. The rest is just mostly about 'char *' => 'const char *', 'char **'=> 'const char **', and the occasional (e.g., deprecated_cmd_warning) case of 'char **'=> 'const char *', where/when I noticed that nothing actually cares about the pointer to pointer output. Tested on x86_64 Fedora 17, native and gdbserver. gdb/ 2013-03-13 Pedro Alves <palves@redhat.com> * ada-lang.c (struct add_partial_datum) <text, text0, word>: Make fields const. (ada_make_symbol_completion_list): Make "text0" parameter const. * ax-gdb.c (agent_eval_command_one): Make "exp" parameter const. * breakpoint.c (condition_completer): Make "text" and "word" parameters const. Adjust. (check_tracepoint_command): Adjust to validate_actionline prototype change. (catch_syscall_completer): Make "text" and "word" parameters const. * cli/cli-cmds.c (show_user): Make "comname" local const. (valid_command_p): Make "command" parameter const. (alias_command): Make "alias_prefix" and "command_prefix" locals const. * cli/cli-decode.c (add_cmd): Make "name" parameter const. (add_alias_cmd): Make "name" and "oldname" parameters const. Adjust. No longer make copy of OLDNAME. (add_prefix_cmd, add_abbrev_prefix_cmd, add_set_or_show_cmd) (add_setshow_cmd_full, add_setshow_enum_cmd) (add_setshow_auto_boolean_cmd, add_setshow_boolean_cmd) (add_setshow_filename_cmd, add_setshow_string_cmd) (add_setshow_string_noescape_cmd) (add_setshow_optional_filename_cmd, add_setshow_integer_cmd) (add_setshow_uinteger_cmd, add_setshow_zinteger_cmd) (add_setshow_zuinteger_unlimited_cmd, add_setshow_zuinteger_cmd) (delete_cmd, add_info, add_info_alias, add_com, add_com_alias): Make "name" parameter const. (help_cmd): Rename "command" parameter to "arg". New const local "command". (find_cmd): Make "command" parameter const. (lookup_cmd_1): Make "text" parameter pointer to const. Adjust to deprecated_cmd_warning prototype change. (undef_cmd_error): Make "cmdtype" parameter const. (lookup_cmd): Make "line" parameter const. (deprecated_cmd_warning): Change type of "text" parameter to pointer to const char, from pointer to pointer to char. Adjust. (lookup_cmd_composition): Make "text" parameter const. (complete_on_cmdlist, complete_on_enum): Make "text" and "word" parameters const. * cli/cli-decode.h (struct cmd_list_element) <name>: Make field const. * cli/cli-script.c (validate_comname): Make "tem" local const. (define_command): New const local "tem_c". Use it in calls to lookup_cmd. (document_command): Make "tem" and "comfull" locals const. (show_user_1): Make "prefix" and "name" parameters const. * cli-script.h (show_user_1): Make "prefix" and "name" parameters const. * command.h (add_cmd, add_alias_cmd, add_prefix_cmd) (add_abbrev_prefix_cmd, completer_ftype, lookup_cmd, lookup_cmd_1) (deprecated_cmd_warning, lookup_cmd_composition, add_com) (add_com_alias, add_info, add_info_alias, complete_on_cmdlist) (complete_on_enum, add_setshow_enum_cmd) (add_setshow_auto_boolean_cmd, add_setshow_boolean_cmd) (add_setshow_filename_cmd, add_setshow_string_cmd) (add_setshow_string_noescape_cmd) (add_setshow_optional_filename_cmd, add_setshow_integer_cmd) (add_setshow_uinteger_cmd, add_setshow_zinteger_cmd) (add_setshow_zuinteger_cmd, add_setshow_zuinteger_unlimited_cmd): Change prototypes, constifying strings. * completer.c (noop_completer, filename_completer): Make "text" and "prefix" parameters const. (location_completer, expression_completer) (complete_line_internal): Make "text" and "prefix" parameters const and adjust. (command_completer, signal_completer): Make "text" and "prefix" parameters const. * completer.h (noop_completer, filename_completer) (expression_completer, location_completer, command_completer) (signal_completer): Change prototypes. * corefile.c (complete_set_gnutarget): Make "text" and "word" parameters const. * cp-abi.c (cp_abi_completer): Likewise. * expression.h (parse_expression_for_completion): Change prototype. * f-lang.c (f_make_symbol_completion_list): Make "text" and "word" parameters const. * infcmd.c (_initialize_infcmd): Make "cmd_name" local const. * infrun.c (handle_completer): Make "text" and "word" parameters const. * interps.c (interpreter_completer): Make "text" and "word" parameters const. * language.h (struct language_defn) <la_make_symbol_completion_list>: Make "text" and "word" parameters const. * parse.c (parse_exp_1): Move const hack to parse_exp_in_context. (parse_exp_in_context): Rename to ... (parse_exp_in_context_1): ... this. (parse_exp_in_context): Reimplement, with const hack from parse_exp_1. (parse_expression_for_completion): Make "string" parameter const. * printcmd.c (decode_format): Make "string_ptr" parameter pointer to pointer to const char. Adjust. (print_command_1): Make "exp" parameter const. (output_command): Rename to ... (output_command_const): ... this. Make "exp" parameter const. (output_command): Reimplement. (x_command): Adjust. (display_command): Rename "exp" parameter to "arg". New "exp" local, const version of "arg". * python/py-auto-load.c (gdbpy_initialize_auto_load): Make "cmd_name" local const. * python/py-cmd.c (cmdpy_destroyer): Cast const away in xfree call. (cmdpy_completer): Make "text" and "word" parameters const. (gdbpy_parse_command_name): Make "prefix_text2" local const. * python/py-param.c (add_setshow_generic): Make "tmp_name" local const. * remote.c (_initialize_remote): Make "cmd_name" local const. * symtab.c (language_search_unquoted_string): Make "text" and "p" parameters const. Adjust. (completion_list_add_fields): Make "sym_text", "text" and "word" parameters const. (struct add_name_data) <sym_text, text, word>: Make fields const. (default_make_symbol_completion_list_break_on): Make "text" and "word" parameters const. Adjust locals. (default_make_symbol_completion_list) (make_symbol_completion_list, make_symbol_completion_type) (make_symbol_completion_list_fn): Make "text" and "word" parameters const. (make_file_symbol_completion_list): Make "text", "word" and "srcfile" parameters const. Adjust locals. (add_filename_to_list): Make "text" and "word" parameters const. (struct add_partial_filename_data) <text, word>: Make fields const. (make_source_files_completion_list): Make "text" and "word" parameters const. * symtab.h (default_make_symbol_completion_list_break_on) (default_make_symbol_completion_list, make_symbol_completion_list) (make_symbol_completion_type enum type_code) (make_symbol_completion_list_fn make_file_symbol_completion_list) (make_source_files_completion_list): Change prototype. * top.c (execute_command): Adjust to pass pointer to pointer to const char to lookup_cmd, and to deprecated_cmd_warning prototype change. (set_verbose): Make "cmdname" local const. * tracepoint.c (decode_agent_options): Make "exp" parameter const, and adjust. (validate_actionline): Make "line" parameter a pointer to const char, and adjust. (encode_actions_1): Make "action_exp" local const, and adjust. (encode_actions): Adjust. (replace_comma): Delete. (trace_dump_actions): Make "action_exp" and "next_comma" locals const, and adjust. Don't frob the action string while splitting it at commas. Instead, make a copy of each split substring in turn. (trace_dump_command): Adjust to validate_actionline prototype change. * tracepoint.h (decode_agent_options, decode_agent_options) (encode_actions, validate_actionline): Change prototypes. * valprint.h (output_command): Delete declaration. (output_command_const): Declare. * value.c (function_destroyer): Cast const away in xfree call.
* Rename record_ prefixes in record-full.h into record_full_.mmetzger2013-03-111-1/+1
| | | | | | | | | | | | | | | | 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.
* Split record.h into record.h and record-full.h.mmetzger2013-03-111-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* 2013-01-31 Aleksandar Ristovski <aristovski@qnx.com>Aleksandar Ristovski2013-01-311-2/+4
| | | | | | | | | | * infrun.c (handle_syscall_event): Remove unused gdbarch. (save_infcall_suspend_state): Ifdef out unused inf. (restore_infcall_suspend_state): Ifdef out unused inf. * jit.c (jit_register_code): Remove unused i, b, inf_data. (jit_frame_sniffer): Remove unused inf_data. Reference: http://sourceware.org/ml/gdb-patches/2013-01/msg00773.html
* gdb/qiyao2013-01-181-6/+8
| | | | | * infrun.c (proceed): Rename local variable 'oneproc' to 'force_step'.
* 2013-01-03 Pedro Alves <palves@redhat.com>Tom Tromey2013-01-161-116/+140
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Tom Tromey <tromey@redhat.com> PR cli/7221: * NEWS: Add "catch signal". * breakpoint.c (base_breakpoint_ops): No longer static. (bpstat_explains_signal): New function. (init_catchpoint): No longer static. (base_breakpoint_explains_signal): New function. (base_breakpoint_ops): Initialize new field. * breakpoint.h (enum bpstat_signal_value): New. (struct breakpoint_ops) <explains_signal>: New field. (bpstat_explains_signal): Remove macro, declare as function. (base_breakpoint_ops, init_catchpoint): Declare. * break-catch-sig.c: New file. * inferior.h (signal_catch_update): Declare. * infrun.c (signal_catch): New global. (handle_syscall_event): Update for change to bpstat_explains_signal. (handle_inferior_event): Likewise. Always handle random signals via bpstats. (signal_cache_update): Check signal_catch. (signal_catch_update): New function. (_initialize_infrun): Initialize signal_catch. * Makefile.in (SFILES): Add break-catch-sig.c. (COMMON_OBS): Add break-catch-sig.o. gdb/doc * gdb.texinfo (Set Catchpoints): Document "catch signal". (Signals): Likewise. gdb/testsuite * gdb.base/catch-signal.c: New file. * gdb.base/catch-signal.exp: New file.
* Update years in copyright notice for the GDB files.Joel Brobecker2013-01-011-1/+1
| | | | | | | Two modifications: 1. The addition of 2013 to the copyright year range for every file; 2. The use of a single year range, instead of potentially multiple year ranges, as approved by the FSF.
* gdb/Jan Kratochvil2012-12-241-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * breakpoint.c (breakpoint_re_set): Remove the skip_re_set call. * infrun.c (handle_inferior_event): Rename the called function to function_name_is_marked_for_skip, pass it TMP_SAL. * skip.c (struct skiplist_entry): Update function_name comment. Remove fields pc, gdbarch and pending. (skip_function_pc): Rename this forward declaration to ... (skip_function): ... here. (skip_file_command): Remove variable pending and its use, remove initialization of E fields pending and gdbarch. Do not use SYMTAB filename, use the specified one. (skip_function_command): Remove variable func_pc, do not set it. Update the caller of skip_function. Replace decode_line_1 call by a lookup_symbol call. Remove variables orig_arg, decode_exception and sals. Update the caller of skip_function. (skip_info): Remove variable address_width and its use. Do not print address (PC). Renumber column 5 to 4. (skip_function_pc): Rename to ... (skip_function): ... here and remove its parameters pc, arch and pending. Update the function comment and no longer use those parameters. (function_pc_is_marked_for_skip): Rename to ... (function_name_is_marked_for_skip): ... here, update function comment just to a skip.h reference, replace pc parameter by function_name and function_sal. No longer use E field pending and pc. Remove variables searched_for_sal, sal and filename. Call compare_filenames_for_search instead of just strcmp. (skip_re_set): Remove the function. * skip.h (struct symtab_and_line): New declaration. (function_pc_is_marked_for_skip): Rename to ... (function_name_is_marked_for_skip): ... here, replace pc parameter by function_name and function_sal, update the function comment. gdb/testsuite/ * gdb.base/skip-solib.exp (info skip with pending file): Update the expected output. (info skip with pending file): Remove. (ignoring function in solib, info skip for function multiply): Update the expected output. * gdb.base/skip.ex (skip (main), skip function baz, info skip) (info skip (delete 1), info skip after disabling all) (info skip after enabling all, info skip after disabling 4 2-3) (info skip after enabling 2-3, info skip 2-3) (info skip after deleting 2 3): Update the expected output. * gdb.linespec/base/two/thefile.cc (n): New variable v, split the statement to its initialization and return. * gdb.linespec/skip-two.exp: New file.
* gdb/qiyao2012-11-301-14/+0
| | | | | | | | | | | 2012-11-30 Yao Qi <yao@codesourcery.com> * infrun.c (error_is_running, ensure_not_running): Move them to ... * infcmd.c (error_is_running, ensure_not_running): ... here. Make them 'static'. * inferior.h: Remove declarations of error_is_running and ensure_not_running.
* gdb/qiyao2012-11-301-2/+2
| | | | | | | | 2012-11-30 Yao Qi <yao@codesourcery.com> * infrun.c: Make the declaration of 'init_infwait_state' static. (init_infwait_state): Make it 'static'.
* gdb/qiyao2012-11-201-1/+1
| | | | | | | 2012-11-20 Yao Qi <yao@codesourcery.com> * infrun.c (handle_inferior_event): Pass 'saved_singlestep_ptid' to deprecated_context_hook.
* gdb/qiyao2012-11-191-1/+1
| | | | | | 2012-11-19 Yao Qi <yao@codesourcery.com> * infrun.c (infwait_state): Add static.
* 2012-11-09 Pedro Alves <palves@redhat.com>Pedro Alves2012-11-091-0/+19
| | | | | | | | | | | | | | | PR gdb/14306 * infrun.c: Include target-descriptions.h. (follow_exec): Fetch new target description. gdb/testsuite/ 2012-11-09 Pedro Alves <palves@redhat.com> PR gdb/14306 * gdb.multi/multi-arch-exec.c: New file. * gdb.multi/multi-arch-exec.exp: New file.
* gdb/Pedro Alves2012-11-051-0/+2
| | | | | | | | | | | | | | | | | 2012-11-05 Pedro Alves <palves@redhat.com> * inferior.c (exit_inferior_1): Clear 'vfork_parent' in the vfork child. Clear 'pending_detach'. * infrun.c (handle_vfork_child_exec_or_exit): Clear 'pending_detach' in the vfork parent. gdb/testsuite/ 2012-11-05 Pedro Alves <palves@redhat.com> * gdb.base/foll-vfork.exp (vfork_relations_in_info_inferiors): New procedure. (do_vfork_and_follow_child_tests_exec) (do_vfork_and_follow_child_tests_exit): Call it.
* gdb/Pedro Alves2012-11-021-1/+10
| | | | | | | | | | | | | | | | | | | | | 2012-11-02 Pedro Alves <palves@redhat.com> PR gdb/14766 * infrun.c (handle_inferior_event) <TARGET_WAITKIND_EXITED/TARGET_WAITKIND_SIGNALLED>: Switch to null_ptid before handling a vfork child exec or exit. Switch to the event ptid afterwards. gdb/testsuite/ 2012-11-02 Pedro Alves <palves@redhat.com> PR gdb/14766 * gdb.base/foll-vfork.exp (vfork_child_follow_to_exit): Remove setup_kfail. (tcatch_vfork_then_child_follow_exit): No longer expect "Couldn't get registers".
* 2012-10-26 Pedro Alves <palves@redhat.com>Pedro Alves2012-10-261-27/+24
| | | | | * infrun.c (handle_inferior_event) <TARGET_WAITKIND_SIGNALLED>: Remove comment.
* 2012-10-26 Pedro Alves <palves@redhat.com>Pedro Alves2012-10-261-5/+0
| | | | | * infrun.c (handle_inferior_event) <TARGET_WAITKIND_SIGNALLED>: Remove comment.
* 2012-10-26 Pedro Alves <palves@redhat.com>Pedro Alves2012-10-261-1/+6
| | | | | * infrun.c (handle_inferior_event): Print TARGET_WAITKIND_VFORKED as "TARGET_WAITKIND_VFORKED", not "TARGET_WAITKIND_FORKED".
* * infrun.c (restore_infcall_suspend_state): Eliminate single-usesiddhesh2012-09-171-2/+1
| | | | variable LEN.
* gdb/Jan Kratochvil2012-09-171-16/+32
| | | | | | | | | | | | | | | | PR 14548 * infrun.c (handle_inferior_event): Do not reverse-continue back to the function start if we are already at function start. Both for reverse-next and for reverse-step into function without line number info. gdb/testsuite/ PR 14548 * gdb.reverse/singlejmp-reverse-nodebug.S: New file. * gdb.reverse/singlejmp-reverse-nodebug.c: New file. * gdb.reverse/singlejmp-reverse.S: New file. * gdb.reverse/singlejmp-reverse.c: New file. * gdb.reverse/singlejmp-reverse.exp: New file.
* 2012-08-23 Pedro Alves <palves@redhat.com>Pedro Alves2012-08-231-3/+7
| | | | | | | | | gdb/ * infrun.c (_initialize_infrun) <handle command help text>: Mention that multiple signals are supported. gdb/testsuite/ * gdb.base/help.exp: Adjust to "handle" help text change.
* Change detach_breakpoints to take a ptid instead of a pidJoel Brobecker2012-08-161-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before this change, detach_breakpoints would take a pid, and then set inferior_ptid to a ptid that it constructs using pid_to_ptid (pid). Unfortunately, this ptid is not necessarily valid. Consider for instance the case of ia64-hpux, where ttrace refuses a register-read operation if the LWP is not provided. This problems shows up when GDB is trying to handle fork events. Assuming GDB is configured to follow the parent, GDB will try to detach from the child. But before doing so, it needs to remove all breakpoints inside that child. On ia64, this involves reading inferior (the child's) memory. And on ia64-hpux, reading memory requires us to read the bsp and bspstore registers, in order to determine where that memory is relative to the value of those registers, and thus to determine which ttrace operation to use in order to fetch that memory (see ia64_hpux_xfer_memory). This patch therefore changes detach_breakpoints to take a ptid instead of a pid, and then updates all callers. One of the consequences of this patch is that it trips an assert on GNU/Linux targets. But this assert appears to have not actual purpose, and is thus removed. gdb/ChangeLog: * breakpoint.h (detach_breakpoints): pid parameter is now a ptid. * breakpoint.c (detach_breakpoints): Change pid parameter into a ptid. Adjust code accordingly. * infrun.c (handle_inferior_event): Delete variable child_pid. Update call to detach_breakpoints to pass the child ptid for fork events. * linux-nat.c (linux_nat_iterate_watchpoint_lwps): Remove assert that inferior_ptid's lwp is zero. (linux_handle_extended_wait): Update call to detach_breakpoints. * inf-ttrace.c (inf_ttrace_follow_fork): Update call to detach_breakpoints.
* gdb: improve usage stringsMike Frysinger2012-08-151-0/+6
| | | | | | | This adds Usage strings to a bunch of commands, tweaks the grammar in a few, and improves the help text for the handle command. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* gdb: add completion handler for "handle" and "signal"Mike Frysinger2012-08-101-1/+34
| | | | | | | | | | | | | | The command line completion has spoiled me. Thus the lack of completion with the "handle" command annoys me. Patch! This does a few things: - adds a VEC_merge helper - adds a generic signal completer - adds a completion handler for the "handle" command - sets the completion handler for the "signal" command URL: http://sourceware.org/bugzilla/show_bug.cgi?id=10436 Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* gdb/qiyao2012-08-021-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * dwarf2loc.c (entry_values_debug): Add 'unsigned'. (_initialize_dwarf2loc): Call add_setshow_zuinteger_cmd instead of add_setshow_zinteger_cmd. * dwarf2loc.h: Update the declaration of 'entry_values_debug'. * dwarf2read.c (dwarf2_die_debug): Add 'unsigned'. (_initialize_dwarf2_read): Call add_setshow_zuinteger_cmd instead of add_setshow_zinteger_cmd. * darwin-nat.c (dwarwin_debug_flag): Add 'unsigned'. (_initialize_darwin_inferior): Call add_setshow_zuinteger_cmd instead of add_setshow_zinteger_cmd. * frame.c (frame_debug): Add 'unsigned'. (_intialize_frame): Call add_setshow_zuinteger_cmd instead of add_setshow_zinteger_cmd. * frame.h: Update the declaration of 'frame_debug'. * gdbtypes.c (overload_debug): Add 'unsigned'. (_initialize_gdbtypes): Call add_setshow_zuinteger_cmd instead of add_setshow_zinteger_cmd. * inferior.h: Update declaration of 'debug_infrun'. * infrun.c (debug_infrun): Add 'unsigned'. (_initialize_infrun): Call add_setshow_zuinteger_cmd instead of add_setshow_zinteger_cmd. * jit.c (jit_debug): Add 'unsigned'. (_initialize_jit): Call add_setshow_zuinteger_cmd instead of add_setshow_zinteger_cmd. * linux-nat.c (debug_linux_nat): Add 'unsigned'. (_initialize_linux_nat): Call add_setshow_zuinteger_cmd instead of add_setshow_zinteger_cmd. * linux-thread-db.c (libthread_db_debug): Add 'unsigned'. (_initialize_thread_db): Call add_setshow_zuinteger_cmd instead of add_setshow_zinteger_cmd. * machoread.c (mach_o_debug_level): Add 'unsigned'. (_initialize_machoread): Call add_setshow_zuinteger_cmd instead of add_setshow_zinteger_cmd. * mi/mi-cmd-var.c: Update the declaration of 'varobjdebug'. * microblaze-tdep.c (microblaze_debug_flag): Add 'unsigned'. (_initialize_microblaze_tdep): Call add_setshow_zuinteger_cmd intead of add_setshow_zinteger_cmd. * mips-tdep.c (mips_debug): Add 'unsigned'. (_initialize_mips_tdep): Call add_setshow_zuinteger_cmd instead of add_setshow_zinteger_cmd. * monitor.c (monitor_debug): Add 'unsigned'. (_initialize_remote_monitors): Call add_setshow_zuinteger_cmd instead of add_setshow_zinteger_cmd. * observer.c (observer_debug): Add 'unsigned'. (_initialize_observer): Call add_setshow_zuinteger_cmd instead of add_setshow_zinteger_cmd. * parse.c (expressiondebug): Add 'unsigned'. (_initialize_parse): Call add_setshow_zuinteger_cmd instead of add_setshow_zinteger_cmd. * record.c (record_debug): Add 'unsigned'. (_initialize_record): Call add_setshow_zuinteger_cmd instead of add_setshow_zinteger_cmd. * record.h: Update the declaration of 'record_debug'. * stap-probe.c (stap_expression_debug): Add 'unsigned'. (_initialize_stap_probe): Call add_setshow_zuinteger_cmd instead of add_setshow_zinteger_cmd. * serial.c (global_serial_debug_p): Add 'unsigned'. (_initialize_serial): Call add_setshow_zuinteger_cmd instead of add_setshow_zinteger_cmd. * solib-dsbt.c (solib_dsbt_debug): Add 'unsigned'. (_initialize_dsbt_solib): Call add_setshow_zuinteger_cmd instead of add_setshow_zinteger_cmd. * solib-frv.c (solib_frv_debug): Add 'unsigned'. (_initialize_frv_solib): Call add_setshow_zuinteger_cmd instead of add_setshow_zinteger_cmd. * target.c (targetdebug): Add 'unsigned'. (initialize_targets): Call add_setshow_zuinteger_cmd instead of add_setshow_zinteger_cmd. * valops.c (overload_debug): Add 'unsigned'. * varobj.c (varobjdebug): Add 'unsigned'. (_initialize_varobj): Call add_setshow_zuinteger_cmd instead of add_setshow_zinteger_cmd. * xtensa-tdep.c (xtensa_debug_level): Add 'unsigned'. (_initialize_xtensa_tdep): Call add_setshow_zuinteger_cmd instead of add_setshow_zinteger_cmd. * arch-utils.h: Remove the declaration of 'gdbarch_debug'. * gdbarch.sh (gdbarch_debug): Add 'unsigned'. (extern void _initialize_gdbarch): Call add_setshow_zuinteger_cmd instead of add_setshow_zinteger_cmd. * gdbarch.c, gdbarch.h: Re-generated.
* 2012-07-20 Pedro Alves <palves@redhat.com>Pedro Alves2012-07-201-4/+2
| | | | | | | | | | | | | | | | | | | | | | | PR threads/11692 PR gdb/12203 gdb/ * infrun.c (handle_inferior_event) <new thread>: Don't special case minus_one_ptid. <TARGET_WAITKIND_SPURIOUS>: Ditto. * linux-thread-db.c (thread_get_info_callback): Don't return early if the thread is zombie. (thread_from_lwp): Change return type to void. Rewrite stale comment. (attach_thread): Don't return early if the thread is zombie, instead set its "dying" flag. (thread_db_wait): Don't return TARGET_WAITKIND_SPURIOUS anymore. (find_new_threads_callback): Don't return early if the thread is zombie. gdb/testsuite/ * gdb.threads/create-fail.c: New file. * gdb.threads/create-fail.exp: New file.
* 2012-07-18 Pedro Alves <palves@redhat.com>Pedro Alves2012-07-181-0/+9
| | | | | * infrun.c (handle_inferior_event) <TARGET_WAITKIND_NO_HISTORY>: Pull the single step breakpoints out of the target.
* 2012-07-18 Sergio Durigan Junior <sergiodj@redhat.com>sergiodj2012-07-181-6/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * elfread.c (elf_get_probe_argument_count): Remove `objfile' argument. (elf_compile_to_ax): Likewise. * infrun.c (insert_exception_resume_from_probe): Likewise. (check_exception_resume): Remove `objfile' variable. * probe.c (find_probe_by_pc): Remove `objfile' argument. (struct probe_and_objfile, probe_and_objfile_s): Delete. (collect_probes): Adjust return value to `VEC (probe_p) *'. (compare_entries): Rename to... (compare_probes): ...this. Adjust function to work with `struct probe *'. Rename variables `ea' and `eb' to `pa' and `pb' respectively. (gen_ui_out_table_header_info): Adjust `probes' argument to be `VEC (probe_p) *'. (print_ui_out_info): Adjust argument to be `struct probe *'. (info_probes_for_ops): Adjust internal computations to use `VEC (probe_p) *'. (probe_safe_evaluate_at_pc): Refactor to not pass `objfile' anymore. * probe.h (struct probe_ops) <get_probe_argument_count, compile_to_ax, gen_info_probes_table_values>: Remove `objfile' argument. (struct probe) <objfile>: New field. (find_probe_by_pc): Remove `objfile' argument. * stap-probe.c (stap_parse_probe_arguments): Likewise. (stap_get_probe_argument_count): Likewise. (stap_get_arg): Likewise. (stap_evaluate_probe_argument): Likewise. (stap_compile_to_ax): Likewise. (compile_probe_arg): Refactor not to pass `objfile' anymore. (handle_stap_probe): Fill `objfile' field from `struct probe'. (stap_gen_info_probes_table_header): Remove `objfile' argument. * symfile.h (struct sym_probe_fns) <sym_evaluate_probe_argument, sym_compile_to_ax>: Likewise.
* gdb:qiyao2012-07-011-25/+9
| | | | | | | | | | | | | | | | | * breakpoint.c: Removed always_inserted_auto, always_inserted_on, always_inserted_off, and always_inserted_enums. Change always_inserted_mode's type to 'enum auto_boolean'. (show_always_inserted_mode, breakpoint_always_inserted_mode): Update callers. (_initialize_breakpoint): Call add_setshow_auto_boolean_cmd instead of add_setshow_enum_cmd. * infrun.c: Remove can_use_displaced_stepping_auto, can_use_displaced_stepping_on, can_use_displaced_stepping_off, and can_use_displaced_stepping_enum. Change can_use_displaced_stepping's type to 'enum auto_boolean'. (show_can_use_displaced_stepping, use_displaced_stepping): Update callers. (_initialize_infrun): Call add_setshow_auto_boolean_cmd instead of add_setshow_enum_cmd.
* gdb/Pedro Alves2012-06-281-186/+186
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2012-06-28 Jan Kratochvil <jan.kratochvil@redhat.com> Pedro Alves <palves@redhat.com> * gdbthread.h (ALL_THREADS): New macro. (thread_list): Declare. * infrun.c (handle_inferior_event) <spurious signal>: Don't keep going, but instead fall through to the stepping handling. * linux-nat.c (resume_lwp): New parameter 'signo'. Resume with the passed in signal. Adjust debug output. (resume_callback): Rename to ... (linux_nat_resume_callback): ... this. Pass the thread's last stop signal, if in "pass" state. (linux_nat_resume): Adjust to rename. (stop_wait_callback): New assertion. Don't respawn signals; instead let the LWP remain with SIGNALLED set. (linux_nat_wait_1): Remove flushing of pending SIGSTOPs. * remote.c (append_pending_thread_resumptions): New. (remote_vcont_resume): Call it. * target.h (target_resume): Extend comment. gdb/testsuite/ 2012-06-28 Jan Kratochvil <jan.kratochvil@redhat.com> Pedro Alves <palves@redhat.com> * gdb.threads/siginfo-threads.exp: New file. * gdb.threads/siginfo-threads.c: New file. * gdb.threads/sigstep-threads.exp: New file. * gdb.threads/sigstep-threads.c: New file.
* gdb/Jan Kratochvil2012-06-181-3/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove stale dummy frames. * breakpoint.c: Include dummy-frame.h. (longjmp_breakpoint_ops): New variable. (update_breakpoints_after_exec, breakpoint_init_inferior): Delete also bp_longjmp_call_dummy. (bpstat_what, bptype_string, print_one_breakpoint_location) (init_bp_location): Support bp_longjmp_call_dummy. (set_longjmp_breakpoint): Use longjmp_breakpoint_ops. Comment why. (set_longjmp_breakpoint_for_call_dummy) (check_longjmp_breakpoint_for_call_dummy, longjmp_bkpt_dtor): New functions. (initialize_breakpoint_ops): Initialize longjmp_breakpoint_ops. * breakpoint.h (enum bptype): New item bp_longjmp_call_dummy. Delete FIXME comment and extend the other comment for bp_call_dummy. (set_longjmp_breakpoint_for_call_dummy) (check_longjmp_breakpoint_for_call_dummy): New declarations. * dummy-frame.c: Include gdbthread.h. (pop_dummy_frame_bpt): New function. (pop_dummy_frame): Call pop_dummy_frame_bpt. (dummy_frame_discard): New function. (cleanup_dummy_frames): Update the comment about longjmps. * dummy-frame.h (dummy_frame_discard): New declaration. * gdbthread.h (struct thread_info): Extend initiating_frame comment. * infcall.c (call_function_by_hand): New variable longjmp_b. Call set_longjmp_breakpoint_for_call_dummy. Chain its breakpoints with BPT. * infrun.c (handle_inferior_event) <BPSTAT_WHAT_CLEAR_LONGJMP_RESUME>: Add case 4 comment. Call check_longjmp_breakpoint_for_call_dummy and keep_going if IS_LONGJMP and there is no other reason to stop. gdb/testsuite/ Remove stale dummy frames. * gdb.base/call-signal-resume.exp (maintenance print dummy-frames) (maintenance info breakpoints): New tests. * gdb.base/stale-infcall.c: New file. * gdb.base/stale-infcall.exp: New file.
* * infrun.c (handle_inferior_event): Correct indentation.Maciej W. Rozycki2012-06-151-4/+4
|