[rtems-tools commit] Catch empty task names,

Chris Johns chrisj at rtems.org
Sun Aug 24 23:45:35 UTC 2014


Module:    rtems-tools
Branch:    master
Commit:    7a415d4e43de67e0eabcca3a1375c4e530f37a07
Changeset: http://git.rtems.org/rtems-tools/commit/?id=7a415d4e43de67e0eabcca3a1375c4e530f37a07

Author:    Dhananjay Balan <mb.dhananjay at gmail.com>
Date:      Sat Aug 24 20:44:06 2013 +0530

Catch empty task names,
 - All the tasks do not have a name.

---

 tools/gdb/python/classic.py |    2 ++
 tools/gdb/python/objects.py |    9 ++++++++-
 tools/gdb/python/threads.py |    6 ++++--
 3 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/tools/gdb/python/classic.py b/tools/gdb/python/classic.py
index b919383..261f648 100644
--- a/tools/gdb/python/classic.py
+++ b/tools/gdb/python/classic.py
@@ -140,6 +140,8 @@ class semaphore:
             tasks = wait_queue.tasks()
             print '    Queue: len = %d, state = %s' % (len(tasks),
                                                        wait_queue.state())
+            print '    Tasks:'
+            print '    Name (c:current, r:real), (id)'
             for t in range(0, len(tasks)):
                 print '      ', tasks[t].brief(), ' (%08x)' % (tasks[t].id())
         else:
diff --git a/tools/gdb/python/objects.py b/tools/gdb/python/objects.py
index 58c2730..f4ae5e1 100644
--- a/tools/gdb/python/objects.py
+++ b/tools/gdb/python/objects.py
@@ -253,4 +253,11 @@ class control:
 
     def name(self):
         is_string = information.is_string(self._id.api(), self._id._class())
-        return str(name(self.object['name'], is_string))
\ No newline at end of file
+        val = str(name(self.object['name'],is_string))
+
+        # Normal comaprision is a bit tricky with quotes
+        # 0 '\000' in hex == '3020275c30303027'
+        if val.encode('hex') == '3020275c30303027':
+            val = ""
+
+        return val
\ No newline at end of file
diff --git a/tools/gdb/python/threads.py b/tools/gdb/python/threads.py
index 77c7efa..7098481 100644
--- a/tools/gdb/python/threads.py
+++ b/tools/gdb/python/threads.py
@@ -6,7 +6,6 @@
 #
 
 import gdb
-
 import chains
 import objects
 
@@ -134,7 +133,10 @@ class control:
         return self.object.id()
 
     def name(self):
-        return self.object.name()
+        val = self.object.name()
+        if val == "":
+            val = '*'
+        return val
 
     def current_state(self):
         return state(self.ctrl['current_state']).to_string()



More information about the vc mailing list