From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by sourceware.org (Postfix) with ESMTPS id A7B61385842C for ; Thu, 10 Feb 2022 13:53:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A7B61385842C X-IronPort-AV: E=McAfee;i="6200,9189,10253"; a="249699600" X-IronPort-AV: E=Sophos;i="5.88,358,1635231600"; d="scan'208";a="249699600" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Feb 2022 05:53:13 -0800 X-IronPort-AV: E=Sophos;i="5.88,358,1635231600"; d="scan'208";a="482768923" Received: from sugan-001.iul.intel.com (HELO localhost) ([172.28.48.31]) by orsmga003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Feb 2022 05:53:12 -0800 From: Ari Hannula To: gdb-patches@sourceware.org Cc: Tim Wiederhake , Ari Hannula Subject: [PATCH 3/5] [func_call] Fix MI output for function call history. Date: Thu, 10 Feb 2022 14:52:41 +0100 Message-Id: <20220210135243.3127629-4-ari.hannula@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220210135243.3127629-1-ari.hannula@intel.com> References: <20220210135243.3127629-1-ari.hannula@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-11.0 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Feb 2022 13:53:17 -0000 From: Tim Wiederhake "record function-call-history" formats its output as one single tuple with the same keys for every line. Fix by turning the output into a list of tuples and the indentation into an optional "level" field. gdb/ChangeLog: 2018-12-27 Tim Wiederhake * record-btrace.c (btrace_call_history): Emit individual tuples. (record_btrace_target::call_history): Emit list instead of tuple, fix field name. (record_btrace_target::call_history_range): Emit list instead of tuple. Signed-off-by: Tim Wiederhake Signed-off-by: Ari Hannula --- gdb/record-btrace.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/gdb/record-btrace.c b/gdb/record-btrace.c index 3dfdf592dd..dd5f4b4dd7 100644 --- a/gdb/record-btrace.c +++ b/gdb/record-btrace.c @@ -1156,6 +1156,7 @@ btrace_call_history (struct ui_out *uiout, for (it = *begin; btrace_call_cmp (&it, end) < 0; btrace_call_next (&it, 1)) { + ui_out_emit_tuple tuple_emitter (uiout, nullptr); const struct btrace_function *bfun; struct minimal_symbol *msym; struct symbol *sym; @@ -1185,10 +1186,13 @@ btrace_call_history (struct ui_out *uiout, if ((flags & RECORD_PRINT_INDENT_CALLS) != 0) { - int level = bfun->level + btinfo->level, i; + const int level = bfun->level + btinfo->level; - for (i = 0; i < level; ++i) - uiout->text (" "); + if (uiout->is_mi_like_p ()) + uiout->field_signed ("level", level); + else + for (int i = 0; i < level; ++i) + uiout->text (" "); } if (sym != NULL) @@ -1229,7 +1233,7 @@ record_btrace_target::call_history (int size, record_print_flags flags) unsigned int context, covered; uiout = current_uiout; - ui_out_emit_tuple tuple_emitter (uiout, "insn history"); + ui_out_emit_list list_emitter (uiout, "func history"); context = abs (size); if (context == 0) error (_("Bad record function-call-history-size.")); @@ -1316,7 +1320,7 @@ record_btrace_target::call_history_range (ULONGEST from, ULONGEST to, int found; uiout = current_uiout; - ui_out_emit_tuple tuple_emitter (uiout, "func history"); + ui_out_emit_list list_emitter (uiout, "func history"); low = from; high = to; -- 2.25.1 Intel Deutschland GmbH Registered Address: Am Campeon 10, 85579 Neubiberg, Germany Tel: +49 89 99 8853-0, www.intel.de Managing Directors: Christin Eisenschmid, Sharon Heck, Tiffany Doon Silva Chairperson of the Supervisory Board: Nicole Lau Registered Office: Munich Commercial Register: Amtsgericht Muenchen HRB 186928