|
|
@ -36,6 +36,36 @@ SourceLocationTracker.prototype.getSourceLocation = function (address, index, co |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Return the source location associated with the given @arg pc |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @param {String} address - contract address from which the source location is retrieved |
|
|
|
|
|
|
|
* @param {Int} vmtraceStepIndex - index of the current code in the vmtrace |
|
|
|
|
|
|
|
* @param {Object} contractDetails - AST of compiled contracts |
|
|
|
|
|
|
|
* @param {Function} cb - callback function |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
SourceLocationTracker.prototype.getSourceLocation = function (address, vmtraceStepIndex, contractsDetails, cb) { |
|
|
|
|
|
|
|
var self = this |
|
|
|
|
|
|
|
this.codeManager.getCode(address, function (error, result) { |
|
|
|
|
|
|
|
if (!error) { |
|
|
|
|
|
|
|
var sourceMap = getSourceMap(address, result.bytecode, contractsDetails) |
|
|
|
|
|
|
|
if (sourceMap) { |
|
|
|
|
|
|
|
self.codeManager.getInstructionIndex(address, vmtraceStepIndex, function (error, index) { |
|
|
|
|
|
|
|
if (error) { |
|
|
|
|
|
|
|
cb(error) |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
cb(null, self.sourceMappingDecoder.atIndex(index, sourceMap)) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
cb('no srcmap associated with the code ' + address) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
cb(error) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* backwards compatibility - attribute name will certainly be changed |
|
|
|
* backwards compatibility - attribute name will certainly be changed |
|
|
|
*/ |
|
|
|
*/ |
|
|
|