Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save timotheecour/cce51bf06f3b12b1db2b15f4cdc31ef5 to your computer and use it in GitHub Desktop.
Save timotheecour/cce51bf06f3b12b1db2b15f4cdc31ef5 to your computer and use it in GitHub Desktop.
zig lldb output
zig version
0.6.0+480deac
`zig build-exe --c-source /Users/timothee/git_clone//nim//timn/src/timn/examples/thelloc.c`
```
error: unable to create target: 'Unable to find target for this triple (no targets are registered)'
1 error generated.
The following command failed:
/usr/local/Cellar/zig/HEAD-480deac/bin/zig clang -c -nostdinc -fno-spell-checking -target x86_64-unknown-macosx-gnu -isystem /usr/local/Cellar/zig/HEAD-480deac/lib/zig/include -isystem /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -Xclang -target-cpu -Xclang skylake -Xclang -target-feature -Xclang -3dnow,-3dnowa,+64bit,+adx,+aes,+avx,+avx2,-avx512bf16,-avx512bitalg,-avx512bw,-avx512cd,-avx512dq,-avx512er,-avx512f,-avx512ifma,-avx512pf,-avx512vbmi,-avx512vbmi2,-avx512vl,-avx512vnni,-avx512vp2intersect,-avx512vpopcntdq,+bmi,+bmi2,-branchfusion,-cldemote,+clflushopt,-clwb,-clzero,+cmov,+cx16,+cx8,-enqcmd,+ermsb,+f16c,-false-deps-lzcnt-tzcnt,+false-deps-popcnt,-fast-11bytenop,-fast-15bytenop,-fast-bextr,+fast-gather,-fast-hops,-fast-lzcnt,+fast-scalar-fsqrt,-fast-scalar-shift-masks,+fast-shld-rotate,+fast-variable-shuffle,+fast-vector-fsqrt,-fast-vector-shift-masks,+fma,-fma4,+fsgsbase,+fxsr,-gfni,-idivl-to-divb,+idivq-to-divl,+invpcid,-lea-sp,-lea-uses-ag,-lwp,+lzcnt,+macrofusion,+merge-to-threeway-branch,+mmx,+movbe,-movdir64b,-movdiri,-mpx,-mwaitx,+nopl,-pad-short-functions,+pclmul,-pconfig,-pku,+popcnt,-prefer-128-bit,-prefer-256-bit,-prefer-mask-registers,-prefetchwt1,+prfchw,-ptwrite,-rdpid,+rdrnd,+rdseed,-retpoline,-retpoline-external-thunk,-retpoline-indirect-branches,-retpoline-indirect-calls,-rtm,+sahf,+sgx,-sha,-shstk,+slow-3ops-lea,-slow-incdec,-slow-lea,-slow-pmaddwd,-slow-pmulld,-slow-shld,-slow-two-mem-ops,-slow-unaligned-mem-16,-slow-unaligned-mem-32,-soft-float,+sse,-sse-unaligned-mem,+sse2,+sse3,+sse4.1,+sse4.2,-sse4a,+ssse3,-tbm,-use-aa,-use-glm-div-sqrt-costs,-vaes,-vpclmulqdq,+vzeroupper,-waitpkg,-wbnoinvd,+x87,-xop,+xsave,+xsavec,+xsaveopt,+xsaves -MD -MV -MF zig-cache/tmp/Xrvx3YUIFd4W-thelloc.o.d -g -fno-omit-frame-pointer -fsanitize=undefined -fsanitize-trap=undefined -D_DEBUG -Og -fstack-protector-strong --param ssp-buffer-size=4 -fPIC -o zig-cache/tmp/Xrvx3YUIFd4W-thelloc.o /Users/timothee/git_clone//nim//timn/src/timn/examples/thelloc.c
```
`lldb -- /usr/local/Cellar/zig/HEAD-480deac/bin/zig clang -c -nostdinc -fno-spell-checking -target x86_64-unknown-macosx-gnu -isystem /usr/local/Cellar/zig/HEAD-480deac/lib/zig/include -isystem /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -Xclang -target-cpu -Xclang skylake -Xclang -target-feature -Xclang -3dnow,-3dnowa,+64bit,+adx,+aes,+avx,+avx2,-avx512bf16,-avx512bitalg,-avx512bw,-avx512cd,-avx512dq,-avx512er,-avx512f,-avx512ifma,-avx512pf,-avx512vbmi,-avx512vbmi2,-avx512vl,-avx512vnni,-avx512vp2intersect,-avx512vpopcntdq,+bmi,+bmi2,-branchfusion,-cldemote,+clflushopt,-clwb,-clzero,+cmov,+cx16,+cx8,-enqcmd,+ermsb,+f16c,-false-deps-lzcnt-tzcnt,+false-deps-popcnt,-fast-11bytenop,-fast-15bytenop,-fast-bextr,+fast-gather,-fast-hops,-fast-lzcnt,+fast-scalar-fsqrt,-fast-scalar-shift-masks,+fast-shld-rotate,+fast-variable-shuffle,+fast-vector-fsqrt,-fast-vector-shift-masks,+fma,-fma4,+fsgsbase,+fxsr,-gfni,-idivl-to-divb,+idivq-to-divl,+invpcid,-lea-sp,-lea-uses-ag,-lwp,+lzcnt,+macrofusion,+merge-to-threeway-branch,+mmx,+movbe,-movdir64b,-movdiri,-mpx,-mwaitx,+nopl,-pad-short-functions,+pclmul,-pconfig,-pku,+popcnt,-prefer-128-bit,-prefer-256-bit,-prefer-mask-registers,-prefetchwt1,+prfchw,-ptwrite,-rdpid,+rdrnd,+rdseed,-retpoline,-retpoline-external-thunk,-retpoline-indirect-branches,-retpoline-indirect-calls,-rtm,+sahf,+sgx,-sha,-shstk,+slow-3ops-lea,-slow-incdec,-slow-lea,-slow-pmaddwd,-slow-pmulld,-slow-shld,-slow-two-mem-ops,-slow-unaligned-mem-16,-slow-unaligned-mem-32,-soft-float,+sse,-sse-unaligned-mem,+sse2,+sse3,+sse4.1,+sse4.2,-sse4a,+ssse3,-tbm,-use-aa,-use-glm-div-sqrt-costs,-vaes,-vpclmulqdq,+vzeroupper,-waitpkg,-wbnoinvd,+x87,-xop,+xsave,+xsavec,+xsaveopt,+xsaves -MD -MV -MF zig-cache/tmp/Xrvx3YUIFd4W-thelloc.o.d -g -fno-omit-frame-pointer -fsanitize=undefined -fsanitize-trap=undefined -D_DEBUG -Og -fstack-protector-strong --param ssp-buffer-size=4 -fPIC -o zig-cache/tmp/Xrvx3YUIFd4W-thelloc.o /Users/timothee/git_clone//nim//timn/src/timn/examples/thelloc.c`
```
command script list
Current user-defined commands:
d_help -- For more information run 'help d_help'
d_reimport -- For more information run 'help d_reimport'
d_rerun_fun -- For more information run 'help d_rerun_fun'
For more information on any command, type 'help <command-name>'.
(lldb) target create "/usr/local/Cellar/zig/HEAD-480deac/bin/zig"
Current executable set to '/usr/local/Cellar/zig/HEAD-480deac/bin/zig' (x86_64).
(lldb) settings set -- target.run-args "clang" "-c" "-nostdinc" "-fno-spell-checking" "-target" "x86_64-unknown-macosx-gnu" "-isystem" "/usr/local/Cellar/zig/HEAD-480deac/lib/zig/include" "-isystem" "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include" "-Xclang" "-target-cpu" "-Xclang" "skylake" "-Xclang" "-target-feature" "-Xclang" "-3dnow,-3dnowa,+64bit,+adx,+aes,+avx,+avx2,-avx512bf16,-avx512bitalg,-avx512bw,-avx512cd,-avx512dq,-avx512er,-avx512f,-avx512ifma,-avx512pf,-avx512vbmi,-avx512vbmi2,-avx512vl,-avx512vnni,-avx512vp2intersect,-avx512vpopcntdq,+bmi,+bmi2,-branchfusion,-cldemote,+clflushopt,-clwb,-clzero,+cmov,+cx16,+cx8,-enqcmd,+ermsb,+f16c,-false-deps-lzcnt-tzcnt,+false-deps-popcnt,-fast-11bytenop,-fast-15bytenop,-fast-bextr,+fast-gather,-fast-hops,-fast-lzcnt,+fast-scalar-fsqrt,-fast-scalar-shift-masks,+fast-shld-rotate,+fast-variable-shuffle,+fast-vector-fsqrt,-fast-vector-shift-masks,+fma,-fma4,+fsgsbase,+fxsr,-gfni,-idivl-to-divb,+idivq-to-divl,+invpcid,-lea-sp,-lea-uses-ag,-lwp,+lzcnt,+macrofusion,+merge-to-threeway-branch,+mmx,+movbe,-movdir64b,-movdiri,-mpx,-mwaitx,+nopl,-pad-short-functions,+pclmul,-pconfig,-pku,+popcnt,-prefer-128-bit,-prefer-256-bit,-prefer-mask-registers,-prefetchwt1,+prfchw,-ptwrite,-rdpid,+rdrnd,+rdseed,-retpoline,-retpoline-external-thunk,-retpoline-indirect-branches,-retpoline-indirect-calls,-rtm,+sahf,+sgx,-sha,-shstk,+slow-3ops-lea,-slow-incdec,-slow-lea,-slow-pmaddwd,-slow-pmulld,-slow-shld,-slow-two-mem-ops,-slow-unaligned-mem-16,-slow-unaligned-mem-32,-soft-float,+sse,-sse-unaligned-mem,+sse2,+sse3,+sse4.1,+sse4.2,-sse4a,+ssse3,-tbm,-use-aa,-use-glm-div-sqrt-costs,-vaes,-vpclmulqdq,+vzeroupper,-waitpkg,-wbnoinvd,+x87,-xop,+xsave,+xsavec,+xsaveopt,+xsaves" "-MD" "-MV" "-MF" "zig-cache/tmp/Xrvx3YUIFd4W-thelloc.o.d" "-g" "-fno-omit-frame-pointer" "-fsanitize=undefined" "-fsanitize-trap=undefined" "-D_DEBUG" "-Og" "-fstack-protector-strong" "--param" "ssp-buffer-size=4" "-fPIC" "-o" "zig-cache/tmp/Xrvx3YUIFd4W-thelloc.o" "/Users/timothee/git_clone//nim//timn/src/timn/examples/thelloc.c"
(lldb) b CreateTargetMachine
Breakpoint 1: where = libclang-cpp.dylib`(anonymous namespace)::EmitAssemblyHelper::CreateTargetMachine(bool), address = 0x00000000009a1c44
(lldb) r
Process 11795 launched: '/usr/local/Cellar/zig/HEAD-480deac/bin/zig' (x86_64)
Process 11795 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
frame #0: 0x0000000104ffcc44 libclang-cpp.dylib`(anonymous namespace)::EmitAssemblyHelper::CreateTargetMachine(bool)
libclang-cpp.dylib`(anonymous namespace)::EmitAssemblyHelper::CreateTargetMachine:
-> 0x104ffcc44 <+0>: pushq %rbp
0x104ffcc45 <+1>: movq %rsp, %rbp
0x104ffcc48 <+4>: pushq %r15
0x104ffcc4a <+6>: pushq %r14
Target 0: (zig) stopped.
(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
frame #0: 0x0000000104ffcc44 libclang-cpp.dylib`(anonymous namespace)::EmitAssemblyHelper::CreateTargetMachine(bool)
frame #1: 0x0000000104ff53a2 libclang-cpp.dylib`clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::HeaderSearchOptions const&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::DataLayout const&, llvm::Module*, clang::BackendAction, std::__1::unique_ptr<llvm::raw_pwrite_stream, std::__1::default_delete<llvm::raw_pwrite_stream> >) + 5621
frame #2: 0x00000001051f0f19 libclang-cpp.dylib`clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) + 993
frame #3: 0x000000010472fe4f libclang-cpp.dylib`clang::ParseAST(clang::Sema&, bool, bool) + 514
frame #4: 0x00000001056d7b3b libclang-cpp.dylib`clang::FrontendAction::Execute() + 77
frame #5: 0x00000001056a2e51 libclang-cpp.dylib`clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 833
frame #6: 0x00000001057252bf libclang-cpp.dylib`clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 1299
frame #7: 0x00000001001bf8bb zig`cc1_main(llvm::ArrayRef<char const*>, char const*, void*) + 1781
frame #8: 0x00000001001be8e2 zig`ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&) + 264
frame #9: 0x00000001054ac395 libclang-cpp.dylib`void llvm::function_ref<void ()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*, bool*) const::$_1>(long) + 23
frame #10: 0x0000000106e0d25c libLLVM.dylib`llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) + 218
frame #11: 0x00000001054aba93 libclang-cpp.dylib`clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*, bool*) const + 235
frame #12: 0x000000010548c99c libclang-cpp.dylib`clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&) const + 526
frame #13: 0x000000010548cb79 libclang-cpp.dylib`clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::__1::pair<int, clang::driver::Command const*> >&) const + 95
frame #14: 0x000000010549b45c libclang-cpp.dylib`clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::__1::pair<int, clang::driver::Command const*> >&) + 210
frame #15: 0x00000001001be462 zig`ZigClang_main + 6796
frame #16: 0x0000000100002ee0 zig`main + 37
frame #17: 0x00007fff6c97f7fd libdyld.dylib`start + 1
frame #18: 0x00007fff6c97f7fd libdyld.dylib`start + 1
(lldb) fin
error: unable to create target: 'Unable to find target for this triple (no targets are registered)'
Process 11795 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = step out
frame #0: 0x0000000104ff53a2 libclang-cpp.dylib`clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::HeaderSearchOptions const&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::DataLayout const&, llvm::Module*, clang::BackendAction, std::__1::unique_ptr<llvm::raw_pwrite_stream, std::__1::default_delete<llvm::raw_pwrite_stream> >) + 5621
libclang-cpp.dylib`clang::EmitBackendOutput:
-> 0x104ff53a2 <+5621>: leal -0x1(%rbx), %eax
0x104ff53a5 <+5624>: movq -0x908(%rbp), %rsi
0x104ff53ac <+5631>: cmpl $0x3, %eax
0x104ff53af <+5634>: jae 0x104ff53f0 ; <+5699>
Target 0: (zig) stopped.
```
@timotheecour
Copy link
Author

note:
with (lldb) b TargetRegistry::lookupTarget I would've gotten instead this (just to show that EmitAssemblyHelper::CreateTargetMachine( calls TargetRegistry::lookupTarget and then that fails)

(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 1.4
  frame #0: 0x0000000106e97f50 libLLVM.dylib`llvm::TargetRegistry::lookupTarget(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&)
  frame #1: 0x0000000104ffcc8c libclang-cpp.dylib`(anonymous namespace)::EmitAssemblyHelper::CreateTargetMachine(bool) + 72
  frame #2: 0x0000000104ff53a2 libclang-cpp.dylib`clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::HeaderSearchOptions const&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::DataLayout const&, llvm::Module*, clang::BackendAction, std::__1::unique_ptr<llvm::raw_pwrite_stream, std::__1::default_delete
<llvm::raw_pwrite_stream> >) + 5621                                                                                                                                                                                                                                                                                                                                  frame #3: 0x00000001051f0f19 libclang-cpp.dylib`clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) + 993                                                                                                                                                                                                                                            frame #4: 0x000000010472fe4f libclang-cpp.dylib`clang::ParseAST(clang::Sema&, bool, bool) + 514                                                                                                                                                                                                                                                                    frame #5: 0x00000001056d7b3b libclang-cpp.dylib`clang::FrontendAction::Execute() + 77                                                                                                                                                                                                                                                                              frame #6: 0x00000001056a2e51 libclang-cpp.dylib`clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 833                                                                                                                                                                                                                                               frame #7: 0x00000001057252bf libclang-cpp.dylib`clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 1299
  frame #8: 0x00000001001bf8bb zig`cc1_main(llvm::ArrayRef<char const*>, char const*, void*) + 1781                                                                                                                                                                                                                                                                  frame #9: 0x00000001001be8e2 zig`ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&) + 264                                                                                                                                                                                                                                                                         frame #10: 0x00000001054ac395 libclang-cpp.dylib`void llvm::function_ref<void ()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*, bool*) const::$_1>(long) + 23                                                          frame #11: 0x0000000106e0d25c libLLVM.dylib`llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) + 218                                                                                                                                                                                                                                               frame #12: 0x00000001054aba93 libclang-cpp.dylib`clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*, bool*) const + 235                                                                                                                   frame #13: 0x000000010548c99c libclang-cpp.dylib`clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&) const + 526
  frame #14: 0x000000010548cb79 libclang-cpp.dylib`clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::__1::pair<int, clang::driver::Command const*> >&) const + 95
  frame #15: 0x000000010549b45c libclang-cpp.dylib`clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::__1::pair<int, clang::driver::Command const*> >&) + 210
  frame #16: 0x00000001001be462 zig`ZigClang_main + 6796
  frame #17: 0x0000000100002ee0 zig`main + 37
  frame #18: 0x00007fff6c97f7fd libdyld.dylib`start + 1
  frame #19: 0x00007fff6c97f7fd libdyld.dylib`start + 1
(lldb) fin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment