TBOOX

Running and debugging program using xmake

2016-07-25

xmake can run and debug the given target program now.

We only need configure the debug mode to compile this target and run it.

e.g.


-- enable debug symbols
if is_mode("debug")
    set_symbols("debug")
end

-- define target
target("demo")
    set_kind("kind")
    add_files("src/*.c")

And we compile and run this program with the debug symbols.

$ xmake f -m debug
$ xmake r -d demo

It will generate pdb debug symbol files and detect the default debugger automatically on windows. (.e.g vsjitdebugger, windbg, ollydbg …)

vsjitdebugger

ollydbg

And we can set the given third-party debugger manually.

$ xmake f --dd="C:\Program Files\Debugging Tools for Windows (x86)\windbg.exe"
$ xmake r -d demo 

Or we set it to the global configuration.

$ xmake g --dd="C:\Program Files\Debugging Tools for Windows (x86)\windbg.exe"

xmake will load the debugger (lldb or gdb ..) to debug program in default case on macosx and linux.

$ xmake r -d demo

$ [lldb]$target create "build/demo"
  Current executable set to 'build/demo' (x86_64).
$ [lldb]$

中文

Similar Posts

Comments



Links