Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Thiago Jung Bauermann <bauerman@br.ibm.com>
To: gdb-patches@sources.redhat.com
Subject: Re: [rfc] expose gdb values to python
Date: Thu, 25 Sep 2008 04:33:00 -0000	[thread overview]
Message-ID: <gbf491$tv9$1@ger.gmane.org> (raw)
In-Reply-To: <20080921042657.GB29631@caradoc.them.org>

Daniel Jacobowitz wrote:
> On Fri, Sep 19, 2008 at 04:39:12PM -0600, Tom Tromey wrote:
>> Thiago> I believe it's better to avoid using current_language, right?
>> Thiago> I don't think there's a way to get a sensible language_defn to
>> Thiago> use here, so my only idea is to add an element to struct value
>> Thiago> which holds the language associated with the value. This
>> Thiago> element would be filled at the moment the value is created.
>> 
>> My first reaction to this was "no way".

Well, thanks for the sincerity I suppose. :-)

>> But, I couldn't think of a 
>> concrete case where this would have bad results -- especially provided
>> we restrict use of the language field to stringifying the value.
> 
> This seems iffy.  A value's just a value - how it's printed depends on
> how it's used, not how it was created.  e.g. if two languages had
> different number formatting, "print $1" should generate different
> results based on the current language.
> 
> So what the right language is may depend on the context.

My reasoning was that if a value comes from a C context (for example),
at least at first I'd expect it to always be printed in C syntax. But
I see your point. And I have no preference, really.

So leaving current_language in valpy_str is acceptable? Then one FIXME
can be just dropped.

>> There are some intermediate ideas, too, like allowing the invisible
>> approach only when the field name is unique; or we could define the
>> search order.  (It is tempting to use the language's rules, but I
>> suspect this might be too tricky to get right.)
> 
> Why isn't this the same as for expression evaluation in GDB today?
> That does follow the language rules (and fail, in some cases).

From what I understood of the expression evaluator, this means just
calling value_struct_elt to find the element. If that's the case, it's what
this patch implements.

Is it useful to provide a casting mechanism, to enable for instance access
to elements from a specific type in the inheritance hierarchy?

With that, a python script will have the same capability as the user at the
GDB prompt to access any struct/class element, right?

But I'd leave type casting to the (still to be written) patch exposing the
type system to python.

> I'm not sure we really need length to work, but I haven't spent much
> time looking at it.  If we don't, I'd rather it failed always than
> intermittently.

A function which always fails? I can write that. :-)
-- 
[]'s
Thiago Jung Bauermann
IBM Linux Technology Center


  reply	other threads:[~2008-09-25  4:33 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-12  6:05 Thiago Jung Bauermann
2008-09-20 21:29 ` Tom Tromey
2008-09-21  4:27   ` Daniel Jacobowitz
2008-09-25  4:33     ` Thiago Jung Bauermann [this message]
2008-09-25 11:47       ` Daniel Jacobowitz
2008-09-26  2:00         ` Thiago Jung Bauermann
2008-09-26  9:30           ` Eli Zaretskii
2008-09-28  1:19             ` Thiago Jung Bauermann
2008-09-28 18:19               ` Eli Zaretskii
2008-09-29 16:16                 ` Thiago Jung Bauermann
2008-09-29 17:00                   ` Daniel Jacobowitz
2008-09-30  4:07                     ` Thiago Jung Bauermann
2008-09-30 12:41                       ` Daniel Jacobowitz
2008-10-01  3:18                         ` Thiago Jung Bauermann
2008-10-01 11:40                           ` Daniel Jacobowitz
2008-09-29 18:52                   ` Eli Zaretskii
2008-09-26 20:57           ` Daniel Jacobowitz
2008-10-01  5:39           ` Joel Brobecker
2008-10-04 22:14             ` Thiago Jung Bauermann
2008-09-25  4:49   ` Thiago Jung Bauermann
2008-09-26 23:08     ` Tom Tromey
2008-10-01  5:48   ` Joel Brobecker
2008-10-01 15:12     ` Tom Tromey
2008-10-01 16:04       ` Joel Brobecker
2008-10-04 22:21       ` Daniel Jacobowitz
2008-10-05  0:00         ` Tom Tromey
2008-10-06 18:49           ` Joel Brobecker
2008-10-06 21:15           ` Daniel Jacobowitz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='gbf491$tv9$1@ger.gmane.org' \
    --to=bauerman@br.ibm.com \
    --cc=gdb-patches@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox