10.07.2015 Views

emScript & Debugging - Motorola Solutions Launchpad

emScript & Debugging - Motorola Solutions Launchpad

emScript & Debugging - Motorola Solutions Launchpad

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>emScript</strong> & <strong>Debugging</strong>Paul HurfordPaul.Hurford@<strong>Motorola</strong><strong>Solutions</strong>.com


<strong>Motorola</strong> Debug Tools• RT Logs (Start->Debug)• Retail Logs – system driver logs• RIL Logs• Phone/WAN debug log• eMScript• Logging tool – ‘black box’ recorder• Will be preloaded in future OS builds


RT Logs• OS System driver debug• Can be very useful for identifying issues• Suggest RT log collected every warm boot• Your application can write to RT log• Write to standard Error (stderr defined as 2)• fwprintf( stderr, TEXT(“To RTLog: %s"), szError );• Applications• RTLogManger.exe – Allows changing of parameters• RTLogExport.exe – Creates RT log file \ExportLogs\Logs\• Only stores last RT log, each file has unique name.


RIL Logs• Radio Interface Layer log• Enable if you suspect phone/WAN issues• Need to be sent to support desk – raisesupport case first! – Very important• Very little for application developers to look atin logs


eMScript and the ResourceMonitor• eMScript is an executable (.EXE) that interprets textbased script files into execution code on the device.• Install via a CAB file• Resource Monitor is a script (.mot) file that containscustom data collection logic, settings and calls toother tools− CeSnapshot - graphical memory viewing tool and API− PushPullClient - external tool used to push logs up toan FTP server


Resource Monitor Basics:OutputsWhen run, the script creates the following logs1. Resource_(ESN).csv – High level timeline summary ofcustomized resource usage.2. Snapshot data – detailed process and memory info in binary formLegacy formats are also created:a)PROCLIST-XXXX.txt.gz – Detailed process usage information in text format.b)SNPxxx.mbs.gz – Device memory map.•c) RTLog.txt and RTLog.bak.txt – Retail logs• 4. Remote Logs – Automated storage of files and folders on aFTP server organized on a per device basis (every 2 hours)


Resource.csv (time line data)• Resource.csv contains a series of snapsof the most common resources• Time stamps and correlation to report issue– Locate times where problem was reported, then look at column datafor items of interest (more on this later)• Event column (last column) provide more detailed info– Boot count/type, suspend reason, in/out of cradle, etc.– Creation of detailed dumps are reported in event column– Multiple events occurring at the same time are text delimited


Snapshot Data - Memory Viewing(CeSnapshot)CeSnapshot is a Memory/Process capture and viewing tool• Client version produces .mbs files which are binary dumps ofmemory and process information• eMScript exposes the client API and is called by the ResourceMonitor• Desktop version converts .mbs into a graphical memory viewand detailed text for the process information• Expands the legacy DLL crunch tool by showing all virtual memoryslots (not just the first 32)• Allows for visual mapping of all DLLs to memory and insight intoMicrosoft improvements• Used for memory leaks and locating memory commits


Memory dump• Memory dump shows running processslot (1 st 32 slots)


Process SnapshotSnapshot shows process, dlls, threads, heaps:


Uses of the data• Although the resource monitor is mainly forissue fault finding other uses include• Device profiling or trending (excel)• i.e. Battery Life• Geo tagging (google maps)• Custom data reporting or hooks into other tools• Other uses that would normally require advancedprogramming knowledge• Please limit script use to diagnostics or readonly functionality• eMScript is not intended to be a replacement forcustomer debug but as an aid


Example Use : Profiling Graphs• Since timeline data is CSV, graphs are quick and easy• In Excel, just highlight column and insert chart via menuoptions• Detailed Process log at end of timeline shows whichprocess leakedBattery Current (mA)80060040020000 500 1000 1500 2000-200-400-600-8001000000009000000080000000700000006000000050000000400000003000000020000000100000000Memory Availiable0 500 1000 1500 2000


Example Use: Geo-Tagging<strong>Motorola</strong> has a tool toconvert .csv data into KMLwhich can be used for helpGPS reportsWith minor tailoring anyresource.csv data in thetime line can easy be geotagged


Common things to look forWhat to look for is very problem specific the following are most commonindicators of root cause• Abnormal resource (CPU, memory, battery, etc.) usage• Detailed logs help point out if it is a user or system process• Foreground window and process• Gives insight on what the user was doing/seeing• Events• Gives insight on actions surrounding the issue• Also points to what detailed dumps to look at• Gaps in time stamps• Points to device suspended or more advanced tools needed• If no gaps then tool is running even if user think it locked up• Network settings and radio states• Gives indication if the radios are working• Detailed logs help to isolate what process is failing• Detailed logs are mainly used for CPU and memory drill down for eachprocess• Very helpful in pointing out non <strong>Motorola</strong> issues


Dr. Watson Dump FilesDr. Watson dump files are created whenthere is a system crash in Windows MobileBy default Displays notification seen onrightCreates detailed dump fileCan be triggered intentionally for debugpurposes with the APICaptureDumpFileOnDevice()


System Shimming toolsShimming is an undocumentedfeature that allows you to interceptAPI callsSystem loader will load custom“shim” DLL in place of targetmoduleUse with caution as this caneasily spoof advanced behaviorShimmed APICallsRegistryFileSystemApplicationCustom (shim) DllCoreDLLKernelOther Dlls


Thank you for yourtime and attentionQuestions

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!