This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Re: report a segment fault bug of systemtap
- From: Mark Wielaard <mjw at redhat dot com>
- To: "Frank Ch. Eigler" <fche at redhat dot com>
- Cc: maliubiao <maliubiao at gmail dot com>, systemtap at sourceware dot org
- Date: Mon, 13 Jan 2014 11:49:19 +0100
- Subject: Re: report a segment fault bug of systemtap
- Authentication-results: sourceware.org; auth=none
- References: <CAFiE4-7SMukWFiRCau50PQWXOQ8QdHMAgAH38vpscJTAv+JeNA at mail dot gmail dot com> <y0mob3iqtja dot fsf at fche dot csb>
On Sat, 2014-01-11 at 13:10 -0500, Frank Ch. Eigler wrote:
> It seems like incomplete DWARF data can result in elfutils passing
> NULL char*'s to the stap translator, which the latter is not always
> prepared to tolerate. We encountered this same problem here yesterday
> and committed a patch.
I quickly looked at the patch and I do think elfutils is allowed to
return NULL indeed. And you should guard against it.
dwarf_decl_file () will return NULL when there is no DW_AT_decl_file
attribute, if the value is zero (which indicates no source information
was recorded by the compiler) or if the .debug_line section isn't
valid/doesn't contain the indicated source file.
dwarf_diename () will return NULL when no DW_AT_name attribute can be
found (which isn't guaranteed to be produced by the compiler in all
cases). Or if the DW_AT_name is wrongly encoded (isn't a string).
In particular for CUs a DW_TAG_compile_unit often does have a name (the
primary source the compiler used), but a DW_TAG_partial_unit often
doesn't have one (since there it might be unclear whether there even is
a primary source file in that case).
Cheers,
Mark