Changes to make the simulator work again.
* callback.c (fdbad): Fix typo in comment. (os_close, os_isatty, os_lseek, os_read, os_write): Use if statements rather than || to get correct return value. (os_write_stdout): Pass missing first argument to os_write. * remote-sim.c: Include callback.h. (_initialize_remote_sim): Call sim_set_callbacks and then initialize the callbacks.
This commit is contained in:
parent
6834d4935c
commit
abf6a9dc4e
|
@ -1,3 +1,13 @@
|
||||||
|
Fri Oct 6 11:56:49 1995 Jim Wilson <wilson@chestnut.cygnus.com>
|
||||||
|
|
||||||
|
* callback.c (fdbad): Fix typo in comment.
|
||||||
|
(os_close, os_isatty, os_lseek, os_read, os_write): Use if statements
|
||||||
|
rather than || to get correct return value.
|
||||||
|
(os_write_stdout): Pass missing first argument to os_write.
|
||||||
|
* remote-sim.c: Include callback.h.
|
||||||
|
(_initialize_remote_sim): Call sim_set_callbacks and then initialize
|
||||||
|
the callbacks.
|
||||||
|
|
||||||
Thu Oct 5 17:28:09 1995 Per Bothner <bothner@kalessin.cygnus.com>
|
Thu Oct 5 17:28:09 1995 Per Bothner <bothner@kalessin.cygnus.com>
|
||||||
|
|
||||||
* values.c allocate_repeat_value): Allocate an array type, and
|
* values.c allocate_repeat_value): Allocate an array type, and
|
||||||
|
|
|
@ -56,7 +56,7 @@ wrap (p, val)
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Make sure the FD provided is ok. If not, return non -1
|
/* Make sure the FD provided is ok. If not, return non-zero
|
||||||
and set errno. */
|
and set errno. */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -85,7 +85,13 @@ os_close (p, fd)
|
||||||
host_callback *p;
|
host_callback *p;
|
||||||
int fd;
|
int fd;
|
||||||
{
|
{
|
||||||
return fdbad (p, fd) || wrap (p, close (fdmap (p, fd)));
|
int result;
|
||||||
|
|
||||||
|
result = fdbad (p, fd);
|
||||||
|
if (result)
|
||||||
|
return result;
|
||||||
|
result = wrap (p, close (fdmap (p, fd)));
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -102,7 +108,13 @@ os_isatty (p, fd)
|
||||||
host_callback *p;
|
host_callback *p;
|
||||||
int fd;
|
int fd;
|
||||||
{
|
{
|
||||||
return fdbad (p, fd) || wrap (p, isatty (fdmap (fd)));
|
int result;
|
||||||
|
|
||||||
|
result = fdbad (p, fd);
|
||||||
|
if (result)
|
||||||
|
return result;
|
||||||
|
result = wrap (p, isatty (fdmap (fd)));
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -112,7 +124,13 @@ os_lseek (p, fd, off, way)
|
||||||
long off;
|
long off;
|
||||||
int way;
|
int way;
|
||||||
{
|
{
|
||||||
return fdbad (p, fd) || lseek (fdmap (p, fd), off, way);
|
int result;
|
||||||
|
|
||||||
|
result = fdbad (p, fd);
|
||||||
|
if (result)
|
||||||
|
return result;
|
||||||
|
result = lseek (fdmap (p, fd), off, way);
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -148,7 +166,13 @@ os_read (p, fd, buf, len)
|
||||||
char *buf;
|
char *buf;
|
||||||
int len;
|
int len;
|
||||||
{
|
{
|
||||||
return fdbad (p, fd) || wrap (p, read (fdmap (p, fd), buf, len));
|
int result;
|
||||||
|
|
||||||
|
result = fdbad (p, fd);
|
||||||
|
if (result)
|
||||||
|
return result;
|
||||||
|
result = wrap (p, read (fdmap (p, fd), buf, len));
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -167,7 +191,13 @@ os_write (p, fd, buf, len)
|
||||||
const char *buf;
|
const char *buf;
|
||||||
int len;
|
int len;
|
||||||
{
|
{
|
||||||
return fdbad (p, fd) || wrap (p, write (fdmap (p, fd), buf, len));
|
int result;
|
||||||
|
|
||||||
|
result = fdbad (p, fd);
|
||||||
|
if (result)
|
||||||
|
return result;
|
||||||
|
result = wrap (p, write (fdmap (p, fd), buf, len));
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ignore the grossness of INSIDE_SIMULATOR, it will go away one day. */
|
/* ignore the grossness of INSIDE_SIMULATOR, it will go away one day. */
|
||||||
|
@ -178,7 +208,7 @@ os_write_stdout (p, buf, len)
|
||||||
int len;
|
int len;
|
||||||
{
|
{
|
||||||
#ifdef INSIDE_SIMULATOR
|
#ifdef INSIDE_SIMULATOR
|
||||||
return os_write (1, buf, len);
|
return os_write (p, 1, buf, len);
|
||||||
#else
|
#else
|
||||||
int i;
|
int i;
|
||||||
char b[2];
|
char b[2];
|
||||||
|
|
|
@ -34,6 +34,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||||
#include "gdbcore.h"
|
#include "gdbcore.h"
|
||||||
#include "remote-sim.h"
|
#include "remote-sim.h"
|
||||||
#include "remote-utils.h"
|
#include "remote-utils.h"
|
||||||
|
#include "callback.h"
|
||||||
|
|
||||||
/* Naming convention:
|
/* Naming convention:
|
||||||
|
|
||||||
|
@ -459,4 +460,7 @@ _initialize_remote_sim ()
|
||||||
|
|
||||||
add_com ("sim <command>", class_obscure, simulator_command,
|
add_com ("sim <command>", class_obscure, simulator_command,
|
||||||
"Send a command to the simulator.");
|
"Send a command to the simulator.");
|
||||||
|
|
||||||
|
sim_set_callbacks (&default_callback);
|
||||||
|
default_callback.init (&default_callback);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue