Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 854
Johan Avatar asked Dec 18 '25 01:12

Johan


2 Answers

Create a method exit breakpoint instead of a normal breakpoint.

like image 140
Bananeweizen Avatar answered Dec 19 '25 16:12

Bananeweizen


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.

like image 31
BrantApps Avatar answered Dec 19 '25 15:12

BrantApps



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!