From: Steve Chamberlain Date: Tue, 1 Jun 1993 18:20:29 +0000 (+0000) Subject: Support for -v X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=1cec8dae6869feb51c1ac6c50386275431f3c574;p=binutils-gdb.git Support for -v --- diff --git a/sim/h8300/p3.c b/sim/h8300/p3.c index 0d8c2597c21..921f19133dd 100644 --- a/sim/h8300/p3.c +++ b/sim/h8300/p3.c @@ -69,3 +69,10 @@ ni++; SAVE_INTERPRETER_STATE(); } + + +sim_info() +{ + int cycles = saved_state.reg[CYCLES]; + printf("cycles (v approximate) %10d\n", cycles); +} diff --git a/sim/h8300/run.c b/sim/h8300/run.c index 59797ca79d4..a697465d01d 100644 --- a/sim/h8300/run.c +++ b/sim/h8300/run.c @@ -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; + if (strcmp (av[i], "-v") == 0) + { + verbose = 1; + } + else if (strcmp (av[i], "-t") == 0) + { + trace = 1; + } + + else + { + name = av[i]; + } } - else if (strcmp(av[i],"-t") == 0) + if (verbose) { - trace = 1; + printf ("run %s\n", name); } + abfd = bfd_openr (name, "coff-h8300"); - 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)) + 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)); + } - 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 (); - start_address = bfd_get_start_address(abfd); - sim_store_register( - 9,start_address); - sim_resume(0,0); - return 0; + return 0; + } } - } return 1; }