From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 49213 invoked by alias); 20 Feb 2018 16:28:42 -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 49198 invoked by uid 89); 20 Feb 2018 16:28:41 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.2 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=consequent, HContent-Transfer-Encoding:8bit X-HELO: smtp.eu.adacore.com Received: from mel.act-europe.fr (HELO smtp.eu.adacore.com) (194.98.77.210) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 20 Feb 2018 16:28:39 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id C898F81387; Tue, 20 Feb 2018 17:28:37 +0100 (CET) Received: from smtp.eu.adacore.com ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id XCnd7FY6imXe; Tue, 20 Feb 2018 17:28:37 +0100 (CET) Received: from Xaviers-MacBook-Pro.local (unknown [46.18.100.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.eu.adacore.com (Postfix) with ESMTPSA id 5EA6181386; Tue, 20 Feb 2018 17:28:37 +0100 (CET) Subject: Re: [RFA] Fix frame argument printing when using auto language mode To: Yao Qi Cc: GDB Patches , Joel Brobecker References: <1519044767-8741-1-git-send-email-roirand@adacore.com> From: Xavier Roirand Message-ID: Date: Tue, 20 Feb 2018 16:28:00 -0000 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-IsSubscribed: yes X-SW-Source: 2018-02/txt/msg00264.txt.bz2 Le 2/20/18 à 4:15 PM, Yao Qi a écrit : > On Mon, Feb 19, 2018 at 12:52 PM, Xavier Roirand wrote: >> >> The problem is that GDB prints the S parameter in the pck.call_me Ada >> function using the current language, so the C one, because the program >> is stopped in a C function, whereas it should use the pck.call_me frame >> one. This behavior is ok when user manually changes the language but it's >> not the right one when language is auto. > > Agreed, GDB should use per-frame language instead of global current > language. However, instead of switching global variable current_language, > why don't we pass the per-frame language down to la_val_print? In > ada-valprint.c:ada_val_print, > > ada_val_print_1 (type, embedded_offset, address, > stream, recurse, val, options, > current_language); > ^^^^^^^^^^^^^^^^^ > > why don't pass language for ada here? > Hello Yao, It was my first idea, but it would imply a consequent amount of work because when ada_val_print_1 is called, the stack is the following one: #0 ada_val_print_1 #1 ada_val_print #2 val_print (got the language of the frame arg) So if we want to pass the per-frame language down to ada_val_print_1 then in the generic val_print function, we have to change: language->la_val_print (type, embedded_offset, address, stream, recurse, val, &local_opts); to something like: language->la_val_print (type, embedded_offset, address, stream, recurse, val, &local_opts, language); ^^^^^^^^ Fix me if I'm wrong but it means that _val_print functions for all the supported GDB languages have to be modified in order to support the language parameter. Regards.