Re: [Lldb-commits] [lldb] r277117 - Fix -break-insert not working when using absolute paths (MI)
For LLDB, I think it's up to Greg to decide. On Tue, Aug 2, 2016 at 10:20 PM, Ilia K wrote: > Hi Hans! > > The author of this commit asks me is there a chance to include this changes > to 3.9 release? I'm not sure about our policy when RC has already been > tagged. > > On Fri, Jul 29, 2016 at 9:01 AM, Ilia K via lldb-commits > wrote: >> >> Author: ki.stfu >> Date: Fri Jul 29 01:01:20 2016 >> New Revision: 277117 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=277117&view=rev >> Log: >> Fix -break-insert not working when using absolute paths (MI) >> >> Summary: >> When trying to parse the -break-insert arguments as a named location, the >> string parsing was not configured to allow directory paths. This patch adds >> a constructor to allow the parsing of string as directory path along with >> the other parameters. >> >> This fixes https://llvm.org/bugs/show_bug.cgi?id=28709 >> >> Patch from malape...@gmail.com >> Reviewers: clayborg, ki.stfu >> Subscribers: lldb-commits, ki.stfu >> Differential Revision: https://reviews.llvm.org/D22902 >> >> >> Modified: >> >> lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/breakpoint/TestMiBreak.py >> lldb/trunk/tools/lldb-mi/MICmdArgValString.cpp >> lldb/trunk/tools/lldb-mi/MICmdArgValString.h >> lldb/trunk/tools/lldb-mi/MICmdCmdBreak.cpp >> >> Modified: >> lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/breakpoint/TestMiBreak.py >> URL: >> http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/breakpoint/TestMiBreak.py?rev=277117&r1=277116&r2=277117&view=diff >> >> == >> --- >> lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/breakpoint/TestMiBreak.py >> (original) >> +++ >> lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/breakpoint/TestMiBreak.py >> Fri Jul 29 01:01:20 2016 >> @@ -155,7 +155,6 @@ class MiBreakTestCase(lldbmi_testcase.Mi >> >> @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on >> Windows >> @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known >> thread races >> -@unittest2.expectedFailure("-break-insert doesn't work for absolute >> path") >> def test_lldbmi_break_insert_file_line_absolute_path(self): >> """Test that 'lldb-mi --interpreter' works for file:line >> breakpoints.""" >> >> >> Modified: lldb/trunk/tools/lldb-mi/MICmdArgValString.cpp >> URL: >> http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MICmdArgValString.cpp?rev=277117&r1=277116&r2=277117&view=diff >> >> == >> --- lldb/trunk/tools/lldb-mi/MICmdArgValString.cpp (original) >> +++ lldb/trunk/tools/lldb-mi/MICmdArgValString.cpp Fri Jul 29 01:01:20 >> 2016 >> @@ -85,6 +85,30 @@ CMICmdArgValString::CMICmdArgValString(c >> } >> >> //++ >> >> +// Details: CMICmdArgValString constructor. >> +// Type:Method. >> +// Args:vrArgName - (R) Argument's name to search by. >> +// vbMandatory - (R) True = Yes must be present, false = >> optional argument. >> +// vbHandleByCmd - (R) True = Command processes *this option, >> false = not handled. >> +// vbHandleQuotes - (R) True = Parse a string surrounded by >> quotes spaces are not delimiters, false = only text up to >> +// next delimiting space character. >> +// vbAcceptNumbers - (R) True = Parse a string and accept as a >> number if number, false = numbers not recognised as >> +// vbHandleDirPaths - (R) True = Parse a string and accept as a >> file path if a path, false = file paths are not >> +// string types. >> +// Return: None. >> +// Throws: None. >> +//-- >> +CMICmdArgValString::CMICmdArgValString(const CMIUtilString &vrArgName, >> const bool vbMandatory, const bool vbHandleByCmd, >> + const bool vbHandleQuotes, const bool vbAcceptNumbers, >> const bool vbHandleDirPaths) >> +: CMICmdArgValBaseTemplate(vrArgName, vbMandatory, vbHandleByCmd) >> +, m_bHandleQuotedString(vbHandleQuotes) >> +, m_bAcceptNumbers(vbAcceptNumbers) >> +, m_bHandleDirPaths(vbHandleDirPaths) >> +, m_bHandleAnything(false) >> +{ >> +} >> + >> +//++ >> >> // Details: CMICmdArgValString destructor. >> // Type:Overridden. >> // Args:None. >> >> Modified: lldb/trunk/tools/lldb-mi/MICmdArgValString.h >> URL: >> http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MICmdArgValString.h?rev=277117&r1=277116&r2=277117&view=diff >> >> == >> --- lldb/trunk/tools/lldb-mi/MICmdArgValString.h (original) >> +++ lldb/trunk/tools/lldb-mi/MICmdArgValString.h Fri Jul 29 01:01:20 2016 >> @@ -32,6 +32,8 @@ class CMICmdArgValString : public CM
[Lldb-commits] [lldb] r277608 - Fix an unused variable warning in release builds.
Author: ldrumm Date: Wed Aug 3 11:29:45 2016 New Revision: 277608 URL: http://llvm.org/viewvc/llvm-project?rev=277608&view=rev Log: Fix an unused variable warning in release builds. ``num_params`` was unused in RenderScript ABI fixup pass ``cloneToStructRetFnTy`` and was only used in an `assert()` that the number of function parameters for the cloned function was correct. Now we actually use this variable, rather than recomputing it, and avoid the unused variable warning when building without asserts enabled. Subscribers: lldb-commits Modified: lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptx86ABIFixups.cpp Modified: lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptx86ABIFixups.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptx86ABIFixups.cpp?rev=277608&r1=277607&r2=277608&view=diff == --- lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptx86ABIFixups.cpp (original) +++ lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptx86ABIFixups.cpp Wed Aug 3 11:29:45 2016 @@ -103,8 +103,8 @@ cloneToStructRetFnTy(llvm::CallInst *cal if (log) log->Printf("%s - cloning to StructRet function for '%s'", __FUNCTION__, name.str().c_str()); -std::vector new_params{orig_type->getNumParams() + 1, nullptr}; unsigned num_params = orig_type->getNumParams(); +std::vector new_params{num_params + 1, nullptr}; std::vector params{orig_type->param_begin(), orig_type->param_end()}; // This may not work if the function is somehow declared void as llvm is strongly typed ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r277613 - [RenderScript] Always create a new allocation ID in CaptureAllocationInit hook
Author: ldrumm Date: Wed Aug 3 12:31:58 2016 New Revision: 277613 URL: http://llvm.org/viewvc/llvm-project?rev=277613&view=rev Log: [RenderScript] Always create a new allocation ID in CaptureAllocationInit hook Due to internal reuse of buffers in the RenderScript runtime by the system allocator, comparing pointers is not a safe way to check whether an allocation is tracked by lldb. This change updates the lldb RenderScript internal hook callback to properly identify and remove old allocations that had have an address that is currently being tracked. This change also removes the need for `lldb_private::renderscript::LookupAllocation` to take a `create` flag, as this is now always the case. Original Author: Subscribers: lldb-commits Modified: lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h Modified: lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp?rev=277613&r1=277612&r2=277613&view=diff == --- lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp (original) +++ lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp Wed Aug 3 12:31:58 2016 @@ -1091,7 +1091,10 @@ RenderScriptRuntime::CaptureScriptInvoke // for all allocations we have found for (const uint64_t alloc_addr : allocs) { -AllocationDetails* alloc = LookUpAllocation(alloc_addr, true); +AllocationDetails *alloc = LookUpAllocation(alloc_addr); +if (!alloc) +alloc = CreateAllocation(alloc_addr); + if (alloc) { // save the allocation address @@ -1207,7 +1210,7 @@ RenderScriptRuntime::CaptureAllocationIn log->Printf("%s - 0x%" PRIx64 ",0x%" PRIx64 ",0x%" PRIx64 " .", __FUNCTION__, uint64_t(args[eRsContext]), uint64_t(args[eRsAlloc]), uint64_t(args[eRsForceZero])); -AllocationDetails *alloc = LookUpAllocation(uint64_t(args[eRsAlloc]), true); +AllocationDetails *alloc = CreateAllocation(uint64_t(args[eRsAlloc])); if (alloc) alloc->context = uint64_t(args[eRsContext]); } @@ -3467,7 +3470,7 @@ RenderScriptRuntime::LookUpScript(addr_t } RenderScriptRuntime::AllocationDetails * -RenderScriptRuntime::LookUpAllocation(addr_t address, bool create) +RenderScriptRuntime::LookUpAllocation(addr_t address) { for (const auto &a : m_allocations) { @@ -3475,14 +3478,35 @@ RenderScriptRuntime::LookUpAllocation(ad if (*a->address == address) return a.get(); } -if (create) +return nullptr; +} + +RenderScriptRuntime::AllocationDetails * +RenderScriptRuntime::CreateAllocation(addr_t address) +{ +Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE); + +// Remove any previous allocation which contains the same address +auto it = m_allocations.begin(); +while (it != m_allocations.end()) { -std::unique_ptr a(new AllocationDetails); -a->address = address; -m_allocations.push_back(std::move(a)); -return m_allocations.back().get(); +if (*((*it)->address) == address) +{ +if (log) +log->Printf("%s - Removing allocation id: %d, address: 0x%" PRIx64, __FUNCTION__, (*it)->id, address); + +it = m_allocations.erase(it); +} +else +{ +it++; +} } -return nullptr; + +std::unique_ptr a(new AllocationDetails); +a->address = address; +m_allocations.push_back(std::move(a)); +return m_allocations.back().get(); } void Modified: lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h?rev=277613&r1=277612&r2=277613&view=diff == --- lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h (original) +++ lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h Wed Aug 3 12:31:58 2016 @@ -408,10 +408,13 @@ private: // Search for a previously saved allocation detail object using a target address. // If an allocation does not exist for this address then nullptr will be returned. -// If 'create' is true and there is no previous allocation then a new allocation -// detail object will be created for this address and returned. AllocationDetails *
Re: [Lldb-commits] [PATCH] D22831: [LLDB] Documentation for SBAddress class
jafl updated this revision to Diff 66678. jafl added a comment. Incorporated feedback Repository: rL LLVM https://reviews.llvm.org/D22831 Files: include/lldb/API/SBAddress.h Index: include/lldb/API/SBAddress.h === --- include/lldb/API/SBAddress.h +++ include/lldb/API/SBAddress.h @@ -15,6 +15,74 @@ namespace lldb { +//-- +/// \class SBAddress +/// +/// Represents an address. An address may refer to code or data from an +/// existing module (SBModule), or it may refer to something on the stack +/// or heap. +/// +/// SBAddress objects can represent two types of addresses: file address +/// and load address. +/// +/// File addresses refer to the raw address as it is known in the object +/// file that the module is using. File addresses will match the virtual +/// addresses that are found in the object file, such as the address values +/// in the symbols in the native symbol tables, unwind tables and any other +/// data structures in the object file format (ELF, mach-o, COFF). File +/// addresses are not unique across multiple modules as many modules might +/// contain a file address of 0x0 (possibly the first function in the .text +/// section) since many object files, like shared libraries, have their +/// virtual addresses start at 0x0. +/// +/// Load addresses represent a unique location within a process' address +/// space. A load address might represent a section/offset address within a +/// process. In this case the SBAddress will have a valid section +/// (lldb::SBAddress::GetSection() will return a SBSection that is valid), +/// and a valid offset (lldb::addr_t lldb::SBAddress::GetOffset()) into +/// that section. Or a load address might represent a unique location in +/// the process' memory space that doesn't resolve to a section within an +/// object file, like a location on the stack or heap. In this case the +/// address will not have a valid section (lldb::SBSection +/// lldb::SBAddress::GetSection() will return a SBSection that is *not* +/// valid), and lldb::SBAddress::GetOffset() will return the value load +/// address. +/// +/// If an address has a valid section, the address might refer to things +/// found in the debug information: +/// +/// SBModule - the module that contains the section +/// SBCompileUnit - the source file that was compiled to create this code +/// SBFunction - the function that contains this address +/// SBBlock - the deepest lexical block that contains the address within the SBFucntion +/// SBLineEntry - the file and line and column that contains the address +/// SBVariable - the static/global variable that contains the address +/// +/// If there is no debug information, then the address might also refer to +/// a symbol from the symbol table: +/// +/// SBSymbol - the symbol that contains the address +/// +/// If an address comes from an existing module, then it will be resolved +/// into an offset from its containing section in that module. That way it +/// can refer to the same logical location in the module that holds it even +/// if the module is unloaded and loaded at different addresses. Module +/// based SBAddresses are not bound to a particular target or process, but +/// you can ask the SBAddress where/if it has been loaded in a particular +/// target. +/// +/// The individual Get*() functions grab individual objects for a given +/// address and are less efficient if you want more than one symbol related +/// objects. Use one of the following when you want multiple debug symbol +/// related objects for an address: +/// ~~~ +/// * lldb::SBSymbolContext SBAddress::GetSymbolContext (uint32_t resolve_scope); +/// * lldb::SBSymbolContext SBTarget::ResolveSymbolContextForAddress (const SBAddress &addr, uint32_t resolve_scope); +/// ~~~ +/// One or more bits from the SymbolContextItem enumerations can be +/// logically OR'ed together to more efficiently retrieve multiple symbol +/// objects. +//-- class LLDB_API SBAddress { public: @@ -33,73 +101,203 @@ const lldb::SBAddress & operator = (const lldb::SBAddress &rhs); +//-- +/// @return +/// true if the object is valid. If the object is invalid, it is +/// not safe to call any other methods. +//-- bool IsValid () const; +//-- +/// Clears the address. The object is no longer valid. +//-- void Clear (); +//-- +/// Get the file address. +/// +/// @return +/// The valid file address, or LLDB_INVALI
Re: [Lldb-commits] [lldb] r277443 - Support for OCaml native debugging
Just finishing off a test build. Give me a minute and I'll check it in. Jim > On Aug 3, 2016, at 2:22 PM, Tamas Berghammer via lldb-commits > wrote: > > It is failing because the new files have to be added to the xcode project. > Currently I don't have a Mac around to do it but if nobody fixes it then I > will try to find one. > > Tamás > > On Wed, 3 Aug 2016, 21:17 Tim Hammerquist, wrote: > Hi Tamas, > > It looks like the LLDB Build and Check job started failing around the time of > this commit. You can see the error at this link: > > http://lab.llvm.org:8080/green/job/lldb_build_test/19751/consoleFull#-1586822805dd1929ea-7054-4089-b7ef-4624c3781fa4 > > Could you take a look? > > Thanks, > -Tim > > > On Tue, Aug 2, 2016 at 4:15 AM, Tamas Berghammer via lldb-commits > wrote: > Author: tberghammer > Date: Tue Aug 2 06:15:55 2016 > New Revision: 277443 > > URL: http://llvm.org/viewvc/llvm-project?rev=277443&view=rev > Log: > Support for OCaml native debugging > > This introduces basic support for debugging OCaml binaries. > Use of the native compiler with DWARF emission support (see > https://github.com/ocaml/ocaml/pull/574) is required. > > Available variables are considered as 64 bits unsigned integers, > their interpretation will be left to a OCaml-made debugging layer. > > Differential revision: https://reviews.llvm.org/D22132 > > Added: > lldb/trunk/include/lldb/Symbol/OCamlASTContext.h > lldb/trunk/source/Plugins/Language/OCaml/ > lldb/trunk/source/Plugins/Language/OCaml/CMakeLists.txt > lldb/trunk/source/Plugins/Language/OCaml/OCamlLanguage.cpp > lldb/trunk/source/Plugins/Language/OCaml/OCamlLanguage.h > lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserOCaml.cpp > lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserOCaml.h > lldb/trunk/source/Symbol/OCamlASTContext.cpp > Modified: > lldb/trunk/cmake/LLDBDependencies.cmake > lldb/trunk/include/lldb/Symbol/TypeSystem.h > lldb/trunk/source/API/SystemInitializerFull.cpp > lldb/trunk/source/Plugins/Language/CMakeLists.txt > lldb/trunk/source/Plugins/SymbolFile/DWARF/CMakeLists.txt > lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h > lldb/trunk/source/Symbol/CMakeLists.txt > > Modified: lldb/trunk/cmake/LLDBDependencies.cmake > URL: > http://llvm.org/viewvc/llvm-project/lldb/trunk/cmake/LLDBDependencies.cmake?rev=277443&r1=277442&r2=277443&view=diff > == > --- lldb/trunk/cmake/LLDBDependencies.cmake (original) > +++ lldb/trunk/cmake/LLDBDependencies.cmake Tue Aug 2 06:15:55 2016 > @@ -27,6 +27,7 @@ set( LLDB_USED_LIBS >lldbPluginJavaLanguage >lldbPluginObjCLanguage >lldbPluginObjCPlusPlusLanguage > + lldbPluginOCamlLanguage > >lldbPluginObjectFileELF >lldbPluginObjectFileJIT > > Added: lldb/trunk/include/lldb/Symbol/OCamlASTContext.h > URL: > http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/OCamlASTContext.h?rev=277443&view=auto > == > --- lldb/trunk/include/lldb/Symbol/OCamlASTContext.h (added) > +++ lldb/trunk/include/lldb/Symbol/OCamlASTContext.h Tue Aug 2 06:15:55 2016 > @@ -0,0 +1,355 @@ > +//===-- OCamlASTContext.h --*- C++ > -*-===// > +// > +// The LLVM Compiler Infrastructure > +// > +// This file is distributed under the University of Illinois Open Source > +// License. See LICENSE.TXT for details. > +// > +//===--===// > + > +#ifndef liblldb_OCamlASTContext_h_ > +#define liblldb_OCamlASTContext_h_ > + > +// C Includes > +// C++ Includes > +#include > +#include > +#include > +#include > +#include > + > +// Other libraries and framework includes > +// Project includes > +#include "lldb/Core/ConstString.h" > +#include "lldb/Symbol/TypeSystem.h" > +#include "lldb/Symbol/CompilerType.h" > + > +namespace lldb_private > +{ > + > +class OCamlASTContext : public TypeSystem > +{ > + public: > +class OCamlType; > +typedef std::map> OCamlTypeMap; > + > +OCamlASTContext(); > +~OCamlASTContext() override; > + > +ConstString > +GetPluginName() override; > + > +uint32_t > +GetPluginVersion() override; > + > +static ConstString > +GetPluginNameStatic (); > + > +static lldb::TypeSystemSP > +CreateInstance (lldb::LanguageType language, Module *module, Target > *target); > + > +static void > +EnumerateSupportedLanguages(std::set > &languages_for_types, > +std::set > &languages_for_expressions); > + > +static void > +Initialize (); > + > +static void > +Terminate (); > + > +DWARFASTParser *GetDWARFParser() override; > + > +void > +SetAddressByteSize(int byte_size) > +{ > +m_pointer_byte_size = byte_size
[Lldb-commits] [lldb] r277660 - Add the new OCaml support files to the Xcode project file.
Author: jingham Date: Wed Aug 3 17:12:00 2016 New Revision: 277660 URL: http://llvm.org/viewvc/llvm-project?rev=277660&view=rev Log: Add the new OCaml support files to the Xcode project file. Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=277660&r1=277659&r2=277660&view=diff == --- lldb/trunk/lldb.xcodeproj/project.pbxproj (original) +++ lldb/trunk/lldb.xcodeproj/project.pbxproj Wed Aug 3 17:12:00 2016 @@ -716,6 +716,10 @@ 4C88BC2A1BA3722B00AA0964 /* Expression.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C88BC291BA3722B00AA0964 /* Expression.cpp */; }; 4C88BC2D1BA391B000AA0964 /* UserExpression.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C0083331B9A5DE200D5CF24 /* UserExpression.cpp */; }; 4CABA9E0134A8BCD00539BDD /* ValueObjectMemory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4CABA9DF134A8BCD00539BDD /* ValueObjectMemory.cpp */; }; + 4CC7C6501D5298F30076FF94 /* OCamlLanguage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4CC7C64D1D5298E20076FF94 /* OCamlLanguage.cpp */; }; + 4CC7C6531D5299140076FF94 /* DWARFASTParserOCaml.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 4CC7C6511D5299140076FF94 /* DWARFASTParserOCaml.h */; }; + 4CC7C6571D52997A0076FF94 /* OCamlASTContext.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4CC7C6551D52996C0076FF94 /* OCamlASTContext.cpp */; }; + 4CC7C6581D529B950076FF94 /* DWARFASTParserOCaml.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4CC7C6521D5299140076FF94 /* DWARFASTParserOCaml.cpp */; }; 4CCA644D13B40B82003BDF98 /* ItaniumABILanguageRuntime.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4CCA643D13B40B82003BDF98 /* ItaniumABILanguageRuntime.cpp */; }; 4CCA645013B40B82003BDF98 /* AppleObjCRuntime.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4CCA644213B40B82003BDF98 /* AppleObjCRuntime.cpp */; }; 4CCA645213B40B82003BDF98 /* AppleObjCRuntimeV1.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4CCA644413B40B82003BDF98 /* AppleObjCRuntimeV1.cpp */; }; @@ -1144,6 +1148,7 @@ 23D0658C1D4A7BDA0008EDE6 /* RenderScriptRuntime.h in CopyFiles */, 23D0658A1D4A7BDA0008EDE6 /* RenderScriptExpressionOpts.h in CopyFiles */, 49DEF1221CD7BD90006A7C7D /* BlockPointer.h in CopyFiles */, + 4CC7C6531D5299140076FF94 /* DWARFASTParserOCaml.h in CopyFiles */, AF90106515AB7D3600FF120D /* lldb.1 in CopyFiles */, 23D065881D4A7BDA0008EDE6 /* CMakeLists.txt in CopyFiles */, ); @@ -2453,6 +2458,11 @@ 4CB443F612499B6E00C13DC2 /* ObjCLanguageRuntime.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ObjCLanguageRuntime.h; path = include/lldb/Target/ObjCLanguageRuntime.h; sourceTree = ""; }; 4CC2A148128C73ED001531C4 /* ThreadPlanTracer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ThreadPlanTracer.cpp; path = source/Target/ThreadPlanTracer.cpp; sourceTree = ""; }; 4CC2A14C128C7409001531C4 /* ThreadPlanTracer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ThreadPlanTracer.h; path = include/lldb/Target/ThreadPlanTracer.h; sourceTree = ""; }; + 4CC7C64C1D5298E20076FF94 /* OCamlLanguage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OCamlLanguage.h; path = Language/OCaml/OCamlLanguage.h; sourceTree = ""; }; + 4CC7C64D1D5298E20076FF94 /* OCamlLanguage.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = OCamlLanguage.cpp; path = Language/OCaml/OCamlLanguage.cpp; sourceTree = ""; }; + 4CC7C6511D5299140076FF94 /* DWARFASTParserOCaml.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DWARFASTParserOCaml.h; sourceTree = ""; }; + 4CC7C6521D5299140076FF94 /* DWARFASTParserOCaml.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DWARFASTParserOCaml.cpp; sourceTree = ""; }; + 4CC7C6551D52996C0076FF94 /* OCamlASTContext.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = OCamlASTContext.cpp; path = source/Symbol/OCamlASTContext.cpp; sourceTree = ""; }; 4CCA643D13B40B82003BDF98 /* ItaniumABILanguageRuntime.cpp */ = {isa = PBXFileReference; fileEn
Re: [Lldb-commits] [lldb] r277443 - Support for OCaml native debugging
r277660 should do it. Jim > On Aug 3, 2016, at 3:04 PM, Jim Ingham wrote: > > Just finishing off a test build. Give me a minute and I'll check it in. > > Jim > >> On Aug 3, 2016, at 2:22 PM, Tamas Berghammer via lldb-commits >> wrote: >> >> It is failing because the new files have to be added to the xcode project. >> Currently I don't have a Mac around to do it but if nobody fixes it then I >> will try to find one. >> >> Tamás >> >> On Wed, 3 Aug 2016, 21:17 Tim Hammerquist, wrote: >> Hi Tamas, >> >> It looks like the LLDB Build and Check job started failing around the time >> of this commit. You can see the error at this link: >> >> http://lab.llvm.org:8080/green/job/lldb_build_test/19751/consoleFull#-1586822805dd1929ea-7054-4089-b7ef-4624c3781fa4 >> >> Could you take a look? >> >> Thanks, >> -Tim >> >> >> On Tue, Aug 2, 2016 at 4:15 AM, Tamas Berghammer via lldb-commits >> wrote: >> Author: tberghammer >> Date: Tue Aug 2 06:15:55 2016 >> New Revision: 277443 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=277443&view=rev >> Log: >> Support for OCaml native debugging >> >> This introduces basic support for debugging OCaml binaries. >> Use of the native compiler with DWARF emission support (see >> https://github.com/ocaml/ocaml/pull/574) is required. >> >> Available variables are considered as 64 bits unsigned integers, >> their interpretation will be left to a OCaml-made debugging layer. >> >> Differential revision: https://reviews.llvm.org/D22132 >> >> Added: >>lldb/trunk/include/lldb/Symbol/OCamlASTContext.h >>lldb/trunk/source/Plugins/Language/OCaml/ >>lldb/trunk/source/Plugins/Language/OCaml/CMakeLists.txt >>lldb/trunk/source/Plugins/Language/OCaml/OCamlLanguage.cpp >>lldb/trunk/source/Plugins/Language/OCaml/OCamlLanguage.h >>lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserOCaml.cpp >>lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserOCaml.h >>lldb/trunk/source/Symbol/OCamlASTContext.cpp >> Modified: >>lldb/trunk/cmake/LLDBDependencies.cmake >>lldb/trunk/include/lldb/Symbol/TypeSystem.h >>lldb/trunk/source/API/SystemInitializerFull.cpp >>lldb/trunk/source/Plugins/Language/CMakeLists.txt >>lldb/trunk/source/Plugins/SymbolFile/DWARF/CMakeLists.txt >>lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h >>lldb/trunk/source/Symbol/CMakeLists.txt >> >> Modified: lldb/trunk/cmake/LLDBDependencies.cmake >> URL: >> http://llvm.org/viewvc/llvm-project/lldb/trunk/cmake/LLDBDependencies.cmake?rev=277443&r1=277442&r2=277443&view=diff >> == >> --- lldb/trunk/cmake/LLDBDependencies.cmake (original) >> +++ lldb/trunk/cmake/LLDBDependencies.cmake Tue Aug 2 06:15:55 2016 >> @@ -27,6 +27,7 @@ set( LLDB_USED_LIBS >> lldbPluginJavaLanguage >> lldbPluginObjCLanguage >> lldbPluginObjCPlusPlusLanguage >> + lldbPluginOCamlLanguage >> >> lldbPluginObjectFileELF >> lldbPluginObjectFileJIT >> >> Added: lldb/trunk/include/lldb/Symbol/OCamlASTContext.h >> URL: >> http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/OCamlASTContext.h?rev=277443&view=auto >> == >> --- lldb/trunk/include/lldb/Symbol/OCamlASTContext.h (added) >> +++ lldb/trunk/include/lldb/Symbol/OCamlASTContext.h Tue Aug 2 06:15:55 2016 >> @@ -0,0 +1,355 @@ >> +//===-- OCamlASTContext.h --*- C++ >> -*-===// >> +// >> +// The LLVM Compiler Infrastructure >> +// >> +// This file is distributed under the University of Illinois Open Source >> +// License. See LICENSE.TXT for details. >> +// >> +//===--===// >> + >> +#ifndef liblldb_OCamlASTContext_h_ >> +#define liblldb_OCamlASTContext_h_ >> + >> +// C Includes >> +// C++ Includes >> +#include >> +#include >> +#include >> +#include >> +#include >> + >> +// Other libraries and framework includes >> +// Project includes >> +#include "lldb/Core/ConstString.h" >> +#include "lldb/Symbol/TypeSystem.h" >> +#include "lldb/Symbol/CompilerType.h" >> + >> +namespace lldb_private >> +{ >> + >> +class OCamlASTContext : public TypeSystem >> +{ >> + public: >> +class OCamlType; >> +typedef std::map> OCamlTypeMap; >> + >> +OCamlASTContext(); >> +~OCamlASTContext() override; >> + >> +ConstString >> +GetPluginName() override; >> + >> +uint32_t >> +GetPluginVersion() override; >> + >> +static ConstString >> +GetPluginNameStatic (); >> + >> +static lldb::TypeSystemSP >> +CreateInstance (lldb::LanguageType language, Module *module, Target >> *target); >> + >> +static void >> +EnumerateSupportedLanguages(std::set >> &languages_for_types, >> +std::set >> &languages_for_expressions); >> + >> +static void >> +Initialize
[Lldb-commits] [lldb] r277662 - Errors compiling breakpoint conditions will cause the breakpoint not to be hit
Author: jingham Date: Wed Aug 3 17:46:11 2016 New Revision: 277662 URL: http://llvm.org/viewvc/llvm-project?rev=277662&view=rev Log: Errors compiling breakpoint conditions will cause the breakpoint not to be hit This was a shadowed variable error from the big Expression Parser plugin-ification. I also added a test case for this. Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_conditions/TestBreakpointConditions.py lldb/trunk/source/Breakpoint/BreakpointLocation.cpp Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_conditions/TestBreakpointConditions.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_conditions/TestBreakpointConditions.py?rev=277662&r1=277661&r2=277662&view=diff == --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_conditions/TestBreakpointConditions.py (original) +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_conditions/TestBreakpointConditions.py Wed Aug 3 17:46:11 2016 @@ -36,6 +36,13 @@ class BreakpointConditionsTestCase(TestB self.build() self.breakpoint_conditions_python() +@skipIfWindows # Requires EE to support COFF on Windows (http://llvm.org/pr22232) +@add_test_categories(['pyapi']) +def test_breakpoint_invalid_condition_and_python_api(self): +"""Use Python APIs to set breakpoint conditions.""" +self.build() +self.breakpoint_invalid_conditions_python() + def setUp(self): # Call super's setUp(). TestBase.setUp(self) @@ -186,3 +193,40 @@ class BreakpointConditionsTestCase(TestB value = frame0.EvaluateExpression("$0", options) self.assertTrue(value.GetError().Fail(), "Conditions should not make result variables.") process.Continue() + +def breakpoint_invalid_conditions_python(self): +"""Use Python APIs to set breakpoint conditions.""" +exe = os.path.join(os.getcwd(), "a.out") + +# Create a target by the debugger. +target = self.dbg.CreateTarget(exe) +self.assertTrue(target, VALID_TARGET) + +# Now create a breakpoint on main.c by name 'c'. +breakpoint = target.BreakpointCreateByName('c', 'a.out') +#print("breakpoint:", breakpoint) +self.assertTrue(breakpoint and +breakpoint.GetNumLocations() == 1, +VALID_BREAKPOINT) + +# Set the condition on the breakpoint. +breakpoint.SetCondition('no_such_variable == not_this_one_either') +self.expect(breakpoint.GetCondition(), exe=False, +startstr = 'no_such_variable == not_this_one_either') + +# 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) + +# Frame #0 should be on self.line1 and the break condition should hold. +from lldbsuite.test.lldbutil import get_stopped_thread +thread = get_stopped_thread(process, lldb.eStopReasonBreakpoint) +self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint condition") +frame0 = thread.GetFrameAtIndex(0) +var = frame0.FindValue('val', lldb.eValueTypeVariableArgument) +self.assertTrue(frame0.GetLineEntry().GetLine() == self.line1) + +# The hit count for the breakpoint should be 1. +self.assertTrue(breakpoint.GetHitCount() == 1) + + Modified: lldb/trunk/source/Breakpoint/BreakpointLocation.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointLocation.cpp?rev=277662&r1=277661&r2=277662&view=diff == --- lldb/trunk/source/Breakpoint/BreakpointLocation.cpp (original) +++ lldb/trunk/source/Breakpoint/BreakpointLocation.cpp Wed Aug 3 17:46:11 2016 @@ -272,6 +272,8 @@ BreakpointLocation::ConditionSaysStop (E return false; } +error.Clear(); + DiagnosticManager diagnostics; if (condition_hash != m_condition_hash || !m_user_expression_sp || !m_user_expression_sp->MatchesContext(exe_ctx)) @@ -282,7 +284,6 @@ BreakpointLocation::ConditionSaysStop (E if (comp_unit) language = comp_unit->GetLanguage(); -Error error; m_user_expression_sp.reset(GetTarget().GetUserExpressionForLanguage(condition_text, nullptr, language, @@ -302,7 +303,7 @@ BreakpointLocation::ConditionSaysStop (E error.SetErrorStringWithFormat("Couldn't parse co
[Lldb-commits] [PATCH] D23150: [InstrumentationRuntime] Refactor the API (Part 2/N) (NFCI)
vsk created this revision. vsk added reviewers: kubabrecka, k8stone. vsk added a subscriber: lldb-commits. vsk added a dependency: D23043: [InstrumentationRuntime] Refactor the API (Part 1/N) (NFCI). Factor out some common logic used to find the runtime library in a list of modules. Depends on D23043. https://reviews.llvm.org/D23150 Files: include/lldb/Target/InstrumentationRuntime.h source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.cpp source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.h source/Plugins/InstrumentationRuntime/ThreadSanitizer/ThreadSanitizerRuntime.cpp source/Plugins/InstrumentationRuntime/ThreadSanitizer/ThreadSanitizerRuntime.h source/Target/InstrumentationRuntime.cpp Index: source/Target/InstrumentationRuntime.cpp === --- source/Target/InstrumentationRuntime.cpp +++ source/Target/InstrumentationRuntime.cpp @@ -13,7 +13,10 @@ // Project includes #include "lldb/lldb-private.h" #include "lldb/Target/Process.h" +#include "lldb/Core/Module.h" +#include "lldb/Core/ModuleList.h" #include "lldb/Core/PluginManager.h" +#include "lldb/Core/RegularExpression.h" #include "lldb/Target/InstrumentationRuntime.h" using namespace lldb; @@ -40,6 +43,38 @@ } } +void +InstrumentationRuntime::ModulesDidLoad(lldb_private::ModuleList &module_list) +{ +if (IsActive()) +return; + +if (GetRuntimeModuleSP()) +{ +Activate(); +return; +} + +module_list.ForEach([this](const lldb::ModuleSP module_sp) -> bool { +const FileSpec &file_spec = module_sp->GetFileSpec(); +if (!file_spec) +return true; // Keep iterating. + +const RegularExpression &runtime_regex = GetPatternForRuntimeLibrary(); +if (runtime_regex.Execute(file_spec.GetFilename().GetCString()) || module_sp->IsExecutable()) +{ +if (CheckIfRuntimeIsValid(module_sp)) +{ +SetRuntimeModuleSP(module_sp); +Activate(); +return false; // Stop iterating, we're done. +} +} + +return true; +}); +} + lldb::ThreadCollectionSP InstrumentationRuntime::GetBacktracesFromExtendedStopInfo(StructuredData::ObjectSP info) { Index: source/Plugins/InstrumentationRuntime/ThreadSanitizer/ThreadSanitizerRuntime.h === --- source/Plugins/InstrumentationRuntime/ThreadSanitizer/ThreadSanitizerRuntime.h +++ source/Plugins/InstrumentationRuntime/ThreadSanitizer/ThreadSanitizerRuntime.h @@ -56,17 +56,20 @@ return 1; } -void -ModulesDidLoad(lldb_private::ModuleList &module_list) override; - lldb::ThreadCollectionSP GetBacktracesFromExtendedStopInfo(StructuredData::ObjectSP info) override; private: ThreadSanitizerRuntime(const lldb::ProcessSP &process_sp) : lldb_private::InstrumentationRuntime(process_sp) {} +const RegularExpression & +GetPatternForRuntimeLibrary() override; + +bool +CheckIfRuntimeIsValid(const lldb::ModuleSP module_sp) override; + void -Activate(); +Activate() override; void Deactivate(); Index: source/Plugins/InstrumentationRuntime/ThreadSanitizer/ThreadSanitizerRuntime.cpp === --- source/Plugins/InstrumentationRuntime/ThreadSanitizer/ThreadSanitizerRuntime.cpp +++ source/Plugins/InstrumentationRuntime/ThreadSanitizer/ThreadSanitizerRuntime.cpp @@ -12,7 +12,6 @@ #include "lldb/Breakpoint/StoppointCallbackContext.h" #include "lldb/Core/Debugger.h" #include "lldb/Core/Module.h" -#include "lldb/Core/ModuleList.h" #include "lldb/Core/RegularExpression.h" #include "lldb/Core/PluginInterface.h" #include "lldb/Core/PluginManager.h" @@ -73,46 +72,6 @@ Deactivate(); } -static bool -ModuleContainsTSanRuntime(ModuleSP module_sp) -{ -static ConstString g_tsan_get_current_report("__tsan_get_current_report"); -const Symbol* symbol = module_sp->FindFirstSymbolWithNameAndType(g_tsan_get_current_report, lldb::eSymbolTypeAny); -return symbol != nullptr; -} - -void -ThreadSanitizerRuntime::ModulesDidLoad(lldb_private::ModuleList &module_list) -{ -if (IsActive()) -return; - -if (GetRuntimeModuleSP()) { -Activate(); -return; -} - -module_list.ForEach ([this](const lldb::ModuleSP module_sp) -> bool -{ -const FileSpec & file_spec = module_sp->GetFileSpec(); -if (! file_spec) -return true; // Keep iterating through modules - -llvm::StringRef module_basename(file_spec.GetFilename().GetStringRef()); -if (module_sp->IsExecutable() || module_basename.startswith("libclang_rt.tsan_")) -{ -if (ModuleContainsTSanRuntime(module_sp)) -{ -SetRuntimeModuleSP(mod