# stopAndReturnDebugTraceRecording

Description: stopAndReturnDebugTraceRecording cheatcode documentation

Note: This document was authored using MDX

  Source: https://github.com/NomicFoundation/hardhat-website/tree/main/src/content/docs/docs/reference/cheatcodes/Environment/stop-and-return-debug-trace-recording.mdx

### Signature

```solidity
struct DebugStep {
  /// The stack before executing the step of the run.
  /// stack[0] represents the top of the stack.
  /// and only stack data relevant to the opcode execution is contained.
  uint256[] stack;
  /// The memory input data before executing the step of the run.
  /// only input data relevant to the opcode execution is contained.
  ///
  /// e.g. for MLOAD, it will have memory [offset:offset+32] copied here.
  /// the offset value can be get by the stack data.
  bytes memoryInput;
  /// The opcode that was accessed.
  uint8 opcode;
  /// The call depth of the step.
  uint64 depth;
  /// Whether the call end up with out of gas error.
  bool isOutOfGas;
  /// The contract address where the opcode is running
  address contractAddr;
}
function stopAndReturnDebugTraceRecording()
  external
  returns (DebugStep[] memory step);
```

### Description

Stop debug trace recording and returns the recorded debug trace.
