innovative software tools & methods to profile, test and ... · need for code coverage...

18
presented by Innovative Software Tools & Methods to Profile, Test and Optimize UEFI Firmware Improving Test Coverage and Debug Results UEFI US Fall Plugfest – September 20 - 22, 2016 Presented by Kevin Davis (Insyde Software) Updated 2011-06-01

Upload: others

Post on 15-Jul-2020

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Innovative Software Tools & Methods to Profile, Test and ... · Need for Code Coverage •Validate that all code is being tested –If code isn’t being tested during validation,

presented by

Innovative Software Tools & Methods to Profile, Test and Optimize UEFI Firmware

Improving Test Coverage and Debug Results

UEFI US Fall Plugfest – September 20 - 22, 2016Presented by Kevin Davis (Insyde Software)

Updated 2011-06-01

Page 2: Innovative Software Tools & Methods to Profile, Test and ... · Need for Code Coverage •Validate that all code is being tested –If code isn’t being tested during validation,

Agenda

• Introduction

• Intel Processor Trace Buffer

• Driver Profiling

• Code Coverage Display

• Questions?

UEFI Plugfest – September 2016 www.uefi.org 2

Page 3: Innovative Software Tools & Methods to Profile, Test and ... · Need for Code Coverage •Validate that all code is being tested –If code isn’t being tested during validation,

Debug Models

• Hardware Level Debuggers

– Physical Access to board required

– Complexity of connection to board

– No or minor impact to software execution

• Software Level Debuggers

– No need to have physical access to the board

– Some impact to software execution

– Complexity of sharing a processor

UEFI Plugfest – September 2016 www.uefi.org 3

Page 4: Innovative Software Tools & Methods to Profile, Test and ... · Need for Code Coverage •Validate that all code is being tested –If code isn’t being tested during validation,

Define Software Terms

• Host Machine – runs the User Interface of the Software Debugger to the engineer

• Target Platform – runs the BIOS interface of the Software Debugger

UEFI Plugfest – September 2016 www.uefi.org 4

Page 5: Innovative Software Tools & Methods to Profile, Test and ... · Need for Code Coverage •Validate that all code is being tested –If code isn’t being tested during validation,

Innovation of Branch Tracing

• Previously to trace, SW debuggers broke on either each instruction or at branches– On each break:

• Transmit data to host or store locally• Check various debug control conditions• Restart next instruction

– Very slow execution

• Now with Branch Tracing– SW debugger stops on a condition– Unwinds execution trace to previous IP or size of the

Trace buffer– Target code executes much faster

UEFI Plugfest – September 2016 www.uefi.org 5

Page 6: Innovative Software Tools & Methods to Profile, Test and ... · Need for Code Coverage •Validate that all code is being tested –If code isn’t being tested during validation,

Branch Records

UEFI Plugfest – September 2016 www.uefi.org 6

32-bit Branch Trace Record Format

64-bit Branch Trace Record Format

Page 7: Innovative Software Tools & Methods to Profile, Test and ... · Need for Code Coverage •Validate that all code is being tested –If code isn’t being tested during validation,

Solving new problems

• More features can be created in a software debugger –Unravel call trees

–Highlight areas called by Oss

– Find long hardware I/O loops

– Figure out where a crash started

– Test sequence code coverage

–Profile specific drivers

UEFI Plugfest – September 2016 www.uefi.org 7

Page 8: Innovative Software Tools & Methods to Profile, Test and ... · Need for Code Coverage •Validate that all code is being tested –If code isn’t being tested during validation,

Profiling Drivers

UEFI Plugfest – September 2016 www.uefi.org 8

Page 9: Innovative Software Tools & Methods to Profile, Test and ... · Need for Code Coverage •Validate that all code is being tested –If code isn’t being tested during validation,

Steps to profile a driver

UEFI Plugfest – September 2016 www.uefi.org 9

Setup Profiling buffer size from Project Setting dialog

Update debug engine to support Profiling

Update to Bios Debugger Log Analysis

Enable/Disable Profiling from Profiling menu

Build bios withnon-optimized and generating debug info

Select Profiling Analyzer from Profiling menu to start profiling analysis

The reports will be displayed on Report view after completion

Page 10: Innovative Software Tools & Methods to Profile, Test and ... · Need for Code Coverage •Validate that all code is being tested –If code isn’t being tested during validation,

Setup Trace Buffer sizes

UEFI Plugfest – September 2016 www.uefi.org 10

Page 11: Innovative Software Tools & Methods to Profile, Test and ... · Need for Code Coverage •Validate that all code is being tested –If code isn’t being tested during validation,

Profiling Execution Flow Example

UEFI Plugfest – September 2016 www.uefi.org 11

Executed code colored in green

Execution path

displayed in

tree view

Page 12: Innovative Software Tools & Methods to Profile, Test and ... · Need for Code Coverage •Validate that all code is being tested –If code isn’t being tested during validation,

Code Coverage

UEFI Plugfest – September 2016 www.uefi.org 12

Page 13: Innovative Software Tools & Methods to Profile, Test and ... · Need for Code Coverage •Validate that all code is being tested –If code isn’t being tested during validation,

Need for Code Coverage

• Validate that all code is being tested

– If code isn’t being tested during validation, code path is either:

• Unnecessary – remove it!

• Not being tested – probably buggy, might cause problems in the field

– Fix the test & test the code

UEFI Plugfest – September 2016 www.uefi.org 13

Page 14: Innovative Software Tools & Methods to Profile, Test and ... · Need for Code Coverage •Validate that all code is being tested –If code isn’t being tested during validation,

Code Coverage Example

UEFI Plugfest – September 2016 www.uefi.org 14

Executed

Not executed

undeterminedCoverage information by module/driver

Summary of functions in a module/driver

Page 15: Innovative Software Tools & Methods to Profile, Test and ... · Need for Code Coverage •Validate that all code is being tested –If code isn’t being tested during validation,

Call to action

• Contact your Debugger vendor

–Ask about their support for tracing code execution

• Profile your drivers to understand their execution flow

• Verify that your code is executed during your testing

UEFI Plugfest – September 2016 www.uefi.org 15

Page 16: Innovative Software Tools & Methods to Profile, Test and ... · Need for Code Coverage •Validate that all code is being tested –If code isn’t being tested during validation,

Thanks for attending the UEFI US Fall Plugfest 2016

For more information on the Unified EFI Forum and UEFI Specifications, visit http://www.uefi.org

presented by

UEFI Plugfest – September 2016 www.uefi.org 16

Page 17: Innovative Software Tools & Methods to Profile, Test and ... · Need for Code Coverage •Validate that all code is being tested –If code isn’t being tested during validation,

References Pointers to more information

Backup

UEFI Plugfest – September 2016 www.uefi.org 17

Page 18: Innovative Software Tools & Methods to Profile, Test and ... · Need for Code Coverage •Validate that all code is being tested –If code isn’t being tested during validation,

References

• Material heavily borrowed from:– Intel 64, ia, 32 Architectures Software Developer

Manual #325462

– Insyde Software DDT Developer Manual

• Pointer– http://www.intel.com/content/www/us/en/proce

ssors/architectures-software-developer-manuals.html

– https://www.insyde.com/products/developertools

UEFI Plugfest – September 2016 www.uefi.org 18