diff options
author | Steve Chamberlain <sac@cygnus> | 1993-06-01 18:20:29 +0000 |
---|---|---|
committer | Steve Chamberlain <sac@cygnus> | 1993-06-01 18:20:29 +0000 |
commit | 1cec8dae6869feb51c1ac6c50386275431f3c574 (patch) | |
tree | 821921085d388d9d4526f8bee40cccc6177f058a /sim | |
parent | d7df19a6c341aa5fb29f8d9454bd2774b5b6971f (diff) | |
download | binutils-1cec8dae6869feb51c1ac6c50386275431f3c574.zip binutils-1cec8dae6869feb51c1ac6c50386275431f3c574.tar.gz binutils-1cec8dae6869feb51c1ac6c50386275431f3c574.tar.bz2 |
Support for -v
Diffstat (limited to 'sim')
-rw-r--r-- | sim/h8300/p3.c | 7 | ||||
-rw-r--r-- | sim/h8300/run.c | 70 |
2 files changed, 44 insertions, 33 deletions
diff --git a/sim/h8300/p3.c b/sim/h8300/p3.c index 0d8c259..921f191 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 59797ca..a697465 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; } |