Thu Sep 28 15:26:59 1995 steve chamberlain <sac@slash.cygnus.com>

* run.c: Moved to ../common.
	* interp.c (trap): Use gdb's callback interface.
	* Makefile.in: Updated.
This commit is contained in:
Steve Chamberlain 1995-09-28 22:39:36 +00:00
parent 69fd4fddca
commit c966ea3a50
3 changed files with 0 additions and 284 deletions

View file

@ -31,8 +31,6 @@ configure
configure.in
interp.c
gencode.c
run.1
run.c
syscall.h
Things-to-lose:

View file

@ -1,107 +0,0 @@
.\" Copyright (c) 1993 Free Software Foundation
.\" See section COPYING for conditions for redistribution
.TH run 1 "13oct1993" "GNU Tools" "GNU Tools"
.de BP
.sp
.ti -.2i
\(**
..
.SH NAME
run\(em\&Hitachi SH emulator
.SH SYNOPSIS
.hy 0
.na
.TP
.B run
.RB "[\|" \-v "\|]"
." .RB "[\|" \-t "\|]"
.RB "[\|" \-p
.IR freq "\|]"
.RB "[\|" \-m
.IR memory "\|]"
.I program
.ad b
.hy 1
.SH DESCRIPTION
Use `\|\c
.BI run " program"\c
\&\|' to execute a Hitachi SH binary by interpreting SH machine
instructions on your host computer.
.B run
is the same emulator used by GDB's `\|\c
.B target sim\c
\&\|' command. You can run it directly by executing
.B run
if you just want to see your program execute, and do not need any
debugger functionality. You can also use
.B run
to generate profiling information for analysis with
.BR gprof .
.SH OPTIONS
.TP
.B \-v
Verbose output. Display the name of the program to run before
execution; after execution, display the number of instructions
executed, the number of machine cycles emulated, the number of
pipeline stalls, the real time taken, the emulated execution time
taken, and a summary of how much profiling information was generated.
."
." .TP
." .B \-t
." `trace', calls a sim_trace routine that does nothing.
.TP
.BI \-p " freq"
Generate profile information (for use with
.B gprof\c
\&).
.I freq
is the profiling frequency. Write the profiling information to a file called
.BR gmon.out .
.TP
.BI \-m " memory"
Set the memory size for the emulated machine to two to the power
.IR memory .
The default value is 19, emulating a board with 524288 bytes of memory.
.PP
.SH "SEE ALSO"
.RB "`\|" gprof "\|'"
entry in
.B info\c
\&;
.RB "`\|" gdb "\|'"
entry in
.B info\c
\&;
.I
Using GDB: A Guide to the GNU Source-Level Debugger\c
, Richard M. Stallman and Roland H. Pesch.
.SH COPYING
Copyright (c) 1993 Free Software Foundation, Inc.
.PP
Permission is granted to make and distribute verbatim copies of
this manual provided the copyright notice and this permission notice
are preserved on all copies.
.PP
Permission is granted to copy and distribute modified versions of this
manual under the conditions for verbatim copying, provided that the
entire resulting derived work is distributed under the terms of a
permission notice identical to this one.
.PP
Permission is granted to copy and distribute translations of this
manual into another language, under the above conditions for modified
versions, except that this permission notice may be included in
translations approved by the Free Software Foundation instead of in
the original English.

View file

@ -1,175 +0,0 @@
/* run front end support for SH
Copyright (C) 1987, 1992 Free Software Foundation, Inc.
This file is part of SH SIM
GNU CC is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU CC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* Steve Chamberlain
sac@cygnus.com */
#include <signal.h>
#include <stdio.h>
#include <varargs.h>
#include "bfd.h"
#include "remote-sim.h"
#ifndef SIGQUIT
#define SIGQUIT SIGTERM
#endif
void usage();
extern int optind;
extern char *optarg;
int target_byte_order;
int
main (ac, av)
int ac;
char **av;
{
bfd *abfd;
bfd_vma start_address;
asection *s;
int i;
int verbose = 0;
int trace = 0;
char *name = "";
enum sim_stop reason;
int sigrc;
while ((i = getopt (ac, av, "m:p:s:tv")) != EOF)
switch (i)
{
case 'm':
sim_size (atoi (optarg));
break;
case 'p':
sim_set_profile (atoi (optarg));
break;
case 's':
sim_set_profile_size (atoi (optarg));
break;
case 't':
trace = 1;
break;
case 'v':
verbose = 1;
break;
default:
usage();
}
ac -= optind;
av += optind;
if (ac != 1)
usage();
name = *av;
if (verbose)
{
printf ("run %s\n", name);
}
abfd = bfd_openr (name, 0);
if (abfd)
{
if (bfd_check_format (abfd, bfd_object))
{
for (s = abfd->sections; s; s = s->next)
{
unsigned 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_create_inferior (start_address, NULL, NULL);
target_byte_order = abfd->xvec->byteorder_big_p ? 4321 : 1234;
if (trace)
{
int done = 0;
while (!done)
{
done = sim_trace ();
}
}
else
{
sim_resume (0, 0);
}
if (verbose)
sim_info (0);
sim_stop_reason (&reason, &sigrc);
/* Check to see if we left through the exit system call.
If we did, then we will have gotten a SIGQUIT and the exit
code is in r5. Otherwise, report the error number as the
exit code. */
if (sigrc == SIGQUIT)
{
unsigned char b[4];
sim_fetch_register (5, b);
return b[3];
}
else
return sigrc;
}
}
return 1;
}
void
usage()
{
fprintf (stderr, "usage: run [-tv] program\n");
exit (1);
}
/* Callbacks used by the simulator proper. */
void
printf_filtered (va_alist)
va_dcl
{
va_list args;
char *format;
va_start (args);
format = va_arg (args, char *);
vfprintf (stdout, format, args);
va_end (args);
}
int
sim_callback_write_stdout (arg, len)
char *arg;
int len;
{
return write (1, arg, len);
}