Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

generic gdb macro for tree walk.

68 views
Skip to first unread message

sinbad

unread,
Mar 8, 2017, 12:21:46 AM3/8/17
to
Hi,

Is it possible to write generic gdb macro for a tree walk. for instance i have two types of trees as follows.
Does gdb macro provide for c_macro style replacement so that i can specifiy what is the left pointer and right
pointer and the data variable for the tree.

typedef struct tree_one_data {
int x;
}tree_one_data_t;

typedef struct tree_one {
void *left;
void *right
tree_one_data_t *data;
};

typedef struct tree_one_data {
char x;
}tree_two_data_t;

typedef struct tree_two {
void *lpointer;
void *rpointer;
tree_two_data_t *data;
};

thanks

sp...@potato.field

unread,
Mar 8, 2017, 4:39:28 AM3/8/17
to
On Tue, 7 Mar 2017 21:21:43 -0800 (PST)
sinbad <sinbad...@gmail.com> wrote:
>Hi,
>
>Is it possible to write generic gdb macro for a tree walk. for instance i have
>two types of trees as follows.

Do your own coursework. Plus that is a generic C question, not a unix one.

--
Spud


sinbad

unread,
Mar 9, 2017, 12:21:12 AM3/9/17
to
I think you misunderstood me. it's not a C question, it's a gdb macro question and i think this is the right forum to ask.

>Do your own coursework

I did in fact check gdb scripting manual, couldn't find anything obvious.

Jorgen Grahn

unread,
Mar 9, 2017, 12:58:36 AM3/9/17
to
On Thu, 2017-03-09, sinbad wrote:
> I think you misunderstood me. it's not a C question, it's a gdb
> macro question and i think this is the right forum to ask.

I tend to agree. However, I'm unsure if people on c.u.p. generally
know a lot about customizing gdb. I don't, sorry.

>>Do your own coursework
>
> I did in fact check gdb scripting manual, couldn't find anything
> obvious.

Then you have an excuse to ask on a gdb mailing list, if there is one.

/Jorgen

--
// Jorgen Grahn <grahn@ Oo o. . .
\X/ snipabacken.se> O o .

Ben Bacarisse

unread,
Mar 9, 2017, 5:30:34 AM3/9/17
to
sinbad <sinbad...@gmail.com> writes:

> Is it possible to write generic gdb macro for a tree walk. for
> instance i have two types of trees as follows.
> Does gdb macro provide for c_macro style replacement so that i can
> specifiy what is the left pointer and right pointer and the data
> variable for the tree.

I think you've misunderstood what gdb macros are. They are limited to
making C source more comprehensible when using gdb. (That is, unless
*I've* misunderstood since I'm not much of a gdb user!)

So, in short, no.

<snip>
--
Ben.
0 new messages