用windows ce error reporting来发现和修正错误
DESCRIPTION
用Windows CE Error Reporting来发现和修正错误. 刘斌 北京数智动力科技有限公司. 议程. Window Error Reporting (WER) 简介 WER 基础架构 在平台中增加 WER 支持 查看 WER 数据 怎样从微软得到 WER 数据 分析与解决崩溃问题. 简介 概念 ?. Windows CE/Mobile Error Reporting a.k.a Watson, Dr. Watson, WER, Error Reporting Windows CE/Mobile 5.0 新特性 - PowerPoint PPT PresentationTRANSCRIPT
用 Windows CE Error Reporting 来发现和修正错误
刘斌北京数智动力科技有限公司
议程• Window Error Reporting (WER) 简介• WER 基础架构• 在平台中增加 WER 支持• 查看 WER 数据• 怎样从微软得到 WER 数据 • 分析与解决崩溃问题
简介概念 ?
• Windows CE/Mobile Error Reporting a.k.a Watson, Dr. Watson, WER, Error Reporting
• Windows CE/Mobile 5.0 新特性• WER 客户端上载 crash data 到微软服务器• 捕获 System 和 Application 层崩溃• 微软使用 WER 数据识别与解决问题• 与 OEMs 和 ISVs 共享 WER 数据• 解决问题,提升产品质量
简介有何益处 ?
• 从用户报告的产品问题中得到有效的数据• 得到问题的频率和数量• 根据 crash data 分析问题 • 根据报告数量决定 Bug 的优先级• 为客户提供优秀的产品
简介错误优先级
关注关键问题关注关键问题
Unique Problems (Buckets)Unique Problems (Buckets)
• 数量• 严重性
简介隐私• 用户决定是否上载
– 用户可以查看上载的内容• 所有数据将保存在微软管理的安全数据库中• 符合 Federal Trade Commission's Safe
Harbor Agreement and EU laws• 目的是修改缺陷,而非跟踪用户
简介过程
基础架构设计
Unhandled 2nd chance exception
Kernel
Exception HandlerDebug
Stub
Persistent Memory
Write Dump File
SchedulerSignal Transfer.dll
to run
Error
File System
Consent UI
Upload Protocol
MS Watson Server
Continue
Requires reset
Kernel Exception
App Exception
Feedback(optional)
Send
Dw.exe process
Core Logic
Error Report Details - text
viewer
Device.exe
Transfer.dll
Read Dump File
Write
Move capture from persistent memory to file
systemLaunches
Run
DW Control PanelRegistry
Set Options
Read Options
Read Options
Write Options
基础架构组件• 核心组件
– Hd.dll– Osaxst0.dll
• 驱动程序组件– Dwxfer.dll– Dwui.dll
• 客户端程序– Dw.exe
• 预估大小 = 110KB (ARM)
基础架构捕获• 未处理的异常• 捕获的三种类型
• Standard MS minidump format– Context (4-64KB)– System (64KB-several MB)– Complete (all physical mem + 64KB)
• 使用哪种方法依赖于 OEM 分配的专有内存– 推荐 300KB RAM
基础架构界面 – e.g. Pocket PC
基础架构Headless Devices
• 便于配置– 移除界面组件– 在注册表中设置 NoConsentRequired
• Headless 是指没有提示用户的界面– 隐私问题 ?
• Some devices don’t have privacy issues• If so, opt-in is not an issue
– WER 要求用户同意隐私条款• Add the privacy policy to the User license
– EULA– Shrink wrap license agreement
• On host computer configuration
基础架构数据上载• Minidumps 为压缩格式• 使用 HTTPS 连接上载
– 可配置• 直接使用 internet 连接• 通过 Active Sync 连接
• 如果连接成功 – 文件将被删除
• 如果连接不成功– 当有建立新的连接时将重试
• Asynchronous – as connections happen
基础架构Bucketing parameters
• Bucketing parameters 为– 应用程序名称 , 版本 , 时间 – 模块名称 , 版本 , 时间 – 模块中的偏移 – 所有者应用程序的名称 , 版本 , 时间
• crash dumps 的分组为 buckets• 相似的崩溃问题生成相同的 bucket• After collecting so many just
increment counters
为应用程序集成 WER通过程序捕获BOOL CaptureDumpFileOnDevice(
DWORD dwProcessId, DWORD dwThreadId, LPCWSTR pwzExtraFilesPath
); dwProcessId, dwThreadId
0 = current Otherwise, provide the Id
pwzExtraFilesPathOptionalUnique folder name (ownership changes)
Returns TRUE = successfulFALSE = failure, check GetLastError()
为应用程序集成 WER 异常处理• 处理的异常不引发捕获• 在异常 Filter 中生成 dump 文件
EFaultRepRetVal ReportFault( LPEXCEPTION_POINTERS pep, DWORD dwOpt
); • pep – Pointer to an EXCEPTION_POINTER structure• dwOpt – Reserved and should be zero• Returns
– frrvErrNoDW – on error– fvvrOk – successful capture
为应用程序集成 WER异常处理例程__try { FunctionThatGeneratesAnException(); }__except(ReportFault(GetExceptionInformation(),0),
EXCEPTION_EXECUTE_HANDLER) { SomeHandlerFunction(); }
在平台中增加 WER 功能• 使用 PB 建立新平台
– 在平台向导中增加 WER 功能• 使用 PB 修改已有平台
– 从 Catalog 中增加 WER 功能• 使用命令行
– Define the SYSGENs • 分配捕获用专有内存
在平台中增加 WER 功能平台向导• Windows CE Error Reporting ( checkbox )
– 选择所有组件• Exception Report Generator• Error Report Transfer Driver• Error Report Control Panel• Report Upload Client
– Default is Client Without User Interface
• 分配专有内存 • Build 平台
在平台中增加 WER 功能Catalog
• CoreOS\Windows CE Devices 下– 增加 Windows CE Error Reporting 组件到平台中
• Exception Report Generator• Error Report Transfer Driver• Error Report Control Panel• Report Upload Client
– Report Client User Interface
• 分配专有内存• Build 平台
在平台中增加 WER 功能命令行• 定义环境变量 SYSGENs
– SYSGEN_WATSON_DMPGEN – SYSGEN_WATSON_XFER – SYSGEN_WATSON_CTPNL – SYSGEN_WATSON_CLIENT – SYSGEN_WATSON_CLIENT_UI
• 分配专有内存• Build 平台
在平台中增加 WER 功能专有内存• 分配专有内存
– 在 RAM 中 ( 默认 )• Does not persist across cold boots• Set dwNKDrWatsonSize variable in OEMInit()• e.g. for 300 KB dwNKDrWatsonSize = (300 * 1024);
– 在 OEM 指定的存储空间中• Set dwNKDrWatsonSize variable in OEMInit()• OEM must provide the following routines
– RAMDrWatsonFlush(void)– RAMDrWatsonClear(void)– RAMDrWatsonRead(DWORD dwOffset, LPVOID pData, DWORD cbSize)– RAMDrWatsonWrite(DWORD dwOffset, LPVOID pData, DWORD cbSize)
配置 设备的注册表[HKEY_LOCAL_MACHINE\System\ErrorReporting\DumpSettings]"MaxLogFiles"=dword:00000064"MaxDiskUsage"=dword:000e1000"UploadClient"="\\windows\\Dw.exe""ExtraFilesDirectory"="\\windows\\ExtraDumpFiles""CabDirectory"="\\Windows\\System\\DumpFiles\\CabFiles""DumpDirectory"="\\Windows\\System\\DumpFiles""DumpEnabled"=dword:00000001 [HKEY_LOCAL_MACHINE\System\ErrorReporting\UploadSettings]"ManifestConsent"=dword:00000001"UploadFailedDlg"=dword:00000000"UploadSucceededDlg"=dword:00000000"MaxDailyReports"=dword:00000000"MaxWeeklyReports"=dword:00000000"DontUpload"=dword:00000000"NoConsentRequired"=dword:00000000
分析 WER 数据基于设备• 失去 bucketing 参数的优势• Dumps 存储在设备上• 配置为不上载• 从设备上移出 WER 数据• 创建自己的客户程序
分析 WER 数据通过 WinQual
• WinQual – Windows Quality Online– http://winqual.microsoft.com – Part of the Windows Logo Program website
• You do not have to have a logo– 条件
• Code Signing VerisignID Certificate• Sign Term of Use agreement (TOU)• File mapping
– 要求反馈• Close the loop with customers
分析 WER 数据Debugging
• Platform Builder Kernel Debugger– Postmortem debugger missed Windows CE 5.0
• Power tools– UIDumpView.exe– http://download.microsoft.com/download/7/8/4/784bf4d
2-2a21-416f-b495-1fd0f2340e3b/UIDumpViewer.exe• Matching binaries and sources are required
– WinQual– Microsoft Symbol server
Debugging The crash
总结 • 容易增加 WER• 可以通过 WinQual 直接存取数据• 便于发现崩溃问题• 创造成功产品
Tools & Resources
msdn.microsoft.com/msdn.microsoft.com/ embeddedembedded
microsoft.public.microsoft.public. windowsxp.embeddedwindowsxp.embedded windowsce.platbuilderwindowsce.platbuilder windowsce.embedded.vcwindowsce.embedded.vc
blogs.msdn.com/blogs.msdn.com/ mikehallmikehall
Windows CE 5.0 Eval KitWindows CE 5.0 Eval KitWindows XP Embedded Eval KitWindows XP Embedded Eval Kit
msdn.microsoft.com/msdn.microsoft.com/ mobilitymobility
microsoft.public.microsoft.public. pocketpc.developer pocketpc.developer smartphone.developer smartphone.developer dotnet.framework.compactframeworkdotnet.framework.compactframework
blogs.msdn.com/blogs.msdn.com/ windowsmobilewindowsmobile vsdteamvsdteam netcfteamnetcfteam
Windows Mobile 5.0 Eval KitWindows Mobile 5.0 Eval Kit
WebsitesWebsites
NewsgroupsNewsgroups
BlogsBlogs
ToolsTools
BuildBuild DevelopDevelop
请在课程结束后填写课程培训反馈表,参加抽奖。请填写资料袋内的蓝色大会满意度反馈表,到大会接待台领取《 Windows Mobile手机应用开发》工具书。您还可以:参加 Windows Mobile 动手实验室;参观微软及合作伙伴展区;体验基于 Windows Mobile 平台开发的最新硬件产品及解决方案。
大会注意事项