Android中debug的应用

22 篇文章 0 订阅

怎样在Eclipse中使用debug调试程序?

最基本的操作是:
1, 首先在一个java文件中设断点,然后运行,当程序走到断点处就会转到debug视图下,
2, F5键与F6键均为单步调试,F5是step into,也就是进入本行代码中执行,F6是step over,
也就是执行本行代码,跳到下一行,
3,F7是跳出函数
4,F8是执行到最后。

 

按F5/F6跟进,当执行语句有变量时,在eclipse右上角的 variables 框里,会有变量的值,或者对象里的成员。

也可以通过 鼠标 选择 变量,单击右键 --> watch 来查看变量值。

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

偶尔会遇到程序跟进到了API中的class的情况,

可以下载 jadClipse || http://jadclipse.sourceforge.net/wiki/index.php/Main_Page

来查看反编译 class文件。

 

配合 jad || http://www.varaneckas.com/jad

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


1.Step Into (also F5) 跳入
2.Step Over (also F6) 跳过
3.Step Return (also F7) 执行完当前method,然后return跳出此method
4.step Filter 逐步过滤 一直执行直到遇到未经过滤的位置或断点(设置Filter:window-preferences-java-Debug-step Filtering)
5.resume 重新开始执行debug,一直运行直到遇到breakpoint
6.hit count 设置执行次数 适合程序中的for循环(设置 breakpoint view-右键hit count)
7.inspect 检查 运算。执行一个表达式显示执行值
8.watch 实时地监视变量的变化
9.我们常说的断点(breakpoints)是指line breakpoints,除了line breakpoints,还有其他的断点类型:field(watchpoint)breakpoint,method breakpoint,exception breakpoint.
10.field breakpoint 也叫watchpoint(监视点) 当成员变量被读取或修改时暂挂
11.添加method breakpoint 进入/离开此方法时暂挂(Run-method breakpoint)
12.添加Exception breakpoint 捕抓到Execption时暂挂(待续...)
断点属性:
1.hit count 执行多少次数后暂挂 用于循环
2.enable condition 遇到符合你输入条件(为ture/改变时)就暂挂
3.suspend thread 多线程时暂挂此线程
4.suspend VM 暂挂虚拟机
13.variables 视图里的变量可以改变变量值,在variables 视图选择变量点击右键--change value.一次来进行快速调试。
14.debug 过程中修改了某些code后--〉save&build-->resume-->重新暂挂于断点

=================================

1, let cell phone connects to computer

2, to confirm that APK file can install device via USB

         For example: you choose run Android Application in eclipse, this project could be installed in device directly

3, go to project IMP/AndroidManifest.xml, please in <application> element add android:debuggable="true",

like <application android:icon="@drawable/icon" android:label="@string/app_name" android:debuggable="true" >

4, add break point into source code then go to Debug As --- > Android Application

 

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值