. Net CF Command Line debugger mdbg entry (3) Process Control

Source: Internet
Author: User
Old wolf's words: David Kline is a very good developer in the. net cf team. He has seen this series of articles for a long time and has never been able to translate them. Today, I used my post time to translate it. I also hope that I can make this series of articles so that more friends can understand it. Original article address:
Http://blogs.msdn.com/davidklinems/archive/2006/08/11/695975.aspx

In the first two articles in this series, I discussed how to get started with mdbg and how to use a device simulator. This time, we will discuss how to use mdbg to control processes on the device during debugging.

Commands
CP [Roc]
Kp [Roc]
Pro [cessenum]

CP [Roc] command: run a process without attach the debugger to the process.

In my first article, I talked about how to connect to the netcflaunch application and start to debug an application. At that time, I want to debug the running process. If I want to start a process but do not debug it. I will use the CP [Roc] command, for example:

Mdbg> CP "/program files/webcrawler.exe"

If the command can start a process, the mdbg> prompt will appear. If a process cannot be started (for example, the application does not exist), an error message is displayed.

Pro [cessenum] command: list processes running on the Current Device

If you often need to know which processes are running on your device. For example, your application depends on the data provided by other processes or executes special characters. Run the pro [cessenum] command to check whether the dependent process is running. The following example shows the processes running on your windows mobile 5.0 Pocket PC:

Mdbg> pro
Active processes on current machine:
(PID: 0x0dcb4002) nk. exe
(PID: 0xedca5752) filesys.exe
(PID: 0x8dadc526) device.exe
(PID: 0xcd7f62ea) Shell32.exe
(PID: 0xcd97c7a6) gwes.exe
(PID: 0xcd7f6732) services.exe
(PID: 0x2d4b6da6) commloader.exe
(PID: 0xcd517ac2) batteryindicator.exe
(PID: 0x2d5219ea) connmgr.exe
(PID: 0xad517b8a) srvtrust.exe
(PID: 0xed810392) repllog.exe
(PID: 0x2d4b6c76) poutlook.exe
(PID: 0xed3affce) cprog.exe
(PID: 0x2d99977a) rapiclnt
(PID: 0xeced62b2) webcrawler.exe
(PID: 0x2d0ed5be) tmail.exe
(PID: 0x8d30f68a) netcflaunch.exe

When we look at this process, we can see that we successfully run webcrawler.exe when we call cp1_rocworkflow.

Kp [Roc] command: terminate a running process

In some cases, we need to terminate the running of a process. When my application communicates with other processes, I need to study the failure code path, which will be very useful. In the following example, I use the kp[roc command to end the webcrawler.exe process. This process was started using the CP [Roc] command.

Mdbg> KP 0xeced62b2

The value passed to the KP [Roc] command is the process ID (PID) listed by the Pro [cessenum] command ).

(PID: 0xeced62b2) webcrawler.exe

Note: Be careful when terminating processes on the device. Force terminating an incorrect application may cause device instability or delay. (Note: nk.exe?filesys.exe=device.exe=shell32.exe=gwes.exeand services.exe are processes related to system running and cannot be forcibly terminated .)

Tip: Use the command line to prompt whether the quickedit mode or mark and paste function in the form enables the mdbg to use the cut and copy functions.

Enjoy!
-- Dk
 

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.