On Thursday, 17 January 2019 at 00:11:10 UTC, Johan Engelen wrote:
On Wednesday, 16 January 2019 at 23:29:45 UTC, Johan Engelen
wrote:
On Wednesday, 16 January 2019 at 22:10:14 UTC, Johan Engelen
wrote:
On Wednesday, 16 January 2019 at 17:36:31 UTC, Márcio Martins
wrote:
On Tuesday, 15 January 2019 at 22:51:15 UTC, Johan Engelen
wrote:
What platform are you on?
Linux x64
OK, so that should work. What is your testcase? Try with
`-fxray-instruction-threshold=1` to also instrument small
functions.
I'm trying now and am having the same problem. I'm trying to
figure out how to fix LDC so that it works.
work in progress!
-Johan
OK, got it :-) LLVM 7 changed things a little, so it's broken
with LDC 1.13 [*].
For now, you can use LDC 1.12 (LLVM 6). You also have to add
`-L-lstdc++` as compiler flag. So with LDC 1.12, Linux, and
this commandline things work for me:
```
ldc2 -fxray-instrument -fxray-instruction-threshold=1
xraytest.d -L-lstdc++
XRAY_OPTIONS="patch_premain=true xray_mode=xray-basic
verbosity=1" xraytest
```
Happy testing,
Johan
[*] XRay was split into several libraries, and we only
copy+link with one of them. You can make things work by
downloading the libs and linking with them.
Great! Does it mean it will be fixed in next LDC release? :)
I also played a bit with -finstrument-functions and it works fine
for tools like uftrace... However, if you define your own
__cyg_profile_func_* functions, it won't work (or be useful),
because there is no way to disable instrumenting on these
__cyg_profile_func_* functions, so you can imagine what happens.
I tried @llvmAttr("no_instrument_function"), supposedly the GCC
compatible way to disable instrumentation on these, but it
doesn't make a difference.
There are few LLVM settings that will make this useful:
- https://reviews.llvm.org/D40276
- https://reviews.llvm.org/D39331 (which enables instrumenting
after inlining, which is more useful in my use case)
- https://reviews.llvm.org/D37622 (is has not been merged yet,
but necessary, to be able to conveniently call library functions
from within the hooks)