# stage2: add debug info for globals in the LLVM backend · gitcafe/zig

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

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

Visibility: public

Requested revision: c757f197903940115c1d42883240ec1fe7ef660c

Requested commit: c757f197903940115c1d42883240ec1fe7ef660c

Commit: c757f197903940115c1d42883240ec1fe7ef660c

Tree: 31915696778776c3a906df85cbf08e428f052b90

Author: William Sengir

Committer: Andrew Kelley

## Message

```
stage2: add debug info for globals in the LLVM backend

LLVM backend: generate DIGlobalVariable's for non-function globals and
rename linkage names when exporting functions and globals.

zig_llvm.cpp: add some wrappers to convert a handful of DI classes
into DINode's since DIGlobalVariable is not a DIScope like the others.

zig_llvm.cpp: add some wrappers to allow replacing the LinkageName of
DISubprogram and DIGlobalVariable.

zig_llvm.cpp: fix DI class mixup causing nonsense reinterpret_cast.

The end result is that GDB is now usable since you now no longer need
to manually cast every global nor fully qualify every export.

```

## Parents

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

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