Module 6: Debugging a Windows CE Image

Slides:



Advertisements
Similar presentations
Introduction to Eclipse. Start Eclipse Click and then click Eclipse from the menu: Or open a shell and type eclipse after the prompt.
Advertisements

Device Drivers. Linux Device Drivers Linux supports three types of hardware device: character, block and network –character devices: R/W without buffering.
Lab7: Introduction to Arduino
BIM313 – Advanced Programming Techniques Debugging 1.
The IDE (Integrated Development Environment) provides a DEBUGGER for locating and correcting errors in program logic (logic errors not syntax errors) The.
Visual Basic Debugging Tools Appendix D 6/27/20151Dr. Monther Aldwairi.
OllyDbg Debuger.
1 Threads Chapter 4 Reading: 4.1,4.4, Process Characteristics l Unit of resource ownership - process is allocated: n a virtual address space to.
©2005 GE Fanuc Automation, Inc. All Rights Reserved PACSystems Training Programmer’s Toolkit.
MDK-ARM Microcontroller Development Kit MDK: Microcontroller Development Kit.
 2003 Prentice Hall, Inc. All rights reserved. 1 Chapter 19 - The Preprocessor Outline 19.1 Introduction 19.2 The #include Preprocessor Directive 19.3.
Silicon Labs ToolStick Development Platform
Joe Chen Sr. Manager, Insyde Software
The 6713 DSP Starter Kit (DSK) is a low-cost platform which lets customers evaluate and develop applications for the Texas Instruments C67X DSP family.
Main sponsor PicassoMonet + RembrandtMatejko + Canaletto How Debuggers Work Karl Rehmer Failures Come in Flavors Michael Nygard REST in Java Stefan Tilkov.
Using a Debugger. SWC What is ”debugging”? An error in a computer program is often called a ”bug”… …so, to ”debug” is to find and get rid of errors in.
Debugging Cluster Programs using symbolic debuggers.
Introduction Purpose This training course covers debugging an application on an SH target in the Renesas HEW (High-performance Embedded Workshop) development.
Practical Malware Analysis Ch 8: Debugging Rev
Debugging applications, using properties Jim Warren – COMPSCI 280 S Enterprise Software Development.
PROGRAMMING IN VISUAL BASIC.NET VISUAL BASIC BUILDING BLOCKS Bilal Munir Mughal 1 Chapter-5.
Part 3: Advanced Dynamic Analysis Chapter 8: Debugging.
Instructor Notes GPU debugging is still immature, but being improved daily. You should definitely check to see the latest options available before giving.
Debugging in Java. Common Bugs Compilation or syntactical errors are the first that you will encounter and the easiest to debug They are usually the result.
UBI >> Contents Chapter 2 Software Development tools Code Composer Essentials v3: Code Debugging Texas Instruments Incorporated University of Beira Interior.
Module 6: Debugging a Windows CE Image.  Overview Debug Zones IDE Debug Setup IDE Debug Commands Platform Builder Integrated Kernel Debugger Other Debugging.
NT Kernel CS Spring Overview Interrupts and Exceptions: Trap Handler Interrupt Request Levels and IRT DPC’s, and APC’s System Service Dispatching.
A Tutorial on Introduction to gdb By Sasanka Madiraju Graduate Assistant Center for Computation and Technology.
Allegro CL Certification Program Lisp Programming Series Level I Session Basic Lisp Development in the IDE.
 2003 Prentice Hall, Inc. All rights reserved. 1 IS 0020 Program Design and Software Tools Preprocessing Lecture 12 April 7, 2005.
Dynamic Link Libraries: Inside Out. Dynamic Link Libraries  About Dynamic-Link Libraries  Dynamic-Link Libraries Hands On  Dynamic Link Library Reference.
Writing a Run Time DLL The application loads the DLL using LoadLibrary() or LoadLibraryEx(). The standard search sequence is used by the operating system.
Bit-DSP-MicrocontrollerTMS320F2812 Texas Instruments Incorporated European Customer Training Center University of Applied Sciences Zwickau (FH)
Centric features In this presentation… –macro capabilities more sophisticated functionality –advanced macro features Inspector Debugging error trapping.
Thread Implementations; MUTEX Reference on thread implementation –text: Tanenbaum ch. 2.2 Reference on mutual exclusion (MUTEX) –text: Tanenbaum ch
 2003 Prentice Hall, Inc. All rights reserved. 1 IS 0020 Program Design and Software Tools Preprocessor Midterm Review Lecture 7 Feb 17, 2004.
Compiler Directives. The C Preprocessor u The C preprocessor (cpp) changes your source code based on instructions, or preprocessor directives, embedded.
The Preprocessor Directives Introduction Preprocessing – Occurs before program compiled Inclusion of external files Definition of symbolic constants.
1 Object-Oriented Programming -- Using C++ Andres, Wen-Yuan Liao Department of Computer Science and Engineering De Lin Institute of Technology
15 Copyright © 2004, Oracle. All rights reserved. Debugging Triggers.
© 2008, Renesas Technology America, Inc., All Rights Reserved 1 Introduction Purpose  This training course demonstrates the Project Generator function.
COMPUTER PROGRAMMING I SUMMER Understand Different Types of Programming Errors.
Debugging Lab Antonio Gómez-Iglesias Texas Advanced Computing Center.
Some of the utilities associated with the development of programs. These program development tools allow users to write and construct programs that the.
A variable is a name for a value stored in memory.
5.01 Understand Different Types of Programming Errors
Programming and Debugging with the Dragon and JTAG
How to debug an application
CS4101 Introduction to Embedded Systems Lab 1: MSP430 LaunchPad IDE
Crash Dump Analysis - Santosh Kumar Singh.
Debugging with gdb gdb is the GNU debugger on our CS machines.
Unix Process Management
Debugging CMSC 202.
LESSON 20.
PRU-ICSS Programming with CCS
Malware Incident Response  Dynamic Analysis - 2
C Basics.
Using Visual Studio with C#
Important terms Black-box testing White-box testing Regression testing
Important terms Black-box testing White-box testing Regression testing
5.01 Understand Different Types of Programming Errors
C Preprocessor(CPP).
Thread Implementations; MUTEX
ECE 3567 Microcontroller Lab
When your program crashes
Homework Any Questions?.
Software Setup & Validation
Thread Implementations; MUTEX
C Preprocessor Seema Chandak.
Code Composer Essentials 3.0
Presentation transcript:

Module 6: Debugging a Windows CE Image

Overview Debug Zones IDE Debug Setup IDE Debug Commands Platform Builder Integrated Kernel Debugger Other Debugging Techniques

Debug Zones What Are Debug Zones? Defining Debug Zones Declaring Debug Zones Registering Debug Zones Using Debug Zones

What Are Debug Zones? Provide debug information without halting the system Allow you to control the output of debug messages Debug zone = Name + Output status (On/Off) 16 debug zones per module Must be registered with the debug subsystem to dynamically change the output status of debug zones. Use macros to output debug messages

Defining Debug Zones // Define Ids for each zone (1->15) #define ZONEID_INIT 0 #define ZONEID_SECOND 1 . . . #define ZONEID_ERROR 15 // Define masks for each zone (16-bit mask) #define ZONEMASK_INIT (1<<ZONEID_INIT) #define ZONEMASK_SECOND (1<<ZONEID_SECOND) #define ZONEMASK_ERROR (1<<ZONEID_ERROR)

Defining Debug Zones (continued) #ifdef DEBUG // These constants are used as the first arg to MACROS #define ZONE_INIT DEBUGZONE(ZONEID_INIT) #define ZONE_SECOND DEBUGZONE(ZONEID_SECOND) . . . #define ZONE_ERROR DEBUGZONE(ZONEID_ERROR) #else // Disable all output when compiled in release. #define ZONE_INIT 0 #define ZONE_SECOND 0 #define ZONE_ERROR 0 #endif

Declaring Debug Zones Include DbgApi.h header file in your source code Declare a DBGPARAM structure that contains: Your module name A name for each debug zone An initial mask for the output status of all debug zones DBGPARAM structure must be called dpCurSettings dpCurSettings must be a global variable in your module

Declaring Debug Zones (continued) #ifdef DEBUG // Init DBGPARAM structure DBGPARAM dpCurSettings = { TEXT(”TestDebugZones"), TEXT("Init"), TEXT(”Second"), . . . TEXT("Error") }, // As a default, turn on init & error debug zones. ZONEMASK_INIT | ZONEMASK_ERROR }; #endif

Registering Debug Zones The DEBUGREGISTER(param) macro registers the dpCurSettings structure with the debug subsystem Override zone mask with a REG_DWORD value in HKCU\Pegasus\zones\module_name DllMain(...) { switch(ulReason) { case DLL_PROCESS_ATTACH: DEBUGREGISTER(hMod); break; . . .

Using Debug Zones Send debug messages through macros First parameter is a condition. The message is issued when condition is TRUE. Usually condition is a zone (ZONE_zonename ) Can also be an expression Second parameter is a Unicode string representing the message Retail and Debug macros

Using Debug Zones (continued) DEBUGMSG(cond,msg), RETAILMSG(cond,msg) Conditionally output message DEBUGLED(cond,word), RETAILLED(cond,word) Conditionally output word to LEDs ERRORMSG(cond,msg) Conditionally output ERROR + file + line + msg DEBUGCHK(expr) Issue a DebugBreak if the expr evaluates to FALSE

Using Debug Zones (continued) DEBUGMSG (ZONE_INIT, (TEXT (”TestDebugZones starting 1\n"))); RETAILMSG(1, (TEXT (” TestDebugZones starting 2\n"))); hThread = CreateThread (…PeriodicThread…) if (NULL == hThread) { ERRORMSG (1, (TEXT (”GetLastError: %u\n"), GetLastError() )); return (1); } DWORD PeriodicThread(LPVOID pUnused) int i = 0; while (1) { DEBUGMSG(ZONE_SECOND,(TEXT(”Seconds: %d\n"), i)); Sleep(1000); . . .

IDE Debug Setup Platform Settings Service Settings Enabling Kernel Debugging Environment Variables

Platform Settings

Service Settings

Enable Kernel Debugging

Environment Variables

IDE Debug Commands Target Menu Target | Advanced Commands (CESH)… Running Commands : An Alternate Method Processes Threads Modules and Symbols Setting Exception Handling Debug Zones

Target Menu

Target | Advanced Commands (CESH)…

Target | Run Program…

Target | Processes

Target | Threads

Target | Modules and Symbols

Target | Exceptions

Target | Debug Zones…

Platform Builder Integrated Kernel Debugger About the Kernel Debugger Starting the Debugger Setting a Breakpoint Handling Exceptions Debugger Windows

About the Kernel Debugger Requires a special OS version Remains active after the application being debugged stops Application remains active after stopping the debugger Can debug modules loaded by XIP applications

Starting the Debugger Create a Debug Image of the Operating System Download the debug image to the device Start the Debugger Target | Start | Debugger Check the Debugger Status Target | Status Monitor

Setting a Breakpoint Symbols must be loaded first Breakpoints can be set before starting the OS image Windows CE OS must be halted to set breakpoints after the OS has started Debug| Break DebugBreak Win32 API Open the source file Put breakpoints in the source code, assembly code, and call-stack window

Handling Exceptions When exception occurs, you can choose to: Stop always Stop if not handled If the debugger is stopped in order to debug an exception, you can choose: Go handled - the kernel again executes the instruction that caused the exception. Go not handled - the kernel tries to find a handler of the exception. If one is not found, it then tries to handle the exception, and if unsuccessful, terminates the thread that caused the exception.

Debugger Windows Source Code and Disassembly windows Watch window Variables window Call Stack and Registers windows Advanced Memory Dialog Box

Debugger Windows: Source Code and Disassembly

Debugger Windows: Watch

Debugger Windows: Variables

Debugger Windows: Call Stack and Registers

Debugger Windows: Advanced Memory

Other Debugging Techniques Why Use Alternate Methods? Logic Analyzer Debug LEDs

Why Use Alternate Methods? Some devices need quick response from the system and cannot allow even a slight delay during processing Debug messages affect timing issues The kernel debugger needs the system to be in break mode There are less intrusive methods for solving timing issues when debugging Logic analyzer LEDs

Logic Analyzer Records probes’ activities simultaneously Supports sophisticated reports and graphs Useful for debugging bus/timing problems Requires hardware attach points LA Connector Probe points Specialized bus analyzer for ISA, PCI, etc.

Debug LEDs You must code OEMWriteDebugLed function to enable Debug LEDs routines LEDs activities can be monitored and decoded later Less intrusive than debug messages Use DEBUGLED and RETAILLED macros Can be used for measuring ISR latency

Lab A: Debugging a Windows CE Image

Review Debug Zones IDE Debug Setup IDE Debug Commands Platform Builder Integrated Kernel Debugger Other Debugging Techniques