Build failure with probe patch
Commit Message
On Thu, 2015-02-19 at 15:53 -0500, Sergio Durigan Junior wrote:
> >
> > This looks good to me.
>
> This is OK with a ChangeLog entry, and after you address Jose's request.
OK, here is the patch (and ChangeLog) after I added a comment about
initializing arg.expr. I will go ahead and check it in later today.
Steve Ellcey
sellcey@imgtec.com
2015-02-19 Steve Ellcey <sellcey@imgtec.com>
* dtrace-probe.c (dtrace_process_dof_probe): Initialize arg.expr.
(dtrace_get_probes) Change dof type.
Comments
On Thursday, February 19 2015, Steve Ellcey wrote:
> On Thu, 2015-02-19 at 15:53 -0500, Sergio Durigan Junior wrote:
>
>> >
>> > This looks good to me.
>>
>> This is OK with a ChangeLog entry, and after you address Jose's request.
>
> OK, here is the patch (and ChangeLog) after I added a comment about
> initializing arg.expr. I will go ahead and check it in later today.
Thanks, Steve. Small nits below.
> Steve Ellcey
> sellcey@imgtec.com
>
>
> 2015-02-19 Steve Ellcey <sellcey@imgtec.com>
>
> * dtrace-probe.c (dtrace_process_dof_probe): Initialize arg.expr.
> (dtrace_get_probes) Change dof type.
I prefer "Change type of variable 'dof'".
>
>
> diff --git a/gdb/dtrace-probe.c b/gdb/dtrace-probe.c
> index a6544ba..5b41e6b 100644
> --- a/gdb/dtrace-probe.c
> +++ b/gdb/dtrace-probe.c
> @@ -415,6 +415,9 @@ dtrace_process_dof_probe (struct objfile *objfile,
> struct dtrace_probe_arg arg;
> struct expression *expr;
>
> + /* Set arg.expr to ensure all fields in expr are initialized and
> + the compiler will not warn when arg is used. */
> + arg.expr = NULL;
> arg.type_str = xstrdup (p);
>
> /* Use strtab_size as a sentinel. */
> @@ -617,17 +620,17 @@ dtrace_get_probes (VEC (probe_p) **probesp, struct objfile *objfile)
> {
> if (elf_section_data (sect)->this_hdr.sh_type == SHT_SUNW_dof)
> {
> - struct dtrace_dof_hdr *dof;
> + bfd_byte *dof;
>
> /* Read the contents of the DOF section and then process it to
> extract the information of any probe defined into it. */
> - if (!bfd_malloc_and_get_section (abfd, sect, (bfd_byte **) &dof))
> + if (!bfd_malloc_and_get_section (abfd, sect, &dof))
> complaint (&symfile_complaints,
> _("could not obtain the contents of"
> "section '%s' in objfile `%s'."),
> sect->name, abfd->filename);
>
> - dtrace_process_dof (sect, objfile, probesp, dof);
> + dtrace_process_dof (sect, objfile, probesp, (struct dtrace_dof_hdr *) dof);
This line is too long. Break it after "probesp,".
> xfree (dof);
> }
> }
OK with those changes.
Thanks,
On Thu, 2015-02-19 at 16:52 -0500, Sergio Durigan Junior wrote:
> > 2015-02-19 Steve Ellcey <sellcey@imgtec.com>
> >
> > * dtrace-probe.c (dtrace_process_dof_probe): Initialize arg.expr.
> > (dtrace_get_probes) Change dof type.
>
> I prefer "Change type of variable 'dof'".
Ok.
> > - dtrace_process_dof (sect, objfile, probesp, dof);
> > + dtrace_process_dof (sect, objfile, probesp, (struct dtrace_dof_hdr *) dof);
>
> This line is too long. Break it after "probesp,".
OK, I will break that line up (should have seen that myself).
Steve Ellcey
sellcey@imgtec
@@ -415,6 +415,9 @@ dtrace_process_dof_probe (struct objfile *objfile,
struct dtrace_probe_arg arg;
struct expression *expr;
+ /* Set arg.expr to ensure all fields in expr are initialized and
+ the compiler will not warn when arg is used. */
+ arg.expr = NULL;
arg.type_str = xstrdup (p);
/* Use strtab_size as a sentinel. */
@@ -617,17 +620,17 @@ dtrace_get_probes (VEC (probe_p) **probesp, struct objfile *objfile)
{
if (elf_section_data (sect)->this_hdr.sh_type == SHT_SUNW_dof)
{
- struct dtrace_dof_hdr *dof;
+ bfd_byte *dof;
/* Read the contents of the DOF section and then process it to
extract the information of any probe defined into it. */
- if (!bfd_malloc_and_get_section (abfd, sect, (bfd_byte **) &dof))
+ if (!bfd_malloc_and_get_section (abfd, sect, &dof))
complaint (&symfile_complaints,
_("could not obtain the contents of"
"section '%s' in objfile `%s'."),
sect->name, abfd->filename);
- dtrace_process_dof (sect, objfile, probesp, dof);
+ dtrace_process_dof (sect, objfile, probesp, (struct dtrace_dof_hdr *) dof);
xfree (dof);
}
}