void nullify_last_target_wait_ptid (void);
+static void insert_step_resume_breakpoint_at_frame (struct frame_info *);
+
+static void insert_step_resume_breakpoint_at_caller (struct frame_info *);
+
+static void insert_step_resume_breakpoint_at_sal (struct gdbarch *,
+ struct symtab_and_line ,
+ struct frame_id);
+
+static void insert_longjmp_resume_breakpoint (struct gdbarch *, CORE_ADDR);
+
/* When set, stop the 'step' command if we enter a function which has
no line number information. The normal behavior is that we step
over such function. */
fprintf_filtered (file, _("Mode of the step operation is %s.\n"), value);
}
-/* In asynchronous mode, but simulating synchronous execution. */
+/* In asynchronous mode, but simulating synchronous execution. */
int sync_execution = 0;
static unsigned char *signal_print;
static unsigned char *signal_program;
+/* Table of signals that the target may silently handle.
+ This is automatically determined from the flags above,
+ and simply cached here. */
+static unsigned char *signal_pass;
+
#define SET_SIGS(nsigs,sigs,flags) \
do { \
int signum = (nsigs); \
(flags)[signum] = 0; \
} while (0)
-/* Value to pass to target_resume() to cause all threads to resume */
+/* Value to pass to target_resume() to cause all threads to resume. */
#define RESUME_ALL minus_one_ptid
over from WAIT_PID" logic above. */
nullify_last_target_wait_ptid ();
- /* If we followed the child, switch to it... */
+ /* If we followed the child, switch to it... */
if (follow_child)
{
switch_to_thread (child);
struct program_space *pspace;
struct address_space *aspace;
- /* follow-fork child, detach-on-fork on */
+ /* follow-fork child, detach-on-fork on. */
old_chain = make_cleanup_restore_current_thread ();
inf->aspace = pspace->aspace;
/* Put back inferior_ptid. We'll continue mourning this
- inferior. */
+ inferior. */
do_cleanups (old_chain);
resume_parent = inf->vfork_parent->pid;
fprintf_filtered (file, _("Follow exec mode is \"%s\".\n"), value);
}
-/* EXECD_PATHNAME is assumed to be non-NULL. */
+/* EXECD_PATHNAME is assumed to be non-NULL. */
static void
follow_exec (ptid_t pid, char *execd_pathname)
And, we DON'T want to call delete_breakpoints() here, since
that may write the bp's "shadow contents" (the instruction
value that was overwritten witha TRAP instruction). Since
- we now have a new a.out, those shadow contents aren't valid. */
+ we now have a new a.out, those shadow contents aren't valid. */
mark_breakpoints_out ();
update_breakpoints_after_exec ();
/* If there was one, it's gone now. We cannot truly step-to-next
- statement through an exec(). */
+ statement through an exec(). */
th->control.step_resume_breakpoint = NULL;
th->control.exception_resume_breakpoint = NULL;
th->control.step_range_start = 0;
with scheduler-locking on in all-stop mode. */
th->stop_requested = 0;
- /* What is this a.out's name? */
+ /* What is this a.out's name? */
printf_unfiltered (_("%s is executing new program: %s\n"),
target_pid_to_str (inferior_ptid),
execd_pathname);
/* We've followed the inferior through an exec. Therefore, the
- inferior has essentially been killed & reborn. */
+ inferior has essentially been killed & reborn. */
gdb_flush (gdb_stdout);
gdb_assert (current_program_space == inf->pspace);
- /* That a.out is now the one to use. */
+ /* That a.out is now the one to use. */
exec_file_attach (execd_pathname, 0);
/* SYMFILE_DEFER_BP_RESET is used as the proper displacement for PIE
/* Reinsert all breakpoints. (Those which were symbolic have
been reset to the proper address in the new a.out, thanks
- to symbol_file_command...) */
+ to symbol_file_command...). */
insert_breakpoints ();
/* The next resume of this inferior should bring it to the shlib
startup breakpoints. (If the user had also set bp's on
"main" from the old (parent) process, then they'll auto-
- matically get reset there in the new process.) */
+ matically get reset there in the new process.). */
}
/* Non-zero if we just simulating a single-step. This is needed
is finished, we need to switch to deferred_step_ptid, and step it.
The use case is when one thread has hit a breakpoint, and then the user
- has switched to another thread and issued 'step'. We need to step over
+ has switched to another thread and issued 'step'. We need to step over
breakpoint in the thread which hit the breakpoint, but then continue
stepping the thread user has selected. */
static ptid_t deferred_step_ptid;
return state;
}
+/* If inferior is in displaced stepping, and ADDR equals to starting address
+ of copy area, return corresponding displaced_step_closure. Otherwise,
+ return NULL. */
+
+struct displaced_step_closure*
+get_displaced_step_closure_by_addr (CORE_ADDR addr)
+{
+ struct displaced_step_inferior_state *displaced
+ = get_displaced_stepping_state (ptid_get_pid (inferior_ptid));
+
+ /* If checking the mode of displaced instruction in copy area. */
+ if (displaced && !ptid_equal (displaced->step_ptid, null_ptid)
+ && (displaced->step_copy == addr))
+ return displaced->step_closure;
+
+ return NULL;
+}
+
/* Remove the displaced stepping state of process PID. */
static void
{
hw_step = 0;
/* Do not pull these breakpoints until after a `wait' in
- `wait_for_inferior' */
+ `wait_for_inferior'. */
singlestep_breakpoints_inserted_p = 1;
singlestep_ptid = inferior_ptid;
singlestep_pc = pc;
if (gdbarch_skip_permanent_breakpoint_p (gdbarch))
gdbarch_skip_permanent_breakpoint (gdbarch, regcache);
else
- error (_("The program is stopped at a permanent "
- "breakpoint, but GDB does not know\n"
- "how to step past a permanent breakpoint "
- "on this architecture. Try using\na command "
- "like `return' or `jump' to continue execution."));
+ error (_("\
+The program is stopped at a permanent breakpoint, but GDB does not know\n\
+how to step past a permanent breakpoint on this architecture. Try using\n\
+a command like `return' or `jump' to continue execution."));
}
/* If enabled, step over breakpoints by executing a copy of the
else if (step)
step = maybe_software_singlestep (gdbarch, pc);
+ /* Currently, our software single-step implementation leads to different
+ results than hardware single-stepping in one situation: when stepping
+ into delivering a signal which has an associated signal handler,
+ hardware single-step will stop at the first instruction of the handler,
+ while software single-step will simply skip execution of the handler.
+
+ For now, this difference in behavior is accepted since there is no
+ easy way to actually implement single-stepping into a signal handler
+ without kernel support.
+
+ However, there is one scenario where this difference leads to follow-on
+ problems: if we're stepping off a breakpoint by removing all breakpoints
+ and then single-stepping. In this case, the software single-step
+ behavior means that even if there is a *breakpoint* in the signal
+ handler, GDB still would not stop.
+
+ Fortunately, we can at least fix this particular issue. We detect
+ here the case where we are about to deliver a signal while software
+ single-stepping with breakpoints removed. In this situation, we
+ revert the decisions to remove all breakpoints and insert single-
+ step breakpoints, and instead we install a step-resume breakpoint
+ at the current address, deliver the signal without stepping, and
+ once we arrive back at the step-resume breakpoint, actually step
+ over the breakpoint we originally wanted to step over. */
+ if (singlestep_breakpoints_inserted_p
+ && tp->control.trap_expected && sig != TARGET_SIGNAL_0)
+ {
+ /* If we have nested signals or a pending signal is delivered
+ immediately after a handler returns, might might already have
+ a step-resume breakpoint set on the earlier handler. We cannot
+ set another step-resume breakpoint; just continue on until the
+ original breakpoint is hit. */
+ if (tp->control.step_resume_breakpoint == NULL)
+ {
+ insert_step_resume_breakpoint_at_frame (get_current_frame ());
+ tp->step_after_step_resume_breakpoint = 1;
+ }
+
+ remove_single_step_breakpoints ();
+ singlestep_breakpoints_inserted_p = 0;
+
+ insert_breakpoints ();
+ tp->control.trap_expected = 0;
+ }
+
if (should_resume)
{
ptid_t resume_ptid;
|| (scheduler_mode == schedlock_step
&& (step || singlestep_breakpoints_inserted_p)))
{
- /* User-settable 'scheduler' mode requires solo thread resume. */
+ /* User-settable 'scheduler' mode requires solo thread resume. */
resume_ptid = inferior_ptid;
}
happens to apply to another thread. */
tp->suspend.stop_signal = TARGET_SIGNAL_0;
+ /* Advise target which signals may be handled silently. If we have
+ removed breakpoints because we are stepping over one (which can
+ happen only if we are not using displaced stepping), we need to
+ receive all signals to avoid accidentally skipping a breakpoint
+ during execution of a signal handler. */
+ if ((step || singlestep_breakpoints_inserted_p)
+ && tp->control.trap_expected
+ && !use_displaced_stepping (gdbarch))
+ target_pass_signals (0, NULL);
+ else
+ target_pass_signals ((int) TARGET_SIGNAL_LAST, signal_pass);
+
target_resume (resume_ptid, step, sig);
}
event. If a step-over is required return TRUE and set the current thread
to the old thread. Otherwise return FALSE.
- This should be suitable for any targets that support threads. */
+ This should be suitable for any targets that support threads. */
static int
prepare_to_proceed (int step)
/* We return 1 to indicate that there is a breakpoint here,
so we need to step over it before continuing to avoid
- hitting it straight away. */
+ hitting it straight away. */
return 1;
}
}
"infrun: proceed (addr=%s, signal=%d, step=%d)\n",
paddress (gdbarch, addr), siggnal, step);
- /* We're handling a live event, so make sure we're doing live
- debugging. If we're looking at traceframes while the target is
- running, we're going to need to get back to that mode after
- handling the event. */
- if (non_stop)
- {
- make_cleanup_restore_current_traceframe ();
- set_traceframe_number (-1);
- }
-
if (non_stop)
/* In non-stop, each thread is handled individually. The context
must already be set to the right thread here. */
prepare_to_proceed checks the current thread against the
thread that reported the most recent event. If a step-over
is required it returns TRUE and sets the current thread to
- the old thread. */
+ the old thread. */
if (prepare_to_proceed (step))
oneproc = 1;
}
/* Wait for it to stop (if not standalone)
and in any case decode why it stopped, and act accordingly. */
/* Do this only if we are not using the event loop, or if the target
- does not support asynchronous execution. */
+ does not support asynchronous execution. */
if (!target_can_async_p ())
{
- wait_for_inferior (0);
+ wait_for_inferior ();
normal_stop ();
}
}
inferior = current_inferior ();
inferior->control.stop_soon = STOP_QUIETLY_REMOTE;
- /* Always go on waiting for the target, regardless of the mode. */
+ /* Always go on waiting for the target, regardless of the mode. */
/* FIXME: cagney/1999-09-23: At present it isn't possible to
indicate to wait_for_inferior that a target should timeout if
nothing is returned (instead of just blocking). Because of this,
targets expecting an immediate response need to, internally, set
things up so that the target_wait() is forced to eventually
- timeout. */
+ timeout. */
/* FIXME: cagney/1999-09-24: It isn't possible for target_open() to
differentiate to its caller what the state of the target is after
the initial open has been performed. Here we're assuming that
the target has stopped. It should be possible to eventually have
target_open() return to the caller an indication that the target
is currently running and GDB state should be set to the same as
- for an async run. */
- wait_for_inferior (0);
+ for an async run. */
+ wait_for_inferior ();
/* Now that the inferior has stopped, do any bookkeeping like
loading shared libraries. We want to do this before normal_stop,
struct execution_control_state *ecs);
static void handle_step_into_function_backward (struct gdbarch *gdbarch,
struct execution_control_state *ecs);
-static void insert_step_resume_breakpoint_at_frame (struct frame_info *);
-static void insert_step_resume_breakpoint_at_caller (struct frame_info *);
-static void insert_step_resume_breakpoint_at_sal (struct gdbarch *,
- struct symtab_and_line ,
- struct frame_id);
-static void insert_longjmp_resume_breakpoint (struct gdbarch *, CORE_ADDR);
static void check_exception_resume (struct execution_control_state *,
struct frame_info *, struct symbol *);
iterate_over_threads (delete_step_resume_breakpoint_callback, NULL);
}
-/* A cleanup wrapper. */
+/* A cleanup wrapper. */
static void
delete_step_thread_step_resume_breakpoint_cleanup (void *arg)
target_wait because they can be loaded from the target while
in target_wait. This makes remote debugging a bit more
efficient for those targets that provide critical registers
- as part of their normal status mechanism. */
+ as part of their normal status mechanism. */
registers_changed ();
/* Wait for control to return from inferior to debugger.
- If TREAT_EXEC_AS_SIGTRAP is non-zero, then handle EXEC signals
- as if they were SIGTRAP signals. This can be useful during
- the startup sequence on some targets such as HP/UX, where
- we receive an EXEC event instead of the expected SIGTRAP.
-
If inferior gets a signal, we may decide to start it up again
instead of returning. That is why there is a loop in this function.
When this function actually returns it means the inferior
should be left stopped and GDB should read more commands. */
void
-wait_for_inferior (int treat_exec_as_sigtrap)
+wait_for_inferior (void)
{
struct cleanup *old_cleanups;
struct execution_control_state ecss;
if (debug_infrun)
fprintf_unfiltered
- (gdb_stdlog, "infrun: wait_for_inferior (treat_exec_as_sigtrap=%d)\n",
- treat_exec_as_sigtrap);
+ (gdb_stdlog, "infrun: wait_for_inferior ()\n");
old_cleanups =
make_cleanup (delete_step_thread_step_resume_breakpoint_cleanup, NULL);
because they can be loaded from the target while in target_wait.
This makes remote debugging a bit more efficient for those
targets that provide critical registers as part of their normal
- status mechanism. */
+ status mechanism. */
overlay_cache_invalid = 1;
registers_changed ();
if (debug_infrun)
print_target_wait_results (waiton_ptid, ecs->ptid, &ecs->ws);
- if (treat_exec_as_sigtrap && ecs->ws.kind == TARGET_WAITKIND_EXECD)
- {
- xfree (ecs->ws.value.execd_pathname);
- ecs->ws.kind = TARGET_WAITKIND_STOPPED;
- ecs->ws.value.sig = TARGET_SIGNAL_TRAP;
- }
-
/* If an error happens while handling the event, propagate GDB's
knowledge of the executing state to the frontend/user running
state. */
do_cleanups (old_cleanups);
}
-/* Asynchronous version of wait_for_inferior. It is called by the
+/* Asynchronous version of wait_for_inferior. It is called by the
event loop whenever a change of state is detected on the file
- descriptor corresponding to the target. It can be called more than
- once to complete a single execution command. In such cases we need
- to keep the state in a global variable ECSS. If it is the last time
+ descriptor corresponding to the target. It can be called more than
+ once to complete a single execution command. In such cases we need
+ to keep the state in a global variable ECSS. If it is the last time
that this function is called for a single execution command, then
report to the user that the inferior has stopped, and do the
- necessary cleanups. */
+ necessary cleanups. */
void
fetch_inferior_event (void *client_data)
/* We'll update this if & when we switch to a new thread. */
previous_inferior_ptid = inferior_ptid;
+ /* We're handling a live event, so make sure we're doing live
+ debugging. If we're looking at traceframes while the target is
+ running, we're going to need to get back to that mode after
+ handling the event. */
+ if (non_stop)
+ {
+ make_cleanup_restore_current_traceframe ();
+ set_current_traceframe (-1);
+ }
+
if (non_stop)
/* In non-stop mode, the user/frontend should not notice a thread
switch due to internal events. Make sure we reverse to the
because they can be loaded from the target while in target_wait.
This makes remote debugging a bit more efficient for those
targets that provide critical registers as part of their normal
- status mechanism. */
+ status mechanism. */
overlay_cache_invalid = 1;
registers_changed ();
else
stop_soon = NO_STOP_QUIETLY;
- /* Cache the last pid/waitstatus. */
+ /* Cache the last pid/waitstatus. */
target_last_wait_ptid = ecs->ptid;
target_last_waitstatus = ecs->ws;
/* Always clear state belonging to the previous time we stopped. */
stop_stack_dummy = STOP_NONE;
- /* If it's a new process, add it to the thread database */
+ /* If it's a new process, add it to the thread database. */
ecs->new_thread_event = (!ptid_equal (ecs->ptid, inferior_ptid)
&& !ptid_equal (ecs->ptid, minus_one_ptid)
set_current_inferior (find_inferior_pid (ptid_get_pid (ecs->ptid)));
set_current_program_space (current_inferior ()->pspace);
handle_vfork_child_exec_or_exit (0);
- target_terminal_ours (); /* Must do this before mourn anyway */
+ target_terminal_ours (); /* Must do this before mourn anyway. */
print_exited_reason (ecs->ws.value.integer);
/* Record the exit code in the convenience variable $_exitcode, so
set_current_program_space (current_inferior ()->pspace);
handle_vfork_child_exec_or_exit (0);
stop_print_frame = 0;
- target_terminal_ours (); /* Must do this before mourn anyway */
+ target_terminal_ours (); /* Must do this before mourn anyway. */
/* Note: By definition of TARGET_WAITKIND_SIGNALLED, we shouldn't
reach here unless the inferior is dead. However, for years
target_kill() was called here, which hints that fatal signals aren't
really fatal on some systems. If that's true, then some changes
- may be needed. */
+ may be needed. */
target_mourn_inferior ();
print_signal_exited_reason (ecs->ws.value.sig);
return;
/* The following are the only cases in which we keep going;
- the above cases end in a continue or goto. */
+ the above cases end in a continue or goto. */
case TARGET_WAITKIND_FORKED:
case TARGET_WAITKIND_VFORKED:
if (debug_infrun)
if (singlestep_breakpoints_inserted_p)
{
- /* Pull the single step breakpoints out of the target. */
+ /* Pull the single step breakpoints out of the target. */
remove_single_step_breakpoints ();
singlestep_breakpoints_inserted_p = 0;
}
if (debug_infrun)
fprintf_unfiltered (gdb_stdlog,
"infrun: TARGET_WAITKIND_SYSCALL_ENTRY\n");
- /* Getting the current syscall number */
+ /* Getting the current syscall number. */
if (handle_syscall_event (ecs) != 0)
return;
goto process_event_stop_test;
get_regcache_aspace (get_thread_regcache (ecs->ptid));
/* Check if a regular breakpoint has been hit before checking
- for a potential single step breakpoint. Otherwise, GDB will
+ for a potential single step breakpoint. Otherwise, GDB will
not see this breakpoint hit when stepping onto breakpoints. */
if (regular_breakpoint_inserted_here_p (aspace, stop_pc))
{
context_switch (ecs->ptid);
/* Saw a breakpoint, but it was hit by the wrong thread.
- Just continue. */
+ Just continue. */
if (singlestep_breakpoints_inserted_p)
{
- /* Pull the single step breakpoints out of the target. */
+ /* Pull the single step breakpoints out of the target. */
remove_single_step_breakpoints ();
singlestep_breakpoints_inserted_p = 0;
}
the bp's: On HP-UX's that use ttrace, we can't
change the address space of a vforking child
process until the child exits (well, okay, not
- then either :-) or execs. */
+ then either :-) or execs. */
if (remove_status != 0)
error (_("Cannot step over breakpoint hit in wrong thread"));
else
if (singlestep_breakpoints_inserted_p)
{
- /* Pull the single step breakpoints out of the target. */
+ /* Pull the single step breakpoints out of the target. */
remove_single_step_breakpoints ();
singlestep_breakpoints_inserted_p = 0;
}
int hw_step = 1;
if (!target_have_steppable_watchpoint)
- remove_breakpoints ();
+ {
+ remove_breakpoints ();
+ /* See comment in resume why we need to stop bypassing signals
+ while breakpoints have been removed. */
+ target_pass_signals (0, NULL);
+ }
/* Single step */
hw_step = maybe_software_singlestep (gdbarch, stop_pc);
target_resume (ecs->ptid, hw_step, TARGET_SIGNAL_0);
{
/* We're trying to step off a breakpoint. Turns out that we're
also on an instruction that needs to be stepped multiple
- times before it's been fully executing. E.g., architectures
+ times before it's been fully executing. E.g., architectures
with a delay slot. It needs to be stepped twice, once for
the instruction and once for the delay slot. */
int step_through_delay
/* When we reach this point, we've pretty much decided
that the reason for stopping must've been a random
- (unexpected) signal. */
+ (unexpected) signal. */
else
ecs->random_signal = 1;
insert_step_resume_breakpoint_at_frame (frame);
ecs->event_thread->step_after_step_resume_breakpoint = 1;
+ /* Reset trap_expected to ensure breakpoints are re-inserted. */
+ ecs->event_thread->control.trap_expected = 0;
keep_going (ecs);
return;
}
"single-step range\n");
insert_step_resume_breakpoint_at_frame (frame);
+ /* Reset trap_expected to ensure breakpoints are re-inserted. */
+ ecs->event_thread->control.trap_expected = 0;
keep_going (ecs);
return;
}
if (ecs->event_thread->stepping_through_solib_after_catch)
{
#if defined(SOLIB_ADD)
- /* Have we reached our destination? If not, keep going. */
+ /* Have we reached our destination? If not, keep going. */
if (SOLIB_IN_DYNAMIC_LINKER (PIDGET (ecs->ptid), stop_pc))
{
if (debug_infrun)
if (debug_infrun)
fprintf_unfiltered (gdb_stdlog, "infrun: step past dynamic linker\n");
/* Else, stop and report the catchpoint(s) whose triggering
- caused us to begin stepping. */
+ caused us to begin stepping. */
ecs->event_thread->stepping_through_solib_after_catch = 0;
bpstat_clear (&ecs->event_thread->control.stop_bpstat);
ecs->event_thread->control.stop_bpstat
struct symtab_and_line tmp_sal;
tmp_sal = find_pc_line (ecs->stop_func_start, 0);
- tmp_sal.pspace = get_frame_program_space (frame);
if (tmp_sal.line != 0)
{
if (execution_direction == EXEC_REVERSE)
/* Only proceed through if we know where it's going. */
if (real_stop_pc)
{
- /* And put the step-breakpoint there and go until there. */
+ /* And put the step-breakpoint there and go until there. */
struct symtab_and_line sr_sal;
init_sal (&sr_sal); /* initialize to zeroes */
/* This function handles various cases where we need to continue
waiting for the inferior. */
-/* (Used to be the keep_going: label in the old wait_for_inferior) */
+/* (Used to be the keep_going: label in the old wait_for_inferior). */
static void
keep_going (struct execution_control_state *ecs)
halts the simulation handing control to GDB; GDB, noteing
that the break-point isn't valid, returns control back to the
simulator; the simulator then delivers the hardware
- equivalent of a SIGNAL_TRAP to the program being debugged. */
+ equivalent of a SIGNAL_TRAP to the program being debugged. */
if (ecs->event_thread->suspend.stop_signal == TARGET_SIGNAL_TRAP
&& !signal_program[ecs->event_thread->suspend.stop_signal])
static void
print_exited_reason (int exitstatus)
{
+ struct inferior *inf = current_inferior ();
+ const char *pidstr = target_pid_to_str (pid_to_ptid (inf->pid));
+
annotate_exited (exitstatus);
if (exitstatus)
{
if (ui_out_is_mi_like_p (uiout))
ui_out_field_string (uiout, "reason",
async_reason_lookup (EXEC_ASYNC_EXITED));
- ui_out_text (uiout, "\nProgram exited with code ");
+ ui_out_text (uiout, "[Inferior ");
+ ui_out_text (uiout, plongest (inf->num));
+ ui_out_text (uiout, " (");
+ ui_out_text (uiout, pidstr);
+ ui_out_text (uiout, ") exited with code ");
ui_out_field_fmt (uiout, "exit-code", "0%o", (unsigned int) exitstatus);
- ui_out_text (uiout, ".\n");
+ ui_out_text (uiout, "]\n");
}
else
{
if (ui_out_is_mi_like_p (uiout))
ui_out_field_string
(uiout, "reason", async_reason_lookup (EXEC_ASYNC_EXITED_NORMALLY));
- ui_out_text (uiout, "\nProgram exited normally.\n");
+ ui_out_text (uiout, "[Inferior ");
+ ui_out_text (uiout, plongest (inf->num));
+ ui_out_text (uiout, " (");
+ ui_out_text (uiout, pidstr);
+ ui_out_text (uiout, ") exited normally]\n");
}
/* Support the --return-child-result option. */
return_child_result_value = exitstatus;
}
/* Signal received, print why the inferior has stopped. The signal table
- tells us to print about it. */
+ tells us to print about it. */
static void
print_signal_received_reason (enum target_signal siggnal)
/* Select innermost stack frame - i.e., current frame is frame 0,
and current location is based on that.
Don't do this on return from a stack dummy routine,
- or if the program has exited. */
+ or if the program has exited. */
if (!stop_stack_dummy)
{
we have changed functions or hit a breakpoint.
Print source line if we have one.
bpstat_print() contains the logic deciding in detail
- what to print, based on the event(s) that just occurred. */
+ what to print, based on the event(s) that just occurred. */
/* If --batch-silent is enabled then there's no need to print the current
source location, and to try risks causing an error message about
&& frame_id_eq (tp->control.step_frame_id,
get_frame_id (get_current_frame ()))
&& step_start_function == find_pc_function (stop_pc))
- source_flag = SRC_LINE; /* finished step, just
- print source line */
+ source_flag = SRC_LINE; /* Finished step, just
+ print source line. */
else
- source_flag = SRC_AND_LOC; /* print location and
- source line */
+ source_flag = SRC_AND_LOC; /* Print location and
+ source line. */
break;
case PRINT_SRC_AND_LOC:
- source_flag = SRC_AND_LOC; /* print location and
- source line */
+ source_flag = SRC_AND_LOC; /* Print location and
+ source line. */
break;
case PRINT_SRC_ONLY:
source_flag = SRC_LINE;
flag is:
SRC_LINE: Print only source line
LOCATION: Print only location
- SRC_AND_LOC: Print location and source line */
+ SRC_AND_LOC: Print location and source line. */
if (do_frame_printing)
print_stack_frame (get_selected_frame (NULL), 0, source_flag);
return signal_program[signo];
}
+static void
+signal_cache_update (int signo)
+{
+ if (signo == -1)
+ {
+ for (signo = 0; signo < (int) TARGET_SIGNAL_LAST; signo++)
+ signal_cache_update (signo);
+
+ return;
+ }
+
+ signal_pass[signo] = (signal_stop[signo] == 0
+ && signal_print[signo] == 0
+ && signal_program[signo] == 1);
+}
+
int
signal_stop_update (int signo, int state)
{
int ret = signal_stop[signo];
signal_stop[signo] = state;
+ signal_cache_update (signo);
return ret;
}
int ret = signal_print[signo];
signal_print[signo] = state;
+ signal_cache_update (signo);
return ret;
}
int ret = signal_program[signo];
signal_program[signo] = state;
+ signal_cache_update (signo);
return ret;
}
error_no_arg (_("signal to handle"));
}
- /* Allocate and zero an array of flags for which signals to handle. */
+ /* Allocate and zero an array of flags for which signals to handle. */
nsigs = (int) TARGET_SIGNAL_LAST;
sigs = (unsigned char *) alloca (nsigs);
memset (sigs, 0, nsigs);
- /* Break the command line up into args. */
+ /* Break the command line up into args. */
argv = gdb_buildargv (args);
old_chain = make_cleanup_freeargv (argv);
/* Walk through the args, looking for signal oursigs, signal names, and
actions. Signal numbers and signal names may be interspersed with
actions, with the actions being performed for all signals cumulatively
- specified. Signal ranges can be specified as <LOW>-<HIGH>. */
+ specified. Signal ranges can be specified as <LOW>-<HIGH>. */
while (*argv != NULL)
{
if (wordlen >= 1 && !strncmp (*argv, "all", wordlen))
{
/* Apply action to all signals except those used by the
- debugger. Silently skip those. */
+ debugger. Silently skip those. */
allsigs = 1;
sigfirst = 0;
siglast = nsigs - 1;
}
if (sigfirst > siglast)
{
- /* Bet he didn't figure we'd think of this case... */
+ /* Bet he didn't figure we'd think of this case... */
signum = sigfirst;
sigfirst = siglast;
siglast = signum;
}
/* If any signal numbers or symbol names were found, set flags for
- which signals to apply actions to. */
+ which signals to apply actions to. */
for (signum = sigfirst; signum >= 0 && signum <= siglast; signum++)
{
for (signum = 0; signum < nsigs; signum++)
if (sigs[signum])
{
- target_notice_signals (inferior_ptid);
+ signal_cache_update (-1);
+ target_pass_signals ((int) TARGET_SIGNAL_LAST, signal_pass);
if (from_tty)
{
if (args == NULL)
error_no_arg (_("xdb command"));
- /* Break the command line up into args. */
+ /* Break the command line up into args. */
argv = gdb_buildargv (args);
old_chain = make_cleanup_freeargv (argv);
/* The $_siginfo convenience variable is a bit special. We don't know
for sure the type of the value until we actually have a chance to
- fetch the data. The type can change depending on gdbarch, so it it
+ fetch the data. The type can change depending on gdbarch, so it is
also dependent on which thread you have selected.
1. making $_siginfo be an internalvar that creates a new value on
inf_status->thread_control.exception_resume_breakpoint->disposition
= disp_del_at_next_stop;
- /* See save_infcall_control_state for info on stop_bpstat. */
+ /* See save_infcall_control_state for info on stop_bpstat. */
bpstat_clear (&inf_status->thread_control.stop_bpstat);
xfree (inf_status);
int
ptid_match (ptid_t ptid, ptid_t filter)
{
- /* Since both parameters have the same type, prevent easy mistakes
- from happening. */
- gdb_assert (!ptid_equal (ptid, minus_one_ptid)
- && !ptid_equal (ptid, null_ptid));
-
if (ptid_equal (filter, minus_one_ptid))
return 1;
if (ptid_is_pid (filter)
xmalloc (sizeof (signal_print[0]) * numsigs);
signal_program = (unsigned char *)
xmalloc (sizeof (signal_program[0]) * numsigs);
+ signal_pass = (unsigned char *)
+ xmalloc (sizeof (signal_program[0]) * numsigs);
for (i = 0; i < numsigs; i++)
{
signal_stop[i] = 1;
signal_stop[TARGET_SIGNAL_CANCEL] = 0;
signal_print[TARGET_SIGNAL_CANCEL] = 0;
+ /* Update cached state. */
+ signal_cache_update (-1);
+
add_setshow_zinteger_cmd ("stop-on-solib-events", class_support,
&stop_on_solib_events, _("\
Set stopping for shared library events."), _("\