Top Banner
ni.com LabVIEW Debugging Techniques to Find and Squash Software Bugs Rejwan Ali Marketing Engineer
33

LabVIEW Debugging Techniques to Find and Squash …australia.ni.com/sites/default/files/LabVIEW Debugging Techniques... · LabVIEW Debugging Techniques to Find and Squash Software

Jun 20, 2018

Download

Documents

truongnhu
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: LabVIEW Debugging Techniques to Find and Squash …australia.ni.com/sites/default/files/LabVIEW Debugging Techniques... · LabVIEW Debugging Techniques to Find and Squash Software

ni.com

LabVIEW Debugging Techniques to Find and Squash Software Bugs

Rejwan Ali

Marketing Engineer

Page 3: LabVIEW Debugging Techniques to Find and Squash …australia.ni.com/sites/default/files/LabVIEW Debugging Techniques... · LabVIEW Debugging Techniques to Find and Squash Software

3ni.com

LabVIEW Edit-Time Bugs

Page 4: LabVIEW Debugging Techniques to Find and Squash …australia.ni.com/sites/default/files/LabVIEW Debugging Techniques... · LabVIEW Debugging Techniques to Find and Squash Software

4ni.com

LabVIEW Edit-Time Bugs

Page 5: LabVIEW Debugging Techniques to Find and Squash …australia.ni.com/sites/default/files/LabVIEW Debugging Techniques... · LabVIEW Debugging Techniques to Find and Squash Software

5ni.com

LabVIEW Run-Time Bugs

Page 6: LabVIEW Debugging Techniques to Find and Squash …australia.ni.com/sites/default/files/LabVIEW Debugging Techniques... · LabVIEW Debugging Techniques to Find and Squash Software

6ni.com

1. Use Error Wires

• Surfaces run-time errors so you can fix them

• Search ni.com “Structured Error Handler” for a more

structured error handling strategy

Page 7: LabVIEW Debugging Techniques to Find and Squash …australia.ni.com/sites/default/files/LabVIEW Debugging Techniques... · LabVIEW Debugging Techniques to Find and Squash Software

7ni.com

1. Use Error Wires

• Surfaces run-time errors so you can fix them

• Search for “Structured Error Handler” on ni.com for a

more structured error handling strategy

Page 8: LabVIEW Debugging Techniques to Find and Squash …australia.ni.com/sites/default/files/LabVIEW Debugging Techniques... · LabVIEW Debugging Techniques to Find and Squash Software

8ni.com

2. Highlight Execution

• Animation of the block diagram data flow

• LabVIEW Idea Exchange (ni.com/ideas) on “User

Defined Partial Highlight Execution”

Page 9: LabVIEW Debugging Techniques to Find and Squash …australia.ni.com/sites/default/files/LabVIEW Debugging Techniques... · LabVIEW Debugging Techniques to Find and Squash Software

9ni.com

3. Single-Stepping

• Walk through each block diagram interaction one at a time

• If you single-step through a VI with execution highlighting

on, an execution glyph appears on the icons of the

subVIs that are currently running.

Step Into Step Over Step Out

Page 10: LabVIEW Debugging Techniques to Find and Squash …australia.ni.com/sites/default/files/LabVIEW Debugging Techniques... · LabVIEW Debugging Techniques to Find and Squash Software

10ni.com

4. Probes

• Watch data values on wires in “real time”

• SAPHIR - VIBox Probes free add-on for custom probes

available on the LabVIEW Tools Network

Page 11: LabVIEW Debugging Techniques to Find and Squash …australia.ni.com/sites/default/files/LabVIEW Debugging Techniques... · LabVIEW Debugging Techniques to Find and Squash Software

11ni.com

4. Probes

• Watch data values on wires in “real time”

• SAPHIR - VIBox Probes free add-on for custom probes

available on the LabVIEW Tools Network

Page 12: LabVIEW Debugging Techniques to Find and Squash …australia.ni.com/sites/default/files/LabVIEW Debugging Techniques... · LabVIEW Debugging Techniques to Find and Squash Software

12ni.com

4. Probes

• Watch data values on wires in “real-time”

• SAPHIR - VIBox Probes free add-on for custom probes

available on the LabVIEW Tools Network

Page 13: LabVIEW Debugging Techniques to Find and Squash …australia.ni.com/sites/default/files/LabVIEW Debugging Techniques... · LabVIEW Debugging Techniques to Find and Squash Software

13ni.com

5. Breakpoints

• Pause execution of a VI at a certain block diagram location

• LabVIEW Idea Exchange (ni.com/ideas) on “Allow Data in

Wires to be Forced During Development”

Page 14: LabVIEW Debugging Techniques to Find and Squash …australia.ni.com/sites/default/files/LabVIEW Debugging Techniques... · LabVIEW Debugging Techniques to Find and Squash Software

14ni.com

5. Breakpoints

• Pause execution of a VI at a certain block diagram location

• LabVIEW Idea Exchange (ni.com/ideas) on “Allow Data

in Wires to be Forced During Development”

Page 15: LabVIEW Debugging Techniques to Find and Squash …australia.ni.com/sites/default/files/LabVIEW Debugging Techniques... · LabVIEW Debugging Techniques to Find and Squash Software

15ni.com

6. Suspend When Called

• Suspends execution of subVI when it is called

• Determine where the subVI is being called from by using

the Call list pull-down menu on the toolbar (Call Chain

function also would work programmatically)

Page 16: LabVIEW Debugging Techniques to Find and Squash …australia.ni.com/sites/default/files/LabVIEW Debugging Techniques... · LabVIEW Debugging Techniques to Find and Squash Software

16ni.com

6. Suspend When Called

• Suspends execution of subVI when it is called

• Determine where the subVI is being called from by using

the Call list pull-down menu on the toolbar (Call Chain

function also would work programmatically)

Page 17: LabVIEW Debugging Techniques to Find and Squash …australia.ni.com/sites/default/files/LabVIEW Debugging Techniques... · LabVIEW Debugging Techniques to Find and Squash Software

17ni.com

6. Suspend When Called

• Suspends execution of subVI when it is called

• Determine where the subVI is being called from by using

the Call list pull-down menu on the toolbar (Call Chain

function also would work programmatically)

Page 18: LabVIEW Debugging Techniques to Find and Squash …australia.ni.com/sites/default/files/LabVIEW Debugging Techniques... · LabVIEW Debugging Techniques to Find and Squash Software

18ni.com

6. Suspend When Called

• Suspends execution of subVI when it is called

• Determine where the subVI is being called from by using

the Call list pull-down menu on the toolbar (Call Chain

function also would work programmatically)

Page 19: LabVIEW Debugging Techniques to Find and Squash …australia.ni.com/sites/default/files/LabVIEW Debugging Techniques... · LabVIEW Debugging Techniques to Find and Squash Software

19ni.com

6. Suspend When Called

• Suspends execution of subVI when it is called

• Determine where the subVI is being called from by using

the Call list pull-down menu on the toolbar (Call Chain

function also would work programmatically)

Page 20: LabVIEW Debugging Techniques to Find and Squash …australia.ni.com/sites/default/files/LabVIEW Debugging Techniques... · LabVIEW Debugging Techniques to Find and Squash Software

20ni.com

7. Debugging with “Binary Search” method

• Comment out half of your code and see if the problem still

persists. Keep going until you narrow in on the offending

code

• LabVIEW Idea Exchange (ni.com/ideas) on “Conditional

Disable Symbols settable in Application Builder”

Page 21: LabVIEW Debugging Techniques to Find and Squash …australia.ni.com/sites/default/files/LabVIEW Debugging Techniques... · LabVIEW Debugging Techniques to Find and Squash Software

21ni.com

7. Debugging with “Binary Search” method

• Comment out half of your code and see if the problem still

persists. Keep going until you narrow in on the offending

code

• LabVIEW Idea Exchange (ni.com/ideas) on “Conditional

Disable Symbols settable in Application Builder”

Page 22: LabVIEW Debugging Techniques to Find and Squash …australia.ni.com/sites/default/files/LabVIEW Debugging Techniques... · LabVIEW Debugging Techniques to Find and Squash Software

22ni.com

7. Debugging with “Binary Search” method

• Comment out half of your code and see if the problem still

persists. Keep going until you narrow in on the offending

code

• LabVIEW Idea Exchange (ni.com/ideas) on “Conditional

Disable Symbols settable in Application Builder”

Page 23: LabVIEW Debugging Techniques to Find and Squash …australia.ni.com/sites/default/files/LabVIEW Debugging Techniques... · LabVIEW Debugging Techniques to Find and Squash Software

23ni.com

8. VI Debug File

• Write values to a “debug file” periodically so that you can

read about the VI execution later

• This will show the values in more real execution timing

compared to other tools like Highlight Execution

Page 24: LabVIEW Debugging Techniques to Find and Squash …australia.ni.com/sites/default/files/LabVIEW Debugging Techniques... · LabVIEW Debugging Techniques to Find and Squash Software

24ni.com

8. VI Debug File

• Write values to a “debug file” periodically so that you can

read about the VI execution later

• This will show the values in more real execution timing

compared to other options like Highlight Execution

Page 25: LabVIEW Debugging Techniques to Find and Squash …australia.ni.com/sites/default/files/LabVIEW Debugging Techniques... · LabVIEW Debugging Techniques to Find and Squash Software

25ni.com

8. VI Debug File

• Write values to a “debug file” periodically so that you can

read about the VI execution later

• This will show the values in more real execution timing

compared to other options like Highlight Execution

Page 26: LabVIEW Debugging Techniques to Find and Squash …australia.ni.com/sites/default/files/LabVIEW Debugging Techniques... · LabVIEW Debugging Techniques to Find and Squash Software

26ni.com

8. VI Debug File

• Write values to a “debug file” periodically so that you can

read about the VI execution later

• For this example, search ni.com/community for “Simple

Debug File Troubleshooting in LabVIEW”

Page 27: LabVIEW Debugging Techniques to Find and Squash …australia.ni.com/sites/default/files/LabVIEW Debugging Techniques... · LabVIEW Debugging Techniques to Find and Squash Software

27ni.com

9. Desktop Execution Trace Toolkit

• Even code that is syntactically correct and functionally

complete is often still contaminated with problems such

as memory leaks or daemon tasks that can impact

performance or lead to incorrect behavior

• Debugging large, highly parallel applications is difficult

• Code that crashes LabVIEW needs another process to

help it debug

Page 28: LabVIEW Debugging Techniques to Find and Squash …australia.ni.com/sites/default/files/LabVIEW Debugging Techniques... · LabVIEW Debugging Techniques to Find and Squash Software

28ni.com

9. Desktop Execution Trace Toolkit

• Good for memory leaks, event sources, last call before

error, and remote execution tracing

• It can trace VI Execution, Event Structure, Queues and

Notifers, User Logged Strings, Reference Leaks, Error

I/O, Memory Allocations, and Thread and CPU IDs

Page 29: LabVIEW Debugging Techniques to Find and Squash …australia.ni.com/sites/default/files/LabVIEW Debugging Techniques... · LabVIEW Debugging Techniques to Find and Squash Software

29ni.com

10. Catch All

• Make sure and initialize appropriate shift registers (There

is a VI Analyzer test for this)

• Hidden or unwired subVIs could happen if you place

structures on top of VIs and could cause the VI to perform

extra functions. Use View»VI Hierarchy, to look for extra

VIs or change the environmental setting so that terminals

are “required” by default.

• What else is missing from this list?

Page 30: LabVIEW Debugging Techniques to Find and Squash …australia.ni.com/sites/default/files/LabVIEW Debugging Techniques... · LabVIEW Debugging Techniques to Find and Squash Software

30ni.com

Want to Learn More?

• ni.com/training

• “LabVIEW Core 1” – LabVIEW Debugging Basics

• “LabVIEW Core 2” – Debugging a LabVIEW Application

• “LabVIEW Performance” – Identify and Improve Performance

Issues; VI Profiler, VI Analyzer, Desktop Execution Trace Toolkit

• ni.com/training/self-paced (For LabVIEW Core 1 & 2)

• “Debugging Techniques” in-product whitepaper

(Help»LabVIEW Help) and also online if you search

ni.com

Page 31: LabVIEW Debugging Techniques to Find and Squash …australia.ni.com/sites/default/files/LabVIEW Debugging Techniques... · LabVIEW Debugging Techniques to Find and Squash Software

31ni.com

Plan Your ProficiencyVisit the Proficiency Booth and complete the short questionnaire to see your custom plan

for recommended Training and Certification

Page 32: LabVIEW Debugging Techniques to Find and Squash …australia.ni.com/sites/default/files/LabVIEW Debugging Techniques... · LabVIEW Debugging Techniques to Find and Squash Software

32ni.com

Let us help you identify

the skills your LabVIEW

project requires today

Visit the LabVIEW

Proficiency Booth for details

Page 33: LabVIEW Debugging Techniques to Find and Squash …australia.ni.com/sites/default/files/LabVIEW Debugging Techniques... · LabVIEW Debugging Techniques to Find and Squash Software

ni.com

Thanks for attending!