ericsoco
ericsoco

Reputation: 26253

Possible to tell if two objects are the same in Chrome debugger?

In Eclipse, the debugger shows a unique session id next to each object (for Java and AS3, anyway). This makes it simple to identify the same object appearing in multiple contexts.

I'm working on a JavaScript project, and would like the same ability to identify objects in the Chrome debugger (e.g. in the "Scope Variables" pane). Is this information tracked by the browser/debugger? Is there a different way to identify an object across contexts, without adding code (a purely IDE way of doing this, applicable to any context).

Upvotes: 10

Views: 5318

Answers (3)

LucasZW
LucasZW

Reputation: 21

I believe this is possible using Chrome Dev Tools by:

  1. Taking a Heap Snapshot and opening up console while in summary view
  2. Printing the object in the console
  3. Right clicking the console output and selecting "Reveal in Summary View" (If you don't see this option it is likely that you do not have the profile panel open)

Upvotes: 1

beefeather
beefeather

Reputation: 1040

Technically this is possible. You probably already can see it, if you use Chrome Dev Tools for Java (Eclipse-based debugger). http://code.google.com/p/chromedevtools

As to in-browser debugger, UI merely lacks UI for this. I guess you should file a feature request on this at: http://crbug.com

P.S. Note, that this not an address at all – both Java and JavaScript move their objects in memory at random moments.

Upvotes: 2

Brian
Brian

Reputation: 7654

JavaScript does not have memory addresses. "The same variable" can be compared using the triple equal sign notation (anObjectReference === anotherObjectReference)

Upvotes: 1

Related Questions