aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Target/ThreadPlanCallFunction.cpp
AgeCommit message (Collapse)AuthorFilesLines
2016-09-06*** This commit represents a complete reformatting of the LLDB source codeKate Stone1-479/+406
*** to conform to clang-format’s LLVM style. This kind of mass change has *** two obvious implications: Firstly, merging this particular commit into a downstream fork may be a huge effort. Alternatively, it may be worth merging all changes up to this commit, performing the same reformatting operation locally, and then discarding the merge for this particular commit. The commands used to accomplish this reformatting were as follows (with current working directory as the root of the repository): find . \( -iname "*.c" -or -iname "*.cpp" -or -iname "*.h" -or -iname "*.mm" \) -exec clang-format -i {} + find . -iname "*.py" -exec autopep8 --in-place --aggressive --aggressive {} + ; The version of clang-format used was 3.9.0, and autopep8 was 1.2.4. Secondly, “blame” style tools will generally point to this commit instead of a meaningful prior commit. There are alternatives available that will attempt to look through this change and find the appropriate prior commit. YMMV. llvm-svn: 280751
2015-12-15Fix Clang-tidy modernize-use-nullptr and readability-simplify-boolean-expr ↵Eugene Zelenko1-22/+6
warnings in some files in source/Target/. Simplify smart pointers checks in conditions. Other minor fixes. llvm-svn: 255598
2015-08-11ClangASTType is now CompilerType.Greg Clayton1-2/+2
This is more preparation for multiple different kinds of types from different compilers (clang, Pascal, Go, RenderScript, Swift, etc). llvm-svn: 244689
2015-07-14Expression evaluation, a new ThreadPlanCallFunctionUsingABI for executing a ↵Ewan Crawford1-12/+40
function call on target via register manipulation For Hexagon we want to be able to call functions during debugging, however currently lldb only supports this when there is JIT support. Although emulation using IR interpretation is an alternative, it is currently limited in that it can't make function calls. In this patch we have extended the IR interpreter so that it can execute a function call on the target using register manipulation. To do this we need to handle the Call IR instruction, passing arguments to a new thread plan and collecting any return values to pass back into the IR interpreter. The new thread plan is needed to call an alternative ABI interface of "ABI::PerpareTrivialCall()", allowing more detailed information about arguments and return values. Reviewers: jingham, spyffe Subscribers: emaste, lldb-commits, ted, ADodds, deepak2427 Differential Revision: http://reviews.llvm.org/D9404 llvm-svn: 242137
2015-05-07Add a missing check for m_real_stop_reason.Jim Ingham1-1/+1
<rdar://problem/20738527> llvm-svn: 236762
2015-03-18Move lldb-log.cpp to core/Logging.cppZachary Turner1-1/+0
So that we don't have to update every single #include in the entire codebase to #include this new header (which used to get included by lldb-private-log.h, we automatically #include "Logging.h" from within "Log.h". llvm-svn: 232653
2015-03-03Reduce header footprint of Target.hZachary Turner1-0/+1
This continues the effort to reduce header footprint and improve build speed by removing clang and other unnecessary headers from Target.h. In one case, some headers were included solely for the purpose of declaring a nested class in Target, which was not needed by anybody outside the class. In this case the definition and implementation of the nested class were isolated in the .cpp file so the header could be removed. llvm-svn: 231107
2014-04-08Fix the behavior when hand-calling a function times out on one thread,Jim Ingham1-0/+8
but by the time we go to halt, it has already stopped by hitting the function end breakpoint. That wasn't being shown to the threads so the Function call thread plan didn't know its job was done. <rdar://problem/16515785> llvm-svn: 205803
2014-04-04sweep up -Wformat warnings from gccSaleem Abdulrasool1-26/+43
This is a purely mechanical change explicitly casting any parameters for printf style conversion. This cleans up the warnings emitted by gcc 4.8 on Linux. llvm-svn: 205607
2014-04-02Workaround for collision between enum members in LLVM's MachO.h and system ↵Jim Ingham1-1/+1
headers on Mac OS X (in particular mach/machine.h). <rdar://problem/16494607> llvm-svn: 205480
2014-03-07The ThreadPlanCallFunction needs to pass its "StopOthers" to its run to ↵Jim Ingham1-0/+7
address subplan. llvm-svn: 203231
2014-02-28Plumb the EvaluateExpressionOptions::{Set,Get}StopOthers through the SB API, ↵Jim Ingham1-11/+0
and make it work in RunThreadPlan. Also remove SetStopOthers from the ThreadPlanCallFunction, because if the value you have doesn't match what is in the EvaluateExpressionOptions the plan was passed when created it won't work correctly. llvm-svn: 202464
2013-11-12Log failure to restore thread state in ThreadPlanCallFunction::DoTakedownEd Maste1-1/+5
In order to help track down llvm.org/pr17226. llvm-svn: 194487
2013-11-08Changed the ABIs and ClangFunction to take aSean Callanan1-82/+7
llvm::ArrayRef of arguments rather than taking a fixed number of possibly-NULL pointers to arguments. Also changed ClangFunction::GetThreadPlanToCallFunction to take the address of the argument struct by value instead of by reference, since it doesn't actually modify the value passed into it. llvm-svn: 194232
2013-11-07This patch does a couple of things. Jim Ingham1-39/+51
It completes the job of using EvaluateExpressionOptions consistently throughout the inferior function calling mechanism in lldb begun in Greg's patch r194009. It removes a handful of alternate calls into the ClangUserExpression/ClangFunction/ThreadPlanCallFunction which were there for convenience. Using the EvaluateExpressionOptions removes the need for them. Using that it gets the --debug option from Greg's patch to work cleanly. It also adds another EvaluateExpressionOption to not trap exceptions when running expressions. You shouldn't use this option unless you KNOW your expression can't throw beyond itself. This is: <rdar://problem/15374885> At present this is only available through the SB API's or python. It fixes a bug where function calls would unset the ObjC & C++ exception breakpoints without checking whether they were set by somebody else already. llvm-svn: 194182
2013-06-04If ThreadPlanCallFunction hasn't set its notion of the "real stop info" yet, ↵Jim Ingham1-3/+3
just return the current PrivateStopInfo. Also renamed a few more places where we were using StopReason in functions that were returning StopInfo's. <rdar://problem/14042692> llvm-svn: 183177
2013-05-16Handle the case where there is a user breakpoint set at the location of one ↵Jim Ingham1-0/+8
of our function call exception catching breakpoints. We need to force ourselves to stop in that case. <rdar://problem/13903801> llvm-svn: 182056
2013-05-08Figure out the reply to "PlanExplainsStop" once when we stop and then use ↵Jim Ingham1-3/+3
the cached value. This fixes problems, for instance, with the StepRange plans, where they know that they explained the stop because they were at their "run to here" breakpoint, then deleted that breakpoint, so when they got asked again, doh! I had done this for a couple of plans in an ad hoc fashion, this just formalizes it. Also add a "ResumeRequested" in Process so that the code in the completion handlers can tell the ShouldStop logic they want to resume rather than just directly resuming. That allows us to handle resuming in a more controlled fashion. Also, SetPublicState can take a "restarted" flag, so that it doesn't drop the run lock when the target was immediately restarted. --This line, and those below , will be ignored-- M test/lang/objc/objc-dynamic-value/TestObjCDynamicValue.py M include/lldb/Target/ThreadList.h M include/lldb/Target/ThreadPlanStepOut.h M include/lldb/Target/Thread.h M include/lldb/Target/ThreadPlanBase.h M include/lldb/Target/ThreadPlanStepThrough.h M include/lldb/Target/ThreadPlanStepInstruction.h M include/lldb/Target/ThreadPlanStepInRange.h M include/lldb/Target/ThreadPlanStepOverBreakpoint.h M include/lldb/Target/ThreadPlanStepUntil.h M include/lldb/Target/StopInfo.h M include/lldb/Target/Process.h M include/lldb/Target/ThreadPlanRunToAddress.h M include/lldb/Target/ThreadPlan.h M include/lldb/Target/ThreadPlanCallFunction.h M include/lldb/Target/ThreadPlanStepOverRange.h M source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.h M source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.cpp M source/Target/StopInfo.cpp M source/Target/Process.cpp M source/Target/ThreadPlanRunToAddress.cpp M source/Target/ThreadPlan.cpp M source/Target/ThreadPlanCallFunction.cpp M source/Target/ThreadPlanStepOverRange.cpp M source/Target/ThreadList.cpp M source/Target/ThreadPlanStepOut.cpp M source/Target/Thread.cpp M source/Target/ThreadPlanBase.cpp M source/Target/ThreadPlanStepThrough.cpp M source/Target/ThreadPlanStepInstruction.cpp M source/Target/ThreadPlanStepInRange.cpp M source/Target/ThreadPlanStepOverBreakpoint.cpp M source/Target/ThreadPlanStepUntil.cpp M lldb.xcodeproj/xcshareddata/xcschemes/Run Testsuite.xcscheme llvm-svn: 181381
2013-03-28Return a useful error message from ValidatePlan if the expression can't be ↵Jim Ingham1-7/+23
made for some reason. llvm-svn: 178201
2013-03-27<rdar://problem/13521159>Greg Clayton1-5/+5
LLDB is crashing when logging is enabled from lldb-perf-clang. This has to do with the global destructor chain as the process and its threads are being torn down. All logging channels now make one and only one instance that is kept in a global pointer which is never freed. This guarantees that logging can correctly continue as the process tears itself down. llvm-svn: 178191
2013-02-27Add GNU indirect function support in expressions for Linux.Matt Kopec1-2/+2
llvm-svn: 176206
2013-02-14Add a test for handling a function call that throws an exception, and make ↵Jim Ingham1-6/+0
it work. <rdar://problem/13183944> llvm-svn: 175127
2013-02-09Reworked the way Process::RunThreadPlan and the ThreadPlanCallFunction ↵Jim Ingham1-28/+53
interoperate to fix problems where hitting auto-continue signals while running a thread plan would cause us to lose control of the debug session. <rdar://problem/12993641> llvm-svn: 174793
2013-01-15Separated the "expr --unwind-on-error" behavior into two parts, actual ↵Jim Ingham1-14/+39
errors (i.e. crashes) which continue to be controlled by the --unwind-on-error flag, and --ignore-breakpoint which separately controls behavior when a called function hits a breakpoint. For breakpoints, we don't unwind, we either stop, or ignore the breakpoint, which makes more sense. Also make both these behaviors globally settable through "settings set". Also handle the case where a breakpoint command calls code that ends up re-hitting the breakpoint. We were recursing and crashing. Now we just stop without calling the second command. <rdar://problem/12986644> <rdar://problem/9119325> llvm-svn: 172503
2012-12-07Set ThreadPlanCallFunction to private in ConstructorSetup. This fixes a ↵Andrew Kaylor1-0/+1
problem on Linux where 'continue' was misfiring after an expression evaluation when stopped at a breakpoint. The problem was that InferiorCallMmap was not setting its ThreadPlanCallFunction to private and so the completion of that thread plan appeared to be the stop reason and therefore the 'continue' operation failed to step over the breakpoint. The SetPrivate call is being put in ThreadPlanCallFunction rather than InferiorCallMmap to make the solution more general. llvm-svn: 169618
2012-11-29Resolve printf formatting warnings on Linux:Daniel Malea1-4/+4
- use macros from inttypes.h for format strings instead of OS-specific types Patch from Matt Kopec! llvm-svn: 168945
2012-11-26The Function calling thread plan was replacing the stored stop info too ↵Jim Ingham1-6/+16
soon, causing recursive entry into the breakpoint StopInfo's PerformAction, which is bad. Reworked this so that it is now correct. <rdar://problem/12501259> llvm-svn: 168634
2012-09-11Some more typing-related fixes.Filipe Cabecinhas1-2/+2
llvm-svn: 163638
2012-08-29<rdar://problem/11757916>Greg Clayton1-0/+2
Make breakpoint setting by file and line much more efficient by only looking for inlined breakpoint locations if we are setting a breakpoint in anything but a source implementation file. Implementing this complex for a many reasons. Turns out that parsing compile units lazily had some issues with respect to how we need to do things with DWARF in .o files. So the fixes in the checkin for this makes these changes: - Add a new setting called "target.inline-breakpoint-strategy" which can be set to "never", "always", or "headers". "never" will never try and set any inlined breakpoints (fastest). "always" always looks for inlined breakpoint locations (slowest, but most accurate). "headers", which is the default setting, will only look for inlined breakpoint locations if the breakpoint is set in what are consudered to be header files, which is realy defined as "not in an implementation source file". - modify the breakpoint setting by file and line to check the current "target.inline-breakpoint-strategy" setting and act accordingly - Modify compile units to be able to get their language and other info lazily. This allows us to create compile units from the debug map and not have to fill all of the details in, and then lazily discover this information as we go on debuggging. This is needed to avoid parsing all .o files when setting breakpoints in implementation only files (no inlines). Otherwise we would need to parse the .o file, the object file (mach-o in our case) and the symbol file (DWARF in the object file) just to see what the compile unit was. - modify the "SymbolFileDWARFDebugMap" to subclass lldb_private::Module so that the virtual "GetObjectFile()" and "GetSymbolVendor()" functions can be intercepted when the .o file contenst are later lazilly needed. Prior to this fix, when we first instantiated the "SymbolFileDWARFDebugMap" class, we would also make modules, object files and symbol files for every .o file in the debug map because we needed to fix up the sections in the .o files with information that is in the executable debug map. Now we lazily do this in the DebugMapModule::GetObjectFile() Cleaned up header includes a bit as well. llvm-svn: 162860
2012-08-09Removed explicit NULL checks for shared pointersSean Callanan1-1/+1
and instead made us use implicit casts to bool. This generated a warning in C++11. <rdar://problem/11930775> llvm-svn: 161559
2012-05-11Found one more place where the OkayToDiscard needs to be consulted.Jim Ingham1-1/+1
Also changed the defaults for SBThread::Step* to not delete extant plans. Also added some test cases to test more complex stepping scenarios. llvm-svn: 156667
2012-05-11Don't try to use "OkayToDiscard" to mean BOTH this plan is a user plan or ↵Jim Ingham1-10/+14
not AND unwind on error. rdar://problem/11419156 llvm-svn: 156627
2012-05-10If the ObjC Step Through Trampoline plan causes a target crash, properly ↵Jim Ingham1-14/+34
propagate the error back to the controlling plans so that they don't lose control. Also change "ThreadPlanStepThrough" to take the return StackID for its backstop breakpoint as an argument to the constructor rather than having it try to figure it out itself, since it might get it wrong whereas the caller always knows where it is coming from. rdar://problem/11402287 llvm-svn: 156529
2012-04-13Don't do the work in DoTakedown if the thread plan isn't valid.Jim Ingham1-12/+21
Also fixed up some logging. llvm-svn: 154709
2012-04-13Factor out a bunch of common code in the two ThreadPlanCallFunction ↵Jim Ingham1-97/+62
constructors. Also add a sanity check - try reading the frame, and if we fail bag out. llvm-svn: 154698
2012-04-13ThreadPlanCallFunction's destructor wasn't calling DoTakedown, so if the ↵Jim Ingham1-0/+1
that plan got discarded we weren't doing the takedown. llvm-svn: 154681
2012-04-10Set variables returned by utility functions toSean Callanan1-1/+2
not consume slots in the persistent variable store. llvm-svn: 154416
2012-04-09Rework how master plans declare themselves. Also make "PlanIsBasePlan" not ↵Jim Ingham1-0/+6
rely only on this being the bottom plan in the stack, but allow the plan to declare itself as such. llvm-svn: 154351
2012-02-21Thread hardening part 3. Now lldb_private::Thread objects have std::weak_ptrGreg Clayton1-22/+39
objects for the backlink to the lldb_private::Process. The issues we were running into before was someone was holding onto a shared pointer to a lldb_private::Thread for too long, and the lldb_private::Process parent object would get destroyed and the lldb_private::Thread had a "Process &m_process" member which would just treat whatever memory that used to be a Process as a valid Process. This was mostly happening for lldb_private::StackFrame objects that had a member like "Thread &m_thread". So this completes the internal strong/weak changes. Documented the ExecutionContext and ExecutionContextRef classes so that our LLDB developers can understand when and where to use ExecutionContext and ExecutionContextRef objects. llvm-svn: 151009
2011-12-22Improve the x86_64 return value decoder to handle most structure returns.Jim Ingham1-5/+8
Switch from GetReturnValue, which was hardly ever used, to GetReturnValueObject which is much more convenient. Return the "return value object" as a persistent variable if requested. llvm-svn: 147157
2011-11-01Enhanced the ObjC DynamicCheckerFunction to test for "object responds to ↵Jim Ingham1-8/+6
selector" as well as "object borked"... Also made the error when the checker fails reflect this fact rather than report a crash at 0x0. Also a little cleanup: - StopInfoMachException had a redundant copy of the description string. - ThreadPlanCallFunction had a redundant copy of the thread, and had a copy of the process that it didn't really need. llvm-svn: 143419
2011-10-19Moved lldb::user_id_t values to be 64 bit. This was going to be needed forGreg Clayton1-2/+2
process IDs, and thread IDs, but was mainly needed for for the UserID's for Types so that DWARF with debug map can work flawlessly. With DWARF in .o files the type ID was the DIE offset in the DWARF for the .o file which is not unique across all .o files, so now the SymbolFileDWARFDebugMap class will make the .o file index part (the high 32 bits) of the unique type identifier so it can uniquely identify the types. llvm-svn: 142534
2011-08-12Make ValueObject::SetValueFromCString work correctly.Jim Ingham1-2/+2
Also change the SourceInitFile to look for .lldb-<APPNAME> and source that preferentially if it exists. Also made the breakpoint site report its address as well as its breakpoint number when it gets hit and can't find any the associated locations (usually because the breakpoint got disabled or deleted programmatically between the time it was hit and reported.) Changed ThreadPlanCallFunction to initialize the ivar m_func in the initializers of the constructor, rather than waiting to initialize till later on in the function. Fixed a bug where if you make an SBError and the ask it Success, it returns false. Fixed ValueObject::ResolveValue so that it resolves a temporary value, rather than overwriting the one in the value object. llvm-svn: 137536
2011-08-11Fix the broken build that happened with my last checkin.Greg Clayton1-3/+3
llvm-svn: 137300
2011-08-11Added the ability to remove orphaned module shared pointers from a ModuleList.Greg Clayton1-7/+7
This is helping us track down some extra references to ModuleSP objects that are causing things to get kept around for too long. Added a module pointer accessor to target and change a lot of code to use it where it would be more efficient. "taret delete" can now specify "--clean=1" which will cleanup the global module list for any orphaned module in the shared module cache which can save memory and also help track down module reference leaks like we have now. llvm-svn: 137294
2011-08-10Check log shared pointer before using it.Johnny Chen1-8/+13
llvm-svn: 137228
2011-07-19The implementation of categories is now synchronization safeEnrico Granata1-1/+1
Code cleanup: - The Format Manager implementation is now split between two files: FormatClasses.{h|cpp} where the actual formatter classes (ValueFormat, SummaryFormat, ...) are implemented and FormatManager.{h|cpp} where the infrastructure classes (FormatNavigator, FormatManager, ...) are contained. The wrapper code always remains in Debugger.{h|cpp} - Several leftover fields, methods and comments from previous design choices have been removed type category subcommands (enable, disable, delete) now can take a list of category names as input - for type category enable, saying "enable A B C" is the same as saying enable C enable B enable A (the ordering is relevant in enabling categories, and it is expected that a user typing enable A B C wants to look into category A, then into B, then into C and not the other way round) - for the other two commands, the order is not really relevant (however, the same inverted ordering is used for consistency) llvm-svn: 135494
2011-06-03Fix some order-of-initialisation warningsPeter Collingbourne1-4/+4
llvm-svn: 132588
2011-05-19Fixed a crasher that was happened when a log shared pointer wasn't valid.Greg Clayton1-10/+17
Fixed ThreadPlanCallFunction::ReportRegisterState(...) to only dump when verbose logging is enabled and fixed the function to use the new RegisterValue method of reading registers. Fixed the GDB remote client to not send a continue packet after receiving stdout or stderr from the inferior process. llvm-svn: 131628
2011-05-17Fix the error message when an expression evaluation is interrupted by a ↵Jim Ingham1-3/+5
crash/breakpoint hit to give the reason for the interrupt. Also make sure it we don't want to unwind from the evaluation we print something if it is interrupted. llvm-svn: 131448