This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Python objfile-gdb.py file -- how to handle reloading properly ?


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]