Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/data
diff options
context:
space:
mode:
authorJoao Matos <joao@tritao.eu>2015-12-07 21:19:44 +0300
committerJoao Matos <joao@tritao.eu>2015-12-07 21:20:43 +0300
commit4497e9265b3ff2a7d935db80f91ec297f8708efc (patch)
tree4631829daf05753e806225ae299cf5745826ac00 /data
parent75c7aac4484245ed47465fbe4d43d98c53623e7a (diff)
Added the monobt LLDB plugin to the repository.
Diffstat (limited to 'data')
-rw-r--r--data/lldb/monobt.py56
1 files changed, 56 insertions, 0 deletions
diff --git a/data/lldb/monobt.py b/data/lldb/monobt.py
new file mode 100644
index 00000000000..0e4713816d7
--- /dev/null
+++ b/data/lldb/monobt.py
@@ -0,0 +1,56 @@
+import lldb
+
+def print_frames(thread, num_frames, current_thread):
+ # TODO: Make output header similar to bt.
+ print '%c thread #%i' % ('*' if current_thread else ' ', thread.idx)
+
+ if current_thread:
+ selected_frame = thread.GetSelectedFrame()
+
+ for frame in thread.frames[:+num_frames]:
+ pc = str(frame.addr)
+ fmt = ' %c %s'
+ var = frame
+ if pc[0] == '0':
+ try:
+ framestr = frame.EvaluateExpression('(char*)mono_pmip((void*)%s)' % pc).summary[1:-1]
+ var = 'frame #%i: %s%s' % (frame.idx, pc, framestr)
+ except:
+ pass
+
+ print fmt % ('*' if current_thread and frame.idx == selected_frame.idx else ' ', var)
+
+def monobt(debugger, command, result, dict):
+ opts = {'all_bt': False, 'num_frames': None}
+
+ if command == 'all':
+ opts['all_bt'] = True
+ elif command.isdigit():
+ opts['num_frames'] = int(command)
+ elif command != '':
+ print 'error: monobt [<number>|all]'
+ return
+
+ target = debugger.GetSelectedTarget()
+ process = target.process
+
+ if not process.IsValid():
+ print 'error: invalid process'
+ return
+
+ if opts['all_bt']:
+ for thread in process.threads:
+ print_frames(thread, len(thread), process.selected_thread == thread)
+ print ''
+ else:
+ thread = process.selected_thread
+ num_frames = len(thread) if opts['num_frames'] is None else opts['num_frames']
+ print_frames(thread, num_frames, True)
+
+ return None
+
+def __lldb_init_module (debugger, dict):
+ # This initializer is being run from LLDB in the embedded command interpreter
+ # Add any commands contained in this module to LLDB
+ debugger.HandleCommand('command script add -f monobt.monobt monobt')
+ print '"monobt" command installed' \ No newline at end of file