Native Breakpoint Icon Cues Test

Status/Icon reference https://goo.gl/MLwqIU More info regarding breakpoint cues for native code: https://goto.google.com/ocnfz

Manually testing by using an existing project.

The short/quick way to test

  1. Download the native android app from https://goto.google.com/orfof. Extract and open it. Note: Update the local.properties to reflect the correct ndk and sdk directories.
  2. Verify that the target link libraries do not have ‘baz’ linked in CMakeLists.txt.
  3. Add breakpoints in Foo::getString in Foo.cpp and Baz::getString in Baz.cpp Verify that the breakpoints are both set to ‘Enabled’
  4. Re-sync gradle, rebuild the app and debug the app
  5. Breakpoint in Foo::getString should be hit Verify:
  • the icon is set to ‘Valid’ in Foo::getString()
  • the icon is set to ‘Enabled’ in Baz::getString()
  1. Resume the program Verify:
  • output in the app is “Hello from C++ I am in Foo”
  • the icon is set to ‘Valid’ in Foo::getString()
  • the icon is set to ‘Enabled’ in Baz::getString()
  1. Stop the app.

  2. Update the target_link_libraries CMakeLists.txt target_link_libraries( # Specifies the target library. native-lib foo baz

                    # Links the target library to the log library
                    # included in the NDK.
                    ${log-lib} )
    
  3. Verify that existing breakpoints are both set to ‘Enabled’

  4. Re-sync gradle, rebuild the app and debug the app

  5. Breakpoint in Foo::getString should be hit Verify:

  • the icon is set to ‘Valid’ in Foo::getString()
  • the icon is set to ‘Valid’ in Baz::getString()
  1. Resume the program Verify:
  • output in the app is “Hello from C++ I am in Foo”
  • the icon is set to ‘Valid’ in Foo::getString()
  • the icon is set to ‘Valid’ in Baz::getString()
  1. Stop the app.

Manually testing by creating a new project from scratch.

The long way (if the downloaded native android app does not work for some reason).

  1. Create a new project with C++ support with default options.

  2. Create Foo.h and Foo.cpp

1.a Update Foo.h

// start code #include

class Foo { public: Foo() { } std::string getString() const; }; // end code

1.b and update Foo.cpp

// start code #include “Foo.h”

std::string Foo::getString() const { std::string result; result = “I am in Foo”; return result; } // end code

  1. Create Baz.h and Baz.cpp and make similar updates.

2.a Baz.h // start code #include

class Baz { public: Baz() { } std::string getString() const; }; // end code

2.b Baz.cpp

// start code #include “Baz.h”

std::string Baz::getString() const { std::string result; result = “I am in Baz”; return result; } // end code

  1. Now update app/CMakeLists.txt

add foo and baz libraries

add_library( # Sets the name of the library. foo # Sets the library as a shared library. SHARED # Provides a relative path to your source file(s). src/main/cpp/Foo.cpp )

add_library( # Sets the name of the library. baz # Sets the library as a shared library. SHARED # Provides a relative path to your source file(s). src/main/cpp/Baz.cpp )

update the target_link_libraries

Note: baz is not part of the linked libraries.

target_link_libraries( # Specifies the target library. native-lib foo

                   # Links the target library to the log library
                   # included in the NDK.
                   ${log-lib} )
  1. Update native-lib.cpp

start update

extern “C” JNIEXPORT jstring JNICALL Java_com_example_kravindran_as_1icon_1cue_MainActivity_stringFromJNI( JNIEnv env, jobject / this */) { std::string hello = “Hello from C++”; const Foo f; hello += " " + f.getString(); return env->NewStringUTF(hello.c_str()); }

end update

  1. Add breakpoints in Foo::getString in Foo.cpp and Baz::getString in Baz.cpp Verify that the breakpoints are both set to ‘Enabled’

  2. Re-sync gradle, rebuild the app and debug the app

  3. Breakpoint in Foo::getString should be hit Verify:

  • the icon is set to ‘Valid’ in Foo::getString()
  • the icon is set to ‘Invalid’ in Baz::getString()
  1. Resume the program Verify:
  • output in the app is “Hello from C++ I am in Foo”
  • the icon is set to ‘Valid’ in Foo::getString()
  • the icon is set to ‘Invalid’ in Baz::getString()
  1. Stop the app.

  2. Update the CMakeLists.txt

update the target_link_libraries

Note: baz is now part of the linked libraries.

target_link_libraries( # Specifies the target library. native-lib foo baz

                   # Links the target library to the log library
                   # included in the NDK.
                   ${log-lib} )
  1. Verify that existing breakpoints are both set to ‘Enabled’
  2. Re-sync gradle, rebuild the app and debug the app
  3. Breakpoint in Foo::getString should be hit Verify:
  • the icon is set to ‘Valid’ in Foo::getString()
  • the icon is set to ‘Valid’ in Baz::getString()
  1. Resume the program Verify:
  • output in the app is “Hello from C++ I am in Foo”
  • the icon is set to ‘Valid’ in Foo::getString()
  • the icon is set to ‘Valid’ in Baz::getString()
  1. Stop the app.