mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-11-29 04:53:56 +08:00
* infrun.c (stop_registers): Change variable's type to ``struct
regcache'''. (xmalloc_inferior_status): Delete function. (free_inferior_status): Delete function. (normal_stop): Use regcache_cpy. (struct inferior_status): Change type of fields ``stop_registers'' and ``registers'' to ``struct regcache''. (write_inferior_status_register): Use regcache_write. (save_inferior_status): Instead of calling xmalloc_inferior_status, allocate the inf_status buffer directly. Use regcache_dup_no_passthrough and regcache_dup to save the buffers. (restore_inferior_status): Use regcache_xfree and regcache_cpy. Replace the stop_registers regcache instead of overriding it. Use regcache_xfree. Instead of calling free_inferior_status, xfree the buffer directly. (discard_inferior_status): Use regcache_xfree. Instead of calling free_inferior_status, xfree the buffer directly. (build_infrun): Use regcache_xmalloc. (_initialize_infrun): Delete redundant call to build_infrun. * Makefile.in (infcmd.o): Add $(regcache_h). * infcmd.c: Include "regcache.h". (run_stack_dummy): Use deprecated_grub_regcache_for_registers to obtain the address of `stop_registers' register buffer. (print_return_value): Ditto. * inferior.h (struct regcache): Add opaque declaration. (stop_registers): Change variable's declared type to ``struct regcache''.
This commit is contained in:
parent
8f28b84541
commit
72cec14173
@ -1,3 +1,37 @@
|
||||
2002-06-25 Andrew Cagney <cagney@redhat.com>
|
||||
|
||||
* infrun.c (stop_registers): Change variable's type to ``struct
|
||||
regcache'''.
|
||||
(xmalloc_inferior_status): Delete function.
|
||||
(free_inferior_status): Delete function.
|
||||
(normal_stop): Use regcache_cpy.
|
||||
(struct inferior_status): Change type of fields ``stop_registers''
|
||||
and ``registers'' to ``struct regcache''.
|
||||
(write_inferior_status_register): Use regcache_write.
|
||||
(save_inferior_status): Instead of calling
|
||||
xmalloc_inferior_status, allocate the inf_status buffer directly.
|
||||
Use regcache_dup_no_passthrough and regcache_dup to save the
|
||||
buffers.
|
||||
(restore_inferior_status): Use regcache_xfree and regcache_cpy.
|
||||
Replace the stop_registers regcache instead of overriding it. Use
|
||||
regcache_xfree. Instead of calling free_inferior_status, xfree
|
||||
the buffer directly.
|
||||
(discard_inferior_status): Use regcache_xfree. Instead of calling
|
||||
free_inferior_status, xfree the buffer directly.
|
||||
(build_infrun): Use regcache_xmalloc.
|
||||
(_initialize_infrun): Delete redundant call to build_infrun.
|
||||
|
||||
* Makefile.in (infcmd.o): Add $(regcache_h).
|
||||
|
||||
* infcmd.c: Include "regcache.h".
|
||||
(run_stack_dummy): Use deprecated_grub_regcache_for_registers to
|
||||
obtain the address of `stop_registers' register buffer.
|
||||
(print_return_value): Ditto.
|
||||
|
||||
* inferior.h (struct regcache): Add opaque declaration.
|
||||
(stop_registers): Change variable's declared type to ``struct
|
||||
regcache''.
|
||||
|
||||
2002-06-24 Tom Tromey <tromey@redhat.com>
|
||||
|
||||
* cli/cli-decode.c (add_show_from_set): Fixed typo in comment.
|
||||
|
@ -1690,7 +1690,7 @@ ia64-tdep.o: ia64-tdep.c $(defs_h) $(inferior_h) $(symfile_h) $(gdbcore_h) \
|
||||
|
||||
infcmd.o: infcmd.c $(defs_h) environ.h $(gdbcmd_h) $(gdbcore_h) \
|
||||
$(inferior_h) $(target_h) $(language_h) $(symfile_h) $(gdb_string_h) \
|
||||
$(ui_out_h) $(completer_h)
|
||||
$(ui_out_h) $(completer_h) $(regcache_h)
|
||||
|
||||
inflow.o: inflow.c $(bfd_h) $(command_h) $(defs_h) $(inferior_h) \
|
||||
$(target_h) $(terminal_h) $(gdbthread_h) $(gdb_string_h)
|
||||
|
21
gdb/infcmd.c
21
gdb/infcmd.c
@ -41,6 +41,8 @@
|
||||
#include "event-top.h"
|
||||
#include "parser-defs.h"
|
||||
|
||||
#include "regcache.h" /* for deprecated_grub_regcache_for_registers(). */
|
||||
|
||||
/* Functions exported for general use: */
|
||||
|
||||
void nofp_registers_info (char *, int);
|
||||
@ -1043,7 +1045,8 @@ run_stack_dummy (CORE_ADDR addr, char *buffer)
|
||||
|
||||
/* On normal return, the stack dummy has been popped already. */
|
||||
|
||||
memcpy (buffer, stop_registers, REGISTER_BYTES);
|
||||
memcpy (buffer, deprecated_grub_regcache_for_registers (stop_registers),
|
||||
REGISTER_BYTES);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1143,7 +1146,15 @@ print_return_value (int structure_return, struct type *value_type)
|
||||
|
||||
if (!structure_return)
|
||||
{
|
||||
#if 0
|
||||
value = value_being_returned (value_type, stop_registers, structure_return);
|
||||
#else
|
||||
/* FIXME: cagney/2002-06-22: Function value_being_returned()
|
||||
should take a regcache as a parameter. */
|
||||
value = value_being_returned
|
||||
(value_type, deprecated_grub_regcache_for_registers (stop_registers),
|
||||
structure_return);
|
||||
#endif
|
||||
stb = ui_out_stream_new (uiout);
|
||||
ui_out_text (uiout, "Value returned is ");
|
||||
ui_out_field_fmt (uiout, "gdb-result-var", "$%d", record_latest_value (value));
|
||||
@ -1164,7 +1175,15 @@ print_return_value (int structure_return, struct type *value_type)
|
||||
ui_out_text (uiout, ".");
|
||||
ui_out_text (uiout, " Cannot determine contents\n");
|
||||
#else
|
||||
#if 0
|
||||
value = value_being_returned (value_type, stop_registers, structure_return);
|
||||
#else
|
||||
/* FIXME: cagney/2002-06-22: Function value_being_returned()
|
||||
should take a regcache as a parameter. */
|
||||
value = value_being_returned
|
||||
(value_type, deprecated_grub_regcache_for_registers (stop_registers),
|
||||
structure_return);
|
||||
#endif
|
||||
stb = ui_out_stream_new (uiout);
|
||||
ui_out_text (uiout, "Value returned is ");
|
||||
ui_out_field_fmt (uiout, "gdb-result-var", "$%d", record_latest_value (value));
|
||||
|
@ -24,6 +24,7 @@
|
||||
#define INFERIOR_H 1
|
||||
|
||||
struct gdbarch;
|
||||
struct regcache;
|
||||
|
||||
/* For bpstat. */
|
||||
#include "breakpoint.h"
|
||||
@ -396,7 +397,7 @@ extern int proceed_to_finish;
|
||||
Thus this contains the return value from the called function (assuming
|
||||
values are returned in a register). */
|
||||
|
||||
extern char *stop_registers;
|
||||
extern struct regcache *stop_registers;
|
||||
|
||||
/* Nonzero if the child process in inferior_ptid was attached rather
|
||||
than forked. */
|
||||
|
57
gdb/infrun.c
57
gdb/infrun.c
@ -62,10 +62,6 @@ static void delete_breakpoint_current_contents (void *);
|
||||
static void set_follow_fork_mode_command (char *arg, int from_tty,
|
||||
struct cmd_list_element * c);
|
||||
|
||||
static struct inferior_status *xmalloc_inferior_status (void);
|
||||
|
||||
static void free_inferior_status (struct inferior_status *);
|
||||
|
||||
static int restore_selected_frame (void *);
|
||||
|
||||
static void build_infrun (void);
|
||||
@ -341,7 +337,7 @@ int proceed_to_finish;
|
||||
Thus this contains the return value from the called function (assuming
|
||||
values are returned in a register). */
|
||||
|
||||
char *stop_registers;
|
||||
struct regcache *stop_registers;
|
||||
|
||||
/* Nonzero if program stopped due to error trying to insert breakpoints. */
|
||||
|
||||
@ -3505,7 +3501,9 @@ and/or watchpoints.\n");
|
||||
/* Save the function value return registers, if we care.
|
||||
We might be about to restore their previous contents. */
|
||||
if (proceed_to_finish)
|
||||
read_register_bytes (0, stop_registers, REGISTER_BYTES);
|
||||
/* NB: The copy goes through to the target picking up the value of
|
||||
all the registers. */
|
||||
regcache_cpy (stop_registers, current_regcache);
|
||||
|
||||
if (stop_stack_dummy)
|
||||
{
|
||||
@ -3910,12 +3908,12 @@ struct inferior_status
|
||||
CORE_ADDR step_resume_break_address;
|
||||
int stop_after_trap;
|
||||
int stop_soon_quietly;
|
||||
char *stop_registers;
|
||||
struct regcache *stop_registers;
|
||||
|
||||
/* These are here because if call_function_by_hand has written some
|
||||
registers and then decides to call error(), we better not have changed
|
||||
any registers. */
|
||||
char *registers;
|
||||
struct regcache *registers;
|
||||
|
||||
/* A frame unique identifier. */
|
||||
struct frame_id selected_frame_id;
|
||||
@ -3925,24 +3923,6 @@ struct inferior_status
|
||||
int proceed_to_finish;
|
||||
};
|
||||
|
||||
static struct inferior_status *
|
||||
xmalloc_inferior_status (void)
|
||||
{
|
||||
struct inferior_status *inf_status;
|
||||
inf_status = xmalloc (sizeof (struct inferior_status));
|
||||
inf_status->stop_registers = xmalloc (REGISTER_BYTES);
|
||||
inf_status->registers = xmalloc (REGISTER_BYTES);
|
||||
return inf_status;
|
||||
}
|
||||
|
||||
static void
|
||||
free_inferior_status (struct inferior_status *inf_status)
|
||||
{
|
||||
xfree (inf_status->registers);
|
||||
xfree (inf_status->stop_registers);
|
||||
xfree (inf_status);
|
||||
}
|
||||
|
||||
void
|
||||
write_inferior_status_register (struct inferior_status *inf_status, int regno,
|
||||
LONGEST val)
|
||||
@ -3950,7 +3930,7 @@ write_inferior_status_register (struct inferior_status *inf_status, int regno,
|
||||
int size = REGISTER_RAW_SIZE (regno);
|
||||
void *buf = alloca (size);
|
||||
store_signed_integer (buf, size, val);
|
||||
memcpy (&inf_status->registers[REGISTER_BYTE (regno)], buf, size);
|
||||
regcache_write (inf_status->registers, regno, buf);
|
||||
}
|
||||
|
||||
/* Save all of the information associated with the inferior<==>gdb
|
||||
@ -3960,7 +3940,7 @@ write_inferior_status_register (struct inferior_status *inf_status, int regno,
|
||||
struct inferior_status *
|
||||
save_inferior_status (int restore_stack_info)
|
||||
{
|
||||
struct inferior_status *inf_status = xmalloc_inferior_status ();
|
||||
struct inferior_status *inf_status = XMALLOC (struct inferior_status);
|
||||
|
||||
inf_status->stop_signal = stop_signal;
|
||||
inf_status->stop_pc = stop_pc;
|
||||
@ -3984,9 +3964,9 @@ save_inferior_status (int restore_stack_info)
|
||||
inf_status->restore_stack_info = restore_stack_info;
|
||||
inf_status->proceed_to_finish = proceed_to_finish;
|
||||
|
||||
memcpy (inf_status->stop_registers, stop_registers, REGISTER_BYTES);
|
||||
inf_status->stop_registers = regcache_dup_no_passthrough (stop_registers);
|
||||
|
||||
read_register_bytes (0, inf_status->registers, REGISTER_BYTES);
|
||||
inf_status->registers = regcache_dup (current_regcache);
|
||||
|
||||
get_frame_id (selected_frame, &inf_status->selected_frame_id);
|
||||
return inf_status;
|
||||
@ -4033,13 +4013,16 @@ restore_inferior_status (struct inferior_status *inf_status)
|
||||
breakpoint_proceeded = inf_status->breakpoint_proceeded;
|
||||
proceed_to_finish = inf_status->proceed_to_finish;
|
||||
|
||||
/* FIXME: Is the restore of stop_registers always needed */
|
||||
memcpy (stop_registers, inf_status->stop_registers, REGISTER_BYTES);
|
||||
/* FIXME: Is the restore of stop_registers always needed. */
|
||||
regcache_xfree (stop_registers);
|
||||
stop_registers = inf_status->stop_registers;
|
||||
|
||||
/* The inferior can be gone if the user types "print exit(0)"
|
||||
(and perhaps other times). */
|
||||
if (target_has_execution)
|
||||
write_register_bytes (0, inf_status->registers, REGISTER_BYTES);
|
||||
/* NB: The register write goes through to the target. */
|
||||
regcache_cpy (current_regcache, inf_status->registers);
|
||||
regcache_xfree (inf_status->registers);
|
||||
|
||||
/* FIXME: If we are being called after stopping in a function which
|
||||
is called from gdb, we should not be trying to restore the
|
||||
@ -4062,7 +4045,7 @@ restore_inferior_status (struct inferior_status *inf_status)
|
||||
|
||||
}
|
||||
|
||||
free_inferior_status (inf_status);
|
||||
xfree (inf_status);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -4082,7 +4065,9 @@ discard_inferior_status (struct inferior_status *inf_status)
|
||||
{
|
||||
/* See save_inferior_status for info on stop_bpstat. */
|
||||
bpstat_clear (&inf_status->stop_bpstat);
|
||||
free_inferior_status (inf_status);
|
||||
regcache_xfree (inf_status->registers);
|
||||
regcache_xfree (inf_status->stop_registers);
|
||||
xfree (inf_status);
|
||||
}
|
||||
|
||||
/* Oft used ptids */
|
||||
@ -4173,7 +4158,7 @@ save_inferior_ptid (void)
|
||||
static void
|
||||
build_infrun (void)
|
||||
{
|
||||
stop_registers = xmalloc (REGISTER_BYTES);
|
||||
stop_registers = regcache_xmalloc (current_gdbarch);
|
||||
}
|
||||
|
||||
void
|
||||
|
Loading…
Reference in New Issue
Block a user