| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -197,7 +197,8 @@ debug> | |||
| 197 | 197 | * `watchers`: List all watchers and their values (automatically listed on each | |
| 198 | 198 | breakpoint) | |
| 199 | 199 | * `repl`: Open debugger's repl for evaluation in debugging script's context | |
| 200 | - * `exec expr`: Execute an expression in debugging script's context | ||
| 200 | + * `exec expr`, `p expr`: Execute an expression in debugging script's context and | ||
| 201 | + print its value | ||
| 201 | 202 | ||
| 202 | 203 | ### Execution control | |
| 203 | 204 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -68,6 +68,7 @@ const SHORTCUTS = { | |||
| 68 | 68 | setBreakpoint: 'sb', | |
| 69 | 69 | clearBreakpoint: 'cb', | |
| 70 | 70 | run: 'r', | |
| 71 | + exec: 'p' | ||
| 71 | 72 | }; | |
| 72 | 73 | ||
| 73 | 74 | const HELP = StringPrototypeTrim(` | |
@@ -93,7 +94,8 @@ watch(expr) Start watching the given expression | |||
| 93 | 94 | unwatch(expr) Stop watching an expression | |
| 94 | 95 | watchers Print all watched expressions and their current values | |
| 95 | 96 | ||
| 96 | - exec(expr) Evaluate the expression and print the value | ||
| 97 | + exec(expr), p(expr), exec expr, p expr | ||
| 98 | + Evaluate the expression and print the value | ||
| 97 | 99 | repl Enter a debug repl that works like exec | |
| 98 | 100 | ||
| 99 | 101 | scripts List application scripts that are currently loaded | |
@@ -530,7 +532,7 @@ function createRepl(inspector) { | |||
| 530 | 532 | function prepareControlCode(input) { | |
| 531 | 533 | if (input === '\n') return lastCommand; | |
| 532 | 534 | // Add parentheses: exec process.title => exec("process.title"); | |
| 533 | - const match = RegExpPrototypeSymbolMatch(/^\s*exec\s+([^\n]*)/, input); | ||
| 535 | + const match = RegExpPrototypeSymbolMatch(/^\s*(?:exec|p)\s+([^\n]*)/, input); | ||
| 534 | 536 | if (match) { | |
| 535 | 537 | lastCommand = `exec(${JSONStringify(match[1])})`; | |
| 536 | 538 | } else { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -27,6 +27,14 @@ const assert = require('assert'); | |||
| 27 | 27 | 'works w/o paren' | |
| 28 | 28 | ); | |
| 29 | 29 | }) | |
| 30 | + .then(() => cli.command('p [typeof heartbeat, typeof process.exit]')) | ||
| 31 | + .then(() => { | ||
| 32 | + assert.match( | ||
| 33 | + cli.output, | ||
| 34 | + /\[ 'function', 'function' \]/, | ||
| 35 | + 'works w/o paren, short' | ||
| 36 | + ); | ||
| 37 | + }) | ||
| 30 | 38 | .then(() => cli.command('repl')) | |
| 31 | 39 | .then(() => { | |
| 32 | 40 | assert.match( | |
@@ -54,6 +62,14 @@ const assert = require('assert'); | |||
| 54 | 62 | 'works w/ paren' | |
| 55 | 63 | ); | |
| 56 | 64 | }) | |
| 65 | + .then(() => cli.command('p("[typeof heartbeat, typeof process.exit]")')) | ||
| 66 | + .then(() => { | ||
| 67 | + assert.match( | ||
| 68 | + cli.output, | ||
| 69 | + /\[ 'function', 'function' \]/, | ||
| 70 | + 'works w/ paren, short' | ||
| 71 | + ); | ||
| 72 | + }) | ||
| 57 | 73 | .then(() => cli.command('cont')) | |
| 58 | 74 | .then(() => cli.command('exec [typeof heartbeat, typeof process.exit]')) | |
| 59 | 75 | .then(() => { | |
| Back | FazBrowse Home | New Git URL |
0 commit comments