Skip to content

Commit e9f2055

Browse files
committed
allow parsing stack traces that end with "skipping x frames"
1 parent 875a31a commit e9f2055

1 file changed

Lines changed: 25 additions & 10 deletions

File tree

front_end/panels/console/ErrorStackParser.ts

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,30 +21,35 @@ export interface ParsedErrorFrame {
2121
};
2222
}
2323

24-
export type SpecialHermesStackTraceFrameTypes = 'native' | 'address at' | 'empty url';
24+
export type SpecialHermesStackTraceFrameTypes =
25+
// functions implemented in c++.
26+
// TODO: these might be enhanced to include the C++ loc for the frame
27+
// so that a debugger could stitch together a hybrid cross-language call stack
28+
'native' |
29+
// frames with empty url
30+
// TODO: these seem to be happening due to a bug that needs to be investigated
31+
// and produce an actual script URL instead
32+
'address at' |
33+
// frames pointing to a bytecode locations
34+
// TODO: these could be symbolicated and link to source files with the help of
35+
// a bytecode source maps once they are available.
36+
'empty url' |
37+
// frames collepsed in the middle of a stack trace for very long stack traces
38+
'skipping x frames';
2539

2640
function getSpecialHermesStackTraceFrameType({
2741
url,
2842
}: {
2943
url: Platform.DevToolsPath.UrlString,
3044
}): SpecialHermesStackTraceFrameTypes | null {
31-
// functions implemented in c++.
32-
// TODO: these might be enhanced to include the C++ loc for the frame
33-
// so that a debugger could stitch together a hybrid cross-language call stack
3445
if (url === 'native') {
3546
return 'native';
3647
}
3748

38-
// frames with empty url
39-
// TODO: these seem to be happening due to a bug that needs to be investigated
40-
// and produce an actual script URL instead
4149
if (url === '') {
4250
return 'empty url';
4351
}
4452

45-
// frames pointing to a bytecode locations
46-
// TODO: these could be symbolicated and link to source files with the help of
47-
// a bytecode source maps once they are available.
4853
if (url.startsWith?.('address at ')) {
4954
return 'address at';
5055
}
@@ -77,6 +82,16 @@ export function parseSourcePositionsFromErrorStack(
7782
const match = /^\s*at\s(async\s)?/.exec(line);
7883
if (!match) {
7984
if (linkInfos.length && linkInfos[linkInfos.length - 1].isCallFrame) {
85+
if (/^\s*... skipping \d+ frames$/.exec(line)) {
86+
if (!linkInfos[linkInfos.length - 1].link) {
87+
// Combine builtin frames.
88+
linkInfos[linkInfos.length - 1].line += `\n${line}`;
89+
} else {
90+
linkInfos.push({line, isCallFrame: false});
91+
}
92+
specialHermesFramesParsed.add('skipping x frames');
93+
continue;
94+
}
8095
Host.rnPerfMetrics.stackTraceSymbolicationFailed(stack, line, '"at (url)" not found');
8196
return null;
8297
}

0 commit comments

Comments
 (0)