Re: tracepoints implementation: bug in byte code generating.

Michael Snyder
2000-10-19T10:32:00Z

> Generating code for remote traces, the case of "pointer1->pointer2->data"
> was not covered if pointer2's declaration involved a typedef. This simple
> fix should take care of that by checking the target type whenever the code
> is TYPE_CODE_TYPEDEF.
>
> Regards - Josef Ezra

Josef, your change is good, but let me make it better
and feed it back to you for YOUR approval. In the process,
I'll show you what we would like submissions to look like.

Your problem description is fine, but this is what a
change log entry looks like:

2000-10-19 Josef Ezra <jezra@emc.com>

* while generating data code, cases of "collect p1->p2->data"
where not covered if p2 is a 'typedefed' type. this simple
fix should forward the type pointer to the real type.

And there is already a gdb function called CHECK_TYPEDEF
for doing what you want to do:

*** ax-gdb.c 2000/07/30 01:48:24 1.6
--- ax-gdb.c 2000/10/19 17:31:08
*************** gen_struct_ref (struct agent_expr *ax, s
*** 1342,1348 ****
gen_usual_unary (ax, value);
gen_deref (ax, value);
}
! type = value->type;

/* This must yield a structure or a union. */
if (TYPE_CODE (type) != TYPE_CODE_STRUCT
--- 1342,1348 ----
gen_usual_unary (ax, value);
gen_deref (ax, value);
}
! type = CHECK_TYPEDEF (value->type);

/* This must yield a structure or a union. */
if (TYPE_CODE (type) != TYPE_CODE_STRUCT

OK for me to accept your change as modified?
Thanks,
Michael Snyder
From msnyder@redhat.com Thu Oct 19 10:35:00 2000
From: Michael Snyder <msnyder@redhat.com>
To: DJ Delorie <dj@delorie.com>
Cc: gdb-patches@sourceware.cygnus.com, jezra@emc.com
Subject: Re: tracepoints implementation: bug in byte code generating.
Date: Thu, 19 Oct 2000 10:35:00 -0000
Message-id: <39EF30ED.5E33@redhat.com>
References: <00c801c02c9a$fe671c90$6c219fa8@lss.emc.com> <39D8D1CE.3059@redhat.com> <004e01c039d8$774c1d50$6c219fa8@lss.emc.com> <39EF3020.3F6A@redhat.com> <200010191733.NAA03317@envy.delorie.com>
X-SW-Source: 2000-10/msg00119.html
Content-length: 469

DJ Delorie wrote:
>
> > Your problem description is fine, but this is what a
> > change log entry looks like:
> >
> > 2000-10-19 Josef Ezra <jezra@emc.com>
> >
> > * while generating data code, cases of "collect p1->p2->data"
> > where not covered if p2 is a 'typedefed' type. this simple
> > fix should forward the type pointer to the real type.
>
> Actually, it should be "* ax-gdb.c (gen_struct_ref): While
> generating..."

Oops. Right.
From jezra@emc.com Thu Oct 19 11:02:00 2000
From: "Josef Ezra" <jezra@emc.com>
To: "Michael Snyder" <msnyder@redhat.com>
Cc: <gdb-patches@sources.redhat.com>, "ezra, josef" <ezra_josef@emc.com>, <shagam@emc.com>, <sgordon@emc.com>
Subject: Re: tracepoints implementation: bug in byte code generating.
Date: Thu, 19 Oct 2000 11:02:00 -0000
Message-id: <005b01c039f6$f46b1390$6c219fa8@lss.emc.com>
References: <00c801c02c9a$fe671c90$6c219fa8@lss.emc.com> <39D8D1CE.3059@redhat.com> <004e01c039d8$774c1d50$6c219fa8@lss.emc.com> <39EF3020.3F6A@redhat.com>
X-SW-Source: 2000-10/msg00120.html
Content-length: 1925

> Josef Ezra wrote:
> >
> > Generating code for remote traces, the case of
"pointer1->pointer2->data"
> > was not covered if pointer2's declaration involved a typedef. This
simple
> > fix should take care of that by checking the target type whenever the
code
> > is TYPE_CODE_TYPEDEF.
> >
> > Regards - Josef Ezra
>
> Josef, your change is good, but let me make it better
> and feed it back to you for YOUR approval. In the process,
> I'll show you what we would like submissions to look like.
>
> Your problem description is fine, but this is what a
> change log entry looks like:
>
> 2000-10-19 Josef Ezra <jezra@emc.com>
>
> * while generating data code, cases of "collect p1->p2->data"
> where not covered if p2 is a 'typedefed' type. this simple
> fix should forward the type pointer to the real type.
>
> And there is already a gdb function called CHECK_TYPEDEF
> for doing what you want to do:
>
> *** ax-gdb.c 2000/07/30 01:48:24 1.6
> --- ax-gdb.c 2000/10/19 17:31:08
> *************** gen_struct_ref (struct agent_expr *ax, s
> *** 1342,1348 ****
> gen_usual_unary (ax, value);
> gen_deref (ax, value);
> }
> ! type = value->type;
>
> /* This must yield a structure or a union. */
> if (TYPE_CODE (type) != TYPE_CODE_STRUCT
> --- 1342,1348 ----
> gen_usual_unary (ax, value);
> gen_deref (ax, value);
> }
> ! type = CHECK_TYPEDEF (value->type);
>
> /* This must yield a structure or a union. */
> if (TYPE_CODE (type) != TYPE_CODE_STRUCT
>
> OK for me to accept your change as modified?
> Thanks,
> Michael Snyder
>

Michael

1. Your code is better. I can't resist this modification.
2. In the future, I will try to follow change-log-entry roles, sorry for
this one.
3. I would like to add commands to the remote protocol, is there a gnu
routine to standardizes some of those changed?

Thanks again
Josef Ezra