#include "gdbthread.h"
#include "valprint.h"
#include "inline-frame.h"
-
-extern void disconnect_or_stop_tracing (int from_tty);
+#include "tracepoint.h"
/* Functions exported for general use, in inferior.h: */
/* Nonzero if stopped due to completion of a stack dummy routine. */
-int stop_stack_dummy;
+enum stop_stack_kind stop_stack_dummy;
/* Nonzero if stopped due to a random (unexpected) signal in inferior
process. */
/* Note that we ignore the passed-in value in favor of computing it
directly. */
const char *inferior_io_terminal = get_inferior_io_terminal ();
+
if (inferior_io_terminal == NULL)
inferior_io_terminal = "";
fprintf_filtered (gdb_stdout,
has done its thing; now we are setting up the running program. */
post_create_inferior (¤t_target, 0);
- /* Start the target running. */
- proceed ((CORE_ADDR) -1, TARGET_SIGNAL_0, 0);
+ /* Start the target running. Do not use -1 continuation as it would skip
+ breakpoint right at the entry point. */
+ proceed (regcache_read_pc (get_current_regcache ()), TARGET_SIGNAL_0, 0);
/* Since there was no error, there's no need to finish the thread
states here. */
Cannot execute this command without a live selected thread."));
}
+/* If the user is looking at trace frames, any resumption of execution
+ is likely to mix up recorded and live target data. So simply
+ disallow those commands. */
+
+void
+ensure_not_tfind_mode (void)
+{
+ if (get_traceframe_number () >= 0)
+ error (_("\
+Cannot execute this command while looking at trace frames."));
+}
+
void
continue_1 (int all_threads)
{
ERROR_NO_INFERIOR;
+ ensure_not_tfind_mode ();
if (non_stop && all_threads)
{
/* Don't error out if the current thread is running, because
- there may be other stopped threads. */
+ there may be other stopped threads. */
struct cleanup *old_chain;
/* Backup current thread and selected frame. */
step_1 (int skip_subroutines, int single_inst, char *count_string)
{
int count = 1;
- struct frame_info *frame;
struct cleanup *cleanups = make_cleanup (null_cleanup, NULL);
int async_exec = 0;
int thread = -1;
ERROR_NO_INFERIOR;
+ ensure_not_tfind_mode ();
ensure_valid_thread ();
ensure_not_running ();
for (; count > 0; count--)
{
struct thread_info *tp;
+
step_once (skip_subroutines, single_inst, count, thread);
if (target_has_execution
INFERIOR_PTID thread instead, which is the same thread when
THREAD is set. */
struct thread_info *tp = inferior_thread ();
+
clear_proceed_status ();
set_step_frame ();
else if (tp->step_range_end == 0)
{
char *name;
+
if (find_pc_partial_function (pc, &name,
&tp->step_range_start,
&tp->step_range_end) == 0)
target_terminal_ours ();
printf_filtered (_("\
-Single stepping until exit from function %s, \n\
+Single stepping until exit from function %s,\n\
which has no line number information.\n"), name);
}
}
int async_exec = 0;
ERROR_NO_INFERIOR;
+ ensure_not_tfind_mode ();
ensure_valid_thread ();
ensure_not_running ();
dont_repeat (); /* Too dangerous. */
ERROR_NO_INFERIOR;
+ ensure_not_tfind_mode ();
ensure_valid_thread ();
ensure_not_running ();
{
int async_exec = 0;
- if (!target_has_execution)
- error (_("The program is not running."));
+ ERROR_NO_INFERIOR;
+ ensure_not_tfind_mode ();
+ ensure_valid_thread ();
+ ensure_not_running ();
/* Find out whether we must run in the background. */
if (arg != NULL)
{
int async_exec = 0;
- if (!target_has_execution)
- error (_("The program is not running."));
+ ERROR_NO_INFERIOR;
+ ensure_not_tfind_mode ();
+ ensure_valid_thread ();
+ ensure_not_running ();
if (arg == NULL)
error_no_arg (_("a location"));
_("finish_command: function has no target type"));
if (TYPE_CODE (value_type) != TYPE_CODE_VOID)
- print_return_value (SYMBOL_TYPE (a->function), value_type);
+ {
+ volatile struct gdb_exception ex;
+
+ TRY_CATCH (ex, RETURN_MASK_ALL)
+ {
+ /* print_return_value can throw an exception in some
+ circumstances. We need to catch this so that we still
+ delete the breakpoint. */
+ print_return_value (SYMBOL_TYPE (a->function), value_type);
+ }
+ if (ex.reason < 0)
+ exception_print (gdb_stdout, ex);
+ }
}
/* We suppress normal call of normal_stop observer and do it here so
int async_exec = 0;
+ ERROR_NO_INFERIOR;
+ ensure_not_tfind_mode ();
+ ensure_valid_thread ();
+ ensure_not_running ();
+
/* Find out whether we must run in the background. */
if (arg != NULL)
async_exec = strip_bg_char (&arg);
if (arg)
error (_("The \"finish\" command does not take any arguments."));
- if (!target_has_execution)
- error (_("The program is not running."));
frame = get_prev_frame (get_selected_frame (_("No selected frame.")));
if (frame == 0)
and not step over the rest of this inlined function call. */
struct thread_info *tp = inferior_thread ();
struct symtab_and_line empty_sal;
+
init_sal (&empty_sal);
set_step_info (frame, empty_sal);
tp->step_range_start = tp->step_range_end = get_frame_pc (frame);
else
{
struct target_waitstatus ws;
+
get_last_target_status (&ptid, &ws);
}
if (var)
{
char *val = get_in_environ (current_inferior ()->environment, var);
+
if (val)
{
puts_filtered (var);
else
{
char **vector = environ_vector (current_inferior ()->environment);
+
while (*vector)
{
puts_filtered (*vector++);
{
char *exec_path;
char *env;
+
dont_repeat ();
env = get_in_environ (current_inferior ()->environment, path_var_name);
/* Can be null if path is not set */
get_user_print_options (&opts);
opts.deref_ref = 1;
val_print (register_type (gdbarch, i), buffer, 0, 0,
- file, 0, &opts, current_language);
+ file, 0, NULL, &opts, current_language);
fprintf_filtered (file, "\t(raw 0x");
for (j = 0; j < register_size (gdbarch, i); j++)
{
int idx;
+
if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
idx = j;
else
get_formatted_print_options (&opts, 'x');
opts.deref_ref = 1;
val_print (register_type (gdbarch, i), buffer, 0, 0,
- file, 0, &opts,
- current_language);
+ file, 0, NULL, &opts, current_language);
/* If not a vector register, print it also according to its
natural format. */
if (TYPE_VECTOR (register_type (gdbarch, i)) == 0)
opts.deref_ref = 1;
fprintf_filtered (file, "\t");
val_print (register_type (gdbarch, i), buffer, 0, 0,
- file, 0, &opts, current_language);
+ file, 0, NULL, &opts, current_language);
}
}
{
struct frame_info *frame;
struct gdbarch *gdbarch;
- int regnum, numregs;
- char *end;
if (!target_has_registers)
error (_("The program has no registers now."));
/* A register name? */
{
int regnum = user_reg_map_name_to_regnum (gdbarch, start, end - start);
+
if (regnum >= 0)
{
/* User registers lie completely outside of the range of
/* A register group? */
{
struct reggroup *group;
+
for (group = reggroup_next (gdbarch, NULL);
group != NULL;
group = reggroup_next (gdbarch, group))
if (group != NULL)
{
int regnum;
+
for (regnum = 0;
regnum < gdbarch_num_regs (gdbarch)
+ gdbarch_num_pseudo_regs (gdbarch);
attach_command_continuation (void *args)
{
struct attach_command_continuation_args *a = args;
+
attach_command_post_wait (a->args, a->from_tty, a->async_exec);
}
attach_command_continuation_free_args (void *args)
{
struct attach_command_continuation_args *a = args;
+
xfree (a->args);
xfree (a);
}
void
attach_command (char *args, int from_tty)
{
- char *exec_file;
- char *full_exec_path = NULL;
int async_exec = 0;
struct cleanup *back_to = make_cleanup (null_cleanup, NULL);
if (ptid_equal (inferior_ptid, null_ptid))
error (_("The program is not being run."));
- disconnect_or_stop_tracing (from_tty);
+ disconnect_tracing (from_tty);
target_detach (args, from_tty);
interrupt_target_1 (int all_threads)
{
ptid_t ptid;
+
if (all_threads)
ptid = minus_one_ptid;
else