I'm trying to use the Java function Debug.isDebuggerConnected() on Android.
(Our app has some global exception handling that I want to disable when
running under the debugger, so that any exceptions can be trapped by the
debugger in the usual way.)

When I debug our app using Qt Creator, Debug.isDebuggerConnected() always
returns false, even though the debugger clearly is connected.

My Java function looks like this:

    public static boolean isDebuggerConnected() {
        if (Debug.isDebuggerConnected()) {
            Log.d(TAG, "**** Debugger connnected");
        }
        else {
            Log.d(TAG, "**** Debugger NOT connnected");
        }

        return Debug.isDebuggerConnected();
    }

And the C++ code that calls this via JNI is as follows:

bool debug_IsDebuggerPresent()
{
    jboolean isDebuggerConnected =
QAndroidJniObject::callStaticMethod<jboolean>(
        "com/trimble/access/Device",
        "isDebuggerConnected");
    return isDebuggerConnected != JNI_FALSE;
}

The log statement in the Java code produces this output:

D Device  : **** Debugger NOT connnected

And the result of the C++ function is 'false'.

Even more puzzling is that, a little earlier in the debug output, there is
this message coming from the OS:

I System.out: Debugger has connected

Am I doing something wrong here? Can anyone suggest why this function seems
to be telling me the debugger is not connected, when it plainly is?

Thanks,

Rob Allan
Trimble Ltd
_______________________________________________
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest

Reply via email to