Skip to content
Snippets Groups Projects
Commit c1cc6ec7 authored by Guy Zana's avatar Guy Zana
Browse files

Merge branch 'master' of https://github.com/cloudius-systems/osv

parents 074c8052 5f888167
No related branches found
No related tags found
No related merge requests found
......@@ -55,13 +55,9 @@ To run OSv
Uncomment the "tracing-flags =" line in build.mak, and rebuild.
Run the program until it aborts, then in gdb:
osv syms
set pagination off
set print elements 0
set print array-indexes on
set print pretty on
set logging on
print trace_log
print trace_record_last._M_i % trace_max
osv trace
gdb.txt will contain the the log, the last line contains the array index
of the last trace entry, read backwards from there.
gdb.txt will contain the the trace.
......@@ -316,6 +316,49 @@ def setup_libstdcxx():
main = glob(gcc + '/usr/share/gdb/auto-load/usr/lib64/libstdc++.so.*.py')[0]
execfile(main)
def dump_trace():
from collections import defaultdict
trace_log = gdb.lookup_global_symbol('trace_log').value()
max_trace = gdb.parse_and_eval('max_trace')
last = gdb.lookup_global_symbol('trace_record_last').value()['_M_i']
indents = defaultdict(int)
for i in range(max_trace):
tr = trace_log[(last + i) % max_trace]
type = tr['type']
thread = ulong(tr['thread'])
if type == 0:
continue
elif type == 1:
annotation = '->'
indent = ' ' * indents[thread]
indents[thread] += 1
elif type == 2:
annotation = '<-'
indents[thread] -= 1
if indents[thread] < 0:
indents[thread] = 0
indent = ' ' * indents[thread]
else:
delta = 0
annotation = '??'
fn = tr['fn']
try:
block = gdb.block_for_pc(long(fn))
fn_name = block.function.print_name
except:
fn_name = '???'
gdb.write('0x%016x %s %s %s\n' % (thread,
indent,
annotation,
fn_name
))
class osv_trace(gdb.Command):
def __init__(self):
gdb.Command.__init__(self, 'osv trace', gdb.COMMAND_USER, gdb.COMPLETE_NONE)
def invoke(self, arg, from_tty):
dump_trace()
osv()
osv_heap()
osv_syms()
......@@ -324,5 +367,6 @@ osv_info_threads()
osv_thread()
osv_thread_apply()
osv_thread_apply_all()
osv_trace()
setup_libstdcxx()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment