- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
在使用 Android 2.3.4 附带的 Amazon Kindle Fire 解决问题时遇到了一些困难,崩溃是 SIGSERV 并且并不总是重现。
App本身是原生游戏,有几个点会闪退。很难通过日志语句确定究竟是什么导致了崩溃。我已经能够在保存游戏中捕获游戏状态,以继续恢复并运行一个有问题的部分。
此问题只会在启用 Proguard 时重现,我尝试了 Proguard 的各种配置以禁用各种功能。以下是在混淆器中使用的,对问题没有影响:
-keepclasseswithmembers class *{
native <methods>;
}
-keepclasseswithmembers class * {
*** *Callback(...);
}
-dontshrink
-dontoptimize
-dontpreverify
-keep class javax.** { *; }
-keep class java.** { *; }
-keep class org.** { *; }
-keep class android.** { *; }
-keep class com.** { *; }
添加 -dontobfuscate 似乎可以解决问题,但由于效果的随机性,我无法 100% 确认。
堆栈轨迹如下:
I/DEBUG (23231): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
I/DEBUG (23231): Build fingerprint: 'generic/blaze/blaze:2.3.4 GINGERBREAD/6.3.1_user_4107720:user/release-keys'
I/DEBUG (23231): pid: 23238, tid: 23409 >>> mypackage <<<
I/DEBUG (23231): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 00000000
I/DEBUG (23231): r0 00000000 r1 0045ae68 r2 00000fc0 r3 006f003b
I/DEBUG (23231): r4 003b0059 r5 00040013 r6 fff60000 r7 0004fff5
I/DEBUG (23231): r8 00080009 r9 0046d350 10 00100000 fp 00000001
I/DEBUG (23231): ip 00120008 sp 48c2ee24 lr 00070013 pc afd0cfe0 cpsr 20000110
I/DEBUG (23231): d0 0000001900000110 d1 be94da8200000000
I/DEBUG (23231): d2 bfd180bc00000000 d3 3feec709dc3a0300
I/DEBUG (23231): d4 be86935e00000000 d5 bfd5a7f8c70233a6
I/DEBUG (23231): d6 458000009eb93fdb d7 00000b9a00000b9a
I/DEBUG (23231): d8 00000000103a3c9d d9 0000000000000000
I/DEBUG (23231): d10 0000000000000000 d11 0000000000000000
I/DEBUG (23231): d12 0000000000000000 d13 0000000000000000
I/DEBUG (23231): d14 0000000000000000 d15 0000000000000000
I/DEBUG (23231): d16 3fe7356a68b6af7e d17 3ff0000000000000
I/DEBUG (23231): d18 be607fc1c458778e d19 bfa7cc5f02a59422
I/DEBUG (23231): d20 4000000000000000 d21 3f114aff86ff44bc
I/DEBUG (23231): d22 bebbaaeb53350f0d d23 bfd48eb6ede7d000
I/DEBUG (23231): d24 3e66376972bea4d0 d25 3fd193d7807f5e77
I/DEBUG (23231): d26 3ff4000000000000 d27 bfa7cc5f02a59424
I/DEBUG (23231): d28 c002b4ff18e04675 d29 bfd48eb70ee75389
I/DEBUG (23231): d30 3c6ad5a68fb54afb d31 be607fc1c4800000
I/DEBUG (23231): scr 80000012
I/DEBUG (23231):
I/DEBUG (23231): #00 pc 0000cfe0 /system/lib/libc.so
I/DEBUG (23231): #01 lr 00070013 <unknown>
I/DEBUG (23231):
I/DEBUG (23231): code around pc:
I/DEBUG (23231): afd0cfc0 24c04001 24c05001 e2522020 ba000005
I/DEBUG (23231): afd0cfd0 f5d1f060 f5d1f080 e8b151f8 e2522020
I/DEBUG (23231): afd0cfe0 e8a051f8 aafffffa e2922020 0a00000c
I/DEBUG (23231): afd0cff0 e1b0ce02 28b10078 48b10180 28a00078
I/DEBUG (23231): afd0d000 48a00180 e1b0cf02 24913004 40d140b2
I/DEBUG (23231):
I/DEBUG (23231): code around lr:
I/DEBUG (23231): 0006fff0 00000000 00000000 00000000 00000000
I/DEBUG (23231): 00070000 00000000 00000000 00000000 00000000
I/DEBUG (23231): 00070010 00000000 00000000 00000000 00000000
I/DEBUG (23231): 00070020 00000000 00000000 00000000 00000000
I/DEBUG (23231): 00070030 00000000 00000000 00000000 00000000
I/DEBUG (23231):
I/DEBUG (23231): stack:
I/DEBUG (23231): 48c2ede4 00000000
I/DEBUG (23231): 48c2ede8 00000000
I/DEBUG (23231): 48c2edec 00000000
I/DEBUG (23231): 48c2edf0 00000000
I/DEBUG (23231): 48c2edf4 00000000
I/DEBUG (23231): 48c2edf8 00000000
I/DEBUG (23231): 48c2edfc 00000000
I/DEBUG (23231): 48c2ee00 00000000
I/DEBUG (23231): 48c2ee04 00000000
I/DEBUG (23231): 48c2ee08 00000000
I/DEBUG (23231): 48c2ee0c 00000000
I/DEBUG (23231): 48c2ee10 002275c4
I/DEBUG (23231): 48c2ee14 00000001
I/DEBUG (23231): 48c2ee18 df002777
I/DEBUG (23231): 48c2ee1c e3a070ad
I/DEBUG (23231): 48c2ee20 48c2ee5c
I/DEBUG (23231): #00 48c2ee24 002275a0
I/DEBUG (23231): 48c2ee28 00001000
I/DEBUG (23231): 48c2ee2c 48c2ee5c
I/DEBUG (23231): 48c2ee30 00001000
I/DEBUG (23231): 48c2ee34 a811cda9 /system/lib/libutils.so
I/DEBUG (23231): 48c2ee38 00000000
I/DEBUG (23231): 48c2ee3c 81004f45 /system/lib/libOpenSLES.so
I/DEBUG (23231): 48c2ee40 00000000
I/DEBUG (23231): 48c2ee44 002275a0
I/DEBUG (23231): 48c2ee48 00227eb8
I/DEBUG (23231): 48c2ee4c 00000800
I/DEBUG (23231): 48c2ee50 48c2ee5c
I/DEBUG (23231): 48c2ee54 a903181b /system/lib/libmedia.so
I/DEBUG (23231): 48c2ee58 00000000
I/DEBUG (23231): 48c2ee5c 00000000
I/DEBUG (23231): 48c2ee60 00000001
I/DEBUG (23231): 48c2ee64 00000001
I/DEBUG (23231): 48c2ee68 00000800
为了获取调试信息,我启用了 proguard 进入 Debug模式并启用了调试符号并运行了 gdb。当崩溃发生时,通过 gdb 回溯被丢弃,因为帧上的返回指针已被覆盖。
使用 addr2line,内存引用显示它在 memcpy 中崩溃了。对 gdb 的一些挖掘表明它是 memcpy 的第一个参数被传递了一个 NULL 指针。
尝试了很多方法试图找到这个问题的根源,甚至尝试用我自己定制的函数替换 memcpy 函数来捕获问题。然而,在 ARM 指针数学下的重定向遇到了一些问题。
堆栈上的返回指针,而不是 lr 寄存器似乎指向 JITed 代码。这不是我调用 memcpy 的 native 代码。
在手动检查堆栈时,似乎没有任何内容指向我的任何 native 代码。
关于获取更多有用信息以查明问题或什至使用 memcpy 执行替换功能的任何建议?或者从 native 崩溃中获取有用的 dalvik 堆栈跟踪。
最佳答案
我遇到了同样的问题。在 Android 3.x 上工作得很好,然后你显示的同样的事情发生在 Android 4 上。只需使用 memmove,只要你想使用 memcpy。
关于Android NDK memcpy 崩溃,在 libc.so 中带有 proguard 的断回跟踪,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12044650/
我打算使用 vulkan synchronization examples 之一作为如何处理不经常更新的统一缓冲区的引用。具体来说,我正在看这个: vkBeginCommandBuffer(...);
我对 git 的了解有限。 我已经从 master 创建了一个分支 B1,进行了一些编辑并提交到这个分支。 我想从 B1 创建另一个分支 B2,我在 B2 中进行了一些编辑 而且我还想提交 B2(包含
这是我做的 我创建了一个分支 abc。然后我创建了两个文本文件 one.txt 和 two.txt。然后我将它们提交到分支 abc。然后我从分支中删除文件 one.txt 并将这些更改提交到分支。 现
在我的主分支中,我得到了 2 个文件: file1.txt file2.txt 我从那里创建了名为 b1 的新分支。在b1中,我修改了file2.txt,不小心删除了file1.txt(从磁盘中,当我
我是 git 的新手。 我创建了一个分支,进行了更改,现在我想 merge 回 master 以使它们“永久化”。 所以我执行了 git merge 1.2 报告为已经是最新的,在 master 上执
我在一个新团队中,工作方式与我以前习惯的完全不同,我们在功能分支上工作,测试人员会在该功能分支上进行测试,然后我们会运行一个 jenkins 作业在该功能被测试签署时将该功能 merge 到开发中,根
我目前正在学习动态内存管理是如何工作的,更具体地说是 realloc 以及它是如何在函数中完成的。 在下面的程序中,我只是想尝试使用 malloc 在函数 a() 中分配一些数字,然后将它们传递给另一
在 Java 中如何从另一个线程分派(dispatch)回主 UI 线程?我正在使用带有 Runnable 的执行器在主 UI 线程之外做一些工作,并且我有一个接口(interface),以便可以通过
我在 git 中有一个项目,所有的事情都直接在 master 分支上完成,标签被用来标记代码的发布版本。我知道这并不理想,并且一直在查看 git 流程,例如:http://nvie.com/posts
我们有一个相当大的 GIT 存储库,我想删除从未 merge 回 master 的分支。 反过来也很好 - 一种列出在某个时候已 merge 到 master 中的所有分支的方法。 我希望首先获取一个
在 Swift 和 C 之间传递字符串时,我看到一些我不理解的行为。请考虑以下 Swift 函数: func demo() { print("\n\n\n\n")
我以前从未合作过,现在我发现自己需要与其他一些人分享这个项目,即使我将完成 90% 的开发工作。 我在 github 上有一个私有(private)仓库。我用 推送了我的初始源 git push or
我们的项目使用 Gitlab,我们有两个长期存在的分支:dev 和 master,类似于 Git Flow。我们正在使用“merge 提交”方法,它将在主分支中创建一个 merge 提交。 但是,由于
我对自定义 View 的绑定(bind)属性有疑问。该属性绑定(bind)到核心数据实体的 NSArrayController。 问题是这样的: 在我看来,我画了几个矩形。这些矩形的位置保存在核心数据
这对我来说似乎太棘手,无法正确执行此操作。 我有一个TreeMap ,我正在获取其中的子图: public static reqObj assignObj(reqObj vArg, i
我有以下 XAML: 所以,基本上我希望将其中一
我正在使用 Angular js 1.3.4 版本并使用 ui-select。 我正在将复杂的多级 JSON 对象数组绑定(bind)到此 ui-select,它工作正常。因此用户可以在此选择中选择任
我正在使用 WebAPI 构建 API,并且一直在使用 NLog 在整个堆栈中进行日志记录。我的 API 解决方案有两个主要项目,包括: 实现 Controller 和 webapi 东西的网站层本身
在 Git 中,给定 (1) 一个分支 A 和 (2) 一个在过去某个时间从 A 派生的分支 B,然后 merge 回 A,我如何才能找到现在 A 中起源于 B 的所有提交? 目的是确定现在在 A 中
假设我的 Controller 如下所示: public class myController { private MyCustomItem acte; ... // gett
我是一名优秀的程序员,十分优秀!