NDK(6)eclipse下断点调试ndk代码

Using the NDK Plugin

1. First set the path to SDK and NDK:

  Eclipse -> Window -> Preferences -> Android -> set path to SDK  

  Eclipse -> Window -> Preferences -> Android -> NDK -> set path to the NDK 

 

2. Right click on an Android project and select Android Tools -> Add native support.

  Note that you will not be able to add native support if the project already has C/C++ nature.

  At this point, you will be able to build your applications using Project -> Build All.

  Debugging native applications

  a. Update your build config to include “NDK_DEBUG=1”. 没有 空格 

    Right click project -> properties -> C/C++ Build:
 
  b. Set a breakpoint in your C code.
  c. Right click on your project, select Debug As -> Android Native Application

Note:
  a,  There is a delay of a few seconds between when the activity is launched and when native debugging starts. If your code is already executed by that point, then you won’t see the breakpoint being hit. So either put a breakpoint in code that is called repetitively, or make sure that you call JNI code after you see that ndk-gdb has connected.
  b,  在模拟器上调试时最好在Application.mk中  APP_ABI := x86  
  c,  在真机器上,最好有root权限, Application.mk中  APP_ABI :=  armeabi
 
下图是在模拟器上调试:
 

Known Issues

1. Eclipse does not automatically find the include paths to all the NDK headers on Windows. This issue will be fixed (20.0.1+).
2. Eclipse does not automatically find the include paths with CDT 8.1.0 (Juno). This issue is tracked in Bug 33788.

转载于:https://www.cnblogs.com/sjjg/p/4736730.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值