From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-io1-xd2c.google.com (mail-io1-xd2c.google.com [IPv6:2607:f8b0:4864:20::d2c]) by sourceware.org (Postfix) with ESMTPS id DF3AE3858D28 for ; Thu, 16 Mar 2023 19:37:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org DF3AE3858D28 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com Received: by mail-io1-xd2c.google.com with SMTP id t129so1289346iof.12 for ; Thu, 16 Mar 2023 12:37:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1678995472; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=89gZOSsmDpGRY8EYqNeDmkqN1aEnUoLTZnCnC8uNddw=; b=QfXm1tdUw6a+EuFAyyG5P3ZYPMWYwcCCw08zfg5wN1exWIf8VV6yK3dk86UAEfyC// Y8JHmfae4kN/oRt0WUMyaX2iMzC0aupvsUQllfO3Z1sScfOlNWFnU5+R6S7iIN2fk3FL TbXZ4yJJlOceVZOk6tkPBBfKZTDjvNsOCgYsRQnK4HIbDfBbsOqcQH4ULwgvAEZTQ1it a4C1/yUXisNwSXnPsNQgywds6l7qE33vmCpYq4pq17gG46N/FJpkHceU9PNX/mBjO326 SHuTUIymEDn8Lb3z37FbxIJsRSpDMvYTs7ubU6E8TYBqSglSm1wktPR/AiiX51GUkM42 Iiig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678995472; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=89gZOSsmDpGRY8EYqNeDmkqN1aEnUoLTZnCnC8uNddw=; b=T6B8J9iGVc6VCiD19YkCeBK5jvkLK8VM8giNB0D05MzhUI0lmTaF0RsLT7Ucyy/y21 v4TjlCO+JvA6tNGdD5tfAf+hpPvbbg+uTuwrMnpEnuBynz/YJfvp69ct7kZeNhyi1BKS bDzRM3ddW0RUlVsXtHkIZodHyyBncn3ydXzZVjG/fzHk3vOiqrI/2VSYiENDCo1C6qvA zVt8VxUirkzBEfKYFvKlmVTfPqTgtWP4Ja8BTVd+f2LQgtqs3+yNtQkTjBSOkJMSIXTH vCbAeFeRPCilv8auB3he9n/AHOyoeQxgWeUaFxE5v5RiFlzcX7DS06bc21twzxb6vRb2 t51w== X-Gm-Message-State: AO0yUKWZsE9qlfZpFxIwNiGaV0R9SI1YjZDJ8JHJyEc8V0ug3c/jbZTw 70ojUu81AaERdhyio5qMUAMWX1e3cuUSg+pUzNM= X-Google-Smtp-Source: AK7set/KSqmPe0h6ly69zBsW7ThOlZ5TEjuKwxsVK9j3PV8oWxSJuaML1+dbDNyk+2xZqfrhuGg8pw== X-Received: by 2002:a5e:da04:0:b0:74c:91c2:cb05 with SMTP id x4-20020a5eda04000000b0074c91c2cb05mr126390ioj.9.1678995472082; Thu, 16 Mar 2023 12:37:52 -0700 (PDT) Received: from localhost.localdomain (71-211-185-113.hlrn.qwest.net. [71.211.185.113]) by smtp.gmail.com with ESMTPSA id c18-20020a5ea812000000b00734262159a1sm15346ioa.31.2023.03.16.12.37.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Mar 2023 12:37:51 -0700 (PDT) From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH] Make ui_out::do_progress_end 'private' Date: Thu, 16 Mar 2023 13:37:41 -0600 Message-Id: <20230316193741.3804125-1-tromey@adacore.com> X-Mailer: git-send-email 2.39.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-11.6 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: I noticed that ui_out::do_progress_end is public, just to support one use in debuginfod-support.c. This patch makes it private, updates progress_info to call it from its destructor, and finally changes debuginfod-support.c to follow. --- gdb/debuginfod-support.c | 101 ++++++++++++++++++++++----------------- gdb/ui-out.h | 8 ++-- 2 files changed, 61 insertions(+), 48 deletions(-) diff --git a/gdb/debuginfod-support.c b/gdb/debuginfod-support.c index 04d254a1601..5853f420a18 100644 --- a/gdb/debuginfod-support.c +++ b/gdb/debuginfod-support.c @@ -261,16 +261,13 @@ debuginfod_is_enabled () /* Print the result of the most recent attempted download. */ static void -print_outcome (user_data &data, int fd) +print_outcome (int fd, const char *desc, const char *fname) { - /* Clears the current line of progress output. */ - current_uiout->do_progress_end (); - if (fd < 0 && fd != -ENOENT) gdb_printf (_("Download failed: %s. Continuing without %s %ps.\n"), safe_strerror (-fd), - data.desc, - styled_string (file_name_style.style (), data.fname)); + desc, + styled_string (file_name_style.style (), fname)); } /* See debuginfod-support.h */ @@ -290,23 +287,28 @@ debuginfod_source_query (const unsigned char *build_id, return scoped_fd (-ENOMEM); char *dname = nullptr; - user_data data ("source file", srcpath); - - debuginfod_set_user_data (c, &data); + scoped_fd fd; gdb::optional term_state; - if (target_supports_terminal_ours ()) - { - term_state.emplace (); - target_terminal::ours (); - } - scoped_fd fd (debuginfod_find_source (c, - build_id, - build_id_len, - srcpath, - &dname)); - debuginfod_set_user_data (c, nullptr); - print_outcome (data, fd.get ()); + { + user_data data ("source file", srcpath); + + debuginfod_set_user_data (c, &data); + if (target_supports_terminal_ours ()) + { + term_state.emplace (); + target_terminal::ours (); + } + + fd = scoped_fd (debuginfod_find_source (c, + build_id, + build_id_len, + srcpath, + &dname)); + debuginfod_set_user_data (c, nullptr); + } + + print_outcome (fd.get (), "source file", srcpath); if (fd.get () >= 0) destname->reset (dname); @@ -331,20 +333,25 @@ debuginfod_debuginfo_query (const unsigned char *build_id, return scoped_fd (-ENOMEM); char *dname = nullptr; - user_data data ("separate debug info for", filename); - - debuginfod_set_user_data (c, &data); + scoped_fd fd; gdb::optional term_state; - if (target_supports_terminal_ours ()) - { - term_state.emplace (); - target_terminal::ours (); - } - scoped_fd fd (debuginfod_find_debuginfo (c, build_id, build_id_len, - &dname)); - debuginfod_set_user_data (c, nullptr); - print_outcome (data, fd.get ()); + { + user_data data ("separate debug info for", filename); + + debuginfod_set_user_data (c, &data); + if (target_supports_terminal_ours ()) + { + term_state.emplace (); + target_terminal::ours (); + } + + fd = scoped_fd (debuginfod_find_debuginfo (c, build_id, build_id_len, + &dname)); + debuginfod_set_user_data (c, nullptr); + } + + print_outcome (fd.get (), "separate debug info for", filename); if (fd.get () >= 0) destname->reset (dname); @@ -369,19 +376,25 @@ debuginfod_exec_query (const unsigned char *build_id, return scoped_fd (-ENOMEM); char *dname = nullptr; - user_data data ("executable for", filename); - - debuginfod_set_user_data (c, &data); + scoped_fd fd; gdb::optional term_state; - if (target_supports_terminal_ours ()) - { - term_state.emplace (); - target_terminal::ours (); - } - scoped_fd fd (debuginfod_find_executable (c, build_id, build_id_len, &dname)); - debuginfod_set_user_data (c, nullptr); - print_outcome (data, fd.get ()); + { + user_data data ("executable for", filename); + + debuginfod_set_user_data (c, &data); + if (target_supports_terminal_ours ()) + { + term_state.emplace (); + target_terminal::ours (); + } + + fd = scoped_fd (debuginfod_find_executable (c, build_id, build_id_len, + &dname)); + debuginfod_set_user_data (c, nullptr); + } + + print_outcome (fd.get (), "executable for", filename); if (fd.get () >= 0) destname->reset (dname); diff --git a/gdb/ui-out.h b/gdb/ui-out.h index c7ae6698bbf..ba5b1de68ab 100644 --- a/gdb/ui-out.h +++ b/gdb/ui-out.h @@ -302,7 +302,7 @@ class ui_out ~progress_update () { - + m_uiout->do_progress_end (); } progress_update (const progress_update &) = delete; @@ -321,14 +321,13 @@ class ui_out { m_uiout->do_progress_notify (msg, "", -1, -1); } + private: struct ui_out *m_uiout; }; - virtual void do_progress_end () = 0; - - protected: +protected: virtual void do_table_begin (int nbrofcols, int nr_rows, const char *tblid) = 0; @@ -365,6 +364,7 @@ class ui_out virtual void do_progress_start () = 0; virtual void do_progress_notify (const std::string &, const char *, double, double) = 0; + virtual void do_progress_end () = 0; /* Set as not MI-like by default. It is overridden in subclasses if necessary. */ -- 2.39.1