Search code examples
debugginggdbbreakpointsddd-debugger

how to disable all breakpoints at once in DDD debugger (pydb mode)


Using gdb, we can disable breakpoints as explained on ftp://ftp.gnu.org/old-gnu/Manuals/gdb/html_node/gdb_32.html. On the document, to disalbe all the breakpoints it says to give just disalbe without the breakpoint list. But in my ddd(data-display-debuger), it doesn't work. How can I do it? Or how can I specify the range? (I tried 1-10 but didn't work).

EDIT : I was using DDD for python debugging using command ddd -pydb prog.py arg1 arg2.. so it was actually pydb command, not gdb command. See the comments for the answer, and I later found that for pydb, the command delete without any argument deletes all the breakpoints. For disabling all the breakpoints, you have to modify gdb.py and see comments below.


Solution

  • The commands supported by pydb are similar to those in gdb, but they aren't all the same. Currently, pydb's disable command gives an error if no arguments are given. You can edit pydb's source code (it may be found in /usr/share/pyshared/pydb/ on many systems) and change do_disable (in gdb.py) so that if no args are given to disable, it will disable all breakpoints:

    *** gdb.py.orig 2009-11-17 17:00:21.000000000 -0800
    --- gdb.py  2016-08-20 17:12:09.561338798 -0700
    ***************
    *** 1067,1069 ****
              if len(args) == 0:
    !             self.errmsg('No breakpoint number given.')
                  return
    --- 1067,1071 ----
              if len(args) == 0:
    !             for bp in bdb.Breakpoint.bpbynumber:
    !                 if bp:
    !                     bp.disable()
                  return