aboutsummaryrefslogtreecommitdiff
path: root/gdb/callback.c
diff options
context:
space:
mode:
authorJim Wilson <wilson@tuliptree.org>1995-10-06 19:06:13 +0000
committerJim Wilson <wilson@tuliptree.org>1995-10-06 19:06:13 +0000
commitabf6a9dc4ebf206e0e9d619a1e2a700a60d068ff (patch)
treec4c8a9a0ded76026cb7086df7e8bfa301f37a210 /gdb/callback.c
parent6834d4935c454c3e0ba4280b4dd04182a8aadb89 (diff)
downloadgdb-abf6a9dc4ebf206e0e9d619a1e2a700a60d068ff.zip
gdb-abf6a9dc4ebf206e0e9d619a1e2a700a60d068ff.tar.gz
gdb-abf6a9dc4ebf206e0e9d619a1e2a700a60d068ff.tar.bz2
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.
Diffstat (limited to 'gdb/callback.c')
-rw-r--r--gdb/callback.c44
1 files changed, 37 insertions, 7 deletions
diff --git a/gdb/callback.c b/gdb/callback.c
index b878f77..d59ecda 100644
--- a/gdb/callback.c
+++ b/gdb/callback.c
@@ -56,7 +56,7 @@ wrap (p, 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. */
static int
@@ -85,7 +85,13 @@ os_close (p, fd)
host_callback *p;
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
@@ -102,7 +108,13 @@ os_isatty (p, fd)
host_callback *p;
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
@@ -112,7 +124,13 @@ os_lseek (p, fd, off, way)
long off;
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
@@ -148,7 +166,13 @@ os_read (p, fd, buf, len)
char *buf;
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
@@ -167,7 +191,13 @@ os_write (p, fd, buf, len)
const char *buf;
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. */
@@ -178,7 +208,7 @@ os_write_stdout (p, buf, len)
int len;
{
#ifdef INSIDE_SIMULATOR
- return os_write (1, buf, len);
+ return os_write (p, 1, buf, len);
#else
int i;
char b[2];