Android Debugging Tools DDMS usage _android

Source: Internet
Author: User
Tags garbage collection

Concrete visible http://developer.android.com/tools/debugging/ddms.html. Ddms a bridge for the IDE and Emultor, the real Android device. Developers can see the process/ready-made state running on the target machine through DDMS, can Android screen to the development machine, can look at the heap information of the process, can view the Logcat information, can see the process allocates memory, can send text messages and make a phone call like the target machine, can To send geographic information like Android development. You can attach a process debugging like GDB. The full version of the DDMS is available under the SDK Tools directory and can be run directly. The following is an example of Eclipse's DDMS perspective to briefly describe the features of DDMS.

As with the Debug,java perspective, the installation of a good ADT will have a DDMS perspective, open it.

open window for,

The Device window lists all the processes in the emulator, and the top-right row of buttons is: Debug a process, update a process, update process stack information, stop a process, and grab the Android screen when the last Picture button is clicked.

When you select a process and press the Debug process button, if you have the code for this process in eclipse, you can debug at the source level. A bit like gdb attach. The picture Grab button can take the current Android display desktop to your machine and is also very useful.

The window on the right has the threads, heap, File Explorer tab. Displays thread statistics, stack information, and the Android file system, respectively.

File Explorer is very useful, he can upload files to the Android phone, or download from the phone, you can also delete operations. After selecting the File Explorer tab, press the three buttons below to upload, download, and delete the Android phone file system.

Emulator control is also very important, through which it can send text messages like a cell phone, phone, has updated the location of mobile phone information.

Summarize:

The DDMS functionality currently provided by Eclipse ADT is only a small part of the real DDMS, and you can use all the features directly under the tools DDMS. One of the features that looks at the process memory allocation is more useful.


DDMS Full Name: Dalvik Debug Monitor Service
The role of DDMS it provides screenshots, viewing threads and heaps of information, logcat, processes, broadcast status information, analog call calls and SMS, virtual geographic coordinates, and so on.

Two, Ddms how to work 1, each Android application is run in a Dalvik virtual machine instance, and each virtual machine instance is a separate process space. The threading mechanism of virtual machines, memory allocation and management, mutexes, and so on are all dependent on the underlying operating system. All Android applications have a thread that corresponds to a Linux thread, so that virtual machines can rely more on the operating system's thread scheduling and management mechanisms.
2,ddms the role of an intermediary between the IDE and the device or emulator.
3,DDMS will establish a device monitoring service with the ADB to monitor the device when it starts. The service notifies DDMS when the device is disconnected or linked.
4, when a device is linked, a VM monitoring service is established between DDSM and ADB to monitor the virtual machines on the device.
5, the ADB deamon links to the debugger of the virtual machines on the device so that Ddms starts talking to the virtual machine.

Third, Port 1, for each virtual machine on the device debugger, DDMS will open a listening port. The port starts at 8600.
2,8700 Port

Four, left panel 1, the left shows all the current list of emulators or devices that can be found, and the list of virtual machines that each device is currently running. The virtual machine is displayed according to the package of the program.

2, these lists allow you to find the virtual machines that run the activity that you want to debug. Next to each virtual machine is the "debugger pass-through" port, which links to one of the ports and links to the corresponding virtual machines on the device. However, when using DDMS, you only need to link to port 8700 because DDSM forwards all traffic to the currently selected virtual machine. This way, you don't have to reconfigure the debugger port each time you switch the virtual machine.

3, when a running program calls the Waitfordebugger () function, a red icon appears next to the client name, knowing that the debugger is connected to the corresponding virtual machine, which is debugger will turn green.

4, if you see the fork icon, it means that DDMS is used for the port that cannot open the virtual machine and cannot establish a debugger connection with the virtual machine. If you see all the virtual machines as such, there is probably another DDSM instance running.
Five, right panel 1,info
This shows general information about the selected VM, including the process ID, the package name, and the virtual machine version.

2,threads
The thread view lists all the threads for this process.
ID: the only thread ID that the virtual machine assigns, in Dalvik, they are odd numbers starting from 3.
The Tid:linux thread id,for the main thread in a process and this would match the process ID.
Stauts: Thread state,
Running: Executing program code
Sleeping: Executed Thread.Sleep ()
Monitor: Waiting to receive a listening lock.
Wait:Object.wait ()
Native: Executing native code
Vmwait: Waiting for virtual machines
Zombie: Threads in the dying process
Init: Thread is initializing (we can't see it)
Starting: Thread is starting (we can't see it)
Utime: Cumulative time to execute user code
Stime: Cumulative time to execute system code
Name: Names of Threads

4,VM Heap
Shows the status of some heaps that are updated during garbage collection. When you select a virtual machine, the VM heap view cannot display data, click on the "Show Heap Updates" button on the right side of the loaf, and then click "Cause GC" to implement the garbage collection update heap status.

6,allocation Tracker
In this view, we can track the memory allocations for each selected virtual machine. Click "Start Tracking" and click "Get Allocations" to see it.

7,emulator Control
Here, you can simulate some device state and behavior.
Telephony Status: Change the state of telephony and data schemes to simulate different network speeds.
TelePhony Actions: Send analog phone calls and SMS to simulators.
Location Controls: Send virtual positioning data into the simulator, we can perform the operations such as positioning. It can be done. Enter longitude latitude in manual to be sent to the simulator, or through GPX and KML files.

Six, other 1,file Explorer
Open File Explorer with device > File Explorer. Here you can browse the file, upload the upload to delete the file, of course, there is a corresponding permission restrictions.

2,screen Capture
Screenshots are available via device > Screen Capture.

3,exploring Processes
Through device > Show process status, the information here is exported through the shell command "Ps-x".
4,examine Radio State
Detects broadcast status through device > Dump radio.

5,stop a Virtual Machine
Stop a virtual machine through the Actions > Halt VM.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.