Beispiel #1
0
    def _generate_program(self):
        self.program = """
#include <linux/ptrace.h>
#include <linux/sched.h>        /* For TASK_COMM_LEN */

"""
        self.program += BPF.generate_auto_includes(
            map(lambda p: p.raw_probe, self.probes))
        self.program += Tracepoint.generate_decl()
        self.program += Tracepoint.generate_entry_probe()
        for probe in self.probes:
            self.program += probe.generate_program(self.args.include_self)

        if self.args.verbose:
            print(self.program)
Beispiel #2
0
Datei: trace.py Projekt: AoJ/bcc
        def _generate_program(self):
                self.program = """
#include <linux/ptrace.h>
#include <linux/sched.h>        /* For TASK_COMM_LEN */

"""
                self.program += BPF.generate_auto_includes(
                        map(lambda p: p.raw_probe, self.probes))
                self.program += Tracepoint.generate_decl()
                self.program += Tracepoint.generate_entry_probe()
                for probe in self.probes:
                        self.program += probe.generate_program(
                                        self.args.include_self)

                if self.args.verbose:
                        print(self.program)
Beispiel #3
0
        def _generate_program(self):
                bpf_source = """
struct __string_t { char s[%d]; };

#include <uapi/linux/ptrace.h>
                """ % self.args.string_size
                for include in (self.args.include or []):
                        bpf_source += "#include <%s>\n" % include
                bpf_source += BPF.generate_auto_includes(
                                map(lambda p: p.raw_spec, self.probes))
                bpf_source += Tracepoint.generate_decl()
                bpf_source += Tracepoint.generate_entry_probe()
                for probe in self.probes:
                        bpf_source += probe.generate_text()
                if self.args.verbose:
                        print(bpf_source)
                self.bpf = BPF(text=bpf_source)
Beispiel #4
0
    def _generate_program(self):
        bpf_source = """
struct __string_t { char s[%d]; };

#include <uapi/linux/ptrace.h>
                """ % self.args.string_size
        for include in (self.args.include or []):
            bpf_source += "#include <%s>\n" % include
        bpf_source += BPF.generate_auto_includes(
            map(lambda p: p.raw_spec, self.probes))
        bpf_source += Tracepoint.generate_decl()
        bpf_source += Tracepoint.generate_entry_probe()
        for probe in self.probes:
            bpf_source += probe.generate_text()
        if self.args.verbose:
            print(bpf_source)
        self.bpf = BPF(text=bpf_source)