logging in or signing up abf sanay Download Post to : URL : Related Presentations : Share Add to Flag Embed Email Send to Blogs and Networks Add to Channel Uploaded from authorPOINTLite Insert YouTube videos in PowerPont slides with aS Desktop Copy embed code: (To copy code, click on the text box) Embed: URL: Thumbnail: WordPress Embed Customize Embed The presentation is successfully added In Your Favorites. Views: 68 Category: Entertainment License: All Rights Reserved Like it (0) Dislike it (0) Added: November 26, 2007 This Presentation is Public Favorites: 0 Presentation Description No description available. Comments Posting comment... Premium member Presentation Transcript Ada Bug Finder: Ada Bug FinderAda Bug Finder: Ada Bug Finder The Ada Bug Finder is a Windows application that searches Ada code for recognisable bug patterns Presentation: Presentation Bug Finders Ada Bug Finder v1.4 Ada Bug Patterns Results Free software for you to try out! Inspiration: Inspiration “Finding Bugs is Easy” By David Hovemeyer and William Pugh Presented October 2004 at OOPSLA Specific to Java Bug Patterns Bug Pattern - Definition: Bug Pattern - Definition A bug pattern is a code idiom that is likely to be an error. David Hovemeyer and William Pugh Syntactically correct but probably not what the author intended. Concept : Concept Premise: Bugs exist in production code Search existing Ada code base for bug patterns. Bugs in Production Code: Bugs in Production Code Why? In code that is rarely executed Symptoms hard to reproduce No access to development staffA “Find bugs” Utility: A “Find bugs” Utility Should use simple patterns Need not be 100% correct False Positives are to be expected No guarantee that every situation covered Overnight background job – Speed not an issueTrade-offs: Trade-offs Compilers could do more Increased compilation time Bug finder utility could do more or raise fewer false positives Increased development costs Ada Bug Finder v1.4: Ada Bug Finder v1.4 Result of a small 140 hour project As yet only detects 8 bug patterns Optionally checks 7 style rules False Positives: False Positives ABF doesn’t always get it right! Implementation trade-off Bad or over-complex style Exercise care when modifying code! Mark code with special comment to prevent ABF reportingCode Marking - Example: Code Marking - ExampleRecognised Ada Bug Patterns: Recognised Ada Bug Patterns Illogical Operator Rename Code Not Reachable Exception Not Raised Unused Unit Unused Declaration Null Pointer Non Short Circuit Wrong Granularity1. Illogical Operator Rename: 1. Illogical Operator Rename In Ada83, where there is no use type clause, operators are often renamed to avoid the use of prefixed notation Clumsy cut & paste editing might result in renaming an operator to be something totally different. The compiler allows this although it is highly unlikely to be what the author intendedIOR - Example: IOR - Example2. Code Not Reachable: 2. Code Not Reachable Code placed after an unconditional Raise Return Exit Some compilers (Gnat) detect this.CNR - Example: CNR - Example3. Exception Not Raised: 3. Exception Not Raised An exception is declared but never raised Exception handled but never raisedENR – Example of False Positive: ENR – Example of False Positive4. Unused Unit: 4. Unused Unit Package imported but never used Procedure, function or package defined but neither exported nor used locally False positives: Undetected default generic subprogram parameter Conditional compilation selected code destined for a different targetUU – Example of False Positive: UU – Example of False Positive5. Unused Declaration: 5. Unused Declaration Type, Constant or Variable declared but never used Why? History Confusion – Similar names Overloading False positive: Required because controlled type or default initialisation has an effectUD – Example of False Positive: UD – Example of False Positive6. Null Pointer: 6. Null Pointer Code explicitly checks for null then dereferences the pointer Unbelievable? Not a compiler requirement. Some make checks None do the job properly! NP - Example: NP - Example7. Non Short Circuit: 7. Non Short Circuit and used instead of and then or used instead of or else Typically Test if index in range then use it Test if pointer not null then dereference itNSC - Example: NSC - Example8. Wrong Granularity: 8. Wrong Granularity Size attribute outside of an expression Unlikely usage because hardly anything requires the size of an object in bits! Typically An imported API (e.g. Windows) requires the address and size of a buffer in bytes. If this buffer size is supplied as bits, a buffer overrun may occur!WG - Example: WG - ExampleThe Ada Bug Finder Utility: The Ada Bug Finder Utility Written in Ada95 Uses Ada Parser to detect patterns Reports Options StyleScreen Shot: Screen ShotABF - Reports: ABF - Reports Text Comma DelimitedABF - Options: ABF - Options Gnat Extensions Preparation Phase (Second pass to reduce false positives at the expense of speed)Style Rules: Style Rules Not bugs as such but coding practices that lead to bugs or make bugs harder to find. Character Not Portable Handle Task Exceptions No Declaration Overloading No Goto Statements No Use Clause No Variables in Specification Superfluous Code MarkOther recognised bug patterns: Other recognised bug patterns Division by Zero Raise after Assignment Redundant Comparison to Null Symmetrical Comparison1. Division by Zero: 1. Division by Zero Code explicitly checks for zero then uses it for division.DBZ - Example: DBZ - Example2.Raise after assignment: 2.Raise after assignment Leaving a procedure abnormally nullifies assignment to in-out or out parameters RAA - Example: RAA - Example3. Redundant Comparison to null: 3. Redundant Comparison to null Comparing a pointer to null after it has been dereferenced is redundant Indicates confusion. Either the check is truly redundant or the previous dereference should have been first checked.RCN - Example: RCN - Example4. Symmetrical Comparison: 4. Symmetrical Comparison When both sides of a comparison are identicalSC - Example: SC - ExampleResults: ResultsResults: Results Bugs were found in all the code bases we searched. Most were in code that was seldom if ever executed (e.g. Error handling) Some were severe! Reluctance to change production code that been accepted and that appears to function correctly. Can be used as a development tool.Results (Style Violations): Results (Style Violations)Any other ideas?: Any other ideas? After you find a bug ask yourself whether it could have been found automatically by looking for a “Simple Pattern” If so then let’s include it into ABF and see if anyone else has made the same bug!Where to get it: Where to get it Not open source but freely available for use Download from www.white-elephant.ch Feedback appreciated. Results Suggestions for new patterns Excessive false positives. You do not have the permission to view this presentation. In order to view it, please contact the author of the presentation.
abf sanay Download Post to : URL : Related Presentations : Share Add to Flag Embed Email Send to Blogs and Networks Add to Channel Uploaded from authorPOINTLite Insert YouTube videos in PowerPont slides with aS Desktop Copy embed code: (To copy code, click on the text box) Embed: URL: Thumbnail: WordPress Embed Customize Embed The presentation is successfully added In Your Favorites. Views: 68 Category: Entertainment License: All Rights Reserved Like it (0) Dislike it (0) Added: November 26, 2007 This Presentation is Public Favorites: 0 Presentation Description No description available. Comments Posting comment... Premium member Presentation Transcript Ada Bug Finder: Ada Bug FinderAda Bug Finder: Ada Bug Finder The Ada Bug Finder is a Windows application that searches Ada code for recognisable bug patterns Presentation: Presentation Bug Finders Ada Bug Finder v1.4 Ada Bug Patterns Results Free software for you to try out! Inspiration: Inspiration “Finding Bugs is Easy” By David Hovemeyer and William Pugh Presented October 2004 at OOPSLA Specific to Java Bug Patterns Bug Pattern - Definition: Bug Pattern - Definition A bug pattern is a code idiom that is likely to be an error. David Hovemeyer and William Pugh Syntactically correct but probably not what the author intended. Concept : Concept Premise: Bugs exist in production code Search existing Ada code base for bug patterns. Bugs in Production Code: Bugs in Production Code Why? In code that is rarely executed Symptoms hard to reproduce No access to development staffA “Find bugs” Utility: A “Find bugs” Utility Should use simple patterns Need not be 100% correct False Positives are to be expected No guarantee that every situation covered Overnight background job – Speed not an issueTrade-offs: Trade-offs Compilers could do more Increased compilation time Bug finder utility could do more or raise fewer false positives Increased development costs Ada Bug Finder v1.4: Ada Bug Finder v1.4 Result of a small 140 hour project As yet only detects 8 bug patterns Optionally checks 7 style rules False Positives: False Positives ABF doesn’t always get it right! Implementation trade-off Bad or over-complex style Exercise care when modifying code! Mark code with special comment to prevent ABF reportingCode Marking - Example: Code Marking - ExampleRecognised Ada Bug Patterns: Recognised Ada Bug Patterns Illogical Operator Rename Code Not Reachable Exception Not Raised Unused Unit Unused Declaration Null Pointer Non Short Circuit Wrong Granularity1. Illogical Operator Rename: 1. Illogical Operator Rename In Ada83, where there is no use type clause, operators are often renamed to avoid the use of prefixed notation Clumsy cut & paste editing might result in renaming an operator to be something totally different. The compiler allows this although it is highly unlikely to be what the author intendedIOR - Example: IOR - Example2. Code Not Reachable: 2. Code Not Reachable Code placed after an unconditional Raise Return Exit Some compilers (Gnat) detect this.CNR - Example: CNR - Example3. Exception Not Raised: 3. Exception Not Raised An exception is declared but never raised Exception handled but never raisedENR – Example of False Positive: ENR – Example of False Positive4. Unused Unit: 4. Unused Unit Package imported but never used Procedure, function or package defined but neither exported nor used locally False positives: Undetected default generic subprogram parameter Conditional compilation selected code destined for a different targetUU – Example of False Positive: UU – Example of False Positive5. Unused Declaration: 5. Unused Declaration Type, Constant or Variable declared but never used Why? History Confusion – Similar names Overloading False positive: Required because controlled type or default initialisation has an effectUD – Example of False Positive: UD – Example of False Positive6. Null Pointer: 6. Null Pointer Code explicitly checks for null then dereferences the pointer Unbelievable? Not a compiler requirement. Some make checks None do the job properly! NP - Example: NP - Example7. Non Short Circuit: 7. Non Short Circuit and used instead of and then or used instead of or else Typically Test if index in range then use it Test if pointer not null then dereference itNSC - Example: NSC - Example8. Wrong Granularity: 8. Wrong Granularity Size attribute outside of an expression Unlikely usage because hardly anything requires the size of an object in bits! Typically An imported API (e.g. Windows) requires the address and size of a buffer in bytes. If this buffer size is supplied as bits, a buffer overrun may occur!WG - Example: WG - ExampleThe Ada Bug Finder Utility: The Ada Bug Finder Utility Written in Ada95 Uses Ada Parser to detect patterns Reports Options StyleScreen Shot: Screen ShotABF - Reports: ABF - Reports Text Comma DelimitedABF - Options: ABF - Options Gnat Extensions Preparation Phase (Second pass to reduce false positives at the expense of speed)Style Rules: Style Rules Not bugs as such but coding practices that lead to bugs or make bugs harder to find. Character Not Portable Handle Task Exceptions No Declaration Overloading No Goto Statements No Use Clause No Variables in Specification Superfluous Code MarkOther recognised bug patterns: Other recognised bug patterns Division by Zero Raise after Assignment Redundant Comparison to Null Symmetrical Comparison1. Division by Zero: 1. Division by Zero Code explicitly checks for zero then uses it for division.DBZ - Example: DBZ - Example2.Raise after assignment: 2.Raise after assignment Leaving a procedure abnormally nullifies assignment to in-out or out parameters RAA - Example: RAA - Example3. Redundant Comparison to null: 3. Redundant Comparison to null Comparing a pointer to null after it has been dereferenced is redundant Indicates confusion. Either the check is truly redundant or the previous dereference should have been first checked.RCN - Example: RCN - Example4. Symmetrical Comparison: 4. Symmetrical Comparison When both sides of a comparison are identicalSC - Example: SC - ExampleResults: ResultsResults: Results Bugs were found in all the code bases we searched. Most were in code that was seldom if ever executed (e.g. Error handling) Some were severe! Reluctance to change production code that been accepted and that appears to function correctly. Can be used as a development tool.Results (Style Violations): Results (Style Violations)Any other ideas?: Any other ideas? After you find a bug ask yourself whether it could have been found automatically by looking for a “Simple Pattern” If so then let’s include it into ABF and see if anyone else has made the same bug!Where to get it: Where to get it Not open source but freely available for use Download from www.white-elephant.ch Feedback appreciated. Results Suggestions for new patterns Excessive false positives.