* [RFC] remote-sim.c: Make sim memory accessible after a "load"
@ 2010-07-02 23:07 Kevin Buettner
2010-08-10 4:41 ` Kevin Buettner
0 siblings, 1 reply; 2+ messages in thread
From: Kevin Buettner @ 2010-07-02 23:07 UTC (permalink / raw)
To: gdb-patches
The patch below depends upon:
http://sourceware.org/ml/gdb-patches/2010-07/msg00059.html
It makes sim memory accessible immediately after a "load". For more
discussion of this matter, see:
http://sourceware.org/ml/gdb-patches/2010-06/msg00656.html
I've tested it (along with its dependency) against the following
simulators: arm, frv, mips, powerpc, and v850. No regressions
found for any of these simulators.
Comments?
Kevin
* remote-sim.c (gdbsim_xfer_inferior_memory): Replace
`target_has_execution' check with `to_has_memory' check.
(gdbsim_has_all_memory, gdbsim_has_memory): New functions.
(init_gdbsym_ops): Initialize relevant fields of `gdbsim_ops'
with `gdbsim_has_all_memory' and `gdbsim_has_memory'.
--- ../../../sourceware-multi-1/src/gdb/remote-sim.c 2010-07-02 13:00:24.000000000 -0700
+++ remote-sim.c 2010-07-01 17:15:30.000000000 -0700
@@ -903,10 +903,10 @@ gdbsim_xfer_inferior_memory (CORE_ADDR m
struct sim_inferior_data *sim_data
= get_sim_inferior_data (SIM_INSTANCE_NOT_NEEDED);
- /* If no program is running yet, then ignore the simulator for
- memory. Pass the request down to the next target, hopefully
- an exec file. */
- if (!target_has_execution)
+ /* If this target doesn't have memory yet, return 0 causing the
+ request to be passed to a lower target, hopefully an exec
+ file. */
+ if (!target->to_has_memory (target))
return 0;
if (!sim_data->program_loaded)
@@ -1047,6 +1047,32 @@ gdbsim_pid_to_str (struct target_ops *op
return normal_pid_to_str (ptid);
}
+/* Simulator memory may be accessed after the program has been loaded. */
+
+int
+gdbsim_has_all_memory (struct target_ops *ops)
+{
+ struct sim_inferior_data *sim_data
+ = get_sim_inferior_data (SIM_INSTANCE_NOT_NEEDED);
+
+ if (!sim_data->program_loaded)
+ return 0;
+
+ return 1;
+}
+
+int
+gdbsim_has_memory (struct target_ops *ops)
+{
+ struct sim_inferior_data *sim_data
+ = get_sim_inferior_data (SIM_INSTANCE_NOT_NEEDED);
+
+ if (!sim_data->program_loaded)
+ return 0;
+
+ return 1;
+}
+
/* Define the target subroutine names */
struct target_ops gdbsim_ops;
@@ -1077,8 +1103,8 @@ init_gdbsim_ops (void)
gdbsim_ops.to_thread_alive = gdbsim_thread_alive;
gdbsim_ops.to_pid_to_str = gdbsim_pid_to_str;
gdbsim_ops.to_stratum = process_stratum;
- gdbsim_ops.to_has_all_memory = default_child_has_all_memory;
- gdbsim_ops.to_has_memory = default_child_has_memory;
+ gdbsim_ops.to_has_all_memory = gdbsim_has_all_memory;
+ gdbsim_ops.to_has_memory = gdbsim_has_memory;
gdbsim_ops.to_has_stack = default_child_has_stack;
gdbsim_ops.to_has_registers = default_child_has_registers;
gdbsim_ops.to_has_execution = default_child_has_execution;
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [RFC] remote-sim.c: Make sim memory accessible after a "load"
2010-07-02 23:07 [RFC] remote-sim.c: Make sim memory accessible after a "load" Kevin Buettner
@ 2010-08-10 4:41 ` Kevin Buettner
0 siblings, 0 replies; 2+ messages in thread
From: Kevin Buettner @ 2010-08-10 4:41 UTC (permalink / raw)
To: gdb-patches
On Fri, 2 Jul 2010 16:07:01 -0700
Kevin Buettner <kevinb@redhat.com> wrote:
> It makes sim memory accessible immediately after a "load". For more
> discussion of this matter, see:
>
> http://sourceware.org/ml/gdb-patches/2010-06/msg00656.html
>
> I've tested it (along with its dependency) against the following
> simulators: arm, frv, mips, powerpc, and v850. No regressions
> found for any of these simulators.
Below is the patch that I just committed. (It is similar to the
original patch, but that patch no longer applied cleanly due to
the various changes that were made as a result of Pedro's feedback
to the multiple sim instance patch.)
* remote-sim.c (gdbsim_xfer_inferior_memory): Replace
`target_has_execution' check with `to_has_memory' check.
(gdbsim_has_all_memory, gdbsim_has_memory): New functions.
(init_gdbsym_ops): Initialize relevant fields of `gdbsim_ops'
with `gdbsim_has_all_memory' and `gdbsim_has_memory'.
Index: remote-sim.c
===================================================================
RCS file: /cvs/src/src/gdb/remote-sim.c,v
retrieving revision 1.97
diff -u -p -r1.97 remote-sim.c
--- remote-sim.c 10 Aug 2010 00:19:26 -0000 1.97
+++ remote-sim.c 10 Aug 2010 04:32:11 -0000
@@ -1063,10 +1063,10 @@ gdbsim_xfer_inferior_memory (CORE_ADDR m
struct sim_inferior_data *sim_data
= get_sim_inferior_data (current_inferior (), SIM_INSTANCE_NOT_NEEDED);
- /* If no program is running yet, then ignore the simulator for
- memory. Pass the request down to the next target, hopefully
- an exec file. */
- if (!target_has_execution)
+ /* If this target doesn't have memory yet, return 0 causing the
+ request to be passed to a lower target, hopefully an exec
+ file. */
+ if (!target->to_has_memory (target))
return 0;
if (!sim_data->program_loaded)
@@ -1210,6 +1210,32 @@ gdbsim_pid_to_str (struct target_ops *op
return normal_pid_to_str (ptid);
}
+/* Simulator memory may be accessed after the program has been loaded. */
+
+int
+gdbsim_has_all_memory (struct target_ops *ops)
+{
+ struct sim_inferior_data *sim_data
+ = get_sim_inferior_data (current_inferior (), SIM_INSTANCE_NOT_NEEDED);
+
+ if (!sim_data->program_loaded)
+ return 0;
+
+ return 1;
+}
+
+int
+gdbsim_has_memory (struct target_ops *ops)
+{
+ struct sim_inferior_data *sim_data
+ = get_sim_inferior_data (current_inferior (), SIM_INSTANCE_NOT_NEEDED);
+
+ if (!sim_data->program_loaded)
+ return 0;
+
+ return 1;
+}
+
/* Define the target subroutine names */
struct target_ops gdbsim_ops;
@@ -1240,8 +1266,8 @@ init_gdbsim_ops (void)
gdbsim_ops.to_thread_alive = gdbsim_thread_alive;
gdbsim_ops.to_pid_to_str = gdbsim_pid_to_str;
gdbsim_ops.to_stratum = process_stratum;
- gdbsim_ops.to_has_all_memory = default_child_has_all_memory;
- gdbsim_ops.to_has_memory = default_child_has_memory;
+ gdbsim_ops.to_has_all_memory = gdbsim_has_all_memory;
+ gdbsim_ops.to_has_memory = gdbsim_has_memory;
gdbsim_ops.to_has_stack = default_child_has_stack;
gdbsim_ops.to_has_registers = default_child_has_registers;
gdbsim_ops.to_has_execution = default_child_has_execution;
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-08-10 4:41 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-07-02 23:07 [RFC] remote-sim.c: Make sim memory accessible after a "load" Kevin Buettner
2010-08-10 4:41 ` Kevin Buettner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).