@@ -21,6 +21,35 @@ export interface ParsedErrorFrame {
2121 } ;
2222}
2323
24+ export type SpecialHermesStackTraceFrameTypes = 'native' | 'address at' | 'empty url' ;
25+
26+ function getSpecialHermesStackTraceFrameType ( {
27+ url,
28+ } : {
29+ url : Platform . DevToolsPath . UrlString ,
30+ } ) : 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
34+ if ( url === 'native' ) {
35+ return 'native' ;
36+ }
37+
38+ // frames with empty url
39+ // TODO: these seem to be happening due to a bug that needs to be investigated
40+ if ( url === '' ) {
41+ return 'empty url' ;
42+ }
43+
44+ // frames pointing to a bytecode locations
45+ // TODO: these could be symbolicated and link to source files with the help of
46+ // a bytecode source maps.
47+ if ( url . startsWith ?.( 'address at ' ) ) {
48+ return 'address at' ;
49+ }
50+ return null ;
51+ }
52+
2453/**
2554 * Takes a V8 Error#stack string and extracts source position information.
2655 *
@@ -79,7 +108,8 @@ export function parseSourcePositionsFromErrorStack(
79108
80109 const linkCandidate = line . substring ( left , right ) ;
81110 const splitResult = Common . ParsedURL . ParsedURL . splitLineAndColumn ( linkCandidate ) ;
82- if ( splitResult . url === '<anonymous>' || splitResult . url === 'native' ) {
111+ const specialHermesFrameType = getSpecialHermesStackTraceFrameType ( splitResult ) ;
112+ if ( splitResult . url === '<anonymous>' || specialHermesFrameType !== null ) {
83113 if ( linkInfos . length && linkInfos [ linkInfos . length - 1 ] . isCallFrame && ! linkInfos [ linkInfos . length - 1 ] . link ) {
84114 // Combine builtin frames.
85115 linkInfos [ linkInfos . length - 1 ] . line += `\n${ line } ` ;
0 commit comments