/* Module support.
- Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
+
+ Copyright 1996-2019 Free Software Foundation, Inc.
+
Contributed by Cygnus Support.
This file is part of GDB, the GNU debugger.
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
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
+the Free Software Foundation; either version 3 of the License, or
+(at your option) any later version.
This program 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. */
+You should have received a copy of the GNU General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>. */
+#include "config.h"
#include "sim-main.h"
#include "sim-io.h"
#include "sim-options.h"
#include "sim-assert.h"
-/* start-sanitize-am30 */
#if WITH_HW
#include "sim-hw.h"
#endif
-/* end-sanitize-am30 */
+
+#ifdef HAVE_DV_SOCKSER
+/* TODO: Shouldn't have device models here. */
+#include "dv-sockser.h"
+#endif
#include "libiberty.h"
static MODULE_INSTALL_FN * const modules[] = {
standard_install,
sim_events_install,
-#if WITH_ENGINE
+ sim_model_install,
sim_engine_install,
-#endif
-#if WITH_TRACE
+#if WITH_TRACE_ANY_P
trace_install,
#endif
#if WITH_PROFILE
profile_install,
#endif
sim_core_install,
-#ifndef SIM_HAVE_FLATMEM
- /* FIXME: should handle flatmem as well FLATMEM */
sim_memopt_install,
-#endif
-#if WITH_WATCHPOINTS
sim_watchpoint_install,
-#endif
#if WITH_SCACHE
scache_install,
#endif
-#ifdef SIM_HAVE_MODEL
- sim_model_install,
-#endif
-#ifdef SIM_HAVE_BREAKPOINTS
- sim_break_install,
-#endif
- /* start-sanitize-am30 */
#if WITH_HW
sim_hw_install,
#endif
- /* end-sanitize-am30 */
- /* Configured in [simulator specific] additional modules. */
-#ifdef MODULE_LIST
- MODULE_LIST
+#ifdef HAVE_DV_SOCKSER
+ /* TODO: Shouldn't have device models here. */
+ dv_sockser_install,
#endif
0
};
SIM_ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER);
SIM_ASSERT (STATE_MODULES (sd) == NULL);
- STATE_MY_NAME (sd) = myname + strlen (myname);
- while (STATE_MY_NAME (sd) > myname && STATE_MY_NAME (sd)[-1] != '/')
- --STATE_MY_NAME (sd);
+ STATE_MY_NAME (sd) = lbasename (myname);
/* Set the cpu names to default values. */
{
for (i = 0; i < MAX_NR_PROCESSORS; ++i)
{
char *name;
- asprintf (&name, "cpu%d", i);
+ if (asprintf (&name, "cpu%d", i) < 0)
+ return SIM_RC_FAIL;
CPU_NAME (STATE_CPU (sd, i)) = name;
}
}
SIM_ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER);
SIM_ASSERT (STATE_MODULES (sd) != NULL);
- if (sim_module_init (sd) != SIM_RC_OK)
- return SIM_RC_FAIL;
-
/* Set the cpu->state backlinks for each cpu. */
for (i = 0; i < MAX_NR_PROCESSORS; ++i)
{
CPU_INDEX (STATE_CPU (sd, i)) = i;
}
+ if (sim_module_init (sd) != SIM_RC_OK)
+ return SIM_RC_FAIL;
+
return SIM_RC_OK;
}
\f
for (d = modules->init_list; d != NULL; d = n)
{
n = d->next;
- zfree (d);
+ free (d);
}
}
for (d = modules->resume_list; d != NULL; d = n)
{
n = d->next;
- zfree (d);
+ free (d);
}
}
for (d = modules->suspend_list; d != NULL; d = n)
{
n = d->next;
- zfree (d);
+ free (d);
}
}
for (d = modules->uninstall_list; d != NULL; d = n)
{
n = d->next;
- zfree (d);
+ free (d);
}
}
for (d = modules->info_list; d != NULL; d = n)
{
n = d->next;
- zfree (d);
+ free (d);
}
}
- zfree (modules);
+ free (modules);
STATE_MODULES (sd) = NULL;
}