Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* has_more="0" with pretty-printer installed
@ 2013-11-11  7:26 Yao Qi
  2013-11-11  7:37 ` Yao Qi
       [not found] ` <CEA8125BCE884349929B204B961E547140798705@DEBOSVPEX001.ent.rt.verigy.net>
  0 siblings, 2 replies; 3+ messages in thread
From: Yao Qi @ 2013-11-11  7:26 UTC (permalink / raw)
  To: gdb

Hi,
I find the output of "-var-create" in gdb.python/py-mi.exp confuses me a 
little,

-var-create container @ c^M
^done,name="container",numchild="0",value="{...}",type="zzz_type",thread-id="1",dynamic="1",has_more="0"^M
                                                  ^^^^^^^^^^^^
(gdb) ^M
PASS: gdb.python/py-mi.exp: create container varobj

On this test, pretty-printer is installed, and 'c' is of type 'zzz_type',

struct container
{
   string name;
   int len;
   int *elements;
};

typedef struct container zzz_type;

IIUC, has_more should be 1 here, because c has three fields.  Am I 
missing something?  The minimum steps to reproduce this problem are:

$ ./gdb ./testsuite/gdb.python/py-mi
(gdb) b main
Breakpoint 1 at 0x80485ee: file 
../../../../git/gdb/testsuite/gdb.python/py-prettyprint.c, line 264.
(gdb) run
Starting program: 
/home/yao/Source/gnu/gdb/build-git/x86/gdb/testsuite/gdb.python/py-mi

Breakpoint 1, main () at 
../../../../git/gdb/testsuite/gdb.python/py-prettyprint.c:264
264       string x = make_string ("this is x");
(gdb) python exec (open 
('gdb/git/gdb/testsuite/gdb.python/py-prettyprint.py').read ())
(gdb) interpreter-exec mi "-enable-pretty-printing"
^done
(gdb) interpreter-exec mi "-var-create container @ c"
^done,name="container",numchild="0",value="{...}",type="zzz_type",thread-id="1",dynamic="1",has_more="1"
                                                  ^^^^^^^^^^^
// note: at this point, has_more is 1, which looks right to me

(gdb) b 329
Breakpoint 2 at 0x804871e: file 
../../../../git/gdb/testsuite/gdb.python/py-prettyprint.c, line 329.
(gdb) c
Continuing.

Breakpoint 2, main () at 
../../../../git/gdb/testsuite/gdb.python/py-prettyprint.c:329
329       add_item (&c, 23);            /* MI breakpoint here */
(gdb) interpreter-exec mi "-var-create container1 @ c"
^done,name="container1",numchild="0",value="{...}",type="zzz_type",thread-id="1",dynamic="1",has_more="0"
                                                  ^^^^^^^^^^^^

// has_more becomes 0.

-- 
Yao (齐尧)


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

* Re: has_more="0" with pretty-printer installed
  2013-11-11  7:26 has_more="0" with pretty-printer installed Yao Qi
@ 2013-11-11  7:37 ` Yao Qi
       [not found] ` <CEA8125BCE884349929B204B961E547140798705@DEBOSVPEX001.ent.rt.verigy.net>
  1 sibling, 0 replies; 3+ messages in thread
From: Yao Qi @ 2013-11-11  7:37 UTC (permalink / raw)
  To: gdb

On 11/11/2013 03:24 PM, Yao Qi wrote:
> (gdb) b 329
> Breakpoint 2 at 0x804871e: file
> ../../../../git/gdb/testsuite/gdb.python/py-prettyprint.c, line 329.
> (gdb) c
> Continuing.
>
> Breakpoint 2, main () at
> ../../../../git/gdb/testsuite/gdb.python/py-prettyprint.c:329
> 329       add_item (&c, 23);            /* MI breakpoint here */

You should set breakpoint on line 328 to reproduce it.
A blank line is added in my gdb.python/py-prettyprint.c.

-- 
Yao (齐尧)


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

* Re: has_more="0" with pretty-printer installed
       [not found] ` <CEA8125BCE884349929B204B961E547140798705@DEBOSVPEX001.ent.rt.verigy.net>
@ 2013-11-11 13:04   ` Yao Qi
  0 siblings, 0 replies; 3+ messages in thread
From: Yao Qi @ 2013-11-11 13:04 UTC (permalink / raw)
  To: Elmenthaler, Jens; +Cc: gdb

On 11/11/2013 04:05 PM, Elmenthaler, Jens wrote:
> Since dynamic is true, there is a pretty printer registered for zzz_type or struct container. Struct container looks like a collection, so the purpose of the pretty printer probably is to show its elements as children, not the struct's data members itself. If nobody add elements to the container, the number of its children will be 0. Just a guess, of course, ...

Your are right, the pretty printer shows field "elements" of "struct
container" as children, instead of "struct container"'s fields.  Thanks!

-- 
Yao (齐尧)


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

end of thread, other threads:[~2013-11-11 13:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-11  7:26 has_more="0" with pretty-printer installed Yao Qi
2013-11-11  7:37 ` Yao Qi
     [not found] ` <CEA8125BCE884349929B204B961E547140798705@DEBOSVPEX001.ent.rt.verigy.net>
2013-11-11 13:04   ` Yao Qi

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