Support for -v

This commit is contained in:
Steve Chamberlain 1993-06-01 18:20:29 +00:00
parent d7df19a6c3
commit 1cec8dae68
2 changed files with 47 additions and 36 deletions

View File

@ -69,3 +69,10 @@ ni++;
SAVE_INTERPRETER_STATE();
}
sim_info()
{
int cycles = saved_state.reg[CYCLES];
printf("cycles (v approximate) %10d\n", cycles);
}

View File

@ -22,9 +22,9 @@
#include "sysdep.h"
int
main(ac,av)
int ac;
char **av;
main (ac, av)
int ac;
char **av;
{
bfd *abfd;
bfd_vma start_address;
@ -34,45 +34,49 @@ char **av;
int trace = 0;
char *name = "";
for (i = 1; i < ac; i++)
{
if (strcmp(av[i],"-v") == 0)
{
verbose = 1;
}
else if (strcmp(av[i],"-t") == 0)
{
trace = 1;
}
if (strcmp (av[i], "-v") == 0)
{
verbose = 1;
}
else if (strcmp (av[i], "-t") == 0)
{
trace = 1;
}
else
{
name = av[i];
else
{
name = av[i];
}
}
}
if (verbose)
{
printf("run %s\n", name);
}
abfd = bfd_openr(name,"coff-h8300");
if (abfd) {
if (bfd_check_format(abfd, bfd_object))
{
for (s = abfd->sections; s; s=s->next)
{
char *buffer = malloc(bfd_section_size(abfd,s));
bfd_get_section_contents(abfd, s, buffer, 0, bfd_section_size(abfd,s));
sim_write(s->vma, buffer, bfd_section_size(abfd,s));
}
start_address = bfd_get_start_address(abfd);
sim_store_register(
9,start_address);
sim_resume(0,0);
return 0;
printf ("run %s\n", name);
}
abfd = bfd_openr (name, "coff-h8300");
if (abfd)
{
if (bfd_check_format (abfd, bfd_object))
{
for (s = abfd->sections; s; s = s->next)
{
char *buffer = malloc (bfd_section_size (abfd, s));
bfd_get_section_contents (abfd, s, buffer, 0, bfd_section_size (abfd, s));
sim_write (s->vma, buffer, bfd_section_size (abfd, s));
}
start_address = bfd_get_start_address (abfd);
sim_store_register (
9, start_address);
sim_resume (0, 0);
if (verbose)
sim_info ();
return 0;
}
}
}
return 1;
}