From cb08cc53a94b7b878df56545bddfff940bb90d20 Mon Sep 17 00:00:00 2001 From: Jan Kratochvil Date: Fri, 14 Oct 2011 07:55:26 +0000 Subject: gdb/ * defs.h (struct so_list): New forward declaration. (make_cleanup_free_so): New declaration. * solib-svr4.c (ignore_first_link_map_entry): Remove. (svr4_free_so): Move the function here from downwards. Handle NULL so->lm_info. (svr4_free_library_list): New. (svr4_read_so_list): New, moved here code from svr4_current_sos. Use more cleanups. Use new parameter ignore_first instead of ignore_first_link_map_entry. (svr4_current_sos): New variable ignore_first, initialize it. New variable back_to, use it for svr4_free_library_list protection. (svr4_free_so): Remove - move upwards. * utils.c: Include solist.h. (do_free_so, make_cleanup_free_so): New functions. --- gdb/utils.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'gdb/utils.c') diff --git a/gdb/utils.c b/gdb/utils.c index 4a0b5a2..5c03e71 100644 --- a/gdb/utils.c +++ b/gdb/utils.c @@ -60,6 +60,7 @@ #include "gdbcore.h" #include "top.h" #include "main.h" +#include "solist.h" #include "inferior.h" /* for signed_pointer_to_address */ @@ -495,6 +496,24 @@ make_cleanup_value_free (struct value *value) return make_my_cleanup (&cleanup_chain, do_value_free, value); } +/* Helper for make_cleanup_free_so. */ + +static void +do_free_so (void *arg) +{ + struct so_list *so = arg; + + free_so (so); +} + +/* Make cleanup handler calling free_so for SO. */ + +struct cleanup * +make_cleanup_free_so (struct so_list *so) +{ + return make_my_cleanup (&cleanup_chain, do_free_so, so); +} + struct cleanup * make_my_cleanup2 (struct cleanup **pmy_chain, make_cleanup_ftype *function, void *arg, void (*free_arg) (void *)) -- cgit v1.1