GDB (xrefs)
/tmp/gdb-7.10/gdb/varobj-iter.h
Go to the documentation of this file.
1 /* Iterator of varobj.
2  Copyright (C) 2013-2015 Free Software Foundation, Inc.
3 
4  This program is free software; you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation; either version 3 of the License, or
7  (at your option) any later version.
8 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with this program. If not, see <http://www.gnu.org/licenses/>. */
16 
17 /* A node or item of varobj, composed of the name and the value. */
18 
19 typedef struct varobj_item
20 {
21  /* Name of this item. */
22  char *name;
23 
24  /* Value of this item. */
25  struct value *value;
26 } varobj_item;
27 
28 struct varobj_iter_ops;
29 
30 /* A dynamic varobj iterator "class". */
31 
33 {
34  /* The 'vtable'. */
35  const struct varobj_iter_ops *ops;
36 
37  /* The varobj this iterator is listing children for. */
38  struct varobj *var;
39 
40  /* The next raw index we will try to check is available. If it is
41  equal to number_of_children, then we've already iterated the
42  whole set. */
44 };
45 
46 /* The vtable of the varobj iterator class. */
47 
49 {
50  /* Destructor. Releases everything from SELF (but not SELF
51  itself). */
52  void (*dtor) (struct varobj_iter *self);
53 
54  /* Returns the next object or NULL if it has reached the end. */
55  varobj_item *(*next) (struct varobj_iter *self);
56 };
57 
58 /* Returns the next varobj or NULL if it has reached the end. */
59 
60 #define varobj_iter_next(ITER) (ITER)->ops->next (ITER)
61 
62 /* Delete a varobj_iter object. */
63 
64 #define varobj_iter_delete(ITER) \
65  do \
66  { \
67  if ((ITER) != NULL) \
68  { \
69  (ITER)->ops->dtor (ITER); \
70  xfree (ITER); \
71  } \
72  } while (0)
Definition: varobj.h:89
void(* dtor)(struct varobj_iter *self)
Definition: varobj-iter.h:52
const struct varobj_iter_ops * ops
Definition: varobj-iter.h:35
struct varobj_item varobj_item
char * name
Definition: varobj-iter.h:22
Definition: value.c:172
int next_raw_index
Definition: varobj-iter.h:43
struct value * value
Definition: varobj-iter.h:25
struct varobj * var
Definition: varobj-iter.h:38