MCPcopy Create free account
hub / github.com/GNOME/gjs / evalInFrame

Function evalInFrame

modules/script/_bootstrap/debugger.js:240–267  ·  view source on GitHub ↗
(expr)

Source from the content-addressed store, hash-verified

238
239// Evaluate @expr in the current frame, logging and suppressing any exceptions
240function evalInFrame(expr) {
241 if (!focusedFrame) {
242 print('No stack');
243 return;
244 }
245
246 skipUnwindHandler = true;
247 let cv;
248 try {
249 cv = saveExcursion(
250 () => focusedFrame.evalWithBindings(`(${expr})`, debuggeeValues));
251 } finally {
252 skipUnwindHandler = false;
253 }
254
255 if (cv === null) {
256 print(`Debuggee died while evaluating ${expr}`);
257 return;
258 }
259
260 const {throw: exc, return: dv} = cv;
261 if (exc) {
262 print(`Exception caught while evaluating ${expr}: ${dvToString(exc)}`);
263 return;
264 }
265
266 return {value: dv};
267}
268
269// Accept debugger commands starting with '#' so that scripting the debugger
270// can be annotated

Callers 2

keysCommandFunction · 0.85
throwOrReturnFunction · 0.85

Calls 2

saveExcursionFunction · 0.85
dvToStringFunction · 0.85

Tested by

no test coverage detected