cmyr / cargo-instruments

A cargo plugin to generate Xcode Instruments trace files

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Failed to execute loader thread for liboainject.dylib

washanhanzi opened this issue · comments

The command report the following error:

cargo instruments -t Allocations --bin struct_with_string_test
    Finished dev [unoptimized + debuginfo] target(s) in 0.00s
   Profiling target/debug/struct_with_string_test with template 'Allocations'
      Failed instruments errored: Run issues were detected (trace is still ready to be viewed):
* [Error] Failed to attach to target process

	* [Error] Failed to execute loader thread for /Applications/Xcode.app/Contents/SharedFrameworks/DVTInstrumentsFoundation.framework/Resources/liboainject.dylib in target; target process 97865 likely exited

The instruments file are generated, and I can open the file with instruments. instruments showed the same error. I'm not familiar with instruments and xcode, could you provide me with some information so I can debug the problem?

  • instruments version: 14.0.1
  • arch: x86_64
  • target macOS: 12.6.1

This sounds like a problem related to instruments itself, and I don't have a lot of insight there. Can you launch the instruments GUI app (bundled with Xcode)?

Yes I can. I can launch the app and open the instruments file generated by cargo instruments. But in GUI it showed the same error.

can you launch the app and record new traces from within it? This sounds like a problem with Xcode/Instruments that is unrelated to cargo-instruments, and I haven't encountered it before. If you can't find anything, I would try uninstalling and reinstalling Xcode. :/

I looked around and find maybe it was because my program is too simple. The program finishes before Instruments can start profiling. Then I tested with a line of thread::sleep, and it works fine.

Thanks for your time.

Closing.

thanks so much @washanhanzi (and @cmyr for this great package 🙏) I've just run into the same problem with latest xcode 14.

Solution was to add std::thread::sleep(std::time::Duration::from_millis(10)) just before exiting.

Was this working for either of you before Xcode 14? I'm curious if this is a change, or just a coincidence.

I tried cargo-instruments for the first time yesterday, so I'm afraid I can't help on that.

Same for me. Never used it before.