mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-10-15 11:56:11 +08:00
* inferior.h, infrun.c, thread.c, infcmd.c: Remove all uses of
pc_changed. If it was ever set to a non-zero value, it was before GDB 2.8. It doesn't seem to have any useful function.
This commit is contained in:
@ -1,5 +1,9 @@
|
|||||||
Mon Sep 13 12:53:09 1993 Jim Kingdon (kingdon@cirdan.cygnus.com)
|
Mon Sep 13 12:53:09 1993 Jim Kingdon (kingdon@cirdan.cygnus.com)
|
||||||
|
|
||||||
|
* inferior.h, infrun.c, thread.c, infcmd.c: Remove all uses of
|
||||||
|
pc_changed. If it was ever set to a non-zero value, it was before
|
||||||
|
GDB 2.8. It doesn't seem to have any useful function.
|
||||||
|
|
||||||
* defs.h: Don't define NORETURN (see comment).
|
* defs.h: Don't define NORETURN (see comment).
|
||||||
|
|
||||||
Sat Sep 11 10:46:09 1993 Jim Kingdon (kingdon@poseidon.cygnus.com)
|
Sat Sep 11 10:46:09 1993 Jim Kingdon (kingdon@poseidon.cygnus.com)
|
||||||
|
@ -526,7 +526,7 @@ run_stack_dummy (addr, buffer)
|
|||||||
if (stack_dummy_testing & 4)
|
if (stack_dummy_testing & 4)
|
||||||
{
|
{
|
||||||
POP_FRAME;
|
POP_FRAME;
|
||||||
return;
|
return(0);
|
||||||
}
|
}
|
||||||
proceed_to_finish = 1; /* We want stop_registers, please... */
|
proceed_to_finish = 1; /* We want stop_registers, please... */
|
||||||
proceed (addr, 0, 0);
|
proceed (addr, 0, 0);
|
||||||
@ -918,7 +918,6 @@ write_pc (val)
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
pc_changed = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Cope with strage ways of getting to the stack and frame pointers */
|
/* Cope with strage ways of getting to the stack and frame pointers */
|
||||||
|
187
gdb/infrun.c
187
gdb/infrun.c
@ -232,11 +232,6 @@ int stop_after_trap;
|
|||||||
|
|
||||||
int stop_soon_quietly;
|
int stop_soon_quietly;
|
||||||
|
|
||||||
/* Nonzero if pc has been changed by the debugger
|
|
||||||
since the inferior stopped. */
|
|
||||||
|
|
||||||
int pc_changed;
|
|
||||||
|
|
||||||
/* Nonzero if proceed is being used for a "finish" command or a similar
|
/* Nonzero if proceed is being used for a "finish" command or a similar
|
||||||
situation when stop_registers should be saved. */
|
situation when stop_registers should be saved. */
|
||||||
|
|
||||||
@ -300,7 +295,7 @@ resume (step, sig)
|
|||||||
DO_DEFERRED_STORES;
|
DO_DEFERRED_STORES;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
target_resume (step, sig);
|
target_resume (inferior_pid, step, sig);
|
||||||
discard_cleanups (old_cleanups);
|
discard_cleanups (old_cleanups);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -356,7 +351,7 @@ proceed (addr, siggnal, step)
|
|||||||
step one instruction before inserting breakpoints
|
step one instruction before inserting breakpoints
|
||||||
so that we do not stop right away. */
|
so that we do not stop right away. */
|
||||||
|
|
||||||
if (!pc_changed && breakpoint_here_p (read_pc ()))
|
if (breakpoint_here_p (read_pc ()))
|
||||||
oneproc = 1;
|
oneproc = 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -470,16 +465,16 @@ wait_for_inferior ()
|
|||||||
WAITTYPE w;
|
WAITTYPE w;
|
||||||
int another_trap;
|
int another_trap;
|
||||||
int random_signal;
|
int random_signal;
|
||||||
CORE_ADDR stop_sp;
|
CORE_ADDR stop_sp = 0;
|
||||||
CORE_ADDR stop_func_start;
|
CORE_ADDR stop_func_start;
|
||||||
char *stop_func_name;
|
char *stop_func_name;
|
||||||
CORE_ADDR prologue_pc, tmp;
|
CORE_ADDR prologue_pc = 0, tmp;
|
||||||
struct symtab_and_line sal;
|
struct symtab_and_line sal;
|
||||||
int remove_breakpoints_on_following_step = 0;
|
int remove_breakpoints_on_following_step = 0;
|
||||||
int current_line;
|
int current_line;
|
||||||
int handling_longjmp = 0; /* FIXME */
|
int handling_longjmp = 0; /* FIXME */
|
||||||
struct symtab *symtab;
|
|
||||||
struct breakpoint *step_resume_breakpoint = NULL;
|
struct breakpoint *step_resume_breakpoint = NULL;
|
||||||
|
int pid;
|
||||||
|
|
||||||
old_cleanups = make_cleanup (delete_breakpoint_current_contents,
|
old_cleanups = make_cleanup (delete_breakpoint_current_contents,
|
||||||
&step_resume_breakpoint);
|
&step_resume_breakpoint);
|
||||||
@ -489,11 +484,10 @@ wait_for_inferior ()
|
|||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
/* Clean up saved state that will become invalid. */
|
/* Clean up saved state that will become invalid. */
|
||||||
pc_changed = 0;
|
|
||||||
flush_cached_frames ();
|
flush_cached_frames ();
|
||||||
registers_changed ();
|
registers_changed ();
|
||||||
|
|
||||||
target_wait (&w);
|
pid = target_wait (&w);
|
||||||
|
|
||||||
#ifdef SIGTRAP_STOP_AFTER_LOAD
|
#ifdef SIGTRAP_STOP_AFTER_LOAD
|
||||||
|
|
||||||
@ -550,6 +544,76 @@ wait_for_inferior ()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (pid != inferior_pid)
|
||||||
|
{
|
||||||
|
int printed = 0;
|
||||||
|
|
||||||
|
if (!in_thread_list (pid))
|
||||||
|
{
|
||||||
|
fprintf (stderr, "[New %s]\n", target_pid_to_str (pid));
|
||||||
|
add_thread (pid);
|
||||||
|
|
||||||
|
target_resume (pid, 0, 0);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
stop_signal = WSTOPSIG (w);
|
||||||
|
|
||||||
|
if (stop_signal >= NSIG || signal_print[stop_signal])
|
||||||
|
{
|
||||||
|
char *signame;
|
||||||
|
|
||||||
|
printed = 1;
|
||||||
|
target_terminal_ours_for_output ();
|
||||||
|
printf_filtered ("\nProgram received signal ");
|
||||||
|
signame = strsigno (stop_signal);
|
||||||
|
if (signame == NULL)
|
||||||
|
printf_filtered ("%d", stop_signal);
|
||||||
|
else
|
||||||
|
printf_filtered ("%s (%d)", signame, stop_signal);
|
||||||
|
printf_filtered (", %s\n", safe_strsignal (stop_signal));
|
||||||
|
|
||||||
|
fflush (stdout);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (stop_signal >= NSIG || signal_stop[stop_signal])
|
||||||
|
{
|
||||||
|
inferior_pid = pid;
|
||||||
|
printf_filtered ("[Switching to %s]\n", target_pid_to_str (pid));
|
||||||
|
|
||||||
|
flush_cached_frames ();
|
||||||
|
registers_changed ();
|
||||||
|
trap_expected = 0;
|
||||||
|
if (step_resume_breakpoint)
|
||||||
|
{
|
||||||
|
delete_breakpoint (step_resume_breakpoint);
|
||||||
|
step_resume_breakpoint = NULL;
|
||||||
|
}
|
||||||
|
prev_pc = 0;
|
||||||
|
prev_sp = 0;
|
||||||
|
prev_func_name = NULL;
|
||||||
|
step_range_start = 0;
|
||||||
|
step_range_end = 0;
|
||||||
|
step_frame_address = 0;
|
||||||
|
handling_longjmp = 0;
|
||||||
|
another_trap = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (printed)
|
||||||
|
target_terminal_inferior ();
|
||||||
|
|
||||||
|
/* Clear the signal if it should not be passed. */
|
||||||
|
if (signal_program[stop_signal] == 0)
|
||||||
|
stop_signal = 0;
|
||||||
|
|
||||||
|
target_resume (pid, 0, stop_signal);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef NO_SINGLE_STEP
|
#ifdef NO_SINGLE_STEP
|
||||||
if (one_stepped)
|
if (one_stepped)
|
||||||
single_step (0); /* This actually cleans up the ss */
|
single_step (0); /* This actually cleans up the ss */
|
||||||
@ -565,8 +629,7 @@ wait_for_inferior ()
|
|||||||
}
|
}
|
||||||
|
|
||||||
stop_pc = read_pc ();
|
stop_pc = read_pc ();
|
||||||
set_current_frame ( create_new_frame (read_fp (),
|
set_current_frame ( create_new_frame (read_fp (), stop_pc));
|
||||||
read_pc ()));
|
|
||||||
|
|
||||||
stop_frame_address = FRAME_FP (get_current_frame ());
|
stop_frame_address = FRAME_FP (get_current_frame ());
|
||||||
stop_sp = read_sp ();
|
stop_sp = read_sp ();
|
||||||
@ -574,7 +637,8 @@ wait_for_inferior ()
|
|||||||
stop_func_name = 0;
|
stop_func_name = 0;
|
||||||
/* Don't care about return value; stop_func_start and stop_func_name
|
/* Don't care about return value; stop_func_start and stop_func_name
|
||||||
will both be 0 if it doesn't work. */
|
will both be 0 if it doesn't work. */
|
||||||
find_pc_partial_function (stop_pc, &stop_func_name, &stop_func_start);
|
find_pc_partial_function (stop_pc, &stop_func_name, &stop_func_start,
|
||||||
|
(CORE_ADDR *)NULL);
|
||||||
stop_func_start += FUNCTION_START_OFFSET;
|
stop_func_start += FUNCTION_START_OFFSET;
|
||||||
another_trap = 0;
|
another_trap = 0;
|
||||||
bpstat_clear (&stop_bpstat);
|
bpstat_clear (&stop_bpstat);
|
||||||
@ -1573,7 +1637,6 @@ save_inferior_status (inf_status, restore_stack_info)
|
|||||||
struct inferior_status *inf_status;
|
struct inferior_status *inf_status;
|
||||||
int restore_stack_info;
|
int restore_stack_info;
|
||||||
{
|
{
|
||||||
inf_status->pc_changed = pc_changed;
|
|
||||||
inf_status->stop_signal = stop_signal;
|
inf_status->stop_signal = stop_signal;
|
||||||
inf_status->stop_pc = stop_pc;
|
inf_status->stop_pc = stop_pc;
|
||||||
inf_status->stop_frame_address = stop_frame_address;
|
inf_status->stop_frame_address = stop_frame_address;
|
||||||
@ -1597,20 +1660,53 @@ save_inferior_status (inf_status, restore_stack_info)
|
|||||||
inf_status->proceed_to_finish = proceed_to_finish;
|
inf_status->proceed_to_finish = proceed_to_finish;
|
||||||
|
|
||||||
memcpy (inf_status->stop_registers, stop_registers, REGISTER_BYTES);
|
memcpy (inf_status->stop_registers, stop_registers, REGISTER_BYTES);
|
||||||
|
|
||||||
|
read_register_bytes (0, inf_status->registers, REGISTER_BYTES);
|
||||||
|
|
||||||
record_selected_frame (&(inf_status->selected_frame_address),
|
record_selected_frame (&(inf_status->selected_frame_address),
|
||||||
&(inf_status->selected_level));
|
&(inf_status->selected_level));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct restore_selected_frame_args {
|
||||||
|
FRAME_ADDR frame_address;
|
||||||
|
int level;
|
||||||
|
};
|
||||||
|
|
||||||
|
static int restore_selected_frame PARAMS ((char *));
|
||||||
|
|
||||||
|
/* Restore the selected frame. args is really a struct
|
||||||
|
restore_selected_frame_args * (declared as char * for catch_errors)
|
||||||
|
telling us what frame to restore. Returns 1 for success, or 0 for
|
||||||
|
failure. An error message will have been printed on error. */
|
||||||
|
static int
|
||||||
|
restore_selected_frame (args)
|
||||||
|
char *args;
|
||||||
|
{
|
||||||
|
struct restore_selected_frame_args *fr =
|
||||||
|
(struct restore_selected_frame_args *) args;
|
||||||
|
FRAME fid;
|
||||||
|
int level = fr->level;
|
||||||
|
|
||||||
|
fid = find_relative_frame (get_current_frame (), &level);
|
||||||
|
|
||||||
|
/* If inf_status->selected_frame_address is NULL, there was no
|
||||||
|
previously selected frame. */
|
||||||
|
if (fid == 0 ||
|
||||||
|
FRAME_FP (fid) != fr->frame_address ||
|
||||||
|
level != 0)
|
||||||
|
{
|
||||||
|
warning ("Unable to restore previously selected frame.\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
select_frame (fid, fr->level);
|
||||||
|
return(1);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
restore_inferior_status (inf_status)
|
restore_inferior_status (inf_status)
|
||||||
struct inferior_status *inf_status;
|
struct inferior_status *inf_status;
|
||||||
{
|
{
|
||||||
FRAME fid;
|
|
||||||
int level = inf_status->selected_level;
|
|
||||||
|
|
||||||
pc_changed = inf_status->pc_changed;
|
|
||||||
stop_signal = inf_status->stop_signal;
|
stop_signal = inf_status->stop_signal;
|
||||||
stop_pc = inf_status->stop_pc;
|
stop_pc = inf_status->stop_pc;
|
||||||
stop_frame_address = inf_status->stop_frame_address;
|
stop_frame_address = inf_status->stop_frame_address;
|
||||||
@ -1633,32 +1729,33 @@ restore_inferior_status (inf_status)
|
|||||||
|
|
||||||
/* The inferior can be gone if the user types "print exit(0)"
|
/* The inferior can be gone if the user types "print exit(0)"
|
||||||
(and perhaps other times). */
|
(and perhaps other times). */
|
||||||
|
if (target_has_execution)
|
||||||
|
write_register_bytes (0, inf_status->registers, REGISTER_BYTES);
|
||||||
|
|
||||||
|
/* The inferior can be gone if the user types "print exit(0)"
|
||||||
|
(and perhaps other times). */
|
||||||
|
|
||||||
|
/* FIXME: If we are being called after stopping in a function which
|
||||||
|
is called from gdb, we should not be trying to restore the
|
||||||
|
selected frame; it just prints a spurious error message (The
|
||||||
|
message is useful, however, in detecting bugs in gdb (like if gdb
|
||||||
|
clobbers the stack)). In fact, should we be restoring the
|
||||||
|
inferior status at all in that case? . */
|
||||||
|
|
||||||
if (target_has_stack && inf_status->restore_stack_info)
|
if (target_has_stack && inf_status->restore_stack_info)
|
||||||
{
|
{
|
||||||
fid = find_relative_frame (get_current_frame (),
|
struct restore_selected_frame_args fr;
|
||||||
&level);
|
fr.level = inf_status->selected_level;
|
||||||
|
fr.frame_address = inf_status->selected_frame_address;
|
||||||
/* If inf_status->selected_frame_address is NULL, there was no
|
/* The point of catch_errors is that if the stack is clobbered,
|
||||||
previously selected frame. */
|
walking the stack might encounter a garbage pointer and error()
|
||||||
if (fid == 0 ||
|
trying to dereference it. */
|
||||||
FRAME_FP (fid) != inf_status->selected_frame_address ||
|
if (catch_errors (restore_selected_frame, &fr,
|
||||||
level != 0)
|
"Unable to restore previously selected frame:\n",
|
||||||
{
|
RETURN_MASK_ERROR) == 0)
|
||||||
#if 1
|
/* Error in restoring the selected frame. Select the innermost
|
||||||
/* I'm not sure this error message is a good idea. I have
|
frame. */
|
||||||
only seen it occur after "Can't continue previously
|
select_frame (get_current_frame (), 0);
|
||||||
requested operation" (we get called from do_cleanups), in
|
|
||||||
which case it just adds insult to injury (one confusing
|
|
||||||
error message after another. Besides which, does the
|
|
||||||
user really care if we can't restore the previously
|
|
||||||
selected frame? */
|
|
||||||
fprintf (stderr, "Unable to restore previously selected frame.\n");
|
|
||||||
#endif
|
|
||||||
select_frame (get_current_frame (), 0);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
select_frame (fid, inf_status->selected_level);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -187,7 +187,6 @@ thread_switch (pid)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
inferior_pid = pid;
|
inferior_pid = pid;
|
||||||
pc_changed = 0;
|
|
||||||
flush_cached_frames ();
|
flush_cached_frames ();
|
||||||
registers_changed ();
|
registers_changed ();
|
||||||
stop_pc = read_pc();
|
stop_pc = read_pc();
|
||||||
|
Reference in New Issue
Block a user