MCPcopy Create free account
hub / github.com/EmmyLua/EmmyLuaDebugger / main

Function main

emmy_tool/src/main.cpp:7–67  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5#include <thread>
6
7int main(int argc, char **argv) {
8 CommandLine commandLine;
9 commandLine.AddTarget("attach");
10 commandLine.AddTarget("list_processes");
11 commandLine.AddTarget("arch_file", false);
12 commandLine.AddTarget("arch_pid", false);
13 commandLine.AddTarget("launch");
14 commandLine.AddTarget("receive_log");
15
16 // pid
17 commandLine.Add<int>("p");
18 // dir
19 commandLine.Add<std::string>("dir");
20 // dll
21 commandLine.Add<std::string>("dll");
22 // exe
23 commandLine.Add<std::string>("exe");
24 // work space
25 commandLine.Add<std::string>("work");
26 // stop on process exit
27 commandLine.Add<bool>("block-on-exit");
28 commandLine.Add<int>("debug-port");
29 commandLine.Add<bool>("listen-mode");
30 commandLine.Add<bool>("create-new-window");
31 // rest param
32 commandLine.Add<std::string>("args", true);
33 commandLine.Add<bool>("capture-log");
34 commandLine.Add<bool>("unitbuf");
35
36 if (!commandLine.Parse(argc, argv)) {
37 printf("parse fail");
38 return -1;
39 }
40 EmmyTool tool(commandLine);
41 const std::string target = commandLine.GetTarget();
42 if (target == "attach") {
43 //emmy_tool.exe attach -p 100 -dir c:/xx -dll emmy_hook.dll
44 return tool.Attach();
45 }
46 if (target == "list_processes") {
47 //emmy_tool.exe list_processes
48 return tool.ListProcesses();
49 }
50 if (target == "arch_file") {
51 //emmy_tool.exe arch_file FILE_PATH
52 return tool.ArchFile();
53 }
54 if (target == "arch_pid") {
55 //emmy_tool.exe arch_pid PROCESS_ID
56 return tool.ArchPid();
57 }
58 if (target == "launch") {
59 //emmy_tool.exe run_and_attach -dir c:/xx -dll emmy_hook.dll -work d:fff/ -exe c:/lua/lua.exe -args test.lua
60 return tool.Launch();
61 }
62 if (target == "receive_log") {
63 return tool.ReceiveLog();
64 }

Callers

nothing calls this directly

Calls 9

AddTargetMethod · 0.80
ParseMethod · 0.80
GetTargetMethod · 0.80
ListProcessesMethod · 0.80
ArchFileMethod · 0.80
ArchPidMethod · 0.80
LaunchMethod · 0.80
ReceiveLogMethod · 0.80
AttachMethod · 0.45

Tested by

no test coverage detected