2002-11-22 Andrew Cagney <ac131313@redhat.com>
[deliverable/binutils-gdb.git] / sim / common / hw-base.c
index 3adef18dfa88e69c2b35202b5f98e83fd6c715e3..7fbe61ef1736df10cdd06cd35671f130e25164ad 100644 (file)
@@ -1,25 +1,28 @@
-/*  This file is part of the program psim.
+/* The common simulator framework for GDB, the GNU Debugger.
 
-    Copyright (C) 1994-1996, 1998, Andrew Cagney <cagney@highland.com.au>
+   Copyright 2002 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
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
+   Contributed by Andrew Cagney and Red Hat.
 
-    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.
-    */
+   This file is part of GDB.
 
+   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 of the License, or
+   (at your option) any later version.
 
-#include "sim-main.h"
+   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.  */
+
+
+#include "hw-main.h"
 #include "hw-base.h"
 
 
@@ -41,7 +44,7 @@
 
 struct hw_base_data {
   int finished_p;
-  const struct hw_device_descriptor *descriptor;
+  const struct hw_descriptor *descriptor;
   hw_delete_callback *to_delete;
 };
 
@@ -393,12 +396,12 @@ hw_create (struct sim_state *sd,
 
   /* locate a descriptor */
   {
-    const struct hw_device_descriptor **table;
+    const struct hw_descriptor **table;
     for (table = hw_descriptors;
         *table != NULL;
         table++)
       {
-       const struct hw_device_descriptor *entry;
+       const struct hw_descriptor *entry;
        for (entry = *table;
             entry->family != NULL;
             entry++)
@@ -421,6 +424,8 @@ hw_create (struct sim_state *sd,
   create_hw_property_data (hw);
   create_hw_port_data (hw);
   create_hw_event_data (hw);
+  create_hw_handle_data (hw);
+  create_hw_instance_data (hw);
   
   return hw;
 }
@@ -472,6 +477,8 @@ hw_delete (struct hw *me)
   /* give the object a chance to tidy up */
   me->base_of_hw->to_delete (me);
 
+  delete_hw_instance_data (me);
+  delete_hw_handle_data (me);
   delete_hw_event_data (me);
   delete_hw_port_data (me);
   delete_hw_property_data (me);
@@ -506,10 +513,15 @@ hw_delete (struct hw *me)
   delete_hw_alloc_data (me);
 
   /* finally */
-  zfree (me->base_of_hw);
   zfree (me);
 }
 
+void
+set_hw_delete (struct hw *hw, hw_delete_callback method)
+{
+  hw->base_of_hw->to_delete = method;
+}
+
 
 /* Go through the devices various reg properties for those that
    specify attach addresses */
This page took 0.024862 seconds and 4 git commands to generate.