remote-sim.c: Send debug output to gdb_stdlog.
Tested by building for --target=arm-eabi, and playing with the debug output a bit. gdb/ 2013-09-06 Pedro Alves <palves@redhat.com> * remote-sim.c (dump_mem, gdbsim_fetch_register) (gdbsim_store_register, gdbsim_kill, gdbsim_load) (gdbsim_create_inferior, gdbsim_open, gdbsim_close) (gdbsim_detach, gdbsim_resume_inferior, gdbsim_wait) (gdbsim_files_info, gdbsim_mourn_inferior): Send debug output to gdb_stdlog.
This commit is contained in:
parent
146ec4dbcf
commit
1385f66cf4
2 changed files with 35 additions and 22 deletions
|
@ -1,3 +1,12 @@
|
||||||
|
2013-09-06 Pedro Alves <palves@redhat.com>
|
||||||
|
|
||||||
|
* remote-sim.c (dump_mem, gdbsim_fetch_register)
|
||||||
|
(gdbsim_store_register, gdbsim_kill, gdbsim_load)
|
||||||
|
(gdbsim_create_inferior, gdbsim_open, gdbsim_close)
|
||||||
|
(gdbsim_detach, gdbsim_resume_inferior, gdbsim_wait)
|
||||||
|
(gdbsim_files_info, gdbsim_mourn_inferior): Send debug output to
|
||||||
|
gdb_stdlog.
|
||||||
|
|
||||||
2013-09-06 Pedro Alves <palves@redhat.com>
|
2013-09-06 Pedro Alves <palves@redhat.com>
|
||||||
|
|
||||||
* remote-sim.c (dump_mem): Constify buf parameter.
|
* remote-sim.c (dump_mem): Constify buf parameter.
|
||||||
|
|
|
@ -271,26 +271,26 @@ sim_inferior_data_cleanup (struct inferior *inf, void *data)
|
||||||
static void
|
static void
|
||||||
dump_mem (const gdb_byte *buf, int len)
|
dump_mem (const gdb_byte *buf, int len)
|
||||||
{
|
{
|
||||||
printf_filtered ("\t");
|
fputs_unfiltered ("\t", gdb_stdlog);
|
||||||
|
|
||||||
if (len == 8 || len == 4)
|
if (len == 8 || len == 4)
|
||||||
{
|
{
|
||||||
uint32_t l[2];
|
uint32_t l[2];
|
||||||
|
|
||||||
memcpy (l, buf, len);
|
memcpy (l, buf, len);
|
||||||
printf_filtered ("0x%08x", l[0]);
|
fprintf_unfiltered (gdb_stdlog, "0x%08x", l[0]);
|
||||||
if (len == 8)
|
if (len == 8)
|
||||||
printf_filtered (" 0x%08x", l[1]);
|
fprintf_unfiltered (gdb_stdlog, " 0x%08x", l[1]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < len; i++)
|
for (i = 0; i < len; i++)
|
||||||
printf_filtered ("0x%02x ", buf[i]);
|
fprintf_unfiltered (gdb_stdlog, "0x%02x ", buf[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
printf_filtered ("\n");
|
fputs_unfiltered ("\n", gdb_stdlog);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initialize gdb_callback. */
|
/* Initialize gdb_callback. */
|
||||||
|
@ -486,7 +486,8 @@ gdbsim_fetch_register (struct target_ops *ops,
|
||||||
regcache_raw_supply (regcache, regno, buf);
|
regcache_raw_supply (regcache, regno, buf);
|
||||||
if (remote_debug)
|
if (remote_debug)
|
||||||
{
|
{
|
||||||
printf_filtered ("gdbsim_fetch_register: %d", regno);
|
fprintf_unfiltered (gdb_stdlog,
|
||||||
|
"gdbsim_fetch_register: %d", regno);
|
||||||
/* FIXME: We could print something more intelligible. */
|
/* FIXME: We could print something more intelligible. */
|
||||||
dump_mem (buf, register_size (gdbarch, regno));
|
dump_mem (buf, register_size (gdbarch, regno));
|
||||||
}
|
}
|
||||||
|
@ -532,7 +533,7 @@ gdbsim_store_register (struct target_ops *ops,
|
||||||
|
|
||||||
if (remote_debug)
|
if (remote_debug)
|
||||||
{
|
{
|
||||||
printf_filtered ("gdbsim_store_register: %d", regno);
|
fprintf_unfiltered (gdb_stdlog, "gdbsim_store_register: %d", regno);
|
||||||
/* FIXME: We could print something more intelligible. */
|
/* FIXME: We could print something more intelligible. */
|
||||||
dump_mem (tmp, register_size (gdbarch, regno));
|
dump_mem (tmp, register_size (gdbarch, regno));
|
||||||
}
|
}
|
||||||
|
@ -546,7 +547,7 @@ static void
|
||||||
gdbsim_kill (struct target_ops *ops)
|
gdbsim_kill (struct target_ops *ops)
|
||||||
{
|
{
|
||||||
if (remote_debug)
|
if (remote_debug)
|
||||||
printf_filtered ("gdbsim_kill\n");
|
fprintf_unfiltered (gdb_stdlog, "gdbsim_kill\n");
|
||||||
|
|
||||||
/* There is no need to `kill' running simulator - the simulator is
|
/* There is no need to `kill' running simulator - the simulator is
|
||||||
not running. Mourning it is enough. */
|
not running. Mourning it is enough. */
|
||||||
|
@ -577,7 +578,7 @@ gdbsim_load (char *args, int fromtty)
|
||||||
error (_("GDB sim does not yet support a load offset."));
|
error (_("GDB sim does not yet support a load offset."));
|
||||||
|
|
||||||
if (remote_debug)
|
if (remote_debug)
|
||||||
printf_filtered ("gdbsim_load: prog \"%s\"\n", prog);
|
fprintf_unfiltered (gdb_stdlog, "gdbsim_load: prog \"%s\"\n", prog);
|
||||||
|
|
||||||
/* FIXME: We will print two messages on error.
|
/* FIXME: We will print two messages on error.
|
||||||
Need error to either not print anything if passed NULL or need
|
Need error to either not print anything if passed NULL or need
|
||||||
|
@ -615,7 +616,8 @@ gdbsim_create_inferior (struct target_ops *target, char *exec_file, char *args,
|
||||||
warning (_("No program loaded."));
|
warning (_("No program loaded."));
|
||||||
|
|
||||||
if (remote_debug)
|
if (remote_debug)
|
||||||
printf_filtered ("gdbsim_create_inferior: exec_file \"%s\", args \"%s\"\n",
|
fprintf_unfiltered (gdb_stdlog,
|
||||||
|
"gdbsim_create_inferior: exec_file \"%s\", args \"%s\"\n",
|
||||||
(exec_file ? exec_file : "(NULL)"),
|
(exec_file ? exec_file : "(NULL)"),
|
||||||
args);
|
args);
|
||||||
|
|
||||||
|
@ -669,7 +671,8 @@ gdbsim_open (char *args, int from_tty)
|
||||||
SIM_DESC gdbsim_desc;
|
SIM_DESC gdbsim_desc;
|
||||||
|
|
||||||
if (remote_debug)
|
if (remote_debug)
|
||||||
printf_filtered ("gdbsim_open: args \"%s\"\n", args ? args : "(null)");
|
fprintf_unfiltered (gdb_stdlog,
|
||||||
|
"gdbsim_open: args \"%s\"\n", args ? args : "(null)");
|
||||||
|
|
||||||
/* Ensure that the sim target is not on the target stack. This is
|
/* Ensure that the sim target is not on the target stack. This is
|
||||||
necessary, because if it is on the target stack, the call to
|
necessary, because if it is on the target stack, the call to
|
||||||
|
@ -789,7 +792,7 @@ gdbsim_close (void)
|
||||||
= get_sim_inferior_data (current_inferior (), SIM_INSTANCE_NOT_NEEDED);
|
= get_sim_inferior_data (current_inferior (), SIM_INSTANCE_NOT_NEEDED);
|
||||||
|
|
||||||
if (remote_debug)
|
if (remote_debug)
|
||||||
printf_filtered ("gdbsim_close\n");
|
fprintf_unfiltered (gdb_stdlog, "gdbsim_close\n");
|
||||||
|
|
||||||
iterate_over_inferiors (gdbsim_close_inferior, NULL);
|
iterate_over_inferiors (gdbsim_close_inferior, NULL);
|
||||||
|
|
||||||
|
@ -817,7 +820,7 @@ static void
|
||||||
gdbsim_detach (struct target_ops *ops, char *args, int from_tty)
|
gdbsim_detach (struct target_ops *ops, char *args, int from_tty)
|
||||||
{
|
{
|
||||||
if (remote_debug)
|
if (remote_debug)
|
||||||
printf_filtered ("gdbsim_detach: args \"%s\"\n", args);
|
fprintf_unfiltered (gdb_stdlog, "gdbsim_detach: args \"%s\"\n", args);
|
||||||
|
|
||||||
unpush_target (ops); /* calls gdbsim_close to do the real work */
|
unpush_target (ops); /* calls gdbsim_close to do the real work */
|
||||||
if (from_tty)
|
if (from_tty)
|
||||||
|
@ -847,7 +850,8 @@ gdbsim_resume_inferior (struct inferior *inf, void *arg)
|
||||||
sim_data->resume_step = rd->step;
|
sim_data->resume_step = rd->step;
|
||||||
|
|
||||||
if (remote_debug)
|
if (remote_debug)
|
||||||
printf_filtered (_("gdbsim_resume: pid %d, step %d, signal %d\n"),
|
fprintf_unfiltered (gdb_stdlog,
|
||||||
|
_("gdbsim_resume: pid %d, step %d, signal %d\n"),
|
||||||
inf->pid, rd->step, rd->siggnal);
|
inf->pid, rd->step, rd->siggnal);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -985,7 +989,7 @@ gdbsim_wait (struct target_ops *ops,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (remote_debug)
|
if (remote_debug)
|
||||||
printf_filtered ("gdbsim_wait\n");
|
fprintf_unfiltered (gdb_stdlog, "gdbsim_wait\n");
|
||||||
|
|
||||||
#if defined (HAVE_SIGACTION) && defined (SA_RESTART)
|
#if defined (HAVE_SIGACTION) && defined (SA_RESTART)
|
||||||
{
|
{
|
||||||
|
@ -1132,11 +1136,11 @@ gdbsim_files_info (struct target_ops *target)
|
||||||
file = bfd_get_filename (exec_bfd);
|
file = bfd_get_filename (exec_bfd);
|
||||||
|
|
||||||
if (remote_debug)
|
if (remote_debug)
|
||||||
printf_filtered ("gdbsim_files_info: file \"%s\"\n", file);
|
fprintf_unfiltered (gdb_stdlog, "gdbsim_files_info: file \"%s\"\n", file);
|
||||||
|
|
||||||
if (exec_bfd)
|
if (exec_bfd)
|
||||||
{
|
{
|
||||||
printf_filtered ("\tAttached to %s running program %s\n",
|
fprintf_unfiltered (gdb_stdlog, "\tAttached to %s running program %s\n",
|
||||||
target_shortname, file);
|
target_shortname, file);
|
||||||
sim_info (sim_data->gdbsim_desc, 0);
|
sim_info (sim_data->gdbsim_desc, 0);
|
||||||
}
|
}
|
||||||
|
@ -1151,7 +1155,7 @@ gdbsim_mourn_inferior (struct target_ops *target)
|
||||||
= get_sim_inferior_data (current_inferior (), SIM_INSTANCE_NOT_NEEDED);
|
= get_sim_inferior_data (current_inferior (), SIM_INSTANCE_NOT_NEEDED);
|
||||||
|
|
||||||
if (remote_debug)
|
if (remote_debug)
|
||||||
printf_filtered ("gdbsim_mourn_inferior:\n");
|
fprintf_unfiltered (gdb_stdlog, "gdbsim_mourn_inferior:\n");
|
||||||
|
|
||||||
remove_breakpoints ();
|
remove_breakpoints ();
|
||||||
generic_mourn_inferior ();
|
generic_mourn_inferior ();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue