This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Using systemtap to validate manual code inspection.


On Tue, May 07, 2013 at 12:18:47PM -0400, Carlos O'Donell wrote:
> On 05/07/2013 11:26 AM, Frank Ch. Eigler wrote:
> > =?utf-8?B?T25kxZllaiBCw61sa2E=?= <neleai@seznam.cz> writes:
> > 
> >> [...]
> >>>> This is really neat, but the problem here is not limited to systemtap
> >>>> needing root privileges.  [...]
> > 
> > (Technically, stapusr/stapdev group memberships are sufficient as opposed
> > to root, but still.)
> > 
> >> [...]
> >> You can do this without annotating source. Use diff approach, for probe
> >> copy fragment consisting of three lines before and three after with
> >> relevant code, for example bug with freed memory could be writen as:
> >>
> >> START_DIFF
> >>
> >> some_func (int *in)
> >> {
> >> + PROBE{ 
> >> + free(in);
> >> + }
> >> glob = *in;
> >> }
> >>
> >> END_DIFF
> >>
> >> Three lines are in 99.9% cases enough to uniquely determine position in code, when ambiguous
> >> write bigger fragment.
> > 
> > This sort of thing has been noted before as a systemtap RFE: 
> > http://sourceware.org/bugzilla/show_bug.cgi?id=12992
> > 
> > Another solution is to compile in more sys/sdt.h macro invocations
> > into such paths:
> >      #include <sys/sdt.h>
> > 
> >      some_func(int *in)
> >      {
> >           free (in);
> >           STAP_PROBE1(error_inject_site_NNN, & value);
> >           glob = *in;
> >      }                         
> > then stap (and gdb) can locate them easily.
> > 
> > If you don't want to compile anything at all in, but source markup is
> > practical, then a straightforward shell script can synthesize stap
> > (or gdb) scripts from "grep -n PATTERN *".
> 
> So that's a real issue. The compiler generated debug information
> may not allow you to inject the failure, and in those cases we
> will have to use a "failure probe".
> 
If we add code like this then we could directy use macro that runs code
in debug build when environment variable is set and we could avoid
systemtap which becomes retundant.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]