Usage of android debugging tool DDMS

Source: Internet
Author: User

For details, see http://developer.android.com/tools/debugging/ddms.html. DDMS is a bridge between IDE, emultor, and real android devices. Developers can view the running process/ready-to-use status on the target machine through DDMS. They can go to the development machine on the android screen, view the heap information of the process, and view the logcat information, you can view the memory allocated by the process. You can send text messages and make phone calls to the target machine, and send geographic location information like android. Attach a process for debugging like gdb. The full version of ddms is provided in the SDK tools directory and can be directly run. The following uses DDMS perspective in Eclipse as an example to briefly introduce the features of DDMS.

Like debug and java's perspective, after adt is installed, there will be a DDMS perspective. Just open it.

The window that appears is,

The device window lists all processes in the simulator. The buttons in the upper right corner are: Debug a process, update a process, update the process stack information, and stop a process, when the last image is pressed, the current android screen is captured.

When you select a process and press the debug process button, if eclipse contains the code of this process, you can perform source code-level debugging. It's a bit like gdb attach. The image capture button can capture the current android display desktop to your machine, which is also very useful.

The window on the right contains the threads, heap, and file explorer tabs. Displays thread statistics, stack information, and android file systems respectively.

File explorer is very useful. It can upload files to or download files from android phones or delete files. After selecting the file explorer tab, you can click the following three buttons to upload, download, and delete the file system of your android phone.

Emulator control is also very important. It can send text messages like a mobile phone, make a call, and update the mobile phone location information.

Summary:

Currently, the ddms function provided by eclipse adt is only a small part of the real ddms. You can directly use the ddms below tools to use all the functions. One of the functions is useful for viewing the memory allocation of processes.

Full name of DDMS: Dalvik Debug Monitor Service
1. The role of DDMS is to provide screenshots, view thread and heap information, logcat, process, broadcast status information, simulate incoming call and SMS, and virtual geographic coordinates.

Ii. How does DDMS work? 1. Every Android application runs in a Dalvik Virtual Machine instance, and every virtual machine instance is an independent process space. The thread mechanism, memory allocation and management, and Mutex of virtual machines depend on the underlying operating system. All Android Application threads correspond to a Linux thread. Therefore, virtual machines can rely more on the thread scheduling and management mechanisms of the operating system.
2. DDMS acts as the intermediary between the IDE and the device or simulator.
3. A device monitoring service is established between the DDMS and ADB at startup to monitor the device. When the device is disconnected or connected, this service will notify DDMS.
4. When a device is connected, a VM monitoring service is established between DDSM and ADB to monitor virtual machines on the device.
5. Use ADB Deamon to establish a connection with the debugger of the virtual machine on the device, so that DDMS starts to talk to the virtual machine.

3. Port 1. DDMS enables a listening port for the debugger of each virtual machine on the device. The port starts from 8600.
Port

4. Panel 1 on the left, the left shows the list of all simulators or devices currently available and the list of VMS currently running for each device. Virtual machines are displayed according to the package Life of the program.

2. You can find the virtual machine that runs the activity for debugging through these lists. The "debugger pass-through" port is next to each virtual machine. A port is linked to the corresponding virtual machine on the device. In any case, when using DDMS, you only need to link to port 8700, because DDSM forwards all the communication to the selected virtual machine. In this way, you do not need to reconfigure the debugger port every time you switch the virtual machine.

3. When a running program calls the waitForDebugger () function, a red icon is displayed next to the client name, indicating that the debugger is connected to the corresponding virtual machine. This indicates that the debugger turns green.

4. If the cross icon is displayed, it means that DDMS cannot open the port of the virtual machine, but cannot establish a connection between the debugger and the virtual machine. If this is the case for all the VMS, it is likely that another DDSM instance is running.
5. Right Panel 1, info
General information about the selected VM is displayed, including the process ID, package name, and virtual machine version.

2, Threads
The thread view lists all threads of the process.
ID: the unique thread ID allocated by the VM. In Dalvik, they are odd numbers starting from 3.
Tid: linux thread ID, For the main thread in a process, this will match the process ID.
Stauts: thread status,
Running: executing program code
Sleeping: Thread. sleep () is executed ()
Monitor: Wait for a listener lock to be accepted.
Wait: Object. wait ()
Native: native code is being executed
Vmwait: waiting for the VM
Zombie: The thread is dying.
Init: The thread is being initialized (we cannot see it)
Starting: The thread is starting (we cannot see it)
Utime: the cumulative time for Executing User code
Stime: the cumulative time for executing system code
Name: thread name

4. VM Heap
Displays the status of some heaps, which are updated during garbage collection. When a VM is selected, the VM Heap view cannot display data. You can click the "Show heap updates" button on the right of the VM, then click "Cause GC" to implement garbage collection and update the heap status.

6. Allocation Tracker
In this view, we can track the memory allocation of each selected virtual machine. Click Start Tracking and click Get Allocations.

7. Emulator Control
Here, you can simulate the status and behavior of some devices.
Telephony Status: changes the Status of the telephone voice and data solution to simulate different network speeds.
TelePhony Actions: sends analog phone calls and text messages to the simulator.
Location Controls: sends virtual Location data to the simulator, and we can perform operations such as Location. You can enter the Longitude Latitude in Manual and send it to the simulator. You can also use the GPX and KML files.

Vi. Miscellaneous 1, File Explorer
Choose Device> File Explorer to open File Explorer. Here, you can browse the file and upload and delete the file. Of course, this is subject to permission restrictions.

2, Screen Capture
You can use Device> Screen Capture.

3. processing Processes
Through Device> Show process status, the information here is output through the shell command "ps-x.
4, Examine Radio State
Detects the broadcast status through Device> Dump radio.

5. Stop a Virtual Machine
Use Actions> Halt VM to stop a virtual machine.

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.