<!--
{
  "availability" : [
    "macOS: 11.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Hypervisor",
  "identifier" : "/documentation/Hypervisor/hv_vcpu_set_trap_debug_reg_accesses(_:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Hypervisor"
    ],
    "preciseIdentifier" : "c:@F@hv_vcpu_set_trap_debug_reg_accesses"
  },
  "title" : "hv_vcpu_set_trap_debug_reg_accesses(_:_:)"
}
-->

# hv_vcpu_set_trap_debug_reg_accesses(_:_:)

Sets whether debug-register accesses exit the guest.

```
func hv_vcpu_set_trap_debug_reg_accesses(_ vcpu: hv_vcpu_t, _ value: Bool) -> hv_return_t
```

## Parameters

`vcpu`

The instance of the vCPU.

`value`

A Boolean value that if `true` indicates debug-register accesses in the guest trap to the host.

## Return Value

[`HV_SUCCESS`](/documentation/Hypervisor/HV_SUCCESS) if the operation was successful, otherwise an error code specified in [`hv_return_t`](/documentation/Hypervisor/hv_return_t).

## Discussion

The trapped registers includes `DBGBCR<n>_EL1`, `DBGBVR<n>_EL1`, `DBGWCR<n>_EL1`, `DBGWVR<n>_EL1.` and `MDSCR_EL1`.

The equivalent system register is `MDCR_EL2.TDA`.

> Important:
> This function must be called by the owning thread.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)