remote-sim.c: Don't install a deprecated_xfer_memory method.
Manually tested with a --target=arm-eabi build, and doing things like: $ arm-eabi-gcc ~/gdb/tests/main.c -o a.out -c -g $ ./gdb a.out ... (gdb) tar sim (gdb) load (gdb) disassemble 0 Dump of assembler code for function main: 0x00000000 <+0>: mov r12, sp 0x00000004 <+4>: push {r11, r12, lr, pc} 0x00000008 <+8>: sub r11, r12, #4 0x0000000c <+12>: sub sp, sp, #8 0x00000010 <+16>: str r0, [r11, #-16] 0x00000014 <+20>: str r1, [r11, #-20] 0x00000018 <+24>: mov r3, #0 0x0000001c <+28>: mov r0, r3 0x00000020 <+32>: sub sp, r11, #12 0x00000024 <+36>: ldm sp, {r11, sp, pc} End of assembler dump. (gdb) p *0 = 1 0x00000001 gdb/ 2013-09-06 Pedro Alves <palves@redhat.com> * remote-sim.c (dump_mem): Constify buf parameter. gdbsim_xfer_inferior_memory): Rename to ... (gdbsim_xfer_memory): ... this. Adjust interface as target_xfer_partial helper. (gdbsim_xfer_partial): New function. (init_gdbsim_ops): Don't install a deprecated_xfer_memory hook. Install a to_xfer_partial hook. Send output to gdb_stdlog.
This commit is contained in:
parent
fcde0081d9
commit
146ec4dbcf
|
@ -1,3 +1,13 @@
|
||||||
|
2013-09-06 Pedro Alves <palves@redhat.com>
|
||||||
|
|
||||||
|
* remote-sim.c (dump_mem): Constify buf parameter.
|
||||||
|
gdbsim_xfer_inferior_memory): Rename to ...
|
||||||
|
(gdbsim_xfer_memory): ... this. Adjust interface as
|
||||||
|
target_xfer_partial helper.
|
||||||
|
(gdbsim_xfer_partial): New function.
|
||||||
|
(init_gdbsim_ops): Don't install a deprecated_xfer_memory hook.
|
||||||
|
Install a to_xfer_partial hook. Send output to gdb_stdlog.
|
||||||
|
|
||||||
2013-09-06 Pedro Alves <palves@redhat.com>
|
2013-09-06 Pedro Alves <palves@redhat.com>
|
||||||
|
|
||||||
* remote-sim.c (gdbsim_xfer_inferior_memory): Use
|
* remote-sim.c (gdbsim_xfer_inferior_memory): Use
|
||||||
|
|
|
@ -46,8 +46,6 @@
|
||||||
|
|
||||||
extern void _initialize_remote_sim (void);
|
extern void _initialize_remote_sim (void);
|
||||||
|
|
||||||
static void dump_mem (gdb_byte *buf, int len);
|
|
||||||
|
|
||||||
static void init_callbacks (void);
|
static void init_callbacks (void);
|
||||||
|
|
||||||
static void end_callbacks (void);
|
static void end_callbacks (void);
|
||||||
|
@ -271,7 +269,7 @@ sim_inferior_data_cleanup (struct inferior *inf, void *data)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
dump_mem (gdb_byte *buf, int len)
|
dump_mem (const gdb_byte *buf, int len)
|
||||||
{
|
{
|
||||||
printf_filtered ("\t");
|
printf_filtered ("\t");
|
||||||
|
|
||||||
|
@ -1054,16 +1052,13 @@ gdbsim_prepare_to_store (struct regcache *regcache)
|
||||||
/* Do nothing, since we can store individual regs. */
|
/* Do nothing, since we can store individual regs. */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Transfer LEN bytes between GDB address MYADDR and target address
|
/* Helper for gdbsim_xfer_partial that handles memory transfers.
|
||||||
MEMADDR. If WRITE is non-zero, transfer them to the target,
|
Arguments are like target_xfer_partial. */
|
||||||
otherwise transfer them from the target. TARGET is unused.
|
|
||||||
|
|
||||||
Returns the number of bytes transferred. */
|
static LONGEST
|
||||||
|
gdbsim_xfer_memory (struct target_ops *target,
|
||||||
static int
|
gdb_byte *readbuf, const gdb_byte *writebuf,
|
||||||
gdbsim_xfer_inferior_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len,
|
ULONGEST memaddr, LONGEST len)
|
||||||
int write, struct mem_attrib *attrib,
|
|
||||||
struct target_ops *target)
|
|
||||||
{
|
{
|
||||||
struct sim_inferior_data *sim_data
|
struct sim_inferior_data *sim_data
|
||||||
= get_sim_inferior_data (current_inferior (), SIM_INSTANCE_NOT_NEEDED);
|
= get_sim_inferior_data (current_inferior (), SIM_INSTANCE_NOT_NEEDED);
|
||||||
|
@ -1087,27 +1082,45 @@ gdbsim_xfer_inferior_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len,
|
||||||
|
|
||||||
if (remote_debug)
|
if (remote_debug)
|
||||||
fprintf_unfiltered (gdb_stdlog,
|
fprintf_unfiltered (gdb_stdlog,
|
||||||
"gdbsim_xfer_inferior_memory: myaddr %s, "
|
"gdbsim_xfer_memory: readbuf %s, writebuf %s, "
|
||||||
"memaddr %s, len %d, write %d\n",
|
"memaddr %s, len %s\n",
|
||||||
host_address_to_string (myaddr),
|
host_address_to_string (readbuf),
|
||||||
|
host_address_to_string (writebuf),
|
||||||
paddress (target_gdbarch (), memaddr),
|
paddress (target_gdbarch (), memaddr),
|
||||||
len, write);
|
plongest (len));
|
||||||
|
|
||||||
if (write)
|
if (writebuf)
|
||||||
{
|
{
|
||||||
if (remote_debug && len > 0)
|
if (remote_debug && len > 0)
|
||||||
dump_mem (myaddr, len);
|
dump_mem (writebuf, len);
|
||||||
len = sim_write (sim_data->gdbsim_desc, memaddr, myaddr, len);
|
len = sim_write (sim_data->gdbsim_desc, memaddr, writebuf, len);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
len = sim_read (sim_data->gdbsim_desc, memaddr, myaddr, len);
|
len = sim_read (sim_data->gdbsim_desc, memaddr, readbuf, len);
|
||||||
if (remote_debug && len > 0)
|
if (remote_debug && len > 0)
|
||||||
dump_mem (myaddr, len);
|
dump_mem (readbuf, len);
|
||||||
}
|
}
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Target to_xfer_partial implementation. */
|
||||||
|
|
||||||
|
static LONGEST
|
||||||
|
gdbsim_xfer_partial (struct target_ops *ops, enum target_object object,
|
||||||
|
const char *annex, gdb_byte *readbuf,
|
||||||
|
const gdb_byte *writebuf, ULONGEST offset, LONGEST len)
|
||||||
|
{
|
||||||
|
switch (object)
|
||||||
|
{
|
||||||
|
case TARGET_OBJECT_MEMORY:
|
||||||
|
return gdbsim_xfer_memory (ops, readbuf, writebuf, offset, len);
|
||||||
|
|
||||||
|
default:
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gdbsim_files_info (struct target_ops *target)
|
gdbsim_files_info (struct target_ops *target)
|
||||||
{
|
{
|
||||||
|
@ -1283,7 +1296,7 @@ init_gdbsim_ops (void)
|
||||||
gdbsim_ops.to_fetch_registers = gdbsim_fetch_register;
|
gdbsim_ops.to_fetch_registers = gdbsim_fetch_register;
|
||||||
gdbsim_ops.to_store_registers = gdbsim_store_register;
|
gdbsim_ops.to_store_registers = gdbsim_store_register;
|
||||||
gdbsim_ops.to_prepare_to_store = gdbsim_prepare_to_store;
|
gdbsim_ops.to_prepare_to_store = gdbsim_prepare_to_store;
|
||||||
gdbsim_ops.deprecated_xfer_memory = gdbsim_xfer_inferior_memory;
|
gdbsim_ops.to_xfer_partial = gdbsim_xfer_partial;
|
||||||
gdbsim_ops.to_files_info = gdbsim_files_info;
|
gdbsim_ops.to_files_info = gdbsim_files_info;
|
||||||
gdbsim_ops.to_insert_breakpoint = memory_insert_breakpoint;
|
gdbsim_ops.to_insert_breakpoint = memory_insert_breakpoint;
|
||||||
gdbsim_ops.to_remove_breakpoint = memory_remove_breakpoint;
|
gdbsim_ops.to_remove_breakpoint = memory_remove_breakpoint;
|
||||||
|
|
Loading…
Reference in New Issue