Download presentation

Presentation is loading. Please wait.

Published byHanna Goodier Modified over 2 years ago

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 What ’ s next?

4
The Code Location Problem Source S1: y=0; S2: a=b+c; S3: x=2; S4: y=z*3; Optimized Assembly I1: ld r1, b I2: ld r2, c I3: ld r5, z I4: mul r6, r5, 3 I5: mov r4, 2 I6: add r3, r1, r2 We want a breakpoint at S2

5
The Data-Value Problem Source S1: y=0; S2: a=b+c; S3: x=2; S4: y=z*3; Optimized Assembly I1: ld r1, b I2: ld r2, c I3: ld r5, z I4: mul r6, r5, 3 I5: mov r4, 2 I6: add r3, r1, r2 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 E 0 : x=u-v E 1 : x=y+zBkpt1 Bkpt2 E 2 : x=y+z Bkpt3

9
Code Hoisting E 0 : x=u-v E 1 : x=y+zE 3 : x=y+z Bkpt1 Bkpt2 E 2 : x=y+z Bkpt3 E 2 =RedCopy(E 3 )

10
Hoist Reaches E 0 : x=u-v E 1 : x=y+zE 3 : x=y+z Bkpt1 Bkpt2 E 2 : x=y+z Bkpt3 E 2 =RedCopy(E 3 )

11
Dead Code Elimination E 0 : x=y+z Bkpt1 Bkpt2 Bkpt3 E 1 : …=x Bkpt4 Bkpt5 E 2 : x=u-v Bkpt6

12
Dead Code Elimination E 0 : x=y+z Bkpt1 Bkpt2 Bkpt3 E 3 : x=y+z E 1 : …=x Bkpt4 Bkpt5 E 2 : x=u-v Bkpt6

13
E 0 : x=y+z Bkpt1 Bkpt2 Bkpt3 E 3 : x=y+z E 1 : …=x Bkpt4 Bkpt5 E 2 : x=u-v Bkpt6 Dead Reaching

14
What ’ s Next? Good paper, but it only warns programmer Suggestions about how to get the expected value Alok Ladsariya ’ s talk …

Similar presentations

OK

CS 104 Introduction to Computer Science and Graphics Problems Software and Programming Language (2) Programming Languages 09/26/2008 Yang Song (Prepared.

CS 104 Introduction to Computer Science and Graphics Problems Software and Programming Language (2) Programming Languages 09/26/2008 Yang Song (Prepared.

© 2018 SlidePlayer.com Inc.

All rights reserved.

Ads by Google

Ppt on directors under companies act 1956 Ppt on google search engine Ppt on history of olympics swimming Ppt on power system stability classification Training ppt on team building Ppt on product portfolio management Ppt on success and failure in life Ppt on credit default swaps history Ppt on bluetooth based smart sensor networks applications Ppt on electromagnetism theory