check for cda dir

This commit is contained in:
George Hotz 2014-07-31 08:20:12 -07:00
parent 0c867a55f6
commit ec6197b486
4 changed files with 18 additions and 11 deletions

View File

@ -124,7 +124,10 @@ def parse_files(files, args=[]):
args.append(basedir+"/clang/build/Release+Asserts/lib/clang/3.4.2/include")
for fn in files:
print "CDA: caching",fn
file_cache[fn] = parse_file(fn, args)
try:
file_cache[fn] = parse_file(fn, args)
except Exception as e:
print "CDA: error on",fn,":",e
dat = (object_cache, file_cache, xref_cache)
return dat

View File

@ -2,7 +2,7 @@
stream = io.connect("http://localhost:3002/cda");
stream.on('setline', function(filename, line) {
p('setline');
//p('setline');
var b64xref = location.hash.split(",")[1];
if (b64xref === undefined) b64xref = "";
else b64xref = ","+b64xref;
@ -15,18 +15,20 @@ function p(s) {
}
var highlighted = $();
var sline = undefined;
$(window).on('hashchange', function() {
if (location.hash == "") location.replace("#0");
var ln = location.hash.substr(1).split(",")[0];
var b64xref = location.hash.split(",")[1];
highlighted.removeClass("line_highlighted")
highlighted = $("#l" + ln)
if (highlighted.length > 0) {
if (sline != parseInt(ln)) {
highlighted.removeClass("line_highlighted")
highlighted = $("#l" + ln)
highlighted.addClass("line_highlighted");
p(highlighted);
$(window).scrollTo(highlighted, {offset: -150})
$('#program').scrollTo(highlighted, {offset: -150})
stream.emit('navigateline', $('#filename')[0].innerHTML, parseInt(ln))
sline = parseInt(ln);
}
if (b64xref !== undefined) {
selected.removeClass('highlighted');

View File

@ -1,5 +1,6 @@
#!/usr/bin/env python2
import os
basedir = os.path.dirname(os.path.realpath(__file__))
import argparse
import socket
import threading
@ -17,9 +18,10 @@ if __name__ == '__main__':
parser.add_argument('-t', "--tracelibraries", help="trace into all libraries", action="store_true")
parser.add_argument('binary', help="path to the binary")
parser.add_argument('args', nargs='*', help="arguments to the binary")
parser.add_argument("--dwarf", help="parse program dwarf data", action="store_true")
parser.add_argument("--cda", help="use CDA to view source(implies dwarf)", action="store_true")
parser.add_argument("--flush-cache", help="flush all QIRA caches", action="store_true")
parser.add_argument("--dwarf", help="parse program dwarf data", action="store_true")
if os.path.isdir(basedir+"/../cda"):
parser.add_argument("--cda", help="use CDA to view source(implies dwarf)", action="store_true")
# parse arguments
args = parser.parse_args()

View File

@ -74,7 +74,7 @@ def navigateline(fn, ln):
iaddr = program.rdwarves[fn+"#"+str(ln)]
except:
return
print 'navigateline',fn,ln,iaddr
#print 'navigateline',fn,ln,iaddr
socketio.emit('setiaddr', iaddr, namespace='/qira')
@socketio.on('navigateiaddr', namespace='/qira')
@ -85,7 +85,7 @@ def navigateiaddr(iaddr):
(filename, line, linedat) = program.dwarves[iaddr]
except:
return
print 'navigateiaddr', hex(iaddr), filename, line
#print 'navigateiaddr', hex(iaddr), filename, line
socketio.emit('setline', filename, line, namespace='/cda')
@socketio.on('forkat', namespace='/qira')