(dv, style = {pretty: options.pretty})
| 65 | } |
| 66 | |
| 67 | function debuggeeValueToString(dv, style = {pretty: options.pretty}) { |
| 68 | // Special sentinel values returned by Debugger.Environment.getVariable() |
| 69 | if (typeof dv === 'object' && dv !== null) { |
| 70 | if (dv.missingArguments) |
| 71 | return ['<missing>', undefined]; |
| 72 | if (dv.optimizedOut) |
| 73 | return ['<optimized out>', undefined]; |
| 74 | if (dv.uninitialized) |
| 75 | return ['<uninitialized>', undefined]; |
| 76 | if (!(dv instanceof Debugger.Object)) |
| 77 | return ['<unexpected object>', JSON.stringify(dv, null, 4)]; |
| 78 | } |
| 79 | |
| 80 | const dvrepr = dvToString(dv); |
| 81 | if (!style.pretty || (typeof dv !== 'object') || (dv === null)) |
| 82 | return [dvrepr, undefined]; |
| 83 | |
| 84 | const exec = debuggeeGlobalWrapper.executeInGlobalWithBindings.bind(debuggeeGlobalWrapper); |
| 85 | |
| 86 | if (['TypeError', 'Error', 'GIRespositoryNamespace', 'GObject_Object'].includes(dv.class)) { |
| 87 | const errval = exec('v.toString()', {v: dv}); |
| 88 | return [dvrepr, errval['return']]; |
| 89 | } |
| 90 | |
| 91 | if (style.brief) |
| 92 | return [dvrepr, dvrepr]; |
| 93 | |
| 94 | const properties = {}; |
| 95 | getProperties(dv, properties); |
| 96 | const str = exec('imports._print.getPrettyPrintFunction(globalThis)(v, extra)', {v: dv, extra: dv.makeDebuggeeValue(properties)}); |
| 97 | if ('throw' in str) { |
| 98 | if (style.noerror) |
| 99 | return [dvrepr, undefined]; |
| 100 | |
| 101 | const substyle = {...style, noerror: true}; |
| 102 | return [dvrepr, debuggeeValueToString(str.throw, substyle)]; |
| 103 | } |
| 104 | |
| 105 | return [dvrepr, str['return']]; |
| 106 | } |
| 107 | |
| 108 | function showDebuggeeValue(dv, style = {pretty: options.pretty}) { |
| 109 | const i = nextDebuggeeValueIndex++; |
no test coverage detected