aboutsummaryrefslogtreecommitdiff
path: root/sim/h8300/compile.c
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>1997-08-25 23:14:25 +0000
committerAndrew Cagney <cagney@redhat.com>1997-08-25 23:14:25 +0000
commit247fccdeb54a09a14287b2e829511803ad9d7cc1 (patch)
treec992df7132ca0c315cbcfd5ad81bbc4f16675936 /sim/h8300/compile.c
parent04f295b64859a6c6b01739fc4dd7fddce42db8d9 (diff)
downloadgdb-247fccdeb54a09a14287b2e829511803ad9d7cc1.zip
gdb-247fccdeb54a09a14287b2e829511803ad9d7cc1.tar.gz
gdb-247fccdeb54a09a14287b2e829511803ad9d7cc1.tar.bz2
Add ABFD argument to sim_open call. Pass through to sim_config so
that image properties such as endianness can be checked. More strongly document the expected behavour of each of the sim_* interfaces. Add default endian argument to simulator config macro SIM_AC_OPTION_ENDIAN. Use in sim_config.
Diffstat (limited to 'sim/h8300/compile.c')
-rw-r--r--sim/h8300/compile.c46
1 files changed, 22 insertions, 24 deletions
diff --git a/sim/h8300/compile.c b/sim/h8300/compile.c
index 4973ed7..b498968 100644
--- a/sim/h8300/compile.c
+++ b/sim/h8300/compile.c
@@ -916,6 +916,15 @@ case O(name, SB): \
if(s) store (&code->dst,ea); goto next; \
}
+int
+sim_stop (sd)
+ SIM_DESC sd;
+{
+ cpu.state = SIM_STATE_STOPPED;
+ cpu.exception = SIGINT;
+ return 1;
+}
+
void
sim_resume (sd, step, siggnal)
SIM_DESC sd;
@@ -1705,29 +1714,13 @@ sim_resume (sd, step, siggnal)
;
/* if (cpu.regs[8] ) abort(); */
-#if defined (WIN32)
- /* Poll after every 100th insn, */
if (poll_count++ > 100)
{
poll_count = 0;
- if (win32pollquit())
- {
- control_c();
- }
+ if ((*sim_callback->poll_quit) != NULL
+ && (*sim_callback->poll_quit) (sim_callback))
+ sim_stop (sd);
}
-#endif
-#if defined(__GO32__)
- /* Poll after every 100th insn, */
- if (poll_count++ > 100)
- {
- poll_count = 0;
- if (kbhit ())
- {
- int c = getkey ();
- control_c ();
- }
- }
-#endif
}
while (cpu.state == SIM_STATE_RUNNING);
@@ -2027,12 +2020,15 @@ sim_kill (sd)
}
SIM_DESC
-sim_open (kind,argv)
+sim_open (kind, ptr, abfd, argv)
SIM_OPEN_KIND kind;
+ struct host_callback_struct *ptr;
+ struct _bfd *abfd;
char **argv;
{
sim_kind = kind;
myname = argv[0];
+ sim_callback = ptr;
/* fudge our descriptor */
return (SIM_DESC) 1;
}
@@ -2065,10 +2061,13 @@ sim_load (sd, prog, abfd, from_tty)
prog_bfd = bfd_openr (prog, "coff-h8300");
if (prog_bfd != NULL)
{
+ /* Set the cpu type. We ignore failure from bfd_check_format
+ and bfd_openr as sim_load_file checks too. */
if (bfd_check_format (prog_bfd, bfd_object))
{
- set_h8300h (prog_bfd->arch_info->mach == bfd_mach_h8300h
- || prog_bfd->arch_info->mach == bfd_mach_h8300s);
+ unsigned long mach = bfd_get_mach (prog_bfd);
+ set_h8300h (mach == bfd_mach_h8300h
+ || mach == bfd_mach_h8300s);
}
}
@@ -2143,8 +2142,7 @@ sim_do_command (sd, cmd)
}
void
-sim_set_callbacks (sd, ptr)
- SIM_DESC sd;
+sim_set_callbacks (ptr)
struct host_callback_struct *ptr;
{
sim_callback = ptr;