Debugging Optimized Code - PowerPoint PPT Presentation

About This Presentation
Title:

Debugging Optimized Code

Description:

Un-optimized code has a correlation ... By Ali-Reza Adl-Tabatabai and Thomas Gross. Identifies data-value problems ... Actual value = value stored in register ... – PowerPoint PPT presentation

Number of Views:23
Avg rating:3.0/5.0
Slides: 15
Provided by: steveno152
Learn more at: http://www.cs.cmu.edu
Category:

less

Transcript and Presenter's Notes

Title: Debugging Optimized Code


1
Debugging Optimized Code
  • Steven Osman

2
Debugging Optimized Code is Hard
  • Un-optimized code has a correlation between
    source and object code
  • Optimizing compilers rearrange, add and remove
    code. This results in
  • Code location problems
  • Data value problems

3
Talk Overview
  • Understanding the problems
  • Introducing Source-Level Debugging of Scalar
    Optimized Code
  • Classifying data-value problems
  • Identifying data-value problems
  • Whats next?

4
The Code Location Problem
Source S1 y0 S2 abc S3 x2 S4 yz3 Optimized Assembly I1 ld r1, b ltS2gt I2 ld r2, c ltS2gt I3 ld r5, z ltS4gt I4 mul r6, r5, 3 ltS4gt I5 mov r4, 2 ltS3gt I6 add r3, r1, r2 ltS2gt
We want a breakpoint at S2
5
The Data-Value Problem
Source S1 y0 S2 abc S3 x2 S4 yz3 Optimized Assembly I1 ld r1, b ltS2gt I2 ld r2, c ltS2gt I3 ld r5, z ltS4gt I4 mul r6, r5, 3 ltS4gt I5 mov r4, 2 ltS3gt I6 add r3, r1, r2 ltS2gt
What is the value of y at S2?
6
Source-Level Debugging of Scalar Optimized Code
  • By Ali-Reza Adl-Tabatabai and Thomas Gross
  • Identifies data-value problems
  • No changes to the optimized code
  • Uses knowledge of optimizations

7
Some Simple Terminology
  • Expected value value a variable should have
  • Actual value value stored in register
  • Current Actual value IS expected value (true
    for all in unoptimzed code)
  • Endangered Not current
  • Noncurrent Actual IS NOT expected
  • Suspect Actual may be expected

8
Code Hoisting
E0 xu-v
E1 xyz
Bkpt1
Bkpt2 E2 xyz Bkpt3
9
Code Hoisting
E0 xu-v
E1 xyz
E3 xyz Bkpt1
Bkpt2 E2 xyz Bkpt3
E2RedCopy(E3)
10
Hoist Reaches
E0 xu-v
E1 xyz
E3 xyz Bkpt1
Bkpt2 E2 xyz Bkpt3
E2RedCopy(E3)
11
Dead Code Elimination
E0 xyz Bkpt1
Bkpt3 E1 x Bkpt4
Bkpt2
Bkpt5 E2 xu-v Bkpt6
12
Dead Code Elimination
E0 xyz Bkpt1
Bkpt3 E3 xyz E1 x Bkpt4
Bkpt2
Bkpt5 E2 xu-v Bkpt6
13
Dead Reaching
E0 xyz Bkpt1
Bkpt3 E3 xyz E1 x Bkpt4
Bkpt2
Bkpt5 E2 xu-v Bkpt6
14
Whats Next?
  • Good paper, but it only warns programmer
  • Suggestions about how to get the expected value
  • Alok Ladsariyas talk
Write a Comment
User Comments (0)
About PowerShow.com