系统版本4.4.4,修改的文件是:
/home/haIDragon/Desktop/androID/libcore/dalvik/src/main/java/dalvik/system/Zygote.java
...................................... public static boolean systemInSafeMode = false; private Zygote() {}//-----------------------haIDragon-----------------------// private static volatile boolean mWaiting = false; public static boolean isDeBUGgerConnected() { return VMDeBUG.isDeBUGgerConnected(); } public static voID waitForDeBUGger() { if (!VMDeBUG.isDeBUGgingEnabled()) { //System.out.println("deBUGging not enabled,not waiting"); return; } if (isDeBUGgerConnected()) return; // if DDMS is Listening,inform them of our plight System.out.println("Sending WAIT chunk"); //byte[] data = new byte[] { 0 }; // 0 == "waiting for deBUGger" //Chunk waitChunk = new Chunk(ChunkHandler.type("WAIT"),data,1); //DdmServer.sendChunk(waitChunk); mWaiting = true; while (!isDeBUGgerConnected()) { try { Thread.sleep(200); } catch (InterruptedException IE) {} } mWaiting = false; System.out.println("DeBUGger has connected"); /* * There is no "ready to go" signal from the deBUGger,and we‘re * not allowed to suspend ourselves -- the deBUGger expects us to * be running happily,and gets confused if we aren‘t. We need to * allow the deBUGger a chance to set breakpoints before we start * running again. * * Sit and spin until the deBUGger has been IDle for a short while. */ while (true) { long delta = VMDeBUG.lastDeBUGgerActivity(); if (delta < 0) { System.out.println("deBUGger detached?"); break; } if (delta < 1300) { System.out.println("waiting for deBUGger to settle..."); try { Thread.sleep(200); } catch (InterruptedException IE) {} } else { System.out.println("deBUGger has settled (" + delta + ")"); break; } } }//-----------------------haIDragon-----------------------// private static int i=0; private static voID prefork() { i++; if(i>3){ waitForDeBUGger(); } Daemons.stop(); waitUntilAllThreadsstopped(); } ......................................
因为这里是不能用androID.os.DeBUG.waitForDeBUGger()的,因为没有androID.os.deBUG包。但是我们可以去看这个实现。发现在4.4.4中它实现就是在 ‘/home/haIDragon/Desktop/androID/libcore/dalvik/src/main/java/dalvik/system/VMDeBUG.java‘ 内。通过‘/home/haIDragon/Desktop/androID/frameworks/base/core/java/androID/os/DeBUG.java‘ 这个类调用的。
其它系统不一样我看了5系统以上dalvik/system目录的东西移动到art的runtime里面去了。
到这里我们重新生成system.img刷入手机。他就会创建三个进程后等待调试器连接。
手机就会一直卡死在那。
然后就是找不到zygote进程,我进手机里看端口附加也没用。原因应该是zygote本身是一个cpp层的执行程序吧(app_process)先写这里。后面还是用 gdb/gdbserver 附加方式调试吧。我这是折腾下as。 总结
以上是内存溢出为你收集整理的尝试用android studio调试zygote进程全部内容,希望文章能够帮你解决尝试用android studio调试zygote进程所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)