Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* Re: [PATCH] -var-update
@ 2006-05-20  6:21 Nick Roberts
  2006-05-20 16:34 ` Daniel Jacobowitz
  0 siblings, 1 reply; 10+ messages in thread
From: Nick Roberts @ 2006-05-20  6:21 UTC (permalink / raw)
  To: Vladimir Prus; +Cc: gdb-patches


> > Anyway here's a patch that actually seems to work.  I've taken code from
> > c_val_print.  Maybe there should be more checks and I've not tested
> > varobj_set_value (-var-assign) yet, but I thought I'd sound out the
> > genaral approcah first.

> I think that in any case, you should add a function and call it, instead of
> adding three identical code fragments.

It's just for discussion, not a finalised patch for approval.

>                                         BTW, why coerce_ref is not suitable
> here?

coerce_ref ensures that the address is placed in the value's contents, not
the actual value which is being referred to.

-- 
Nick                                           http://www.inet.net.nz/~nickrob


^ permalink raw reply	[flat|nested] 10+ messages in thread
* Re: Variable objects: references formatting
@ 2006-05-03 23:05 Nick Roberts
  2006-05-04  7:00 ` Vladimir Prus
  0 siblings, 1 reply; 10+ messages in thread
From: Nick Roberts @ 2006-05-03 23:05 UTC (permalink / raw)
  To: Vladimir Prus; +Cc: gdb-patches


> At the moment, when using variable objects to display a struct or a class,
> the result of -data-evaluate-expression is "...". However, when displaying
> a reference to a class, the result of -data-evaluate-expression is
> {}-enclosed list of members and their values.

> This disparity does not seem to be reasonable, the attached patch fixes it:

> Changelog:

>   2006-05-03 Vladimir Prus <ghost@cs.msu.su>
>       varobj.c (c_value_of_variable): Ignore top-level references.

> Patch attached.

> Thanks,
> Volodya

There are som many things about this patch that I don't understand:

> Index: varobj.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/varobj.c,v
> retrieving revision 1.58

Version 1.59 has been in the repository for over a month, so how come this
patch is against 1.58?

> diff -u -r1.58 varobj.c
> @@ -2055,8 +2219,14 @@

I'm not used to unified diffs, but as insertion appears to be done at the
same place why is it not something like:

@@ -2055,8 +2055,14 @@

>  {
>    /* BOGUS: if val_print sees a struct/class, it will print out its
>       children instead of "{...}" */
> +  struct type* type = get_type (var);
> +  /* Strip top-level references. */
> +  while (TYPE_CODE (type) == TYPE_CODE_REF)
> +    {
> +      type = TYPE_TARGET_TYPE (type);
> +    }
>  
> -  switch (TYPE_CODE (get_type (var)))
> +  switch (TYPE_CODE (type))
>      {
>      case TYPE_CODE_STRUCT:
>      case TYPE_CODE_UNION:


Most importantly, however, the preamble is about -data-evaluate-expression
but AFAICS this doesn't call c_value_of_variable.

I have tested the output of -data-evaluate-expression on pointers to typedeffed
structures and found that with the latter I get a {}-enclosed list of members
with gcc 3.2 and {...} with gcc 4.1.  More generally, I have found that gcc 4.1
treats typedefs differently, which leads to errors with variable objects.

So clearly I also don't understand how Jim can think that the patch looks
good and he'll apply it.


-- 
Nick                                           http://www.inet.net.nz/~nickrob


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2006-05-25  0:26 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-05-20  6:21 [PATCH] -var-update Nick Roberts
2006-05-20 16:34 ` Daniel Jacobowitz
2006-05-21  2:04   ` Nick Roberts
2006-05-21  5:22     ` Daniel Jacobowitz
2006-05-21 23:04       ` Nick Roberts
2006-05-25  0:21         ` Nick Roberts
2006-05-25  0:26           ` [patch] Fixes problem setting breakpoint in dynamic loader PAUL GILLIAM
2006-05-25  0:29             ` PAUL GILLIAM
  -- strict thread matches above, loose matches on Subject: below --
2006-05-03 23:05 Variable objects: references formatting Nick Roberts
2006-05-04  7:00 ` Vladimir Prus
2006-05-04  7:20   ` Nick Roberts
2006-05-04 12:10     ` Vladimir Prus
2006-05-08 12:41       ` [PATCH] -var-update [was Re: Variable objects: references formatting] Nick Roberts
2006-05-15 16:54         ` Daniel Jacobowitz
2006-05-17  0:45           ` Nick Roberts
2006-05-17  1:28             ` Daniel Jacobowitz
2006-05-17  1:43               ` Nick Roberts
2006-05-17  3:39                 ` Daniel Jacobowitz
2006-05-19  7:41                   ` [PATCH] -var-update Nick Roberts
2006-05-19  9:47                     ` Vladimir Prus

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox