From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 36238 invoked by alias); 25 Jan 2018 12:13:16 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 36221 invoked by uid 89); 25 Jan 2018 12:13:15 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.9 required=5.0 tests=BAYES_00,KAM_LAZY_DOMAIN_SECURITY,SPF_HELO_PASS,T_RP_MATCHES_RCVD autolearn=no version=3.3.2 spammy=opinion X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 25 Jan 2018 12:13:14 +0000 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4E0BF2D1EF6; Thu, 25 Jan 2018 12:13:13 +0000 (UTC) Received: from [127.0.0.1] (ovpn04.gateway.prod.ext.ams2.redhat.com [10.39.146.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4111360A9D; Thu, 25 Jan 2018 12:13:12 +0000 (UTC) Subject: Re: [RFC] expected behavior for "bt" command used with "set language ..." ? To: Joel Brobecker , Tom Tromey References: <87vafxk3us.fsf@tromey.com> <20180123115152.26mi46zogpbuodn7@adacore.com> Cc: Xavier Roirand , gdb-patches@sourceware.org From: Pedro Alves Message-ID: <5e5147c1-6790-c18c-6286-f5f97ca9be09@redhat.com> Date: Thu, 25 Jan 2018 12:13:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: <20180123115152.26mi46zogpbuodn7@adacore.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2018-01/txt/msg00518.txt.bz2 On 01/23/2018 11:51 AM, Joel Brobecker wrote: >> Xavier> When printing one frame arguments, should we do it using the language >> Xavier> of the frame, and it may be different for each frame in a single "bt" >> Xavier> command or should we leave things as they are, and possibly allow the >> Xavier> "bt" command to display weird values for frame arguments or even >> Xavier> worse, crash GDB because the user set language manually so he has to >> Xavier> know what he's doing ? >> >> I tend to think the answer should be: >> >> * If the language is "auto", then use each frame's language; otherwise >> * If the user specified a particular language, use that language for >> everything. I think that this is what makes sense. The way I see it, "bt" should print frames as-if the user had manually done a sequence of "up", "frame", "up", frame", ... And in that case, we print each frame's arguments using the frame's language (if language is "auto"), because "up" selects a new frame, and that switches the language accordingly. Right? > > I don't really have a strong opinion on this. But I thought I'd mention > that using a language to dump the value of a variable described using > another language can be a bit iffy, and lead to fairly mysterious > errors. If I was a fan of FUD, I might even say it can lead to crashes, > if the code is not careful enough. For instance, who knows what it's > going to look like asking Ada to print come C++ stuff, or vice-versa... IMO, the uncertainty comes from lack of tests. So instead of FUDing, we should add some tests to raise the confidence level. For example, we could have a testcase that picks a couple Ada constructs that are quite unique to Ada, and then cycle through all languages, printing the objects. Same for C++. And another testcase that calls C++ from Ada, and then does something like: while !$outermost_frame foreach lang $supported_languages gdb_test "set language $lang" gdb_test "frame" gdb_test "up" Thanks, Pedro Alves