1 / 14

Debugging Optimized Code

Debugging Optimized Code. Steven Osman. 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. Talk Overview.

hume
Download Presentation

Debugging Optimized Code

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  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 We want a breakpoint at S2

  5. The Data-Value Problem 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: x=u-v E1: x=y+z Bkpt1 Bkpt2 E2: x=y+z Bkpt3

  9. Code Hoisting E0: x=u-v E1: x=y+z E3: x=y+z Bkpt1 Bkpt2 E2: x=y+z Bkpt3 E2=RedCopy(E3)

  10. Hoist Reaches E0: x=u-v E1: x=y+z E3: x=y+z Bkpt1 Bkpt2 E2: x=y+z Bkpt3 E2=RedCopy(E3)

  11. Dead Code Elimination E0: x=y+z Bkpt1 Bkpt3 E1: …=x Bkpt4 Bkpt2 Bkpt5 E2: x=u-v Bkpt6

  12. Dead Code Elimination E0: x=y+z Bkpt1 Bkpt3 E3: x=y+z E1: …=x Bkpt4 Bkpt2 Bkpt5 E2: x=u-v Bkpt6

  13. Dead Reaching E0: x=y+z Bkpt1 Bkpt3 E3: x=y+z E1: …=x Bkpt4 Bkpt2 Bkpt5 E2: x=u-v Bkpt6

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

More Related