From patchwork Fri Oct 11 23:24:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 98769 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 5C0AD3857835 for ; Fri, 11 Oct 2024 23:25:38 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from omta038.useast.a.cloudfilter.net (omta038.useast.a.cloudfilter.net [44.202.169.37]) by sourceware.org (Postfix) with ESMTPS id E34BF3858D26 for ; Fri, 11 Oct 2024 23:24:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E34BF3858D26 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tromey.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tromey.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org E34BF3858D26 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=44.202.169.37 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1728689079; cv=none; b=YzTbHvWF3kOvYagfQCaaBwMp9EC9mkqIBJrwRnZXdh8nRPN1V1iKuUUCm8SgNAq2j9feCEwCUhIg9c2gtPN8ZcMxfnoY2/2lijY1790J9QwSuoqpkLu8h4g1MYPq8vt7vN81otgNkVibiNx6+1Zh1eSXFw2HUVuz39ZrnX5FCyg= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1728689079; c=relaxed/simple; bh=Wa5ehOVCr9bYaMNiFxRg3zLPLqSpj0FN2/hQVoFfw/0=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=EOQSnZj2bOFJAVcp1tFDnC0xR4m6WsIBCmP6cOF63Qk0hSYA6ZAgc6p+UbT17Rt1ZiieWRa9tzK4wsIR5aWzrS99elXtCcnsMLrDi/N+FCmjKjwzmZZawCfDhdpvZvuDH3WIeIztzw6KfQdPIi3DG4eeGM7ry7dV63yTZQ2bjuM= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from eig-obgw-5006a.ext.cloudfilter.net ([10.0.29.179]) by cmsmtp with ESMTPS id zIYTsPTfzg2lzzOzrsLyjE; Fri, 11 Oct 2024 23:24:35 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id zOzqsME8p3nDKzOzrshQb7; Fri, 11 Oct 2024 23:24:35 +0000 X-Authority-Analysis: v=2.4 cv=T6iKTeKQ c=1 sm=1 tr=0 ts=6709b3b3 a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=IkcTkHD0fZMA:10 a=DAUX931o1VcA:10 a=ItBw4LHWJt0A:10 a=CrcZfdKhomYTbV2mLZcA:9 a=QEXdDO2ut3YA:10 a=6Ogn3jAGHLSNbaov7Orx:22 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=To:In-Reply-To:References:Message-Id:Content-Transfer-Encoding: Content-Type:MIME-Version:Subject:Date:From:Sender:Reply-To:Cc:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=MAYD0AlLAIeSlPjdOwM2ZAfnQcRtHwzyfCk2U6xS7P4=; b=Ro5OLbXaTZhit0v4Y2kf5n8VtO 1wtdvCJcXNNnqYPc1WSGiwI+MzeLwRGzlpyJAeOP/4RWEoFBQZMS+jXx2M7G3vsagRxS50TP4wZ5p jX20Z7X6UTfV92zbc2Gm82p3q; Received: from 97-118-40-216.hlrn.qwest.net ([97.118.40.216]:39238 helo=prentzel.local) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96.2) (envelope-from ) id 1szOzq-001F4p-0Q for gdb-patches@sourceware.org; Fri, 11 Oct 2024 17:24:34 -0600 From: Tom Tromey Date: Fri, 11 Oct 2024 17:24:30 -0600 Subject: [PATCH 1/3] Use ui-out tables in some "maint print" commands MIME-Version: 1.0 Message-Id: <20241011-even-more-ui-out-v1-1-e1f92f01bacb@tromey.com> References: <20241011-even-more-ui-out-v1-0-e1f92f01bacb@tromey.com> In-Reply-To: <20241011-even-more-ui-out-v1-0-e1f92f01bacb@tromey.com> To: gdb-patches@sourceware.org X-Mailer: b4 0.14.2 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box5379.bluehost.com X-AntiAbuse: Original Domain - sourceware.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 97.118.40.216 X-Source-L: No X-Exim-ID: 1szOzq-001F4p-0Q X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-118-40-216.hlrn.qwest.net (prentzel.local) [97.118.40.216]:39238 X-Source-Auth: tom+tromey.com X-Email-Count: 2 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfAk5eqKaxY7AP0jI2OcTLtUPE7JlR246pb8xheCaQwiffBvQ0/dKIL0NiEwfdft7dn0opwkpk2E1LIUXYnMr1sT2eUdWdgzqIavcOR0IDwgHdfyCnMEV F7CDVJht3s/l6gcKlIS7FABPKNDfKheQYkzXuu/KzDGf4O9hMhJjDI5iqxVsOS29mY3Nc/IxSok6NIlWL4qmovwJ85xbnuRKxQU= X-Spam-Status: No, score=-3020.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_LOTSOFHASH, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, 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 X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~patchwork=sourceware.org@sourceware.org This changes various "maint print" register commands to use ui-out tables rather than the current printf approach. --- gdb/regcache-dump.c | 210 ++++++++++++++++++-------------- gdb/regcache.c | 132 +++++++++----------- gdb/regcache.h | 11 +- gdb/testsuite/gdb.base/maint.exp | 4 +- gdb/testsuite/gdb.server/server-run.exp | 2 +- 5 files changed, 191 insertions(+), 168 deletions(-) diff --git a/gdb/regcache-dump.c b/gdb/regcache-dump.c index 6b711bf6c2a01e21b89b952e9926a7acfb27540b..f71f05bbdc77c6956bfb09f1cc62b57245ee59f0 100644 --- a/gdb/regcache-dump.c +++ b/gdb/regcache-dump.c @@ -38,43 +38,45 @@ class register_dump_regcache : public register_dump } protected: - void dump_reg (ui_file *file, int regnum) override + + int num_additional_headers () override + { return 1; } + + void additional_headers (ui_out *out) override { - if (regnum < 0) + out->table_header (0, ui_left, "value", + m_dump_pseudo ? "Cooked value" : "Raw value"); + } + + void dump_reg (ui_out *out, int regnum) override + { + if (regnum < gdbarch_num_regs (m_gdbarch) || m_dump_pseudo) { - if (m_dump_pseudo) - gdb_printf (file, "Cooked value"); + auto size = register_size (m_gdbarch, regnum); + + if (size == 0) + return; + + gdb::byte_vector buf (size); + auto status = m_regcache->cooked_read (regnum, buf.data ()); + + if (status == REG_UNKNOWN) + out->field_string ("value", ""); + else if (status == REG_UNAVAILABLE) + out->field_string ("value", ""); else - gdb_printf (file, "Raw value"); + { + string_file str; + print_hex_chars (&str, buf.data (), size, + gdbarch_byte_order (m_gdbarch), true); + out->field_stream ("value", str); + } } else { - if (regnum < gdbarch_num_regs (m_gdbarch) || m_dump_pseudo) - { - auto size = register_size (m_gdbarch, regnum); - - if (size == 0) - return; - - gdb::byte_vector buf (size); - auto status = m_regcache->cooked_read (regnum, buf.data ()); - - if (status == REG_UNKNOWN) - gdb_printf (file, ""); - else if (status == REG_UNAVAILABLE) - gdb_printf (file, ""); - else - { - print_hex_chars (file, buf.data (), size, - gdbarch_byte_order (m_gdbarch), true); - } - } - else - { - /* Just print "" for pseudo register when - regcache_dump_raw. */ - gdb_printf (file, ""); - } + /* Just print "" for pseudo register when + regcache_dump_raw. */ + out->field_string ("value", ""); } } @@ -97,39 +99,39 @@ class register_dump_reg_buffer : public register_dump, reg_buffer } protected: - void dump_reg (ui_file *file, int regnum) override + + int num_additional_headers () override + { return 1; } + + void additional_headers (ui_out *out) override { - if (regnum < 0) - { - if (m_has_pseudo) - gdb_printf (file, "Cooked value"); - else - gdb_printf (file, "Raw value"); - } - else + out->table_header (0, ui_left, "value", + m_has_pseudo ? "Cooked value" : "Raw value"); + } + + void dump_reg (ui_out *out, int regnum) override + { + if (regnum < gdbarch_num_regs (m_gdbarch) || m_has_pseudo) { - if (regnum < gdbarch_num_regs (m_gdbarch) || m_has_pseudo) - { - auto size = register_size (m_gdbarch, regnum); + auto size = register_size (m_gdbarch, regnum); - if (size == 0) - return; + if (size == 0) + return; - auto status = get_register_status (regnum); + auto status = get_register_status (regnum); - gdb_assert (status != REG_VALID); + gdb_assert (status != REG_VALID); - if (status == REG_UNKNOWN) - gdb_printf (file, ""); - else - gdb_printf (file, ""); - } + if (status == REG_UNKNOWN) + out->field_string ("value", ""); else - { - /* Just print "" for pseudo register when - regcache_dump_raw. */ - gdb_printf (file, ""); - } + out->field_string ("value", ""); + } + else + { + /* Just print "" for pseudo register when + regcache_dump_raw. */ + out->field_string ("value", ""); } } }; @@ -144,7 +146,14 @@ class register_dump_none : public register_dump {} protected: - void dump_reg (ui_file *file, int regnum) override + + int num_additional_headers () override + { return 0; } + + void additional_headers (ui_out *out) override + { } + + void dump_reg (ui_out *out, int regnum) override {} }; @@ -158,24 +167,38 @@ class register_dump_remote : public register_dump {} protected: - void dump_reg (ui_file *file, int regnum) override + + int num_additional_headers () override + { return 3; } + + void additional_headers (ui_out *out) override + { + out->table_header (7, ui_left, "remnum", "Rmt Nr"); + out->table_header (11, ui_left, "goffset", "g/G Offset"); + out->table_header (3, ui_left, "expedited", "Expedited"); + } + + void dump_reg (ui_out *out, int regnum) override { - if (regnum < 0) + int pnum, poffset; + + if (regnum < gdbarch_num_regs (m_gdbarch) + && remote_register_number_and_offset (m_gdbarch, regnum, + &pnum, &poffset)) { - gdb_printf (file, "Rmt Nr g/G Offset Expedited"); + out->field_signed ("remnum", pnum); + out->field_signed ("goffset", poffset); + + if (remote_register_is_expedited (regnum)) + out->field_string ("expedited", "yes"); + else + out->field_skip ("expedited"); } - else if (regnum < gdbarch_num_regs (m_gdbarch)) + else { - int pnum, poffset; - - if (remote_register_number_and_offset (m_gdbarch, regnum, - &pnum, &poffset)) - { - if (remote_register_is_expedited (regnum)) - gdb_printf (file, "%7d %11d yes", pnum, poffset); - else - gdb_printf (file, "%7d %11d", pnum, poffset); - } + out->field_skip ("remnum"); + out->field_skip ("goffset"); + out->field_skip ("expedited"); } } }; @@ -190,22 +213,28 @@ class register_dump_groups : public register_dump {} protected: - void dump_reg (ui_file *file, int regnum) override + + int num_additional_headers () override + { return 1; } + + void additional_headers (ui_out *out) override { - if (regnum < 0) - gdb_printf (file, "Groups"); - else + out->table_header (0, ui_left, "groups", "Groups"); + } + + void dump_reg (ui_out *out, int regnum) override + { + string_file file; + const char *sep = ""; + for (const struct reggroup *group : gdbarch_reggroups (m_gdbarch)) { - const char *sep = ""; - for (const struct reggroup *group : gdbarch_reggroups (m_gdbarch)) + if (gdbarch_register_reggroup_p (m_gdbarch, regnum, group)) { - if (gdbarch_register_reggroup_p (m_gdbarch, regnum, group)) - { - gdb_printf (file, "%s%s", sep, group->name ()); - sep = ","; - } + gdb_printf (&file, "%s%s", sep, group->name ()); + sep = ","; } } + out->field_stream ("groups", file); } }; @@ -221,15 +250,13 @@ regcache_print (const char *args, enum regcache_dump_what what_to_dump) { /* Where to send output. */ stdio_file file; - ui_file *out; + std::optional redirect; - if (args == NULL) - out = gdb_stdout; - else + if (args != nullptr) { if (!file.open (args, "w")) perror_with_name (_("maintenance print architecture")); - out = &file; + redirect.emplace (current_uiout, &file); } std::unique_ptr dump; @@ -241,20 +268,25 @@ regcache_print (const char *args, enum regcache_dump_what what_to_dump) else gdbarch = current_inferior ()->arch (); + const char *name; switch (what_to_dump) { case regcache_dump_none: dump.reset (new register_dump_none (gdbarch)); + name = "Registers"; break; case regcache_dump_remote: dump.reset (new register_dump_remote (gdbarch)); + name = "RegisterRemote"; break; case regcache_dump_groups: dump.reset (new register_dump_groups (gdbarch)); + name = "RegisterGroups"; break; case regcache_dump_raw: case regcache_dump_cooked: { + name = "RegisterDump"; auto dump_pseudo = (what_to_dump == regcache_dump_cooked); if (target_has_registers ()) @@ -272,7 +304,7 @@ regcache_print (const char *args, enum regcache_dump_what what_to_dump) break; } - dump->dump (out); + dump->dump (current_uiout, name); } static void diff --git a/gdb/regcache.c b/gdb/regcache.c index f04354d822f9c78db671e9cd41f15811b0770bd8..c0433121d2fd6312bbafaca91fe8c3a536ffe7ec 100644 --- a/gdb/regcache.c +++ b/gdb/regcache.c @@ -1509,7 +1509,7 @@ reg_flush_command (const char *command, int from_tty) } void -register_dump::dump (ui_file *file) +register_dump::dump (ui_out *out, const char *name) { auto descr = regcache_descr (m_gdbarch); int regnum; @@ -1521,107 +1521,91 @@ register_dump::dump (ui_file *file) gdb_assert (descr->nr_cooked_registers == gdbarch_num_cooked_regs (m_gdbarch)); - for (regnum = -1; regnum < descr->nr_cooked_registers; regnum++) + ui_out_emit_table table (out, 6 + num_additional_headers (), -1, name); + out->table_header (10, ui_left, "name", "Name"); + out->table_header (4, ui_left, "num", "Nr"); + out->table_header (4, ui_left, "relnum", "Rel"); + out->table_header (8, ui_left, "offset", "Offset"); + out->table_header (5, ui_left, "size", "Size"); + out->table_header (15, ui_left, "type", "Type"); + additional_headers (out); + out->table_body (); + + for (regnum = 0; regnum < descr->nr_cooked_registers; regnum++) { - /* Name. */ - if (regnum < 0) - gdb_printf (file, " %-10s", "Name"); - else - { - const char *p = gdbarch_register_name (m_gdbarch, regnum); + ui_out_emit_tuple tuple_emitter (out, nullptr); - if (p[0] == '\0') - p = "''"; - gdb_printf (file, " %-10s", p); - } + /* Name. */ + const char *p = gdbarch_register_name (m_gdbarch, regnum); + if (p[0] == '\0') + p = "''"; + out->field_string ("name", p); /* Number. */ - if (regnum < 0) - gdb_printf (file, " %4s", "Nr"); - else - gdb_printf (file, " %4d", regnum); + out->field_signed ("num", regnum); /* Relative number. */ - if (regnum < 0) - gdb_printf (file, " %4s", "Rel"); - else if (regnum < gdbarch_num_regs (m_gdbarch)) - gdb_printf (file, " %4d", regnum); + if (regnum < gdbarch_num_regs (m_gdbarch)) + out->field_signed ("relnum", regnum); else - gdb_printf (file, " %4d", - (regnum - gdbarch_num_regs (m_gdbarch))); + out->field_signed ("relnum", (regnum - gdbarch_num_regs (m_gdbarch))); /* Offset. */ - if (regnum < 0) - gdb_printf (file, " %6s ", "Offset"); - else + if (register_offset != descr->register_offset[regnum] + || (regnum > 0 + && (descr->register_offset[regnum] + != (descr->register_offset[regnum - 1] + + descr->sizeof_register[regnum - 1])))) { - gdb_printf (file, " %6ld", - descr->register_offset[regnum]); - if (register_offset != descr->register_offset[regnum] - || (regnum > 0 - && (descr->register_offset[regnum] - != (descr->register_offset[regnum - 1] - + descr->sizeof_register[regnum - 1]))) - ) - { - if (!footnote_register_offset) - footnote_register_offset = ++footnote_nr; - gdb_printf (file, "*%d", footnote_register_offset); - } - else - gdb_printf (file, " "); - register_offset = (descr->register_offset[regnum] - + descr->sizeof_register[regnum]); + if (!footnote_register_offset) + footnote_register_offset = ++footnote_nr; + std::string val = string_printf ("%ld*%d", + descr->register_offset[regnum], + footnote_register_offset); + out->field_string ("offset", val); } + else + out->field_signed ("offset", descr->register_offset[regnum]); + register_offset = (descr->register_offset[regnum] + + descr->sizeof_register[regnum]); /* Size. */ - if (regnum < 0) - gdb_printf (file, " %5s ", "Size"); - else - gdb_printf (file, " %5ld", descr->sizeof_register[regnum]); + out->field_signed ("size", descr->sizeof_register[regnum]); /* Type. */ { const char *t; std::string name_holder; - if (regnum < 0) - t = "Type"; - else + static const char blt[] = "builtin_type"; + + t = register_type (m_gdbarch, regnum)->name (); + if (t == NULL) { - static const char blt[] = "builtin_type"; - - t = register_type (m_gdbarch, regnum)->name (); - if (t == NULL) - { - if (!footnote_register_type_name_null) - footnote_register_type_name_null = ++footnote_nr; - name_holder = string_printf ("*%d", - footnote_register_type_name_null); - t = name_holder.c_str (); - } - /* Chop a leading builtin_type. */ - if (startswith (t, blt)) - t += strlen (blt); + if (!footnote_register_type_name_null) + footnote_register_type_name_null = ++footnote_nr; + name_holder = string_printf ("*%d", + footnote_register_type_name_null); + t = name_holder.c_str (); } - gdb_printf (file, " %-15s", t); - } + /* Chop a leading builtin_type. */ + if (startswith (t, blt)) + t += strlen (blt); - /* Leading space always present. */ - gdb_printf (file, " "); + out->field_string ("type", t); + } - dump_reg (file, regnum); + dump_reg (out, regnum); - gdb_printf (file, "\n"); + out->text ("\n"); } if (footnote_register_offset) - gdb_printf (file, "*%d: Inconsistent register offsets.\n", - footnote_register_offset); + out->message ("*%d: Inconsistent register offsets.\n", + footnote_register_offset); if (footnote_register_type_name_null) - gdb_printf (file, - "*%d: Register type's name NULL.\n", - footnote_register_type_name_null); + out->message ("*%d: Register type's name NULL.\n", + footnote_register_type_name_null); } #if GDB_SELF_TEST diff --git a/gdb/regcache.h b/gdb/regcache.h index 2f4b7d94c69344bbe9d2f5b716874fc47c6720c4..916044e3a793b20886b74602c3aefcd89742e487 100644 --- a/gdb/regcache.h +++ b/gdb/regcache.h @@ -31,6 +31,7 @@ struct gdbarch; class thread_info; struct process_stratum_target; struct inferior; +class ui_out; extern struct regcache *get_thread_regcache (process_stratum_target *target, ptid_t ptid); @@ -533,7 +534,7 @@ extern void registers_changed_thread (thread_info *thread); class register_dump { public: - void dump (ui_file *file); + void dump (ui_out *out, const char *name); virtual ~register_dump () = default; protected: @@ -541,9 +542,15 @@ class register_dump : m_gdbarch (arch) {} + /* Number of additional table headers. */ + virtual int num_additional_headers () = 0; + + /* Add the additional headers to OUT. */ + virtual void additional_headers (ui_out *out) = 0; + /* Dump the register REGNUM contents. If REGNUM is -1, print the header. */ - virtual void dump_reg (ui_file *file, int regnum) = 0; + virtual void dump_reg (ui_out *out, int regnum) = 0; gdbarch *m_gdbarch; }; diff --git a/gdb/testsuite/gdb.base/maint.exp b/gdb/testsuite/gdb.base/maint.exp index d6aa22321f1c0e364a03212619722a5863229ee7..970cec1d89161b940af3e61033f63d2293893b17 100644 --- a/gdb/testsuite/gdb.base/maint.exp +++ b/gdb/testsuite/gdb.base/maint.exp @@ -70,11 +70,11 @@ set saw_registers 0 set saw_headers 0 set test "maint print registers" gdb_test_multiple $test $test { - -re "\[^\r\n\]+Name\[^\r\n\]+Nr\[^\r\n\]+Rel\[^\r\n\]+Offset\[^\r\n\]+Size\[^\r\n\]+Type\[^\r\n\]+\r\n" { + -re "Name\[^\r\n\]+Nr\[^\r\n\]+Rel\[^\r\n\]+Offset\[^\r\n\]+Size\[^\r\n\]+Type\[^\r\n\]+\r\n" { set saw_headers 1 exp_continue } - -re "^\[^\r\n\]+\[0-9\]+\[^\r\n\]+\[0-9\]+\[^\r\n\]+\[0-9\]+\[^\r\n\]+\[0-9\]+\[^\r\n\]+\r\n" { + -re "\[0-9\]+\[^\r\n\]+\[0-9\]+\[^\r\n\]+\[0-9\]+\[^\r\n\]+\[0-9\]+\[^\r\n\]+\r\n" { set saw_registers 1 exp_continue } diff --git a/gdb/testsuite/gdb.server/server-run.exp b/gdb/testsuite/gdb.server/server-run.exp index af5a5f53ca03f1bd9507f8b7284d70ddb7f12915..e81384f0dfb4fb5b187631ce131eb5e801c758a4 100644 --- a/gdb/testsuite/gdb.server/server-run.exp +++ b/gdb/testsuite/gdb.server/server-run.exp @@ -74,7 +74,7 @@ if { [info exists pc_regname] } { set seen_line false gdb_test_multiple "maintenance print remote-registers" \ $expedited_pc_test_name -lbl { - -re " ${pc_regname}\[\[:space:\]\]+${decimal}.*${decimal} yes" { + -re "${pc_regname}\[\[:space:\]\]+${decimal}.*${decimal}\[\[:space:\]\]+yes" { set seen_line true exp_continue } From patchwork Fri Oct 11 23:24:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 98768 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2EAA1385AC25 for ; Fri, 11 Oct 2024 23:25:15 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from omta36.uswest2.a.cloudfilter.net (omta36.uswest2.a.cloudfilter.net [35.89.44.35]) by sourceware.org (Postfix) with ESMTPS id 46B963858433 for ; Fri, 11 Oct 2024 23:24:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 46B963858433 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tromey.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tromey.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 46B963858433 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=35.89.44.35 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1728689079; cv=none; b=Tbq7LMm9dD/JpZORqAQGStiSNFyn7guMDZHHJeM7MKvha/fSZFKWsY0F+rSbLcB3wquj716c0jNw6cza+sLPHvQRkZ2s0Gyu2v2czhgeplwssbpRh5qRFXMT6aEn1lbY6gxHnq/vVAvpwrYTM/NxPBE36D+TRp3sKE2dgiFV1z0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1728689079; c=relaxed/simple; bh=msVRnOfTxJAMqfHIMMJ4hlCr/EoU3Tka134mbEIsiY4=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=QI6I4NcXC7oeqepSir5kHqW1jkwje3oU4iDgaC3zWjTVV6z3SWjy1Y/g8qp9BViNPAb5edconuelV1oN+6gMul0XD10GKMZcEvgYUAFNJmf9liYZUyCgIvROAPoKRZW4tnpaGqV8Sof40OBO6Iz1FfQRtJ5EC/Upv4yndRVpdJQ= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from eig-obgw-5010a.ext.cloudfilter.net ([10.0.29.199]) by cmsmtp with ESMTPS id z7GCsf06qqvuozOzss3mn2; Fri, 11 Oct 2024 23:24:36 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id zOzqskNmpxS8LzOzrswc1X; Fri, 11 Oct 2024 23:24:35 +0000 X-Authority-Analysis: v=2.4 cv=Wa4KaVhX c=1 sm=1 tr=0 ts=6709b3b3 a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=IkcTkHD0fZMA:10 a=DAUX931o1VcA:10 a=ItBw4LHWJt0A:10 a=S9odsrSVWhxOl4p7IAkA:9 a=QEXdDO2ut3YA:10 a=6Ogn3jAGHLSNbaov7Orx:22 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=To:In-Reply-To:References:Message-Id:Content-Transfer-Encoding: Content-Type:MIME-Version:Subject:Date:From:Sender:Reply-To:Cc:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=ck636J2xheT+bwMyWRS3l2NLsGpP/pHF9ZF3y9Zwiao=; b=ijA0aZw+UqhwmsTWIy6/7Jif2z LJj3A6S4Ez3Io9Z3NhYm8RlKwRiuxP3yuNQMxm/fa8nRC9KiZPEVshzd7QhzPr+iS4ClboeyxTL7x JVnpuUKPCychvmWgWnS0QF7XK; Received: from 97-118-40-216.hlrn.qwest.net ([97.118.40.216]:39238 helo=prentzel.local) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96.2) (envelope-from ) id 1szOzq-001F4p-1h for gdb-patches@sourceware.org; Fri, 11 Oct 2024 17:24:34 -0600 From: Tom Tromey Date: Fri, 11 Oct 2024 17:24:31 -0600 Subject: [PATCH 2/3] Use ui-out table in "maint print reggroups" MIME-Version: 1.0 Message-Id: <20241011-even-more-ui-out-v1-2-e1f92f01bacb@tromey.com> References: <20241011-even-more-ui-out-v1-0-e1f92f01bacb@tromey.com> In-Reply-To: <20241011-even-more-ui-out-v1-0-e1f92f01bacb@tromey.com> To: gdb-patches@sourceware.org X-Mailer: b4 0.14.2 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box5379.bluehost.com X-AntiAbuse: Original Domain - sourceware.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 97.118.40.216 X-Source-L: No X-Exim-ID: 1szOzq-001F4p-1h X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-118-40-216.hlrn.qwest.net (prentzel.local) [97.118.40.216]:39238 X-Source-Auth: tom+tromey.com X-Email-Count: 3 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfLFreDv44/ny6ZWQm6n1jnD5kpKqZumMxx/qn436lA4r0TQw+HylURN4uNeTshmG/EhcGSedsfCL0vSFTn5srbQp8GBRDMig7vO+Hlf5t8czs0WcGAfa 1F4I2MqZZVPnbE36ngTZ/tl5k7hnvynIzmu2pnCuWKkYLozto+T34itZ6fNbTJv6HSEXRPtRVn2Tdx4lUPBil8DT+n4/9WWrQbE= X-Spam-Status: No, score=-3020.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_LOTSOFHASH, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, 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 X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~patchwork=sourceware.org@sourceware.org This changes the "maint print reggroups" command to use a ui-out table rather than printf. It also fixes a typo I noticed in a related test case name; and lets us finally remove the leading \s from the regexp in completion.exp. Reviewed-by: Christina Schimpe --- gdb/reggroups.c | 22 +++++++++++++--------- gdb/testsuite/gdb.base/completion.exp | 2 +- gdb/testsuite/gdb.base/reggroups.exp | 4 ++-- gdb/testsuite/gdb.python/py-arch-reg-groups.exp | 6 +++--- gdb/testsuite/gdb.xml/tdesc-regs.exp | 2 +- 5 files changed, 20 insertions(+), 16 deletions(-) diff --git a/gdb/reggroups.c b/gdb/reggroups.c index b2ac62c62b14d4d404b7107a90fdeb1954a7cadd..c651575257e3cd9757ddca20e8f1e47371bd3118 100644 --- a/gdb/reggroups.c +++ b/gdb/reggroups.c @@ -186,16 +186,19 @@ reggroup_find (struct gdbarch *gdbarch, const char *name) /* Dump out a table of register groups for the current architecture. */ static void -reggroups_dump (struct gdbarch *gdbarch, struct ui_file *file) +reggroups_dump (struct gdbarch *gdbarch, struct ui_out *out) { - static constexpr const char *fmt = " %-10s %-10s\n"; - - gdb_printf (file, fmt, "Group", "Type"); + ui_out_emit_table table (out, 2, -1, "RegGroups"); + out->table_header (10, ui_left, "group", "Group"); + out->table_header (10, ui_left, "type", "Type"); + out->table_body (); for (const struct reggroup *group : gdbarch_reggroups (gdbarch)) { + ui_out_emit_tuple tuple_emitter (out, nullptr); + /* Group name. */ - const char *name = group->name (); + out->field_string ("group", group->name ()); /* Group type. */ const char *type; @@ -214,8 +217,8 @@ reggroups_dump (struct gdbarch *gdbarch, struct ui_file *file) /* Note: If you change this, be sure to also update the documentation. */ - - gdb_printf (file, fmt, name, type); + out->field_string ("type", type); + out->text ("\n"); } } @@ -227,14 +230,15 @@ maintenance_print_reggroups (const char *args, int from_tty) struct gdbarch *gdbarch = get_current_arch (); if (args == NULL) - reggroups_dump (gdbarch, gdb_stdout); + reggroups_dump (gdbarch, current_uiout); else { stdio_file file; if (!file.open (args, "w")) perror_with_name (_("maintenance print reggroups")); - reggroups_dump (gdbarch, &file); + ui_out_redirect_pop redirect (current_uiout, &file); + reggroups_dump (gdbarch, current_uiout); } } diff --git a/gdb/testsuite/gdb.base/completion.exp b/gdb/testsuite/gdb.base/completion.exp index 57b4d1c1045a2fad8d947fd804f3698a32960b52..aea18de9e3f87b43fd2e6ce111e1f1d0728e6cf5 100644 --- a/gdb/testsuite/gdb.base/completion.exp +++ b/gdb/testsuite/gdb.base/completion.exp @@ -145,7 +145,7 @@ append regs_output "\n" append regs_output [capture_command_output "mt print user-registers" \ ".*Name.*Nr\[^\n]*\n"] set all_regs {} -foreach {- reg} [regexp -all -inline -line {^\s*(\w+)} $regs_output] { +foreach {- reg} [regexp -all -inline -line {^(\w+)} $regs_output] { lappend all_regs $reg } diff --git a/gdb/testsuite/gdb.base/reggroups.exp b/gdb/testsuite/gdb.base/reggroups.exp index 56c00e588311fe2faedd440c1e614a7d6dafe7de..638601b4936fc905389ece05bbf6564b9aff4fe4 100644 --- a/gdb/testsuite/gdb.base/reggroups.exp +++ b/gdb/testsuite/gdb.base/reggroups.exp @@ -39,10 +39,10 @@ proc fetch_reggroups {test} { -re "maint print reggroups\r\n" { exp_continue } - -re "^ Group\[ \t\]+Type\[ \t\]+\r\n" { + -re "^Group\[ \t\]+Type\[ \t\]+\r\n" { exp_continue } - -re "^ (\[_0-9a-zA-Z-\]+)\[ \t\]+(user|internal)\[ \t\]+\r\n" { + -re "^(\[_0-9a-zA-Z-\]+)\[ \t\]+(user|internal)\[ \t\]+\r\n" { lappend reggroups $expect_out(1,string) exp_continue } diff --git a/gdb/testsuite/gdb.python/py-arch-reg-groups.exp b/gdb/testsuite/gdb.python/py-arch-reg-groups.exp index 4ff3e9cd8c2a40f43ac723102f4b6408bee18e43..e3646f56eb64d3004ed4ccdc07c59cdd1c7f3b9b 100644 --- a/gdb/testsuite/gdb.python/py-arch-reg-groups.exp +++ b/gdb/testsuite/gdb.python/py-arch-reg-groups.exp @@ -32,10 +32,10 @@ if ![runto_main] { set groups {} set test "maint print reggroups" gdb_test_multiple $test $test { - -re ".*Group\[ \t\]+Type\[ \t\]+\r\n" { + -re "Group\[ \t\]+Type\[ \t\]+\r\n" { exp_continue } - -re "^ (\[^ \t\]+)\[ \t\]+\[^\r\n\]+\r\n" { + -re "^(\[^ \t\]+)\[ \t\]+\[^\r\n\]+\r\n" { lappend groups $expect_out(1,string) exp_continue } @@ -74,7 +74,7 @@ gdb_test_multiple "python print (\"\\n\".join (groups))" \ gdb_assert {[llength $py_groups] > 0} \ "Found at least one register group from python" gdb_assert {[llength $py_groups] == [llength $groups]} \ - "Same numnber of registers groups found" + "Same number of registers groups found" set found_non_match 0 for { set i 0 } { $i < [llength $groups] } { incr i } { diff --git a/gdb/testsuite/gdb.xml/tdesc-regs.exp b/gdb/testsuite/gdb.xml/tdesc-regs.exp index 344e387004a73c27e39e813a3aea39a1a93e4f07..1ba4cd90837fe7b378656a2be32063f65106eaba 100644 --- a/gdb/testsuite/gdb.xml/tdesc-regs.exp +++ b/gdb/testsuite/gdb.xml/tdesc-regs.exp @@ -195,7 +195,7 @@ gdb_test "ptype \$mixed_flags" \ "type = flag mixed_flags {\r\n *bool A @0;\r\n *uint32_t B @1-3;\r\n *bool C @4;\r\n *uint32_t D @5;\r\n *uint32_t @6-7;\r\n *enum Z_values {yes = 1, no = 0, maybe = 2, so} Z @8-9;\r\n}" # Reggroups should have at least general and the extra foo group gdb_test "maintenance print reggroups" \ - " Group\[ \t\]+Type\[ \t\]+\r\n.* general\[ \t\]+user\[ \t\]+\r\n.* foo\[ \t\]+user\[ \t\]+" + "Group\[ \t\]+Type\[ \t\]+\r\n.*general\[ \t\]+user\[ \t\]+\r\n.*foo\[ \t\]+user\[ \t\]+" with_test_prefix "core-only.xml" { load_description "core-only.xml" "" "test-regs.xml" From patchwork Fri Oct 11 23:24:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 98767 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 70E883857014 for ; Fri, 11 Oct 2024 23:25:09 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from omta034.useast.a.cloudfilter.net (omta034.useast.a.cloudfilter.net [44.202.169.33]) by sourceware.org (Postfix) with ESMTPS id 2A5103858C2B for ; Fri, 11 Oct 2024 23:24:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2A5103858C2B Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tromey.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tromey.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 2A5103858C2B Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=44.202.169.33 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1728689078; cv=none; b=rxIX5XblMELPQRZPu05i9awSltNI6QxL4Xw3rrlXRhRhEc49B2yMhDAxfLzFYRiICTZKgDQyWDOAt+1qM/sZ7TEAjiv4CeJe3swwLJV3etTpt37vZgzJcyUUzPDV56mCCuMlwm7BFCo/czDgl6qUKapaalKVs9VMOSpC2L5zfR4= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1728689078; c=relaxed/simple; bh=XODJunESo+Rc0Tnu1phtDHdi8aCbHMtcv/zkE29vGmM=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=nYFrwvcvBRBiA/W8JXDnOYhDYusaplnxYo1rNxEbp6xrRfeLxPRmB60agYjGOhquHQJZmQM/50p4d4b8xScPo4vEB9hX6iHVGF0TORTBxg8MaUxCt2qIJitlESYBxx83qJzZs8mrW7HyMc0/heTbEjdNMKLAlXW2/ov8TGhyLlc= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from eig-obgw-5010a.ext.cloudfilter.net ([10.0.29.199]) by cmsmtp with ESMTPS id zLQNsDmOQ1zuHzOzssRSPG; Fri, 11 Oct 2024 23:24:36 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id zOzrskNmzxS8LzOzrswc1j; Fri, 11 Oct 2024 23:24:35 +0000 X-Authority-Analysis: v=2.4 cv=Wa4KaVhX c=1 sm=1 tr=0 ts=6709b3b3 a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=IkcTkHD0fZMA:10 a=DAUX931o1VcA:10 a=ItBw4LHWJt0A:10 a=5L_RBJdIVtb8YuWitxYA:9 a=QEXdDO2ut3YA:10 a=6Ogn3jAGHLSNbaov7Orx:22 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=To:In-Reply-To:References:Message-Id:Content-Transfer-Encoding: Content-Type:MIME-Version:Subject:Date:From:Sender:Reply-To:Cc:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=ZJDamv6PW+xcqEqeTTi0UdY3kCWmRn49ttMxuQXQQN8=; b=lY1CfTjK2fyISI3vcj8iVd4jm6 kj7alfbllSkNPb01DyO3Xd9C9zIA1Ui6dNxVL6FBH/4069vG5OnvFQwqiHS9fTxeQJtF+FY+PYKS4 4F6I1xHNjXZhwL2aGhVBSA1cP; Received: from 97-118-40-216.hlrn.qwest.net ([97.118.40.216]:39238 helo=prentzel.local) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96.2) (envelope-from ) id 1szOzq-001F4p-2S for gdb-patches@sourceware.org; Fri, 11 Oct 2024 17:24:34 -0600 From: Tom Tromey Date: Fri, 11 Oct 2024 17:24:32 -0600 Subject: [PATCH 3/3] Fix "maint print" error messages MIME-Version: 1.0 Message-Id: <20241011-even-more-ui-out-v1-3-e1f92f01bacb@tromey.com> References: <20241011-even-more-ui-out-v1-0-e1f92f01bacb@tromey.com> In-Reply-To: <20241011-even-more-ui-out-v1-0-e1f92f01bacb@tromey.com> To: gdb-patches@sourceware.org X-Mailer: b4 0.14.2 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box5379.bluehost.com X-AntiAbuse: Original Domain - sourceware.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 97.118.40.216 X-Source-L: No X-Exim-ID: 1szOzq-001F4p-2S X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-118-40-216.hlrn.qwest.net (prentzel.local) [97.118.40.216]:39238 X-Source-Auth: tom+tromey.com X-Email-Count: 4 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfLFreDv44/ny6ZWQm6n1jnD5kpKqZumMxx/qn436lA4r0TQw+HylURN4uNeTshmG/EhcGSedsfCL0vSFTn5srbQp8GBRDMig7vO+Hlf5t8czs0WcGAfa 1F4I2MqZZVPnbE36ngTZ/tl5k7hnvynIzmu2pnCuWKkYLozto+T34itZ6fNbTJv6HSEXRPtRVn2Tdx4lUPBil8DT+n4/9WWrQbE= X-Spam-Status: No, score=-3020.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, JMQ_SPF_NEUTRAL, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, 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 X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~patchwork=sourceware.org@sourceware.org While working on an earlier patch, I noticed that all the register-related "maint print" commands used the wrong command name in an error message. This fixes them. Reviewed-by: Christina Schimpe --- gdb/regcache-dump.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/gdb/regcache-dump.c b/gdb/regcache-dump.c index f71f05bbdc77c6956bfb09f1cc62b57245ee59f0..4b4c6d9037c38e13b602dd0cffb36742c97251f6 100644 --- a/gdb/regcache-dump.c +++ b/gdb/regcache-dump.c @@ -246,7 +246,8 @@ enum regcache_dump_what }; static void -regcache_print (const char *args, enum regcache_dump_what what_to_dump) +regcache_print (const char *args, enum regcache_dump_what what_to_dump, + const char *command) { /* Where to send output. */ stdio_file file; @@ -255,7 +256,7 @@ regcache_print (const char *args, enum regcache_dump_what what_to_dump) if (args != nullptr) { if (!file.open (args, "w")) - perror_with_name (_("maintenance print architecture")); + perror_with_name (command); redirect.emplace (current_uiout, &file); } @@ -310,31 +311,34 @@ regcache_print (const char *args, enum regcache_dump_what what_to_dump) static void maintenance_print_registers (const char *args, int from_tty) { - regcache_print (args, regcache_dump_none); + regcache_print (args, regcache_dump_none, "maintenance print registers"); } static void maintenance_print_raw_registers (const char *args, int from_tty) { - regcache_print (args, regcache_dump_raw); + regcache_print (args, regcache_dump_raw, "maintenance print raw-registers"); } static void maintenance_print_cooked_registers (const char *args, int from_tty) { - regcache_print (args, regcache_dump_cooked); + regcache_print (args, regcache_dump_cooked, + "maintenance print cooked-registers"); } static void maintenance_print_register_groups (const char *args, int from_tty) { - regcache_print (args, regcache_dump_groups); + regcache_print (args, regcache_dump_groups, + "maintenance print register-groups"); } static void maintenance_print_remote_registers (const char *args, int from_tty) { - regcache_print (args, regcache_dump_remote); + regcache_print (args, regcache_dump_remote, + "maintenance print remote-registers"); } void _initialize_regcache_dump ();