diff options
author | Stephane Carrez <stcarrez@nerim.fr> | 2000-11-25 09:18:52 +0000 |
---|---|---|
committer | Stephane Carrez <stcarrez@nerim.fr> | 2000-11-25 09:18:52 +0000 |
commit | ce13044d7a335947b721e7e83730a9f7d97de8e0 (patch) | |
tree | d5540213d0bb6e9c9dd55214fda2ea6bca419de2 | |
parent | 7c070881e4a395f2e803aef0254508ee7a9dda99 (diff) | |
download | gdb-ce13044d7a335947b721e7e83730a9f7d97de8e0.zip gdb-ce13044d7a335947b721e7e83730a9f7d97de8e0.tar.gz gdb-ce13044d7a335947b721e7e83730a9f7d97de8e0.tar.bz2 |
Fix for sim/common hw_delete()/hw_tree_delete()
-rw-r--r-- | sim/common/ChangeLog | 8 | ||||
-rw-r--r-- | sim/common/hw-alloc.c | 2 | ||||
-rw-r--r-- | sim/common/hw-base.c | 7 | ||||
-rw-r--r-- | sim/common/hw-base.h | 3 |
4 files changed, 15 insertions, 5 deletions
diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog index 831e274..473bb57 100644 --- a/sim/common/ChangeLog +++ b/sim/common/ChangeLog @@ -1,5 +1,13 @@ 2000-11-24 Stephane Carrez <Stephane.Carrez@worldnet.fr> + * hw-base.c (hw_delete): Don't free base_of_hw since it's freed. + (set_hw_delete): Moved the macro as a function. + * hw-base.h (set_hw_delete): Declare as external function. + * hw-alloc.c (delete_hw_alloc_data): Allow to free the memory + allocated using hw_malloc. + +2000-11-24 Stephane Carrez <Stephane.Carrez@worldnet.fr> + * sim-options.c (sim_parse_args): Free the memory used for long_options, short_options, handlers, opt_cpu, orig_val. diff --git a/sim/common/hw-alloc.c b/sim/common/hw-alloc.c index e64ae82..5664e9b 100644 --- a/sim/common/hw-alloc.c +++ b/sim/common/hw-alloc.c @@ -42,8 +42,6 @@ create_hw_alloc_data (struct hw *me) void delete_hw_alloc_data (struct hw *me) { - if (me->alloc_of_hw != NULL) - hw_abort (me, "hw-alloc botch"); while (me->alloc_of_hw != NULL) { hw_free (me, me->alloc_of_hw->alloc); diff --git a/sim/common/hw-base.c b/sim/common/hw-base.c index a13ac64..9c05da8 100644 --- a/sim/common/hw-base.c +++ b/sim/common/hw-base.c @@ -510,10 +510,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 */ diff --git a/sim/common/hw-base.h b/sim/common/hw-base.h index d6452d1..5760103 100644 --- a/sim/common/hw-base.h +++ b/sim/common/hw-base.h @@ -54,8 +54,7 @@ void hw_delete typedef void (hw_delete_callback) (struct hw *me); -#define set_hw_delete(hw, method) \ -((hw)->base_of_hw->to_delete = (method)) +extern void set_hw_delete(struct hw* hw, hw_delete_callback method); /* ALLOC */ |