Re: [Lldb-commits] [PATCH] D11323: Initialize variable to prevent garbage values (RenderScriptRuntime)

2015-07-24 Thread Ewan Crawford
This revision was automatically updated to reflect the committed changes.
Closed by commit rL243104: Initialize variable to prevent garbage values 
(RenderScriptRuntime) (authored by EwanCrawford).

Changed prior to commit:
  http://reviews.llvm.org/D11323?vs=30064&id=30567#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D11323

Files:
  
lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp

Index: 
lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
===
--- 
lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
+++ 
lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
@@ -776,7 +776,7 @@
 return;
 }
 
-bool kernels_found;
+bool kernels_found = false;
 ConstString kernel_name(name);
 for (const auto &module : m_rsmodules)
 {


Index: lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
===
--- lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
+++ lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
@@ -776,7 +776,7 @@
 return;
 }
 
-bool kernels_found;
+bool kernels_found = false;
 ConstString kernel_name(name);
 for (const auto &module : m_rsmodules)
 {
___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r243104 - Initialize variable to prevent garbage values (RenderScriptRuntime)

2015-07-24 Thread Ewan Crawford
Author: ewancrawford
Date: Fri Jul 24 05:01:11 2015
New Revision: 243104

URL: http://llvm.org/viewvc/llvm-project?rev=243104&view=rev
Log:
Initialize variable to prevent garbage values (RenderScriptRuntime)

The kernels_found variable is not initialized, so if it is not assigned true on 
line 823, then it will be a garbage value in the branch condition on line 828. 
This patch initializes the variable to false. 

Patch by neilparikh.

Reviewers: domipheus
Differential Revision: http://reviews.llvm.org/D11323

Modified:

lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp

Modified: 
lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp?rev=243104&r1=243103&r2=243104&view=diff
==
--- 
lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
 (original)
+++ 
lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
 Fri Jul 24 05:01:11 2015
@@ -776,7 +776,7 @@ RenderScriptRuntime::AttemptBreakpointAt
 return;
 }
 
-bool kernels_found;
+bool kernels_found = false;
 ConstString kernel_name(name);
 for (const auto &module : m_rsmodules)
 {


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r242143 - Fix LLDB Xcode build broken in r242137

2015-07-14 Thread Ewan Crawford
Author: ewancrawford
Date: Tue Jul 14 08:29:03 2015
New Revision: 242143

URL: http://llvm.org/viewvc/llvm-project?rev=242143&view=rev
Log:
Fix LLDB Xcode build broken in r242137

Modified:
lldb/trunk/lldb.xcodeproj/project.pbxproj

Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=242143&r1=242142&r2=242143&view=diff
==
--- lldb/trunk/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/trunk/lldb.xcodeproj/project.pbxproj Tue Jul 14 08:29:03 2015
@@ -861,6 +861,7 @@
E7723D4C1AC4A944002BA082 /* RegisterContextPOSIX_arm64.cpp in 
Sources */ = {isa = PBXBuildFile; fileRef = E7723D4A1AC4A944002BA082 /* 
RegisterContextPOSIX_arm64.cpp */; };
E778E9A21B062D1700247609 /* EmulateInstructionMIPS.cpp in 
Sources */ = {isa = PBXBuildFile; fileRef = E778E99F1B062D1700247609 /* 
EmulateInstructionMIPS.cpp */; };
E7E94ABC1B54961F00D0AE30 /* GDBRemoteSignals.cpp in Sources */ 
= {isa = PBXBuildFile; fileRef = E73A15A41B548EC500786197 /* 
GDBRemoteSignals.cpp */; };
+   EB8375E71B553DE800BA907D /* ThreadPlanCallFunctionUsingABI.cpp 
in Sources */ = {isa = PBXBuildFile; fileRef = EB8375E61B553DE800BA907D /* 
ThreadPlanCallFunctionUsingABI.cpp */; };
ED88244E15114A9200BC98B9 /* Security.framework in Frameworks */ 
= {isa = PBXBuildFile; fileRef = EDB919B414F6F10D008FF64B /* Security.framework 
*/; };
ED88245015114CA200BC98B9 /* main.mm in Sources */ = {isa = 
PBXBuildFile; fileRef = ED88244F15114CA200BC98B9 /* main.mm */; };
ED88245115114CA200BC98B9 /* main.mm in Sources */ = {isa = 
PBXBuildFile; fileRef = ED88244F15114CA200BC98B9 /* main.mm */; };
@@ -2689,8 +2690,8 @@
E7723D4B1AC4A944002BA082 /* RegisterContextPOSIX_arm64.h */ = 
{isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; 
name = RegisterContextPOSIX_arm64.h; path = 
Utility/RegisterContextPOSIX_arm64.h; sourceTree = ""; };
E778E99F1B062D1700247609 /* EmulateInstructionMIPS.cpp */ = 
{isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = 
sourcecode.cpp.cpp; path = EmulateInstructionMIPS.cpp; sourceTree = ""; 
};
E778E9A01B062D1700247609 /* EmulateInstructionMIPS.h */ = {isa 
= PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path 
= EmulateInstructionMIPS.h; sourceTree = ""; };
-   EBDD01241B39B62F00E04792 /* ThreadPlanCallFunctionUsingABI.cpp 
*/ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = 
sourcecode.cpp.cpp; name = ThreadPlanCallFunctionUsingABI.cpp; path = 
source/Target/ThreadPlanCallFunctionUsingABI.cpp; sourceTree = ""; };
-   EBDD01261B39B66700E04792 /* ThreadPlanCallFunctionUsingABI.h */ 
= {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = 
ThreadPlanCallFunctionUsingABI.h; path = 
include/lldb/Target/ThreadPlanCallFunctionUsingABI.h; sourceTree = ""; };
+   EB8375E61B553DE800BA907D /* ThreadPlanCallFunctionUsingABI.cpp 
*/ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = 
sourcecode.cpp.cpp; name = ThreadPlanCallFunctionUsingABI.cpp; path = 
source/Target/ThreadPlanCallFunctionUsingABI.cpp; sourceTree = ""; };
+   EB8375E81B553DFE00BA907D /* ThreadPlanCallFunctionUsingABI.h */ 
= {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = 
ThreadPlanCallFunctionUsingABI.h; path = 
include/lldb/Target/ThreadPlanCallFunctionUsingABI.h; sourceTree = ""; };
ED88244F15114CA200BC98B9 /* main.mm */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; 
path = main.mm; sourceTree = ""; };
ED88245215114CFC00BC98B9 /* LauncherRootXPCService.mm */ = {isa 
= PBXFileReference; fileEncoding = 4; lastKnownFileType = 
sourcecode.cpp.objcpp; path = LauncherRootXPCService.mm; sourceTree = 
""; };
EDB919B214F6EC85008FF64B /* LauncherXPCService.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = 
LauncherXPCService.h; sourceTree = ""; };
@@ -4524,8 +4525,6 @@
26BC7DEF10F1B80200F91463 /* Target */ = {
isa = PBXGroup;
children = (
-   EBDD01261B39B66700E04792 /* 
ThreadPlanCallFunctionUsingABI.h */,
-   EBDD01241B39B62F00E04792 /* 
ThreadPlanCallFunctionUsingABI.cpp */,
8CF02AE019DCBF3B00B14BE0 /* 
InstrumentationRuntime.h */,
8CF02ADF19DCBF3B00B14BE0 /* 
InstrumentationRuntime.cpp */,
8CF02AEE19DD15CF00B14BE0 /* 
InstrumentationRuntimeStopInfo.h */,
@@ -4604,6 +4603,8 @@
260C847110F50EFC00BB2B04 /* ThreadPlanBase.cpp 
*/

[Lldb-commits] [lldb] r242137 - Expression evaluation, a new ThreadPlanCallFunctionUsingABI for executing a function call on target via register manipulation

2015-07-14 Thread Ewan Crawford
Author: ewancrawford
Date: Tue Jul 14 05:56:58 2015
New Revision: 242137

URL: http://llvm.org/viewvc/llvm-project?rev=242137&view=rev
Log:
Expression evaluation, a new ThreadPlanCallFunctionUsingABI for executing a 
function call on target via register manipulation

For Hexagon we want to be able to call functions during debugging, however 
currently lldb only supports this when there is JIT support. 
Although emulation using IR interpretation is an alternative, it is currently 
limited in that it can't make function calls.

In this patch we have extended the IR interpreter so that it can execute a 
function call on the target using register manipulation. 
To do this we need to handle the Call IR instruction, passing arguments to a 
new thread plan and collecting any return values to pass back into the IR 
interpreter. 

The new thread plan is needed to call an alternative ABI interface of 
"ABI::PerpareTrivialCall()", allowing more detailed information about arguments 
and return values.

Reviewers: jingham, spyffe

Subscribers: emaste, lldb-commits, ted, ADodds, deepak2427

Differential Revision: http://reviews.llvm.org/D9404

Added:
lldb/trunk/include/lldb/Target/ThreadPlanCallFunctionUsingABI.h
lldb/trunk/source/Target/ThreadPlanCallFunctionUsingABI.cpp

lldb/trunk/test/expression_command/call-function/TestCallUserDefinedFunction.py
Modified:
lldb/trunk/include/lldb/Expression/IRInterpreter.h
lldb/trunk/include/lldb/Expression/IRMemoryMap.h
lldb/trunk/include/lldb/Target/ABI.h
lldb/trunk/include/lldb/Target/Process.h
lldb/trunk/include/lldb/Target/ThreadPlanCallFunction.h
lldb/trunk/lldb.xcodeproj/project.pbxproj
lldb/trunk/source/Expression/ClangExpressionParser.cpp
lldb/trunk/source/Expression/ClangUserExpression.cpp
lldb/trunk/source/Expression/IRInterpreter.cpp
lldb/trunk/source/Expression/IRMemoryMap.cpp
lldb/trunk/source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.cpp

lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp

lldb/trunk/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp
lldb/trunk/source/Target/CMakeLists.txt
lldb/trunk/source/Target/Process.cpp
lldb/trunk/source/Target/ThreadPlanCallFunction.cpp
lldb/trunk/test/expression_command/call-function/main.cpp

Modified: lldb/trunk/include/lldb/Expression/IRInterpreter.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/IRInterpreter.h?rev=242137&r1=242136&r2=242137&view=diff
==
--- lldb/trunk/include/lldb/Expression/IRInterpreter.h (original)
+++ lldb/trunk/include/lldb/Expression/IRInterpreter.h Tue Jul 14 05:56:58 2015
@@ -44,7 +44,8 @@ public:
 static bool
 CanInterpret (llvm::Module &module,
   llvm::Function &function,
-  lldb_private::Error &error);
+  lldb_private::Error &error,
+  const bool support_function_calls);
 
 static bool
 Interpret (llvm::Module &module,
@@ -53,7 +54,8 @@ public:
lldb_private::IRMemoryMap &memory_map,
lldb_private::Error &error,
lldb::addr_t stack_frame_bottom,
-   lldb::addr_t stack_frame_top);
+   lldb::addr_t stack_frame_top,
+   lldb_private::ExecutionContext &exe_ctx);
 
 private:   
 static bool

Modified: lldb/trunk/include/lldb/Expression/IRMemoryMap.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/IRMemoryMap.h?rev=242137&r1=242136&r2=242137&view=diff
==
--- lldb/trunk/include/lldb/Expression/IRMemoryMap.h (original)
+++ lldb/trunk/include/lldb/Expression/IRMemoryMap.h Tue Jul 14 05:56:58 2015
@@ -60,7 +60,7 @@ public:
 void ReadMemory (uint8_t *bytes, lldb::addr_t process_address, size_t 
size, Error &error);
 void ReadScalarFromMemory (Scalar &scalar, lldb::addr_t process_address, 
size_t size, Error &error);
 void ReadPointerFromMemory (lldb::addr_t *address, lldb::addr_t 
process_address, Error &error);
-
+bool GetAllocSize(lldb::addr_t address, size_t &size);
 void GetMemoryData (DataExtractor &extractor, lldb::addr_t 
process_address, size_t size, Error &error);
 
 lldb::ByteOrder GetByteOrder();

Modified: lldb/trunk/include/lldb/Target/ABI.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/ABI.h?rev=242137&r1=242136&r2=242137&view=diff
==
--- lldb/trunk/include/lldb/Target/ABI.h (original)
+++ lldb/trunk/include/lldb/Target/ABI.h Tue Jul 14 05:56:58 2015
@@ -39,10 +39,9 @@ public:
 };
 eType  type;/* value of eType */
 size_t size;/* size in bytes of this argument */
-union {
-lld

Re: [Lldb-commits] [PATCH] D9404: Expression evaluation, a new ThreadPlanCallFunctionNoJIT for executing a function call on target via register manipulation

2015-07-14 Thread Ewan Crawford
This revision was automatically updated to reflect the committed changes.
Closed by commit rL242137: Expression evaluation, a new 
ThreadPlanCallFunctionUsingABI for executing a… (authored by EwanCrawford).

Changed prior to commit:
  http://reviews.llvm.org/D9404?vs=29343&id=29661#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D9404

Files:
  lldb/trunk/include/lldb/Expression/IRInterpreter.h
  lldb/trunk/include/lldb/Expression/IRMemoryMap.h
  lldb/trunk/include/lldb/Target/ABI.h
  lldb/trunk/include/lldb/Target/Process.h
  lldb/trunk/include/lldb/Target/ThreadPlanCallFunction.h
  lldb/trunk/include/lldb/Target/ThreadPlanCallFunctionUsingABI.h
  lldb/trunk/lldb.xcodeproj/project.pbxproj
  lldb/trunk/source/Expression/ClangExpressionParser.cpp
  lldb/trunk/source/Expression/ClangUserExpression.cpp
  lldb/trunk/source/Expression/IRInterpreter.cpp
  lldb/trunk/source/Expression/IRMemoryMap.cpp
  lldb/trunk/source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.cpp
  
lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
  
lldb/trunk/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp
  lldb/trunk/source/Target/CMakeLists.txt
  lldb/trunk/source/Target/Process.cpp
  lldb/trunk/source/Target/ThreadPlanCallFunction.cpp
  lldb/trunk/source/Target/ThreadPlanCallFunctionUsingABI.cpp
  
lldb/trunk/test/expression_command/call-function/TestCallUserDefinedFunction.py
  lldb/trunk/test/expression_command/call-function/main.cpp

Index: lldb/trunk/source/Target/Process.cpp
===
--- lldb/trunk/source/Target/Process.cpp
+++ lldb/trunk/source/Target/Process.cpp
@@ -754,6 +754,7 @@
 m_force_next_event_delivery (false),
 m_last_broadcast_state (eStateInvalid),
 m_destroy_in_process (false),
+m_can_interpret_function_calls(false),
 m_can_jit(eCanJITDontKnow)
 {
 CheckInWithManager ();
@@ -3011,6 +3012,13 @@
 m_can_jit = (can_jit ? eCanJITYes : eCanJITNo);
 }
 
+void
+Process::SetCanRunCode (bool can_run_code)
+{
+SetCanJIT(can_run_code);
+m_can_interpret_function_calls = can_run_code;
+}
+
 Error
 Process::DeallocateMemory (addr_t ptr)
 {
Index: lldb/trunk/source/Target/CMakeLists.txt
===
--- lldb/trunk/source/Target/CMakeLists.txt
+++ lldb/trunk/source/Target/CMakeLists.txt
@@ -40,6 +40,7 @@
   ThreadPlan.cpp
   ThreadPlanBase.cpp
   ThreadPlanCallFunction.cpp
+  ThreadPlanCallFunctionUsingABI.cpp
   ThreadPlanCallUserExpression.cpp
   ThreadPlanPython.cpp
   ThreadPlanRunToAddress.cpp
Index: lldb/trunk/source/Target/ThreadPlanCallFunction.cpp
===
--- lldb/trunk/source/Target/ThreadPlanCallFunction.cpp
+++ lldb/trunk/source/Target/ThreadPlanCallFunction.cpp
@@ -147,15 +147,16 @@
 m_trap_exceptions (options.GetTrapExceptions()),
 m_function_addr (function),
 m_function_sp (0),
-m_return_type (return_type),
 m_takedown_done (false),
 m_should_clear_objc_exception_bp(false),
 m_should_clear_cxx_exception_bp (false),
-m_stop_address (LLDB_INVALID_ADDRESS)
+m_stop_address (LLDB_INVALID_ADDRESS),
+m_return_type (return_type)
 {
-lldb::addr_t start_load_addr;
-ABI *abi;
-lldb::addr_t function_load_addr;
+lldb::addr_t start_load_addr = LLDB_INVALID_ADDRESS;
+lldb::addr_t function_load_addr = LLDB_INVALID_ADDRESS;
+ABI *abi = nullptr;
+
 if (!ConstructorSetup (thread, abi, start_load_addr, function_load_addr))
 return;
 
@@ -171,6 +172,27 @@
 m_valid = true;
 }
 
+ThreadPlanCallFunction::ThreadPlanCallFunction(Thread &thread,
+   const Address &function,
+   const EvaluateExpressionOptions &options) :
+ThreadPlan(ThreadPlan::eKindCallFunction, "Call function plan", thread, eVoteNoOpinion, eVoteNoOpinion),
+m_valid(false),
+m_stop_other_threads(options.GetStopOthers()),
+m_unwind_on_error(options.DoesUnwindOnError()),
+m_ignore_breakpoints(options.DoesIgnoreBreakpoints()),
+m_debug_execution(options.GetDebug()),
+m_trap_exceptions(options.GetTrapExceptions()),
+m_function_addr(function),
+m_function_sp(0),
+m_takedown_done(false),
+m_should_clear_objc_exception_bp(false),
+m_should_clear_cxx_exception_bp(false),
+m_stop_address(LLDB_INVALID_ADDRESS),
+m_return_type(ClangASTType())
+{
+
+}
+
 ThreadPlanCallFunction::~ThreadPlanCallFunction ()
 {
 DoTakedown(PlanSucceeded());
@@ -222,13 +244,7 @@
 {
 if (success)
 {
-ProcessSP process_sp (m_thread.GetProcess());
-const ABI *abi = process_sp ? process_sp->GetABI().get() : NULL;
-if (abi && m_return_type.IsValid())
-{
-const bool persistent = false;
-m_return_valobj_sp = abi->GetReturnValueOb

Re: [Lldb-commits] [PATCH] D9404: Expression evaluation, a new ThreadPlanCallFunctionNoJIT for executing a function call on target via register manipulation

2015-07-09 Thread Ewan Crawford
EwanCrawford updated this revision to Diff 29343.
EwanCrawford added a comment.

To address that final point of not doing any code execution at all for certain 
targets. I used the CanJIT() idea to create a similar 
CanInterpretFunctionCalls() member function of Process.
This means that we can just pass the value of the 
m_can_interpret_function_calls variable to CanInterpret() instead of the Arch 
or execution context.

Since interpreting function calls is a special case for hexagon right now the 
value defaults to false, and is only set to true by the hexagon dynamic loader.

In the future though when more targets support this feature, 
CanInterpretFunctionCalls() would be enabled by default and then specifically 
disabled by targets. 
Using the example of the OSX kernel, which can't do any code execution, the 
patch explicitly sets jitting and interpreting function calls to false in the 
dynamic loader using an added CanRunCode() function.


Repository:
  rL LLVM

http://reviews.llvm.org/D9404

Files:
  include/lldb/Expression/IRInterpreter.h
  include/lldb/Expression/IRMemoryMap.h
  include/lldb/Target/ABI.h
  include/lldb/Target/Process.h
  include/lldb/Target/ThreadPlanCallFunction.h
  include/lldb/Target/ThreadPlanCallFunctionUsingABI.h
  lldb.xcodeproj/project.pbxproj
  source/Expression/ClangExpressionParser.cpp
  source/Expression/ClangUserExpression.cpp
  source/Expression/IRInterpreter.cpp
  source/Expression/IRMemoryMap.cpp
  source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.cpp
  source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
  source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp
  source/Target/CMakeLists.txt
  source/Target/Process.cpp
  source/Target/ThreadPlanCallFunction.cpp
  source/Target/ThreadPlanCallFunctionUsingABI.cpp
  test/expression_command/call-function/TestCallUserDefinedFunction.py
  test/expression_command/call-function/main.cpp

Index: test/expression_command/call-function/main.cpp
===
--- test/expression_command/call-function/main.cpp
+++ test/expression_command/call-function/main.cpp
@@ -1,5 +1,6 @@
 #include 
 #include 
+#include 
 
 struct Five
 {
@@ -14,6 +15,30 @@
 return my_five;
 }
 
+unsigned int
+fib(unsigned int n)
+{
+if (n < 2)
+return n;
+else
+return fib(n - 1) + fib(n - 2);
+}
+
+int
+add(int a, int b)
+{
+return a + b;
+}
+
+bool
+stringCompare(const char *str)
+{
+if (strcmp( str, "Hello world" ) == 0)
+return true;
+else
+return false;
+}
+
 int main (int argc, char const *argv[])
 {
 std::string str = "Hello world";
Index: test/expression_command/call-function/TestCallUserDefinedFunction.py
===
--- test/expression_command/call-function/TestCallUserDefinedFunction.py
+++ test/expression_command/call-function/TestCallUserDefinedFunction.py
@@ -0,0 +1,68 @@
+"""
+Test calling user defined functions using expression evaluation.
+
+Note:
+  LLDBs current first choice of evaluating functions is using the IR interpreter,
+  which is only supported on Hexagon. Otherwise JIT is used for the evaluation.
+
+"""
+
+import unittest2
+import lldb
+import lldbutil
+from lldbtest import *
+
+class ExprCommandCallUserDefinedFunction(TestBase):
+
+mydir = TestBase.compute_mydir(__file__)
+
+def setUp(self):
+# Call super's setUp().
+TestBase.setUp(self)
+# Find the line number to break for main.c.
+self.line = line_number('main.cpp',
+'// Please test these expressions while stopped at this line:')
+@skipUnlessDarwin
+@dsym_test
+@expectedFailureDarwin("llvm.org/pr20274") # intermittent failure on MacOSX
+def test_with_dsym(self):
+"""Test return values of user defined function calls."""
+self.buildDsym()
+self.call_function()
+
+@dwarf_test
+@expectedFailureFreeBSD("llvm.org/pr20274") # intermittent failure
+def test_with_dwarf(self):
+"""Test return values of user defined function calls."""
+self.buildDwarf()
+self.call_functions()
+
+def call_functions(self):
+"""Test return values of user defined function calls."""
+
+# Set breakpoint in main and run exe
+self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
+lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=-1, loc_exact=True)
+
+self.runCmd("run", RUN_SUCCEEDED)
+
+# Test recursive function call.
+self.expect("expr fib(5)", substrs = ['$0 = 5'])
+
+# Test function with more than one paramter
+self.expect("expr add(4,8)", substrs = ['$1 = 12'])
+
+# Test nesting function calls in function paramters
+self.expect("expr add(add(5,2),add(3,4))", substrs = ['$2 = 14'])
+self.expect("expr add(add(5,2),fib(5))", subs

Re: [Lldb-commits] [PATCH] D9404: Expression evaluation, a new ThreadPlanCallFunctionNoJIT for executing a function call on target via register manipulation

2015-07-02 Thread Ewan Crawford
EwanCrawford updated this revision to Diff 28959.
EwanCrawford added a comment.

Thanks for taking the time to have a closer look Jim. Could you expand on your 
last point about situations where we don't want to run the target at all, it 
didn't quite click.


REPOSITORY
  rL LLVM

http://reviews.llvm.org/D9404

Files:
  include/lldb/Expression/IRInterpreter.h
  include/lldb/Expression/IRMemoryMap.h
  include/lldb/Target/ABI.h
  include/lldb/Target/ThreadPlanCallFunction.h
  include/lldb/Target/ThreadPlanCallFunctionUsingABI.h
  lldb.xcodeproj/project.pbxproj
  source/Expression/ClangExpressionParser.cpp
  source/Expression/ClangUserExpression.cpp
  source/Expression/IRInterpreter.cpp
  source/Expression/IRMemoryMap.cpp
  source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.cpp
  source/Target/CMakeLists.txt
  source/Target/ThreadPlanCallFunction.cpp
  source/Target/ThreadPlanCallFunctionUsingABI.cpp
  test/expression_command/call-function/TestCallUserDefinedFunction.py
  test/expression_command/call-function/main.cpp

Index: test/expression_command/call-function/main.cpp
===
--- test/expression_command/call-function/main.cpp
+++ test/expression_command/call-function/main.cpp
@@ -1,5 +1,6 @@
 #include 
 #include 
+#include 
 
 struct Five
 {
@@ -14,6 +15,30 @@
 return my_five;
 }
 
+unsigned int 
+fib(unsigned int n)
+{
+if (n < 2)
+return n;
+else
+return fib(n - 1) + fib(n - 2);
+}
+
+int 
+add(int a, int b)
+{
+return a + b;
+}
+
+bool 
+stringCompare(const char *str)
+{
+if (strcmp( str, "Hello world" ) == 0)
+return true;
+else
+return false;
+}
+
 int main (int argc, char const *argv[])
 {
 std::string str = "Hello world";
Index: test/expression_command/call-function/TestCallUserDefinedFunction.py
===
--- test/expression_command/call-function/TestCallUserDefinedFunction.py
+++ test/expression_command/call-function/TestCallUserDefinedFunction.py
@@ -0,0 +1,68 @@
+"""
+Test calling user defined functions using expression evaluation.
+
+Note:
+  LLDBs first choice method of evaluating functions is using the IR interpreter,
+  which is currently only supported on Hexagon. Otherwise JIT is used for the evaluation.
+
+"""
+
+import unittest2
+import lldb
+import lldbutil
+from lldbtest import *
+
+class ExprCommandCallUserDefinedFunction(TestBase):
+
+mydir = TestBase.compute_mydir(__file__)
+
+def setUp(self):
+# Call super's setUp().
+TestBase.setUp(self)
+# Find the line number to break for main.c.
+self.line = line_number('main.cpp',
+'// Please test these expressions while stopped at this line:')
+@skipUnlessDarwin
+@dsym_test
+@expectedFailureDarwin("llvm.org/pr20274") # intermittent failure on MacOSX
+def test_with_dsym(self):
+"""Test return values of user defined function calls."""
+self.buildDsym()
+self.call_function()
+
+@dwarf_test
+@expectedFailureFreeBSD("llvm.org/pr20274") # intermittent failure
+def test_with_dwarf(self):
+"""Test return values of user defined function calls."""
+self.buildDwarf()
+self.call_functions()
+
+def call_functions(self):
+"""Test return values of user defined function calls."""
+   
+# Set breakpoint in main and run exe
+self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
+lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=-1, loc_exact=True)
+
+self.runCmd("run", RUN_SUCCEEDED)
+
+# Test recursive function call.
+self.expect("expr fib(5)", substrs = ['$0 = 5'])
+
+# Test function with more than one paramter 
+self.expect("expr add(4,8)", substrs = ['$1 = 12'])
+
+# Test nesting function calls in function paramters 
+self.expect("expr add(add(5,2),add(3,4))", substrs = ['$2 = 14'])
+self.expect("expr add(add(5,2),fib(5))", substrs = ['$3 = 12'])
+ 
+# Test function with pointer paramter
+self.expect("exp stringCompare((const char*) \"Hello world\")", substrs = ['$4 = true'])
+self.expect("exp stringCompare((const char*) \"Hellworld\")", substrs = ['$5 = false'])
+
+
+if __name__ == '__main__':
+import atexit
+lldb.SBDebugger.Initialize()
+atexit.register(lambda: lldb.SBDebugger.Terminate())
+unittest2.main()
Index: source/Target/ThreadPlanCallFunctionUsingABI.cpp
===
--- source/Target/ThreadPlanCallFunctionUsingABI.cpp
+++ source/Target/ThreadPlanCallFunctionUsingABI.cpp
@@ -0,0 +1,91 @@
+//===-- ThreadPlanCallFunctionUsingABI.cpp --*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the Universi

Re: [Lldb-commits] [PATCH] Expression evaluation, a new ThreadPlanCallFunctionNoJIT for executing a function call on target via register manipulation

2015-07-01 Thread Ewan Crawford
Could we please get a final answer on this? Cheers.


REPOSITORY
  rL LLVM

http://reviews.llvm.org/D9404

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/



___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r241071 - Fix windows build.

2015-06-30 Thread Ewan Crawford
Author: ewancrawford
Date: Tue Jun 30 10:03:31 2015
New Revision: 241071

URL: http://llvm.org/viewvc/llvm-project?rev=241071&view=rev
Log:
Fix windows build.

Windows build was broken in either r240983 or r240978 in the changes to 
FileSpec.cpp

Modified:
lldb/trunk/source/Host/common/FileSpec.cpp

Modified: lldb/trunk/source/Host/common/FileSpec.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/FileSpec.cpp?rev=241071&r1=241070&r2=241071&view=diff
==
--- lldb/trunk/source/Host/common/FileSpec.cpp (original)
+++ lldb/trunk/source/Host/common/FileSpec.cpp Tue Jun 30 10:03:31 2015
@@ -1088,7 +1088,6 @@ FileSpec::ForEachItemInDirectory (const
 
 do
 {
-bool call_callback = false;
 FileSpec::FileType file_type = eFileTypeUnknown;
 if (ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
 {
@@ -1101,54 +1100,49 @@ FileSpec::ForEachItemInDirectory (const
 continue;
 
 file_type = eFileTypeDirectory;
-call_callback = find_directories;
 }
 else if (ffd.dwFileAttributes & FILE_ATTRIBUTE_DEVICE)
 {
 file_type = eFileTypeOther;
-call_callback = find_other;
 }
 else
 {
 file_type = eFileTypeRegular;
-call_callback = find_files;
 }
-if (call_callback)
-{
-char child_path[MAX_PATH];
-const int child_path_len = ::snprintf (child_path, 
sizeof(child_path), "%s\\%s", dir_path, ffd.cFileName);
-if (child_path_len < (int)(sizeof(child_path) - 1))
-{
-// Don't resolve the file type or path
-FileSpec child_path_spec (child_path, false);
 
-EnumerateDirectoryResult result = callback (file_type, 
child_path_spec);
+char child_path[MAX_PATH];
+const int child_path_len = ::snprintf (child_path, 
sizeof(child_path), "%s\\%s", dir_path, ffd.cFileName);
+if (child_path_len < (int)(sizeof(child_path) - 1))
+{
+// Don't resolve the file type or path
+FileSpec child_path_spec (child_path, false);
 
-switch (result)
-{
-case eEnumerateDirectoryResultNext:
-// Enumerate next entry in the current directory. 
We just
-// exit this switch and will continue enumerating 
the
-// current directory as we currently are...
-break;
-
-case eEnumerateDirectoryResultEnter: // Recurse into 
the current entry if it is a directory or symlink, or next if not
-if (FileSpec::ForEachItemInDirectory(child_path, 
callback) == eEnumerateDirectoryResultQuit)
-{
-// The subdirectory returned Quit, which means 
to
-// stop all directory enumerations at all 
levels.
-return eEnumerateDirectoryResultQuit;
-}
-break;
-
-case eEnumerateDirectoryResultExit:  // Exit from the 
current directory at the current level.
-// Exit from this directory level and tell parent 
to
-// keep enumerating.
-return eEnumerateDirectoryResultNext;
+EnumerateDirectoryResult result = callback (file_type, 
child_path_spec);
 
-case eEnumerateDirectoryResultQuit:  // Stop directory 
enumerations at any level
+switch (result)
+{
+case eEnumerateDirectoryResultNext:
+// Enumerate next entry in the current directory. We 
just
+// exit this switch and will continue enumerating the
+// current directory as we currently are...
+break;
+
+case eEnumerateDirectoryResultEnter: // Recurse into the 
current entry if it is a directory or symlink, or next if not
+if (FileSpec::ForEachItemInDirectory(child_path, 
callback) == eEnumerateDirectoryResultQuit)
+{
+// The subdirectory returned Quit, which means to
+// stop all directory enumerations at all levels.
 return eEnumerateDirectoryResultQuit;
-}
+}
+break;
+
+case eEnumerateDirectoryResultExit:  // Exit from the 
current directory at the cu

Re: [Lldb-commits] [PATCH] Add setting for breakpoint PC adjustment from remote stubs which don't back PC up.

2015-06-30 Thread Ewan Crawford
REPOSITORY
  rL LLVM

http://reviews.llvm.org/D10775

Files:
  lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp

Index: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
===
--- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -520,6 +520,19 @@
 GetGlobalPluginProperties()->SetPacketTimeout(host_packet_timeout);
 }
 
+// Register info search order: 
+// 1 - Use the target definition python file if one is specified.
+// 2 - If the target definition doesn't have any of the info from the 
target.xml (registers) then proceed to read the target.xml.
+// 3 - Fall back on the qRegisterInfo packets.
+
+FileSpec target_definition_fspec = 
GetGlobalPluginProperties()->GetTargetDefinitionFile ();
+if (target_definition_fspec)
+{
+// See if we can get register definitions from a python file
+if (ParsePythonTargetDefinition (target_definition_fspec))
+return;
+}
+
 if (GetGDBServerRegisterInfo ())
 return;
 
@@ -679,15 +692,6 @@
 return;
 }
 
-FileSpec target_definition_fspec = 
GetGlobalPluginProperties()->GetTargetDefinitionFile ();
-
-if (target_definition_fspec)
-{
-// See if we can get register definitions from a python file
-if (ParsePythonTargetDefinition (target_definition_fspec))
-return;
-}
-
 // We didn't get anything if the accumulated reg_num is zero.  See if we 
are
 // debugging ARM and fill with a hard coded register set until we can get 
an
 // updated debugserver down on the devices.

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
Index: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
===
--- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -520,6 +520,19 @@
 GetGlobalPluginProperties()->SetPacketTimeout(host_packet_timeout);
 }
 
+// Register info search order: 
+// 1 - Use the target definition python file if one is specified.
+// 2 - If the target definition doesn't have any of the info from the target.xml (registers) then proceed to read the target.xml.
+// 3 - Fall back on the qRegisterInfo packets.
+
+FileSpec target_definition_fspec = GetGlobalPluginProperties()->GetTargetDefinitionFile ();
+if (target_definition_fspec)
+{
+// See if we can get register definitions from a python file
+if (ParsePythonTargetDefinition (target_definition_fspec))
+return;
+}
+
 if (GetGDBServerRegisterInfo ())
 return;
 
@@ -679,15 +692,6 @@
 return;
 }
 
-FileSpec target_definition_fspec = GetGlobalPluginProperties()->GetTargetDefinitionFile ();
-
-if (target_definition_fspec)
-{
-// See if we can get register definitions from a python file
-if (ParsePythonTargetDefinition (target_definition_fspec))
-return;
-}
-
 // We didn't get anything if the accumulated reg_num is zero.  See if we are
 // debugging ARM and fill with a hard coded register set until we can get an
 // updated debugserver down on the devices.
___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r241063 - Change search order of target definition files.

2015-06-30 Thread Ewan Crawford
Author: ewancrawford
Date: Tue Jun 30 08:08:44 2015
New Revision: 241063

URL: http://llvm.org/viewvc/llvm-project?rev=241063&view=rev
Log:
Change search order of target definition files.

Make the python target definition file have highest priority so that we can set 
the remote stub breakpoint pc offset using it.

Reviewers: clayborg
Subscribers: ted, deepak2427, lldb-commits 

Differential revision: http://reviews.llvm.org/D10775


Modified:
lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp?rev=241063&r1=241062&r2=241063&view=diff
==
--- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Tue Jun 
30 08:08:44 2015
@@ -520,6 +520,19 @@ ProcessGDBRemote::BuildDynamicRegisterIn
 GetGlobalPluginProperties()->SetPacketTimeout(host_packet_timeout);
 }
 
+// Register info search order: 
+// 1 - Use the target definition python file if one is specified.
+// 2 - If the target definition doesn't have any of the info from the 
target.xml (registers) then proceed to read the target.xml.
+// 3 - Fall back on the qRegisterInfo packets.
+
+FileSpec target_definition_fspec = 
GetGlobalPluginProperties()->GetTargetDefinitionFile ();
+if (target_definition_fspec)
+{
+// See if we can get register definitions from a python file
+if (ParsePythonTargetDefinition (target_definition_fspec))
+return;
+}
+
 if (GetGDBServerRegisterInfo ())
 return;
 
@@ -679,15 +692,6 @@ ProcessGDBRemote::BuildDynamicRegisterIn
 return;
 }
 
-FileSpec target_definition_fspec = 
GetGlobalPluginProperties()->GetTargetDefinitionFile ();
-
-if (target_definition_fspec)
-{
-// See if we can get register definitions from a python file
-if (ParsePythonTargetDefinition (target_definition_fspec))
-return;
-}
-
 // We didn't get anything if the accumulated reg_num is zero.  See if we 
are
 // debugging ARM and fill with a hard coded register set until we can get 
an
 // updated debugserver down on the devices.


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] Add setting for breakpoint PC adjustment from remote stubs which don't back PC up.

2015-06-29 Thread Ewan Crawford
Prioritizing the python target definition seems a cleaner solution.


REPOSITORY
  rL LLVM

http://reviews.llvm.org/D10775

Files:
  source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp

Index: source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
===
--- source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -520,6 +520,19 @@
 GetGlobalPluginProperties()->SetPacketTimeout(host_packet_timeout);
 }
 
+// Register info search order: 
+// 1 - Use the target definition python file if one is specified.
+// 2 - If the target definition doesn't have any of the info from the 
target.xml (registers) then proceed to read the target.xml.
+// 3 - Fall back on the qRegisterInfo packets.
+
+FileSpec target_definition_fspec = 
GetGlobalPluginProperties()->GetTargetDefinitionFile ();
+if (target_definition_fspec)
+{
+// See if we can get register definitions from a python file
+if (ParsePythonTargetDefinition (target_definition_fspec))
+return;
+}
+
 if (GetGDBServerRegisterInfo ())
 return;
 
@@ -679,15 +692,6 @@
 return;
 }
 
-FileSpec target_definition_fspec = 
GetGlobalPluginProperties()->GetTargetDefinitionFile ();
-
-if (target_definition_fspec)
-{
-// See if we can get register definitions from a python file
-if (ParsePythonTargetDefinition (target_definition_fspec))
-return;
-}
-
 // We didn't get anything if the accumulated reg_num is zero.  See if we 
are
 // debugging ARM and fill with a hard coded register set until we can get 
an
 // updated debugserver down on the devices.

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
Index: source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
===
--- source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -520,6 +520,19 @@
 GetGlobalPluginProperties()->SetPacketTimeout(host_packet_timeout);
 }
 
+// Register info search order: 
+// 1 - Use the target definition python file if one is specified.
+// 2 - If the target definition doesn't have any of the info from the target.xml (registers) then proceed to read the target.xml.
+// 3 - Fall back on the qRegisterInfo packets.
+
+FileSpec target_definition_fspec = GetGlobalPluginProperties()->GetTargetDefinitionFile ();
+if (target_definition_fspec)
+{
+// See if we can get register definitions from a python file
+if (ParsePythonTargetDefinition (target_definition_fspec))
+return;
+}
+
 if (GetGDBServerRegisterInfo ())
 return;
 
@@ -679,15 +692,6 @@
 return;
 }
 
-FileSpec target_definition_fspec = GetGlobalPluginProperties()->GetTargetDefinitionFile ();
-
-if (target_definition_fspec)
-{
-// See if we can get register definitions from a python file
-if (ParsePythonTargetDefinition (target_definition_fspec))
-return;
-}
-
 // We didn't get anything if the accumulated reg_num is zero.  See if we are
 // debugging ARM and fill with a hard coded register set until we can get an
 // updated debugserver down on the devices.
___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] Add setting for breakpoint PC adjustment from remote stubs which don't back PC up.

2015-06-26 Thread Ewan Crawford
Hi clayborg,

Currently `m_breakpoint_pc_offset` is only set using the python target 
definition file. This variable adjusts the PC for a breakpoint hit when the 
remote stub, like gdbserver, hasn't backed up the PC. 

The introduction of reading XML target definition files from the remote however 
means that the XML target def has priority over the python target definition. 
So in cases where the XML is provided, the python target def isn't used. In 
such a situation there is no way to provide the breakpoint PC offset. 

This patch allows the breakpoint offset variable to set using a settting.  An 
alternative however could be to prioritize the python target definition, over 
the XML target definition.

REPOSITORY
  rL LLVM

http://reviews.llvm.org/D10775

Files:
  source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp

Index: source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
===
--- source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -107,6 +107,9 @@
 {
 { "packet-timeout" , OptionValue::eTypeUInt64 , true , 1, NULL, NULL, 
"Specify the default packet timeout in seconds." },
 { "target-definition-file" , OptionValue::eTypeFileSpec , true, 0 , 
NULL, NULL, "The file that provides the description for remote target 
registers." },
+{ "breakpoint-pc-offset", OptionValue::eTypeSInt64, true, 0, NULL, 
NULL, "Architecture specific PC offset when a breakpoint is hit. "
+   
  "Needed if debug stub does not rollback PC after hitting a breakpoint. "
+   
  "For negative values, use '--' before settings variable." },
 {  NULL, OptionValue::eTypeInvalid, false, 0, NULL, NULL, 
NULL  }
 };
 
@@ -113,7 +116,8 @@
 enum
 {
 ePropertyPacketTimeout,
-ePropertyTargetDefinitionFile
+ePropertyTargetDefinitionFile,
+ePropertyBreakpointOffset
 };
 
 class PluginProperties : public Properties
@@ -158,6 +162,13 @@
 const uint32_t idx = ePropertyTargetDefinitionFile;
 return m_collection_sp->GetPropertyAtIndexAsFileSpec (NULL, idx);
 }
+
+int64_t
+GetBreakpointOffset() const
+{
+const uint32_t idx = ePropertyBreakpointOffset;
+return m_collection_sp->GetPropertyAtIndexAsSInt64(NULL, idx, 0);
+}
 };
 
 typedef std::shared_ptr ProcessKDPPropertiesSP;
@@ -399,6 +410,10 @@
 const uint64_t timeout_seconds = 
GetGlobalPluginProperties()->GetPacketTimeout();
 if (timeout_seconds > 0)
 m_gdb_comm.SetPacketTimeout(timeout_seconds);
+
+const int64_t settings_bp_offset = 
GetGlobalPluginProperties()->GetBreakpointOffset();
+if (settings_bp_offset != 0)
+m_breakpoint_pc_offset = settings_bp_offset;
 }
 
 //--

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
Index: source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
===
--- source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -107,6 +107,9 @@
 {
 { "packet-timeout" , OptionValue::eTypeUInt64 , true , 1, NULL, NULL, "Specify the default packet timeout in seconds." },
 { "target-definition-file" , OptionValue::eTypeFileSpec , true, 0 , NULL, NULL, "The file that provides the description for remote target registers." },
+{ "breakpoint-pc-offset", OptionValue::eTypeSInt64, true, 0, NULL, NULL, "Architecture specific PC offset when a breakpoint is hit. "
+ "Needed if debug stub does not rollback PC after hitting a breakpoint. "
+ "For negative values, use '--' before settings variable." },
 {  NULL, OptionValue::eTypeInvalid, false, 0, NULL, NULL, NULL  }
 };
 
@@ -113,7 +116,8 @@
 enum
 {
 ePropertyPacketTimeout,
-ePropertyTargetDefinitionFile
+ePropertyTargetDefinitionFile,
+ePropertyBreakpointOffset
 };
 
 class PluginProperties : public Properties
@@ -158,6 +162,13 @@
 const uint32_t idx = ePropertyTargetDefinitionFile;
 return m_collection_sp->GetPropertyAtIndexAsFileSpec (NULL, idx);
 }
+
+int64_t
+GetBreakpointOffset() const
+{
+const uint32_t idx = ePropertyBreakpointOffset;
+return m_collection_sp->GetPropertyAtIndexAsSInt64(NULL, idx, 0);
+}
 };
 
 typedef std::shared_ptr ProcessKDPPrope

[Lldb-commits] [lldb] r240768 - XML register info fix

2015-06-26 Thread Ewan Crawford
Author: ewancrawford
Date: Fri Jun 26 04:38:27 2015
New Revision: 240768

URL: http://llvm.org/viewvc/llvm-project?rev=240768&view=rev
Log:
XML register info fix

There are a couple of bugs in the XML register info handling which this patch 
fixes:

+ conflicting variable names in lambda, both capture list and parameters 
contains a variable called 'name'.

+ prev_reg_num, which sets the register number, should be incremented after 
each register is processed.

+ Windows errors regarding empty strings and the 'xi:' prefix disappearing from 
'xi:include' node name.

Reviewers: clayborg

Subscribers: lldb-commits, deepak2427

Differential Revision: http://reviews.llvm.org/D10731

Modified:

lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp

Modified: 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp?rev=240768&r1=240767&r2=240768&view=diff
==
--- 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp 
(original)
+++ 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp 
Fri Jun 26 04:38:27 2015
@@ -4224,8 +4224,8 @@ GDBRemoteCommunicationClient::ReadExtFea
 // send query extended feature packet
 std::stringstream packet;
 packet << "qXfer:" 
-   << object.AsCString( ) << ":read:" 
-   << annex.AsCString( )  << ":" 
+   << object.AsCString("") << ":read:" 
+   << annex.AsCString("")  << ":" 
<< std::hex << offset  << "," 
<< std::hex << size;
 

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp?rev=240768&r1=240767&r2=240768&view=diff
==
--- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Fri Jun 
26 04:38:27 2015
@@ -3969,7 +3969,6 @@ ParseRegisters (XMLNode feature_node, Gd
 uint32_t reg_offset = 0;
 
 feature_node.ForEachChildElementWithName("reg", [&target_info, 
&dyn_reg_info, &prev_reg_num, ®_offset](const XMLNode ®_node) -> bool {
-std::string name;
 std::string gdb_group;
 std::string gdb_type;
 ConstString reg_name;
@@ -3996,7 +3995,7 @@ ParseRegisters (XMLNode feature_node, Gd
 NULL
 };
 
-reg_node.ForEachAttribute([&target_info, &name, &gdb_group, &gdb_type, 
®_name, &alt_name, &set_name, &value_regs, &invalidate_regs, &encoding_set, 
&format_set, ®_info, &prev_reg_num, ®_offset](const llvm::StringRef 
&name, const llvm::StringRef &value) -> bool {
+reg_node.ForEachAttribute([&target_info, &gdb_group, &gdb_type, 
®_name, &alt_name, &set_name, &value_regs, &invalidate_regs, &encoding_set, 
&format_set, ®_info, &prev_reg_num, ®_offset](const llvm::StringRef 
&name, const llvm::StringRef &value) -> bool {
 if (name == "name")
 {
 reg_name.SetString(value);
@@ -4131,6 +4130,7 @@ ParseRegisters (XMLNode feature_node, Gd
 reg_info.invalidate_regs = invalidate_regs.data();
 }
 
+++prev_reg_num;
 dyn_reg_info.AddRegister(reg_info, reg_name, alt_name, set_name);
 
 return true; // Keep iterating through all "reg" elements
@@ -4192,7 +4192,7 @@ ProcessGDBRemote::GetGDBServerRegisterIn
 {
 node.GetElementText(target_info.osabi);
 }
-else if (name == "xi:include")
+else if (name == "xi:include" || name == "include")
 {
 llvm::StringRef href = node.GetAttributeValue("href");
 if (!href.empty())


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] XML register info fix

2015-06-26 Thread Ewan Crawford
REPOSITORY
  rL LLVM

http://reviews.llvm.org/D10731

Files:
  lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
  lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp

Index: 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
===
--- 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
+++ 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
@@ -4224,8 +4224,8 @@
 // send query extended feature packet
 std::stringstream packet;
 packet << "qXfer:" 
-   << object.AsCString( ) << ":read:" 
-   << annex.AsCString( )  << ":" 
+   << object.AsCString("") << ":read:" 
+   << annex.AsCString("")  << ":" 
<< std::hex << offset  << "," 
<< std::hex << size;
 
Index: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
===
--- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -3969,7 +3969,6 @@
 uint32_t reg_offset = 0;
 
 feature_node.ForEachChildElementWithName("reg", [&target_info, 
&dyn_reg_info, &prev_reg_num, ®_offset](const XMLNode ®_node) -> bool {
-std::string name;
 std::string gdb_group;
 std::string gdb_type;
 ConstString reg_name;
@@ -3996,7 +3995,7 @@
 NULL
 };
 
-reg_node.ForEachAttribute([&target_info, &name, &gdb_group, &gdb_type, 
®_name, &alt_name, &set_name, &value_regs, &invalidate_regs, &encoding_set, 
&format_set, ®_info, &prev_reg_num, ®_offset](const llvm::StringRef 
&name, const llvm::StringRef &value) -> bool {
+reg_node.ForEachAttribute([&target_info, &gdb_group, &gdb_type, 
®_name, &alt_name, &set_name, &value_regs, &invalidate_regs, &encoding_set, 
&format_set, ®_info, &prev_reg_num, ®_offset](const llvm::StringRef 
&name, const llvm::StringRef &value) -> bool {
 if (name == "name")
 {
 reg_name.SetString(value);
@@ -4131,6 +4130,7 @@
 reg_info.invalidate_regs = invalidate_regs.data();
 }
 
+++prev_reg_num;
 dyn_reg_info.AddRegister(reg_info, reg_name, alt_name, set_name);
 
 return true; // Keep iterating through all "reg" elements
@@ -4192,7 +4192,7 @@
 {
 node.GetElementText(target_info.osabi);
 }
-else if (name == "xi:include")
+else if (name == "xi:include" || name == "include")
 {
 llvm::StringRef href = node.GetAttributeValue("href");
 if (!href.empty())

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
Index: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
===
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
@@ -4224,8 +4224,8 @@
 // send query extended feature packet
 std::stringstream packet;
 packet << "qXfer:" 
-   << object.AsCString( ) << ":read:" 
-   << annex.AsCString( )  << ":" 
+   << object.AsCString("") << ":read:" 
+   << annex.AsCString("")  << ":" 
<< std::hex << offset  << "," 
<< std::hex << size;
 
Index: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
===
--- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -3969,7 +3969,6 @@
 uint32_t reg_offset = 0;
 
 feature_node.ForEachChildElementWithName("reg", [&target_info, &dyn_reg_info, &prev_reg_num, ®_offset](const XMLNode ®_node) -> bool {
-std::string name;
 std::string gdb_group;
 std::string gdb_type;
 ConstString reg_name;
@@ -3996,7 +3995,7 @@
 NULL
 };
 
-reg_node.ForEachAttribute([&target_info, &name, &gdb_group, &gdb_type, ®_name, &alt_name, &set_name, &value_regs, &invalidate_regs, &encoding_set, &format_set, ®_info, &prev_reg_num, ®_offset](const llvm::StringRef &name, const llvm::StringRef &value) -> bool {
+reg_node.ForEachAttribute([&target_info, &gdb_group, &gdb_type, ®_name, &alt_name, &set_name, &value_regs, &invalidate_regs, &encoding_set, &format_set, ®_info, &prev_reg_num, ®_offset](const llvm::StringRef &name, const llvm::StringRef &value) -> bool {
 if (name == "name")
 {
 reg_name.SetString(value);
@@

[Lldb-commits] [PATCH] XML register info fix

2015-06-25 Thread Ewan Crawford
Hi clayborg,

There are a couple of bugs in the XML register info handling which this patch 
fixes:

+ conflicting variable names in lambda, both capture list and parameters 
contains a variable called 'name'.

+ prev_reg_num, which sets the register number, should be incremented after 
each register is processed. 

+ Windows errors regarding empty strings and the 'xi:' prefix disappearing from 
'xi:include' node name.

REPOSITORY
  rL LLVM

http://reviews.llvm.org/D10731

Files:
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
  source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp

Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
===
--- source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
+++ source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
@@ -4197,8 +4197,8 @@
 // send query extended feature packet
 std::stringstream packet;
 packet << "qXfer:" 
-   << object.AsCString( ) << ":read:" 
-   << annex.AsCString( )  << ":" 
+   << object.AsCString("") << ":read:" 
+   << annex.AsCString("")  << ":" 
<< std::hex << offset  << "," 
<< std::hex << size;
 
Index: source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
===
--- source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -3761,7 +3761,6 @@
 uint32_t reg_offset = 0;
 
 feature_node.ForEachChildElementWithName("reg", [&target_info, 
&dyn_reg_info, &prev_reg_num, ®_offset](const XMLNode ®_node) -> bool {
-std::string name;
 std::string gdb_group;
 std::string gdb_type;
 ConstString reg_name;
@@ -3788,7 +3787,7 @@
 NULL
 };
 
-reg_node.ForEachAttribute([&target_info, &name, &gdb_group, &gdb_type, 
®_name, &alt_name, &set_name, &value_regs, &invalidate_regs, &encoding_set, 
&format_set, ®_info, &prev_reg_num, ®_offset](const llvm::StringRef 
&name, const llvm::StringRef &value) -> bool {
+reg_node.ForEachAttribute([&target_info, &gdb_group, &gdb_type, 
®_name, &alt_name, &set_name, &value_regs, &invalidate_regs, &encoding_set, 
&format_set, ®_info, &prev_reg_num, ®_offset](const llvm::StringRef 
&name, const llvm::StringRef &value) -> bool {
 if (name == "name")
 {
 reg_name.SetString(value);
@@ -3923,6 +3922,7 @@
 reg_info.invalidate_regs = invalidate_regs.data();
 }
 
+++prev_reg_num;
 dyn_reg_info.AddRegister(reg_info, reg_name, alt_name, set_name);
 
 return true; // Keep iterating through all "reg" elements
@@ -3984,7 +3984,7 @@
 {
 node.GetElementText(target_info.osabi);
 }
-else if (name == "xi:include")
+else if (name == "xi:include" || name == "include")
 {
 llvm::StringRef href = node.GetAttributeValue("href");
 if (!href.empty())

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
===
--- source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
+++ source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
@@ -4197,8 +4197,8 @@
 // send query extended feature packet
 std::stringstream packet;
 packet << "qXfer:" 
-   << object.AsCString( ) << ":read:" 
-   << annex.AsCString( )  << ":" 
+   << object.AsCString("") << ":read:" 
+   << annex.AsCString("")  << ":" 
<< std::hex << offset  << "," 
<< std::hex << size;
 
Index: source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
===
--- source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -3761,7 +3761,6 @@
 uint32_t reg_offset = 0;
 
 feature_node.ForEachChildElementWithName("reg", [&target_info, &dyn_reg_info, &prev_reg_num, ®_offset](const XMLNode ®_node) -> bool {
-std::string name;
 std::string gdb_group;
 std::string gdb_type;
 ConstString reg_name;
@@ -3788,7 +3787,7 @@
 NULL
 };
 
-reg_node.ForEachAttribute([&target_info, &name, &gdb_group, &gdb_type, ®_name, &alt_name, &set_name, &value_regs, &invalidate_regs, &encoding_set, &format_set, ®_info, &prev_reg_num, ®_offset](const llvm::StringRef &name, const llvm::StringRef &value) -> bool {
+reg_node.ForEachAttribute([&target_info, &gdb_group, &gdb_type, ®_name, &alt_name,

[Lldb-commits] [lldb] r240546 - Proper handling of QNonStop packet response.

2015-06-24 Thread Ewan Crawford
Author: ewancrawford
Date: Wed Jun 24 10:14:26 2015
New Revision: 240546

URL: http://llvm.org/viewvc/llvm-project?rev=240546&view=rev
Log:
Proper handling of QNonStop packet response.

Turn non-stop mode off if reply to QNonStop packet isn't an OK.

Modified:
lldb/trunk/include/lldb/Target/Target.h
lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
lldb/trunk/source/Target/Target.cpp

Modified: lldb/trunk/include/lldb/Target/Target.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Target.h?rev=240546&r1=240545&r2=240546&view=diff
==
--- lldb/trunk/include/lldb/Target/Target.h (original)
+++ lldb/trunk/include/lldb/Target/Target.h Wed Jun 24 10:14:26 2015
@@ -198,7 +198,10 @@ public:
 
 bool
 GetNonStopModeEnabled () const;
-
+
+void
+SetNonStopModeEnabled (bool b);
+
 bool
 GetDisplayRuntimeSupportValues () const;
 

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp?rev=240546&r1=240545&r2=240546&view=diff
==
--- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Wed Jun 
24 10:14:26 2015
@@ -1172,7 +1172,7 @@ ProcessGDBRemote::ConnectToDebugserver (
 
 // Send $QNonStop:1 packet on startup if required
 if (GetTarget().GetNonStopModeEnabled())
-m_gdb_comm.SetNonStopMode(true);
+GetTarget().SetNonStopModeEnabled (m_gdb_comm.SetNonStopMode(true));
 
 m_gdb_comm.GetEchoSupported ();
 m_gdb_comm.GetThreadSuffixSupported ();

Modified: lldb/trunk/source/Target/Target.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Target.cpp?rev=240546&r1=240545&r2=240546&view=diff
==
--- lldb/trunk/source/Target/Target.cpp (original)
+++ lldb/trunk/source/Target/Target.cpp Wed Jun 24 10:14:26 2015
@@ -3550,6 +3550,13 @@ TargetProperties::GetNonStopModeEnabled
 return m_collection_sp->GetPropertyAtIndexAsBoolean (NULL, idx, false);
 }
 
+void
+TargetProperties::SetNonStopModeEnabled (bool b)
+{
+const uint32_t idx = ePropertyNonStopModeEnabled;
+m_collection_sp->SetPropertyAtIndexAsBoolean (NULL, idx, b);
+}
+
 const ProcessLaunchInfo &
 TargetProperties::GetProcessLaunchInfo ()
 {


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] Expression evaluation, a new ThreadPlanCallFunctionNoJIT for executing a function call on target via register manipulation

2015-06-23 Thread Ewan Crawford
Thanks for the instructions Jim, I agree it would be good to get them 
documented somewhere.


REPOSITORY
  rL LLVM

http://reviews.llvm.org/D9404

Files:
  include/lldb/Expression/IRInterpreter.h
  include/lldb/Expression/IRMemoryMap.h
  include/lldb/Target/ABI.h
  include/lldb/Target/ThreadPlanCallFunction.h
  include/lldb/Target/ThreadPlanCallFunctionUsingABI.h
  lldb.xcodeproj/project.pbxproj
  source/Expression/ClangExpressionParser.cpp
  source/Expression/ClangUserExpression.cpp
  source/Expression/IRInterpreter.cpp
  source/Expression/IRMemoryMap.cpp
  source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.cpp
  source/Target/CMakeLists.txt
  source/Target/ThreadPlanCallFunction.cpp
  source/Target/ThreadPlanCallFunctionUsingABI.cpp
  test/expression_command/call-function/TestCallUsingIRInterpreter.py
  test/expression_command/call-function/main.cpp

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
Index: include/lldb/Expression/IRInterpreter.h
===
--- include/lldb/Expression/IRInterpreter.h
+++ include/lldb/Expression/IRInterpreter.h
@@ -44,7 +44,8 @@
 static bool
 CanInterpret (llvm::Module &module,
   llvm::Function &function,
-  lldb_private::Error &error);
+  lldb_private::Error &error,
+  lldb_private::ExecutionContext &exe_ctx);
 
 static bool
 Interpret (llvm::Module &module,
@@ -53,7 +54,8 @@
lldb_private::IRMemoryMap &memory_map,
lldb_private::Error &error,
lldb::addr_t stack_frame_bottom,
-   lldb::addr_t stack_frame_top);
+   lldb::addr_t stack_frame_top,
+   lldb_private::ExecutionContext &exe_ctx);
 
 private:   
 static bool
Index: include/lldb/Expression/IRMemoryMap.h
===
--- include/lldb/Expression/IRMemoryMap.h
+++ include/lldb/Expression/IRMemoryMap.h
@@ -60,7 +60,7 @@
 void ReadMemory (uint8_t *bytes, lldb::addr_t process_address, size_t size, Error &error);
 void ReadScalarFromMemory (Scalar &scalar, lldb::addr_t process_address, size_t size, Error &error);
 void ReadPointerFromMemory (lldb::addr_t *address, lldb::addr_t process_address, Error &error);
-
+bool GetAllocSize(lldb::addr_t address, size_t &size);
 void GetMemoryData (DataExtractor &extractor, lldb::addr_t process_address, size_t size, Error &error);
 
 lldb::ByteOrder GetByteOrder();
Index: include/lldb/Target/ABI.h
===
--- include/lldb/Target/ABI.h
+++ include/lldb/Target/ABI.h
@@ -39,10 +39,9 @@
 };
 eType  type;/* value of eType */
 size_t size;/* size in bytes of this argument */
-union {
-lldb::addr_t  value;/* literal value */
-uint8_t  *data; /* host data pointer */
-};
+
+lldb::addr_t  value;/* literal value */
+std::unique_ptr data_ap; /* host data pointer */
 };
 
 virtual
@@ -58,7 +57,7 @@
  lldb::addr_t returnAddress, 
  llvm::ArrayRef args) const = 0;
 
-// Prepare trivial call used from ThreadPlanFunctionCallGDB
+// Prepare trivial call used from ThreadPlanFunctionCallUsingABI
 // AD:
 //  . Because i don't want to change other ABI's this is not declared pure virtual.
 //The dummy implementation will simply fail.  Only HexagonABI will currently
Index: include/lldb/Target/ThreadPlanCallFunction.h
===
--- include/lldb/Target/ThreadPlanCallFunction.h
+++ include/lldb/Target/ThreadPlanCallFunction.h
@@ -34,6 +34,10 @@
 llvm::ArrayRef args,
 const EvaluateExpressionOptions &options);
 
+ThreadPlanCallFunction(Thread &thread,
+   const Address &function,
+   const EvaluateExpressionOptions &options);
+
 virtual
 ~ThreadPlanCallFunction ();
 
@@ -133,9 +137,10 @@
 
 virtual bool
 DoPlanExplainsStop (Event *event_ptr);
+   
+virtual void
+SetReturnValue();
 
-private:
-
 bool
 ConstructorSetup (Thread &thread,
   ABI *& abi,
@@ -153,7 +158,7 @@
 
 bool
 BreakpointsExplainStop ();
-
+
 boolm_valid;
 boolm_stop_other_threads;
 boolm_unwind_on_error;
@@ -172,13 +177,14 @@
  // it's nice to know the real stop reason.
  // This gets set in DoTakedown.
 Stre

[Lldb-commits] [lldb] r240397 - Add handling of async notify packets

2015-06-23 Thread Ewan Crawford
Author: ewancrawford
Date: Tue Jun 23 07:32:06 2015
New Revision: 240397

URL: http://llvm.org/viewvc/llvm-project?rev=240397&view=rev
Log:
Add handling of async notify packets

This patch adds a listener to the AynscThread in ProcessGDBRemote, specifically 
for dealing with any async notification packets.

>From the broadcast our listener receives we can process the notify packet from 
>the event data. A handler function then sets the thread stop info from this 
>packet, and updates lldb by setting the process private state to stopped. 
>Allowing the async thread to go back to sleep and getting the main thread to 
>handle the implications of a state change.

When sending a vCont in nonstop mode we also get a different reply from 
all-stop mode, an OK response as opposed to a stop reply. So a condition is 
added to handle this and set the process state without the stop-reply data.

Reviewers: clayborg

Subscribers: lldb-commits, labath, ted, aidan.dodds, deepak2427

Differential Revision: http://reviews.llvm.org/D10544

Modified:

lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h

Modified: 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp?rev=240397&r1=240396&r2=240397&view=diff
==
--- 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp 
(original)
+++ 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp 
Tue Jun 23 07:32:06 2015
@@ -929,6 +929,57 @@ GDBRemoteCommunicationClient::HarmonizeT
 return final_output.str();
 }
 
+bool
+GDBRemoteCommunicationClient::SendvContPacket
+(
+ProcessGDBRemote *process,
+const char *payload,
+size_t packet_length,
+StringExtractorGDBRemote &response
+)
+{
+
+m_curr_tid = LLDB_INVALID_THREAD_ID;
+Log *log(ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PROCESS));
+if (log)
+log->Printf("GDBRemoteCommunicationClient::%s ()", __FUNCTION__);
+
+// we want to lock down packet sending while we continue
+Mutex::Locker locker(m_sequence_mutex);
+
+// here we broadcast this before we even send the packet!!
+// this signals doContinue() to exit
+BroadcastEvent(eBroadcastBitRunPacketSent, NULL);
+
+// set the public state to running
+m_public_is_running.SetValue(true, eBroadcastNever);
+
+// Set the starting continue packet into "continue_packet". This packet
+// may change if we are interrupted and we continue after an async 
packet...
+std::string continue_packet(payload, packet_length);
+
+if (log)
+log->Printf("GDBRemoteCommunicationClient::%s () sending vCont packet: 
%s", __FUNCTION__, continue_packet.c_str());
+
+if (SendPacketNoLock(continue_packet.c_str(), continue_packet.size()) != 
PacketResult::Success)
+ return false;
+
+// set the private state to running and broadcast this
+m_private_is_running.SetValue(true, eBroadcastAlways);
+
+if (log)
+log->Printf("GDBRemoteCommunicationClient::%s () ReadPacket(%s)", 
__FUNCTION__, continue_packet.c_str());
+
+// wait for the response to the vCont
+if (ReadPacket(response, UINT32_MAX, false) == PacketResult::Success)
+{
+if (response.IsOKResponse())
+return true;
+}
+
+return false;
+}
+
 StateType
 GDBRemoteCommunicationClient::SendContinuePacketAndWaitForResponse
 (

Modified: 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h?rev=240397&r1=240396&r2=240397&view=diff
==
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h 
(original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h 
Tue Jun 23 07:32:06 2015
@@ -78,6 +78,11 @@ public:
   const char *packet_payload,
   size_t packet_length,
   StringExtractorGDBRemote &response);
+bool
+SendvContPacket (ProcessGDBRemote *process,
+ const char *payload,
+ size_t packet_length,
+ StringExtractorGDBRemote &response);
 
 bool
 GetThreadSuffixSupported () override;

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/Proces

Re: [Lldb-commits] [PATCH] Add handling of async notify packets.

2015-06-23 Thread Ewan Crawford
REPOSITORY
  rL LLVM

http://reviews.llvm.org/D10544

Files:
  lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
  lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
  lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
  lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
Index: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
===
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
@@ -929,6 +929,57 @@
 return final_output.str();
 }
 
+bool
+GDBRemoteCommunicationClient::SendvContPacket
+(
+ProcessGDBRemote *process,
+const char *payload,
+size_t packet_length,
+StringExtractorGDBRemote &response
+)
+{
+
+m_curr_tid = LLDB_INVALID_THREAD_ID;
+Log *log(ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PROCESS));
+if (log)
+log->Printf("GDBRemoteCommunicationClient::%s ()", __FUNCTION__);
+
+// we want to lock down packet sending while we continue
+Mutex::Locker locker(m_sequence_mutex);
+
+// here we broadcast this before we even send the packet!!
+// this signals doContinue() to exit
+BroadcastEvent(eBroadcastBitRunPacketSent, NULL);
+
+// set the public state to running
+m_public_is_running.SetValue(true, eBroadcastNever);
+
+// Set the starting continue packet into "continue_packet". This packet
+// may change if we are interrupted and we continue after an async packet...
+std::string continue_packet(payload, packet_length);
+
+if (log)
+log->Printf("GDBRemoteCommunicationClient::%s () sending vCont packet: %s", __FUNCTION__, continue_packet.c_str());
+
+if (SendPacketNoLock(continue_packet.c_str(), continue_packet.size()) != PacketResult::Success)
+ return false;
+
+// set the private state to running and broadcast this
+m_private_is_running.SetValue(true, eBroadcastAlways);
+
+if (log)
+log->Printf("GDBRemoteCommunicationClient::%s () ReadPacket(%s)", __FUNCTION__, continue_packet.c_str());
+
+// wait for the response to the vCont
+if (ReadPacket(response, UINT32_MAX, false) == PacketResult::Success)
+{
+if (response.IsOKResponse())
+return true;
+}
+
+return false;
+}
+
 StateType
 GDBRemoteCommunicationClient::SendContinuePacketAndWaitForResponse
 (
Index: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
===
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
@@ -78,6 +78,11 @@
   const char *packet_payload,
   size_t packet_length,
   StringExtractorGDBRemote &response);
+bool
+SendvContPacket (ProcessGDBRemote *process,
+ const char *payload,
+ size_t packet_length,
+ StringExtractorGDBRemote &response);
 
 bool
 GetThreadSuffixSupported () override;
Index: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
===
--- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -1592,7 +1592,18 @@
 {
 // All threads are resuming...
 m_gdb_comm.SetCurrentThreadForRun (-1);
-continue_packet.PutChar ('s');
+
+// If in Non-Stop-Mode use vCont when stepping
+if (GetTarget().GetNonStopModeEnabled())
+{
+if (m_gdb_comm.GetVContSupported('s'))
+continue_packet.PutCString("vCont;s");
+else
+continue_packet.PutChar('s');
+}
+else
+continue_packet.PutChar('s');
+
 continue_packet_error = false;
 }
 else if (num_continue_c_tids == 0 &&
@@ -3228,6 +3239,34 @@
 log->Printf("ProcessGDBRemote::%s () - Called when Async thread was not running.", __FUNCTION__);
 }
 
+bool
+ProcessGDBRemote::HandleNotifyPacket (StringExtractorGDBRemote &packet)
+{
+// get the packet at a string
+const std::string &pkt = packet.GetStringRef();
+// skip %stop:
+StringExtractorGDBRemote stop_info(pkt.c_str() + 5);
+
+// pass as a thread stop info packet
+SetLastStopPacket(stop_info);
+
+// ch

Re: [Lldb-commits] [PATCH] Expression evaluation, a new ThreadPlanCallFunctionNoJIT for executing a function call on target via register manipulation

2015-06-22 Thread Ewan Crawford
Hiya Jim, I do have access to an OSX system with Xcode. It would be good to 
know how to add files for future reference.


http://reviews.llvm.org/D9404

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/



___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] Expression evaluation, a new ThreadPlanCallFunctionNoJIT for executing a function call on target via register manipulation

2015-06-19 Thread Ewan Crawford
Hi everyone, I'm still quite keen to get this patch through so I'd appreciate 
any more feedback you have.

Also If I'm adding new files, how do I go about updating the xcode project file?


http://reviews.llvm.org/D9404

Files:
  include/lldb/Expression/IRInterpreter.h
  include/lldb/Expression/IRMemoryMap.h
  include/lldb/Target/ABI.h
  include/lldb/Target/ThreadPlanCallFunction.h
  include/lldb/Target/ThreadPlanCallFunctionUsingABI.h
  source/Expression/ClangExpressionParser.cpp
  source/Expression/ClangUserExpression.cpp
  source/Expression/IRInterpreter.cpp
  source/Expression/IRMemoryMap.cpp
  source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.cpp
  source/Target/CMakeLists.txt
  source/Target/ThreadPlanCallFunction.cpp
  source/Target/ThreadPlanCallFunctionUsingABI.cpp
  test/expression_command/call-function/TestCallUsingIRInterpreter.py
  test/expression_command/call-function/main.cpp

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
Index: include/lldb/Expression/IRInterpreter.h
===
--- include/lldb/Expression/IRInterpreter.h
+++ include/lldb/Expression/IRInterpreter.h
@@ -44,7 +44,8 @@
 static bool
 CanInterpret (llvm::Module &module,
   llvm::Function &function,
-  lldb_private::Error &error);
+  lldb_private::Error &error,
+  lldb_private::ExecutionContext &exe_ctx);
 
 static bool
 Interpret (llvm::Module &module,
@@ -53,7 +54,8 @@
lldb_private::IRMemoryMap &memory_map,
lldb_private::Error &error,
lldb::addr_t stack_frame_bottom,
-   lldb::addr_t stack_frame_top);
+   lldb::addr_t stack_frame_top,
+   lldb_private::ExecutionContext &exe_ctx);
 
 private:   
 static bool
Index: include/lldb/Expression/IRMemoryMap.h
===
--- include/lldb/Expression/IRMemoryMap.h
+++ include/lldb/Expression/IRMemoryMap.h
@@ -60,7 +60,7 @@
 void ReadMemory (uint8_t *bytes, lldb::addr_t process_address, size_t size, Error &error);
 void ReadScalarFromMemory (Scalar &scalar, lldb::addr_t process_address, size_t size, Error &error);
 void ReadPointerFromMemory (lldb::addr_t *address, lldb::addr_t process_address, Error &error);
-
+bool GetAllocSize(lldb::addr_t address, size_t &size);
 void GetMemoryData (DataExtractor &extractor, lldb::addr_t process_address, size_t size, Error &error);
 
 lldb::ByteOrder GetByteOrder();
Index: include/lldb/Target/ABI.h
===
--- include/lldb/Target/ABI.h
+++ include/lldb/Target/ABI.h
@@ -39,10 +39,9 @@
 };
 eType  type;/* value of eType */
 size_t size;/* size in bytes of this argument */
-union {
-lldb::addr_t  value;/* literal value */
-uint8_t  *data; /* host data pointer */
-};
+
+lldb::addr_t  value;/* literal value */
+std::unique_ptr data_ap; /* host data pointer */
 };
 
 virtual
@@ -58,7 +57,7 @@
  lldb::addr_t returnAddress, 
  llvm::ArrayRef args) const = 0;
 
-// Prepare trivial call used from ThreadPlanFunctionCallGDB
+// Prepare trivial call used from ThreadPlanFunctionCallUsingABI
 // AD:
 //  . Because i don't want to change other ABI's this is not declared pure virtual.
 //The dummy implementation will simply fail.  Only HexagonABI will currently
Index: include/lldb/Target/ThreadPlanCallFunction.h
===
--- include/lldb/Target/ThreadPlanCallFunction.h
+++ include/lldb/Target/ThreadPlanCallFunction.h
@@ -34,6 +34,10 @@
 llvm::ArrayRef args,
 const EvaluateExpressionOptions &options);
 
+ThreadPlanCallFunction(Thread &thread,
+   const Address &function,
+   const EvaluateExpressionOptions &options);
+
 virtual
 ~ThreadPlanCallFunction ();
 
@@ -133,9 +137,10 @@
 
 virtual bool
 DoPlanExplainsStop (Event *event_ptr);
+   
+virtual void
+SetReturnValue();
 
-private:
-
 bool
 ConstructorSetup (Thread &thread,
   ABI *& abi,
@@ -153,7 +158,7 @@
 
 bool
 BreakpointsExplainStop ();
-
+
 boolm_valid;
 boolm_stop_other_threads;
 boolm_unwind_on_error;
@@ -172,7 +177,6 @@
  // it's nice to know the real stop reason.
  //

Re: [Lldb-commits] [PATCH] Add handling of async notify packets.

2015-06-19 Thread Ewan Crawford
Thanks for taking a look Greg.


REPOSITORY
  rL LLVM

http://reviews.llvm.org/D10544

Files:
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
  source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
  source/Plugins/Process/gdb-remote/ProcessGDBRemote.h

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
===
--- source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
+++ source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
@@ -929,6 +929,57 @@
 return final_output.str();
 }
 
+bool
+GDBRemoteCommunicationClient::SendvContPacket
+(
+ProcessGDBRemote *process,
+const char *payload,
+size_t packet_length,
+StringExtractorGDBRemote &response
+)
+{
+
+m_curr_tid = LLDB_INVALID_THREAD_ID;
+Log *log(ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PROCESS));
+if (log)
+log->Printf("GDBRemoteCommunicationClient::%s ()", __FUNCTION__);
+
+// we want to lock down packet sending while we continue
+Mutex::Locker locker(m_sequence_mutex);
+
+// here we broadcast this before we even send the packet!!
+// this signals doContinue() to exit
+BroadcastEvent(eBroadcastBitRunPacketSent, NULL);
+
+// set the public state to running
+m_public_is_running.SetValue(true, eBroadcastNever);
+
+// Set the starting continue packet into "continue_packet". This packet
+// may change if we are interrupted and we continue after an async packet...
+std::string continue_packet(payload, packet_length);
+
+if (log)
+log->Printf("GDBRemoteCommunicationClient::%s () sending vCont packet: %s", __FUNCTION__, continue_packet.c_str());
+
+if (SendPacketNoLock(continue_packet.c_str(), continue_packet.size()) != PacketResult::Success)
+ return false;
+
+// set the private state to running and broadcast this
+m_private_is_running.SetValue(true, eBroadcastAlways);
+
+if (log)
+log->Printf("GDBRemoteCommunicationClient::%s () ReadPacket(%s)", __FUNCTION__, continue_packet.c_str());
+
+// wait for the response to the vCont
+if (ReadPacket(response, UINT32_MAX, false) == PacketResult::Success)
+{
+if (response.IsOKResponse())
+return true;
+}
+
+return false;
+}
+
 StateType
 GDBRemoteCommunicationClient::SendContinuePacketAndWaitForResponse
 (
Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
===
--- source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
+++ source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
@@ -78,6 +78,11 @@
   const char *packet_payload,
   size_t packet_length,
   StringExtractorGDBRemote &response);
+bool
+SendvContPacket (ProcessGDBRemote *process,
+ const char *payload,
+ size_t packet_length,
+ StringExtractorGDBRemote &response);
 
 bool
 GetThreadSuffixSupported () override;
Index: source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
===
--- source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -1592,7 +1592,18 @@
 {
 // All threads are resuming...
 m_gdb_comm.SetCurrentThreadForRun (-1);
-continue_packet.PutChar ('s');
+
+// If in Non-Stop-Mode use vCont when stepping
+if (GetTarget().GetNonStopModeEnabled())
+{
+if (m_gdb_comm.GetVContSupported('s'))
+continue_packet.PutCString("vCont;s");
+else
+continue_packet.PutChar('s');
+}
+else
+continue_packet.PutChar('s');
+
 continue_packet_error = false;
 }
 else if (num_continue_c_tids == 0 &&
@@ -3228,7 +3239,35 @@
 log->Printf("ProcessGDBRemote::%s () - Called when Async thread was not running.", __FUNCTION__);
 }
 
+bool
+ProcessGDBRemote::HandleNotifyPacket (StringExtractorGDBRemote &packet)
+{
+// get the packet at a string
+const std::string &pkt = packet.GetStringRef();
+// skip %stop:
+StringExtractorGDBRemote stop_info(pkt.c_str() + 5);
 
+// pass as a thread stop info packet
+SetLastStopPacket(stop_info);
+
+// check for more stop reasons
+HandleStopReplySequence();
+
+// if the process is stopped then we need to 

[Lldb-commits] [PATCH] Add handling of async notify packets.

2015-06-18 Thread Ewan Crawford
Hi clayborg,

This patch adds a listener to the AynscThread in ProcessGDBRemote, specifically 
for dealing with any async notification packets.

>From the broadcast our listener receives we can process the notify packet from 
>the event data.  A handler function then sets the thread stop info from this 
>packet, and updates lldb by setting the process private state to stopped. 
>Allowing the async thread to go back to sleep and getting the main thread to 
>handle the implications of a state change.

When sending a vCont in nonstop mode we also get a different reply from 
all-stop mode, an OK response as opposed to a stop reply. So a condition is 
added to handle this and set the process state without the stop-reply data.

REPOSITORY
  rL LLVM

http://reviews.llvm.org/D10544

Files:
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
  source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
  source/Plugins/Process/gdb-remote/ProcessGDBRemote.h

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
===
--- source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
+++ source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
@@ -872,6 +872,57 @@
 return final_output.str();
 }
 
+bool
+GDBRemoteCommunicationClient::SendvContPacket
+(
+ProcessGDBRemote *process,
+const char *payload,
+size_t packet_length,
+StringExtractorGDBRemote &response
+)
+{
+
+m_curr_tid = LLDB_INVALID_THREAD_ID;
+Log *log(ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PROCESS));
+if (log)
+log->Printf("GDBRemoteCommunicationClient::%s ()", __FUNCTION__);
+
+// we want to lock down packet sending while we continue
+Mutex::Locker locker(m_sequence_mutex);
+
+// here we broadcast this before we even send the packet!!
+// this signals doContinue() to exit
+BroadcastEvent(eBroadcastBitRunPacketSent, NULL);
+
+// set the public state to running
+m_public_is_running.SetValue(true, eBroadcastNever);
+
+// Set the starting continue packet into "continue_packet". This packet
+// may change if we are interrupted and we continue after an async packet...
+std::string continue_packet(payload, packet_length);
+
+if (log)
+log->Printf("GDBRemoteCommunicationClient::%s () sending vCont packet: %s", __FUNCTION__, continue_packet.c_str());
+
+if (SendPacketNoLock(continue_packet.c_str(), continue_packet.size()) != PacketResult::Success)
+ return false;
+
+// set the private state to running and broadcast this
+m_private_is_running.SetValue(true, eBroadcastAlways);
+
+if (log)
+log->Printf("GDBRemoteCommunicationClient::%s () ReadPacket(%s)", __FUNCTION__, continue_packet.c_str());
+
+// wait for the response to the vCont
+if (ReadPacket(response, UINT32_MAX, false) == PacketResult::Success)
+{
+if (response.IsOKResponse())
+return true;
+}
+
+return false;
+}
+
 StateType
 GDBRemoteCommunicationClient::SendContinuePacketAndWaitForResponse
 (
Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
===
--- source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
+++ source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
@@ -78,6 +78,11 @@
   const char *packet_payload,
   size_t packet_length,
   StringExtractorGDBRemote &response);
+bool
+SendvContPacket (ProcessGDBRemote *process,
+ const char *payload,
+ size_t packet_length,
+ StringExtractorGDBRemote &response);
 
 bool
 GetThreadSuffixSupported () override;
Index: source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
===
--- source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -1592,7 +1592,18 @@
 {
 // All threads are resuming...
 m_gdb_comm.SetCurrentThreadForRun (-1);
-continue_packet.PutChar ('s');
+
+// If in Non-Stop-Mode use vCont when stepping
+if (GetTarget().GetNonStopModeEnabled())
+{
+if (m_gdb_comm.GetVContSupported('s'))
+continue_packet.PutCString("vCont;s");
+else
+continue_packet.PutChar('s');
+}
+else
+continue_packet.PutChar('s');
+
  

Re: [Lldb-commits] [PATCH] Add Read Thread to GDBRemoteCommunication.

2015-06-16 Thread Ewan Crawford
REPOSITORY
  rL LLVM

http://reviews.llvm.org/D10085

Files:
  lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
  lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h
  lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
  lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
Index: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
===
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
@@ -145,7 +145,7 @@
 PacketResult packet_result = PacketResult::Success;
 const uint32_t timeout_usec = 10 * 1000; // Wait for 10 ms for a response
 while (packet_result == PacketResult::Success)
-packet_result = WaitForPacketWithTimeoutMicroSecondsNoLock (response, timeout_usec, false);
+packet_result = ReadPacket (response, timeout_usec, false);
 
 // The return value from QueryNoAckModeSupported() is true if the packet
 // was sent and _any_ response (including UNIMPLEMENTED) was received),
@@ -654,7 +654,7 @@
 {
 PacketResult packet_result = SendPacketNoLock (payload, payload_length);
 if (packet_result == PacketResult::Success)
-packet_result = WaitForPacketWithTimeoutMicroSecondsNoLock (response, GetPacketTimeoutInMicroSeconds (), true);
+packet_result = ReadPacket (response, GetPacketTimeoutInMicroSeconds (), true);
 return packet_result;
 }
 
@@ -670,6 +670,12 @@
 PacketResult packet_result = PacketResult::ErrorSendFailed;
 Mutex::Locker locker;
 Log *log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PROCESS));
+
+// In order to stop async notifications from being processed in the middle of the
+// send/recieve sequence Hijack the broadcast. Then rebroadcast any events when we are done.
+static Listener hijack_listener("lldb.NotifyHijacker");
+HijackBroadcaster(&hijack_listener, eBroadcastBitGdbReadThreadGotNotify);
+
 if (GetSequenceMutex (locker))
 {
 packet_result = SendPacketAndWaitForResponseNoLock (payload, payload_length, response);
@@ -761,6 +767,15 @@
 log->Printf("error: failed to get packet sequence mutex, not sending packet '%*s'", (int) payload_length, payload);
 }
 }
+
+// Remove our Hijacking listner from the broadcast.
+RestoreBroadcaster();
+
+// If a notification event occured, rebroadcast since it can now be processed safely.  
+EventSP event_sp;
+if (hijack_listener.GetNextEvent(event_sp))
+BroadcastEvent(event_sp);
+
 return packet_result;
 }
 
@@ -902,9 +917,9 @@
 got_async_packet = false;
 
 if (log)
-log->Printf ("GDBRemoteCommunicationClient::%s () WaitForPacket(%s)", __FUNCTION__, continue_packet.c_str());
+log->Printf ("GDBRemoteCommunicationClient::%s () ReadPacket(%s)", __FUNCTION__, continue_packet.c_str());
 
-if (WaitForPacketWithTimeoutMicroSecondsNoLock(response, UINT32_MAX, false) == PacketResult::Success)
+if (ReadPacket(response, UINT32_MAX, false) == PacketResult::Success)
 {
 if (response.Empty())
 state = eStateInvalid;
@@ -961,7 +976,7 @@
 // packet to make sure it doesn't get in the way
 StringExtractorGDBRemote extra_stop_reply_packet;
 uint32_t timeout_usec = 1000;
-if (WaitForPacketWithTimeoutMicroSecondsNoLock (extra_stop_reply_packet, timeout_usec, false) == PacketResult::Success)
+if (ReadPacket (extra_stop_reply_packet, timeout_usec, false) == PacketResult::Success)
 {
 switch (extra_stop_reply_packet.GetChar())
 {
@@ -1139,7 +1154,7 @@
 else
 {
 if (log)
-log->Printf ("GDBRemoteCommunicationClient::%s () WaitForPacket(...) => false", __FUNCTION__);
+log->Printf ("GDBRemoteCommunicationClient::%s () ReadPacket(...) => false", __FUNCTION__);
 state = eStateInvalid;
 }
 }
Index: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
===
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
@@ -171,6 +171,12 @@
 {
 Disconnect();
 }
+
+// Stop the communications read thread which is used to parse all
+// incoming packets.  This function will block until the read
+// thread retu

[Lldb-commits] [lldb] r239824 - Add Read Thread to GDBRemoteCommunication

2015-06-16 Thread Ewan Crawford
Author: ewancrawford
Date: Tue Jun 16 10:50:18 2015
New Revision: 239824

URL: http://llvm.org/viewvc/llvm-project?rev=239824&view=rev
Log:
Add Read Thread to GDBRemoteCommunication

In order to support asynchronous notifications for non-stop mode this patch 
adds a packet read thread. This is done by implementing AppendBytesToCache() 
from the communications class, which continually reads packets into a packet 
queue. To initialize this thread StartReadThread() must be called by the 
client, so since llgs and platform tools use the GBDRemoteCommunicatos code 
they must also call this function as well as ProcessGDBRemote.

When the read thread detects an async notify packet it broadcasts this event, 
where the matching listener will be added in the next non-stop patch.

Packets are now accessed by calling ReadPacket() which pops a packet from the 
queue, instead of using WaitForPacketWithTimeoutMicroSecondsNoLock()

Reviewers: vharron, clayborg

Subscribers: lldb-commits, labath, ted, domipheus, deepak2427 

Differential Revision: http://reviews.llvm.org/D10085



Modified:
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h

lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp

Modified: 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp?rev=239824&r1=239823&r2=239824&view=diff
==
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp 
(original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp Tue 
Jun 16 10:50:18 2015
@@ -171,6 +171,12 @@ GDBRemoteCommunication::~GDBRemoteCommun
 {
 Disconnect();
 }
+
+// Stop the communications read thread which is used to parse all
+// incoming packets.  This function will block until the read
+// thread returns.
+if (m_read_thread_enabled)
+StopReadThread();
 }
 
 char
@@ -295,7 +301,7 @@ GDBRemoteCommunication::PacketResult
 GDBRemoteCommunication::GetAck ()
 {
 StringExtractorGDBRemote packet;
-PacketResult result = WaitForPacketWithTimeoutMicroSecondsNoLock (packet, 
GetPacketTimeoutInMicroSeconds (), false);
+PacketResult result = ReadPacket (packet, GetPacketTimeoutInMicroSeconds 
(), false);
 if (result == PacketResult::Success)
 {
 if (packet.GetResponseType() == 
StringExtractorGDBRemote::ResponseType::eAck)
@@ -324,6 +330,62 @@ GDBRemoteCommunication::WaitForNotRunnin
 }
 
 GDBRemoteCommunication::PacketResult
+GDBRemoteCommunication::ReadPacket (StringExtractorGDBRemote &response, 
uint32_t timeout_usec, bool sync_on_timeout)
+{
+   if (m_read_thread_enabled)
+   return PopPacketFromQueue (response, timeout_usec);
+   else
+   return WaitForPacketWithTimeoutMicroSecondsNoLock (response, 
timeout_usec, sync_on_timeout);
+}
+
+
+// This function is called when a packet is requested.
+// A whole packet is popped from the packet queue and returned to the caller.
+// Packets are placed into this queue from the communication read thread.
+// See GDBRemoteCommunication::AppendBytesToCache.
+GDBRemoteCommunication::PacketResult
+GDBRemoteCommunication::PopPacketFromQueue (StringExtractorGDBRemote 
&response, uint32_t timeout_usec)
+{
+// Calculate absolute timeout value
+TimeValue timeout = TimeValue::Now();
+timeout.OffsetWithMicroSeconds(timeout_usec);
+
+do
+{
+// scope for the mutex
+{
+// lock down the packet queue
+Mutex::Locker locker(m_packet_queue_mutex);
+
+// Wait on condition variable.
+if (m_packet_queue.size() == 0)
+m_condition_queue_not_empty.Wait(m_packet_queue_mutex, 
&timeout);
+
+if (m_packet_queue.size() > 0)
+{
+// get the front element of the queue
+response = m_packet_queue.front();
+
+// remove the front element
+m_packet_queue.pop();
+
+// we got a packet
+return PacketResult::Success;
+}
+ }
+
+ // Disconnected
+ if (!IsConnected())
+ return PacketResult::ErrorDisconnected;
+
+  // Loop while not timed out
+} while (TimeValue::Now() < timeout);
+
+return PacketResult::ErrorReplyTimeout;
+}
+
+
+GDBRemoteCommunication::PacketResult
 GDBRemoteCommunication::WaitForPacketWithTimeoutMicroSecondsNoLock 
(StringExtractorGDBRemote &packet, uint32_t timeout_usec, bool sync_on_timeout)
 {
 uint8_t buffer[8192];
@@ -1094,3 +1156,53 @@ GDBRemoteCommunication::ScopedTimeout::~
 {
 m_gdb_comm.SetPacketTimeout (m_saved_timeout);
 }
+
+// This func

Re: [Lldb-commits] [PATCH] Add Read Thread to GDBRemoteCommunication.

2015-06-11 Thread Ewan Crawford
I looked into how GDB processes async packets with only one thread. Essentially 
GDB has a high level event loop which listens for events from multiple sources. 
Events are queued and only processed later by calling the appropriate handler, 
allowing the event loop to continue listening for more events. There is an 
event for async notification packets which is generated when the notify packet 
is received, but only responded later so that it doesn't interfere with regular 
synchronous communication.  The event itself is generated from either polling 
the serial connection or looking for a synchronous response after a send.

For our purposes polling isn't the best solution since we can spawn a thread 
from Communication easily. However delaying the notify processing does address 
a race condition I didn't previously cover.

(a)  ---> m
 (b) <--- %notify
 (c)  [broadcast notify packet received]
 (d)  ---> vStopped [broadcast is handled by listener in AysncThread before 
reply to (a) is received]
 (e)  <--- memory reply to (a), unexpected response to vStopped.

This patch fixes this by getting SendPacketAndWaitForResponse() to Hijack the 
notify broadcast, then rebroadcasting after the synchronous response has been 
seen. Avoiding interference with regular synchronous communication.


REPOSITORY
  rL LLVM

http://reviews.llvm.org/D10085

Files:
  source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
  source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
  source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
===
--- source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
+++ source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
@@ -171,6 +171,12 @@
 {
 Disconnect();
 }
+
+// Stop the communications read thread which is used to parse all
+// incoming packets.  This function will block until the read
+// thread returns.
+if (m_read_thread_enabled)
+StopReadThread();
 }
 
 char
@@ -295,7 +301,7 @@
 GDBRemoteCommunication::GetAck ()
 {
 StringExtractorGDBRemote packet;
-PacketResult result = WaitForPacketWithTimeoutMicroSecondsNoLock (packet, GetPacketTimeoutInMicroSeconds (), false);
+PacketResult result = ReadPacket (packet, GetPacketTimeoutInMicroSeconds (), false);
 if (result == PacketResult::Success)
 {
 if (packet.GetResponseType() == StringExtractorGDBRemote::ResponseType::eAck)
@@ -324,6 +330,62 @@
 }
 
 GDBRemoteCommunication::PacketResult
+GDBRemoteCommunication::ReadPacket (StringExtractorGDBRemote &response, uint32_t timeout_usec, bool sync_on_timeout)
+{
+   if (m_read_thread_enabled)
+   return PopPacketFromQueue (response, timeout_usec);
+   else
+   return WaitForPacketWithTimeoutMicroSecondsNoLock (response, timeout_usec, sync_on_timeout);
+}
+
+
+// This function is called when a packet is requested.
+// A whole packet is popped from the packet queue and returned to the caller.
+// Packets are placed into this queue from the communication read thread.
+// See GDBRemoteCommunication::AppendBytesToCache.
+GDBRemoteCommunication::PacketResult
+GDBRemoteCommunication::PopPacketFromQueue (StringExtractorGDBRemote &response, uint32_t timeout_usec)
+{
+// Calculate absolute timeout value
+TimeValue timeout = TimeValue::Now();
+timeout.OffsetWithMicroSeconds(timeout_usec);
+
+do
+{
+// scope for the mutex
+{
+// lock down the packet queue
+Mutex::Locker locker(m_packet_queue_mutex);
+
+// Wait on condition variable.
+if (m_packet_queue.size() == 0)
+m_condition_queue_not_empty.Wait(m_packet_queue_mutex, &timeout);
+
+if (m_packet_queue.size() > 0)
+{
+// get the front element of the queue
+response = m_packet_queue.front();
+
+// remove the front element
+m_packet_queue.pop();
+
+// we got a packet
+return PacketResult::Success;
+}
+ }
+
+ // Disconnected
+ if (!IsConnected())
+ return PacketResult::ErrorDisconnected;
+
+  // Loop while not timed out
+} while (TimeValue::Now() < timeout);
+
+return PacketResult::ErrorReplyTimeout;
+}
+
+
+GDBRemoteCommunication::PacketResult
 GDBRemoteCommunication::WaitForPacketWithTimeoutMicroSecondsNoLock (StringExtractorGDBRemote &packet, uint32_t timeout_usec, bool sync_on_timeout)
 {
 uint8_t buffer[8192];
@@ -1094,3 +1156,53 @@
 {
 m_gdb_comm.SetPacketTimeout (m_saved_timeout);
 }
+
+// This function is called via the Communications class read thread when bytes become available
+// for this connection. Th

[Lldb-commits] [lldb] r238323 - Change ProcessGDBRemote last stop packet to a container.

2015-05-27 Thread Ewan Crawford
Author: ewancrawford
Date: Wed May 27 09:12:34 2015
New Revision: 238323

URL: http://llvm.org/viewvc/llvm-project?rev=238323&view=rev
Log:
Change ProcessGDBRemote last stop packet to a container.

In ProcessGDBRemote we currently have a single packet, m_last_stop_packet, used 
to set the thread stop info.
However in non-stop mode we can receive several stop reply packets in a 
sequence for different threads. As a result we need to use a container to hold 
them before they are processed.

This patch also changes the return type of CheckPacket() so we can detect async 
notification packets.

Reviewers: clayborg

Subscribers: labath, ted, deepak2427, lldb-commits

Differential Revision: http://reviews.llvm.org/D9853

Modified:
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h
lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h

Modified: 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp?rev=238323&r1=238322&r2=238323&view=diff
==
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp 
(original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp Wed 
May 27 09:12:34 2015
@@ -329,7 +329,7 @@ GDBRemoteCommunication::WaitForPacketWit
 Log *log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PACKETS 
| GDBR_LOG_VERBOSE));
 
 // Check for a packet from our cache first without trying any reading...
-if (CheckForPacket (NULL, 0, packet))
+if (CheckForPacket(NULL, 0, packet) != PacketType::Invalid)
 return PacketResult::Success;
 
 bool timed_out = false;
@@ -349,7 +349,7 @@ GDBRemoteCommunication::WaitForPacketWit
 
 if (bytes_read > 0)
 {
-if (CheckForPacket (buffer, bytes_read, packet))
+if (CheckForPacket(buffer, bytes_read, packet) != 
PacketType::Invalid)
 return PacketResult::Success;
 }
 else
@@ -383,7 +383,7 @@ GDBRemoteCommunication::WaitForPacketWit
 return PacketResult::ErrorReplyFailed;
 }
 
-bool
+GDBRemoteCommunication::PacketType
 GDBRemoteCommunication::CheckForPacket (const uint8_t *src, size_t src_len, 
StringExtractorGDBRemote &packet)
 {
 // Put the packet data into the buffer in a thread safe fashion
@@ -405,6 +405,8 @@ GDBRemoteCommunication::CheckForPacket (
 m_bytes.append ((const char *)src, src_len);
 }
 
+bool isNotifyPacket = false;
+
 // Parse up the packets into gdb remote packets
 if (!m_bytes.empty())
 {
@@ -425,6 +427,9 @@ GDBRemoteCommunication::CheckForPacket (
 break;
 
 case '%': // Async notify packet
+isNotifyPacket = true;
+// Intentional fall through
+
 case '$':
 // Look for a standard gdb packet?
 {
@@ -487,7 +492,7 @@ GDBRemoteCommunication::CheckForPacket (
 if (content_length == std::string::npos)
 {
 packet.Clear();
-return false;
+return GDBRemoteCommunication::PacketType::Invalid;
 }
 else if (total_length > 0)
 {
@@ -626,11 +631,15 @@ GDBRemoteCommunication::CheckForPacket (
 
 m_bytes.erase(0, total_length);
 packet.SetFilePos(0);
-return success;
+
+if (isNotifyPacket)
+return GDBRemoteCommunication::PacketType::Notify;
+else
+return GDBRemoteCommunication::PacketType::Standard;
 }
 }
 packet.Clear();
-return false;
+return GDBRemoteCommunication::PacketType::Invalid;
 }
 
 Error

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h?rev=238323&r1=238322&r2=238323&view=diff
==
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h 
(original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h Wed 
May 27 09:12:34 2015
@@ -49,7 +49,14 @@ public:
 {
 eBroadcastBitRunPacketSent = kLoUserBroadcastBit
 };
-
+
+enum class PacketType
+{
+Invalid = 0,
+Standard,
+Notify
+};
+
 enum class PacketResult
 {
 Success = 0,// Success
@@ -101,7 +108,7 @@ public:
 bool
 GetSequenceMutex (Mutex::Locker& locker, const char *failure_message = 
NULL);
 
-bool
+PacketType
 CheckForPacket (const uint8_t *src, 
 size_t src_len, 
 

[Lldb-commits] [lldb] r237239 - Remote Non-Stop Support

2015-05-13 Thread Ewan Crawford
Author: ewancrawford
Date: Wed May 13 04:18:18 2015
New Revision: 237239

URL: http://llvm.org/viewvc/llvm-project?rev=237239&view=rev
Log:
Remote Non-Stop Support
 
Summary:
 
This patch is the beginnings of support for Non-stop mode in the remote 
protocol. Letting a user examine stopped threads, while other threads execute 
freely.

Non-stop mode is enabled using the setting target.non-stop-mode, which sends a 
QNonStop packet when establishing the remote connection.
Changes are also made to treat the '?' stop reply packet differently in 
non-stop mode, according to spec 
https://sourceware.org/gdb/current/onlinedocs/gdb/Remote-Non_002dStop.html#Remote-Non_002dStop.
A setting for querying the remote for default thread on setup is also included.

Handling of '%' async notification packets will be added next.

Reviewers: clayborg

Subscribers: lldb-commits, ADodds, ted, deepak2427

Differential Revision: http://reviews.llvm.org/D9656


Modified:
lldb/trunk/include/lldb/Target/Target.h
lldb/trunk/source/Commands/CommandObjectThread.cpp
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp

lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
lldb/trunk/source/Target/Target.cpp
lldb/trunk/source/Utility/StringExtractorGDBRemote.cpp
lldb/trunk/source/Utility/StringExtractorGDBRemote.h

Modified: lldb/trunk/include/lldb/Target/Target.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Target.h?rev=237239&r1=237238&r2=237239&view=diff
==
--- lldb/trunk/include/lldb/Target/Target.h (original)
+++ lldb/trunk/include/lldb/Target/Target.h Wed May 13 04:18:18 2015
@@ -189,6 +189,9 @@ public:
 
 void
 SetUserSpecifiedTrapHandlerNames (const Args &args);
+
+bool
+GetNonStopModeEnabled () const;
 
 bool
 GetDisplayRuntimeSupportValues () const;

Modified: lldb/trunk/source/Commands/CommandObjectThread.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectThread.cpp?rev=237239&r1=237238&r2=237239&view=diff
==
--- lldb/trunk/source/Commands/CommandObjectThread.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectThread.cpp Wed May 13 04:18:18 2015
@@ -433,6 +433,12 @@ public:
 m_step_in_avoid_no_debug = eLazyBoolCalculate;
 m_step_out_avoid_no_debug = eLazyBoolCalculate;
 m_run_mode = eOnlyDuringStepping;
+
+// Check if we are in Non-Stop mode
+lldb::TargetSP target_sp = 
m_interpreter.GetDebugger().GetSelectedTarget();
+if (target_sp.get() != nullptr && 
target_sp->GetNonStopModeEnabled())
+m_run_mode = eOnlyThisThread;
+
 m_avoid_regexp.clear();
 m_step_in_target.clear();
 m_class_name.clear();

Modified: 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp?rev=237239&r1=237238&r2=237239&view=diff
==
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp 
(original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp Wed 
May 13 04:18:18 2015
@@ -424,6 +424,7 @@ GDBRemoteCommunication::CheckForPacket (
 content_length = total_length = 1;  // The command is one byte 
long...
 break;
 
+case '%': // Async notify packet
 case '$':
 // Look for a standard gdb packet?
 {
@@ -466,6 +467,7 @@ GDBRemoteCommunication::CheckForPacket (
 case '+':
 case '-':
 case '\x03':
+case '%':
 case '$':
 done = true;
 break;
@@ -586,7 +588,7 @@ GDBRemoteCommunication::CheckForPacket (
 }
 }
 
-if (m_bytes[0] == '$')
+if (m_bytes[0] == '$' || m_bytes[0] == '%')
 {
 assert (checksum_idx < m_bytes.size());
 if (::isxdigit (m_bytes[checksum_idx+0]) || 

Modified: 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp?rev=237239&r1=237238&r2=237239&view=diff
==
--- 
lldb/trunk/source

[Lldb-commits] [lldb] r235980 - test commit

2015-04-28 Thread Ewan Crawford
Author: ewancrawford
Date: Tue Apr 28 07:34:19 2015
New Revision: 235980

URL: http://llvm.org/viewvc/llvm-project?rev=235980&view=rev
Log:
test commit

Modified:
lldb/trunk/docs/lldb-for-gdb-users.txt

Modified: lldb/trunk/docs/lldb-for-gdb-users.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/docs/lldb-for-gdb-users.txt?rev=235980&r1=235979&r2=235980&view=diff
==
--- lldb/trunk/docs/lldb-for-gdb-users.txt (original)
+++ lldb/trunk/docs/lldb-for-gdb-users.txt Tue Apr 28 07:34:19 2015
@@ -280,7 +280,7 @@ Finally, there's:
 
 (lldb) thread until 100
 
-which runs the thread in the current frame till it reaches line 100 in
+Which runs the thread in the current frame till it reaches line 100 in
 this frame or stops if it leaves the current frame.  This is a pretty 
 close equivalent to gdb's "until" command.
 


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] MI support for '-var-create $regname' command.

2015-04-17 Thread Ewan Crawford

Test looks like it still fails, need to change
self.expect("\^done,value=\"0x0006\"")
to self.expect("\^done,value=\"0x0006\"") for 32 bit.

Best,
 Ewan

On 17/04/2015 16:49, Ilia K wrote:

Oops.. done:
$ svn ci
Sendingtest/tools/lldb-mi/variable/TestMiVar.py
Transmitting file data .
Committed revision 235197.

Thanks,
Ilia

On Fri, Apr 17, 2015 at 6:39 PM, Pavel Labath <mailto:lab...@google.com>> wrote:


This test is failing on Linux i386.

http://lab.llvm.org:8011/builders/lldb-x86_64-ubuntu-14.04-cmake/builds/1755

==
  ERROR: test_lldbmi_var_create_register (TestMiVar.MiVarTestCase)
 Test that 'lldb-mi --interpreter' works for -var-create $regname.
--
  Traceback (most recent call last):
File
"/lldb-buildbot/lldbSlave/buildWorkingDir/llvm/tools/lldb/test/lldbtest.py",
line 447, in wrapper
  return func(self, *args, **kwargs)
File
"/lldb-buildbot/lldbSlave/buildWorkingDir/llvm/tools/lldb/test/lldbtest.py",
line 562, in wrapper
  func(*args, **kwargs)
File

"/lldb-buildbot/lldbSlave/buildWorkingDir/llvm/tools/lldb/test/tools/lldb-mi/variable/TestMiVar.py",
line 215, in test_lldbmi_var_create_register

self.expect("\^done,name=\"var_reg\",numchild=\"0\",value=\"0x[0-9a-f]+\",type=\"unsigned
long\",thread-id=\"1\",has_more=\"0\"")
File

"/lldb-buildbot/lldbSlave/buildWorkingDir/llvm/tools/lldb/test/tools/lldb-mi/lldbmi_testcase.py",
line 46, in expect
  return self.child.expect(pattern, *args, **kwargs)
File

"/lldb-buildbot/lldbSlave/buildWorkingDir/llvm/tools/lldb/test/pexpect-2.4/pexpect.py",
line 1316, in expect
  return self.expect_list(compiled_pattern_list, timeout,
searchwindowsize)
File

"/lldb-buildbot/lldbSlave/buildWorkingDir/llvm/tools/lldb/test/pexpect-2.4/pexpect.py",
line 1330, in expect_list
  return self.expect_loop(searcher_re(pattern_list), timeout,
searchwindowsize)
File

"/lldb-buildbot/lldbSlave/buildWorkingDir/llvm/tools/lldb/test/pexpect-2.4/pexpect.py",
line 1414, in expect_loop
  raise TIMEOUT (str(e) + '\n' + str(self))
  TIMEOUT: Timeout exceeded in read_nonblocking().

    Could you fix/revert/XFAIL, please?


REPOSITORY
  rL LLVM

http://reviews.llvm.org/D8965

EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/





--
Ewan Crawford
Codeplay Software Ltd
45 York Place, Edinburgh, EH1 3HP
Tel: 0131 466 0503
Fax: 0131 557 6600
Website: http://www.codeplay.com
Twitter: https://twitter.com/codeplaysoft

This email and any attachments may contain confidential and /or privileged 
information and is for use by the addressee only. If you are not the intended 
recipient, please notify Codeplay Software Ltd immediately and delete the 
message from your computer. You may not copy or forward it,or use or disclose 
its contents to any other person. Any views or other information in this 
message which do not relate to our business are not authorized by Codeplay 
software Ltd, nor does this message form part of any contract unless so stated.
As internet communications are capable of data corruption Codeplay Software Ltd 
does not accept any responsibility for any changes made to this message after 
it was sent. Please note that Codeplay Software Ltd does not accept any 
liability or responsibility for viruses and it is your responsibility to scan 
any attachments.
Company registered in England and Wales, number: 04567874
Registered office: 81 Linkfield Street, Redhill RH1 6BY

___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] Include comments in LLDB-MI disassembly, and other MI changes

2015-04-09 Thread Ewan Crawford
REPOSITORY
  rL LLVM

http://reviews.llvm.org/D8923

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/



___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] Added long 'print-values' option for var-update MI command.

2015-03-04 Thread Ewan Crawford
Thanks Ilia. I don't have commit access, would you mind committing?


REPOSITORY
  rL LLVM

http://reviews.llvm.org/D8008

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/



___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] Added long 'print-values' option for var-update MI command.

2015-03-03 Thread Ewan Crawford
Updated patch with suggested changes


REPOSITORY
  rL LLVM

http://reviews.llvm.org/D8008

Files:
  lldb/tools/lldb-mi/MICmdCmdVar.cpp
  lldb/tools/lldb-mi/MICmdCmdVar.h
  lldb/tools/lldb-mi/MICmnResources.cpp

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
Index: lldb/tools/lldb-mi/MICmdCmdVar.cpp
===
--- lldb/tools/lldb-mi/MICmdCmdVar.cpp
+++ lldb/tools/lldb-mi/MICmdCmdVar.cpp
@@ -276,6 +276,9 @@
 : m_eVarInfoFormat(CMICmnLLDBDebugSessionInfo::eVariableInfoFormat_NoValues)
 , m_constStrArgPrintValues("print-values")
 , m_constStrArgName("name")
+, m_constStrArgNoValues("no-values")
+, m_constStrArgAllValues("all-values")
+, m_constStrArgSimpleValues("simple-values")
 , m_bValueChangedArrayType(false)
 , m_bValueChangedCompositeType(false)
 , m_bValueChangedNormalType(false)
@@ -312,6 +315,9 @@
 CMICmdCmdVarUpdate::ParseArgs(void)
 {
 bool bOk = m_setCmdArgs.Add(*(new CMICmdArgValNumber(m_constStrArgPrintValues, false, true)));
+bOk = bOk && m_setCmdArgs.Add(*(new CMICmdArgValOptionLong(m_constStrArgNoValues, false, true)));
+bOk = bOk && m_setCmdArgs.Add(*(new CMICmdArgValOptionLong(m_constStrArgAllValues, false, true)));
+bOk = bOk && m_setCmdArgs.Add(*(new CMICmdArgValOptionLong(m_constStrArgSimpleValues, false, true)));
 bOk = bOk && m_setCmdArgs.Add(*(new CMICmdArgValString(m_constStrArgName, true, true)));
 return (bOk && ParseValidateCmdOptions());
 }
@@ -330,7 +336,32 @@
 {
 CMICMDBASE_GETOPTION(pArgPrintValues, Number, m_constStrArgPrintValues);
 CMICMDBASE_GETOPTION(pArgName, String, m_constStrArgName);
+CMICMDBASE_GETOPTION(pArgNoValues, OptionLong, m_constStrArgNoValues);
+CMICMDBASE_GETOPTION(pArgAllValues, OptionLong, m_constStrArgAllValues);
+CMICMDBASE_GETOPTION(pArgSimpleValues, OptionLong, m_constStrArgSimpleValues);
 
+CMICmnLLDBDebugSessionInfo::VariableInfoFormat_e eVarInfoFormat;
+if (pArgPrintValues->GetFound())
+{
+const MIuint nPrintValues = pArgPrintValues->GetValue();
+if (nPrintValues >= CMICmnLLDBDebugSessionInfo::kNumVariableInfoFormats)
+{
+SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_INVALID_PRINT_VALUES), m_cmdData.strMiCmd.c_str()));
+return MIstatus::failure;
+}
+eVarInfoFormat = static_cast(nPrintValues);
+}
+else if (pArgNoValues->GetFound())
+eVarInfoFormat = CMICmnLLDBDebugSessionInfo::eVariableInfoFormat_NoValues;
+else if (pArgAllValues->GetFound())
+eVarInfoFormat = CMICmnLLDBDebugSessionInfo::eVariableInfoFormat_AllValues;
+else if (pArgSimpleValues->GetFound())
+eVarInfoFormat = CMICmnLLDBDebugSessionInfo::eVariableInfoFormat_SimpleValues;
+else
+// If no print-values, default is "no-values"
+eVarInfoFormat = CMICmnLLDBDebugSessionInfo::eVariableInfoFormat_NoValues;
+m_eVarInfoFormat = eVarInfoFormat;
+
 const CMIUtilString &rVarObjName(pArgName->GetValue());
 CMICmnLLDBDebugSessionInfoVarObj varObj;
 if (!CMICmnLLDBDebugSessionInfoVarObj::VarObjGet(rVarObjName, varObj))
@@ -339,14 +370,6 @@
 return MIstatus::failure;
 }
 
-const MIuint nPrintValues = pArgPrintValues->GetValue();
-if (nPrintValues >= CMICmnLLDBDebugSessionInfo::kNumVariableInfoFormats)
-{
-SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_INVALID_PRINT_VALUES), m_cmdData.strMiCmd.c_str()));
-return MIstatus::failure;
-}
-m_eVarInfoFormat = static_cast(nPrintValues);
-
 const CMIUtilString &rVarRealName(varObj.GetNameReal());
 MIunused(rVarRealName);
 lldb::SBValue &rValue = const_cast(varObj.GetValue());
@@ -436,7 +459,9 @@
 const CMICmnMIValueConst miValueConst(m_strValueName);
 CMICmnMIValueResult miValueResult("name", miValueConst);
 CMICmnMIValueTuple miValueTuple(miValueResult);
-if (m_eVarInfoFormat != CMICmnLLDBDebugSessionInfo::eVariableInfoFormat_NoValues)
+if (m_eVarInfoFormat == CMICmnLLDBDebugSessionInfo::eVariableInfoFormat_AllValues ||
+   (m_eVarInfoFormat == CMICmnLLDBDebugSessionInfo::eVariableInfoFormat_SimpleValues
+   && m_bValueChangedNormalType))
 {
 const CMICmnMIValueConst miValueConst2(strValue);
 CMICmnMIValueResult miValueResult2("value", miValueConst2);
@@ -511,8 +536,12 @@
 CMICmnMIValueResult miValueResult("name", miValueConst);
 CMICmnMIValueTuple miValueTuple(miValueResult);
 const CMICmnMIValueConst miValueConst2(vrStrValue);
-CMICmnMIValueResult miValueResult2("value", miValueConst2);
-bool bOk = miValueTuple.Add(miValueResult2);
+bool bOk = true;
+if(m_eVarInfoFormat == CMICmnLLDBDebugSessionInfo::eVariableInfoFormat_AllValues)
+{
+  CMICmnMIValueResult miValueResult2("value", miValueConst2);
+  bOk = bOk && miValueTuple.Add(miValueResult2);
+}
  

Re: [Lldb-commits] [PATCH] Added long 'print-values' option for var-update MI command.

2015-03-03 Thread Ewan Crawford
Thanks for the comments ki.stfu.

My understanding of MIFormResponse() is that it is only called from 
CMICmdCmdVarUpdate::Execute() when there are composite types, in which case we 
wouldn't print the values for --simple-values. So we only need to check for 
--all-values and can ignore --simple-values.
Should MIFormResponse() ever need to print values for --simple-value?

I'll add a check --simple-value to CMICmdCmdVarUpdate::Acknowledge() though, to 
print values for when m_bValueChangedNormalType is set.


REPOSITORY
  rL LLVM


Comment at: lldb/tools/lldb-mi/MICmdCmdVar.cpp:339-341
@@ -332,2 +338,5 @@
 CMICMDBASE_GETOPTION(pArgName, String, m_constStrArgName);
+CMICMDBASE_GETOPTION(pArgNoValue, OptionLong, m_constStrArgNoValues);
+CMICMDBASE_GETOPTION(pArgAllValue, OptionLong, m_constStrArgAllValues);
+CMICMDBASE_GETOPTION(pArgSimpleValue, OptionLong, 
m_constStrArgSimpleValues);
 

ki.stfu wrote:
> I think it should be pArgNoValues/pArgAllValues/pArgSimpleValues (aka 
> --no-value*s*/--all-value*s*/--simple-value*s*)
Will do


Comment at: lldb/tools/lldb-mi/MICmdCmdVar.cpp:343-357
@@ -333,1 +342,17 @@
 
+MIuint print_value = 0;
+if (pArgPrintValues->GetFound())
+{
+MIuint tmp = pArgPrintValues->GetValue();
+if (tmp <= 2)
+print_value = tmp;
+}
+else if (pArgNoValue->GetFound())
+print_value = 0; // no value
+else if (pArgAllValue->GetFound())
+print_value = 1; // all values
+else if (pArgSimpleValue->GetFound())
+print_value = 2; // simple values
+
+m_eVarInfoFormat = 
static_cast(print_value);
+

ki.stfu wrote:
> Use the following:
> ```
> CMICmnLLDBDebugSessionInfo::VariableInfoFormat_e eVarInfoFormat;
> if (pArgPrintValues->GetFound())
> {
> const MIuint nPrintValues = pArgPrintValues->GetValue();
> if (nPrintValues >= 
> CMICmnLLDBDebugSessionInfo::kNumVariableInfoFormats)
> {
> 
> SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_INVALID_PRINT_VALUES), 
> m_cmdData.strMiCmd.c_str()));
> return MIstatus::failure;
> }
> eVarInfoFormat = 
> static_cast(nPrintValues);
> }
> else if (pArgNoValues->GetFound())
> eVarInfoFormat = 
> CMICmnLLDBDebugSessionInfo::eVariableInfoFormat_NoValues;
> else if (pArgAllValues->GetFound())
> eVarInfoFormat = 
> CMICmnLLDBDebugSessionInfo::eVariableInfoFormat_AllValues;
> else if (pArgSimpleValues->GetFound())
> eVarInfoFormat = 
> CMICmnLLDBDebugSessionInfo::eVariableInfoFormat_SimpleValues;
> else
> // If no print-values, default is "no-values"
> eVarInfoFormat = 
> CMICmnLLDBDebugSessionInfo::eVariableInfoFormat_NoValues;
> m_eVarInfoFormat = eVarInfoFormat;
> ```
no problem

http://reviews.llvm.org/D8008

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/



___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] Added long 'print-values' option for var-update MI command.

2015-03-02 Thread Ewan Crawford
The -var-update MI command should take the same print-values options as 
var-list children, however currently only the integer versions are supported.
Added --no-values, --all-values, and --simple-values long options. 

See:
https://sourceware.org/gdb/onlinedocs/gdb/GDB_002fMI-Variable-Objects.html#GDB_002fMI-Variable-Objects

REPOSITORY
  rL LLVM

http://reviews.llvm.org/D8008

Files:
  lldb/tools/lldb-mi/MICmdCmdVar.cpp
  lldb/tools/lldb-mi/MICmdCmdVar.h
  lldb/tools/lldb-mi/MICmnResources.cpp

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
Index: lldb/tools/lldb-mi/MICmdCmdVar.cpp
===
--- lldb/tools/lldb-mi/MICmdCmdVar.cpp
+++ lldb/tools/lldb-mi/MICmdCmdVar.cpp
@@ -276,6 +276,9 @@
 : m_eVarInfoFormat(CMICmnLLDBDebugSessionInfo::eVariableInfoFormat_NoValues)
 , m_constStrArgPrintValues("print-values")
 , m_constStrArgName("name")
+, m_constStrArgNoValues("no-values")
+, m_constStrArgAllValues("all-values")
+, m_constStrArgSimpleValues("simple-values")
 , m_bValueChangedArrayType(false)
 , m_bValueChangedCompositeType(false)
 , m_bValueChangedNormalType(false)
@@ -312,6 +315,9 @@
 CMICmdCmdVarUpdate::ParseArgs(void)
 {
 bool bOk = m_setCmdArgs.Add(*(new CMICmdArgValNumber(m_constStrArgPrintValues, false, true)));
+bOk = bOk && m_setCmdArgs.Add(*(new CMICmdArgValOptionLong(m_constStrArgNoValues, false, true)));
+bOk = bOk && m_setCmdArgs.Add(*(new CMICmdArgValOptionLong(m_constStrArgAllValues, false, true)));
+bOk = bOk && m_setCmdArgs.Add(*(new CMICmdArgValOptionLong(m_constStrArgSimpleValues, false, true)));
 bOk = bOk && m_setCmdArgs.Add(*(new CMICmdArgValString(m_constStrArgName, true, true)));
 return (bOk && ParseValidateCmdOptions());
 }
@@ -330,7 +336,26 @@
 {
 CMICMDBASE_GETOPTION(pArgPrintValues, Number, m_constStrArgPrintValues);
 CMICMDBASE_GETOPTION(pArgName, String, m_constStrArgName);
+CMICMDBASE_GETOPTION(pArgNoValue, OptionLong, m_constStrArgNoValues);
+CMICMDBASE_GETOPTION(pArgAllValue, OptionLong, m_constStrArgAllValues);
+CMICMDBASE_GETOPTION(pArgSimpleValue, OptionLong, m_constStrArgSimpleValues);
 
+MIuint print_value = 0;
+if (pArgPrintValues->GetFound())
+{
+MIuint tmp = pArgPrintValues->GetValue();
+if (tmp <= 2)
+print_value = tmp;
+}
+else if (pArgNoValue->GetFound())
+print_value = 0; // no value
+else if (pArgAllValue->GetFound())
+print_value = 1; // all values
+else if (pArgSimpleValue->GetFound())
+print_value = 2; // simple values
+
+m_eVarInfoFormat = static_cast(print_value);
+
 const CMIUtilString &rVarObjName(pArgName->GetValue());
 CMICmnLLDBDebugSessionInfoVarObj varObj;
 if (!CMICmnLLDBDebugSessionInfoVarObj::VarObjGet(rVarObjName, varObj))
@@ -339,14 +364,6 @@
 return MIstatus::failure;
 }
 
-const MIuint nPrintValues = pArgPrintValues->GetValue();
-if (nPrintValues >= CMICmnLLDBDebugSessionInfo::kNumVariableInfoFormats)
-{
-SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_INVALID_PRINT_VALUES), m_cmdData.strMiCmd.c_str()));
-return MIstatus::failure;
-}
-m_eVarInfoFormat = static_cast(nPrintValues);
-
 const CMIUtilString &rVarRealName(varObj.GetNameReal());
 MIunused(rVarRealName);
 lldb::SBValue &rValue = const_cast(varObj.GetValue());
@@ -511,8 +528,12 @@
 CMICmnMIValueResult miValueResult("name", miValueConst);
 CMICmnMIValueTuple miValueTuple(miValueResult);
 const CMICmnMIValueConst miValueConst2(vrStrValue);
-CMICmnMIValueResult miValueResult2("value", miValueConst2);
-bool bOk = miValueTuple.Add(miValueResult2);
+bool bOk;
+if(m_eVarInfoFormat == CMICmnLLDBDebugSessionInfo::eVariableInfoFormat_AllValues)
+{
+  CMICmnMIValueResult miValueResult2("value", miValueConst2);
+  bOk = miValueTuple.Add(miValueResult2);
+}
 const CMICmnMIValueConst miValueConst3(vrStrScope);
 CMICmnMIValueResult miValueResult3("in_scope", miValueConst3);
 bOk = bOk && miValueTuple.Add(miValueResult3);
Index: lldb/tools/lldb-mi/MICmdCmdVar.h
===
--- lldb/tools/lldb-mi/MICmdCmdVar.h
+++ lldb/tools/lldb-mi/MICmdCmdVar.h
@@ -131,8 +131,11 @@
   private:
 CMIUtilString m_strValueName;
 CMICmnLLDBDebugSessionInfo::VariableInfoFormat_e m_eVarInfoFormat;
-const CMIUtilString m_constStrArgPrintValues; // Not handled by *this command
+const CMIUtilString m_constStrArgPrintValues;
 const CMIUtilString m_constStrArgName;
+const CMIUtilString m_constStrArgNoValues;
+const CMIUtilString m_constStrArgAllValues;
+const CMIUtilString m_constStrArgSimpleValues;
 bool m_bValueChangedArrayType; // True = yes value changed, false = no change
 bool m_bValueChangedCompositeType; // True = yes value changed, false = no c