On Sunday, 11 February 2024 at 06:43:19 UTC, Per Nordlöw wrote:
How do I make LDC stacktraces like
```test-library(+0x1fb232)[0x562230d82232]
So it turns out that ldc2 doesn't show symbols in stack traces by
default.
IMHO, in debug mode D should adhere to what other languages do.
Meaning a sane behavior like what
```d
int main(string[] args) {
import etc.linux.memoryerror : registerMemoryErrorHandler;
registerMemoryErrorHandler();
int*x = null;
*x = 42;
return 0;
}
```
does when using compiled and run via
```sh
dmd -g -debug -run app
```
gives
```
etc.linux.memoryerror.NullPointerError@src/etc/linux/memoryerror.d(322)
----------------
??:? void etc.linux.memoryerror.sigsegvUserspaceProcess(void*)
[0x55fd3461e4f6]
??:? void etc.linux.memoryerror.sigsegvDataHandler()
[0x55fd3461e42e]
./app.d:4 _Dmain [0x55fd345e53e6]
```
. Doing the same thing with LDC via
```sh
ldc2 -g --d-debug -run app
```
gives
```
ld: error: undefined symbol:
_D3etc5linux11memoryerror26registerMemoryErrorHandlerFNbZb
referenced by app.d:3
/tmp/objtmp-ldc-dec7a7/app.o:(D main)
collect2: error: ld returned 1 exit status
Error: /usr/bin/cc failed with status: 1
```
.