Index: tools/gdb/utils-gdb.py
===================================================================
--- tools/gdb/utils-gdb.py	(revision ff79d5e0c1b8084b524b4eea26224b2ddde2512a)
+++ tools/gdb/utils-gdb.py	(revision 9dc3eb21aaa56f0f92f0c321820e671a30ea502f)
@@ -44,8 +44,4 @@
 STACK = []
 
-# A global variable to keep all system task name
-SysTask_Name = ["uLocalDebuggerReader", "uLocalDebugger", "uProcessorTask", "uBootTask", "uSystemTask",
-"uProcessorTask", "uPthread", "uProfiler"]
-
 not_supported_error_msg = "Not a supported command for this language"
 
@@ -101,4 +97,76 @@
 	return cluster_root
 
+def get_sched_lock():
+	"""
+	Return: gdb.Value of __scheduler_lock
+	"""
+	lock = gdb.parse_and_eval('_X16__scheduler_lockPS20__scheduler_RWLock_t_1')
+	if lock.address == 0x0:
+		print('No scheduler lock, program terminated')
+	return lock
+
+def all_clusters():
+	if not is_cforall():
+		return None
+
+	cluster_root = get_cluster_root()
+	if cluster_root.address == 0x0:
+		return
+
+	curr = cluster_root
+	ret = [curr]
+
+	while True:
+		curr = curr['_X4nodeS26__cluster____dbg_node_cltr_1']['_X4nextPS7cluster_1']
+		if curr == cluster_root:
+			break
+
+		ret.append(curr)
+
+	return ret
+
+def all_processors():
+	if not is_cforall():
+		return None
+
+	cfa_t = get_cfa_types()
+
+	# get processors from registration to the RWlock
+	lock = get_sched_lock()
+
+	#get number of elements
+	count = lock['_X5readyVj_1']
+
+	#find all the procs
+	raw_procs = [lock['_X4dataPS21__scheduler_lock_id_t_1'][i]['_X6handleVPS16__processor_id_t_1'] for i in range(count)]
+
+	# pre cast full procs
+	procs = [p.cast(cfa_t.processor_ptr) for p in raw_procs if p['_X9full_procb_1']]
+
+	# sort procs by clusters
+	return sorted(procs, key=lambda p: p['_X4cltrPS7cluster_1'])
+
+def tls_for_pthread(pthrd):
+	prev = gdb.selected_thread()
+	inf = gdb.selected_inferior()
+
+	thrd = inf.thread_from_thread_handle( pthrd )
+	thrd.switch()
+	tls = gdb.parse_and_eval('&_X9kernelTLSS16KernelThreadData_1')
+
+	prev.switch()
+	return tls
+
+def tls_for_proc(proc):
+	return tls_for_pthread(proc['_X13kernel_threadm_1'])
+
+def thread_for_pthread(pthrd):
+	return tls_for_pthread(pthrd)['_X11this_threadVPS7$thread_1']
+
+def thread_for_proc(proc):
+	return tls_for_proc(proc)['_X11this_threadVPS7$thread_1']
+
+
+
 def find_curr_thread():
 	# btstr = gdb.execute('bt', to_string = True).splitlines()
@@ -108,25 +176,4 @@
 	# return btstr[0].split('this=',1)[1].split(',')[0].split(')')[0]
 	return None
-
-def all_clusters():
-	if not is_cforall():
-		return None
-
-	cluster_root = get_cluster_root()
-	if cluster_root.address == 0x0:
-		return
-
-	curr = cluster_root
-	ret = [curr]
-
-	while True:
-		curr = curr['_X4nodeS26__cluster____dbg_node_cltr_1']['_X4nextPS7cluster_1']
-		if curr == cluster_root:
-			break
-
-		ret.append(curr)
-
-	return ret
-
 
 def lookup_cluster(name = None):
@@ -239,6 +286,5 @@
 	"""Cforall: Display currently known processors
 Usage:
-	info processors                 : print out all the processors in the Main Cluster
-	info processors all             : print out all processors in all clusters
+	info processors                 : print out all the processors
 	info processors <cluster_name>  : print out all processors in a given cluster
 """
@@ -247,32 +293,31 @@
 		super(Processors, self).__init__('info processors', gdb.COMMAND_USER)
 
-	def print_processor(self, name, status, pending, address):
-		print('{:>20}  {:>11}  {:>13}  {:>20}'.format(name, status, pending, address))
-
-	def iterate_procs(self, root, active):
-		if root == 0x0:
-			return
-
-		cfa_t = get_cfa_types()
-		curr = root
-
-		while True:
-			processor = curr
-			should_stop = processor['_X12do_terminateVb_1']
+	def print_processor(self, processor):
+		should_stop = processor['_X12do_terminateVb_1']
+		if not should_stop:
+			midle = processor['_X6$linksS7$dlinks_S9processor__1']['_X4nextS9$mgd_link_Y13__tE_generic___1']['_X4elemPY13__tE_generic__1'] != 0x0
+			end   = processor['_X6$linksS7$dlinks_S9processor__1']['_X4nextS9$mgd_link_Y13__tE_generic___1']['_X10terminatorPv_1'] != 0x0
+
+			status = 'Idle' if midle or end else 'Active'
+		else:
 			stop_count  = processor['_X10terminatedS9semaphore_1']['_X5counti_1']
-			if not should_stop:
-				status = 'Active' if active else 'Idle'
-			else:
-				status_str  = 'Last Thread' if stop_count >= 0 else 'Terminating'
-				status      = '{}({},{})'.format(status_str, should_stop, stop_count)
-
-			self.print_processor(processor['_X4namePKc_1'].string(),
-					status, str(processor['_X18pending_preemptionb_1']), str(processor)
-				)
-
-			curr = curr['_X4nodeS28__processor____dbg_node_proc_1']['_X4nextPS9processor_1']
-
-			if curr == root or curr == 0x0:
-				break
+			status_str  = 'Last Thread' if stop_count >= 0 else 'Terminating'
+			status      = '{}({},{})'.format(status_str, should_stop, stop_count)
+
+		print('{:>20}  {:>11}  {:<7}  {:<}'.format(
+			processor['_X4namePKc_1'].string(),
+			status,
+			str(processor['_X18pending_preemptionb_1']),
+			str(processor)
+		))
+		tls = tls_for_proc( processor )
+		thrd = tls['_X11this_threadVPS7$thread_1']
+		if thrd != 0x0:
+			tname = '{} {}'.format(thrd['self_cor']['name'].string(), str(thrd))
+		else:
+			tname = None
+
+		print('{:>20}  {}'.format('Thread', tname))
+		print('{:>20}  {}'.format('TLS', tls))
 
 	#entry point from gdb
@@ -282,6 +327,4 @@
 
 		if not arg:
-			clusters = [lookup_cluster(None)]
-		elif arg == "all":
 			clusters = all_clusters()
 		else:
@@ -292,24 +335,19 @@
 			return
 
-		cfa_t = get_cfa_types()
-		for cluster in clusters:
-			print('Cluster: "{}"({})'.format(cluster['_X4namePKc_1'].string(), cluster.cast(cfa_t.cluster_ptr)))
-
-			active_root = cluster.cast(cfa_t.cluster_ptr) \
-					['_X5procsS8__dllist_S9processor__1'] \
-					['_X4headPY15__TYPE_generic__1'] \
-					.cast(cfa_t.processor_ptr)
-
-			idle_root = cluster.cast(cfa_t.cluster_ptr) \
-					['_X5idlesS8__dllist_S9processor__1'] \
-					['_X4headPY15__TYPE_generic__1'] \
-					.cast(cfa_t.processor_ptr)
-
-			if idle_root != 0x0 or active_root != 0x0:
-				self.print_processor('Name', 'Status', 'Pending Yield', 'Address')
-				self.iterate_procs(active_root, True)
-				self.iterate_procs(idle_root, False)
-			else:
-				print("No processors on cluster")
+		procs = all_processors()
+
+		print('{:>20}  {:>11}  {:<7}  {}'.format('Processor', '', 'Pending', 'Object'))
+		print('{:>20}  {:>11}  {:<7}  {}'.format('Name', 'Status', 'Yield', 'Address'))
+		cl = None
+		for p in procs:
+			# if this is a different cluster print it
+			if cl != p['_X4cltrPS7cluster_1']:
+				if cl:
+					print()
+				cl = p['_X4cltrPS7cluster_1']
+				print('Cluster {}'.format(cl['_X4namePKc_1'].string()))
+
+			# print the processor information
+			self.print_processor(p)
 
 		print()
