Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Watch register showing "Collecting data" #651

Open
c2hpxq opened this issue Sep 27, 2018 · 16 comments
Open

Watch register showing "Collecting data" #651

c2hpxq opened this issue Sep 27, 2018 · 16 comments
Labels

Comments

@c2hpxq
Copy link

c2hpxq commented Sep 27, 2018

Hi,
I'm debugging a 3rd party apk using smalidea, and I want to watch registers(p0, v0, etc) when single stepping through some method.
However, I meet the following strange behavior, the variables I've added simply show "Collecting data..." all the time and no value available.
image
I've googled around for a while, but there seems to be no similar situation or existing solution.
Can somebody help me with that? I really need your help!

@Rad0van
Copy link

Rad0van commented Oct 13, 2018

Hit that one too. is it a bug or a feature?

@Rad0van
Copy link

Rad0van commented Oct 14, 2018

Further info: upon trying to do so exception occurs:

Unexpected JDWP Error: 35
com.sun.jdi.InternalException: Unexpected JDWP Error: 35
	at com.sun.tools.jdi.JDWPException.toJDIException(JDWPException.java:65)
	at com.sun.tools.jdi.StackFrameImpl.getValues(StackFrameImpl.java:241)
	at com.sun.tools.jdi.StackFrameImpl.getValue(StackFrameImpl.java:201)
	at org.jf.smalidea.debugging.SmaliCodeFragmentFactory.evaluateRegister(SmaliCodeFragmentFactory.java:331)
	at org.jf.smalidea.debugging.value.LazyValue.getNullableValue(LazyValue.java:119)
	at org.jf.smalidea.debugging.value.LazyValue.hashCode(LazyValue.java:171)
	at java.util.HashMap.hash(HashMap.java:338)
	at java.util.HashMap.put(HashMap.java:611)
	at java.util.HashSet.add(HashSet.java:219)
	at com.intellij.debugger.engine.SuspendContextImpl.keep(SuspendContextImpl.java:189)
	at com.intellij.debugger.impl.DebuggerUtilsEx.keep(DebuggerUtilsEx.java:437)
	at com.intellij.debugger.ui.impl.watch.EvaluationDescriptor.calcValue(EvaluationDescriptor.java:90)
	at com.intellij.debugger.ui.impl.watch.ValueDescriptorImpl.setContext(ValueDescriptorImpl.java:186)
	at com.intellij.debugger.engine.JavaDebuggerEvaluator$1.threadAction(JavaDebuggerEvaluator.java:87)
	at com.intellij.debugger.engine.events.DebuggerContextCommandImpl.contextAction(DebuggerContextCommandImpl.java:83)
	at com.intellij.debugger.engine.events.SuspendContextCommandImpl.action(SuspendContextCommandImpl.java:73)
	at com.intellij.debugger.engine.events.DebuggerCommandImpl.run(DebuggerCommandImpl.java:33)
	at com.intellij.debugger.engine.DebuggerManagerThreadImpl.processEvent(DebuggerManagerThreadImpl.java:147)
	at com.intellij.debugger.engine.DebuggerManagerThreadImpl.processEvent(DebuggerManagerThreadImpl.java:43)
	at com.intellij.debugger.impl.InvokeThread.run(InvokeThread.java:141)
	at com.intellij.debugger.impl.InvokeThread.access$100(InvokeThread.java:18)
	at com.intellij.debugger.impl.InvokeThread$WorkerThreadRequest.run(InvokeThread.java:47)
	at com.intellij.openapi.application.impl.ApplicationImpl$1.run(ApplicationImpl.java:305)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)

@JesusFreke
Copy link
Owner

If you want to continue investigating this, I think the next step here would be to look through art's JDWP implementation to see what error 35 means.

@Rad0van
Copy link

Rad0van commented Oct 15, 2018

If you want to continue investigating this, I think the next step here would be to look through art's JDWP implementation to see what error 35 means.

According to https://android.googlesource.com/platform/art/+/master/runtime/jdwp/jdwp_constants.h it is:
ERR_INVALID_SLOT = 35

Does not ring a bell to me :-(

@JesusFreke
Copy link
Owner

That sounds like one of the registers that you added might be outside the range of valid registers in the given method. How many registers does the method have?

@Rad0van
Copy link

Rad0van commented Oct 15, 2018

That sounds like one of the registers that you added might be outside the range of valid registers in the given method. How many registers does the method have?

Does not matter how many - happens with all local variables like v0, v1, ... The screenshot posted no top shows it nicely. Using latest Android Studio.

@JesusFreke
Copy link
Owner

does it happen if you only have v0 in the watch list?

@Rad0van
Copy link

Rad0van commented Oct 15, 2018

does it happen if you only have v0 in the watch list?

Happens regardless of combination - can be single v0, or v0 and v1, ...

@JesusFreke
Copy link
Owner

Check logcat. Based on the source, there should be a corresponding error message

LOG(ERROR) << "Invalid local slot " << slot << " for method " << m->PrettyMethod();

@Rad0van
Copy link

Rad0van commented Oct 15, 2018

Not really. But I receive a different stack track now:

Read access is allowed from event dispatch thread or inside read-action only (see com.intellij.openapi.application.Application.runReadAction())
Details: Current thread: Thread[DebuggerManagerThread,4,Idea Thread Group] 1209329855
; dispatch thread: false; isDispatchThread(): false
SystemEventQueueThread: Thread[AWT-EventQueue-0 3.2#AI-181.5540.7.32.5056338 Studio, eap:false, os:Linux 4.15.0-36-generic, java-version:JetBrains s.r.o 1.8.0_152-release-1136-b06,6,Idea Thread Group] 439649949
com.intellij.openapi.application.impl.ApplicationImpl$NoReadAccessException
	at com.intellij.openapi.application.impl.ApplicationImpl.assertReadAccessAllowed(ApplicationImpl.java:1057)
	at com.intellij.psi.impl.source.PsiFileImpl.assertReadAccessAllowed(PsiFileImpl.java:180)
	at com.intellij.psi.impl.source.PsiFileImpl.getStubTree(PsiFileImpl.java:639)
	at com.intellij.psi.impl.source.tree.AstPath$RootPath.getFileStubTree(AstPath.java:307)
	at com.intellij.psi.impl.source.tree.AstPath$ChildPath.getFileStubTree(AstPath.java:212)
	at com.intellij.psi.impl.source.tree.AstPath.getStub(AstPath.java:67)
	at com.intellij.extapi.psi.StubBasedPsiElementBase.getStub(StubBasedPsiElementBase.java:386)
	at org.jf.smalidea.psi.impl.SmaliModifierList.hasExplicitModifier(SmaliModifierList.java:88)
	at org.jf.smalidea.psi.impl.SmaliModifierList.hasModifierProperty(SmaliModifierList.java:84)
	at org.jf.smalidea.psi.impl.SmaliMethod.hasModifierProperty(SmaliMethod.java:270)
	at org.jf.smalidea.psi.impl.SmaliMethod.isStatic(SmaliMethod.java:185)
	at org.jf.smalidea.psi.impl.SmaliMethod.getParameterRegisterCount(SmaliMethod.java:169)
	at org.jf.smalidea.psi.impl.SmaliRegistersStatement.getRegisterCount(SmaliRegistersStatement.java:66)
	at org.jf.smalidea.psi.impl.SmaliMethod.getRegisterCount(SmaliMethod.java:164)
	at org.jf.smalidea.debugging.SmaliCodeFragmentFactory.evaluateRegister(SmaliCodeFragmentFactory.java:282)
	at org.jf.smalidea.debugging.value.LazyValue.getNullableValue(LazyValue.java:119)
	at org.jf.smalidea.debugging.value.LazyValue.hashCode(LazyValue.java:171)
	at java.util.HashMap.hash(HashMap.java:338)
	at java.util.HashMap.put(HashMap.java:611)
	at java.util.HashSet.add(HashSet.java:219)
	at com.intellij.debugger.engine.SuspendContextImpl.keep(SuspendContextImpl.java:189)
	at com.intellij.debugger.impl.DebuggerUtilsEx.keep(DebuggerUtilsEx.java:437)
	at com.intellij.debugger.ui.impl.watch.EvaluationDescriptor.calcValue(EvaluationDescriptor.java:90)
	at com.intellij.debugger.ui.impl.watch.ValueDescriptorImpl.setContext(ValueDescriptorImpl.java:186)
	at com.intellij.debugger.engine.JavaDebuggerEvaluator$1.threadAction(JavaDebuggerEvaluator.java:87)
	at com.intellij.debugger.engine.events.DebuggerContextCommandImpl.contextAction(DebuggerContextCommandImpl.java:83)
	at com.intellij.debugger.engine.events.SuspendContextCommandImpl.action(SuspendContextCommandImpl.java:73)
	at com.intellij.debugger.engine.events.DebuggerCommandImpl.run(DebuggerCommandImpl.java:33)
	at com.intellij.debugger.engine.DebuggerManagerThreadImpl.processEvent(DebuggerManagerThreadImpl.java:147)
	at com.intellij.debugger.engine.DebuggerManagerThreadImpl.processEvent(DebuggerManagerThreadImpl.java:43)
	at com.intellij.debugger.impl.InvokeThread.run(InvokeThread.java:141)
	at com.intellij.debugger.impl.InvokeThread.access$100(InvokeThread.java:18)
	at com.intellij.debugger.impl.InvokeThread$WorkerThreadRequest.run(InvokeThread.java:47)
	at com.intellij.openapi.application.impl.ApplicationImpl$1.run(ApplicationImpl.java:305)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)

@ntomoya
Copy link

ntomoya commented Dec 6, 2018

The same issue occurred when I debugged an app running on Android 9.0.
However, debugging the same app on the same device downgraded to Android 7.1, everything works fine.

@railsjack
Copy link

railsjack commented Jan 20, 2019

I have same issue on handling this trouble. It's forever collecting data. Can't you fix this issue?

@wwwtete
Copy link

wwwtete commented Jun 28, 2019

I also encountered the same problem, have you solved it?

@railsjack
Copy link

Not yet

@ubamrein
Copy link

I stumbled accross this issue (getting jdwp 35 error code while trying to retrieve the arguments of a method) while trying to implement some basic debugger using the Java Debugger Interface. After trying around I found out that when I was using the Events location to retrieve the Method, I actually could get (at least) the parameters of the function. I was not testing thoroughly so maybe one could also go further.

Of course there is still the possibility to patch the smali files (with actual type and register information) and then repdeploy. The reason why this is necessary on Android 9 is described in the blog post below.

Anyways the guys at pnfsoftware faced similiar problems for their debugger. While the source code is closed they still had a blog entry describing why what was happening.

https://www.pnfsoftware.com/blog/debugging-android-apps-on-android-pie-and-above/

I hope this helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants