mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2025-01-21 15:33:33 +08:00
Update rx sim so that it'll print load statistics.
This commit is contained in:
parent
636b802b4e
commit
d98bfeb023
@ -1,3 +1,16 @@
|
||||
2012-03-02 Kevin Buettner <kevinb@redhat.com>
|
||||
|
||||
* load.h (rx_load): Add `callback' parameter to function prototype.
|
||||
(gdb/callback.h): Include.
|
||||
* load.c (load.h): Include.
|
||||
(xprintf, find_section_name_by_offset): New functions.
|
||||
(rx_load): Add `callback' parameter. Add code for printing
|
||||
section loaded using GDB's printf facilities.
|
||||
* gdb-if.c (sim_load, sim_create_inferior): Update calls to
|
||||
rx_load().
|
||||
* main.c (main): Likewise.
|
||||
* syscalls.c, syscalls.h (get_callbacks): New function.
|
||||
|
||||
2011-12-03 Mike Frysinger <vapier@gentoo.org>
|
||||
|
||||
* aclocal.m4: New file.
|
||||
|
@ -201,7 +201,7 @@ sim_load (SIM_DESC sd, char *prog, struct bfd *abfd, int from_tty)
|
||||
if (!abfd)
|
||||
return SIM_RC_FAIL;
|
||||
|
||||
rx_load (abfd);
|
||||
rx_load (abfd, get_callbacks ());
|
||||
build_swap_list (abfd);
|
||||
|
||||
return SIM_RC_OK;
|
||||
@ -214,7 +214,7 @@ sim_create_inferior (SIM_DESC sd, struct bfd *abfd, char **argv, char **env)
|
||||
|
||||
if (abfd)
|
||||
{
|
||||
rx_load (abfd);
|
||||
rx_load (abfd, NULL);
|
||||
build_swap_list (abfd);
|
||||
}
|
||||
|
||||
|
@ -28,9 +28,36 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
#include "libbfd.h"
|
||||
#include "cpu.h"
|
||||
#include "mem.h"
|
||||
#include "load.h"
|
||||
#include "elf/internal.h"
|
||||
#include "elf/common.h"
|
||||
|
||||
/* Helper function for invoking a GDB-specified printf. */
|
||||
static void
|
||||
xprintf (host_callback *callback, const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
va_start (ap, fmt);
|
||||
|
||||
(*callback->vprintf_filtered) (callback, fmt, ap);
|
||||
|
||||
va_end (ap);
|
||||
}
|
||||
|
||||
/* Given a file offset, look up the section name. */
|
||||
static const char *
|
||||
find_section_name_by_offset (bfd *abfd, file_ptr filepos)
|
||||
{
|
||||
asection *s;
|
||||
|
||||
for (s = abfd->sections; s; s = s->next)
|
||||
if (s->filepos == filepos)
|
||||
return bfd_get_section_name (abfd, s);
|
||||
|
||||
return "(unknown)";
|
||||
}
|
||||
|
||||
/* A note about endianness and swapping...
|
||||
|
||||
The RX chip is CISC-like in that the opcodes are variable length
|
||||
@ -56,7 +83,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
encoded in little-endian format. */
|
||||
|
||||
void
|
||||
rx_load (bfd *prog)
|
||||
rx_load (bfd *prog, host_callback *callback)
|
||||
{
|
||||
unsigned long highest_addr_loaded = 0;
|
||||
Elf_Internal_Phdr * phdrs;
|
||||
@ -105,6 +132,11 @@ rx_load (bfd *prog)
|
||||
if (verbose > 1)
|
||||
fprintf (stderr, "[load segment: lma=%08x vma=%08x size=%08x]\n",
|
||||
(int) base, (int) p->p_vaddr, (int) size);
|
||||
if (callback)
|
||||
xprintf (callback,
|
||||
"Loading section %s, size %#lx lma %08lx vma %08lx\n",
|
||||
find_section_name_by_offset (prog, p->p_offset),
|
||||
size, base, p->p_vaddr);
|
||||
|
||||
buf = malloc (size);
|
||||
if (buf == NULL)
|
||||
|
@ -20,8 +20,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
|
||||
#include "bfd.h"
|
||||
#include "gdb/callback.h"
|
||||
|
||||
extern int default_machine;
|
||||
|
||||
void rx_set_mach (int mach);
|
||||
void rx_load (bfd *);
|
||||
void rx_load (bfd *, host_callback *callback);
|
||||
|
@ -174,7 +174,7 @@ main (int argc, char **argv)
|
||||
rx_in_gdb = 0;
|
||||
save_trace = trace;
|
||||
trace = 0;
|
||||
rx_load (prog);
|
||||
rx_load (prog, NULL);
|
||||
trace = save_trace;
|
||||
|
||||
sim_disasm_init (prog);
|
||||
|
@ -43,6 +43,12 @@ set_callbacks (struct host_callback_struct *cb)
|
||||
callbacks = cb;
|
||||
}
|
||||
|
||||
struct host_callback_struct *
|
||||
get_callbacks (void)
|
||||
{
|
||||
return callbacks;
|
||||
}
|
||||
|
||||
|
||||
/* Arguments 1..4 are in R1..R4, remainder on stack.
|
||||
|
||||
|
@ -21,4 +21,5 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
struct host_callback_struct;
|
||||
extern void set_callbacks (struct host_callback_struct *);
|
||||
extern struct host_callback_struct * get_callbacks (void);
|
||||
extern int rx_syscall (int id);
|
||||
|
Loading…
Reference in New Issue
Block a user