Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Debugger crashes when attempting autocomplete on yet-to-be-required object #8359

Closed
sarathms opened this issue Sep 12, 2014 · 6 comments
Closed

Comments

@sarathms
Copy link

Scenario: While debugging attempted to use util.inspect(). But instead of requiring into a var and then calling the inspect method, tried performing a require('util').inspect(obj). Crash with below stack trace.

> require('util').inspThere was an internal error in Node's debugger. Please report this bug.
Object.keys called on non-object
TypeError: Object.keys called on non-object
    at Function.keys (native)
    at REPLServer.complete (repl.js:449:23)
    at Interface.complete [as completer] (repl.js:152:10)
    at Interface._tabComplete (readline.js:359:8)
    at Interface._ttyWrite (readline.js:779:14)
    at ReadStream.onkeypress (readline.js:99:10)
    at ReadStream.emit (events.js:98:17)
    at emitKey (readline.js:1095:12)
    at ReadStream.onData (readline.js:840:14)
    at ReadStream.emit (events.js:95:17)

I'm on Ubuntu 12.04

$ uname -srvmpio
Linux 3.8.0-34-generic #49~precise1-Ubuntu SMP Wed Nov 13 18:05:00 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

$ node
> process.versions
{ http_parser: '1.0',
  node: '0.10.31',
  v8: '3.14.5.9',
  ares: '1.9.0-DEV',
  uv: '0.10.28',
  zlib: '1.2.3',
  modules: '11',
  openssl: '1.0.1i' }
@trevnorris
Copy link

I can't reproduce. Can you give more specific steps, and possibly the contents of the object you were trying to inspect?

@sarathms
Copy link
Author

Using script which has code as simple as:

debugger;
console.log("hello nodejs");

Steps to reproduce:

  1. Run the script in debug mode. I used the usual node debug test.js.
  2. At the break point, enter the debug repl.
  3. At the repl prompt, type require(' and hit TAB.
  4. Crash!

NOTE: Autocomplete works until the '(' and crashes from the ' onwards.

@trevnorris
Copy link

@sarathms Thanks. Exactly what I needed to reproduce.

@trevnorris
Copy link

Also confirmed on the v0.12 branch.

@qfox
Copy link

qfox commented Nov 11, 2014

Catched the same error.

$ uname -srvmpio
Linux 2.6.39.4 #2 SMP Sun Aug 7 21:53:07 MSD 2011 x86_64 unknown unknown GNU/Linux

$ node -e 'console.log(process.versions)'
{ http_parser: '1.0',
  node: '0.10.21',
  v8: '3.14.5.9',
  ares: '1.9.0-DEV',
  uv: '0.10.18',
  zlib: '1.2.3',
  modules: '11',
  openssl: '1.0.1e' }

cjihrig added a commit to nodejs/node that referenced this issue Dec 6, 2014
Currently, the debugger uses require('repl') to setup the repl.
However, require.extensions is not available yet, causing a
crash on tab completion of require('. This commit uses the
module.requireRepl() method to bootstrap the repl.

Fixes: nodejs/node-v0.x-archive#8359
PR-URL: #49
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
@wonderdogone
Copy link

Confirmed same v0.11.14 windows

@Trott Trott closed this as completed Apr 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants