Unnamed Fossil Project

Check-in [c2fd6aa60a]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Let us switch between stopped threads with "fg" command
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256:c2fd6aa60a287e6b00d39c5239b34f73619caf87a3faba93ac3ac47257d0f994
User & Date: vandys 2018-11-14 21:08:56
Context
2018-11-17
18:39
The obvious alias for "tbreak" (and supported by gdb, too) check-in: 6de4efb9f8 user: vandys tags: trunk
2018-11-14
21:08
Let us switch between stopped threads with "fg" command check-in: c2fd6aa60a user: vandys tags: trunk
18:33
First pass, dealing with multiple threads check-in: 453a9abb8f user: vandys tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to pdb.py.

1275
1276
1277
1278
1279
1280
1281




































1282
1283
1284
1285
1286
1287
1288
....
1313
1314
1315
1316
1317
1318
1319


1320
1321
1322
1323
1324
1325
1326
1327

    # List any threads waiting to enter pdb
    def do_jobs(self, arg):
	global Jobs

	for t,tup in Jobs.iteritems():
	    sys.stderr.write("%5d %r: %s\n" % (tup[3], t, tup[1]))





































    # Command loop finished
    def postloop(self):
	self.leave_pdb()

    # Change our pdb state value
    def pdb_state(self, s):
................................................................................
	    # Nobody else
	    return

	# Pick lowest job number and hand off
	chosen = min( tup[3] for tup in Jobs.itervalues() )
	for tup in Jobs.itervalues():
	    if tup[3] == chosen:


		tup[2].release()
		return

    # Update state to reflect we're still in PDB, but
    #  running target code
    def stepping(self):
	global Jobs
	me = threading.current_thread()







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







>
>
|







1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
....
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365

    # List any threads waiting to enter pdb
    def do_jobs(self, arg):
	global Jobs

	for t,tup in Jobs.iteritems():
	    sys.stderr.write("%5d %r: %s\n" % (tup[3], t, tup[1]))

    # Switch to different waiting pdb session
    def do_fg(self, arg):
	try:
	    jnum = int(eval(arg, {}, {}))
	except:
	    sys.stderr.write("Bad job number\n")
	    return
	for tup in Jobs.itervalues():
	    if tup[3] == jnum:
		break
	else:
	    sys.stderr.write("No such job: %d\n" % (jnum,))
	    return

	# Get the sema the target is waiting upon
	sema1 = tup[2]
	if sema1 is None:
	    sys.stderr.write("Job %d is not waiting\n"% (jnum,))
	    return

	# Set up a sema for me
	me = threading.current_thread()
	tup = Jobs[me]
	sema2 = threading.Semaphore(0)
	tup[1] = "waiting"
	tup[2] = sema2

	# Release them, stop us
	sema1.release()
	sema2.acquire()

	# Aaaannnnnd... we're back
	jnum = tup[3]
	sys.stderr.write("[pdb resume job %d: %s]\n" % (jnum, me))
	tup[1] = "pdb"

    # Command loop finished
    def postloop(self):
	self.leave_pdb()

    # Change our pdb state value
    def pdb_state(self, s):
................................................................................
	    # Nobody else
	    return

	# Pick lowest job number and hand off
	chosen = min( tup[3] for tup in Jobs.itervalues() )
	for tup in Jobs.itervalues():
	    if tup[3] == chosen:
		sema = tup[2]
		tup[2] = None
		sema.release()
		return

    # Update state to reflect we're still in PDB, but
    #  running target code
    def stepping(self):
	global Jobs
	me = threading.current_thread()