def set_break(self, filename, lineno, temporary=False, cond=None, funcname=None, **kwargs): """ Sets a breakpoint. This is overridden to account for the filecache and for unreachable lines. **kwargs are ignored. This is to work with payloads that pass extra fields to the set_break payload. """ filename = self.canonic(filename) if filename else self.default_file try: self.get_line(filename, lineno) except IndexError: raise QdbUnreachableBreakpoint({ 'file': filename, 'line': lineno, 'temp': temporary, 'cond': cond, 'func': funcname, }) blist = self.breaks.setdefault(filename, []) if lineno not in blist: blist.append(lineno) Breakpoint(filename, lineno, temporary, cond, funcname)
def update_pudb_breakpoints(self, buffname): bps = [] if buffname in self._bps_placed: for ln in self._bps_placed[buffname]: bps.append(self.pudbbp(buffname, int(ln / 10))) for bpt in self.iter_breakpoints(): if bpt.filename == buffname: # we already placed these continue else: # make sure we pass on anything we aren't messing with bps.append(bpt) __logger__.debug( 'Updating breakpoints in pudb:\n %s', pprint.pformat( list(map(lambda x: Breakpoint(x.filename, x.lineno), bps)))) pudb.settings.save_breakpoints( list(map(lambda x: Breakpoint(x.filename, x.lineno), bps)))
def set_break(self, filename, lineno, temporary=0, cond = None, funcname=None): filename = self.canonic(filename) import linecache # Import as late as possible line = linecache.getline(filename, lineno) if not line: return 'Line %s:%d does not exist' % (filename, lineno) if not filename in self.breaks: self.breaks[filename] = [] list = self.breaks[filename] if not lineno in list: list.append(lineno) bp = Breakpoint(filename, lineno, temporary, cond, funcname) self.mybp.append(bp)