Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #74368

Re: Save/restore breakpoints between pdb runs

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.mixmin.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed1a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'scripts': 0.03; 'source,': 0.04; 'insert': 0.05; 'debug': 0.07; '"c"': 0.09; "'python": 0.09; 'debugger': 0.09; 'executable': 0.09; 'exit': 0.09; 'lines.': 0.09; 'meantime,': 0.09; 'permissions': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'python': 0.11; 'programs.': 0.14; '"f"': 0.16; '"g"': 0.16; 'background,': 0.16; 'breakpoint': 0.16; 'breakpoints': 0.16; 'consequence,': 0.16; 'files)': 0.16; 'objects;': 0.16; 'pdb': 0.16; 'pdb;': 0.16; 'received:80.91.229.3': 0.16; 'received:dip0.t-ipconnect.de': 0.16; 'received:plane.gmane.org': 0.16; 'received:t-ipconnect.de': 0.16; 'slight': 0.16; 'subject:between': 0.16; 'extensions': 0.16; 'modification': 0.16; 'bit': 0.19; 'possible,': 0.19; 'addition,': 0.20; 'written': 0.21; 'code,': 0.22; 'import': 0.22; '(in': 0.22; 'load': 0.23; 'header:User-Agent:1': 0.23; 'java': 0.24; 'looks': 0.24; "i've": 0.25; 'source': 0.25; 'script': 0.25; 'subject:/': 0.26; 'header:X-Complaints-To:1': 0.27; 'external': 0.29; 'lines': 0.31; '(maybe': 0.31; 'consequence': 0.31; "skip:' 40": 0.31; 'writes:': 0.31; 'class': 0.32; 'quite': 0.32; 'problem': 0.35; 'but': 0.35; 'opposed': 0.36; 'method': 0.36; 'charset:us-ascii': 0.36; 'possible': 0.36; 'too': 0.37; 'needed': 0.38; 'to:addr :python-list': 0.38; 'expect': 0.39; 'does': 0.39; 'itself': 0.39; 'moving': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'even': 0.60; 'ago,': 0.61; 'numbers': 0.61; 'received:217': 0.63; 'personal': 0.63; 'places': 0.64; 'more': 0.64; 'targeted': 0.69; 'subject:Save': 0.91
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From dieter <dieter@handshake.de>
Subject Re: Save/restore breakpoints between pdb runs
Date Sat, 12 Jul 2014 08:05:27 +0200
References <1405104539.54db53@strabo.loghyr>
Mime-Version 1.0
Content-Type text/plain; charset=us-ascii
X-Gmane-NNTP-Posting-Host pd9e0abec.dip0.t-ipconnect.de
User-Agent Gnus/5.1008 (Gnus v5.10.8) XEmacs/21.4.22 (linux)
Cancel-Lock sha1:nqDknzU2VQHbGHotxnqz88YEuK8=
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.11768.1405145144.18130.python-list@python.org> (permalink)
Lines 49
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1405145144 news.xs4all.nl 2974 [2001:888:2000:d::a6]:41483
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:74368

Show key headers only | View raw


Ed Blackman <ed@edgewood.to> writes:
> I've recently started using Python for my job (as opposed to writing
> smallish scripts for personal use), and so have needed to debug quite
> a bit more.
>
> I've been using pdb mainly via 'python -m pdb script args'.  Perhaps
> it's my Java background, but even when I have permissions to change
> the source, I find editing source to insert 'import pdb;
> pdb.set_trace()' unnatural.  The consequence is that I have to
> recreate my breakpoints when I have to exit pdb.
>
> I've written the following code, which I load from .pdbrc with
> 'execfile(os.path.expanduser('~/.pydb.py'))'

This approach does not seem very robust to me:

  "pdb" resolves all breakpoints to lines (in source files) - and
  any modification to the source may change the lines.
  As a consequence, your breakpoints may no longer be at the
  places where you expect them.


A long time ago, I have developped "dm.pdb" - a slight
extension/improvement over "pdb". One of the extensions
has been to make it possible to set breakpoints from outside
the debugger -- without too many surprises. It looks somehow like that:

  from dm.pdb import Pdb; D = Pdb()
  ...
  from ... import f
  from ... import g
  from ... import C
  ...
  D.do_break("f") # set breakpoint on "f"
  D.do_break("g") # set breakpoint on "g"
  D.do_breack("C.m") # set breakpoint on method "m" of class "C"
  ...
  D.run("...")

It is more robust than breakpoints on line numbers - but, of course,
it cannot be automated but must be targeted to individual programs.
In addition, the robustness is limited to breakpoints on
executable objects; setting breakpoints on line numbers is possible, too --
but has the same problem with moving lines.


In the meantime, "pdb" itself may support this form of external
control (maybe even better then "dm.pdb").

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Save/restore breakpoints between pdb runs Ed Blackman <ed@edgewood.to> - 2014-07-11 15:16 -0400
  Re: Save/restore breakpoints between pdb runs dieter <dieter@handshake.de> - 2014-07-12 08:05 +0200

csiph-web