Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Catch ctrl-c to get current backtrace for debugging stuck #2033

Closed
waruqi opened this issue Feb 8, 2022 · 0 comments
Closed

Catch ctrl-c to get current backtrace for debugging stuck #2033

waruqi opened this issue Feb 8, 2022 · 0 comments

Comments

@waruqi
Copy link
Member

waruqi commented Feb 8, 2022

#2032

Get current stuck backtrace

We set XMAKE_PROFILE=stuck to enable this feature.

test.lua

function main()
    io.read()
end
$ XMAKE_PROFILE=stuck xmake l test.lua
<Ctrl+C>
stack traceback:
        [C]: in function 'base/io.file_read'
        @programdir/core/base/io.lua:177: in method '_read'
        @programdir/core/sandbox/modules/io.lua:90: in function <@programdir/core/sandbox/module
s/io.lua:89>
        (...tail calls...)
        /Users/ruki/share/test.lua:2: in function </Users/ruki/share/test.lua:1>
        (...tail calls...)
        @programdir/plugins/lua/main.lua:123: in function <@programdir/plugins/lua/main.lua:79>
        (...tail calls...)
        [C]: in function 'xpcall'
        @programdir/core/base/utils.lua:280: in function 'sandbox/modules/utils.trycall'
        (...tail calls...)
        @programdir/core/base/task.lua:519: in function 'base/task.run'
        @programdir/core/main.lua:278: in upvalue 'cotask'
        @programdir/core/base/scheduler.lua:371: in function <@programdir/core/base/scheduler.lu
a:368>

Trace process

$ XMAKE_PROFILE=stuck xmake f -c
<subprocess: sysctl>: /usr/sbin/sysctl -n machdep.cpu.vendor machdep.cpu.model machdep.cpu.famil
y machdep.cpu.features machdep.cpu.brand_string
checking for platform ... macosx
checking for architecture ... x86_64
<subprocess: security>: /usr/bin/security find-identity
checking for Xcode directory ... /Applications/Xcode.app
checking for Codesign Identity of Xcode ... Apple Development: waruqi@gmail.com (T3NA4MRVPU)
<subprocess: sw_vers>: sw_vers -productVersion
checking for SDK version of Xcode for macosx (x86_64) ... 11.3
checking for Minimal target version of Xcode for macosx (x86_64) ... 11.4
<subprocess: which>: which dmd
<subprocess: dmd>: /usr/local/bin/dmd --version
<subprocess: which>: which zig
<subprocess: zig>: /usr/local/bin/zig version
<subprocess: which>: which "xcrun -sdk macosx clang"
^C[xmake]: [engine]: stack traceback:
        @programdir/core/base/scheduler.lua:429: in function 'base/scheduler.co_suspend'
        @programdir/core/base/scheduler.lua:465: in function 'base/scheduler.co_sleep'
        (...tail calls...)
        ...mdir/core/sandbox/modules/import/core/base/scheduler.lua:73: in function 'sandbox/mod
ules/import/core/base/scheduler.co_yield'
        .../core/sandbox/modules/import/lib/detect/find_program.lua:266: in function <.../core/s
andbox/modules/import/lib/detect/find_program.lua:260>
        (...tail calls...)
        @programdir/modules/detect/tools/find_clang.lua:44: in function <@programdir/modules/det
ect/tools/find_clang.lua:38>
        (...tail calls...)
        @programdir/modules/lib/detect/find_tool.lua:33: in global '_find_from_modules'
        @programdir/modules/lib/detect/find_tool.lua:48: in global '_find_tool'
        @programdir/modules/lib/detect/find_tool.lua:100: in function <@programdir/modules/lib/d
etect/find_tool.lua:93>
        (...tail calls...)
        @programdir/core/tool/toolchain.lua:425: in method '_checktool'
        @programdir/core/tool/toolchain.lua:193: in method 'tool'
        ...     (skipping 12 levels)
        @programdir/core/project/option.lua:170: in method '_do_check_cxsnippets'
        @programdir/core/project/option.lua:223: in function <@programdir/core/project/option.lu
a:220>
        (...tail calls...)
        @programdir/core/project/option.lua:271: in method '_check'
        @programdir/core/project/option.lua:328: in method 'check'
        ...dir/core/sandbox/modules/import/core/project/project.lua:106: in upvalue 'jobfunc'
        @programdir/modules/private/async/runjobs.lua:208: in function <@programdir/modules/priv
ate/async/runjobs.lua:202>
        [C]: in function 'xpcall'
        @programdir/core/base/utils.lua:280: in function 'base/utils.trycall'
        @programdir/core/sandbox/modules/try.lua:121: in global 'try'
        @programdir/modules/private/async/runjobs.lua:200: in upvalue 'cotask'
        @programdir/core/base/scheduler.lua:371: in function <@programdir/core/base/scheduler.lu
a:368>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant