| Index: emcore/trunk/tools/emcore.py | 
| — | — | @@ -458,9 +458,12 @@ | 
| 459 | 459 |              self.logger.info("Thread type: %s\n" % thread.thread_type, 4)
 | 
| 460 | 460 |              self.logger.info("Thread state: %s\n" % thread.state, 4)
 | 
| 461 | 461 |              if thread.block_type != "THREAD_NOT_BLOCKED":
 | 
| 462 |   | -                self.logger.info("Block type: %s\n" % thread.block_type, 6)
 | 
| 463 |   | -                if thread.blocked_by != 0:
 | 
| 464 |   | -                    self.logger.info("Blocked by: 0x%X\n" % thread.blocked_by, 6)
 | 
|   | 462 | +                self.logger.info("Block type: %s\n" % thread.block_type, 4)
 | 
|   | 463 | +                if thread.block_type == "THREAD_BLOCK_MUTEX":
 | 
|   | 464 | +                    self.logger.info("Blocked by mutex: 0x%X\n" % thread.blocked_by, 6)
 | 
|   | 465 | +                    self.logger.info("Owner: %s (0x%X)\n" % (thread.blocked_by.owner.name, thread.blocked_by.owner), 8)
 | 
|   | 466 | +                elif thread.block_type == "THREAD_BLOCK_WAKEUP":
 | 
|   | 467 | +                    self.logger.info("Blocked by wakeup: 0x%X\n" % thread.blocked_by, 6)
 | 
| 465 | 468 |              self.logger.info("Priority: %d/255\n" % thread.priority, 4)
 | 
| 466 | 469 |              self.logger.info("Current CPU load: %.1f%%\n" % ((thread.cpuload * 100) / 255.), 4)
 | 
| 467 | 470 |              self.logger.info("CPU time (total): %s\n" % datetime.timedelta(microseconds = thread.cputime_total), 4)
 | 
| Index: emcore/trunk/tools/libemcore.py | 
| — | — | @@ -33,7 +33,7 @@ | 
| 34 | 34 |  import base64
 | 
| 35 | 35 |  
 | 
| 36 | 36 |  from libemcoredata import *
 | 
| 37 |   | -from misc import Logger, Bunch, Error, ArgumentError, gethwname
 | 
|   | 37 | +from misc import Logger, Bunch, remote_pointer, Error, ArgumentError, getthread, gethwname
 | 
| 38 | 38 |  from functools import wraps
 | 
| 39 | 39 |  
 | 
| 40 | 40 |  class DeviceNotFoundError(Error):
 | 
| — | — | @@ -393,10 +393,29 @@ | 
| 394 | 394 |                  threadstruct.name = self.readstring(threadstruct.name)
 | 
| 395 | 395 |              else: threadstruct.name = "[Thread %08X]" % structptr
 | 
| 396 | 396 |              threadstruct.state = thread_state(threadstruct.state)
 | 
|   | 397 | +            if threadstruct.block_type == "THREAD_BLOCK_MUTEX":
 | 
|   | 398 | +                blocked_by_struct = mutex
 | 
|   | 399 | +            elif threadstruct.block_type == "THREAD_BLOCK_WAKEUP":
 | 
|   | 400 | +                blocked_by_struct = wakeup
 | 
|   | 401 | +            else:
 | 
|   | 402 | +                blocked_by_struct = None
 | 
|   | 403 | +            if blocked_by_struct != None:
 | 
|   | 404 | +                blocked_by_data = self.read(threadstruct.blocked_by, ctypes.sizeof(blocked_by_struct))
 | 
|   | 405 | +                blocked_by = blocked_by_struct()
 | 
|   | 406 | +                blocked_by._from_string(blocked_by_data)
 | 
|   | 407 | +                threadstruct.blocked_by = remote_pointer(threadstruct.blocked_by, blocked_by._to_bunch())
 | 
|   | 408 | +            else:
 | 
|   | 409 | +                threadstruct.blocked_by = 0
 | 
| 397 | 410 |              threads.append(threadstruct)
 | 
| 398 | 411 |              id += 1
 | 
| 399 | 412 |              structptr = threadstruct.thread_next
 | 
| 400 | 413 |          self.lockscheduler(schedulerstate)
 | 
|   | 414 | +        
 | 
|   | 415 | +        for thread in threads:
 | 
|   | 416 | +            if thread.block_type == "THREAD_BLOCK_MUTEX":
 | 
|   | 417 | +                thread.blocked_by.owner = remote_pointer(thread.blocked_by.owner, getthread(thread.blocked_by.owner, threads))
 | 
|   | 418 | +            if thread.block_type == "THREAD_BLOCK_WAKEUP":
 | 
|   | 419 | +                thread.blocked_by.waiter = remote_pointer(thread.blocked_by.waiter, getthread(thread.blocked_by.waiter, threads))
 | 
| 401 | 420 |          return threads
 | 
| 402 | 421 |      
 | 
| 403 | 422 |      @command()
 |