Android的NDK的NDK-gdb的Emacs的整合? [英] Integration of android ndk's ndk-gdb with emacs?

查看:376
本文介绍了Android的NDK的NDK-gdb的Emacs的整合?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

谁能告诉我如何 NDK-gdb的从emacs的使用范围内运行的 GDB-模式?我目前运行在一个的的缓冲区。我喜欢有一种方法可以自动同步源文件缓冲区当前PC在gdb的时候我休息或台阶。再说了,如设置从源头断裂,这表明GDB本地人等,并为gdb命令快捷键将肉汁的缓冲区。

Can anyone tell me how to run ndk-gdb from within emacs using gdb-mode? I'm currently running it in a shell buffer. What I'd love to have is a way to automatically sync a source file buffer with the current pc in gdb when I break or step. Anything more, like setting breaks from source, buffers that show gdb locals etc., and key shortcuts for gdb commands would be gravy.

背景:我正在开发的GNU Emacs的23.1.90.1(I386-苹果darwin10.5.0,NS苹果了AppKit-1038.35)的2010-12-15在OSX 10.6.6与Android的模式,采用android- NDK-R5B和混合的Java / C / C ++ $ C $下一个Android的目标。

Background: I'm developing in GNU Emacs 23.1.90.1 (i386-apple-darwin10.5.0, NS apple-appkit-1038.35) of 2010-12-15 on OSX 10.6.6 with android-mode, using android-ndk-r5b and mixed java/c/c++ code for an android target.

Android的模式和外壳(运行NDK-GDB)在Emacs让我看到只是我需要的一切,但我的设置会更方便,如果我能得到一个源缓冲区与调试器进行同步,或者获得等同什么是EmacsWiki 这里描述。

Android-mode and shell (running ndk-gdb) within emacs allow me to see just about everything I need, but my setup would be more convenient if I could get a source buffer to sync with the debugger, or get the equivalent of what is described in EmacsWiki here.

通知你,我目前使用Eclipse进行Java一边调试和开发,但是发现它不稳定的,难以建立原生的工作,尽管的塞阔亚,而且,月食是没有emacs的。

FYI, I'm currently using eclipse for java side debugging and development, but finding it unstable and difficult to set up for native work, despite the availability of sequoyah, and besides, eclipse is no emacs.

[追加]

运行GDB的Mx使用NDK-GDB作为gdb命令(见下文),结果在一个叫做缓冲的 GUD 的一个模式行说:(调试器:运行[初始化...])。缓冲区不接受gdb命令,也不会接受emacs的gdb命令 - (MS,锰等导致与<>

Running M-x gdb with ndk-gdb as the gdb command (see below) results in a buffer called gud with a modeline saying "(Debugger:run [initializing...])". The buffer does not accept gdb commands, nor does it accept emacs gdb commands - (M-s, M-n etc result in <>

输出:


Current directory is /Users/jpschelter/
Android NDK installation path: /Developer/android-ndk-r5b
Using specific adb command: /Developer/android-sdk-mac_x86/platform-tools/adb
...
... ...
...
(no debugging symbols found)
warning: Unable to find dynamic linker breakpoint function.
GDB will be unable to debug shared library initializers
and track explicitly loaded dynamic code.
0xafd0e21c in nanosleep () from /Developer/Projects/ECS/DIGG/Projects/droid/obj/local/armeabi/libc.so
(gdb) Undefined command: "1-inferior-tty-set".  Try "help".
(gdb) Undefined command: "2-gdb-set".  Try "help".
(gdb) Undefined command: "3-gdb-set".  Try "help".
(gdb) Undefined command: "4-file-list-exec-source-files".  Try "help".
(gdb) Undefined command: "5-file-list-exec-source-file".  Try "help".
(gdb) Undefined command: "6-gdb-show".  Try "help".
(gdb) Undefined command: "7-stack-info-frame".  Try "help".
(gdb) Undefined command: "8-thread-info".  Try "help".
(gdb) Undefined command: "9-break-list".  Try "help".

缓冲器名为 *的* 主题*输入/输出* *也创造了* 断点,但都是空的。

Buffers called *threads of*, *input/output of* and *breakpoints of* are also created, but are empty.

翻阅我的Emacs的GDB-mi.el源,和比较到 GDB调试日志输出,它看起来像GDB-MI正试图将这些参数发送到GDB的可执行文件,但GDB服务器不响应命令如预期?

Browsing through the gdb-mi.el source of my emacs, and comparing to the gdb-debug-log output, it looks like gdb-mi is trying to send these parameters to a gdb executable, but gdb-server is not responding to the commands as expected?

请注意,运行的Mx GUD-GDB的命令行NDK-gdb的似乎导致运行NDK-gdb的一个壳体内的等价物,所以这个问题似乎是GDB模式在Emacs的配置中。

Note that running M-x gud-gdb with the command-line for ndk-gdb seems to result in the equivalent of running ndk-gdb within a shell, so the issue seems to be within the configuration of gdb-mode in emacs.

推荐答案

在emacs的运行gdb的时候我有相同的问题:* GUD *窗口没有响应命令。不过,NDK-gdb的运作良好的外壳。为了让在GUD UI Emacs的工作,我不得不修改NDK-gdb的脚本了一下。

I had the exact same problem when running gdb under emacs: the *gud* window was not responding to commands. However, ndk-gdb was working well in a shell. To make it work under the emacs gud UI, I had to modify the ndk-gdb script a bit.

在调用GDB(最后一行),这样做:

On call to GDB (last line), do this:

$GDBCLIENT --annotate=3 -x `native_path $GDBSETUP`

在--annotate = 3选项强制emacs的GUD接口,就不能没有它的工作(这就是为什么* GUD *没有响应)。

The --annotate=3 option is mandatory for emacs gud interface, it cannot work without it (that's why *gud* was not responding).

但你半途而废。现在,它会工作,但只有当你在一个缓冲区从文件的项目(如AndroidManifest.xml中)的根调用NDK-gdb的一段时间。由于这是非常不可能的大部分时间,因为你是一个C / C ++程序员,你工作的来源是JNI目录或更深下,你需要做的更多一点。该NDK-gdb的脚本是一个有点马车,它会高兴地迷惑你就这一个(和gdb本身也无能为力)。

But you're halfway. Now it will work, but only if you invoke ndk-gdb while in a buffer from a file at the root of the project (like AndroidManifest.xml). Since this is very unlikely most of the time because you are a C/C++ programmer and the sources you're working on are under the jni directory or deeper, you need to do a little more. The ndk-gdb script is a bit buggy and it will happily confuse you on this one (and gdb itself won't help much either).

搜索脚本PROJECT = $ OPTION_PROJECT。您将在很长的话......否则......科幻条款,负责寻找项目的根目录(如果它没有被赋予与--project选择,虽然这样做不会解决问题的我谈论,见下文)。该网络后,加入这一行:

Search the script for "PROJECT=$OPTION_PROJECT". You will be in a long if...else...fi clause which is in charge of finding the root of the project (if it has not been given with the --project option, though doing so WILL NOT resolve the issue I talk about, see below). After the fi, add this line:

cd $PROJECT

对于一些模糊的原因,该脚本没有cd到项目的根目录。这导致了非常错误的行为时,与在该脚本假设是在项目的根在gdb.setup文件处理。添加此行会解决它。

For some obscure reason, the script DOES NOT cd to the project root directory. This leads to very wrong behaviour when dealing with the gdb.setup file where the script assumes to be at project root. Adding this line will fix it.

请确保你调用NDK-gdb的Emacs的范围内与通常的命令:

Make sure you call ndk-gdb within emacs with the usual command:

(gdb "ndk-gdb ...")

不要使用GUD-GDB(奇怪的是,这是用gdb的旧emacs的方式无关,与你要搜索的漂亮的UI)。替换...你的论点,(CONCAT ...)或者你想什么。我强烈建议无论如何要使用--project选项。如果不这样做,你在一个缓冲区的文件,该文件是出的项目,该脚本将找不到根。更糟的是,如果你在另一个Android项目的文件,它会发现,项目的根,而不是(甚至复制gdb.setup,配件到它失败了GDB会话之前)。所以给那个该死的--project选项。如果你使用emacs桌面命令集,做到这一点:

Do not use gud-gdb (oddly, this is old emacs way of using gdb and has nothing to do with the nice UI you're searching for). Replace ... with your arguments, (concat ...) or anything you wish. I strongly recommend to use the --project option anyway. If you don't and you are in a buffer for a file which is out of the project, the script won't find the root. Worse, if you're in a file in another Android project, it will find the root of that project instead (maybe even copying gdb.setup and stuffs into it before failing the gdb session). So give that damn --project option. If you're using emacs desktop command set, do this:

(gdb (concat "ndk-gdb --project=" desktop-dirname ...))

(假设你的.emacs.desktop当然是在项目的根)。

(assuming your .emacs.desktop is at the root of the project, of course).

现在你终于可以用GUD UI调试,在源代码级设置断点。 请注意,我用emacs 23.3.1(GDB-ui.el),所以没有必要有24对这项工作。

Now you can finally debug with gud UI, setting breakpoints at source level. Note that I use emacs 23.3.1 (gdb-ui.el), so there is no need to have 24 for this to work.

这篇关于Android的NDK的NDK-gdb的Emacs的整合?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆