Introduce common cleanup for restoring integers.

* defs.h (make_cleanup_restore_integer): New declaration.
        (struct cleanup): New field free_arg.
        (make_my_cleanup_2): New.
        * utils.c (restore_integer_closure, restore_integer)
        (make_cleanup_restore_integer): New.
        (make_my_cleanup): Initialize the free_arg field and
        renamed to make_my_cleanup_2.
        (do_my_cleanups): Call free_arg.
        (discard_cleanups): Call free_arg.
        * breakpoint.c (restore_always_inserted_mode): Remove.
        (update_breakpoints_after_exec): Use make_cleanup_restore_integer.
This commit is contained in:
Vladimir Prus
2008-06-10 09:29:15 +00:00
parent 3201a343ca
commit 0b080f5982
4 changed files with 69 additions and 11 deletions

View File

@ -1435,12 +1435,6 @@ reattach_breakpoints (int pid)
return 0;
}
static void
restore_always_inserted_mode (void *p)
{
always_inserted_mode = (uintptr_t) p;
}
void
update_breakpoints_after_exec (void)
{
@ -1456,8 +1450,7 @@ update_breakpoints_after_exec (void)
/* The binary we used to debug is now gone, and we're updating
breakpoints for the new binary. Until we're done, we should not
try to insert breakpoints. */
cleanup = make_cleanup (restore_always_inserted_mode,
(void *) (uintptr_t) always_inserted_mode);
cleanup = make_cleanup_restore_integer (&always_inserted_mode);
always_inserted_mode = 0;
ALL_BREAKPOINTS_SAFE (b, temp)