From gclayton at apple.com Mon Feb 6 00:42:51 2012 From: gclayton at apple.com (Greg Clayton) Date: Mon, 06 Feb 2012 06:42:51 -0000 Subject: [Lldb-commits] [lldb] r149858 - in /lldb/trunk: include/lldb/Core/ClangForward.h include/lldb/Symbol/ClangASTContext.h lldb.xcodeproj/xcshareddata/xcschemes/lldb-tool.xcscheme source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h source/Symbol/ClangASTContext.cpp Message-ID: <20120206064252.006792A6C12C@llvm.org> Author: gclayton Date: Mon Feb 6 00:42:51 2012 New Revision: 149858 URL: http://llvm.org/viewvc/llvm-project?rev=149858&view=rev Log: Almost have templatized functions working (templatized classes are already working, but not functions). I need to check on a few things to make sure I am registering everything correctly in the right order and in the right contexts. Modified: lldb/trunk/include/lldb/Core/ClangForward.h lldb/trunk/include/lldb/Symbol/ClangASTContext.h lldb/trunk/lldb.xcodeproj/xcshareddata/xcschemes/lldb-tool.xcscheme lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h lldb/trunk/source/Symbol/ClangASTContext.cpp Modified: lldb/trunk/include/lldb/Core/ClangForward.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ClangForward.h?rev=149858&r1=149857&r2=149858&view=diff ============================================================================== --- lldb/trunk/include/lldb/Core/ClangForward.h (original) +++ lldb/trunk/include/lldb/Core/ClangForward.h Mon Feb 6 00:42:51 2012 @@ -67,6 +67,8 @@ class FloatingLiteral; class FrontendOptions; class FunctionDecl; + class FunctionTemplateDecl; + class FunctionTemplateSpecializationInfo; class GotoStmt; class HeaderSearchOptions; class IdentifierTable; @@ -109,6 +111,7 @@ class TargetOptions; class TemplateArgument; class TemplateDecl; + class TemplateParameterList; class TemplateTemplateParmDecl; class TemplateTypeParmDecl; class TextDiagnosticBuffer; Modified: lldb/trunk/include/lldb/Symbol/ClangASTContext.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/ClangASTContext.h?rev=149858&r1=149857&r2=149858&view=diff ============================================================================== --- lldb/trunk/include/lldb/Symbol/ClangASTContext.h (original) +++ lldb/trunk/include/lldb/Symbol/ClangASTContext.h Mon Feb 6 00:42:51 2012 @@ -342,6 +342,17 @@ llvm::SmallVector args; }; + clang::FunctionTemplateDecl * + CreateFunctionTemplateDecl (clang::DeclContext *decl_ctx, + clang::FunctionDecl *func_decl, + const char *name, + const TemplateParameterInfos &infos); + + void + CreateFunctionTemplateSpecializationInfo (clang::FunctionDecl *func_decl, + clang::FunctionTemplateDecl *Template, + const TemplateParameterInfos &infos); + clang::ClassTemplateDecl * CreateClassTemplateDecl (clang::DeclContext *decl_ctx, lldb::AccessType access_type, Modified: lldb/trunk/lldb.xcodeproj/xcshareddata/xcschemes/lldb-tool.xcscheme URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/xcshareddata/xcschemes/lldb-tool.xcscheme?rev=149858&r1=149857&r2=149858&view=diff ============================================================================== --- lldb/trunk/lldb.xcodeproj/xcshareddata/xcschemes/lldb-tool.xcscheme (original) +++ lldb/trunk/lldb.xcodeproj/xcshareddata/xcschemes/lldb-tool.xcscheme Mon Feb 6 00:42:51 2012 @@ -101,7 +101,7 @@ 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=149858&r1=149857&r2=149858&view=diff ============================================================================== --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original) +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Mon Feb 6 00:42:51 2012 @@ -15,6 +15,7 @@ #include "clang/AST/Decl.h" #include "clang/AST/DeclGroup.h" #include "clang/AST/DeclObjC.h" +#include "clang/AST/DeclTemplate.h" #include "clang/Basic/Builtins.h" #include "clang/Basic/IdentifierTable.h" #include "clang/Basic/LangOptions.h" @@ -733,7 +734,18 @@ if (die->Tag() != DW_TAG_subprogram) return NULL; - if (die->GetDIENamesAndRanges(this, dwarf_cu, name, mangled, func_ranges, decl_file, decl_line, decl_column, call_file, call_line, call_column, &frame_base)) + if (die->GetDIENamesAndRanges (this, + dwarf_cu, + name, + mangled, + func_ranges, + decl_file, + decl_line, + decl_column, + call_file, + call_line, + call_column, + &frame_base)) { // Union of all ranges in the function DIE (if the function is discontiguous) AddressRange func_range; @@ -1181,6 +1193,96 @@ } bool +SymbolFileDWARF::ParseTemplateDIE (DWARFCompileUnit* dwarf_cu, + const DWARFDebugInfoEntry *die, + ClangASTContext::TemplateParameterInfos &template_param_infos) +{ + const dw_tag_t tag = die->Tag(); + + switch (tag) + { + case DW_TAG_template_type_parameter: + case DW_TAG_template_value_parameter: + { + const uint8_t *fixed_form_sizes = DWARFFormValue::GetFixedFormSizesForAddressSize (dwarf_cu->GetAddressByteSize()); + + DWARFDebugInfoEntry::Attributes attributes; + const size_t num_attributes = die->GetAttributes (this, + dwarf_cu, + fixed_form_sizes, + attributes); + const char *name = NULL; + Type *lldb_type = NULL; + clang_type_t clang_type = NULL; + uint64_t uval64 = 0; + bool uval64_valid = false; + if (num_attributes > 0) + { + DWARFFormValue form_value; + for (size_t i=0; iGetClangForwardType(); + } + break; + + case DW_AT_const_value: + if (attributes.ExtractFormValueAtIndex(this, i, form_value)) + { + uval64_valid = true; + uval64 = form_value.Unsigned(); + } + break; + default: + break; + } + } + + if (name && lldb_type && clang_type) + { + bool is_signed = false; + template_param_infos.names.push_back(name); + clang::QualType clang_qual_type (clang::QualType::getFromOpaquePtr (clang_type)); + if (tag == DW_TAG_template_value_parameter && ClangASTContext::IsIntegerType (clang_type, is_signed) && uval64_valid) + { + llvm::APInt apint (lldb_type->GetByteSize() * 8, uval64, is_signed); + template_param_infos.args.push_back (clang::TemplateArgument (llvm::APSInt(apint), clang_qual_type)); + } + else + { + template_param_infos.args.push_back (clang::TemplateArgument (clang_qual_type)); + } + } + else + { + return false; + } + + } + } + return true; + + default: + break; + } + return false; +} + +bool SymbolFileDWARF::ParseTemplateParameterInfos (DWARFCompileUnit* dwarf_cu, const DWARFDebugInfoEntry *parent_die, ClangASTContext::TemplateParameterInfos &template_param_infos) @@ -1202,75 +1304,7 @@ { case DW_TAG_template_type_parameter: case DW_TAG_template_value_parameter: - { - DWARFDebugInfoEntry::Attributes attributes; - const size_t num_attributes = die->GetAttributes (this, - dwarf_cu, - fixed_form_sizes, - attributes); - const char *name = NULL; - Type *lldb_type = NULL; - clang_type_t clang_type = NULL; - uint64_t uval64 = 0; - bool uval64_valid = false; - if (num_attributes > 0) - { - DWARFFormValue form_value; - for (size_t i=0; iGetClangForwardType(); - } - break; - - case DW_AT_const_value: - if (attributes.ExtractFormValueAtIndex(this, i, form_value)) - { - uval64_valid = true; - uval64 = form_value.Unsigned(); - } - break; - default: - break; - } - } - - if (name && lldb_type && clang_type) - { - bool is_signed = false; - template_param_infos.names.push_back(name); - clang::QualType clang_qual_type (clang::QualType::getFromOpaquePtr (clang_type)); - if (tag == DW_TAG_template_value_parameter && ClangASTContext::IsIntegerType (clang_type, is_signed) && uval64_valid) - { - llvm::APInt apint (lldb_type->GetByteSize() * 8, uval64, is_signed); - template_param_infos.args.push_back (clang::TemplateArgument (llvm::APSInt(apint), clang_qual_type)); - } - else - { - template_param_infos.args.push_back (clang::TemplateArgument (clang_qual_type)); - } - } - else - { - return false; - } - - } - } + ParseTemplateDIE (dwarf_cu, die, template_param_infos); break; default: @@ -3329,7 +3363,8 @@ TypeList* type_list, std::vector& function_param_types, std::vector& function_param_decls, - unsigned &type_quals) + unsigned &type_quals, + ClangASTContext::TemplateParameterInfos &template_param_infos) { if (parent_die == NULL) return 0; @@ -3466,6 +3501,11 @@ } break; + case DW_TAG_template_type_parameter: + case DW_TAG_template_value_parameter: + ParseTemplateDIE (dwarf_cu, die,template_param_infos); + break; + default: break; } @@ -5089,7 +5129,8 @@ // if we find a "this" paramters as the first parameter if (is_cxx_method) is_static = true; - + ClangASTContext::TemplateParameterInfos template_param_infos; + if (die->HasChildren()) { bool skip_artificial = true; @@ -5102,7 +5143,8 @@ type_list, function_param_types, function_param_decls, - type_quals); + type_quals, + template_param_infos); } // clang_type will get the function prototype clang type after this call @@ -5301,7 +5343,18 @@ clang_type, storage, is_inline); - + +// if (template_param_infos.GetSize() > 0) +// { +// clang::FunctionTemplateDecl *func_template_decl = ast.CreateFunctionTemplateDecl (containing_decl_ctx, +// function_decl, +// type_name_cstr, +// template_param_infos); +// +// ast.CreateFunctionTemplateSpecializationInfo (function_decl, +// func_template_decl, +// template_param_infos); +// } // Add the decl to our DIE to decl context map assert (function_decl); LinkDeclContextToDIE(function_decl, die); Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h?rev=149858&r1=149857&r2=149858&view=diff ============================================================================== --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h (original) +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h Mon Feb 6 00:42:51 2012 @@ -354,7 +354,8 @@ lldb_private::TypeList* type_list, std::vector& function_args, std::vector& function_param_decls, - unsigned &type_quals); + unsigned &type_quals, + lldb_private::ClangASTContext::TemplateParameterInfos &template_param_infos); size_t ParseChildEnumerators( const lldb_private::SymbolContext& sc, @@ -496,6 +497,11 @@ const DWARFDebugInfoEntry *parent_die, lldb_private::ClangASTContext::TemplateParameterInfos &template_param_infos); + bool + ParseTemplateDIE (DWARFCompileUnit* dwarf_cu, + const DWARFDebugInfoEntry *die, + lldb_private::ClangASTContext::TemplateParameterInfos &template_param_infos); + clang::ClassTemplateDecl * ParseClassTemplateDecl (clang::DeclContext *decl_ctx, lldb::AccessType access_type, Modified: lldb/trunk/source/Symbol/ClangASTContext.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTContext.cpp?rev=149858&r1=149857&r2=149858&view=diff ============================================================================== --- lldb/trunk/source/Symbol/ClangASTContext.cpp (original) +++ lldb/trunk/source/Symbol/ClangASTContext.cpp Mon Feb 6 00:42:51 2012 @@ -1140,31 +1140,11 @@ return ast->getTagDeclType(decl).getAsOpaquePtr(); } -ClassTemplateDecl * -ClangASTContext::CreateClassTemplateDecl (DeclContext *decl_ctx, - lldb::AccessType access_type, - const char *class_name, - int kind, - const TemplateParameterInfos &template_param_infos) +static TemplateParameterList * +CreateTemplateParameterList (ASTContext *ast, + const ClangASTContext::TemplateParameterInfos &template_param_infos, + llvm::SmallVector &template_param_decls) { - ASTContext *ast = getASTContext(); - - ClassTemplateDecl *class_template_decl = NULL; - if (decl_ctx == NULL) - decl_ctx = ast->getTranslationUnitDecl(); - - IdentifierInfo &identifier_info = ast->Idents.get(class_name); - DeclarationName decl_name (&identifier_info); - - clang::DeclContext::lookup_result result = decl_ctx->lookup(decl_name); - for (clang::DeclContext::lookup_iterator pos = result.first, end = result.second; pos != end; ++pos) - { - class_template_decl = dyn_cast(*pos); - if (class_template_decl) - return class_template_decl; - } - - llvm::SmallVector template_param_decls; const bool parameter_pack = false; const bool is_typename = false; const unsigned depth = 0; @@ -1184,7 +1164,7 @@ template_param_infos.args[i].getIntegralType(), parameter_pack, NULL)); - + } else { @@ -1199,14 +1179,92 @@ parameter_pack)); } } + + TemplateParameterList *template_param_list = TemplateParameterList::Create (*ast, + SourceLocation(), + SourceLocation(), + &template_param_decls.front(), + template_param_decls.size(), + SourceLocation()); + return template_param_list; +} + +clang::FunctionTemplateDecl * +ClangASTContext::CreateFunctionTemplateDecl (clang::DeclContext *decl_ctx, + clang::FunctionDecl *func_decl, + const char *name, + const TemplateParameterInfos &template_param_infos) +{ +// /// \brief Create a function template node. + ASTContext *ast = getASTContext(); + + llvm::SmallVector template_param_decls; + + TemplateParameterList *template_param_list = CreateTemplateParameterList (ast, + template_param_infos, + template_param_decls); + FunctionTemplateDecl *func_tmpl_decl = FunctionTemplateDecl::Create (*ast, + decl_ctx, + func_decl->getLocation(), + func_decl->getDeclName(), + template_param_list, + func_decl); - TemplateParameterList *template_param_list = TemplateParameterList::Create (*ast, - SourceLocation(), - SourceLocation(), - &template_param_decls.front(), - template_param_decls.size(), - SourceLocation()); + for (size_t i=0, template_param_decl_count = template_param_decls.size(); + i < template_param_decl_count; + ++i) + { + // TODO: verify which decl context we should put template_param_decls into.. + template_param_decls[i]->setDeclContext (func_decl); + } + + return func_tmpl_decl; +} + +void +ClangASTContext::CreateFunctionTemplateSpecializationInfo (FunctionDecl *func_decl, + clang::FunctionTemplateDecl *func_tmpl_decl, + const TemplateParameterInfos &infos) +{ + TemplateArgumentList template_args (TemplateArgumentList::OnStack, + infos.args.data(), + infos.args.size()); + + func_decl->setFunctionTemplateSpecialization (func_tmpl_decl, + &template_args, + NULL); +} + + +ClassTemplateDecl * +ClangASTContext::CreateClassTemplateDecl (DeclContext *decl_ctx, + lldb::AccessType access_type, + const char *class_name, + int kind, + const TemplateParameterInfos &template_param_infos) +{ + ASTContext *ast = getASTContext(); + + ClassTemplateDecl *class_template_decl = NULL; + if (decl_ctx == NULL) + decl_ctx = ast->getTranslationUnitDecl(); + + IdentifierInfo &identifier_info = ast->Idents.get(class_name); + DeclarationName decl_name (&identifier_info); + + clang::DeclContext::lookup_result result = decl_ctx->lookup(decl_name); + for (clang::DeclContext::lookup_iterator pos = result.first, end = result.second; pos != end; ++pos) + { + class_template_decl = dyn_cast(*pos); + if (class_template_decl) + return class_template_decl; + } + + llvm::SmallVector template_param_decls; + TemplateParameterList *template_param_list = CreateTemplateParameterList (ast, + template_param_infos, + template_param_decls); CXXRecordDecl *template_cxx_decl = CXXRecordDecl::Create (*ast, (TagDecl::TagKind)kind, From johnny.chen at apple.com Mon Feb 6 13:14:44 2012 From: johnny.chen at apple.com (Johnny Chen) Date: Mon, 06 Feb 2012 19:14:44 -0000 Subject: [Lldb-commits] [lldb] r149891 - in /lldb/trunk/test/lang/cpp/dynamic-value: TestCppValueCast.py sbvalue-cast.cpp Message-ID: <20120206191444.DB9DE2A6C12C@llvm.org> Author: johnny Date: Mon Feb 6 13:14:44 2012 New Revision: 149891 URL: http://llvm.org/viewvc/llvm-project?rev=149891&view=rev Log: Add regular C++ inheritance in addition to the virtual inheritance to TestCppValueCast.py. Plus mark the virtual inheritance test cases as expected failures. Modified: lldb/trunk/test/lang/cpp/dynamic-value/TestCppValueCast.py lldb/trunk/test/lang/cpp/dynamic-value/sbvalue-cast.cpp Modified: lldb/trunk/test/lang/cpp/dynamic-value/TestCppValueCast.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/cpp/dynamic-value/TestCppValueCast.py?rev=149891&r1=149890&r2=149891&view=diff ============================================================================== --- lldb/trunk/test/lang/cpp/dynamic-value/TestCppValueCast.py (original) +++ lldb/trunk/test/lang/cpp/dynamic-value/TestCppValueCast.py Mon Feb 6 13:14:44 2012 @@ -12,17 +12,34 @@ mydir = os.path.join("lang", "cpp", "dynamic-value") + # rdar://problem/10808472 SBValue::Cast test case is failing (virtual inheritance) + @unittest2.expectedFailure @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin") @python_api_test - def test_value_cast_with_dsym(self): - """Test SBValue::Cast(SBType) API for C++ types.""" - self.buildDsym(dictionary=self.d) + def test_value_cast_with_dsym_and_virtual_inheritance(self): + """Test SBValue::Cast(SBType) API for C++ types with virtual inheritance.""" + self.buildDsym(dictionary=self.d_virtual) self.do_sbvalue_cast(self.exe_name) + # rdar://problem/10808472 SBValue::Cast test case is failing (virtual inheritance) + @unittest2.expectedFailure @python_api_test - def test_get_dynamic_vals_with_dwarf(self): - """Test SBValue::Cast(SBType) API for C++ types.""" - self.buildDwarf(dictionary=self.d) + def test_value_cast_with_dwarf_and_virtual_inheritance(self): + """Test SBValue::Cast(SBType) API for C++ types with virtual inheritance.""" + self.buildDwarf(dictionary=self.d_virtual) + self.do_sbvalue_cast(self.exe_name) + + @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin") + @python_api_test + def test_value_cast_with_dsym_and_regular_inheritance(self): + """Test SBValue::Cast(SBType) API for C++ types with regular inheritance.""" + self.buildDsym(dictionary=self.d_regular) + self.do_sbvalue_cast(self.exe_name) + + @python_api_test + def test_value_cast_with_dwarf_and_regular_inheritance(self): + """Test SBValue::Cast(SBType) API for C++ types with regular inheritance.""" + self.buildDwarf(dictionary=self.d_regular) self.do_sbvalue_cast(self.exe_name) def setUp(self): @@ -33,7 +50,8 @@ self.source = 'sbvalue-cast.cpp'; self.line = line_number(self.source, '// Set breakpoint here.') self.exe_name = self.testMethodName - self.d = {'CXX_SOURCES': self.source, 'EXE': self.exe_name} + self.d_virtual = {'CXX_SOURCES': self.source, 'EXE': self.exe_name, 'CFLAGS_EXTRAS': '-DVIRTUAL=YES'} + self.d_regular = {'CXX_SOURCES': self.source, 'EXE': self.exe_name} def do_sbvalue_cast (self, exe_name): """Test SBValue::Cast(SBType) API for C++ types.""" @@ -83,13 +101,14 @@ instanceA = tellerA.Cast(typeA.GetPointerType()) self.DebugSBValue(instanceA) - # These outputs don't look correct? + # Iterate through all the children and print their values. if self.TraceOn(): for child in instanceA: print "child name:", child.GetName() print child a_member_val = instanceA.GetChildMemberWithName('m_a_val') self.DebugSBValue(a_member_val) + self.assertTrue(a_member_val.GetValueAsUnsigned(error, 0) == 10) # Second stop is for DerivedB instance. threads = lldbutil.continue_to_breakpoint (process, breakpoint) @@ -110,13 +129,14 @@ instanceB = tellerB.Cast(typeB.GetPointerType()) self.DebugSBValue(instanceB) - # These outputs don't look correct? + # Iterate through all the children and print their values. if self.TraceOn(): for child in instanceB: print "child name:", child.GetName() print child b_member_val = instanceB.GetChildMemberWithName('m_b_val') self.DebugSBValue(b_member_val) + self.assertTrue(b_member_val.GetValueAsUnsigned(error, 0) == 36) if __name__ == '__main__': Modified: lldb/trunk/test/lang/cpp/dynamic-value/sbvalue-cast.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/cpp/dynamic-value/sbvalue-cast.cpp?rev=149891&r1=149890&r2=149891&view=diff ============================================================================== --- lldb/trunk/test/lang/cpp/dynamic-value/sbvalue-cast.cpp (original) +++ lldb/trunk/test/lang/cpp/dynamic-value/sbvalue-cast.cpp Mon Feb 6 13:14:44 2012 @@ -6,6 +6,12 @@ // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// +#ifdef VIRTUAL +#define VIRTUAL virtual +#else +#define VIRTUAL +#endif + #include class Base @@ -24,7 +30,7 @@ int m_base_val; }; -class DerivedA : public virtual Base +class DerivedA : public VIRTUAL Base { public: DerivedA(int val) : Base(val*2), m_a_val(val) { @@ -38,7 +44,7 @@ int m_a_val; }; -class DerivedB : public virtual Base +class DerivedB : public VIRTUAL Base { public: DerivedB(int val) : Base(val), m_b_val(val*3) { From johnny.chen at apple.com Mon Feb 6 13:36:30 2012 From: johnny.chen at apple.com (Johnny Chen) Date: Mon, 06 Feb 2012 19:36:30 -0000 Subject: [Lldb-commits] [lldb] r149893 - /lldb/trunk/test/python_api/sbdata/TestSBData.py Message-ID: <20120206193630.30B222A6C12C@llvm.org> Author: johnny Date: Mon Feb 6 13:36:29 2012 New Revision: 149893 URL: http://llvm.org/viewvc/llvm-project?rev=149893&view=rev Log: Print out the frame only if self.TraceOn() is True. Modified: lldb/trunk/test/python_api/sbdata/TestSBData.py Modified: lldb/trunk/test/python_api/sbdata/TestSBData.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/sbdata/TestSBData.py?rev=149893&r1=149892&r2=149893&view=diff ============================================================================== --- lldb/trunk/test/python_api/sbdata/TestSBData.py (original) +++ lldb/trunk/test/python_api/sbdata/TestSBData.py Mon Feb 6 13:36:29 2012 @@ -53,7 +53,8 @@ thread = process.GetThreadAtIndex(0) frame = thread.GetSelectedFrame() - print frame + if self.TraceOn(): + print frame foobar = frame.FindVariable('foobar') self.assertTrue(foobar.IsValid()) if self.TraceOn(): From johnny.chen at apple.com Mon Feb 6 15:07:21 2012 From: johnny.chen at apple.com (Johnny Chen) Date: Mon, 06 Feb 2012 21:07:21 -0000 Subject: [Lldb-commits] [lldb] r149899 - /lldb/trunk/test/functionalities/process_launch/TestProcessLaunch.py Message-ID: <20120206210721.BB8D52A6C12C@llvm.org> Author: johnny Date: Mon Feb 6 15:07:21 2012 New Revision: 149899 URL: http://llvm.org/viewvc/llvm-project?rev=149899&view=rev Log: Fix a typo in specifying the error path when launching the inferior. Modified: lldb/trunk/test/functionalities/process_launch/TestProcessLaunch.py Modified: lldb/trunk/test/functionalities/process_launch/TestProcessLaunch.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/process_launch/TestProcessLaunch.py?rev=149899&r1=149898&r2=149899&view=diff ============================================================================== --- lldb/trunk/test/functionalities/process_launch/TestProcessLaunch.py (original) +++ lldb/trunk/test/functionalities/process_launch/TestProcessLaunch.py Mon Feb 6 15:07:21 2012 @@ -135,9 +135,9 @@ except OSError: pass - launch_command = "process launch -w %s -o %s -e %sl" % (my_working_dir_path, - out_file_path, - err_file_path) + launch_command = "process launch -w %s -o %s -e %s" % (my_working_dir_path, + out_file_path, + err_file_path) self.expect(launch_command, patterns = [ "Process .* launched: .*a.out" ]) From johnny.chen at apple.com Mon Feb 6 15:11:17 2012 From: johnny.chen at apple.com (Johnny Chen) Date: Mon, 06 Feb 2012 21:11:17 -0000 Subject: [Lldb-commits] [lldb] r149900 - /lldb/trunk/test/lang/cpp/dynamic-value/TestCppValueCast.py Message-ID: <20120206211117.B1AE92A6C12C@llvm.org> Author: johnny Date: Mon Feb 6 15:11:17 2012 New Revision: 149900 URL: http://llvm.org/viewvc/llvm-project?rev=149900&view=rev Log: Special build dictionary needs the same dictionary when specifying the after-the-test cleanup. Modified: lldb/trunk/test/lang/cpp/dynamic-value/TestCppValueCast.py Modified: lldb/trunk/test/lang/cpp/dynamic-value/TestCppValueCast.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/cpp/dynamic-value/TestCppValueCast.py?rev=149900&r1=149899&r2=149900&view=diff ============================================================================== --- lldb/trunk/test/lang/cpp/dynamic-value/TestCppValueCast.py (original) +++ lldb/trunk/test/lang/cpp/dynamic-value/TestCppValueCast.py Mon Feb 6 15:11:17 2012 @@ -19,6 +19,7 @@ def test_value_cast_with_dsym_and_virtual_inheritance(self): """Test SBValue::Cast(SBType) API for C++ types with virtual inheritance.""" self.buildDsym(dictionary=self.d_virtual) + self.setTearDownCleanup(dictionary=self.d_virtual) self.do_sbvalue_cast(self.exe_name) # rdar://problem/10808472 SBValue::Cast test case is failing (virtual inheritance) @@ -27,6 +28,7 @@ def test_value_cast_with_dwarf_and_virtual_inheritance(self): """Test SBValue::Cast(SBType) API for C++ types with virtual inheritance.""" self.buildDwarf(dictionary=self.d_virtual) + self.setTearDownCleanup(dictionary=self.d_virtual) self.do_sbvalue_cast(self.exe_name) @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin") @@ -34,12 +36,14 @@ def test_value_cast_with_dsym_and_regular_inheritance(self): """Test SBValue::Cast(SBType) API for C++ types with regular inheritance.""" self.buildDsym(dictionary=self.d_regular) + self.setTearDownCleanup(dictionary=self.d_regular) self.do_sbvalue_cast(self.exe_name) @python_api_test def test_value_cast_with_dwarf_and_regular_inheritance(self): """Test SBValue::Cast(SBType) API for C++ types with regular inheritance.""" self.buildDwarf(dictionary=self.d_regular) + self.setTearDownCleanup(dictionary=self.d_regular) self.do_sbvalue_cast(self.exe_name) def setUp(self): From scallanan at apple.com Mon Feb 6 15:28:03 2012 From: scallanan at apple.com (Sean Callanan) Date: Mon, 06 Feb 2012 21:28:03 -0000 Subject: [Lldb-commits] [lldb] r149903 - in /lldb/trunk/source: Expression/ClangASTSource.cpp Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Symbol/ClangASTContext.cpp Message-ID: <20120206212803.ABAFB2A6C12C@llvm.org> Author: spyffe Date: Mon Feb 6 15:28:03 2012 New Revision: 149903 URL: http://llvm.org/viewvc/llvm-project?rev=149903&view=rev Log: I left some stray debugging messages in the source code. Removing these. Modified: lldb/trunk/source/Expression/ClangASTSource.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp lldb/trunk/source/Symbol/ClangASTContext.cpp Modified: lldb/trunk/source/Expression/ClangASTSource.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangASTSource.cpp?rev=149903&r1=149902&r2=149903&view=diff ============================================================================== --- lldb/trunk/source/Expression/ClangASTSource.cpp (original) +++ lldb/trunk/source/Expression/ClangASTSource.cpp Mon Feb 6 15:28:03 2012 @@ -987,9 +987,6 @@ lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS)); - if (!record->getNameAsString().compare("PseudoObjectExprBitfields")) - fprintf(stderr, "THIS IS THE ONE!"); - if (log) { log->Printf("LayoutRecordType[%u] on (RecordDecl*)%p [name = '%s']", 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=149903&r1=149902&r2=149903&view=diff ============================================================================== --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original) +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Mon Feb 6 15:28:03 2012 @@ -1291,8 +1291,6 @@ if (parent_die == NULL) return NULL; - const uint8_t *fixed_form_sizes = DWARFFormValue::GetFixedFormSizesForAddressSize (dwarf_cu->GetAddressByteSize()); - Args template_parameter_names; for (const DWARFDebugInfoEntry *die = parent_die->GetFirstChild(); die != NULL; @@ -5156,9 +5154,6 @@ if (type_name_cstr) { - if (die->GetOffset() == 0xaeaba) - fprintf(stderr, "This is the one!"); - bool type_handled = false; if (tag == DW_TAG_subprogram) { Modified: lldb/trunk/source/Symbol/ClangASTContext.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTContext.cpp?rev=149903&r1=149902&r2=149903&view=diff ============================================================================== --- lldb/trunk/source/Symbol/ClangASTContext.cpp (original) +++ lldb/trunk/source/Symbol/ClangASTContext.cpp Mon Feb 6 15:28:03 2012 @@ -40,6 +40,7 @@ #include "clang/AST/RecordLayout.h" #include "clang/AST/Type.h" #include "clang/Basic/Builtins.h" +#include "clang/Basic/Diagnostic.h" #include "clang/Basic/FileManager.h" #include "clang/Basic/FileSystemOptions.h" #include "clang/Basic/SourceManager.h" From johnny.chen at apple.com Mon Feb 6 16:17:23 2012 From: johnny.chen at apple.com (Johnny Chen) Date: Mon, 06 Feb 2012 22:17:23 -0000 Subject: [Lldb-commits] [lldb] r149917 - /lldb/trunk/source/Commands/CommandObjectFrame.cpp Message-ID: <20120206221723.CBB922A6C12C@llvm.org> Author: johnny Date: Mon Feb 6 16:17:23 2012 New Revision: 149917 URL: http://llvm.org/viewvc/llvm-project?rev=149917&view=rev Log: Add help string for 'frame variable' to link to 'watchpoint set' which allows for using an expression to specify the address to watch for. rdar://problem/10703290 Modified: lldb/trunk/source/Commands/CommandObjectFrame.cpp Modified: lldb/trunk/source/Commands/CommandObjectFrame.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectFrame.cpp?rev=149917&r1=149916&r2=149917&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectFrame.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectFrame.cpp Mon Feb 6 16:17:23 2012 @@ -332,7 +332,9 @@ "Children of aggregate variables can be specified such as " "'var->child.x'. " "You can choose to watch a variable with the '-w' option. " - "Note that hardware resources for watching are often limited.", + "Note that hardware resources for watching are often limited. " + "See alo 'watchpoint set' where you can use an expression to " + "specify the address to watch for.", NULL, eFlagProcessMustBeLaunched | eFlagProcessMustBePaused), m_option_group (interpreter), From gclayton at apple.com Mon Feb 6 18:55:00 2012 From: gclayton at apple.com (Greg Clayton) Date: Tue, 07 Feb 2012 00:55:00 -0000 Subject: [Lldb-commits] [lldb] r149946 - /lldb/tags/lldb-112/ Message-ID: <20120207005500.28F9A2A6C12C@llvm.org> Author: gclayton Date: Mon Feb 6 18:54:59 2012 New Revision: 149946 URL: http://llvm.org/viewvc/llvm-project?rev=149946&view=rev Log: lldb-112 pre-tag copy. Added: lldb/tags/lldb-112/ - copied from r149944, lldb/tags/lldb-111/ From gclayton at apple.com Mon Feb 6 20:12:30 2012 From: gclayton at apple.com (Greg Clayton) Date: Tue, 07 Feb 2012 02:12:30 -0000 Subject: [Lldb-commits] [lldb] r149955 - in /lldb/tags/lldb-112: lldb.xcodeproj/project.pbxproj resources/LLDB-Info.plist tools/debugserver/debugserver.xcodeproj/project.pbxproj Message-ID: <20120207021230.79A9E2A6C12C@llvm.org> Author: gclayton Date: Mon Feb 6 20:12:30 2012 New Revision: 149955 URL: http://llvm.org/viewvc/llvm-project?rev=149955&view=rev Log: Bumping Xcode project versions for lldb-112 and debugserver-170 Modified: lldb/tags/lldb-112/lldb.xcodeproj/project.pbxproj lldb/tags/lldb-112/resources/LLDB-Info.plist lldb/tags/lldb-112/tools/debugserver/debugserver.xcodeproj/project.pbxproj Modified: lldb/tags/lldb-112/lldb.xcodeproj/project.pbxproj URL: http://llvm.org/viewvc/llvm-project/lldb/tags/lldb-112/lldb.xcodeproj/project.pbxproj?rev=149955&r1=149954&r2=149955&view=diff ============================================================================== --- lldb/tags/lldb-112/lldb.xcodeproj/project.pbxproj (original) +++ lldb/tags/lldb-112/lldb.xcodeproj/project.pbxproj Mon Feb 6 20:12:30 2012 @@ -3733,9 +3733,9 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; - CURRENT_PROJECT_VERSION = 110; + CURRENT_PROJECT_VERSION = 112; DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 110; + DYLIB_CURRENT_VERSION = 112; EXPORTED_SYMBOLS_FILE = "resources/lldb-framework-exports"; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -3793,10 +3793,10 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; - CURRENT_PROJECT_VERSION = 110; + CURRENT_PROJECT_VERSION = 112; DEAD_CODE_STRIPPING = YES; DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 110; + DYLIB_CURRENT_VERSION = 112; EXPORTED_SYMBOLS_FILE = "resources/lldb-framework-exports"; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -3852,8 +3852,8 @@ 2689FFD513353D7A00698AC0 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - CURRENT_PROJECT_VERSION = 110; - DYLIB_CURRENT_VERSION = 110; + CURRENT_PROJECT_VERSION = 112; + DYLIB_CURRENT_VERSION = 112; EXECUTABLE_EXTENSION = a; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -3881,8 +3881,8 @@ 2689FFD613353D7A00698AC0 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - CURRENT_PROJECT_VERSION = 110; - DYLIB_CURRENT_VERSION = 110; + CURRENT_PROJECT_VERSION = 112; + DYLIB_CURRENT_VERSION = 112; EXECUTABLE_EXTENSION = a; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -3910,8 +3910,8 @@ 2689FFD713353D7A00698AC0 /* BuildAndIntegration */ = { isa = XCBuildConfiguration; buildSettings = { - CURRENT_PROJECT_VERSION = 110; - DYLIB_CURRENT_VERSION = 110; + CURRENT_PROJECT_VERSION = 112; + DYLIB_CURRENT_VERSION = 112; EXECUTABLE_EXTENSION = a; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -3991,7 +3991,7 @@ isa = XCBuildConfiguration; buildSettings = { COPY_PHASE_STRIP = YES; - CURRENT_PROJECT_VERSION = 110; + CURRENT_PROJECT_VERSION = 112; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "\"$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks\"", @@ -4022,10 +4022,10 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; COPY_PHASE_STRIP = YES; - CURRENT_PROJECT_VERSION = 110; + CURRENT_PROJECT_VERSION = 112; DEAD_CODE_STRIPPING = YES; DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 110; + DYLIB_CURRENT_VERSION = 112; EXPORTED_SYMBOLS_FILE = "resources/lldb-framework-exports"; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -4263,7 +4263,7 @@ 26F5C26C10F3D9A5009D5894 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - CURRENT_PROJECT_VERSION = 110; + CURRENT_PROJECT_VERSION = 112; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "\"$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks\"", @@ -4293,7 +4293,7 @@ 26F5C26D10F3D9A5009D5894 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - CURRENT_PROJECT_VERSION = 110; + CURRENT_PROJECT_VERSION = 112; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "\"$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks\"", Modified: lldb/tags/lldb-112/resources/LLDB-Info.plist URL: http://llvm.org/viewvc/llvm-project/lldb/tags/lldb-112/resources/LLDB-Info.plist?rev=149955&r1=149954&r2=149955&view=diff ============================================================================== --- lldb/tags/lldb-112/resources/LLDB-Info.plist (original) +++ lldb/tags/lldb-112/resources/LLDB-Info.plist Mon Feb 6 20:12:30 2012 @@ -17,7 +17,7 @@ CFBundleSignature ???? CFBundleVersion - 110 + 112 CFBundleName ${EXECUTABLE_NAME} Modified: lldb/tags/lldb-112/tools/debugserver/debugserver.xcodeproj/project.pbxproj URL: http://llvm.org/viewvc/llvm-project/lldb/tags/lldb-112/tools/debugserver/debugserver.xcodeproj/project.pbxproj?rev=149955&r1=149954&r2=149955&view=diff ============================================================================== --- lldb/tags/lldb-112/tools/debugserver/debugserver.xcodeproj/project.pbxproj (original) +++ lldb/tags/lldb-112/tools/debugserver/debugserver.xcodeproj/project.pbxproj Mon Feb 6 20:12:30 2012 @@ -475,7 +475,7 @@ i386, ); COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 168; + CURRENT_PROJECT_VERSION = 170; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; SDKROOT = ""; @@ -494,7 +494,7 @@ x86_64, i386, ); - CURRENT_PROJECT_VERSION = 168; + CURRENT_PROJECT_VERSION = 170; DEAD_CODE_STRIPPING = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; @@ -515,7 +515,7 @@ x86_64, i386, ); - CURRENT_PROJECT_VERSION = 168; + CURRENT_PROJECT_VERSION = 170; DEAD_CODE_STRIPPING = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; @@ -534,7 +534,7 @@ "ARCHS[sdk=iphoneos*]" = "$(ARCHS_STANDARD_32_BIT)"; "CODE_SIGN_ENTITLEMENTS[sdk=iphoneos*]" = "source/debugserver-entitlements.plist"; COPY_PHASE_STRIP = YES; - CURRENT_PROJECT_VERSION = 168; + CURRENT_PROJECT_VERSION = 170; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; FRAMEWORK_SEARCH_PATHS = $SDKROOT/System/Library/PrivateFrameworks; "FRAMEWORK_SEARCH_PATHS[sdk=iphoneos*][arch=*]" = ( @@ -574,7 +574,7 @@ "ARCHS[sdk=iphoneos*]" = "$(ARCHS_STANDARD_32_BIT)"; "CODE_SIGN_ENTITLEMENTS[sdk=iphoneos*]" = "source/debugserver-entitlements.plist"; COPY_PHASE_STRIP = YES; - CURRENT_PROJECT_VERSION = 168; + CURRENT_PROJECT_VERSION = 170; FRAMEWORK_SEARCH_PATHS = $SDKROOT/System/Library/PrivateFrameworks; "FRAMEWORK_SEARCH_PATHS[sdk=iphoneos*][arch=*]" = ( "$(SDKROOT)/System/Library/PrivateFrameworks", @@ -613,7 +613,7 @@ "ARCHS[sdk=iphoneos*]" = "$(ARCHS_STANDARD_32_BIT)"; "CODE_SIGN_ENTITLEMENTS[sdk=iphoneos*]" = "source/debugserver-entitlements.plist"; COPY_PHASE_STRIP = YES; - CURRENT_PROJECT_VERSION = 168; + CURRENT_PROJECT_VERSION = 170; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; FRAMEWORK_SEARCH_PATHS = $SDKROOT/System/Library/PrivateFrameworks; "FRAMEWORK_SEARCH_PATHS[sdk=iphoneos*][arch=*]" = ( From gclayton at apple.com Mon Feb 6 20:16:57 2012 From: gclayton at apple.com (Greg Clayton) Date: Tue, 07 Feb 2012 02:16:57 -0000 Subject: [Lldb-commits] [lldb] r149956 - in /lldb/tags/lldb-111: lldb.xcodeproj/project.pbxproj resources/LLDB-Info.plist tools/debugserver/debugserver.xcodeproj/project.pbxproj Message-ID: <20120207021657.2BC172A6C12C@llvm.org> Author: gclayton Date: Mon Feb 6 20:16:56 2012 New Revision: 149956 URL: http://llvm.org/viewvc/llvm-project?rev=149956&view=rev Log: Forgot to checkin the Xcode project version bumps for lldb-111 and debugserver-169 in the lldb-111 tag. Modified: lldb/tags/lldb-111/lldb.xcodeproj/project.pbxproj lldb/tags/lldb-111/resources/LLDB-Info.plist lldb/tags/lldb-111/tools/debugserver/debugserver.xcodeproj/project.pbxproj Modified: lldb/tags/lldb-111/lldb.xcodeproj/project.pbxproj URL: http://llvm.org/viewvc/llvm-project/lldb/tags/lldb-111/lldb.xcodeproj/project.pbxproj?rev=149956&r1=149955&r2=149956&view=diff ============================================================================== --- lldb/tags/lldb-111/lldb.xcodeproj/project.pbxproj (original) +++ lldb/tags/lldb-111/lldb.xcodeproj/project.pbxproj Mon Feb 6 20:16:56 2012 @@ -2947,6 +2947,7 @@ buildPhases = ( 26DC6A0D1337FE6900FF7998 /* Sources */, 26DC6A0E1337FE6900FF7998 /* Frameworks */, + 26EA734D14DA328C002C9339 /* Codesign */, ); buildRules = ( ); @@ -3109,6 +3110,20 @@ shellPath = /bin/sh; shellScript = "$SRCROOT/scripts/build-swig-wrapper-classes.sh $SRCROOT $TARGET_BUILD_DIR $CONFIGURATION_BUILD_DIR \"\"\n"; }; + 26EA734D14DA328C002C9339 /* Codesign */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = Codesign; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = "/bin/sh -x"; + shellScript = "if [ $CONFIGURATION != BuildAndIntegration -a $PLATFORM_NAME = macosx ]; then \n /usr/bin/codesign -s lldb_codesign -f \"$TARGET_BUILD_DIR/$TARGET_NAME\"\nfi"; + }; 9A19ACE2116563A700E0D453 /* Finish swig wrapper classes (lldb) */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -3733,9 +3748,9 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; - CURRENT_PROJECT_VERSION = 110; + CURRENT_PROJECT_VERSION = 111; DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 110; + DYLIB_CURRENT_VERSION = 111; EXPORTED_SYMBOLS_FILE = "resources/lldb-framework-exports"; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -3793,10 +3808,10 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; - CURRENT_PROJECT_VERSION = 110; + CURRENT_PROJECT_VERSION = 111; DEAD_CODE_STRIPPING = YES; DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 110; + DYLIB_CURRENT_VERSION = 111; EXPORTED_SYMBOLS_FILE = "resources/lldb-framework-exports"; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -3852,8 +3867,8 @@ 2689FFD513353D7A00698AC0 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - CURRENT_PROJECT_VERSION = 110; - DYLIB_CURRENT_VERSION = 110; + CURRENT_PROJECT_VERSION = 111; + DYLIB_CURRENT_VERSION = 111; EXECUTABLE_EXTENSION = a; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -3881,8 +3896,8 @@ 2689FFD613353D7A00698AC0 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - CURRENT_PROJECT_VERSION = 110; - DYLIB_CURRENT_VERSION = 110; + CURRENT_PROJECT_VERSION = 111; + DYLIB_CURRENT_VERSION = 111; EXECUTABLE_EXTENSION = a; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -3910,8 +3925,8 @@ 2689FFD713353D7A00698AC0 /* BuildAndIntegration */ = { isa = XCBuildConfiguration; buildSettings = { - CURRENT_PROJECT_VERSION = 110; - DYLIB_CURRENT_VERSION = 110; + CURRENT_PROJECT_VERSION = 111; + DYLIB_CURRENT_VERSION = 111; EXECUTABLE_EXTENSION = a; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -3991,7 +4006,7 @@ isa = XCBuildConfiguration; buildSettings = { COPY_PHASE_STRIP = YES; - CURRENT_PROJECT_VERSION = 110; + CURRENT_PROJECT_VERSION = 111; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "\"$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks\"", @@ -4022,10 +4037,10 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; COPY_PHASE_STRIP = YES; - CURRENT_PROJECT_VERSION = 110; + CURRENT_PROJECT_VERSION = 111; DEAD_CODE_STRIPPING = YES; DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 110; + DYLIB_CURRENT_VERSION = 111; EXPORTED_SYMBOLS_FILE = "resources/lldb-framework-exports"; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -4263,7 +4278,7 @@ 26F5C26C10F3D9A5009D5894 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - CURRENT_PROJECT_VERSION = 110; + CURRENT_PROJECT_VERSION = 111; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "\"$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks\"", @@ -4293,7 +4308,7 @@ 26F5C26D10F3D9A5009D5894 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - CURRENT_PROJECT_VERSION = 110; + CURRENT_PROJECT_VERSION = 111; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "\"$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks\"", Modified: lldb/tags/lldb-111/resources/LLDB-Info.plist URL: http://llvm.org/viewvc/llvm-project/lldb/tags/lldb-111/resources/LLDB-Info.plist?rev=149956&r1=149955&r2=149956&view=diff ============================================================================== --- lldb/tags/lldb-111/resources/LLDB-Info.plist (original) +++ lldb/tags/lldb-111/resources/LLDB-Info.plist Mon Feb 6 20:16:56 2012 @@ -17,7 +17,7 @@ CFBundleSignature ???? CFBundleVersion - 110 + 111 CFBundleName ${EXECUTABLE_NAME} Modified: lldb/tags/lldb-111/tools/debugserver/debugserver.xcodeproj/project.pbxproj URL: http://llvm.org/viewvc/llvm-project/lldb/tags/lldb-111/tools/debugserver/debugserver.xcodeproj/project.pbxproj?rev=149956&r1=149955&r2=149956&view=diff ============================================================================== --- lldb/tags/lldb-111/tools/debugserver/debugserver.xcodeproj/project.pbxproj (original) +++ lldb/tags/lldb-111/tools/debugserver/debugserver.xcodeproj/project.pbxproj Mon Feb 6 20:16:56 2012 @@ -366,6 +366,7 @@ 26CE05C7115C36870022F371 /* ShellScript */, 26CE0591115C31C20022F371 /* Sources */, 26CE0592115C31C20022F371 /* Frameworks */, + 26EA734F14DA32B2002C9339 /* Codesign */, ); buildRules = ( ); @@ -419,6 +420,20 @@ shellPath = /bin/sh; shellScript = "perl -x scripts/dbgnub-config.pl\n"; }; + 26EA734F14DA32B2002C9339 /* Codesign */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = Codesign; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = "/bin/sh -x"; + shellScript = "if [ $CONFIGURATION != BuildAndIntegration -a $PLATFORM_NAME = macosx ]; then \n /usr/bin/codesign -s lldb_codesign -f \"$TARGET_BUILD_DIR/$TARGET_NAME\"\nfi"; + }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ @@ -475,7 +490,7 @@ i386, ); COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 168; + CURRENT_PROJECT_VERSION = 169; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; SDKROOT = ""; @@ -494,7 +509,7 @@ x86_64, i386, ); - CURRENT_PROJECT_VERSION = 168; + CURRENT_PROJECT_VERSION = 169; DEAD_CODE_STRIPPING = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; @@ -515,7 +530,7 @@ x86_64, i386, ); - CURRENT_PROJECT_VERSION = 168; + CURRENT_PROJECT_VERSION = 169; DEAD_CODE_STRIPPING = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; @@ -534,7 +549,7 @@ "ARCHS[sdk=iphoneos*]" = "$(ARCHS_STANDARD_32_BIT)"; "CODE_SIGN_ENTITLEMENTS[sdk=iphoneos*]" = "source/debugserver-entitlements.plist"; COPY_PHASE_STRIP = YES; - CURRENT_PROJECT_VERSION = 168; + CURRENT_PROJECT_VERSION = 169; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; FRAMEWORK_SEARCH_PATHS = $SDKROOT/System/Library/PrivateFrameworks; "FRAMEWORK_SEARCH_PATHS[sdk=iphoneos*][arch=*]" = ( @@ -574,7 +589,7 @@ "ARCHS[sdk=iphoneos*]" = "$(ARCHS_STANDARD_32_BIT)"; "CODE_SIGN_ENTITLEMENTS[sdk=iphoneos*]" = "source/debugserver-entitlements.plist"; COPY_PHASE_STRIP = YES; - CURRENT_PROJECT_VERSION = 168; + CURRENT_PROJECT_VERSION = 169; FRAMEWORK_SEARCH_PATHS = $SDKROOT/System/Library/PrivateFrameworks; "FRAMEWORK_SEARCH_PATHS[sdk=iphoneos*][arch=*]" = ( "$(SDKROOT)/System/Library/PrivateFrameworks", @@ -613,7 +628,7 @@ "ARCHS[sdk=iphoneos*]" = "$(ARCHS_STANDARD_32_BIT)"; "CODE_SIGN_ENTITLEMENTS[sdk=iphoneos*]" = "source/debugserver-entitlements.plist"; COPY_PHASE_STRIP = YES; - CURRENT_PROJECT_VERSION = 168; + CURRENT_PROJECT_VERSION = 169; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; FRAMEWORK_SEARCH_PATHS = $SDKROOT/System/Library/PrivateFrameworks; "FRAMEWORK_SEARCH_PATHS[sdk=iphoneos*][arch=*]" = ( From gclayton at apple.com Mon Feb 6 20:18:35 2012 From: gclayton at apple.com (Greg Clayton) Date: Tue, 07 Feb 2012 02:18:35 -0000 Subject: [Lldb-commits] [lldb] r149957 - /lldb/tags/lldb-112/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Message-ID: <20120207021835.C22252A6C12C@llvm.org> Author: gclayton Date: Mon Feb 6 20:18:35 2012 New Revision: 149957 URL: http://llvm.org/viewvc/llvm-project?rev=149957&view=rev Log: Fixed a case where we couldn't attach to an iOS app after recent code changes. Modified: lldb/tags/lldb-112/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Modified: lldb/tags/lldb-112/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/tags/lldb-112/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp?rev=149957&r1=149956&r2=149957&view=diff ============================================================================== --- lldb/tags/lldb-112/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp (original) +++ lldb/tags/lldb-112/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Mon Feb 6 20:18:35 2012 @@ -147,6 +147,7 @@ { // m_mach_process.UnregisterNotificationCallbacks (this); Clear(); + StopAsyncThread(); // We need to call finalize on the process before destroying ourselves // to make sure all of the broadcaster cleanup goes as planned. If we // destruct this class, then Process::~Process() might have problems From scallanan at apple.com Tue Feb 7 15:13:38 2012 From: scallanan at apple.com (Sean Callanan) Date: Tue, 07 Feb 2012 21:13:38 -0000 Subject: [Lldb-commits] [lldb] r150004 - /lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Message-ID: <20120207211338.B45FF2A6C12C@llvm.org> Author: spyffe Date: Tue Feb 7 15:13:38 2012 New Revision: 150004 URL: http://llvm.org/viewvc/llvm-project?rev=150004&view=rev Log: Made SymbolFileDWARF be less strict when looking for types that can be uniqued to the given type. This is especially helpful when types are missing file and line information. Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp 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=150004&r1=150003&r2=150004&view=diff ============================================================================== --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original) +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Tue Feb 7 15:13:38 2012 @@ -4660,27 +4660,25 @@ } UniqueDWARFASTType unique_ast_entry; - if (decl.IsValid()) - { - if (GetUniqueDWARFASTTypeMap().Find (type_name_const_str, - this, - dwarf_cu, - die, - decl, - byte_size_valid ? byte_size : -1, - unique_ast_entry)) - { - // We have already parsed this type or from another - // compile unit. GCC loves to use the "one definition - // rule" which can result in multiple definitions - // of the same class over and over in each compile - // unit. - type_sp = unique_ast_entry.m_type_sp; - if (type_sp) - { - m_die_to_type[die] = type_sp.get(); - return type_sp; - } + + if (GetUniqueDWARFASTTypeMap().Find (type_name_const_str, + this, + dwarf_cu, + die, + decl, + byte_size_valid ? byte_size : -1, + unique_ast_entry)) + { + // We have already parsed this type or from another + // compile unit. GCC loves to use the "one definition + // rule" which can result in multiple definitions + // of the same class over and over in each compile + // unit. + type_sp = unique_ast_entry.m_type_sp; + if (type_sp) + { + m_die_to_type[die] = type_sp.get(); + return type_sp; } } From scallanan at apple.com Tue Feb 7 15:53:52 2012 From: scallanan at apple.com (Sean Callanan) Date: Tue, 07 Feb 2012 21:53:52 -0000 Subject: [Lldb-commits] [lldb] r150005 - /lldb/trunk/.gitignore Message-ID: <20120207215352.DAAEF2A6C12C@llvm.org> Author: spyffe Date: Tue Feb 7 15:53:52 2012 New Revision: 150005 URL: http://llvm.org/viewvc/llvm-project?rev=150005&view=rev Log: Added a .gitignore so that "git status" isn't quite as busy. Added: lldb/trunk/.gitignore Added: lldb/trunk/.gitignore URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/.gitignore?rev=150005&view=auto ============================================================================== --- lldb/trunk/.gitignore (added) +++ lldb/trunk/.gitignore Tue Feb 7 15:53:52 2012 @@ -0,0 +1,7 @@ +*.pyc +build/ +llvm/ +llvm-build/ +*xcuserdata +test/20* +source/LLDBWrapPython.cpp From johnny.chen at apple.com Tue Feb 7 19:13:31 2012 From: johnny.chen at apple.com (Johnny Chen) Date: Wed, 08 Feb 2012 01:13:31 -0000 Subject: [Lldb-commits] [lldb] r150032 - in /lldb/trunk: include/lldb/Interpreter/ source/Commands/ source/Interpreter/ test/functionalities/watchpoint/hello_watchpoint/ test/functionalities/watchpoint/watchpoint_set_command/ test/help/ Message-ID: <20120208011332.07E5C2A6C12C@llvm.org> Author: johnny Date: Tue Feb 7 19:13:31 2012 New Revision: 150032 URL: http://llvm.org/viewvc/llvm-project?rev=150032&view=rev Log: Refine the 'watchpoint set' command to now require either the '-v' option (for watching of a variable) or the '-e' option (for watching of an address) to be present. Update some existing test cases with the required option and add some more test cases. Since the '-v' option takes and the '-e' option takes as the command arg, the existing infrastructure for generating the option usage can produce confusing help message, like: watchpoint set -e [-w ] [-x ] watchpoint set -v [-w ] [-x ] The solution adopted is to provide an extra member field to the struct CommandArgumentData called (uint32_t)arg_opt_set_association, whose purpose is to link this particular argument data with some option set(s). Also modify the signature of CommandObject::GetFormattedCommandArguments() to: GetFormattedCommandArguments (Stream &str, uint32_t opt_set_mask = LLDB_OPT_SET_ALL) it now takes an additional opt_set_mask which can be used to generate a filtered formatted command args for help message. Options::GenerateOptionUsage() impl is modified to call the GetFormattedCommandArguments() appropriately. So that the help message now looks like: watchpoint set -e [-w ] [-x ] watchpoint set -v [-w ] [-x ] rdar://problem/10703256 Modified: lldb/trunk/include/lldb/Interpreter/CommandObject.h lldb/trunk/source/Commands/CommandObjectWatchpoint.cpp lldb/trunk/source/Commands/CommandObjectWatchpoint.h lldb/trunk/source/Interpreter/CommandObject.cpp lldb/trunk/source/Interpreter/OptionGroupWatchpoint.cpp lldb/trunk/source/Interpreter/Options.cpp lldb/trunk/test/functionalities/watchpoint/hello_watchpoint/TestMyFirstWatchpoint.py lldb/trunk/test/functionalities/watchpoint/watchpoint_set_command/TestWatchLocationWithWatchSet.py lldb/trunk/test/functionalities/watchpoint/watchpoint_set_command/TestWatchpointSetErrorCases.py lldb/trunk/test/help/TestHelp.py Modified: lldb/trunk/include/lldb/Interpreter/CommandObject.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/CommandObject.h?rev=150032&r1=150031&r2=150032&view=diff ============================================================================== --- lldb/trunk/include/lldb/Interpreter/CommandObject.h (original) +++ lldb/trunk/include/lldb/Interpreter/CommandObject.h Tue Feb 7 19:13:31 2012 @@ -60,6 +60,12 @@ { lldb::CommandArgumentType arg_type; ArgumentRepetitionType arg_repetition; + uint32_t arg_opt_set_association; // This arg might be associated only with some particular option set(s). + CommandArgumentData(): + arg_type(lldb::eArgTypeNone), + arg_repetition(eArgRepeatPlain), + arg_opt_set_association(LLDB_OPT_SET_ALL) // By default, the arg associates to all option sets. + {} }; typedef std::vector CommandArgumentEntry; // Used to build individual command argument lists @@ -171,8 +177,13 @@ static const char * GetArgumentName (lldb::CommandArgumentType arg_type); + // Generates a nicely formatted command args string for help command output. + // By default, all possible args are taken into account, for example, + // ''. This can be refined by passing a second arg + // specifying which option set(s) we are interested, which could then, for + // example, produce either '' or ''. void - GetFormattedCommandArguments (Stream &str); + GetFormattedCommandArguments (Stream &str, uint32_t opt_set_mask = LLDB_OPT_SET_ALL); bool IsPairType (ArgumentRepetitionType arg_repeat_type); Modified: lldb/trunk/source/Commands/CommandObjectWatchpoint.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectWatchpoint.cpp?rev=150032&r1=150031&r2=150032&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectWatchpoint.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectWatchpoint.cpp Tue Feb 7 19:13:31 2012 @@ -853,6 +853,70 @@ } //------------------------------------------------------------------------- +// CommandObjectWatchpointSet::CommandOptions +//------------------------------------------------------------------------- +#pragma mark Set::CommandOptions + +CommandObjectWatchpointSet::CommandOptions::CommandOptions() : + OptionGroup() +{ +} + +CommandObjectWatchpointSet::CommandOptions::~CommandOptions () +{ +} + +OptionDefinition +CommandObjectWatchpointSet::CommandOptions::g_option_table[] = +{ +{ LLDB_OPT_SET_1, true, "expression", 'e', no_argument, NULL, NULL, eArgTypeNone, "Watch an address with an expression specified at the end."}, +{ LLDB_OPT_SET_2, true, "variable", 'v', no_argument, NULL, NULL, eArgTypeNone, "Watch a variable name specified at the end."} +}; + +uint32_t +CommandObjectWatchpointSet::CommandOptions::GetNumDefinitions () +{ + return sizeof(g_option_table)/sizeof(OptionDefinition); +} + +const OptionDefinition* +CommandObjectWatchpointSet::CommandOptions::GetDefinitions () +{ + return g_option_table; +} + +Error +CommandObjectWatchpointSet::CommandOptions::SetOptionValue (CommandInterpreter &interpreter, + uint32_t option_idx, + const char *option_arg) +{ + Error error; + char short_option = (char) g_option_table[option_idx].short_option; + + switch (short_option) + { + case 'e': + m_do_expression = true; + break; + case 'v': + m_do_variable = true; + break; + default: + error.SetErrorStringWithFormat ("unrecognized option '%c'", short_option); + break; + } + + return error; +} + +void +CommandObjectWatchpointSet::CommandOptions::OptionParsingStarting (CommandInterpreter &interpreter) +{ + m_do_expression = false; + m_do_variable = false; +} + +//------------------------------------------------------------------------- // CommandObjectWatchpointSet //------------------------------------------------------------------------- #pragma mark Set @@ -861,45 +925,51 @@ CommandObject (interpreter, "watchpoint set", "Set a watchpoint. " - "You can choose to watch a variable in scope with just the '-w' option. " - "If you use the '-x' option to specify the byte size, it is implied " - "that the remaining string is evaluated as an expression with the result " - "interpreted as an address to watch for, i.e., the pointee is watched. " + "You can choose to watch a variable in scope with the '-v' option " + "or to watch an address with the '-e' option by supplying an expression. " + "Use the '-w' option to specify the type of watchpoint and " + "the '-x' option to specify the byte size to watch for. " "If no '-w' option is specified, it defaults to read_write. " "Note that hardware resources for watching are often limited.", NULL, eFlagProcessMustBeLaunched | eFlagProcessMustBePaused), m_option_group (interpreter), - m_option_watchpoint() + m_option_watchpoint (), + m_command_options () { SetHelpLong( "Examples: \n\ \n\ - watchpoint set -w read_wriate my_global_var \n\ - # Watch my_global_var for read/write access.\n\ + watchpoint set -w read_wriate -v my_global_var \n\ + # Watch my_global_var for read/write access, with the region to watch corresponding to the byte size of the data type.\n\ \n\ - watchpoint set -w write -x 1 foo + 32\n\ - # Watch write access for the 1-byte region pointed to by the address 'foo + 32'.\n"); + watchpoint set -w write -x 1 -e foo + 32\n\ + # Watch write access for the 1-byte region pointed to by the address 'foo + 32'.\n\ + # If no '-x' option is specified, byte size defaults to 4.\n"); CommandArgumentEntry arg; CommandArgumentData var_name_arg, expression_arg; // Define the first variant of this arg. - var_name_arg.arg_type = eArgTypeVarName; - var_name_arg.arg_repetition = eArgRepeatPlain; - - // Define the second variant of this arg. expression_arg.arg_type = eArgTypeExpression; expression_arg.arg_repetition = eArgRepeatPlain; + expression_arg.arg_opt_set_association = LLDB_OPT_SET_1; + // Define the second variant of this arg. + var_name_arg.arg_type = eArgTypeVarName; + var_name_arg.arg_repetition = eArgRepeatPlain; + var_name_arg.arg_opt_set_association = LLDB_OPT_SET_2; + // Push the two variants into the argument entry. - arg.push_back (var_name_arg); arg.push_back (expression_arg); + arg.push_back (var_name_arg); - // Push the data for the first argument into the m_arguments vector. + // Push the data for the only argument into the m_arguments vector. m_arguments.push_back (arg); - - m_option_group.Append (&m_option_watchpoint, LLDB_OPT_SET_ALL, LLDB_OPT_SET_1); + + // Absorb the '-w' and '-x' options. + m_option_group.Append (&m_option_watchpoint, LLDB_OPT_SET_1, LLDB_OPT_SET_1|LLDB_OPT_SET_2); + m_option_group.Append (&m_command_options); m_option_group.Finalize(); } @@ -930,35 +1000,25 @@ return false; } - // Be careful about the stack frame, if any summary formatter runs code, it might clear the StackFrameList - // for the thread. So hold onto a shared pointer to the frame so it stays alive. - bool get_file_globals = true; - VariableList *variable_list = frame->GetVariableList (get_file_globals); + // If no argument is present, issue an error message. There's no way to set a watchpoint. + if (command.GetArgumentCount() <= 0) + { + result.GetErrorStream().Printf("error: required argument missing; specify your program variable ('-v') or an address ('-e') to watch for\n"); + result.SetStatus(eReturnStatusFailed); + return false; + } + + // It's either '-e' to watch an address with expression' or '-v' to watch a variable. + bool watch_address = m_command_options.m_do_expression; - bool watch_address = (m_option_watchpoint.watch_size > 0); - // If no '-w' is specified, default to '-w read_write'. if (!m_option_watchpoint.watch_variable) { m_option_watchpoint.watch_variable = true; m_option_watchpoint.watch_type = OptionGroupWatchpoint::eWatchReadWrite; } - // It's possible to specify an address to watch for with the '-x' option. - if (!variable_list && !watch_address) - { - result.GetErrorStream().Printf("error: no variables found, did you forget to use '-x' option to watch an address?\n"); - result.SetStatus(eReturnStatusFailed); - return false; - } - // If thre's no argument, it is an error. - if (command.GetArgumentCount() <= 0) - { - result.GetErrorStream().Printf("error: specify your target variable (no '-x') or expression (with '-x') to watch for\n"); - result.SetStatus(eReturnStatusFailed); - return false; - } - // We passed the sanity check for the options. + // We passed the sanity check for the command. // Proceed to set the watchpoint now. lldb::addr_t addr = 0; size_t size = 0; @@ -968,6 +1028,7 @@ Stream &output_stream = result.GetOutputStream(); if (watch_address) { + // Use expression evaluation to arrive at the address to watch. std::string expr_str; command.GetQuotedCommandString(expr_str); const bool coerce_to_id = true; @@ -983,6 +1044,7 @@ valobj_sp); if (expr_result != eExecutionCompleted) { result.GetErrorStream().Printf("error: expression evaluation of address to watch failed\n"); + result.GetErrorStream().Printf("expression evaluated: %s\n", expr_str.c_str()); result.SetStatus(eReturnStatusFailed); } @@ -993,11 +1055,12 @@ result.SetStatus(eReturnStatusFailed); return false; } - size = m_option_watchpoint.watch_size; + size = m_option_watchpoint.watch_size == 0 ? 4 /* Could use a better default size? */ + : m_option_watchpoint.watch_size; } else { // A simple watch variable gesture allows only one argument. - if (m_option_watchpoint.watch_size == 0 && command.GetArgumentCount() != 1) { - result.GetErrorStream().Printf("error: specify exactly one variable with the '-w' option, i.e., no '-x'\n"); + if (command.GetArgumentCount() != 1) { + result.GetErrorStream().Printf("error: specify exactly one variable with the '-v' option\n"); result.SetStatus(eReturnStatusFailed); return false; } @@ -1016,7 +1079,8 @@ if (addr_type == eAddressTypeLoad) { // We're in business. // Find out the size of this variable. - size = valobj_sp->GetByteSize(); + size = m_option_watchpoint.watch_size == 0 ? valobj_sp->GetByteSize() + : m_option_watchpoint.watch_size; } } else { const char *error_cstr = error.AsCString(NULL); @@ -1045,7 +1109,8 @@ output_stream.EOL(); result.SetStatus(eReturnStatusSuccessFinishResult); } else { - result.AppendErrorWithFormat("Watchpoint creation failed.\n"); + result.AppendErrorWithFormat("Watchpoint creation failed (addr=0x%llx, size=%lu).\n", + addr, size); result.SetStatus(eReturnStatusFailed); } Modified: lldb/trunk/source/Commands/CommandObjectWatchpoint.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectWatchpoint.h?rev=150032&r1=150031&r2=150032&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectWatchpoint.h (original) +++ lldb/trunk/source/Commands/CommandObjectWatchpoint.h Tue Feb 7 19:13:31 2012 @@ -251,6 +251,36 @@ { public: + class CommandOptions : public OptionGroup + { + public: + + CommandOptions (); + + virtual + ~CommandOptions (); + + virtual uint32_t + GetNumDefinitions (); + + virtual const OptionDefinition* + GetDefinitions (); + + virtual Error + SetOptionValue (CommandInterpreter &interpreter, + uint32_t option_idx, + const char *option_value); + + virtual void + OptionParsingStarting (CommandInterpreter &interpreter); + + // Options table: Required for subclasses of Options. + + static OptionDefinition g_option_table[]; + bool m_do_expression; + bool m_do_variable; + }; + CommandObjectWatchpointSet (CommandInterpreter &interpreter); virtual @@ -266,6 +296,7 @@ private: OptionGroupOptions m_option_group; OptionGroupWatchpoint m_option_watchpoint; + CommandOptions m_command_options; }; } // namespace lldb_private Modified: lldb/trunk/source/Interpreter/CommandObject.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandObject.cpp?rev=150032&r1=150031&r2=150032&view=diff ============================================================================== --- lldb/trunk/source/Interpreter/CommandObject.cpp (original) +++ lldb/trunk/source/Interpreter/CommandObject.cpp Tue Feb 7 19:13:31 2012 @@ -535,15 +535,30 @@ return false; } +static CommandObject::CommandArgumentEntry +OptSetFiltered(uint32_t opt_set_mask, CommandObject::CommandArgumentEntry &cmd_arg_entry) +{ + CommandObject::CommandArgumentEntry ret_val; + for (unsigned i = 0; i < cmd_arg_entry.size(); ++i) + if (opt_set_mask & cmd_arg_entry[i].arg_opt_set_association) + ret_val.push_back(cmd_arg_entry[i]); + return ret_val; +} + +// Default parameter value of opt_set_mask is LLDB_OPT_SET_ALL, which means take +// all the argument data into account. On rare cases where some argument sticks +// with certain option sets, this function returns the option set filtered args. void -CommandObject::GetFormattedCommandArguments (Stream &str) +CommandObject::GetFormattedCommandArguments (Stream &str, uint32_t opt_set_mask) { int num_args = m_arguments.size(); for (int i = 0; i < num_args; ++i) { if (i > 0) str.Printf (" "); - CommandArgumentEntry arg_entry = m_arguments[i]; + CommandArgumentEntry arg_entry = + opt_set_mask == LLDB_OPT_SET_ALL ? m_arguments[i] + : OptSetFiltered(opt_set_mask, m_arguments[i]); int num_alternatives = arg_entry.size(); if ((num_alternatives == 2) Modified: lldb/trunk/source/Interpreter/OptionGroupWatchpoint.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/OptionGroupWatchpoint.cpp?rev=150032&r1=150031&r2=150032&view=diff ============================================================================== --- lldb/trunk/source/Interpreter/OptionGroupWatchpoint.cpp (original) +++ lldb/trunk/source/Interpreter/OptionGroupWatchpoint.cpp Tue Feb 7 19:13:31 2012 @@ -40,8 +40,8 @@ static OptionDefinition g_option_table[] = { - { LLDB_OPT_SET_1, false, "watch", 'w', required_argument, g_watch_type, 0, eArgTypeWatchType, "Determine how to watch a variable; or, with -x option, its pointee."}, - { LLDB_OPT_SET_1, false, "xsize", 'x', required_argument, g_watch_size, 0, eArgTypeByteSize, "Number of bytes to use to watch the pointee."} + { LLDB_OPT_SET_1, false, "watch", 'w', required_argument, g_watch_type, 0, eArgTypeWatchType, "Specify the type of watching to perform."}, + { LLDB_OPT_SET_1, false, "xsize", 'x', required_argument, g_watch_size, 0, eArgTypeByteSize, "Number of bytes to use to watch a region."} }; Modified: lldb/trunk/source/Interpreter/Options.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/Options.cpp?rev=150032&r1=150031&r2=150032&view=diff ============================================================================== --- lldb/trunk/source/Interpreter/Options.cpp (original) +++ lldb/trunk/source/Interpreter/Options.cpp Tue Feb 7 19:13:31 2012 @@ -437,6 +437,10 @@ strm.Printf ("\n"); strm.Indent (name); + // Different option sets may require different args. + StreamString args_str; + cmd->GetFormattedCommandArguments(args_str, opt_set_mask); + // First go through and print all options that take no arguments as // a single string. If a command has "-a" "-b" and "-c", this will show // up as [-abc] @@ -556,12 +560,12 @@ } } - if (arguments_str.GetSize() > 0) + if (args_str.GetSize() > 0) { if (cmd->WantsRawCommandString()) strm.Printf(" --"); - strm.Printf (" %s", arguments_str.GetData()); + strm.Printf (" %s", args_str.GetData()); } } Modified: lldb/trunk/test/functionalities/watchpoint/hello_watchpoint/TestMyFirstWatchpoint.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/watchpoint/hello_watchpoint/TestMyFirstWatchpoint.py?rev=150032&r1=150031&r2=150032&view=diff ============================================================================== --- lldb/trunk/test/functionalities/watchpoint/hello_watchpoint/TestMyFirstWatchpoint.py (original) +++ lldb/trunk/test/functionalities/watchpoint/hello_watchpoint/TestMyFirstWatchpoint.py Tue Feb 7 19:13:31 2012 @@ -75,7 +75,7 @@ substrs = ['Watchpoint created', 'size = 4', 'type = w', '%s:%d' % (self.source, self.decl)]) else: - self.expect("watchpoint set -w write global", WATCHPOINT_CREATED, + self.expect("watchpoint set -w write -v global", WATCHPOINT_CREATED, substrs = ['Watchpoint created', 'size = 4', 'type = w', '%s:%d' % (self.source, self.decl)]) Modified: lldb/trunk/test/functionalities/watchpoint/watchpoint_set_command/TestWatchLocationWithWatchSet.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/watchpoint/watchpoint_set_command/TestWatchLocationWithWatchSet.py?rev=150032&r1=150031&r2=150032&view=diff ============================================================================== --- lldb/trunk/test/functionalities/watchpoint/watchpoint_set_command/TestWatchLocationWithWatchSet.py (original) +++ lldb/trunk/test/functionalities/watchpoint/watchpoint_set_command/TestWatchLocationWithWatchSet.py Tue Feb 7 19:13:31 2012 @@ -60,7 +60,7 @@ # with offset as 7. # The main.cpp, by design, misbehaves by not following the agreed upon # protocol of only accessing the allowable index range of [0, 6]. - self.expect("watchpoint set -w write -x 1 g_char_ptr + 7", WATCHPOINT_CREATED, + self.expect("watchpoint set -w write -x 1 -e g_char_ptr + 7", WATCHPOINT_CREATED, substrs = ['Watchpoint created', 'size = 1', 'type = w']) self.runCmd("expr unsigned val = g_char_ptr[7]; val") self.expect(self.res.GetOutput().splitlines()[0], exe=False, Modified: lldb/trunk/test/functionalities/watchpoint/watchpoint_set_command/TestWatchpointSetErrorCases.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/watchpoint/watchpoint_set_command/TestWatchpointSetErrorCases.py?rev=150032&r1=150031&r2=150032&view=diff ============================================================================== --- lldb/trunk/test/functionalities/watchpoint/watchpoint_set_command/TestWatchpointSetErrorCases.py (original) +++ lldb/trunk/test/functionalities/watchpoint/watchpoint_set_command/TestWatchpointSetErrorCases.py Tue Feb 7 19:13:31 2012 @@ -51,9 +51,13 @@ # No argument is an error. self.expect("watchpoint set", error=True, - substrs = ['specify your target variable', - 'or expression', - 'to watch for']) + startstr = 'error: invalid combination of options for the given command') + self.runCmd("watchpoint set -v -w read_write", check=False) + + # 'watchpoint set' now takes a mandatory '-v' or '-e' option to + # indicate watching for either variable or address. + self.expect("watchpoint set -w write global", error=True, + startstr = 'error: invalid combination of options for the given command') # Wrong size parameter is an error. self.expect("watchpoint set -x -128", error=True, Modified: lldb/trunk/test/help/TestHelp.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/help/TestHelp.py?rev=150032&r1=150031&r2=150032&view=diff ============================================================================== --- lldb/trunk/test/help/TestHelp.py (original) +++ lldb/trunk/test/help/TestHelp.py Tue Feb 7 19:13:31 2012 @@ -121,6 +121,13 @@ self.expect("help watchpt-id-list", substrs = ['']) + def test_help_watchpoint_set(self): + """Test that 'help watchpoint set' prints out for the '-e' option + and for the '-v' option.""" + self.expect("help watchpoint set", + patterns = ['watchpoint set -e.*', + 'watchpoint set -v.*']) + if __name__ == '__main__': import atexit From scallanan at apple.com Tue Feb 7 19:27:49 2012 From: scallanan at apple.com (Sean Callanan) Date: Wed, 08 Feb 2012 01:27:49 -0000 Subject: [Lldb-commits] [lldb] r150034 - /lldb/trunk/source/Expression/IRInterpreter.cpp Message-ID: <20120208012749.8C6AB2A6C12C@llvm.org> Author: spyffe Date: Tue Feb 7 19:27:49 2012 New Revision: 150034 URL: http://llvm.org/viewvc/llvm-project?rev=150034&view=rev Log: The IRInterpreter's constant evaluator wasn't sufficiently general - it could only handle literals and operations that didn't change the data. Now the constant evaluator passes APInt values around, and can handle GetElementPtr constants. Modified: lldb/trunk/source/Expression/IRInterpreter.cpp Modified: lldb/trunk/source/Expression/IRInterpreter.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/IRInterpreter.cpp?rev=150034&r1=150033&r2=150034&view=diff ============================================================================== --- lldb/trunk/source/Expression/IRInterpreter.cpp (original) +++ lldb/trunk/source/Expression/IRInterpreter.cpp Tue Feb 7 19:27:49 2012 @@ -538,35 +538,73 @@ return true; } - bool ResolveConstant (Memory::Region ®ion, const Constant *constant) + bool ResolveConstantValue (APInt &value, const Constant *constant) { - size_t constant_size = m_target_data.getTypeStoreSize(constant->getType()); - if (const ConstantInt *constant_int = dyn_cast(constant)) { - const uint64_t *raw_data = constant_int->getValue().getRawData(); - return m_memory.Write(region.m_base, (const uint8_t*)raw_data, constant_size); + value = constant_int->getValue(); + return true; } else if (const ConstantFP *constant_fp = dyn_cast(constant)) { - const uint64_t *raw_data = constant_fp->getValueAPF().bitcastToAPInt().getRawData(); - return m_memory.Write(region.m_base, (const uint8_t*)raw_data, constant_size); + value = constant_fp->getValueAPF().bitcastToAPInt(); + return true; } else if (const ConstantExpr *constant_expr = dyn_cast(constant)) { switch (constant_expr->getOpcode()) { - default: - return false; - case Instruction::IntToPtr: - case Instruction::BitCast: - return ResolveConstant(region, constant_expr->getOperand(0)); + default: + return false; + case Instruction::IntToPtr: + case Instruction::BitCast: + return ResolveConstantValue(value, constant_expr->getOperand(0)); + case Instruction::GetElementPtr: + { + ConstantExpr::const_op_iterator op_cursor = constant_expr->op_begin(); + ConstantExpr::const_op_iterator op_end = constant_expr->op_end(); + + Constant *base = dyn_cast(*op_cursor); + + if (!base) + return false; + + if (!ResolveConstantValue(value, base)) + return false; + + op_cursor++; + + if (op_cursor == op_end) + return true; // no offset to apply! + + SmallVector indices (op_cursor, op_end); + + uint64_t offset = m_target_data.getIndexedOffset(base->getType(), indices); + + const bool is_signed = true; + value += APInt(value.getBitWidth(), offset, is_signed); + + return true; + } } } return false; } + bool ResolveConstant (Memory::Region ®ion, const Constant *constant) + { + APInt resolved_value; + + if (!ResolveConstantValue(resolved_value, constant)) + return false; + + const uint64_t *raw_data = resolved_value.getRawData(); + + size_t constant_size = m_target_data.getTypeStoreSize(constant->getType()); + return m_memory.Write(region.m_base, (const uint8_t*)raw_data, constant_size); + } + Memory::Region ResolveValue (const Value *value, Module &module) { ValueMap::iterator i = m_values.find(value); From johnny.chen at apple.com Tue Feb 7 19:35:38 2012 From: johnny.chen at apple.com (Johnny Chen) Date: Wed, 08 Feb 2012 01:35:38 -0000 Subject: [Lldb-commits] [lldb] r150036 - /lldb/trunk/source/Commands/CommandObjectWatchpoint.cpp Message-ID: <20120208013538.995E72A6C12C@llvm.org> Author: johnny Date: Tue Feb 7 19:35:38 2012 New Revision: 150036 URL: http://llvm.org/viewvc/llvm-project?rev=150036&view=rev Log: Update comment. Modified: lldb/trunk/source/Commands/CommandObjectWatchpoint.cpp Modified: lldb/trunk/source/Commands/CommandObjectWatchpoint.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectWatchpoint.cpp?rev=150036&r1=150035&r2=150036&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectWatchpoint.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectWatchpoint.cpp Tue Feb 7 19:35:38 2012 @@ -967,7 +967,8 @@ // Push the data for the only argument into the m_arguments vector. m_arguments.push_back (arg); - // Absorb the '-w' and '-x' options. + // Absorb the '-w' and '-x' options into the '-e' (LLDB_OPT_SET_1) set as + // well as the '-v' (LLDB_OPT_SET_2) set. m_option_group.Append (&m_option_watchpoint, LLDB_OPT_SET_1, LLDB_OPT_SET_1|LLDB_OPT_SET_2); m_option_group.Append (&m_command_options); m_option_group.Finalize(); From johnny.chen at apple.com Tue Feb 7 19:50:38 2012 From: johnny.chen at apple.com (Johnny Chen) Date: Wed, 08 Feb 2012 01:50:38 -0000 Subject: [Lldb-commits] [lldb] r150039 - /lldb/trunk/source/Commands/CommandObjectFrame.cpp Message-ID: <20120208015038.BE5CF2A6C12C@llvm.org> Author: johnny Date: Tue Feb 7 19:50:38 2012 New Revision: 150039 URL: http://llvm.org/viewvc/llvm-project?rev=150039&view=rev Log: Clarify the 'frame variable' help message regarding the watchpoint functionality. Modified: lldb/trunk/source/Commands/CommandObjectFrame.cpp Modified: lldb/trunk/source/Commands/CommandObjectFrame.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectFrame.cpp?rev=150039&r1=150038&r2=150039&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectFrame.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectFrame.cpp Tue Feb 7 19:50:38 2012 @@ -331,7 +331,10 @@ "argument, local, file static and file global variables. " "Children of aggregate variables can be specified such as " "'var->child.x'. " - "You can choose to watch a variable with the '-w' option. " + "You can choose to watch a variable with the '-w' option; " + "with the additional '-x' option to specify the region size, " + "the variable's value will be used as the starting address of " + "the region to watch for, instead. " "Note that hardware resources for watching are often limited. " "See alo 'watchpoint set' where you can use an expression to " "specify the address to watch for.", From scallanan at apple.com Tue Feb 7 21:45:08 2012 From: scallanan at apple.com (Sean Callanan) Date: Wed, 08 Feb 2012 03:45:08 -0000 Subject: [Lldb-commits] [lldb] r150051 - /lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp Message-ID: <20120208034508.54CAD2A6C12C@llvm.org> Author: spyffe Date: Tue Feb 7 21:45:08 2012 New Revision: 150051 URL: http://llvm.org/viewvc/llvm-project?rev=150051&view=rev Log: Fixed ClangExpressionDeclMap to use the debug information about the current frame rather than the debug information about "this" and "self" when determining the types of those pointers. This allows expressions to work in frames that don't have valid "this" and "self" pointers, working around poor debug information. Modified: lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp Modified: lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp?rev=150051&r1=150050&r2=150051&view=diff ============================================================================== --- lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp (original) +++ lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp Tue Feb 7 21:45:08 2012 @@ -2350,57 +2350,40 @@ if (name == g_lldb_class_name) { // Clang is looking for the type of "this" - - if (!frame) + + if (frame == NULL) return; - VariableList *vars = frame->GetVariableList(false); + SymbolContext sym_ctx = frame->GetSymbolContext(lldb::eSymbolContextFunction); - if (!vars) + if (!sym_ctx.function) return; - lldb::VariableSP this_var = vars->FindVariable(ConstString("this")); - - if (!this_var || - !this_var->IsInScope(frame) || - !this_var->LocationIsValidForFrame (frame)) - return; + clang::DeclContext *decl_context; - Type *this_type = this_var->GetType(); + if (sym_ctx.block && sym_ctx.block->GetInlinedFunctionInfo()) + decl_context = sym_ctx.block->GetClangDeclContextForInlinedFunction(); + else + decl_context = sym_ctx.function->GetClangDeclContext(); - if (!this_type) + if (!decl_context) return; - if (log && log->GetVerbose()) - { - log->Printf (" CEDM::FEVD[%u] Type for \"this\" is: ", current_id); - StreamString strm; - this_type->Dump(&strm, true); - log->PutCString (strm.GetData()); - } - - TypeFromUser this_user_type(this_type->GetClangFullType(), - this_type->GetClangAST()); - - m_struct_vars->m_object_pointer_type = this_user_type; + clang::CXXMethodDecl *method_decl = llvm::dyn_cast(decl_context); - void *pointer_target_type = NULL; - - if (!ClangASTContext::IsPointerType(this_user_type.GetOpaqueQualType(), - &pointer_target_type)) + if (!method_decl) return; - clang::QualType pointer_target_qual_type = QualType::getFromOpaquePtr(pointer_target_type); + clang::CXXRecordDecl *class_decl = method_decl->getParent(); - if (pointer_target_qual_type.isConstQualified()) - pointer_target_qual_type.removeLocalConst(); + QualType class_qual_type(class_decl->getTypeForDecl(), 0); - TypeFromUser class_user_type(pointer_target_qual_type.getAsOpaquePtr(), - this_type->GetClangAST()); + TypeFromUser class_user_type (class_qual_type.getAsOpaquePtr(), + &class_decl->getASTContext()); if (log) { - ASTDumper ast_dumper(pointer_target_qual_type); + ASTDumper ast_dumper(class_qual_type); log->Printf(" CEDM::FEVD[%u] Adding type for $__lldb_class: %s", current_id, ast_dumper.GetCString()); } @@ -2455,24 +2438,46 @@ AddOneType(context, class_user_type, current_id, false); +#if 0 VariableList *vars = frame->GetVariableList(false); lldb::VariableSP self_var = vars->FindVariable(ConstString("self")); - if (!self_var || - !self_var->IsInScope(frame) || - !self_var->LocationIsValidForFrame (frame)) - return; - - Type *self_type = self_var->GetType(); + if (self_var && + self_var->IsInScope(frame) && + self_var->LocationIsValidForFrame (frame)) { + Type *self_type = self_var->GetType(); + + if (!self_type) + return; + + TypeFromUser self_user_type(self_type->GetClangFullType(), + self_type->GetClangAST()); + } +#endif - if (!self_type) - return; + if (method_decl->isInstanceMethod()) + { + // self is a pointer to the object + + QualType class_pointer_type = method_decl->getASTContext().getObjCObjectPointerType(QualType(interface_type, 0)); - TypeFromUser self_user_type(self_type->GetClangFullType(), - self_type->GetClangAST()); + TypeFromUser self_user_type(class_pointer_type.getAsOpaquePtr(), + &method_decl->getASTContext()); - m_struct_vars->m_object_pointer_type = self_user_type; + m_struct_vars->m_object_pointer_type = self_user_type; + } + else + { + // self is a Class pointer + QualType class_type = method_decl->getASTContext().getObjCClassType(); + + TypeFromUser self_user_type(class_type.getAsOpaquePtr(), + &method_decl->getASTContext()); + + m_struct_vars->m_object_pointer_type = self_user_type; + } + return; } From jingham at apple.com Tue Feb 7 23:23:15 2012 From: jingham at apple.com (Jim Ingham) Date: Wed, 08 Feb 2012 05:23:15 -0000 Subject: [Lldb-commits] [lldb] r150057 - in /lldb/trunk: include/lldb/ include/lldb/API/ include/lldb/Breakpoint/ scripts/Python/interface/ source/API/ source/Breakpoint/ source/Commands/ source/Target/ tools/driver/ Message-ID: <20120208052316.069612A6C12C@llvm.org> Author: jingham Date: Tue Feb 7 23:23:15 2012 New Revision: 150057 URL: http://llvm.org/viewvc/llvm-project?rev=150057&view=rev Log: Send Breakpoint Changed events for all the relevant changes to breakpoints. Also, provide and use accessors for the thread options on breakpoints so we can control sending the appropriate events. Modified: lldb/trunk/include/lldb/API/SBBreakpoint.h lldb/trunk/include/lldb/API/SBProcess.h lldb/trunk/include/lldb/Breakpoint/Breakpoint.h lldb/trunk/include/lldb/Breakpoint/BreakpointLocation.h lldb/trunk/include/lldb/Breakpoint/BreakpointLocationList.h lldb/trunk/include/lldb/lldb-enumerations.h lldb/trunk/scripts/Python/interface/SBBreakpoint.i lldb/trunk/scripts/Python/interface/SBProcess.i lldb/trunk/source/API/SBBreakpoint.cpp lldb/trunk/source/API/SBBreakpointLocation.cpp lldb/trunk/source/API/SBProcess.cpp lldb/trunk/source/Breakpoint/Breakpoint.cpp lldb/trunk/source/Breakpoint/BreakpointLocation.cpp lldb/trunk/source/Breakpoint/BreakpointLocationCollection.cpp lldb/trunk/source/Breakpoint/BreakpointLocationList.cpp lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp lldb/trunk/source/Target/TargetList.cpp lldb/trunk/tools/driver/Driver.cpp lldb/trunk/tools/driver/Driver.h Modified: lldb/trunk/include/lldb/API/SBBreakpoint.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBBreakpoint.h?rev=150057&r1=150056&r2=150057&view=diff ============================================================================== --- lldb/trunk/include/lldb/API/SBBreakpoint.h (original) +++ lldb/trunk/include/lldb/API/SBBreakpoint.h Tue Feb 7 23:23:15 2012 @@ -115,6 +115,9 @@ bool GetDescription (lldb::SBStream &description); + static bool + EventIsBreakpointEvent (const lldb::SBEvent &event); + static lldb::BreakpointEventType GetBreakpointEventTypeFromEvent (const lldb::SBEvent& event); @@ -123,6 +126,10 @@ static lldb::SBBreakpointLocation GetBreakpointLocationAtIndexFromEvent (const lldb::SBEvent& event, uint32_t loc_idx); + + static uint32_t + GetNumBreakpointLocationsFromEvent (const lldb::SBEvent &event_sp); + private: friend class SBBreakpointLocation; Modified: lldb/trunk/include/lldb/API/SBProcess.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBProcess.h?rev=150057&r1=150056&r2=150057&view=diff ============================================================================== --- lldb/trunk/include/lldb/API/SBProcess.h (original) +++ lldb/trunk/include/lldb/API/SBProcess.h Tue Feb 7 23:23:15 2012 @@ -171,6 +171,9 @@ static lldb::SBProcess GetProcessFromEvent (const lldb::SBEvent &event); + + static bool + EventIsProcessEvent (const lldb::SBEvent &event); lldb::SBBroadcaster GetBroadcaster () const; Modified: lldb/trunk/include/lldb/Breakpoint/Breakpoint.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Breakpoint/Breakpoint.h?rev=150057&r1=150056&r2=150057&view=diff ============================================================================== --- lldb/trunk/include/lldb/Breakpoint/Breakpoint.h (original) +++ lldb/trunk/include/lldb/Breakpoint/Breakpoint.h Tue Feb 7 23:23:15 2012 @@ -106,7 +106,7 @@ GetFlavor () const; BreakpointEventData (lldb::BreakpointEventType sub_type, - lldb::BreakpointSP &new_breakpoint_sp); + const lldb::BreakpointSP &new_breakpoint_sp); virtual ~BreakpointEventData(); @@ -116,6 +116,12 @@ lldb::BreakpointSP & GetBreakpoint (); + + BreakpointLocationCollection & + GetBreakpointLocationCollection() + { + return m_locations; + } virtual void @@ -129,10 +135,14 @@ static lldb::BreakpointLocationSP GetBreakpointLocationAtIndexFromEvent (const lldb::EventSP &event_sp, uint32_t loc_idx); + + static uint32_t + GetNumBreakpointLocationsFromEvent (const lldb::EventSP &event_sp); + + static const BreakpointEventData * + GetEventDataFromEvent (const Event *event_sp); private: - static BreakpointEventData * - GetEventDataFromEvent (const lldb::EventSP &event_sp); lldb::BreakpointEventType m_breakpoint_event; lldb::BreakpointSP m_new_breakpoint_sp; @@ -343,7 +353,25 @@ /// The thread id for which the breakpoint hit will stop, LLDB_INVALID_THREAD_ID for all threads. //------------------------------------------------------------------ lldb::tid_t - GetThreadID (); + GetThreadID () const; + + void + SetThreadIndex (uint32_t index); + + uint32_t + GetThreadIndex() const; + + void + SetThreadName (const char *thread_name); + + const char * + GetThreadName () const; + + void + SetQueueName (const char *queue_name); + + const char * + GetQueueName () const; //------------------------------------------------------------------ /// Set the callback action invoked when the breakpoint is hit. @@ -531,11 +559,18 @@ //------------------------------------------------------------------ // For Breakpoint only //------------------------------------------------------------------ + bool m_being_created; Target &m_target; // The target that holds this breakpoint. lldb::SearchFilterSP m_filter_sp; // The filter that constrains the breakpoint's domain. lldb::BreakpointResolverSP m_resolver_sp; // The resolver that defines this breakpoint. BreakpointOptions m_options; // Settable breakpoint options BreakpointLocationList m_locations; // The list of locations currently found for this breakpoint. + + void + SendBreakpointChangedEvent (lldb::BreakpointEventType eventKind); + + void + SendBreakpointChangedEvent (BreakpointEventData *data); DISALLOW_COPY_AND_ASSIGN(Breakpoint); }; Modified: lldb/trunk/include/lldb/Breakpoint/BreakpointLocation.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Breakpoint/BreakpointLocation.h?rev=150057&r1=150056&r2=150057&view=diff ============================================================================== --- lldb/trunk/include/lldb/Breakpoint/BreakpointLocation.h (original) +++ lldb/trunk/include/lldb/Breakpoint/BreakpointLocation.h Tue Feb 7 23:23:15 2012 @@ -203,6 +203,27 @@ //------------------------------------------------------------------ void SetThreadID (lldb::tid_t thread_id); + + lldb::tid_t + GetThreadID (); + + void + SetThreadIndex (uint32_t index); + + uint32_t + GetThreadIndex() const; + + void + SetThreadName (const char *thread_name); + + const char * + GetThreadName () const; + + void + SetQueueName (const char *queue_name); + + const char * + GetQueueName () const; //------------------------------------------------------------------ // The next section deals with this location's breakpoint sites. @@ -366,11 +387,15 @@ //------------------------------------------------------------------ // Data members: //------------------------------------------------------------------ + bool m_being_created; Address m_address; ///< The address defining this location. Breakpoint &m_owner; ///< The breakpoint that produced this object. std::auto_ptr m_options_ap; ///< Breakpoint options pointer, NULL if we're using our breakpoint's options. lldb::BreakpointSiteSP m_bp_site_sp; ///< Our breakpoint site (it may be shared by more than one location.) + void + SendBreakpointLocationChangedEvent (lldb::BreakpointEventType eventKind); + DISALLOW_COPY_AND_ASSIGN (BreakpointLocation); }; Modified: lldb/trunk/include/lldb/Breakpoint/BreakpointLocationList.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Breakpoint/BreakpointLocationList.h?rev=150057&r1=150056&r2=150057&view=diff ============================================================================== --- lldb/trunk/include/lldb/Breakpoint/BreakpointLocationList.h (original) +++ lldb/trunk/include/lldb/Breakpoint/BreakpointLocationList.h Tue Feb 7 23:23:15 2012 @@ -223,7 +223,7 @@ /// here because only Breakpoints are allowed to create the /// breakpoint location list. //------------------------------------------------------------------ - BreakpointLocationList(); + BreakpointLocationList(Breakpoint &owner); //------------------------------------------------------------------ /// Add the breakpoint \a bp_loc_sp to the list. @@ -236,18 +236,29 @@ /// Returns breakpoint location id. //------------------------------------------------------------------ lldb::BreakpointLocationSP - Create (Breakpoint &owner, const Address &addr); -// Add (lldb::BreakpointLocationSP& bp_loc_sp); + Create (const Address &addr); + + void + StartRecordingNewLocations(BreakpointLocationCollection &new_locations); + + void + StopRecordingNewLocations(); + + lldb::BreakpointLocationSP + AddLocation (const Address &addr, + bool *new_location = NULL); typedef std::vector collection; typedef std::map addr_map; + Breakpoint &m_owner; collection m_locations; addr_map m_address_to_location; mutable Mutex m_mutex; lldb::break_id_t m_next_id; + BreakpointLocationCollection *m_new_location_recorder; }; } // namespace lldb_private Modified: lldb/trunk/include/lldb/lldb-enumerations.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-enumerations.h?rev=150057&r1=150056&r2=150057&view=diff ============================================================================== --- lldb/trunk/include/lldb/lldb-enumerations.h (original) +++ lldb/trunk/include/lldb/lldb-enumerations.h Tue Feb 7 23:23:15 2012 @@ -284,9 +284,15 @@ eBreakpointEventTypeInvalidType = (1u << 0), eBreakpointEventTypeAdded = (1u << 1), eBreakpointEventTypeRemoved = (1u << 2), - eBreakpointEventTypeLocationsAdded = (1u << 3), + eBreakpointEventTypeLocationsAdded = (1u << 3), // Locations added doesn't get sent when the breakpoint is created eBreakpointEventTypeLocationsRemoved = (1u << 4), - eBreakpointEventTypeLocationsResolved = (1u << 5) + eBreakpointEventTypeLocationsResolved = (1u << 5), + eBreakpointEventTypeEnabled = (1u << 6), + eBreakpointEventTypeDisabled = (1u << 7), + eBreakpointEventTypeCommandChanged = (1u << 8), + eBreakpointEventTypeConditionChanged = (1u << 9), + eBreakpointEventTypeIgnoreChanged = (1u << 10), + eBreakpointEventTypeThreadChanged = (1u << 11) } BreakpointEventType; Modified: lldb/trunk/scripts/Python/interface/SBBreakpoint.i URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBBreakpoint.i?rev=150057&r1=150056&r2=150057&view=diff ============================================================================== --- lldb/trunk/scripts/Python/interface/SBBreakpoint.i (original) +++ lldb/trunk/scripts/Python/interface/SBBreakpoint.i Tue Feb 7 23:23:15 2012 @@ -180,6 +180,9 @@ bool GetDescription (lldb::SBStream &description); + static bool + EventIsBreakpointEvent (const lldb::SBEvent &event); + static lldb::BreakpointEventType GetBreakpointEventTypeFromEvent (const lldb::SBEvent& event); @@ -188,6 +191,9 @@ static lldb::SBBreakpointLocation GetBreakpointLocationAtIndexFromEvent (const lldb::SBEvent& event, uint32_t loc_idx); + + static uint32_t + GetNumBreakpointLocationsFromEvent (const lldb::SBEvent &event_sp); }; } // namespace lldb Modified: lldb/trunk/scripts/Python/interface/SBProcess.i URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBProcess.i?rev=150057&r1=150056&r2=150057&view=diff ============================================================================== --- lldb/trunk/scripts/Python/interface/SBProcess.i (original) +++ lldb/trunk/scripts/Python/interface/SBProcess.i Tue Feb 7 23:23:15 2012 @@ -269,6 +269,9 @@ static lldb::SBProcess GetProcessFromEvent (const lldb::SBEvent &event); + static bool + EventIsProcessEvent (const lldb::SBEvent &event); + lldb::SBBroadcaster GetBroadcaster () const; Modified: lldb/trunk/source/API/SBBreakpoint.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBBreakpoint.cpp?rev=150057&r1=150056&r2=150057&view=diff ============================================================================== --- lldb/trunk/source/API/SBBreakpoint.cpp (original) +++ lldb/trunk/source/API/SBBreakpoint.cpp Tue Feb 7 23:23:15 2012 @@ -557,6 +557,13 @@ return m_opaque_sp; } +bool +SBBreakpoint::EventIsBreakpointEvent (const lldb::SBEvent &event) +{ + return Breakpoint::BreakpointEventData::GetEventDataFromEvent(event.get()) != NULL; + +} + BreakpointEventType SBBreakpoint::GetBreakpointEventTypeFromEvent (const SBEvent& event) { @@ -583,4 +590,13 @@ return sb_breakpoint_loc; } +uint32_t +SBBreakpoint::GetNumBreakpointLocationsFromEvent (const lldb::SBEvent &event) +{ + uint32_t num_locations = 0; + if (event.IsValid()) + num_locations = (Breakpoint::BreakpointEventData::GetNumBreakpointLocationsFromEvent (event.GetSP())); + return num_locations; +} + Modified: lldb/trunk/source/API/SBBreakpointLocation.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBBreakpointLocation.cpp?rev=150057&r1=150056&r2=150057&view=diff ============================================================================== --- lldb/trunk/source/API/SBBreakpointLocation.cpp (original) +++ lldb/trunk/source/API/SBBreakpointLocation.cpp Tue Feb 7 23:23:15 2012 @@ -176,9 +176,7 @@ if (m_opaque_sp) { Mutex::Locker api_locker (m_opaque_sp->GetBreakpoint().GetTarget().GetAPIMutex()); - const ThreadSpec *thread_spec = m_opaque_sp->GetLocationOptions()->GetThreadSpecNoCreate(); - if (thread_spec) - tid = thread_spec->GetTID(); + return m_opaque_sp->GetThreadID(); } return tid; } @@ -189,7 +187,7 @@ if (m_opaque_sp) { Mutex::Locker api_locker (m_opaque_sp->GetBreakpoint().GetTarget().GetAPIMutex()); - m_opaque_sp->GetLocationOptions()->GetThreadSpec()->SetIndex (index); + m_opaque_sp->SetThreadIndex (index); } } @@ -200,9 +198,7 @@ if (m_opaque_sp) { Mutex::Locker api_locker (m_opaque_sp->GetBreakpoint().GetTarget().GetAPIMutex()); - const ThreadSpec *thread_spec = m_opaque_sp->GetOptionsNoCreate()->GetThreadSpecNoCreate(); - if (thread_spec) - thread_idx = thread_spec->GetIndex(); + return m_opaque_sp->GetThreadIndex(); } return thread_idx; } @@ -214,7 +210,7 @@ if (m_opaque_sp) { Mutex::Locker api_locker (m_opaque_sp->GetBreakpoint().GetTarget().GetAPIMutex()); - m_opaque_sp->GetLocationOptions()->GetThreadSpec()->SetName (thread_name); + m_opaque_sp->SetThreadName (thread_name); } } @@ -224,9 +220,7 @@ if (m_opaque_sp) { Mutex::Locker api_locker (m_opaque_sp->GetBreakpoint().GetTarget().GetAPIMutex()); - const ThreadSpec *thread_spec = m_opaque_sp->GetOptionsNoCreate()->GetThreadSpecNoCreate(); - if (thread_spec) - return thread_spec->GetName(); + return m_opaque_sp->GetThreadName(); } return NULL; } @@ -237,7 +231,7 @@ if (m_opaque_sp) { Mutex::Locker api_locker (m_opaque_sp->GetBreakpoint().GetTarget().GetAPIMutex()); - m_opaque_sp->GetLocationOptions()->GetThreadSpec()->SetQueueName (queue_name); + m_opaque_sp->SetQueueName (queue_name); } } @@ -247,9 +241,7 @@ if (m_opaque_sp) { Mutex::Locker api_locker (m_opaque_sp->GetBreakpoint().GetTarget().GetAPIMutex()); - const ThreadSpec *thread_spec = m_opaque_sp->GetOptionsNoCreate()->GetThreadSpecNoCreate(); - if (thread_spec) - return thread_spec->GetQueueName(); + m_opaque_sp->GetQueueName (); } return NULL; } Modified: lldb/trunk/source/API/SBProcess.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBProcess.cpp?rev=150057&r1=150056&r2=150057&view=diff ============================================================================== --- lldb/trunk/source/API/SBProcess.cpp (original) +++ lldb/trunk/source/API/SBProcess.cpp Tue Feb 7 23:23:15 2012 @@ -740,6 +740,11 @@ return process; } +bool +SBProcess::EventIsProcessEvent (const SBEvent &event) +{ + return Process::ProcessEventData::GetEventDataFromEvent(event.get()) != NULL; +} SBBroadcaster SBProcess::GetBroadcaster () const Modified: lldb/trunk/source/Breakpoint/Breakpoint.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/Breakpoint.cpp?rev=150057&r1=150056&r2=150057&view=diff ============================================================================== --- lldb/trunk/source/Breakpoint/Breakpoint.cpp (original) +++ lldb/trunk/source/Breakpoint/Breakpoint.cpp Tue Feb 7 23:23:15 2012 @@ -45,12 +45,14 @@ // Breakpoint constructor //---------------------------------------------------------------------- Breakpoint::Breakpoint(Target &target, SearchFilterSP &filter_sp, BreakpointResolverSP &resolver_sp) : + m_being_created(true), m_target (target), m_filter_sp (filter_sp), m_resolver_sp (resolver_sp), m_options (), - m_locations () + m_locations (*this) { + m_being_created = false; } //---------------------------------------------------------------------- @@ -83,21 +85,7 @@ BreakpointLocationSP Breakpoint::AddLocation (const Address &addr, bool *new_location) { - if (new_location) - *new_location = false; - BreakpointLocationSP bp_loc_sp (m_locations.FindByAddress(addr)); - if (!bp_loc_sp) - { - bp_loc_sp = m_locations.Create (*this, addr); - if (bp_loc_sp) - { - bp_loc_sp->ResolveBreakpointSite(); - - if (new_location) - *new_location = true; - } - } - return bp_loc_sp; + return m_locations.AddLocation (addr, new_location); } BreakpointLocationSP @@ -135,11 +123,17 @@ void Breakpoint::SetEnabled (bool enable) { + if (enable == m_options.IsEnabled()) + return; + m_options.SetEnabled(enable); if (enable) m_locations.ResolveAllBreakpointSites(); else m_locations.ClearAllBreakpointSites(); + + SendBreakpointChangedEvent (enable ? eBreakpointEventTypeEnabled : eBreakpointEventTypeDisabled); + } bool @@ -151,7 +145,11 @@ void Breakpoint::SetIgnoreCount (uint32_t n) { + if (m_options.GetIgnoreCount() == n) + return; + m_options.SetIgnoreCount(n); + SendBreakpointChangedEvent (eBreakpointEventTypeIgnoreChanged); } uint32_t @@ -169,22 +167,84 @@ void Breakpoint::SetThreadID (lldb::tid_t thread_id) { + if (m_options.GetThreadSpec()->GetTID() == thread_id) + return; + m_options.GetThreadSpec()->SetTID(thread_id); + SendBreakpointChangedEvent (eBreakpointEventTypeThreadChanged); } lldb::tid_t -Breakpoint::GetThreadID () +Breakpoint::GetThreadID () const { - if (m_options.GetThreadSpec() == NULL) + if (m_options.GetThreadSpecNoCreate() == NULL) return LLDB_INVALID_THREAD_ID; else - return m_options.GetThreadSpec()->GetTID(); + return m_options.GetThreadSpecNoCreate()->GetTID(); +} + +void +Breakpoint::SetThreadIndex (uint32_t index) +{ + if (m_options.GetThreadSpec()->GetIndex() == index) + return; + + m_options.GetThreadSpec()->SetIndex(index); + SendBreakpointChangedEvent (eBreakpointEventTypeThreadChanged); +} + +uint32_t +Breakpoint::GetThreadIndex() const +{ + if (m_options.GetThreadSpecNoCreate() == NULL) + return 0; + else + return m_options.GetThreadSpecNoCreate()->GetIndex(); +} + +void +Breakpoint::SetThreadName (const char *thread_name) +{ + if (::strcmp (m_options.GetThreadSpec()->GetName(), thread_name) == 0) + return; + + m_options.GetThreadSpec()->SetName (thread_name); + SendBreakpointChangedEvent (eBreakpointEventTypeThreadChanged); +} + +const char * +Breakpoint::GetThreadName () const +{ + if (m_options.GetThreadSpecNoCreate() == NULL) + return NULL; + else + return m_options.GetThreadSpecNoCreate()->GetName(); +} + +void +Breakpoint::SetQueueName (const char *queue_name) +{ + if (::strcmp (m_options.GetThreadSpec()->GetQueueName(), queue_name) == 0) + return; + + m_options.GetThreadSpec()->SetQueueName (queue_name); + SendBreakpointChangedEvent (eBreakpointEventTypeThreadChanged); +} + +const char * +Breakpoint::GetQueueName () const +{ + if (m_options.GetThreadSpecNoCreate() == NULL) + return NULL; + else + return m_options.GetThreadSpecNoCreate()->GetQueueName(); } void Breakpoint::SetCondition (const char *condition) { m_options.SetCondition (condition); + SendBreakpointChangedEvent (eBreakpointEventTypeConditionChanged); } ThreadPlan * @@ -206,6 +266,8 @@ // The default "Baton" class will keep a copy of "baton" and won't free // or delete it when it goes goes out of scope. m_options.SetCallback(callback, BatonSP (new Baton(baton)), is_synchronous); + + SendBreakpointChangedEvent (eBreakpointEventTypeCommandChanged); } // This function is used when a baton needs to be freed and therefore is @@ -309,9 +371,31 @@ new_modules.AppendIfNeeded (module_sp); } + if (new_modules.GetSize() > 0) { - ResolveBreakpointInModules(new_modules); + // If this is not an internal breakpoint, set up to record the new locations, then dispatch + // an event with the new locations. + if (!IsInternal()) + { + BreakpointEventData *new_locations_event = new BreakpointEventData (eBreakpointEventTypeLocationsAdded, + shared_from_this()); + + m_locations.StartRecordingNewLocations(new_locations_event->GetBreakpointLocationCollection()); + + ResolveBreakpointInModules(new_modules); + + m_locations.StopRecordingNewLocations(); + if (new_locations_event->GetBreakpointLocationCollection().GetSize() != 0) + { + SendBreakpointChangedEvent (new_locations_event); + } + else + delete new_locations_event; + } + else + ResolveBreakpointInModules(new_modules); + } } else @@ -323,6 +407,13 @@ // the same? Or do we need to do an equality on modules that is an // "equivalence"??? + BreakpointEventData *removed_locations_event; + if (!IsInternal()) + removed_locations_event = new BreakpointEventData (eBreakpointEventTypeLocationsRemoved, + shared_from_this()); + else + removed_locations_event = NULL; + for (size_t i = 0; i < module_list.GetSize(); i++) { ModuleSP module_sp (module_list.GetModuleAtIndex (i)); @@ -340,10 +431,15 @@ // so we always get complete hit count and breakpoint // lifetime info break_loc->ClearBreakpointSite(); + if (removed_locations_event) + { + removed_locations_event->GetBreakpointLocationCollection().Add(break_loc); + } } } } } + SendBreakpointChangedEvent (removed_locations_event); } } @@ -429,7 +525,7 @@ } Breakpoint::BreakpointEventData::BreakpointEventData (BreakpointEventType sub_type, - BreakpointSP &new_breakpoint_sp) : + const BreakpointSP &new_breakpoint_sp) : EventData (), m_breakpoint_event (sub_type), m_new_breakpoint_sp (new_breakpoint_sp) @@ -471,14 +567,14 @@ { } -Breakpoint::BreakpointEventData * -Breakpoint::BreakpointEventData::GetEventDataFromEvent (const EventSP &event_sp) +const Breakpoint::BreakpointEventData * +Breakpoint::BreakpointEventData::GetEventDataFromEvent (const Event *event) { - if (event_sp) + if (event) { - EventData *event_data = event_sp->GetData(); + const EventData *event_data = event->GetData(); if (event_data && event_data->GetFlavor() == BreakpointEventData::GetFlavorString()) - return static_cast (event_sp->GetData()); + return static_cast (event->GetData()); } return NULL; } @@ -486,7 +582,7 @@ BreakpointEventType Breakpoint::BreakpointEventData::GetBreakpointEventTypeFromEvent (const EventSP &event_sp) { - BreakpointEventData *data = GetEventDataFromEvent (event_sp); + const BreakpointEventData *data = GetEventDataFromEvent (event_sp.get()); if (data == NULL) return eBreakpointEventTypeInvalidType; @@ -499,24 +595,32 @@ { BreakpointSP bp_sp; - BreakpointEventData *data = GetEventDataFromEvent (event_sp); + const BreakpointEventData *data = GetEventDataFromEvent (event_sp.get()); if (data) - bp_sp = data->GetBreakpoint(); + bp_sp = data->m_new_breakpoint_sp; return bp_sp; } +uint32_t +Breakpoint::BreakpointEventData::GetNumBreakpointLocationsFromEvent (const EventSP &event_sp) +{ + const BreakpointEventData *data = GetEventDataFromEvent (event_sp.get()); + if (data) + return data->m_locations.GetSize(); + + return 0; +} + lldb::BreakpointLocationSP Breakpoint::BreakpointEventData::GetBreakpointLocationAtIndexFromEvent (const lldb::EventSP &event_sp, uint32_t bp_loc_idx) { lldb::BreakpointLocationSP bp_loc_sp; - BreakpointEventData *data = GetEventDataFromEvent (event_sp); + const BreakpointEventData *data = GetEventDataFromEvent (event_sp.get()); if (data) { - Breakpoint *bp = data->GetBreakpoint().get(); - if (bp) - bp_loc_sp = bp->GetLocationAtIndex(bp_loc_idx); + bp_loc_sp = data->m_locations.GetByIndex(bp_loc_idx); } return bp_loc_sp; @@ -556,3 +660,31 @@ { m_filter_sp->GetDescription (s); } + +void +Breakpoint::SendBreakpointChangedEvent (lldb::BreakpointEventType eventKind) +{ + if (!m_being_created + && !IsInternal() + && GetTarget().EventTypeHasListeners(Target::eBroadcastBitBreakpointChanged)) + { + BreakpointEventData *data = new Breakpoint::BreakpointEventData (eventKind, shared_from_this()); + + GetTarget().BroadcastEvent (Target::eBroadcastBitBreakpointChanged, data); + } +} + +void +Breakpoint::SendBreakpointChangedEvent (BreakpointEventData *data) +{ + + if (data == NULL) + return; + + if (!m_being_created + && !IsInternal() + && GetTarget().EventTypeHasListeners(Target::eBroadcastBitBreakpointChanged)) + GetTarget().BroadcastEvent (Target::eBroadcastBitBreakpointChanged, data); + else + delete data; +} Modified: lldb/trunk/source/Breakpoint/BreakpointLocation.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointLocation.cpp?rev=150057&r1=150056&r2=150057&view=diff ============================================================================== --- lldb/trunk/source/Breakpoint/BreakpointLocation.cpp (original) +++ lldb/trunk/source/Breakpoint/BreakpointLocation.cpp Tue Feb 7 23:23:15 2012 @@ -38,12 +38,14 @@ bool hardware ) : StoppointLocation (loc_id, addr.GetOpcodeLoadAddress(&owner.GetTarget()), hardware), + m_being_created(true), m_address (addr), m_owner (owner), m_options_ap (), m_bp_site_sp () { SetThreadID (tid); + m_being_created = false; } BreakpointLocation::~BreakpointLocation() @@ -92,6 +94,7 @@ { ClearBreakpointSite(); } + SendBreakpointLocationChangedEvent (enabled ? eBreakpointEventTypeEnabled : eBreakpointEventTypeDisabled); } void @@ -106,6 +109,89 @@ if (m_options_ap.get() != NULL) m_options_ap->SetThreadID (thread_id); } + SendBreakpointLocationChangedEvent (eBreakpointEventTypeThreadChanged); +} + +lldb::tid_t +BreakpointLocation::GetThreadID () +{ + if (GetOptionsNoCreate()->GetThreadSpecNoCreate()) + return GetOptionsNoCreate()->GetThreadSpecNoCreate()->GetTID(); + else + return LLDB_INVALID_THREAD_ID; +} + +void +BreakpointLocation::SetThreadIndex (uint32_t index) +{ + if (index != 0) + GetLocationOptions()->GetThreadSpec()->SetIndex(index); + else + { + // If we're resetting this to an invalid thread id, then + // don't make an options pointer just to do that. + if (m_options_ap.get() != NULL) + m_options_ap->GetThreadSpec()->SetIndex(index); + } + SendBreakpointLocationChangedEvent (eBreakpointEventTypeThreadChanged); + +} + +uint32_t +BreakpointLocation::GetThreadIndex() const +{ + if (GetOptionsNoCreate()->GetThreadSpecNoCreate()) + return GetOptionsNoCreate()->GetThreadSpecNoCreate()->GetIndex(); + else + return 0; +} + +void +BreakpointLocation::SetThreadName (const char *thread_name) +{ + if (thread_name != NULL) + GetLocationOptions()->GetThreadSpec()->SetName(thread_name); + else + { + // If we're resetting this to an invalid thread id, then + // don't make an options pointer just to do that. + if (m_options_ap.get() != NULL) + m_options_ap->GetThreadSpec()->SetName(thread_name); + } + SendBreakpointLocationChangedEvent (eBreakpointEventTypeThreadChanged); +} + +const char * +BreakpointLocation::GetThreadName () const +{ + if (GetOptionsNoCreate()->GetThreadSpecNoCreate()) + return GetOptionsNoCreate()->GetThreadSpecNoCreate()->GetName(); + else + return NULL; +} + +void +BreakpointLocation::SetQueueName (const char *queue_name) +{ + if (queue_name != NULL) + GetLocationOptions()->GetThreadSpec()->SetQueueName(queue_name); + else + { + // If we're resetting this to an invalid thread id, then + // don't make an options pointer just to do that. + if (m_options_ap.get() != NULL) + m_options_ap->GetThreadSpec()->SetQueueName(queue_name); + } + SendBreakpointLocationChangedEvent (eBreakpointEventTypeThreadChanged); +} + +const char * +BreakpointLocation::GetQueueName () const +{ + if (GetOptionsNoCreate()->GetThreadSpecNoCreate()) + return GetOptionsNoCreate()->GetThreadSpecNoCreate()->GetQueueName(); + else + return NULL; } bool @@ -124,6 +210,7 @@ // The default "Baton" class will keep a copy of "baton" and won't free // or delete it when it goes goes out of scope. GetLocationOptions()->SetCallback(callback, BatonSP (new Baton(baton)), is_synchronous); + SendBreakpointLocationChangedEvent (eBreakpointEventTypeCommandChanged); } void @@ -131,6 +218,7 @@ bool is_synchronous) { GetLocationOptions()->SetCallback (callback, baton_sp, is_synchronous); + SendBreakpointLocationChangedEvent (eBreakpointEventTypeCommandChanged); } @@ -144,6 +232,7 @@ BreakpointLocation::SetCondition (const char *condition) { GetLocationOptions()->SetCondition (condition); + SendBreakpointLocationChangedEvent (eBreakpointEventTypeConditionChanged); } ThreadPlan * @@ -171,6 +260,7 @@ BreakpointLocation::SetIgnoreCount (uint32_t n) { GetLocationOptions()->SetIgnoreCount(n); + SendBreakpointLocationChangedEvent (eBreakpointEventTypeIgnoreChanged); } const BreakpointOptions * @@ -420,3 +510,18 @@ GetHitCount(), GetOptionsNoCreate()->GetIgnoreCount()); } + +void +BreakpointLocation::SendBreakpointLocationChangedEvent (lldb::BreakpointEventType eventKind) +{ + if (!m_being_created + && !m_owner.IsInternal() + && m_owner.GetTarget().EventTypeHasListeners(Target::eBroadcastBitBreakpointChanged)) + { + Breakpoint::BreakpointEventData *data = new Breakpoint::BreakpointEventData (eventKind, + m_owner.shared_from_this()); + data->GetBreakpointLocationCollection().Add (shared_from_this()); + m_owner.GetTarget().BroadcastEvent (Target::eBroadcastBitBreakpointChanged, data); + } +} + Modified: lldb/trunk/source/Breakpoint/BreakpointLocationCollection.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointLocationCollection.cpp?rev=150057&r1=150056&r2=150057&view=diff ============================================================================== --- lldb/trunk/source/Breakpoint/BreakpointLocationCollection.cpp (original) +++ lldb/trunk/source/Breakpoint/BreakpointLocationCollection.cpp Tue Feb 7 23:23:15 2012 @@ -16,7 +16,6 @@ #include "lldb/Core/ModuleList.h" #include "lldb/Breakpoint/Breakpoint.h" #include "lldb/Breakpoint/BreakpointLocation.h" -#include "lldb/Breakpoint/BreakpointLocationList.h" #include "lldb/Target/Thread.h" #include "lldb/Target/ThreadSpec.h" Modified: lldb/trunk/source/Breakpoint/BreakpointLocationList.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointLocationList.cpp?rev=150057&r1=150056&r2=150057&view=diff ============================================================================== --- lldb/trunk/source/Breakpoint/BreakpointLocationList.cpp (original) +++ lldb/trunk/source/Breakpoint/BreakpointLocationList.cpp Tue Feb 7 23:23:15 2012 @@ -20,10 +20,12 @@ using namespace lldb; using namespace lldb_private; -BreakpointLocationList::BreakpointLocationList() : +BreakpointLocationList::BreakpointLocationList(Breakpoint &owner) : m_locations(), m_address_to_location (), - m_mutex (Mutex::eMutexTypeRecursive) + m_mutex (Mutex::eMutexTypeRecursive), + m_new_location_recorder (NULL), + m_owner (owner) { } @@ -32,12 +34,12 @@ } BreakpointLocationSP -BreakpointLocationList::Create (Breakpoint &bp, const Address &addr) +BreakpointLocationList::Create (const Address &addr) { Mutex::Locker locker (m_mutex); // The location ID is just the size of the location list + 1 lldb::break_id_t bp_loc_id = m_locations.size() + 1; - BreakpointLocationSP bp_loc_sp (new BreakpointLocation (bp_loc_id, bp, addr)); + BreakpointLocationSP bp_loc_sp (new BreakpointLocation (bp_loc_id, m_owner, addr)); m_locations.push_back (bp_loc_sp); m_address_to_location[addr] = bp_loc_sp; return bp_loc_sp; @@ -217,3 +219,45 @@ } } +BreakpointLocationSP +BreakpointLocationList::AddLocation (const Address &addr, bool *new_location) +{ + Mutex::Locker locker (m_mutex); + + if (new_location) + *new_location = false; + BreakpointLocationSP bp_loc_sp (FindByAddress(addr)); + if (!bp_loc_sp) + { + bp_loc_sp = Create (addr); + if (bp_loc_sp) + { + bp_loc_sp->ResolveBreakpointSite(); + + if (new_location) + *new_location = true; + if(m_new_location_recorder) + { + m_new_location_recorder->Add(bp_loc_sp); + } + } + } + return bp_loc_sp; +} + + +void +BreakpointLocationList::StartRecordingNewLocations (BreakpointLocationCollection &new_locations) +{ + Mutex::Locker locker (m_mutex); + assert (m_new_location_recorder == NULL); + m_new_location_recorder = &new_locations; +} + +void +BreakpointLocationList::StopRecordingNewLocations () +{ + Mutex::Locker locker (m_mutex); + m_new_location_recorder = NULL; +} + Modified: lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp?rev=150057&r1=150056&r2=150057&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp Tue Feb 7 23:23:15 2012 @@ -1516,16 +1516,16 @@ location->SetThreadID (m_options.m_thread_id); if (m_options.m_thread_index_passed) - location->GetLocationOptions()->GetThreadSpec()->SetIndex(m_options.m_thread_index); + location->SetThreadIndex(m_options.m_thread_index); if (m_options.m_name_passed) - location->GetLocationOptions()->GetThreadSpec()->SetName(m_options.m_thread_name.c_str()); + location->SetThreadName(m_options.m_thread_name.c_str()); if (m_options.m_queue_passed) - location->GetLocationOptions()->GetThreadSpec()->SetQueueName(m_options.m_queue_name.c_str()); + location->SetQueueName(m_options.m_queue_name.c_str()); if (m_options.m_ignore_count != 0) - location->GetLocationOptions()->SetIgnoreCount(m_options.m_ignore_count); + location->SetIgnoreCount(m_options.m_ignore_count); if (m_options.m_enable_passed) location->SetEnabled (m_options.m_enable_value); @@ -1540,16 +1540,16 @@ bp->SetThreadID (m_options.m_thread_id); if (m_options.m_thread_index_passed) - bp->GetOptions()->GetThreadSpec()->SetIndex(m_options.m_thread_index); + bp->SetThreadIndex(m_options.m_thread_index); if (m_options.m_name_passed) - bp->GetOptions()->GetThreadSpec()->SetName(m_options.m_thread_name.c_str()); + bp->SetThreadName(m_options.m_thread_name.c_str()); if (m_options.m_queue_passed) - bp->GetOptions()->GetThreadSpec()->SetQueueName(m_options.m_queue_name.c_str()); + bp->SetQueueName(m_options.m_queue_name.c_str()); if (m_options.m_ignore_count != 0) - bp->GetOptions()->SetIgnoreCount(m_options.m_ignore_count); + bp->SetIgnoreCount(m_options.m_ignore_count); if (m_options.m_enable_passed) bp->SetEnabled (m_options.m_enable_value); Modified: lldb/trunk/source/Target/TargetList.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/TargetList.cpp?rev=150057&r1=150056&r2=150057&view=diff ============================================================================== --- lldb/trunk/source/Target/TargetList.cpp (original) +++ lldb/trunk/source/Target/TargetList.cpp Tue Feb 7 23:23:15 2012 @@ -161,6 +161,9 @@ Mutex::Locker locker(m_target_list_mutex); m_selected_target_idx = m_target_list.size(); m_target_list.push_back(target_sp); + + // Now sign the Debugger up to listen to target events for this target: + debugger.GetListener().StartListeningForEvents(target_sp.get(), Target::eBroadcastBitBreakpointChanged); } return error; Modified: lldb/trunk/tools/driver/Driver.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/driver/Driver.cpp?rev=150057&r1=150056&r2=150057&view=diff ============================================================================== --- lldb/trunk/tools/driver/Driver.cpp (original) +++ lldb/trunk/tools/driver/Driver.cpp Tue Feb 7 23:23:15 2012 @@ -22,6 +22,7 @@ #include #include "IOChannel.h" +#include "lldb/API/SBBreakpoint.h" #include "lldb/API/SBCommandInterpreter.h" #include "lldb/API/SBCommandReturnObject.h" #include "lldb/API/SBCommunication.h" @@ -824,6 +825,46 @@ } } +// This function handles events that were broadcast by the process. +void +Driver::HandleBreakpointEvent (const SBEvent &event) +{ + using namespace lldb; + const uint32_t event_type = SBBreakpoint::GetBreakpointEventTypeFromEvent (event); + + if (event_type & eBreakpointEventTypeAdded + || event_type & eBreakpointEventTypeRemoved + || event_type & eBreakpointEventTypeEnabled + || event_type & eBreakpointEventTypeDisabled + || event_type & eBreakpointEventTypeCommandChanged + || event_type & eBreakpointEventTypeConditionChanged + || event_type & eBreakpointEventTypeIgnoreChanged + || event_type & eBreakpointEventTypeLocationsResolved) + { + // Don't do anything about these events, since the breakpoint commands already echo these actions. + } + else if (event_type & eBreakpointEventTypeLocationsAdded) + { + char message[256]; + uint32_t num_new_locations = SBBreakpoint::GetNumBreakpointLocationsFromEvent(event); + if (num_new_locations > 0) + { + SBBreakpoint breakpoint = SBBreakpoint::GetBreakpointFromEvent(event); + int message_len = ::snprintf (message, sizeof(message), "%d locations added to breakpoint %d\n", + num_new_locations, + breakpoint.GetID()); + m_io_channel_ap->OutWrite(message, message_len, ASYNC); + } + } + else if (event_type & eBreakpointEventTypeLocationsRemoved) + { + // These locations just get disabled, not sure it is worth spamming folks about this on the command line. + } + else if (event_type & eBreakpointEventTypeLocationsResolved) + { + // This might be an interesting thing to note, but I'm going to leave it quiet for now, it just looked noisy. + } +} // This function handles events that were broadcast by the process. void @@ -1348,10 +1389,14 @@ else done = HandleIOEvent (event); } - else if (event.BroadcasterMatchesRef (m_debugger.GetSelectedTarget().GetProcess().GetBroadcaster())) + else if (SBProcess::EventIsProcessEvent (event)) { HandleProcessEvent (event); } + else if (SBBreakpoint::EventIsBreakpointEvent (event)) + { + HandleBreakpointEvent (event); + } else if (event.BroadcasterMatchesRef (sb_interpreter.GetBroadcaster())) { if (event_type & SBCommandInterpreter::eBroadcastBitQuitCommandReceived) Modified: lldb/trunk/tools/driver/Driver.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/driver/Driver.h?rev=150057&r1=150056&r2=150057&view=diff ============================================================================== --- lldb/trunk/tools/driver/Driver.h (original) +++ lldb/trunk/tools/driver/Driver.h Tue Feb 7 23:23:15 2012 @@ -62,6 +62,9 @@ void HandleProcessEvent (const lldb::SBEvent &event); + void + HandleBreakpointEvent (const lldb::SBEvent &event); + lldb::SBError ParseArgs (int argc, const char *argv[], FILE *out_fh, bool &do_exit); From jmolenda at apple.com Wed Feb 8 01:31:16 2012 From: jmolenda at apple.com (Jason Molenda) Date: Wed, 08 Feb 2012 07:31:16 -0000 Subject: [Lldb-commits] [lldb] r150063 - in /lldb/trunk: lldb.xcodeproj/project.pbxproj resources/LLDB-Info.plist Message-ID: <20120208073116.771A92A6C12C@llvm.org> Author: jmolenda Date: Wed Feb 8 01:31:16 2012 New Revision: 150063 URL: http://llvm.org/viewvc/llvm-project?rev=150063&view=rev Log: Version bump to 113. Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj lldb/trunk/resources/LLDB-Info.plist Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=150063&r1=150062&r2=150063&view=diff ============================================================================== --- lldb/trunk/lldb.xcodeproj/project.pbxproj (original) +++ lldb/trunk/lldb.xcodeproj/project.pbxproj Wed Feb 8 01:31:16 2012 @@ -3744,9 +3744,9 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; - CURRENT_PROJECT_VERSION = 109; + CURRENT_PROJECT_VERSION = 113; DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 109; + DYLIB_CURRENT_VERSION = 113; EXPORTED_SYMBOLS_FILE = "resources/lldb-framework-exports"; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -3804,10 +3804,10 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; - CURRENT_PROJECT_VERSION = 109; + CURRENT_PROJECT_VERSION = 113; DEAD_CODE_STRIPPING = YES; DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 109; + DYLIB_CURRENT_VERSION = 113; EXPORTED_SYMBOLS_FILE = "resources/lldb-framework-exports"; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -3863,8 +3863,8 @@ 2689FFD513353D7A00698AC0 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - CURRENT_PROJECT_VERSION = 109; - DYLIB_CURRENT_VERSION = 109; + CURRENT_PROJECT_VERSION = 113; + DYLIB_CURRENT_VERSION = 113; EXECUTABLE_EXTENSION = a; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -3892,8 +3892,8 @@ 2689FFD613353D7A00698AC0 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - CURRENT_PROJECT_VERSION = 109; - DYLIB_CURRENT_VERSION = 109; + CURRENT_PROJECT_VERSION = 113; + DYLIB_CURRENT_VERSION = 113; EXECUTABLE_EXTENSION = a; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -3921,8 +3921,8 @@ 2689FFD713353D7A00698AC0 /* BuildAndIntegration */ = { isa = XCBuildConfiguration; buildSettings = { - CURRENT_PROJECT_VERSION = 109; - DYLIB_CURRENT_VERSION = 109; + CURRENT_PROJECT_VERSION = 113; + DYLIB_CURRENT_VERSION = 113; EXECUTABLE_EXTENSION = a; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -4002,7 +4002,7 @@ isa = XCBuildConfiguration; buildSettings = { COPY_PHASE_STRIP = YES; - CURRENT_PROJECT_VERSION = 109; + CURRENT_PROJECT_VERSION = 113; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "\"$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks\"", @@ -4033,10 +4033,10 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; COPY_PHASE_STRIP = YES; - CURRENT_PROJECT_VERSION = 109; + CURRENT_PROJECT_VERSION = 113; DEAD_CODE_STRIPPING = YES; DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 109; + DYLIB_CURRENT_VERSION = 113; EXPORTED_SYMBOLS_FILE = "resources/lldb-framework-exports"; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -4274,7 +4274,7 @@ 26F5C26C10F3D9A5009D5894 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - CURRENT_PROJECT_VERSION = 109; + CURRENT_PROJECT_VERSION = 113; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "\"$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks\"", @@ -4304,7 +4304,7 @@ 26F5C26D10F3D9A5009D5894 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - CURRENT_PROJECT_VERSION = 109; + CURRENT_PROJECT_VERSION = 113; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "\"$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks\"", Modified: lldb/trunk/resources/LLDB-Info.plist URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/resources/LLDB-Info.plist?rev=150063&r1=150062&r2=150063&view=diff ============================================================================== --- lldb/trunk/resources/LLDB-Info.plist (original) +++ lldb/trunk/resources/LLDB-Info.plist Wed Feb 8 01:31:16 2012 @@ -17,7 +17,7 @@ CFBundleSignature ???? CFBundleVersion - 109 + 113 CFBundleName ${EXECUTABLE_NAME} From scallanan at apple.com Wed Feb 8 12:43:35 2012 From: scallanan at apple.com (Sean Callanan) Date: Wed, 08 Feb 2012 18:43:35 -0000 Subject: [Lldb-commits] [lldb] r150079 - /lldb/trunk/source/Expression/ClangUserExpression.cpp Message-ID: <20120208184335.9ABA22A6C12C@llvm.org> Author: spyffe Date: Wed Feb 8 12:43:35 2012 New Revision: 150079 URL: http://llvm.org/viewvc/llvm-project?rev=150079&view=rev Log: In the absence of a valid process, the expression parser now at least tries to generate IR for the target. Modified: lldb/trunk/source/Expression/ClangUserExpression.cpp Modified: lldb/trunk/source/Expression/ClangUserExpression.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangUserExpression.cpp?rev=150079&r1=150078&r2=150079&view=diff ============================================================================== --- lldb/trunk/source/Expression/ClangUserExpression.cpp (original) +++ lldb/trunk/source/Expression/ClangUserExpression.cpp Wed Feb 8 12:43:35 2012 @@ -317,7 +317,12 @@ } Process *process = exe_ctx.GetProcessPtr(); - ClangExpressionParser parser(process, *this); + ExecutionContextScope *exe_scope = process; + + if (!exe_scope) + exe_scope = exe_ctx.GetTargetPtr(); + + ClangExpressionParser parser(exe_scope, *this); unsigned num_errors = parser.Parse (error_stream); From granata.enrico at gmail.com Wed Feb 8 13:57:18 2012 From: granata.enrico at gmail.com (Enrico Granata) Date: Wed, 08 Feb 2012 19:57:18 -0000 Subject: [Lldb-commits] [lldb] r150085 - /lldb/trunk/examples/synthetic/gnu_libstdcpp.py Message-ID: <20120208195718.CECCC2A6C12C@llvm.org> Author: enrico Date: Wed Feb 8 13:57:18 2012 New Revision: 150085 URL: http://llvm.org/viewvc/llvm-project?rev=150085&view=rev Log: fixing comment to reflect that currentversion of OSX works with our STL formatters Modified: lldb/trunk/examples/synthetic/gnu_libstdcpp.py Modified: lldb/trunk/examples/synthetic/gnu_libstdcpp.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/synthetic/gnu_libstdcpp.py?rev=150085&r1=150084&r2=150085&view=diff ============================================================================== --- lldb/trunk/examples/synthetic/gnu_libstdcpp.py (original) +++ lldb/trunk/examples/synthetic/gnu_libstdcpp.py Wed Feb 8 13:57:18 2012 @@ -2,7 +2,7 @@ # C++ STL formatters for LLDB # These formatters are based upon the version of the GNU libstdc++ -# as it ships with Mac OS X 10.6.8 and 10.7.0 +# as it ships with Mac OS X 10.6.8 thru 10.7.3 # You are encouraged to look at the STL implementation for your platform # before relying on these formatters to do the right thing for your setup From scallanan at apple.com Wed Feb 8 15:55:14 2012 From: scallanan at apple.com (Sean Callanan) Date: Wed, 08 Feb 2012 21:55:14 -0000 Subject: [Lldb-commits] [lldb] r150103 - /lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp Message-ID: <20120208215514.881FA2A6C12C@llvm.org> Author: spyffe Date: Wed Feb 8 15:55:14 2012 New Revision: 150103 URL: http://llvm.org/viewvc/llvm-project?rev=150103&view=rev Log: Added support to the expression parser for reading variables that are only available in symbols. Modified: lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp Modified: lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp?rev=150103&r1=150102&r2=150103&view=diff ============================================================================== --- lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp (original) +++ lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp Wed Feb 8 15:55:14 2012 @@ -969,7 +969,7 @@ return false; Error err; - target->ReadMemory(file_addr, true, data, length, err); + target->ReadMemory(file_addr, false, data, length, err); return err.Success(); } @@ -1011,34 +1011,57 @@ if (expr_var_sp) { - if (!expr_var_sp->m_parser_vars.get() || !expr_var_sp->m_parser_vars->m_lldb_var) + if (!expr_var_sp->m_parser_vars.get()) return Value(); bool is_reference = expr_var_sp->m_flags & ClangExpressionVariable::EVTypeIsReference; - - std::auto_ptr value(GetVariableValue(exe_ctx, expr_var_sp->m_parser_vars->m_lldb_var, NULL)); - - if (is_reference && value.get() && value->GetValueType() == Value::eValueTypeLoadAddress) + + if (expr_var_sp->m_parser_vars->m_lldb_var) { - Process *process = m_parser_vars->m_exe_ctx->GetProcessPtr(); + std::auto_ptr value(GetVariableValue(exe_ctx, expr_var_sp->m_parser_vars->m_lldb_var, NULL)); - if (!process) + if (is_reference && value.get() && value->GetValueType() == Value::eValueTypeLoadAddress) + { + Process *process = m_parser_vars->m_exe_ctx->GetProcessPtr(); + + if (!process) + return Value(); + + lldb::addr_t value_addr = value->GetScalar().ULongLong(); + Error read_error; + addr_t ref_value = process->ReadPointerFromMemory (value_addr, read_error); + + if (!read_error.Success()) + return Value(); + + value->GetScalar() = (unsigned long long)ref_value; + } + + if (value.get()) + return *value; + else return Value(); + } + else if (expr_var_sp->m_parser_vars->m_lldb_sym) + { + const Address sym_address = expr_var_sp->m_parser_vars->m_lldb_sym->GetAddressRangeRef().GetBaseAddress(); - lldb::addr_t value_addr = value->GetScalar().ULongLong(); - Error read_error; - addr_t ref_value = process->ReadPointerFromMemory (value_addr, read_error); - - if (!read_error.Success()) + if (!sym_address.IsValid()) return Value(); + + Value ret; + + uint64_t symbol_addr = sym_address.GetFileAddress(); + + ret.GetScalar() = symbol_addr; + ret.SetValueType(Value::eValueTypeFileAddress); - value->GetScalar() = (unsigned long long)ref_value; + return ret; } - - if (value.get()) - return *value; else + { return Value(); + } } else if (persistent_var_sp) { From johnny.chen at apple.com Wed Feb 8 16:37:49 2012 From: johnny.chen at apple.com (Johnny Chen) Date: Wed, 08 Feb 2012 22:37:49 -0000 Subject: [Lldb-commits] [lldb] r150109 - in /lldb/trunk: include/lldb/Interpreter/ source/Commands/ source/Interpreter/ test/functionalities/completion/ test/functionalities/watchpoint/hello_watchpoint/ test/functionalities/watchpoint/watchpoint_set_command/ test/help/ Message-ID: <20120208223749.6E7442A6C12C@llvm.org> Author: johnny Date: Wed Feb 8 16:37:48 2012 New Revision: 150109 URL: http://llvm.org/viewvc/llvm-project?rev=150109&view=rev Log: After discussions with Jim and Greg, modify the 'watchpoint set' command to become a mutiword command with subcommand 'expression' and 'variable'. The first subcommand is for supplying an expression to be evaluated into an address to watch for, while the second is for watching a variable. 'watchpoint set expression' is a raw command, which means that you need to use the "--" option terminator to end the '-w' or '-x' option processing and to start typing your expression. Also update several test cases to comply and add a couple of test cases into TestCompletion.py, in particular, test that 'watchpoint set ex' completes to 'watchpoint set expression ' and that 'watchpoint set var' completes to 'watchpoint set variable '. Modified: lldb/trunk/include/lldb/Interpreter/OptionGroupWatchpoint.h lldb/trunk/source/Commands/CommandObjectFrame.cpp lldb/trunk/source/Commands/CommandObjectWatchpoint.cpp lldb/trunk/source/Commands/CommandObjectWatchpoint.h lldb/trunk/source/Interpreter/OptionGroupWatchpoint.cpp lldb/trunk/test/functionalities/completion/TestCompletion.py lldb/trunk/test/functionalities/watchpoint/hello_watchpoint/TestMyFirstWatchpoint.py lldb/trunk/test/functionalities/watchpoint/watchpoint_set_command/TestWatchLocationWithWatchSet.py lldb/trunk/test/functionalities/watchpoint/watchpoint_set_command/TestWatchpointSetErrorCases.py lldb/trunk/test/help/TestHelp.py Modified: lldb/trunk/include/lldb/Interpreter/OptionGroupWatchpoint.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionGroupWatchpoint.h?rev=150109&r1=150108&r2=150109&view=diff ============================================================================== --- lldb/trunk/include/lldb/Interpreter/OptionGroupWatchpoint.h (original) +++ lldb/trunk/include/lldb/Interpreter/OptionGroupWatchpoint.h Wed Feb 8 16:37:48 2012 @@ -57,7 +57,7 @@ WatchType watch_type; uint32_t watch_size; - bool watch_variable; + bool watch_type_specified; private: DISALLOW_COPY_AND_ASSIGN(OptionGroupWatchpoint); Modified: lldb/trunk/source/Commands/CommandObjectFrame.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectFrame.cpp?rev=150109&r1=150108&r2=150109&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectFrame.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectFrame.cpp Wed Feb 8 16:37:48 2012 @@ -433,7 +433,7 @@ if (variable_list) { // If watching a variable, there are certain restrictions to be followed. - if (m_option_watchpoint.watch_variable) + if (m_option_watchpoint.watch_type_specified) { if (command.GetArgumentCount() != 1) { result.GetErrorStream().Printf("error: specify exactly one variable when using the '-w' option\n"); @@ -544,7 +544,7 @@ options, format); // Process watchpoint if necessary. - if (m_option_watchpoint.watch_variable) + if (m_option_watchpoint.watch_type_specified) { AddressType addr_type; lldb::addr_t addr = 0; Modified: lldb/trunk/source/Commands/CommandObjectWatchpoint.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectWatchpoint.cpp?rev=150109&r1=150108&r2=150109&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectWatchpoint.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectWatchpoint.cpp Wed Feb 8 16:37:48 2012 @@ -853,141 +853,255 @@ } //------------------------------------------------------------------------- -// CommandObjectWatchpointSet::CommandOptions +// CommandObjectWatchpointSet //------------------------------------------------------------------------- -#pragma mark Set::CommandOptions -CommandObjectWatchpointSet::CommandOptions::CommandOptions() : - OptionGroup() -{ +CommandObjectWatchpointSet::CommandObjectWatchpointSet (CommandInterpreter &interpreter) : + CommandObjectMultiword (interpreter, + "watchpoint set", + "A set of commands for setting a watchpoint.", + "watchpoint set []") +{ + + LoadSubCommand ("variable", CommandObjectSP (new CommandObjectWatchpointSetVariable (interpreter))); + LoadSubCommand ("expression", CommandObjectSP (new CommandObjectWatchpointSetExpression (interpreter))); } -CommandObjectWatchpointSet::CommandOptions::~CommandOptions () +CommandObjectWatchpointSet::~CommandObjectWatchpointSet () { } -OptionDefinition -CommandObjectWatchpointSet::CommandOptions::g_option_table[] = +//------------------------------------------------------------------------- +// CommandObjectWatchpointSetVariable +//------------------------------------------------------------------------- +#pragma mark Set + +CommandObjectWatchpointSetVariable::CommandObjectWatchpointSetVariable (CommandInterpreter &interpreter) : + CommandObject (interpreter, + "watchpoint set variable", + "Set a watchpoint on a variable. " + "Use the '-w' option to specify the type of watchpoint and " + "the '-x' option to specify the byte size to watch for. " + "If no '-w' option is specified, it defaults to read_write. " + "If no '-x' option is specified, it defaults to the variable's " + "byte size. " + "Note that hardware resources for watching are often limited.", + NULL, + eFlagProcessMustBeLaunched | eFlagProcessMustBePaused), + m_option_group (interpreter), + m_option_watchpoint () { -{ LLDB_OPT_SET_1, true, "expression", 'e', no_argument, NULL, NULL, eArgTypeNone, "Watch an address with an expression specified at the end."}, -{ LLDB_OPT_SET_2, true, "variable", 'v', no_argument, NULL, NULL, eArgTypeNone, "Watch a variable name specified at the end."} -}; + SetHelpLong( +"Examples: \n\ +\n\ + watchpoint set variable -w read_wriate my_global_var \n\ + # Watch my_global_var for read/write access, with the region to watch corresponding to the byte size of the data type.\n"); + + CommandArgumentEntry arg; + CommandArgumentData var_name_arg; + + // Define the only variant of this arg. + var_name_arg.arg_type = eArgTypeVarName; + var_name_arg.arg_repetition = eArgRepeatPlain; + + // Push the variant into the argument entry. + arg.push_back (var_name_arg); + + // Push the data for the only argument into the m_arguments vector. + m_arguments.push_back (arg); + + // Absorb the '-w' and '-x' options into our option group. + m_option_group.Append (&m_option_watchpoint, LLDB_OPT_SET_ALL, LLDB_OPT_SET_1); + m_option_group.Finalize(); +} -uint32_t -CommandObjectWatchpointSet::CommandOptions::GetNumDefinitions () +CommandObjectWatchpointSetVariable::~CommandObjectWatchpointSetVariable () { - return sizeof(g_option_table)/sizeof(OptionDefinition); } -const OptionDefinition* -CommandObjectWatchpointSet::CommandOptions::GetDefinitions () +Options * +CommandObjectWatchpointSetVariable::GetOptions () { - return g_option_table; + return &m_option_group; } -Error -CommandObjectWatchpointSet::CommandOptions::SetOptionValue (CommandInterpreter &interpreter, - uint32_t option_idx, - const char *option_arg) +bool +CommandObjectWatchpointSetVariable::Execute +( + Args& command, + CommandReturnObject &result +) { - Error error; - char short_option = (char) g_option_table[option_idx].short_option; + ExecutionContext exe_ctx(m_interpreter.GetExecutionContext()); + StackFrame *frame = exe_ctx.GetFramePtr(); + if (frame == NULL) + { + result.AppendError ("you must be stopped in a valid stack frame to set a watchpoint."); + result.SetStatus (eReturnStatusFailed); + return false; + } - switch (short_option) + // If no argument is present, issue an error message. There's no way to set a watchpoint. + if (command.GetArgumentCount() <= 0) { - case 'e': - m_do_expression = true; - break; - case 'v': - m_do_variable = true; - break; - default: - error.SetErrorStringWithFormat ("unrecognized option '%c'", short_option); - break; + result.GetErrorStream().Printf("error: required argument missing; specify your program variable to watch for\n"); + result.SetStatus(eReturnStatusFailed); + return false; } - return error; -} + // If no '-w' is specified, default to '-w read_write'. + if (!m_option_watchpoint.watch_type_specified) + { + m_option_watchpoint.watch_type = OptionGroupWatchpoint::eWatchReadWrite; + } -void -CommandObjectWatchpointSet::CommandOptions::OptionParsingStarting (CommandInterpreter &interpreter) -{ - m_do_expression = false; - m_do_variable = false; + // We passed the sanity check for the command. + // Proceed to set the watchpoint now. + lldb::addr_t addr = 0; + size_t size = 0; + + VariableSP var_sp; + ValueObjectSP valobj_sp; + Stream &output_stream = result.GetOutputStream(); + + // A simple watch variable gesture allows only one argument. + if (command.GetArgumentCount() != 1) { + result.GetErrorStream().Printf("error: specify exactly one variable to watch for\n"); + result.SetStatus(eReturnStatusFailed); + return false; + } + + // Things have checked out ok... + Error error; + uint32_t expr_path_options = StackFrame::eExpressionPathOptionCheckPtrVsMember; + valobj_sp = frame->GetValueForVariableExpressionPath (command.GetArgumentAtIndex(0), + eNoDynamicValues, + expr_path_options, + var_sp, + error); + if (valobj_sp) { + AddressType addr_type; + addr = valobj_sp->GetAddressOf(false, &addr_type); + if (addr_type == eAddressTypeLoad) { + // We're in business. + // Find out the size of this variable. + size = m_option_watchpoint.watch_size == 0 ? valobj_sp->GetByteSize() + : m_option_watchpoint.watch_size; + } + } else { + const char *error_cstr = error.AsCString(NULL); + if (error_cstr) + result.GetErrorStream().Printf("error: %s\n", error_cstr); + else + result.GetErrorStream().Printf ("error: unable to find any variable expression path that matches '%s'\n", + command.GetArgumentAtIndex(0)); + return false; + } + + // Now it's time to create the watchpoint. + uint32_t watch_type = m_option_watchpoint.watch_type; + Watchpoint *wp = exe_ctx.GetTargetRef().CreateWatchpoint(addr, size, watch_type).get(); + if (wp) { + if (var_sp && var_sp->GetDeclaration().GetFile()) { + StreamString ss; + // True to show fullpath for declaration file. + var_sp->GetDeclaration().DumpStopContext(&ss, true); + wp->SetDeclInfo(ss.GetString()); + } + StreamString ss; + output_stream.Printf("Watchpoint created: "); + wp->GetDescription(&output_stream, lldb::eDescriptionLevelFull); + output_stream.EOL(); + result.SetStatus(eReturnStatusSuccessFinishResult); + } else { + result.AppendErrorWithFormat("Watchpoint creation failed (addr=0x%llx, size=%lu).\n", + addr, size); + result.SetStatus(eReturnStatusFailed); + } + + return result.Succeeded(); } //------------------------------------------------------------------------- -// CommandObjectWatchpointSet +// CommandObjectWatchpointSetExpression //------------------------------------------------------------------------- #pragma mark Set -CommandObjectWatchpointSet::CommandObjectWatchpointSet (CommandInterpreter &interpreter) : +CommandObjectWatchpointSetExpression::CommandObjectWatchpointSetExpression (CommandInterpreter &interpreter) : CommandObject (interpreter, - "watchpoint set", - "Set a watchpoint. " - "You can choose to watch a variable in scope with the '-v' option " - "or to watch an address with the '-e' option by supplying an expression. " + "watchpoint set expression", + "Set a watchpoint on an address by supplying an expression. " "Use the '-w' option to specify the type of watchpoint and " "the '-x' option to specify the byte size to watch for. " "If no '-w' option is specified, it defaults to read_write. " + "If no '-x' option is specified, it defaults to the target's " + "pointer byte size. " "Note that hardware resources for watching are often limited.", NULL, eFlagProcessMustBeLaunched | eFlagProcessMustBePaused), m_option_group (interpreter), - m_option_watchpoint (), - m_command_options () + m_option_watchpoint () { SetHelpLong( "Examples: \n\ \n\ - watchpoint set -w read_wriate -v my_global_var \n\ - # Watch my_global_var for read/write access, with the region to watch corresponding to the byte size of the data type.\n\ -\n\ - watchpoint set -w write -x 1 -e foo + 32\n\ - # Watch write access for the 1-byte region pointed to by the address 'foo + 32'.\n\ - # If no '-x' option is specified, byte size defaults to 4.\n"); + watchpoint set expression -w write -x 1 -- foo + 32\n\ + # Watch write access for the 1-byte region pointed to by the address 'foo + 32'.\n"); CommandArgumentEntry arg; - CommandArgumentData var_name_arg, expression_arg; + CommandArgumentData expression_arg; - // Define the first variant of this arg. + // Define the only variant of this arg. expression_arg.arg_type = eArgTypeExpression; expression_arg.arg_repetition = eArgRepeatPlain; - expression_arg.arg_opt_set_association = LLDB_OPT_SET_1; - - // Define the second variant of this arg. - var_name_arg.arg_type = eArgTypeVarName; - var_name_arg.arg_repetition = eArgRepeatPlain; - var_name_arg.arg_opt_set_association = LLDB_OPT_SET_2; - // Push the two variants into the argument entry. + // Push the only variant into the argument entry. arg.push_back (expression_arg); - arg.push_back (var_name_arg); // Push the data for the only argument into the m_arguments vector. m_arguments.push_back (arg); - // Absorb the '-w' and '-x' options into the '-e' (LLDB_OPT_SET_1) set as - // well as the '-v' (LLDB_OPT_SET_2) set. - m_option_group.Append (&m_option_watchpoint, LLDB_OPT_SET_1, LLDB_OPT_SET_1|LLDB_OPT_SET_2); - m_option_group.Append (&m_command_options); + // Absorb the '-w' and '-x' options into our option group. + m_option_group.Append (&m_option_watchpoint, LLDB_OPT_SET_ALL, LLDB_OPT_SET_1); m_option_group.Finalize(); } -CommandObjectWatchpointSet::~CommandObjectWatchpointSet () +CommandObjectWatchpointSetExpression::~CommandObjectWatchpointSetExpression () { } Options * -CommandObjectWatchpointSet::GetOptions () +CommandObjectWatchpointSetExpression::GetOptions () { return &m_option_group; } +#include "llvm/ADT/StringRef.h" +static inline void StripLeadingSpaces(llvm::StringRef &Str) +{ + while (!Str.empty() && isspace(Str[0])) + Str = Str.substr(1); +} +static inline llvm::StringRef StripOptionTerminator(llvm::StringRef &Str, bool with_dash_w, bool with_dash_x) +{ + llvm::StringRef ExprStr = Str; + + // Get rid of the leading spaces first. + StripLeadingSpaces(ExprStr); + + // If there's no '-w' and no '-x', we can just return. + if (!with_dash_w && !with_dash_x) + return ExprStr; + + // Otherwise, split on the "--" option terminator string, and return the rest of the string. + ExprStr = ExprStr.split("--").second; + StripLeadingSpaces(ExprStr); + return ExprStr; +} bool -CommandObjectWatchpointSet::Execute +CommandObjectWatchpointSetExpression::ExecuteRawCommandString ( - Args& command, + const char *raw_command, CommandReturnObject &result ) { @@ -1001,21 +1115,26 @@ return false; } + Args command(raw_command); + + // Process possible options. + if (!ParseOptions (command, result)) + return false; + // If no argument is present, issue an error message. There's no way to set a watchpoint. if (command.GetArgumentCount() <= 0) { - result.GetErrorStream().Printf("error: required argument missing; specify your program variable ('-v') or an address ('-e') to watch for\n"); + result.GetErrorStream().Printf("error: required argument missing; specify an expression to evaulate into the addres to watch for\n"); result.SetStatus(eReturnStatusFailed); return false; } - // It's either '-e' to watch an address with expression' or '-v' to watch a variable. - bool watch_address = m_command_options.m_do_expression; + bool no_dash_w = !m_option_watchpoint.watch_type_specified; + bool no_dash_x = (m_option_watchpoint.watch_size == 0); // If no '-w' is specified, default to '-w read_write'. - if (!m_option_watchpoint.watch_variable) + if (no_dash_w) { - m_option_watchpoint.watch_variable = true; m_option_watchpoint.watch_type = OptionGroupWatchpoint::eWatchReadWrite; } @@ -1028,71 +1147,37 @@ ValueObjectSP valobj_sp; Stream &output_stream = result.GetOutputStream(); - if (watch_address) { - // Use expression evaluation to arrive at the address to watch. - std::string expr_str; - command.GetQuotedCommandString(expr_str); - const bool coerce_to_id = true; - const bool unwind_on_error = true; - const bool keep_in_memory = false; - ExecutionResults expr_result = target->EvaluateExpression (expr_str.c_str(), - frame, - eExecutionPolicyOnlyWhenNeeded, - coerce_to_id, - unwind_on_error, - keep_in_memory, - eNoDynamicValues, - valobj_sp); - if (expr_result != eExecutionCompleted) { - result.GetErrorStream().Printf("error: expression evaluation of address to watch failed\n"); - result.GetErrorStream().Printf("expression evaluated: %s\n", expr_str.c_str()); - result.SetStatus(eReturnStatusFailed); - } - - // Get the address to watch. - addr = valobj_sp->GetValueAsUnsigned(0); - if (!addr) { - result.GetErrorStream().Printf("error: expression did not evaluate to an address\n"); - result.SetStatus(eReturnStatusFailed); - return false; - } - size = m_option_watchpoint.watch_size == 0 ? 4 /* Could use a better default size? */ - : m_option_watchpoint.watch_size; - } else { - // A simple watch variable gesture allows only one argument. - if (command.GetArgumentCount() != 1) { - result.GetErrorStream().Printf("error: specify exactly one variable with the '-v' option\n"); - result.SetStatus(eReturnStatusFailed); - return false; - } + // We will process the raw command string to rid of the '-w', '-x', or '--' + llvm::StringRef raw_expr_str(raw_command); + std::string expr_str = StripOptionTerminator(raw_expr_str, !no_dash_w, !no_dash_x).str(); + + // Use expression evaluation to arrive at the address to watch. + const bool coerce_to_id = true; + const bool unwind_on_error = true; + const bool keep_in_memory = false; + ExecutionResults expr_result = target->EvaluateExpression (expr_str.c_str(), + frame, + eExecutionPolicyOnlyWhenNeeded, + coerce_to_id, + unwind_on_error, + keep_in_memory, + eNoDynamicValues, + valobj_sp); + if (expr_result != eExecutionCompleted) { + result.GetErrorStream().Printf("error: expression evaluation of address to watch failed\n"); + result.GetErrorStream().Printf("expression evaluated: %s\n", expr_str.c_str()); + result.SetStatus(eReturnStatusFailed); + } - // Things have checked out ok... - Error error; - uint32_t expr_path_options = StackFrame::eExpressionPathOptionCheckPtrVsMember; - valobj_sp = frame->GetValueForVariableExpressionPath (command.GetArgumentAtIndex(0), - eNoDynamicValues, - expr_path_options, - var_sp, - error); - if (valobj_sp) { - AddressType addr_type; - addr = valobj_sp->GetAddressOf(false, &addr_type); - if (addr_type == eAddressTypeLoad) { - // We're in business. - // Find out the size of this variable. - size = m_option_watchpoint.watch_size == 0 ? valobj_sp->GetByteSize() - : m_option_watchpoint.watch_size; - } - } else { - const char *error_cstr = error.AsCString(NULL); - if (error_cstr) - result.GetErrorStream().Printf("error: %s\n", error_cstr); - else - result.GetErrorStream().Printf ("error: unable to find any variable expression path that matches '%s'\n", - command.GetArgumentAtIndex(0)); - return false; - } + // Get the address to watch. + addr = valobj_sp->GetValueAsUnsigned(0); + if (!addr) { + result.GetErrorStream().Printf("error: expression did not evaluate to an address\n"); + result.SetStatus(eReturnStatusFailed); + return false; } + size = no_dash_x ? target->GetArchitecture().GetAddressByteSize() + : m_option_watchpoint.watch_size; // Now it's time to create the watchpoint. uint32_t watch_type = m_option_watchpoint.watch_type; Modified: lldb/trunk/source/Commands/CommandObjectWatchpoint.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectWatchpoint.h?rev=150109&r1=150108&r2=150109&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectWatchpoint.h (original) +++ lldb/trunk/source/Commands/CommandObjectWatchpoint.h Wed Feb 8 16:37:48 2012 @@ -247,45 +247,27 @@ // CommandObjectWatchpointSet //------------------------------------------------------------------------- -class CommandObjectWatchpointSet : public CommandObject +class CommandObjectWatchpointSet : public CommandObjectMultiword { public: - class CommandOptions : public OptionGroup - { - public: - - CommandOptions (); - - virtual - ~CommandOptions (); - - virtual uint32_t - GetNumDefinitions (); - - virtual const OptionDefinition* - GetDefinitions (); - - virtual Error - SetOptionValue (CommandInterpreter &interpreter, - uint32_t option_idx, - const char *option_value); - - virtual void - OptionParsingStarting (CommandInterpreter &interpreter); - - // Options table: Required for subclasses of Options. - - static OptionDefinition g_option_table[]; - bool m_do_expression; - bool m_do_variable; - }; - CommandObjectWatchpointSet (CommandInterpreter &interpreter); virtual ~CommandObjectWatchpointSet (); + +}; + +class CommandObjectWatchpointSetVariable : public CommandObject +{ +public: + + CommandObjectWatchpointSetVariable (CommandInterpreter &interpreter); + + virtual + ~CommandObjectWatchpointSetVariable (); + virtual bool Execute (Args& command, CommandReturnObject &result); @@ -296,7 +278,39 @@ private: OptionGroupOptions m_option_group; OptionGroupWatchpoint m_option_watchpoint; - CommandOptions m_command_options; +}; + +class CommandObjectWatchpointSetExpression : public CommandObject +{ +public: + + CommandObjectWatchpointSetExpression (CommandInterpreter &interpreter); + + virtual + ~CommandObjectWatchpointSetExpression (); + + virtual bool + Execute (Args& command, + CommandReturnObject &result) + { return false; } + + virtual bool + WantsRawCommandString() { return true; } + + // Overrides base class's behavior where WantsCompletion = !WantsRawCommandString. + virtual bool + WantsCompletion() { return true; } + + virtual bool + ExecuteRawCommandString (const char *raw_command, + CommandReturnObject &result); + + virtual Options * + GetOptions (); + +private: + OptionGroupOptions m_option_group; + OptionGroupWatchpoint m_option_watchpoint; }; } // namespace lldb_private Modified: lldb/trunk/source/Interpreter/OptionGroupWatchpoint.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/OptionGroupWatchpoint.cpp?rev=150109&r1=150108&r2=150109&view=diff ============================================================================== --- lldb/trunk/source/Interpreter/OptionGroupWatchpoint.cpp (original) +++ lldb/trunk/source/Interpreter/OptionGroupWatchpoint.cpp Wed Feb 8 16:37:48 2012 @@ -66,7 +66,7 @@ case 'w': watch_type = (WatchType) Args::StringToOptionEnum(option_arg, g_option_table[option_idx].enum_values, 0, error); if (error.Success()) - watch_variable = true; + watch_type_specified = true; break; case 'x': @@ -84,7 +84,7 @@ void OptionGroupWatchpoint::OptionParsingStarting (CommandInterpreter &interpreter) { - watch_variable = false; + watch_type_specified = false; watch_type = eWatchInvalid; watch_size = 0; } Modified: lldb/trunk/test/functionalities/completion/TestCompletion.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/completion/TestCompletion.py?rev=150109&r1=150108&r2=150109&view=diff ============================================================================== --- lldb/trunk/test/functionalities/completion/TestCompletion.py (original) +++ lldb/trunk/test/functionalities/completion/TestCompletion.py Wed Feb 8 16:37:48 2012 @@ -26,13 +26,17 @@ """Test that 'frame variable -w ' completes to ['Available completions:', 'read', 'write', 'read_write'].""" self.complete_from_to('frame variable -w ', ['Available completions:', 'read', 'write', 'read_write']) - def test_watchpoint_set_dash_x(self): - """Test that 'watchpoint set -x' completes to 'watchpoint set -x '.""" - self.complete_from_to('watchpoint set -x', 'watchpoint set -x ') - - def test_watchpoint_set_dash_w_read_underbar(self): - """Test that 'watchpoint set -w read_' completes to 'watchpoint set -w read_write'.""" - self.complete_from_to('watchpoint set -w read_', 'watchpoint set -w read_write') + def test_watchpoint_set_ex(self): + """Test that 'watchpoint set ex' completes to 'watchpoint set expression '.""" + self.complete_from_to('watchpoint set ex', 'watchpoint set expression ') + + def test_watchpoint_set_var(self): + """Test that 'watchpoint set var' completes to 'watchpoint set variable '.""" + self.complete_from_to('watchpoint set var', 'watchpoint set variable ') + + def test_watchpoint_set_variable_dash_w_read_underbar(self): + """Test that 'watchpoint set variable -w read_' completes to 'watchpoint set variable -w read_write'.""" + self.complete_from_to('watchpoint set variable -w read_', 'watchpoint set variable -w read_write') def test_help_fi(self): """Test that 'help fi' completes to ['Available completions:', 'file', 'finish'].""" Modified: lldb/trunk/test/functionalities/watchpoint/hello_watchpoint/TestMyFirstWatchpoint.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/watchpoint/hello_watchpoint/TestMyFirstWatchpoint.py?rev=150109&r1=150108&r2=150109&view=diff ============================================================================== --- lldb/trunk/test/functionalities/watchpoint/hello_watchpoint/TestMyFirstWatchpoint.py (original) +++ lldb/trunk/test/functionalities/watchpoint/hello_watchpoint/TestMyFirstWatchpoint.py Wed Feb 8 16:37:48 2012 @@ -75,7 +75,7 @@ substrs = ['Watchpoint created', 'size = 4', 'type = w', '%s:%d' % (self.source, self.decl)]) else: - self.expect("watchpoint set -w write -v global", WATCHPOINT_CREATED, + self.expect("watchpoint set variable -w write global", WATCHPOINT_CREATED, substrs = ['Watchpoint created', 'size = 4', 'type = w', '%s:%d' % (self.source, self.decl)]) Modified: lldb/trunk/test/functionalities/watchpoint/watchpoint_set_command/TestWatchLocationWithWatchSet.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/watchpoint/watchpoint_set_command/TestWatchLocationWithWatchSet.py?rev=150109&r1=150108&r2=150109&view=diff ============================================================================== --- lldb/trunk/test/functionalities/watchpoint/watchpoint_set_command/TestWatchLocationWithWatchSet.py (original) +++ lldb/trunk/test/functionalities/watchpoint/watchpoint_set_command/TestWatchLocationWithWatchSet.py Wed Feb 8 16:37:48 2012 @@ -13,13 +13,13 @@ @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin") def test_watchlocation_with_dsym_using_watchpoint_set(self): - """Test watching a location with 'watchpoint set -w write -x size' option.""" + """Test watching a location with 'watchpoint set expression -w write -x size' option.""" self.buildDsym(dictionary=self.d) self.setTearDownCleanup(dictionary=self.d) self.watchlocation_using_watchpoint_set() def test_watchlocation_with_dwarf_using_watchpoint_set(self): - """Test watching a location with 'watchpoint set -w write -x size' option.""" + """Test watching a location with 'watchpoint set expression -w write -x size' option.""" self.buildDwarf(dictionary=self.d) self.setTearDownCleanup(dictionary=self.d) self.watchlocation_using_watchpoint_set() @@ -60,7 +60,7 @@ # with offset as 7. # The main.cpp, by design, misbehaves by not following the agreed upon # protocol of only accessing the allowable index range of [0, 6]. - self.expect("watchpoint set -w write -x 1 -e g_char_ptr + 7", WATCHPOINT_CREATED, + self.expect("watchpoint set expression -w write -x 1 -- g_char_ptr + 7", WATCHPOINT_CREATED, substrs = ['Watchpoint created', 'size = 1', 'type = w']) self.runCmd("expr unsigned val = g_char_ptr[7]; val") self.expect(self.res.GetOutput().splitlines()[0], exe=False, Modified: lldb/trunk/test/functionalities/watchpoint/watchpoint_set_command/TestWatchpointSetErrorCases.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/watchpoint/watchpoint_set_command/TestWatchpointSetErrorCases.py?rev=150109&r1=150108&r2=150109&view=diff ============================================================================== --- lldb/trunk/test/functionalities/watchpoint/watchpoint_set_command/TestWatchpointSetErrorCases.py (original) +++ lldb/trunk/test/functionalities/watchpoint/watchpoint_set_command/TestWatchpointSetErrorCases.py Wed Feb 8 16:37:48 2012 @@ -49,18 +49,20 @@ # Try some error conditions: - # No argument is an error. - self.expect("watchpoint set", error=True, - startstr = 'error: invalid combination of options for the given command') - self.runCmd("watchpoint set -v -w read_write", check=False) - - # 'watchpoint set' now takes a mandatory '-v' or '-e' option to - # indicate watching for either variable or address. - self.expect("watchpoint set -w write global", error=True, - startstr = 'error: invalid combination of options for the given command') + # 'watchpoint set' is now a multiword command. + self.expect("watchpoint set", + substrs = ['The following subcommands are supported:', + 'expression', + 'variable']) + self.runCmd("watchpoint set variable -w read_write", check=False) + + # 'watchpoint set expression' with '-w' or '-x' specified now needs + # an option terminator and a raw expression after that. + self.expect("watchpoint set expression -w write --", error=True, + startstr = 'error: required argument missing; specify an expression to evaulate into the addres to watch for') # Wrong size parameter is an error. - self.expect("watchpoint set -x -128", error=True, + self.expect("watchpoint set variable -x -128", error=True, substrs = ['invalid enumeration value']) Modified: lldb/trunk/test/help/TestHelp.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/help/TestHelp.py?rev=150109&r1=150108&r2=150109&view=diff ============================================================================== --- lldb/trunk/test/help/TestHelp.py (original) +++ lldb/trunk/test/help/TestHelp.py Wed Feb 8 16:37:48 2012 @@ -122,11 +122,12 @@ substrs = ['']) def test_help_watchpoint_set(self): - """Test that 'help watchpoint set' prints out for the '-e' option - and for the '-v' option.""" + """Test that 'help watchpoint set' prints out 'expression' and 'variable' + as the possible subcommands.""" self.expect("help watchpoint set", - patterns = ['watchpoint set -e.*', - 'watchpoint set -v.*']) + substrs = ['The following subcommands are supported:'], + patterns = ['expression +--', + 'variable +--']) if __name__ == '__main__': From johnny.chen at apple.com Wed Feb 8 18:27:02 2012 From: johnny.chen at apple.com (Johnny Chen) Date: Thu, 09 Feb 2012 00:27:02 -0000 Subject: [Lldb-commits] [lldb] r150119 - in /lldb/trunk/test/terminal: ./ TestSTTYBeforeAndAfter.py Message-ID: <20120209002702.17FEC2A6C12C@llvm.org> Author: johnny Date: Wed Feb 8 18:27:01 2012 New Revision: 150119 URL: http://llvm.org/viewvc/llvm-project?rev=150119&view=rev Log: Add a case to test that 'stty -a' displays the same output before and after running the lldb command. Added: lldb/trunk/test/terminal/ lldb/trunk/test/terminal/TestSTTYBeforeAndAfter.py Added: lldb/trunk/test/terminal/TestSTTYBeforeAndAfter.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/terminal/TestSTTYBeforeAndAfter.py?rev=150119&view=auto ============================================================================== --- lldb/trunk/test/terminal/TestSTTYBeforeAndAfter.py (added) +++ lldb/trunk/test/terminal/TestSTTYBeforeAndAfter.py Wed Feb 8 18:27:01 2012 @@ -0,0 +1,113 @@ +""" +Test that 'stty -a' displays the same output before and after running the lldb command. +""" + +import os +import unittest2 +import lldb +import pexpect +from lldbtest import * + +class CommandLineCompletionTestCase(TestBase): + + mydir = os.path.join("functionalities", "completion") + + @classmethod + def classCleanup(cls): + """Cleanup the test byproducts.""" + system(["/bin/sh", "-c", "rm -f child_send1.txt"]) + system(["/bin/sh", "-c", "rm -f child_read1.txt"]) + system(["/bin/sh", "-c", "rm -f child_send2.txt"]) + system(["/bin/sh", "-c", "rm -f child_read2.txt"]) + + def test_stty_dash_a_before_and_afetr_invoking_lldb_command(self): + """Test that 'stty -a' displays the same output before and after running the lldb command.""" + + # The expect prompt. + expect_prompt = "expect.*> " + # The default lldb prompt. + lldb_prompt = "(lldb) " + + # So that the child gets torn down after the test. + self.child = pexpect.spawn('expect') + child = self.child + + child.expect(expect_prompt) + child.setecho(True) + if self.TraceOn(): + child.logfile = sys.stdout + + # Turn on loggings for input/output to/from the child. + with open('child_send1.txt', 'w') as f_send1: + with open('child_read1.txt', 'w') as f_read1: + child.logfile_send = f_send1 + child.logfile_read = f_read1 + + child.sendline('stty -a') + child.expect(expect_prompt) + + # Now that the stage1 logging is done, restore logfile to None to + # stop further logging. + child.logfile_send = None + child.logfile_read = None + + # Invoke the lldb command. + child.sendline('%s %s' % (self.lldbHere, self.lldbOption)) + child.expect_exact(lldb_prompt) + + # Immediately quit. + child.sendline('quit') + child.expect(expect_prompt) + + with open('child_send2.txt', 'w') as f_send2: + with open('child_read2.txt', 'w') as f_read2: + child.logfile_send = f_send2 + child.logfile_read = f_read2 + + child.sendline('stty -a') + child.expect(expect_prompt) + + child.sendline('exit') + + # Now that the stage2 logging is done, restore logfile to None to + # stop further logging. + child.logfile_send = None + child.logfile_read = None + + with open('child_send1.txt', 'r') as fs: + if self.TraceOn(): + print "\n\nContents of child_send1.txt:" + print fs.read() + with open('child_read1.txt', 'r') as fr: + from_child1 = fr.read() + if self.TraceOn(): + print "\n\nContents of child_read1.txt:" + print from_child1 + + with open('child_send2.txt', 'r') as fs: + if self.TraceOn(): + print "\n\nContents of child_send2.txt:" + print fs.read() + with open('child_read2.txt', 'r') as fr: + from_child2 = fr.read() + if self.TraceOn(): + print "\n\nContents of child_read2.txt:" + print from_child2 + + stty_output1_lines = from_child1.splitlines() + stty_output2_lines = from_child2.splitlines() + zipped = zip(stty_output1_lines, stty_output2_lines) + for tuple in zipped: + if self.TraceOn(): + print "tuple->%s" % str(tuple) + # Every line should compare equal until the first blank line. + if len(tuple[0]) == 0: + break + self.assertTrue(tuple[0] == tuple[1]) + + +if __name__ == '__main__': + import atexit + lldb.SBDebugger.Initialize() + atexit.register(lambda: lldb.SBDebugger.Terminate()) + unittest2.main() From johnny.chen at apple.com Wed Feb 8 18:51:41 2012 From: johnny.chen at apple.com (Johnny Chen) Date: Thu, 09 Feb 2012 00:51:41 -0000 Subject: [Lldb-commits] [lldb] r150124 - /lldb/trunk/test/terminal/TestSTTYBeforeAndAfter.py Message-ID: <20120209005141.7297F2A6C12C@llvm.org> Author: johnny Date: Wed Feb 8 18:51:41 2012 New Revision: 150124 URL: http://llvm.org/viewvc/llvm-project?rev=150124&view=rev Log: Make the expect_prompt more strict. Modified: lldb/trunk/test/terminal/TestSTTYBeforeAndAfter.py Modified: lldb/trunk/test/terminal/TestSTTYBeforeAndAfter.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/terminal/TestSTTYBeforeAndAfter.py?rev=150124&r1=150123&r2=150124&view=diff ============================================================================== --- lldb/trunk/test/terminal/TestSTTYBeforeAndAfter.py (original) +++ lldb/trunk/test/terminal/TestSTTYBeforeAndAfter.py Wed Feb 8 18:51:41 2012 @@ -24,7 +24,7 @@ """Test that 'stty -a' displays the same output before and after running the lldb command.""" # The expect prompt. - expect_prompt = "expect.*> " + expect_prompt = "expect[0-9.]+> " # The default lldb prompt. lldb_prompt = "(lldb) " From scallanan at apple.com Wed Feb 8 18:54:55 2012 From: scallanan at apple.com (Sean Callanan) Date: Thu, 09 Feb 2012 00:54:55 -0000 Subject: [Lldb-commits] [lldb] r150125 - /lldb/trunk/include/lldb/Expression/ClangExpressionVariable.h Message-ID: <20120209005455.C058B2A6C12C@llvm.org> Author: spyffe Date: Wed Feb 8 18:54:55 2012 New Revision: 150125 URL: http://llvm.org/viewvc/llvm-project?rev=150125&view=rev Log: Remembered to NULL out the symbol, which was causing testsuite crashes. Modified: lldb/trunk/include/lldb/Expression/ClangExpressionVariable.h Modified: lldb/trunk/include/lldb/Expression/ClangExpressionVariable.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/ClangExpressionVariable.h?rev=150125&r1=150124&r2=150125&view=diff ============================================================================== --- lldb/trunk/include/lldb/Expression/ClangExpressionVariable.h (original) +++ lldb/trunk/include/lldb/Expression/ClangExpressionVariable.h Wed Feb 8 18:54:55 2012 @@ -98,7 +98,8 @@ m_named_decl (NULL), m_llvm_value (NULL), m_lldb_value (NULL), - m_lldb_var () + m_lldb_var (), + m_lldb_sym (NULL) { } From johnny.chen at apple.com Wed Feb 8 19:16:04 2012 From: johnny.chen at apple.com (Johnny Chen) Date: Thu, 09 Feb 2012 01:16:04 -0000 Subject: [Lldb-commits] [lldb] r150127 - /lldb/trunk/test/terminal/TestSTTYBeforeAndAfter.py Message-ID: <20120209011605.0761A2A6C12D@llvm.org> Author: johnny Date: Wed Feb 8 19:16:04 2012 New Revision: 150127 URL: http://llvm.org/viewvc/llvm-project?rev=150127&view=rev Log: Set the terminal type to 'xterm' before doing 'stty -a'. Modified: lldb/trunk/test/terminal/TestSTTYBeforeAndAfter.py Modified: lldb/trunk/test/terminal/TestSTTYBeforeAndAfter.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/terminal/TestSTTYBeforeAndAfter.py?rev=150127&r1=150126&r2=150127&view=diff ============================================================================== --- lldb/trunk/test/terminal/TestSTTYBeforeAndAfter.py (original) +++ lldb/trunk/test/terminal/TestSTTYBeforeAndAfter.py Wed Feb 8 19:16:04 2012 @@ -37,6 +37,11 @@ if self.TraceOn(): child.logfile = sys.stdout + child.sendline('set env(TERM) xterm') + child.expect(expect_prompt) + child.sendline('puts $env(TERM)') + child.expect(expect_prompt) + # Turn on loggings for input/output to/from the child. with open('child_send1.txt', 'w') as f_send1: with open('child_read1.txt', 'w') as f_read1: @@ -73,7 +78,7 @@ # stop further logging. child.logfile_send = None child.logfile_read = None - + with open('child_send1.txt', 'r') as fs: if self.TraceOn(): print "\n\nContents of child_send1.txt:" From jingham at apple.com Wed Feb 8 19:49:26 2012 From: jingham at apple.com (Jim Ingham) Date: Thu, 09 Feb 2012 01:49:26 -0000 Subject: [Lldb-commits] [lldb] r150131 - /lldb/trunk/source/Breakpoint/Breakpoint.cpp Message-ID: <20120209014926.AABE42A6C12C@llvm.org> Author: jingham Date: Wed Feb 8 19:49:26 2012 New Revision: 150131 URL: http://llvm.org/viewvc/llvm-project?rev=150131&view=rev Log: Some Breakpoint:: methods crept down be log the Breakpoint::BreakpointEventData methods. Modified: lldb/trunk/source/Breakpoint/Breakpoint.cpp Modified: lldb/trunk/source/Breakpoint/Breakpoint.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/Breakpoint.cpp?rev=150131&r1=150130&r2=150131&view=diff ============================================================================== --- lldb/trunk/source/Breakpoint/Breakpoint.cpp (original) +++ lldb/trunk/source/Breakpoint/Breakpoint.cpp Wed Feb 8 19:49:26 2012 @@ -524,6 +524,68 @@ } } +void +Breakpoint::GetResolverDescription (Stream *s) +{ + if (m_resolver_sp) + m_resolver_sp->GetDescription (s); +} + + +bool +Breakpoint::GetMatchingFileLine (const ConstString &filename, uint32_t line_number, BreakpointLocationCollection &loc_coll) +{ + // TODO: To be correct, this method needs to fill the breakpoint location collection + // with the location IDs which match the filename and line_number. + // + + if (m_resolver_sp) + { + BreakpointResolverFileLine *resolverFileLine = dyn_cast(m_resolver_sp.get()); + if (resolverFileLine && + resolverFileLine->m_file_spec.GetFilename() == filename && + resolverFileLine->m_line_number == line_number) + { + return true; + } + } + return false; +} + +void +Breakpoint::GetFilterDescription (Stream *s) +{ + m_filter_sp->GetDescription (s); +} + +void +Breakpoint::SendBreakpointChangedEvent (lldb::BreakpointEventType eventKind) +{ + if (!m_being_created + && !IsInternal() + && GetTarget().EventTypeHasListeners(Target::eBroadcastBitBreakpointChanged)) + { + BreakpointEventData *data = new Breakpoint::BreakpointEventData (eventKind, shared_from_this()); + + GetTarget().BroadcastEvent (Target::eBroadcastBitBreakpointChanged, data); + } +} + +void +Breakpoint::SendBreakpointChangedEvent (BreakpointEventData *data) +{ + + if (data == NULL) + return; + + if (!m_being_created + && !IsInternal() + && GetTarget().EventTypeHasListeners(Target::eBroadcastBitBreakpointChanged)) + GetTarget().BroadcastEvent (Target::eBroadcastBitBreakpointChanged, data); + else + delete data; +} + Breakpoint::BreakpointEventData::BreakpointEventData (BreakpointEventType sub_type, const BreakpointSP &new_breakpoint_sp) : EventData (), @@ -625,66 +687,3 @@ return bp_loc_sp; } - - -void -Breakpoint::GetResolverDescription (Stream *s) -{ - if (m_resolver_sp) - m_resolver_sp->GetDescription (s); -} - - -bool -Breakpoint::GetMatchingFileLine (const ConstString &filename, uint32_t line_number, BreakpointLocationCollection &loc_coll) -{ - // TODO: To be correct, this method needs to fill the breakpoint location collection - // with the location IDs which match the filename and line_number. - // - - if (m_resolver_sp) - { - BreakpointResolverFileLine *resolverFileLine = dyn_cast(m_resolver_sp.get()); - if (resolverFileLine && - resolverFileLine->m_file_spec.GetFilename() == filename && - resolverFileLine->m_line_number == line_number) - { - return true; - } - } - return false; -} - -void -Breakpoint::GetFilterDescription (Stream *s) -{ - m_filter_sp->GetDescription (s); -} - -void -Breakpoint::SendBreakpointChangedEvent (lldb::BreakpointEventType eventKind) -{ - if (!m_being_created - && !IsInternal() - && GetTarget().EventTypeHasListeners(Target::eBroadcastBitBreakpointChanged)) - { - BreakpointEventData *data = new Breakpoint::BreakpointEventData (eventKind, shared_from_this()); - - GetTarget().BroadcastEvent (Target::eBroadcastBitBreakpointChanged, data); - } -} - -void -Breakpoint::SendBreakpointChangedEvent (BreakpointEventData *data) -{ - - if (data == NULL) - return; - - if (!m_being_created - && !IsInternal() - && GetTarget().EventTypeHasListeners(Target::eBroadcastBitBreakpointChanged)) - GetTarget().BroadcastEvent (Target::eBroadcastBitBreakpointChanged, data); - else - delete data; -} From johnny.chen at apple.com Wed Feb 8 20:02:00 2012 From: johnny.chen at apple.com (Johnny Chen) Date: Thu, 09 Feb 2012 02:02:00 -0000 Subject: [Lldb-commits] [lldb] r150133 - in /lldb/trunk/test: lldbtest.py terminal/TestSTTYBeforeAndAfter.py Message-ID: <20120209020200.3EAE72A6C12C@llvm.org> Author: johnny Date: Wed Feb 8 20:01:59 2012 New Revision: 150133 URL: http://llvm.org/viewvc/llvm-project?rev=150133&view=rev Log: Add safe guard for when the 'expect' program cannot be located and skip the test. Modified: lldb/trunk/test/lldbtest.py lldb/trunk/test/terminal/TestSTTYBeforeAndAfter.py Modified: lldb/trunk/test/lldbtest.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbtest.py?rev=150133&r1=150132&r2=150133&view=diff ============================================================================== --- lldb/trunk/test/lldbtest.py (original) +++ lldb/trunk/test/lldbtest.py Wed Feb 8 20:01:59 2012 @@ -240,6 +240,23 @@ a_pointer = ctypes.c_void_p(0xffff) return 8 * ctypes.sizeof(a_pointer) +def is_exe(fpath): + """Returns true if fpath is an executable.""" + return os.path.isfile(fpath) and os.access(fpath, os.X_OK) + +def which(program): + """Returns the full path to a program; None otherwise.""" + fpath, fname = os.path.split(program) + if fpath: + if is_exe(program): + return program + else: + for path in os.environ["PATH"].split(os.pathsep): + exe_file = os.path.join(path, program) + if is_exe(exe_file): + return exe_file + return None + class recording(StringIO.StringIO): """ A nice little context manager for recording the debugger interactions into Modified: lldb/trunk/test/terminal/TestSTTYBeforeAndAfter.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/terminal/TestSTTYBeforeAndAfter.py?rev=150133&r1=150132&r2=150133&view=diff ============================================================================== --- lldb/trunk/test/terminal/TestSTTYBeforeAndAfter.py (original) +++ lldb/trunk/test/terminal/TestSTTYBeforeAndAfter.py Wed Feb 8 20:01:59 2012 @@ -23,6 +23,9 @@ def test_stty_dash_a_before_and_afetr_invoking_lldb_command(self): """Test that 'stty -a' displays the same output before and after running the lldb command.""" + if not which('expect'): + self.skipTest("The 'expect' program cannot be located, skip the test") + # The expect prompt. expect_prompt = "expect[0-9.]+> " # The default lldb prompt. From scallanan at apple.com Wed Feb 8 20:04:23 2012 From: scallanan at apple.com (Sean Callanan) Date: Thu, 09 Feb 2012 02:04:23 -0000 Subject: [Lldb-commits] [lldb] r150134 - /lldb/trunk/source/Symbol/ClangASTImporter.cpp Message-ID: <20120209020423.E38032A6C12C@llvm.org> Author: spyffe Date: Wed Feb 8 20:04:23 2012 New Revision: 150134 URL: http://llvm.org/viewvc/llvm-project?rev=150134&view=rev Log: Removed another debug message. Sigh... Modified: lldb/trunk/source/Symbol/ClangASTImporter.cpp Modified: lldb/trunk/source/Symbol/ClangASTImporter.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTImporter.cpp?rev=150134&r1=150133&r2=150134&view=diff ============================================================================== --- lldb/trunk/source/Symbol/ClangASTImporter.cpp (original) +++ lldb/trunk/source/Symbol/ClangASTImporter.cpp Wed Feb 8 20:04:23 2012 @@ -418,10 +418,6 @@ to, from_named_decl->getName().str().c_str(), from); - - if (!strcmp(from->getDeclKindName(), "ClassTemplateSpecialization") && - !from_named_decl->getName().str().compare("rebind")) - fprintf(stderr, "This is the one!"); } else { From scallanan at apple.com Wed Feb 8 21:22:42 2012 From: scallanan at apple.com (Sean Callanan) Date: Thu, 09 Feb 2012 03:22:42 -0000 Subject: [Lldb-commits] [lldb] r150142 - in /lldb/trunk: scripts/build-llvm.pl source/Expression/IRDynamicChecks.cpp source/Expression/IRForTarget.cpp Message-ID: <20120209032242.33C892A6C12C@llvm.org> Author: spyffe Date: Wed Feb 8 21:22:41 2012 New Revision: 150142 URL: http://llvm.org/viewvc/llvm-project?rev=150142&view=rev Log: Brought LLVM/Clang up to top of tree. The only change (besides logging) is that now string literals in the IR are ConstantDataArrays instead of ConstantArrays. Modified: lldb/trunk/scripts/build-llvm.pl lldb/trunk/source/Expression/IRDynamicChecks.cpp lldb/trunk/source/Expression/IRForTarget.cpp Modified: lldb/trunk/scripts/build-llvm.pl URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/build-llvm.pl?rev=150142&r1=150141&r2=150142&view=diff ============================================================================== --- lldb/trunk/scripts/build-llvm.pl (original) +++ lldb/trunk/scripts/build-llvm.pl Wed Feb 8 21:22:41 2012 @@ -21,8 +21,8 @@ our $llvm_configuration = $ENV{LLVM_CONFIGURATION}; -our $llvm_revision = "149773"; -our $clang_revision = "149773"; +our $llvm_revision = "150134"; +our $clang_revision = "150134"; our $SRCROOT = "$ENV{SRCROOT}"; our $llvm_dstroot_zip = "$SRCROOT/llvm.zip"; Modified: lldb/trunk/source/Expression/IRDynamicChecks.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/IRDynamicChecks.cpp?rev=150142&r1=150141&r2=150142&view=diff ============================================================================== --- lldb/trunk/source/Expression/IRDynamicChecks.cpp (original) +++ lldb/trunk/source/Expression/IRDynamicChecks.cpp Wed Feb 8 21:22:41 2012 @@ -512,7 +512,7 @@ return false; } - ConstantArray *real_name = dyn_cast(metadata->getOperand(0)); + ConstantDataArray *real_name = dyn_cast(metadata->getOperand(0)); if (!real_name) { @@ -528,12 +528,12 @@ return false; } - if (log) - log->Printf("Found call to %s: %s\n", real_name->getAsString().c_str(), PrintValue(call_inst).c_str()); - std::string name_str = real_name->getAsString(); const char* name_cstr = name_str.c_str(); + if (log) + log->Printf("Found call to %s: %s\n", name_cstr, PrintValue(call_inst).c_str()); + if (name_str.find("objc_msgSend") == std::string::npos) return true; Modified: lldb/trunk/source/Expression/IRForTarget.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/IRForTarget.cpp?rev=150142&r1=150141&r2=150142&view=diff ============================================================================== --- lldb/trunk/source/Expression/IRForTarget.cpp (original) +++ lldb/trunk/source/Expression/IRForTarget.cpp Wed Feb 8 21:22:41 2012 @@ -312,7 +312,7 @@ if (Instruction *user_inst = dyn_cast(user)) { - Constant *name_array = ConstantArray::get(context, StringRef(name)); + Constant *name_array = ConstantDataArray::getString(context, StringRef(name)); ArrayRef md_values(name_array); @@ -891,14 +891,14 @@ m_CFStringCreateWithBytes = ConstantExpr::getIntToPtr(CFSCWB_addr_int, CFSCWB_ptr_ty); } - ConstantArray *string_array = NULL; + ConstantDataSequential *string_array = NULL; if (cstr) - string_array = dyn_cast(cstr->getInitializer()); + string_array = dyn_cast(cstr->getInitializer()); Constant *alloc_arg = Constant::getNullValue(i8_ptr_ty); Constant *bytes_arg = cstr ? ConstantExpr::getBitCast(cstr, i8_ptr_ty) : Constant::getNullValue(i8_ptr_ty); - Constant *numBytes_arg = ConstantInt::get(intptr_ty, cstr ? string_array->getType()->getNumElements() - 1 : 0, false); + Constant *numBytes_arg = ConstantInt::get(intptr_ty, cstr ? string_array->getNumElements() - 1 : 0, false); Constant *encoding_arg = ConstantInt::get(i32_ty, 0x0600, false); /* 0x0600 is kCFStringEncodingASCII */ Constant *isExternal_arg = ConstantInt::get(i8_ty, 0x0, false); /* 0x0 is false */ @@ -1109,12 +1109,12 @@ } */ - ConstantArray *cstr_array = dyn_cast(cstr_global->getInitializer()); + ConstantDataArray *cstr_array = dyn_cast(cstr_global->getInitializer()); if (log) { if (cstr_array) - log->Printf("Found NSString constant %s, which contains \"%s\"", value_name_cstr, cstr_array->getAsString().c_str()); + log->Printf("Found NSString constant %s, which contains \"%s\"", value_name_cstr, cstr_array->getAsString().str().c_str()); else log->Printf("Found NSString constant %s, which contains \"\"", value_name_cstr); } @@ -1224,7 +1224,7 @@ Constant *omvn_initializer = _objc_meth_var_name_->getInitializer(); - ConstantArray *omvn_initializer_array = dyn_cast(omvn_initializer); + ConstantDataArray *omvn_initializer_array = dyn_cast(omvn_initializer); if (!omvn_initializer_array->isString()) return false; @@ -1488,7 +1488,7 @@ memcpy (data, int_initializer->getValue().getRawData(), m_target_data->getTypeStoreSize(initializer_type)); return true; } - else if (ConstantArray *array_initializer = dyn_cast(initializer)) + else if (ConstantDataArray *array_initializer = dyn_cast(initializer)) { if (array_initializer->isString()) { @@ -1504,7 +1504,13 @@ for (int i = 0; i < array_initializer->getNumOperands(); ++i) { - if (!MaterializeInitializer(data + (i * element_size), array_initializer->getOperand(i))) + Value *operand_value = array_initializer->getOperand(i); + Constant *operand_constant = dyn_cast(operand_value); + + if (!operand_constant) + return false; + + if (!MaterializeInitializer(data + (i * element_size), operand_constant)) return false; } } @@ -1926,7 +1932,7 @@ } else { - ConstantArray *gc_array = dyn_cast(gc); + ConstantDataArray *gc_array = dyn_cast(gc); if (!gc_array) continue; From gclayton at apple.com Thu Feb 9 00:16:33 2012 From: gclayton at apple.com (Greg Clayton) Date: Thu, 09 Feb 2012 06:16:33 -0000 Subject: [Lldb-commits] [lldb] r150154 - in /lldb/trunk: include/lldb/ include/lldb/Core/ include/lldb/Symbol/ include/lldb/Target/ lldb.xcodeproj/ source/ source/API/ source/Commands/ source/Core/ source/Plugins/DynamicLoader/MacOSX-DYLD/ source/Plugins/ObjectFile/Mach-O/ source/Plugins/Platform/MacOSX/ source/Plugins/Platform/gdb-server/ source/Plugins/Process/MacOSX-Kernel/ source/Plugins/Process/Utility/ source/Plugins/Process/gdb-remote/ source/Plugins/Process/mach-core/ source/Symbol/ source/Target/ Message-ID: <20120209061634.09EDD2A6C12C@llvm.org> Author: gclayton Date: Thu Feb 9 00:16:32 2012 New Revision: 150154 URL: http://llvm.org/viewvc/llvm-project?rev=150154&view=rev Log: First pass at mach-o core file support is in. It currently works for x86_64 user space programs. The core file support is implemented by making a process plug-in that will dress up the threads and stack frames by using the core file memory. Added many default implementations for the lldb_private::Process functions so that plug-ins like the ProcessMachCore don't need to override many many functions only to have to return an error. Added new virtual functions to the ObjectFile class for extracting the frozen thread states that might be stored in object files. The default implementations return no thread information, but any platforms that support core files that contain frozen thread states (like mach-o) can make a module using the core file and then extract the information. The object files can enumerate the threads and also provide the register state for each thread. Since each object file knows how the thread registers are stored, they are responsible for creating a suitable register context that can be used by the core file threads. Changed the process CreateInstace callbacks to return a shared pointer and to also take an "const FileSpec *core_file" parameter to allow for core file support. This will also allow for lldb_private::Process subclasses to be made that could load crash logs. This should be possible on darwin where the crash logs contain all of the stack frames for all of the threads, yet the crash logs only contain the registers for the crashed thrad. It should also allow some variables to be viewed for the thread that crashed. Added: lldb/trunk/source/Plugins/Process/mach-core/ lldb/trunk/source/Plugins/Process/mach-core/ProcessMachCore.cpp lldb/trunk/source/Plugins/Process/mach-core/ProcessMachCore.h lldb/trunk/source/Plugins/Process/mach-core/ThreadMachCore.cpp lldb/trunk/source/Plugins/Process/mach-core/ThreadMachCore.h Modified: lldb/trunk/include/lldb/Core/RangeMap.h lldb/trunk/include/lldb/Symbol/ObjectFile.h lldb/trunk/include/lldb/Target/Process.h lldb/trunk/include/lldb/Target/Target.h lldb/trunk/include/lldb/Target/ThreadList.h lldb/trunk/include/lldb/lldb-private-interfaces.h lldb/trunk/lldb.xcodeproj/project.pbxproj lldb/trunk/source/API/SBTarget.cpp lldb/trunk/source/Commands/CommandObjectProcess.cpp lldb/trunk/source/Commands/CommandObjectTarget.cpp lldb/trunk/source/Core/ModuleList.cpp lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp lldb/trunk/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.h lldb/trunk/source/Plugins/Process/Utility/RegisterContextDarwin_x86_64.h lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h lldb/trunk/source/Symbol/ObjectFile.cpp lldb/trunk/source/Target/Process.cpp lldb/trunk/source/Target/Target.cpp lldb/trunk/source/Target/ThreadList.cpp lldb/trunk/source/lldb.cpp Modified: lldb/trunk/include/lldb/Core/RangeMap.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/RangeMap.h?rev=150154&r1=150153&r2=150154&view=diff ============================================================================== --- lldb/trunk/include/lldb/Core/RangeMap.h (original) +++ lldb/trunk/include/lldb/Core/RangeMap.h Thu Feb 9 00:16:32 2012 @@ -682,6 +682,21 @@ return NULL; } + Entry * + Back() + { + if (!m_entries.empty()) + return &m_entries.back(); + return NULL; + } + + const Entry * + Back() const + { + if (!m_entries.empty()) + return &m_entries.back(); + return NULL; + } protected: Collection m_entries; Modified: lldb/trunk/include/lldb/Symbol/ObjectFile.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/ObjectFile.h?rev=150154&r1=150153&r2=150154&view=diff ============================================================================== --- lldb/trunk/include/lldb/Symbol/ObjectFile.h (original) +++ lldb/trunk/include/lldb/Symbol/ObjectFile.h Thu Feb 9 00:16:32 2012 @@ -415,6 +415,18 @@ virtual lldb_private::Address GetHeaderAddress () { return Address();} + + virtual uint32_t + GetNumThreadContexts () + { + return 0; + } + + virtual lldb::RegisterContextSP + GetThreadContextAtIndex (uint32_t idx, lldb_private::Thread &thread) + { + return lldb::RegisterContextSP(); + } //------------------------------------------------------------------ /// The object file should be able to calculate its type by looking /// at its file header and possibly the sections or other data in @@ -504,8 +516,13 @@ DataExtractor m_data; ///< The data for this object file so things can be parsed lazily. lldb_private::UnwindTable m_unwind_table; /// < Table of FuncUnwinders objects created for this ObjectFile's functions lldb::ProcessWP m_process_wp; - const bool m_in_memory; + const lldb::addr_t m_memory_addr; + bool + IsInMemory () const + { + return m_memory_addr != LLDB_INVALID_ADDRESS; + } //------------------------------------------------------------------ /// Sets the architecture for a module. At present the architecture /// can only be set if it is invalid. It is not allowed to switch from Modified: lldb/trunk/include/lldb/Target/Process.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Process.h?rev=150154&r1=150153&r2=150154&view=diff ============================================================================== --- lldb/trunk/include/lldb/Target/Process.h (original) +++ lldb/trunk/include/lldb/Target/Process.h Thu Feb 9 00:16:32 2012 @@ -1479,8 +1479,11 @@ /// /// @see Process::CanDebug () //------------------------------------------------------------------ - static Process* - FindPlugin (Target &target, const char *plugin_name, Listener &listener); + static lldb::ProcessSP + FindPlugin (Target &target, + const char *plugin_name, + Listener &listener, + const FileSpec *crash_file_path); @@ -1588,6 +1591,17 @@ virtual Error Launch (const ProcessLaunchInfo &launch_info); + virtual Error + LoadCore (); + + virtual Error + DoLoadCore () + { + Error error; + error.SetErrorStringWithFormat("error: %s does not support loading core files.", GetShortPluginName()); + return error; + } + //------------------------------------------------------------------ /// Attach to an existing process using the process attach info. /// @@ -1844,7 +1858,12 @@ /// LLDB_INVALID_PROCESS_ID if attaching fails. //------------------------------------------------------------------ virtual Error - DoAttachToProcessWithID (lldb::pid_t pid) = 0; + DoAttachToProcessWithID (lldb::pid_t pid) + { + Error error; + error.SetErrorStringWithFormat("error: %s does not support attaching to a process by pid", GetShortPluginName()); + return error; + } //------------------------------------------------------------------ /// Attach to an existing process using a partial process name. @@ -1940,7 +1959,13 @@ //------------------------------------------------------------------ virtual Error DoLaunch (Module *exe_module, - const ProcessLaunchInfo &launch_info) = 0; + const ProcessLaunchInfo &launch_info) + { + Error error; + error.SetErrorStringWithFormat("error: %s does not support launching processes", GetShortPluginName()); + return error; + } + //------------------------------------------------------------------ /// Called after launching a process. @@ -1983,7 +2008,13 @@ /// @see Thread:Suspend() //------------------------------------------------------------------ virtual Error - DoResume () = 0; + DoResume () + { + Error error; + error.SetErrorStringWithFormat("error: %s does not support resuming processes", GetShortPluginName()); + return error; + } + //------------------------------------------------------------------ /// Called after resuming a process. @@ -2026,7 +2057,13 @@ /// otherwise. //------------------------------------------------------------------ virtual Error - DoHalt (bool &caused_stop) = 0; + DoHalt (bool &caused_stop) + { + Error error; + error.SetErrorStringWithFormat("error: %s does not support halting processes", GetShortPluginName()); + return error; + } + //------------------------------------------------------------------ /// Called after halting a process. @@ -2060,7 +2097,13 @@ /// false otherwise. //------------------------------------------------------------------ virtual Error - DoDetach () = 0; + DoDetach () + { + Error error; + error.SetErrorStringWithFormat("error: %s does not support detaching from processes", GetShortPluginName()); + return error; + } + //------------------------------------------------------------------ /// Called after detaching from a process. @@ -2092,9 +2135,12 @@ /// Returns an error object. //------------------------------------------------------------------ virtual Error - DoSignal (int signal) = 0; - - + DoSignal (int signal) + { + Error error; + error.SetErrorStringWithFormat("error: %s does not support senging signals to processes", GetShortPluginName()); + return error; + } virtual Error WillDestroy () { return Error(); } @@ -2115,7 +2161,6 @@ virtual void DidSignal () {} - //------------------------------------------------------------------ /// Currently called as part of ShouldStop. /// FIXME: Should really happen when the target stops before the @@ -2445,7 +2490,12 @@ /// The number of bytes that were actually written. //------------------------------------------------------------------ virtual size_t - DoWriteMemory (lldb::addr_t vm_addr, const void *buf, size_t size, Error &error) = 0; + DoWriteMemory (lldb::addr_t vm_addr, const void *buf, size_t size, Error &error) + { + error.SetErrorStringWithFormat("error: %s does not support writing to processes", GetShortPluginName()); + return 0; + } + //------------------------------------------------------------------ /// Write all or part of a scalar value to memory. @@ -2537,7 +2587,12 @@ //------------------------------------------------------------------ virtual lldb::addr_t - DoAllocateMemory (size_t size, uint32_t permissions, Error &error) = 0; + DoAllocateMemory (size_t size, uint32_t permissions, Error &error) + { + error.SetErrorStringWithFormat("error: %s does not support allocating in the debug process", GetShortPluginName()); + return LLDB_INVALID_ADDRESS; + } + //------------------------------------------------------------------ /// The public interface to allocating memory in the process. @@ -2660,7 +2715,13 @@ //------------------------------------------------------------------ virtual Error - DoDeallocateMemory (lldb::addr_t ptr) = 0; + DoDeallocateMemory (lldb::addr_t ptr) + { + Error error; + error.SetErrorStringWithFormat("error: %s does not support deallocating in the debug process", GetShortPluginName()); + return error; + } + //------------------------------------------------------------------ /// The public interface to deallocating memory in the process. @@ -2741,10 +2802,22 @@ GetSoftwareBreakpointTrapOpcode (BreakpointSite* bp_site); virtual Error - EnableBreakpoint (BreakpointSite *bp_site) = 0; + EnableBreakpoint (BreakpointSite *bp_site) + { + Error error; + error.SetErrorStringWithFormat("error: %s does not support enabling breakpoints", GetShortPluginName()); + return error; + } + virtual Error - DisableBreakpoint (BreakpointSite *bp_site) = 0; + DisableBreakpoint (BreakpointSite *bp_site) + { + Error error; + error.SetErrorStringWithFormat("error: %s does not support disabling breakpoints", GetShortPluginName()); + return error; + } + // This is implemented completely using the lldb::Process API. Subclasses // don't need to implement this function unless the standard flow of Modified: lldb/trunk/include/lldb/Target/Target.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Target.h?rev=150154&r1=150153&r2=150154&view=diff ============================================================================== --- lldb/trunk/include/lldb/Target/Target.h (original) +++ lldb/trunk/include/lldb/Target/Target.h Thu Feb 9 00:16:32 2012 @@ -335,7 +335,9 @@ Dump (Stream *s, lldb::DescriptionLevel description_level); const lldb::ProcessSP & - CreateProcess (Listener &listener, const char *plugin_name = NULL); + CreateProcess (Listener &listener, + const char *plugin_name, + const FileSpec *crash_file); const lldb::ProcessSP & GetProcessSP () const; Modified: lldb/trunk/include/lldb/Target/ThreadList.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/ThreadList.h?rev=150154&r1=150153&r2=150154&view=diff ============================================================================== --- lldb/trunk/include/lldb/Target/ThreadList.h (original) +++ lldb/trunk/include/lldb/Target/ThreadList.h Thu Feb 9 00:16:32 2012 @@ -43,7 +43,7 @@ GetSize(bool can_update = true); void - AddThread (lldb::ThreadSP &thread_sp); + AddThread (const lldb::ThreadSP &thread_sp); // Return the selected thread if there is one. Otherwise, return the thread // selected at index 0. Modified: lldb/trunk/include/lldb/lldb-private-interfaces.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-private-interfaces.h?rev=150154&r1=150153&r2=150154&view=diff ============================================================================== --- lldb/trunk/include/lldb/lldb-private-interfaces.h (original) +++ lldb/trunk/include/lldb/lldb-private-interfaces.h Thu Feb 9 00:16:32 2012 @@ -27,7 +27,7 @@ typedef OperatingSystem* (*OperatingSystemCreateInstance) (Process *process, bool force); typedef LanguageRuntime *(*LanguageRuntimeCreateInstance) (Process *process, lldb::LanguageType language); typedef Platform* (*PlatformCreateInstance) (); - typedef Process* (*ProcessCreateInstance) (Target &target, Listener &listener); + typedef lldb::ProcessSP (*ProcessCreateInstance) (Target &target, Listener &listener, const FileSpec *crash_file_path); typedef SymbolFile* (*SymbolFileCreateInstance) (ObjectFile* obj_file); typedef SymbolVendor* (*SymbolVendorCreateInstance) (Module *module); // Module can be NULL for default system symbol vendor typedef bool (*BreakpointHitCallback) (void *baton, StoppointCallbackContext *context, lldb::user_id_t break_id, lldb::user_id_t break_loc_id); Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=150154&r1=150153&r2=150154&view=diff ============================================================================== --- lldb/trunk/lldb.xcodeproj/project.pbxproj (original) +++ lldb/trunk/lldb.xcodeproj/project.pbxproj Thu Feb 9 00:16:32 2012 @@ -334,6 +334,10 @@ 26957D9A13D381C900670048 /* RegisterContextDarwin_i386.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26957D9413D381C900670048 /* RegisterContextDarwin_i386.cpp */; }; 26957D9C13D381C900670048 /* RegisterContextDarwin_x86_64.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26957D9613D381C900670048 /* RegisterContextDarwin_x86_64.cpp */; }; 2697A54D133A6305004E4240 /* PlatformDarwin.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2697A54B133A6305004E4240 /* PlatformDarwin.cpp */; }; + 26A527C114E24F5F00F3A14A /* ProcessMachCore.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26A527BD14E24F5F00F3A14A /* ProcessMachCore.cpp */; }; + 26A527C214E24F5F00F3A14A /* ProcessMachCore.h in Headers */ = {isa = PBXBuildFile; fileRef = 26A527BE14E24F5F00F3A14A /* ProcessMachCore.h */; }; + 26A527C314E24F5F00F3A14A /* ThreadMachCore.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26A527BF14E24F5F00F3A14A /* ThreadMachCore.cpp */; }; + 26A527C414E24F5F00F3A14A /* ThreadMachCore.h in Headers */ = {isa = PBXBuildFile; fileRef = 26A527C014E24F5F00F3A14A /* ThreadMachCore.h */; }; 26A69C5F137A17A500262477 /* RegisterValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26C6886E137880C400407EDF /* RegisterValue.cpp */; }; 26A7A035135E6E4200FB369E /* NamedOptionValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26A7A034135E6E4200FB369E /* NamedOptionValue.cpp */; }; 26B1FCB813381071002886E2 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 26F5C39010F3FA26009D5894 /* CoreFoundation.framework */; }; @@ -778,6 +782,10 @@ 26A3B4AC1181454800381BC2 /* ObjectContainerBSDArchive.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ObjectContainerBSDArchive.cpp; sourceTree = ""; }; 26A3B4AD1181454800381BC2 /* ObjectContainerBSDArchive.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ObjectContainerBSDArchive.h; sourceTree = ""; }; 26A4EEB511682AAC007A372A /* LLDBWrapPython.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; lineEnding = 0; name = LLDBWrapPython.cpp; path = source/LLDBWrapPython.cpp; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.cpp; }; + 26A527BD14E24F5F00F3A14A /* ProcessMachCore.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ProcessMachCore.cpp; sourceTree = ""; }; + 26A527BE14E24F5F00F3A14A /* ProcessMachCore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProcessMachCore.h; sourceTree = ""; }; + 26A527BF14E24F5F00F3A14A /* ThreadMachCore.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ThreadMachCore.cpp; sourceTree = ""; }; + 26A527C014E24F5F00F3A14A /* ThreadMachCore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ThreadMachCore.h; sourceTree = ""; }; 26A7A034135E6E4200FB369E /* NamedOptionValue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = NamedOptionValue.cpp; path = source/Interpreter/NamedOptionValue.cpp; sourceTree = ""; }; 26A7A036135E6E5300FB369E /* NamedOptionValue.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = NamedOptionValue.h; path = include/lldb/Interpreter/NamedOptionValue.h; sourceTree = ""; }; 26B167A41123BF5500DC7B4F /* ThreadSafeValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ThreadSafeValue.h; path = include/lldb/Core/ThreadSafeValue.h; sourceTree = ""; }; @@ -1573,6 +1581,7 @@ children = ( 4CEE62F71145F1C70064CF93 /* GDB Remote */, 2642FBA713D003B400ED6808 /* MacOSX-Kernel */, + 26A527BC14E24F5F00F3A14A /* mach-core */, 26B4666E11A2080F00CF6220 /* Utility */, ); path = Process; @@ -1977,6 +1986,17 @@ path = "BSD-Archive"; sourceTree = ""; }; + 26A527BC14E24F5F00F3A14A /* mach-core */ = { + isa = PBXGroup; + children = ( + 26A527BD14E24F5F00F3A14A /* ProcessMachCore.cpp */, + 26A527BE14E24F5F00F3A14A /* ProcessMachCore.h */, + 26A527BF14E24F5F00F3A14A /* ThreadMachCore.cpp */, + 26A527C014E24F5F00F3A14A /* ThreadMachCore.h */, + ); + path = "mach-core"; + sourceTree = ""; + }; 26AC3F441365F40E0065C7EF /* UnwindAssembly */ = { isa = PBXGroup; children = ( @@ -2871,6 +2891,8 @@ isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( + 26A527C214E24F5F00F3A14A /* ProcessMachCore.h in Headers */, + 26A527C414E24F5F00F3A14A /* ThreadMachCore.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -3530,6 +3552,8 @@ 494260DA14579144003C1C78 /* VerifyDecl.cpp in Sources */, 49DA65031485C92A005FF180 /* AppleObjCSymbolVendor.cpp in Sources */, 4966DCC4148978A10028481B /* ClangExternalASTSourceCommon.cpp in Sources */, + 26A527C114E24F5F00F3A14A /* ProcessMachCore.cpp in Sources */, + 26A527C314E24F5F00F3A14A /* ThreadMachCore.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; Modified: lldb/trunk/source/API/SBTarget.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBTarget.cpp?rev=150154&r1=150153&r2=150154&view=diff ============================================================================== --- lldb/trunk/source/API/SBTarget.cpp (original) +++ lldb/trunk/source/API/SBTarget.cpp Thu Feb 9 00:16:32 2012 @@ -225,9 +225,9 @@ else { if (listener.IsValid()) - process_sp = target_sp->CreateProcess (listener.ref()); + process_sp = target_sp->CreateProcess (listener.ref(), NULL, NULL); else - process_sp = target_sp->CreateProcess (target_sp->GetDebugger().GetListener()); + process_sp = target_sp->CreateProcess (target_sp->GetDebugger().GetListener(), NULL, NULL); } if (process_sp) @@ -346,9 +346,9 @@ else { if (listener.IsValid()) - process_sp = target_sp->CreateProcess (listener.ref()); + process_sp = target_sp->CreateProcess (listener.ref(), NULL, NULL); else - process_sp = target_sp->CreateProcess (target_sp->GetDebugger().GetListener()); + process_sp = target_sp->CreateProcess (target_sp->GetDebugger().GetListener(), NULL, NULL); } if (process_sp) { @@ -421,9 +421,9 @@ else { if (listener.IsValid()) - process_sp = target_sp->CreateProcess (listener.ref()); + process_sp = target_sp->CreateProcess (listener.ref(), NULL, NULL); else - process_sp = target_sp->CreateProcess (target_sp->GetDebugger().GetListener()); + process_sp = target_sp->CreateProcess (target_sp->GetDebugger().GetListener(), NULL, NULL); } if (process_sp) @@ -467,9 +467,9 @@ { Mutex::Locker api_locker (target_sp->GetAPIMutex()); if (listener.IsValid()) - process_sp = target_sp->CreateProcess (listener.ref(), plugin_name); + process_sp = target_sp->CreateProcess (listener.ref(), plugin_name, NULL); else - process_sp = target_sp->CreateProcess (target_sp->GetDebugger().GetListener(), plugin_name); + process_sp = target_sp->CreateProcess (target_sp->GetDebugger().GetListener(), plugin_name, NULL); if (process_sp) Modified: lldb/trunk/source/Commands/CommandObjectProcess.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectProcess.cpp?rev=150154&r1=150153&r2=150154&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectProcess.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectProcess.cpp Thu Feb 9 00:16:32 2012 @@ -189,7 +189,7 @@ else { const char *plugin_name = m_options.launch_info.GetProcessPluginName(); - process = target->CreateProcess (debugger.GetListener(), plugin_name).get(); + process = target->CreateProcess (debugger.GetListener(), plugin_name, NULL).get(); if (process) error = process->Launch (m_options.launch_info); } @@ -501,7 +501,7 @@ if (state != eStateConnected) { const char *plugin_name = m_options.attach_info.GetProcessPluginName(); - process = target->CreateProcess (m_interpreter.GetDebugger().GetListener(), plugin_name).get(); + process = target->CreateProcess (m_interpreter.GetDebugger().GetListener(), plugin_name, NULL).get(); } if (process) @@ -870,7 +870,7 @@ plugin_name = m_options.plugin_name.c_str(); const char *remote_url = command.GetArgumentAtIndex(0); - process = target_sp->CreateProcess (m_interpreter.GetDebugger().GetListener(), plugin_name).get(); + process = target_sp->CreateProcess (m_interpreter.GetDebugger().GetListener(), plugin_name, NULL).get(); if (process) { Modified: lldb/trunk/source/Commands/CommandObjectTarget.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectTarget.cpp?rev=150154&r1=150153&r2=150154&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectTarget.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectTarget.cpp Thu Feb 9 00:16:32 2012 @@ -148,7 +148,8 @@ NULL), m_option_group (interpreter), m_arch_option (), - m_platform_options(true) // Do include the "--platform" option in the platform settings by passing true + m_platform_options(true), // Do include the "--platform" option in the platform settings by passing true + m_core_file (LLDB_OPT_SET_1, false, "core-file", 'c', 0, eArgTypePath, "Fullpath to a core file to use for this target.") { CommandArgumentEntry arg; CommandArgumentData file_arg; @@ -165,6 +166,7 @@ m_option_group.Append (&m_arch_option, LLDB_OPT_SET_ALL, LLDB_OPT_SET_1); m_option_group.Append (&m_platform_options, LLDB_OPT_SET_ALL, LLDB_OPT_SET_1); + m_option_group.Append (&m_core_file, LLDB_OPT_SET_ALL, LLDB_OPT_SET_1); m_option_group.Finalize(); } @@ -182,11 +184,16 @@ Execute (Args& command, CommandReturnObject &result) { const int argc = command.GetArgumentCount(); - if (argc == 1) + FileSpec core_file (m_core_file.GetOptionValue().GetCurrentValue()); + + if (argc == 1 || core_file) { const char *file_path = command.GetArgumentAtIndex(0); Timer scoped_timer(__PRETTY_FUNCTION__, "(lldb) target create '%s'", file_path); - FileSpec file_spec (file_path, true); + FileSpec file_spec; + + if (file_path) + file_spec.SetFile (file_path, true); TargetSP target_sp; Debugger &debugger = m_interpreter.GetDebugger(); @@ -202,8 +209,41 @@ if (target_sp) { debugger.GetTargetList().SetSelectedTarget(target_sp.get()); - result.AppendMessageWithFormat ("Current executable set to '%s' (%s).\n", file_path, target_sp->GetArchitecture().GetArchitectureName()); - result.SetStatus (eReturnStatusSuccessFinishNoResult); + if (core_file) + { + ProcessSP process_sp (target_sp->CreateProcess (m_interpreter.GetDebugger().GetListener(), NULL, &core_file)); + char core_path[PATH_MAX]; + core_file.GetPath(core_path, sizeof(core_path)); + + if (process_sp) + { + // Seems wierd that we Launch a core file, but that is + // what we do! + error = process_sp->LoadCore(); + + if (error.Fail()) + { + result.AppendError(error.AsCString("can't find plug-in for core file")); + result.SetStatus (eReturnStatusFailed); + return false; + } + else + { + result.AppendMessageWithFormat ("Core file '%s' (%s) was loaded.\n", core_path, target_sp->GetArchitecture().GetArchitectureName()); + result.SetStatus (eReturnStatusSuccessFinishNoResult); + } + } + else + { + result.AppendErrorWithFormat ("Unable to find process plug-in for core file '%s'\n", core_path); + result.SetStatus (eReturnStatusFailed); + } + } + else + { + result.AppendMessageWithFormat ("Current executable set to '%s' (%s).\n", file_path, target_sp->GetArchitecture().GetArchitectureName()); + result.SetStatus (eReturnStatusSuccessFinishNoResult); + } } else { @@ -213,7 +253,7 @@ } else { - result.AppendErrorWithFormat("'%s' takes exactly one executable path argument.\n", m_cmd_name.c_str()); + result.AppendErrorWithFormat("'%s' takes exactly one executable path argument, or use the --core-file option.\n", m_cmd_name.c_str()); result.SetStatus (eReturnStatusFailed); } return result.Succeeded(); @@ -247,6 +287,7 @@ OptionGroupOptions m_option_group; OptionGroupArchitecture m_arch_option; OptionGroupPlatform m_platform_options; + OptionGroupFile m_core_file; }; Modified: lldb/trunk/source/Core/ModuleList.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ModuleList.cpp?rev=150154&r1=150153&r2=150154&view=diff ============================================================================== --- lldb/trunk/source/Core/ModuleList.cpp (original) +++ lldb/trunk/source/Core/ModuleList.cpp Thu Feb 9 00:16:32 2012 @@ -803,20 +803,25 @@ // Make sure there are a module and an object file since we can specify // a valid file path with an architecture that might not be in that file. // By getting the object file we can guarantee that the architecture matches - if (module_sp && module_sp->GetObjectFile()) + if (module_sp) { - // If we get in here we got the correct arch, now we just need - // to verify the UUID if one was given - if (uuid_ptr && *uuid_ptr != module_sp->GetUUID()) - module_sp.reset(); - else + if (module_sp->GetObjectFile()) { - if (did_create_ptr) - *did_create_ptr = true; - - shared_module_list.Append(module_sp); - return error; + // If we get in here we got the correct arch, now we just need + // to verify the UUID if one was given + if (uuid_ptr && *uuid_ptr != module_sp->GetUUID()) + module_sp.reset(); + else + { + if (did_create_ptr) + *did_create_ptr = true; + + shared_module_list.Append(module_sp); + return error; + } } + else + module_sp.reset(); } } } Modified: lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp?rev=150154&r1=150153&r2=150154&view=diff ============================================================================== --- lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp (original) +++ lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp Thu Feb 9 00:16:32 2012 @@ -7,6 +7,9 @@ // //===----------------------------------------------------------------------===// + +#include "llvm/Support/MachO.h" + #include "lldb/Breakpoint/StoppointCallbackContext.h" #include "lldb/Core/DataBuffer.h" #include "lldb/Core/DataBufferHeap.h" @@ -211,7 +214,35 @@ DynamicLoaderMacOSXDYLD::LocateDYLD() { if (m_dyld_all_image_infos_addr == LLDB_INVALID_ADDRESS) - m_dyld_all_image_infos_addr = m_process->GetImageInfoAddress (); + { + // Check the image info addr as it might point to the + // mach header for dyld, or it might point to the + // dyld_all_image_infos struct + addr_t shlib_addr = m_process->GetImageInfoAddress (); + + ByteOrder byte_order = m_process->GetTarget().GetArchitecture().GetByteOrder(); + uint8_t buf[4]; + DataExtractor data (buf, sizeof(buf), byte_order, 4); + Error error; + if (m_process->ReadMemory (shlib_addr, buf, 4, error) == 4) + { + uint32_t offset = 0; + uint32_t magic = data.GetU32 (&offset); + switch (magic) + { + case llvm::MachO::HeaderMagic32: + case llvm::MachO::HeaderMagic64: + case llvm::MachO::HeaderMagic32Swapped: + case llvm::MachO::HeaderMagic64Swapped: + return ReadDYLDInfoFromMemoryAndSetNotificationCallback(shlib_addr); + + default: + break; + } + } + // Maybe it points to the all image infos? + m_dyld_all_image_infos_addr = shlib_addr; + } if (m_dyld_all_image_infos_addr != LLDB_INVALID_ADDRESS) { Modified: lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp?rev=150154&r1=150153&r2=150154&view=diff ============================================================================== --- lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp (original) +++ lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp Thu Feb 9 00:16:32 2012 @@ -27,12 +27,110 @@ #include "lldb/Symbol/ClangNamespaceDecl.h" #include "lldb/Symbol/ObjectFile.h" #include "lldb/Target/Process.h" +#include "Plugins/Process/Utility/RegisterContextDarwin_x86_64.h" using namespace lldb; using namespace lldb_private; using namespace llvm::MachO; +class RegisterContextDarwin_x86_64_Mach : public RegisterContextDarwin_x86_64 +{ +public: + RegisterContextDarwin_x86_64_Mach (lldb_private::Thread &thread, const DataExtractor &data) : + RegisterContextDarwin_x86_64 (thread, 0) + { + SetRegisterDataFrom_LC_THREAD (data); + } + + virtual void + InvalidateAllRegisters () + { + // Do nothing... registers are always valid... + } + + void + SetRegisterDataFrom_LC_THREAD (const DataExtractor &data) + { + int flavor; + uint32_t offset = 0; + SetError (GPRRegSet, Read, -1); + SetError (FPURegSet, Read, -1); + SetError (EXCRegSet, Read, -1); + while ((flavor = data.GetU32 (&offset)) > 0) + { + uint32_t i; + uint32_t count = data.GetU32 (&offset); + switch (flavor) + { + case 7: + case 8: + case 9: + // Goofy extra flavor inside state... + flavor = data.GetU32 (&offset); + count = data.GetU32 (&offset); + default: + break; + } + + switch (flavor) + { + case GPRRegSet: + for (i=0; iGetRangeBase(), + thread_context_file_range->GetByteSize()); + reg_ctx_sp.reset (new RegisterContextDarwin_x86_64_Mach (thread, data)); + } + return reg_ctx_sp; +} + ObjectFile::Type ObjectFileMachO::CalculateType() Modified: lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h?rev=150154&r1=150153&r2=150154&view=diff ============================================================================== --- lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h (original) +++ lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h Thu Feb 9 00:16:32 2012 @@ -13,6 +13,7 @@ #include "llvm/Support/MachO.h" #include "lldb/Core/Address.h" +#include "lldb/Core/RangeMap.h" #include "lldb/Host/FileSpec.h" #include "lldb/Host/Mutex.h" #include "lldb/Symbol/ObjectFile.h" @@ -126,6 +127,12 @@ virtual lldb_private::Address GetHeaderAddress (); + virtual uint32_t + GetNumThreadContexts (); + + virtual lldb::RegisterContextSP + GetThreadContextAtIndex (uint32_t idx, lldb_private::Thread &thread); + virtual ObjectFile::Type CalculateType(); @@ -146,7 +153,10 @@ llvm::MachO::dysymtab_command m_dysymtab; std::vector m_mach_segments; std::vector m_mach_sections; + typedef lldb_private::RangeArray FileRangeArray; lldb_private::Address m_entry_point_address; + FileRangeArray m_thread_context_offsets; + bool m_thread_context_offsets_valid; size_t ParseSections (); Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp?rev=150154&r1=150153&r2=150154&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp (original) +++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp Thu Feb 9 00:16:32 2012 @@ -447,7 +447,7 @@ { debugger.GetTargetList().SetSelectedTarget(target); - process_sp = target->CreateProcess (listener, attach_info.GetProcessPluginName()); + process_sp = target->CreateProcess (listener, attach_info.GetProcessPluginName(), NULL); if (process_sp) error = process_sp->Attach (attach_info); Modified: lldb/trunk/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp?rev=150154&r1=150153&r2=150154&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp (original) +++ lldb/trunk/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp Thu Feb 9 00:16:32 2012 @@ -378,7 +378,7 @@ // The darwin always currently uses the GDB remote debugger plug-in // so even when debugging locally we are debugging remotely! - process_sp = target->CreateProcess (listener, "gdb-remote"); + process_sp = target->CreateProcess (listener, "gdb-remote", NULL); if (process_sp) { Modified: lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp?rev=150154&r1=150153&r2=150154&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp (original) +++ lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp Thu Feb 9 00:16:32 2012 @@ -49,10 +49,15 @@ } -Process* -ProcessKDP::CreateInstance (Target &target, Listener &listener) -{ - return new ProcessKDP (target, listener); +lldb::ProcessSP +ProcessKDP::CreateInstance (Target &target, + Listener &listener, + const FileSpec *crash_file_path) +{ + lldb::ProcessSP process_sp; + if (crash_file_path == NULL) + process_sp.reset(new ProcessKDP (target, listener)); + return process_sp; } bool Modified: lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.h?rev=150154&r1=150153&r2=150154&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.h (original) +++ lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.h Thu Feb 9 00:16:32 2012 @@ -38,8 +38,10 @@ //------------------------------------------------------------------ // Constructors and Destructors //------------------------------------------------------------------ - static Process* - CreateInstance (lldb_private::Target& target, lldb_private::Listener &listener); + static lldb::ProcessSP + CreateInstance (lldb_private::Target& target, + lldb_private::Listener &listener, + const lldb_private::FileSpec *crash_file_path); static void Initialize(); Modified: lldb/trunk/source/Plugins/Process/Utility/RegisterContextDarwin_x86_64.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/RegisterContextDarwin_x86_64.h?rev=150154&r1=150153&r2=150154&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Utility/RegisterContextDarwin_x86_64.h (original) +++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextDarwin_x86_64.h Thu Feb 9 00:16:32 2012 @@ -21,7 +21,7 @@ { public: RegisterContextDarwin_x86_64 (lldb_private::Thread &thread, - uint32_t concrete_frame_idx); + uint32_t concrete_frame_idx); virtual ~RegisterContextDarwin_x86_64(); @@ -239,36 +239,35 @@ return -1; } - int + virtual int DoReadFPU (lldb::tid_t tid, int flavor, FPU &fpu) { return -1; } - int + virtual int DoReadEXC (lldb::tid_t tid, int flavor, EXC &exc) { return -1; } - int + virtual int DoWriteGPR (lldb::tid_t tid, int flavor, const GPR &gpr) { return -1; } - int + virtual int DoWriteFPU (lldb::tid_t tid, int flavor, const FPU &fpu) { return -1; } - int + virtual int DoWriteEXC (lldb::tid_t tid, int flavor, const EXC &exc) { return -1; } - int ReadRegisterSet (uint32_t set, bool force); Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp?rev=150154&r1=150153&r2=150154&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp (original) +++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Thu Feb 9 00:16:32 2012 @@ -94,10 +94,13 @@ } -Process* -ProcessGDBRemote::CreateInstance (Target &target, Listener &listener) +lldb::ProcessSP +ProcessGDBRemote::CreateInstance (Target &target, Listener &listener, const FileSpec *crash_file_path) { - return new ProcessGDBRemote (target, listener); + lldb::ProcessSP process_sp; + if (crash_file_path == NULL) + process_sp.reset (new ProcessGDBRemote (target, listener)); + return process_sp; } bool @@ -109,7 +112,25 @@ // For now we are just making sure the file exists for a given module Module *exe_module = target.GetExecutableModulePointer(); if (exe_module) + { + ObjectFile *exe_objfile = exe_module->GetObjectFile(); + // We can't debug core files... + switch (exe_objfile->GetType()) + { + case ObjectFile::eTypeInvalid: + case ObjectFile::eTypeCoreFile: + case ObjectFile::eTypeDebugInfo: + case ObjectFile::eTypeObjectFile: + case ObjectFile::eTypeSharedLibrary: + case ObjectFile::eTypeStubLibrary: + return false; + case ObjectFile::eTypeExecutable: + case ObjectFile::eTypeDynamicLinker: + case ObjectFile::eTypeUnknown: + break; + } return exe_module->GetFileSpec().Exists(); + } // However, if there is no executable module, we return true since we might be preparing to attach. return true; } Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h?rev=150154&r1=150153&r2=150154&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h (original) +++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h Thu Feb 9 00:16:32 2012 @@ -39,8 +39,10 @@ //------------------------------------------------------------------ // Constructors and Destructors //------------------------------------------------------------------ - static Process* - CreateInstance (lldb_private::Target& target, lldb_private::Listener &listener); + static lldb::ProcessSP + CreateInstance (lldb_private::Target& target, + lldb_private::Listener &listener, + const lldb_private::FileSpec *crash_file_path); static void Initialize(); Added: lldb/trunk/source/Plugins/Process/mach-core/ProcessMachCore.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/mach-core/ProcessMachCore.cpp?rev=150154&view=auto ============================================================================== --- lldb/trunk/source/Plugins/Process/mach-core/ProcessMachCore.cpp (added) +++ lldb/trunk/source/Plugins/Process/mach-core/ProcessMachCore.cpp Thu Feb 9 00:16:32 2012 @@ -0,0 +1,346 @@ +//===-- ProcessMachCore.cpp ------------------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// C Includes +#include +#include + +// C++ Includes +#include "llvm/Support/MachO.h" + +// Other libraries and framework includes +#include "lldb/Core/Debugger.h" +#include "lldb/Core/PluginManager.h" +#include "lldb/Core/State.h" +#include "lldb/Host/Host.h" +#include "lldb/Target/Target.h" +#include "lldb/Target/Thread.h" + +// Project includes +#include "ProcessMachCore.h" +#include "ThreadMachCore.h" +#include "StopInfoMachException.h" + +using namespace lldb; +using namespace lldb_private; + +const char * +ProcessMachCore::GetPluginNameStatic() +{ + return "mach-o-core"; +} + +const char * +ProcessMachCore::GetPluginDescriptionStatic() +{ + return "Mach-O core file debugging plug-in."; +} + +void +ProcessMachCore::Terminate() +{ + PluginManager::UnregisterPlugin (ProcessMachCore::CreateInstance); +} + + +lldb::ProcessSP +ProcessMachCore::CreateInstance (Target &target, Listener &listener, const FileSpec *crash_file) +{ + lldb::ProcessSP process_sp; + if (crash_file) + process_sp.reset(new ProcessMachCore (target, listener, *crash_file)); + return process_sp; +} + +bool +ProcessMachCore::CanDebug(Target &target, bool plugin_specified_by_name) +{ + if (plugin_specified_by_name) + return true; + + // For now we are just making sure the file exists for a given module + if (!m_core_module_sp && m_core_file.Exists()) + { + Error error (ModuleList::GetSharedModule(m_core_file, target.GetArchitecture(), NULL, NULL, 0, m_core_module_sp, NULL, NULL)); + + if (m_core_module_sp) + { + const llvm::Triple &triple_ref = m_core_module_sp->GetArchitecture().GetTriple(); + if (triple_ref.getOS() == llvm::Triple::Darwin && + triple_ref.getVendor() == llvm::Triple::Apple) + { + ObjectFile *core_objfile = m_core_module_sp->GetObjectFile(); + if (core_objfile && core_objfile->GetType() == ObjectFile::eTypeCoreFile) + return true; + } + } + } + return false; +} + +//---------------------------------------------------------------------- +// ProcessMachCore constructor +//---------------------------------------------------------------------- +ProcessMachCore::ProcessMachCore(Target& target, Listener &listener, const FileSpec &core_file) : + Process (target, listener), + m_core_aranges (), + m_core_module_sp (), + m_core_file (core_file), + m_shlib_addr (LLDB_INVALID_ADDRESS) +{ +} + +//---------------------------------------------------------------------- +// Destructor +//---------------------------------------------------------------------- +ProcessMachCore::~ProcessMachCore() +{ + Clear(); + // We need to call finalize on the process before destroying ourselves + // to make sure all of the broadcaster cleanup goes as planned. If we + // destruct this class, then Process::~Process() might have problems + // trying to fully destroy the broadcaster. + Finalize(); +} + +//---------------------------------------------------------------------- +// PluginInterface +//---------------------------------------------------------------------- +const char * +ProcessMachCore::GetPluginName() +{ + return "Process debugging plug-in that loads mach-o core files."; +} + +const char * +ProcessMachCore::GetShortPluginName() +{ + return GetPluginNameStatic(); +} + +uint32_t +ProcessMachCore::GetPluginVersion() +{ + return 1; +} + +//---------------------------------------------------------------------- +// Process Control +//---------------------------------------------------------------------- +Error +ProcessMachCore::DoLoadCore () +{ + Error error; + DataExtractor data; + ObjectFile *core_objfile = m_core_module_sp->GetObjectFile(); + if (core_objfile == NULL) + { + error.SetErrorString ("invalid core object file"); + return error; + } + SectionList *section_list = core_objfile->GetSectionList(); + if (section_list == NULL) + { + error.SetErrorString ("core file has no sections"); + return error; + } + + const uint32_t num_sections = section_list->GetNumSections(0); + if (num_sections == 0) + { + error.SetErrorString ("core file has no sections"); + return error; + } + bool ranges_are_sorted = true; + addr_t vm_addr = 0; + for (uint32_t i=0; iGetSectionAtIndex (i).get(); + if (section) + { + lldb::addr_t section_vm_addr = section->GetFileAddress(); + + if (m_shlib_addr == LLDB_INVALID_ADDRESS) + { + if (core_objfile->ReadSectionData (section, data)) + { + uint32_t offset = 0; + llvm::MachO::mach_header header; + if (data.GetU32(&offset, &header, sizeof(header)/sizeof(uint32_t))) + { + + if (header.magic == llvm::MachO::HeaderMagic32 || + header.magic == llvm::MachO::HeaderMagic64) + { + // Check MH_EXECUTABLE to see if we can find the mach image + // that contains the shared library list. The dynamic loader + // (dyld) is what contains the list for user applications, + // and the mach kernel contains a global that has the list + // of kexts to load + switch (header.filetype) + { + case llvm::MachO::HeaderFileTypeDynamicLinkEditor: + // Address of dyld "struct mach_header" in the core file + m_shlib_addr = section_vm_addr; + break; + case llvm::MachO::HeaderFileTypeExecutable: + // Check MH_EXECUTABLE file types to see if the dynamic link object flag + // is NOT set. If it isn't, then we have a mach_kernel. + if ((header.flags & llvm::MachO::HeaderFlagBitIsDynamicLinkObject) == 0) + { + // Address of the mach kernel "struct mach_header" in the core file. + m_shlib_addr = section_vm_addr; + } + break; + } + } + } + } + } + FileRange file_range (section->GetFileOffset(), section->GetFileSize()); + VMRangeToFileOffset::Entry range_entry (section_vm_addr, + section->GetByteSize(), + file_range); + + if (vm_addr > section_vm_addr) + ranges_are_sorted = false; + vm_addr = section->GetFileAddress(); + VMRangeToFileOffset::Entry *last_entry = m_core_aranges.Back(); + if (last_entry && + last_entry->GetRangeEnd() == range_entry.GetRangeBase() && + last_entry->data.GetRangeEnd() == range_entry.data.GetRangeBase()) + { + last_entry->SetRangeEnd (range_entry.GetRangeEnd()); + last_entry->data.SetRangeEnd (range_entry.data.GetRangeEnd()); + } + else + { + m_core_aranges.Append(range_entry); + } + } + } + if (!ranges_are_sorted) + { + m_core_aranges.Sort(); + } + if (!m_target.GetArchitecture().IsValid()) + m_target.SetArchitecture(m_core_module_sp->GetArchitecture()); + + return error; +} + + +uint32_t +ProcessMachCore::UpdateThreadList (ThreadList &old_thread_list, ThreadList &new_thread_list) +{ + if (old_thread_list.GetSize(false) == 0) + { + // Make up the thread the first time this is called so we can setup our one and only + // core thread state. + ObjectFile *core_objfile = m_core_module_sp->GetObjectFile(); + + if (core_objfile) + { + const uint32_t num_threads = core_objfile->GetNumThreadContexts (); + for (lldb::tid_t tid = 0; tid < num_threads; ++tid) + { + ThreadSP thread_sp(new ThreadMachCore (*this, tid)); + new_thread_list.AddThread (thread_sp); + } + } + } + else + { + const uint32_t num_threads = old_thread_list.GetSize(false); + for (uint32_t i=0; iGetObjectFile(); + + if (core_objfile) + { + const VMRangeToFileOffset::Entry *core_memory_entry = m_core_aranges.FindEntryThatContains (addr); + if (core_memory_entry) + { + const addr_t offset = addr - core_memory_entry->GetRangeBase(); + const addr_t bytes_left = core_memory_entry->GetRangeEnd() - addr; + size_t bytes_to_read = size; + if (bytes_to_read > bytes_left) + bytes_to_read = bytes_left; + return core_objfile->CopyData (core_memory_entry->data.GetRangeBase() + offset, bytes_to_read, buf); + } + else + { + error.SetErrorStringWithFormat ("core file does not contain 0x%llx", addr); + } + } + return 0; +} + +void +ProcessMachCore::Clear() +{ + m_thread_list.Clear(); +} + +void +ProcessMachCore::Initialize() +{ + static bool g_initialized = false; + + if (g_initialized == false) + { + g_initialized = true; + PluginManager::RegisterPlugin (GetPluginNameStatic(), + GetPluginDescriptionStatic(), + CreateInstance); + } +} + +addr_t +ProcessMachCore::GetImageInfoAddress() +{ + return m_shlib_addr; +} + + Added: lldb/trunk/source/Plugins/Process/mach-core/ProcessMachCore.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/mach-core/ProcessMachCore.h?rev=150154&view=auto ============================================================================== --- lldb/trunk/source/Plugins/Process/mach-core/ProcessMachCore.h (added) +++ lldb/trunk/source/Plugins/Process/mach-core/ProcessMachCore.h Thu Feb 9 00:16:32 2012 @@ -0,0 +1,147 @@ +//===-- ProcessMachCore.h ---------------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef liblldb_ProcessMachCore_h_ +#define liblldb_ProcessMachCore_h_ + +// C Includes + +// C++ Includes +#include +#include + +// Other libraries and framework includes +#include "lldb/Core/ArchSpec.h" +#include "lldb/Core/Broadcaster.h" +#include "lldb/Core/Error.h" +#include "lldb/Core/InputReader.h" +#include "lldb/Core/StreamString.h" +#include "lldb/Core/StringList.h" +#include "lldb/Core/ThreadSafeValue.h" +#include "lldb/Target/Process.h" +#include "lldb/Target/Thread.h" + +#include "CommunicationKDP.h" +#include "Utility/StringExtractor.h" + +class ThreadKDP; + +class ProcessMachCore : public lldb_private::Process +{ +public: + //------------------------------------------------------------------ + // Constructors and Destructors + //------------------------------------------------------------------ + static lldb::ProcessSP + CreateInstance (lldb_private::Target& target, + lldb_private::Listener &listener, + const lldb_private::FileSpec *crash_file_path); + + static void + Initialize(); + + static void + Terminate(); + + static const char * + GetPluginNameStatic(); + + static const char * + GetPluginDescriptionStatic(); + + //------------------------------------------------------------------ + // Constructors and Destructors + //------------------------------------------------------------------ + ProcessMachCore(lldb_private::Target& target, + lldb_private::Listener &listener, + const lldb_private::FileSpec &core_file); + + virtual + ~ProcessMachCore(); + + //------------------------------------------------------------------ + // Check if a given Process + //------------------------------------------------------------------ + virtual bool + CanDebug (lldb_private::Target &target, + bool plugin_specified_by_name); + + //------------------------------------------------------------------ + // Creating a new process, or attaching to an existing one + //------------------------------------------------------------------ + virtual lldb_private::Error + DoLoadCore (); + + //------------------------------------------------------------------ + // PluginInterface protocol + //------------------------------------------------------------------ + virtual const char * + GetPluginName(); + + virtual const char * + GetShortPluginName(); + + virtual uint32_t + GetPluginVersion(); + + //------------------------------------------------------------------ + // Process Control + //------------------------------------------------------------------ + virtual lldb_private::Error + DoDestroy (); + + virtual void + RefreshStateAfterStop(); + + //------------------------------------------------------------------ + // Process Queries + //------------------------------------------------------------------ + virtual bool + IsAlive (); + + //------------------------------------------------------------------ + // Process Memory + //------------------------------------------------------------------ + virtual size_t + DoReadMemory (lldb::addr_t addr, void *buf, size_t size, lldb_private::Error &error); + + virtual lldb::addr_t + GetImageInfoAddress (); + +protected: + friend class ThreadMachCore; + + void + Clear ( ); + + uint32_t + UpdateThreadList (lldb_private::ThreadList &old_thread_list, + lldb_private::ThreadList &new_thread_list); + + lldb_private::ObjectFile * + GetCoreObjectFile () + { + return m_core_module_sp->GetObjectFile(); + } +private: + //------------------------------------------------------------------ + // For ProcessMachCore only + //------------------------------------------------------------------ + typedef lldb_private::Range FileRange; + typedef lldb_private::RangeDataArray VMRangeToFileOffset; + + VMRangeToFileOffset m_core_aranges; + lldb::ModuleSP m_core_module_sp; + lldb_private::FileSpec m_core_file; + lldb::addr_t m_shlib_addr; + DISALLOW_COPY_AND_ASSIGN (ProcessMachCore); + +}; + +#endif // liblldb_ProcessMachCore_h_ Added: lldb/trunk/source/Plugins/Process/mach-core/ThreadMachCore.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/mach-core/ThreadMachCore.cpp?rev=150154&view=auto ============================================================================== --- lldb/trunk/source/Plugins/Process/mach-core/ThreadMachCore.cpp (added) +++ lldb/trunk/source/Plugins/Process/mach-core/ThreadMachCore.cpp Thu Feb 9 00:16:32 2012 @@ -0,0 +1,145 @@ +//===-- ThreadMachCore.cpp --------------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + + +#include "ThreadMachCore.h" + +#include "llvm/Support/MachO.h" + +#include "lldb/Core/ArchSpec.h" +#include "lldb/Core/DataExtractor.h" +#include "lldb/Core/StreamString.h" +#include "lldb/Core/State.h" +#include "lldb/Target/Process.h" +#include "lldb/Target/RegisterContext.h" +#include "lldb/Target/StopInfo.h" +#include "lldb/Target/Target.h" +#include "lldb/Target/Unwind.h" +#include "lldb/Breakpoint/Watchpoint.h" + +#include "ProcessMachCore.h" +//#include "RegisterContextKDP_arm.h" +//#include "RegisterContextKDP_i386.h" +//#include "RegisterContextKDP_x86_64.h" + +using namespace lldb; +using namespace lldb_private; + +//---------------------------------------------------------------------- +// Thread Registers +//---------------------------------------------------------------------- + +ThreadMachCore::ThreadMachCore (ProcessMachCore &process, lldb::tid_t tid) : + Thread(process, tid), + m_thread_name (), + m_dispatch_queue_name (), + m_thread_dispatch_qaddr (LLDB_INVALID_ADDRESS) +{ +} + +ThreadMachCore::~ThreadMachCore () +{ + DestroyThread(); +} + +const char * +ThreadMachCore::GetName () +{ + if (m_thread_name.empty()) + return NULL; + return m_thread_name.c_str(); +} + +void +ThreadMachCore::RefreshStateAfterStop() +{ + // Invalidate all registers in our register context. We don't set "force" to + // true because the stop reply packet might have had some register values + // that were expedited and these will already be copied into the register + // context by the time this function gets called. The KDPRegisterContext + // class has been made smart enough to detect when it needs to invalidate + // which registers are valid by putting hooks in the register read and + // register supply functions where they check the process stop ID and do + // the right thing. + const bool force = false; + GetRegisterContext()->InvalidateIfNeeded (force); +} + +void +ThreadMachCore::ClearStackFrames () +{ + Unwind *unwinder = GetUnwinder (); + if (unwinder) + unwinder->Clear(); + Thread::ClearStackFrames(); +} + + +bool +ThreadMachCore::ThreadIDIsValid (lldb::tid_t thread) +{ + return thread != 0; +} + +lldb::RegisterContextSP +ThreadMachCore::GetRegisterContext () +{ + if (m_reg_context_sp.get() == NULL) + m_reg_context_sp = CreateRegisterContextForFrame (NULL); + return m_reg_context_sp; +} + +lldb::RegisterContextSP +ThreadMachCore::CreateRegisterContextForFrame (StackFrame *frame) +{ + lldb::RegisterContextSP reg_ctx_sp; + uint32_t concrete_frame_idx = 0; + + if (frame) + concrete_frame_idx = frame->GetConcreteFrameIndex (); + + if (concrete_frame_idx == 0) + { + ObjectFile *core_objfile = GetMachCoreProcess ().GetCoreObjectFile (); + if (core_objfile) + reg_ctx_sp = core_objfile->GetThreadContextAtIndex (GetID(), *this); + } + else if (m_unwinder_ap.get()) + reg_ctx_sp = m_unwinder_ap->CreateRegisterContextForFrame (frame); + return reg_ctx_sp; +} + +lldb::StopInfoSP +ThreadMachCore::GetPrivateStopReason () +{ + const uint32_t process_stop_id = GetProcess().GetStopID(); + if (m_thread_stop_reason_stop_id != process_stop_id || + (m_actual_stop_info_sp && !m_actual_stop_info_sp->IsValid())) + { + // TODO: can we query the initial state of the thread here? + // For now I am just going to pretend that a SIGSTOP happened. + + SetStopInfo(StopInfo::CreateStopReasonWithSignal (*this, SIGSTOP)); + + // If GetKDPProcess().SetThreadStopInfo() doesn't find a stop reason + // for this thread, then m_actual_stop_info_sp will not ever contain + // a valid stop reason and the "m_actual_stop_info_sp->IsValid() == false" + // check will never be able to tell us if we have the correct stop info + // for this thread and we will continually send qThreadStopInfo packets + // down to the remote KDP server, so we need to keep our own notion + // of the stop ID that m_actual_stop_info_sp is valid for (even if it + // contains nothing). We use m_thread_stop_reason_stop_id for this below. +// m_thread_stop_reason_stop_id = process_stop_id; +// m_actual_stop_info_sp.reset(); + + } + return m_actual_stop_info_sp; +} + + Added: lldb/trunk/source/Plugins/Process/mach-core/ThreadMachCore.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/mach-core/ThreadMachCore.h?rev=150154&view=auto ============================================================================== --- lldb/trunk/source/Plugins/Process/mach-core/ThreadMachCore.h (added) +++ lldb/trunk/source/Plugins/Process/mach-core/ThreadMachCore.h Thu Feb 9 00:16:32 2012 @@ -0,0 +1,98 @@ +//===-- ThreadMachCore.h ----------------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef liblldb_ThreadMachCore_h_ +#define liblldb_ThreadMachCore_h_ + +#include + +#include "lldb/Target/Process.h" +#include "lldb/Target/Thread.h" + +class ProcessMachCore; + +class ThreadMachCore : public lldb_private::Thread +{ +public: + ThreadMachCore (ProcessMachCore &process, + lldb::tid_t tid); + + virtual + ~ThreadMachCore (); + + virtual void + RefreshStateAfterStop(); + + virtual const char * + GetName (); + + virtual lldb::RegisterContextSP + GetRegisterContext (); + + virtual lldb::RegisterContextSP + CreateRegisterContextForFrame (lldb_private::StackFrame *frame); + + virtual void + ClearStackFrames (); + + ProcessMachCore & + GetMachCoreProcess () + { + return (ProcessMachCore &)m_process; + } + + static bool + ThreadIDIsValid (lldb::tid_t thread); + + bool + ShouldStop (bool &step_more); + + const char * + GetBasicInfoAsString (); + + void + SetName (const char *name) + { + if (name && name[0]) + m_thread_name.assign (name); + else + m_thread_name.clear(); + } + + lldb::addr_t + GetThreadDispatchQAddr () + { + return m_thread_dispatch_qaddr; + } + + void + SetThreadDispatchQAddr (lldb::addr_t thread_dispatch_qaddr) + { + m_thread_dispatch_qaddr = thread_dispatch_qaddr; + } + +protected: + + friend class ProcessMachCore; + + //------------------------------------------------------------------ + // Member variables. + //------------------------------------------------------------------ + std::string m_thread_name; + std::string m_dispatch_queue_name; + lldb::addr_t m_thread_dispatch_qaddr; + //------------------------------------------------------------------ + // Member variables. + //------------------------------------------------------------------ + + virtual lldb::StopInfoSP + GetPrivateStopReason (); +}; + +#endif // liblldb_ThreadMachCore_h_ Modified: lldb/trunk/source/Symbol/ObjectFile.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ObjectFile.cpp?rev=150154&r1=150153&r2=150154&view=diff ============================================================================== --- lldb/trunk/source/Symbol/ObjectFile.cpp (original) +++ lldb/trunk/source/Symbol/ObjectFile.cpp Thu Feb 9 00:16:32 2012 @@ -156,7 +156,7 @@ m_data (), m_unwind_table (*this), m_process_wp(), - m_in_memory (false) + m_memory_addr (LLDB_INVALID_ADDRESS) { if (file_spec_ptr) m_file = *file_spec_ptr; @@ -202,7 +202,7 @@ m_data (), m_unwind_table (*this), m_process_wp (process_sp), - m_in_memory (true) + m_memory_addr (header_addr) { if (header_data_sp) m_data.SetData (header_data_sp, 0, header_data_sp->GetByteSize()); @@ -382,7 +382,7 @@ size_t ObjectFile::ReadSectionData (const Section *section, off_t section_offset, void *dst, size_t dst_len) const { - if (m_in_memory) + if (IsInMemory()) { ProcessSP process_sp (m_process_wp.lock()); if (process_sp) @@ -404,7 +404,7 @@ size_t ObjectFile::ReadSectionData (const Section *section, DataExtractor& section_data) const { - if (m_in_memory) + if (IsInMemory()) { ProcessSP process_sp (m_process_wp.lock()); if (process_sp) @@ -431,7 +431,7 @@ size_t ObjectFile::MemoryMapSectionData (const Section *section, DataExtractor& section_data) const { - if (m_in_memory) + if (IsInMemory()) { return ReadSectionData (section, section_data); } Modified: lldb/trunk/source/Target/Process.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=150154&r1=150153&r2=150154&view=diff ============================================================================== --- lldb/trunk/source/Target/Process.cpp (original) +++ lldb/trunk/source/Target/Process.cpp Thu Feb 9 00:16:32 2012 @@ -708,30 +708,39 @@ m_match_all_users = false; } -Process* -Process::FindPlugin (Target &target, const char *plugin_name, Listener &listener) +ProcessSP +Process::FindPlugin (Target &target, const char *plugin_name, Listener &listener, const FileSpec *crash_file_path) { + ProcessSP process_sp; ProcessCreateInstance create_callback = NULL; if (plugin_name) { create_callback = PluginManager::GetProcessCreateCallbackForPluginName (plugin_name); if (create_callback) { - std::auto_ptr debugger_ap(create_callback(target, listener)); - if (debugger_ap->CanDebug(target, true)) - return debugger_ap.release(); + process_sp = create_callback(target, listener, crash_file_path); + if (process_sp) + { + if (!process_sp->CanDebug(target, true)) + process_sp.reset(); + } } } else { for (uint32_t idx = 0; (create_callback = PluginManager::GetProcessCreateCallbackAtIndex(idx)) != NULL; ++idx) { - std::auto_ptr debugger_ap(create_callback(target, listener)); - if (debugger_ap->CanDebug(target, false)) - return debugger_ap.release(); + process_sp = create_callback(target, listener, crash_file_path); + if (process_sp) + { + if (!process_sp->CanDebug(target, false)) + process_sp.reset(); + else + break; + } } } - return NULL; + return process_sp; } @@ -2328,6 +2337,30 @@ return error; } + +Error +Process::LoadCore () +{ + Error error = DoLoadCore(); + if (error.Success()) + { + if (PrivateStateThreadIsValid ()) + ResumePrivateStateThread (); + else + StartPrivateStateThread (); + + CompleteAttach (); + // We successfully loaded a core file, now pretend we stopped so we can + // show all of the threads in the core file and explore the crashed + // state. + SetPrivateState (eStateStopped); + + } + return error; +} + + + Process::NextEventAction::EventActionResult Process::AttachCompletionHandler::PerformAction (lldb::EventSP &event_sp) { Modified: lldb/trunk/source/Target/Target.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Target.cpp?rev=150154&r1=150153&r2=150154&view=diff ============================================================================== --- lldb/trunk/source/Target/Target.cpp (original) +++ lldb/trunk/source/Target/Target.cpp Thu Feb 9 00:16:32 2012 @@ -136,10 +136,10 @@ } const lldb::ProcessSP & -Target::CreateProcess (Listener &listener, const char *plugin_name) +Target::CreateProcess (Listener &listener, const char *plugin_name, const FileSpec *crash_file) { DeleteCurrentProcess (); - m_process_sp.reset(Process::FindPlugin(*this, plugin_name, listener)); + m_process_sp = Process::FindPlugin(*this, plugin_name, listener, crash_file); return m_process_sp; } Modified: lldb/trunk/source/Target/ThreadList.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadList.cpp?rev=150154&r1=150153&r2=150154&view=diff ============================================================================== --- lldb/trunk/source/Target/ThreadList.cpp (original) +++ lldb/trunk/source/Target/ThreadList.cpp Thu Feb 9 00:16:32 2012 @@ -77,7 +77,7 @@ void -ThreadList::AddThread (ThreadSP &thread_sp) +ThreadList::AddThread (const ThreadSP &thread_sp) { Mutex::Locker locker(m_threads_mutex); m_threads.push_back(thread_sp); Modified: lldb/trunk/source/lldb.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/lldb.cpp?rev=150154&r1=150153&r2=150154&view=diff ============================================================================== --- lldb/trunk/source/lldb.cpp (original) +++ lldb/trunk/source/lldb.cpp Thu Feb 9 00:16:32 2012 @@ -51,6 +51,8 @@ #include "Plugins/Platform/MacOSX/PlatformRemoteiOS.h" #endif +#include "Plugins/Process/mach-core/ProcessMachCore.h" + #if defined (__linux__) #include "Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h" #include "Plugins/Platform/Linux/PlatformLinux.h" @@ -113,6 +115,7 @@ ObjectFileMachO::Initialize(); ProcessKDP::Initialize(); ProcessGDBRemote::Initialize(); + ProcessMachCore::Initialize(); SymbolVendorMacOSX::Initialize(); PlatformMacOSX::Initialize(); PlatformRemoteiOS::Initialize(); @@ -183,6 +186,7 @@ AppleObjCRuntimeV1::Terminate(); ObjectContainerUniversalMachO::Terminate(); ObjectFileMachO::Terminate(); + ProcessMachCore::Terminate(); ProcessKDP::Terminate(); ProcessGDBRemote::Terminate(); SymbolVendorMacOSX::Terminate(); From johnny.chen at apple.com Thu Feb 9 12:44:27 2012 From: johnny.chen at apple.com (Johnny Chen) Date: Thu, 09 Feb 2012 18:44:27 -0000 Subject: [Lldb-commits] [lldb] r150195 - in /lldb/trunk: source/Commands/CommandObjectWatchpoint.cpp test/functionalities/watchpoint/watchpoint_set_command/TestWatchpointSetErrorCases.py Message-ID: <20120209184427.80FFD2A6C12D@llvm.org> Author: johnny Date: Thu Feb 9 12:44:27 2012 New Revision: 150195 URL: http://llvm.org/viewvc/llvm-project?rev=150195&view=rev Log: Add error handling for missing option terminator "--" and a test scenario for it. Also fix a logic error for a missing return stmt. Oops. Modified: lldb/trunk/source/Commands/CommandObjectWatchpoint.cpp lldb/trunk/test/functionalities/watchpoint/watchpoint_set_command/TestWatchpointSetErrorCases.py Modified: lldb/trunk/source/Commands/CommandObjectWatchpoint.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectWatchpoint.cpp?rev=150195&r1=150194&r2=150195&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectWatchpoint.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectWatchpoint.cpp Thu Feb 9 12:44:27 2012 @@ -1129,11 +1129,11 @@ return false; } - bool no_dash_w = !m_option_watchpoint.watch_type_specified; - bool no_dash_x = (m_option_watchpoint.watch_size == 0); + bool with_dash_w = m_option_watchpoint.watch_type_specified; + bool with_dash_x = (m_option_watchpoint.watch_size != 0); // If no '-w' is specified, default to '-w read_write'. - if (no_dash_w) + if (!with_dash_w) { m_option_watchpoint.watch_type = OptionGroupWatchpoint::eWatchReadWrite; } @@ -1149,7 +1149,15 @@ // We will process the raw command string to rid of the '-w', '-x', or '--' llvm::StringRef raw_expr_str(raw_command); - std::string expr_str = StripOptionTerminator(raw_expr_str, !no_dash_w, !no_dash_x).str(); + std::string expr_str = StripOptionTerminator(raw_expr_str, with_dash_w, with_dash_x).str(); + + // Sanity check for when the user forgets to terminate the option strings with a '--'. + if ((with_dash_w || with_dash_w) && expr_str.empty()) + { + result.GetErrorStream().Printf("error: did you forget to enter the option terminator string \"--\"?\n"); + result.SetStatus(eReturnStatusFailed); + return false; + } // Use expression evaluation to arrive at the address to watch. const bool coerce_to_id = true; @@ -1167,6 +1175,7 @@ result.GetErrorStream().Printf("error: expression evaluation of address to watch failed\n"); result.GetErrorStream().Printf("expression evaluated: %s\n", expr_str.c_str()); result.SetStatus(eReturnStatusFailed); + return false; } // Get the address to watch. @@ -1176,8 +1185,8 @@ result.SetStatus(eReturnStatusFailed); return false; } - size = no_dash_x ? target->GetArchitecture().GetAddressByteSize() - : m_option_watchpoint.watch_size; + size = with_dash_x ? m_option_watchpoint.watch_size + : target->GetArchitecture().GetAddressByteSize(); // Now it's time to create the watchpoint. uint32_t watch_type = m_option_watchpoint.watch_type; Modified: lldb/trunk/test/functionalities/watchpoint/watchpoint_set_command/TestWatchpointSetErrorCases.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/watchpoint/watchpoint_set_command/TestWatchpointSetErrorCases.py?rev=150195&r1=150194&r2=150195&view=diff ============================================================================== --- lldb/trunk/test/functionalities/watchpoint/watchpoint_set_command/TestWatchpointSetErrorCases.py (original) +++ lldb/trunk/test/functionalities/watchpoint/watchpoint_set_command/TestWatchpointSetErrorCases.py Thu Feb 9 12:44:27 2012 @@ -61,6 +61,10 @@ self.expect("watchpoint set expression -w write --", error=True, startstr = 'error: required argument missing; specify an expression to evaulate into the addres to watch for') + # Check for missing option terminator '--'. + self.expect("watchpoint set expression -w write -x 1 g_char_ptr", error=True, + startstr = 'error: did you forget to enter the option terminator string "--"?') + # Wrong size parameter is an error. self.expect("watchpoint set variable -x -128", error=True, substrs = ['invalid enumeration value']) From johnny.chen at apple.com Thu Feb 9 13:34:26 2012 From: johnny.chen at apple.com (Johnny Chen) Date: Thu, 09 Feb 2012 19:34:26 -0000 Subject: [Lldb-commits] [lldb] r150198 - /lldb/trunk/test/terminal/TestSTTYBeforeAndAfter.py Message-ID: <20120209193426.130A12A6C12D@llvm.org> Author: johnny Date: Thu Feb 9 13:34:25 2012 New Revision: 150198 URL: http://llvm.org/viewvc/llvm-project?rev=150198&view=rev Log: Setting terminal type to 'xterm' on Darwin; otherwise, to 'vt100'. Modified: lldb/trunk/test/terminal/TestSTTYBeforeAndAfter.py Modified: lldb/trunk/test/terminal/TestSTTYBeforeAndAfter.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/terminal/TestSTTYBeforeAndAfter.py?rev=150198&r1=150197&r2=150198&view=diff ============================================================================== --- lldb/trunk/test/terminal/TestSTTYBeforeAndAfter.py (original) +++ lldb/trunk/test/terminal/TestSTTYBeforeAndAfter.py Thu Feb 9 13:34:25 2012 @@ -40,7 +40,10 @@ if self.TraceOn(): child.logfile = sys.stdout - child.sendline('set env(TERM) xterm') + if sys.platform.startswith("darwin"): + child.sendline('set env(TERM) xterm') + else: + child.sendline('set env(TERM) vt100') child.expect(expect_prompt) child.sendline('puts $env(TERM)') child.expect(expect_prompt) From johnso87 at crhc.illinois.edu Thu Feb 9 13:43:16 2012 From: johnso87 at crhc.illinois.edu (Matt Johnson) Date: Thu, 9 Feb 2012 13:43:16 -0600 Subject: [Lldb-commits] CommunicationKDP.h not checked in? Message-ID: <4F3421D4.5030208@crhc.illinois.edu> Hi all, Was CommunicationKDP.h supposed to be included in r150154? ToT build is broken by the include in ProcessMachCore.h. Thanks! -Matt From gclayton at apple.com Thu Feb 9 14:03:50 2012 From: gclayton at apple.com (Greg Clayton) Date: Thu, 09 Feb 2012 20:03:50 -0000 Subject: [Lldb-commits] [lldb] r150203 - /lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Message-ID: <20120209200350.1E6A92A6C12D@llvm.org> Author: gclayton Date: Thu Feb 9 14:03:49 2012 New Revision: 150203 URL: http://llvm.org/viewvc/llvm-project?rev=150203&view=rev Log: Added a logging helper class for SymbolFileDWARF::ParseType() that will enable us to track the depth of parsing and what is being parsed. This helps when trying to track down difficult type parsing issues and is only enabled in non-production builds. Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp 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=150203&r1=150202&r2=150203&view=diff ============================================================================== --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original) +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Thu Feb 9 14:03:49 2012 @@ -109,6 +109,86 @@ return eAccessNone; } +#if defined(LLDB_CONFIGURATION_DEBUG) or defined(LLDB_CONFIGURATION_RELEASE) + +class DIEStack +{ +public: + + void Push (DWARFCompileUnit *cu, const DWARFDebugInfoEntry *die) + { + m_dies.push_back (DIEInfo(cu, die)); + } + + + void LogDIEs (Log *log, SymbolFileDWARF *dwarf) + { + StreamString log_strm; + const size_t n = m_dies.size(); + log_strm.Printf("DIEStack[%zu]:\n", n); + for (size_t i=0; iGetQualifiedName(dwarf, cu, qualified_name); + log_strm.Printf ("[%zu] 0x%8.8x: %s name='%s'\n", + i, + die->GetOffset(), + DW_TAG_value_to_name(die->Tag()), + qualified_name.c_str()); + } + log->PutCString(log_strm.GetData()); + } + void Pop () + { + m_dies.pop_back(); + } + + class ScopedPopper + { + public: + ScopedPopper (DIEStack &die_stack) : + m_die_stack (die_stack), + m_valid (false) + { + } + + void + Push (DWARFCompileUnit *cu, const DWARFDebugInfoEntry *die) + { + m_valid = true; + m_die_stack.Push (cu, die); + } + + ~ScopedPopper () + { + if (m_valid) + m_die_stack.Pop(); + } + + + + protected: + DIEStack &m_die_stack; + bool m_valid; + }; + +protected: + struct DIEInfo { + DIEInfo (DWARFCompileUnit *c, const DWARFDebugInfoEntry *d) : + cu(c), + die(d) + { + } + DWARFCompileUnit *cu; + const DWARFDebugInfoEntry *die; + }; + typedef std::vector Stack; + Stack m_dies; +}; +#endif + void SymbolFileDWARF::Initialize() { @@ -4349,15 +4429,11 @@ if (type_is_new_ptr) *type_is_new_ptr = false; - - static int depth = -1; - - class DepthTaker { - public: - DepthTaker (int &depth) : m_depth(depth) { ++m_depth; } - ~DepthTaker () { --m_depth; } - int &m_depth; - } depth_taker(depth); + +#if defined(LLDB_CONFIGURATION_DEBUG) or defined(LLDB_CONFIGURATION_RELEASE) + static DIEStack g_die_stack; + DIEStack::ScopedPopper scoped_die_logger(g_die_stack); +#endif AccessType accessibility = eAccessNone; if (die != NULL) @@ -4368,20 +4444,17 @@ const DWARFDebugInfoEntry *context_die; clang::DeclContext *context = GetClangDeclContextContainingDIE (dwarf_cu, die, &context_die); - std::string name_storage; - - const char* qual_name = die->GetQualifiedName(this, - dwarf_cu, - name_storage); - - GetObjectFile()->GetModule()->LogMessage (log.get(), "SymbolFileDWARF::ParseType (depth = %d, die = 0x%8.8x, decl_ctx = %p (die 0x%8.8x)) %s '%s'='%s')", - depth, + GetObjectFile()->GetModule()->LogMessage (log.get(), "SymbolFileDWARF::ParseType (die = 0x%8.8x, decl_ctx = %p (die 0x%8.8x)) %s name = '%s')", die->GetOffset(), context, context_die->GetOffset(), DW_TAG_value_to_name(die->Tag()), - die->GetName(this, dwarf_cu), - qual_name); + die->GetName(this, dwarf_cu)); + +#if defined(LLDB_CONFIGURATION_DEBUG) or defined(LLDB_CONFIGURATION_RELEASE) + scoped_die_logger.Push (dwarf_cu, die); + g_die_stack.LogDIEs(log.get(), this); +#endif } // // LogSP log (LogChannelDWARF::GetLogIfAll(DWARF_LOG_DEBUG_INFO)); From johnny.chen at apple.com Thu Feb 9 14:29:11 2012 From: johnny.chen at apple.com (Johnny Chen) Date: Thu, 09 Feb 2012 20:29:11 -0000 Subject: [Lldb-commits] [lldb] r150205 - in /lldb/trunk/test/lang/cpp/dynamic-value: TestCppValueCast.py sbvalue-cast.cpp Message-ID: <20120209202911.927232A6C12D@llvm.org> Author: johnny Date: Thu Feb 9 14:29:11 2012 New Revision: 150205 URL: http://llvm.org/viewvc/llvm-project?rev=150205&view=rev Log: Fix compile time warnings for the inferior program. Modified: lldb/trunk/test/lang/cpp/dynamic-value/TestCppValueCast.py lldb/trunk/test/lang/cpp/dynamic-value/sbvalue-cast.cpp Modified: lldb/trunk/test/lang/cpp/dynamic-value/TestCppValueCast.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/cpp/dynamic-value/TestCppValueCast.py?rev=150205&r1=150204&r2=150205&view=diff ============================================================================== --- lldb/trunk/test/lang/cpp/dynamic-value/TestCppValueCast.py (original) +++ lldb/trunk/test/lang/cpp/dynamic-value/TestCppValueCast.py Thu Feb 9 14:29:11 2012 @@ -54,7 +54,7 @@ self.source = 'sbvalue-cast.cpp'; self.line = line_number(self.source, '// Set breakpoint here.') self.exe_name = self.testMethodName - self.d_virtual = {'CXX_SOURCES': self.source, 'EXE': self.exe_name, 'CFLAGS_EXTRAS': '-DVIRTUAL=YES'} + self.d_virtual = {'CXX_SOURCES': self.source, 'EXE': self.exe_name, 'CFLAGS_EXTRAS': '-DDO_VIRTUAL_VIRTUAL'} self.d_regular = {'CXX_SOURCES': self.source, 'EXE': self.exe_name} def do_sbvalue_cast (self, exe_name): Modified: lldb/trunk/test/lang/cpp/dynamic-value/sbvalue-cast.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/cpp/dynamic-value/sbvalue-cast.cpp?rev=150205&r1=150204&r2=150205&view=diff ============================================================================== --- lldb/trunk/test/lang/cpp/dynamic-value/sbvalue-cast.cpp (original) +++ lldb/trunk/test/lang/cpp/dynamic-value/sbvalue-cast.cpp Thu Feb 9 14:29:11 2012 @@ -6,7 +6,7 @@ // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// -#ifdef VIRTUAL +#ifdef DO_VIRTUAL_INHERITANCE #define VIRTUAL virtual #else #define VIRTUAL From scallanan at apple.com Thu Feb 9 16:54:11 2012 From: scallanan at apple.com (Sean Callanan) Date: Thu, 09 Feb 2012 22:54:11 -0000 Subject: [Lldb-commits] [lldb] r150211 - /lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Message-ID: <20120209225411.5D4A22A6C12D@llvm.org> Author: spyffe Date: Thu Feb 9 16:54:11 2012 New Revision: 150211 URL: http://llvm.org/viewvc/llvm-project?rev=150211&view=rev Log: Caching the DIE for the DeclContext as reported by GetClangDeclContextContainingDIE, for better debuggability. Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp 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=150211&r1=150210&r2=150211&view=diff ============================================================================== --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original) +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Thu Feb 9 16:54:11 2012 @@ -4887,7 +4887,9 @@ clang_type = m_forward_decl_die_to_clang_type.lookup (die); if (clang_type == NULL) { - clang::DeclContext *decl_ctx = GetClangDeclContextContainingDIE (dwarf_cu, die, NULL); + const DWARFDebugInfoEntry *decl_ctx_die; + + clang::DeclContext *decl_ctx = GetClangDeclContextContainingDIE (dwarf_cu, die, &decl_ctx_die); if (accessibility == eAccessNone && decl_ctx) { // Check the decl context that contains this class/struct/union. From granata.enrico at gmail.com Thu Feb 9 18:10:27 2012 From: granata.enrico at gmail.com (Enrico Granata) Date: Fri, 10 Feb 2012 00:10:27 -0000 Subject: [Lldb-commits] [lldb] r150213 - in /lldb/trunk/test/lang/cpp/dynamic-value: TestCppValueCast.py sbvalue-cast.cpp Message-ID: <20120210001027.9F0FC2A6C12D@llvm.org> Author: enrico Date: Thu Feb 9 18:10:27 2012 New Revision: 150213 URL: http://llvm.org/viewvc/llvm-project?rev=150213&view=rev Log: fixing a macro name mismatch that was making our test case succeed for the wrong reason; plus a minor code change to the CPP side of the test which eases debugging efforts Modified: lldb/trunk/test/lang/cpp/dynamic-value/TestCppValueCast.py lldb/trunk/test/lang/cpp/dynamic-value/sbvalue-cast.cpp Modified: lldb/trunk/test/lang/cpp/dynamic-value/TestCppValueCast.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/cpp/dynamic-value/TestCppValueCast.py?rev=150213&r1=150212&r2=150213&view=diff ============================================================================== --- lldb/trunk/test/lang/cpp/dynamic-value/TestCppValueCast.py (original) +++ lldb/trunk/test/lang/cpp/dynamic-value/TestCppValueCast.py Thu Feb 9 18:10:27 2012 @@ -54,7 +54,7 @@ self.source = 'sbvalue-cast.cpp'; self.line = line_number(self.source, '// Set breakpoint here.') self.exe_name = self.testMethodName - self.d_virtual = {'CXX_SOURCES': self.source, 'EXE': self.exe_name, 'CFLAGS_EXTRAS': '-DDO_VIRTUAL_VIRTUAL'} + self.d_virtual = {'CXX_SOURCES': self.source, 'EXE': self.exe_name, 'CFLAGS_EXTRAS': '-DDO_VIRTUAL_INHERITANCE'} self.d_regular = {'CXX_SOURCES': self.source, 'EXE': self.exe_name} def do_sbvalue_cast (self, exe_name): Modified: lldb/trunk/test/lang/cpp/dynamic-value/sbvalue-cast.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/cpp/dynamic-value/sbvalue-cast.cpp?rev=150213&r1=150212&r2=150213&view=diff ============================================================================== --- lldb/trunk/test/lang/cpp/dynamic-value/sbvalue-cast.cpp (original) +++ lldb/trunk/test/lang/cpp/dynamic-value/sbvalue-cast.cpp Thu Feb 9 18:10:27 2012 @@ -67,7 +67,9 @@ int main(int argc, char **argv) { - Base *array[2] = {new DerivedA(10), new DerivedB(12)}; + DerivedA* dA = new DerivedA(10); + DerivedB* dB = new DerivedB(12); + Base *array[2] = {dA, dB}; Base *teller = NULL; for (int i = 0; i < 2; ++i) { teller = array[i]; From scallanan at apple.com Thu Feb 9 19:22:05 2012 From: scallanan at apple.com (Sean Callanan) Date: Fri, 10 Feb 2012 01:22:05 -0000 Subject: [Lldb-commits] [lldb] r150217 - in /lldb/trunk: include/lldb/Expression/ClangExpressionDeclMap.h include/lldb/Expression/ClangUserExpression.h source/Expression/ClangExpressionDeclMap.cpp source/Expression/ClangUserExpression.cpp Message-ID: <20120210012205.EAF111BE003@llvm.org> Author: spyffe Date: Thu Feb 9 19:22:05 2012 New Revision: 150217 URL: http://llvm.org/viewvc/llvm-project?rev=150217&view=rev Log: Fixed a bunch of ownership problems with the expression parser. Specifically: - ClangUserExpression now keeps weak pointers to the structures it needs and then locks them when needed. This ensures that they continue to be valid without leaking memory if the ClangUserExpression is long lived. - ClangExpressionDeclMap, instead of keeping a pointer to an ExecutionContext, now contains an ExecutionContext. This prevents bugs if the pointer or its contents somehow become stale. It also no longer requires that ExecutionContexts be passed into any function except its initialization function, since it can count on the ExecutionContext still being around. There's a lot of room for improvement (specifically, ClangExpressionDeclMap should also use weak pointers insetad of shared pointers) but this is an important first step that codifies assumptions that already existed in the code. Modified: lldb/trunk/include/lldb/Expression/ClangExpressionDeclMap.h lldb/trunk/include/lldb/Expression/ClangUserExpression.h lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp lldb/trunk/source/Expression/ClangUserExpression.cpp Modified: lldb/trunk/include/lldb/Expression/ClangExpressionDeclMap.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/ClangExpressionDeclMap.h?rev=150217&r1=150216&r2=150217&view=diff ============================================================================== --- lldb/trunk/include/lldb/Expression/ClangExpressionDeclMap.h (original) +++ lldb/trunk/include/lldb/Expression/ClangExpressionDeclMap.h Thu Feb 9 19:22:05 2012 @@ -512,9 +512,6 @@ /// at a given address, which should be aligned as specified by /// GetStructInfo(). /// - /// @param[in] exe_ctx - /// The execution context at which to dump the struct. - /// /// @param[in] struct_address /// The address at which the struct should be written. /// @@ -526,8 +523,7 @@ /// True on success; false otherwise. //------------------------------------------------------------------ bool - Materialize (ExecutionContext &exe_ctx, - lldb::addr_t &struct_address, + Materialize (lldb::addr_t &struct_address, Error &error); //------------------------------------------------------------------ @@ -541,9 +537,6 @@ /// The name of the object pointer -- "this," "self," or similar /// depending on language /// - /// @param[in] exe_ctx - /// The execution context at which to dump the struct. - /// /// @param[in] error /// An Error to populate with any messages related to /// finding the "this" pointer. @@ -557,7 +550,6 @@ bool GetObjectPointer (lldb::addr_t &object_ptr, ConstString &object_name, - ExecutionContext &exe_ctx, Error &error, bool suppress_type_check = false); @@ -580,8 +572,7 @@ /// True on success; false otherwise. //------------------------------------------------------------------ bool - DumpMaterializedStruct (ExecutionContext &exe_ctx, - Stream &s, + DumpMaterializedStruct (Stream &s, Error &error); //------------------------------------------------------------------ @@ -608,8 +599,7 @@ /// True on success; false otherwise. //------------------------------------------------------------------ bool - Dematerialize (ExecutionContext &exe_ctx, - lldb::ClangExpressionVariableSP &result_sp, + Dematerialize (lldb::ClangExpressionVariableSP &result_sp, lldb::addr_t stack_frame_top, lldb::addr_t stack_frame_bottom, Error &error); @@ -670,7 +660,7 @@ { public: ParserVars(ClangExpressionDeclMap &decl_map) : - m_exe_ctx(NULL), + m_exe_ctx(), m_sym_ctx(), m_persistent_vars(NULL), m_enable_lookups(false), @@ -681,14 +671,14 @@ Target * GetTarget() { - if (m_exe_ctx && m_exe_ctx->GetTargetPtr()) - return m_exe_ctx->GetTargetPtr(); + if (m_exe_ctx.GetTargetPtr()) + return m_exe_ctx.GetTargetPtr(); else if (m_sym_ctx.target_sp) m_sym_ctx.target_sp.get(); return NULL; } - ExecutionContext *m_exe_ctx; ///< The execution context to use when parsing. + ExecutionContext m_exe_ctx; ///< The execution context to use when parsing. SymbolContext m_sym_ctx; ///< The symbol context to use in finding variables and types. ClangPersistentVariables *m_persistent_vars; ///< The persistent variables for the process. bool m_enable_lookups; ///< Set to true during parsing if we have found the first "$__lldb" name. @@ -874,9 +864,6 @@ /// Get the value of a variable in a given execution context and return /// the associated Types if needed. /// - /// @param[in] exe_ctx - /// The execution context to look for the variable in. - /// /// @param[in] var /// The variable to evaluate. /// @@ -900,8 +887,7 @@ /// The LLDB Value for the variable. //------------------------------------------------------------------ Value * - GetVariableValue (ExecutionContext &exe_ctx, - lldb::VariableSP &var, + GetVariableValue (lldb::VariableSP &var, clang::ASTContext *parser_ast_context, TypeFromUser *found_type = NULL, TypeFromParser *parser_type = NULL); @@ -1026,9 +1012,6 @@ /// True if the struct is to be dematerialized; false if it is to /// be materialized. /// - /// @param[in] exe_ctx - /// The execution context to use. - /// /// @param[in] stack_frame_top, stack_frame_bottom /// If not LLDB_INVALID_ADDRESS, the bounds for the stack frame /// in which the expression ran. A result whose address falls @@ -1049,7 +1032,6 @@ //------------------------------------------------------------------ bool DoMaterialize (bool dematerialize, - ExecutionContext &exe_ctx, lldb::addr_t stack_frame_top, lldb::addr_t stack_frame_bottom, lldb::ClangExpressionVariableSP *result_sp_ptr, @@ -1069,9 +1051,6 @@ /// True if the variable is to be dematerialized; false if it is to /// be materialized. /// - /// @param[in] exe_ctx - /// The execution context to use. - /// /// @param[in] var_sp /// The persistent variable to materialize /// @@ -1093,7 +1072,6 @@ //------------------------------------------------------------------ bool DoMaterializeOnePersistentVariable (bool dematerialize, - ExecutionContext &exe_ctx, lldb::ClangExpressionVariableSP &var_sp, lldb::addr_t addr, lldb::addr_t stack_frame_top, @@ -1108,9 +1086,6 @@ /// True if the variable is to be dematerialized; false if it is to /// be materialized. /// - /// @param[in] exe_ctx - /// The execution context to use. - /// /// @param[in] sym_ctx /// The symbol context to use (for looking the variable up). /// @@ -1132,7 +1107,6 @@ //------------------------------------------------------------------ bool DoMaterializeOneVariable (bool dematerialize, - ExecutionContext &exe_ctx, const SymbolContext &sym_ctx, lldb::ClangExpressionVariableSP &expr_var, lldb::addr_t addr, @@ -1146,9 +1120,6 @@ /// True if the variable is to be dematerialized; false if it is to /// be materialized. /// - /// @param[in] exe_ctx - /// The execution context to use. - /// /// @param[in] reg_ctx /// The register context to use. /// @@ -1167,7 +1138,6 @@ //------------------------------------------------------------------ bool DoMaterializeOneRegister (bool dematerialize, - ExecutionContext &exe_ctx, RegisterContext ®_ctx, const RegisterInfo ®_info, lldb::addr_t addr, Modified: lldb/trunk/include/lldb/Expression/ClangUserExpression.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/ClangUserExpression.h?rev=150217&r1=150216&r2=150217&view=diff ============================================================================== --- lldb/trunk/include/lldb/Expression/ClangUserExpression.h (original) +++ lldb/trunk/include/lldb/Expression/ClangUserExpression.h Thu Feb 9 19:22:05 2012 @@ -28,7 +28,7 @@ #include "lldb/Expression/IRForTarget.h" #include "lldb/Expression/ProcessDataAllocator.h" #include "lldb/Symbol/TaggedASTType.h" -#include "lldb/Target/Process.h" +#include "lldb/Target/ExecutionContext.h" #include "llvm/ExecutionEngine/JITMemoryManager.h" @@ -356,6 +356,36 @@ return m_evaluated_statically; } + void + InstallContext (ExecutionContext &exe_ctx) + { + m_process_wp = exe_ctx.GetProcessSP(); + m_target_wp = exe_ctx.GetTargetSP(); + m_frame_wp = exe_ctx.GetFrameSP(); + } + + bool + LockAndCheckContext (ExecutionContext &exe_ctx, + lldb::TargetSP &target_sp, + lldb::ProcessSP &process_sp, + lldb::StackFrameSP &frame_sp) + { + target_sp = m_target_wp.lock(); + process_sp = m_process_wp.lock(); + frame_sp = m_frame_wp.lock(); + + if ((target_sp && target_sp.get() != exe_ctx.GetTargetPtr()) || + (process_sp && process_sp.get() != exe_ctx.GetProcessPtr()) || + (frame_sp && frame_sp.get() != exe_ctx.GetFramePtr())) + return false; + + return true; + } + + lldb::TargetWP m_target_wp; ///< The target used as the context for the expression. + lldb::ProcessWP m_process_wp; ///< The process used as the context for the expression. + lldb::StackFrameWP m_frame_wp; ///< The stack frame used as context for the expression. + std::string m_expr_text; ///< The text of the expression, as typed by the user std::string m_expr_prefix; ///< The text of the translation-level definitions, as provided by the user lldb::LanguageType m_language; ///< The language to use when parsing (eLanguageTypeUnknown means use defaults) Modified: lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp?rev=150217&r1=150216&r2=150217&view=diff ============================================================================== --- lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp (original) +++ lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp Thu Feb 9 19:22:05 2012 @@ -75,7 +75,7 @@ ClangExpressionDeclMap::WillParse(ExecutionContext &exe_ctx) { EnableParserVars(); - m_parser_vars->m_exe_ctx = &exe_ctx; + m_parser_vars->m_exe_ctx = exe_ctx; Target *target = exe_ctx.GetTargetPtr(); if (exe_ctx.GetFramePtr()) @@ -146,26 +146,24 @@ TargetInfo ret; - ExecutionContext *exe_ctx = m_parser_vars->m_exe_ctx; - if (exe_ctx) + ExecutionContext &exe_ctx = m_parser_vars->m_exe_ctx; + + Process *process = exe_ctx.GetProcessPtr(); + if (process) { - Process *process = exe_ctx->GetProcessPtr(); - if (process) - { - ret.byte_order = process->GetByteOrder(); - ret.address_byte_size = process->GetAddressByteSize(); - } - else + ret.byte_order = process->GetByteOrder(); + ret.address_byte_size = process->GetAddressByteSize(); + } + else + { + Target *target = exe_ctx.GetTargetPtr(); + if (target) { - Target *target = exe_ctx->GetTargetPtr(); - if (target) - { - ret.byte_order = target->GetArchitecture().GetByteOrder(); - ret.address_byte_size = target->GetArchitecture().GetAddressByteSize(); - } + ret.byte_order = target->GetArchitecture().GetByteOrder(); + ret.address_byte_size = target->GetArchitecture().GetAddressByteSize(); } } - + return ret; } @@ -190,10 +188,12 @@ { assert (m_parser_vars.get()); - ExecutionContext *exe_ctx = m_parser_vars->m_exe_ctx; - if (exe_ctx == NULL) - return lldb::ClangExpressionVariableSP(); - Target *target = exe_ctx->GetTargetPtr(); + ExecutionContext &exe_ctx = m_parser_vars->m_exe_ctx; + + Target *target = exe_ctx.GetTargetPtr(); + + if (!target) + return ClangExpressionVariableSP(); ASTContext *context(target->GetScratchClangASTContext()->getASTContext()); @@ -212,7 +212,7 @@ return lldb::ClangExpressionVariableSP(); } - if (!m_parser_vars->m_persistent_vars->CreatePersistentVariable (exe_ctx->GetBestExecutionContextScope (), + if (!m_parser_vars->m_persistent_vars->CreatePersistentVariable (exe_ctx.GetBestExecutionContextScope (), name, user_type, m_parser_vars->m_target_info.byte_order, @@ -279,10 +279,8 @@ lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS)); - ExecutionContext *exe_ctx = m_parser_vars->m_exe_ctx; - if (exe_ctx == NULL) - return lldb::ClangExpressionVariableSP(); - Target *target = exe_ctx->GetTargetPtr(); + ExecutionContext &exe_ctx = m_parser_vars->m_exe_ctx; + Target *target = exe_ctx.GetTargetPtr(); if (target == NULL) return lldb::ClangExpressionVariableSP(); @@ -313,7 +311,7 @@ TypeFromUser var_type = var_sp->GetTypeFromUser(); - StackFrame *frame = exe_ctx->GetFramePtr(); + StackFrame *frame = exe_ctx.GetFramePtr(); if (frame == NULL) return lldb::ClangExpressionVariableSP(); @@ -384,8 +382,7 @@ if (maybe_make_load && value.GetValueType() == Value::eValueTypeFileAddress && - m_parser_vars->m_exe_ctx && - m_parser_vars->m_exe_ctx->GetProcessPtr()) + m_parser_vars->m_exe_ctx.GetProcessPtr()) { value.SetValueType(Value::eValueTypeLoadAddress); } @@ -399,7 +396,7 @@ unsigned long long address = value.GetScalar().ULongLong(); AddressType address_type = value.GetValueAddressType(); - pvar_sp->m_live_sp = ValueObjectConstResult::Create(m_parser_vars->m_exe_ctx->GetBestExecutionContextScope(), + pvar_sp->m_live_sp = ValueObjectConstResult::Create(m_parser_vars->m_exe_ctx.GetBestExecutionContextScope(), pvar_sp->GetTypeFromUser().GetASTContext(), pvar_sp->GetTypeFromUser().GetOpaqueQualType(), pvar_sp->GetName(), @@ -449,10 +446,8 @@ assert (m_parser_vars.get()); lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS)); - ExecutionContext *exe_ctx = m_parser_vars->m_exe_ctx; - if (exe_ctx == NULL) - return false; - Target *target = exe_ctx->GetTargetPtr(); + ExecutionContext &exe_ctx = m_parser_vars->m_exe_ctx; + Target *target = exe_ctx.GetTargetPtr(); if (target == NULL) return false; @@ -473,7 +468,7 @@ if (!m_parser_vars->m_target_info.IsValid()) return false; - if (!m_parser_vars->m_persistent_vars->CreatePersistentVariable (exe_ctx->GetBestExecutionContextScope (), + if (!m_parser_vars->m_persistent_vars->CreatePersistentVariable (exe_ctx.GetBestExecutionContextScope (), name, user_type, m_parser_vars->m_target_info.byte_order, @@ -695,10 +690,8 @@ assert (m_parser_vars.get()); lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS)); - ExecutionContext *exe_ctx = m_parser_vars->m_exe_ctx; - if (exe_ctx == NULL) - return false; - Target *target = exe_ctx->GetTargetPtr(); + ExecutionContext &exe_ctx = m_parser_vars->m_exe_ctx; + Target *target = exe_ctx.GetTargetPtr(); // Back out in all cases where we're not fully initialized if (target == NULL) return false; @@ -819,11 +812,10 @@ { assert (m_parser_vars.get()); - if (!m_parser_vars->m_exe_ctx || - !m_parser_vars->m_exe_ctx->GetTargetPtr()) + if (!m_parser_vars->m_exe_ctx.GetTargetPtr()) return false; - return GetSymbolAddress(m_parser_vars->m_exe_ctx->GetTargetRef(), name, symbol_type); + return GetSymbolAddress(m_parser_vars->m_exe_ctx.GetTargetRef(), name, symbol_type); } // Interface for IRInterpreter @@ -835,7 +827,7 @@ ret.SetContext(Value::eContextTypeInvalid, NULL); - if (m_parser_vars->m_exe_ctx && m_parser_vars->m_exe_ctx->GetProcessPtr()) + if (m_parser_vars->m_exe_ctx.GetProcessPtr()) ret.SetValueType(Value::eValueTypeLoadAddress); else ret.SetValueType(Value::eValueTypeFileAddress); @@ -852,15 +844,15 @@ { assert (m_parser_vars.get()); - ExecutionContext *exe_ctx = m_parser_vars->m_exe_ctx; + ExecutionContext &exe_ctx = m_parser_vars->m_exe_ctx; - Process *process = exe_ctx->GetProcessPtr(); + Process *process = exe_ctx.GetProcessPtr(); if (value.GetContextType() == Value::eContextTypeRegisterInfo) { if (!process) return false; - RegisterContext *reg_ctx = exe_ctx->GetRegisterContext(); + RegisterContext *reg_ctx = exe_ctx.GetRegisterContext(); RegisterInfo *reg_info = value.GetRegisterInfo(); if (!reg_ctx) @@ -885,7 +877,7 @@ if (!process) return false; - Target *target = exe_ctx->GetTargetPtr(); + Target *target = exe_ctx.GetTargetPtr(); Address file_addr; if (!target->GetImages().ResolveFileAddress((lldb::addr_t)value.GetScalar().ULongLong(), file_addr)) @@ -928,16 +920,16 @@ { assert (m_parser_vars.get()); - ExecutionContext *exe_ctx = m_parser_vars->m_exe_ctx; + ExecutionContext &exe_ctx = m_parser_vars->m_exe_ctx; - Process *process = exe_ctx->GetProcessPtr(); + Process *process = exe_ctx.GetProcessPtr(); if (value.GetContextType() == Value::eContextTypeRegisterInfo) { if (!process) return false; - RegisterContext *reg_ctx = exe_ctx->GetRegisterContext(); + RegisterContext *reg_ctx = exe_ctx.GetRegisterContext(); RegisterInfo *reg_info = value.GetRegisterInfo(); if (!reg_ctx) @@ -959,7 +951,7 @@ return false; case Value::eValueTypeFileAddress: { - Target *target = exe_ctx->GetTargetPtr(); + Target *target = exe_ctx.GetTargetPtr(); if (target == NULL) return false; @@ -1003,9 +995,7 @@ ClangExpressionDeclMap::LookupDecl (clang::NamedDecl *decl) { assert (m_parser_vars.get()); - - ExecutionContext exe_ctx = *m_parser_vars->m_exe_ctx; - + ClangExpressionVariableSP expr_var_sp (m_found_entities.GetVariable(decl)); ClangExpressionVariableSP persistent_var_sp (m_parser_vars->m_persistent_vars->GetVariable(decl)); @@ -1018,11 +1008,11 @@ if (expr_var_sp->m_parser_vars->m_lldb_var) { - std::auto_ptr value(GetVariableValue(exe_ctx, expr_var_sp->m_parser_vars->m_lldb_var, NULL)); + std::auto_ptr value(GetVariableValue(expr_var_sp->m_parser_vars->m_lldb_var, NULL)); if (is_reference && value.get() && value->GetValueType() == Value::eValueTypeLoadAddress) { - Process *process = m_parser_vars->m_exe_ctx->GetProcessPtr(); + Process *process = m_parser_vars->m_exe_ctx.GetProcessPtr(); if (!process) return Value(); @@ -1069,8 +1059,8 @@ persistent_var_sp->m_flags & ClangExpressionVariable::EVIsLLDBAllocated) && persistent_var_sp->m_live_sp && ((persistent_var_sp->m_live_sp->GetValue().GetValueType() == Value::eValueTypeLoadAddress && - m_parser_vars->m_exe_ctx->GetProcessSP() && - m_parser_vars->m_exe_ctx->GetProcessSP()->IsAlive()) || + m_parser_vars->m_exe_ctx.GetProcessSP() && + m_parser_vars->m_exe_ctx.GetProcessSP()->IsAlive()) || (persistent_var_sp->m_live_sp->GetValue().GetValueType() == Value::eValueTypeFileAddress))) { return persistent_var_sp->m_live_sp->GetValue(); @@ -1095,10 +1085,7 @@ { assert(m_parser_vars.get()); - if (!m_parser_vars->m_exe_ctx) - return Value(); - - StackFrame *frame = m_parser_vars->m_exe_ctx->GetFramePtr(); + StackFrame *frame = m_parser_vars->m_exe_ctx.GetFramePtr(); if (!frame) return Value(); @@ -1115,11 +1102,11 @@ !var->LocationIsValidForFrame (frame)) return Value(); - std::auto_ptr value(GetVariableValue(*m_parser_vars->m_exe_ctx, var, NULL)); + std::auto_ptr value(GetVariableValue(var, NULL)); if (value.get() && value->GetValueType() == Value::eValueTypeLoadAddress) { - Process *process = m_parser_vars->m_exe_ctx->GetProcessPtr(); + Process *process = m_parser_vars->m_exe_ctx.GetProcessPtr(); if (!process) return Value(); @@ -1145,17 +1132,18 @@ bool ClangExpressionDeclMap::Materialize ( - ExecutionContext &exe_ctx, lldb::addr_t &struct_address, Error &err ) { + if (!m_parser_vars.get()) + return false; + EnableMaterialVars(); - m_material_vars->m_process = exe_ctx.GetProcessPtr(); + m_material_vars->m_process = m_parser_vars->m_exe_ctx.GetProcessPtr(); bool result = DoMaterialize(false /* dematerialize */, - exe_ctx, LLDB_INVALID_ADDRESS /* top of stack frame */, LLDB_INVALID_ADDRESS /* bottom of stack frame */, NULL, /* result SP */ @@ -1172,16 +1160,15 @@ ( lldb::addr_t &object_ptr, ConstString &object_name, - ExecutionContext &exe_ctx, Error &err, bool suppress_type_check ) { assert (m_struct_vars.get()); - Target *target = exe_ctx.GetTargetPtr(); - Process *process = exe_ctx.GetProcessPtr(); - StackFrame *frame = exe_ctx.GetFramePtr(); + Target *target = m_parser_vars->m_exe_ctx.GetTargetPtr(); + Process *process = m_parser_vars->m_exe_ctx.GetProcessPtr(); + StackFrame *frame = m_parser_vars->m_exe_ctx.GetFramePtr(); if (frame == NULL || process == NULL || target == NULL) { @@ -1205,8 +1192,7 @@ return false; } - std::auto_ptr location_value(GetVariableValue(exe_ctx, - object_ptr_var, + std::auto_ptr location_value(GetVariableValue(object_ptr_var, NULL)); if (!location_value.get()) @@ -1260,7 +1246,7 @@ return false; } - RegisterContext *reg_ctx = exe_ctx.GetRegisterContext(); + RegisterContext *reg_ctx = m_parser_vars->m_exe_ctx.GetRegisterContext(); if (!reg_ctx) { @@ -1280,14 +1266,13 @@ bool ClangExpressionDeclMap::Dematerialize ( - ExecutionContext &exe_ctx, ClangExpressionVariableSP &result_sp, lldb::addr_t stack_frame_top, lldb::addr_t stack_frame_bottom, Error &err ) { - return DoMaterialize(true, exe_ctx, stack_frame_top, stack_frame_bottom, &result_sp, err); + return DoMaterialize(true, stack_frame_top, stack_frame_bottom, &result_sp, err); DidDematerialize(); } @@ -1314,7 +1299,6 @@ bool ClangExpressionDeclMap::DumpMaterializedStruct ( - ExecutionContext &exe_ctx, Stream &s, Error &err ) @@ -1327,7 +1311,7 @@ err.SetErrorString("Structure hasn't been laid out yet"); return false; } - Process *process = exe_ctx.GetProcessPtr(); + Process *process = m_parser_vars->m_exe_ctx.GetProcessPtr(); if (!process) { @@ -1335,7 +1319,7 @@ return false; } - Target *target = exe_ctx.GetTargetPtr(); + Target *target = m_parser_vars->m_exe_ctx.GetTargetPtr(); if (!target) { err.SetErrorString("Couldn't find the target"); @@ -1395,7 +1379,6 @@ ClangExpressionDeclMap::DoMaterialize ( bool dematerialize, - ExecutionContext &exe_ctx, lldb::addr_t stack_frame_top, lldb::addr_t stack_frame_bottom, lldb::ClangExpressionVariableSP *result_sp_ptr, @@ -1415,13 +1398,13 @@ return false; } - StackFrame *frame = exe_ctx.GetFramePtr(); + StackFrame *frame = m_parser_vars->m_exe_ctx.GetFramePtr(); if (!frame) { err.SetErrorString("Received null execution frame"); return false; } - Target *target = exe_ctx.GetTargetPtr(); + Target *target = m_parser_vars->m_exe_ctx.GetTargetPtr(); ClangPersistentVariables &persistent_vars = target->GetPersistentVariables(); @@ -1439,7 +1422,7 @@ if (!dematerialize) { - Process *process = exe_ctx.GetProcessPtr(); + Process *process = m_parser_vars->m_exe_ctx.GetProcessPtr(); if (m_material_vars->m_materialized_location) { process->DeallocateMemory(m_material_vars->m_materialized_location); @@ -1481,7 +1464,7 @@ { // This is a register variable - RegisterContext *reg_ctx = exe_ctx.GetRegisterContext(); + RegisterContext *reg_ctx = m_parser_vars->m_exe_ctx.GetRegisterContext(); if (!reg_ctx) { @@ -1490,7 +1473,6 @@ } if (!DoMaterializeOneRegister (dematerialize, - exe_ctx, *reg_ctx, *reg_info, m_material_vars->m_materialized_location + member_sp->m_jit_vars->m_offset, @@ -1506,7 +1488,6 @@ } if (!DoMaterializeOneVariable (dematerialize, - exe_ctx, sym_ctx, member_sp, m_material_vars->m_materialized_location + member_sp->m_jit_vars->m_offset, @@ -1532,7 +1513,6 @@ } if (!DoMaterializeOnePersistentVariable (dematerialize, - exe_ctx, member_sp, m_material_vars->m_materialized_location + member_sp->m_jit_vars->m_offset, stack_frame_top, @@ -1555,7 +1535,6 @@ ClangExpressionDeclMap::DoMaterializeOnePersistentVariable ( bool dematerialize, - ExecutionContext &exe_ctx, ClangExpressionVariableSP &var_sp, lldb::addr_t addr, lldb::addr_t stack_frame_top, @@ -1581,7 +1560,7 @@ } Error error; - Process *process = exe_ctx.GetProcessPtr(); + Process *process = m_parser_vars->m_exe_ctx.GetProcessPtr(); lldb::addr_t mem; // The address of a spare memory area used to hold the persistent variable. @@ -1610,7 +1589,7 @@ // If the reference comes from the program, then the ClangExpressionVariable's // live variable data hasn't been set up yet. Do this now. - var_sp->m_live_sp = ValueObjectConstResult::Create (exe_ctx.GetBestExecutionContextScope (), + var_sp->m_live_sp = ValueObjectConstResult::Create (m_parser_vars->m_exe_ctx.GetBestExecutionContextScope (), var_sp->GetTypeFromUser().GetASTContext(), var_sp->GetTypeFromUser().GetOpaqueQualType(), var_sp->GetName(), @@ -1716,7 +1695,7 @@ // Put the location of the spare memory into the live data of the ValueObject. - var_sp->m_live_sp = ValueObjectConstResult::Create (exe_ctx.GetBestExecutionContextScope(), + var_sp->m_live_sp = ValueObjectConstResult::Create (m_parser_vars->m_exe_ctx.GetBestExecutionContextScope(), var_sp->GetTypeFromUser().GetASTContext(), var_sp->GetTypeFromUser().GetOpaqueQualType(), var_sp->GetName(), @@ -1769,7 +1748,6 @@ ClangExpressionDeclMap::DoMaterializeOneVariable ( bool dematerialize, - ExecutionContext &exe_ctx, const SymbolContext &sym_ctx, ClangExpressionVariableSP &expr_var, lldb::addr_t addr, @@ -1777,9 +1755,9 @@ ) { lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS)); - Target *target = exe_ctx.GetTargetPtr(); - Process *process = exe_ctx.GetProcessPtr(); - StackFrame *frame = exe_ctx.GetFramePtr(); + Target *target = m_parser_vars->m_exe_ctx.GetTargetPtr(); + Process *process = m_parser_vars->m_exe_ctx.GetProcessPtr(); + StackFrame *frame = m_parser_vars->m_exe_ctx.GetFramePtr(); if (!frame || !process || !target || !m_parser_vars.get() || !expr_var->m_parser_vars.get()) { @@ -1801,8 +1779,7 @@ if (var) { - location_value.reset(GetVariableValue(exe_ctx, - var, + location_value.reset(GetVariableValue(var, NULL)); } else if (sym) @@ -1939,7 +1916,7 @@ RegisterValue reg_value; - RegisterContext *reg_ctx = exe_ctx.GetRegisterContext(); + RegisterContext *reg_ctx = m_parser_vars->m_exe_ctx.GetRegisterContext(); if (!reg_ctx) { @@ -2053,7 +2030,7 @@ // Put the location of the spare memory into the live data of the ValueObject. - expr_var->m_live_sp = ValueObjectConstResult::Create (exe_ctx.GetBestExecutionContextScope(), + expr_var->m_live_sp = ValueObjectConstResult::Create (m_parser_vars->m_exe_ctx.GetBestExecutionContextScope(), type.GetASTContext(), type.GetOpaqueQualType(), name, @@ -2107,7 +2084,6 @@ ClangExpressionDeclMap::DoMaterializeOneRegister ( bool dematerialize, - ExecutionContext &exe_ctx, RegisterContext ®_ctx, const RegisterInfo ®_info, lldb::addr_t addr, @@ -2364,8 +2340,8 @@ // Only look for functions by name out in our symbols if the function // doesn't start with our phony prefix of '$' - Target *target = m_parser_vars->m_exe_ctx->GetTargetPtr(); - StackFrame *frame = m_parser_vars->m_exe_ctx->GetFramePtr(); + Target *target = m_parser_vars->m_exe_ctx.GetTargetPtr(); + StackFrame *frame = m_parser_vars->m_exe_ctx.GetFramePtr(); if (name_unique_cstr[0] == '$' && !namespace_decl) { static ConstString g_lldb_class_name ("$__lldb_class"); @@ -2554,9 +2530,9 @@ const char *reg_name(&name.GetCString()[1]); - if (m_parser_vars->m_exe_ctx->GetRegisterContext()) + if (m_parser_vars->m_exe_ctx.GetRegisterContext()) { - const RegisterInfo *reg_info(m_parser_vars->m_exe_ctx->GetRegisterContext()->GetRegisterInfoByName(reg_name)); + const RegisterInfo *reg_info(m_parser_vars->m_exe_ctx.GetRegisterContext()->GetRegisterInfoByName(reg_name)); if (reg_info) { @@ -2695,7 +2671,6 @@ Value * ClangExpressionDeclMap::GetVariableValue ( - ExecutionContext &exe_ctx, VariableSP &var, ASTContext *parser_ast_context, TypeFromUser *user_type, @@ -2737,7 +2712,7 @@ lldb::addr_t loclist_base_load_addr = LLDB_INVALID_ADDRESS; - Target *target = exe_ctx.GetTargetPtr(); + Target *target = m_parser_vars->m_exe_ctx.GetTargetPtr(); if (var_location_expr.IsLocationList()) { @@ -2747,7 +2722,7 @@ } Error err; - if (!var_location_expr.Evaluate(&exe_ctx, ast, NULL, NULL, NULL, loclist_base_load_addr, NULL, *var_location.get(), &err)) + if (!var_location_expr.Evaluate(&m_parser_vars->m_exe_ctx, ast, NULL, NULL, NULL, loclist_base_load_addr, NULL, *var_location.get(), &err)) { if (log) log->Printf("Error evaluating location: %s", err.AsCString()); @@ -2817,8 +2792,7 @@ TypeFromUser ut; TypeFromParser pt; - Value *var_location = GetVariableValue (*m_parser_vars->m_exe_ctx, - var, + Value *var_location = GetVariableValue (var, m_ast_context, &ut, &pt); @@ -2903,7 +2877,7 @@ lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS)); - Target *target = m_parser_vars->m_exe_ctx->GetTargetPtr(); + Target *target = m_parser_vars->m_exe_ctx.GetTargetPtr(); if (target == NULL) return; @@ -2920,7 +2894,7 @@ std::string decl_name(context.m_decl_name.getAsString()); ConstString entity_name(decl_name.c_str()); - ClangExpressionVariableSP entity(m_found_entities.CreateVariable (m_parser_vars->m_exe_ctx->GetBestExecutionContextScope (), + ClangExpressionVariableSP entity(m_found_entities.CreateVariable (m_parser_vars->m_exe_ctx.GetBestExecutionContextScope (), entity_name, user_type, m_parser_vars->m_target_info.byte_order, @@ -2956,7 +2930,7 @@ ClangExpressionDeclMap::ResolveUnknownTypes() { lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS)); - Target *target = m_parser_vars->m_exe_ctx->GetTargetPtr(); + Target *target = m_parser_vars->m_exe_ctx.GetTargetPtr(); ASTContext *scratch_ast_context = target->GetScratchClangASTContext()->getASTContext(); @@ -3035,7 +3009,7 @@ NamedDecl *var_decl = context.AddVarDecl(parser_type.GetOpaqueQualType()); - ClangExpressionVariableSP entity(m_found_entities.CreateVariable (m_parser_vars->m_exe_ctx->GetBestExecutionContextScope(), + ClangExpressionVariableSP entity(m_found_entities.CreateVariable (m_parser_vars->m_exe_ctx.GetBestExecutionContextScope(), m_parser_vars->m_target_info.byte_order, m_parser_vars->m_target_info.address_byte_size)); assert (entity.get()); @@ -3127,13 +3101,13 @@ return; } - Target *target = m_parser_vars->m_exe_ctx->GetTargetPtr(); + Target *target = m_parser_vars->m_exe_ctx.GetTargetPtr(); lldb::addr_t load_addr = fun_address->GetCallableLoadAddress(target); fun_location->SetValueType(Value::eValueTypeLoadAddress); fun_location->GetScalar() = load_addr; - ClangExpressionVariableSP entity(m_found_entities.CreateVariable (m_parser_vars->m_exe_ctx->GetBestExecutionContextScope (), + ClangExpressionVariableSP entity(m_found_entities.CreateVariable (m_parser_vars->m_exe_ctx.GetBestExecutionContextScope (), m_parser_vars->m_target_info.byte_order, m_parser_vars->m_target_info.address_byte_size)); assert (entity.get()); Modified: lldb/trunk/source/Expression/ClangUserExpression.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangUserExpression.cpp?rev=150217&r1=150216&r2=150217&view=diff ============================================================================== --- lldb/trunk/source/Expression/ClangUserExpression.cpp (original) +++ lldb/trunk/source/Expression/ClangUserExpression.cpp Thu Feb 9 19:22:05 2012 @@ -255,6 +255,8 @@ lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS)); Error err; + + InstallContext(exe_ctx); ScanContext(exe_ctx, err); @@ -385,6 +387,19 @@ { lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS)); + lldb::TargetSP target; + lldb::ProcessSP process; + lldb::StackFrameSP frame; + + if (!LockAndCheckContext(exe_ctx, + target, + process, + frame)) + { + error_stream.Printf("The context has changed before we could JIT the expression!"); + return false; + } + if (m_jit_start_addr != LLDB_INVALID_ADDRESS) { Error materialize_error; @@ -407,7 +422,7 @@ return false; } - if (!(m_expr_decl_map->GetObjectPointer(object_ptr, object_name, exe_ctx, materialize_error))) + if (!(m_expr_decl_map->GetObjectPointer(object_ptr, object_name, materialize_error))) { error_stream.Printf("warning: couldn't get required object pointer (substituting NULL): %s\n", materialize_error.AsCString()); object_ptr = 0; @@ -417,7 +432,7 @@ { ConstString cmd_name("_cmd"); - if (!(m_expr_decl_map->GetObjectPointer(cmd_ptr, cmd_name, exe_ctx, materialize_error, true))) + if (!(m_expr_decl_map->GetObjectPointer(cmd_ptr, cmd_name, materialize_error, true))) { error_stream.Printf("warning: couldn't get object pointer (substituting NULL): %s\n", materialize_error.AsCString()); cmd_ptr = 0; @@ -425,7 +440,7 @@ } } - if (!m_expr_decl_map->Materialize(exe_ctx, struct_address, materialize_error)) + if (!m_expr_decl_map->Materialize(struct_address, materialize_error)) { error_stream.Printf("Couldn't materialize struct: %s\n", materialize_error.AsCString()); return false; @@ -454,7 +469,7 @@ if (struct_address) { - if (!m_expr_decl_map->DumpMaterializedStruct(exe_ctx, args, dump_error)) + if (!m_expr_decl_map->DumpMaterializedStruct(args, dump_error)) { log->Printf(" Couldn't extract variable values : %s", dump_error.AsCString("unknown error")); } @@ -511,7 +526,7 @@ Error dump_error; - if (!m_expr_decl_map->DumpMaterializedStruct(exe_ctx, args, dump_error)) + if (!m_expr_decl_map->DumpMaterializedStruct(args, dump_error)) { log->Printf(" Couldn't extract variable values : %s", dump_error.AsCString("unknown error")); } @@ -524,7 +539,7 @@ lldb::addr_t function_stack_bottom = function_stack_pointer - Host::GetPageSize(); - if (!m_expr_decl_map->Dematerialize(exe_ctx, result, function_stack_pointer, function_stack_bottom, expr_error)) + if (!m_expr_decl_map->Dematerialize(result, function_stack_pointer, function_stack_bottom, expr_error)) { error_stream.Printf ("Couldn't dematerialize struct : %s\n", expr_error.AsCString("unknown error")); return false; From jingham at apple.com Fri Feb 10 14:08:00 2012 From: jingham at apple.com (Jim Ingham) Date: Fri, 10 Feb 2012 20:08:00 -0000 Subject: [Lldb-commits] [lldb] r150263 - /lldb/tags/lldb-113/ Message-ID: <20120210200800.43BF02A6C12D@llvm.org> Author: jingham Date: Fri Feb 10 14:08:00 2012 New Revision: 150263 URL: http://llvm.org/viewvc/llvm-project?rev=150263&view=rev Log: Make a tag for lldb-113. Added: lldb/tags/lldb-113/ - copied from r150262, lldb/tags/lldb-112/ From jingham at apple.com Fri Feb 10 14:11:11 2012 From: jingham at apple.com (Jim Ingham) Date: Fri, 10 Feb 2012 20:11:11 -0000 Subject: [Lldb-commits] [lldb] r150269 - in /lldb/tags/lldb-113/tools/debugserver/source/MacOSX: MachException.cpp MachException.h MachTask.cpp Message-ID: <20120210201111.187A92A6C12D@llvm.org> Author: jingham Date: Fri Feb 10 14:11:10 2012 New Revision: 150269 URL: http://llvm.org/viewvc/llvm-project?rev=150269&view=rev Log: Switch to using a hand-built set of exceptions to watch rather than depending on the EXC_MASK_ALL define. Modified: lldb/tags/lldb-113/tools/debugserver/source/MacOSX/MachException.cpp lldb/tags/lldb-113/tools/debugserver/source/MacOSX/MachException.h lldb/tags/lldb-113/tools/debugserver/source/MacOSX/MachTask.cpp Modified: lldb/tags/lldb-113/tools/debugserver/source/MacOSX/MachException.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/tags/lldb-113/tools/debugserver/source/MacOSX/MachException.cpp?rev=150269&r1=150268&r2=150269&view=diff ============================================================================== --- lldb/tags/lldb-113/tools/debugserver/source/MacOSX/MachException.cpp (original) +++ lldb/tags/lldb-113/tools/debugserver/source/MacOSX/MachException.cpp Fri Feb 10 14:11:10 2012 @@ -472,9 +472,9 @@ count = (sizeof (ports) / sizeof (ports[0])); DNBLogThreadedIf(LOG_EXCEPTIONS | LOG_VERBOSE, "MachException::PortInfo::Save ( task = 0x%4.4x )", task); DNBError err; - err = ::task_get_exception_ports (task, EXC_MASK_ALL, masks, &count, ports, behaviors, flavors); + err = ::task_get_exception_ports (task, LLDB_MACH_EXC_MASK_BASE, masks, &count, ports, behaviors, flavors); if (DNBLogCheckLogBit(LOG_EXCEPTIONS) || err.Fail()) - err.LogThreaded("::task_get_exception_ports ( task = 0x%4.4x, mask = 0x%x, maskCnt => %u, ports, behaviors, flavors )", task, EXC_MASK_ALL, count); + err.LogThreaded("::task_get_exception_ports ( task = 0x%4.4x, mask = 0x%x, maskCnt => %u, ports, behaviors, flavors )", task, LLDB_MACH_EXC_MASK_BASE, count); if (err.Fail()) count = 0; return err.Error(); Modified: lldb/tags/lldb-113/tools/debugserver/source/MacOSX/MachException.h URL: http://llvm.org/viewvc/llvm-project/lldb/tags/lldb-113/tools/debugserver/source/MacOSX/MachException.h?rev=150269&r1=150268&r2=150269&view=diff ============================================================================== --- lldb/tags/lldb-113/tools/debugserver/source/MacOSX/MachException.h (original) +++ lldb/tags/lldb-113/tools/debugserver/source/MacOSX/MachException.h Fri Feb 10 14:11:10 2012 @@ -22,6 +22,20 @@ class MachProcess; class PThreadMutex; +// This set of exceptions is common on 10.7 and up. It is the +// base exception set we should use, and then we can add others +// as appropriate based on the system type. + +#define LLDB_MACH_EXC_MASK_BASE (EXC_MASK_BAD_ACCESS | \ + EXC_MASK_BAD_INSTRUCTION | \ + EXC_MASK_ARITHMETIC | \ + EXC_MASK_EMULATION | \ + EXC_MASK_SOFTWARE | \ + EXC_MASK_BREAKPOINT | \ + EXC_MASK_SYSCALL | \ + EXC_MASK_MACH_SYSCALL | \ + EXC_MASK_RPC_ALERT) + typedef union MachMessageTag { mach_msg_header_t hdr; Modified: lldb/tags/lldb-113/tools/debugserver/source/MacOSX/MachTask.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/tags/lldb-113/tools/debugserver/source/MacOSX/MachTask.cpp?rev=150269&r1=150268&r2=150269&view=diff ============================================================================== --- lldb/tags/lldb-113/tools/debugserver/source/MacOSX/MachTask.cpp (original) +++ lldb/tags/lldb-113/tools/debugserver/source/MacOSX/MachTask.cpp Fri Feb 10 14:11:10 2012 @@ -30,6 +30,7 @@ #include "DNBError.h" #include "DNBLog.h" #include "MachProcess.h" +#include "MachException.h" #include "DNBDataRef.h" #include "stack_logging.h" @@ -368,7 +369,7 @@ SaveExceptionPortInfo(); // Set the ability to get all exceptions on this port - err = ::task_set_exception_ports (task, EXC_MASK_ALL, m_exception_port, EXCEPTION_DEFAULT | MACH_EXCEPTION_CODES, THREAD_STATE_NONE); + err = ::task_set_exception_ports (task, LLDB_MACH_EXC_MASK_BASE, m_exception_port, EXCEPTION_DEFAULT | MACH_EXCEPTION_CODES, THREAD_STATE_NONE); if (err.Fail()) return false; From jingham at apple.com Fri Feb 10 14:11:39 2012 From: jingham at apple.com (Jim Ingham) Date: Fri, 10 Feb 2012 20:11:39 -0000 Subject: [Lldb-commits] [lldb] r150270 - in /lldb/tags/lldb-113: lldb.xcodeproj/project.pbxproj resources/LLDB-Info.plist tools/debugserver/debugserver.xcodeproj/project.pbxproj Message-ID: <20120210201139.F24CF2A6C12D@llvm.org> Author: jingham Date: Fri Feb 10 14:11:39 2012 New Revision: 150270 URL: http://llvm.org/viewvc/llvm-project?rev=150270&view=rev Log: Bumping versions, also setting the deployment target to 10.7. Modified: lldb/tags/lldb-113/lldb.xcodeproj/project.pbxproj lldb/tags/lldb-113/resources/LLDB-Info.plist lldb/tags/lldb-113/tools/debugserver/debugserver.xcodeproj/project.pbxproj Modified: lldb/tags/lldb-113/lldb.xcodeproj/project.pbxproj URL: http://llvm.org/viewvc/llvm-project/lldb/tags/lldb-113/lldb.xcodeproj/project.pbxproj?rev=150270&r1=150269&r2=150270&view=diff ============================================================================== --- lldb/tags/lldb-113/lldb.xcodeproj/project.pbxproj (original) +++ lldb/tags/lldb-113/lldb.xcodeproj/project.pbxproj Fri Feb 10 14:11:39 2012 @@ -3628,6 +3628,7 @@ LLVM_BUILD_DIR_ARCH = "$(CURRENT_ARCH)/"; LLVM_CONFIGURATION = "Debug+Asserts"; LLVM_SOURCE_DIR = "$(SRCROOT)/llvm"; + MACOSX_DEPLOYMENT_TARGET = 10.7; ONLY_ACTIVE_ARCH = YES; OTHER_CFLAGS = ( "-flimit-debug-info", @@ -3680,6 +3681,7 @@ LLVM_BUILD_DIR_ARCH = "$(CURRENT_ARCH)/"; LLVM_CONFIGURATION = Release; LLVM_SOURCE_DIR = "$(SRCROOT)/llvm"; + MACOSX_DEPLOYMENT_TARGET = 10.7; OTHER_CFLAGS = ( "-flimit-debug-info", "-Wparentheses", @@ -3733,9 +3735,9 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; - CURRENT_PROJECT_VERSION = 112; + CURRENT_PROJECT_VERSION = 113; DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 112; + DYLIB_CURRENT_VERSION = 113; EXPORTED_SYMBOLS_FILE = "resources/lldb-framework-exports"; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -3793,10 +3795,10 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; - CURRENT_PROJECT_VERSION = 112; + CURRENT_PROJECT_VERSION = 113; DEAD_CODE_STRIPPING = YES; DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 112; + DYLIB_CURRENT_VERSION = 113; EXPORTED_SYMBOLS_FILE = "resources/lldb-framework-exports"; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -3852,8 +3854,8 @@ 2689FFD513353D7A00698AC0 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - CURRENT_PROJECT_VERSION = 112; - DYLIB_CURRENT_VERSION = 112; + CURRENT_PROJECT_VERSION = 113; + DYLIB_CURRENT_VERSION = 113; EXECUTABLE_EXTENSION = a; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -3881,8 +3883,8 @@ 2689FFD613353D7A00698AC0 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - CURRENT_PROJECT_VERSION = 112; - DYLIB_CURRENT_VERSION = 112; + CURRENT_PROJECT_VERSION = 113; + DYLIB_CURRENT_VERSION = 113; EXECUTABLE_EXTENSION = a; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -3910,8 +3912,8 @@ 2689FFD713353D7A00698AC0 /* BuildAndIntegration */ = { isa = XCBuildConfiguration; buildSettings = { - CURRENT_PROJECT_VERSION = 112; - DYLIB_CURRENT_VERSION = 112; + CURRENT_PROJECT_VERSION = 113; + DYLIB_CURRENT_VERSION = 113; EXECUTABLE_EXTENSION = a; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -3977,6 +3979,7 @@ LLVM_BUILD_DIR_ARCH = "$(CURRENT_ARCH)/"; LLVM_CONFIGURATION = Release; LLVM_SOURCE_DIR = "$(SRCROOT)/llvm"; + MACOSX_DEPLOYMENT_TARGET = 10.7; OTHER_CFLAGS = ( "-flimit-debug-info", "-Wparentheses", @@ -3991,7 +3994,7 @@ isa = XCBuildConfiguration; buildSettings = { COPY_PHASE_STRIP = YES; - CURRENT_PROJECT_VERSION = 112; + CURRENT_PROJECT_VERSION = 113; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "\"$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks\"", @@ -4022,10 +4025,10 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; COPY_PHASE_STRIP = YES; - CURRENT_PROJECT_VERSION = 112; + CURRENT_PROJECT_VERSION = 113; DEAD_CODE_STRIPPING = YES; DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 112; + DYLIB_CURRENT_VERSION = 113; EXPORTED_SYMBOLS_FILE = "resources/lldb-framework-exports"; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -4263,7 +4266,7 @@ 26F5C26C10F3D9A5009D5894 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - CURRENT_PROJECT_VERSION = 112; + CURRENT_PROJECT_VERSION = 113; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "\"$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks\"", @@ -4293,7 +4296,7 @@ 26F5C26D10F3D9A5009D5894 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - CURRENT_PROJECT_VERSION = 112; + CURRENT_PROJECT_VERSION = 113; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "\"$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks\"", Modified: lldb/tags/lldb-113/resources/LLDB-Info.plist URL: http://llvm.org/viewvc/llvm-project/lldb/tags/lldb-113/resources/LLDB-Info.plist?rev=150270&r1=150269&r2=150270&view=diff ============================================================================== --- lldb/tags/lldb-113/resources/LLDB-Info.plist (original) +++ lldb/tags/lldb-113/resources/LLDB-Info.plist Fri Feb 10 14:11:39 2012 @@ -17,7 +17,7 @@ CFBundleSignature ???? CFBundleVersion - 112 + 113 CFBundleName ${EXECUTABLE_NAME} Modified: lldb/tags/lldb-113/tools/debugserver/debugserver.xcodeproj/project.pbxproj URL: http://llvm.org/viewvc/llvm-project/lldb/tags/lldb-113/tools/debugserver/debugserver.xcodeproj/project.pbxproj?rev=150270&r1=150269&r2=150270&view=diff ============================================================================== --- lldb/tags/lldb-113/tools/debugserver/debugserver.xcodeproj/project.pbxproj (original) +++ lldb/tags/lldb-113/tools/debugserver/debugserver.xcodeproj/project.pbxproj Fri Feb 10 14:11:39 2012 @@ -475,7 +475,7 @@ i386, ); COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 170; + CURRENT_PROJECT_VERSION = 171; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; SDKROOT = ""; @@ -494,7 +494,7 @@ x86_64, i386, ); - CURRENT_PROJECT_VERSION = 170; + CURRENT_PROJECT_VERSION = 171; DEAD_CODE_STRIPPING = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; @@ -515,7 +515,7 @@ x86_64, i386, ); - CURRENT_PROJECT_VERSION = 170; + CURRENT_PROJECT_VERSION = 171; DEAD_CODE_STRIPPING = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; @@ -534,7 +534,7 @@ "ARCHS[sdk=iphoneos*]" = "$(ARCHS_STANDARD_32_BIT)"; "CODE_SIGN_ENTITLEMENTS[sdk=iphoneos*]" = "source/debugserver-entitlements.plist"; COPY_PHASE_STRIP = YES; - CURRENT_PROJECT_VERSION = 170; + CURRENT_PROJECT_VERSION = 171; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; FRAMEWORK_SEARCH_PATHS = $SDKROOT/System/Library/PrivateFrameworks; "FRAMEWORK_SEARCH_PATHS[sdk=iphoneos*][arch=*]" = ( @@ -547,6 +547,7 @@ HEADER_SEARCH_PATHS = /System/Library/Frameworks/System.framework/PrivateHeaders; INSTALL_PATH = /usr/bin; LLDB_DEBUGSERVER = 1; + MACOSX_DEPLOYMENT_TARGET = 10.7; OTHER_CFLAGS = "-Wparentheses"; OTHER_LDFLAGS = ( "-sectcreate", @@ -574,7 +575,7 @@ "ARCHS[sdk=iphoneos*]" = "$(ARCHS_STANDARD_32_BIT)"; "CODE_SIGN_ENTITLEMENTS[sdk=iphoneos*]" = "source/debugserver-entitlements.plist"; COPY_PHASE_STRIP = YES; - CURRENT_PROJECT_VERSION = 170; + CURRENT_PROJECT_VERSION = 171; FRAMEWORK_SEARCH_PATHS = $SDKROOT/System/Library/PrivateFrameworks; "FRAMEWORK_SEARCH_PATHS[sdk=iphoneos*][arch=*]" = ( "$(SDKROOT)/System/Library/PrivateFrameworks", @@ -587,6 +588,7 @@ GCC_VERSION = com.apple.compilers.llvm.clang.1_0; INSTALL_PATH = /usr/bin; LLDB_DEBUGSERVER = 1; + MACOSX_DEPLOYMENT_TARGET = 10.7; OTHER_CFLAGS = "-Wparentheses"; OTHER_LDFLAGS = ( "-sectcreate", @@ -613,7 +615,7 @@ "ARCHS[sdk=iphoneos*]" = "$(ARCHS_STANDARD_32_BIT)"; "CODE_SIGN_ENTITLEMENTS[sdk=iphoneos*]" = "source/debugserver-entitlements.plist"; COPY_PHASE_STRIP = YES; - CURRENT_PROJECT_VERSION = 170; + CURRENT_PROJECT_VERSION = 171; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; FRAMEWORK_SEARCH_PATHS = $SDKROOT/System/Library/PrivateFrameworks; "FRAMEWORK_SEARCH_PATHS[sdk=iphoneos*][arch=*]" = ( @@ -626,6 +628,7 @@ HEADER_SEARCH_PATHS = /System/Library/Frameworks/System.framework/PrivateHeaders; INSTALL_PATH = /usr/bin; LLDB_DEBUGSERVER = 1; + MACOSX_DEPLOYMENT_TARGET = 10.7; OTHER_CFLAGS = "-Wparentheses"; OTHER_LDFLAGS = ( "-sectcreate", From gclayton at apple.com Fri Feb 10 14:13:26 2012 From: gclayton at apple.com (Greg Clayton) Date: Fri, 10 Feb 2012 20:13:26 -0000 Subject: [Lldb-commits] [lldb] r150271 - in /lldb/trunk/source/Plugins/Process/mach-core: ProcessMachCore.h ThreadMachCore.h Message-ID: <20120210201327.0E2122A6C12D@llvm.org> Author: gclayton Date: Fri Feb 10 14:13:26 2012 New Revision: 150271 URL: http://llvm.org/viewvc/llvm-project?rev=150271&view=rev Log: Fixed incorrect #include directives. Modified: lldb/trunk/source/Plugins/Process/mach-core/ProcessMachCore.h lldb/trunk/source/Plugins/Process/mach-core/ThreadMachCore.h Modified: lldb/trunk/source/Plugins/Process/mach-core/ProcessMachCore.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/mach-core/ProcessMachCore.h?rev=150271&r1=150270&r2=150271&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/mach-core/ProcessMachCore.h (original) +++ lldb/trunk/source/Plugins/Process/mach-core/ProcessMachCore.h Fri Feb 10 14:13:26 2012 @@ -17,18 +17,8 @@ #include // Other libraries and framework includes -#include "lldb/Core/ArchSpec.h" -#include "lldb/Core/Broadcaster.h" #include "lldb/Core/Error.h" -#include "lldb/Core/InputReader.h" -#include "lldb/Core/StreamString.h" -#include "lldb/Core/StringList.h" -#include "lldb/Core/ThreadSafeValue.h" #include "lldb/Target/Process.h" -#include "lldb/Target/Thread.h" - -#include "CommunicationKDP.h" -#include "Utility/StringExtractor.h" class ThreadKDP; Modified: lldb/trunk/source/Plugins/Process/mach-core/ThreadMachCore.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/mach-core/ThreadMachCore.h?rev=150271&r1=150270&r2=150271&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/mach-core/ThreadMachCore.h (original) +++ lldb/trunk/source/Plugins/Process/mach-core/ThreadMachCore.h Fri Feb 10 14:13:26 2012 @@ -12,7 +12,6 @@ #include -#include "lldb/Target/Process.h" #include "lldb/Target/Thread.h" class ProcessMachCore; From gclayton at apple.com Fri Feb 10 14:18:16 2012 From: gclayton at apple.com (Greg Clayton) Date: Fri, 10 Feb 2012 12:18:16 -0800 Subject: [Lldb-commits] CommunicationKDP.h not checked in? In-Reply-To: <4F3421D4.5030208@crhc.illinois.edu> References: <4F3421D4.5030208@crhc.illinois.edu> Message-ID: <6A235C22-BDAD-471F-9FC9-D5BEA56D4264@apple.com> Yep, that was a copy/paste error. Fixed: % svn commit Sending source/Plugins/Process/mach-core/ProcessMachCore.h Sending source/Plugins/Process/mach-core/ThreadMachCore.h Transmitting file data .. Committed revision 150271. On Feb 9, 2012, at 11:43 AM, Matt Johnson wrote: > Hi all, > Was CommunicationKDP.h supposed to be included in r150154? ToT > build is broken by the include in ProcessMachCore.h. > Thanks! > -Matt > _______________________________________________ > lldb-commits mailing list > lldb-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits From scallanan at apple.com Fri Feb 10 14:22:35 2012 From: scallanan at apple.com (Sean Callanan) Date: Fri, 10 Feb 2012 20:22:35 -0000 Subject: [Lldb-commits] [lldb] r150272 - in /lldb/trunk: include/lldb/Symbol/ObjectFile.h source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.cpp source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp source/Plugins/OperatingSystem/Darwin-Kernel/OperatingSystemDarwinKernel.cpp Message-ID: <20120210202235.BBC812A6C12D@llvm.org> Author: spyffe Date: Fri Feb 10 14:22:35 2012 New Revision: 150272 URL: http://llvm.org/viewvc/llvm-project?rev=150272&view=rev Log: Improved detection of object file types, moving detection of kernels into the object file and adding a new category for raw binary images. Fixed all clients who previously searched for sections manually, making them use the object file's facilities instead. Modified: lldb/trunk/include/lldb/Symbol/ObjectFile.h lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp lldb/trunk/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.cpp lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp lldb/trunk/source/Plugins/OperatingSystem/Darwin-Kernel/OperatingSystemDarwinKernel.cpp Modified: lldb/trunk/include/lldb/Symbol/ObjectFile.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/ObjectFile.h?rev=150272&r1=150271&r2=150272&view=diff ============================================================================== --- lldb/trunk/include/lldb/Symbol/ObjectFile.h (original) +++ lldb/trunk/include/lldb/Symbol/ObjectFile.h Fri Feb 10 14:22:35 2012 @@ -75,7 +75,8 @@ eStrataInvalid = 0, eStrataUnknown, eStrataUser, - eStrataKernel + eStrataKernel, + eStrataRawImage } Strata; //------------------------------------------------------------------ Modified: lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp?rev=150272&r1=150271&r2=150272&view=diff ============================================================================== --- lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp (original) +++ lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp Fri Feb 10 14:22:35 2012 @@ -58,15 +58,7 @@ ObjectFile *object_file = exe_module->GetObjectFile(); if (object_file) { - SectionList *section_list = object_file->GetSectionList(); - if (section_list) - { - static ConstString g_kld_section_name ("__KLD"); - if (section_list->FindSectionByName (g_kld_section_name)) - { - create = true; - } - } + create = (object_file->GetStrata() == ObjectFile::eStrataKernel); } } Modified: lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp?rev=150272&r1=150271&r2=150272&view=diff ============================================================================== --- lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp (original) +++ lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp Fri Feb 10 14:22:35 2012 @@ -98,15 +98,7 @@ ObjectFile *object_file = exe_module->GetObjectFile(); if (object_file) { - SectionList *section_list = object_file->GetSectionList(); - if (section_list) - { - static ConstString g_kld_section_name ("__KLD"); - if (section_list->FindSectionByName (g_kld_section_name)) - { - create = false; - } - } + create = (object_file->GetStrata() == ObjectFile::eStrataUser); } } Modified: lldb/trunk/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.cpp?rev=150272&r1=150271&r2=150272&view=diff ============================================================================== --- lldb/trunk/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.cpp (original) +++ lldb/trunk/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.cpp Fri Feb 10 14:22:35 2012 @@ -33,6 +33,19 @@ create = true; } + if (!create) + { + Module *exe_module = process->GetTarget().GetExecutableModulePointer(); + if (exe_module) + { + ObjectFile *object_file = exe_module->GetObjectFile(); + if (object_file) + { + create = (object_file->GetStrata() == ObjectFile::eStrataRawImage); + } + } + } + if (create) return new DynamicLoaderStatic (process); return NULL; Modified: lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp?rev=150272&r1=150271&r2=150272&view=diff ============================================================================== --- lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp (original) +++ lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp Fri Feb 10 14:22:35 2012 @@ -2180,12 +2180,24 @@ case HeaderFileTypeExecutable: // 0x2u MH_EXECUTE // Check for the MH_DYLDLINK bit in the flags if (m_header.flags & HeaderFlagBitIsDynamicLinkObject) + { return eStrataUser; - return eStrataKernel; + } + else + { + SectionList *section_list = GetSectionList(); + if (section_list) + { + static ConstString g_kld_section_name ("__KLD"); + if (section_list->FindSectionByName(g_kld_section_name)) + return eStrataKernel; + } + } + return eStrataRawImage; case HeaderFileTypeFixedVMShlib: return eStrataUser; // 0x3u MH_FVMLIB case HeaderFileTypeCore: return eStrataUnknown; // 0x4u MH_CORE - case HeaderFileTypePreloadedExecutable: return eStrataUser; // 0x5u MH_PRELOAD + case HeaderFileTypePreloadedExecutable: return eStrataRawImage; // 0x5u MH_PRELOAD case HeaderFileTypeDynamicShlib: return eStrataUser; // 0x6u MH_DYLIB case HeaderFileTypeDynamicLinkEditor: return eStrataUser; // 0x7u MH_DYLINKER case HeaderFileTypeBundle: return eStrataUser; // 0x8u MH_BUNDLE Modified: lldb/trunk/source/Plugins/OperatingSystem/Darwin-Kernel/OperatingSystemDarwinKernel.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/OperatingSystem/Darwin-Kernel/OperatingSystemDarwinKernel.cpp?rev=150272&r1=150271&r2=150272&view=diff ============================================================================== --- lldb/trunk/source/Plugins/OperatingSystem/Darwin-Kernel/OperatingSystemDarwinKernel.cpp (original) +++ lldb/trunk/source/Plugins/OperatingSystem/Darwin-Kernel/OperatingSystemDarwinKernel.cpp Fri Feb 10 14:22:35 2012 @@ -68,14 +68,9 @@ ObjectFile *object_file = exe_module->GetObjectFile(); if (object_file) { - SectionList *section_list = object_file->GetSectionList(); - if (section_list) + if (object_file->GetStrata() != ObjectFile::eStrataKernel) { - static ConstString g_kld_section_name ("__KLD"); - if (section_list->FindSectionByName (g_kld_section_name)) - { - create = true; - } + return NULL; } } } From gclayton at apple.com Fri Feb 10 16:16:02 2012 From: gclayton at apple.com (Greg Clayton) Date: Fri, 10 Feb 2012 22:16:02 -0000 Subject: [Lldb-commits] [lldb] r150277 - /lldb/tags/lldb-114/ Message-ID: <20120210221602.7BAAD2A6C12D@llvm.org> Author: gclayton Date: Fri Feb 10 16:16:02 2012 New Revision: 150277 URL: http://llvm.org/viewvc/llvm-project?rev=150277&view=rev Log: lldb-114 tag Added: lldb/tags/lldb-114/ - copied from r150276, lldb/tags/lldb-113/ From gclayton at apple.com Fri Feb 10 16:17:02 2012 From: gclayton at apple.com (Greg Clayton) Date: Fri, 10 Feb 2012 22:17:02 -0000 Subject: [Lldb-commits] [lldb] r150278 - in /lldb/tags/lldb-114: lldb.xcodeproj/project.pbxproj resources/LLDB-Info.plist Message-ID: <20120210221702.650E62A6C12D@llvm.org> Author: gclayton Date: Fri Feb 10 16:17:02 2012 New Revision: 150278 URL: http://llvm.org/viewvc/llvm-project?rev=150278&view=rev Log: Bumped Xcode project version for lldb-114. Modified: lldb/tags/lldb-114/lldb.xcodeproj/project.pbxproj lldb/tags/lldb-114/resources/LLDB-Info.plist Modified: lldb/tags/lldb-114/lldb.xcodeproj/project.pbxproj URL: http://llvm.org/viewvc/llvm-project/lldb/tags/lldb-114/lldb.xcodeproj/project.pbxproj?rev=150278&r1=150277&r2=150278&view=diff ============================================================================== --- lldb/tags/lldb-114/lldb.xcodeproj/project.pbxproj (original) +++ lldb/tags/lldb-114/lldb.xcodeproj/project.pbxproj Fri Feb 10 16:17:02 2012 @@ -3735,9 +3735,9 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; - CURRENT_PROJECT_VERSION = 113; + CURRENT_PROJECT_VERSION = 114; DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 113; + DYLIB_CURRENT_VERSION = 114; EXPORTED_SYMBOLS_FILE = "resources/lldb-framework-exports"; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -3795,10 +3795,10 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; - CURRENT_PROJECT_VERSION = 113; + CURRENT_PROJECT_VERSION = 114; DEAD_CODE_STRIPPING = YES; DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 113; + DYLIB_CURRENT_VERSION = 114; EXPORTED_SYMBOLS_FILE = "resources/lldb-framework-exports"; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -3854,8 +3854,8 @@ 2689FFD513353D7A00698AC0 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - CURRENT_PROJECT_VERSION = 113; - DYLIB_CURRENT_VERSION = 113; + CURRENT_PROJECT_VERSION = 114; + DYLIB_CURRENT_VERSION = 114; EXECUTABLE_EXTENSION = a; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -3883,8 +3883,8 @@ 2689FFD613353D7A00698AC0 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - CURRENT_PROJECT_VERSION = 113; - DYLIB_CURRENT_VERSION = 113; + CURRENT_PROJECT_VERSION = 114; + DYLIB_CURRENT_VERSION = 114; EXECUTABLE_EXTENSION = a; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -3912,8 +3912,8 @@ 2689FFD713353D7A00698AC0 /* BuildAndIntegration */ = { isa = XCBuildConfiguration; buildSettings = { - CURRENT_PROJECT_VERSION = 113; - DYLIB_CURRENT_VERSION = 113; + CURRENT_PROJECT_VERSION = 114; + DYLIB_CURRENT_VERSION = 114; EXECUTABLE_EXTENSION = a; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -3994,7 +3994,7 @@ isa = XCBuildConfiguration; buildSettings = { COPY_PHASE_STRIP = YES; - CURRENT_PROJECT_VERSION = 113; + CURRENT_PROJECT_VERSION = 114; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "\"$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks\"", @@ -4025,10 +4025,10 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; COPY_PHASE_STRIP = YES; - CURRENT_PROJECT_VERSION = 113; + CURRENT_PROJECT_VERSION = 114; DEAD_CODE_STRIPPING = YES; DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 113; + DYLIB_CURRENT_VERSION = 114; EXPORTED_SYMBOLS_FILE = "resources/lldb-framework-exports"; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -4266,7 +4266,7 @@ 26F5C26C10F3D9A5009D5894 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - CURRENT_PROJECT_VERSION = 113; + CURRENT_PROJECT_VERSION = 114; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "\"$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks\"", @@ -4296,7 +4296,7 @@ 26F5C26D10F3D9A5009D5894 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - CURRENT_PROJECT_VERSION = 113; + CURRENT_PROJECT_VERSION = 114; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "\"$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks\"", Modified: lldb/tags/lldb-114/resources/LLDB-Info.plist URL: http://llvm.org/viewvc/llvm-project/lldb/tags/lldb-114/resources/LLDB-Info.plist?rev=150278&r1=150277&r2=150278&view=diff ============================================================================== --- lldb/tags/lldb-114/resources/LLDB-Info.plist (original) +++ lldb/tags/lldb-114/resources/LLDB-Info.plist Fri Feb 10 16:17:02 2012 @@ -17,7 +17,7 @@ CFBundleSignature ???? CFBundleVersion - 113 + 114 CFBundleName ${EXECUTABLE_NAME} From scallanan at apple.com Fri Feb 10 16:52:19 2012 From: scallanan at apple.com (Sean Callanan) Date: Fri, 10 Feb 2012 22:52:19 -0000 Subject: [Lldb-commits] [lldb] r150279 - in /lldb/trunk: include/lldb/Core/ include/lldb/Symbol/ source/API/ source/Breakpoint/ source/Commands/ source/Core/ source/Expression/ source/Plugins/Process/Utility/ source/Plugins/SymbolFile/DWARF/ source/Plugins/SymbolFile/Symtab/ source/Symbol/ Message-ID: <20120210225220.BD6D72A6C12D@llvm.org> Author: spyffe Date: Fri Feb 10 16:52:19 2012 New Revision: 150279 URL: http://llvm.org/viewvc/llvm-project?rev=150279&view=rev Log: Extended function lookup to allow the user to indicate whether inline functions are desired. This allows the expression parser, for instance, to filter out inlined functions when looking for functions it can call. Modified: lldb/trunk/include/lldb/Core/Module.h lldb/trunk/include/lldb/Core/ModuleList.h lldb/trunk/include/lldb/Symbol/SymbolFile.h lldb/trunk/include/lldb/Symbol/SymbolVendor.h lldb/trunk/source/API/SBModule.cpp lldb/trunk/source/API/SBTarget.cpp lldb/trunk/source/Breakpoint/BreakpointResolverName.cpp lldb/trunk/source/Commands/CommandCompletions.cpp lldb/trunk/source/Commands/CommandObjectSource.cpp lldb/trunk/source/Commands/CommandObjectTarget.cpp lldb/trunk/source/Core/AddressResolverName.cpp lldb/trunk/source/Core/Disassembler.cpp lldb/trunk/source/Core/Module.cpp lldb/trunk/source/Core/ModuleList.cpp lldb/trunk/source/Core/SourceManager.cpp lldb/trunk/source/Expression/ClangASTSource.cpp lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp lldb/trunk/source/Plugins/Process/Utility/InferiorCallPOSIX.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h lldb/trunk/source/Symbol/SymbolVendor.cpp Modified: lldb/trunk/include/lldb/Core/Module.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Module.h?rev=150279&r1=150278&r2=150279&view=diff ============================================================================== --- lldb/trunk/include/lldb/Core/Module.h (original) +++ lldb/trunk/include/lldb/Core/Module.h Fri Feb 10 16:52:19 2012 @@ -271,7 +271,8 @@ FindFunctions (const ConstString &name, const ClangNamespaceDecl *namespace_decl, uint32_t name_type_mask, - bool symbols_ok, + bool symbols_ok, + bool inlines_ok, bool append, SymbolContextList& sc_list); @@ -300,6 +301,7 @@ uint32_t FindFunctions (const RegularExpression& regex, bool symbols_ok, + bool inlines_ok, bool append, SymbolContextList& sc_list); Modified: lldb/trunk/include/lldb/Core/ModuleList.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ModuleList.h?rev=150279&r1=150278&r2=150279&view=diff ============================================================================== --- lldb/trunk/include/lldb/Core/ModuleList.h (original) +++ lldb/trunk/include/lldb/Core/ModuleList.h Fri Feb 10 16:52:19 2012 @@ -182,6 +182,7 @@ FindFunctions (const ConstString &name, uint32_t name_type_mask, bool include_symbols, + bool include_inlines, bool append, SymbolContextList &sc_list); Modified: lldb/trunk/include/lldb/Symbol/SymbolFile.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/SymbolFile.h?rev=150279&r1=150278&r2=150279&view=diff ============================================================================== --- lldb/trunk/include/lldb/Symbol/SymbolFile.h (original) +++ lldb/trunk/include/lldb/Symbol/SymbolFile.h Fri Feb 10 16:52:19 2012 @@ -133,8 +133,8 @@ virtual uint32_t ResolveSymbolContext (const FileSpec& file_spec, uint32_t line, bool check_inlines, uint32_t resolve_scope, SymbolContextList& sc_list) = 0; virtual uint32_t FindGlobalVariables (const ConstString &name, const ClangNamespaceDecl *namespace_decl, bool append, uint32_t max_matches, VariableList& variables) = 0; virtual uint32_t FindGlobalVariables (const RegularExpression& regex, bool append, uint32_t max_matches, VariableList& variables) = 0; - virtual uint32_t FindFunctions (const ConstString &name, const ClangNamespaceDecl *namespace_decl, uint32_t name_type_mask, bool append, SymbolContextList& sc_list) = 0; - virtual uint32_t FindFunctions (const RegularExpression& regex, bool append, SymbolContextList& sc_list) = 0; + virtual uint32_t FindFunctions (const ConstString &name, const ClangNamespaceDecl *namespace_decl, uint32_t name_type_mask, bool include_inlines, bool append, SymbolContextList& sc_list) = 0; + virtual uint32_t FindFunctions (const RegularExpression& regex, bool include_inlines, bool append, SymbolContextList& sc_list) = 0; virtual uint32_t FindTypes (const SymbolContext& sc, const ConstString &name, const ClangNamespaceDecl *namespace_decl, bool append, uint32_t max_matches, TypeList& types) = 0; // virtual uint32_t FindTypes (const SymbolContext& sc, const RegularExpression& regex, bool append, uint32_t max_matches, TypeList& types) = 0; virtual TypeList * GetTypeList (); Modified: lldb/trunk/include/lldb/Symbol/SymbolVendor.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/SymbolVendor.h?rev=150279&r1=150278&r2=150279&view=diff ============================================================================== --- lldb/trunk/include/lldb/Symbol/SymbolVendor.h (original) +++ lldb/trunk/include/lldb/Symbol/SymbolVendor.h Fri Feb 10 16:52:19 2012 @@ -113,12 +113,14 @@ virtual uint32_t FindFunctions (const ConstString &name, const ClangNamespaceDecl *namespace_decl, - uint32_t name_type_mask, + uint32_t name_type_mask, + bool include_inlines, bool append, SymbolContextList& sc_list); virtual uint32_t FindFunctions (const RegularExpression& regex, + bool include_inlines, bool append, SymbolContextList& sc_list); Modified: lldb/trunk/source/API/SBModule.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBModule.cpp?rev=150279&r1=150278&r2=150279&view=diff ============================================================================== --- lldb/trunk/source/API/SBModule.cpp (original) +++ lldb/trunk/source/API/SBModule.cpp Fri Feb 10 16:52:19 2012 @@ -327,10 +327,12 @@ { const bool append = true; const bool symbols_ok = true; + const bool inlines_ok = true; m_opaque_sp->FindFunctions (ConstString(name), NULL, name_type_mask, - symbols_ok, + symbols_ok, + inlines_ok, append, *sb_sc_list); } Modified: lldb/trunk/source/API/SBTarget.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBTarget.cpp?rev=150279&r1=150278&r2=150279&view=diff ============================================================================== --- lldb/trunk/source/API/SBTarget.cpp (original) +++ lldb/trunk/source/API/SBTarget.cpp Fri Feb 10 16:52:19 2012 @@ -1262,10 +1262,12 @@ if (target_sp) { const bool symbols_ok = true; + const bool inlines_ok = true; const bool append = true; target_sp->GetImages().FindFunctions (ConstString(name), name_type_mask, - symbols_ok, + symbols_ok, + inlines_ok, append, *sb_sc_list); } Modified: lldb/trunk/source/Breakpoint/BreakpointResolverName.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointResolverName.cpp?rev=150279&r1=150278&r2=150279&view=diff ============================================================================== --- lldb/trunk/source/Breakpoint/BreakpointResolverName.cpp (original) +++ lldb/trunk/source/Breakpoint/BreakpointResolverName.cpp Fri Feb 10 16:52:19 2012 @@ -120,6 +120,7 @@ } const bool include_symbols = false; + const bool include_inlines = true; const bool append = false; bool filter_by_cu = (filter.GetFilterRequiredItems() & eSymbolContextCompUnit) != 0; @@ -131,7 +132,8 @@ uint32_t num_functions = context.module_sp->FindFunctions (m_func_name, NULL, m_func_name_type_mask, - include_symbols, + include_symbols, + include_inlines, append, func_list); // If the search filter specifies a Compilation Unit, then we don't need to bother to look in plain @@ -150,7 +152,8 @@ if (!filter_by_cu) context.module_sp->FindSymbolsMatchingRegExAndType (m_regex, eSymbolTypeCode, sym_list); context.module_sp->FindFunctions (m_regex, - include_symbols, + include_symbols, + include_inlines, append, func_list); } Modified: lldb/trunk/source/Commands/CommandCompletions.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandCompletions.cpp?rev=150279&r1=150278&r2=150279&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandCompletions.cpp (original) +++ lldb/trunk/source/Commands/CommandCompletions.cpp Fri Feb 10 16:52:19 2012 @@ -618,8 +618,9 @@ { SymbolContextList sc_list; const bool include_symbols = true; + const bool include_inlines = true; const bool append = true; - context.module_sp->FindFunctions (m_regex, include_symbols, append, sc_list); + context.module_sp->FindFunctions (m_regex, include_symbols, include_inlines, append, sc_list); SymbolContext sc; // Now add the functions & symbols to the list - only add if unique: Modified: lldb/trunk/source/Commands/CommandObjectSource.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectSource.cpp?rev=150279&r1=150278&r2=150279&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectSource.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectSource.cpp Fri Feb 10 16:52:19 2012 @@ -299,6 +299,7 @@ SymbolContextList sc_list; ConstString name(m_options.symbol_name.c_str()); bool include_symbols = false; + bool include_inlines = true; bool append = true; size_t num_matches = 0; @@ -312,13 +313,13 @@ { matching_modules.Clear(); target->GetImages().FindModules (&module_spec, NULL, NULL, NULL, matching_modules); - num_matches += matching_modules.FindFunctions (name, eFunctionNameTypeAuto, include_symbols, append, sc_list); + num_matches += matching_modules.FindFunctions (name, eFunctionNameTypeAuto, include_symbols, include_inlines, append, sc_list); } } } else { - num_matches = target->GetImages().FindFunctions (name, eFunctionNameTypeAuto, include_symbols, append, sc_list); + num_matches = target->GetImages().FindFunctions (name, eFunctionNameTypeAuto, include_symbols, include_inlines, append, sc_list); } SymbolContext sc; Modified: lldb/trunk/source/Commands/CommandObjectTarget.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectTarget.cpp?rev=150279&r1=150278&r2=150279&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectTarget.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectTarget.cpp Fri Feb 10 16:52:19 2012 @@ -1521,6 +1521,7 @@ { SymbolContextList sc_list; const bool include_symbols = false; + const bool include_inlines = true; const bool append = true; uint32_t num_matches = 0; if (name_is_regex) @@ -1528,6 +1529,7 @@ RegularExpression function_name_regex (name); num_matches = module->FindFunctions (function_name_regex, include_symbols, + include_inlines, append, sc_list); } @@ -1538,6 +1540,7 @@ NULL, eFunctionNameTypeBase | eFunctionNameTypeFull | eFunctionNameTypeMethod | eFunctionNameTypeSelector, include_symbols, + include_inlines, append, sc_list); } Modified: lldb/trunk/source/Core/AddressResolverName.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/AddressResolverName.cpp?rev=150279&r1=150278&r2=150279&view=diff ============================================================================== --- lldb/trunk/source/Core/AddressResolverName.cpp (original) +++ lldb/trunk/source/Core/AddressResolverName.cpp Fri Feb 10 16:52:19 2012 @@ -104,6 +104,7 @@ } const bool include_symbols = false; + const bool include_inlines = true; const bool append = false; switch (m_match_type) { @@ -117,6 +118,7 @@ NULL, eFunctionNameTypeBase | eFunctionNameTypeFull | eFunctionNameTypeMethod | eFunctionNameTypeSelector, include_symbols, + include_inlines, append, func_list); } @@ -130,6 +132,7 @@ sym_list); context.module_sp->FindFunctions (m_regex, include_symbols, + include_inlines, append, func_list); } Modified: lldb/trunk/source/Core/Disassembler.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Disassembler.cpp?rev=150279&r1=150278&r2=150279&view=diff ============================================================================== --- lldb/trunk/source/Core/Disassembler.cpp (original) +++ lldb/trunk/source/Core/Disassembler.cpp Fri Feb 10 16:52:19 2012 @@ -165,6 +165,7 @@ if (name) { const bool include_symbols = true; + const bool include_inlines = true; if (module) { module->FindFunctions (name, @@ -174,6 +175,7 @@ eFunctionNameTypeMethod | eFunctionNameTypeSelector, include_symbols, + include_inlines, true, sc_list); } @@ -184,7 +186,8 @@ eFunctionNameTypeFull | eFunctionNameTypeMethod | eFunctionNameTypeSelector, - include_symbols, + include_symbols, + include_inlines, false, sc_list); } Modified: lldb/trunk/source/Core/Module.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Module.cpp?rev=150279&r1=150278&r2=150279&view=diff ============================================================================== --- lldb/trunk/source/Core/Module.cpp (original) +++ lldb/trunk/source/Core/Module.cpp Fri Feb 10 16:52:19 2012 @@ -504,7 +504,8 @@ Module::FindFunctions (const ConstString &name, const ClangNamespaceDecl *namespace_decl, uint32_t name_type_mask, - bool include_symbols, + bool include_symbols, + bool include_inlines, bool append, SymbolContextList& sc_list) { @@ -516,7 +517,7 @@ // Find all the functions (not symbols, but debug information functions... SymbolVendor *symbols = GetSymbolVendor (); if (symbols) - symbols->FindFunctions(name, namespace_decl, name_type_mask, append, sc_list); + symbols->FindFunctions(name, namespace_decl, name_type_mask, include_inlines, append, sc_list); // Now check our symbol table for symbols that are code symbols if requested if (include_symbols) @@ -548,7 +549,8 @@ uint32_t Module::FindFunctions (const RegularExpression& regex, - bool include_symbols, + bool include_symbols, + bool include_inlines, bool append, SymbolContextList& sc_list) { @@ -559,7 +561,7 @@ SymbolVendor *symbols = GetSymbolVendor (); if (symbols) - symbols->FindFunctions(regex, append, sc_list); + symbols->FindFunctions(regex, include_inlines, append, sc_list); // Now check our symbol table for symbols that are code symbols if requested if (include_symbols) { Modified: lldb/trunk/source/Core/ModuleList.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ModuleList.cpp?rev=150279&r1=150278&r2=150279&view=diff ============================================================================== --- lldb/trunk/source/Core/ModuleList.cpp (original) +++ lldb/trunk/source/Core/ModuleList.cpp Fri Feb 10 16:52:19 2012 @@ -186,6 +186,7 @@ ModuleList::FindFunctions (const ConstString &name, uint32_t name_type_mask, bool include_symbols, + bool include_inlines, bool append, SymbolContextList &sc_list) { @@ -196,7 +197,7 @@ collection::const_iterator pos, end = m_modules.end(); for (pos = m_modules.begin(); pos != end; ++pos) { - (*pos)->FindFunctions (name, NULL, name_type_mask, include_symbols, true, sc_list); + (*pos)->FindFunctions (name, NULL, name_type_mask, include_symbols, include_inlines, true, sc_list); } return sc_list.GetSize(); Modified: lldb/trunk/source/Core/SourceManager.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/SourceManager.cpp?rev=150279&r1=150278&r2=150279&view=diff ============================================================================== --- lldb/trunk/source/Core/SourceManager.cpp (original) +++ lldb/trunk/source/Core/SourceManager.cpp Fri Feb 10 16:52:19 2012 @@ -245,8 +245,9 @@ uint32_t num_matches; ConstString main_name("main"); bool symbols_okay = false; // Force it to be a debug symbol. + bool inlines_okay = true; bool append = false; - num_matches = executable_ptr->FindFunctions (main_name, NULL, lldb::eFunctionNameTypeBase, symbols_okay, append, sc_list); + num_matches = executable_ptr->FindFunctions (main_name, NULL, lldb::eFunctionNameTypeBase, inlines_okay, symbols_okay, append, sc_list); for (uint32_t idx = 0; idx < num_matches; idx++) { SymbolContext sc; Modified: lldb/trunk/source/Expression/ClangASTSource.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangASTSource.cpp?rev=150279&r1=150278&r2=150279&view=diff ============================================================================== --- lldb/trunk/source/Expression/ClangASTSource.cpp (original) +++ lldb/trunk/source/Expression/ClangASTSource.cpp Fri Feb 10 16:52:19 2012 @@ -667,6 +667,7 @@ SymbolContextList sc_list; const bool include_symbols = false; + const bool include_inlines = false; const bool append = false; std::string interface_name = interface_decl->getNameAsString(); @@ -678,7 +679,7 @@ ms.Flush(); ConstString instance_method_name(ms.GetData()); - m_target->GetImages().FindFunctions(instance_method_name, lldb::eFunctionNameTypeFull, include_symbols, append, sc_list); + m_target->GetImages().FindFunctions(instance_method_name, lldb::eFunctionNameTypeFull, include_symbols, include_inlines, append, sc_list); if (sc_list.GetSize()) break; @@ -688,7 +689,7 @@ ms.Flush(); ConstString class_method_name(ms.GetData()); - m_target->GetImages().FindFunctions(class_method_name, lldb::eFunctionNameTypeFull, include_symbols, append, sc_list); + m_target->GetImages().FindFunctions(class_method_name, lldb::eFunctionNameTypeFull, include_symbols, include_inlines, append, sc_list); if (sc_list.GetSize()) break; @@ -698,7 +699,7 @@ SymbolContextList candidate_sc_list; - m_target->GetImages().FindFunctions(selector_name, lldb::eFunctionNameTypeSelector, include_symbols, append, candidate_sc_list); + m_target->GetImages().FindFunctions(selector_name, lldb::eFunctionNameTypeSelector, include_symbols, include_inlines, append, candidate_sc_list); for (uint32_t ci = 0, ce = candidate_sc_list.GetSize(); ci != ce; Modified: lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp?rev=150279&r1=150278&r2=150279&view=diff ============================================================================== --- lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp (original) +++ lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp Fri Feb 10 16:52:19 2012 @@ -2586,6 +2586,7 @@ if (!context.m_found.variable) { const bool include_symbols = true; + const bool include_inlines = false; const bool append = false; if (namespace_decl && module_sp) @@ -2594,6 +2595,7 @@ &namespace_decl, eFunctionNameTypeBase, include_symbols, + include_inlines, append, sc_list); } @@ -2602,6 +2604,7 @@ target->GetImages().FindFunctions(name, eFunctionNameTypeBase, include_symbols, + include_inlines, append, sc_list); } Modified: lldb/trunk/source/Plugins/Process/Utility/InferiorCallPOSIX.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/InferiorCallPOSIX.cpp?rev=150279&r1=150278&r2=150279&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Utility/InferiorCallPOSIX.cpp (original) +++ lldb/trunk/source/Plugins/Process/Utility/InferiorCallPOSIX.cpp Fri Feb 10 16:52:19 2012 @@ -30,11 +30,13 @@ const bool append = true; const bool include_symbols = true; + const bool include_inlines = false; SymbolContextList sc_list; const uint32_t count = process->GetTarget().GetImages().FindFunctions (ConstString ("mmap"), eFunctionNameTypeFull, - include_symbols, + include_symbols, + include_inlines, append, sc_list); if (count > 0) @@ -128,11 +130,13 @@ const bool append = true; const bool include_symbols = true; + const bool include_inlines = false; SymbolContextList sc_list; const uint32_t count = process->GetTarget().GetImages().FindFunctions (ConstString ("munmap"), eFunctionNameTypeFull, include_symbols, + include_inlines, append, sc_list); if (count > 0) 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=150279&r1=150278&r2=150279&view=diff ============================================================================== --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original) +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Fri Feb 10 16:52:19 2012 @@ -2910,7 +2910,8 @@ uint32_t SymbolFileDWARF::FindFunctions (const ConstString &name, const lldb_private::ClangNamespaceDecl *namespace_decl, - uint32_t name_type_mask, + uint32_t name_type_mask, + bool include_inlines, bool append, SymbolContextList& sc_list) { @@ -3020,6 +3021,9 @@ if (namespace_decl && !DIEIsInNamespace (namespace_decl, dwarf_cu, die)) continue; + if (!include_inlines && die->Tag() == DW_TAG_inlined_subroutine) + continue; + ResolveFunction (dwarf_cu, die, sc_list); } else @@ -3048,7 +3052,12 @@ { const char *die_name = die->GetName(this, dwarf_cu); if (ObjCLanguageRuntime::IsPossibleObjCMethodName(die_name)) + { + if (!include_inlines && die->Tag() == DW_TAG_inlined_subroutine) + continue; + ResolveFunction (dwarf_cu, die, sc_list); + } } else { @@ -3090,6 +3099,9 @@ base_name_start, base_name_end)) continue; + + if (!include_inlines && die->Tag() == DW_TAG_inlined_subroutine) + continue; // If we get to here, the die is good, and we should add it: ResolveFunction (dwarf_cu, die, sc_list); @@ -3139,6 +3151,9 @@ base_name_end)) continue; + if (!include_inlines && die->Tag() == DW_TAG_inlined_subroutine) + continue; + // If we get to here, the die is good, and we should add it: ResolveFunction (dwarf_cu, die, sc_list); } @@ -3166,6 +3181,9 @@ base_name_end)) continue; + if (!include_inlines && die->Tag() == DW_TAG_inlined_subroutine) + continue; + // If we get to here, the die is good, and we should add it: ResolveFunction (dwarf_cu, die, sc_list); } @@ -3186,7 +3204,7 @@ } uint32_t -SymbolFileDWARF::FindFunctions(const RegularExpression& regex, bool append, SymbolContextList& sc_list) +SymbolFileDWARF::FindFunctions(const RegularExpression& regex, bool include_inlines, bool append, SymbolContextList& sc_list) { Timer scoped_timer (__PRETTY_FUNCTION__, "SymbolFileDWARF::FindFunctions (regex = '%s')", Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h?rev=150279&r1=150278&r2=150279&view=diff ============================================================================== --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h (original) +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h Fri Feb 10 16:52:19 2012 @@ -113,8 +113,8 @@ virtual uint32_t ResolveSymbolContext (const lldb_private::FileSpec& file_spec, uint32_t line, bool check_inlines, uint32_t resolve_scope, lldb_private::SymbolContextList& sc_list); virtual uint32_t FindGlobalVariables(const lldb_private::ConstString &name, const lldb_private::ClangNamespaceDecl *namespace_decl, bool append, uint32_t max_matches, lldb_private::VariableList& variables); virtual uint32_t FindGlobalVariables(const lldb_private::RegularExpression& regex, bool append, uint32_t max_matches, lldb_private::VariableList& variables); - virtual uint32_t FindFunctions(const lldb_private::ConstString &name, const lldb_private::ClangNamespaceDecl *namespace_decl, uint32_t name_type_mask, bool append, lldb_private::SymbolContextList& sc_list); - virtual uint32_t FindFunctions(const lldb_private::RegularExpression& regex, bool append, lldb_private::SymbolContextList& sc_list); + virtual uint32_t FindFunctions(const lldb_private::ConstString &name, const lldb_private::ClangNamespaceDecl *namespace_decl, uint32_t name_type_mask, bool include_inlines, bool append, lldb_private::SymbolContextList& sc_list); + virtual uint32_t FindFunctions(const lldb_private::RegularExpression& regex, bool include_inlines, bool append, lldb_private::SymbolContextList& sc_list); virtual uint32_t FindTypes (const lldb_private::SymbolContext& sc, const lldb_private::ConstString &name, const lldb_private::ClangNamespaceDecl *namespace_decl, bool append, uint32_t max_matches, lldb_private::TypeList& types); virtual lldb_private::TypeList * GetTypeList (); Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp?rev=150279&r1=150278&r2=150279&view=diff ============================================================================== --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp (original) +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp Fri Feb 10 16:52:19 2012 @@ -882,7 +882,7 @@ } uint32_t -SymbolFileDWARFDebugMap::FindFunctions(const ConstString &name, const ClangNamespaceDecl *namespace_decl, uint32_t name_type_mask, bool append, SymbolContextList& sc_list) +SymbolFileDWARFDebugMap::FindFunctions(const ConstString &name, const ClangNamespaceDecl *namespace_decl, uint32_t name_type_mask, bool include_inlines, bool append, SymbolContextList& sc_list) { Timer scoped_timer (__PRETTY_FUNCTION__, "SymbolFileDWARFDebugMap::FindFunctions (name = %s)", @@ -899,7 +899,7 @@ while ((oso_dwarf = GetSymbolFileByOSOIndex (oso_idx++)) != NULL) { uint32_t sc_idx = sc_list.GetSize(); - if (oso_dwarf->FindFunctions(name, namespace_decl, name_type_mask, true, sc_list)) + if (oso_dwarf->FindFunctions(name, namespace_decl, name_type_mask, include_inlines, true, sc_list)) { RemoveFunctionsWithModuleNotEqualTo (m_obj_file->GetModule(), sc_list, sc_idx); } @@ -910,7 +910,7 @@ uint32_t -SymbolFileDWARFDebugMap::FindFunctions (const RegularExpression& regex, bool append, SymbolContextList& sc_list) +SymbolFileDWARFDebugMap::FindFunctions (const RegularExpression& regex, bool include_inlines, bool append, SymbolContextList& sc_list) { Timer scoped_timer (__PRETTY_FUNCTION__, "SymbolFileDWARFDebugMap::FindFunctions (regex = '%s')", @@ -928,7 +928,7 @@ { uint32_t sc_idx = sc_list.GetSize(); - if (oso_dwarf->FindFunctions(regex, true, sc_list)) + if (oso_dwarf->FindFunctions(regex, include_inlines, true, sc_list)) { RemoveFunctionsWithModuleNotEqualTo (m_obj_file->GetModule(), sc_list, sc_idx); } Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h?rev=150279&r1=150278&r2=150279&view=diff ============================================================================== --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h (original) +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h Fri Feb 10 16:52:19 2012 @@ -76,8 +76,8 @@ virtual uint32_t ResolveSymbolContext (const lldb_private::FileSpec& file_spec, uint32_t line, bool check_inlines, uint32_t resolve_scope, lldb_private::SymbolContextList& sc_list); virtual uint32_t FindGlobalVariables (const lldb_private::ConstString &name, const lldb_private::ClangNamespaceDecl *namespace_decl, bool append, uint32_t max_matches, lldb_private::VariableList& variables); virtual uint32_t FindGlobalVariables (const lldb_private::RegularExpression& regex, bool append, uint32_t max_matches, lldb_private::VariableList& variables); - virtual uint32_t FindFunctions (const lldb_private::ConstString &name, const lldb_private::ClangNamespaceDecl *namespace_decl, uint32_t name_type_mask, bool append, lldb_private::SymbolContextList& sc_list); - virtual uint32_t FindFunctions (const lldb_private::RegularExpression& regex, bool append, lldb_private::SymbolContextList& sc_list); + virtual uint32_t FindFunctions (const lldb_private::ConstString &name, const lldb_private::ClangNamespaceDecl *namespace_decl, uint32_t name_type_mask, bool include_inlines, bool append, lldb_private::SymbolContextList& sc_list); + virtual uint32_t FindFunctions (const lldb_private::RegularExpression& regex, bool include_inlines, bool append, lldb_private::SymbolContextList& sc_list); virtual uint32_t FindTypes (const lldb_private::SymbolContext& sc, const lldb_private::ConstString &name, const lldb_private::ClangNamespaceDecl *namespace_decl, bool append, uint32_t max_matches, lldb_private::TypeList& types); virtual lldb_private::ClangNamespaceDecl FindNamespace (const lldb_private::SymbolContext& sc, Modified: lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp?rev=150279&r1=150278&r2=150279&view=diff ============================================================================== --- lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp (original) +++ lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp Fri Feb 10 16:52:19 2012 @@ -332,7 +332,7 @@ } uint32_t -SymbolFileSymtab::FindFunctions(const ConstString &name, const ClangNamespaceDecl *namespace_decl, uint32_t name_type_mask, bool append, SymbolContextList& sc_list) +SymbolFileSymtab::FindFunctions(const ConstString &name, const ClangNamespaceDecl *namespace_decl, uint32_t name_type_mask, bool include_inlines, bool append, SymbolContextList& sc_list) { Timer scoped_timer (__PRETTY_FUNCTION__, "SymbolFileSymtab::FindFunctions (name = '%s')", @@ -346,7 +346,7 @@ } uint32_t -SymbolFileSymtab::FindFunctions(const RegularExpression& regex, bool append, SymbolContextList& sc_list) +SymbolFileSymtab::FindFunctions(const RegularExpression& regex, bool include_inlines, bool append, SymbolContextList& sc_list) { Timer scoped_timer (__PRETTY_FUNCTION__, "SymbolFileSymtab::FindFunctions (regex = '%s')", Modified: lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h?rev=150279&r1=150278&r2=150279&view=diff ============================================================================== --- lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h (original) +++ lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h Fri Feb 10 16:52:19 2012 @@ -91,10 +91,10 @@ FindGlobalVariables(const lldb_private::RegularExpression& regex, bool append, uint32_t max_matches, lldb_private::VariableList& variables); virtual uint32_t - FindFunctions(const lldb_private::ConstString &name, const lldb_private::ClangNamespaceDecl *namespace_decl, uint32_t name_type_mask, bool append, lldb_private::SymbolContextList& sc_list); + FindFunctions(const lldb_private::ConstString &name, const lldb_private::ClangNamespaceDecl *namespace_decl, uint32_t name_type_mask, bool include_inlines, bool append, lldb_private::SymbolContextList& sc_list); virtual uint32_t - FindFunctions(const lldb_private::RegularExpression& regex, bool append, lldb_private::SymbolContextList& sc_list); + FindFunctions(const lldb_private::RegularExpression& regex, bool include_inlines, bool append, lldb_private::SymbolContextList& sc_list); virtual uint32_t FindTypes (const lldb_private::SymbolContext& sc,const lldb_private::ConstString &name, const lldb_private::ClangNamespaceDecl *namespace_decl, bool append, uint32_t max_matches, lldb_private::TypeList& types); Modified: lldb/trunk/source/Symbol/SymbolVendor.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/SymbolVendor.cpp?rev=150279&r1=150278&r2=150279&view=diff ============================================================================== --- lldb/trunk/source/Symbol/SymbolVendor.cpp (original) +++ lldb/trunk/source/Symbol/SymbolVendor.cpp Fri Feb 10 16:52:19 2012 @@ -234,20 +234,20 @@ } uint32_t -SymbolVendor::FindFunctions(const ConstString &name, const ClangNamespaceDecl *namespace_decl, uint32_t name_type_mask, bool append, SymbolContextList& sc_list) +SymbolVendor::FindFunctions(const ConstString &name, const ClangNamespaceDecl *namespace_decl, uint32_t name_type_mask, bool include_inlines, bool append, SymbolContextList& sc_list) { Mutex::Locker locker(m_mutex); if (m_sym_file_ap.get()) - return m_sym_file_ap->FindFunctions(name, namespace_decl, name_type_mask, append, sc_list); + return m_sym_file_ap->FindFunctions(name, namespace_decl, name_type_mask, include_inlines, append, sc_list); return 0; } uint32_t -SymbolVendor::FindFunctions(const RegularExpression& regex, bool append, SymbolContextList& sc_list) +SymbolVendor::FindFunctions(const RegularExpression& regex, bool include_inlines, bool append, SymbolContextList& sc_list) { Mutex::Locker locker(m_mutex); if (m_sym_file_ap.get()) - return m_sym_file_ap->FindFunctions(regex, append, sc_list); + return m_sym_file_ap->FindFunctions(regex, include_inlines, append, sc_list); return 0; } From scallanan at apple.com Fri Feb 10 18:24:04 2012 From: scallanan at apple.com (Sean Callanan) Date: Sat, 11 Feb 2012 00:24:04 -0000 Subject: [Lldb-commits] [lldb] r150285 - /lldb/trunk/source/Commands/CommandObjectTarget.cpp Message-ID: <20120211002404.5EEF92A6C12D@llvm.org> Author: spyffe Date: Fri Feb 10 18:24:04 2012 New Revision: 150285 URL: http://llvm.org/viewvc/llvm-project?rev=150285&view=rev Log: Make the output from "target modules lookup -n" prettier. Modified: lldb/trunk/source/Commands/CommandObjectTarget.cpp Modified: lldb/trunk/source/Commands/CommandObjectTarget.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectTarget.cpp?rev=150285&r1=150284&r2=150285&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectTarget.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectTarget.cpp Fri Feb 10 18:24:04 2012 @@ -1485,12 +1485,21 @@ strm.PutCString(" in "); } } + + AddressRange range; + + sc.GetAddressRange(eSymbolContextEverything, + 0, + true, + range); + sc.DumpStopContext(&strm, exe_scope, - sc.line_entry.range.GetBaseAddress(), + range.GetBaseAddress(), true, true, false); + strm.EOL(); if (verbose) { From scallanan at apple.com Fri Feb 10 19:22:21 2012 From: scallanan at apple.com (Sean Callanan) Date: Sat, 11 Feb 2012 01:22:21 -0000 Subject: [Lldb-commits] [lldb] r150289 - /lldb/trunk/source/Commands/CommandObjectTarget.cpp Message-ID: <20120211012221.B64FC2A6C12D@llvm.org> Author: spyffe Date: Fri Feb 10 19:22:21 2012 New Revision: 150289 URL: http://llvm.org/viewvc/llvm-project?rev=150289&view=rev Log: Made the "--no-inlines" option on "target modules lookup" also work with the "--function" option, so you can search for functions that aren't inlined. This is the same query that the expression parser makes, so it's good for diagnosing situations where the expression parser doesn't find a function you think should be there. Modified: lldb/trunk/source/Commands/CommandObjectTarget.cpp Modified: lldb/trunk/source/Commands/CommandObjectTarget.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectTarget.cpp?rev=150289&r1=150288&r2=150289&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectTarget.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectTarget.cpp Fri Feb 10 19:22:21 2012 @@ -1524,13 +1524,12 @@ } static uint32_t -LookupFunctionInModule (CommandInterpreter &interpreter, Stream &strm, Module *module, const char *name, bool name_is_regex, bool verbose) +LookupFunctionInModule (CommandInterpreter &interpreter, Stream &strm, Module *module, const char *name, bool name_is_regex, bool include_inlines, bool verbose) { if (module && name && name[0]) { SymbolContextList sc_list; const bool include_symbols = false; - const bool include_inlines = true; const bool append = true; uint32_t num_matches = 0; if (name_is_regex) @@ -3132,7 +3131,7 @@ break; case 'i': - m_check_inlines = false; + m_include_inlines = false; break; case 'l': @@ -3176,7 +3175,7 @@ m_offset = 0; m_line_number = 0; m_use_regex = false; - m_check_inlines = true; + m_include_inlines = true; m_verbose = false; } @@ -3196,7 +3195,7 @@ lldb::addr_t m_offset; // Subtract this offset from m_addr before doing lookups. uint32_t m_line_number; // Line number for file+line lookups bool m_use_regex; // Name lookups in m_str are regular expressions. - bool m_check_inlines;// Check for inline entries when looking up by file/line. + bool m_include_inlines;// Check for inline entries when looking up by file/line. bool m_verbose; // Enable verbose lookup info }; @@ -3276,7 +3275,7 @@ module, m_options.m_file, m_options.m_line_number, - m_options.m_check_inlines, + m_options.m_include_inlines, m_options.m_verbose)) { result.SetStatus(eReturnStatusSuccessFinishResult); @@ -3293,6 +3292,7 @@ module, m_options.m_str.c_str(), m_options.m_use_regex, + m_options.m_include_inlines, m_options.m_verbose)) { result.SetStatus(eReturnStatusSuccessFinishResult); @@ -3420,7 +3420,8 @@ { LLDB_OPT_SET_2, true, "symbol", 's', required_argument, NULL, 0, eArgTypeSymbol, "Lookup a symbol by name in the symbol tables in one or more target modules."}, { LLDB_OPT_SET_3, true, "file", 'f', required_argument, NULL, 0, eArgTypeFilename, "Lookup a file by fullpath or basename in one or more target modules."}, { LLDB_OPT_SET_3, false, "line", 'l', required_argument, NULL, 0, eArgTypeLineNum, "Lookup a line number in a file (must be used in conjunction with --file)."}, - { LLDB_OPT_SET_3, false, "no-inlines", 'i', no_argument, NULL, 0, eArgTypeNone, "Check inline line entries (must be used in conjunction with --file)."}, + { LLDB_OPT_SET_3| + LLDB_OPT_SET_4, false, "no-inlines", 'i', no_argument, NULL, 0, eArgTypeNone, "Ignore inline entries (must be used in conjunction with --file or --function)."}, { LLDB_OPT_SET_4, true, "function", 'n', required_argument, NULL, 0, eArgTypeFunctionName, "Lookup a function by name in the debug symbols in one or more target modules."}, { LLDB_OPT_SET_5, true, "type", 't', required_argument, NULL, 0, eArgTypeName, "Lookup a type by name in the debug symbols in one or more target modules."}, { LLDB_OPT_SET_ALL, false, "verbose", 'v', no_argument, NULL, 0, eArgTypeNone, "Enable verbose lookup information."}, @@ -3564,6 +3565,10 @@ } m_sym_ctx_specified = true; break; + + case 'i': + m_no_inlines = true; + break; case 'n': m_function_name = option_arg; @@ -3628,7 +3633,8 @@ m_thread_index = UINT32_MAX; m_thread_name.clear(); m_queue_name.clear(); - + + m_no_inlines = false; m_sym_ctx_specified = false; m_thread_specified = false; @@ -3651,6 +3657,7 @@ std::string m_thread_name; std::string m_queue_name; bool m_sym_ctx_specified; + bool m_no_inlines; bool m_thread_specified; // Instance variables to hold the values for one_liner options. bool m_use_one_liner;