如何在WINCE模拟器中调试OS模块和应用程序

一、与PB调试有关的编译选项介绍

Platform->Settings->Bulid Options:

a.Enable CE Target Control Support

  支持对实际平台的控制,可以执行CESH命令

b.Enable Event Tracking During Boot

  在引导过程中支持事件跟踪

c.Enable Full Kernel Mode

  支持全内核模式(有关全内核模式见配置文件)

d.Enable Kernel Debugger

允许调试内核

e.Enable KITL(内核独立传输层)

用于在开发平台和实际平台之间相互通信

f.Enable Profiling---能够测试内核的行能

选择时应注意的问题

1.(a)(d)不选,选择(e),这时Target->Run programs/Target Control变灰,没法调试应用程序及内核,断点失效,应用程序不可调用; Connectivity Options->Debugger中的KdStub选或不选,均可运行模拟器.

2.(a)(e),不选择(d),这时Target->Run programs/Target Control可用,没法调试应用程序及内核,断点失效,应用程序可调用; Connectivity Options->Debugger中的KdStub选或不选,都可以运行模拟器.

3.(a)(d)(e)都选上,这时模拟器可以运行,而且Target->Run programs/Target Control可用,可以调试应用程序及内核,断点可用,可调试跟踪,应用程序可调用; Connectivity Options->Debugger中的KdStub必须选上,才可以运行模拟器,如果不选KdStub,模拟器出现黑屏后停滞,且出现如下警告!

Warning: 

Debugger service map is set to none.

If your image has debugging support it may not boot properly.

Cannot access selected Device from service host.

The Kernel Debugger is waiting to connect with target.

Debugger could not initialize connection.

The Kernel Debugger has been disconnected successfully.

 

二、如何在WINCE5.0下调试应用程序?

 

1.     新建或打开一个PB5.0项目,在编译生成镜像文件之前作如下配置:

iPlatform->Settings…->Bulid Options

 

iiBuild OS->Set Active Configuration…

 

2.新建或导入一个WINCE5.0应用程序项目,例如名字为AppTest,编译生成可执行文件AppTest.exe,可执行文件会自动被拷贝到模拟器运行后的Release文件夹下面.

 

3.配置(见下图)并运行模拟器,然后到AppTest代码中用F9键设置断点.

 

4.选择Target->Run Programs…, 运行应用程序AppTest.exe,然后按Go按钮( )跟踪程序,或者在窗口区按右键选中Debug调出浮动调试窗口,通过浮动调试窗口来调试程序.

 

5.调试完毕后,要停止Debug调试,具体做法:Debug菜单或工具条选择Stop Debugging即可.如果不这样做的话,重新编译应用程序时,会编译不过去!

 

三、如何在WINCE5.0下调试OS

 

1.在上面()中的配置下,运行模拟器后,然后在Debug浮动调试窗口中选中Break中断调试(见下图),到要调试的代码区,按F9设置调试断点.

 

2.仿照()中的第4步进行调试.调试完毕后,按下列步骤调出断点列表:Edit->Breakpoints…,清除调试断点,然后停止调试(Stop Debugging),OS恢复正常运行!

 

:当模拟器选运行后,在菜单Target里面选中CE Target Control,或在右键浮动菜单里面选中Target Control就会出现左边的带”Win CE>”提示符的命令调试窗口,你可以键入如下命令进行调试.


break: Breaks into the debugger


s: Starts new process


gi ["proc","thrd","mod","all"]* [""] : Get Information

    proc->Lists all processes in the system

    thrd-> Lists all processes with their threads

    delta->Lists only threads that have changes in CPU times

    mod->Lists all modules loaded

    moduse->Lists module usage data

    system -> Lists processor architecture and OS version

    all->Lists all of the above


mi ["kernel","full"]: Memory information

    kernel->Lists kernel memory detail

    full->Lists full memory maps


zo ["p","m","h"] [index,name,handle] [,[["on","off"][]*]*: Zone Ops

    p/m/h->Selects whether you operate on a process, module, or hProcess/pModule

    index->Put the index of the proc/module, as printed by the gi command

    name->Put the name of the proc/module, as printed by the gi command

    handle->Put the value of the hProcess/pModule, as printed by the gi command

        ->If no args are specified, prints cur setting with the zone names

    zone->Must be a number to which this proc/modl zones are to be set

             Prefix by 0x if this is specified in hex

    on/off-> Specify bits to be turned on/off relative to the current zonemask

  eg. zo p 2: Prints zone names for the proc at index 2 in the proc list

  eg. zo h 8fe773a2: Prints zone names for the proc/module with hProcess/pModule of 8fe773a2

  eg. zo m 0 0x100: Sets zone for module at index 0 to 0x100

  eg. zo p 3 on 3 5 off 2: Sets bits 3&5 on, and bit 2 off for the proc[3]


win: Dumps the list of windows


log[user zone] [process zone] : Change CeLog zone settings


prof[data_type] [storage_type] : Start or stop kernel profiler


memtrack {on, off, baseline} : Turns memtrack on or off, or generates baseline


kp: Kills process


dd[size]: dumps dwords for specified process id


df: dumps address to file


hd: dumps the process heap


run: run file in batch mode


dis: Discard all discardable memory


options: Set options

     timestamp->Toggle timestamp on all cmds (useful for logs)

     priority[N]->Change the priority of the shell thread

     kernfault -> Fault even if NOFAULT specified

     kernnofault->Re-enable default NOFAULT handling


suspend: Suspend the device.  Requires GWES.exe and proper OAL support


loadext [[-u] DLLName] : Load shell.exe extension dll

    -u: unload extension dll

    DLLName: name of DLL to load (i.e. shellext.dll)


tp[prio]: Sets/queries thread priority

    tid: can be either a thread id, 'kitlintr' or 'kitltimer'

    prio: thread priority

           -1 or omitted : query current thread priority

           0 - 255: set thread priorit


 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

princewwj

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值