From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 953 invoked by alias); 22 Mar 2011 14:07:35 -0000 Received: (qmail 932 invoked by uid 22791); 22 Mar 2011 14:07:33 -0000 X-SWARE-Spam-Status: No, hits=-0.6 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,TW_BJ,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: sourceware.org Received: from mail-iw0-f169.google.com (HELO mail-iw0-f169.google.com) (209.85.214.169) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 22 Mar 2011 14:07:29 +0000 Received: by iwl42 with SMTP id 42so9712336iwl.0 for ; Tue, 22 Mar 2011 07:07:27 -0700 (PDT) Received: by 10.42.134.193 with SMTP id m1mr9176834ict.230.1300802847102; Tue, 22 Mar 2011 07:07:27 -0700 (PDT) MIME-Version: 1.0 Received: by 10.43.59.10 with HTTP; Tue, 22 Mar 2011 07:07:07 -0700 (PDT) From: Kevin Pouget Date: Tue, 22 Mar 2011 14:07:00 -0000 Message-ID: Subject: Python objfile-gdb.py file -- how to handle reloading properly ? To: gdb@sourceware.org Content-Type: text/plain; charset=ISO-8859-1 X-IsSubscribed: yes 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-03/txt/msg00113.txt.bz2 Hello, I'm playing with the objfile-gdb.py loading, and I can't manage to support the reloading efficiently: class my_list: list = [] def addToList(elt): my_list.__class__.list.append(elt) I would need this `list` attribute to keep its value across the multiple `start` of my application, but it doesn't work this way, and the only solution I found was: try: if a is None: print "(exception thrown)" print "second time" except: print "firs timet" # The list of replay breakpoints replay_breakpoints = [] a = 1 class my_list: global list def addToList(elt): list.append(elt) which looks like a ugly hack! Did you find any better solution? ("gdb does not track which files it has already auto-loaded this way. gdb will load the associated script every time the corresponding objfile is opened. So your -gdb.py file should be careful to avoid errors if it is evaluated more than once.") Cordially, Kevin