Understanding Static and Dynamic Breakpoints

Aug 4, 2024

Debugging Mode: Static vs Dynamic Breakpoints

Introduction

  • Focus of video: Learn about static and dynamic breakpoints in debugging mode.
  • Importance of understanding the difference between user independent and user dependent breakpoints.

Static Breakpoints

  • Definition: User independent breakpoints.
  • Characteristics:
    • If one user (e.g., trainee01) sets a static breakpoint, all users running the same program will enter debugging mode at that breakpoint.
    • Example:
      • User trainee01 sets a static breakpoint.
      • User trainee02 runs the program and hits the breakpoint set by trainee01.
  • How to Set:
    • Use the command break-point to set a static breakpoint.
    • Example displayed in the program where program execution pauses at line 12 for all users.

Dynamic Breakpoints

  • Definition: User dependent breakpoints.
  • Characteristics:
    • If a user (e.g., trainee01) sets a dynamic breakpoint, it will only affect that user.
    • Example:
      • User trainee01 sets a dynamic breakpoint.
      • Other users will not be affected or enter debugging mode when they run the program.
  • How to Set:
    • Use the command break <username> to set a dynamic breakpoint (user dependent).
    • Example:
      • Using username (e.g., s4aug13), the program execution pauses only for that user.

Best Practices for Debugging

  • Recommendation: Prefer dynamic breakpoints over static breakpoints.
  • Reason:
    • Setting static breakpoints can disrupt other users by forcing them into debugging mode, especially if the code with the static breakpoint moves to production.
    • Customer or other users might inadvertently enter debugging mode, causing confusion and issues.

Summary

  • Static Breakpoint:
    • Command: break-point
    • User independent; affects all users.
  • Dynamic Breakpoint:
    • Command: break <username>
    • User dependent; only affects the user setting it.
  • Always prefer dynamic breakpoints to avoid disrupting other users when debugging.