aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2019-01-24 06:41:12 -0700
committerTom Tromey <tom@tromey.com>2019-03-06 16:04:31 -0700
commit2b6ff1c0474fca286b95be7ae9dcc5a22ff2a0b9 (patch)
treea5ec7413187147ce8006d6ddaa7e56490c45c088 /gdb
parentd01c5877664024043f4e5920d072c5f62fc7f89a (diff)
downloadgdb-2b6ff1c0474fca286b95be7ae9dcc5a22ff2a0b9.zip
gdb-2b6ff1c0474fca286b95be7ae9dcc5a22ff2a0b9.tar.gz
gdb-2b6ff1c0474fca286b95be7ae9dcc5a22ff2a0b9.tar.bz2
Remove last cleanups from solib-svr4.c
This removes the last cleanups from solib-svr4.c, replacing them with uses of make_scope_exit. 2019-03-06 Tom Tromey <tom@tromey.com> * solib-svr4.c (svr4_parse_libraries, svr4_current_sos_direct): Use make_scope_exit.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/solib-svr4.c17
2 files changed, 15 insertions, 7 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index e7c6a18..0a3698e 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@
2019-03-06 Tom Tromey <tom@tromey.com>
+ * solib-svr4.c (svr4_parse_libraries, svr4_current_sos_direct):
+ Use make_scope_exit.
+
+2019-03-06 Tom Tromey <tom@tromey.com>
+
* solib-svr4.c (disable_probes_interface): Remove parameter.
(svr4_handle_solib_event): Use make_scope_exit.
diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c
index 2b370ef..84693c1 100644
--- a/gdb/solib-svr4.c
+++ b/gdb/solib-svr4.c
@@ -1198,8 +1198,10 @@ static const struct gdb_xml_element svr4_library_list_elements[] =
static int
svr4_parse_libraries (const char *document, struct svr4_library_list *list)
{
- struct cleanup *back_to = make_cleanup (svr4_free_library_list,
- &list->head);
+ auto cleanup = make_scope_exit ([&] ()
+ {
+ svr4_free_library_list (&list->head);
+ });
memset (list, 0, sizeof (*list));
list->tailp = &list->head;
@@ -1207,11 +1209,10 @@ svr4_parse_libraries (const char *document, struct svr4_library_list *list)
svr4_library_list_elements, document, list) == 0)
{
/* Parsed successfully, keep the result. */
- discard_cleanups (back_to);
+ cleanup.release ();
return 1;
}
- do_cleanups (back_to);
return 0;
}
@@ -1374,7 +1375,6 @@ svr4_current_sos_direct (struct svr4_info *info)
CORE_ADDR lm;
struct so_list *head = NULL;
struct so_list **link_ptr = &head;
- struct cleanup *back_to;
int ignore_first;
struct svr4_library_list library_list;
@@ -1412,7 +1412,10 @@ svr4_current_sos_direct (struct svr4_info *info)
else
ignore_first = 1;
- back_to = make_cleanup (svr4_free_library_list, &head);
+ auto cleanup = make_scope_exit ([&] ()
+ {
+ svr4_free_library_list (&head);
+ });
/* Walk the inferior's link map list, and build our list of
`struct so_list' nodes. */
@@ -1428,7 +1431,7 @@ svr4_current_sos_direct (struct svr4_info *info)
if (lm)
svr4_read_so_list (lm, 0, &link_ptr, 0);
- discard_cleanups (back_to);
+ cleanup.release ();
if (head == NULL)
return svr4_default_sos ();