I just want to get all dumps from java virtual machine threads, to look at what the threads lock and what threads waiting to unlock some resources. Something like is described here. I've tryed to kill Zygote process but with no results.
相关问题
- Delete Messages from a Topic in Apache Kafka
- Jackson Deserialization not calling deserialize on
- How can I create this custom Bottom Navigation on
- How to maintain order of key-value in DataFrame sa
- StackExchange API - Deserialize Date in JSON Respo
Taking the commands from the answer, and putting it all up together, here is the following script. Putting it into the dump.sh file and executing, it will find the needed PID, create a new file with current timestamp and next it will fetch the Thread-Dump into it. This command can be useful when one has a very short period of time to fetch the dump. Before using it, make sure that traces are put into the file
/data/anr/traces.txt
or replace this value in the script.As an alternative file name, one can use
f=$(date +"%T.%6N")
to get human readable timestamp. It would be easier to find the needed file.I'm guessing you need the threads within an app. For this, you can use the DDMS view on the ADT eclipse plugin. Here's the doc http://developer.android.com/tools/debugging/ddms.html#thread
The easiest way is with DDMS, or the ADT plugin in Eclipse. See http://developer.android.com/tools/debugging/ddms.html for basic instructions. In short, go into the Device view, select the application you're interested in, make sure thread updates are enabled, and switch to the Threads view. You will get a live-updated list of threads in that process. Double-clicking on a thread will grab a snapshot of the current stack state.
You can use select-all and copy in the thread dump to copy & paste the stack trace.
If you have a developer / rooted device, you can ask the Dalvik VM to dump thread stacks by sending a
SIGQUIT
to the app process you're interested in. For example, if you wanted to see the stacks for all threads in the Calendar app, you could do something like this:The logcat output will say something like:
So, pull that:
Every time you signal a process, the logs are appended to that file. There may be other stuff in there, so you need to search for
pid 2596
:The advantage of doing this over the DDMS thread view is that, if the thread is stuck on a monitor, the stack dump will give you an indication of what object is locked and which thread currently holds the lock.
The zygote process isn't relevant here; by definition it isn't running an app. Since it doesn't have a JDWP thread, and doesn't listen for SIGQUIT, you can't get a stack trace out of it anyway.
Just debug your app on your phone in Android Studio; then in the "Debug view"
Alt+5
just press the "Camera" button at the bottom left corner, to obtain a dump of all stacktraces, including locks they are holding.If you switch to the DDMS view in Eclipse you have some tools to look at threads. Is that what you're looking for?