Hi,

While doing debugging with Eclipse I noted that the debugger
highlights the wrong line as "next line to execute" for methods with
multiple return points. It fools the developer that the last line of
the method is executed, where in fact it is not.

Does anyone know if this is some kind of known issue? My colleagues
have also experienced this but we have never seen it when doing on-
device-debugging on e.g. the Sony Ericsson SDK.

I couldn't find anything at http://code.google.com/p/android/issues/list
There was a similar post in android-beginners 2007-11-25. No replies,
though.
http://groups.google.com/group/android-beginners/browse_thread/thread/60277af9bdca002f/805692d0e6689c6e?lnk=gst&q=John+Wiedey#805692d0e6689c6e

Any help would be deeply appreciated. It seems hard to know where in
the tool chain to begin looking for the problem.

    Br, Jesper


Steps to reproduce (works with both emulator and dev phone 1)

1. In the code below, set a break point at line 18: if (i == 1) {
2. Project, Debug
3. If prompted select "Android application" and target device
4. Debugger will stop at line 18
5. Press F5 (step into) - debugger advances to line 19: return 0;
6. Press F5 again. Now the debugger indicates that the next line to be
executed is 22: return 1 which is wrong.
7. Press F5 again and you are back to line 14 in calling code as
expected.

If the code line 12 is modified so that the call is m(2), the if-
statement is not executed and the debugger is correct. A similar
example can be made with a try-catch where it looks like the last line
of the catch block is executed even if no exception is thrown.

Code (first line is line 1)
----
package com.wayfinder.example;

import android.app.Activity;
import android.os.Bundle;

public class DebugProblem1 extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        m(1);

        setContentView(R.layout.main);
    }

    private int m(int i) {
        if (i == 1) {
            return 0;
        }

        return 1;
    }
}

Environment
----
SDK 1.1
Eclipse 3.4.2
ADT installed and used.

More details including dump available on request.

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

Reply via email to