# llvm: make debuggers actually usable · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/fb4a5ccdeeddf56a0849b4168fe7a9525f36b107)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: fb4a5ccdeeddf56a0849b4168fe7a9525f36b107

Requested commit: fb4a5ccdeeddf56a0849b4168fe7a9525f36b107

Commit: fb4a5ccdeeddf56a0849b4168fe7a9525f36b107

Tree: b73a5a59ddb6850ee9c69d2ee8fbbc17126b4d44

Author: Veikka Tuominen

Committer: Veikka Tuominen

## Message

````
llvm: make debuggers actually usable

`@llvm.dbg.value` is absolutely useless, adding a temporary alloca
to store the constant in will make it actually show up in debuggers.
The effect on performance should be minimal since there is only one
store and it the change is not applied to ReleaseSafe builds.

```zig
fn foo(a: u32, b: []const u8, c: bool, d: enum { yes, no }) void {
    _ = a; _ = b; _ = c; _ = d;
}
```
before:
```
Breakpoint 1, a.foo (a=<optimized out>, b=..., c=<optimized out>, d=<optimized out>) at a.zig:18
18          _ = d;
```
after:
```
Breakpoint 1, a.foo (a=1, b=..., c=false, d=yes) at a.zig:15
15          _ = a; _ = b; _ = c; _ = d;
(gdb) p b
$1 = {ptr = 0x20854f <a.main.anon_3888> "bar", len = 3}
```

````

## Parents

- [e4fd9acc2a7682d0d64d6d42e2882967cf3877aa](https://git.cafe/gitcafe/zig/commit/e4fd9acc2a7682d0d64d6d42e2882967cf3877aa?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/fb4a5ccdeeddf56a0849b4168fe7a9525f36b107?format=markdown)
