From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9724 invoked by alias); 22 May 2011 01:41:45 -0000 Received: (qmail 9715 invoked by uid 22791); 22 May 2011 01:41:44 -0000 X-SWARE-Spam-Status: No, hits=-1.0 required=5.0 tests=AWL,BAYES_00,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from kay.astro.Princeton.EDU (HELO mail.astro.princeton.edu) (128.112.24.221) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 22 May 2011 01:41:30 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.astro.princeton.edu (Postfix) with ESMTP id C07D41BC004D1 for ; Sat, 21 May 2011 21:41:29 -0400 (EDT) Received: from mail.astro.princeton.edu ([127.0.0.1]) by localhost (kay.astro.princeton.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 373r9f9xCs8L for ; Sat, 21 May 2011 21:41:28 -0400 (EDT) X-Submitted: to mail.astro.princeton.edu (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: rhl) with ESMTP for ; Sat, 21 May 2011 21:41:28 -0400 (EDT) From: Robert Lupton the Good Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Subject: Problem redefining python pretty printers Date: Sun, 22 May 2011 01:41:00 -0000 Message-Id: <1AAE9F25-87D5-44F0-BCF8-B6C3A5D20203@astro.princeton.edu> To: gdb@sourceware.org Mime-Version: 1.0 (Apple Message framework v1084) Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2011-05/txt/msg00117.txt.bz2 Using the 7.2.90.20110521-cvs (i.e. 7.3-branch) version, the docs say: > Help on function register_pretty_printer in module gdb.printing: >=20 > register_pretty_printer(obj, printer) > Register pretty-printer PRINTER with OBJ. >=20=20=20=20=20 > The printer is added to the front of the search list, thus one can ov= erride > an existing printer if one needs to. which makes sense if one's working on a new printer. Unfortunately: > (gdb) python import sourcePrinter; sourcePrinter.register(); sourcePrinte= r.register() > Traceback (most recent call last): > File "", line 1, in > File "/home/rhl/Bugs/gdb-pp/sourcePrinter.py", line 35, in register > gdb.printing.register_pretty_printer(gdb, printer) > File "/home/astro/hsc/products/Linux64/external/gdb/7.3-1/share/gdb/pyt= hon/gdb/printing.py", line 131, in register_pretty_printer > printer.name) > RuntimeError: pretty-printer already registered: afw > Error while executing Python code. The routine register is: > def register(): > printer =3D gdb.printing.RegexpCollectionPrettyPrinter("afw") > gdb.printing.register_pretty_printer(gdb, printer) Any advice on what I'm doing wrong? I suppose I could come up with a new n= ame each time, but that seems a little clumsy. R