日期:2014-05-16  浏览次数:20455 次

【翻译】(12)NDK GDB

-----------------

英文文档见android-ndk-r5b的documentation.html

属于Android Native Development Kit (NDK)的一部分

见http://developer.android.com/sdk/ndk/(需要代理)

翻译仅个人见解

-----------------

'ndk-gdb' Overview

?

ndk-gdb概述

?

IMPORTANT: IF YOU ARE DEBUGGING THREADED PROGRAMS, PLEASE READ THE SECTION BELOW TITLED 'Thread Support'.

?

重要:如果你在调试多线程程序,请阅读下面题为“线程支持”的章节。

?

I. Usage:

?

一、用法:

---------

?

The Android NDK r4 introduced a helper shell script named 'ndk-gdb' to easily launch a native debugging session for your NDK-generated machine code.

?

Android NDK r4引入一个名为ndk-gdb的辅助shell脚本,为你用NDK生成的机器代码简单地启动原生调试会话。

?

The script is located at the top-level directory of the NDK, and shall be invoked from the command-line when in your application project directory, or any of its sub-directories. For example:

?

脚本位于NDK的顶级目录,当你位于应用程序工程目录或其子目录中,它将在命令行中执行。例如:

?

?? ?cd $PROJECT

?? ?$NDK/ndk-gdb

?

Where $NDK points to your NDK installation path. You can also create an alias or add $NDK to your PATH to avoid typing it every time.

?

这里$NDK指向你的NDK安装目录。你还可以创建一个别名或添加$NDK到你的PATH环境变量以避免每次都输入它。

?

IMPORTANT: Native debugging can only work if *all* these conditions are met:

?

重要:原生调试只可以工作在下面所有条件都满足的时候:

?

?? ?1. Your application is built with the 'ndk-build' script:

?

1. 你的应用程序由ndk-build脚本构建:

?

?? ? ? ?Building with the legacy "make APP=<name>" method is not supported by ndk-gdb.

?

遗留的make APP=<名称>方法构建不被ndk-gdb支持。

?

?? ?2. Your application is debuggable:

?

?? ?2. 你的应用程序可调试:

?

?? ? ? ?In other words, your AndroidManifest.xml has an <application> element that sets the android:debuggable attribute to "true"

?

?? ? ? ?换句话说,你的AndroidManifest.xml拥有<application>元素,它设置android:debuggable属性为true。

?

?? ?3. You are running your application on Android 2.2 (or higher):

?

3. 你在Android 2.2(或更高)上运行你的应用程序:

?

?? ? ? ?ndk-gdb will not work if you try to run your application on previous versions of the system. That does not mean that your application should target the Android 2.2. API level, just that the debugging session should happen on a 2.2+ device or emulator system image.

?

?? ? ? ?如果你尝试运行你的应用程序在以前的系统版本,ndk-gdb将不会工作。那并不意味着你的应用程序应该把目标定为Android 2.2。只是调试会话的API级别应该发生在版本2.2以上的设备或模拟器的系统镜像上。

?

?? ? ? ?IMPORTANT IMPORTANT IMPORTANT !!

?

?? ? ? ?重要 重要 重要 !!

?

?? ? ? ? ? ?If you are using the ADT Eclipse plug-in to build your application, make sure you're using version 0.9.7 or later.

?

?? ? ? ? ? ?如果你使用ADT Eclipse插件构建你的应用程序,请确保你正在使用0.9.7或更新。

?

?? ? ? ? ? ?If you are using the 'ant' build tool, make sure that you have the latest revision of the SDK Platform components. The following minimal revisions are required:

?

?? ? ? ? ? ?如果你正在使用ant构建工具,请确保你拥有最新修订版的SDK平台组件。需要以下最小修订版:

?

?? ? ? ? ? ? ? ?Android 1.5 ? ? ?r4

?? ? ? ? ? ? ? ?Android 1.6 ? ? ?r3

?? ? ? ? ? ? ? ?Android 2.1 ? ? ?r2

?? ? ? ? ? ? ? ?Android 2.2 ? ? ?r1

?

?? ? ? ? ? ?These should be available through the SDK updater.

?

?? ? ? ? ? ?这些修订版通过SDK更新器可用。

?? ? ? ? ? ?If these conditions are not met, the generated .apk will not contain required s