This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA] Fix frame argument printing when using auto language mode
- From: Xavier Roirand <roirand at adacore dot com>
- To: Yao Qi <qiyaoltc at gmail dot com>
- Cc: GDB Patches <gdb-patches at sourceware dot org>, Joel Brobecker <brobecker at adacore dot com>
- Date: Tue, 20 Feb 2018 17:28:36 +0100
- Subject: Re: [RFA] Fix frame argument printing when using auto language mode
- Authentication-results: sourceware.org; auth=none
- References: <1519044767-8741-1-git-send-email-roirand@adacore.com> <CAH=s-PM+9dGs12pLNDZTcr69tdkTMDdyFhAwhHHL037vkvqCKQ@mail.gmail.com>
Le 2/20/18 à 4:15 PM, Yao Qi a écrit :
On Mon, Feb 19, 2018 at 12:52 PM, Xavier Roirand <roirand@adacore.com> 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 <language>_val_print functions for
all the supported GDB languages have to be modified in order to support
the language parameter.
Regards.