From 143bfb465af68ec29d4887d67a7f1f57b53c0747 Mon Sep 17 00:00:00 2001 From: ruki Date: Sat, 21 May 2016 13:30:20 +0800 Subject: add backtrace option --- xmake/core/project/task.lua | 11 ++++++----- xmake/core/sandbox/modules/coroutine.lua | 2 +- xmake/core/sandbox/sandbox.lua | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/xmake/core/project/task.lua b/xmake/core/project/task.lua index d695c9c83..672df88b0 100644 --- a/xmake/core/project/task.lua +++ b/xmake/core/project/task.lua @@ -128,16 +128,17 @@ function task._translate_menu(menu) end -- add common options - table.insert(options, 1, {'v', "verbose", "k", nil, "Print lots of verbose information." }) - table.insert(options, 2, {nil, "version", "k", nil, "Print the version number and exit." }) - table.insert(options, 3, {'h', "help", "k", nil, "Print this help message and exit." }) + table.insert(options, 1, {'v', "verbose", "k", nil, "Print lots of verbose information." }) + table.insert(options, 1, {'b', "backtrace", "k", nil, "Print backtrace information for debugging." }) + table.insert(options, 2, {nil, "version", "k", nil, "Print the version number and exit." }) + table.insert(options, 3, {'h', "help", "k", nil, "Print this help message and exit." }) table.insert(options, 4, {}) - table.insert(options, 5, {'f', "file", "kv", nil, "Read a given xmake.lua file." }) + table.insert(options, 5, {'f', "file", "kv", nil, "Read a given xmake.lua file." }) table.insert(options, 6, {'P', "project", "kv", nil, "Change to the given project directory." , "Search priority:" , " 1. The Given Command Argument" , " 2. The Envirnoment Variable: XMAKE_PROJECT_DIR" - , " 3. The Current Directory" }) + , " 3. The Current Directory" }) table.insert(options, 7, {}) end diff --git a/xmake/core/sandbox/modules/coroutine.lua b/xmake/core/sandbox/modules/coroutine.lua index a704af6c3..f01506cfa 100644 --- a/xmake/core/sandbox/modules/coroutine.lua +++ b/xmake/core/sandbox/modules/coroutine.lua @@ -43,7 +43,7 @@ function sandbox_coroutine.resume(co, ...) -- get errors local errors = results - if option.get("verbose") then + if option.get("backtrace") then errors = debug.traceback(co, results) elseif type(results) == "string" then -- remove the prefix info diff --git a/xmake/core/sandbox/sandbox.lua b/xmake/core/sandbox/sandbox.lua index c4da87b05..64729bf7f 100644 --- a/xmake/core/sandbox/sandbox.lua +++ b/xmake/core/sandbox/sandbox.lua @@ -35,7 +35,7 @@ local option = require("base/option") function sandbox._traceback(errors) -- not verbose? - if not option.get("verbose") then + if not option.get("backtrace") then if errors then -- remove the prefix info local _, pos = errors:find(":%d+: ") -- cgit v1.3.1