X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=gdb%2Futils.c;h=98b8ae3fec09ac47ca95acab3c33ea9c708954c3;hb=8d4d924b76392dfd191e5bc0e54381befb9af0af;hp=6b1f4ba0ac2bb6bf20031de8f5bc0abf3d6b1f9b;hpb=84f49b315b57025e0400e2b5d66b49bef3e16e23;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/utils.c b/gdb/utils.c index 6b1f4ba0ac..98b8ae3fec 100644 --- a/gdb/utils.c +++ b/gdb/utils.c @@ -311,6 +311,26 @@ make_cleanup_ui_file_delete (struct ui_file *arg) return make_my_cleanup (&cleanup_chain, do_ui_file_delete, arg); } +/* Helper function for make_cleanup_ui_out_redirect_pop. */ + +static void +do_ui_out_redirect_pop (void *arg) +{ + struct ui_out *uiout = arg; + + if (ui_out_redirect (uiout, NULL) < 0) + warning (_("Cannot restore redirection of the current output protocol")); +} + +/* Return a new cleanup that pops the last redirection by ui_out_redirect + with NULL parameter. */ + +struct cleanup * +make_cleanup_ui_out_redirect_pop (struct ui_out *uiout) +{ + return make_my_cleanup (&cleanup_chain, do_ui_out_redirect_pop, uiout); +} + static void do_free_section_addr_info (void *arg) {