Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* Python objfile-gdb.py file -- how to handle reloading properly ?
@ 2011-03-22 14:07 Kevin Pouget
       [not found] ` <AANLkTikZX2JvZF4bNYh8ZQR-e-bqLS=+zZq_m_b2Y+an@mail.gmail.com>
  2011-03-22 17:00 ` Tom Tromey
  0 siblings, 2 replies; 6+ messages in thread
From: Kevin Pouget @ 2011-03-22 14:07 UTC (permalink / raw)
  To: gdb

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


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-03-23 18:26 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-22 14:07 Python objfile-gdb.py file -- how to handle reloading properly ? Kevin Pouget
     [not found] ` <AANLkTikZX2JvZF4bNYh8ZQR-e-bqLS=+zZq_m_b2Y+an@mail.gmail.com>
2011-03-22 15:00   ` Kevin Pouget
2011-03-22 17:00 ` Tom Tromey
     [not found]   ` <AANLkTi=XEP8x27_BNr6NwS09Ra=nNu=CA6qrrpUJ5N8Z@mail.gmail.com>
2011-03-23  9:06     ` Kevin Pouget
     [not found]       ` <AANLkTikp_m_zwsUPmmEvgHiEKxBidNd-MNY4cTrprynU@mail.gmail.com>
     [not found]         ` <AANLkTi=66tRSet6UgrtBpZzEU5o_PmTdazdkB-NnWEVZ@mail.gmail.com>
2011-03-23 10:46           ` Kevin Pouget
2011-03-23 18:26     ` Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox