(inspector)
| 363 | } |
| 364 | |
| 365 | function createRepl(inspector) { |
| 366 | const { Debugger, HeapProfiler, Profiler, Runtime } = inspector; |
| 367 | |
| 368 | let repl; |
| 369 | |
| 370 | // Things we want to keep around |
| 371 | const history = { control: [], debug: [] }; |
| 372 | const watchedExpressions = []; |
| 373 | const knownBreakpoints = []; |
| 374 | let heapSnapshotPromise = null; |
| 375 | let pauseOnExceptionState = 'none'; |
| 376 | let lastCommand; |
| 377 | |
| 378 | // Things we need to reset when the app restarts |
| 379 | let knownScripts; |
| 380 | let currentBacktrace; |
| 381 | let selectedFrame; |
| 382 | let exitDebugRepl; |
| 383 | let contextLineNumber = 2; |
| 384 | let initialBreakRender; |
| 385 | let waitForInitialBreakRender = false; |
| 386 | |
| 387 | function resetOnStart() { |
| 388 | knownScripts = {}; |
| 389 | currentBacktrace = null; |
| 390 | selectedFrame = null; |
| 391 | |
| 392 | if (exitDebugRepl) exitDebugRepl(); |
| 393 | exitDebugRepl = null; |
| 394 | } |
| 395 | resetOnStart(); |
| 396 | |
| 397 | const INSPECT_OPTIONS = { colors: inspector.stdout.isTTY }; |
| 398 | function inspect(value) { |
| 399 | return utilInspect(value, INSPECT_OPTIONS); |
| 400 | } |
| 401 | |
| 402 | function print(value, addNewline = true) { |
| 403 | const text = typeof value === 'string' ? value : inspect(value); |
| 404 | return inspector.print(text, addNewline); |
| 405 | } |
| 406 | |
| 407 | function getCurrentLocation() { |
| 408 | if (!selectedFrame) { |
| 409 | throw new ERR_DEBUGGER_ERROR('Requires execution to be paused'); |
| 410 | } |
| 411 | return selectedFrame.location; |
| 412 | } |
| 413 | |
| 414 | function isCurrentScript(script) { |
| 415 | return selectedFrame && getCurrentLocation().scriptId === script.scriptId; |
| 416 | } |
| 417 | |
| 418 | function formatScripts(displayNatives = false) { |
| 419 | function isVisible(script) { |
| 420 | if (displayNatives) return true; |
| 421 | return !script.isNative || isCurrentScript(script); |
| 422 | } |
no test coverage detected
searching dependent graphs…