[Lldb-commits] [lldb] r345155 - [lldb] Remove enableThreadSanitizer from shared Xcode schemes
Author: kuba.brecka Date: Wed Oct 24 08:59:31 2018 New Revision: 345155 URL: http://llvm.org/viewvc/llvm-project?rev=345155&view=rev Log: [lldb] Remove enableThreadSanitizer from shared Xcode schemes This was probably committed accidentally and default Xcode builds of LLDB now have TSan on. Let's turn it off. Modified: lldb/trunk/lldb.xcodeproj/xcshareddata/xcschemes/LLDB.xcscheme lldb/trunk/lldb.xcodeproj/xcshareddata/xcschemes/darwin-debug.xcscheme Modified: lldb/trunk/lldb.xcodeproj/xcshareddata/xcschemes/LLDB.xcscheme URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/xcshareddata/xcschemes/LLDB.xcscheme?rev=345155&r1=345154&r2=345155&view=diff == --- lldb/trunk/lldb.xcodeproj/xcshareddata/xcschemes/LLDB.xcscheme (original) +++ lldb/trunk/lldb.xcodeproj/xcshareddata/xcschemes/LLDB.xcscheme Wed Oct 24 08:59:31 2018 @@ -54,7 +54,6 @@ selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" displayScaleIsEnabled = "NO" displayScale = "1.00" - enableThreadSanitizer = "YES" launchStyle = "0" useCustomWorkingDirectory = "NO" ignoresPersistentStateOnLaunch = "NO" Modified: lldb/trunk/lldb.xcodeproj/xcshareddata/xcschemes/darwin-debug.xcscheme URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/xcshareddata/xcschemes/darwin-debug.xcscheme?rev=345155&r1=345154&r2=345155&view=diff == --- lldb/trunk/lldb.xcodeproj/xcshareddata/xcschemes/darwin-debug.xcscheme (original) +++ lldb/trunk/lldb.xcodeproj/xcshareddata/xcschemes/darwin-debug.xcscheme Wed Oct 24 08:59:31 2018 @@ -45,7 +45,6 @@ selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" displayScaleIsEnabled = "NO" displayScale = "1.00" - enableThreadSanitizer = "YES" launchStyle = "0" useCustomWorkingDirectory = "NO" ignoresPersistentStateOnLaunch = "NO" ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r345678 - [lldb] Introduce StackFrameRecognizer
Author: kuba.brecka Date: Tue Oct 30 17:21:03 2018 New Revision: 345678 URL: http://llvm.org/viewvc/llvm-project?rev=345678&view=rev Log: [lldb] Introduce StackFrameRecognizer This patch introduces a concept of "frame recognizer" and "recognized frame". This should be an extensible mechanism that retrieves information about special frames based on ABI, arguments or other special properties of that frame, even without source code. A few examples where that could be useful could be 1) objc_exception_throw, where we'd like to get the current exception, 2) terminate_with_reason and extracting the current terminate string, 3) recognizing Objective-C frames and automatically extracting the receiver+selector, or perhaps all arguments (based on selector). Differential Revision: https://reviews.llvm.org/D44603 Added: lldb/trunk/include/lldb/Target/StackFrameRecognizer.h lldb/trunk/packages/Python/lldbsuite/test/functionalities/frame-recognizer/ lldb/trunk/packages/Python/lldbsuite/test/functionalities/frame-recognizer/Makefile lldb/trunk/packages/Python/lldbsuite/test/functionalities/frame-recognizer/TestFrameRecognizer.py lldb/trunk/packages/Python/lldbsuite/test/functionalities/frame-recognizer/main.m lldb/trunk/packages/Python/lldbsuite/test/functionalities/frame-recognizer/recognizer.py lldb/trunk/source/Target/StackFrameRecognizer.cpp Modified: lldb/trunk/include/lldb/API/SBVariablesOptions.h lldb/trunk/include/lldb/Interpreter/OptionGroupVariable.h lldb/trunk/include/lldb/Interpreter/ScriptInterpreter.h lldb/trunk/include/lldb/Target/StackFrame.h lldb/trunk/include/lldb/lldb-forward.h lldb/trunk/lldb.xcodeproj/project.pbxproj lldb/trunk/scripts/Python/python-wrapper.swig lldb/trunk/scripts/interface/SBVariablesOptions.i lldb/trunk/source/API/SBFrame.cpp lldb/trunk/source/API/SBVariablesOptions.cpp lldb/trunk/source/API/SystemInitializerFull.cpp lldb/trunk/source/Commands/CommandObjectFrame.cpp lldb/trunk/source/Interpreter/OptionGroupVariable.cpp lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h lldb/trunk/source/Target/CMakeLists.txt lldb/trunk/source/Target/StackFrame.cpp lldb/trunk/www/python-reference.html Modified: lldb/trunk/include/lldb/API/SBVariablesOptions.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBVariablesOptions.h?rev=345678&r1=345677&r2=345678&view=diff == --- lldb/trunk/include/lldb/API/SBVariablesOptions.h (original) +++ lldb/trunk/include/lldb/API/SBVariablesOptions.h Tue Oct 30 17:21:03 2018 @@ -33,6 +33,10 @@ public: void SetIncludeArguments(bool); + bool GetIncludeRecognizedArguments() const; + + void SetIncludeRecognizedArguments(bool); + bool GetIncludeLocals() const; void SetIncludeLocals(bool); Modified: lldb/trunk/include/lldb/Interpreter/OptionGroupVariable.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionGroupVariable.h?rev=345678&r1=345677&r2=345678&view=diff == --- lldb/trunk/include/lldb/Interpreter/OptionGroupVariable.h (original) +++ lldb/trunk/include/lldb/Interpreter/OptionGroupVariable.h Tue Oct 30 17:21:03 2018 @@ -39,6 +39,8 @@ public: bool include_frame_options : 1, show_args : 1,// Frame option only (include_frame_options == true) + show_recognized_args : 1, // Frame option only (include_frame_options == + // true) show_locals : 1, // Frame option only (include_frame_options == true) show_globals : 1, // Frame option only (include_frame_options == true) use_regex : 1, show_scope : 1, show_decl : 1; Modified: lldb/trunk/include/lldb/Interpreter/ScriptInterpreter.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/ScriptInterpreter.h?rev=345678&r1=345677&r2=345678&view=diff == --- lldb/trunk/include/lldb/Interpreter/ScriptInterpreter.h (original) +++ lldb/trunk/include/lldb/Interpreter/ScriptInterpreter.h Tue Oct 30 17:21:03 2018 @@ -174,6 +174,17 @@ public: } virtual StructuredData::GenericSP + CreateFrameRecognizer(const char *class_name) { +return StructuredData::GenericSP(); + } + + virtual lldb::ValueObjectListSP GetRecognizedArguments( + const StructuredData::ObjectSP &implementor, + lldb::StackFrameSP frame_sp) { +return lldb::ValueObjectListSP(); + } + + virtual StructuredData::GenericSP OSPlugin_CreatePluginObject(const char *class_name, lldb::ProcessSP process_sp) { return StructuredData::GenericSP(); Modified: lldb/trunk/include/lldb/Target/StackFrame.h URL:
[Lldb-commits] [lldb] r345680 - Revert r345678 (build failure on Linux machines).
Author: kuba.brecka Date: Tue Oct 30 17:29:17 2018 New Revision: 345680 URL: http://llvm.org/viewvc/llvm-project?rev=345680&view=rev Log: Revert r345678 (build failure on Linux machines). Modified: lldb/trunk/include/lldb/API/SBVariablesOptions.h lldb/trunk/include/lldb/Interpreter/OptionGroupVariable.h lldb/trunk/include/lldb/Interpreter/ScriptInterpreter.h lldb/trunk/include/lldb/Target/StackFrame.h lldb/trunk/include/lldb/Target/StackFrameRecognizer.h lldb/trunk/include/lldb/lldb-forward.h lldb/trunk/lldb.xcodeproj/project.pbxproj lldb/trunk/packages/Python/lldbsuite/test/functionalities/frame-recognizer/Makefile lldb/trunk/packages/Python/lldbsuite/test/functionalities/frame-recognizer/TestFrameRecognizer.py lldb/trunk/packages/Python/lldbsuite/test/functionalities/frame-recognizer/main.m lldb/trunk/packages/Python/lldbsuite/test/functionalities/frame-recognizer/recognizer.py lldb/trunk/scripts/Python/python-wrapper.swig lldb/trunk/scripts/interface/SBVariablesOptions.i lldb/trunk/source/API/SBFrame.cpp lldb/trunk/source/API/SBVariablesOptions.cpp lldb/trunk/source/API/SystemInitializerFull.cpp lldb/trunk/source/Commands/CommandObjectFrame.cpp lldb/trunk/source/Interpreter/OptionGroupVariable.cpp lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h lldb/trunk/source/Target/CMakeLists.txt lldb/trunk/source/Target/StackFrame.cpp lldb/trunk/source/Target/StackFrameRecognizer.cpp lldb/trunk/www/python-reference.html Modified: lldb/trunk/include/lldb/API/SBVariablesOptions.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBVariablesOptions.h?rev=345680&r1=345679&r2=345680&view=diff == --- lldb/trunk/include/lldb/API/SBVariablesOptions.h (original) +++ lldb/trunk/include/lldb/API/SBVariablesOptions.h Tue Oct 30 17:29:17 2018 @@ -33,10 +33,6 @@ public: void SetIncludeArguments(bool); - bool GetIncludeRecognizedArguments() const; - - void SetIncludeRecognizedArguments(bool); - bool GetIncludeLocals() const; void SetIncludeLocals(bool); Modified: lldb/trunk/include/lldb/Interpreter/OptionGroupVariable.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionGroupVariable.h?rev=345680&r1=345679&r2=345680&view=diff == --- lldb/trunk/include/lldb/Interpreter/OptionGroupVariable.h (original) +++ lldb/trunk/include/lldb/Interpreter/OptionGroupVariable.h Tue Oct 30 17:29:17 2018 @@ -39,8 +39,6 @@ public: bool include_frame_options : 1, show_args : 1,// Frame option only (include_frame_options == true) - show_recognized_args : 1, // Frame option only (include_frame_options == - // true) show_locals : 1, // Frame option only (include_frame_options == true) show_globals : 1, // Frame option only (include_frame_options == true) use_regex : 1, show_scope : 1, show_decl : 1; Modified: lldb/trunk/include/lldb/Interpreter/ScriptInterpreter.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/ScriptInterpreter.h?rev=345680&r1=345679&r2=345680&view=diff == --- lldb/trunk/include/lldb/Interpreter/ScriptInterpreter.h (original) +++ lldb/trunk/include/lldb/Interpreter/ScriptInterpreter.h Tue Oct 30 17:29:17 2018 @@ -174,17 +174,6 @@ public: } virtual StructuredData::GenericSP - CreateFrameRecognizer(const char *class_name) { -return StructuredData::GenericSP(); - } - - virtual lldb::ValueObjectListSP GetRecognizedArguments( - const StructuredData::ObjectSP &implementor, - lldb::StackFrameSP frame_sp) { -return lldb::ValueObjectListSP(); - } - - virtual StructuredData::GenericSP OSPlugin_CreatePluginObject(const char *class_name, lldb::ProcessSP process_sp) { return StructuredData::GenericSP(); Modified: lldb/trunk/include/lldb/Target/StackFrame.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/StackFrame.h?rev=345680&r1=345679&r2=345680&view=diff == --- lldb/trunk/include/lldb/Target/StackFrame.h (original) +++ lldb/trunk/include/lldb/Target/StackFrame.h Tue Oct 30 17:29:17 2018 @@ -544,8 +544,6 @@ public: void CalculateExecutionContext(ExecutionContext &exe_ctx) override; - lldb::RecognizedStackFrameSP GetRecognizedFrame(); - protected: friend class StackFrameList; @@ -580,7 +578,6 @@ private: ValueObjectList m_variable_list_value_objects; // Value objects for each // variable in
[Lldb-commits] [lldb] r345686 - [lldb] Introduce StackFrameRecognizer [take 2]
Author: kuba.brecka Date: Tue Oct 30 17:36:20 2018 New Revision: 345686 URL: http://llvm.org/viewvc/llvm-project?rev=345686&view=rev Log: [lldb] Introduce StackFrameRecognizer [take 2] This patch introduces a concept of "frame recognizer" and "recognized frame". This should be an extensible mechanism that retrieves information about special frames based on ABI, arguments or other special properties of that frame, even without source code. A few examples where that could be useful could be 1) objc_exception_throw, where we'd like to get the current exception, 2) terminate_with_reason and extracting the current terminate string, 3) recognizing Objective-C frames and automatically extracting the receiver+selector, or perhaps all arguments (based on selector). Differential Revision: https://reviews.llvm.org/D44603 Modified: lldb/trunk/include/lldb/API/SBVariablesOptions.h lldb/trunk/include/lldb/Interpreter/OptionGroupVariable.h lldb/trunk/include/lldb/Interpreter/ScriptInterpreter.h lldb/trunk/include/lldb/Target/StackFrame.h lldb/trunk/include/lldb/Target/StackFrameRecognizer.h lldb/trunk/include/lldb/lldb-forward.h lldb/trunk/lldb.xcodeproj/project.pbxproj lldb/trunk/packages/Python/lldbsuite/test/functionalities/frame-recognizer/Makefile lldb/trunk/packages/Python/lldbsuite/test/functionalities/frame-recognizer/TestFrameRecognizer.py lldb/trunk/packages/Python/lldbsuite/test/functionalities/frame-recognizer/main.m lldb/trunk/packages/Python/lldbsuite/test/functionalities/frame-recognizer/recognizer.py lldb/trunk/scripts/Python/python-wrapper.swig lldb/trunk/scripts/interface/SBVariablesOptions.i lldb/trunk/source/API/SBFrame.cpp lldb/trunk/source/API/SBVariablesOptions.cpp lldb/trunk/source/API/SystemInitializerFull.cpp lldb/trunk/source/Commands/CommandObjectFrame.cpp lldb/trunk/source/Interpreter/OptionGroupVariable.cpp lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h lldb/trunk/source/Target/CMakeLists.txt lldb/trunk/source/Target/StackFrame.cpp lldb/trunk/source/Target/StackFrameRecognizer.cpp lldb/trunk/www/python-reference.html Modified: lldb/trunk/include/lldb/API/SBVariablesOptions.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBVariablesOptions.h?rev=345686&r1=345685&r2=345686&view=diff == --- lldb/trunk/include/lldb/API/SBVariablesOptions.h (original) +++ lldb/trunk/include/lldb/API/SBVariablesOptions.h Tue Oct 30 17:36:20 2018 @@ -33,6 +33,10 @@ public: void SetIncludeArguments(bool); + bool GetIncludeRecognizedArguments() const; + + void SetIncludeRecognizedArguments(bool); + bool GetIncludeLocals() const; void SetIncludeLocals(bool); Modified: lldb/trunk/include/lldb/Interpreter/OptionGroupVariable.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionGroupVariable.h?rev=345686&r1=345685&r2=345686&view=diff == --- lldb/trunk/include/lldb/Interpreter/OptionGroupVariable.h (original) +++ lldb/trunk/include/lldb/Interpreter/OptionGroupVariable.h Tue Oct 30 17:36:20 2018 @@ -39,6 +39,8 @@ public: bool include_frame_options : 1, show_args : 1,// Frame option only (include_frame_options == true) + show_recognized_args : 1, // Frame option only (include_frame_options == + // true) show_locals : 1, // Frame option only (include_frame_options == true) show_globals : 1, // Frame option only (include_frame_options == true) use_regex : 1, show_scope : 1, show_decl : 1; Modified: lldb/trunk/include/lldb/Interpreter/ScriptInterpreter.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/ScriptInterpreter.h?rev=345686&r1=345685&r2=345686&view=diff == --- lldb/trunk/include/lldb/Interpreter/ScriptInterpreter.h (original) +++ lldb/trunk/include/lldb/Interpreter/ScriptInterpreter.h Tue Oct 30 17:36:20 2018 @@ -174,6 +174,17 @@ public: } virtual StructuredData::GenericSP + CreateFrameRecognizer(const char *class_name) { +return StructuredData::GenericSP(); + } + + virtual lldb::ValueObjectListSP GetRecognizedArguments( + const StructuredData::ObjectSP &implementor, + lldb::StackFrameSP frame_sp) { +return lldb::ValueObjectListSP(); + } + + virtual StructuredData::GenericSP OSPlugin_CreatePluginObject(const char *class_name, lldb::ProcessSP process_sp) { return StructuredData::GenericSP(); Modified: lldb/trunk/include/lldb/Target/StackFrame.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/StackFrame.
[Lldb-commits] [lldb] r345688 - Revert r345686 due to build failures
Author: kuba.brecka Date: Tue Oct 30 18:22:48 2018 New Revision: 345688 URL: http://llvm.org/viewvc/llvm-project?rev=345688&view=rev Log: Revert r345686 due to build failures Removed: lldb/trunk/include/lldb/Target/StackFrameRecognizer.h lldb/trunk/packages/Python/lldbsuite/test/functionalities/frame-recognizer/ lldb/trunk/source/Target/StackFrameRecognizer.cpp Modified: lldb/trunk/include/lldb/API/SBVariablesOptions.h lldb/trunk/include/lldb/Interpreter/OptionGroupVariable.h lldb/trunk/include/lldb/Interpreter/ScriptInterpreter.h lldb/trunk/include/lldb/Target/StackFrame.h lldb/trunk/include/lldb/lldb-forward.h lldb/trunk/lldb.xcodeproj/project.pbxproj lldb/trunk/scripts/Python/python-wrapper.swig lldb/trunk/scripts/interface/SBVariablesOptions.i lldb/trunk/source/API/SBFrame.cpp lldb/trunk/source/API/SBVariablesOptions.cpp lldb/trunk/source/API/SystemInitializerFull.cpp lldb/trunk/source/Commands/CommandObjectFrame.cpp lldb/trunk/source/Interpreter/OptionGroupVariable.cpp lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h lldb/trunk/source/Target/CMakeLists.txt lldb/trunk/source/Target/StackFrame.cpp lldb/trunk/www/python-reference.html Modified: lldb/trunk/include/lldb/API/SBVariablesOptions.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBVariablesOptions.h?rev=345688&r1=345687&r2=345688&view=diff == --- lldb/trunk/include/lldb/API/SBVariablesOptions.h (original) +++ lldb/trunk/include/lldb/API/SBVariablesOptions.h Tue Oct 30 18:22:48 2018 @@ -33,10 +33,6 @@ public: void SetIncludeArguments(bool); - bool GetIncludeRecognizedArguments() const; - - void SetIncludeRecognizedArguments(bool); - bool GetIncludeLocals() const; void SetIncludeLocals(bool); Modified: lldb/trunk/include/lldb/Interpreter/OptionGroupVariable.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionGroupVariable.h?rev=345688&r1=345687&r2=345688&view=diff == --- lldb/trunk/include/lldb/Interpreter/OptionGroupVariable.h (original) +++ lldb/trunk/include/lldb/Interpreter/OptionGroupVariable.h Tue Oct 30 18:22:48 2018 @@ -39,8 +39,6 @@ public: bool include_frame_options : 1, show_args : 1,// Frame option only (include_frame_options == true) - show_recognized_args : 1, // Frame option only (include_frame_options == - // true) show_locals : 1, // Frame option only (include_frame_options == true) show_globals : 1, // Frame option only (include_frame_options == true) use_regex : 1, show_scope : 1, show_decl : 1; Modified: lldb/trunk/include/lldb/Interpreter/ScriptInterpreter.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/ScriptInterpreter.h?rev=345688&r1=345687&r2=345688&view=diff == --- lldb/trunk/include/lldb/Interpreter/ScriptInterpreter.h (original) +++ lldb/trunk/include/lldb/Interpreter/ScriptInterpreter.h Tue Oct 30 18:22:48 2018 @@ -174,17 +174,6 @@ public: } virtual StructuredData::GenericSP - CreateFrameRecognizer(const char *class_name) { -return StructuredData::GenericSP(); - } - - virtual lldb::ValueObjectListSP GetRecognizedArguments( - const StructuredData::ObjectSP &implementor, - lldb::StackFrameSP frame_sp) { -return lldb::ValueObjectListSP(); - } - - virtual StructuredData::GenericSP OSPlugin_CreatePluginObject(const char *class_name, lldb::ProcessSP process_sp) { return StructuredData::GenericSP(); Modified: lldb/trunk/include/lldb/Target/StackFrame.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/StackFrame.h?rev=345688&r1=345687&r2=345688&view=diff == --- lldb/trunk/include/lldb/Target/StackFrame.h (original) +++ lldb/trunk/include/lldb/Target/StackFrame.h Tue Oct 30 18:22:48 2018 @@ -544,8 +544,6 @@ public: void CalculateExecutionContext(ExecutionContext &exe_ctx) override; - lldb::RecognizedStackFrameSP GetRecognizedFrame(); - protected: friend class StackFrameList; @@ -580,7 +578,6 @@ private: ValueObjectList m_variable_list_value_objects; // Value objects for each // variable in // m_variable_list_sp - lldb::RecognizedStackFrameSP m_recognized_frame_sp; StreamString m_disassembly; std::recursive_mutex m_mutex; Removed: lldb/trunk/include/lldb/Target/StackFrameRecognizer.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/in
[Lldb-commits] [lldb] r345693 - [lldb] Introduce StackFrameRecognizer [take 3]
Author: kuba.brecka Date: Tue Oct 30 21:00:22 2018 New Revision: 345693 URL: http://llvm.org/viewvc/llvm-project?rev=345693&view=rev Log: [lldb] Introduce StackFrameRecognizer [take 3] This patch introduces a concept of "frame recognizer" and "recognized frame". This should be an extensible mechanism that retrieves information about special frames based on ABI, arguments or other special properties of that frame, even without source code. A few examples where that could be useful could be 1) objc_exception_throw, where we'd like to get the current exception, 2) terminate_with_reason and extracting the current terminate string, 3) recognizing Objective-C frames and automatically extracting the receiver+selector, or perhaps all arguments (based on selector). Differential Revision: https://reviews.llvm.org/D44603 Added: lldb/trunk/include/lldb/Target/StackFrameRecognizer.h lldb/trunk/packages/Python/lldbsuite/test/functionalities/frame-recognizer/ lldb/trunk/packages/Python/lldbsuite/test/functionalities/frame-recognizer/Makefile lldb/trunk/packages/Python/lldbsuite/test/functionalities/frame-recognizer/TestFrameRecognizer.py lldb/trunk/packages/Python/lldbsuite/test/functionalities/frame-recognizer/main.m lldb/trunk/packages/Python/lldbsuite/test/functionalities/frame-recognizer/recognizer.py lldb/trunk/source/Target/StackFrameRecognizer.cpp Modified: lldb/trunk/include/lldb/API/SBVariablesOptions.h lldb/trunk/include/lldb/Interpreter/OptionGroupVariable.h lldb/trunk/include/lldb/Interpreter/ScriptInterpreter.h lldb/trunk/include/lldb/Target/StackFrame.h lldb/trunk/include/lldb/lldb-forward.h lldb/trunk/lldb.xcodeproj/project.pbxproj lldb/trunk/scripts/Python/python-wrapper.swig lldb/trunk/scripts/interface/SBVariablesOptions.i lldb/trunk/source/API/SBFrame.cpp lldb/trunk/source/API/SBVariablesOptions.cpp lldb/trunk/source/API/SystemInitializerFull.cpp lldb/trunk/source/Commands/CommandObjectFrame.cpp lldb/trunk/source/Interpreter/OptionGroupVariable.cpp lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h lldb/trunk/source/Target/CMakeLists.txt lldb/trunk/source/Target/StackFrame.cpp lldb/trunk/www/python-reference.html Modified: lldb/trunk/include/lldb/API/SBVariablesOptions.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBVariablesOptions.h?rev=345693&r1=345692&r2=345693&view=diff == --- lldb/trunk/include/lldb/API/SBVariablesOptions.h (original) +++ lldb/trunk/include/lldb/API/SBVariablesOptions.h Tue Oct 30 21:00:22 2018 @@ -33,6 +33,10 @@ public: void SetIncludeArguments(bool); + bool GetIncludeRecognizedArguments() const; + + void SetIncludeRecognizedArguments(bool); + bool GetIncludeLocals() const; void SetIncludeLocals(bool); Modified: lldb/trunk/include/lldb/Interpreter/OptionGroupVariable.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionGroupVariable.h?rev=345693&r1=345692&r2=345693&view=diff == --- lldb/trunk/include/lldb/Interpreter/OptionGroupVariable.h (original) +++ lldb/trunk/include/lldb/Interpreter/OptionGroupVariable.h Tue Oct 30 21:00:22 2018 @@ -39,6 +39,8 @@ public: bool include_frame_options : 1, show_args : 1,// Frame option only (include_frame_options == true) + show_recognized_args : 1, // Frame option only (include_frame_options == + // true) show_locals : 1, // Frame option only (include_frame_options == true) show_globals : 1, // Frame option only (include_frame_options == true) use_regex : 1, show_scope : 1, show_decl : 1; Modified: lldb/trunk/include/lldb/Interpreter/ScriptInterpreter.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/ScriptInterpreter.h?rev=345693&r1=345692&r2=345693&view=diff == --- lldb/trunk/include/lldb/Interpreter/ScriptInterpreter.h (original) +++ lldb/trunk/include/lldb/Interpreter/ScriptInterpreter.h Tue Oct 30 21:00:22 2018 @@ -174,6 +174,17 @@ public: } virtual StructuredData::GenericSP + CreateFrameRecognizer(const char *class_name) { +return StructuredData::GenericSP(); + } + + virtual lldb::ValueObjectListSP GetRecognizedArguments( + const StructuredData::ObjectSP &implementor, + lldb::StackFrameSP frame_sp) { +return lldb::ValueObjectListSP(); + } + + virtual StructuredData::GenericSP OSPlugin_CreatePluginObject(const char *class_name, lldb::ProcessSP process_sp) { return StructuredData::GenericSP(); Modified: lldb/trunk/include/lldb/Target/StackFrame
[Lldb-commits] [lldb] r345694 - Fixup the Python-less build of ScriptedRecognizedStackFrame
Author: kuba.brecka Date: Tue Oct 30 21:43:09 2018 New Revision: 345694 URL: http://llvm.org/viewvc/llvm-project?rev=345694&view=rev Log: Fixup the Python-less build of ScriptedRecognizedStackFrame Modified: lldb/trunk/source/Commands/CommandObjectFrame.cpp lldb/trunk/source/Target/StackFrameRecognizer.cpp Modified: lldb/trunk/source/Commands/CommandObjectFrame.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectFrame.cpp?rev=345694&r1=345693&r2=345694&view=diff == --- lldb/trunk/source/Commands/CommandObjectFrame.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectFrame.cpp Tue Oct 30 21:43:09 2018 @@ -883,6 +883,7 @@ Process 1234 stopped bool CommandObjectFrameRecognizerAdd::DoExecute(Args &command, CommandReturnObject &result) { +#ifndef LLDB_DISABLE_PYTHON if (m_options.m_class_name.empty()) { result.AppendErrorWithFormat( "%s needs a Python class name (-l argument).\n", m_cmd_name.c_str()); @@ -927,6 +928,7 @@ bool CommandObjectFrameRecognizerAdd::Do auto func = ConstString(m_options.m_function); StackFrameRecognizerManager::AddRecognizer(recognizer_sp, module, func); } +#endif result.SetStatus(eReturnStatusSuccessFinishNoResult); return result.Succeeded(); Modified: lldb/trunk/source/Target/StackFrameRecognizer.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/StackFrameRecognizer.cpp?rev=345694&r1=345693&r2=345694&view=diff == --- lldb/trunk/source/Target/StackFrameRecognizer.cpp (original) +++ lldb/trunk/source/Target/StackFrameRecognizer.cpp Tue Oct 30 21:43:09 2018 @@ -22,6 +22,8 @@ using namespace lldb; using namespace lldb_private; +#ifndef LLDB_DISABLE_PYTHON + class ScriptedRecognizedStackFrame : public RecognizedStackFrame { public: ScriptedRecognizedStackFrame(ValueObjectListSP args) { @@ -47,6 +49,8 @@ ScriptedStackFrameRecognizer::RecognizeF return RecognizedStackFrameSP(new ScriptedRecognizedStackFrame(args)); } +#endif + class StackFrameRecognizerManagerImpl { public: void AddRecognizer(StackFrameRecognizerSP recognizer, ConstString &module, ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r346673 - [lldb] Fix "code requires global destructor" warning in g_architecture_mutex
Author: kuba.brecka Date: Mon Nov 12 08:52:58 2018 New Revision: 346673 URL: http://llvm.org/viewvc/llvm-project?rev=346673&view=rev Log: [lldb] Fix "code requires global destructor" warning in g_architecture_mutex Differential Revision: https://reviews.llvm.org/D44060 Modified: lldb/trunk/source/Core/PluginManager.cpp Modified: lldb/trunk/source/Core/PluginManager.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/PluginManager.cpp?rev=346673&r1=346672&r2=346673&view=diff == --- lldb/trunk/source/Core/PluginManager.cpp (original) +++ lldb/trunk/source/Core/PluginManager.cpp Mon Nov 12 08:52:58 2018 @@ -286,7 +286,10 @@ struct ArchitectureInstance { typedef std::vector ArchitectureInstances; -static std::mutex g_architecture_mutex; +static std::mutex &GetArchitectureMutex() { +static std::mutex g_architecture_mutex; +return g_architecture_mutex; +} static ArchitectureInstances &GetArchitectureInstances() { static ArchitectureInstances g_instances; @@ -296,13 +299,13 @@ static ArchitectureInstances &GetArchite void PluginManager::RegisterPlugin(const ConstString &name, llvm::StringRef description, ArchitectureCreateInstance create_callback) { - std::lock_guard guard(g_architecture_mutex); + std::lock_guard guard(GetArchitectureMutex()); GetArchitectureInstances().push_back({name, description, create_callback}); } void PluginManager::UnregisterPlugin( ArchitectureCreateInstance create_callback) { - std::lock_guard guard(g_architecture_mutex); + std::lock_guard guard(GetArchitectureMutex()); auto &instances = GetArchitectureInstances(); for (auto pos = instances.begin(), end = instances.end(); pos != end; ++pos) { @@ -316,7 +319,7 @@ void PluginManager::UnregisterPlugin( std::unique_ptr PluginManager::CreateArchitectureInstance(const ArchSpec &arch) { - std::lock_guard guard(g_architecture_mutex); + std::lock_guard guard(GetArchitectureMutex()); for (const auto &instances : GetArchitectureInstances()) { if (auto plugin_up = instances.create_callback(arch)) return plugin_up; ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r346679 - [lldb] Refactor ObjC/NSException.cpp (cleanup, avoid code duplication). NFC.
Author: kuba.brecka Date: Mon Nov 12 09:25:23 2018 New Revision: 346679 URL: http://llvm.org/viewvc/llvm-project?rev=346679&view=rev Log: [lldb] Refactor ObjC/NSException.cpp (cleanup, avoid code duplication). NFC. - Refactor reading of NSException fields into ExtractFields method to avoid code duplication. - Remove "m_child_ptr" field, as it's not used anywhere. - Clang-format. Differential Revision: https://reviews.llvm.org/D44073 Modified: lldb/trunk/source/Plugins/Language/ObjC/NSException.cpp Modified: lldb/trunk/source/Plugins/Language/ObjC/NSException.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/ObjC/NSException.cpp?rev=346679&r1=346678&r2=346679&view=diff == --- lldb/trunk/source/Plugins/Language/ObjC/NSException.cpp (original) +++ lldb/trunk/source/Plugins/Language/ObjC/NSException.cpp Mon Nov 12 09:25:23 2018 @@ -29,52 +29,70 @@ using namespace lldb; using namespace lldb_private; using namespace lldb_private::formatters; -bool lldb_private::formatters::NSException_SummaryProvider( -ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options) { +static bool ExtractFields(ValueObject &valobj, ValueObjectSP *name_sp, + ValueObjectSP *reason_sp, + ValueObjectSP *userinfo_sp) { ProcessSP process_sp(valobj.GetProcessSP()); if (!process_sp) return false; - lldb::addr_t ptr_value = LLDB_INVALID_ADDRESS; + lldb::addr_t ptr = LLDB_INVALID_ADDRESS; CompilerType valobj_type(valobj.GetCompilerType()); Flags type_flags(valobj_type.GetTypeInfo()); if (type_flags.AllClear(eTypeHasValue)) { if (valobj.IsBaseClass() && valobj.GetParent()) - ptr_value = valobj.GetParent()->GetValueAsUnsigned(LLDB_INVALID_ADDRESS); - } else -ptr_value = valobj.GetValueAsUnsigned(LLDB_INVALID_ADDRESS); + ptr = valobj.GetParent()->GetValueAsUnsigned(LLDB_INVALID_ADDRESS); + } else { +ptr = valobj.GetValueAsUnsigned(LLDB_INVALID_ADDRESS); + } - if (ptr_value == LLDB_INVALID_ADDRESS) + if (ptr == LLDB_INVALID_ADDRESS) return false; size_t ptr_size = process_sp->GetAddressByteSize(); - lldb::addr_t name_location = ptr_value + 1 * ptr_size; - lldb::addr_t reason_location = ptr_value + 2 * ptr_size; Status error; - lldb::addr_t name = process_sp->ReadPointerFromMemory(name_location, error); + auto name = process_sp->ReadPointerFromMemory(ptr + 1 * ptr_size, error); if (error.Fail() || name == LLDB_INVALID_ADDRESS) return false; - - lldb::addr_t reason = - process_sp->ReadPointerFromMemory(reason_location, error); + auto reason = process_sp->ReadPointerFromMemory(ptr + 2 * ptr_size, error); if (error.Fail() || reason == LLDB_INVALID_ADDRESS) return false; + auto userinfo = process_sp->ReadPointerFromMemory(ptr + 3 * ptr_size, error); + if (error.Fail() || userinfo == LLDB_INVALID_ADDRESS) +return false; InferiorSizedWord name_isw(name, *process_sp); InferiorSizedWord reason_isw(reason, *process_sp); + InferiorSizedWord userinfo_isw(userinfo, *process_sp); CompilerType voidstar = process_sp->GetTarget() .GetScratchClangASTContext() ->GetBasicType(lldb::eBasicTypeVoid) .GetPointerType(); - ValueObjectSP name_sp = ValueObject::CreateValueObjectFromData( - "name_str", name_isw.GetAsData(process_sp->GetByteOrder()), - valobj.GetExecutionContextRef(), voidstar); - ValueObjectSP reason_sp = ValueObject::CreateValueObjectFromData( - "reason_str", reason_isw.GetAsData(process_sp->GetByteOrder()), - valobj.GetExecutionContextRef(), voidstar); + if (name_sp) +*name_sp = ValueObject::CreateValueObjectFromData( +"name", name_isw.GetAsData(process_sp->GetByteOrder()), +valobj.GetExecutionContextRef(), voidstar); + if (reason_sp) +*reason_sp = ValueObject::CreateValueObjectFromData( +"reason", reason_isw.GetAsData(process_sp->GetByteOrder()), +valobj.GetExecutionContextRef(), voidstar); + if (userinfo_sp) +*userinfo_sp = ValueObject::CreateValueObjectFromData( +"userInfo", userinfo_isw.GetAsData(process_sp->GetByteOrder()), +valobj.GetExecutionContextRef(), voidstar); + + return true; +} + +bool lldb_private::formatters::NSException_SummaryProvider( +ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options) { + lldb::ValueObjectSP name_sp; + lldb::ValueObjectSP reason_sp; + if (!ExtractFields(valobj, &name_sp, &reason_sp, nullptr)) +return false; if (!name_sp || !reason_sp) return false; @@ -97,63 +115,24 @@ public: : SyntheticChildrenFrontEnd(*valobj_sp) {} ~NSExceptionSyntheticFrontEnd() override = default; - // no need to delete m_child_ptr - it's kept alive by the cluster manager on - // our behalf size_t CalculateNum
[Lldb-commits] [lldb] r346692 - [lldb] Fix the typo (replace underscore with dash) in svn:ignore on test/ and add "lldb-test-build.noindex" to ignored files
Author: kuba.brecka Date: Mon Nov 12 11:05:16 2018 New Revision: 346692 URL: http://llvm.org/viewvc/llvm-project?rev=346692&view=rev Log: [lldb] Fix the typo (replace underscore with dash) in svn:ignore on test/ and add "lldb-test-build.noindex" to ignored files Differential Revision: https://reviews.llvm.org/D54432 Modified: lldb/trunk/test/ (props changed) Propchange: lldb/trunk/test/ -- --- svn:ignore (original) +++ svn:ignore Mon Nov 12 11:05:16 2018 @@ -1 +1,2 @@ -20[1-9][0-9]-[01][0-9]-[0-3][0-9]_[0-2][0-9]_[0-5][0-9]_[0-6][0-9] +20[1-9][0-9]-[01][0-9]-[0-3][0-9]-[0-2][0-9]_[0-5][0-9]_[0-6][0-9] +lldb-test-build.noindex ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r346693 - [lldb] Add "ninja" to svn:ignore
Author: kuba.brecka Date: Mon Nov 12 11:06:15 2018 New Revision: 346693 URL: http://llvm.org/viewvc/llvm-project?rev=346693&view=rev Log: [lldb] Add "ninja" to svn:ignore Differential Revision: https://reviews.llvm.org/D54431 Modified: lldb/trunk/ (props changed) Propchange: lldb/trunk/ -- --- svn:ignore (original) +++ svn:ignore Mon Nov 12 11:06:15 2018 @@ -3,4 +3,5 @@ intermediates llvm llvm-build .vscode +ninja ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r346695 - [lldb] Extract more fields from NSException values
Author: kuba.brecka Date: Mon Nov 12 11:12:31 2018 New Revision: 346695 URL: http://llvm.org/viewvc/llvm-project?rev=346695&view=rev Log: [lldb] Extract more fields from NSException values This patch teaches LLDB about more fields on NSException Obj-C objects, specifically we can now retrieve the "name" and "reason" of an NSException. The goal is to eventually be able to have SB API that can provide details about the currently thrown/caught/processed exception. Differential Revision: https://reviews.llvm.org/D43884 Added: lldb/trunk/packages/Python/lldbsuite/test/lang/objc/exceptions/ lldb/trunk/packages/Python/lldbsuite/test/lang/objc/exceptions/Makefile lldb/trunk/packages/Python/lldbsuite/test/lang/objc/exceptions/TestObjCExceptions.py lldb/trunk/packages/Python/lldbsuite/test/lang/objc/exceptions/main.m Modified: lldb/trunk/source/Plugins/Language/ObjC/NSException.cpp Added: lldb/trunk/packages/Python/lldbsuite/test/lang/objc/exceptions/Makefile URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/objc/exceptions/Makefile?rev=346695&view=auto == --- lldb/trunk/packages/Python/lldbsuite/test/lang/objc/exceptions/Makefile (added) +++ lldb/trunk/packages/Python/lldbsuite/test/lang/objc/exceptions/Makefile Mon Nov 12 11:12:31 2018 @@ -0,0 +1,9 @@ +LEVEL = ../../../make + +OBJC_SOURCES := main.m + +CFLAGS_EXTRAS += -w + +include $(LEVEL)/Makefile.rules + +LDFLAGS += -framework Foundation Added: lldb/trunk/packages/Python/lldbsuite/test/lang/objc/exceptions/TestObjCExceptions.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/objc/exceptions/TestObjCExceptions.py?rev=346695&view=auto == --- lldb/trunk/packages/Python/lldbsuite/test/lang/objc/exceptions/TestObjCExceptions.py (added) +++ lldb/trunk/packages/Python/lldbsuite/test/lang/objc/exceptions/TestObjCExceptions.py Mon Nov 12 11:12:31 2018 @@ -0,0 +1,90 @@ +# encoding: utf-8 +""" +Test lldb Obj-C exception support. +""" + +from __future__ import print_function + + +import lldb +from lldbsuite.test.decorators import * +from lldbsuite.test.lldbtest import * +from lldbsuite.test import lldbutil + + +class ObjCExceptionsTestCase(TestBase): + +mydir = TestBase.compute_mydir(__file__) + +@skipUnlessDarwin +def test_objc_exceptions_1(self): +self.build() + +target = self.dbg.CreateTarget(self.getBuildArtifact("a.out")) +self.assertTrue(target, VALID_TARGET) + +lldbutil.run_to_source_breakpoint(self, "// Set break point at this line.", lldb.SBFileSpec("main.m")) + +self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, +substrs=['stopped', 'stop reason = breakpoint']) + +thread = self.dbg.GetSelectedTarget().GetProcess().GetSelectedThread() +frame = thread.GetSelectedFrame() + +self.expect( +'frame variable e1', +substrs=[ +'(NSException *) e1 = ', +'name: @"ExceptionName" - reason: @"SomeReason"' +]) + +self.expect( +'frame variable --dynamic-type no-run-target *e1', +substrs=[ +'(NSException) *e1 = ', +'name = ', '@"ExceptionName"', +'reason = ', '@"SomeReason"', +'userInfo = ', '1 key/value pair', +'reserved = ', 'nil', +]) + +e1 = frame.FindVariable("e1") +self.assertTrue(e1) +self.assertEqual(e1.type.name, "NSException *") +self.assertEqual(e1.GetSummary(), 'name: @"ExceptionName" - reason: @"SomeReason"') +self.assertEqual(e1.GetChildMemberWithName("name").description, "ExceptionName") +self.assertEqual(e1.GetChildMemberWithName("reason").description, "SomeReason") +userInfo = e1.GetChildMemberWithName("userInfo").dynamic +self.assertEqual(userInfo.summary, "1 key/value pair") + self.assertEqual(userInfo.GetChildAtIndex(0).GetChildAtIndex(0).description, "some_key") + self.assertEqual(userInfo.GetChildAtIndex(0).GetChildAtIndex(1).description, "some_value") +self.assertEqual(e1.GetChildMemberWithName("reserved").description, "") + +self.expect( +'frame variable e2', +substrs=[ +'(NSException *) e2 = ', +'name: @"ThrownException" - reason: @"SomeReason"' +]) + +self.expect( +'frame variable --dynamic-type no-run-target *e2', +substrs=[ +'(NSException) *e2 = ', +'name = ', '@"ThrownException"', +'reason = ', '@"SomeReason"', +'userInfo = ', '1 key/value pair', +'reserved = ', +]) + +e2 = frame.FindVariable("e2") +
[Lldb-commits] [lldb] r346708 - [lldb] Add synthetic frontend for _NSCallStackArray
Author: kuba.brecka Date: Mon Nov 12 13:26:03 2018 New Revision: 346708 URL: http://llvm.org/viewvc/llvm-project?rev=346708&view=rev Log: [lldb] Add synthetic frontend for _NSCallStackArray An Obj-C array type _NSCallStackArray is used in NSException backtraces. This patch adds a synthetic frontend for _NSCallStackArray, which now correctly returns frame PCs. Differential Revision: https://reviews.llvm.org/D44081 Modified: lldb/trunk/packages/Python/lldbsuite/test/lang/objc/exceptions/TestObjCExceptions.py lldb/trunk/source/Plugins/Language/ObjC/NSArray.cpp lldb/trunk/source/Plugins/Language/ObjC/ObjCLanguage.cpp Modified: lldb/trunk/packages/Python/lldbsuite/test/lang/objc/exceptions/TestObjCExceptions.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/objc/exceptions/TestObjCExceptions.py?rev=346708&r1=346707&r2=346708&view=diff == --- lldb/trunk/packages/Python/lldbsuite/test/lang/objc/exceptions/TestObjCExceptions.py (original) +++ lldb/trunk/packages/Python/lldbsuite/test/lang/objc/exceptions/TestObjCExceptions.py Mon Nov 12 13:26:03 2018 @@ -28,7 +28,8 @@ class ObjCExceptionsTestCase(TestBase): self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, substrs=['stopped', 'stop reason = breakpoint']) -thread = self.dbg.GetSelectedTarget().GetProcess().GetSelectedThread() +target = self.dbg.GetSelectedTarget() +thread = target.GetProcess().GetSelectedThread() frame = thread.GetSelectedFrame() self.expect( @@ -87,4 +88,13 @@ class ObjCExceptionsTestCase(TestBase): self.assertEqual(userInfo.summary, "1 key/value pair") self.assertEqual(userInfo.GetChildAtIndex(0).GetChildAtIndex(0).description, "some_key") self.assertEqual(userInfo.GetChildAtIndex(0).GetChildAtIndex(1).description, "some_value") - self.assertGreater(e2.GetChildMemberWithName("reserved").dynamic.num_children, 0) +reserved = e2.GetChildMemberWithName("reserved").dynamic +self.assertGreater(reserved.num_children, 0) +callStackReturnAddresses = [reserved.GetChildAtIndex(i).GetChildAtIndex(1) for i in range(0, reserved.GetNumChildren()) +if reserved.GetChildAtIndex(i).GetChildAtIndex(0).description == "callStackReturnAddresses"][0].dynamic +children = [callStackReturnAddresses.GetChildAtIndex(i) for i in range(0, callStackReturnAddresses.num_children)] + +pcs = [i.unsigned for i in children] +names = [target.ResolveSymbolContextForAddress(lldb.SBAddress(pc, target), lldb.eSymbolContextSymbol).GetSymbol().name for pc in pcs] +for n in ["objc_exception_throw", "foo", "main"]: +self.assertTrue(n in names, "%s is in the exception backtrace (%s)" % (n, names)) Modified: lldb/trunk/source/Plugins/Language/ObjC/NSArray.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/ObjC/NSArray.cpp?rev=346708&r1=346707&r2=346708&view=diff == --- lldb/trunk/source/Plugins/Language/ObjC/NSArray.cpp (original) +++ lldb/trunk/source/Plugins/Language/ObjC/NSArray.cpp Mon Nov 12 13:26:03 2018 @@ -214,6 +214,25 @@ namespace Foundation1437 { } +namespace CallStackArray { +struct DataDescriptor_32 { + uint32_t _data; + uint32_t _used; + uint32_t _offset; + const uint32_t _size = 0; +}; + +struct DataDescriptor_64 { + uint64_t _data; + uint64_t _used; + uint64_t _offset; + const uint64_t _size = 0; +}; + +using NSCallStackArraySyntheticFrontEnd = +GenericNSArrayMSyntheticFrontEnd; +} // namespace CallStackArray + template class GenericNSArrayISyntheticFrontEnd : public SyntheticChildrenFrontEnd { public: @@ -364,6 +383,7 @@ bool lldb_private::formatters::NSArraySu static const ConstString g_NSArrayCF("__NSCFArray"); static const ConstString g_NSArrayMLegacy("__NSArrayM_Legacy"); static const ConstString g_NSArrayMImmutable("__NSArrayM_Immutable"); + static const ConstString g_NSCallStackArray("_NSCallStackArray"); if (class_name.IsEmpty()) return false; @@ -413,7 +433,9 @@ bool lldb_private::formatters::NSArraySu value = 0; } else if (class_name == g_NSArray1) { value = 1; - } else if (class_name == g_NSArrayCF) { + } else if (class_name == g_NSArrayCF || class_name == g_NSCallStackArray) { +// __NSCFArray and _NSCallStackArray store the number of elements as a +// pointer-sized value at offset `2 * ptr_size`. Status error; value = process_sp->ReadUnsignedIntegerFromMemory( valobj_addr + 2 * ptr_size, ptr_size, 0, error); @@ -813,6 +835,7 @@ lldb_private::formatters::NSArraySynthet static const ConstString g_NSArray1("__NSSingleObjectArrayI"); static const ConstString g_NSArrayMLegacy("__NSArrayM_Legacy"); static const ConstString g_NSArr
[Lldb-commits] [lldb] r347813 - [lldb] Add GetCurrentException APIs to SBThread, add frame recognizer for objc_exception_throw for Obj-C runtimes
Author: kuba.brecka Date: Wed Nov 28 14:01:52 2018 New Revision: 347813 URL: http://llvm.org/viewvc/llvm-project?rev=347813&view=rev Log: [lldb] Add GetCurrentException APIs to SBThread, add frame recognizer for objc_exception_throw for Obj-C runtimes This adds new APIs and a command to deal with exceptions (mostly Obj-C exceptions): SBThread and Thread get GetCurrentException API, which returns an SBValue/ValueObjectSP with the current exception for a thread. "Current" means an exception that is currently being thrown, caught or otherwise processed. In this patch, we only know about the exception when in objc_exception_throw, but subsequent patches will expand this (and add GetCurrentExceptionBacktrace, which will return an SBThread/ThreadSP containing a historical thread backtrace retrieved from the exception object. Currently unimplemented, subsequent patches will implement this). Extracting the exception from objc_exception_throw is implemented by adding a frame recognizer. This also add a new sub-command "thread exception", which prints the current exception. Differential Revision: https://reviews.llvm.org/D43886 Modified: lldb/trunk/include/lldb/API/SBThread.h lldb/trunk/include/lldb/Target/StackFrameRecognizer.h lldb/trunk/include/lldb/Target/Thread.h lldb/trunk/packages/Python/lldbsuite/test/lang/objc/exceptions/TestObjCExceptions.py lldb/trunk/source/API/SBThread.cpp lldb/trunk/source/Commands/CommandObjectThread.cpp lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp lldb/trunk/source/Target/StackFrameRecognizer.cpp lldb/trunk/source/Target/Thread.cpp Modified: lldb/trunk/include/lldb/API/SBThread.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBThread.h?rev=347813&r1=347812&r2=347813&view=diff == --- lldb/trunk/include/lldb/API/SBThread.h (original) +++ lldb/trunk/include/lldb/API/SBThread.h Wed Nov 28 14:01:52 2018 @@ -198,6 +198,11 @@ public: uint32_t GetExtendedBacktraceOriginatingIndexID(); + SBValue GetCurrentException(); + + // TODO(kubamracek): Extract backtrace from SBValue into SBThread + // SBThread GetCurrentExceptionBacktrace(); + bool SafeToCallFunctions(); #ifndef SWIG Modified: lldb/trunk/include/lldb/Target/StackFrameRecognizer.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/StackFrameRecognizer.h?rev=347813&r1=347812&r2=347813&view=diff == --- lldb/trunk/include/lldb/Target/StackFrameRecognizer.h (original) +++ lldb/trunk/include/lldb/Target/StackFrameRecognizer.h Wed Nov 28 14:01:52 2018 @@ -30,6 +30,9 @@ public: virtual lldb::ValueObjectListSP GetRecognizedArguments() { return m_arguments; } + virtual lldb::ValueObjectSP GetExceptionObject() { +return lldb::ValueObjectSP(); + } virtual ~RecognizedStackFrame(){}; protected: @@ -97,7 +100,8 @@ private: class StackFrameRecognizerManager { public: static void AddRecognizer(lldb::StackFrameRecognizerSP recognizer, -ConstString &module, ConstString &symbol, +const ConstString &module, +const ConstString &symbol, bool first_instruction_only = true); static void AddRecognizer(lldb::StackFrameRecognizerSP recognizer, Modified: lldb/trunk/include/lldb/Target/Thread.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Thread.h?rev=347813&r1=347812&r2=347813&view=diff == --- lldb/trunk/include/lldb/Target/Thread.h (original) +++ lldb/trunk/include/lldb/Target/Thread.h Wed Nov 28 14:01:52 2018 @@ -1253,6 +1253,11 @@ public: //-- virtual uint64_t GetExtendedBacktraceToken() { return LLDB_INVALID_ADDRESS; } + lldb::ValueObjectSP GetCurrentException(); + + // TODO(kubamracek): Extract backtrace from ValueObjectSP into ThreadSP + // lldb::ThreadSP GetCurrentExceptionBacktrace(); + protected: friend class ThreadPlan; friend class ThreadList; Modified: lldb/trunk/packages/Python/lldbsuite/test/lang/objc/exceptions/TestObjCExceptions.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/objc/exceptions/TestObjCExceptions.py?rev=347813&r1=347812&r2=347813&view=diff == --- lldb/trunk/packages/Python/lldbsuite/test/lang/objc/exceptions/T
[Lldb-commits] [lldb] r349718 - [lldb] Retrieve currently handled Obj-C exception via __cxa_current_exception_type and add GetCurrentExceptionBacktrace SB ABI
Author: kuba.brecka Date: Wed Dec 19 18:01:59 2018 New Revision: 349718 URL: http://llvm.org/viewvc/llvm-project?rev=349718&view=rev Log: [lldb] Retrieve currently handled Obj-C exception via __cxa_current_exception_type and add GetCurrentExceptionBacktrace SB ABI This builds on https://reviews.llvm.org/D43884 and https://reviews.llvm.org/D43886 and extends LLDB support of Obj-C exceptions to also look for a "current exception" for a thread in the C++ exception handling runtime metadata (via call to __cxa_current_exception_type). We also construct an actual historical SBThread/ThreadSP that contains frames from the backtrace in the Obj-C exception object. The high level goal this achieves is that when we're already crashed (because an unhandled exception occurred), we can still access the exception object and retrieve the backtrace from the throw point. In Obj-C, this is particularly useful because a catch+rethrow is very common and in those cases you currently don't have any access to the throw point backtrace. Differential Revision: https://reviews.llvm.org/D44072 Added: lldb/trunk/packages/Python/lldbsuite/test/lang/objc/exceptions/main.mm - copied, changed from r349717, lldb/trunk/packages/Python/lldbsuite/test/lang/objc/exceptions/main.m Removed: lldb/trunk/packages/Python/lldbsuite/test/lang/objc/exceptions/main.m Modified: lldb/trunk/include/lldb/API/SBThread.h lldb/trunk/include/lldb/Target/LanguageRuntime.h lldb/trunk/include/lldb/Target/Thread.h lldb/trunk/packages/Python/lldbsuite/test/lang/objc/exceptions/Makefile lldb/trunk/packages/Python/lldbsuite/test/lang/objc/exceptions/TestObjCExceptions.py lldb/trunk/scripts/interface/SBThread.i lldb/trunk/source/API/SBThread.cpp lldb/trunk/source/Commands/CommandObjectThread.cpp lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h lldb/trunk/source/Target/Thread.cpp Modified: lldb/trunk/include/lldb/API/SBThread.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBThread.h?rev=349718&r1=349717&r2=349718&view=diff == --- lldb/trunk/include/lldb/API/SBThread.h (original) +++ lldb/trunk/include/lldb/API/SBThread.h Wed Dec 19 18:01:59 2018 @@ -200,8 +200,7 @@ public: SBValue GetCurrentException(); - // TODO(kubamracek): Extract backtrace from SBValue into SBThread - // SBThread GetCurrentExceptionBacktrace(); + SBThread GetCurrentExceptionBacktrace(); bool SafeToCallFunctions(); Modified: lldb/trunk/include/lldb/Target/LanguageRuntime.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/LanguageRuntime.h?rev=349718&r1=349717&r2=349718&view=diff == --- lldb/trunk/include/lldb/Target/LanguageRuntime.h (original) +++ lldb/trunk/include/lldb/Target/LanguageRuntime.h Wed Dec 19 18:01:59 2018 @@ -119,6 +119,17 @@ public: static Breakpoint::BreakpointPreconditionSP CreateExceptionPrecondition(lldb::LanguageType language, bool catch_bp, bool throw_bp); + + virtual lldb::ValueObjectSP GetExceptionObjectForThread( + lldb::ThreadSP thread_sp) { +return lldb::ValueObjectSP(); + } + + virtual lldb::ThreadSP GetBacktraceThreadFromException( + lldb::ValueObjectSP thread_sp) { +return lldb::ThreadSP(); + } + Process *GetProcess() { return m_process; } Target &GetTargetRef() { return m_process->GetTarget(); } Modified: lldb/trunk/include/lldb/Target/Thread.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Thread.h?rev=349718&r1=349717&r2=349718&view=diff == --- lldb/trunk/include/lldb/Target/Thread.h (original) +++ lldb/trunk/include/lldb/Target/Thread.h Wed Dec 19 18:01:59 2018 @@ -1255,8 +1255,7 @@ public: lldb::ValueObjectSP GetCurrentException(); - // TODO(kubamracek): Extract backtrace from ValueObjectSP into ThreadSP - // lldb::ThreadSP GetCurrentExceptionBacktrace(); + lldb::ThreadSP GetCurrentExceptionBacktrace(); protected: friend class ThreadPlan; Modified: lldb/trunk/packages/Python/lldbsuite/test/lang/objc/exceptions/Makefile URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/objc/exceptions/Makefile?rev=349718&r1=349717&r2=349718&view=diff == --- lldb/trunk/packages/Python/lldbsuite/test/lang/objc/exceptions/Makefile (original) +++ lldb/trunk/packages/Python/lldbsuite/test/l
[Lldb-commits] [lldb] r349856 - [lldb] Add a "display-recognized-arguments" target setting to show recognized arguments by default
Author: kuba.brecka Date: Thu Dec 20 15:38:19 2018 New Revision: 349856 URL: http://llvm.org/viewvc/llvm-project?rev=349856&view=rev Log: [lldb] Add a "display-recognized-arguments" target setting to show recognized arguments by default Differential Revision: https://reviews.llvm.org/D55954 Modified: lldb/trunk/include/lldb/API/SBTarget.h lldb/trunk/include/lldb/API/SBVariablesOptions.h lldb/trunk/include/lldb/Target/Target.h lldb/trunk/packages/Python/lldbsuite/test/functionalities/frame-recognizer/TestFrameRecognizer.py lldb/trunk/scripts/interface/SBVariablesOptions.i lldb/trunk/source/API/SBFrame.cpp lldb/trunk/source/API/SBVariablesOptions.cpp lldb/trunk/source/Target/Target.cpp Modified: lldb/trunk/include/lldb/API/SBTarget.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBTarget.h?rev=349856&r1=349855&r2=349856&view=diff == --- lldb/trunk/include/lldb/API/SBTarget.h (original) +++ lldb/trunk/include/lldb/API/SBTarget.h Thu Dec 20 15:38:19 2018 @@ -903,6 +903,7 @@ protected: friend class SBSourceManager; friend class SBSymbol; friend class SBValue; + friend class SBVariablesOptions; //-- // Constructors are private, use static Target::Create function to create an Modified: lldb/trunk/include/lldb/API/SBVariablesOptions.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBVariablesOptions.h?rev=349856&r1=349855&r2=349856&view=diff == --- lldb/trunk/include/lldb/API/SBVariablesOptions.h (original) +++ lldb/trunk/include/lldb/API/SBVariablesOptions.h Thu Dec 20 15:38:19 2018 @@ -33,7 +33,7 @@ public: void SetIncludeArguments(bool); - bool GetIncludeRecognizedArguments() const; + bool GetIncludeRecognizedArguments(const lldb::SBTarget &) const; void SetIncludeRecognizedArguments(bool); Modified: lldb/trunk/include/lldb/Target/Target.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Target.h?rev=349856&r1=349855&r2=349856&view=diff == --- lldb/trunk/include/lldb/Target/Target.h (original) +++ lldb/trunk/include/lldb/Target/Target.h Thu Dec 20 15:38:19 2018 @@ -188,6 +188,10 @@ public: void SetDisplayRuntimeSupportValues(bool b); + bool GetDisplayRecognizedArguments() const; + + void SetDisplayRecognizedArguments(bool b); + const ProcessLaunchInfo &GetProcessLaunchInfo(); void SetProcessLaunchInfo(const ProcessLaunchInfo &launch_info); Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/frame-recognizer/TestFrameRecognizer.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/frame-recognizer/TestFrameRecognizer.py?rev=349856&r1=349855&r2=349856&view=diff == --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/frame-recognizer/TestFrameRecognizer.py (original) +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/frame-recognizer/TestFrameRecognizer.py Thu Dec 20 15:38:19 2018 @@ -67,9 +67,24 @@ class FrameRecognizerTestCase(TestBase): self.expect("frame variable", substrs=['(int) a = 42', '(int) b = 56']) -opts = lldb.SBVariablesOptions(); -opts.SetIncludeRecognizedArguments(True); -variables = frame.GetVariables(opts); +# Recognized arguments don't show up by default... +variables = frame.GetVariables(lldb.SBVariablesOptions()) +self.assertEqual(variables.GetSize(), 0) + +# ...unless you set target.display-recognized-arguments to 1... +self.runCmd("settings set target.display-recognized-arguments 1") +variables = frame.GetVariables(lldb.SBVariablesOptions()) +self.assertEqual(variables.GetSize(), 2) + +# ...and you can reset it back to 0 to hide them again... +self.runCmd("settings set target.display-recognized-arguments 0") +variables = frame.GetVariables(lldb.SBVariablesOptions()) +self.assertEqual(variables.GetSize(), 0) + +# ... or explicitly ask for them with SetIncludeRecognizedArguments(True). +opts = lldb.SBVariablesOptions() +opts.SetIncludeRecognizedArguments(True) +variables = frame.GetVariables(opts) self.assertEqual(variables.GetSize(), 2) self.assertEqual(variables.GetValueAtIndex(0).name, "a") Modified: lldb/trunk/scripts/interface/SBVariablesOptions.i URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/interface/SBVariablesOptions.i?rev=349856&r1=349855&r2=349856&view=diff == --- lldb/trunk/scripts/interf
[Lldb-commits] [lldb] r350375 - [lldb] Check SafeToCallFunctions before calling functions in GetExceptionObjectForThread
Author: kuba.brecka Date: Thu Jan 3 16:20:52 2019 New Revision: 350375 URL: http://llvm.org/viewvc/llvm-project?rev=350375&view=rev Log: [lldb] Check SafeToCallFunctions before calling functions in GetExceptionObjectForThread Differential Revision: https://reviews.llvm.org/D56115 Modified: lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp Modified: lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp?rev=350375&r1=350374&r2=350375&view=diff == --- lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp (original) +++ lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp Thu Jan 3 16:20:52 2019 @@ -554,6 +554,9 @@ bool ItaniumABILanguageRuntime::Exceptio ValueObjectSP ItaniumABILanguageRuntime::GetExceptionObjectForThread( ThreadSP thread_sp) { + if (!thread_sp->SafeToCallFunctions()) +return {}; + ClangASTContext *clang_ast_context = m_process->GetTarget().GetScratchClangASTContext(); CompilerType voidstar = ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r350376 - [lldb] Fix ObjCExceptionRecognizedStackFrame to populate the list of recognized arguments
Author: kuba.brecka Date: Thu Jan 3 16:25:08 2019 New Revision: 350376 URL: http://llvm.org/viewvc/llvm-project?rev=350376&view=rev Log: [lldb] Fix ObjCExceptionRecognizedStackFrame to populate the list of recognized arguments Differential Revision: https://reviews.llvm.org/D56027 Modified: lldb/trunk/packages/Python/lldbsuite/test/lang/objc/exceptions/TestObjCExceptions.py lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp Modified: lldb/trunk/packages/Python/lldbsuite/test/lang/objc/exceptions/TestObjCExceptions.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/objc/exceptions/TestObjCExceptions.py?rev=350376&r1=350375&r2=350376&view=diff == --- lldb/trunk/packages/Python/lldbsuite/test/lang/objc/exceptions/TestObjCExceptions.py (original) +++ lldb/trunk/packages/Python/lldbsuite/test/lang/objc/exceptions/TestObjCExceptions.py Thu Jan 3 16:25:08 2019 @@ -34,6 +34,17 @@ class ObjCExceptionsTestCase(TestBase): 'name: "ThrownException" - reason: "SomeReason"', ]) +target = self.dbg.GetSelectedTarget() +thread = target.GetProcess().GetSelectedThread() +frame = thread.GetSelectedFrame() + +opts = lldb.SBVariablesOptions() +opts.SetIncludeRecognizedArguments(True) +variables = frame.GetVariables(opts) + +self.assertEqual(variables.GetSize(), 1) +self.assertEqual(variables.GetValueAtIndex(0).name, "exception") + lldbutil.run_to_source_breakpoint(self, "// Set break point at this line.", lldb.SBFileSpec("main.mm"), launch_info=launch_info) self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp?rev=350376&r1=350375&r2=350376&view=diff == --- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp (original) +++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp Thu Jan 3 16:25:08 2019 @@ -2630,6 +2630,9 @@ class ObjCExceptionRecognizedStackFrame exception = ValueObjectConstResult::Create(frame_sp.get(), value, ConstString("exception")); exception = exception->GetDynamicValue(eDynamicDontRunTarget); + +m_arguments = ValueObjectListSP(new ValueObjectList()); +m_arguments->Append(exception); } ValueObjectSP exception; ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r300416 - ThreadSanitizer plugin: Support Swift access races and fix how external races are displayed.
Author: kuba.brecka Date: Sat Apr 15 23:02:45 2017 New Revision: 300416 URL: http://llvm.org/viewvc/llvm-project?rev=300416&view=rev Log: ThreadSanitizer plugin: Support Swift access races and fix how external races are displayed. Modified: lldb/trunk/source/Plugins/InstrumentationRuntime/ThreadSanitizer/ThreadSanitizerRuntime.cpp lldb/trunk/source/Plugins/InstrumentationRuntime/ThreadSanitizer/ThreadSanitizerRuntime.h Modified: lldb/trunk/source/Plugins/InstrumentationRuntime/ThreadSanitizer/ThreadSanitizerRuntime.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/InstrumentationRuntime/ThreadSanitizer/ThreadSanitizerRuntime.cpp?rev=300416&r1=300415&r2=300416&view=diff == --- lldb/trunk/source/Plugins/InstrumentationRuntime/ThreadSanitizer/ThreadSanitizerRuntime.cpp (original) +++ lldb/trunk/source/Plugins/InstrumentationRuntime/ThreadSanitizer/ThreadSanitizerRuntime.cpp Sat Apr 15 23:02:45 2017 @@ -524,6 +524,8 @@ ThreadSanitizerRuntime::FormatDescriptio return "Lock order inversion (potential deadlock)"; } else if (description == "external-race") { return "Race on a library object"; + } else if (description == "swift-access-race") { +return "Swift access race"; } // for unknown report codes just show the code @@ -581,27 +583,31 @@ static void GetSymbolDeclarationFromAddr } addr_t ThreadSanitizerRuntime::GetFirstNonInternalFramePc( -StructuredData::ObjectSP trace) { +StructuredData::ObjectSP trace, bool skip_one_frame) { ProcessSP process_sp = GetProcessSP(); ModuleSP runtime_module_sp = GetRuntimeModuleSP(); - addr_t result = 0; - trace->GetAsArray()->ForEach([process_sp, runtime_module_sp, -&result](StructuredData::Object *o) -> bool { -addr_t addr = o->GetIntegerValue(); + StructuredData::Array *trace_array = trace->GetAsArray(); + for (int i = 0; i < trace_array->GetSize(); i++) { +if (skip_one_frame && i == 0) + continue; + +addr_t addr; +if (!trace_array->GetItemAtIndexAsInteger(i, addr)) + continue; + lldb_private::Address so_addr; if (!process_sp->GetTarget().GetSectionLoadList().ResolveLoadAddress( addr, so_addr)) - return true; + continue; if (so_addr.GetModule() == runtime_module_sp) - return true; + continue; -result = addr; -return false; - }); +return addr; + } - return result; + return 0; } std::string @@ -612,6 +618,10 @@ ThreadSanitizerRuntime::GenerateSummary( ->GetValueForKey("description") ->GetAsString() ->GetValue(); + bool skip_one_frame = + report->GetObjectForDotSeparatedPath("issue_type")->GetStringValue() == + "external-race"; + addr_t pc = 0; if (report->GetAsDictionary() ->GetValueForKey("mops") @@ -622,7 +632,8 @@ ThreadSanitizerRuntime::GenerateSummary( ->GetAsArray() ->GetItemAtIndex(0) ->GetAsDictionary() -->GetValueForKey("trace")); +->GetValueForKey("trace"), +skip_one_frame); if (report->GetAsDictionary() ->GetValueForKey("stacks") @@ -633,7 +644,8 @@ ThreadSanitizerRuntime::GenerateSummary( ->GetAsArray() ->GetItemAtIndex(0) ->GetAsDictionary() -->GetValueForKey("trace")); +->GetValueForKey("trace"), +skip_one_frame); if (pc != 0) { summary = summary + " in " + GetSymbolNameFromAddress(process_sp, pc); @@ -949,9 +961,18 @@ static std::string GenerateThreadName(co addr_string = ""; } -result = Sprintf("%s%s of size %d%s by thread %d", - is_atomic ? "atomic " : "", is_write ? "write" : "read", - size, addr_string.c_str(), thread_id); +if (main_info->GetObjectForDotSeparatedPath("issue_type") +->GetStringValue() == "external-race") { + result = Sprintf("%s access by thread %d", + is_write ? "mutating" : "read-only", thread_id); +} else if (main_info->GetObjectForDotSeparatedPath("issue_type") + ->GetStringValue() == "swift-access-race") { + result = Sprintf("modifying access by thread %d", thread_id); +} else { + result = Sprintf("%s%s of size %d%s by thread %d", + is_atomic ? "atomic " : "", is_write ? "write" : "read", + size, addr_string.c_str(), thread_id); +} } if (path == "th
[Lldb-commits] [lldb] r305589 - Upstreaming the UndefinedBehaviorSanitizerRuntime and MainThreadCheckerRuntime plugins.
Author: kuba.brecka Date: Fri Jun 16 15:59:08 2017 New Revision: 305589 URL: http://llvm.org/viewvc/llvm-project?rev=305589&view=rev Log: Upstreaming the UndefinedBehaviorSanitizerRuntime and MainThreadCheckerRuntime plugins. Added: lldb/trunk/packages/Python/lldbsuite/test/functionalities/ubsan/ lldb/trunk/packages/Python/lldbsuite/test/functionalities/ubsan/basic/ lldb/trunk/packages/Python/lldbsuite/test/functionalities/ubsan/basic/Makefile lldb/trunk/packages/Python/lldbsuite/test/functionalities/ubsan/basic/TestUbsanBasic.py lldb/trunk/packages/Python/lldbsuite/test/functionalities/ubsan/basic/main.c lldb/trunk/source/Plugins/InstrumentationRuntime/MainThreadChecker/ lldb/trunk/source/Plugins/InstrumentationRuntime/MainThreadChecker/CMakeLists.txt lldb/trunk/source/Plugins/InstrumentationRuntime/MainThreadChecker/MainThreadCheckerRuntime.cpp lldb/trunk/source/Plugins/InstrumentationRuntime/MainThreadChecker/MainThreadCheckerRuntime.h lldb/trunk/source/Plugins/InstrumentationRuntime/UndefinedBehaviorSanitizer/ lldb/trunk/source/Plugins/InstrumentationRuntime/UndefinedBehaviorSanitizer/CMakeLists.txt lldb/trunk/source/Plugins/InstrumentationRuntime/UndefinedBehaviorSanitizer/UndefinedBehaviorSanitizerRuntime.cpp lldb/trunk/source/Plugins/InstrumentationRuntime/UndefinedBehaviorSanitizer/UndefinedBehaviorSanitizerRuntime.h Modified: lldb/trunk/include/lldb/lldb-enumerations.h lldb/trunk/lldb.xcodeproj/project.pbxproj lldb/trunk/packages/Python/lldbsuite/test/decorators.py lldb/trunk/source/API/SBThread.cpp lldb/trunk/source/API/SystemInitializerFull.cpp lldb/trunk/source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.cpp lldb/trunk/source/Plugins/InstrumentationRuntime/CMakeLists.txt lldb/trunk/source/Plugins/InstrumentationRuntime/ThreadSanitizer/ThreadSanitizerRuntime.cpp Modified: lldb/trunk/include/lldb/lldb-enumerations.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-enumerations.h?rev=305589&r1=305588&r2=305589&view=diff == --- lldb/trunk/include/lldb/lldb-enumerations.h (original) +++ lldb/trunk/include/lldb/lldb-enumerations.h Fri Jun 16 15:59:08 2017 @@ -454,6 +454,8 @@ enum LanguageType { enum InstrumentationRuntimeType { eInstrumentationRuntimeTypeAddressSanitizer = 0x, eInstrumentationRuntimeTypeThreadSanitizer = 0x0001, + eInstrumentationRuntimeTypeUndefinedBehaviorSanitizer = 0x0002, + eInstrumentationRuntimeTypeMainThreadChecker = 0x0003, eNumInstrumentationRuntimeTypes }; Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=305589&r1=305588&r2=305589&view=diff == --- lldb/trunk/lldb.xcodeproj/project.pbxproj (original) +++ lldb/trunk/lldb.xcodeproj/project.pbxproj Fri Jun 16 15:59:08 2017 @@ -744,6 +744,7 @@ 4CF3D80C15AF4DC800845BF3 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EDB919B414F6F10D008FF64B /* Security.framework */; }; 4CF52AF51428291E0051E832 /* SBFileSpecList.h in Headers */ = {isa = PBXBuildFile; fileRef = 4CF52AF41428291E0051E832 /* SBFileSpecList.h */; settings = {ATTRIBUTES = (Public, ); }; }; 4CF52AF8142829390051E832 /* SBFileSpecList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4CF52AF7142829390051E832 /* SBFileSpecList.cpp */; }; + 54067BF11DF2041B00749AA5 /* UndefinedBehaviorSanitizerRuntime.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 54067BEC1DF2034B00749AA5 /* UndefinedBehaviorSanitizerRuntime.cpp */; }; 6D0F61431C80AAAE00A4ECEE /* JavaASTContext.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6D0F61411C8000A4ECEE /* JavaASTContext.cpp */; }; 6D0F61481C80AAD600A4ECEE /* DWARFASTParserJava.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6D0F61441C80AACF00A4ECEE /* DWARFASTParserJava.cpp */; }; 6D0F614E1C80AB0700A4ECEE /* JavaLanguageRuntime.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6D0F614A1C80AB0400A4ECEE /* JavaLanguageRuntime.cpp */; }; @@ -766,6 +767,7 @@ 8C26C4261C3EA5F90031DF7C /* ThreadSanitizerRuntime.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8C26C4241C3EA4340031DF7C /* ThreadSanitizerRuntime.cpp */; }; 8C2D6A53197A1EAF006989C9 /* MemoryHistory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8C2D6A52197A1EAF006989C9 /* MemoryHistory.cpp */; }; 8C2D6A5E197A250F006989C9 /* MemoryHistoryASan.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8C2D6A5A197A1FDC006989C9 /* MemoryHistoryASan.cpp */; }; + 8C3BD9961EF45DA50016C343 /* MainThreadCheckerRuntime.cpp in Sources */ = {isa = PBXBuildFile; fileRef =
[Lldb-commits] [lldb] r305594 - Fix the CMake files for the new InstrumentationRuntime plugins.
Author: kuba.brecka Date: Fri Jun 16 16:18:28 2017 New Revision: 305594 URL: http://llvm.org/viewvc/llvm-project?rev=305594&view=rev Log: Fix the CMake files for the new InstrumentationRuntime plugins. Modified: lldb/trunk/source/Plugins/InstrumentationRuntime/MainThreadChecker/CMakeLists.txt lldb/trunk/source/Plugins/InstrumentationRuntime/UndefinedBehaviorSanitizer/CMakeLists.txt Modified: lldb/trunk/source/Plugins/InstrumentationRuntime/MainThreadChecker/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/InstrumentationRuntime/MainThreadChecker/CMakeLists.txt?rev=305594&r1=305593&r2=305594&view=diff == --- lldb/trunk/source/Plugins/InstrumentationRuntime/MainThreadChecker/CMakeLists.txt (original) +++ lldb/trunk/source/Plugins/InstrumentationRuntime/MainThreadChecker/CMakeLists.txt Fri Jun 16 16:18:28 2017 @@ -1,3 +1,13 @@ -add_lldb_library(lldbPluginInstrumentationRuntimeMainThreadChecker +add_lldb_library(lldbPluginInstrumentationRuntimeMainThreadChecker PLUGIN MainThreadCheckerRuntime.cpp + + LINK_LIBS +lldbBreakpoint +lldbCore +lldbExpression +lldbInterpreter +lldbSymbol +lldbTarget + LINK_COMPONENTS +Support ) Modified: lldb/trunk/source/Plugins/InstrumentationRuntime/UndefinedBehaviorSanitizer/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/InstrumentationRuntime/UndefinedBehaviorSanitizer/CMakeLists.txt?rev=305594&r1=305593&r2=305594&view=diff == --- lldb/trunk/source/Plugins/InstrumentationRuntime/UndefinedBehaviorSanitizer/CMakeLists.txt (original) +++ lldb/trunk/source/Plugins/InstrumentationRuntime/UndefinedBehaviorSanitizer/CMakeLists.txt Fri Jun 16 16:18:28 2017 @@ -1,3 +1,13 @@ -add_lldb_library(lldbPluginInstrumentationRuntimeUndefinedBehaviorSanitizer +add_lldb_library(lldbPluginInstrumentationRuntimeUndefinedBehaviorSanitizer PLUGIN UndefinedBehaviorSanitizerRuntime.cpp + + LINK_LIBS +lldbBreakpoint +lldbCore +lldbExpression +lldbInterpreter +lldbSymbol +lldbTarget + LINK_COMPONENTS +Support ) ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r306469 - Upstream the 'eInstrumentationRuntimeTypeSwiftRuntimeReporting' value of the 'eInstrumentationRuntimeType' enum from the swift-lldb project (to avoid potential clashes)
Author: kuba.brecka Date: Tue Jun 27 14:39:15 2017 New Revision: 306469 URL: http://llvm.org/viewvc/llvm-project?rev=306469&view=rev Log: Upstream the 'eInstrumentationRuntimeTypeSwiftRuntimeReporting' value of the 'eInstrumentationRuntimeType' enum from the swift-lldb project (to avoid potential clashes). Modified: lldb/trunk/include/lldb/lldb-enumerations.h Modified: lldb/trunk/include/lldb/lldb-enumerations.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-enumerations.h?rev=306469&r1=306468&r2=306469&view=diff == --- lldb/trunk/include/lldb/lldb-enumerations.h (original) +++ lldb/trunk/include/lldb/lldb-enumerations.h Tue Jun 27 14:39:15 2017 @@ -456,6 +456,7 @@ enum InstrumentationRuntimeType { eInstrumentationRuntimeTypeThreadSanitizer = 0x0001, eInstrumentationRuntimeTypeUndefinedBehaviorSanitizer = 0x0002, eInstrumentationRuntimeTypeMainThreadChecker = 0x0003, + eInstrumentationRuntimeTypeSwiftRuntimeReporting = 0x0004, eNumInstrumentationRuntimeTypes }; ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r307170 - [lldb] Add a testcase for MainThreadCheckerRuntime plugin
Author: kuba.brecka Date: Wed Jul 5 09:29:36 2017 New Revision: 307170 URL: http://llvm.org/viewvc/llvm-project?rev=307170&view=rev Log: [lldb] Add a testcase for MainThreadCheckerRuntime plugin This adds a simple testcase for MainThreadCheckerRuntime. The tool (Main Thread Checker) is only available on Darwin, so the test also detects the presence of libMainThreadChecker.dylib and is skipped if the tool is not available. Added: lldb/trunk/packages/Python/lldbsuite/test/functionalities/mtc/ lldb/trunk/packages/Python/lldbsuite/test/functionalities/mtc/simple/ lldb/trunk/packages/Python/lldbsuite/test/functionalities/mtc/simple/Makefile lldb/trunk/packages/Python/lldbsuite/test/functionalities/mtc/simple/TestMTCSimple.py lldb/trunk/packages/Python/lldbsuite/test/functionalities/mtc/simple/main.m Modified: lldb/trunk/packages/Python/lldbsuite/test/lldbplatformutil.py Added: lldb/trunk/packages/Python/lldbsuite/test/functionalities/mtc/simple/Makefile URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/mtc/simple/Makefile?rev=307170&view=auto == --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/mtc/simple/Makefile (added) +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/mtc/simple/Makefile Wed Jul 5 09:29:36 2017 @@ -0,0 +1,6 @@ +LEVEL = ../../../make + +OBJC_SOURCES := main.m +LDFLAGS = $(CFLAGS) -lobjc -framework Foundation -framework AppKit + +include $(LEVEL)/Makefile.rules Added: lldb/trunk/packages/Python/lldbsuite/test/functionalities/mtc/simple/TestMTCSimple.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/mtc/simple/TestMTCSimple.py?rev=307170&view=auto == --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/mtc/simple/TestMTCSimple.py (added) +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/mtc/simple/TestMTCSimple.py Wed Jul 5 09:29:36 2017 @@ -0,0 +1,57 @@ +""" +Tests basic Main Thread Checker support (detecting a main-thread-only violation). +""" + +import os +import time +import lldb +from lldbsuite.test.lldbtest import * +from lldbsuite.test.decorators import * +import lldbsuite.test.lldbutil as lldbutil +from lldbsuite.test.lldbplatformutil import * +import json + + +class MTCSimpleTestCase(TestBase): + +mydir = TestBase.compute_mydir(__file__) + +@skipUnlessDarwin +def test(self): +self.mtc_dylib_path = findMainThreadCheckerDylib() +if self.mtc_dylib_path == "": +self.skipTest("This test requires libMainThreadChecker.dylib.") + +self.build() +self.mtc_tests() + +def setUp(self): +# Call super's setUp(). +TestBase.setUp(self) + +def mtc_tests(self): +# Load the test +exe = os.path.join(os.getcwd(), "a.out") +self.expect("file " + exe, patterns=["Current executable set to .*a.out"]) + +self.runCmd("env DYLD_INSERT_LIBRARIES=%s" % self.mtc_dylib_path) +self.runCmd("run") + +process = self.dbg.GetSelectedTarget().process +thread = process.GetSelectedThread() +frame = thread.GetSelectedFrame() + +self.expect("thread info", substrs=['stop reason = -[NSView superview] must be called from main thread only']) + +self.expect( +"thread info -s", +substrs=["instrumentation_class", "api_name", "class_name", "selector", "description"]) +self.assertEqual(thread.GetStopReason(), lldb.eStopReasonInstrumentation) +output_lines = self.res.GetOutput().split('\n') +json_line = '\n'.join(output_lines[2:]) +data = json.loads(json_line) +self.assertEqual(data["instrumentation_class"], "MainThreadChecker") +self.assertEqual(data["api_name"], "-[NSView superview]") +self.assertEqual(data["class_name"], "NSView") +self.assertEqual(data["selector"], "superview") +self.assertEqual(data["description"], "-[NSView superview] must be called from main thread only") Added: lldb/trunk/packages/Python/lldbsuite/test/functionalities/mtc/simple/main.m URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/mtc/simple/main.m?rev=307170&view=auto == --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/mtc/simple/main.m (added) +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/mtc/simple/main.m Wed Jul 5 09:29:36 2017 @@ -0,0 +1,15 @@ +#import +#import + +int main() { + NSView *view = [[NSView alloc] init]; + dispatch_group_t g = dispatch_group_create(); + dispatch_group_enter(g); + [NSThread detachNewThreadWithBlock:^{ +@autoreleasepool { + [view superview]; +} +dispat
[Lldb-commits] [lldb] r307464 - Update message that Main Thread Checker produces.
Author: kuba.brecka Date: Fri Jul 7 22:18:19 2017 New Revision: 307464 URL: http://llvm.org/viewvc/llvm-project?rev=307464&view=rev Log: Update message that Main Thread Checker produces. Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/mtc/simple/TestMTCSimple.py lldb/trunk/source/Plugins/InstrumentationRuntime/MainThreadChecker/MainThreadCheckerRuntime.cpp Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/mtc/simple/TestMTCSimple.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/mtc/simple/TestMTCSimple.py?rev=307464&r1=307463&r2=307464&view=diff == --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/mtc/simple/TestMTCSimple.py (original) +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/mtc/simple/TestMTCSimple.py Fri Jul 7 22:18:19 2017 @@ -41,7 +41,7 @@ class MTCSimpleTestCase(TestBase): thread = process.GetSelectedThread() frame = thread.GetSelectedFrame() -self.expect("thread info", substrs=['stop reason = -[NSView superview] must be called from main thread only']) +self.expect("thread info", substrs=['stop reason = -[NSView superview] must be used from main thread only']) self.expect( "thread info -s", @@ -54,4 +54,4 @@ class MTCSimpleTestCase(TestBase): self.assertEqual(data["api_name"], "-[NSView superview]") self.assertEqual(data["class_name"], "NSView") self.assertEqual(data["selector"], "superview") -self.assertEqual(data["description"], "-[NSView superview] must be called from main thread only") +self.assertEqual(data["description"], "-[NSView superview] must be used from main thread only") Modified: lldb/trunk/source/Plugins/InstrumentationRuntime/MainThreadChecker/MainThreadCheckerRuntime.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/InstrumentationRuntime/MainThreadChecker/MainThreadCheckerRuntime.cpp?rev=307464&r1=307463&r2=307464&view=diff == --- lldb/trunk/source/Plugins/InstrumentationRuntime/MainThreadChecker/MainThreadCheckerRuntime.cpp (original) +++ lldb/trunk/source/Plugins/InstrumentationRuntime/MainThreadChecker/MainThreadCheckerRuntime.cpp Fri Jul 7 22:18:19 2017 @@ -141,7 +141,7 @@ MainThreadCheckerRuntime::RetrieveReport d->AddStringItem("class_name", className); d->AddStringItem("selector", selector); d->AddStringItem("description", - apiName + " must be called from main thread only"); + apiName + " must be used from main thread only"); d->AddIntegerItem("tid", thread_sp->GetIndexID()); d->AddItem("trace", trace_sp); return dict_sp; ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r307881 - Upstreaming a patch from Github: When evaluation user expressions, ignore InstrumentationRuntime breakpoints. (#235)
Author: kuba.brecka Date: Wed Jul 12 21:35:27 2017 New Revision: 307881 URL: http://llvm.org/viewvc/llvm-project?rev=307881&view=rev Log: Upstreaming a patch from Github: When evaluation user expressions, ignore InstrumentationRuntime breakpoints. (#235) Added: lldb/trunk/packages/Python/lldbsuite/test/functionalities/ubsan/user-expression/ lldb/trunk/packages/Python/lldbsuite/test/functionalities/ubsan/user-expression/Makefile lldb/trunk/packages/Python/lldbsuite/test/functionalities/ubsan/user-expression/TestUbsanUserExpression.py lldb/trunk/packages/Python/lldbsuite/test/functionalities/ubsan/user-expression/main.c Modified: lldb/trunk/source/Plugins/InstrumentationRuntime/ASan/ASanRuntime.cpp lldb/trunk/source/Plugins/InstrumentationRuntime/MainThreadChecker/MainThreadCheckerRuntime.cpp lldb/trunk/source/Plugins/InstrumentationRuntime/TSan/TSanRuntime.cpp lldb/trunk/source/Plugins/InstrumentationRuntime/UBSan/UBSanRuntime.cpp Added: lldb/trunk/packages/Python/lldbsuite/test/functionalities/ubsan/user-expression/Makefile URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/ubsan/user-expression/Makefile?rev=307881&view=auto == --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/ubsan/user-expression/Makefile (added) +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/ubsan/user-expression/Makefile Wed Jul 12 21:35:27 2017 @@ -0,0 +1,6 @@ +LEVEL = ../../../make + +C_SOURCES := main.c +CFLAGS_EXTRAS := -fsanitize=undefined -g + +include $(LEVEL)/Makefile.rules Added: lldb/trunk/packages/Python/lldbsuite/test/functionalities/ubsan/user-expression/TestUbsanUserExpression.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/ubsan/user-expression/TestUbsanUserExpression.py?rev=307881&view=auto == --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/ubsan/user-expression/TestUbsanUserExpression.py (added) +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/ubsan/user-expression/TestUbsanUserExpression.py Wed Jul 12 21:35:27 2017 @@ -0,0 +1,49 @@ +""" +Test that hitting a UBSan issue while running user expression doesn't break the evaluation. +""" + +import os +import time +import lldb +from lldbsuite.test.lldbtest import * +from lldbsuite.test.decorators import * +import lldbsuite.test.lldbutil as lldbutil +import json + + +class UbsanUserExpressionTestCase(TestBase): + +mydir = TestBase.compute_mydir(__file__) + +@skipUnlessUndefinedBehaviorSanitizer +def test(self): +self.build() +self.ubsan_tests() + +def setUp(self): +# Call super's setUp(). +TestBase.setUp(self) +self.line_breakpoint = line_number('main.c', '// breakpoint line') + +def ubsan_tests(self): +# Load the test +exe = os.path.join(os.getcwd(), "a.out") +self.expect( +"file " + exe, +patterns=["Current executable set to .*a.out"]) + +self.runCmd("breakpoint set -f main.c -l %d" % self.line_breakpoint) + +self.runCmd("run") + +process = self.dbg.GetSelectedTarget().process +thread = process.GetSelectedThread() +frame = thread.GetSelectedFrame() + +self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, +substrs=['stopped', 'stop reason = breakpoint']) + +self.expect("p foo()", substrs=["(int) $0 = 42"]) + +self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, +substrs=['stopped', 'stop reason = breakpoint']) Added: lldb/trunk/packages/Python/lldbsuite/test/functionalities/ubsan/user-expression/main.c URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/ubsan/user-expression/main.c?rev=307881&view=auto == --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/ubsan/user-expression/main.c (added) +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/ubsan/user-expression/main.c Wed Jul 12 21:35:27 2017 @@ -0,0 +1,9 @@ +int foo() { + int data[4]; + int x = *(int *)(((char *)&data[0]) + 2); + return 42; +} + +int main() { + return 0; // breakpoint line +} Modified: lldb/trunk/source/Plugins/InstrumentationRuntime/ASan/ASanRuntime.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/InstrumentationRuntime/ASan/ASanRuntime.cpp?rev=307881&r1=307880&r2=307881&view=diff == --- lldb/trunk/source/Plugins/InstrumentationRuntime/ASan/ASanRuntime.cpp (original) +++ lldb/trunk/source/Plugins/InstrumentationRuntime/ASan/ASanRuntime.cpp Wed Jul 12 21:35:27 2017 @@ -247,12 +247,16 @
[Lldb-commits] [lldb] r311483 - [lldb] Correctly escape newlines and backslashes in the JSON serializer
Author: kuba.brecka Date: Tue Aug 22 11:36:12 2017 New Revision: 311483 URL: http://llvm.org/viewvc/llvm-project?rev=311483&view=rev Log: [lldb] Correctly escape newlines and backslashes in the JSON serializer JSON serializer fails to escape newlines and backslashes. Let's fix that. Differential Revision: https://reviews.llvm.org/D34322 Added: lldb/trunk/unittests/Utility/JSONTest.cpp Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj lldb/trunk/source/Utility/JSON.cpp lldb/trunk/unittests/Utility/CMakeLists.txt Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=311483&r1=311482&r2=311483&view=diff == --- lldb/trunk/lldb.xcodeproj/project.pbxproj (original) +++ lldb/trunk/lldb.xcodeproj/project.pbxproj Tue Aug 22 11:36:12 2017 @@ -768,6 +768,7 @@ 8C26C4261C3EA5F90031DF7C /* TSanRuntime.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8C26C4241C3EA4340031DF7C /* TSanRuntime.cpp */; }; 8C2D6A53197A1EAF006989C9 /* MemoryHistory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8C2D6A52197A1EAF006989C9 /* MemoryHistory.cpp */; }; 8C2D6A5E197A250F006989C9 /* MemoryHistoryASan.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8C2D6A5A197A1FDC006989C9 /* MemoryHistoryASan.cpp */; }; + 8C3BD9A01EF5D1FF0016C343 /* JSONTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8C3BD99F1EF5D1B50016C343 /* JSONTest.cpp */; }; 8C3BD9961EF45DA50016C343 /* MainThreadCheckerRuntime.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8C3BD9951EF45D9B0016C343 /* MainThreadCheckerRuntime.cpp */; }; 8CCB017E19BA28A80009FD44 /* ThreadCollection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8CCB017A19BA283D0009FD44 /* ThreadCollection.cpp */; }; 8CCB018219BA4E270009FD44 /* SBThreadCollection.h in Headers */ = {isa = PBXBuildFile; fileRef = 8CCB018119BA4E210009FD44 /* SBThreadCollection.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -2653,6 +2654,7 @@ 8C2D6A54197A1EBE006989C9 /* MemoryHistory.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = MemoryHistory.h; path = include/lldb/Target/MemoryHistory.h; sourceTree = ""; }; 8C2D6A5A197A1FDC006989C9 /* MemoryHistoryASan.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MemoryHistoryASan.cpp; sourceTree = ""; }; 8C2D6A5B197A1FDC006989C9 /* MemoryHistoryASan.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MemoryHistoryASan.h; sourceTree = ""; }; + 8C3BD99F1EF5D1B50016C343 /* JSONTest.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = JSONTest.cpp; sourceTree = ""; }; 8C3BD9931EF45D9B0016C343 /* MainThreadCheckerRuntime.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MainThreadCheckerRuntime.h; sourceTree = ""; }; 8C3BD9951EF45D9B0016C343 /* MainThreadCheckerRuntime.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = MainThreadCheckerRuntime.cpp; sourceTree = ""; }; 8CCB017A19BA283D0009FD44 /* ThreadCollection.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ThreadCollection.cpp; path = source/Target/ThreadCollection.cpp; sourceTree = ""; }; @@ -3392,6 +3394,7 @@ 23CB15041D66CD9200EDDDE1 /* Inputs */, 2321F9441BDD346100BA9A93 /* StringExtractorTest.cpp */, 2321F9451BDD346100BA9A93 /* TaskPoolTest.cpp */, + 8C3BD99F1EF5D1B50016C343 /* JSONTest.cpp */, 2321F9461BDD346100BA9A93 /* UriParserTest.cpp */, ); path = Utility; @@ -7177,6 +7180,7 @@ 9A2057121F3B824B00F6C293 /* SymbolFileDWARFTests.cpp in Sources */, 9A20573A1F3B8E7E00F6C293 /* MainLoopTest.cpp in Sources */, 23CB15351D66DA9300EDDDE1 /* UriParserTest.cpp in Sources */, + 8C3BD9A01EF5D1FF0016C343 /* JSONTest.cpp in Sources */, 23CB15361D66DA9300EDDDE1 /* FileSpecTest.cpp in Sources */, 23E2E5251D90373D006F38BB /* ArchSpecTest.cpp in Sources */, 9A2057081F3B819100F6C293 /* MemoryRegionInfoTest.cpp in Sources */, Modified: lldb/trunk/source/Utility/JSON.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/JSON.cpp?rev=311483&r1=311482&r2=311483&view=diff ===
[Lldb-commits] [lldb] r311484 - Fixup for r311483: Use correct path to StreamString.h
Author: kuba.brecka Date: Tue Aug 22 12:09:39 2017 New Revision: 311484 URL: http://llvm.org/viewvc/llvm-project?rev=311484&view=rev Log: Fixup for r311483: Use correct path to StreamString.h Modified: lldb/trunk/unittests/Utility/JSONTest.cpp Modified: lldb/trunk/unittests/Utility/JSONTest.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Utility/JSONTest.cpp?rev=311484&r1=311483&r2=311484&view=diff == --- lldb/trunk/unittests/Utility/JSONTest.cpp (original) +++ lldb/trunk/unittests/Utility/JSONTest.cpp Tue Aug 22 12:09:39 2017 @@ -1,7 +1,7 @@ #include "gtest/gtest.h" -#include "lldb/Core/StreamString.h" #include "lldb/Utility/JSON.h" +#include "lldb/Utility/StreamString.h" using namespace lldb_private; ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r353363 - [lldb] Make frame recognizers vend synthesized eValueTypeVariableArgument values
Author: kuba.brecka Date: Wed Feb 6 17:49:10 2019 New Revision: 353363 URL: http://llvm.org/viewvc/llvm-project?rev=353363&view=rev Log: [lldb] Make frame recognizers vend synthesized eValueTypeVariableArgument values Modified: lldb/trunk/include/lldb/Target/StackFrameRecognizer.h lldb/trunk/packages/Python/lldbsuite/test/functionalities/frame-recognizer/TestFrameRecognizer.py lldb/trunk/packages/Python/lldbsuite/test/lang/objc/exceptions/TestObjCExceptions.py lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp lldb/trunk/source/Target/StackFrameRecognizer.cpp Modified: lldb/trunk/include/lldb/Target/StackFrameRecognizer.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/StackFrameRecognizer.h?rev=353363&r1=353362&r2=353363&view=diff == --- lldb/trunk/include/lldb/Target/StackFrameRecognizer.h (original) +++ lldb/trunk/include/lldb/Target/StackFrameRecognizer.h Wed Feb 6 17:49:10 2019 @@ -9,6 +9,7 @@ #ifndef liblldb_StackFrameRecognizer_h_ #define liblldb_StackFrameRecognizer_h_ +#include "lldb/Core/ValueObject.h" #include "lldb/Core/ValueObjectList.h" #include "lldb/Symbol/VariableList.h" #include "lldb/Utility/StructuredData.h" @@ -123,6 +124,42 @@ public: static lldb::RecognizedStackFrameSP RecognizeFrame(lldb::StackFrameSP frame); }; +/// @class ValueObjectRecognizerSynthesizedValue +/// +/// ValueObject subclass that presents the passed ValueObject as a recognized +/// value with the specified ValueType. Frame recognizers should return +/// instances of this class as the returned objects in GetRecognizedArguments(). + +class ValueObjectRecognizerSynthesizedValue : public ValueObject { + public: + static lldb::ValueObjectSP Create(ValueObject &parent, lldb::ValueType type) { +return (new ValueObjectRecognizerSynthesizedValue(parent, type))->GetSP(); + } + ValueObjectRecognizerSynthesizedValue(ValueObject &parent, +lldb::ValueType type) + : ValueObject(parent), m_type(type) { +SetName(parent.GetName()); + } + + uint64_t GetByteSize() override { return m_parent->GetByteSize(); } + lldb::ValueType GetValueType() const override { return m_type; } + bool UpdateValue() override { +if (!m_parent->UpdateValueIfNeeded()) return false; +m_value = m_parent->GetValue(); +return true; + } + size_t CalculateNumChildren(uint32_t max = UINT32_MAX) override { +return m_parent->GetNumChildren(max); + } + CompilerType GetCompilerTypeImpl() override { +return m_parent->GetCompilerType(); + } + bool IsSynthetic() override { return true; } + + private: + lldb::ValueType m_type; +}; + } // namespace lldb_private #endif // liblldb_StackFrameRecognizer_h_ Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/frame-recognizer/TestFrameRecognizer.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/frame-recognizer/TestFrameRecognizer.py?rev=353363&r1=353362&r2=353363&view=diff == --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/frame-recognizer/TestFrameRecognizer.py (original) +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/frame-recognizer/TestFrameRecognizer.py Wed Feb 6 17:49:10 2019 @@ -89,8 +89,10 @@ class FrameRecognizerTestCase(TestBase): self.assertEqual(variables.GetSize(), 2) self.assertEqual(variables.GetValueAtIndex(0).name, "a") self.assertEqual(variables.GetValueAtIndex(0).signed, 42) +self.assertEqual(variables.GetValueAtIndex(0).GetValueType(), lldb.eValueTypeVariableArgument) self.assertEqual(variables.GetValueAtIndex(1).name, "b") self.assertEqual(variables.GetValueAtIndex(1).signed, 56) +self.assertEqual(variables.GetValueAtIndex(1).GetValueType(), lldb.eValueTypeVariableArgument) self.expect("frame recognizer info 0", substrs=['frame 0 is recognized by recognizer.MyFrameRecognizer']) Modified: lldb/trunk/packages/Python/lldbsuite/test/lang/objc/exceptions/TestObjCExceptions.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/objc/exceptions/TestObjCExceptions.py?rev=353363&r1=353362&r2=353363&view=diff == --- lldb/trunk/packages/Python/lldbsuite/test/lang/objc/exceptions/TestObjCExceptions.py (original) +++ lldb/trunk/packages/Python/lldbsuite/test/lang/objc/exceptions/TestObjCExceptions.py Wed Feb 6 17:49:10 2019 @@ -44,6 +44,7 @@ class ObjCExceptionsTestCase(TestBase): self.assertEqual(variables.GetSize(), 1) self.assertEqual(variables.GetValueAtIndex(0).name, "exception") +self.assertEqual(variables.GetValueAtIndex(0).GetValu
[Lldb-commits] [lldb] r358629 - [lldb] Don't filter variable list when doing a lookup by mangled name in SymbolFileDWARF::FindGlobalVariables
Author: kuba.brecka Date: Wed Apr 17 17:15:44 2019 New Revision: 358629 URL: http://llvm.org/viewvc/llvm-project?rev=358629&view=rev Log: [lldb] Don't filter variable list when doing a lookup by mangled name in SymbolFileDWARF::FindGlobalVariables Differential Revision: https://reviews.llvm.org/D60737 Added: lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/global_variables/ lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/global_variables/Makefile lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/global_variables/TestGlobalVariables.py lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/global_variables/main.cpp Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Added: lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/global_variables/Makefile URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/global_variables/Makefile?rev=358629&view=auto == --- lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/global_variables/Makefile (added) +++ lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/global_variables/Makefile Wed Apr 17 17:15:44 2019 @@ -0,0 +1,5 @@ +LEVEL = ../../../make + +CXX_SOURCES := main.cpp + +include $(LEVEL)/Makefile.rules Added: lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/global_variables/TestGlobalVariables.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/global_variables/TestGlobalVariables.py?rev=358629&view=auto == --- lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/global_variables/TestGlobalVariables.py (added) +++ lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/global_variables/TestGlobalVariables.py Wed Apr 17 17:15:44 2019 @@ -0,0 +1,41 @@ +"""Test that C++ global variables can be inspected by name and also their mangled name.""" + +from __future__ import print_function + + +from lldbsuite.test.decorators import * +from lldbsuite.test.lldbtest import * +from lldbsuite.test import lldbutil + + +class GlobalVariablesCppTestCase(TestBase): + +mydir = TestBase.compute_mydir(__file__) + +def setUp(self): +TestBase.setUp(self) +self.source = lldb.SBFileSpec('main.cpp') + +@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24764") +def test(self): +self.build() + +(target, _, _, _) = lldbutil.run_to_source_breakpoint(self, "// Set break point at this line.", self.source) + +# Check that we can access g_file_global_int by its name +self.expect("target variable g_file_global_int", VARIABLES_DISPLAYED_CORRECTLY, +substrs=['42']) +self.expect("target variable abc::g_file_global_int", VARIABLES_DISPLAYED_CORRECTLY, +substrs=['42']) +self.expect("target variable xyz::g_file_global_int", VARIABLES_DISPLAYED_CORRECTLY, +error=True, substrs=['can\'t find global variable']) + +# Check that we can access g_file_global_int by its mangled name +addr = target.EvaluateExpression("&abc::g_file_global_int").GetValueAsUnsigned() +self.assertTrue(addr != 0) +mangled = lldb.SBAddress(addr, target).GetSymbol().GetMangledName() +self.assertTrue(mangled != None) +gv = target.FindFirstGlobalVariable(mangled) +self.assertTrue(gv.IsValid()) +self.assertEqual(gv.GetName(), "abc::g_file_global_int") +self.assertEqual(gv.GetValueAsUnsigned(), 42) Added: lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/global_variables/main.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/global_variables/main.cpp?rev=358629&view=auto == --- lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/global_variables/main.cpp (added) +++ lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/global_variables/main.cpp Wed Apr 17 17:15:44 2019 @@ -0,0 +1,17 @@ +//===-- main.c --*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===--===// +#include + +namespace abc { + int g_file_global_int = 42; +} + +int main (int argc, char const *argv[]) +{ +return abc::g_file_global_int; // Set break point at this line. +} Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp?rev=358629&r1=358628&r2=358629&view=diff ==
[Lldb-commits] [lldb] r288542 - Update test expectations after AddressSanitizer text descriptions changed in r288535.
Author: kuba.brecka Date: Fri Dec 2 16:11:26 2016 New Revision: 288542 URL: http://llvm.org/viewvc/llvm-project?rev=288542&view=rev Log: Update test expectations after AddressSanitizer text descriptions changed in r288535. Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/asan/TestMemoryHistory.py lldb/trunk/packages/Python/lldbsuite/test/functionalities/asan/TestReportData.py Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/asan/TestMemoryHistory.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/asan/TestMemoryHistory.py?rev=288542&r1=288541&r2=288542&view=diff == --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/asan/TestMemoryHistory.py (original) +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/asan/TestMemoryHistory.py Fri Dec 2 16:11:26 2016 @@ -121,7 +121,7 @@ class AsanTestCase(TestBase): "Process should be stopped due to ASan report", substrs=[ 'stopped', -'stop reason = Use of deallocated memory detected']) +'stop reason = Use of deallocated memory']) # make sure the 'memory history' command still works even when we're # generating a report now Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/asan/TestReportData.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/asan/TestReportData.py?rev=288542&r1=288541&r2=288542&view=diff == --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/asan/TestReportData.py (original) +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/asan/TestReportData.py Fri Dec 2 16:11:26 2016 @@ -56,7 +56,7 @@ class AsanTestReportDataCase(TestBase): "Process should be stopped due to ASan report", substrs=[ 'stopped', -'stop reason = Use of deallocated memory detected']) +'stop reason = Use of deallocated memory']) self.assertEqual( self.dbg.GetSelectedTarget().process.GetSelectedThread().GetStopReason(), ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r288535 - Support more report types in AddressSanitizerRuntime.cpp, re-word existing ones.
Author: kuba.brecka Date: Fri Dec 2 15:00:32 2016 New Revision: 288535 URL: http://llvm.org/viewvc/llvm-project?rev=288535&view=rev Log: Support more report types in AddressSanitizerRuntime.cpp, re-word existing ones. In r288065, we added more report types into ASan that will be reported via the debugging API. This patch in LLDB provides human-friendly bug descriptions. This also improves wording on existing bug descriptions. Differential Revision: https://reviews.llvm.org/D27017 Modified: lldb/trunk/source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.cpp Modified: lldb/trunk/source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.cpp?rev=288535&r1=288534&r2=288535&view=diff == --- lldb/trunk/source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.cpp (original) +++ lldb/trunk/source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.cpp Fri Dec 2 15:00:32 2016 @@ -26,6 +26,8 @@ #include "lldb/Target/Target.h" #include "lldb/Target/Thread.h" +#include "llvm/ADT/StringSwitch.h" + using namespace lldb; using namespace lldb_private; @@ -194,32 +196,45 @@ AddressSanitizerRuntime::FormatDescripti ->GetValueForKey("description") ->GetAsString() ->GetValue(); - if (description == "heap-use-after-free") { -return "Use of deallocated memory detected"; - } else if (description == "heap-buffer-overflow") { -return "Heap buffer overflow detected"; - } else if (description == "stack-buffer-underflow") { -return "Stack buffer underflow detected"; - } else if (description == "initialization-order-fiasco") { -return "Initialization order problem detected"; - } else if (description == "stack-buffer-overflow") { -return "Stack buffer overflow detected"; - } else if (description == "stack-use-after-return") { -return "Use of returned stack memory detected"; - } else if (description == "use-after-poison") { -return "Use of poisoned memory detected"; - } else if (description == "container-overflow") { -return "Container overflow detected"; - } else if (description == "stack-use-after-scope") { -return "Use of out-of-scope stack memory detected"; - } else if (description == "global-buffer-overflow") { -return "Global buffer overflow detected"; - } else if (description == "unknown-crash") { -return "Invalid memory access detected"; - } - - // for unknown report codes just show the code - return description; + return llvm::StringSwitch(description) + .Case("heap-use-after-free", "Use of deallocated memory") + .Case("heap-buffer-overflow", "Heap buffer overflow") + .Case("stack-buffer-underflow", "Stack buffer underflow") + .Case("initialization-order-fiasco", "Initialization order problem") + .Case("stack-buffer-overflow", "Stack buffer overflow") + .Case("stack-use-after-return", "Use of stack memory after return") + .Case("use-after-poison", "Use of poisoned memory") + .Case("container-overflow", "Container overflow") + .Case("stack-use-after-scope", "Use of out-of-scope stack memory") + .Case("global-buffer-overflow", "Global buffer overflow") + .Case("unknown-crash", "Invalid memory access") + .Case("stack-overflow", "Stack space exhausted") + .Case("null-deref", "Dereference of null pointer") + .Case("wild-jump", "Jump to non-executable address") + .Case("wild-addr-write", "Write through wild pointer") + .Case("wild-addr-read", "Read from wild pointer") + .Case("wild-addr", "Access through wild pointer") + .Case("signal", "Deadly signal") + .Case("double-free", "Deallocation of freed memory") + .Case("new-delete-type-mismatch", +"Deallocation size different from allocation size") + .Case("bad-free", "Deallocation of non-allocated memory") + .Case("alloc-dealloc-mismatch", +"Mismatch between allocation and deallocation APIs") + .Case("bad-malloc_usable_size", "Invalid argument to malloc_usable_size") + .Case("bad-__sanitizer_get_allocated_size", +"Invalid argument to __sanitizer_get_allocated_size") + .Case("param-overlap", +"Call to function disallowing overlapping memory ranges") + .Case("negative-size-param", "Negative size used when accessing memory") + .Case("bad-__sanitizer_annotate_contiguous_container", +"Invalid argument to __sanitizer_annotate_contiguous_container") + .Case("odr-violation", "Symbol defined in multiple translation units") + .Case( + "invalid-pointer-pair", + "Comparison or arithmetic on pointers fro
[Lldb-commits] [lldb] r291522 - Stop limiting the number of TSan backtrace size to 8
Author: kuba.brecka Date: Mon Jan 9 19:14:52 2017 New Revision: 291522 URL: http://llvm.org/viewvc/llvm-project?rev=291522&view=rev Log: Stop limiting the number of TSan backtrace size to 8 We currently limit the length of TSan returned backtraces to 8, which is not necessary (and a bug, most likely). Let's remove this. Differential Revision: https://reviews.llvm.org/D28035 Modified: lldb/trunk/source/Plugins/InstrumentationRuntime/ThreadSanitizer/ThreadSanitizerRuntime.cpp Modified: lldb/trunk/source/Plugins/InstrumentationRuntime/ThreadSanitizer/ThreadSanitizerRuntime.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/InstrumentationRuntime/ThreadSanitizer/ThreadSanitizerRuntime.cpp?rev=291522&r1=291521&r2=291522&view=diff == --- lldb/trunk/source/Plugins/InstrumentationRuntime/ThreadSanitizer/ThreadSanitizerRuntime.cpp (original) +++ lldb/trunk/source/Plugins/InstrumentationRuntime/ThreadSanitizer/ThreadSanitizerRuntime.cpp Mon Jan 9 19:14:52 2017 @@ -206,7 +206,8 @@ CreateStackTrace(ValueObjectSP o, StructuredData::Array *trace = new StructuredData::Array(); ValueObjectSP trace_value_object = o->GetValueForExpressionPath(trace_item_name.c_str()); - for (int j = 0; j < 8; j++) { + size_t count = trace_value_object->GetNumChildren(); + for (size_t j = 0; j < count; j++) { addr_t trace_addr = trace_value_object->GetChildAtIndex(j, true)->GetValueAsUnsigned(0); if (trace_addr == 0) ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r295342 - [lldb] Add support for "external" reports in ThreadSanitizer LLDB plugin
Author: kuba.brecka Date: Thu Feb 16 11:42:33 2017 New Revision: 295342 URL: http://llvm.org/viewvc/llvm-project?rev=295342&view=rev Log: [lldb] Add support for "external" reports in ThreadSanitizer LLDB plugin TSan now has the ability to report races on "external" object, i.e. any library class/object that has read-shared write-exclusive threading semantics. The detection and reporting work almost out of the box, but TSan can now provide the type of the object (as a string). This patch implements this into LLDB. Differential Revision: https://reviews.llvm.org/D30024 Modified: lldb/trunk/source/Plugins/InstrumentationRuntime/ThreadSanitizer/ThreadSanitizerRuntime.cpp Modified: lldb/trunk/source/Plugins/InstrumentationRuntime/ThreadSanitizer/ThreadSanitizerRuntime.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/InstrumentationRuntime/ThreadSanitizer/ThreadSanitizerRuntime.cpp?rev=295342&r1=295341&r2=295342&view=diff == --- lldb/trunk/source/Plugins/InstrumentationRuntime/ThreadSanitizer/ThreadSanitizerRuntime.cpp (original) +++ lldb/trunk/source/Plugins/InstrumentationRuntime/ThreadSanitizer/ThreadSanitizerRuntime.cpp Thu Feb 16 11:42:33 2017 @@ -85,6 +85,10 @@ extern "C" int *running, const char **name, int *parent_tid, void **trace, unsigned long trace_size); int __tsan_get_report_unique_tid(void *report, unsigned long idx, int *tid); + +// TODO: dlsym won't work on Windows. +void *dlsym(void* handle, const char* symbol); +int (*ptr__tsan_get_report_loc_object_type)(void *report, unsigned long idx, const char **object_type); } const int REPORT_TRACE_SIZE = 128; @@ -125,6 +129,7 @@ struct data { int fd; int suppressable; void *trace[REPORT_TRACE_SIZE]; +const char *object_type; } locs[REPORT_ARRAY_SIZE]; int mutex_count; @@ -158,6 +163,8 @@ struct data { const char *thread_sanitizer_retrieve_report_data_command = R"( data t = {0}; +ptr__tsan_get_report_loc_object_type = (typeof(ptr__tsan_get_report_loc_object_type))(void *)dlsym((void*)-2 /*RTLD_DEFAULT*/, "__tsan_get_report_loc_object_type"); + t.report = __tsan_get_current_report(); __tsan_get_report_data(t.report, &t.description, &t.report_count, &t.stack_count, &t.mop_count, &t.loc_count, &t.mutex_count, &t.thread_count, &t.unique_tid_count, t.sleep_trace, REPORT_TRACE_SIZE); @@ -177,6 +184,8 @@ if (t.loc_count > REPORT_ARRAY_SIZE) t.l for (int i = 0; i < t.loc_count; i++) { t.locs[i].idx = i; __tsan_get_report_loc(t.report, i, &t.locs[i].type, &t.locs[i].addr, &t.locs[i].start, &t.locs[i].size, &t.locs[i].tid, &t.locs[i].fd, &t.locs[i].suppressable, t.locs[i].trace, REPORT_TRACE_SIZE); +if (ptr__tsan_get_report_loc_object_type) +ptr__tsan_get_report_loc_object_type(t.report, i, &t.locs[i].object_type); } if (t.mutex_count > REPORT_ARRAY_SIZE) t.mutex_count = REPORT_ARRAY_SIZE; @@ -409,6 +418,8 @@ ThreadSanitizerRuntime::RetrieveReportDa o->GetValueForExpressionPath(".suppressable") ->GetValueAsUnsigned(0)); dict->AddItem("trace", StructuredData::ObjectSP(CreateStackTrace(o))); +dict->AddStringItem("object_type", +RetrieveString(o, process_sp, ".object_type")); }); dict->AddItem("locs", StructuredData::ObjectSP(locs)); @@ -511,6 +522,8 @@ ThreadSanitizerRuntime::FormatDescriptio return "Overwrite of errno in a signal handler"; } else if (description == "lock-order-inversion") { return "Lock order inversion (potential deadlock)"; + } else if (description == "external-race") { +return "Race on a library object"; } // for unknown report codes just show the code @@ -634,6 +647,13 @@ ThreadSanitizerRuntime::GenerateSummary( ->GetValueForKey("locs") ->GetAsArray() ->GetItemAtIndex(0); +std::string object_type = loc->GetAsDictionary() + ->GetValueForKey("object_type") + ->GetAsString() + ->GetValue(); +if (!object_type.empty()) { + summary = "Race on " + object_type + " object"; +} addr_t addr = loc->GetAsDictionary() ->GetValueForKey("address") ->GetAsInteger() @@ -726,8 +746,17 @@ std::string ThreadSanitizerRuntime::GetL ->GetValueForKey("size") ->GetAsInteger() ->GetValue(); - result = - Sprintf("Location is a %ld-byte heap object at 0x%llx", size, addr); + std::string object_type = loc->GetAsDictionary() +->