Frame.parseVM constructor
- String frame
Parses a string representation of a Dart VM stack frame.
Implementation
factory Frame.parseVM(String frame) => _catchFormatException(frame, () {
// The VM sometimes folds multiple stack frames together and replaces
// them with "...".
if (frame == '...') {
return Frame(Uri(), null, null, '...');
}
var match = _vmFrame.firstMatch(frame);
if (match == null) return UnparsedFrame(frame);
// Get the pieces out of the regexp match. Function, URI and line should
// always be found. The column is optional.
var member = match[1]!
.replaceAll(_asyncBody, '<async>')
.replaceAll('<anonymous closure>', '<fn>');
var uri = match[2]!.startsWith('<data:')
? Uri.dataFromString('')
: Uri.parse(match[2]!);
var lineAndColumn = match[3]!.split(':');
var line =
lineAndColumn.length > 1 ? int.parse(lineAndColumn[1]) : null;
var column =
lineAndColumn.length > 2 ? int.parse(lineAndColumn[2]) : null;
return Frame(uri, line, column, member);
});