Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Phil Muldoon <pmuldoon@redhat.com>
To: Thiago Jung Bauermann <bauerman@br.ibm.com>
Cc: Tom Tromey <tromey@redhat.com>,
	        gdb-patches ml <gdb-patches@sourceware.org>
Subject: Re: Python pretty-printing [5/6]
Date: Thu, 09 Apr 2009 15:19:00 -0000	[thread overview]
Message-ID: <49DE11F7.9000501@redhat.com> (raw)
In-Reply-To: <1239289186.30578.18.camel@localhost.localdomain>

Thiago Jung Bauermann wrote:
> El mié, 08-04-2009 a las 18:52 -0600, Tom Tromey escribió:
>   
>> I looked again and I don't see how it can return NULL without setting
>> the exception.  Can you point it out to me?
>>     
>
> I found one potential problem, which could cause the function to return
> NULL without an exception being set (it's not the case I thought of
> before, I think): suppose there's no objfile Python object when this
> function is called, to the ALL_OBJFILES loop will skip all objs, then
> the gdb module has no pretty_printers attribute, or the pretty_printers
> value is not a list object. In that case, the function will return NULL
> without a Python exception being set. Can it happen?
>
>   


This would require the gdb.pretty_printers attribute in the code to be 
changed from a list to something else (or removed for the not existing 
scenario).  Anyway it would require a conscious code change on behalf of 
another author, and not an environmental change. It could happen if 
somebody changed the code, but I suspect (in this scenario) it would 
fail long before it reached here.


> Also, I noticed that the function may return Py_None if no
> pretty-printer is found, and the callers even expect that. The function
> comment needs to be fixed then:
>
> /* Find the pretty-printing constructor function for TYPE.  If no
>    pretty-printer exists, return NULL.  If one exists, return a new
>    reference.  */
>
>   


Yes, my fault.  Missed this :(


>> Thiago> Because of this, pretty_print_one_value can now probably just call
>> Thiago> convert_value_from_python and return a struct value in all cases and be
>> Thiago> done with it. Either this function should be changed to work that way,
>> Thiago> or the comment above removed.
>>
>> I made the minimal change here.  I don't want to refactor this right
>> now; Phil is in the middle of doing that for the embedded \0 problem.
>> We can apply his fix separately; the current code is not ideal, due to
>> this problem, but it is still usable for a variety of printers.
>>     
>
> Fine with me.
>
>   


I'm in the middle of this right now. I'm putting the finishing touches 
on the optional string fetch parameter from the comments posted to the 
archer list, and will start work on fixing string output.


Regards

Phil


  reply	other threads:[~2009-04-09 15:19 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-02 20:57 Tom Tromey
2009-04-03 15:29 ` Eli Zaretskii
2009-04-09  0:29   ` Tom Tromey
2009-04-04 16:39 ` Thiago Jung Bauermann
2009-04-09  0:52   ` Tom Tromey
2009-04-09 15:00     ` Thiago Jung Bauermann
2009-04-09 15:19       ` Phil Muldoon [this message]
2009-04-09 15:41         ` Thiago Jung Bauermann
2009-04-09 16:18           ` Tom Tromey
2009-04-09 15:44       ` Tom Tromey
2009-04-09 19:37     ` Tom Tromey
2009-04-09 22:09       ` Thiago Jung Bauermann
2009-04-09 22:36         ` Tom Tromey
2009-04-07 18:32 ` Joel Brobecker
2009-04-07 18:41   ` Tom Tromey
2009-04-07 20:38     ` Joel Brobecker
2009-04-09  1:08 ` Tom Tromey
2009-04-09  7:40   ` Eli Zaretskii
2009-04-09 16:16     ` Tom Tromey
2009-04-09 16:41       ` Eli Zaretskii

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=49DE11F7.9000501@redhat.com \
    --to=pmuldoon@redhat.com \
    --cc=bauerman@br.ibm.com \
    --cc=gdb-patches@sourceware.org \
    --cc=tromey@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