summaryrefslogtreecommitdiff
path: root/gdb_plugins
diff options
context:
space:
mode:
authorVegard Storheil Eriksen <zyp@jvnv.net>2013-01-29 20:22:45 +0100
committerVegard Storheil Eriksen <zyp@jvnv.net>2013-01-29 20:22:45 +0100
commit410007558fa8d314e3f2fdfb385d2d8ab07e1e6c (patch)
tree70d3d1c07e30cdfa20dc1cf19108182e248faf49 /gdb_plugins
parent5d1833c133407aac01725fd52da5acee008b07a8 (diff)
Added gdb_plugins/rblog.py for reading out RBLog objects.
Diffstat (limited to 'gdb_plugins')
-rw-r--r--gdb_plugins/rblog.py37
1 files changed, 37 insertions, 0 deletions
diff --git a/gdb_plugins/rblog.py b/gdb_plugins/rblog.py
new file mode 100644
index 0000000..c058db9
--- /dev/null
+++ b/gdb_plugins/rblog.py
@@ -0,0 +1,37 @@
+class RBlog(gdb.Command):
+ def __init__(self):
+ gdb.Command.__init__(self, "rblog", gdb.COMMAND_DATA, gdb.COMPLETE_SYMBOL, True)
+
+ def invoke(self, arg, from_tty):
+ args = gdb.string_to_argv(arg)
+ if len(args) != 1:
+ print 'Usage: rblog <object>'
+ return
+
+ rblog = gdb.parse_and_eval(args[0])
+ num_entries = rblog['num_entries']
+ num_arguments = rblog['num_arguments']
+ entries = rblog['entries']
+ index = rblog['index']
+
+ if entries[index]['string']:
+ r = range(index, num_entries) + range(index)
+ else:
+ r = range(index)
+
+ for i in r:
+ entry = entries[i]
+ timestamp = int(entry['timestamp'])
+ if not entry['string']:
+ break
+ string = entry['string'].string()
+ arguments = [int(entry['arguments'][i]) for i in range(num_arguments)]
+
+ try:
+ string = string % tuple(arguments[:string.count('%') - 2 * string.count('%%')])
+ except:
+ pass
+
+ print '%8d %-80s %s' % (timestamp, string, ' '.join('%08x' % a for a in arguments))
+
+RBlog()