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.


=?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 *".

- FChE


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