예제 #1
0
    def _attach_u(self):
        libpath = BPF.find_library(self.library)
        if libpath is None:
            libpath = ProcUtils.which(self.library)
        if libpath is None or len(libpath) == 0:
            self._bail("unable to find library %s" % self.library)

        if self.probe_type == "u":
            for i, location in enumerate(self.usdt.locations):
                self.bpf.attach_uprobe(name=libpath,
                                       addr=location.address,
                                       fn_name=self.usdt_thunk_names[i],
                                       pid=self.pid or -1)
        elif self.probe_type == "r":
            self.bpf.attach_uretprobe(name=libpath,
                                      sym=self.function,
                                      fn_name=self.probe_func_name,
                                      pid=self.pid or -1)
        else:
            self.bpf.attach_uprobe(name=libpath,
                                   sym=self.function,
                                   fn_name=self.probe_func_name,
                                   pid=self.pid or -1)
예제 #2
0
파일: argdist.py 프로젝트: bbotte/bcc
        def _attach_u(self):
                libpath = BPF.find_library(self.library)
                if libpath is None:
                        libpath = ProcUtils.which(self.library)
                if libpath is None or len(libpath) == 0:
                        self._bail("unable to find library %s" % self.library)

                if self.probe_type == "u":
                        for i, location in enumerate(self.usdt.locations):
                                self.bpf.attach_uprobe(name=libpath,
                                        addr=location.address,
                                        fn_name=self.usdt_thunk_names[i],
                                        pid=self.pid or -1)
                elif self.probe_type == "r":
                        self.bpf.attach_uretprobe(name=libpath,
                                                  sym=self.function,
                                                  fn_name=self.probe_func_name,
                                                  pid=self.pid or -1)
                else:
                        self.bpf.attach_uprobe(name=libpath,
                                               sym=self.function,
                                               fn_name=self.probe_func_name,
                                               pid=self.pid or -1)
예제 #3
0
파일: trace.py 프로젝트: AoJ/bcc
        def _attach_u(self, bpf):
                libpath = BPF.find_library(self.library)
                if libpath is None:
                        # This might be an executable (e.g. 'bash')
                        libpath = ProcUtils.which(self.library)
                if libpath is None or len(libpath) == 0:
                        self._bail("unable to find library %s" % self.library)

                if self.probe_type == "u":
                        for i, location in enumerate(self.usdt.locations):
                                bpf.attach_uprobe(name=libpath,
                                        addr=location.address,
                                        fn_name=self.usdt_thunk_names[i],
                                        pid=Probe.pid)
                elif self.probe_type == "r":
                        bpf.attach_uretprobe(name=libpath,
                                             sym=self.function,
                                             fn_name=self.probe_name,
                                             pid=Probe.pid)
                else:
                        bpf.attach_uprobe(name=libpath,
                                          sym=self.function,
                                          fn_name=self.probe_name,
                                          pid=Probe.pid)
예제 #4
0
파일: trace.py 프로젝트: zaafar/bcc
    def _attach_u(self, bpf):
        libpath = BPF.find_library(self.library)
        if libpath is None:
            # This might be an executable (e.g. 'bash')
            libpath = ProcUtils.which(self.library)
        if libpath is None or len(libpath) == 0:
            self._bail("unable to find library %s" % self.library)

        if self.probe_type == "u":
            for i, location in enumerate(self.usdt.locations):
                bpf.attach_uprobe(name=libpath,
                                  addr=location.address,
                                  fn_name=self.usdt_thunk_names[i],
                                  pid=Probe.pid)
        elif self.probe_type == "r":
            bpf.attach_uretprobe(name=libpath,
                                 sym=self.function,
                                 fn_name=self.probe_name,
                                 pid=Probe.pid)
        else:
            bpf.attach_uprobe(name=libpath,
                              sym=self.function,
                              fn_name=self.probe_name,
                              pid=Probe.pid)