Johan
Johan

Reputation: 35194

Inspect object data when debugging in Eclipse (3.7)

I just started developing Android apps in Eclipse. I usually code in Visual Studio, and there is one thing that I just cant figure out how to do in Eclipse:

For example, if i have the following method, and want to inspect the variable i:

public void Foo()
{
    int i = 1;
} 

In visual studio, I am able to set the breakpoint on the closing }, and can inspect the variable:

public void Foo()
{
    int i = 1;
} // <-- Breakpoint here

But in Eclipse, I'm only able to set it on the variable itself:

public void Foo()
{
    int i = 1; //<-- Here
} 

Which result in that i cannot inspect the variable, unless i add another line of code and break later in the method.

TL;DR: How do I inspect a variable in Eclipse while I'm in debug mode?

Upvotes: 3

Views: 4162

Answers (3)

BrantApps
BrantApps

Reputation: 6472

Just F6 over your allowed breakpoint and cntrl+shift+i on the variable you wish to inspect. Jobs a good 'un. The closing brace is a line of code so the debugger won't skip out of the method thus losing your reference.

Upvotes: 1

Bananeweizen
Bananeweizen

Reputation: 22070

Create a method exit breakpoint instead of a normal breakpoint.

Upvotes: 1

someone
someone

Reputation: 6572

In debug mode you could right click on variable and you will see "Watch" click on that. In Expression tab you will see your variable changes. If you just want to see variable value you can do "Inspect" after right click on it.

Upvotes: 0

Related Questions