Use NDK to debug C + + code under Eclipse Touch No Symbol table is loaded

Source: Internet
Author: User

I was stuck with this question for 3 days and finally figured out why. There are various solutions to this problem on the Internet: Some say you need to increase the compiler parameter-G; some say write a test method, call it first, or modify the Gdb.setup file to ensure that it is a UNIX carriage return character. Basically, it's all nonsense.
First talk about the environment:
Windows 7, Eclipse Juno 4.2.2, CDT 8.1.2, ADT 23, NDK r10d, Python 3.4. Don't mention anything cygwin,ndk r10d no longer needs it, use Python instead. It's not easy to take care of these environments, but also to FQ.

Error Description:
The entire compilation run without problems, in the C\c++ code to add a breakpoint, the runtime can not be broken, add a breakpoint when the log hint "No symbol table is loaded." Use the "file" command.

JNI Classes for testing:
public class MyTest {
static {
System.loadlibrary ("Jnitest");
}
public static native String test ();
}

Cause of Error:
Influenced by sample in the NDK, System.loadlibrary () was made static and placed in the JNI class. Java when calling the static block is the first time that the class is used, that is, when the test method is first called, my app is the test method called in a menu item. However, NDK-GDB is only configured this time after the application has been run for the first time, calling Gdb.setup to set the debug environment. In other words, when the NDK-GDB configuration debugging environment, the Java Virtual machine has not LoadLibrary, and then no longer configured, so that the above error has occurred.

Workaround:
System.loadlibrary ("Jnitest") is encapsulated into a static method, which is called in OnCreate.

Use NDK to debug C + + code under Eclipse Touch No Symbol table is loaded

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.