summaryrefslogtreecommitdiff
path: root/sim/common
diff options
context:
space:
mode:
Diffstat (limited to 'sim/common')
-rw-r--r--sim/common/ChangeLog51
-rw-r--r--sim/common/Makefile.in4
-rw-r--r--sim/common/callback.c59
-rw-r--r--sim/common/dv-glue.c4
-rw-r--r--sim/common/hw-tree.c2
-rw-r--r--sim/common/run.c9
-rw-r--r--sim/common/sim-basics.h4
-rw-r--r--sim/common/sim-load.c8
-rw-r--r--sim/common/sim-options.c4
-rw-r--r--sim/common/syscall.c4
10 files changed, 116 insertions, 33 deletions
diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog
index d287cdfe245..0099da089e5 100644
--- a/sim/common/ChangeLog
+++ b/sim/common/ChangeLog
@@ -1,3 +1,54 @@
+2004-07-26 Andrew Cagney <cagney@gnu.org>
+
+ Problem from Olaf Hering <olh@suse.de>.
+ * Makefile.in (install-man, installdirs): Add DESTDIR prefix.
+
+2004-07-10 Ben Elliston <bje@au.ibm.com>
+
+ * hw-tree.c (parse_integer_property): Typo fix in comments.
+ * sim-options.c (sim_args_command): Likewise.
+
+2004-06-28 Andrew Cagney <cagney@gnu.org>
+
+ * run.c: Rename ui_loop_hook to deprecated_ui_loop_hook.
+
+2004-06-27 J"orn Rennecke <joern.rennecke@superh.com>
+
+ * callback.c (os_shutdown): Fix bug in last change: actually
+ mark file descriptors as available on startup.
+
+2004-06-25 J"orn Rennecke <joern.rennecke@superh.com>
+
+ [ include/gdb: * callback.h (host_callback_struct): Replace
+ members fdopen and alwaysopen with fd_buddy. ]
+ * callback.c: Changed all users.
+
+2004-06-15 Alan Modra <amodra@bigpond.net.au>
+
+ * sim-load.c (sim_load_file): Use bfd_get_section_size
+ instead of bfd_get_section_size_before_reloc.
+
+2004-05-18 Daniel Jacobowitz <dan@debian.org>
+
+ * dv-glue.c (hw_glue_finish): Cast result of sizeof to long before
+ passing it to printf.
+
+2004-05-10 Daniel Jacobowitz <dan@debian.org>
+
+ * callback.c: Update copyright dates.
+ * run.c: Likewise.
+ * sim-basics.h: Likewise.
+ * sim-load.c: Likewise.
+ * syscall.c: Likewise.
+
+2004-05-10 Maciej W. Rozycki <macro@ds2.pg.gda.pl>
+
+ * callback.c: Include cconfig.h instead of config.h.
+ * run.c: Likewise.
+ * sim-basics.h: Likewise.
+ * sim-load.c: Likewise.
+ * syscall.c: Likewise.
+
2004-01-16 Ben Elliston <bje@wasabisystems.com>
* Makefile.in (clean): Remove rm -f $(ALL), as $(ALL) is empty.
diff --git a/sim/common/Makefile.in b/sim/common/Makefile.in
index 915598c9c43..37c185077b6 100644
--- a/sim/common/Makefile.in
+++ b/sim/common/Makefile.in
@@ -119,10 +119,10 @@ install: install-man
install-man: installdirs
n=`echo run | sed '$(program_transform_name)'`; \
- $(INSTALL_DATA) $(srcdir)/run.1 $(man1dir)/$$n.1
+ $(INSTALL_DATA) $(srcdir)/run.1 $(DESTDIR)$(man1dir)/$$n.1
installdirs:
- $(SHELL) $(srcdir)/../../mkinstalldirs $(man1dir)
+ $(SHELL) $(srcdir)/../../mkinstalldirs $(DESTDIR)$(man1dir)
Makefile: Makefile.in config.status
$(SHELL) ./config.status
diff --git a/sim/common/callback.c b/sim/common/callback.c
index aa2cf076bd3..ca707fc18cd 100644
--- a/sim/common/callback.c
+++ b/sim/common/callback.c
@@ -1,5 +1,6 @@
/* Remote target callback routines.
- Copyright 1995, 1996, 1997 Free Software Foundation, Inc.
+ Copyright 1995, 1996, 1997, 2000, 2002, 2003, 2004
+ Free Software Foundation, Inc.
Contributed by Cygnus Solutions.
This file is part of GDB.
@@ -22,7 +23,7 @@
level. */
#ifdef HAVE_CONFIG_H
-#include "config.h"
+#include "cconfig.h"
#endif
#include "ansidecl.h"
#ifdef ANSI_PROTOTYPES
@@ -109,7 +110,7 @@ fdbad (p, fd)
host_callback *p;
int fd;
{
- if (fd < 0 || fd > MAX_CALLBACK_FDS || !p->fdopen[fd])
+ if (fd < 0 || fd > MAX_CALLBACK_FDS || p->fd_buddy[fd] < 0)
{
p->last_errno = EINVAL;
return -1;
@@ -131,13 +132,20 @@ os_close (p, fd)
int fd;
{
int result;
+ int i, next;
result = fdbad (p, fd);
if (result)
return result;
- result = wrap (p, close (fdmap (p, fd)));
- if (result == 0 && !p->alwaysopen[fd])
- p->fdopen[fd] = 0;
+ /* If this file descripter has one or more buddies (originals /
+ duplicates from a dup), just remove it from the circular list. */
+ for (i = fd; (next = p->fd_buddy[i]) != fd; )
+ i = next;
+ if (fd != i)
+ p->fd_buddy[i] = p->fd_buddy[fd];
+ else
+ result = wrap (p, close (fdmap (p, fd)));
+ p->fd_buddy[fd] = -1;
return result;
}
@@ -233,7 +241,7 @@ os_open (p, name, flags)
int i;
for (i = 0; i < MAX_CALLBACK_FDS; i++)
{
- if (!p->fdopen[i])
+ if (p->fd_buddy[i] < 0)
{
int f = open (name, cb_target_to_host_open (p, flags), 0644);
if (f < 0)
@@ -241,7 +249,7 @@ os_open (p, name, flags)
p->last_errno = errno;
return f;
}
- p->fdopen[i] = 1;
+ p->fd_buddy[i] = i;
p->fdmap[i] = f;
return i;
}
@@ -427,13 +435,32 @@ static int
os_shutdown (p)
host_callback *p;
{
- int i;
+ int i, next, j;
for (i = 0; i < MAX_CALLBACK_FDS; i++)
{
- if (p->fdopen[i] && !p->alwaysopen[i]) {
+ int do_close = 1;
+
+ next = p->fd_buddy[i];
+ if (next < 0)
+ continue;
+ do
+ {
+ j = next;
+ if (j == MAX_CALLBACK_FDS)
+ do_close = 0;
+ next = p->fd_buddy[j];
+ p->fd_buddy[j] = -1;
+ /* At the initial call of os_init, we got -1, 0, 0, 0, ... */
+ if (next < 0)
+ {
+ p->fd_buddy[i] = -1;
+ do_close = 0;
+ break;
+ }
+ }
+ while (j != i);
+ if (do_close)
close (p->fdmap[i]);
- p->fdopen[i] = 0;
- }
}
return 1;
}
@@ -448,9 +475,10 @@ os_init (p)
for (i = 0; i < 3; i++)
{
p->fdmap[i] = i;
- p->fdopen[i] = 1;
- p->alwaysopen[i] = 1;
+ p->fd_buddy[i] = i - 1;
}
+ p->fd_buddy[0] = MAX_CALLBACK_FDS;
+ p->fd_buddy[MAX_CALLBACK_FDS] = 2;
p->syscall_map = cb_init_syscall_map;
p->errno_map = cb_init_errno_map;
@@ -579,8 +607,7 @@ host_callback default_callback =
0, /* last errno */
{ 0, }, /* fdmap */
- { 0, }, /* fdopen */
- { 0, }, /* alwaysopen */
+ { -1, }, /* fd_buddy */
0, /* syscall_map */
0, /* errno_map */
diff --git a/sim/common/dv-glue.c b/sim/common/dv-glue.c
index ab04fe737b2..1a94ae6c162 100644
--- a/sim/common/dv-glue.c
+++ b/sim/common/dv-glue.c
@@ -222,7 +222,7 @@ hw_glue_finish (struct hw *me)
hw_abort (me, "at least one reg property size must be nonzero");
if (glue->sizeof_output % sizeof (unsigned_word) != 0)
hw_abort (me, "reg property size must be %ld aligned",
- sizeof (unsigned_word));
+ (long) sizeof (unsigned_word));
/* and the address */
hw_unit_address_to_attach_address (hw_parent (me),
&unit.address,
@@ -231,7 +231,7 @@ hw_glue_finish (struct hw *me)
me);
if (glue->address % (sizeof (unsigned_word) * max_nr_ports) != 0)
hw_abort (me, "reg property address must be %ld aligned",
- sizeof (unsigned_word) * max_nr_ports);
+ (long) (sizeof (unsigned_word) * max_nr_ports));
glue->nr_outputs = glue->sizeof_output / sizeof (unsigned_word);
glue->output = hw_zalloc (me, glue->sizeof_output);
}
diff --git a/sim/common/hw-tree.c b/sim/common/hw-tree.c
index 99303564542..f228c69edec 100644
--- a/sim/common/hw-tree.c
+++ b/sim/common/hw-tree.c
@@ -638,7 +638,7 @@ parse_integer_property (struct hw *current,
{
H2BE (words[i]);
}
- /* perhaphs integer array property is better */
+ /* perhaps integer array property is better */
hw_add_array_property (current, property_name, words,
sizeof(words[0]) * nr_entries);
}
diff --git a/sim/common/run.c b/sim/common/run.c
index 79642007618..a88e404a581 100644
--- a/sim/common/run.c
+++ b/sim/common/run.c
@@ -1,5 +1,6 @@
/* run front end support for all the simulators.
- Copyright (C) 1992, 93-96, 1997, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
+ 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -18,8 +19,10 @@ with this program; if not, write to the Free Software Foundation, Inc.,
/* Steve Chamberlain sac@cygnus.com,
and others at Cygnus. */
-#include "config.h"
+#ifdef HAVE_CONFIG_H
+#include "cconfig.h"
#include "tconfig.h"
+#endif
#include <signal.h>
#include <stdio.h>
@@ -60,7 +63,7 @@ extern int getopt ();
#ifdef NEED_UI_LOOP_HOOK
/* Gdb foolery. This is only needed for gdb using a gui. */
-int (*ui_loop_hook) PARAMS ((int signo));
+int (*deprecated_ui_loop_hook) PARAMS ((int signo));
#endif
static SIM_DESC sd;
diff --git a/sim/common/sim-basics.h b/sim/common/sim-basics.h
index be6cb9e90ac..b140566e2bf 100644
--- a/sim/common/sim-basics.h
+++ b/sim/common/sim-basics.h
@@ -1,6 +1,6 @@
/* The common simulator framework for GDB, the GNU Debugger.
- Copyright 2002 Free Software Foundation, Inc.
+ Copyright 2002, 2004 Free Software Foundation, Inc.
Contributed by Andrew Cagney and Red Hat.
@@ -29,7 +29,7 @@
/* Basic configuration */
#ifdef HAVE_CONFIG_H
-#include "config.h"
+#include "cconfig.h"
#endif
/* Basic host dependant mess - hopefully <stdio.h> + <stdarg.h> will
diff --git a/sim/common/sim-load.c b/sim/common/sim-load.c
index 314d2dd173c..5fc4c986c67 100644
--- a/sim/common/sim-load.c
+++ b/sim/common/sim-load.c
@@ -1,5 +1,5 @@
/* Utility to load a file into the simulator.
- Copyright (C) 1997 Free Software Foundation, Inc.
+ Copyright (C) 1997, 1998, 2001, 2002, 2004 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -19,7 +19,9 @@ along with this program; if not, write to the Free Software Foundation, Inc.,
as it is used by simulators that don't use it [though that doesn't mean
to suggest that they shouldn't :-)]. */
-#include "config.h"
+#ifdef HAVE_CONFIG_H
+#include "cconfig.h"
+#endif
#include "ansidecl.h"
#include <stdio.h> /* for NULL */
#ifdef ANSI_PROTOTYPES
@@ -110,7 +112,7 @@ sim_load_file (sd, myname, callback, prog, prog_bfd, verbose_p, lma_p, do_write)
{
bfd_size_type size;
- size = bfd_get_section_size_before_reloc (s);
+ size = bfd_get_section_size (s);
if (size > 0)
{
char *buffer;
diff --git a/sim/common/sim-options.c b/sim/common/sim-options.c
index 94d0de4bd7d..789ec2a6b32 100644
--- a/sim/common/sim-options.c
+++ b/sim/common/sim-options.c
@@ -898,7 +898,7 @@ sim_args_command (SIM_DESC sd, char *cmd)
{
/* something to do? */
if (cmd == NULL)
- return SIM_RC_OK; /* FIXME - perhaphs help would be better */
+ return SIM_RC_OK; /* FIXME - perhaps help would be better */
if (cmd [0] == '-')
{
@@ -916,7 +916,7 @@ sim_args_command (SIM_DESC sd, char *cmd)
sim_cpu *cpu;
if (argv [0] == NULL)
- return SIM_RC_OK; /* FIXME - perhaphs help would be better */
+ return SIM_RC_OK; /* FIXME - perhaps help would be better */
/* First check for a cpu selector. */
{
diff --git a/sim/common/syscall.c b/sim/common/syscall.c
index 75121cf2fc4..04dc71e8971 100644
--- a/sim/common/syscall.c
+++ b/sim/common/syscall.c
@@ -1,5 +1,5 @@
/* Remote target system call support.
- Copyright 1997, 1998 Free Software Foundation, Inc.
+ Copyright 1997, 1998, 2002, 2004 Free Software Foundation, Inc.
Contributed by Cygnus Solutions.
This file is part of GDB.
@@ -25,7 +25,7 @@
supported. */
#ifdef HAVE_CONFIG_H
-#include "config.h"
+#include "cconfig.h"
#endif
#include "ansidecl.h"
#include "libiberty.h"