Skip to content

Martini Debugging Services

Debugging is a critical aspect of software development, offering insights into the inner workings of your services. Martini provides a robust set of debugging tools designed to streamline the process of identifying and resolving issues within your services. This guide will walk you through the essentials of using Martini's debugging features effectively.

Starting a Debug Session

Initiating a debug session is the first step towards inspecting the behavior of your service. Martini allows you to launch your service in debug mode, enabling a variety of debugging operations such as setting breakpoints, stepping through code, and inspecting variables.

How to Start a Debug Session

To begin debugging a service in Martini, follow these steps:

  1. Launch in Debug Mode: Navigate to the service you wish to debug. You can start a debug session by utilizing one of the following methods:

    • Click the debug button on the toolbar when the service is open.
    • Right-click the service from the Navigator or the step tree within the editor and select Debug from the context menu.
  2. Use Keyboard Shortcut: For quicker access, you can start debugging the currently selected or opened service by pressing Ctrl + Alt + R. This shortcut enables you to swiftly enter debug mode without navigating through menus.

Debugging Features

Once in debug mode, Martini offers several powerful features to enhance your debugging experience:

  • Breakpoints: Add breakpoints to pause execution at specific points. This allows you to examine the state of the application at critical junctures.
  • Step Over/Into: Use these commands to navigate through your service's execution flow. Step over executes the next line of code, while step into dives into the functions or methods called by the current line.
  • Examine Context: View and interact with the execution context, including variables and their values. This is invaluable for understanding how data is being manipulated and passed through your service.
  • Perform Evaluations: Execute expressions or code snippets on-the-fly to test potential fixes or understand the current state of your service better.

Toggling Breakpoints and Tracepoints

In Martini, breakpoints and tracepoints are essential tools for debugging services, allowing developers to control execution flow and gather insights during runtime. This section explains how to utilize these tools effectively.

Toggling Breakpoints

Breakpoints pause service execution at specific points, facilitating a closer examination of runtime behavior. They are particularly useful for debugging complex logic and iterative processes.

Breakpoint Properties

  • Hit Count: Determines how many times a breakpoint must be hit before pausing execution. A value of -1 means execution will pause on the first hit. This is beneficial for monitoring loops or recurring events.
  • Condition: A logical expression that pauses execution when evaluated to true. It allows for conditional debugging based on runtime data. If the condition is not met or left empty, the execution continues as normal.

How to Toggle a Breakpoint

Breakpoints can be toggled in several ways: - Press Ctrl + Shift + B to toggle a breakpoint using a keyboard shortcut. - Double-click on the line number in the code editor to toggle a breakpoint. - Right-click on the line number and select Toggle Step Breakpoint from the context menu.

To toggle multiple breakpoints simultaneously, select the desired lines or steps before applying any of the actions above.

Toggling Tracepoints

Tracepoints are specialized breakpoints designed for logging rather than pausing execution. They use conditions to output diagnostic information, such as service and line number, every time the condition is met.

How to Toggle a Tracepoint

To set a tracepoint, follow these steps: 1. Highlight one or more steps where you want to add a tracepoint. 2. Toggle a tracepoint by: - For Martini Desktop, press Ctrl + Shift + T. - For Martini Online, press Alt + Shift + T. - Alternatively, right-click the line number on the line ruler and choose Toggle Step Tracepoint from the context menu.

Tracepoints can act as both loggers and conditional breakpoints by adjusting the condition to return true when specific criteria are met, combining diagnostic logging with conditional execution pausing.

Debugging Step Commands in Martini

Debugging is a nuanced process that involves closely monitoring and controlling the execution flow of your services. Martini supports a comprehensive suite of step commands to navigate through service execution, enabling developers to inspect, analyze, and modify the service behavior in real-time. Below is an overview of the step commands available during a debug session.

Step Commands Overview

Step Command Description
Resume Continues execution until the next breakpoint is encountered or the service execution completes.
Pause Temporarily halts debug execution, allowing for manual inspection and intervention.
Terminate Stops the debug session, ending all current execution flows immediately.
Step Into Moves into the next level of detail, allowing you to examine the execution of lower-level operations or called services.
Step Over Advances to the next operation at the current level, bypassing the internal details of sub-operations unless a breakpoint is met.
Step Return Resumes execution until the current operation returns to the calling service or the main service completes.

Debug Perspective

Martini's debug perspective is tailor-made to enhance the debugging experience, offering a dedicated environment equipped with all necessary tools and views for effective debugging. This perspective includes several key views:

  1. Debug View: Displays the current debug stack, showing which services and operations are being executed and allowing for navigation through the execution flow.
  2. Variables View: Lists the variables in the current execution context, showing their values. Variables that change value during execution are highlighted, and their values can be modified at runtime.
  3. Expressions View: Enables writing and evaluating expressions in the context of the currently debugged service. It's useful for testing hypotheses about service behavior without altering the execution state.
  4. Debug Execution History View: Provides a history of executed steps up to the last 100, including execution times, which aids in identifying performance bottlenecks.
  5. Breakpoints View: Manages breakpoints, allowing you to set, remove, or modify their properties for targeted debugging.

When a breakpoint is hit during service execution, Martini prompts you to switch to the Debug perspective, offering a focused environment for in-depth analysis and control over the debug process.

Using Views for Effective Debugging

  • Debug View: Navigate the execution stack to understand the service flow and decide on your next action—whether to step into, over, or return from the current operation.
  • Variables View: Inspect and dynamically adjust the values of variables to test different scenarios or fix issues on the fly.
  • Expressions View: Evaluate custom expressions for deeper insight into service behavior or to verify logic without making permanent changes.
  • Debug Execution History View: Analyze the service's execution path and timing to pinpoint inefficiencies or unexpected behavior.

Evaluations During Debugging

While evaluating expressions can provide valuable insights, it's important to note that these evaluations do not modify the execution context or variable values within the debugged service. This ensures that the integrity of the service's state is maintained throughout the debugging session.

Breakpoints View and Shortcuts in Martini

The Breakpoints view is an integral part of Martini's debugging toolkit, providing a centralized interface for managing breakpoints across your services. This section outlines how to interact with breakpoints and utilize shortcuts for efficient debugging.

Breakpoints View

The Breakpoints view displays a list of all breakpoints set within Martini instances, offering options to manage their states and configurations effectively.

Managing Breakpoints

  • Enable/Disable: Toggle the activation of breakpoints by checking or unchecking the box next to each breakpoint.
  • Delete: Remove breakpoints that are no longer needed.
  • Configure: Select a breakpoint to adjust its Hit Count and Condition settings. These configurations determine the specific circumstances under which execution will pause.

Hit Count and Condition

  • Hit Count: Specifies the number of times a breakpoint must be encountered before pausing execution.
  • Condition: A logical expression that, when true, causes execution to pause. This allows for conditional debugging based on runtime values.

To save changes to breakpoint configurations, press Ctrl + S.

Condition History

Martini retains a history of previously used Conditions, accessible from a dropdown menu above the condition input field. This feature enables quick reapplication of complex conditions, streamlining the debugging process.

Debugging Shortcuts

Shortcuts facilitate swift navigation and operation within the debugging environment. Martini offers a set of default keyboard shortcuts, with variations for Desktop and Online versions.

Martini Desktop Shortcuts

Command Description Shortcut
Toggle breakpoint Toggles a breakpoint mod+shift+B
Toggle tracepoint Toggles a tracepoint mod+shift+T
Resume Resumes debug execution until a breakpoint is hit F8
Terminate Stops the debug execution mod+F2
Step into Goes into the next level of detail F5
Step over Goes over the current level, stopping at breakpoints F6
Step return Returns to the caller or main service from a step F7

Customizing Shortcuts

To tailor the debugging experience to your preferences, Martini allows for the customization of keyboard shortcuts: - Navigate to the Preferences menu. - Go to General > Keys to modify the shortcuts.

Martini Online Shortcuts

Command Description Shortcut
Toggle breakpoint Toggles a breakpoint alt+shift+B
Toggle tracepoint Toggles a tracepoint alt+shift+T