[Lldb-commits] [PATCH] D17597: [LLDB][MIPS] Fix TestDisassembleBreakpoint
nitesh.jain created this revision. nitesh.jain added a reviewer: clayborg. nitesh.jain added subscribers: jaydeep, bhushan, sagar, mohit.bhakkad, lldb-commits. nitesh.jain set the repository for this revision to rL LLVM. The MIPS/MICROMIPS architecture will generate different jump instruction. Repository: rL LLVM http://reviews.llvm.org/D17597 Files: packages/Python/lldbsuite/test/functionalities/disassembly/TestDisassembleBreakpoint.py Index: packages/Python/lldbsuite/test/functionalities/disassembly/TestDisassembleBreakpoint.py === --- packages/Python/lldbsuite/test/functionalities/disassembly/TestDisassembleBreakpoint.py +++ packages/Python/lldbsuite/test/functionalities/disassembly/TestDisassembleBreakpoint.py @@ -42,7 +42,7 @@ instructions = [' add ', ' ldr ', ' str '] elif re.match("mips" , arch): breakpoint_opcodes = ["break"] -instructions = ['lw', 'sw', 'jr'] +instructions = ['lw', 'sw'] else: # TODO please add your arch here self.fail('unimplemented for arch = "{arch}"'.format(arch=self.getArchitecture())) Index: packages/Python/lldbsuite/test/functionalities/disassembly/TestDisassembleBreakpoint.py === --- packages/Python/lldbsuite/test/functionalities/disassembly/TestDisassembleBreakpoint.py +++ packages/Python/lldbsuite/test/functionalities/disassembly/TestDisassembleBreakpoint.py @@ -42,7 +42,7 @@ instructions = [' add ', ' ldr ', ' str '] elif re.match("mips" , arch): breakpoint_opcodes = ["break"] -instructions = ['lw', 'sw', 'jr'] +instructions = ['lw', 'sw'] else: # TODO please add your arch here self.fail('unimplemented for arch = "{arch}"'.format(arch=self.getArchitecture())) ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r261858 - Handle the case when a variable is only valid in part of the enclosing scope
Author: tberghammer Date: Thu Feb 25 06:23:37 2016 New Revision: 261858 URL: http://llvm.org/viewvc/llvm-project?rev=261858&view=rev Log: Handle the case when a variable is only valid in part of the enclosing scope DWARF stores this information in the DW_AT_start_scope attribute. This CL add support for this attribute and also changes the functions displaying frame variables to only display the variables currently in scope. Differential revision: http://reviews.llvm.org/D17449 Modified: lldb/trunk/include/lldb/Core/RangeMap.h lldb/trunk/include/lldb/Symbol/Block.h lldb/trunk/include/lldb/Symbol/Variable.h lldb/trunk/source/API/SBBlock.cpp lldb/trunk/source/API/SBFrame.cpp lldb/trunk/source/Core/Address.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp lldb/trunk/source/Symbol/Block.cpp lldb/trunk/source/Symbol/Variable.cpp lldb/trunk/source/Target/StackFrame.cpp Modified: lldb/trunk/include/lldb/Core/RangeMap.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/RangeMap.h?rev=261858&r1=261857&r2=261858&view=diff == --- lldb/trunk/include/lldb/Core/RangeMap.h (original) +++ lldb/trunk/include/lldb/Core/RangeMap.h Thu Feb 25 06:23:37 2016 @@ -202,7 +202,13 @@ namespace lldb_private { { m_entries.push_back (entry); } - + +void +Append (B base, S size) +{ +m_entries.emplace_back(base, size); +} + bool RemoveEntrtAtIndex (uint32_t idx) { @@ -471,7 +477,13 @@ namespace lldb_private { { m_entries.push_back (entry); } - + +void +Append (B base, S size) +{ +m_entries.emplace_back(base, size); +} + bool RemoveEntrtAtIndex (uint32_t idx) { Modified: lldb/trunk/include/lldb/Symbol/Block.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/Block.h?rev=261858&r1=261857&r2=261858&view=diff == --- lldb/trunk/include/lldb/Symbol/Block.h (original) +++ lldb/trunk/include/lldb/Symbol/Block.h Thu Feb 25 06:23:37 2016 @@ -310,8 +310,9 @@ public: AppendBlockVariables (bool can_create, bool get_child_block_variables, bool stop_if_child_block_is_inlined_function, + const std::function& filter, VariableList *variable_list); - + //-- /// Appends the variables from this block, and optionally from all /// parent blocks, to \a variable_list. @@ -341,9 +342,10 @@ public: /// variable_list. //-- uint32_t -AppendVariables (bool can_create, - bool get_parent_variables, +AppendVariables (bool can_create, + bool get_parent_variables, bool stop_if_block_is_inlined_function, + const std::function& filter, VariableList *variable_list); //-- Modified: lldb/trunk/include/lldb/Symbol/Variable.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/Variable.h?rev=261858&r1=261857&r2=261858&view=diff == --- lldb/trunk/include/lldb/Symbol/Variable.h (original) +++ lldb/trunk/include/lldb/Symbol/Variable.h Thu Feb 25 06:23:37 2016 @@ -17,6 +17,7 @@ #include "lldb/lldb-private.h" #include "lldb/lldb-enumerations.h" #include "lldb/Core/Mangled.h" +#include "lldb/Core/RangeMap.h" #include "lldb/Core/UserID.h" #include "lldb/Expression/DWARFExpression.h" #include "lldb/Symbol/Declaration.h" @@ -27,6 +28,8 @@ class Variable : public UserID, public std::enable_shared_from_this { public: +typedef RangeVector RangeList; + //-- // Constructors and Destructors //-- @@ -36,6 +39,7 @@ public: const lldb::SymbolFileTypeSP &symfile_type_sp, lldb::ValueType scope, SymbolContextScope *owner_scope, + const RangeList& scope_range, Declaration* decl, const DWARFExpression& location, bool external, @@ -178,12 +182,14 @@ public: CompilerDecl GetDecl (); + protected: ConstString m_name; // The basename of the variable (no namespaces) Mangled m_mangled; // The mangled name of the variable lldb::SymbolFileTypeSP m_symf
Re: [Lldb-commits] [PATCH] D17449: Handle the case when a variable is only valid in part of the enclosing scope
This revision was automatically updated to reflect the committed changes. Closed by commit rL261858: Handle the case when a variable is only valid in part of the enclosing scope (authored by tberghammer). Changed prior to commit: http://reviews.llvm.org/D17449?vs=48908&id=49034#toc Repository: rL LLVM http://reviews.llvm.org/D17449 Files: lldb/trunk/include/lldb/Core/RangeMap.h lldb/trunk/include/lldb/Symbol/Block.h lldb/trunk/include/lldb/Symbol/Variable.h lldb/trunk/source/API/SBBlock.cpp lldb/trunk/source/API/SBFrame.cpp lldb/trunk/source/Core/Address.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp lldb/trunk/source/Symbol/Block.cpp lldb/trunk/source/Symbol/Variable.cpp lldb/trunk/source/Target/StackFrame.cpp Index: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp === --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -4091,6 +4091,7 @@ bool location_is_const_value_data = false; bool has_explicit_location = false; DWARFFormValue const_value; +Variable::RangeList scope_ranges; //AccessType accessibility = eAccessNone; for (i=0; iGetDIE(DIERef(form_value)); break; } +case DW_AT_start_scope: +{ +if (form_value.Form() == DW_FORM_sec_offset) +{ +DWARFRangeList dwarf_scope_ranges; +const DWARFDebugRanges* debug_ranges = DebugRanges(); +debug_ranges->FindRanges(form_value.Unsigned(), dwarf_scope_ranges); + +// All DW_AT_start_scope are relative to the base address of the +// compile unit. We add the compile unit base address to make +// sure all the addresses are properly fixed up. +for (size_t i = 0, count = dwarf_scope_ranges.GetSize(); i < count; ++i) +{ +const DWARFRangeList::Entry& range = dwarf_scope_ranges.GetEntryRef(i); +scope_ranges.Append(range.GetRangeBase() + die.GetCU()->GetBaseAddress(), +range.GetByteSize()); +} +} +else +{ +// TODO: Handle the case when DW_AT_start_scope have form constant. The +// dwarf spec is a bit ambiguous about what is the expected behavior in +// case the enclosing block have a non coninious address range and the +// DW_AT_start_scope entry have a form constant. +GetObjectFile()->GetModule()->ReportWarning ("0x%8.8" PRIx64 ": DW_AT_start_scope has unsupported form type (0x%x)\n", + die.GetID(), + form_value.Form()); +} + +scope_ranges.Sort(); +scope_ranges.CombineConsecutiveRanges(); +} case DW_AT_artificial: is_artificial = form_value.Boolean(); break; case DW_AT_accessibility: break; //accessibility = DW_ACCESS_to_AccessType(form_value.Unsigned()); break; case DW_AT_declaration: case DW_AT_description: case DW_AT_endianity: case DW_AT_segment: -case DW_AT_start_scope: case DW_AT_visibility: default: case DW_AT_abstract_origin: @@ -4392,19 +4424,20 @@ if (symbol_context_scope) { SymbolFileTypeSP type_sp(new SymbolFileType(*this, DIERef(type_die_form).GetUID())); - + if (const_value.Form() && type_sp && type_sp->GetType()) location.CopyOpcodeData(const_value.Unsigned(), type_sp->GetType()->GetByteSize(), die.GetCU()->GetAddressByteSize()); - + var_sp.reset (new Variable (die.GetID(), -name, +name, mangled, type_sp, -scope, -symbol_context_scope, -&decl, -locat
[Lldb-commits] [lldb] r261859 - Add support for handling absolute symbols in ELF
Author: tberghammer Date: Thu Feb 25 06:23:43 2016 New Revision: 261859 URL: http://llvm.org/viewvc/llvm-project?rev=261859&view=rev Log: Add support for handling absolute symbols in ELF Most address represented in lldb as section plus offset and handling of absolute addresses is problematic in several location because of lack of necessary information (e.g. Target) or because of performance issues. This CL change the way ObjectFileELF handle the absolute symbols with creating a pseudo section for each symbol. With this change all existing code designed to work with addresses in the form of section plus offset will work with absolute symbols as well. Differential revision: http://reviews.llvm.org/D17450 Modified: lldb/trunk/include/lldb/lldb-enumerations.h lldb/trunk/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp lldb/trunk/source/Symbol/ObjectFile.cpp lldb/trunk/source/Utility/ConvertEnum.cpp Modified: lldb/trunk/include/lldb/lldb-enumerations.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-enumerations.h?rev=261859&r1=261858&r2=261859&view=diff == --- lldb/trunk/include/lldb/lldb-enumerations.h (original) +++ lldb/trunk/include/lldb/lldb-enumerations.h Thu Feb 25 06:23:43 2016 @@ -622,6 +622,7 @@ namespace lldb { eSectionTypeARMextab, eSectionTypeCompactUnwind,// compact unwind section in Mach-O, __TEXT,__unwind_info eSectionTypeGoSymtab, +eSectionTypeAbsoluteAddress, // Dummy section for symbols with absolute address eSectionTypeOther }; Modified: lldb/trunk/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp?rev=261859&r1=261858&r2=261859&view=diff == --- lldb/trunk/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp (original) +++ lldb/trunk/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp Thu Feb 25 06:23:43 2016 @@ -340,7 +340,9 @@ JITLoaderGDB::ReadJITDescriptorImpl(bool if (module_sp && module_sp->GetObjectFile()) { -bool changed; +// load the symbol table right away +module_sp->GetObjectFile()->GetSymtab(); + m_jit_objects.insert(std::make_pair(symbolfile_addr, module_sp)); if (module_sp->GetObjectFile()->GetPluginName() == ConstString("mach-o")) { @@ -360,12 +362,10 @@ JITLoaderGDB::ReadJITDescriptorImpl(bool } else { +bool changed = false; module_sp->SetLoadAddress(target, 0, true, changed); } -// load the symbol table right away -module_sp->GetObjectFile()->GetSymtab(); - module_list.AppendIfNeeded(module_sp); ModuleList module_list; Modified: lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp?rev=261859&r1=261858&r2=261859&view=diff == --- lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp (original) +++ lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp Thu Feb 25 06:23:43 2016 @@ -921,10 +921,14 @@ ObjectFileELF::SetLoadAddress (Target &t // Iterate through the object file sections to find all // of the sections that have SHF_ALLOC in their flag bits. SectionSP section_sp (section_list->GetSectionAtIndex (sect_idx)); -// if (section_sp && !section_sp->IsThreadSpecific()) if (section_sp && section_sp->Test(SHF_ALLOC)) { -lldb::addr_t load_addr = section_sp->GetFileAddress() + value; +lldb::addr_t load_addr = section_sp->GetFileAddress(); +// We don't want to update the load address of a section with type +// eSectionTypeAbsoluteAddress as they already have the absolute load address +// already specified +if (section_sp->GetType() != eSectionTypeAbsoluteAddress) +load_addr += value; // On 32-bit systems the load address have to fit into 4 bytes. The rest of // the bytes are the overflow from the addition. @@ -2058,6 +2062,8 @@ ObjectFileELF::ParseSymbols (Symtab *sym ArchSpec arch; GetArchitecture(arch); +ModuleSP module_sp(GetModule()); +SectionList* module_section_list = module_sp ? module_sp->GetSectionList()
Re: [Lldb-commits] [PATCH] D17450: Add support for handling absolute symbols in ELF
This revision was automatically updated to reflect the committed changes. Closed by commit rL261859: Add support for handling absolute symbols in ELF (authored by tberghammer). Changed prior to commit: http://reviews.llvm.org/D17450?vs=48947&id=49036#toc Repository: rL LLVM http://reviews.llvm.org/D17450 Files: lldb/trunk/include/lldb/lldb-enumerations.h lldb/trunk/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp lldb/trunk/source/Symbol/ObjectFile.cpp lldb/trunk/source/Utility/ConvertEnum.cpp Index: lldb/trunk/source/Symbol/ObjectFile.cpp === --- lldb/trunk/source/Symbol/ObjectFile.cpp +++ lldb/trunk/source/Symbol/ObjectFile.cpp @@ -379,6 +379,7 @@ case eSectionTypeARMextab: case eSectionTypeCompactUnwind: return eAddressClassRuntime; +case eSectionTypeAbsoluteAddress: case eSectionTypeELFSymbolTable: case eSectionTypeELFDynamicSymbols: case eSectionTypeELFRelocationEntries: Index: lldb/trunk/source/Utility/ConvertEnum.cpp === --- lldb/trunk/source/Utility/ConvertEnum.cpp +++ lldb/trunk/source/Utility/ConvertEnum.cpp @@ -115,6 +115,8 @@ return "compact-unwind"; case eSectionTypeGoSymtab: return "go-symtab"; +case eSectionTypeAbsoluteAddress: +return "absolute"; case eSectionTypeOther: return "regular"; } Index: lldb/trunk/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp === --- lldb/trunk/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp +++ lldb/trunk/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp @@ -340,7 +340,9 @@ if (module_sp && module_sp->GetObjectFile()) { -bool changed; +// load the symbol table right away +module_sp->GetObjectFile()->GetSymtab(); + m_jit_objects.insert(std::make_pair(symbolfile_addr, module_sp)); if (module_sp->GetObjectFile()->GetPluginName() == ConstString("mach-o")) { @@ -360,12 +362,10 @@ } else { +bool changed = false; module_sp->SetLoadAddress(target, 0, true, changed); } -// load the symbol table right away -module_sp->GetObjectFile()->GetSymtab(); - module_list.AppendIfNeeded(module_sp); ModuleList module_list; Index: lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp === --- lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp +++ lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp @@ -921,10 +921,14 @@ // Iterate through the object file sections to find all // of the sections that have SHF_ALLOC in their flag bits. SectionSP section_sp (section_list->GetSectionAtIndex (sect_idx)); -// if (section_sp && !section_sp->IsThreadSpecific()) if (section_sp && section_sp->Test(SHF_ALLOC)) { -lldb::addr_t load_addr = section_sp->GetFileAddress() + value; +lldb::addr_t load_addr = section_sp->GetFileAddress(); +// We don't want to update the load address of a section with type +// eSectionTypeAbsoluteAddress as they already have the absolute load address +// already specified +if (section_sp->GetType() != eSectionTypeAbsoluteAddress) +load_addr += value; // On 32-bit systems the load address have to fit into 4 bytes. The rest of // the bytes are the overflow from the addition. @@ -2058,6 +2062,8 @@ ArchSpec arch; GetArchitecture(arch); +ModuleSP module_sp(GetModule()); +SectionList* module_section_list = module_sp ? module_sp->GetSectionList() : nullptr; // Local cache to avoid doing a FindSectionByName for each symbol. The "const char*" key must // came from a ConstString object so they can be compared by pointer @@ -2083,18 +2089,18 @@ SectionSP symbol_section_sp; SymbolType symbol_type = eSymbolTypeInvalid; -Elf64_Half symbol_idx = symbol.st_shndx; +Elf64_Half section_idx = symbol.st_shndx; -switch (symbol_idx) +switch (section_idx) { case SHN_ABS: symbol_type = eSymbolTypeAbsolute; break; case SHN_UNDEF: symbol_
[Lldb-commits] [lldb] r261861 - Improve readability and performance of ClangExpressionParser::FindFunctionInModule
Author: aidandodds Date: Thu Feb 25 07:07:04 2016 New Revision: 261861 URL: http://llvm.org/viewvc/llvm-project?rev=261861&view=rev Log: Improve readability and performance of ClangExpressionParser::FindFunctionInModule Committed on behalf of: Luke Drummond Differential Revision: http://reviews.llvm.org/D17274 Modified: lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp Modified: lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp?rev=261861&r1=261860&r2=261861&view=diff == --- lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp (original) +++ lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp Thu Feb 25 07:07:04 2016 @@ -542,13 +542,12 @@ static bool FindFunctionInModule (ConstS llvm::Module *module, const char *orig_name) { -for (llvm::Module::iterator fi = module->getFunctionList().begin(), fe = module->getFunctionList().end(); - fi != fe; - ++fi) +for (const auto &func : module->getFunctionList()) { -if (fi->getName().str().find(orig_name) != std::string::npos) +const StringRef &name = func.getName(); +if (name.find(orig_name) != StringRef::npos) { -mangled_name.SetCString(fi->getName().str().c_str()); +mangled_name.SetString(name); return true; } } ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D17274: improve readability and performance of ClangExpressionParser::FindFunctionInModule
This revision was automatically updated to reflect the committed changes. Closed by commit rL261861: Improve readability and performance of ClangExpressionParser… (authored by aidandodds). Changed prior to commit: http://reviews.llvm.org/D17274?vs=48003&id=49045#toc Repository: rL LLVM http://reviews.llvm.org/D17274 Files: lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp Index: lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp === --- lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp +++ lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp @@ -542,13 +542,12 @@ llvm::Module *module, const char *orig_name) { -for (llvm::Module::iterator fi = module->getFunctionList().begin(), fe = module->getFunctionList().end(); - fi != fe; - ++fi) +for (const auto &func : module->getFunctionList()) { -if (fi->getName().str().find(orig_name) != std::string::npos) +const StringRef &name = func.getName(); +if (name.find(orig_name) != StringRef::npos) { -mangled_name.SetCString(fi->getName().str().c_str()); +mangled_name.SetString(name); return true; } } Index: lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp === --- lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp +++ lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp @@ -542,13 +542,12 @@ llvm::Module *module, const char *orig_name) { -for (llvm::Module::iterator fi = module->getFunctionList().begin(), fe = module->getFunctionList().end(); - fi != fe; - ++fi) +for (const auto &func : module->getFunctionList()) { -if (fi->getName().str().find(orig_name) != std::string::npos) +const StringRef &name = func.getName(); +if (name.find(orig_name) != StringRef::npos) { -mangled_name.SetCString(fi->getName().str().c_str()); +mangled_name.SetString(name); return true; } } ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D17274: improve readability and performance of ClangExpressionParser::FindFunctionInModule
ldrumm added inline comments. Comment at: source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp:559-560 @@ -558,5 +558,4 @@ -static bool FindFunctionInModule (ConstString &mangled_name, - llvm::Module *module, - const char *orig_name) +static bool +FindFunctionInModule(ConstString &mangled_name, llvm::Module *module, const char *orig_name) { dawn wrote: > ldrumm wrote: > > jingham wrote: > > > Don't make this kind of change, please. As long as the arguments fit in > > > 120 characters we don't have a rule one way or the other about how to > > > write argument lists like this. But changing them just because they look > > > better to you results in unnecessary churn. Moreover, this is changing > > > it away from the way all the other functions in this source file are > > > written, so it ends up looking odd. > > This change is made by clang-fomat using the rules in the lldb > > .clang-format file. > > > > I'm willing to revert this part of the commit, but seeing as this change is > > essentially a refactoring of the whole method, it feels natural to also > > format the prototype while I’m at it. > Please just keep the space before the params and the return type on a > separate line. Sadly, we can't use clang-format for function decls/defs in > lldb because it doesn't support the lldb-style here, so the formatting of > this must be done manually :( Thanks for your comments, Dawn. I appreciate the time it takes - especially after being ill :( @jingham @dawn To step around the style questions completely, I've updated the changelist to ignore the prototype entirely. I hope that suits you both. Thanks again Repository: rL LLVM http://reviews.llvm.org/D17274 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D17604: Add support for DW_OP_push_object_address in dwarf expressions
tberghammer created this revision. tberghammer added reviewers: ovyalov, clayborg. tberghammer added a subscriber: lldb-commits. Add support for DW_OP_push_object_address in dwarf expressions Additionally fix the type of some dwarf expression where we had a confusion between scalar and load address types after a dereference. http://reviews.llvm.org/D17604 Files: include/lldb/Expression/DWARFExpression.h source/Core/ValueObjectVariable.cpp source/Expression/DWARFExpression.cpp source/Plugins/Process/Utility/RegisterContextLLDB.cpp source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp source/Plugins/SymbolFile/DWARF/DWARFASTParserGo.cpp source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp source/Target/StackFrame.cpp Index: source/Target/StackFrame.cpp === --- source/Target/StackFrame.cpp +++ source/Target/StackFrame.cpp @@ -1221,8 +1221,15 @@ if (m_sc.function->GetFrameBaseExpression().IsLocationList()) loclist_base_addr = m_sc.function->GetAddressRange().GetBaseAddress().GetLoadAddress (exe_ctx.GetTargetPtr()); -if (!m_sc.function->GetFrameBaseExpression().Evaluate(&exe_ctx, nullptr, nullptr, nullptr, loclist_base_addr, - nullptr, expr_value, &m_frame_base_error)) +if (m_sc.function->GetFrameBaseExpression().Evaluate(&exe_ctx, + nullptr, + nullptr, + nullptr, + loclist_base_addr, + nullptr, + nullptr, + expr_value, + &m_frame_base_error) == false) { // We should really have an error if evaluate returns, but in case // we don't, lets set the error to something at least. Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp === --- source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -1063,7 +1063,6 @@ if (cu_die) { const char * cu_comp_dir = resolveCompDir(cu_die.GetAttributeValueAsString(DW_AT_comp_dir, nullptr)); - const dw_offset_t stmt_list = cu_die.GetAttributeValueAsUnsigned(DW_AT_stmt_list, DW_INVALID_OFFSET); if (stmt_list != DW_INVALID_OFFSET) { @@ -1832,7 +1831,7 @@ const DWARFExpression &location = var_sp->LocationExpression(); Value location_result; Error error; -if (location.Evaluate(NULL, NULL, NULL, LLDB_INVALID_ADDRESS, NULL, location_result, &error)) +if (location.Evaluate(nullptr, nullptr, nullptr, LLDB_INVALID_ADDRESS, nullptr, nullptr, location_result, &error)) { if (location_result.GetValueType() == Value::eValueTypeFileAddress) { Index: source/Plugins/SymbolFile/DWARF/DWARFASTParserGo.cpp === --- source/Plugins/SymbolFile/DWARF/DWARFASTParserGo.cpp +++ source/Plugins/SymbolFile/DWARF/DWARFASTParserGo.cpp @@ -715,7 +715,7 @@ NULL, // RegisterContext * module_sp, debug_info_data, die.GetCU(), block_offset, block_length, eRegisterKindDWARF, - &initialValue, memberOffset, NULL)) + &initialValue, NULL, memberOffset, NULL)) { member_byte_offset = memberOffset.ResolveValue(NULL).UInt(); } Index: source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp === --- source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp +++ source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp @@ -2702,19 +2702,20 @@ const DWARFDataExtractor& debug_info_data = die.GetDWARF()->get_debug_info_data(); uint32_t block_length = form_va
Re: [Lldb-commits] [PATCH] D17545: Fix PythonDataObjectsTests for python 2
labath added a comment. Any thoughts on this? This is currently the only failing unit test on linux. http://reviews.llvm.org/D17545 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D17107: [lldb] Unicode support on Win32
cameron314 removed rL LLVM as the repository for this revision. cameron314 updated this revision to Diff 49066. cameron314 added a comment. Here's a new version of the patch which takes into account most of the feedback so far (less `#ifdefs`, etc.). It depends on my pending patch in LLVM (http://reviews.llvm.org/D17549) that introduces a few more helper wrappers for UTF conversion. http://reviews.llvm.org/D17107 Files: lldb/trunk/cmake/modules/LLDBConfig.cmake lldb/trunk/include/lldb/Host/FileSystem.h lldb/trunk/include/lldb/Host/posix/HostInfoPosix.h lldb/trunk/include/lldb/Host/windows/HostInfoWindows.h lldb/trunk/packages/Python/lldbsuite/test/dotest.py lldb/trunk/source/Commands/CommandCompletions.cpp lldb/trunk/source/Core/ConnectionSharedMemory.cpp lldb/trunk/source/Core/Disassembler.cpp lldb/trunk/source/Host/common/File.cpp lldb/trunk/source/Host/common/FileSpec.cpp lldb/trunk/source/Host/posix/FileSystem.cpp lldb/trunk/source/Host/posix/HostInfoPosix.cpp lldb/trunk/source/Host/windows/ConnectionGenericFileWindows.cpp lldb/trunk/source/Host/windows/FileSystem.cpp lldb/trunk/source/Host/windows/Host.cpp lldb/trunk/source/Host/windows/HostInfoWindows.cpp lldb/trunk/source/Host/windows/HostProcessWindows.cpp lldb/trunk/source/Host/windows/PipeWindows.cpp lldb/trunk/source/Host/windows/ProcessLauncherWindows.cpp lldb/trunk/source/Host/windows/Windows.cpp lldb/trunk/source/Plugins/Process/Windows/Live/DebuggerThread.cpp lldb/trunk/source/Plugins/Process/Windows/Live/ProcessWindowsLive.cpp lldb/trunk/source/Plugins/Process/Windows/MiniDump/ProcessWinMiniDump.cpp lldb/trunk/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp lldb/trunk/source/Target/ProcessLaunchInfo.cpp lldb/trunk/tools/driver/Driver.cpp lldb/trunk/tools/driver/Platform.h lldb/trunk/tools/lldb-mi/MICmnLLDBDebugSessionInfo.cpp lldb/trunk/tools/lldb-mi/MIUtilFileStd.cpp lldb/trunk/tools/lldb-mi/Platform.h Index: lldb/trunk/tools/lldb-mi/Platform.h === --- lldb/trunk/tools/lldb-mi/Platform.h +++ lldb/trunk/tools/lldb-mi/Platform.h @@ -60,7 +60,7 @@ typedef long pid_t; #define STDIN_FILENO 0 -#define PATH_MAX MAX_PATH +#define PATH_MAX 32768 #define snprintf _snprintf extern int ioctl(int d, int request, ...); Index: lldb/trunk/tools/lldb-mi/MIUtilFileStd.cpp === --- lldb/trunk/tools/lldb-mi/MIUtilFileStd.cpp +++ lldb/trunk/tools/lldb-mi/MIUtilFileStd.cpp @@ -17,6 +17,8 @@ #include "MIUtilFileStd.h" #include "MICmnResources.h" +#include "llvm/Support/ConvertUTF.h" + //++ // Details: CMIUtilFileStd constructor. // Type:Method. @@ -82,7 +84,14 @@ m_pFileHandle = ::fopen(vFileNamePath.c_str(), "wb"); #else // Open a file with exclusive write and shared read permissions -m_pFileHandle = ::_fsopen(vFileNamePath.c_str(), "wb", _SH_DENYWR); +std::wstring path; +if (llvm::ConvertUTF8toWide(vFileNamePath.c_str(), path)) +m_pFileHandle = ::_wfsopen(path.c_str(), L"wb", _SH_DENYWR); +else +{ +errno = EINVAL; +m_pFileHandle = nullptr; +} #endif // !defined( _MSC_VER ) if (m_pFileHandle == nullptr) @@ -222,7 +231,14 @@ return false; FILE *pTmp = nullptr; +#if _WIN32 +std::wstring path; +if (!llvm::ConvertUTF8toWide(vFileNamePath.c_str(), path)) +return false; +pTmp = ::_wfopen(path.c_str(), L"wb"); +#else pTmp = ::fopen(vFileNamePath.c_str(), "wb"); +#endif if (pTmp != nullptr) { ::fclose(pTmp); Index: lldb/trunk/tools/lldb-mi/MICmnLLDBDebugSessionInfo.cpp === --- lldb/trunk/tools/lldb-mi/MICmnLLDBDebugSessionInfo.cpp +++ lldb/trunk/tools/lldb-mi/MICmnLLDBDebugSessionInfo.cpp @@ -27,6 +27,7 @@ #include "MICmnMIValueTuple.h" #include "MICmdData.h" #include "MICmnLLDBUtilSBValue.h" +#include "Platform.h" //++ // Details: CMICmnLLDBDebugSessionInfo constructor. @@ -614,7 +615,7 @@ { lldb::SBFrame &rFrame = const_cast(vrFrame); -static char pBuffer[MAX_PATH]; +static char pBuffer[PATH_MAX]; const MIuint nBytes = rFrame.GetLineEntry().GetFileSpec().GetPath(&pBuffer[0], sizeof(pBuffer)); MIunused(nBytes); CMIUtilString strResolvedPath(&pBuffer[0]); Index: lldb/trunk/tools/driver/Platform.h === --- lldb/trunk/tools/driver/Platform.h +++ lldb/trunk/tools/driver/Platform.h @@ -81,7 +81,7 @@ typedef long pid_t; #define snprintf _snprintf extern sighandler_t signal( int sig, sighandler_t ); -#define PATH_MAX MAX_PATH +#define PATH_MAX 32768 #endif #define STD
Re: [Lldb-commits] [PATCH] D17107: [lldb] Unicode support on Win32
cameron314 added inline comments. Comment at: lldb/trunk/tools/lldb-mi/MICmnLLDBDebugSessionInfo.cpp:618 @@ -616,3 +617,3 @@ -static char pBuffer[MAX_PATH]; +static char pBuffer[PATH_MAX]; const MIuint nBytes = rFrame.GetLineEntry().GetFileSpec().GetPath(&pBuffer[0], sizeof(pBuffer)); Unrelated to this patch, but can this method be called from several threads at once? http://reviews.llvm.org/D17107 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D17545: Fix PythonDataObjectsTests for python 2
Sorry, was out for a few days and i missed this. Seems ok then On Thu, Feb 25, 2016 at 8:25 AM Pavel Labath wrote: > labath added a comment. > > Any thoughts on this? > > This is currently the only failing unit test on linux. > > > http://reviews.llvm.org/D17545 > > > > ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r261901 - Fix PythonDataObjectsTests for python 2
Author: labath Date: Thu Feb 25 11:41:59 2016 New Revision: 261901 URL: http://llvm.org/viewvc/llvm-project?rev=261901&view=rev Log: Fix PythonDataObjectsTests for python 2 Summary: the python2 branch seems erroneous as it expected the object to be both a "String" and "Bytes". Fix the expectation. Reviewers: zturner Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D17545 Modified: lldb/trunk/unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp Modified: lldb/trunk/unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp?rev=261901&r1=261900&r2=261901&view=diff == --- lldb/trunk/unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp (original) +++ lldb/trunk/unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp Thu Feb 25 11:41:59 2016 @@ -209,14 +209,13 @@ TEST_F(PythonDataObjectsTest, TestPython PyObject *py_bytes = PyBytes_FromString(test_bytes); EXPECT_TRUE(PythonBytes::Check(py_bytes)); PythonBytes python_bytes(PyRefType::Owned, py_bytes); -EXPECT_EQ(PyObjectType::Bytes, python_bytes.GetObjectType()); #if PY_MAJOR_VERSION < 3 EXPECT_TRUE(PythonString::Check(py_bytes)); EXPECT_EQ(PyObjectType::String, python_bytes.GetObjectType()); #else EXPECT_FALSE(PythonString::Check(py_bytes)); -EXPECT_NE(PyObjectType::String, python_bytes.GetObjectType()); +EXPECT_EQ(PyObjectType::Bytes, python_bytes.GetObjectType()); #endif llvm::ArrayRef bytes = python_bytes.GetBytes(); ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D17545: Fix PythonDataObjectsTests for python 2
This revision was automatically updated to reflect the committed changes. Closed by commit rL261901: Fix PythonDataObjectsTests for python 2 (authored by labath). Changed prior to commit: http://reviews.llvm.org/D17545?vs=48820&id=49081#toc Repository: rL LLVM http://reviews.llvm.org/D17545 Files: lldb/trunk/unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp Index: lldb/trunk/unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp === --- lldb/trunk/unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp +++ lldb/trunk/unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp @@ -209,14 +209,13 @@ PyObject *py_bytes = PyBytes_FromString(test_bytes); EXPECT_TRUE(PythonBytes::Check(py_bytes)); PythonBytes python_bytes(PyRefType::Owned, py_bytes); -EXPECT_EQ(PyObjectType::Bytes, python_bytes.GetObjectType()); #if PY_MAJOR_VERSION < 3 EXPECT_TRUE(PythonString::Check(py_bytes)); EXPECT_EQ(PyObjectType::String, python_bytes.GetObjectType()); #else EXPECT_FALSE(PythonString::Check(py_bytes)); -EXPECT_NE(PyObjectType::String, python_bytes.GetObjectType()); +EXPECT_EQ(PyObjectType::Bytes, python_bytes.GetObjectType()); #endif llvm::ArrayRef bytes = python_bytes.GetBytes(); Index: lldb/trunk/unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp === --- lldb/trunk/unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp +++ lldb/trunk/unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp @@ -209,14 +209,13 @@ PyObject *py_bytes = PyBytes_FromString(test_bytes); EXPECT_TRUE(PythonBytes::Check(py_bytes)); PythonBytes python_bytes(PyRefType::Owned, py_bytes); -EXPECT_EQ(PyObjectType::Bytes, python_bytes.GetObjectType()); #if PY_MAJOR_VERSION < 3 EXPECT_TRUE(PythonString::Check(py_bytes)); EXPECT_EQ(PyObjectType::String, python_bytes.GetObjectType()); #else EXPECT_FALSE(PythonString::Check(py_bytes)); -EXPECT_NE(PyObjectType::String, python_bytes.GetObjectType()); +EXPECT_EQ(PyObjectType::Bytes, python_bytes.GetObjectType()); #endif llvm::ArrayRef bytes = python_bytes.GetBytes(); ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D17604: Add support for DW_OP_push_object_address in dwarf expressions
clayborg accepted this revision. clayborg added a comment. This revision is now accepted and ready to land. Looks good. http://reviews.llvm.org/D17604 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D17616: Add a set of new plugins to handle Java debugging
tberghammer created this revision. tberghammer added reviewers: ovyalov, clayborg. tberghammer added a subscriber: lldb-commits. Herald added subscribers: danalbert, tberghammer. Add a set of new plugins to handle Java debugging The purpose of these plugins is to make LLDB capable of debugging java code JIT-ed by the android runtime. (P.S.: I know it is a lot of code but it contain very little change in the existing codes and I don't see any reasonable way to split it up) http://reviews.llvm.org/D17616 Files: cmake/LLDBDependencies.cmake include/lldb/Symbol/JavaASTContext.h include/lldb/Symbol/TypeSystem.h source/API/SystemInitializerFull.cpp source/Plugins/Language/CMakeLists.txt source/Plugins/Language/Java/CMakeLists.txt source/Plugins/Language/Java/JavaFormatterFunctions.cpp source/Plugins/Language/Java/JavaFormatterFunctions.h source/Plugins/Language/Java/JavaLanguage.cpp source/Plugins/Language/Java/JavaLanguage.h source/Plugins/LanguageRuntime/CMakeLists.txt source/Plugins/LanguageRuntime/Java/CMakeLists.txt source/Plugins/LanguageRuntime/Java/JavaLanguageRuntime.cpp source/Plugins/LanguageRuntime/Java/JavaLanguageRuntime.h source/Plugins/SymbolFile/DWARF/CMakeLists.txt source/Plugins/SymbolFile/DWARF/DWARFASTParserJava.cpp source/Plugins/SymbolFile/DWARF/DWARFASTParserJava.h source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h source/Symbol/CMakeLists.txt source/Symbol/JavaASTContext.cpp Index: source/Symbol/JavaASTContext.cpp === --- /dev/null +++ source/Symbol/JavaASTContext.cpp @@ -0,0 +1,1526 @@ +//===-- JavaASTContext.cpp --*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===--===// + +#include + +#include "lldb/Core/ArchSpec.h" +#include "lldb/Core/DataExtractor.h" +#include "lldb/Core/Module.h" +#include "lldb/Core/PluginManager.h" +#include "lldb/Core/Stream.h" +#include "lldb/Core/StreamFile.h" +#include "lldb/Core/ValueObject.h" +#include "lldb/Expression/DWARFExpression.h" +#include "lldb/Symbol/CompilerType.h" +#include "lldb/Symbol/JavaASTContext.h" +#include "lldb/Symbol/SymbolFile.h" +#include "lldb/Symbol/Type.h" +#include "lldb/Target/Target.h" + +#include "Plugins/SymbolFile/DWARF/DWARFASTParserJava.h" + +using namespace lldb; +using namespace lldb_private; + +namespace lldb_private +{ + +class JavaASTContext::JavaType +{ +public: +enum LLVMCastKind +{ +eKindPrimitive, +eKindObject, +eKindReference, +eKindArray, +kNumKinds +}; + +JavaType(LLVMCastKind kind) : m_kind(kind) {} + +virtual ~JavaType() = default; + +virtual ConstString +GetName() = 0; + +virtual void +Dump(Stream *s) = 0; + +virtual bool +IsCompleteType() = 0; + +LLVMCastKind +getKind() const +{ +return m_kind; +} + +private: +LLVMCastKind m_kind; +}; + +} // end of namespace lldb_private + +namespace +{ + +class JavaPrimitiveType : public JavaASTContext::JavaType +{ +public: +enum TypeKind +{ +eTypeByte, +eTypeShort, +eTypeInt, +eTypeLong, +eTypeFloat, +eTypeDouble, +eTypeBoolean, +eTypeChar, +}; + +JavaPrimitiveType(TypeKind type_kind) : JavaType(JavaType::eKindPrimitive), m_type_kind(type_kind) {} + +ConstString +GetName() override +{ +switch (m_type_kind) +{ +case eTypeByte: +return ConstString("byte"); +case eTypeShort: +return ConstString("short"); +case eTypeInt: +return ConstString("int"); +case eTypeLong: +return ConstString("long"); +case eTypeFloat: +return ConstString("float"); +case eTypeDouble: +return ConstString("double"); +case eTypeBoolean: +return ConstString("boolean"); +case eTypeChar: +return ConstString("char"); +} +return ConstString(); +} + +TypeKind +GetTypeKind() +{ +return m_type_kind; +} + +void +Dump(Stream *s) override +{ +s->Printf("%s\n", GetName().GetCString()); +} + +bool +IsCompleteType() override +{ +return true; +} + +static bool +classof(const JavaType *jt) +{ +return jt->getKind() == JavaType::eKindPrimitive; +} + +private: +const TypeKind m_type_kind; +}; + +class JavaObjectType : public JavaASTContext::JavaType +{ +public: +struct Field +{ +
Re: [Lldb-commits] [PATCH] D17604: Add support for DW_OP_push_object_address in dwarf expressions
ovyalov accepted this revision. ovyalov added a comment. LGTM http://reviews.llvm.org/D17604 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D17616: Add a set of new plugins to handle Java debugging
clayborg accepted this revision. clayborg added a comment. This revision is now accepted and ready to land. Looks good. http://reviews.llvm.org/D17616 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D17618: Improve looking up functions with equivalent mangled names.
sivachandra created this revision. sivachandra added reviewers: spyffe, clayborg. sivachandra added a subscriber: lldb-commits. This, in a way, extends the existing "workaroud" by matching function argument type names individually [instead of just matching "(args1...)" with "(args2...)"]. For type name matching, a new method CPlusPlusLanguage::TypeNamesEqual has been added. For now, this method can only handle variations like: * vs * const vs const const * const vs const * const We can extend it to handle more complex name formats as needed. The immediate benefit of this change is with evaluating std::map's subscript operator when producer is GCC. Consider the following: std::map m; std::string s("1"); m[s] = "one"; ... ; // Break here The command "expr m[s]" fails without this change if the producer is GCC. http://reviews.llvm.org/D17618 Files: include/lldb/Symbol/SymbolFile.h packages/Python/lldbsuite/test/lang/cpp/stl/TestSTL.py packages/Python/lldbsuite/test/lang/cpp/stl/main.cpp source/Expression/IRExecutionUnit.cpp source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.h source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h source/Symbol/SymbolFile.cpp unittests/CMakeLists.txt unittests/Language/CMakeLists.txt unittests/Language/CPlusPlus/CMakeLists.txt unittests/Language/CPlusPlus/TypeNamesEqualityTest.cpp Index: unittests/Language/CPlusPlus/TypeNamesEqualityTest.cpp === --- /dev/null +++ unittests/Language/CPlusPlus/TypeNamesEqualityTest.cpp @@ -0,0 +1,32 @@ +//===-- ScalarTest.cpp --*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===--===// + +#include "gtest/gtest.h" + +#include "Plugins/Language/CPlusPlus/CPlusPlusLanguage.h" + +using namespace lldb_private; + +TEST(TypeNamesEqualTest, Equality) +{ +ASSERT_TRUE(CPlusPlusLanguage::TypeNamesEqual("int *", "int*")); +ASSERT_TRUE(CPlusPlusLanguage::TypeNamesEqual("unsigned int *", "unsigned int*")); +ASSERT_TRUE(CPlusPlusLanguage::TypeNamesEqual("const unsigned int", "unsigned int const")); +ASSERT_TRUE(CPlusPlusLanguage::TypeNamesEqual("const unsigned int *", "unsigned int const *")); +ASSERT_TRUE(CPlusPlusLanguage::TypeNamesEqual("unsigned int * const", "unsigned int * const")); +} + +TEST(TypeNamesEqualTest, InEquality) +{ +ASSERT_FALSE(CPlusPlusLanguage::TypeNamesEqual("int *", "short int*")); +ASSERT_FALSE(CPlusPlusLanguage::TypeNamesEqual("unsigned int *", "unsigned int")); +ASSERT_FALSE(CPlusPlusLanguage::TypeNamesEqual("const unsigned int", "int const")); +ASSERT_FALSE(CPlusPlusLanguage::TypeNamesEqual("const unsigned int *", "unsigned int * const")); +ASSERT_FALSE(CPlusPlusLanguage::TypeNamesEqual("unsigned int const *", "unsigned int * const")); +} Index: unittests/Language/CPlusPlus/CMakeLists.txt === --- /dev/null +++ unittests/Language/CPlusPlus/CMakeLists.txt @@ -0,0 +1,5 @@ +add_lldb_unittest(LLDBCPlusCPlusLanguageTests + TypeNamesEqualityTest.cpp + ) + + target_link_libraries(lldbPluginCPlusPlusLanguage) Index: unittests/Language/CMakeLists.txt === --- /dev/null +++ unittests/Language/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory(CPlusPlus) Index: unittests/CMakeLists.txt === --- unittests/CMakeLists.txt +++ unittests/CMakeLists.txt @@ -28,5 +28,6 @@ add_subdirectory(Expression) add_subdirectory(Host) add_subdirectory(Interpreter) +add_subdirectory(Language) add_subdirectory(ScriptInterpreter) add_subdirectory(Utility) Index: source/Symbol/SymbolFile.cpp === --- source/Symbol/SymbolFile.cpp +++ source/Symbol/SymbolFile.cpp @@ -135,7 +135,10 @@ } void -SymbolFile::GetMangledNamesForFunction(const std::string &scope_qualified_name, std::vector &mangled_names) +SymbolFile::GetMangledNamesForFunction(const SymbolContext &sc, + const std::string &scope_qualified_name, + const std::vector &arguments, + std::vector &mangled_names) { return; } Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h === --- source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h +++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h @@ -209,7 +209,9 @@ lldb_private::SymbolContextList& sc_li
Re: [Lldb-commits] [PATCH] D17618: Improve looking up functions with equivalent mangled names.
sivachandra updated this revision to Diff 49098. sivachandra added a comment. Fix a comment in file, fix formatting in another. http://reviews.llvm.org/D17618 Files: include/lldb/Symbol/SymbolFile.h packages/Python/lldbsuite/test/lang/cpp/stl/TestSTL.py packages/Python/lldbsuite/test/lang/cpp/stl/main.cpp source/Expression/IRExecutionUnit.cpp source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.h source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h source/Symbol/SymbolFile.cpp unittests/CMakeLists.txt unittests/Language/CMakeLists.txt unittests/Language/CPlusPlus/CMakeLists.txt unittests/Language/CPlusPlus/TypeNamesEqualityTest.cpp Index: unittests/Language/CPlusPlus/TypeNamesEqualityTest.cpp === --- /dev/null +++ unittests/Language/CPlusPlus/TypeNamesEqualityTest.cpp @@ -0,0 +1,32 @@ +//===-- ScalarTest.cpp --*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===--===// + +#include "gtest/gtest.h" + +#include "Plugins/Language/CPlusPlus/CPlusPlusLanguage.h" + +using namespace lldb_private; + +TEST(TypeNamesEqualTest, Equality) +{ +ASSERT_TRUE(CPlusPlusLanguage::TypeNamesEqual("int *", "int*")); +ASSERT_TRUE(CPlusPlusLanguage::TypeNamesEqual("unsigned int *", "unsigned int*")); +ASSERT_TRUE(CPlusPlusLanguage::TypeNamesEqual("const unsigned int", "unsigned int const")); +ASSERT_TRUE(CPlusPlusLanguage::TypeNamesEqual("const unsigned int *", "unsigned int const *")); +ASSERT_TRUE(CPlusPlusLanguage::TypeNamesEqual("unsigned int * const", "unsigned int * const")); +} + +TEST(TypeNamesEqualTest, InEquality) +{ +ASSERT_FALSE(CPlusPlusLanguage::TypeNamesEqual("int *", "short int*")); +ASSERT_FALSE(CPlusPlusLanguage::TypeNamesEqual("unsigned int *", "unsigned int")); +ASSERT_FALSE(CPlusPlusLanguage::TypeNamesEqual("const unsigned int", "int const")); +ASSERT_FALSE(CPlusPlusLanguage::TypeNamesEqual("const unsigned int *", "unsigned int * const")); +ASSERT_FALSE(CPlusPlusLanguage::TypeNamesEqual("unsigned int const *", "unsigned int * const")); +} Index: unittests/Language/CPlusPlus/CMakeLists.txt === --- /dev/null +++ unittests/Language/CPlusPlus/CMakeLists.txt @@ -0,0 +1,5 @@ +add_lldb_unittest(LLDBCPlusCPlusLanguageTests + TypeNamesEqualityTest.cpp + ) + + target_link_libraries(lldbPluginCPlusPlusLanguage) Index: unittests/Language/CMakeLists.txt === --- /dev/null +++ unittests/Language/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory(CPlusPlus) Index: unittests/CMakeLists.txt === --- unittests/CMakeLists.txt +++ unittests/CMakeLists.txt @@ -28,5 +28,6 @@ add_subdirectory(Expression) add_subdirectory(Host) add_subdirectory(Interpreter) +add_subdirectory(Language) add_subdirectory(ScriptInterpreter) add_subdirectory(Utility) Index: source/Symbol/SymbolFile.cpp === --- source/Symbol/SymbolFile.cpp +++ source/Symbol/SymbolFile.cpp @@ -135,7 +135,10 @@ } void -SymbolFile::GetMangledNamesForFunction(const std::string &scope_qualified_name, std::vector &mangled_names) +SymbolFile::GetMangledNamesForFunction(const SymbolContext &sc, + const std::string &scope_qualified_name, + const std::vector &arguments, + std::vector &mangled_names) { return; } Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h === --- source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h +++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h @@ -209,7 +209,9 @@ lldb_private::SymbolContextList& sc_list) override; void -GetMangledNamesForFunction (const std::string &scope_qualified_name, +GetMangledNamesForFunction (const lldb_private::SymbolContext& sc, +const std::string &scope_qualified_name, +const std::vector &arguments, std::vector &mangled_names) override; uint32_t Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp === --- source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -2966,7 +2966,9 @@ } void -SymbolFileDWARF::GetMangledNamesForFunction
[Lldb-commits] [lldb] r261920 - Fix Clang-tidy modernize-use-nullptr and modernize-use-default warnings in source/Commands/CommandObjectTarget.cpp; other minor fixes.
Author: eugenezelenko Date: Thu Feb 25 13:02:39 2016 New Revision: 261920 URL: http://llvm.org/viewvc/llvm-project?rev=261920&view=rev Log: Fix Clang-tidy modernize-use-nullptr and modernize-use-default warnings in source/Commands/CommandObjectTarget.cpp; other minor fixes. 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=261920&r1=261919&r2=261920&view=diff == --- lldb/trunk/source/Commands/CommandObjectTarget.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectTarget.cpp Thu Feb 25 13:02:39 2016 @@ -10,9 +10,9 @@ #include "CommandObjectTarget.h" // C Includes -#include - // C++ Includes +#include + // Other libraries and framework includes // Project includes #include "lldb/Interpreter/Args.h" @@ -58,8 +58,6 @@ using namespace lldb; using namespace lldb_private; - - static void DumpTargetInfo (uint32_t target_idx, Target *target, const char *prefix_cstr, bool show_stopped_process_status, Stream &strm) { @@ -128,7 +126,7 @@ DumpTargetList (TargetList &target_list, { TargetSP selected_target_sp (target_list.GetSelectedTarget()); strm.PutCString ("Current targets:\n"); -for (uint32_t i=0; iGetExecutableSearchPaths ().Append (core_file_dir); -ProcessSP process_sp (target_sp->CreateProcess (m_interpreter.GetDebugger().GetListener(), NULL, &core_file)); +ProcessSP process_sp(target_sp->CreateProcess(m_interpreter.GetDebugger().GetListener(), nullptr, &core_file)); if (process_sp) { @@ -470,17 +467,14 @@ class CommandObjectTargetList : public C { public: CommandObjectTargetList (CommandInterpreter &interpreter) : -CommandObjectParsed (interpreter, - "target list", - "List all current targets in the current debug session.", - NULL, - 0) +CommandObjectParsed(interpreter, +"target list", +"List all current targets in the current debug session.", +nullptr) { } -~CommandObjectTargetList () override -{ -} +~CommandObjectTargetList() override = default; protected: bool @@ -506,7 +500,6 @@ protected: } }; - #pragma mark CommandObjectTargetSelect //-- @@ -517,17 +510,14 @@ class CommandObjectTargetSelect : public { public: CommandObjectTargetSelect (CommandInterpreter &interpreter) : -CommandObjectParsed (interpreter, - "target select", - "Select a target as the current target by target index.", - NULL, - 0) +CommandObjectParsed(interpreter, +"target select", +"Select a target as the current target by target index.", +nullptr) { } -~CommandObjectTargetSelect () override -{ -} +~CommandObjectTargetSelect() override = default; protected: bool @@ -566,7 +556,8 @@ protected: result.AppendErrorWithFormat ("index %u is out of range, valid target indexes are 0 - %u\n", target_idx, num_targets - 1); -} else +} +else { result.AppendErrorWithFormat ("index %u is out of range since there are no active targets\n", target_idx); @@ -599,11 +590,10 @@ class CommandObjectTargetDelete : public { public: CommandObjectTargetDelete (CommandInterpreter &interpreter) : -CommandObjectParsed (interpreter, - "target delete", - "Delete one or more targets by target index.", - NULL, - 0), +CommandObjectParsed(interpreter, +"target delete", +"Delete one or more targets by target index.", +nullptr), m_option_group(interpreter), m_all_option(LLDB_OPT_SET_1, false, "all", 'a', "Delete all targets.", false, true), m_cleanup_option( @@ -621,9 +611,7 @@ public: m_option_group.Finalize(); } -~CommandObjectTargetDelete () override -{ -} +~CommandObjectTargetDelete() override = default; Option
[Lldb-commits] [lldb] r261936 - Fix Clang-tidy modernize-use-nullptr and modernize-use-default warnings in source/Commands/CommandObjectThread.cpp; other minor fixes.
Author: eugenezelenko Date: Thu Feb 25 17:46:36 2016 New Revision: 261936 URL: http://llvm.org/viewvc/llvm-project?rev=261936&view=rev Log: Fix Clang-tidy modernize-use-nullptr and modernize-use-default warnings in source/Commands/CommandObjectThread.cpp; other minor fixes. Modified: lldb/trunk/source/Commands/CommandObjectThread.cpp Modified: lldb/trunk/source/Commands/CommandObjectThread.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectThread.cpp?rev=261936&r1=261935&r2=261936&view=diff == --- lldb/trunk/source/Commands/CommandObjectThread.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectThread.cpp Thu Feb 25 17:46:36 2016 @@ -37,11 +37,9 @@ #include "lldb/Target/ThreadPlanStepRange.h" #include "lldb/Target/ThreadPlanStepInRange.h" - using namespace lldb; using namespace lldb_private; - //- // CommandObjectThreadBacktrace //- @@ -58,7 +56,7 @@ public: { } -~CommandObjectIterateOverThreads() override {} +~CommandObjectIterateOverThreads() override = default; bool DoExecute (Args& command, CommandReturnObject &result) override @@ -112,7 +110,6 @@ public: result.SetStatus (eReturnStatusFailed); return false; } - } for (uint32_t i = 0; i < num_args; i++) @@ -128,7 +125,6 @@ public: } protected: - // Override this to do whatever you need to do for one thread. // // If you return false, the iteration will stop, otherwise it will proceed. @@ -141,7 +137,6 @@ protected: ReturnStatus m_success_return = eReturnStatusSuccessFinishResult; bool m_add_return = true; - }; //- @@ -151,11 +146,9 @@ protected: class CommandObjectThreadBacktrace : public CommandObjectIterateOverThreads { public: - class CommandOptions : public Options { public: - CommandOptions (CommandInterpreter &interpreter) : Options(interpreter) { @@ -163,9 +156,7 @@ public: OptionParsingStarting (); } -~CommandOptions () override -{ -} +~CommandOptions() override = default; Error SetOptionValue (uint32_t option_idx, const char *option_arg) override @@ -206,7 +197,6 @@ public: default: error.SetErrorStringWithFormat("invalid short option character '%c'", short_option); break; - } return error; } @@ -236,22 +226,20 @@ public: }; CommandObjectThreadBacktrace (CommandInterpreter &interpreter) : -CommandObjectIterateOverThreads (interpreter, - "thread backtrace", - "Show the stack for one or more threads. If no threads are specified, show the currently selected thread. Use the thread-index \"all\" to see all threads.", - NULL, - eCommandRequiresProcess | - eCommandRequiresThread| - eCommandTryTargetAPILock | - eCommandProcessMustBeLaunched | - eCommandProcessMustBePaused ), +CommandObjectIterateOverThreads(interpreter, +"thread backtrace", +"Show the stack for one or more threads. If no threads are specified, show the currently selected thread. Use the thread-index \"all\" to see all threads.", +nullptr, +eCommandRequiresProcess | +eCommandRequiresThread| +eCommandTryTargetAPILock | +eCommandProcessMustBeLaunched | +eCommandProcessMustBePaused ), m_options(interpreter) { } -~CommandObjectThreadBacktrace() override -{ -} +~CommandObjectThreadBacktrace() override = default; Options * GetOptions () override @@ -317,10 +305,10 @@ protected: OptionDefinition CommandObjectThreadBacktrace::CommandOptions::g_option_table[] = { -{ LLDB_OPT_SET_1, false, "count", 'c', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeCount, "How many frames to display (-1 for all)"}, -{ LLDB_OPT_SET_1, false, "start", 's', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeFrameIndex, "Frame in which to start the backtrace"}, -{ LLDB_OPT_SET_1, false, "extend
Re: [Lldb-commits] [PATCH] D17616: Add a set of new plugins to handle Java debugging
ovyalov accepted this revision. Comment at: source/Plugins/SymbolFile/DWARF/DWARFASTParserJava.cpp:35 @@ +34,3 @@ +lldb::TypeSP +DWARFASTParserJava::ParseTypeFromDWARF(const lldb_private::SymbolContext &sc, const DWARFDIE &die, + lldb_private::Log *log, bool *type_is_new_ptr) Please consider splitting this method in smaller sub-methods. Comment at: source/Plugins/SymbolFile/DWARF/DWARFASTParserJava.cpp:519 @@ +518,1 @@ +} \ No newline at end of file Please fix. http://reviews.llvm.org/D17616 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D17616: Add a set of new plugins to handle Java debugging
granata.enrico added a subscriber: granata.enrico. Comment at: source/Plugins/Language/Java/JavaLanguage.cpp:81 @@ +80,3 @@ +HardcodedFormatters::HardcodedSummaryFinder +JavaLanguage::GetHardcodedSummaries() +{ Is there any reason to use hardcoded summaries here? It looks like IsJavaString is a trivial textual match on the string "java.lang.String". If so, could you please avoid hardcoding this formatter? The rationale is that an hardcoded formatter can never be turned off by the user, whereas for a normal typename --> formatter match, the user has a way to delete the individual formatter should they desire to do so. Not a big deal, but would be great to fix if possible. http://reviews.llvm.org/D17616 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D17107: [lldb] Unicode support on Win32
amccarth added a comment. I'm growing more comfortable with these changes, but I'll defer to Zach. Comment at: lldb/trunk/source/Host/common/FileSpec.cpp:242 @@ -221,1 +241,3 @@ +path.push_back(0); +path.pop_back(); } I recognize that you're just repeating the pattern from above, but ... This seems whacky and dangerous. It appears the attempt is to put a null terminator on the end, but not count it in the length of the vector. And I guess that we know it's safe here because path is an llvm::SmallVector, so the implementation details are known. But, ugh. If `path` were ever changed to std::vector, we'd no longer have assurance that the terminator remains after the pop. Comment at: lldb/trunk/source/Host/windows/FileSystem.cpp:231 @@ -191,3 +230,3 @@ -char buf[PATH_MAX]; +wchar_t buf[PATH_MAX + 1]; // Subtract 1 from the path length since this function does not add a null terminator. I agree with Zach that a dynamic solution here is better. It's already icky that we have a 32KB stack buffer here. Turning it into a 64KB +1B stack buffer seem egregious. http://reviews.llvm.org/D17107 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r261950 - Fix all of the unannotated switch cases to annotate the fall through or do the right thing and break.
Author: gclayton Date: Thu Feb 25 19:20:20 2016 New Revision: 261950 URL: http://llvm.org/viewvc/llvm-project?rev=261950&view=rev Log: Fix all of the unannotated switch cases to annotate the fall through or do the right thing and break. Modified: lldb/trunk/source/Core/ArchSpec.cpp lldb/trunk/source/Core/FastDemangle.cpp lldb/trunk/source/Core/RegisterValue.cpp lldb/trunk/source/Core/Scalar.cpp lldb/trunk/source/Core/ValueObject.cpp lldb/trunk/source/Expression/IRMemoryMap.cpp lldb/trunk/source/Host/common/SocketAddress.cpp lldb/trunk/source/Host/posix/FileSystem.cpp lldb/trunk/source/Interpreter/CommandInterpreter.cpp lldb/trunk/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.cpp lldb/trunk/source/Plugins/ABI/MacOSX-arm64/ABIMacOSX_arm64.cpp lldb/trunk/source/Plugins/ABI/SysV-arm/ABISysV_arm.cpp lldb/trunk/source/Plugins/ABI/SysV-arm64/ABISysV_arm64.cpp lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp lldb/trunk/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp lldb/trunk/source/Plugins/Language/ObjC/Cocoa.cpp lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp lldb/trunk/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp lldb/trunk/source/Symbol/ObjectFile.cpp lldb/trunk/source/Symbol/Variable.cpp lldb/trunk/source/Target/StackFrameList.cpp lldb/trunk/source/Utility/JSON.cpp lldb/trunk/source/Utility/StringExtractorGDBRemote.cpp lldb/trunk/tools/lldb-server/lldb-gdbserver.cpp Modified: lldb/trunk/source/Core/ArchSpec.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ArchSpec.cpp?rev=261950&r1=261949&r2=261950&view=diff == --- lldb/trunk/source/Core/ArchSpec.cpp (original) +++ lldb/trunk/source/Core/ArchSpec.cpp Thu Feb 25 19:20:20 2016 @@ -1257,6 +1257,7 @@ cores_match (const ArchSpec::Core core1, return true; try_inverse = false; } +break; case ArchSpec::eCore_mips64: if (!enforce_exact_match) @@ -1267,6 +1268,7 @@ cores_match (const ArchSpec::Core core1, return true; try_inverse = false; } +break; case ArchSpec::eCore_mips64el: if (!enforce_exact_match) @@ -1277,6 +1279,7 @@ cores_match (const ArchSpec::Core core1, return true; try_inverse = false; } +break; case ArchSpec::eCore_mips64r2: case ArchSpec::eCore_mips64r3: Modified: lldb/trunk/source/Core/FastDemangle.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/FastDemangle.cpp?rev=261950&r1=261949&r2=261950&view=diff == --- lldb/trunk/source/Core/FastDemangle.cpp (original) +++ lldb/trunk/source/Core/FastDemangle.cpp Thu Feb 25 19:20:20 2016 @@ -2365,6 +2365,7 @@ private: Write('('); Write(m_read_ptr, m_read_end - m_read_ptr); Write(')'); +LLVM_FALLTHROUGH; case '\0': return true; default: Modified: lldb/trunk/source/Core/RegisterValue.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/RegisterValue.cpp?rev=261950&r1=261949&r2=261950&view=diff == --- lldb/trunk/source/Core/RegisterValue.cpp (original) +++ lldb/trunk/source/Core/RegisterValue.cpp Thu Feb 25 19:20:20 2016 @@ -239,16 +239,17 @@ RegisterValue::GetScalarValue (Scalar &s { case eTypeInvalid: break; case eTypeBytes: -{ -switch (buffer.length) { -default:break; -case 1: scalar = *(const uint8_t *)buffer.bytes; return true; -case 2: scalar = *(const uint16_t *)buffer.bytes; return true; -case 4: scalar = *(const uint32_t *)buffer.bytes; return true; -case 8: scalar = *(const uint64_t *)buffer.bytes; return true; +switch (buffer.length) +{ +default:break; +case 1: scalar = *(const uint8_t *)buffer.bytes; return true; +case 2: scalar = *(const uint16_t *)buffer.bytes; return true; +case 4: scalar = *(const uint32_t *)buffer.bytes; return true; +case 8: scalar = *(const uint64_t *)buffer.bytes; return true; +} } -} +break; case eTypeUInt8:
[Lldb-commits] [lldb] r261953 - Add the "block" keyword to "thread step-in -e", and an alias that uses it: "sif " - i.e. step-into-function
Author: jingham Date: Thu Feb 25 19:37:30 2016 New Revision: 261953 URL: http://llvm.org/viewvc/llvm-project?rev=261953&view=rev Log: Add the "block" keyword to "thread step-in -e", and an alias that uses it: "sif " - i.e. step-into-function to allow you to step through a complex calling sequence into a particular function that may span multiple lines. Also some test cases for this and the --step-target feature. Added: lldb/trunk/packages/Python/lldbsuite/test/lang/c/step-target/ lldb/trunk/packages/Python/lldbsuite/test/lang/c/step-target/Makefile lldb/trunk/packages/Python/lldbsuite/test/lang/c/step-target/TestStepTarget.py lldb/trunk/packages/Python/lldbsuite/test/lang/c/step-target/main.c Modified: lldb/trunk/source/Commands/CommandObjectThread.cpp lldb/trunk/source/Interpreter/CommandInterpreter.cpp Added: lldb/trunk/packages/Python/lldbsuite/test/lang/c/step-target/Makefile URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/c/step-target/Makefile?rev=261953&view=auto == --- lldb/trunk/packages/Python/lldbsuite/test/lang/c/step-target/Makefile (added) +++ lldb/trunk/packages/Python/lldbsuite/test/lang/c/step-target/Makefile Thu Feb 25 19:37:30 2016 @@ -0,0 +1,5 @@ +LEVEL = ../../../make + +C_SOURCES := main.c + +include $(LEVEL)/Makefile.rules Added: lldb/trunk/packages/Python/lldbsuite/test/lang/c/step-target/TestStepTarget.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/c/step-target/TestStepTarget.py?rev=261953&view=auto == --- lldb/trunk/packages/Python/lldbsuite/test/lang/c/step-target/TestStepTarget.py (added) +++ lldb/trunk/packages/Python/lldbsuite/test/lang/c/step-target/TestStepTarget.py Thu Feb 25 19:37:30 2016 @@ -0,0 +1,113 @@ +"""Test the 'step target' feature.""" + +from __future__ import print_function + +import os, time +import lldb +from lldbsuite.test.decorators import * +from lldbsuite.test.lldbtest import * +from lldbsuite.test import lldbutil + +class TestStepTarget(TestBase): + +mydir = TestBase.compute_mydir(__file__) + +def getCategories(self): +return ['basic_process'] + +def setUp(self): +# Call super's setUp(). +TestBase.setUp(self) +# Find the line numbers that we will step to in main: +self.main_source = "main.c" +self.end_line = line_number(self.main_source, "All done") + +@add_test_categories(['pyapi']) + +def get_to_start (self): +self.build() +exe = os.path.join(os.getcwd(), "a.out") + +target = self.dbg.CreateTarget(exe) +self.assertTrue(target, VALID_TARGET) + +self.main_source_spec = lldb.SBFileSpec (self.main_source) + +break_in_main = target.BreakpointCreateBySourceRegex ('Break here to try targetted stepping', self.main_source_spec) +self.assertTrue(break_in_main, VALID_BREAKPOINT) +self.assertTrue(break_in_main.GetNumLocations() > 0,"Has locations.") + +# Now launch the process, and do not stop at entry point. +process = target.LaunchSimple (None, None, self.get_process_working_directory()) + +self.assertTrue(process, PROCESS_IS_VALID) + +# The stop reason of the thread should be breakpoint. +threads = lldbutil.get_threads_stopped_at_breakpoint (process, break_in_main) + +if len(threads) != 1: +self.fail ("Failed to stop at first breakpoint in main.") + +thread = threads[0] +return thread + +def test_with_end_line(self): +"""Test stepping over vrs. hitting breakpoints & subsequent stepping in various forms.""" + +thread = self.get_to_start() + +error = lldb.SBError() +thread.StepInto("lotsOfArgs", self.end_line, error) +frame = thread.frames[0] + +self.assertTrue (frame.name == "lotsOfArgs", "Stepped to lotsOfArgs.") + +def test_with_end_line_bad_name(self): +"""Test stepping over vrs. hitting breakpoints & subsequent stepping in various forms.""" + +thread = self.get_to_start() + +error = lldb.SBError() +thread.StepInto("lotsOfArg", self.end_line, error) +frame = thread.frames[0] +self.assertTrue (frame.line_entry.line == self.end_line, "Stepped to the block end.") + +def test_with_end_line_deeper(self): +"""Test stepping over vrs. hitting breakpoints & subsequent stepping in various forms.""" + +thread = self.get_to_start() + +error = lldb.SBError() +thread.StepInto("modifyInt", self.end_line, error) +frame = thread.frames[0] +self.assertTrue (frame.name == "modifyInt", "Stepped to modifyInt.") + +def test_with_command_and_block(self): +"""Test stepping over vrs. hitting breakpoints & subsequent stepping in va
Re: [Lldb-commits] [PATCH] D17618: Improve looking up functions with equivalent mangled names.
sivachandra updated this revision to Diff 49138. sivachandra added a comment. Add more gtest unittests. http://reviews.llvm.org/D17618 Files: include/lldb/Symbol/SymbolFile.h packages/Python/lldbsuite/test/lang/cpp/stl/TestSTL.py packages/Python/lldbsuite/test/lang/cpp/stl/main.cpp source/Expression/IRExecutionUnit.cpp source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.h source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h source/Symbol/SymbolFile.cpp unittests/CMakeLists.txt unittests/Language/CMakeLists.txt unittests/Language/CPlusPlus/CMakeLists.txt unittests/Language/CPlusPlus/SplitIntoArgsTest.cpp unittests/Language/CPlusPlus/TypeNamesEqualityTest.cpp Index: unittests/Language/CPlusPlus/TypeNamesEqualityTest.cpp === --- /dev/null +++ unittests/Language/CPlusPlus/TypeNamesEqualityTest.cpp @@ -0,0 +1,32 @@ +//===-- ScalarTest.cpp --*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===--===// + +#include "gtest/gtest.h" + +#include "Plugins/Language/CPlusPlus/CPlusPlusLanguage.h" + +using namespace lldb_private; + +TEST(TypeNamesEqualTest, Equality) +{ +ASSERT_TRUE(CPlusPlusLanguage::TypeNamesEqual("int *", "int*")); +ASSERT_TRUE(CPlusPlusLanguage::TypeNamesEqual("unsigned int *", "unsigned int*")); +ASSERT_TRUE(CPlusPlusLanguage::TypeNamesEqual("const unsigned int", "unsigned int const")); +ASSERT_TRUE(CPlusPlusLanguage::TypeNamesEqual("const unsigned int *", "unsigned int const *")); +ASSERT_TRUE(CPlusPlusLanguage::TypeNamesEqual("unsigned int * const", "unsigned int * const")); +} + +TEST(TypeNamesEqualTest, InEquality) +{ +ASSERT_FALSE(CPlusPlusLanguage::TypeNamesEqual("int *", "short int*")); +ASSERT_FALSE(CPlusPlusLanguage::TypeNamesEqual("unsigned int *", "unsigned int")); +ASSERT_FALSE(CPlusPlusLanguage::TypeNamesEqual("const unsigned int", "int const")); +ASSERT_FALSE(CPlusPlusLanguage::TypeNamesEqual("const unsigned int *", "unsigned int * const")); +ASSERT_FALSE(CPlusPlusLanguage::TypeNamesEqual("unsigned int const *", "unsigned int * const")); +} Index: unittests/Language/CPlusPlus/SplitIntoArgsTest.cpp === --- /dev/null +++ unittests/Language/CPlusPlus/SplitIntoArgsTest.cpp @@ -0,0 +1,25 @@ +//===-- ScalarTest.cpp --*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===--===// + +#include "gtest/gtest.h" + +#include "Plugins/Language/CPlusPlus/CPlusPlusLanguage.h" + +using namespace lldb_private; + +TEST(SplitIntoArgumentsTest, Equality) +{ +llvm::StringRef input = "(std::basic_string, std::allocator >, std::basic_string, std::allocator >)"; +std::vector args; + +CPlusPlusLanguage::SplitIntoArguments(input, args); +ASSERT_EQ(args.size(), static_cast(2)); +ASSERT_STREQ(args[0].c_str(), "std::basic_string, std::allocator >"); +ASSERT_STREQ(args[1].c_str(), "std::basic_string, std::allocator >"); +} Index: unittests/Language/CPlusPlus/CMakeLists.txt === --- /dev/null +++ unittests/Language/CPlusPlus/CMakeLists.txt @@ -0,0 +1,6 @@ +add_lldb_unittest(LLDBCPlusCPlusLanguageTests + TypeNamesEqualityTest.cpp + SplitIntoArgsTest.cpp + ) + + target_link_libraries(lldbPluginCPlusPlusLanguage) Index: unittests/Language/CMakeLists.txt === --- /dev/null +++ unittests/Language/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory(CPlusPlus) Index: unittests/CMakeLists.txt === --- unittests/CMakeLists.txt +++ unittests/CMakeLists.txt @@ -28,5 +28,6 @@ add_subdirectory(Expression) add_subdirectory(Host) add_subdirectory(Interpreter) +add_subdirectory(Language) add_subdirectory(ScriptInterpreter) add_subdirectory(Utility) Index: source/Symbol/SymbolFile.cpp === --- source/Symbol/SymbolFile.cpp +++ source/Symbol/SymbolFile.cpp @@ -135,7 +135,10 @@ } void -SymbolFile::GetMangledNamesForFunction(const std::string &scope_qualified_name, std::vector &mangled_names) +SymbolFile::GetMangledNamesForFunction(const SymbolContext &sc, + const std::string &scope_qualified_name, +
Re: [Lldb-commits] [lldb] r261953 - Add the "block" keyword to "thread step-in -e", and an alias that uses it: "sif " - i.e. step-into-function
Hi Jim, This broke a lot of our tests on Linux. E.g., "p foo" doesn't work. http://lab.llvm.org:8011/builders/lldb-x86_64-ubuntu-14.04-cmake/builds/11803 Since the breakage is pretty severe, mind if I revert this first until the problem can be fixed? On Thu, Feb 25, 2016 at 5:42 PM Jim Ingham via lldb-commits < lldb-commits@lists.llvm.org> wrote: > Author: jingham > Date: Thu Feb 25 19:37:30 2016 > New Revision: 261953 > > URL: http://llvm.org/viewvc/llvm-project?rev=261953&view=rev > Log: > Add the "block" keyword to "thread step-in -e", and an alias that uses it: > "sif " - i.e. step-into-function > to allow you to step through a complex calling sequence into a particular > function that may span multiple lines. Also some > test cases for this and the --step-target feature. > > > Added: > lldb/trunk/packages/Python/lldbsuite/test/lang/c/step-target/ > lldb/trunk/packages/Python/lldbsuite/test/lang/c/step-target/Makefile > > lldb/trunk/packages/Python/lldbsuite/test/lang/c/step-target/TestStepTarget.py > lldb/trunk/packages/Python/lldbsuite/test/lang/c/step-target/main.c > Modified: > lldb/trunk/source/Commands/CommandObjectThread.cpp > lldb/trunk/source/Interpreter/CommandInterpreter.cpp > > Added: > lldb/trunk/packages/Python/lldbsuite/test/lang/c/step-target/Makefile > URL: > http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/c/step-target/Makefile?rev=261953&view=auto > > == > --- lldb/trunk/packages/Python/lldbsuite/test/lang/c/step-target/Makefile > (added) > +++ lldb/trunk/packages/Python/lldbsuite/test/lang/c/step-target/Makefile > Thu Feb 25 19:37:30 2016 > @@ -0,0 +1,5 @@ > +LEVEL = ../../../make > + > +C_SOURCES := main.c > + > +include $(LEVEL)/Makefile.rules > > Added: > lldb/trunk/packages/Python/lldbsuite/test/lang/c/step-target/TestStepTarget.py > URL: > http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/c/step-target/TestStepTarget.py?rev=261953&view=auto > > == > --- > lldb/trunk/packages/Python/lldbsuite/test/lang/c/step-target/TestStepTarget.py > (added) > +++ > lldb/trunk/packages/Python/lldbsuite/test/lang/c/step-target/TestStepTarget.py > Thu Feb 25 19:37:30 2016 > @@ -0,0 +1,113 @@ > +"""Test the 'step target' feature.""" > + > +from __future__ import print_function > + > +import os, time > +import lldb > +from lldbsuite.test.decorators import * > +from lldbsuite.test.lldbtest import * > +from lldbsuite.test import lldbutil > + > +class TestStepTarget(TestBase): > + > +mydir = TestBase.compute_mydir(__file__) > + > +def getCategories(self): > +return ['basic_process'] > + > +def setUp(self): > +# Call super's setUp(). > +TestBase.setUp(self) > +# Find the line numbers that we will step to in main: > +self.main_source = "main.c" > +self.end_line = line_number(self.main_source, "All done") > + > +@add_test_categories(['pyapi']) > + > +def get_to_start (self): > +self.build() > +exe = os.path.join(os.getcwd(), "a.out") > + > +target = self.dbg.CreateTarget(exe) > +self.assertTrue(target, VALID_TARGET) > + > +self.main_source_spec = lldb.SBFileSpec (self.main_source) > + > +break_in_main = target.BreakpointCreateBySourceRegex ('Break here > to try targetted stepping', self.main_source_spec) > +self.assertTrue(break_in_main, VALID_BREAKPOINT) > +self.assertTrue(break_in_main.GetNumLocations() > 0,"Has > locations.") > + > +# Now launch the process, and do not stop at entry point. > +process = target.LaunchSimple (None, None, > self.get_process_working_directory()) > + > +self.assertTrue(process, PROCESS_IS_VALID) > + > +# The stop reason of the thread should be breakpoint. > +threads = lldbutil.get_threads_stopped_at_breakpoint (process, > break_in_main) > + > +if len(threads) != 1: > +self.fail ("Failed to stop at first breakpoint in main.") > + > +thread = threads[0] > +return thread > + > +def test_with_end_line(self): > +"""Test stepping over vrs. hitting breakpoints & subsequent > stepping in various forms.""" > + > +thread = self.get_to_start() > + > +error = lldb.SBError() > +thread.StepInto("lotsOfArgs", self.end_line, error) > +frame = thread.frames[0] > + > +self.assertTrue (frame.name == "lotsOfArgs", "Stepped to > lotsOfArgs.") > + > +def test_with_end_line_bad_name(self): > +"""Test stepping over vrs. hitting breakpoints & subsequent > stepping in various forms.""" > + > +thread = self.get_to_start() > + > +error = lldb.SBError() > +thread.StepInto("lotsOfArg", self.end_line, error) > +frame = thread.frames[0] > +self.assertTru
Re: [Lldb-commits] [lldb] r261953 - Add the "block" keyword to "thread step-in -e", and an alias that uses it: "sif " - i.e. step-into-function
Jim just headed home - if you don't mind, please revert the commit. He'll look into it tomorrow morning. J > On Feb 25, 2016, at 6:51 PM, Chaoren Lin via lldb-commits > wrote: > > Hi Jim, > > This broke a lot of our tests on Linux. E.g., "p foo" doesn't work. > http://lab.llvm.org:8011/builders/lldb-x86_64-ubuntu-14.04-cmake/builds/11803 > > Since the breakage is pretty severe, mind if I revert this first until the > problem can be fixed? > > On Thu, Feb 25, 2016 at 5:42 PM Jim Ingham via lldb-commits > wrote: > Author: jingham > Date: Thu Feb 25 19:37:30 2016 > New Revision: 261953 > > URL: http://llvm.org/viewvc/llvm-project?rev=261953&view=rev > Log: > Add the "block" keyword to "thread step-in -e", and an alias that uses it: > "sif " - i.e. step-into-function > to allow you to step through a complex calling sequence into a particular > function that may span multiple lines. Also some > test cases for this and the --step-target feature. > > > Added: > lldb/trunk/packages/Python/lldbsuite/test/lang/c/step-target/ > lldb/trunk/packages/Python/lldbsuite/test/lang/c/step-target/Makefile > > lldb/trunk/packages/Python/lldbsuite/test/lang/c/step-target/TestStepTarget.py > lldb/trunk/packages/Python/lldbsuite/test/lang/c/step-target/main.c > Modified: > lldb/trunk/source/Commands/CommandObjectThread.cpp > lldb/trunk/source/Interpreter/CommandInterpreter.cpp > > Added: lldb/trunk/packages/Python/lldbsuite/test/lang/c/step-target/Makefile > URL: > http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/c/step-target/Makefile?rev=261953&view=auto > == > --- lldb/trunk/packages/Python/lldbsuite/test/lang/c/step-target/Makefile > (added) > +++ lldb/trunk/packages/Python/lldbsuite/test/lang/c/step-target/Makefile Thu > Feb 25 19:37:30 2016 > @@ -0,0 +1,5 @@ > +LEVEL = ../../../make > + > +C_SOURCES := main.c > + > +include $(LEVEL)/Makefile.rules > > Added: > lldb/trunk/packages/Python/lldbsuite/test/lang/c/step-target/TestStepTarget.py > URL: > http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/c/step-target/TestStepTarget.py?rev=261953&view=auto > == > --- > lldb/trunk/packages/Python/lldbsuite/test/lang/c/step-target/TestStepTarget.py > (added) > +++ > lldb/trunk/packages/Python/lldbsuite/test/lang/c/step-target/TestStepTarget.py > Thu Feb 25 19:37:30 2016 > @@ -0,0 +1,113 @@ > +"""Test the 'step target' feature.""" > + > +from __future__ import print_function > + > +import os, time > +import lldb > +from lldbsuite.test.decorators import * > +from lldbsuite.test.lldbtest import * > +from lldbsuite.test import lldbutil > + > +class TestStepTarget(TestBase): > + > +mydir = TestBase.compute_mydir(__file__) > + > +def getCategories(self): > +return ['basic_process'] > + > +def setUp(self): > +# Call super's setUp(). > +TestBase.setUp(self) > +# Find the line numbers that we will step to in main: > +self.main_source = "main.c" > +self.end_line = line_number(self.main_source, "All done") > + > +@add_test_categories(['pyapi']) > + > +def get_to_start (self): > +self.build() > +exe = os.path.join(os.getcwd(), "a.out") > + > +target = self.dbg.CreateTarget(exe) > +self.assertTrue(target, VALID_TARGET) > + > +self.main_source_spec = lldb.SBFileSpec (self.main_source) > + > +break_in_main = target.BreakpointCreateBySourceRegex ('Break here to > try targetted stepping', self.main_source_spec) > +self.assertTrue(break_in_main, VALID_BREAKPOINT) > +self.assertTrue(break_in_main.GetNumLocations() > 0,"Has locations.") > + > +# Now launch the process, and do not stop at entry point. > +process = target.LaunchSimple (None, None, > self.get_process_working_directory()) > + > +self.assertTrue(process, PROCESS_IS_VALID) > + > +# The stop reason of the thread should be breakpoint. > +threads = lldbutil.get_threads_stopped_at_breakpoint (process, > break_in_main) > + > +if len(threads) != 1: > +self.fail ("Failed to stop at first breakpoint in main.") > + > +thread = threads[0] > +return thread > + > +def test_with_end_line(self): > +"""Test stepping over vrs. hitting breakpoints & subsequent stepping > in various forms.""" > + > +thread = self.get_to_start() > + > +error = lldb.SBError() > +thread.StepInto("lotsOfArgs", self.end_line, error) > +frame = thread.frames[0] > + > +self.assertTrue (frame.name == "lotsOfArgs", "Stepped to > lotsOfArgs.") > + > +def test_with_end_line_bad_name(self): > +"""Test stepping over vrs. hitting breakpoints & subsequent stepping > in various forms.""" > + > +
[Lldb-commits] [PATCH] D17634: Clear alias argument vector for 'p' alias.
chaoren created this revision. chaoren added a reviewer: jingham. chaoren added a subscriber: lldb-commits. This fixes the 'p' command which should be aliased to 'expresion --'. http://reviews.llvm.org/D17634 Files: source/Interpreter/CommandInterpreter.cpp Index: source/Interpreter/CommandInterpreter.cpp === --- source/Interpreter/CommandInterpreter.cpp +++ source/Interpreter/CommandInterpreter.cpp @@ -337,6 +337,8 @@ AddAlias ("image", cmd_obj_sp); +alias_arguments_vector_sp.reset(new OptionArgVector); + cmd_obj_sp = GetCommandSPExact ("expression", false); if (cmd_obj_sp) { Index: source/Interpreter/CommandInterpreter.cpp === --- source/Interpreter/CommandInterpreter.cpp +++ source/Interpreter/CommandInterpreter.cpp @@ -337,6 +337,8 @@ AddAlias ("image", cmd_obj_sp); +alias_arguments_vector_sp.reset(new OptionArgVector); + cmd_obj_sp = GetCommandSPExact ("expression", false); if (cmd_obj_sp) { ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D17634: Clear alias argument vector for 'p' alias.
This revision was automatically updated to reflect the committed changes. Closed by commit rL261969: Clear alias argument vector for 'p' alias. (authored by chaoren). Changed prior to commit: http://reviews.llvm.org/D17634?vs=49147&id=49148#toc Repository: rL LLVM http://reviews.llvm.org/D17634 Files: lldb/trunk/source/Interpreter/CommandInterpreter.cpp Index: lldb/trunk/source/Interpreter/CommandInterpreter.cpp === --- lldb/trunk/source/Interpreter/CommandInterpreter.cpp +++ lldb/trunk/source/Interpreter/CommandInterpreter.cpp @@ -337,6 +337,8 @@ AddAlias ("image", cmd_obj_sp); +alias_arguments_vector_sp.reset(new OptionArgVector); + cmd_obj_sp = GetCommandSPExact ("expression", false); if (cmd_obj_sp) { Index: lldb/trunk/source/Interpreter/CommandInterpreter.cpp === --- lldb/trunk/source/Interpreter/CommandInterpreter.cpp +++ lldb/trunk/source/Interpreter/CommandInterpreter.cpp @@ -337,6 +337,8 @@ AddAlias ("image", cmd_obj_sp); +alias_arguments_vector_sp.reset(new OptionArgVector); + cmd_obj_sp = GetCommandSPExact ("expression", false); if (cmd_obj_sp) { ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r261969 - Clear alias argument vector for 'p' alias.
Author: chaoren Date: Thu Feb 25 21:36:27 2016 New Revision: 261969 URL: http://llvm.org/viewvc/llvm-project?rev=261969&view=rev Log: Clear alias argument vector for 'p' alias. Summary: This fixes the 'p' command which should be aliased to 'expresion --'. Reviewers: jingham Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D17634 Modified: lldb/trunk/source/Interpreter/CommandInterpreter.cpp Modified: lldb/trunk/source/Interpreter/CommandInterpreter.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandInterpreter.cpp?rev=261969&r1=261968&r2=261969&view=diff == --- lldb/trunk/source/Interpreter/CommandInterpreter.cpp (original) +++ lldb/trunk/source/Interpreter/CommandInterpreter.cpp Thu Feb 25 21:36:27 2016 @@ -337,6 +337,8 @@ CommandInterpreter::Initialize () AddAlias ("image", cmd_obj_sp); +alias_arguments_vector_sp.reset(new OptionArgVector); + cmd_obj_sp = GetCommandSPExact ("expression", false); if (cmd_obj_sp) { ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D17635: Continue after process exit
Honsik created this revision. Honsik added a reviewer: zturner. Honsik added a subscriber: lldb-commits. When process exits, and SBProcess.Continue() is executed, timeout occurs (5secs). Instead error message "Process is not alive" is returned. Added test for this message. Fix of breakpoint case sensitivity test on Linux. http://reviews.llvm.org/D17635 Files: packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_case_sensitivity/TestBreakpointCaseSensitivity.py packages/Python/lldbsuite/test/python_api/process/TestProcessAPI.py source/Target/Process.cpp Index: source/Target/Process.cpp === --- source/Target/Process.cpp +++ source/Target/Process.cpp @@ -1733,6 +1733,10 @@ Error Process::Resume () { +// Cannot resume already exited process +if (!IsAlive()) +return Error("Process is not alive"); + Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_STATE | LIBLLDB_LOG_PROCESS)); if (log) log->Printf("Process::Resume -- locking run lock"); @@ -1749,6 +1753,10 @@ Error Process::ResumeSynchronous (Stream *stream) { +// Cannot resume already exited process +if (!IsAlive()) +return Error("Process is not alive"); + Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_STATE | LIBLLDB_LOG_PROCESS)); if (log) log->Printf("Process::ResumeSynchronous -- locking run lock"); Index: packages/Python/lldbsuite/test/python_api/process/TestProcessAPI.py === --- packages/Python/lldbsuite/test/python_api/process/TestProcessAPI.py +++ packages/Python/lldbsuite/test/python_api/process/TestProcessAPI.py @@ -284,3 +284,40 @@ if self.TraceOn() and error.Success(): print("Number of supported hardware watchpoints: %d" % num) +@add_test_categories(['pyapi']) +def test_continue_after_process_exit(self): +"""Test SBProcess.Continue() API after the process exits.""" +self.build() +exe = os.path.join(os.getcwd(), "a.out") +self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) + +target = self.dbg.CreateTarget(exe) +self.assertTrue(target, VALID_TARGET) + +breakpoint = target.BreakpointCreateByLocation("main.cpp", self.line) +self.assertTrue(breakpoint, VALID_BREAKPOINT) + +# Launch the process, and do not stop at the entry point. +process = target.LaunchSimple (None, None, self.get_process_working_directory()) + +thread = get_stopped_thread(process, lldb.eStopReasonBreakpoint) +self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint") + +frame = thread.GetFrameAtIndex(0) +le = frame.GetLineEntry() +self.assertTrue(le.IsValid(), "There should be valid line entry at breakpoint") +self.assertEqual(self.line, le.GetLine(), "There should be valid line number") + +# Continue the return out of main +err = process.Continue() +self.assertTrue(err.Success(), "Continue after breakpoint should be valid") + +# At this point, the inferior process should have exited. +self.assertEqual(lldb.eStateExited, process.GetState(), PROCESS_EXITED) + +# Continue after proces exited should fail with good message, try it multiple times +for i in range(2): +err = process.Continue() +self.assertTrue(err.Fail(), "Continue after exit shouldn't be valid") +self.assertIn("Process is not alive", err.GetCString()) + \ No newline at end of file Index: packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_case_sensitivity/TestBreakpointCaseSensitivity.py === --- packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_case_sensitivity/TestBreakpointCaseSensitivity.py +++ packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_case_sensitivity/TestBreakpointCaseSensitivity.py @@ -25,7 +25,6 @@ self.case_sensitivity_breakpoint(True) @skipIf(oslist=['windows']) # Skip for windows platforms -@expectedFailureAll() # Failing for unknown reason on non-Windows platforms. def test_breakpoint_doesnt_match_file_with_different_case(self): """Set breakpoint on file, shouldn't match files with different case on POSIX systems""" self.build() @@ -86,15 +85,22 @@ lldb.SBFileSpec(file)) else: breakpoint = self.target.BreakpointCreateByLocation(file, self.line) + +# breakpoint should be always created +self.assertTrue(breakpoint, VALID_BREAKPOINT + desc) -self.assertEqual(breakpoint and breakpoint.GetNumLocations() == 1, -should_hit, +
[Lldb-commits] [lldb] r261974 - Make TestPlatformProcessConnect to support abstract/domain sockets.
Author: ovyalov Date: Thu Feb 25 22:01:58 2016 New Revision: 261974 URL: http://llvm.org/viewvc/llvm-project?rev=261974&view=rev Log: Make TestPlatformProcessConnect to support abstract/domain sockets. Modified: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/platform-process-connect/TestPlatformProcessConnect.py Modified: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/platform-process-connect/TestPlatformProcessConnect.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/platform-process-connect/TestPlatformProcessConnect.py?rev=261974&r1=261973&r2=261974&view=diff == --- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/platform-process-connect/TestPlatformProcessConnect.py (original) +++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/platform-process-connect/TestPlatformProcessConnect.py Thu Feb 25 22:01:58 2016 @@ -1,5 +1,7 @@ from __future__ import print_function +import time + import gdbremote_testcase from lldbsuite.test.decorators import * from lldbsuite.test.lldbtest import * @@ -22,11 +24,21 @@ class TestPlatformProcessConnect(gdbremo if err.Fail(): raise RuntimeError("Unable copy '%s' to '%s'.\n>>> %s" % (f, wd, err.GetCString())) +m = re.search("^(.*)://([^:/]*)", configuration.lldb_platform_url) +protocol = m.group(1) +hostname = m.group(2) +unix_protocol = protocol.startswith("unix-") +if unix_protocol: +p = re.search("^(.*)-connect", protocol) +listen_url = "%s://%s" % (p.group(1), os.path.join(working_dir, "platform-%d.sock" % int(time.time( +else: +listen_url = "*:0" + port_file = "%s/port" % working_dir -commandline_args = ["platform", "--listen", "*:0", "--socket-file", port_file, "--", "%s/a.out" % working_dir, "foo"] +commandline_args = ["platform", "--listen", listen_url, "--socket-file", port_file, "--", "%s/a.out" % working_dir, "foo"] self.spawnSubprocess(self.debug_monitor_exe, commandline_args, install_remote=False) self.addTearDownHook(self.cleanupSubprocesses) -new_port = self.run_shell_cmd("while [ ! -f %s ]; do sleep 0.25; done && cat %s" % (port_file, port_file)) +socket_id = self.run_shell_cmd("while [ ! -f %s ]; do sleep 0.25; done && cat %s" % (port_file, port_file)) new_debugger = lldb.SBDebugger.Create() new_debugger.SetAsync(False) @@ -38,8 +50,12 @@ class TestPlatformProcessConnect(gdbremo new_debugger.SetSelectedPlatform(new_platform) new_interpreter = new_debugger.GetCommandInterpreter() -m = re.search("(.*):[0-9]+", configuration.lldb_platform_url) -command = "platform connect %s:%s" % (m.group(1), new_port) +if unix_protocol: +connect_url = "%s://%s%s" % (protocol, hostname, socket_id) +else: +connect_url = "%s://%s:%s" % (protocol, hostname, socket_id) + +command = "platform connect %s" % (connect_url) result = lldb.SBCommandReturnObject() new_interpreter.HandleCommand(command, result) self.assertTrue(result.Succeeded(), "platform process connect failed: %s" % result.GetOutput()) ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [lldb] r261953 - Add the "block" keyword to "thread step-in -e", and an alias that uses it: "sif " - i.e. step-into-function
It's okay. I think I fixed it with http://reviews.llvm.org/D17634 On Thu, Feb 25, 2016 at 6:55 PM, Jason Molenda wrote: > Jim just headed home - if you don't mind, please revert the commit. He'll > look into it tomorrow morning. > > J > > > > On Feb 25, 2016, at 6:51 PM, Chaoren Lin via lldb-commits < > lldb-commits@lists.llvm.org> wrote: > > > > Hi Jim, > > > > This broke a lot of our tests on Linux. E.g., "p foo" doesn't work. > > > http://lab.llvm.org:8011/builders/lldb-x86_64-ubuntu-14.04-cmake/builds/11803 > > > > Since the breakage is pretty severe, mind if I revert this first until > the problem can be fixed? > > > > On Thu, Feb 25, 2016 at 5:42 PM Jim Ingham via lldb-commits < > lldb-commits@lists.llvm.org> wrote: > > Author: jingham > > Date: Thu Feb 25 19:37:30 2016 > > New Revision: 261953 > > > > URL: http://llvm.org/viewvc/llvm-project?rev=261953&view=rev > > Log: > > Add the "block" keyword to "thread step-in -e", and an alias that uses > it: "sif " - i.e. step-into-function > > to allow you to step through a complex calling sequence into a > particular function that may span multiple lines. Also some > > test cases for this and the --step-target feature. > > > > > > Added: > > lldb/trunk/packages/Python/lldbsuite/test/lang/c/step-target/ > > lldb/trunk/packages/Python/lldbsuite/test/lang/c/step-target/Makefile > > > > lldb/trunk/packages/Python/lldbsuite/test/lang/c/step-target/TestStepTarget.py > > lldb/trunk/packages/Python/lldbsuite/test/lang/c/step-target/main.c > > Modified: > > lldb/trunk/source/Commands/CommandObjectThread.cpp > > lldb/trunk/source/Interpreter/CommandInterpreter.cpp > > > > Added: > lldb/trunk/packages/Python/lldbsuite/test/lang/c/step-target/Makefile > > URL: > http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/c/step-target/Makefile?rev=261953&view=auto > > > == > > --- > lldb/trunk/packages/Python/lldbsuite/test/lang/c/step-target/Makefile > (added) > > +++ > lldb/trunk/packages/Python/lldbsuite/test/lang/c/step-target/Makefile Thu > Feb 25 19:37:30 2016 > > @@ -0,0 +1,5 @@ > > +LEVEL = ../../../make > > + > > +C_SOURCES := main.c > > + > > +include $(LEVEL)/Makefile.rules > > > > Added: > lldb/trunk/packages/Python/lldbsuite/test/lang/c/step-target/TestStepTarget.py > > URL: > http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/c/step-target/TestStepTarget.py?rev=261953&view=auto > > > == > > --- > lldb/trunk/packages/Python/lldbsuite/test/lang/c/step-target/TestStepTarget.py > (added) > > +++ > lldb/trunk/packages/Python/lldbsuite/test/lang/c/step-target/TestStepTarget.py > Thu Feb 25 19:37:30 2016 > > @@ -0,0 +1,113 @@ > > +"""Test the 'step target' feature.""" > > + > > +from __future__ import print_function > > + > > +import os, time > > +import lldb > > +from lldbsuite.test.decorators import * > > +from lldbsuite.test.lldbtest import * > > +from lldbsuite.test import lldbutil > > + > > +class TestStepTarget(TestBase): > > + > > +mydir = TestBase.compute_mydir(__file__) > > + > > +def getCategories(self): > > +return ['basic_process'] > > + > > +def setUp(self): > > +# Call super's setUp(). > > +TestBase.setUp(self) > > +# Find the line numbers that we will step to in main: > > +self.main_source = "main.c" > > +self.end_line = line_number(self.main_source, "All done") > > + > > +@add_test_categories(['pyapi']) > > + > > +def get_to_start (self): > > +self.build() > > +exe = os.path.join(os.getcwd(), "a.out") > > + > > +target = self.dbg.CreateTarget(exe) > > +self.assertTrue(target, VALID_TARGET) > > + > > +self.main_source_spec = lldb.SBFileSpec (self.main_source) > > + > > +break_in_main = target.BreakpointCreateBySourceRegex ('Break > here to try targetted stepping', self.main_source_spec) > > +self.assertTrue(break_in_main, VALID_BREAKPOINT) > > +self.assertTrue(break_in_main.GetNumLocations() > 0,"Has > locations.") > > + > > +# Now launch the process, and do not stop at entry point. > > +process = target.LaunchSimple (None, None, > self.get_process_working_directory()) > > + > > +self.assertTrue(process, PROCESS_IS_VALID) > > + > > +# The stop reason of the thread should be breakpoint. > > +threads = lldbutil.get_threads_stopped_at_breakpoint (process, > break_in_main) > > + > > +if len(threads) != 1: > > +self.fail ("Failed to stop at first breakpoint in main.") > > + > > +thread = threads[0] > > +return thread > > + > > +def test_with_end_line(self): > > +"""Test stepping over vrs. hitting breakpoints & subsequent > stepping in various forms.""" > > + > > +thread = self.get_to_start() > > +