[Lldb-commits] [PATCH] D65363: [lldb-vscode] add `launchCommands` to handle launch specific commands

2019-11-04 Thread Wanyi Ye via Phabricator via lldb-commits
kusmour marked an inline comment as done.
kusmour added inline comments.



Comment at: lldb/trunk/tools/lldb-vscode/lldb-vscode.cpp:1280
   // Reenable async events and start the event thread to catch async events.
-  g_vsc.debugger.SetAsync(true);
+  // g_vsc.debugger.SetAsync(true);
 }

wallace wrote:
> was this intentional?
ohh yes, it should be deleted


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D65363/new/

https://reviews.llvm.org/D65363



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D65363: [lldb-vscode] add `launchCommands` to handle launch specific commands

2019-11-04 Thread walter erquinigo via Phabricator via lldb-commits
wallace added inline comments.



Comment at: lldb/trunk/tools/lldb-vscode/lldb-vscode.cpp:1280
   // Reenable async events and start the event thread to catch async events.
-  g_vsc.debugger.SetAsync(true);
+  // g_vsc.debugger.SetAsync(true);
 }

was this intentional?


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D65363/new/

https://reviews.llvm.org/D65363



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D65363: [lldb-vscode] add `launchCommands` to handle launch specific commands

2019-08-19 Thread Alex Langford via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL369296: [lldb-vscode] add `launchCommands` to handle launch 
specific commands (authored by xiaobai, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D65363?vs=212683=215971#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D65363/new/

https://reviews.llvm.org/D65363

Files:
  
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-vscode/launch/TestVSCode_launch.py
  
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py
  lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py
  lldb/trunk/tools/lldb-vscode/lldb-vscode.cpp

Index: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py
===
--- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py
+++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py
@@ -245,20 +245,17 @@
 self.assertTrue(response['success'],
 'attach failed (%s)' % (response['message']))
 
-def build_and_launch(self, program, args=None, cwd=None, env=None,
- stopOnEntry=False, disableASLR=True,
- disableSTDIO=False, shellExpandArguments=False,
- trace=False, initCommands=None, preRunCommands=None,
- stopCommands=None, exitCommands=None,
- sourcePath=None, debuggerRoot=None):
-'''Build the default Makefile target, create the VSCode debug adaptor,
-   and launch the process.
+def launch(self, program=None, args=None, cwd=None, env=None,
+   stopOnEntry=False, disableASLR=True,
+   disableSTDIO=False, shellExpandArguments=False,
+   trace=False, initCommands=None, preRunCommands=None,
+   stopCommands=None, exitCommands=None,sourcePath= None,
+   debuggerRoot=None, launchCommands=None):
+'''Sending launch request to vscode
 '''
-self.build_and_create_debug_adaptor()
-self.assertTrue(os.path.exists(program), 'executable must exist')
 
-# Make sure we disconnect and terminate the VSCode debug adaptor even
-# if we throw an exception during the test case.
+# Make sure we disconnet and terminate the VSCode debug adaptor,
+# if we throw an exception during the test case
 def cleanup():
 self.vscode.request_disconnect(terminateDebuggee=True)
 self.vscode.terminate()
@@ -283,7 +280,25 @@
 stopCommands=stopCommands,
 exitCommands=exitCommands,
 sourcePath=sourcePath,
-debuggerRoot=debuggerRoot)
+debuggerRoot=debuggerRoot,
+launchCommands=launchCommands)
 if not (response and response['success']):
 self.assertTrue(response['success'],
 'launch failed (%s)' % (response['message']))
+
+def build_and_launch(self, program, args=None, cwd=None, env=None,
+ stopOnEntry=False, disableASLR=True,
+ disableSTDIO=False, shellExpandArguments=False,
+ trace=False, initCommands=None, preRunCommands=None,
+ stopCommands=None, exitCommands=None,
+ sourcePath=None, debuggerRoot=None):
+'''Build the default Makefile target, create the VSCode debug adaptor,
+   and launch the process.
+'''
+self.build_and_create_debug_adaptor()
+self.assertTrue(os.path.exists(program), 'executable must exist')
+
+self.launch(program, args, cwd, env, stopOnEntry, disableASLR,
+disableSTDIO, shellExpandArguments, trace,
+initCommands, preRunCommands, stopCommands, exitCommands,
+sourcePath, debuggerRoot)
Index: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py
===
--- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py
+++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py
@@ -558,7 +558,7 @@
disableSTDIO=False, shellExpandArguments=False,
trace=False, initCommands=None, preRunCommands=None,
stopCommands=None, exitCommands=None, sourcePath=None,
-   debuggerRoot=None):
+   debuggerRoot=None, launchCommands=None):
 args_dict = {
 'program': program
 }
@@ -591,6 +591,8 @@
 args_dict['sourcePath'] = sourcePath
 if debuggerRoot:
 args_dict['debuggerRoot'] = debuggerRoot
+ 

[Lldb-commits] [PATCH] D65363: [lldb-vscode] add `launchCommands` to handle launch specific commands

2019-07-31 Thread Wanyi Ye via Phabricator via lldb-commits
kusmour updated this revision to Diff 212683.
kusmour added a comment.

complete the corresponding test for extra `launchCommands`


Repository:
  rLLDB LLDB

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D65363/new/

https://reviews.llvm.org/D65363

Files:
  
lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/launch/TestVSCode_launch.py
  lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py
  lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py
  lldb/tools/lldb-vscode/lldb-vscode.cpp

Index: lldb/tools/lldb-vscode/lldb-vscode.cpp
===
--- lldb/tools/lldb-vscode/lldb-vscode.cpp
+++ lldb/tools/lldb-vscode/lldb-vscode.cpp
@@ -1180,6 +1180,7 @@
   g_vsc.pre_run_commands = GetStrings(arguments, "preRunCommands");
   g_vsc.stop_commands = GetStrings(arguments, "stopCommands");
   g_vsc.exit_commands = GetStrings(arguments, "exitCommands");
+  auto launchCommands = GetStrings(arguments, "launchCommands");
   g_vsc.stop_at_entry = GetBoolean(arguments, "stopOnEntry", false);
   const auto debuggerRoot = GetString(arguments, "debuggerRoot");
 
@@ -1252,11 +1253,19 @@
 
   // Run any pre run LLDB commands the user specified in the launch.json
   g_vsc.RunPreRunCommands();
+  if (launchCommands.empty()) {
+// Disable async events so the launch will be successful when we return from
+// the launch call and the launch will happen synchronously
+g_vsc.debugger.SetAsync(false);
+g_vsc.target.Launch(g_vsc.launch_info, error);
+g_vsc.debugger.SetAsync(true);
+  } else {
+g_vsc.RunLLDBCommands("Running launchCommands:", launchCommands);
+// The custom commands might have created a new target so we should use the
+// selected target after these commands are run.
+g_vsc.target = g_vsc.debugger.GetSelectedTarget();
+  }
 
-  // Disable async events so the launch will be successful when we return from
-  // the launch call and the launch will happen synchronously
-  g_vsc.debugger.SetAsync(false);
-  g_vsc.target.Launch(g_vsc.launch_info, error);
   if (error.Fail()) {
 response["success"] = llvm::json::Value(false);
 EmplaceSafeString(response, "message", std::string(error.GetCString()));
@@ -1266,7 +1275,7 @@
   SendProcessEvent(Launch);
   g_vsc.SendJSON(llvm::json::Value(CreateEventObject("initialized")));
   // Reenable async events and start the event thread to catch async events.
-  g_vsc.debugger.SetAsync(true);
+  // g_vsc.debugger.SetAsync(true);
 }
 
 // "NextRequest": {
Index: lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py
===
--- lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py
+++ lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py
@@ -558,7 +558,7 @@
disableSTDIO=False, shellExpandArguments=False,
trace=False, initCommands=None, preRunCommands=None,
stopCommands=None, exitCommands=None, sourcePath=None,
-   debuggerRoot=None):
+   debuggerRoot=None, launchCommands=None):
 args_dict = {
 'program': program
 }
@@ -591,6 +591,8 @@
 args_dict['sourcePath'] = sourcePath
 if debuggerRoot:
 args_dict['debuggerRoot'] = debuggerRoot
+if launchCommands:
+args_dict['launchCommands'] = launchCommands
 command_dict = {
 'command': 'launch',
 'type': 'request',
Index: lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py
===
--- lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py
+++ lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py
@@ -245,20 +245,17 @@
 self.assertTrue(response['success'],
 'attach failed (%s)' % (response['message']))
 
-def build_and_launch(self, program, args=None, cwd=None, env=None,
- stopOnEntry=False, disableASLR=True,
- disableSTDIO=False, shellExpandArguments=False,
- trace=False, initCommands=None, preRunCommands=None,
- stopCommands=None, exitCommands=None,
- sourcePath=None, debuggerRoot=None):
-'''Build the default Makefile target, create the VSCode debug adaptor,
-   and launch the process.
+def launch(self, program=None, args=None, cwd=None, env=None,
+   stopOnEntry=False, disableASLR=True,
+   disableSTDIO=False, shellExpandArguments=False,
+   trace=False, initCommands=None, preRunCommands=None,
+   stopCommands=None, exitCommands=None,sourcePath= None,
+   debuggerRoot=None, launchCommands=None):
+'''Sending launch request to 

[Lldb-commits] [PATCH] D65363: [lldb-vscode] add `launchCommands` to handle launch specific commands

2019-07-26 Thread Wanyi Ye via Phabricator via lldb-commits
kusmour created this revision.
kusmour added a reviewer: xiaobai.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

This can help `lldb-vscode` handle launch commands associate with remote 
platform
attach request have field `attachCommands` to handle attach specific commands
add a corresponding one for launch request
if no launch command is provided, create a new target and launch; otherwise, 
execute the launch command


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D65363

Files:
  lldb/tools/lldb-vscode/lldb-vscode.cpp


Index: lldb/tools/lldb-vscode/lldb-vscode.cpp
===
--- lldb/tools/lldb-vscode/lldb-vscode.cpp
+++ lldb/tools/lldb-vscode/lldb-vscode.cpp
@@ -1180,6 +1180,7 @@
   g_vsc.pre_run_commands = GetStrings(arguments, "preRunCommands");
   g_vsc.stop_commands = GetStrings(arguments, "stopCommands");
   g_vsc.exit_commands = GetStrings(arguments, "exitCommands");
+  auto launchCommands = GetStrings(arguments, "launchCommands");
   g_vsc.stop_at_entry = GetBoolean(arguments, "stopOnEntry", false);
   const auto debuggerRoot = GetString(arguments, "debuggerRoot");
 
@@ -1252,11 +1253,19 @@
 
   // Run any pre run LLDB commands the user specified in the launch.json
   g_vsc.RunPreRunCommands();
-
-  // Disable async events so the launch will be successful when we return from
-  // the launch call and the launch will happen synchronously
   g_vsc.debugger.SetAsync(false);
-  g_vsc.target.Launch(g_vsc.launch_info, error);
+  if (launchCommands.empty()) {
+// Disable async events so the launch will be successful when we return 
from
+// the launch call and the launch will happen synchronously
+g_vsc.target.Launch(g_vsc.launch_info, error);
+// g_vsc.debugger.SetAsync(true);
+  } else {
+g_vsc.RunLLDBCommands("Running launchCommands:", launchCommands);
+// The custom commands might have created a new target so we should use the
+// selected target after these commands are run.
+g_vsc.target = g_vsc.debugger.GetSelectedTarget();
+  }
+
   if (error.Fail()) {
 response["success"] = llvm::json::Value(false);
 EmplaceSafeString(response, "message", std::string(error.GetCString()));


Index: lldb/tools/lldb-vscode/lldb-vscode.cpp
===
--- lldb/tools/lldb-vscode/lldb-vscode.cpp
+++ lldb/tools/lldb-vscode/lldb-vscode.cpp
@@ -1180,6 +1180,7 @@
   g_vsc.pre_run_commands = GetStrings(arguments, "preRunCommands");
   g_vsc.stop_commands = GetStrings(arguments, "stopCommands");
   g_vsc.exit_commands = GetStrings(arguments, "exitCommands");
+  auto launchCommands = GetStrings(arguments, "launchCommands");
   g_vsc.stop_at_entry = GetBoolean(arguments, "stopOnEntry", false);
   const auto debuggerRoot = GetString(arguments, "debuggerRoot");
 
@@ -1252,11 +1253,19 @@
 
   // Run any pre run LLDB commands the user specified in the launch.json
   g_vsc.RunPreRunCommands();
-
-  // Disable async events so the launch will be successful when we return from
-  // the launch call and the launch will happen synchronously
   g_vsc.debugger.SetAsync(false);
-  g_vsc.target.Launch(g_vsc.launch_info, error);
+  if (launchCommands.empty()) {
+// Disable async events so the launch will be successful when we return from
+// the launch call and the launch will happen synchronously
+g_vsc.target.Launch(g_vsc.launch_info, error);
+// g_vsc.debugger.SetAsync(true);
+  } else {
+g_vsc.RunLLDBCommands("Running launchCommands:", launchCommands);
+// The custom commands might have created a new target so we should use the
+// selected target after these commands are run.
+g_vsc.target = g_vsc.debugger.GetSelectedTarget();
+  }
+
   if (error.Fail()) {
 response["success"] = llvm::json::Value(false);
 EmplaceSafeString(response, "message", std::string(error.GetCString()));
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits