How do I step through C code from Java? - a Transformer Prime TF201 issue

Using NDK in Visual Studio, how can I step through C code from Java?

Currently, I can use break points on the Java side but not step into the C code, and C code breakpoints are ignored. However, an integer value is correctly returned from C to Java so the code is being called.

hi John3210,
you can do it by setting debug mode to Java and Native code at Project Properties>Configuration Properties>Debugging>Debug Mode.

Victor, thanks for replying.

I do have that setting and I have tried toggling it to Java/Native and back to Java plus Native but still cannot trace from Java code into Native code.

I wondered whether it had to do with Visual Studio being a 32bit program and the Arm processor being 64bit, though, of course, the code is only actually being stepped through on the tablet. Can’t see any other reason.


Hi John,

Are you able to do that with the Hello World sample project? Are you breakpoints in the C code resolved, i.e. are they red disks (resolved) or red circles, possibly with a warning mark (unresolved)? If the latter and Hello World works fine, then there’s probably something wrong with the symbols or path to them. Do you use Nsight Tegra to build a project or an external build system?

Hi Dmitry.

Can you point me to the correct “Hello World sample project” and I will check.
Nsight Tegra VS is installed in D:\NSight

The breakpoints are resolved - they are solid red circles, but they become greyed out when run.
They grey out when the launcher reaches “starting GDB debugger”.
I have my Asus Transformer Prime connected and the empty app runs on it okay.
The app pauses at this Java breakpoint…

public void onCreate(Bundle savedInstanceState)
super.onCreate(savedInstanceState); // breakpoint here

// Enter code here
ret=myMethod(); // cannot trace into this and breakpoint inside it is greyed out
ret++;          // returned value is correct so code has run


I am using VS2012 and the build system that Sight Tegra Visual Studio provides (no changes). I added just the two lines above to the project created by choosing “Android Application with Native Code”.

I do get a build message “VCInstallDir not found” but I have not been able to find the cause of that yet.

Please post the URL for “hello world”.


The Hello World sample I’m referring to is in the project templates and is named Android Hello World Demo.

Greyed out breakpoints means that they were not resolved by the GDB. Usually that’s happens when it fails to find the symbols for your app. Can you send me the most recent log from %AppData%\NVIDIA Corporation\Nsight Tegra\Logs? I’ve sent you my email address in a PM.

The VCInstallDir message is harmless, it won’t be shown in the next version of Nsight Tegra.

In the “Hello World” template I can set a breakpoint here…

public void run() {
while (true) { Runnable() {
public void run() {
tv.setText( stringFromJNI() ); // * breakpoint here

but when I reach the above breakpoint * then the breakpoint in HelloJni.cpp (**) is greyed out…
extern “C”
Java_com_example_hellojni_HelloJni_stringFromJNI( JNIEnv* env, jobject thiz )
return env->NewStringUTF(“Hello World”); // **

and I cannot step into that code from Java.


It’s currently impossible to debug native code on Asus Transformer Prime devices with stock Android 4.1.1. We are trying to find a solution to the problem.


I do appreciate your work in trying to fix this problem.

I was able to step through both Java and C++ code with NDK version 1.5 but would obviously prefer to work with the later version Nsight Tegra 2.0 Visual Studio Edition.

Are there significant differences between 1.5 and 2.0 that should prevent me from returning to 1.5 whilst you sort out the issues?


While the latest version is always preferred if possible, Nsight Tegra 1.5 should be working fine in most regards as well. Upgrading from 1.5 to the latest when it’s needed shouldn’t be a problem either.

Nsight Tegra, Visual Studio Edition - 2.0 Refresh - 2015/02/03

Is this new release likely to fix my issue with the Asus Transformer Prime ?

Unfortunately, it won’t. The issue with the Transformer Prime device is inherent to GDB, which makes it much harder to fix. We’re planning to research it, but I can’t give you any dates yet.

I appreciate you keeping it on your “todo” list.



The good news is that I have gone back to Nsight Tegra Visual Studio v1.5.1, and can now step through C++ and Java code on the Asus Transformer Prime TF201.



Does the Nsight Tegra Visual Studio version 3 installation fix my Asus Transformer Prime debugging problem?

Hi John,

No, it doesn’t. Unfortunately, our GDB engineers are currently busy with several device-agnostic issues and haven’t got time to address any device-specific ones.