Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Vladimir Prus <ghost@cs.msu.su>
To: "Marc Khouzam" <marc.khouzam@ericsson.com>
Cc: gdb-patches@sources.redhat.com,  Eli Zaretskii <eliz@gnu.org>
Subject: Re: [Patch] Try2: -var-evaluate-expression [-f FORMAT] NAME
Date: Fri, 04 Apr 2008 15:17:00 -0000	[thread overview]
Message-ID: <200804041743.37053.ghost@cs.msu.su> (raw)
In-Reply-To: <6D19CA8D71C89C43A057926FE0D4ADAA0429101B@ecamlmw720.eamcs.ericsson.se>

On Wednesday 02 April 2008 23:10:00 Marc Khouzam wrote:
> 
> >         * varobj.h (varobj_get_formatted_value): Declare.
> > >         * varobj.c (my_value_of_variable): Added format parameter.
> > >         (cplus_value_of_variable): Likewise.
> > >         (java_value_of_variable): Likewise.
> > >         (*(value_of_variable)): Likewise.
> > 
> > Is '*(value_of_variable)' really a name of a function? :-)
> 
> After Daniel's comment, I'm not too sure what you guys do 
> for function pointers that are members.... 
> so I removed this Changelog entry. :-)
> 
> > > +/* Parse a string argument into a format value.  */
> > 
> > As meta-remark, can you pass the "-p" option to diff when generating patches,
> > so that function names are present right in the patch?
> 
> 
> Sounds good but I'm not sure how to tell eclipse to do that...
> I'll keep looking, but until then, please forgive my patch since I ran
> it without
> 
> > ..and make mi_parse_format emit an error message both if the passed format
> > is NULL and when it's not NULL, but unknown?
> 
> Yes, that is nicer.  Done.
> 
> 
> > > +       case OP_FORMAT:
> > > +         if (formatFound)
> > > +           error (_("mi_cmd_var_evaluate_expression: cannot specify format more than once"));
> > > +   
> > 
> > I think the current position is that error messages need not name the name of function, since
> > if this error message ever make it to the user, he has no idea what
> > is "mi_cmd_var_evaluate_expression", and when debugging GDB or frontend, it's not very
> > helpful. Can you drop that prefix, here, and everywhere?
> 
> Done, but only in this method.  Other methods should be cleaned up in a separate patch, right?

Right. It's nice to clean up the code you're directly touching, but only that, not all existing
issues :-)

> 
> > > +  if (formatFound)
> > > +    ui_out_field_string (uiout, "value", varobj_get_formatted_value (var, format));
> > 
> > It's not the problem introduced by your patch, but still -- it appears we have a memory
> > leak here. In c_value_of_variable, we either xstrdup the value, or use value_get_print_value
> > which uses ui_file_xstrdup, so we end up with newly allocated char* pointer. I think
> > we have to free it here.
> 
> Good eye!
> But I think you found a bigger problem, as this seems to be the
> case for may other call to varobj.c.  For example, I believe there is also a leak in when
> calling and not freeing:
>   varobj_get_expression
>   varobj_get_type
>   ...
> 
> How do you suggest we handle this?  I can make a patch that attempts to fix all these leaks...

Of course, if you prepare such a patch, it would be great, but you are not in any way
obliged to -- this is not a problem that you introduced and it does not becomes any
worse with your patch.

> > > +  else
> > > +    ui_out_field_string (uiout, "value", varobj_get_value (var));
> > >  
> > > -  ui_out_field_string (uiout, "value", varobj_get_value (var));
> > >    return MI_CMD_DONE;
> > 
> > The code patch is OK with those changes, thanks!
> > Eli, does the doc patch look good for you?
> 
> Thanks, below is the revised patch.  I'll wait for your and Eli's ok.

The code part of this is OK, thanks. Eli, what about the docs?

- Volodya


  parent reply	other threads:[~2008-04-04 13:44 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-01 14:33 Marc Khouzam
2008-04-02  0:17 ` Nick Roberts
2008-04-02 13:23   ` Marc Khouzam
2008-04-02 16:26 ` Vladimir Prus
2008-04-02 18:20   ` Michael Snyder
2008-04-02 18:50     ` Daniel Jacobowitz
2008-04-02 19:10     ` Marc Khouzam
2008-04-02 21:26   ` Marc Khouzam
2008-04-03  4:42     ` Nick Roberts
2008-04-04 15:07       ` Marc Khouzam
2008-04-06  6:42         ` OT: IDES [was RE: Re: [Patch] Try2: -var-evaluate-expression [-f FORMAT] NAME] Nick Roberts
2008-04-06 22:46           ` Daniel Jacobowitz
2008-04-04 15:17     ` Vladimir Prus [this message]
2008-04-08 17:04 ` [Patch] Try2: -var-evaluate-expression [-f FORMAT] NAME Marc Khouzam
2008-04-08 22:24   ` Eli Zaretskii
2008-04-09 14:54     ` Marc Khouzam

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=200804041743.37053.ghost@cs.msu.su \
    --to=ghost@cs.msu.su \
    --cc=eliz@gnu.org \
    --cc=gdb-patches@sources.redhat.com \
    --cc=marc.khouzam@ericsson.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