In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-12 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
Xmake in how to run and debug the target program, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain for you in detail, people with this need can come to learn, I hope you can gain something.
Xmake is a lightweight and modern Lua-based project construction tool for cAccessPlus. Its main features are simple syntax, easy to use, more readable project maintenance, and consistent cross-platform behavior.
Run build target
Xmake also provides the run command to run the generated executable file directly for convenient and quick testing, such as:
$xmake run
Hello xmake!
Add run environment variables
We can also add environment variables that set the default running target program through the add_runenvs interface in xmake.lua.
Therefore, for PATH, it is very convenient to add values through this interface, and this interface supports multi-value settings, so it is usually used to set multi-valued env with path sep.
Target ("test")
Set_kind ("binary")
Add_files ("src/*.c")
Add_runenvs ("PATH", "/ tmp/bin", "xxx/bin")
Add_runenvs ("LD_LIBRARY_PATH", "/ tmp/lib", "xxx/lib")
For more information on this interface, see the documentation: add_runenvs interface documentation.
Custom running logic
If the simple environment settings and the default loading and running rules do not meet the requirements, we can implement more complex running logic by customizing the on_run script:
For example, run the installed apk program:
Target ("test")
-.
-- set custom run scripts, automatically run installed app programs, and automatically obtain device output information
On_run (function (target))
Os.run ("adb shell am start-n com.demo/com.demo.DemoTest")
Os.run ("adb logcat")
End)
Debugger command line debugging
We can also pass the-d parameter, call debugger programs such as gdb/lldb, and load the object file for debugging:
$xmake run-d
Xmake will use the system's own debugger to load the program to run, currently supports: lldb, gdb, windbg, vsjitdebugger, ollydbg and other debuggers.
[lldb] $target create "build/hello"
Current executable set to 'build/hello' (x86' 64).
[lldb] $b main
Breakpoint 1: where = hello`main, address = 0x0000000100000f50
[lldb] $r
Process 7509 launched:'/ private/tmp/hello/build/hello' (x86 / 64)
Process 7509 stopped
* thread # 1: tid = 0x435a2, 0x0000000100000f50 Hello`main, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
Frame # 0: 0x0000000100000f50 Hello`main
Hello`main:
-> 0x100000f50: pushq% rbp
0x100000f51: movq% rsp,% rbp
0x100000f54: leaq 0x2b (% rip),% rdi; "hello world!"
0x100000f5b: callq 0x100000f64; symbol stub for: puts
[lldb] $
Using vscode for breakpoint debugging
We can also use the xmake-vscode plug-in in conjunction with vscode to implement breakpoint debugging support for the cmax cymbal + project.
In addition, we also need to rely on vscode's C++ plug-in for debugging support, but this plug-in is almost necessary due to the development of the cUnix censor + program, so it's not a big problem.
Even if the plug-in is not installed, xmake-vscode will load system debuggers such as lldb/gdb/vsjitdebugger to load and debug directly.
Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.