[Lldb-commits] [lldb] r277837 - [asan] Remove unused include (NFC)
Author: vedantk Date: Fri Aug 5 12:28:28 2016 New Revision: 277837 URL: http://llvm.org/viewvc/llvm-project?rev=277837&view=rev Log: [asan] Remove unused include (NFC) Modified: lldb/trunk/source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.cpp Modified: lldb/trunk/source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.cpp?rev=277837&r1=277836&r2=277837&view=diff == --- lldb/trunk/source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.cpp (original) +++ lldb/trunk/source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.cpp Fri Aug 5 12:28:28 2016 @@ -22,7 +22,6 @@ #include "lldb/Expression/UserExpression.h" #include "lldb/Interpreter/CommandReturnObject.h" #include "lldb/Symbol/Symbol.h" -#include "lldb/Symbol/SymbolContext.h" #include "lldb/Target/InstrumentationRuntimeStopInfo.h" #include "lldb/Target/StopInfo.h" #include "lldb/Target/Target.h" ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r277844 - Tweaks to the reporting of "missing dyld shared cached" that make it easier to grab logs when such issues occur, make the logs more helpful, and also tweaks to the user
Author: enrico Date: Fri Aug 5 13:09:50 2016 New Revision: 277844 URL: http://llvm.org/viewvc/llvm-project?rev=277844&view=rev Log: Tweaks to the reporting of "missing dyld shared cached" that make it easier to grab logs when such issues occur, make the logs more helpful, and also tweaks to the user messaging to make it easier to pinpoint an investigation avenue early on Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp?rev=277844&r1=277843&r2=277844&view=diff == --- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp (original) +++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp Fri Aug 5 13:09:50 2016 @@ -1360,7 +1360,7 @@ AppleObjCRuntimeV2::UpdateISAToDescripto uint32_t num_class_infos = 0; -Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); +Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_TYPES)); ExecutionContext exe_ctx; @@ -1478,7 +1478,11 @@ AppleObjCRuntimeV2::UpdateISAToDescripto err); if (class_infos_addr == LLDB_INVALID_ADDRESS) +{ +if (log) +log->Printf("unable to allocate %" PRIu32 " bytes in process for shared cache read", class_infos_byte_size); return DescriptorMapUpdateResult::Fail(); +} std::lock_guard guard(m_get_class_info_args_mutex); @@ -1571,7 +1575,7 @@ AppleObjCRuntimeV2::ParseClassInfoArray //uint32_t hash; //} __attribute__((__packed__)); -Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); +Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_TYPES)); uint32_t num_parsed = 0; @@ -1591,6 +1595,8 @@ AppleObjCRuntimeV2::ParseClassInfoArray // never change, so we can just skip it. if (ISAIsCached(isa)) { +if (log) +log->Printf("AppleObjCRuntimeV2 found cached isa=0x%" PRIx64 ", ignoring this class info", isa); offset += 4; } else @@ -1600,10 +1606,12 @@ AppleObjCRuntimeV2::ParseClassInfoArray ClassDescriptorSP descriptor_sp (new ClassDescriptorV2(*this, isa, NULL)); AddClass (isa, descriptor_sp, name_hash); num_parsed++; -if (log && log->GetVerbose()) +if (log) log->Printf("AppleObjCRuntimeV2 added isa=0x%" PRIx64 ", hash=0x%8.8x, name=%s", isa, name_hash,descriptor_sp->GetClassName().AsCString("")); } } +if (log) +log->Printf("AppleObjCRuntimeV2 parsed %" PRIu32 " class infos", num_parsed); return num_parsed; } @@ -1615,7 +1623,7 @@ AppleObjCRuntimeV2::UpdateISAToDescripto if (process == NULL) return DescriptorMapUpdateResult::Fail(); -Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); +Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_TYPES)); ExecutionContext exe_ctx; @@ -1645,14 +1653,7 @@ AppleObjCRuntimeV2::UpdateISAToDescripto if (objc_opt_ptr == LLDB_INVALID_ADDRESS) return DescriptorMapUpdateResult::Fail(); -// Read the total number of classes from the hash table const uint32_t num_classes = 128*1024; -if (num_classes == 0) -{ -if (log) -log->Printf ("No dynamic classes found in gdb_objc_realized_classes_addr."); -return DescriptorMapUpdateResult::Fail(); -} // Make some types for our arguments CompilerType clang_uint32_t_type = ast->GetBuiltinTypeForEncodingAndBitSize(eEncodingUint, 32); @@ -1732,7 +1733,11 @@ AppleObjCRuntimeV2::UpdateISAToDescripto err); if (class_infos_addr == LLDB_INVALID_ADDRESS) +{ +if (log) +log->Printf("unable to allocate %" PRIu32 " bytes in process for shared cache read", class_infos_byte_size); return DescriptorMapUpdateResult::Fail(); +} std::lock_guard guard(m_get_shared_cache_class_info_args_mutex); @@ -1840,7 +1845,7 @@ AppleObjCRuntimeV2::UpdateISAToDescripto bool AppleObjCRuntimeV2::UpdateISAToDescriptorMapFromMemory (RemoteNXMapTable &hash_table) { -Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); +Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_TYPES)); Process *process = GetProcess(); @@ -1912,6 +1917,8 @@ AppleObjCRuntimeV2::GetSharedCa
[Lldb-commits] [lldb] r277879 - Add a few more needed bits to the scripted thread plans.
Author: jingham Date: Fri Aug 5 17:06:12 2016 New Revision: 277879 URL: http://llvm.org/viewvc/llvm-project?rev=277879&view=rev Log: Add a few more needed bits to the scripted thread plans. Modified: lldb/trunk/include/lldb/API/SBThread.h lldb/trunk/include/lldb/API/SBThreadPlan.h lldb/trunk/include/lldb/Interpreter/ScriptInterpreter.h lldb/trunk/include/lldb/Target/ThreadPlanPython.h lldb/trunk/scripts/interface/SBThread.i lldb/trunk/scripts/interface/SBThreadPlan.i lldb/trunk/source/API/SBThread.cpp lldb/trunk/source/API/SBThreadPlan.cpp lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h lldb/trunk/source/Target/ThreadPlanPython.cpp Modified: lldb/trunk/include/lldb/API/SBThread.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBThread.h?rev=277879&r1=277878&r2=277879&view=diff == --- lldb/trunk/include/lldb/API/SBThread.h (original) +++ lldb/trunk/include/lldb/API/SBThread.h Fri Aug 5 17:06:12 2016 @@ -142,6 +142,9 @@ public: StepUsingScriptedThreadPlan (const char *script_class_name); SBError +StepUsingScriptedThreadPlan (const char *script_class_name, bool resume_immediately); + +SBError JumpToLine (lldb::SBFileSpec &file_spec, uint32_t line); void Modified: lldb/trunk/include/lldb/API/SBThreadPlan.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBThreadPlan.h?rev=277879&r1=277878&r2=277879&view=diff == --- lldb/trunk/include/lldb/API/SBThreadPlan.h (original) +++ lldb/trunk/include/lldb/API/SBThreadPlan.h Fri Aug 5 17:06:12 2016 @@ -81,6 +81,9 @@ public: bool IsPlanComplete(); + +bool +IsPlanStale(); bool IsValid(); Modified: lldb/trunk/include/lldb/Interpreter/ScriptInterpreter.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/ScriptInterpreter.h?rev=277879&r1=277878&r2=277879&view=diff == --- lldb/trunk/include/lldb/Interpreter/ScriptInterpreter.h (original) +++ lldb/trunk/include/lldb/Interpreter/ScriptInterpreter.h Fri Aug 5 17:06:12 2016 @@ -265,6 +265,13 @@ public: return true; } +virtual bool +ScriptedThreadPlanIsStale(StructuredData::ObjectSP implementor_sp, bool &script_error) +{ +script_error = true; +return true; +} + virtual lldb::StateType ScriptedThreadPlanGetRunState(StructuredData::ObjectSP implementor_sp, bool &script_error) { Modified: lldb/trunk/include/lldb/Target/ThreadPlanPython.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/ThreadPlanPython.h?rev=277879&r1=277878&r2=277879&view=diff == --- lldb/trunk/include/lldb/Target/ThreadPlanPython.h (original) +++ lldb/trunk/include/lldb/Target/ThreadPlanPython.h Fri Aug 5 17:06:12 2016 @@ -60,6 +60,9 @@ public: void DidPush() override; + +bool +IsPlanStale() override; protected: bool Modified: lldb/trunk/scripts/interface/SBThread.i URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/interface/SBThread.i?rev=277879&r1=277878&r2=277879&view=diff == --- lldb/trunk/scripts/interface/SBThread.i (original) +++ lldb/trunk/scripts/interface/SBThread.i Fri Aug 5 17:06:12 2016 @@ -244,6 +244,9 @@ public: StepUsingScriptedThreadPlan (const char *script_class_name); SBError +StepUsingScriptedThreadPlan (const char *script_class_name, bool resume_immediately); + +SBError JumpToLine (lldb::SBFileSpec &file_spec, uint32_t line); void Modified: lldb/trunk/scripts/interface/SBThreadPlan.i URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/interface/SBThreadPlan.i?rev=277879&r1=277878&r2=277879&view=diff == --- lldb/trunk/scripts/interface/SBThreadPlan.i (original) +++ lldb/trunk/scripts/interface/SBThreadPlan.i Fri Aug 5 17:06:12 2016 @@ -86,6 +86,9 @@ public: IsPlanComplete(); bool +IsPlanStale(); + +bool IsValid(); // This section allows an SBThreadPlan to push another of the common types of plans... Modified: lldb/trunk/source/API/SBThread.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBThread.cpp?rev=277879&r1=277878&r2=277879&view=diff == --- lldb/trunk/source/API/SBThread.cpp (original) +++ lldb/trunk/source/API/SBThread.cpp Fri Aug 5 17:06:12 2016 @@ -1161,6 +1161,12 @@ SBThread::StepOverU
[Lldb-commits] [lldb] r277884 - Mention is_stale in the scripted step doc.
Author: jingham Date: Fri Aug 5 17:47:43 2016 New Revision: 277884 URL: http://llvm.org/viewvc/llvm-project?rev=277884&view=rev Log: Mention is_stale in the scripted step doc. Modified: lldb/trunk/examples/python/scripted_step.py Modified: lldb/trunk/examples/python/scripted_step.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/python/scripted_step.py?rev=277884&r1=277883&r2=277884&view=diff == --- lldb/trunk/examples/python/scripted_step.py (original) +++ lldb/trunk/examples/python/scripted_step.py Fri Aug 5 17:47:43 2016 @@ -64,6 +64,19 @@ #to allow you to do whatever cleanup is required. I haven't gotten to that #yet. For now you should do that at the same time you mark your plan complete. # +# 3) After the round of negotiation over whether to stop or not is done, all the +#plans get asked if they are "stale". If they are say they are stale +#then they will get popped. This question is asked with the "is_stale" method. +# +#This is useful, for instance, in the FinishPrintAndContinue plan. What might +#happen here is that after continuing but before the finish is done, the program +#could hit another breakpoint and stop. Then the user could use the step +#command repeatedly until they leave the frame of interest by stepping. +#In that case, the step plan is the one that will be responsible for stopping, +#and the finish plan won't be asked should_stop, it will just be asked if it +#is stale. In this case, if the step_out plan that the FinishPrintAndContinue +#plan is driving is stale, so is ours, and it is time to do our printing. +# # Both examples show stepping through an address range for 20 bytes from the # current PC. The first one does it by single stepping and checking a condition. # It doesn't, however handle the case where you step into another frame while @@ -195,17 +208,26 @@ class FinishPrintAndContinue: self.step_out_thread_plan = thread_plan.QueueThreadPlanForStepOut(0, True) self.thread = self.thread_plan.GetThread() +def is_stale (self): +if self.step_out_thread_plan.IsPlanStale(): +self.do_print() +return True +else: +return False + def explains_stop (self, event): return False def should_stop (self, event): if self.step_out_thread_plan.IsPlanComplete(): -frame_0 = self.thread.frames[0] -rax_value = frame_0.FindRegister("rax") -if rax_value.GetError().Success(): -print "RAX on exit: ", rax_value.GetValue() -else: -print "Couldn't get rax value:", rax_value.GetError().GetCString() - +self.do_print() self.thread_plan.SetPlanComplete(True) return False + +def do_print (self): +frame_0 = self.thread.frames[0] +rax_value = frame_0.FindRegister("rax") +if rax_value.GetError().Success(): +print "RAX on exit: ", rax_value.GetValue() +else: +print "Couldn't get rax value:", rax_value.GetError().GetCString() ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r277890 - Mention the scripted thread plans in the python reference.
Author: jingham Date: Fri Aug 5 18:35:26 2016 New Revision: 277890 URL: http://llvm.org/viewvc/llvm-project?rev=277890&view=rev Log: Mention the scripted thread plans in the python reference. Modified: lldb/trunk/www/python-reference.html Modified: lldb/trunk/www/python-reference.html URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/www/python-reference.html?rev=277890&r1=277889&r2=277890&view=diff == --- lldb/trunk/www/python-reference.html (original) +++ lldb/trunk/www/python-reference.html Fri Aug 5 18:35:26 2016 @@ -314,6 +314,118 @@ Enter your Python command(s). Type 'DONE To remove the breakpoint command: (lldb) breakpoint command delete 1 + + + + Using the Python API's to create custom stepping logic + + +A slightly esoteric use of the Python API's is to construct custom stepping types. LLDB's stepping is + driven by a stack of "thread plans" and a fairly simple state machine that runs the plans. You can create + a Python class that works as a thread plan, and responds to the requests the state machine makes to run + its operations. +There is a longer discussion of scripted thread plans and the state machine, and several interesting examples + of their use in: +http://llvm.org/svn/llvm-project/lldb/trunk/examples/python/scripted_step.py";>scripted_step.py + + And for a MUCH fuller discussion of the whole state machine, see: + +http://llvm.org/svn/llvm-project/lldb/trunk/include/lldb/Target/ThreadPlan.h";>ThreadPlan.h + +If you are reading those comments it is useful to know that scripted thread plans are set to be + "MasterPlans", and not "OkayToDiscard". + +To implement a scripted step, you define a python class that has the following methods: + + + +Name +Arguments +Description + + + + + +__init__ + + +thread_plan: lldb.SBThreadPlan + + +This is the underlying SBThreadPlan that is pushed onto the plan stack. +You will want to store this away in an ivar. Also, if you are going to +use one of the canned thread plans, you can queue it at this point. + + + + + +explains_stop + + +event: lldb.SBEvent + + +Return True if this stop is part of your thread plans logic, false otherwise. + + + + +is_stale + + +None + + +If your plan is no longer relevant (for instance, you were +stepping in a particular stack frame, but some other operation +pushed that frame off the stack) return True and your plan will +get popped. + + + + +should_step + + +None + + +Return True if you want lldb to instruction step one instruction, +or False to continue till the next breakpoint is hit. + + + + +should_stop + + +event: lldb.SBEvent + + + If your plan wants to stop and return control to the user at this point, return True. + If your plan is done at this point, call SetPlanComplete on your + thread plan instance. + Also, do any work you need here to set up the next stage of stepping. + + + + +
[Lldb-commits] [lldb] r277895 - Fix Windows build - add return statement in SBThread::StepUsingScriptedThreadPlan.
Author: ovyalov Date: Fri Aug 5 19:42:23 2016 New Revision: 277895 URL: http://llvm.org/viewvc/llvm-project?rev=277895&view=rev Log: Fix Windows build - add return statement in SBThread::StepUsingScriptedThreadPlan. Modified: lldb/trunk/source/API/SBThread.cpp Modified: lldb/trunk/source/API/SBThread.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBThread.cpp?rev=277895&r1=277894&r2=277895&view=diff == --- lldb/trunk/source/API/SBThread.cpp (original) +++ lldb/trunk/source/API/SBThread.cpp Fri Aug 5 19:42:23 2016 @@ -1161,7 +1161,7 @@ SBThread::StepOverUntil (lldb::SBFrame & SBError SBThread::StepUsingScriptedThreadPlan (const char *script_class_name) { -StepUsingScriptedThreadPlan(script_class_name, true); +return StepUsingScriptedThreadPlan(script_class_name, true); } SBError ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r277897 - The lack of classes in the hash table is not an error - it's very legitimately possible for a process to define no ObjC classes of its own. Discovered by debugging /bin
Author: enrico Date: Fri Aug 5 19:57:07 2016 New Revision: 277897 URL: http://llvm.org/viewvc/llvm-project?rev=277897&view=rev Log: The lack of classes in the hash table is not an error - it's very legitimately possible for a process to define no ObjC classes of its own. Discovered by debugging /bin/ls Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp?rev=277897&r1=277896&r2=277897&view=diff == --- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp (original) +++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp Fri Aug 5 19:57:07 2016 @@ -1389,7 +1389,7 @@ AppleObjCRuntimeV2::UpdateISAToDescripto { if (log) log->Printf ("No dynamic classes found in gdb_objc_realized_classes."); -return DescriptorMapUpdateResult::Fail(); +return DescriptorMapUpdateResult::Success(0); } // Make some types for our arguments ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits