Try "volatile int n= ...".  What's happening is that the compiler
figures out that the result of getColumn... is only used in the
following line, so it doesn't bother creating the variable n.

There may also be (likely is) a compiler option that will force it to
generate the (to it) useless assignment to n.

In the case of the if statement, it's likely being translated as two
nested ifs.  And then some oddities of how line numbers are mapped
probably creates the other factor of two multiplier in steps.

On Jul 23, 5:18 pm, ClarkBattle <[email protected]> wrote:
> I am debugging an app that tests an API I wrote. There is a section of
> code that simply reads a DB cursor like this:
>
> Cursor row = mDatabase.query("properties", null, where, null, null,
> null, null, null);
> if( row != null )
> {
>    if( row.moveToFirst() ) // A
>    {
>       int n=row.getColumnIndexOrThrow("value");
>       value = row.getString( n ); // B
>    }
>
> }
>
> The debugger steps through line at a time until it gets to the line
> commented // A. The next line the debugger gets to is the line
> commented // B!!! It completely skips over the "int n =..." line. Even
> stranger, at that point the int n is not listed as being in scope at
> all. Basically, as soon as it executes any method on row the debugger
> skips.
>
> I also have to step twice over each clause in any conditional. So
> this: if( a==2 || b==4 ) would require four "step over" actions to get
> past it. Very strange.
>
> I re-installed the latest version of eclipse with the latest ADB and
> the latest emulator. It still happens. This is running against Android
> 2.0, which is a requirement. I am on Windows 7 64 bit with a 32 bit
> installation of eclipse.
>
> Has anyone seen this strange debugger behavior? What should I try to
> do?
>
> Thanks.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to