Dalvik debug monitor server

Source: Internet
Author: User

Ddms is called Dalvik debug monitor server. It provides us with a screenshot of a test device, for example, viewing running threads and heap information, logcat, and broadcast status information for specific processes, simulate telephone calls, receive SMS, virtual geographic coordinates, and other functions. In essence, it interacts with applications on the mobile phone through the ddms tool or IDE debugger, such as passing commands and messages.

Ddms has the same effect on emulator and external test machine. If the system detects that they are running at the same time, ddms points to emulator by default. The operations after the above two types of startup are somewhat different.

How ddms works

Ddms acts as the intermediary between an IDE and an application on the test terminal. on Android, each application has its own Vm and runs in its own process, therefore, each process has a port to listen to the debugger command request.

It is your understanding of the working principle of ddms (I have not read the implementation of ddms source code, but I have drawn it based on my personal understanding. If there are any errors, please correct them): I have the following understanding points:

  • When ddms starts, it connects to ADB and enables a devices monitoring service. When a device connects to ADB or is disconnected from ADB, ddms will be notified.
  • Once a device is connected to ADB, ddms will create a VM monitoring service for this device. When a VM is started or terminated on the device, ddms will be notified.
  • Once a VM starts running, ddms obtains the PID of the VM through ADB, opens a port for the VM, and listens to the debugger from the VM. For the first opened VM port is 8600, the second VM is 8601, and so on...
  • Ddms opens the local port 8700 by default to receive all commands and information from the terminal.

When an IDE debugger is connected, ddms finds the selected Vm and connects to the test terminal through ADB. The process is as follows:

# Debugger send request command ide debugger --> ddms --> ADB --> adbd --> VM # debugger receives Request command VM --> adbd --> ADB --> ddms --> ide Debugger

 

Ddms Composition Analysis

Ddms contains three modules: ddmlib, ddmuilib, and ddms.

  • Ddmlib: a PC-side jar package. Its main function is to support communications between PCs and apps on mobile devices.
  • Ddmuilib: draws the UI of ddms.
  • Ddms: Controls UI rendering and network communication.

The log system of Android allows us to see the debugging information of the system. logs from different apps are stored in a series of circular buffer and displayed to us.

The log system of Android maintains multiple circular buffers to store log information. Not all logs are sent to the default circular buffer. To view log information in other circular buffers, you need to use the-B Option to start logcat. You can choose to view one of the following circular buffer:

  • RADIO: circular buffer that contains logs related to Radio/telephone;
  • Events: Event-related;
  • Dmesg: kernel debugging information.

For the use of ddms, please refer to this article: http://346386938.blog.163.com/blog/static/38439420201041203845317/

For more information about ddms, see: http://developer.android.com/guide/developing/debugging/ddms.html

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.