summaryrefslogtreecommitdiffstats
path: root/lldb/source/Target/ThreadPlanCallFunction.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Fix some order-of-initialisation warningsPeter Collingbourne2011-06-031-4/+4
| | | | llvm-svn: 132588
* Fixed a crasher that was happened when a log shared pointer wasn't valid.Greg Clayton2011-05-191-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
* Fix the error message when an expression evaluation is interrupted by a ↵Jim Ingham2011-05-171-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
* Added the ability to get the return value from a ThreadPlanCallFunctionGreg Clayton2011-05-151-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | thread plan. In order to get the return value, you can call: void ThreadPlanCallFunction::RequestReturnValue (lldb::ValueSP &return_value_sp); This registers a shared pointer to a return value that will get filled in if everything goes well. After the thread plan is run the return value will be extracted for you. Added an ifdef to be able to switch between the LLVM MCJIT and the standand JIT. We currently have the standard JIT selected because we have some work to do to get the MCJIT fuctioning properly. Added the ability to call functions with 6 argument in the x86_64 ABI. Added the ability for GDBRemoteCommunicationClient to detect if the allocate and deallocate memory packets are supported and to not call allocate memory ("_M") or deallocate ("_m") if we find they aren't supported. Modified the ProcessGDBRemote::DoAllocateMemory(...) and ProcessGDBRemote::DoDeallocateMemory(...) to be able to deal with the allocate and deallocate memory packets not being supported. If they are not supported, ProcessGDBRemote will switch to calling "mmap" and "munmap" to allocate and deallocate memory instead using our trivial function call support. Modified the "void ProcessGDBRemote::DidLaunchOrAttach()" to correctly ignore the qHostInfo triple information if any was specified in the target. Currently if the target only specifies an architecture when creating the target: (lldb) target create --arch i386 a.out Then the vendor, os and environemnt will be adopted by the target. If the target was created with any triple that specifies more than the arch: (lldb) target create --arch i386-unknown-unknown a.out Then the target will maintain its triple and not adopt any new values. This can be used to help force bare board debugging where the dynamic loader for static files will get used and users can then use "target modules load ..." to set addressses for any files that are desired. Added back some convenience functions to the lldb_private::RegisterContext class for writing registers with unsigned values. Also made all RegisterContext constructors explicit to make sure we know when an integer is being converted to a RegisterValue. llvm-svn: 131370
* Expand the ABI prepare trivial function call to allow 6 simple args.Greg Clayton2011-05-141-26/+114
| | | | llvm-svn: 131334
* Cleaned up the ABI::PrepareTrivialCall() function to take three argumentGreg Clayton2011-05-121-8/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | pointers: virtual bool PrepareTrivialCall (Thread &thread, lldb::addr_t sp, lldb::addr_t functionAddress, lldb::addr_t returnAddress, lldb::addr_t *arg1_ptr, lldb::addr_t *arg2_ptr, lldb::addr_t *arg3_ptr) const = 0; Prior to this it was: virtual bool PrepareTrivialCall (Thread &thread, lldb::addr_t sp, lldb::addr_t functionAddress, lldb::addr_t returnAddress, lldb::addr_t arg, lldb::addr_t *this_arg, lldb::addr_t *cmd_arg) const = 0; This was because the function that called this slowly added more features to be able to call a C++ member function that might have a "this" pointer, and then later added "self + cmd" support for objective C. Cleaning this code up and the code that calls it makes it easier to implement the functions for new targets. The MacOSX_arm::PrepareTrivialCall() is now filled in and ready for testing. llvm-svn: 131221
* Moved all code from ArchDefaultUnwindPlan and ArchVolatileRegs into theirGreg Clayton2011-05-111-1/+1
| | | | | | | | | | | | | | | respective ABI plugins as they were plug-ins that supplied ABI specfic info. Also hookep up the UnwindAssemblyInstEmulation so that it can generate the unwind plans for ARM. Changed the way ABI plug-ins are handed out when you get an instance from the plug-in manager. They used to return pointers that would be mananged individually by each client that requested them, but now they are handed out as shared pointers since there is no state in the ABI objects, they can be shared. llvm-svn: 131193
* Fixed a bug in which expression-local variables wereSean Callanan2011-05-091-3/+4
| | | | | | | | | | treated as being permanently resident in target memory. In fact, since the expression's stack frame is deleted and potentially re-used after the expression completes, the variables need to be treated as being freeze-dried. llvm-svn: 131104
* Add a method "GetEntryPoint" to the ObjectFile class, and implement it on ↵Jim Ingham2011-03-071-8/+22
| | | | | | MachO & ELF - though the ELF implementation is probably a little weak. Then use this method in place of directly looking for "start" in the ThreadPlanCallFunction constructor to find the stopping point for our function evaluation. llvm-svn: 127194
* Make sure that if a CallFunction thread plan crashes while running in the ↵Jim Ingham2011-01-261-1/+5
| | | | | | | | "run to address" mode, and it is an auto-discard thread plan, the plan stack unwinds properly. llvm-svn: 124306
* Centralize the register reporting (might want to move this function to Thread).Jim Ingham2011-01-221-30/+34
| | | | | | | Make sure DoTakedown gets called only once by adding a dedicated m_takedown_done bool. Add a little more useful logging. llvm-svn: 124015
* Back up both the register AND the stop state when calling functions.Jim Ingham2011-01-201-11/+19
| | | | | | | Set the thread state to "bland" before calling functions so they don't inherit the pending signals and die. llvm-svn: 123869
* In ThreadPlanCallFunction, do the Takedown right when the thread plan gets ↵Jim Ingham2011-01-181-0/+7
| | | | | | popped. When the function call is discarded (e.g. when it crashes and discard_on_error is true) the plan gets discarded. You need to make sure that the stack gets restored right then, and not wait till you start again and the thread plan stack is cleared. llvm-svn: 123716
* Fixed issues with RegisterContext classes and the subclasses. There wasGreg Clayton2011-01-061-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | an issue with the way the UnwindLLDB was handing out RegisterContexts: it was making shared pointers to register contexts and then handing out just the pointers (which would get put into shared pointers in the thread and stack frame classes) and cause double free issues. MallocScribble helped to find these issues after I did some other cleanup. To help avoid any RegisterContext issue in the future, all code that deals with them now returns shared pointers to the register contexts so we don't end up with multiple deletions. Also now that the RegisterContext class doesn't require a stack frame, we patched a memory leak where a StackFrame object was being created and leaked. Made the RegisterContext class not have a pointer to a StackFrame object as one register context class can be used for N inlined stack frames so there is not a 1 - 1 mapping. Updates the ExecutionContextScope part of the RegisterContext class to never return a stack frame to indicate this when it is asked to recreate the execution context. Now register contexts point to the concrete frame using a concrete frame index. Concrete frames are all of the frames that are actually formed on the stack of a thread. These concrete frames can be turned into one or more user visible frames due to inlining. Each inlined stack frame has the exact same register context (shared via shared pointers) as any parent inlined stack frames all the way up to the concrete frame itself. So now the stack frames and the register contexts should behave much better. llvm-svn: 122976
* Added support for generating expressions that haveSean Callanan2010-12-131-2/+4
| | | | | | | | | | | | | | access to the members of the Objective-C self object. The approach we take is to generate the method as a @category on top of the self object, and to pass the "self" pointer to it. (_cmd is currently NULL.) Most changes are in ClangExpressionDeclMap, but the change that adds support to the ABIs to pass _cmd touches a fair amount of code. llvm-svn: 121722
* Excised a version of the low-level function callingSean Callanan2010-11-121-75/+0
| | | | | | | | | logic that supported calling functions with arbitrary arguments. We use ClangFunction for this, and the low-level logic is only required to support one or two pointer arguments. llvm-svn: 118871
* Add ThreadPlanTracer class to allow instruction step tracing of execution.Jim Ingham2010-11-111-1/+1
| | | | | | Also changed eSetVarTypeBool to eSetVarTypeBoolean to make it consistent with eArgTypeBoolean. llvm-svn: 118824
* Added more logging so we see the register stateSean Callanan2010-11-081-0/+38
| | | | | | | | | when a function starts and ends, and also the disassembly for anything that is a client of ClangExpressionParser after it has been JIT compiled. llvm-svn: 118401
* Modified all logging calls to hand out shared pointers to make sure weGreg Clayton2010-11-061-2/+2
| | | | | | | | | | | don't crash if we disable logging when some code already has a copy of the logger. Prior to this fix, logs were handed out as pointers and if they were held onto while a log got disabled, then it could cause a crash. Now all logs are handed out as shared pointers so this problem shouldn't happen anymore. We are also using our new shared pointers that put the shared pointer count and the object into the same allocation for a tad better performance. llvm-svn: 118319
* Re-enabled LLDB's pointer checkers, and moved theSean Callanan2010-11-041-4/+12
| | | | | | | implementation of the Objective-C object checkers into the Objective-C language runtime. llvm-svn: 118226
* Factored the code that implements breakpoints onSean Callanan2010-11-031-102/+17
| | | | | | | | exceptions for different languages out of ThreadPlanCallFunction and put it into the appropriate language runtimes. llvm-svn: 118200
* Modified ThreadPlanCallFunction to perform theSean Callanan2010-11-031-17/+66
| | | | | | | | exception checks at the right time, and modified ClangFunction so that it doesn't misinterpret the stop as a timeout stop. llvm-svn: 118189
* Modified the thread plan that calls functions toSean Callanan2010-11-031-4/+93
| | | | | | | | set breakpoints at the different locations where an exception could be thrown, so that exceptions thrown by expressions are properly caught. llvm-svn: 118142
* Fixed a problem where function calls on i386 weren't Sean Callanan2010-10-261-1/+4
| | | | | | | | | being generated correctly. Also added a messy way to single-step through expressions that I will improve soon. llvm-svn: 117342
* The call function thread plan should allow internal breakpoints to continue ↵Jim Ingham2010-10-261-2/+41
| | | | | | | | on. Also made stopping in mid-expression evaluation when we hit a breakpoint/signal work. llvm-svn: 117341
* Removed a bit of dead code. Thanks to EricSean Callanan2010-10-191-5/+0
| | | | | | Christopher for pointing it out. llvm-svn: 116871
* Expressions now claim responsibility for all stopsSean Callanan2010-10-191-0/+4
| | | | | | | that occur while they run. This means that they clean up after themselves even when they crash. llvm-svn: 116870
* Removed the hacky "#define this ___clang_this" handlerSean Callanan2010-09-211-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | for C++ classes. Replaced it with a less hacky approach: - If an expression is defined in the context of a method of class A, then that expression is wrapped as ___clang_class::___clang_expr(void*) { ... } instead of ___clang_expr(void*) { ... }. - ___clang_class is resolved as the type of the target of the "this" pointer in the method the expression is defined in. - When reporting the type of ___clang_class, a method with the signature ___clang_expr(void*) is added to that class, so that Clang doesn't complain about a method being defined without a corresponding declaration. - Whenever the expression gets called, "this" gets looked up, type-checked, and then passed in as the first argument. This required the following changes: - The ABIs were changed to support passing of the "this" pointer as part of trivial calls. - ThreadPlanCallFunction and ClangFunction were changed to support passing of an optional "this" pointer. - ClangUserExpression was extended to perform the wrapping described above. - ClangASTSource was changed to revert the changes required by the hack. - ClangExpressionParser, IRForTarget, and ClangExpressionDeclMap were changed to handle different manglings of ___clang_expr flexibly. This meant no longer searching for a function called ___clang_expr, but rather looking for a function whose name *contains* ___clang_expr. - ClangExpressionParser and ClangExpressionDeclMap now remember whether "this" is required, and know how to look it up as necessary. A few inheritance bugs remain, and I'm trying to resolve these. But it is now possible to use "this" as well as refer implicitly to member variables, when in the proper context. llvm-svn: 114384
* Moved the section load list up into the target so we can use the targetGreg Clayton2010-09-141-6/+6
| | | | | | to symbolicate things without the need for a valid process subclass. llvm-svn: 113895
* Added support for rewriting objc_msgSend so we canSean Callanan2010-07-311-0/+19
| | | | | | | | | | | call Objective-C methods from expressions. Also added some more logging to the function-calling thread plan so that we can see the registers when a function finishes. Also documented things maybe a bit better. llvm-svn: 109938
* Fix constructor initialization order. Patch by Bill Lynch.Benjamin Kramer2010-07-161-8/+8
| | | | llvm-svn: 108524
* Two changes in this checkin. Added a ThreadPlanKind so that I can do some ↵Jim Ingham2010-06-191-2/+2
| | | | | | | | | | | reasoning based on the kind of thread plan without having to use RTTI. Removed the ThreadPlanContinue and replaced with a ShouldAutoContinue query that serves the same purpose. Having to push another plan to assert that if there's no other indication the target should continue when this plan is popped was flakey and error prone. This method is more stable, and fixed problems we were having with thread specific breakpoints. llvm-svn: 106378
* Initial checkin of lldb code from internal Apple repo.Chris Lattner2010-06-081-0/+250
llvm-svn: 105619
OpenPOWER on IntegriCloud