Re: [Lldb-commits] [PATCH] D14020: Port the python api decorator to use test categories

2015-10-26 Thread Pavel Labath via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL251277: Port the python api decorator to use test categories 
(authored by labath).

Changed prior to commit:
  http://reviews.llvm.org/D14020?vs=38235&id=38383#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D14020

Files:
  lldb/trunk/test/dotest.py
  lldb/trunk/test/dotest_args.py
  lldb/trunk/test/expression_command/test/TestExprs.py
  
lldb/trunk/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommandsFromPython.py
  
lldb/trunk/test/functionalities/breakpoint/breakpoint_conditions/TestBreakpointConditions.py
  
lldb/trunk/test/functionalities/breakpoint/breakpoint_ignore_count/TestBreakpointIgnoreCount.py
  
lldb/trunk/test/functionalities/breakpoint/cpp_exception/TestCPPExceptionBreakpoint.py
  lldb/trunk/test/functionalities/command_script/import/TestImport.py
  
lldb/trunk/test/functionalities/command_script/import/rdar-12586188/TestRdar12586188.py
  lldb/trunk/test/functionalities/conditional_break/TestConditionalBreak.py
  
lldb/trunk/test/functionalities/data-formatter/data-formatter-stl/libcxx/list/loop/TestDataFormatterLibcxxListLoop.py
  
lldb/trunk/test/functionalities/dynamic_value_child_count/TestDynamicValueChildCount.py
  lldb/trunk/test/functionalities/inferior-assert/TestInferiorAssert.py
  lldb/trunk/test/functionalities/inferior-crashing/TestInferiorCrashing.py
  
lldb/trunk/test/functionalities/inferior-crashing/recursive-inferior/TestRecursiveInferior.py
  lldb/trunk/test/functionalities/inline-stepping/TestInlineStepping.py
  lldb/trunk/test/functionalities/return-value/TestReturnValue.py
  lldb/trunk/test/functionalities/step-avoids-no-debug/TestStepNoDebug.py
  
lldb/trunk/test/functionalities/thread/thread_specific_break/TestThreadSpecificBreakpoint.py
  
lldb/trunk/test/functionalities/watchpoint/watchpoint_events/TestWatchpointEvents.py
  lldb/trunk/test/lang/c/array_types/TestArrayTypes.py
  lldb/trunk/test/lang/c/bitfields/TestBitfields.py
  lldb/trunk/test/lang/c/stepping/TestStepAndBreakpoints.py
  lldb/trunk/test/lang/cpp/class_static/TestStaticVariables.py
  lldb/trunk/test/lang/cpp/class_types/TestClassTypes.py
  lldb/trunk/test/lang/cpp/class_types/TestClassTypesDisassembly.py
  lldb/trunk/test/lang/cpp/dynamic-value/TestCppValueCast.py
  lldb/trunk/test/lang/cpp/dynamic-value/TestDynamicValue.py
  lldb/trunk/test/lang/cpp/stl/TestSTL.py
  lldb/trunk/test/lang/go/goroutines/TestGoroutines.py
  lldb/trunk/test/lang/go/types/TestGoASTContext.py
  lldb/trunk/test/lang/objc/blocks/TestObjCIvarsInBlocks.py
  lldb/trunk/test/lang/objc/foundation/TestObjCMethods.py
  lldb/trunk/test/lang/objc/foundation/TestObjectDescriptionAPI.py
  lldb/trunk/test/lang/objc/foundation/TestSymbolTable.py
  lldb/trunk/test/lang/objc/objc-baseclass-sbtype/TestObjCBaseClassSBType.py
  lldb/trunk/test/lang/objc/objc-builtin-types/TestObjCBuiltinTypes.py
  lldb/trunk/test/lang/objc/objc-checker/TestObjCCheckers.py
  lldb/trunk/test/lang/objc/objc-class-method/TestObjCClassMethod.py
  lldb/trunk/test/lang/objc/objc-dynamic-value/TestObjCDynamicValue.py
  lldb/trunk/test/lang/objc/objc-ivar-offsets/TestObjCIvarOffsets.py
  lldb/trunk/test/lang/objc/objc-ivar-stripped/TestObjCIvarStripped.py
  lldb/trunk/test/lang/objc/objc-property/TestObjCProperty.py
  
lldb/trunk/test/lang/objc/objc-static-method-stripped/TestObjCStaticMethodStripped.py
  lldb/trunk/test/lang/objc/objc-static-method/TestObjCStaticMethod.py
  lldb/trunk/test/lang/objc/objc-stepping/TestObjCStepping.py
  lldb/trunk/test/lang/objc/objc-struct-argument/TestObjCStructArgument.py
  lldb/trunk/test/lang/objc/objc-struct-return/TestObjCStructReturn.py
  lldb/trunk/test/lang/objc/objc-super/TestObjCSuper.py
  lldb/trunk/test/lldbtest.py
  lldb/trunk/test/macosx/indirect_symbol/TestIndirectSymbols.py
  lldb/trunk/test/macosx/queues/TestQueues.py
  lldb/trunk/test/macosx/safe-to-func-call/TestSafeFuncCalls.py
  lldb/trunk/test/macosx/universal/TestUniversal.py
  lldb/trunk/test/python_api/breakpoint/TestBreakpointAPI.py
  lldb/trunk/test/python_api/class_members/TestSBTypeClassMembers.py
  lldb/trunk/test/python_api/debugger/TestDebuggerAPI.py
  
lldb/trunk/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py
  lldb/trunk/test/python_api/disassemble-raw-data/TestDisassembleRawData.py
  lldb/trunk/test/python_api/disassemble-raw-data/TestDisassemble_VST1_64.py
  lldb/trunk/test/python_api/event/TestEvents.py
  lldb/trunk/test/python_api/findvalue_duplist/TestSBFrameFindValue.py
  lldb/trunk/test/python_api/formatters/TestFormattersSBAPI.py
  lldb/trunk/test/python_api/frame/TestFrames.py
  lldb/trunk/test/python_api/frame/inlines/TestInlinedFrame.py
  lldb/trunk/test/python_api/function_symbol/TestDisasmAPI.py
  lldb/trunk/test/python_api/function_symbol/TestSymbolAPI.py
  lldb/trunk/test/python_api/hello_world/TestHelloWorld.py
  lldb/trunk/test/python_api/interpreter/TestCommandInterpreterAPI.py
  lldb/tr

[Lldb-commits] [lldb] r251282 - Fix a fission expression evaluation issue

2015-10-26 Thread Tamas Berghammer via lldb-commits
Author: tberghammer
Date: Mon Oct 26 05:53:58 2015
New Revision: 251282

URL: http://llvm.org/viewvc/llvm-project?rev=251282&view=rev
Log:
Fix a fission expression evaluation issue

This fix should eliminate the duplicate definition errors when debug
info is available in multiple dwo symbol file for the same type.

Modified:
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h?rev=251282&r1=251281&r2=251282&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h Mon Oct 26 
05:53:58 2015
@@ -457,7 +457,7 @@ protected:
 DWARFDIE
 FindBlockContainingSpecification (const DWARFDIE &die, dw_offset_t 
spec_block_die_offset);
 
-UniqueDWARFASTTypeMap &
+virtual UniqueDWARFASTTypeMap &
 GetUniqueDWARFASTTypeMap ();
 
 bool

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp?rev=251282&r1=251281&r2=251282&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp Mon Oct 
26 05:53:58 2015
@@ -100,6 +100,12 @@ SymbolFileDWARFDwo::GetForwardDeclClangT
 return GetBaseSymbolFile()->GetForwardDeclClangTypeToDie();
 }
 
+UniqueDWARFASTTypeMap&
+SymbolFileDWARFDwo::GetUniqueDWARFASTTypeMap()
+{
+return GetBaseSymbolFile()->GetUniqueDWARFASTTypeMap();
+}
+
 lldb::TypeSP
 SymbolFileDWARFDwo::FindDefinitionTypeForDWARFDeclContext (const 
DWARFDeclContext &die_decl_ctx)
 {

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h?rev=251282&r1=251281&r2=251282&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h Mon Oct 26 
05:53:58 2015
@@ -54,6 +54,9 @@ protected:
 ClangTypeToDIE&
 GetForwardDeclClangTypeToDie() override;
 
+UniqueDWARFASTTypeMap&
+GetUniqueDWARFASTTypeMap() override;
+
 lldb::TypeSP
 FindDefinitionTypeForDWARFDeclContext (const DWARFDeclContext 
&die_decl_ctx) override;
 


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


[Lldb-commits] [PATCH] D14060: Deprecate -m/+m dotest options in favor of test categories

2015-10-26 Thread Pavel Labath via lldb-commits
labath created this revision.
labath added reviewers: tfiala, dawn, ki.stfu, abidh.
labath added a subscriber: lldb-commits.

This change deprecates -m/+m dotest options (the options are still recognized 
but they print an
error message pointing to the new options) and adds a new lldb-mi test category 
instead. To just
run lldb-mi tests, use '-G lldb-mi'. To skip lldb-mi tests, use 
'--skip-category lldb-mi'. All
lldb-mi tests are marked as such using the getCategories method on the base 
MiTestCaseBase class
and the @lldbmi_test decorator is not needed. In case one still needs to 
annotate a specific test
function as an lldb-mi test, one can use the @add_test_categories(['lldb-mi']) 
decorator to
achieve that.

http://reviews.llvm.org/D14060

Files:
  test/dotest.py
  test/dotest_args.py
  test/lldbtest.py
  test/test_categories.py
  test/tools/lldb-mi/TestMiExit.py
  test/tools/lldb-mi/TestMiFile.py
  test/tools/lldb-mi/TestMiGdbSetShow.py
  test/tools/lldb-mi/TestMiLibraryLoaded.py
  test/tools/lldb-mi/TestMiPrompt.py
  test/tools/lldb-mi/breakpoint/TestMiBreak.py
  test/tools/lldb-mi/control/TestMiExec.py
  test/tools/lldb-mi/data/TestMiData.py
  test/tools/lldb-mi/interpreter/TestMiCliSupport.py
  test/tools/lldb-mi/interpreter/TestMiInterpreterExec.py
  test/tools/lldb-mi/lldbmi_testcase.py
  test/tools/lldb-mi/signal/TestMiSignal.py
  test/tools/lldb-mi/stack/TestMiStack.py
  test/tools/lldb-mi/startup_options/TestMiStartupOptions.py
  test/tools/lldb-mi/symbol/TestMiSymbol.py
  test/tools/lldb-mi/syntax/TestMiSyntax.py
  test/tools/lldb-mi/target/TestMiTarget.py
  test/tools/lldb-mi/variable/TestMiGdbSetShowPrint.py
  test/tools/lldb-mi/variable/TestMiVar.py

Index: test/tools/lldb-mi/variable/TestMiVar.py
===
--- test/tools/lldb-mi/variable/TestMiVar.py
+++ test/tools/lldb-mi/variable/TestMiVar.py
@@ -13,7 +13,6 @@
 
 mydir = TestBase.compute_mydir(__file__)
 
-@lldbmi_test
 @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
 @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
 @expectedFailureAll("llvm.org/pr23560", oslist=["linux"], compiler="gcc", compiler_version=[">=","4.9"], archs=["i386"])
@@ -125,7 +124,6 @@
 # FIXME: The name below is not correct. It should be "var.*argv[0]".
 self.expect("\^done,numchild=\"1\",children=\[child=\{name=\"var6\.\*\$[0-9]+\",exp=\"\*\$[0-9]+\",numchild=\"0\",type=\"const char\",thread-id=\"4294967295\",value=\"47 '/'\",has_more=\"0\"\}\],has_more=\"0\"") #FIXME -var-list-children shows invalid thread-id
 
-@lldbmi_test
 @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
 @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
 @skipIfLinux # llvm.org/pr22841: lldb-mi tests fail on all Linux buildbots
@@ -190,7 +188,6 @@
 self.runCmd("-var-update --all-values var_complx_array")
 self.expect("\^done,changelist=\[\{name=\"var_complx_array\",value=\"\[2\]\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\]")
 
-@lldbmi_test
 @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
 @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
 def test_lldbmi_var_create_register(self):
@@ -230,7 +227,6 @@
 self.runCmd("-data-list-register-values d 0")
 self.expect("\^done,register-values=\[{number=\"0\",value=\"6\"")
 
-@lldbmi_test
 @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
 @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
 @skipIfLinux # llvm.org/pr22841: lldb-mi tests fail on all Linux buildbots
@@ -332,7 +328,6 @@
 self.runCmd("-var-list-children 0 var_complx 0")
 self.expect("\^error,msg=\"Command 'var-list-children'. Variable children range invalid\"")
 
-@lldbmi_test
 @skipIfWindows #llvm.org/pr24452: Get lldb-mi working on Windows
 @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
 @skipIfLinux # llvm.org/pr22841: lldb-mi tests fail on all Linux buildbots
@@ -357,7 +352,6 @@
 self.runCmd("-var-create - * std_string")
 self.expect('\^done,name="var\d+",numchild="[0-9]+",value=""hello"",type="std::[\S]*?string",thread-id="1",has_more="0"')
  
-@lldbmi_test
 @skipIfWindows #llvm.org/pr24452: Get lldb-mi working on Windows
 @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
 @skipIfLinux # llvm.org/pr22841: lldb-mi tests fail on all Linux buildbots
Index: test/tools/lldb-mi/variable/TestMiGdbSetShowPrint.py
===
--- test/tools/lldb-mi/variable/TestMiGdbSetShowPrint.py
+++ test/tools/lldb-mi/variable/TestMiGdbSetShowPrint.py
@@ -25,7 +25,6 @@
 self.runCmd("-var-create - * " + var)
 self

Re: [Lldb-commits] [PATCH] D14060: Deprecate -m/+m dotest options in favor of test categories

2015-10-26 Thread Ilia K via lldb-commits
ki.stfu accepted this revision.
ki.stfu added a comment.
This revision is now accepted and ready to land.

lgtm


http://reviews.llvm.org/D14060



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


Re: [Lldb-commits] [PATCH] D14051: Fix for Arm watchpoint cache corruption in case of ptrace failure

2015-10-26 Thread Tamas Berghammer via lldb-commits
tberghammer accepted this revision.
tberghammer added a comment.
This revision is now accepted and ready to land.

LGTM


http://reviews.llvm.org/D14051



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


Re: [Lldb-commits] [PATCH] D14060: Deprecate -m/+m dotest options in favor of test categories

2015-10-26 Thread Tamas Berghammer via lldb-commits
tberghammer added a subscriber: tberghammer.
tberghammer added a comment.

Before commit please sync with Ying about updating all android build bot to 
still skip the MI tests after the change.


http://reviews.llvm.org/D14060



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


Re: [Lldb-commits] [PATCH] D14060: Deprecate -m/+m dotest options in favor of test categories

2015-10-26 Thread Pavel Labath via lldb-commits
labath added a comment.

In http://reviews.llvm.org/D14060#274952, @tberghammer wrote:

> Before commit please sync with Ying about updating all android build bot to 
> still skip the MI tests after the change.


I've got it covered. :)

I will commit this tomorrow, to give more people a chance to see what is coming.


http://reviews.llvm.org/D14060



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


[Lldb-commits] [lldb] r251293 - [RenderScript] Add option to break on a specific kernel invocation

2015-10-26 Thread Ewan Crawford via lldb-commits
Author: ewancrawford
Date: Mon Oct 26 09:04:37 2015
New Revision: 251293

URL: http://llvm.org/viewvc/llvm-project?rev=251293&view=rev
Log:
[RenderScript] Add option to break on a specific kernel invocation


Adds option -c  to the 'language renderscript kernel breakpoint set' 
command.

Breaks only on the invocation of the kernel with specified coordinate.
Implemented by adding a callback to the kernel breakpoint which checks the 
coordinates of every invocation.

Modified:

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

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

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=251293&r1=251292&r2=251293&view=diff
==
--- 
lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
 (original)
+++ 
lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
 Mon Oct 26 09:04:37 2015
@@ -14,11 +14,13 @@
 #include "lldb/Core/Error.h"
 #include "lldb/Core/Log.h"
 #include "lldb/Core/PluginManager.h"
+#include "lldb/Core/RegularExpression.h"
 #include "lldb/Host/StringConvert.h"
 #include "lldb/Symbol/Symbol.h"
 #include "lldb/Symbol/Type.h"
 #include "lldb/Target/Process.h"
 #include "lldb/Target/Target.h"
+#include "lldb/Target/Thread.h"
 #include "lldb/Interpreter/Args.h"
 #include "lldb/Interpreter/Options.h"
 #include "lldb/Interpreter/CommandInterpreter.h"
@@ -2301,8 +2303,124 @@ RenderScriptRuntime::CreateKernelBreakpo
 return bp;
 }
 
+// Given an expression for a variable this function tries to calculate the 
variable's value.
+// If this is possible it returns true and sets the uint64_t parameter to the 
variables unsigned value.
+// Otherwise function returns false.
+bool
+RenderScriptRuntime::GetFrameVarAsUnsigned(const StackFrameSP frame_sp, const 
char* var_name, uint64_t& val)
+{
+Log* log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_LANGUAGE));
+Error error;
+VariableSP var_sp;
+
+// Find variable in stack frame
+ValueObjectSP 
value_sp(frame_sp->GetValueForVariableExpressionPath(var_name,
+   
eNoDynamicValues,
+   
StackFrame::eExpressionPathOptionCheckPtrVsMember |
+   
StackFrame::eExpressionPathOptionsAllowDirectIVarAccess,
+   var_sp,
+   error));
+if (!error.Success())
+{
+if (log)
+log->Printf("RenderScriptRuntime::GetFrameVarAsUnsigned - Error, 
couldn't find '%s' in frame", var_name);
+
+return false;
+}
+
+// Find the unsigned int value for the variable
+bool success = false;
+val = value_sp->GetValueAsUnsigned(0, &success);
+if (!success)
+{
+if (log)
+log->Printf("RenderScriptRuntime::GetFrameVarAsUnsigned - Error, 
couldn't parse '%s' as an unsigned int", var_name);
+
+return false;
+}
+
+return true;
+}
+
+// Callback when a kernel breakpoint hits and we're looking for a specific 
coordinate.
+// Baton parameter contains a pointer to the target coordinate we want to 
break on.
+// Function then checks the .expand frame for the current coordinate and 
breaks to user if it matches.
+// Parameter 'break_id' is the id of the Breakpoint which made the callback.
+// Parameter 'break_loc_id' is the id for the BreakpointLocation which was hit,
+// a single logical breakpoint can have multiple addresses.
+bool
+RenderScriptRuntime::KernelBreakpointHit(void *baton, StoppointCallbackContext 
*ctx,
+ user_id_t break_id, user_id_t 
break_loc_id)
+{
+Log* log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_LANGUAGE | 
LIBLLDB_LOG_BREAKPOINTS));
+
+assert(baton && "Error: null baton in conditional kernel breakpoint 
callback");
+
+// Coordinate we want to stop on
+const int* target_coord = static_cast(baton);
+
+if (log)
+log->Printf("RenderScriptRuntime::KernelBreakpointHit - Break ID %" 
PRIu64 ", target coord (%d, %d, %d)",
+break_id, target_coord[0], target_coord[1], 
target_coord[2]);
+
+// Go up one stack frame to .expand kernel
+ExecutionContext context(ctx->exe_ctx_ref);
+ThreadSP thread_sp = context.GetThreadSP();
+if (!thread_sp->SetSelectedFrameByIndex(1))
+{
+if (log)
+log->Printf("RenderScriptRuntime::KernelBreakpointHit - 

Re: [Lldb-commits] [PATCH] D14060: Deprecate -m/+m dotest options in favor of test categories

2015-10-26 Thread Todd Fiala via lldb-commits
tfiala accepted this revision.
tfiala added a comment.

LGTM.

Who currently owns the MI tests (or system) these days?  I suppose you are 
doing this to squelch them from failing on the buildbots.  On our end, we see 
the MI tests fail fairly frequently, typically intermittently.


http://reviews.llvm.org/D14060



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


Re: [Lldb-commits] [PATCH] D14060: Deprecate -m/+m dotest options in favor of test categories

2015-10-26 Thread Pavel Labath via lldb-commits
labath added a comment.

We have XFAILed MI tests that were failing on our linux build bot. Atm, I am 
seeing expected passes, so I might try enabling them soon...

However, these tests are not remote-ready, so we have to skip them on the 
android built bots.


http://reviews.llvm.org/D14060



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


[Lldb-commits] [lldb] r251301 - [lldb-server] Send PC of every thread along in the stop-reply packet

2015-10-26 Thread Pavel Labath via lldb-commits
Author: labath
Date: Mon Oct 26 11:25:28 2015
New Revision: 251301

URL: http://llvm.org/viewvc/llvm-project?rev=251301&view=rev
Log:
[lldb-server] Send PC of every thread along in the stop-reply packet

This avoids the need to query the PC for private resume operations (public 
resumes have the PC
from the bigger jStopInfo packet) and speeds up the stepping on an android 
target by about 10%
(it some cases even more).

Modified:

lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp

Modified: 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp?rev=251301&r1=251300&r2=251301&view=diff
==
--- 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
 (original)
+++ 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
 Mon Oct 26 11:25:28 2015
@@ -426,7 +426,7 @@ WriteRegisterValueInHexFixedWidth (Strea
 }
 
 static JSONObject::SP
-GetRegistersAsJSON(NativeThreadProtocol &thread)
+GetRegistersAsJSON(NativeThreadProtocol &thread, bool abridged)
 {
 Log *log (GetLogIfAnyCategoriesSet (LIBLLDB_LOG_THREAD));
 
@@ -448,11 +448,17 @@ GetRegistersAsJSON(NativeThreadProtocol
 // Expedite only a couple of registers until we figure out why sending 
registers is
 // expensive.
 static const uint32_t k_expedited_registers[] = {
-LLDB_REGNUM_GENERIC_PC, LLDB_REGNUM_GENERIC_SP, 
LLDB_REGNUM_GENERIC_FP, LLDB_REGNUM_GENERIC_RA
+LLDB_REGNUM_GENERIC_PC, LLDB_REGNUM_GENERIC_SP, 
LLDB_REGNUM_GENERIC_FP, LLDB_REGNUM_GENERIC_RA, LLDB_INVALID_REGNUM
 };
-for (uint32_t generic_reg: k_expedited_registers)
+static const uint32_t k_abridged_expedited_registers[] = {
+LLDB_REGNUM_GENERIC_PC, LLDB_INVALID_REGNUM
+};
+
+for (const uint32_t *generic_reg_p = abridged ? 
k_abridged_expedited_registers : k_expedited_registers;
+ *generic_reg_p != LLDB_INVALID_REGNUM;
+ ++generic_reg_p)
 {
-uint32_t reg_num = 
reg_ctx_sp->ConvertRegisterKindToRegisterNumber(eRegisterKindGeneric, 
generic_reg);
+uint32_t reg_num = 
reg_ctx_sp->ConvertRegisterKindToRegisterNumber(eRegisterKindGeneric, 
*generic_reg_p);
 if (reg_num == LLDB_INVALID_REGNUM)
 continue; // Target does not support the given register.
 #endif
@@ -518,7 +524,7 @@ GetStopReasonString(StopReason stop_reas
 }
 
 static JSONArray::SP
-GetJSONThreadsInfo(NativeProcessProtocol &process, bool 
threads_with_valid_stop_info_only)
+GetJSONThreadsInfo(NativeProcessProtocol &process, bool abridged)
 {
 Log *log (GetLogIfAnyCategoriesSet (LIBLLDB_LOG_PROCESS | 
LIBLLDB_LOG_THREAD));
 
@@ -551,12 +557,12 @@ GetJSONThreadsInfo(NativeProcessProtocol
 tid_stop_info.details.exception.type);
 }
 
-if (threads_with_valid_stop_info_only && tid_stop_info.reason == 
eStopReasonNone)
-continue; // No stop reason, skip this thread completely.
-
 JSONObject::SP thread_obj_sp = std::make_shared();
 threads_array_sp->AppendObject(thread_obj_sp);
 
+if (JSONObject::SP registers_sp = GetRegistersAsJSON(*thread_sp, 
abridged))
+thread_obj_sp->SetObject("registers", registers_sp);
+
 thread_obj_sp->SetObject("tid", std::make_shared(tid));
 if (signum != 0)
 thread_obj_sp->SetObject("signal", 
std::make_shared(uint64_t(signum)));
@@ -585,12 +591,6 @@ GetJSONThreadsInfo(NativeProcessProtocol
 thread_obj_sp->SetObject("medata", medata_array_sp);
 }
 
-if (threads_with_valid_stop_info_only)
-continue; // Only send the abridged stop info.
-
-if (JSONObject::SP registers_sp = GetRegistersAsJSON(*thread_sp))
-thread_obj_sp->SetObject("registers", registers_sp);
-
 // TODO: Expedite interesting regions of inferior memory
 }
 


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


[Lldb-commits] [lldb] r251302 - Fix usages of range() and xrange() for Python 3.

2015-10-26 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Mon Oct 26 11:49:57 2015
New Revision: 251302

URL: http://llvm.org/viewvc/llvm-project?rev=251302&view=rev
Log:
Fix usages of range() and xrange() for Python 3.

Modified:
lldb/trunk/test/example/TestSequenceFunctions.py
lldb/trunk/test/functionalities/inferior-assert/TestInferiorAssert.py
lldb/trunk/test/functionalities/inferior-crashing/TestInferiorCrashing.py

lldb/trunk/test/functionalities/inferior-crashing/recursive-inferior/TestRecursiveInferior.py
lldb/trunk/test/lang/go/goroutines/TestGoroutines.py
lldb/trunk/test/lang/go/types/TestGoASTContext.py
lldb/trunk/test/lldbutil.py
lldb/trunk/test/tools/lldb-server/inferior-crash/TestGdbRemoteAbort.py

Modified: lldb/trunk/test/example/TestSequenceFunctions.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/example/TestSequenceFunctions.py?rev=251302&r1=251301&r2=251302&view=diff
==
--- lldb/trunk/test/example/TestSequenceFunctions.py (original)
+++ lldb/trunk/test/example/TestSequenceFunctions.py Mon Oct 26 11:49:57 2015
@@ -8,7 +8,7 @@ class SequenceFunctionsTestCase(unittest
 
 def setUp(self):
 #traceback.print_stack()
-self.seq = range(10)
+self.seq = list(range(10))
 
 def tearDown(self):
 #traceback.print_stack()
@@ -18,7 +18,7 @@ class SequenceFunctionsTestCase(unittest
 # make sure the shuffled sequence does not lose any elements
 random.shuffle(self.seq)
 self.seq.sort()
-self.assertEqual(self.seq, range(10))
+self.assertEqual(self.seq, list(range(10)))
 
 def test_choice(self):
 element = random.choice(self.seq)

Modified: lldb/trunk/test/functionalities/inferior-assert/TestInferiorAssert.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/inferior-assert/TestInferiorAssert.py?rev=251302&r1=251301&r2=251302&view=diff
==
--- lldb/trunk/test/functionalities/inferior-assert/TestInferiorAssert.py 
(original)
+++ lldb/trunk/test/functionalities/inferior-assert/TestInferiorAssert.py Mon 
Oct 26 11:49:57 2015
@@ -20,7 +20,7 @@ class AssertingInferiorTestCase(TestBase
 self.inferior_asserting()
 
 @expectedFailureWindows("llvm.org/pr21793: need to implement support for 
detecting assertion / abort on Windows")
-@expectedFailureAndroid(api_levels=range(16 + 1)) # b.android.com/179836
+@expectedFailureAndroid(api_levels=list(range(16 + 1))) # 
b.android.com/179836
 def test_inferior_asserting_register(self):
 """Test that lldb reliably reads registers from the inferior after 
asserting (command)."""
 self.build()
@@ -58,7 +58,7 @@ class AssertingInferiorTestCase(TestBase
 lldbutil.run_break_set_by_file_and_line (self, "main.c", line, 
num_expected_locations=1, loc_exact=True)
 
 def check_stop_reason(self):
-if matchAndroid(api_levels=range(1, 16+1))(self):
+if matchAndroid(api_levels=list(range(1, 16+1)))(self):
 # On android until API-16 the abort() call ended in a sigsegv 
instead of in a sigabrt
 stop_reason = 'stop reason = signal SIGSEGV'
 else:

Modified: 
lldb/trunk/test/functionalities/inferior-crashing/TestInferiorCrashing.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/inferior-crashing/TestInferiorCrashing.py?rev=251302&r1=251301&r2=251302&view=diff
==
--- lldb/trunk/test/functionalities/inferior-crashing/TestInferiorCrashing.py 
(original)
+++ lldb/trunk/test/functionalities/inferior-crashing/TestInferiorCrashing.py 
Mon Oct 26 11:49:57 2015
@@ -47,7 +47,7 @@ class CrashingInferiorTestCase(TestBase)
 
 @expectedFailureFreeBSD('llvm.org/pr24939')
 @expectedFailureWindows("llvm.org/pr24778")
-@expectedFailureAndroid(archs=['aarch64'], api_levels=range(21 + 1)) # No 
eh_frame for sa_restorer
+@expectedFailureAndroid(archs=['aarch64'], api_levels=list(range(21 + 1))) 
# No eh_frame for sa_restorer
 def test_inferior_crashing_step_after_break(self):
 """Test that lldb functions correctly after stepping through a 
crash."""
 self.build()

Modified: 
lldb/trunk/test/functionalities/inferior-crashing/recursive-inferior/TestRecursiveInferior.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/inferior-crashing/recursive-inferior/TestRecursiveInferior.py?rev=251302&r1=251301&r2=251302&view=diff
==
--- 
lldb/trunk/test/functionalities/inferior-crashing/recursive-inferior/TestRecursiveInferior.py
 (original)
+++ 
lldb/trunk/test/functionalities/inferior-crashing/recursive-inferior/TestRecursiveInferior.py
 Mon Oct 26 11:49:57 2015
@@ -47,7 +47,7 @@ class CrashingRecursiveInferiorTestCase(

[Lldb-commits] [lldb] r251308 - Fix tabs and spaces in one of the python files.

2015-10-26 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Mon Oct 26 11:51:36 2015
New Revision: 251308

URL: http://llvm.org/viewvc/llvm-project?rev=251308&view=rev
Log:
Fix tabs and spaces in one of the python files.

Modified:
lldb/trunk/examples/synthetic/gnu_libstdcpp.py

Modified: lldb/trunk/examples/synthetic/gnu_libstdcpp.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/synthetic/gnu_libstdcpp.py?rev=251308&r1=251307&r2=251308&view=diff
==
--- lldb/trunk/examples/synthetic/gnu_libstdcpp.py (original)
+++ lldb/trunk/examples/synthetic/gnu_libstdcpp.py Mon Oct 26 11:51:36 2015
@@ -22,19 +22,17 @@ class StdListSynthProvider:
def is_valid(self,node):
logger = lldb.formatters.Logger.Logger()
valid = self.value(self.next_node(node)) != self.node_address
-if valid:
-logger >> "%s is valid" % str(self.valobj.GetName())
-else:
-logger >> "synthetic value is not valid"
-return valid
+   if valid:
+   logger >> "%s is valid" % str(self.valobj.GetName())
+   else:
+   logger >> "synthetic value is not valid"
+   return valid
 
def value(self,node):
logger = lldb.formatters.Logger.Logger()
-value = node.GetValueAsUnsigned()
-logger >> "synthetic value for {}: {}".format(
-str(self.valobj.GetName()),
-value)
-return value
+   value = node.GetValueAsUnsigned()
+   logger >> "synthetic value for {}: 
{}".format(str(self.valobj.GetName()), value)
+   return value
 
# Floyd's cycle-finding algorithm
# try to detect if this list has a loop
@@ -59,12 +57,12 @@ class StdListSynthProvider:
def num_children(self):
logger = lldb.formatters.Logger.Logger()
if self.count is None:
-# libstdc++ 6.0.21 added dedicated count field.
-count_child = 
self.node.GetChildMemberWithName('_M_data')
-if count_child and count_child.IsValid():
-self.count = count_child.GetValueAsUnsigned(0)
-if self.count is None:
-   self.count = self.num_children_impl()
+   # libstdc++ 6.0.21 added dedicated count field.
+   count_child = 
self.node.GetChildMemberWithName('_M_data')
+   if count_child and count_child.IsValid():
+   self.count = count_child.GetValueAsUnsigned(0)
+   if self.count is None:
+   self.count = self.num_children_impl()
return self.count
 
def num_children_impl(self):


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


[Lldb-commits] [lldb] r251303 - Convert deprecated unittest method names.

2015-10-26 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Mon Oct 26 11:50:39 2015
New Revision: 251303

URL: http://llvm.org/viewvc/llvm-project?rev=251303&view=rev
Log:
Convert deprecated unittest method names.

Plural methods were long deprecated, and in Python 3 they are gone.
Convert to the actual supported method names.

Modified:

lldb/trunk/test/functionalities/data-formatter/data-formatter-stl/libcxx/list/loop/TestDataFormatterLibcxxListLoop.py
lldb/trunk/test/functionalities/inferior-changed/TestInferiorChanged.py
lldb/trunk/test/functionalities/inferior-crashing/TestInferiorCrashing.py

lldb/trunk/test/functionalities/inferior-crashing/recursive-inferior/TestRecursiveInferior.py

lldb/trunk/test/linux/thread/create_during_instruction_step/TestCreateDuringInstructionStep.py
lldb/trunk/test/python_api/section/TestSectionAPI.py
lldb/trunk/test/python_api/target/TestTargetAPI.py
lldb/trunk/test/tools/lldb-server/TestGdbRemoteAuxvSupport.py
lldb/trunk/test/tools/lldb-server/TestGdbRemoteProcessInfo.py
lldb/trunk/test/tools/lldb-server/TestGdbRemoteRegisterState.py
lldb/trunk/test/tools/lldb-server/TestGdbRemoteThreadsInStopReply.py
lldb/trunk/test/tools/lldb-server/TestGdbRemote_qThreadStopInfo.py
lldb/trunk/test/tools/lldb-server/TestLldbGdbServer.py
lldb/trunk/test/tools/lldb-server/commandline/TestStubSetSID.py
lldb/trunk/test/tools/lldb-server/gdbremote_testcase.py
lldb/trunk/test/tools/lldb-server/inferior-crash/TestGdbRemoteAbort.py
lldb/trunk/test/tools/lldb-server/inferior-crash/TestGdbRemoteSegFault.py
lldb/trunk/test/tools/lldb-server/lldbgdbserverutils.py
lldb/trunk/test/tools/lldb-server/test/test_lldbgdbserverutils.py

Modified: 
lldb/trunk/test/functionalities/data-formatter/data-formatter-stl/libcxx/list/loop/TestDataFormatterLibcxxListLoop.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/data-formatter/data-formatter-stl/libcxx/list/loop/TestDataFormatterLibcxxListLoop.py?rev=251303&r1=251302&r2=251303&view=diff
==
--- 
lldb/trunk/test/functionalities/data-formatter/data-formatter-stl/libcxx/list/loop/TestDataFormatterLibcxxListLoop.py
 (original)
+++ 
lldb/trunk/test/functionalities/data-formatter/data-formatter-stl/libcxx/list/loop/TestDataFormatterLibcxxListLoop.py
 Mon Oct 26 11:50:39 2015
@@ -35,7 +35,7 @@ class LibcxxListDataFormatterTestCase(Te
 process = target.LaunchSimple(None, None, 
self.get_process_working_directory())
 lldbutil.skip_if_library_missing(self, target, 
lldbutil.PrintableRegex("libc\+\+"))
 self.assertTrue(process and process.IsValid(), PROCESS_IS_VALID)
-
self.assertEquals(len(lldbutil.get_threads_stopped_at_breakpoint(process, 
breakpoint1)), 1)
+
self.assertEqual(len(lldbutil.get_threads_stopped_at_breakpoint(process, 
breakpoint1)), 1)
 
 # verify our list is displayed correctly
 self.expect("frame variable *numbers_list", substrs=['[0] = 1', '[1] = 
2', '[2] = 3', '[3] = 4', '[5] = 6'])
@@ -43,7 +43,7 @@ class LibcxxListDataFormatterTestCase(Te
 # Continue to breakpoint 2.
 process.Continue()
 self.assertTrue(process and process.IsValid(), PROCESS_IS_VALID)
-
self.assertEquals(len(lldbutil.get_threads_stopped_at_breakpoint(process, 
breakpoint2)), 1)
+
self.assertEqual(len(lldbutil.get_threads_stopped_at_breakpoint(process, 
breakpoint2)), 1)
 
 # The list is now inconsistent. However, we should be able to get the 
first three
 # elements at least (and most importantly, not crash).

Modified: 
lldb/trunk/test/functionalities/inferior-changed/TestInferiorChanged.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/inferior-changed/TestInferiorChanged.py?rev=251303&r1=251302&r2=251303&view=diff
==
--- lldb/trunk/test/functionalities/inferior-changed/TestInferiorChanged.py 
(original)
+++ lldb/trunk/test/functionalities/inferior-changed/TestInferiorChanged.py Mon 
Oct 26 11:50:39 2015
@@ -43,7 +43,7 @@ class ChangedInferiorTestCase(TestBase):
 self.runCmd("run", RUN_SUCCEEDED)
 
 # We should have one crashing thread
-self.assertEquals(
+self.assertEqual(
 len(lldbutil.get_crashed_threads(self, 
self.dbg.GetSelectedTarget().GetProcess())),
 1,
 STOPPED_DUE_TO_EXC_BAD_ACCESS)
@@ -60,7 +60,7 @@ class ChangedInferiorTestCase(TestBase):
 self.runCmd("run", RUN_SUCCEEDED)
 self.runCmd("process status")
 
-self.assertNotEquals(
+self.assertNotEqual(
 len(lldbutil.get_crashed_threads(self, 
self.dbg.GetSelectedTarget().GetProcess())),
 1,
 "Inferior changed, but lldb did not perform a reload")

Modified: 
lldb/trunk/test/functionalities/inferior-crashing/Tes

[Lldb-commits] [lldb] r251305 - Convert `long` to `int`, and portably detect all integral types.

2015-10-26 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Mon Oct 26 11:51:09 2015
New Revision: 251305

URL: http://llvm.org/viewvc/llvm-project?rev=251305&view=rev
Log:
Convert `long` to `int`, and portably detect all integral types.

Modified:
lldb/trunk/test/functionalities/abbreviation/TestCommonShortSpellings.py
lldb/trunk/test/lang/c/array_types/TestArrayTypes.py
lldb/trunk/test/lldbcurses.py
lldb/trunk/test/python_api/sbdata/TestSBData.py
lldb/trunk/test/tools/lldb-server/lldbgdbserverutils.py

Modified: 
lldb/trunk/test/functionalities/abbreviation/TestCommonShortSpellings.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/abbreviation/TestCommonShortSpellings.py?rev=251305&r1=251304&r2=251305&view=diff
==
--- lldb/trunk/test/functionalities/abbreviation/TestCommonShortSpellings.py 
(original)
+++ lldb/trunk/test/functionalities/abbreviation/TestCommonShortSpellings.py 
Mon Oct 26 11:51:09 2015
@@ -32,7 +32,7 @@ class CommonShortSpellingsTestCase(TestB
 ('ta st li', 'target stop-hook list'),
 ]
 
-for (short, long) in abbrevs:
-command_interpreter.ResolveCommand(short, result)
+for (short_val, long_val) in abbrevs:
+command_interpreter.ResolveCommand(short_val, result)
 self.assertTrue(result.Succeeded())
-self.assertEqual(long, result.GetOutput())
+self.assertEqual(long_val, result.GetOutput())

Modified: lldb/trunk/test/lang/c/array_types/TestArrayTypes.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/c/array_types/TestArrayTypes.py?rev=251305&r1=251304&r2=251305&view=diff
==
--- lldb/trunk/test/lang/c/array_types/TestArrayTypes.py (original)
+++ lldb/trunk/test/lang/c/array_types/TestArrayTypes.py Mon Oct 26 11:51:09 
2015
@@ -182,7 +182,7 @@ class ArrayTypesTestCase(TestBase):
 "Variable 'long_6' should have 6 children")
 child5 = variable.GetChildAtIndex(5)
 self.DebugSBValue(child5)
-self.assertTrue(long(child5.GetValue(), 0) == 6,
+self.assertTrue(int(child5.GetValue(), 0) == 6,
 "long_6[5] == 6")
 
 # Last, check that "long_6" has a value type of eValueTypeVariableLocal

Modified: lldb/trunk/test/lldbcurses.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbcurses.py?rev=251305&r1=251304&r2=251305&view=diff
==
--- lldb/trunk/test/lldbcurses.py (original)
+++ lldb/trunk/test/lldbcurses.py Mon Oct 26 11:51:09 2015
@@ -1,5 +1,8 @@
+import lldb_shared
+
 import curses, curses.panel
 import sys
+import six
 import time 
 
 class Point(object):
@@ -138,7 +141,7 @@ class Window(object):
 for key in arg:
 self.add_key_action(key, callback, description)
 else:
-if isinstance(arg, ( int, long )):
+if isinstance(arg, six.integer_types):
 key_action_dict = { 'key' : arg, 
 'callback': callback,
 'description' : decription }

Modified: lldb/trunk/test/python_api/sbdata/TestSBData.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/sbdata/TestSBData.py?rev=251305&r1=251304&r2=251305&view=diff
==
--- lldb/trunk/test/python_api/sbdata/TestSBData.py (original)
+++ lldb/trunk/test/python_api/sbdata/TestSBData.py Mon Oct 26 11:51:09 2015
@@ -220,8 +220,8 @@ class SBDataAPICase(TestBase):
 self.assertTrue(data2.uint8[4] == 111, 'o == 111')
 self.assert_data(data2.GetUnsignedInt8, 5, 33) # !
 
-uint_lists = [ [1,2,3,4,5], [long(i) for i in [1, 2, 3, 4, 5]] ]
-int_lists = [ [2, -2], [long(i) for i in [2, -2]] ]
+uint_lists = [ [1,2,3,4,5], [int(i) for i in [1, 2, 3, 4, 5]] ]
+int_lists = [ [2, -2], [int(i) for i in [2, -2]] ]
 
 for l in uint_lists:
 data2 = 
lldb.SBData.CreateDataFromUInt64Array(process.GetByteOrder(), 
process.GetAddressByteSize(), l)

Modified: lldb/trunk/test/tools/lldb-server/lldbgdbserverutils.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-server/lldbgdbserverutils.py?rev=251305&r1=251304&r2=251305&view=diff
==
--- lldb/trunk/test/tools/lldb-server/lldbgdbserverutils.py (original)
+++ lldb/trunk/test/tools/lldb-server/lldbgdbserverutils.py Mon Oct 26 11:51:09 
2015
@@ -9,6 +9,7 @@ import os
 import os.path
 import platform
 import re
+import six
 import socket_packet_pump
 import subprocess
 import time
@@ -808,8 +809,8 @@ def process_is_running(pid, unknown_valu
 If we don't know how to check running process ids on the

[Lldb-commits] [lldb] r251306 - Python3 - Change sys.maxint to sys.maxsize.

2015-10-26 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Mon Oct 26 11:51:20 2015
New Revision: 251306

URL: http://llvm.org/viewvc/llvm-project?rev=251306&view=rev
Log:
Python3 - Change sys.maxint to sys.maxsize.

Python3 has no analogue to sys.maxint since ints in Python 3 have
arbitrary size.  However, the distinction was not actually important
in any of these cases, and in a few cases using maxint was already
a bug to begin with.

Modified:
lldb/trunk/test/lldbcurses.py
lldb/trunk/test/python_api/default-constructor/sb_address.py
lldb/trunk/test/python_api/default-constructor/sb_breakpoint.py
lldb/trunk/test/python_api/default-constructor/sb_module.py

Modified: lldb/trunk/test/lldbcurses.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbcurses.py?rev=251306&r1=251305&r2=251306&view=diff
==
--- lldb/trunk/test/lldbcurses.py (original)
+++ lldb/trunk/test/lldbcurses.py Mon Oct 26 11:51:20 2015
@@ -421,7 +421,7 @@ class Window(object):
 self.timeout(timeout_msec)
 return c
 
-def key_event_loop(self, timeout_msec=-1, n=sys.maxint):
+def key_event_loop(self, timeout_msec=-1, n=sys.maxsize):
 '''Run an event loop to receive key presses and pass them along to the
responder chain.

@@ -974,7 +974,7 @@ class MenuBar(Panel):
 self.add_key_action(curses.KEY_ENTER, self.perform_action, "Select the 
next menu item")
 self.add_key_action(10, self.perform_action, "Select the next menu 
item")
 
-def insert_menu(self, menu, index=sys.maxint):
+def insert_menu(self, menu, index=sys.maxsize):
 if index >= len(self.menus):
 self.menus.append(menu)
 else:

Modified: lldb/trunk/test/python_api/default-constructor/sb_address.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/default-constructor/sb_address.py?rev=251306&r1=251305&r2=251306&view=diff
==
--- lldb/trunk/test/python_api/default-constructor/sb_address.py (original)
+++ lldb/trunk/test/python_api/default-constructor/sb_address.py Mon Oct 26 
11:51:20 2015
@@ -9,7 +9,7 @@ def fuzz_obj(obj):
 obj.GetFileAddress()
 obj.GetLoadAddress(lldb.SBTarget())
 obj.SetLoadAddress(0x, lldb.SBTarget())
-obj.OffsetAddress(sys.maxint)
+obj.OffsetAddress(sys.maxsize)
 obj.GetDescription(lldb.SBStream())
 obj.GetSection()
 obj.GetSymbolContext(lldb.eSymbolContextEverything)

Modified: lldb/trunk/test/python_api/default-constructor/sb_breakpoint.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/default-constructor/sb_breakpoint.py?rev=251306&r1=251305&r2=251306&view=diff
==
--- lldb/trunk/test/python_api/default-constructor/sb_breakpoint.py (original)
+++ lldb/trunk/test/python_api/default-constructor/sb_breakpoint.py Mon Oct 26 
11:51:20 2015
@@ -8,8 +8,8 @@ import lldb
 def fuzz_obj(obj):
 obj.GetID()
 obj.ClearAllBreakpointSites()
-obj.FindLocationByAddress(sys.maxint)
-obj.FindLocationIDByAddress(sys.maxint)
+obj.FindLocationByAddress(sys.maxsize)
+obj.FindLocationIDByAddress(sys.maxsize)
 obj.FindLocationByID(0)
 obj.GetLocationAtIndex(0)
 obj.SetEnabled(True)

Modified: lldb/trunk/test/python_api/default-constructor/sb_module.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/default-constructor/sb_module.py?rev=251306&r1=251305&r2=251306&view=diff
==
--- lldb/trunk/test/python_api/default-constructor/sb_module.py (original)
+++ lldb/trunk/test/python_api/default-constructor/sb_module.py Mon Oct 26 
11:51:20 2015
@@ -10,11 +10,11 @@ def fuzz_obj(obj):
 obj.GetPlatformFileSpec()
 obj.SetPlatformFileSpec(lldb.SBFileSpec())
 obj.GetUUIDString()
-obj.ResolveFileAddress(sys.maxint)
+obj.ResolveFileAddress(sys.maxsize)
 obj.ResolveSymbolContextForAddress(lldb.SBAddress(), 0)
 obj.GetDescription(lldb.SBStream())
 obj.GetNumSymbols()
-obj.GetSymbolAtIndex(sys.maxint)
+obj.GetSymbolAtIndex(sys.maxsize)
 sc_list = obj.FindFunctions("my_func")
 sc_list = obj.FindFunctions("my_func", lldb.eFunctionNameTypeAny)
 obj.FindGlobalVariables(lldb.SBTarget(), "my_global_var", 1)


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


[Lldb-commits] [lldb] r251307 - Wrap call to zip() in list()

2015-10-26 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Mon Oct 26 11:51:28 2015
New Revision: 251307

URL: http://llvm.org/viewvc/llvm-project?rev=251307&view=rev
Log:
Wrap call to zip() in list()

Modified:
lldb/trunk/test/terminal/TestSTTYBeforeAndAfter.py

Modified: lldb/trunk/test/terminal/TestSTTYBeforeAndAfter.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/terminal/TestSTTYBeforeAndAfter.py?rev=251307&r1=251306&r2=251307&view=diff
==
--- lldb/trunk/test/terminal/TestSTTYBeforeAndAfter.py (original)
+++ lldb/trunk/test/terminal/TestSTTYBeforeAndAfter.py Mon Oct 26 11:51:28 2015
@@ -111,7 +111,7 @@ class CommandLineCompletionTestCase(Test
 
 stty_output1_lines = from_child1.splitlines()
 stty_output2_lines = from_child2.splitlines()
-zipped = zip(stty_output1_lines, stty_output2_lines)
+zipped = list(zip(stty_output1_lines, stty_output2_lines))
 for tuple in zipped:
 if self.TraceOn():
 print("tuple->%s" % str(tuple))


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


[Lldb-commits] [lldb] r251304 - Python3 - Change `dict.has_key(x)` to `x in dict`

2015-10-26 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Mon Oct 26 11:50:51 2015
New Revision: 251304

URL: http://llvm.org/viewvc/llvm-project?rev=251304&view=rev
Log:
Python3 - Change `dict.has_key(x)` to `x in dict`

Modified:
lldb/trunk/test/functionalities/tty/TestTerminal.py
lldb/trunk/test/plugins/builder_base.py

Modified: lldb/trunk/test/functionalities/tty/TestTerminal.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/tty/TestTerminal.py?rev=251304&r1=251303&r2=251304&view=diff
==
--- lldb/trunk/test/functionalities/tty/TestTerminal.py (original)
+++ lldb/trunk/test/functionalities/tty/TestTerminal.py Mon Oct 26 11:50:51 2015
@@ -25,7 +25,7 @@ class LaunchInTerminalTestCase(TestBase)
 @unittest2.skipIf(hasattr(os, 'geteuid') and os.geteuid() == 0, "test 
cannot be run as root")
 # Do we need to disable this test if the testsuite is being run on a 
remote system?
 # This env var is only defined when the shell is running in a local mac 
terminal window
-@unittest2.skipUnless(os.environ.has_key('TERM_PROGRAM'), "test must be 
run on local system")
+@unittest2.skipUnless('TERM_PROGRAM' in os.environ, "test must be run on 
local system")
 @no_debug_info_test
 def test_launch_in_terminal (self):
 exe = "/bin/ls"

Modified: lldb/trunk/test/plugins/builder_base.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/plugins/builder_base.py?rev=251304&r1=251303&r2=251304&view=diff
==
--- lldb/trunk/test/plugins/builder_base.py (original)
+++ lldb/trunk/test/plugins/builder_base.py Mon Oct 26 11:50:51 2015
@@ -82,7 +82,7 @@ def getCmdLine(d):
 
 def setOrAppendVariable(k, v):
 append_vars = ["CFLAGS_EXTRAS", "LD_EXTRAS"]
-if k in append_vars and os.environ.has_key(k):
+if k in append_vars and k in os.environ:
 v = os.environ[k] + " " + v
 return pattern % (k, v)
 cmdline = " ".join([setOrAppendVariable(k, v) for k, v in list(d.items())])


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


[Lldb-commits] [lldb] r251309 - Fix Clang-tidy modernize-use-override warnings in some files in source; other minor fixes.

2015-10-26 Thread Eugene Zelenko via lldb-commits
Author: eugenezelenko
Date: Mon Oct 26 12:00:13 2015
New Revision: 251309

URL: http://llvm.org/viewvc/llvm-project?rev=251309&view=rev
Log:
Fix Clang-tidy modernize-use-override warnings in some files in source; other 
minor fixes.

Modified:
lldb/trunk/source/Core/IOHandler.cpp
lldb/trunk/source/Core/ValueObjectSyntheticFilter.cpp
lldb/trunk/source/DataFormatters/VectorType.cpp
lldb/trunk/source/Expression/Materializer.cpp
lldb/trunk/source/Interpreter/CommandObjectScript.h

Modified: lldb/trunk/source/Core/IOHandler.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/IOHandler.cpp?rev=251309&r1=251308&r2=251309&view=diff
==
--- lldb/trunk/source/Core/IOHandler.cpp (original)
+++ lldb/trunk/source/Core/IOHandler.cpp Mon Oct 26 12:00:13 2015
@@ -7,9 +7,17 @@
 //
 
//===--===//
 
+// C Includes
+#ifndef LLDB_DISABLE_CURSES
+#include 
+#include 
+#endif
 
+// C++ Includes
 #include 
 
+// Other libraries and framework includes
+// Project includes
 #include "lldb/Breakpoint/BreakpointLocation.h"
 #include "lldb/Core/IOHandler.h"
 #include "lldb/Core/Debugger.h"
@@ -28,11 +36,6 @@
 #include "lldb/Target/RegisterContext.h"
 #include "lldb/Target/ThreadPlan.h"
 
-#ifndef LLDB_DISABLE_CURSES
-#include 
-#include 
-#endif
-
 using namespace lldb;
 using namespace lldb_private;
 
@@ -46,7 +49,6 @@ IOHandler::IOHandler (Debugger &debugger
 {
 }
 
-
 IOHandler::IOHandler (Debugger &debugger,
   IOHandler::Type type,
   const lldb::StreamFileSP &input_sp,
@@ -71,10 +73,7 @@ IOHandler::IOHandler (Debugger &debugger
   m_error_sp);
 }
 
-IOHandler::~IOHandler()
-{
-}
-
+IOHandler::~IOHandler() = default;
 
 int
 IOHandler::GetInputFD()
@@ -136,7 +135,6 @@ IOHandler::GetOutputStreamFile()
 return m_output_sp;
 }
 
-
 StreamFileSP &
 IOHandler::GetErrorStreamFile()
 {
@@ -204,10 +202,7 @@ IOHandlerConfirm::IOHandlerConfirm (Debu
 
 }
 
-
-IOHandlerConfirm::~IOHandlerConfirm ()
-{
-}
+IOHandlerConfirm::~IOHandlerConfirm() = default;
 
 int
 IOHandlerConfirm::IOHandlerComplete (IOHandler &io_handler,
@@ -334,11 +329,9 @@ IOHandlerDelegate::IOHandlerComplete (IO
 break;
 }
 
-
 return 0;
 }
 
-
 IOHandlerEditline::IOHandlerEditline (Debugger &debugger,
   IOHandler::Type type,
   const char *editline_name, // Used for 
saving history files
@@ -444,7 +437,6 @@ IOHandlerEditline::Deactivate ()
 m_delegate.IOHandlerDeactivated(*this);
 }
 
-
 bool
 IOHandlerEditline::GetLine (std::string &line, bool &interrupted)
 {
@@ -619,7 +611,6 @@ IOHandlerEditline::GetContinuationPrompt
 return m_continuation_prompt.c_str();
 }
 
-
 void
 IOHandlerEditline::SetContinuationPrompt (const char *p)
 {
@@ -634,7 +625,6 @@ IOHandlerEditline::SetContinuationPrompt
 #endif
 }
 
-
 void
 IOHandlerEditline::SetBaseLineNumber (uint32_t line)
 {
@@ -824,6 +814,7 @@ type summary add -s "x=${var.x}, y=${var
 type summary add -s "w=${var.width}, h=${var.height}" curses::Size
 type summary add -s "${var.origin%S} ${var.size%S}" curses::Rect
 #endif
+
 struct Point
 {
 int x;
@@ -855,13 +846,13 @@ type summary add -s "${var.origin%S} ${v
 {
 printf ("(x=%i, y=%i)\n", x, y);
 }
-
 };
 
 bool operator == (const Point &lhs, const Point &rhs)
 {
 return lhs.x == rhs.x && lhs.y == rhs.y;
 }
+
 bool operator != (const Point &lhs, const Point &rhs)
 {
 return lhs.x != rhs.x || lhs.y != rhs.y;
@@ -889,13 +880,13 @@ type summary add -s "${var.origin%S} ${v
 {
 printf ("(w=%i, h=%i)\n", width, height);
 }
-
 };
 
 bool operator == (const Size &lhs, const Size &rhs)
 {
 return lhs.width == rhs.width && lhs.height == rhs.height;
 }
+
 bool operator != (const Size &lhs, const Size &rhs)
 {
 return lhs.width != rhs.width || lhs.height != rhs.height;
@@ -942,6 +933,7 @@ type summary add -s "${var.origin%S} ${v
 size.height -= h*2;
 origin.y += h;
 }
+
 // Return a status bar rectangle which is the last line of
 // this rectangle. This rectangle will be modified to not
 // include the status bar area.
@@ -1011,7 +1003,6 @@ type summary add -s "${var.origin%S} ${v
 VerticalSplit (left_width, left, right);
 }
 
-
 void
 VerticalSplit (int left_width, Rect &left, Rect &right) const
 {
@@ -1035,6 +1026,7 @@ type summary add -s "${var.origin%S} ${v
 {
 return lhs.origin == rhs.origin && lhs.size == rhs.size;
 }
+
 bool operator != (const Rect &lhs, const Rect &rhs)
 {
 return lhs.origin != rhs.origin || lhs.si

[Lldb-commits] [PATCH] D14083: Fix race condition in process resume

2015-10-26 Thread Pavel Labath via lldb-commits
labath created this revision.
labath added a reviewer: clayborg.
labath added a subscriber: lldb-commits.

Gdb-remote's async thread sent out the eBroadcastBitRunPacketSent message 
*before* actually
sending out the continue packet. Since it's this message the actually triggers 
the public state
transition, it could happen (and it did happen in TestAttachResume, which does 
an "process
interrupt" right after a continue) that we attempt to stop the inferior before 
it was actually
started (which obviously did not end well). This fixes the problem by moving 
the broadcast after
the packet was actually sent.

http://reviews.llvm.org/D14083

Files:
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
  test/functionalities/attach_resume/TestAttachResume.py

Index: test/functionalities/attach_resume/TestAttachResume.py
===
--- test/functionalities/attach_resume/TestAttachResume.py
+++ test/functionalities/attach_resume/TestAttachResume.py
@@ -20,7 +20,6 @@
 @skipIfRemote
 @expectedFailureFreeBSD('llvm.org/pr19310')
 @expectedFailureWindows("llvm.org/pr24778")
-@expectedFlakeyLinux('llvm.org/pr19310')
 def test_attach_continue_interrupt_detach(self):
 """Test attach/continue/interrupt/detach"""
 self.build()
Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
===
--- source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
+++ source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
@@ -1049,7 +1049,6 @@
 Mutex::Locker locker(m_sequence_mutex);
 StateType state = eStateRunning;
 
-BroadcastEvent(eBroadcastBitRunPacketSent, NULL);
 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...
@@ -1059,6 +1058,7 @@
 const auto sigint_signo = 
process->GetUnixSignals()->GetSignalNumberFromName("SIGINT");
 
 bool got_async_packet = false;
+bool broadcast_sent = false;
 
 while (state == eStateRunning)
 {
@@ -1071,6 +1071,12 @@
 else
 m_interrupt_sent = false;
 
+if (! broadcast_sent)
+{
+BroadcastEvent(eBroadcastBitRunPacketSent, NULL);
+broadcast_sent = true;
+}
+
 m_private_is_running.SetValue (true, eBroadcastAlways);
 }
 


Index: test/functionalities/attach_resume/TestAttachResume.py
===
--- test/functionalities/attach_resume/TestAttachResume.py
+++ test/functionalities/attach_resume/TestAttachResume.py
@@ -20,7 +20,6 @@
 @skipIfRemote
 @expectedFailureFreeBSD('llvm.org/pr19310')
 @expectedFailureWindows("llvm.org/pr24778")
-@expectedFlakeyLinux('llvm.org/pr19310')
 def test_attach_continue_interrupt_detach(self):
 """Test attach/continue/interrupt/detach"""
 self.build()
Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
===
--- source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
+++ source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
@@ -1049,7 +1049,6 @@
 Mutex::Locker locker(m_sequence_mutex);
 StateType state = eStateRunning;
 
-BroadcastEvent(eBroadcastBitRunPacketSent, NULL);
 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...
@@ -1059,6 +1058,7 @@
 const auto sigint_signo = process->GetUnixSignals()->GetSignalNumberFromName("SIGINT");
 
 bool got_async_packet = false;
+bool broadcast_sent = false;
 
 while (state == eStateRunning)
 {
@@ -1071,6 +1071,12 @@
 else
 m_interrupt_sent = false;
 
+if (! broadcast_sent)
+{
+BroadcastEvent(eBroadcastBitRunPacketSent, NULL);
+broadcast_sent = true;
+}
+
 m_private_is_running.SetValue (true, eBroadcastAlways);
 }
 
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D14083: Fix race condition in process resume

2015-10-26 Thread Greg Clayton via lldb-commits
clayborg accepted this revision.
clayborg added a comment.
This revision is now accepted and ready to land.

Looks good as long as we always want to send the broadcast even if the continue 
packet fails to send.



Comment at: 
source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp:1074-1079
@@ -1073,2 +1073,8 @@
 
+if (! broadcast_sent)
+{
+BroadcastEvent(eBroadcastBitRunPacketSent, NULL);
+broadcast_sent = true;
+}
+
 m_private_is_running.SetValue (true, eBroadcastAlways);

Do we want this to happen even if we fail to send the packet? Should this  code 
be in the else clause above?


http://reviews.llvm.org/D14083



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


[Lldb-commits] [lldb] r251310 - Re-use prologue parsing code that was already written instead of having two copies of code that parse line table prologues.

2015-10-26 Thread Greg Clayton via lldb-commits
Author: gclayton
Date: Mon Oct 26 12:16:50 2015
New Revision: 251310

URL: http://llvm.org/viewvc/llvm-project?rev=251310&view=rev
Log:
Re-use prologue parsing code that was already written instead of having two 
copies of code that parse line table prologues.

Also since we always read in the DWARF data or mmap it, we don't need to make a 
copy of the strings for the directories and file names, we can just store 
"cosnt char *" values. Every place that uses the prologues use them temporarily 
and then throw them away so no one is expecting the directory and filename 
strings to live longer than the parse functions.


Modified:
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.h

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp?rev=251310&r1=251309&r2=251310&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp Mon Oct 26 
12:16:50 2015
@@ -249,7 +249,7 @@ DWARFDebugLine::DumpStatementOpcodes(Log
 fileEntry.length= 
debug_line_data.GetULEB128(&offset);
 log->Printf( "0x%8.8x: DW_LNE_define_file('%s', 
dir=%i, mod_time=0x%8.8x, length=%i )",
 op_offset,
-fileEntry.name.c_str(),
+fileEntry.name,
 fileEntry.dir_idx,
 fileEntry.mod_time,
 fileEntry.length);
@@ -486,65 +486,25 @@ DWARFDebugLine::ParseSupportFiles (const
FileSpecList &support_files)
 {
 lldb::offset_t offset = stmt_list;
-// Skip the total length
-(void)debug_line_data.GetDWARFInitialLength(&offset);
-uint32_t version = debug_line_data.GetU16(&offset);
-if (version < 2 || version > 4)
-  return false;
 
-const dw_offset_t end_prologue_offset = 
debug_line_data.GetDWARFOffset(&offset) + offset;
-// Skip instruction length, default is stmt, line base, line range
-offset += 4;
-// For DWARF4, skip maximum operations per instruction
-if (version >= 4)
-offset += 1;
-// Skip opcode base, and all opcode lengths
-const uint8_t opcode_base = debug_line_data.GetU8(&offset);
-offset += opcode_base - 1;
-std::vector include_directories{{}}; // Directory at index zero 
doesn't exist
-while (offset < end_prologue_offset)
-{
-FileSpec dir{debug_line_data.GetCStr(&offset), false};
-if (dir)
-include_directories.emplace_back(std::move(dir));
-else
-break;
-}
-while (offset < end_prologue_offset)
+Prologue prologue;
+if (!ParsePrologue(debug_line_data, &offset, &prologue))
 {
-FileSpec file_spec{debug_line_data.GetCStr(&offset), false};
-if (file_spec)
-{
-uint32_t dir_idx = debug_line_data.GetULEB128(&offset);
-debug_line_data.Skip_LEB128(&offset); // Skip mod_time
-debug_line_data.Skip_LEB128(&offset); // Skip length
-
-if (file_spec.IsRelative())
-{
-if (0 < dir_idx && dir_idx < include_directories.size())
-{
-const FileSpec &dir = include_directories[dir_idx];
-file_spec.PrependPathComponent(dir);
-}
-if (file_spec.IsRelative())
-file_spec.PrependPathComponent(cu_comp_dir);
-}
-std::string remapped_file;
-if (module_sp->RemapSourceFile(file_spec.GetCString(), 
remapped_file))
-file_spec.SetFile(remapped_file, false);
-support_files.Append(file_spec);
-}
+Host::SystemLog (Host::eSystemLogError, "error: parsing line table 
prologue at 0x%8.8x (parsing ended around 0x%8.8" PRIx64 "\n", stmt_list, 
offset);
+return false;
 }
 
-if (offset != end_prologue_offset)
+FileSpec file_spec;
+std::string remapped_file;
+
+for (uint32_t file_idx = 1; prologue.GetFile(file_idx, cu_comp_dir, 
file_spec); ++file_idx)
 {
-Host::SystemLog (Host::eSystemLogError, 
- "warning: parsing line table prologue at 0x%8.8x 
should have ended at 0x%8.8x but it ended at 0x%8.8" PRIx64 "\n",
- stmt_list, 
- end_prologue_offset, 
- offset);
+if (module_sp->RemapSourceFile(file_spec.GetCString(), remapped_file))
+file_spec.SetFile(remapped_file, false);
+support_files.Append(file_spec);
+
 }
-return end_prologue_offse

Re: [Lldb-commits] [PATCH] D14060: Deprecate -m/+m dotest options in favor of test categories

2015-10-26 Thread Todd Fiala via lldb-commits
tfiala added a comment.

In http://reviews.llvm.org/D14060#275211, @labath wrote:

> We have XFAILed MI tests that were failing on our linux build bot. Atm, I am 
> seeing expected passes, so I might try enabling them soon...


I have been seeing them fail intermittently on both OS X and Ubuntu 
14.04/15.10.  They seem to pass most of the time, but I'd say something like 
one in 3 or 4 runs, at least one of the MI tests fail.


http://reviews.llvm.org/D14060



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


Re: [Lldb-commits] [PATCH] D14083: Fix race condition in process resume

2015-10-26 Thread Pavel Labath via lldb-commits
labath added inline comments.


Comment at: 
source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp:1074-1079
@@ -1073,2 +1073,8 @@
 
+if (! broadcast_sent)
+{
+BroadcastEvent(eBroadcastBitRunPacketSent, NULL);
+broadcast_sent = true;
+}
+
 m_private_is_running.SetValue (true, eBroadcastAlways);

clayborg wrote:
> Do we want this to happen even if we fail to send the packet? Should this  
> code be in the else clause above?
It was always sent before this change, so I'd probably keep it that way. If the 
sending fails, we'll have to tear down the whole process anyway.


http://reviews.llvm.org/D14083



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


[Lldb-commits] [lldb] r251315 - Fixed the test suite on MacOSX so that "test/api/multithreaded/TestMultithreaded.py" works without errors.

2015-10-26 Thread Greg Clayton via lldb-commits
Author: gclayton
Date: Mon Oct 26 12:52:16 2015
New Revision: 251315

URL: http://llvm.org/viewvc/llvm-project?rev=251315&view=rev
Log:
Fixed the test suite on MacOSX so that 
"test/api/multithreaded/TestMultithreaded.py" works without errors.

The problem was that the @skipIfNoSBHeaders on darwin was trying to use 
self.lib_dir when it hadn't been set yet.

I looked at the code and places were required to set "self.lib_dir" for no real 
reason as all places that used it just used the LLDB_LIB_DIR environment 
variable. So I removed all uses of self.lib_dir and replaced them to use 
'os.environ["LLDB_LIB_DIR"]'. Did the same for self.implib_dir.


Modified:
lldb/trunk/test/api/check_public_api_headers/TestPublicAPIHeaders.py
lldb/trunk/test/api/multiple-debuggers/TestMultipleDebuggers.py
lldb/trunk/test/api/multithreaded/TestMultithreaded.py
lldb/trunk/test/functionalities/plugins/commands/TestPluginCommands.py
lldb/trunk/test/lldbtest.py

Modified: lldb/trunk/test/api/check_public_api_headers/TestPublicAPIHeaders.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/api/check_public_api_headers/TestPublicAPIHeaders.py?rev=251315&r1=251314&r2=251315&view=diff
==
--- lldb/trunk/test/api/check_public_api_headers/TestPublicAPIHeaders.py 
(original)
+++ lldb/trunk/test/api/check_public_api_headers/TestPublicAPIHeaders.py Mon 
Oct 26 12:52:16 2015
@@ -17,8 +17,6 @@ class SBDirCheckerCase(TestBase):
 
 def setUp(self):
 TestBase.setUp(self)
-self.lib_dir = os.environ["LLDB_LIB_DIR"]
-self.implib_dir = os.environ["LLDB_IMPLIB_DIR"]
 self.template = 'main.cpp.template'
 self.source = 'main.cpp'
 self.exe_name = 'a.out'

Modified: lldb/trunk/test/api/multiple-debuggers/TestMultipleDebuggers.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/api/multiple-debuggers/TestMultipleDebuggers.py?rev=251315&r1=251314&r2=251315&view=diff
==
--- lldb/trunk/test/api/multiple-debuggers/TestMultipleDebuggers.py (original)
+++ lldb/trunk/test/api/multiple-debuggers/TestMultipleDebuggers.py Mon Oct 26 
12:52:16 2015
@@ -14,11 +14,6 @@ class TestMultipleSimultaneousDebuggers(
 
 mydir = TestBase.compute_mydir(__file__)
 
-def setUp(self):
-TestBase.setUp(self)
-self.lib_dir = os.environ["LLDB_LIB_DIR"]
-self.implib_dir = os.environ["LLDB_IMPLIB_DIR"]
-
 @skipIfi386
 @skipIfNoSBHeaders
 @expectedFailureFreeBSD("llvm.org/pr20282")

Modified: lldb/trunk/test/api/multithreaded/TestMultithreaded.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/api/multithreaded/TestMultithreaded.py?rev=251315&r1=251314&r2=251315&view=diff
==
--- lldb/trunk/test/api/multithreaded/TestMultithreaded.py (original)
+++ lldb/trunk/test/api/multithreaded/TestMultithreaded.py Mon Oct 26 12:52:16 
2015
@@ -69,8 +69,6 @@ class SBBreakpointCallbackCase(TestBase)
 if self.getLldbArchitecture() != self.getArchitecture():
 self.skipTest("This test is only run if the target arch is the 
same as the lldb binary arch")
 
-self.lib_dir = os.environ["LLDB_LIB_DIR"]
-self.implib_dir = os.environ["LLDB_IMPLIB_DIR"]
 self.inferior = 'inferior_program'
 self.buildProgram('inferior.cpp', self.inferior)
 self.addTearDownHook(lambda: os.remove(self.inferior))

Modified: lldb/trunk/test/functionalities/plugins/commands/TestPluginCommands.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/plugins/commands/TestPluginCommands.py?rev=251315&r1=251314&r2=251315&view=diff
==
--- lldb/trunk/test/functionalities/plugins/commands/TestPluginCommands.py 
(original)
+++ lldb/trunk/test/functionalities/plugins/commands/TestPluginCommands.py Mon 
Oct 26 12:52:16 2015
@@ -16,12 +16,6 @@ class PluginCommandTestCase(TestBase):
 
 mydir = TestBase.compute_mydir(__file__)
 
-def setUp(self):
-# Call super's setUp().
-TestBase.setUp(self)
-self.lib_dir = os.environ["LLDB_LIB_DIR"]
-self.implib_dir = os.environ["LLDB_IMPLIB_DIR"]
-
 @skipIfNoSBHeaders
 @skipIfHostIncompatibleWithRemote # Requires a compatible arch and 
platform to link against the host's built lldb lib.
 @expectedFailureWindows("llvm.org/pr24778")

Modified: lldb/trunk/test/lldbtest.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbtest.py?rev=251315&r1=251314&r2=251315&view=diff
==
--- lldb/trunk/test/lldbtest.py (original)
+++ lldb/trunk/test/lldbtest.py Mon Oct 26 12:52:16 2015
@@ -870,7 +870,7 @@ def skipIfNoSBHeaders(func):
 from unittest2 import case

[Lldb-commits] [PATCH] D14085: Make Socket to support plugin interface

2015-10-26 Thread Oleksiy Vyalov via lldb-commits
ovyalov created this revision.
ovyalov added a reviewer: clayborg.
ovyalov added a subscriber: lldb-commits.
Herald added subscribers: srhines, danalbert, tberghammer.

Make Socket to support plugin interface - moved implementation classes into 
source/Plugins/Socket folder and migrated most of use cases in order to rely on 
base Socket class.

http://reviews.llvm.org/D14085

Files:
  cmake/LLDBDependencies.cmake
  include/lldb/Core/PluginManager.h
  include/lldb/Host/Socket.h
  include/lldb/Host/common/TCPSocket.h
  include/lldb/Host/common/UDPSocket.h
  include/lldb/Host/linux/AbstractSocket.h
  include/lldb/Host/posix/DomainSocket.h
  include/lldb/lldb-forward.h
  include/lldb/lldb-private-interfaces.h
  lldb.xcodeproj/project.pbxproj
  source/Core/PluginManager.cpp
  source/Host/CMakeLists.txt
  source/Host/common/Socket.cpp
  source/Host/common/TCPSocket.cpp
  source/Host/common/UDPSocket.cpp
  source/Host/linux/AbstractSocket.cpp
  source/Host/posix/ConnectionFileDescriptorPosix.cpp
  source/Host/posix/DomainSocket.cpp
  source/Initialization/SystemInitializerCommon.cpp
  source/Plugins/CMakeLists.txt
  source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp
  source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
  source/Plugins/Socket/CMakeLists.txt
  source/Plugins/Socket/Linux/AbstractSocket.cpp
  source/Plugins/Socket/Linux/AbstractSocket.h
  source/Plugins/Socket/Linux/CMakeLists.txt
  source/Plugins/Socket/POSIX/CMakeLists.txt
  source/Plugins/Socket/POSIX/DomainSocket.cpp
  source/Plugins/Socket/POSIX/DomainSocket.h
  source/Plugins/Socket/TCP/CMakeLists.txt
  source/Plugins/Socket/TCP/TCPSocket.cpp
  source/Plugins/Socket/TCP/TCPSocket.h
  source/Plugins/Socket/UDP/CMakeLists.txt
  source/Plugins/Socket/UDP/UDPSocket.cpp
  source/Plugins/Socket/UDP/UDPSocket.h
  tools/lldb-server/Acceptor.cpp
  tools/lldb-server/lldb-platform.cpp
  unittests/Host/SocketTest.cpp

Index: unittests/Host/SocketTest.cpp
===
--- unittests/Host/SocketTest.cpp
+++ unittests/Host/SocketTest.cpp
@@ -21,12 +21,8 @@
 
 #include "lldb/Host/Config.h"
 #include "lldb/Host/Socket.h"
-#include "lldb/Host/common/TCPSocket.h"
-#include "lldb/Host/common/UDPSocket.h"
 
-#ifndef LLDB_DISABLE_POSIX
-#include "lldb/Host/posix/DomainSocket.h"
-#endif
+#include "Plugins/Socket/UDP/UDPSocket.h"
 
 using namespace lldb_private;
 
@@ -40,6 +36,7 @@
 WSADATA data;
 ::WSAStartup(MAKEWORD(2, 2), &data);
 #endif
+Socket::Initialize();
 }
 
 void
@@ -58,13 +55,12 @@
 *error = listen_socket->Accept(listen_remote_address, child_processes_inherit, *accept_socket);
 }
 
-template
 void
-CreateConnectedSockets(const char *listen_remote_address, const std::function &get_connect_addr, std::unique_ptr *a_up, std::unique_ptr *b_up)
+CreateConnectedSockets(const char* scheme, const char *listen_remote_address, const std::function &get_connect_addr, std::unique_ptr *a_up, std::unique_ptr *b_up)
 {
 bool child_processes_inherit = false;
 Error error;
-std::unique_ptr listen_socket_up(new SocketType(child_processes_inherit, error));
+std::unique_ptr listen_socket_up(Socket::Create(scheme, child_processes_inherit, error));
 EXPECT_FALSE(error.Fail());
 error = listen_socket_up->Listen(listen_remote_address, 5);
 EXPECT_FALSE(error.Fail());
@@ -76,7 +72,7 @@
   &accept_socket, &accept_error);
 
 std::string connect_remote_address = get_connect_addr(*listen_socket_up);
-std::unique_ptr connect_socket_up(new SocketType(child_processes_inherit, error));
+std::unique_ptr connect_socket_up(Socket::Create(scheme, child_processes_inherit, error));
 EXPECT_FALSE(error.Fail());
 error = connect_socket_up->Connect(connect_remote_address.c_str());
 EXPECT_FALSE(error.Fail());
@@ -88,7 +84,7 @@
 EXPECT_TRUE((*a_up)->IsValid());
 
 accept_thread.join();
-b_up->reset(static_cast(accept_socket));
+b_up->reset(accept_socket);
 EXPECT_TRUE(accept_error.Success());
 EXPECT_NE(nullptr, b_up->get());
 EXPECT_TRUE((*b_up)->IsValid());
@@ -138,44 +134,47 @@
 const std::string file_name(file_name_str);
 free(file_name_str);
 
-std::unique_ptr socket_a_up;
-std::unique_ptr socket_b_up;
-CreateConnectedSockets(file_name.c_str(),
-  [=](const DomainSocket &)
-  {
-  return file_name;
-  },
-  &socket_a_up, &socket_b_up);
+std::unique_ptr socket_a_up;
+std::unique_ptr socket_b_up;
+CreateConnectedSockets("unix",
+   file_name.c_str(),
+   [=](const Socket &)
+   {
+   

[Lldb-commits] [lldb] r251319 - Fix an API missues in ParseTypeFromDWARF

2015-10-26 Thread Tamas Berghammer via lldb-commits
Author: tberghammer
Date: Mon Oct 26 13:10:55 2015
New Revision: 251319

URL: http://llvm.org/viewvc/llvm-project?rev=251319&view=rev
Log:
Fix an API missues in ParseTypeFromDWARF

The arguments for ClangASTContext::CreateMemberPointerType was passed
in in the wrong order.

Modified:
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp?rev=251319&r1=251318&r2=251319&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp 
(original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp Mon Oct 
26 13:10:55 2015
@@ -1522,7 +1522,7 @@ DWARFASTParserClang::ParseTypeFromDWARF
 CompilerType pointee_clang_type = 
pointee_type->GetForwardCompilerType ();
 CompilerType class_clang_type = 
class_type->GetLayoutCompilerType ();
 
-clang_type = 
ClangASTContext::CreateMemberPointerType(pointee_clang_type, class_clang_type);
+clang_type = 
ClangASTContext::CreateMemberPointerType(class_clang_type, pointee_clang_type);
 
 byte_size = clang_type.GetByteSize(nullptr);
 


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


Re: [Lldb-commits] [PATCH] D14085: Make Socket to support plugin interface

2015-10-26 Thread Zachary Turner via lldb-commits
zturner added a subscriber: zturner.
zturner requested changes to this revision.
zturner added a reviewer: zturner.
zturner added a comment.
This revision now requires changes to proceed.

I'm not sure I agree with this change.  The interface to programming with 
socket is by definition a property of the Host operating system.  It seems to 
me like Host was already the correct place for this code.


http://reviews.llvm.org/D14085



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


[Lldb-commits] [PATCH] D14088: Some minor improvements on the symtab parsing code

2015-10-26 Thread Tamas Berghammer via lldb-commits
tberghammer created this revision.
tberghammer added a reviewer: clayborg.
tberghammer added a subscriber: lldb-commits.

Some minor improvements on the symtab parsing code

* Remove an unnecessary re-computation on arch spec from the ELF file
* Use a local cache to optimize name based section lookup in symtab
  parsing
* Optimize C++ method basename validation with replacing a regex with
  hand written code

These modifications reduce the time required to parse the symtab from
large applications by ~25% (tested with LLDB as inferior)

http://reviews.llvm.org/D14088

Files:
  source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
  source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp

Index: source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
===
--- source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
+++ source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
@@ -11,6 +11,7 @@
 
 #include 
 #include 
+#include 
 
 #include "lldb/Core/ArchSpec.h"
 #include "lldb/Core/DataBuffer.h"
@@ -1943,6 +1944,13 @@
 // makes it highly unlikely that this will collide with anything else.
 bool skip_oatdata_oatexec = m_file.GetFilename() == ConstString("system@framew...@boot.oat");
 
+ArchSpec arch;
+GetArchitecture(arch);
+
+// Local cache to avoid doing a FindSectionByName for each symbol. The "const char*" key must
+// came from a ConstString object so they can be compared by pointer
+std::unordered_map section_name_to_section;
+
 unsigned i;
 for (i = 0; i < num_symbols; ++i)
 {
@@ -2048,8 +2056,7 @@
 int64_t symbol_value_offset = 0;
 uint32_t additional_flags = 0;
 
-ArchSpec arch;
-if (GetArchitecture(arch))
+if (arch.IsValid())
 {
 if (arch.GetMachine() == llvm::Triple::arm)
 {
@@ -2175,11 +2182,13 @@
 if (module_section_list && module_section_list != section_list)
 {
 const ConstString §_name = symbol_section_sp->GetName();
-lldb::SectionSP section_sp (module_section_list->FindSectionByName (sect_name));
-if (section_sp && section_sp->GetFileSize())
-{
-symbol_section_sp = section_sp;
-}
+auto section_it = section_name_to_section.find(sect_name.GetCString());
+if (section_it == section_name_to_section.end())
+section_it = section_name_to_section.emplace(
+sect_name.GetCString(),
+module_section_list->FindSectionByName (sect_name)).first;
+if (section_it->second && section_it->second->GetFileSize())
+symbol_section_sp = section_it->second;
 }
 }
 }
Index: source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
===
--- source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
+++ source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
@@ -131,6 +131,49 @@
 return false;
 }
 
+static bool
+IsValidBasename(const llvm::StringRef& basename)
+{
+// Check that the basename matches with the following regular expression or is an operator name:
+// "^~?([A-Za-z_][A-Za-z_0-9]*)(<.*>)?$"
+// We are using a hand written implementation because it is significantly more efficient then
+// using the general purpose regular expression library.
+size_t idx = 0;
+if (basename.size() > 0 && basename[0] == '~')
+idx = 1;
+
+if (basename.size() <= idx)
+return false; // Empty string or "~"
+
+if (!std::isalpha(basename[idx]) && basename[idx] != '_')
+return false; // First charater (after removing the possible '~'') isn't in [A-Za-z_]
+
+// Read all characters matching [A-Za-z_0-9]
+++idx;
+while (idx < basename.size())
+{
+if (!std::isalnum(basename[idx]) && basename[idx] != '_')
+break;
+++idx;
+}
+
+// We processed all characters. It is a vaild basename.
+if (idx == basename.size())
+return true;
+
+// Check for basename with template arguments
+// TODO: Improve the quality of the validation with validating the template arguments
+if (basename[idx] == '<' && basename.back() == '>')
+return true;
+
+// Check if the basename is a vaild C++ operator name
+if (!basename.startswith("operator"))
+return false;
+
+static RegularExpression g_operator_regex("^(operator)( ?)([A-Za-z_][A-Za-z_0-9]*|\\(\\)|\\[\\]|[\\^<>=!\\/*+-]+)(<.*>)?(\\[\\])?$");
+std::string basename_str(basename.str());
+return g_operator_regex.Execute(basename_str.c_str(), nullptr);
+}
 
 void
 CPlusPlusLanguage::MethodName::Parse()
@@ -201,30 +244,8 @@
 m_parse_error = true;
 return;
 }
-

[Lldb-commits] [lldb] r251328 - Remove use of octal literals.

2015-10-26 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Mon Oct 26 13:48:14 2015
New Revision: 251328

URL: http://llvm.org/viewvc/llvm-project?rev=251328&view=rev
Log:
Remove use of octal literals.

Python 3 has a different syntax for octal literals than Python 2
and they are incompatible with each other.  Six doesn't provide
a transparent wrapper around this, so the most sane thing to do
is to not use octal literals.  If you need an octal literal,
use a decimal literal and if it's not obvious what the value is,
provide the value in octal as a comment.

Modified:
lldb/trunk/test/lldbtest.py
lldb/trunk/test/tools/lldb-server/TestGdbRemoteExpeditedRegisters.py
lldb/trunk/test/tools/lldb-server/TestGdbRemoteThreadsInStopReply.py
lldb/trunk/test/tools/lldb-server/TestGdbRemote_qThreadStopInfo.py
lldb/trunk/test/tools/lldb-server/TestLldbGdbServer.py
lldb/trunk/test/tools/lldb-server/gdbremote_testcase.py

Modified: lldb/trunk/test/lldbtest.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbtest.py?rev=251328&r1=251327&r2=251328&view=diff
==
--- lldb/trunk/test/lldbtest.py (original)
+++ lldb/trunk/test/lldbtest.py Mon Oct 26 13:48:14 2015
@@ -2433,7 +2433,7 @@ class TestBase(Base):
 self.getArchitecture(),
 str(self.test_number),
 self.mydir)
-error = lldb.remote_platform.MakeDirectory(remote_test_dir, 0700)
+error = lldb.remote_platform.MakeDirectory(remote_test_dir, 448) # 
448 = 0o700
 if error.Success():
 lldb.remote_platform.SetWorkingDirectory(remote_test_dir)
 

Modified: lldb/trunk/test/tools/lldb-server/TestGdbRemoteExpeditedRegisters.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-server/TestGdbRemoteExpeditedRegisters.py?rev=251328&r1=251327&r2=251328&view=diff
==
--- lldb/trunk/test/tools/lldb-server/TestGdbRemoteExpeditedRegisters.py 
(original)
+++ lldb/trunk/test/tools/lldb-server/TestGdbRemoteExpeditedRegisters.py Mon 
Oct 26 13:48:14 2015
@@ -16,7 +16,7 @@ class TestGdbRemoteExpeditedRegisters(gd
 # Start up the inferior.
 "read packet: $c#63",
 # Immediately tell it to stop.  We want to see what it reports.
-"read packet: {}".format(chr(03)),
+"read packet: {}".format(chr(3)),
 {"direction":"send", 
"regex":r"^\$T([0-9a-fA-F]+)([^#]+)#[0-9a-fA-F]{2}$", 
"capture":{1:"stop_result", 2:"key_vals_text"} },
 ], True)
 

Modified: lldb/trunk/test/tools/lldb-server/TestGdbRemoteThreadsInStopReply.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-server/TestGdbRemoteThreadsInStopReply.py?rev=251328&r1=251327&r2=251328&view=diff
==
--- lldb/trunk/test/tools/lldb-server/TestGdbRemoteThreadsInStopReply.py 
(original)
+++ lldb/trunk/test/tools/lldb-server/TestGdbRemoteThreadsInStopReply.py Mon 
Oct 26 13:48:14 2015
@@ -36,7 +36,7 @@ class TestGdbRemoteThreadsInStopReply(gd
 time.sleep(1)
 self.reset_test_sequence()
 self.test_sequence.add_log_lines([
-"read packet: {}".format(chr(03)),
+"read packet: {}".format(chr(3)),
 {"direction":"send", 
"regex":r"^\$T([0-9a-fA-F]+)([^#]+)#[0-9a-fA-F]{2}$", 
"capture":{1:"stop_result", 2:"key_vals_text"} },
 ], True)
 context = self.expect_gdbremote_sequence()
@@ -51,7 +51,7 @@ class TestGdbRemoteThreadsInStopReply(gd
 self.reset_test_sequence()
 self.test_sequence.add_log_lines([
 "read packet: $c#63",
-"read packet: {}".format(chr(03)),
+"read packet: {}".format(chr(3)),
 {"direction":"send", 
"regex":r"^\$T([0-9a-fA-F]+)([^#]+)#[0-9a-fA-F]{2}$", 
"capture":{1:"stop_result", 2:"key_vals_text"} },
 ], True)
 context = self.expect_gdbremote_sequence()

Modified: lldb/trunk/test/tools/lldb-server/TestGdbRemote_qThreadStopInfo.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-server/TestGdbRemote_qThreadStopInfo.py?rev=251328&r1=251327&r2=251328&view=diff
==
--- lldb/trunk/test/tools/lldb-server/TestGdbRemote_qThreadStopInfo.py 
(original)
+++ lldb/trunk/test/tools/lldb-server/TestGdbRemote_qThreadStopInfo.py Mon Oct 
26 13:48:14 2015
@@ -33,7 +33,7 @@ class TestGdbRemote_qThreadStopInfo(gdbr
 time.sleep(1)
 self.reset_test_sequence()
 self.test_sequence.add_log_lines([
-"read packet: {}".format(chr(03)),
+"read packet: {}".format(chr(3)),
 {"direction":"send", 
"regex":r"^\$T([0-9a-fA-F]+)([^#]+)#[0-9a-fA-F]{2}$", 
"capture":{1:"stop_result", 2:"key_vals_text"} },
 ], True)

[Lldb-commits] [lldb] r251329 - Python 3: Convert uses of `callable(x)` to `six.callable(x)`.

2015-10-26 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Mon Oct 26 13:48:24 2015
New Revision: 251329

URL: http://llvm.org/viewvc/llvm-project?rev=251329&view=rev
Log:
Python 3: Convert uses of `callable(x)` to `six.callable(x)`.

Modified:
lldb/trunk/test/dotest.py
lldb/trunk/test/lldbcurses.py
lldb/trunk/test/lldbtest.py
lldb/trunk/test/lldbutil.py

Modified: lldb/trunk/test/dotest.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/dotest.py?rev=251329&r1=251328&r2=251329&view=diff
==
--- lldb/trunk/test/dotest.py (original)
+++ lldb/trunk/test/dotest.py Mon Oct 26 13:48:24 2015
@@ -860,12 +860,12 @@ def parseOptionsAndInitTestdirs():
 #print("config:", config)
 if "pre_flight" in config:
 pre_flight = config["pre_flight"]
-if not callable(pre_flight):
+if not six.callable(pre_flight):
 print("fatal error: pre_flight is not callable, exiting.")
 sys.exit(1)
 if "post_flight" in config:
 post_flight = config["post_flight"]
-if not callable(post_flight):
+if not six.callable(post_flight):
 print("fatal error: post_flight is not callable, exiting.")
 sys.exit(1)
 if "lldbtest_remote_sandbox" in config:

Modified: lldb/trunk/test/lldbcurses.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbcurses.py?rev=251329&r1=251328&r2=251329&view=diff
==
--- lldb/trunk/test/lldbcurses.py (original)
+++ lldb/trunk/test/lldbcurses.py Mon Oct 26 13:48:24 2015
@@ -176,7 +176,7 @@ class Window(object):
 
 def set_first_responder(self, window):
 if window.can_become_first_responder:
-if callable(getattr(window, "hidden", None)) and window.hidden():
+if six.callable(getattr(window, "hidden", None)) and 
window.hidden():
 return False
 if not window in self.children:
 self.add_child(window)
@@ -386,7 +386,7 @@ class Window(object):
 return True
 # Check if the window delegate wants to handle this key press
 if self.delegate:  
-if callable(getattr(self.delegate, "handle_key", None)):
+if six.callable(getattr(self.delegate, "handle_key", None)):
 if self.delegate.handle_key(self, key):
 return True
 if self.delegate(self, key):

Modified: lldb/trunk/test/lldbtest.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbtest.py?rev=251329&r1=251328&r2=251329&view=diff
==
--- lldb/trunk/test/lldbtest.py (original)
+++ lldb/trunk/test/lldbtest.py Mon Oct 26 13:48:24 2015
@@ -54,6 +54,8 @@ import test_categories
 from six import add_metaclass
 from six import StringIO as SixStringIO
 from six.moves.urllib import parse as urlparse
+import six
+import collections
 
 # dosep.py starts lots and lots of dotest instances
 # This option helps you find if two (or more) dotest instances are using the 
same
@@ -622,7 +624,7 @@ def expectedFailure(expected_fn, bugnumb
 return wrapper
 # if bugnumber is not-callable(incluing None), that means decorator 
function is called with optional arguments
 # return decorator in this case, so it will be used to decorating original 
method
-if callable(bugnumber):
+if six.callable(bugnumber):
 return expectedFailure_impl(bugnumber)
 else:
 return expectedFailure_impl
@@ -762,7 +764,7 @@ def expectedFlakey(expected_fn, bugnumbe
 return wrapper
 # if bugnumber is not-callable(incluing None), that means decorator 
function is called with optional arguments
 # return decorator in this case, so it will be used to decorating original 
method
-if callable(bugnumber):
+if six.callable(bugnumber):
 return expectedFailure_impl(bugnumber)
 else:
 return expectedFailure_impl
@@ -1088,7 +1090,7 @@ def skipTestIfFn(expected_fn, bugnumber=
 else:
 func(*args, **kwargs)
 return wrapper
-if callable(bugnumber):
+if six.callable(bugnumber):
 return skipTestIfFn_impl(bugnumber)
 else:
 return skipTestIfFn_impl
@@ -1606,7 +1608,7 @@ class Base(unittest2.TestCase):
 
 Hooks are executed in a first come first serve manner.
 """
-if callable(hook):
+if six.callable(hook):
 with recording(self, traceAlways) as sbuf:
 print("Adding tearDown hook:", getsource_if_available(hook), 
file=sbuf)
 self.hooks.append(hook)

Modified: lldb/trunk/test/lldbutil.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbutil.py?rev=251329&r1=251328&r2=251329&view=diff
==

Re: [Lldb-commits] [PATCH] D14085: Make Socket to support plugin interface

2015-10-26 Thread Oleksiy Vyalov via lldb-commits
ovyalov added a comment.

In http://reviews.llvm.org/D14085#275442, @zturner wrote:

> I'm not sure I agree with this change.  The interface to programming with 
> socket is by definition a property of the Host operating system.  It seems to 
> me like Host was already the correct place for this code.


Base Socket class which is utilized by users remains in Host interface - moving 
implementation classes into Plugins somewhat simplifies creation/registration 
process with PluginManager (instead of if (scheme=="tcp"){} else if 
(scheme=="unix"){}..).


http://reviews.llvm.org/D14085



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


Re: [Lldb-commits] [PATCH] D14085: Make Socket to support plugin interface

2015-10-26 Thread Zachary Turner via lldb-commits
zturner added a comment.

I still think implementation should be in Host as well.  If the idea is to 
simplify the creation scheme, then you could create an enum:

  enum class SocketType {
  Tcp,
  Udp,
  UnixDomain
  };

and provide a static method on SocketBase like this:

  class SocketBase {
  public:
  static std::unique_ptr
  MakeSocket(SocketType type);
  };

Although this is in the long term, eventually we will require a modules build 
of LLDB, so introducing more circular library dependencies should really be 
avoided, as they are incompatible with modules build and will have to be 
refactored again once we try to get a modules build working.

Let's see what Greg and others say, but personally I don't think the plugin 
system should be used solely to gain access to a factory-like creation 
interface.


http://reviews.llvm.org/D14085



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


Re: [Lldb-commits] [PATCH] D14085: Make Socket to support plugin interface

2015-10-26 Thread Greg Clayton via lldb-commits
clayborg added a comment.

The plug-in interface I was thinking of was the Connection class. This would 
allow different platforms to support different Connection subclasses for things 
like network, serial, USB, Firewire, shared memory, IPC and others. Not sure if 
socket is stand alone enough to warrant its own plug-in interface. How are the 
socket subclasses used around LLDB? Are they used directly? Or are they place 
into a Connection class?


http://reviews.llvm.org/D14085



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


Re: [Lldb-commits] [PATCH] D14085: Make Socket to support plugin interface

2015-10-26 Thread Zachary Turner via lldb-commits
zturner added a comment.

I think most of the time they are used in a Connection class, but I don't think 
it's necessarily guaranteed they will always be that way.

I can think of at least one use case in the future where we will need to open a 
socket to a server we don't control and stream some data down from the server.  
I don't see the advantage of using a Connection in that case.

So I would say: Right now it's probably always used in Connection, but I dont' 
want to lose the flexibility to use it standalone either.

That said, IMO low-level OS primitive abstractions are by definition what Host 
is for, but higher level abstractions built on top of those can use the plugin 
interface


http://reviews.llvm.org/D14085



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


[Lldb-commits] [PATCH] D14089: Avoid using `..` in paths for include dirs.

2015-10-26 Thread Stephane Sezer via lldb-commits
sas created this revision.
sas added reviewers: dawn, brucem.
sas added a subscriber: lldb-commits.

This breaks when using a symlink from llvm/tools/lldb to the lldb source
tree, instead of cloning directly as a child. With this change, we can
build properly, even when using links.

http://reviews.llvm.org/D14089

Files:
  cmake/modules/LLDBConfig.cmake

Index: cmake/modules/LLDBConfig.cmake
===
--- cmake/modules/LLDBConfig.cmake
+++ cmake/modules/LLDBConfig.cmake
@@ -194,7 +194,7 @@
   add_definitions( -DLLDB_DISABLE_PYTHON )
 endif()
 
-include_directories(../clang/include)
+include_directories(${CMAKE_SOURCE_DIR}/tools/clang/include)
 include_directories("${CMAKE_CURRENT_BINARY_DIR}/../clang/include")
 
 # Disable GCC warnings


Index: cmake/modules/LLDBConfig.cmake
===
--- cmake/modules/LLDBConfig.cmake
+++ cmake/modules/LLDBConfig.cmake
@@ -194,7 +194,7 @@
   add_definitions( -DLLDB_DISABLE_PYTHON )
 endif()
 
-include_directories(../clang/include)
+include_directories(${CMAKE_SOURCE_DIR}/tools/clang/include)
 include_directories("${CMAKE_CURRENT_BINARY_DIR}/../clang/include")
 
 # Disable GCC warnings
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D14091: Remove some useless typedef's.

2015-10-26 Thread Stephane Sezer via lldb-commits
sas created this revision.
sas added reviewers: clayborg, zturner.
sas added a subscriber: lldb-commits.

This does not have any functionnal difference but I found myself
searching for 'struct RegisterInfo$' to find a definition and couldn't
find it. The version without typedef seems more common so let's try and
be consistent.

http://reviews.llvm.org/D14091

Files:
  include/lldb/lldb-private-types.h

Index: include/lldb/lldb-private-types.h
===
--- include/lldb/lldb-private-types.h
+++ include/lldb/lldb-private-types.h
@@ -35,7 +35,7 @@
 // name (optional), encoding, size in bytes and the default display
 // format.
 //--
-typedef struct
+struct RegisterInfo
 {
 const char *name;// Name of this register, can't be NULL
 const char *alt_name;// Alternate name of this register, can be 
NULL
@@ -54,12 +54,12 @@
// null, all registers in this list will be 
invalidated when the value of this
// register changes.  For example, the 
invalidate list for eax would be rax
// ax, ah, and al.
-} RegisterInfo;
+};
 
 //--
 // Registers are grouped into register sets
 //--
-typedef struct
+struct RegisterSet
 {
 const char *name;   // Name of this register set
 const char *short_name; // A short name for this register set
@@ -69,23 +69,23 @@
 // register array.  For example, if eax is 
defined at index 4 for a
 // particular RegisterContext, eax would 
be included in this RegisterSet
 // by adding the value 4.  Not by adding 
the value lldb_eax_i386.
-} RegisterSet;
+};
 
-typedef struct
+struct OptionEnumValueElement
 {
 int64_t value;
 const char *string_value;
 const char *usage;
-} OptionEnumValueElement;
+};
 
 struct OptionValidator
 {
 virtual ~OptionValidator() { }
 virtual bool IsValid(Platform &platform, const ExecutionContext 
&target) const = 0;
 virtual const char * ShortConditionString() const = 0;
 virtual const char * LongConditionString() const = 0;
 };
-
+
 struct OptionDefinition
 {
 uint32_t usage_mask; // Used to mark options that 
can be used together.  If (1 << n & usage_mask) != 0


Index: include/lldb/lldb-private-types.h
===
--- include/lldb/lldb-private-types.h
+++ include/lldb/lldb-private-types.h
@@ -35,7 +35,7 @@
 // name (optional), encoding, size in bytes and the default display
 // format.
 //--
-typedef struct
+struct RegisterInfo
 {
 const char *name;// Name of this register, can't be NULL
 const char *alt_name;// Alternate name of this register, can be NULL
@@ -54,12 +54,12 @@
// null, all registers in this list will be invalidated when the value of this
// register changes.  For example, the invalidate list for eax would be rax
// ax, ah, and al.
-} RegisterInfo;
+};
 
 //--
 // Registers are grouped into register sets
 //--
-typedef struct
+struct RegisterSet
 {
 const char *name;   // Name of this register set
 const char *short_name; // A short name for this register set
@@ -69,23 +69,23 @@
 // register array.  For example, if eax is defined at index 4 for a
 // particular RegisterContext, eax would be included in this RegisterSet
 // by adding the value 4.  Not by adding the value lldb_eax_i386.
-} RegisterSet;
+};
 
-typedef struct
+struct OptionEnumValueElement
 {
 int64_t value;
 const char *string_value;
 const char *usage;
-} OptionEnumValueElement;
+};
 
 struct OptionValidator
 {
 virtual ~OptionValidator() { }
 virtual bool IsValid(Platform &platform, const ExecutionContext &target) const = 0;
 virtual const char * ShortConditionString() const = 0;
 virtual const char * LongConditionString() const = 0;
 };
-
+
 struct OptionDefinition
 {
 uint32_t usage_m

[Lldb-commits] [lldb] r251340 - Clang module compilation options need to be per-platform.

2015-10-26 Thread Sean Callanan via lldb-commits
Author: spyffe
Date: Mon Oct 26 15:33:24 2015
New Revision: 251340

URL: http://llvm.org/viewvc/llvm-project?rev=251340&view=rev
Log:
Clang module compilation options need to be per-platform.

On UNIX (but not Darwin) the username needs to be respected when creating a 
temporary module directory, so that different users don't pollute each others'
module caches.

Modified:
lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.h
lldb/trunk/source/Target/Platform.cpp

Modified: 
lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp?rev=251340&r1=251339&r2=251340&view=diff
==
--- lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp 
(original)
+++ lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp 
Mon Oct 26 15:33:24 2015
@@ -641,18 +641,7 @@ ClangModulesDeclVendor::Create(Target &t
 compiler_invocation_arguments.push_back(ModuleImportBufferName);
 
 // Add additional search paths with { "-I", path } or { "-F", path } here.
-   
-{
-llvm::SmallString<128> DefaultModuleCache;
-const bool erased_on_reboot = false;
-llvm::sys::path::system_temp_directory(erased_on_reboot, 
DefaultModuleCache);
-llvm::sys::path::append(DefaultModuleCache, "org.llvm.clang");
-llvm::sys::path::append(DefaultModuleCache, "ModuleCache");
-std::string module_cache_argument("-fmodules-cache-path=");
-module_cache_argument.append(DefaultModuleCache.str().str());
-compiler_invocation_arguments.push_back(module_cache_argument);
-}
-
+   
 FileSpecList &module_search_paths = target.GetClangModuleSearchPaths();
 
 for (size_t spi = 0, spe = module_search_paths.GetSize(); spi < spe; ++spi)

Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp?rev=251340&r1=251339&r2=251340&view=diff
==
--- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp Mon Oct 26 
15:33:24 2015
@@ -35,6 +35,10 @@
 #include "lldb/Target/Target.h"
 #include "llvm/ADT/STLExtras.h"
 
+#include "llvm/ADT/StringExtras.h"
+#include "llvm/ADT/SmallString.h"
+#include "llvm/Support/Path.h"
+
 using namespace lldb;
 using namespace lldb_private;
 
@@ -1476,6 +1480,17 @@ PlatformDarwin::AddClangModuleCompilatio
apple_arguments.begin(),
apple_arguments.end());
 
+{
+llvm::SmallString<128> DefaultModuleCache;
+const bool erased_on_reboot = false;
+llvm::sys::path::system_temp_directory(erased_on_reboot, 
DefaultModuleCache);
+llvm::sys::path::append(DefaultModuleCache, "org.llvm.clang");
+llvm::sys::path::append(DefaultModuleCache, "ModuleCache");
+std::string module_cache_argument("-fmodules-cache-path=");
+module_cache_argument.append(DefaultModuleCache.str().str());
+options.push_back(module_cache_argument);
+}
+
 StreamString minimum_version_option;
 uint32_t versions[3] = { 0, 0, 0 };
 bool use_current_os_version = false;

Modified: lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp?rev=251340&r1=251339&r2=251340&view=diff
==
--- lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp Mon Oct 26 
15:33:24 2015
@@ -27,6 +27,10 @@
 #include "lldb/Target/Process.h"
 #include "lldb/Target/ProcessLaunchInfo.h"
 
+#include "llvm/ADT/StringExtras.h"
+#include "llvm/ADT/SmallString.h"
+#include "llvm/Support/Path.h"
+
 using namespace lldb;
 using namespace lldb_private;
 
@@ -848,4 +852,64 @@ void
 PlatformPOSIX::CalculateTrapHandlerSymbolNames ()
 {   
 m_trap_handlers.push_back (ConstString ("_sigtramp"));
-}   
+}
+
+static bool isAlphanumeric(const char c)
+{
+return ((c >= '0' && c <= '9') ||
+(c >= 'a' && c <= 'z') ||
+(c >= 'A' && c <= 'Z'));
+}
+
+static void appendUserToPath(llvm::SmallVectorImpl &Result)
+{
+const char *username = getenv("LOGNAME");
+
+if (username)
+{
+// Validate that LoginName can be used in a path, and get its length.
+size_t Len = 0;
+for (const char

Re: [Lldb-commits] [PATCH] D14085: Make Socket to support plugin interface

2015-10-26 Thread Greg Clayton via lldb-commits
clayborg added a comment.

In http://reviews.llvm.org/D14085#275507, @zturner wrote:

> I think most of the time they are used in a Connection class, but I don't 
> think it's necessarily guaranteed they will always be that way.
>
> I can think of at least one use case in the future where we will need to open 
> a socket to a server we don't control and stream some data down from the 
> server.  I don't see the advantage of using a Connection in that case.


Definitely not.

> So I would say: Right now it's probably always used in Connection, but I 
> dont' want to lose the flexibility to use it standalone either.


Agreed. If they are mostly used in connection classes, I would say to do what 
you said to do: add an enum and factory static method on Socket that uses that 
enumeration and then make Connection class into plug-ins they themselves vend 
the URL prefixes and instantiate a connection class with any arguments. So:

1 - convert Socket class to use enum + factory class:

  enum class SocketType {
  Tcp,
  Udp,
  UnixDomain
  };
  
  class SocketBase {
  public:
  static std::unique_ptr
  MakeSocket(SocketType type);
  };

2 - Make Connection classes into plug-ins and have them parse the URLs in the 
"static Connection *Connection::GetConnectionForURL(const char *url);"

> That said, IMO low-level OS primitive abstractions are by definition what 
> Host is for, but higher level abstractions built on top of those can use the 
> plugin interface


That is fine and the above two step solution would enforce that.


http://reviews.llvm.org/D14085



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


Re: [Lldb-commits] [PATCH] D14085: Make Socket to support plugin interface

2015-10-26 Thread Oleksiy Vyalov via lldb-commits
ovyalov added a comment.

In http://reviews.llvm.org/D14085#275507, @zturner wrote:

> I think most of the time they are used in a Connection class, but I don't 
> think it's necessarily guaranteed they will always be that way.
>
> I can think of at least one use case in the future where we will need to open 
> a socket to a server we don't control and stream some data down from the 
> server.  I don't see the advantage of using a Connection in that case.
>
> So I would say: Right now it's probably always used in Connection, but I 
> dont' want to lose the flexibility to use it standalone either.
>
> That said, IMO low-level OS primitive abstractions are by definition what 
> Host is for, but higher level abstractions built on top of those can use the 
> plugin interface


There are some corner cases that don't fit into regular model:

- Creation of UDP connection - LLDB uses pair of send/receive sockets and 
that's why we need to use UDPSocket::Connect instead of using factory method.
- ConnectionFileDescriptor::Connect creates a new TCP socket without giving up 
the ownership of a socket handle.

As an option, we can introduce static std::unique_ptr 
Socket::Create(const char* scheme, bool child_processes_inherit, Error& error); 
as socket class creator method but without moving socket classes into plugins.


http://reviews.llvm.org/D14085



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


[Lldb-commits] [lldb] r251351 - Remove some useless typedef's.

2015-10-26 Thread Stephane Sezer via lldb-commits
Author: sas
Date: Mon Oct 26 16:32:31 2015
New Revision: 251351

URL: http://llvm.org/viewvc/llvm-project?rev=251351&view=rev
Log:
Remove some useless typedef's.

Summary:
This does not have any functionnal difference but I found myself
searching for 'struct RegisterInfo$' to find a definition and couldn't
find it. The version without typedef seems more common so let's try and
be consistent.

Reviewers: clayborg, zturner

Subscribers: lldb-commits

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

Modified:
lldb/trunk/include/lldb/lldb-private-types.h

Modified: lldb/trunk/include/lldb/lldb-private-types.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-private-types.h?rev=251351&r1=251350&r2=251351&view=diff
==
--- lldb/trunk/include/lldb/lldb-private-types.h (original)
+++ lldb/trunk/include/lldb/lldb-private-types.h Mon Oct 26 16:32:31 2015
@@ -35,7 +35,7 @@ namespace lldb_private
 // name (optional), encoding, size in bytes and the default display
 // format.
 //--
-typedef struct
+struct RegisterInfo
 {
 const char *name;// Name of this register, can't be NULL
 const char *alt_name;// Alternate name of this register, can be 
NULL
@@ -54,12 +54,12 @@ namespace lldb_private
// null, all registers in this list will be 
invalidated when the value of this
// register changes.  For example, the 
invalidate list for eax would be rax
// ax, ah, and al.
-} RegisterInfo;
+};
 
 //--
 // Registers are grouped into register sets
 //--
-typedef struct
+struct RegisterSet
 {
 const char *name;   // Name of this register set
 const char *short_name; // A short name for this register set
@@ -69,14 +69,14 @@ namespace lldb_private
 // register array.  For example, if eax is 
defined at index 4 for a
 // particular RegisterContext, eax would 
be included in this RegisterSet
 // by adding the value 4.  Not by adding 
the value lldb_eax_i386.
-} RegisterSet;
+};
 
-typedef struct
+struct OptionEnumValueElement
 {
 int64_t value;
 const char *string_value;
 const char *usage;
-} OptionEnumValueElement;
+};
 
 struct OptionValidator
 {
@@ -85,7 +85,7 @@ namespace lldb_private
 virtual const char * ShortConditionString() const = 0;
 virtual const char * LongConditionString() const = 0;
 };
-
+
 struct OptionDefinition
 {
 uint32_t usage_mask; // Used to mark options that 
can be used together.  If (1 << n & usage_mask) != 0


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


Re: [Lldb-commits] [PATCH] D14091: Remove some useless typedef's.

2015-10-26 Thread Stephane Sezer via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL251351: Remove some useless typedef's. (authored by sas).

Changed prior to commit:
  http://reviews.llvm.org/D14091?vs=38455&id=38464#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D14091

Files:
  lldb/trunk/include/lldb/lldb-private-types.h

Index: lldb/trunk/include/lldb/lldb-private-types.h
===
--- lldb/trunk/include/lldb/lldb-private-types.h
+++ lldb/trunk/include/lldb/lldb-private-types.h
@@ -35,7 +35,7 @@
 // name (optional), encoding, size in bytes and the default display
 // format.
 //--
-typedef struct
+struct RegisterInfo
 {
 const char *name;// Name of this register, can't be NULL
 const char *alt_name;// Alternate name of this register, can be 
NULL
@@ -54,12 +54,12 @@
// null, all registers in this list will be 
invalidated when the value of this
// register changes.  For example, the 
invalidate list for eax would be rax
// ax, ah, and al.
-} RegisterInfo;
+};
 
 //--
 // Registers are grouped into register sets
 //--
-typedef struct
+struct RegisterSet
 {
 const char *name;   // Name of this register set
 const char *short_name; // A short name for this register set
@@ -69,23 +69,23 @@
 // register array.  For example, if eax is 
defined at index 4 for a
 // particular RegisterContext, eax would 
be included in this RegisterSet
 // by adding the value 4.  Not by adding 
the value lldb_eax_i386.
-} RegisterSet;
+};
 
-typedef struct
+struct OptionEnumValueElement
 {
 int64_t value;
 const char *string_value;
 const char *usage;
-} OptionEnumValueElement;
+};
 
 struct OptionValidator
 {
 virtual ~OptionValidator() { }
 virtual bool IsValid(Platform &platform, const ExecutionContext 
&target) const = 0;
 virtual const char * ShortConditionString() const = 0;
 virtual const char * LongConditionString() const = 0;
 };
-
+
 struct OptionDefinition
 {
 uint32_t usage_mask; // Used to mark options that 
can be used together.  If (1 << n & usage_mask) != 0


Index: lldb/trunk/include/lldb/lldb-private-types.h
===
--- lldb/trunk/include/lldb/lldb-private-types.h
+++ lldb/trunk/include/lldb/lldb-private-types.h
@@ -35,7 +35,7 @@
 // name (optional), encoding, size in bytes and the default display
 // format.
 //--
-typedef struct
+struct RegisterInfo
 {
 const char *name;// Name of this register, can't be NULL
 const char *alt_name;// Alternate name of this register, can be NULL
@@ -54,12 +54,12 @@
// null, all registers in this list will be invalidated when the value of this
// register changes.  For example, the invalidate list for eax would be rax
// ax, ah, and al.
-} RegisterInfo;
+};
 
 //--
 // Registers are grouped into register sets
 //--
-typedef struct
+struct RegisterSet
 {
 const char *name;   // Name of this register set
 const char *short_name; // A short name for this register set
@@ -69,23 +69,23 @@
 // register array.  For example, if eax is defined at index 4 for a
 // particular RegisterContext, eax would be included in this RegisterSet
 // by adding the value 4.  Not by adding the value lldb_eax_i386.
-} RegisterSet;
+};
 
-typedef struct
+struct OptionEnumValueElement
 {
 int64_t value;
 const char *string_value;
 const char *usage;
-} OptionEnumValueElement;
+};
 
 struct OptionValidator
 {
 virtual ~OptionValidator() { }
 virtual bool IsValid(Platform &platform, const ExecutionContext &target) const = 0;
 virtual const char * ShortConditionString() const = 0;
 virtual const char * LongConditionString() const = 0;
 };
-
+
 struct OptionDefinition
 {
 uint32_t usag

[Lldb-commits] [lldb] r251354 - Revert "Clang module compilation options need to be per-platform."

2015-10-26 Thread Adrian McCarthy via lldb-commits
Author: amccarth
Date: Mon Oct 26 16:38:41 2015
New Revision: 251354

URL: http://llvm.org/viewvc/llvm-project?rev=251354&view=rev
Log:
Revert "Clang module compilation options need to be per-platform."

This reverts commit r251340.

Breaks the Windows build because Windows doesn't have getuid.  The fix is not 
obvious.

Modified:
lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.h
lldb/trunk/source/Target/Platform.cpp

Modified: 
lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp?rev=251354&r1=251353&r2=251354&view=diff
==
--- lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp 
(original)
+++ lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp 
Mon Oct 26 16:38:41 2015
@@ -641,7 +641,18 @@ ClangModulesDeclVendor::Create(Target &t
 compiler_invocation_arguments.push_back(ModuleImportBufferName);
 
 // Add additional search paths with { "-I", path } or { "-F", path } here.
-   
+   
+{
+llvm::SmallString<128> DefaultModuleCache;
+const bool erased_on_reboot = false;
+llvm::sys::path::system_temp_directory(erased_on_reboot, 
DefaultModuleCache);
+llvm::sys::path::append(DefaultModuleCache, "org.llvm.clang");
+llvm::sys::path::append(DefaultModuleCache, "ModuleCache");
+std::string module_cache_argument("-fmodules-cache-path=");
+module_cache_argument.append(DefaultModuleCache.str().str());
+compiler_invocation_arguments.push_back(module_cache_argument);
+}
+
 FileSpecList &module_search_paths = target.GetClangModuleSearchPaths();
 
 for (size_t spi = 0, spe = module_search_paths.GetSize(); spi < spe; ++spi)

Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp?rev=251354&r1=251353&r2=251354&view=diff
==
--- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp Mon Oct 26 
16:38:41 2015
@@ -35,10 +35,6 @@
 #include "lldb/Target/Target.h"
 #include "llvm/ADT/STLExtras.h"
 
-#include "llvm/ADT/StringExtras.h"
-#include "llvm/ADT/SmallString.h"
-#include "llvm/Support/Path.h"
-
 using namespace lldb;
 using namespace lldb_private;
 
@@ -1480,17 +1476,6 @@ PlatformDarwin::AddClangModuleCompilatio
apple_arguments.begin(),
apple_arguments.end());
 
-{
-llvm::SmallString<128> DefaultModuleCache;
-const bool erased_on_reboot = false;
-llvm::sys::path::system_temp_directory(erased_on_reboot, 
DefaultModuleCache);
-llvm::sys::path::append(DefaultModuleCache, "org.llvm.clang");
-llvm::sys::path::append(DefaultModuleCache, "ModuleCache");
-std::string module_cache_argument("-fmodules-cache-path=");
-module_cache_argument.append(DefaultModuleCache.str().str());
-options.push_back(module_cache_argument);
-}
-
 StreamString minimum_version_option;
 uint32_t versions[3] = { 0, 0, 0 };
 bool use_current_os_version = false;

Modified: lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp?rev=251354&r1=251353&r2=251354&view=diff
==
--- lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp Mon Oct 26 
16:38:41 2015
@@ -27,10 +27,6 @@
 #include "lldb/Target/Process.h"
 #include "lldb/Target/ProcessLaunchInfo.h"
 
-#include "llvm/ADT/StringExtras.h"
-#include "llvm/ADT/SmallString.h"
-#include "llvm/Support/Path.h"
-
 using namespace lldb;
 using namespace lldb_private;
 
@@ -852,64 +848,4 @@ void
 PlatformPOSIX::CalculateTrapHandlerSymbolNames ()
 {   
 m_trap_handlers.push_back (ConstString ("_sigtramp"));
-}
-
-static bool isAlphanumeric(const char c)
-{
-return ((c >= '0' && c <= '9') ||
-(c >= 'a' && c <= 'z') ||
-(c >= 'A' && c <= 'Z'));
-}
-
-static void appendUserToPath(llvm::SmallVectorImpl &Result)
-{
-const char *username = getenv("LOGNAME");
-
-if (username)
-{
-// Validate that LoginName can be used in a path, and get its length.
-size_t Len = 0;
-for (const char *P = username; *P; ++P, ++Len) {
-i

Re: [Lldb-commits] [lldb] r251340 - Clang module compilation options need to be per-platform.

2015-10-26 Thread Adrian McCarthy via lldb-commits
FYI:  This broke the Windows build (which doesn't have getuid), and the fix
wasn't immediately obvious, so I reverted the change.

Adrian.

On Mon, Oct 26, 2015 at 1:33 PM, Sean Callanan via lldb-commits <
lldb-commits@lists.llvm.org> wrote:

> Author: spyffe
> Date: Mon Oct 26 15:33:24 2015
> New Revision: 251340
>
> URL: http://llvm.org/viewvc/llvm-project?rev=251340&view=rev
> Log:
> Clang module compilation options need to be per-platform.
>
> On UNIX (but not Darwin) the username needs to be respected when creating a
> temporary module directory, so that different users don't pollute each
> others'
> module caches.
>
> Modified:
>
> lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
> lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
> lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
> lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.h
> lldb/trunk/source/Target/Platform.cpp
>
> Modified:
> lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp?rev=251340&r1=251339&r2=251340&view=diff
>
> ==
> ---
> lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
> (original)
> +++
> lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
> Mon Oct 26 15:33:24 2015
> @@ -641,18 +641,7 @@ ClangModulesDeclVendor::Create(Target &t
>  compiler_invocation_arguments.push_back(ModuleImportBufferName);
>
>  // Add additional search paths with { "-I", path } or { "-F", path }
> here.
> -
> -{
> -llvm::SmallString<128> DefaultModuleCache;
> -const bool erased_on_reboot = false;
> -llvm::sys::path::system_temp_directory(erased_on_reboot,
> DefaultModuleCache);
> -llvm::sys::path::append(DefaultModuleCache, "org.llvm.clang");
> -llvm::sys::path::append(DefaultModuleCache, "ModuleCache");
> -std::string module_cache_argument("-fmodules-cache-path=");
> -module_cache_argument.append(DefaultModuleCache.str().str());
> -compiler_invocation_arguments.push_back(module_cache_argument);
> -}
> -
> +
>  FileSpecList &module_search_paths =
> target.GetClangModuleSearchPaths();
>
>  for (size_t spi = 0, spe = module_search_paths.GetSize(); spi < spe;
> ++spi)
>
> Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp?rev=251340&r1=251339&r2=251340&view=diff
>
> ==
> --- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp (original)
> +++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp Mon Oct
> 26 15:33:24 2015
> @@ -35,6 +35,10 @@
>  #include "lldb/Target/Target.h"
>  #include "llvm/ADT/STLExtras.h"
>
> +#include "llvm/ADT/StringExtras.h"
> +#include "llvm/ADT/SmallString.h"
> +#include "llvm/Support/Path.h"
> +
>  using namespace lldb;
>  using namespace lldb_private;
>
> @@ -1476,6 +1480,17 @@ PlatformDarwin::AddClangModuleCompilatio
> apple_arguments.begin(),
> apple_arguments.end());
>
> +{
> +llvm::SmallString<128> DefaultModuleCache;
> +const bool erased_on_reboot = false;
> +llvm::sys::path::system_temp_directory(erased_on_reboot,
> DefaultModuleCache);
> +llvm::sys::path::append(DefaultModuleCache, "org.llvm.clang");
> +llvm::sys::path::append(DefaultModuleCache, "ModuleCache");
> +std::string module_cache_argument("-fmodules-cache-path=");
> +module_cache_argument.append(DefaultModuleCache.str().str());
> +options.push_back(module_cache_argument);
> +}
> +
>  StreamString minimum_version_option;
>  uint32_t versions[3] = { 0, 0, 0 };
>  bool use_current_os_version = false;
>
> Modified: lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp?rev=251340&r1=251339&r2=251340&view=diff
>
> ==
> --- lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp (original)
> +++ lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp Mon Oct 26
> 15:33:24 2015
> @@ -27,6 +27,10 @@
>  #include "lldb/Target/Process.h"
>  #include "lldb/Target/ProcessLaunchInfo.h"
>
> +#include "llvm/ADT/StringExtras.h"
> +#include "llvm/ADT/SmallString.h"
> +#include "llvm/Support/Path.h"
> +
>  using namespace lldb;
>  using namespace lldb_private;
>
> @@ -848,4 +852,64 @@ void
>  PlatformPOSIX::CalculateTrapHandlerSymbolNames ()
>  {
>  m_trap_handlers.push_back (ConstString ("_sigtramp"));
> -}
> +}
> +
> +static bool 

[Lldb-commits] [lldb] r251368 - Change TestTypeCompletion to not rely on std::string

2015-10-26 Thread Enrico Granata via lldb-commits
Author: enrico
Date: Mon Oct 26 18:39:12 2015
New Revision: 251368

URL: http://llvm.org/viewvc/llvm-project?rev=251368&view=rev
Log:
Change TestTypeCompletion to not rely on std::string

On some combination of platform and c++ library, this dependency was causing 
the test to fail for reasons tangential to its real objective


Modified:
lldb/trunk/test/functionalities/type_completion/TestTypeCompletion.py
lldb/trunk/test/functionalities/type_completion/main.cpp

Modified: lldb/trunk/test/functionalities/type_completion/TestTypeCompletion.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/type_completion/TestTypeCompletion.py?rev=251368&r1=251367&r2=251368&view=diff
==
--- lldb/trunk/test/functionalities/type_completion/TestTypeCompletion.py 
(original)
+++ lldb/trunk/test/functionalities/type_completion/TestTypeCompletion.py Mon 
Oct 26 18:39:12 2015
@@ -73,14 +73,10 @@ class TypeCompletionTestCase(TestBase):
 self.assertTrue(name_address_type.IsValid(), 'NameAndAddress should be 
valid')
 self.assertTrue(name_address_type.IsTypeComplete(), 'NameAndAddress 
should now be complete')
 field0 = name_address_type.GetFieldAtIndex(0)
-if self.TraceOn():
- print('field0: ' + str(field0))
 self.assertTrue(field0.IsValid(), 'NameAndAddress::m_name should be 
valid')
 string = field0.GetType().GetPointeeType()
-if self.TraceOn():
- print('string: ' + str(string))
-self.assertTrue(string.IsValid(), 'std::string should be valid')
-self.assertFalse(string.IsTypeComplete(), 'std::string complete but it 
should not be')
+self.assertTrue(string.IsValid(), 'CustomString should be valid')
+self.assertFalse(string.IsTypeComplete(), 'CustomString complete but 
it should not be')
 
 self.runCmd("continue")
 
@@ -91,17 +87,13 @@ class TypeCompletionTestCase(TestBase):
 self.assertTrue(name_address_type.IsValid(), 'NameAndAddress should be 
valid')
 self.assertTrue(name_address_type.IsTypeComplete(), 'NameAndAddress 
should now be complete')
 field0 = name_address_type.GetFieldAtIndex(0)
-if self.TraceOn():
- print('field0: ' + str(field0))
 self.assertTrue(field0.IsValid(), 'NameAndAddress::m_name should be 
valid')
 string = field0.GetType().GetPointeeType()
-if self.TraceOn():
- print('string: ' + str(string))
-self.assertTrue(string.IsValid(), 'std::string should be valid')
-self.assertFalse(string.IsTypeComplete(), 'std::string complete but it 
should not be')
+self.assertTrue(string.IsValid(), 'CustomString should be valid')
+self.assertFalse(string.IsTypeComplete(), 'CustomString complete but 
it should not be')
 
 self.runCmd('type category enable -l c++', check=False)
-self.runCmd('frame variable guy --show-types')
+self.runCmd('frame variable guy --show-types --ptr-depth=1')
 
 p_vector = 
self.dbg.GetSelectedTarget().GetProcess().GetSelectedThread().GetSelectedFrame().FindVariable('p')
 p_type = p_vector.GetType()
@@ -112,5 +104,5 @@ class TypeCompletionTestCase(TestBase):
 field0 = name_address_type.GetFieldAtIndex(0)
 self.assertTrue(field0.IsValid(), 'NameAndAddress::m_name should be 
valid')
 string = field0.GetType().GetPointeeType()
-self.assertTrue(string.IsValid(), 'std::string should be valid')
-self.assertTrue(string.IsTypeComplete(), 'std::string should now be 
complete')
+self.assertTrue(string.IsValid(), 'CustomString should be valid')
+self.assertTrue(string.IsTypeComplete(), 'CustomString should now be 
complete')

Modified: lldb/trunk/test/functionalities/type_completion/main.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/type_completion/main.cpp?rev=251368&r1=251367&r2=251368&view=diff
==
--- lldb/trunk/test/functionalities/type_completion/main.cpp (original)
+++ lldb/trunk/test/functionalities/type_completion/main.cpp Mon Oct 26 
18:39:12 2015
@@ -7,16 +7,45 @@
 //
 
//===--===//
 
-#include 
+#include 
 #include 
 #include 
 
+class CustomString
+{
+public:
+  CustomString (const char* buffer) :
+m_buffer(nullptr)
+  {
+if (buffer)
+{
+  auto l = strlen(buffer);
+  m_buffer = new char[1 + l];
+  strcpy(m_buffer, buffer);
+}
+  }
+  
+  ~CustomString ()
+  {
+delete[] m_buffer;
+  }
+  
+  const char*
+  GetBuffer ()
+  {
+return m_buffer;
+  }
+  
+private:
+  char *m_buffer;
+};
+
 class NameAndAddress
{
public:
-   std::string& GetName() { return *m_name; }
-   std::string& GetAddress() { return *m_address; }
-  

Re: [Lldb-commits] [PATCH] D14085: Add Socket::Create factory method which uses socket scheme (tcp, unix, ..) to find an appropriate implementation class.

2015-10-26 Thread Oleksiy Vyalov via lldb-commits
ovyalov retitled this revision from "Make Socket to support plugin interface" 
to "Add Socket::Create factory method which uses socket scheme (tcp, unix,..) 
to find an appropriate implementation class.".
ovyalov updated the summary for this revision.
ovyalov updated this revision to Diff 38484.

http://reviews.llvm.org/D14085

Files:
  include/lldb/Host/Socket.h
  include/lldb/Host/common/TCPSocket.h
  include/lldb/Host/common/UDPSocket.h
  include/lldb/Host/linux/AbstractSocket.h
  include/lldb/Host/posix/DomainSocket.h
  source/Host/common/Socket.cpp
  source/Host/common/TCPSocket.cpp
  source/Host/common/UDPSocket.cpp
  source/Host/linux/AbstractSocket.cpp
  source/Host/posix/DomainSocket.cpp
  tools/lldb-server/Acceptor.cpp

Index: tools/lldb-server/Acceptor.cpp
===
--- tools/lldb-server/Acceptor.cpp
+++ tools/lldb-server/Acceptor.cpp
@@ -14,7 +14,8 @@
 #include "lldb/Core/StreamString.h"
 #include "lldb/Host/ConnectionFileDescriptor.h"
 #include "lldb/Host/common/TCPSocket.h"
-#include "lldb/Host/posix/DomainSocket.h"
+
+#include "Utility/UriParser.h"
 
 using namespace lldb;
 using namespace lldb_private;
@@ -58,32 +59,51 @@
 {
 error.Clear();
 
-LocalSocketIdFunc local_socket_id;
-std::unique_ptr listener_socket = nullptr;
-std::string host_str;
-std::string port_str;
-int32_t port = INT32_MIN;
-if (Socket::DecodeHostAndPort (name, host_str, port_str, port, &error))
+std::unique_ptr listener_socket_up = nullptr;
+
+
+int port;
+std::string scheme, host, path;
+// Try to match socket name as URL - e.g., tcp://localhost:
+if (UriParser::Parse(name.str(), scheme, host, port, path))
 {
-auto tcp_socket = new TCPSocket(child_processes_inherit, error);
-local_socket_id = [tcp_socket]() {
-auto local_port = tcp_socket->GetLocalPortNumber();
-return (local_port != 0) ? std::to_string(local_port) : "";
-};
-listener_socket.reset(tcp_socket);
+listener_socket_up = Socket::Create(scheme.c_str(), child_processes_inherit, error);
+name = name.drop_front(scheme.size() + strlen("://"));
 }
 else
 {
-const std::string socket_name = name;
-local_socket_id = [socket_name](){
-return socket_name;
-};
-listener_socket.reset(new DomainSocket(child_processes_inherit, error));
+std::string host_str;
+std::string port_str;
+int32_t port = INT32_MIN;
+// Try to match socket name as $host:port - e.g., localhost:
+if (Socket::DecodeHostAndPort (name, host_str, port_str, port, &error))
+listener_socket_up = Socket::Create(Socket::TCP, child_processes_inherit, error);
+else
+listener_socket_up = Socket::Create(Socket::UNIX, child_processes_inherit, error);
 }
 
+LocalSocketIdFunc local_socket_id;
 if (error.Success())
+{
+if (listener_socket_up->GetSocketProtocol() == Socket::ProtocolTcp)
+{
+TCPSocket* tcp_socket = static_cast(listener_socket_up.get());
+local_socket_id = [tcp_socket]() {
+auto local_port = tcp_socket->GetLocalPortNumber();
+return (local_port != 0) ? std::to_string(local_port) : "";
+};
+}
+else
+{
+const std::string socket_name = name;
+local_socket_id = [socket_name](){
+return socket_name;
+};
+}
+
 return std::unique_ptr(
-new Acceptor(std::move(listener_socket), name, local_socket_id));
+new Acceptor(std::move(listener_socket_up), name, local_socket_id));
+}
 
 return std::unique_ptr();
 }
Index: source/Host/posix/DomainSocket.cpp
===
--- source/Host/posix/DomainSocket.cpp
+++ source/Host/posix/DomainSocket.cpp
@@ -115,3 +115,9 @@
 {
 FileSystem::Unlink(FileSpec{name, true});
 }
+
+const char *
+DomainSocket::GetScheme() const
+{
+return UNIX;
+}
Index: source/Host/linux/AbstractSocket.cpp
===
--- source/Host/linux/AbstractSocket.cpp
+++ source/Host/linux/AbstractSocket.cpp
@@ -29,3 +29,9 @@
 AbstractSocket::DeleteSocketFile(llvm::StringRef name)
 {
 }
+
+const char *
+AbstractSocket::GetScheme() const
+{
+return UNIX_ABSTRACT;
+}
Index: source/Host/common/UDPSocket.cpp
===
--- source/Host/common/UDPSocket.cpp
+++ source/Host/common/UDPSocket.cpp
@@ -156,3 +156,9 @@
 error.Clear();
 return error;
 }
+
+const char *
+UDPSocket::GetScheme() const
+{
+return UDP;
+}
Index: source/Host/common/TCPSocket.cpp
===
--- source/Host/common/TCPSocket.cpp
+++ source/Host/common/TCPSocket.cpp
@@ -286,3 +2

Re: [Lldb-commits] [PATCH] D14085: Add Socket::Create factory method which uses socket scheme (tcp, unix, ..) to find an appropriate implementation class.

2015-10-26 Thread Zachary Turner via lldb-commits
zturner added a comment.

Do we need this `GetScheme()` method?  And instead of having `Create` take a 
string, couldn't it just take a `SocketProtocol` instead?  It seems like the 
logic of converting the string to the enum should be done in the `Acceptor` 
class, as this URI format is defined by the acceptor, and the socket itself is 
just a low-level host layer abstraction.


http://reviews.llvm.org/D14085



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


[Lldb-commits] [lldb] r251374 - Fix Clang-tidy modernize-use-override warnings in source/Plugins/LanguageRuntime and Platform; other minor fixes.

2015-10-26 Thread Eugene Zelenko via lldb-commits
Author: eugenezelenko
Date: Mon Oct 26 19:45:06 2015
New Revision: 251374

URL: http://llvm.org/viewvc/llvm-project?rev=251374&view=rev
Log:
Fix Clang-tidy modernize-use-override warnings in 
source/Plugins/LanguageRuntime and Platform; other minor fixes.

Modified:

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

lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h
lldb/trunk/source/Plugins/Platform/Android/PlatformAndroid.h
lldb/trunk/source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.h
lldb/trunk/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h
lldb/trunk/source/Plugins/Platform/Kalimba/PlatformKalimba.h
lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.cpp
lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.h
lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.h
lldb/trunk/source/Plugins/Platform/MacOSX/PlatformMacOSX.h
lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.h
lldb/trunk/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.h
lldb/trunk/source/Plugins/Platform/NetBSD/PlatformNetBSD.h
lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.h
lldb/trunk/source/Plugins/Platform/Windows/PlatformWindows.cpp
lldb/trunk/source/Plugins/Platform/Windows/PlatformWindows.h

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=251374&r1=251373&r2=251374&view=diff
==
--- 
lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
 (original)
+++ 
lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
 Mon Oct 26 19:45:06 2015
@@ -7,6 +7,10 @@
 //
 
//===--===//
 
+// C Includes
+// C++ Includes
+// Other libraries and framework includes
+// Project includes
 #include "RenderScriptRuntime.h"
 
 #include "lldb/Core/ConstString.h"
@@ -43,7 +47,7 @@ namespace {
 template 
 class empirical_type
 {
-  public:
+public:
 // Ctor. Contents is invalid when constructed.
 empirical_type()
 : valid(false)
@@ -97,17 +101,17 @@ class empirical_type
 return data;
 }
 
-  protected:
+protected:
 bool valid;
 type_t data;
 };
 
-} // namespace {}
+} // anonymous namespace
 
 // The ScriptDetails class collects data associated with a single script 
instance.
 struct RenderScriptRuntime::ScriptDetails
 {
-~ScriptDetails() {};
+~ScriptDetails() = default;
 
 enum ScriptType
 {
@@ -226,7 +230,6 @@ struct RenderScriptRuntime::AllocationDe
 AllocationDetails(): id(ID++)
 {
 }
-
 };
 
 unsigned int RenderScriptRuntime::AllocationDetails::ID = 1;
@@ -401,7 +404,6 @@ RenderScriptRuntime::IsRenderScriptModul
 return GetModuleKind(module_sp) != eModuleKindIgnored;
 }
 
-
 void 
 RenderScriptRuntime::ModulesDidLoad(const ModuleList &module_list )
 {
@@ -418,7 +420,6 @@ RenderScriptRuntime::ModulesDidLoad(cons
 }
 }
 
-
 //--
 // PluginInterface protocol
 //--
@@ -468,7 +469,6 @@ RenderScriptRuntime::CreateExceptionReso
 return resolver_sp;
 }
 
-
 const RenderScriptRuntime::HookDefn RenderScriptRuntime::s_runtimeHookDefns[] =
 {
 //rsdScript
@@ -531,8 +531,8 @@ const RenderScriptRuntime::HookDefn Rend
 nullptr // handler
 },
 };
-const size_t RenderScriptRuntime::s_runtimeHookCount = 
sizeof(s_runtimeHookDefns)/sizeof(s_runtimeHookDefns[0]);
 
+const size_t RenderScriptRuntime::s_runtimeHookCount = 
sizeof(s_runtimeHookDefns)/sizeof(s_runtimeHookDefns[0]);
 
 bool
 RenderScriptRuntime::HookCallback(void *baton, StoppointCallbackContext *ctx, 
lldb::user_id_t break_id, lldb::user_id_t break_loc_id)
@@ -547,7 +547,6 @@ RenderScriptRuntime::HookCallback(void *
 return false;
 }
 
-
 void 
 RenderScriptRuntime::HookCallback(RuntimeHook* hook_info, ExecutionContext& 
context)
 {
@@ -562,7 +561,6 @@ RenderScriptRuntime::HookCallback(Runtim
 }
 }
 
-
 bool
 RenderScriptRuntime::GetArgSimple(ExecutionContext &context, uint32_t arg, 
uint64_t *data)
 {
@@ -714,7 +712,6 @@ RenderScriptRuntime::GetArgSimple(Execut
 }
 }
 
-
 return success;
 }
 
@@ -868,7 +865,6 @@ RenderScriptRuntime::CaptureScriptInit1(
 {
 log->Printf ("RenderScriptRuntime::CaptureScriptInit1 - resource name 
invalid, Script not tagged");
 }
-
 }
 
 void
@@ -1810,7 +1806,6 @@ RenderScriptRuntime::Update()
 }
 }
 
-
 // The maximum line length of an .rs.info packet
 #define MAXLINE 500
 
@@ -2453,8 +2448,6

[Lldb-commits] [lldb] r251376 - Add calls to the SB API to access the multi-language formatter category feature

2015-10-26 Thread Enrico Granata via lldb-commits
Author: enrico
Date: Mon Oct 26 20:10:35 2015
New Revision: 251376

URL: http://llvm.org/viewvc/llvm-project?rev=251376&view=rev
Log:
Add calls to the SB API to access the multi-language formatter category feature

Modified:
lldb/trunk/include/lldb/API/SBTypeCategory.h
lldb/trunk/scripts/interface/SBTypeCategory.i
lldb/trunk/source/API/SBTypeCategory.cpp

Modified: lldb/trunk/include/lldb/API/SBTypeCategory.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBTypeCategory.h?rev=251376&r1=251375&r2=251376&view=diff
==
--- lldb/trunk/include/lldb/API/SBTypeCategory.h (original)
+++ lldb/trunk/include/lldb/API/SBTypeCategory.h Mon Oct 26 20:10:35 2015
@@ -36,6 +36,15 @@ namespace lldb {
 const char*
 GetName();
 
+lldb::LanguageType
+GetLanguageAtIndex (uint32_t idx);
+
+uint32_t
+GetNumLanguages ();
+
+void
+AddLanguage (lldb::LanguageType language);
+
 bool
 GetDescription (lldb::SBStream &description, 
 lldb::DescriptionLevel description_level);

Modified: lldb/trunk/scripts/interface/SBTypeCategory.i
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/interface/SBTypeCategory.i?rev=251376&r1=251375&r2=251376&view=diff
==
--- lldb/trunk/scripts/interface/SBTypeCategory.i (original)
+++ lldb/trunk/scripts/interface/SBTypeCategory.i Mon Oct 26 20:10:35 2015
@@ -35,6 +35,15 @@ namespace lldb {
 const char*
 GetName();
 
+lldb::LanguageType
+GetLanguageAtIndex (uint32_t idx);
+
+uint32_t
+GetNumLanguages ();
+
+void
+AddLanguage (lldb::LanguageType language);
+
 bool
 GetDescription (lldb::SBStream &description, 
 lldb::DescriptionLevel description_level);

Modified: lldb/trunk/source/API/SBTypeCategory.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBTypeCategory.cpp?rev=251376&r1=251375&r2=251376&view=diff
==
--- lldb/trunk/source/API/SBTypeCategory.cpp (original)
+++ lldb/trunk/source/API/SBTypeCategory.cpp Mon Oct 26 20:10:35 2015
@@ -79,6 +79,29 @@ SBTypeCategory::GetName()
 return m_opaque_sp->GetName();
 }
 
+lldb::LanguageType
+SBTypeCategory::GetLanguageAtIndex (uint32_t idx)
+{
+if (IsValid())
+return m_opaque_sp->GetLanguageAtIndex(idx);
+return lldb::eLanguageTypeUnknown;
+}
+
+uint32_t
+SBTypeCategory::GetNumLanguages ()
+{
+if (IsValid())
+return m_opaque_sp->GetNumLanguages();
+return 0;
+}
+
+void
+SBTypeCategory::AddLanguage (lldb::LanguageType language)
+{
+if (IsValid())
+m_opaque_sp->AddLanguage(language);
+}
+
 uint32_t
 SBTypeCategory::GetNumFormats ()
 {


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


[Lldb-commits] [lldb] r251377 - Minor cleanup of SBTypeSummary::CreateWithCallback to take an optional description argument

2015-10-26 Thread Enrico Granata via lldb-commits
Author: enrico
Date: Mon Oct 26 20:17:28 2015
New Revision: 251377

URL: http://llvm.org/viewvc/llvm-project?rev=251377&view=rev
Log:
Minor cleanup of SBTypeSummary::CreateWithCallback to take an optional 
description argument

Modified:
lldb/trunk/include/lldb/API/SBTypeSummary.h
lldb/trunk/source/API/SBTypeSummary.cpp

Modified: lldb/trunk/include/lldb/API/SBTypeSummary.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBTypeSummary.h?rev=251377&r1=251376&r2=251377&view=diff
==
--- lldb/trunk/include/lldb/API/SBTypeSummary.h (original)
+++ lldb/trunk/include/lldb/API/SBTypeSummary.h Mon Oct 26 20:17:28 2015
@@ -87,7 +87,8 @@ namespace lldb {
 
 static SBTypeSummary
 CreateWithCallback (FormatCallback cb, 
-uint32_t options = 0);
+uint32_t options = 0,
+const char* description = nullptr);
 
 SBTypeSummary (const lldb::SBTypeSummary &rhs);
 

Modified: lldb/trunk/source/API/SBTypeSummary.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBTypeSummary.cpp?rev=251377&r1=251376&r2=251377&view=diff
==
--- lldb/trunk/source/API/SBTypeSummary.cpp (original)
+++ lldb/trunk/source/API/SBTypeSummary.cpp Mon Oct 26 20:17:28 2015
@@ -147,22 +147,25 @@ SBTypeSummary::CreateWithScriptCode (con
 }
 
 SBTypeSummary
-SBTypeSummary::CreateWithCallback (FormatCallback cb, uint32_t options)
+SBTypeSummary::CreateWithCallback (FormatCallback cb, uint32_t options, const 
char* description)
 {
-return SBTypeSummary(
-   TypeSummaryImplSP(
-   cb ? new CXXFunctionSummaryFormat(options,
-   [cb] (ValueObject& valobj, Stream& stm, const 
TypeSummaryOptions& opt) -> bool {
-SBStream stream;
-if (!cb(SBValue(valobj.GetSP()), 
SBTypeSummaryOptions(&opt), stream))
-return false;
-stm.Write(stream.GetData(), stream.GetSize());
-return true;
-   },
-   "SBTypeSummary formatter callback"
-   ) : nullptr
-)
-);
+SBTypeSummary retval;
+if (cb)
+{
+retval.SetSP(TypeSummaryImplSP(new CXXFunctionSummaryFormat(options,
+[cb] 
(ValueObject& valobj, Stream& stm, const TypeSummaryOptions& opt) -> bool {
+
SBStream stream;
+
SBValue sb_value(valobj.GetSP());
+
SBTypeSummaryOptions options(&opt);
+if 
(!cb(sb_value, options, stream))
+
return false;
+
stm.Write(stream.GetData(), stream.GetSize());
+return 
true;
+},
+
description ? description : "callback summary formatter")));
+}
+
+return retval;
 }
 
 SBTypeSummary::SBTypeSummary (const lldb::SBTypeSummary &rhs) :


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


Re: [Lldb-commits] [PATCH] D14085: Add Socket::Create factory method which uses socket protocol to find an appropriate implementation class.

2015-10-26 Thread Oleksiy Vyalov via lldb-commits
ovyalov retitled this revision from "Add Socket::Create factory method which 
uses socket scheme (tcp, unix,..) to find an appropriate implementation class." 
to "Add Socket::Create factory method which uses socket protocol to find an 
appropriate implementation class.".
ovyalov updated the summary for this revision.
ovyalov updated this revision to Diff 38487.
ovyalov added a comment.

Thanks for suggestions - addressed review comments.


http://reviews.llvm.org/D14085

Files:
  include/lldb/Host/Socket.h
  include/lldb/Host/common/UDPSocket.h
  source/Host/common/Socket.cpp
  tools/lldb-server/Acceptor.cpp
  tools/lldb-server/Acceptor.h

Index: tools/lldb-server/Acceptor.h
===
--- tools/lldb-server/Acceptor.h
+++ tools/lldb-server/Acceptor.h
@@ -39,11 +39,13 @@
 static std::unique_ptr
 Create(llvm::StringRef name, const bool child_processes_inherit, Error &error);
 
-Socket::SocketProtocol GetSocketProtocol() const;
+Socket::SocketProtocol
+GetSocketProtocol() const;
 
 // Returns either TCP port number as string or domain socket path.
 // Empty string is returned in case of error.
-std::string GetLocalSocketId() const;
+std::string
+GetLocalSocketId() const;
 
 private:
 typedef std::function LocalSocketIdFunc;
Index: tools/lldb-server/Acceptor.cpp
===
--- tools/lldb-server/Acceptor.cpp
+++ tools/lldb-server/Acceptor.cpp
@@ -14,13 +14,44 @@
 #include "lldb/Core/StreamString.h"
 #include "lldb/Host/ConnectionFileDescriptor.h"
 #include "lldb/Host/common/TCPSocket.h"
-#include "lldb/Host/posix/DomainSocket.h"
+
+#include "Utility/UriParser.h"
 
 using namespace lldb;
 using namespace lldb_private;
 using namespace lldb_private::lldb_server;
 using namespace llvm;
 
+namespace {
+
+struct SocketScheme
+{
+const char* m_scheme;
+const Socket::SocketProtocol m_protocol;
+};
+
+SocketScheme socket_schemes[] = {
+{"tcp", Socket::ProtocolTcp},
+{"udp", Socket::ProtocolUdp},
+{"unix", Socket::ProtocolUnixDomain},
+{"unix-abstract", Socket::ProtocolUnixAbstract},
+};
+
+bool FindProtocolByScheme(const char* scheme, Socket::SocketProtocol& protocol)
+{
+for (auto s: socket_schemes)
+{
+if (!strcmp(s.m_scheme, scheme))
+{
+protocol = s.m_protocol;
+return true;
+}
+}
+return false;
+}
+
+}
+
 Error
 Acceptor::Listen(int backlog)
 {
@@ -58,32 +89,55 @@
 {
 error.Clear();
 
-LocalSocketIdFunc local_socket_id;
-std::unique_ptr listener_socket = nullptr;
-std::string host_str;
-std::string port_str;
-int32_t port = INT32_MIN;
-if (Socket::DecodeHostAndPort (name, host_str, port_str, port, &error))
+Socket::SocketProtocol socket_protocol = Socket::ProtocolUnixDomain;
+int port;
+std::string scheme, host, path;
+// Try to match socket name as URL - e.g., tcp://localhost:
+if (UriParser::Parse(name.str(), scheme, host, port, path))
 {
-auto tcp_socket = new TCPSocket(child_processes_inherit, error);
-local_socket_id = [tcp_socket]() {
-auto local_port = tcp_socket->GetLocalPortNumber();
-return (local_port != 0) ? std::to_string(local_port) : "";
-};
-listener_socket.reset(tcp_socket);
+if (!FindProtocolByScheme(scheme.c_str(), socket_protocol))
+error.SetErrorStringWithFormat("Unknown protocol scheme \"%s\"", scheme.c_str());
+else
+name = name.drop_front(scheme.size() + strlen("://"));
 }
 else
 {
-const std::string socket_name = name;
-local_socket_id = [socket_name](){
-return socket_name;
-};
-listener_socket.reset(new DomainSocket(child_processes_inherit, error));
+std::string host_str;
+std::string port_str;
+int32_t port = INT32_MIN;
+// Try to match socket name as $host:port - e.g., localhost:
+if (Socket::DecodeHostAndPort (name, host_str, port_str, port, nullptr))
+socket_protocol = Socket::ProtocolTcp;
 }
 
+if (error.Fail())
+return std::unique_ptr();
+
+std::unique_ptr listener_socket_up = Socket::Create(
+socket_protocol, child_processes_inherit, error);
+
+LocalSocketIdFunc local_socket_id;
 if (error.Success())
+{
+if (listener_socket_up->GetSocketProtocol() == Socket::ProtocolTcp)
+{
+TCPSocket* tcp_socket = static_cast(listener_socket_up.get());
+local_socket_id = [tcp_socket]() {
+auto local_port = tcp_socket->GetLocalPortNumber();
+return (local_port != 0) ? std::to_string(local_port) : "";
+};
+}
+else
+{
+const std::string socket_name = name;
+local_socket_id = [socket_name](){
+return socket_name;
+ 

[Lldb-commits] [PATCH] D14101: Treat hostname in android URL as device id unless it matches "localhost"

2015-10-26 Thread Oleksiy Vyalov via lldb-commits
ovyalov created this revision.
ovyalov added reviewers: tberghammer, labath.
ovyalov added a subscriber: lldb-commits.
Herald added subscribers: danalbert, tberghammer.

We can connect to a device using various protocols (tcp, unix domain, abstract).
Instead of adding new URL schemes (e.g., adb-unix, adb-abstract) to cover 
alternative transport we can use standard connect URLs together with device id 
as hostname, unless it matches "localhost".
If hostname is "localhost" then we expect a single connected device.

http://reviews.llvm.org/D14101

Files:
  source/Plugins/Platform/Android/PlatformAndroid.cpp
  source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp

Index: source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp
===
--- source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp
+++ source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp
@@ -126,7 +126,7 @@
 return Error("URL is null.");
 if (!UriParser::Parse (url, scheme, host, remote_port, path))
 return Error("Invalid URL: %s", url);
-if (scheme == "adb")
+if (host != "localhost")
 m_device_id = host;
 
 std::string connect_url;
Index: source/Plugins/Platform/Android/PlatformAndroid.cpp
===
--- source/Plugins/Platform/Android/PlatformAndroid.cpp
+++ source/Plugins/Platform/Android/PlatformAndroid.cpp
@@ -196,7 +196,7 @@
 return Error("URL is null.");
 if (!UriParser::Parse(url, scheme, host, port, path))
 return Error("Invalid URL: %s", url);
-if (scheme == "adb")
+if (host != "localhost")
 m_device_id = host;
 
 auto error = PlatformLinux::ConnectRemote(args);


Index: source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp
===
--- source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp
+++ source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp
@@ -126,7 +126,7 @@
 return Error("URL is null.");
 if (!UriParser::Parse (url, scheme, host, remote_port, path))
 return Error("Invalid URL: %s", url);
-if (scheme == "adb")
+if (host != "localhost")
 m_device_id = host;
 
 std::string connect_url;
Index: source/Plugins/Platform/Android/PlatformAndroid.cpp
===
--- source/Plugins/Platform/Android/PlatformAndroid.cpp
+++ source/Plugins/Platform/Android/PlatformAndroid.cpp
@@ -196,7 +196,7 @@
 return Error("URL is null.");
 if (!UriParser::Parse(url, scheme, host, port, path))
 return Error("Invalid URL: %s", url);
-if (scheme == "adb")
+if (host != "localhost")
 m_device_id = host;
 
 auto error = PlatformLinux::ConnectRemote(args);
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r251386 - Fix for Arm watchpoint cache corruption in case of ptrace failure

2015-10-26 Thread Omair Javaid via lldb-commits
Author: omjavaid
Date: Tue Oct 27 00:56:56 2015
New Revision: 251386

URL: http://llvm.org/viewvc/llvm-project?rev=251386&view=rev
Log:
Fix for Arm watchpoint cache corruption in case of ptrace failure

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


Modified:
lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.cpp

Modified: 
lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.cpp?rev=251386&r1=251385&r2=251386&view=diff
==
--- lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.cpp 
(original)
+++ lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.cpp 
Tue Oct 27 00:56:56 2015
@@ -451,7 +451,13 @@ NativeRegisterContextLinux_arm::SetHardw
 error = WriteHardwareDebugRegs(eDREGTypeBREAK, bp_index);
 
 if (error.Fail())
+{
+m_hbr_regs[bp_index].address = 0;
+m_hbr_regs[bp_index].control &= ~1;
+m_hbr_regs[bp_index].refcount = 0;
+
 return LLDB_INVALID_INDEX32;
+}
 }
 else
 m_hbr_regs[bp_index].refcount++;
@@ -486,6 +492,11 @@ NativeRegisterContextLinux_arm::ClearHar
 }
 else if (m_hbr_regs[hw_idx].refcount == 1)
 {
+// Create a backup we can revert to in case of failure.
+lldb::addr_t tempAddr = m_hbr_regs[hw_idx].address;
+uint32_t tempControl = m_hbr_regs[hw_idx].control;
+uint32_t tempRefCount = m_hbr_regs[hw_idx].refcount;
+
 m_hbr_regs[hw_idx].control &= ~1;
 m_hbr_regs[hw_idx].address = 0;
 m_hbr_regs[hw_idx].refcount = 0;
@@ -494,7 +505,13 @@ NativeRegisterContextLinux_arm::ClearHar
 WriteHardwareDebugRegs(eDREGTypeBREAK, hw_idx);
 
 if (error.Fail())
+{
+m_hbr_regs[hw_idx].control = tempControl;
+m_hbr_regs[hw_idx].address = tempAddr;
+m_hbr_regs[hw_idx].refcount = tempRefCount;
+
 return false;
+}
 
 return true;
 }
@@ -614,7 +631,13 @@ NativeRegisterContextLinux_arm::SetHardw
 error = WriteHardwareDebugRegs(eDREGTypeWATCH, wp_index);
 
 if (error.Fail())
+{
+m_hwp_regs[wp_index].address = 0;
+m_hwp_regs[wp_index].control &= ~1;
+m_hwp_regs[wp_index].refcount = 0;
+
 return LLDB_INVALID_INDEX32;
+}
 }
 else
 m_hwp_regs[wp_index].refcount++;
@@ -649,6 +672,11 @@ NativeRegisterContextLinux_arm::ClearHar
 }
 else if (m_hwp_regs[wp_index].refcount == 1)
 {
+// Create a backup we can revert to in case of failure.
+lldb::addr_t tempAddr = m_hwp_regs[wp_index].address;
+uint32_t tempControl = m_hwp_regs[wp_index].control;
+uint32_t tempRefCount = m_hwp_regs[wp_index].refcount;
+
 // Update watchpoint in local cache
 m_hwp_regs[wp_index].control &= ~1;
 m_hwp_regs[wp_index].address = 0;
@@ -658,7 +686,13 @@ NativeRegisterContextLinux_arm::ClearHar
 error = WriteHardwareDebugRegs(eDREGTypeWATCH, wp_index);
 
 if (error.Fail())
+{
+m_hwp_regs[wp_index].control = tempControl;
+m_hwp_regs[wp_index].address = tempAddr;
+m_hwp_regs[wp_index].refcount = tempRefCount;
+
 return false;
+}
 
 return true;
 }
@@ -682,10 +716,18 @@ NativeRegisterContextLinux_arm::ClearAll
 if (error.Fail())
 return error;
 
+lldb::addr_t tempAddr = 0;
+uint32_t tempControl = 0, tempRefCount = 0;
+
 for (uint32_t i = 0; i < m_max_hwp_supported; i++)
 {
 if (m_hwp_regs[i].control & 0x01)
 {
+// Create a backup we can revert to in case of failure.
+tempAddr = m_hwp_regs[i].address;
+tempControl = m_hwp_regs[i].control;
+tempRefCount = m_hwp_regs[i].refcount;
+
 // Clear watchpoints in local cache
 m_hwp_regs[i].control &= ~1;
 m_hwp_regs[i].address = 0;
@@ -695,7 +737,13 @@ NativeRegisterContextLinux_arm::ClearAll
 error = WriteHardwareDebugRegs(eDREGTypeWATCH, i);
 
 if (error.Fail())
+{
+m_hwp_regs[i].control = tempControl;
+m_hwp_regs[i].address = tempAddr;
+m_hwp_regs[i].refcount = tempRefCount;
+
 return error;
+}
 }
 }
 


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


Re: [Lldb-commits] [PATCH] D14051: Fix for Arm watchpoint cache corruption in case of ptrace failure

2015-10-26 Thread Muhammad Omair Javaid via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL251386: Fix for Arm watchpoint cache corruption in case of 
ptrace failure (authored by omjavaid).

Changed prior to commit:
  http://reviews.llvm.org/D14051?vs=38364&id=38502#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D14051

Files:
  lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.cpp

Index: lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.cpp
===
--- lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.cpp
+++ lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.cpp
@@ -451,7 +451,13 @@
 error = WriteHardwareDebugRegs(eDREGTypeBREAK, bp_index);
 
 if (error.Fail())
+{
+m_hbr_regs[bp_index].address = 0;
+m_hbr_regs[bp_index].control &= ~1;
+m_hbr_regs[bp_index].refcount = 0;
+
 return LLDB_INVALID_INDEX32;
+}
 }
 else
 m_hbr_regs[bp_index].refcount++;
@@ -486,15 +492,26 @@
 }
 else if (m_hbr_regs[hw_idx].refcount == 1)
 {
+// Create a backup we can revert to in case of failure.
+lldb::addr_t tempAddr = m_hbr_regs[hw_idx].address;
+uint32_t tempControl = m_hbr_regs[hw_idx].control;
+uint32_t tempRefCount = m_hbr_regs[hw_idx].refcount;
+
 m_hbr_regs[hw_idx].control &= ~1;
 m_hbr_regs[hw_idx].address = 0;
 m_hbr_regs[hw_idx].refcount = 0;
 
 // PTRACE call to clear corresponding hardware breakpoint register.
 WriteHardwareDebugRegs(eDREGTypeBREAK, hw_idx);
 
 if (error.Fail())
+{
+m_hbr_regs[hw_idx].control = tempControl;
+m_hbr_regs[hw_idx].address = tempAddr;
+m_hbr_regs[hw_idx].refcount = tempRefCount;
+
 return false;
+}
 
 return true;
 }
@@ -614,7 +631,13 @@
 error = WriteHardwareDebugRegs(eDREGTypeWATCH, wp_index);
 
 if (error.Fail())
+{
+m_hwp_regs[wp_index].address = 0;
+m_hwp_regs[wp_index].control &= ~1;
+m_hwp_regs[wp_index].refcount = 0;
+
 return LLDB_INVALID_INDEX32;
+}
 }
 else
 m_hwp_regs[wp_index].refcount++;
@@ -649,6 +672,11 @@
 }
 else if (m_hwp_regs[wp_index].refcount == 1)
 {
+// Create a backup we can revert to in case of failure.
+lldb::addr_t tempAddr = m_hwp_regs[wp_index].address;
+uint32_t tempControl = m_hwp_regs[wp_index].control;
+uint32_t tempRefCount = m_hwp_regs[wp_index].refcount;
+
 // Update watchpoint in local cache
 m_hwp_regs[wp_index].control &= ~1;
 m_hwp_regs[wp_index].address = 0;
@@ -658,7 +686,13 @@
 error = WriteHardwareDebugRegs(eDREGTypeWATCH, wp_index);
 
 if (error.Fail())
+{
+m_hwp_regs[wp_index].control = tempControl;
+m_hwp_regs[wp_index].address = tempAddr;
+m_hwp_regs[wp_index].refcount = tempRefCount;
+
 return false;
+}
 
 return true;
 }
@@ -682,10 +716,18 @@
 if (error.Fail())
 return error;
 
+lldb::addr_t tempAddr = 0;
+uint32_t tempControl = 0, tempRefCount = 0;
+
 for (uint32_t i = 0; i < m_max_hwp_supported; i++)
 {
 if (m_hwp_regs[i].control & 0x01)
 {
+// Create a backup we can revert to in case of failure.
+tempAddr = m_hwp_regs[i].address;
+tempControl = m_hwp_regs[i].control;
+tempRefCount = m_hwp_regs[i].refcount;
+
 // Clear watchpoints in local cache
 m_hwp_regs[i].control &= ~1;
 m_hwp_regs[i].address = 0;
@@ -695,7 +737,13 @@
 error = WriteHardwareDebugRegs(eDREGTypeWATCH, i);
 
 if (error.Fail())
+{
+m_hwp_regs[i].control = tempControl;
+m_hwp_regs[i].address = tempAddr;
+m_hwp_regs[i].refcount = tempRefCount;
+
 return error;
+}
 }
 }
 
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits