summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/Process
Commit message (Collapse)AuthorAgeFilesLines
* When we use the "fd://%u" for file descriptors, we need to detect if this isGreg Clayton2011-07-021-7/+12
| | | | | | | | | a file or socket. We now make a getsockopt call to check if the fd is a socket. Also, the previous logic in the GDB communication needs to watch for success with an error so we can deal with EAGAIN and other normal "retry" error codes. llvm-svn: 134359
* Cleanup errors that come out of commands and make sure they all have newlinesGreg Clayton2011-07-021-10/+42
| | | | | | | | | | | | | _only_ in the resulting stream, not in the error objects (lldb_private::Error). lldb_private::Error objects should always just have an error string with no terminating newline characters or periods. Fixed an issue with GDB remote packet detection that could end up deadlocking if a full packet wasn't received in one chunk. Also modified the packet checking function to properly toss one or more bytes when it detects bad data. llvm-svn: 134357
* Removed an member variable "m_local_debugserver" that is no longer needed.Greg Clayton2011-06-242-3/+2
| | | | | | | We now check with the platform to see if we are doing local or remote debugging and setup the stdio accordingly. llvm-svn: 133835
* Fixed SBTarget attach calls to properly deal with being connected to a remotelyGreg Clayton2011-06-241-39/+35
| | | | | | | | | connected process connection. Also added support for more kinds of continue packet when multiple threads need to continue where some want to continue with signals. llvm-svn: 133785
* Remove duplicate m_monitor field from LaunchArgsPeter Collingbourne2011-06-201-1/+0
| | | | | | Fixes segfault when launching process on Linux. llvm-svn: 133484
* Use the dyld_mode, image_infos & image_infos_count passed into the shared ↵Jim Ingham2011-06-201-0/+2
| | | | | | | | library notification function to update libraries rather than reading the whole all_imaage_infos structure every time we get notified. llvm-svn: 133448
* Switch from USEC_PER_SEC/NSEC_PER_SEC/NSEC_PER_USEC to TimeValue constantsPeter Collingbourne2011-06-183-10/+11
| | | | | | Fixes the Linux build. llvm-svn: 133370
* Added the notion of an system root for SDKs. This is a directory where allGreg Clayton2011-06-171-9/+8
| | | | | | | | | | | | | | | | libraries and headers exist. This can be specified using the platform select function: platform select --sysroot /Volumes/remote-root remote-macosx Each platform subclass is free to interpret the sysroot as needed. Expose the new SDK root directory through the SBDebugger class. Fixed an issue with the GDB remote protocol where unimplemented packets were not being handled correctly. llvm-svn: 133231
* Improved the packet throughput when debugging with GDB remote by over 3x onGreg Clayton2011-06-176-162/+175
| | | | | | | | | | | | | darwin (not sure about other platforms). Modified the communication and connection classes to not require the BytesAvailable function. Now the "Read(...)" function has a timeout in microseconds. Fixed a lot of assertions that were firing off in certain cases and replaced them with error output and code that can deal with the assertion case. llvm-svn: 133224
* Primitive attach support for linuxJohnny Chen2011-06-143-24/+214
| | | | | | | This patch is a starting point for the attach functionality. Signed-off-by: Johnny Chen <johnny.chen@apple.com> llvm-svn: 133006
* Improve error reporting in ProcessMonitor::LaunchPeter Collingbourne2011-06-141-8/+46
| | | | llvm-svn: 132972
* Fix mistakes relating to ProcessMonitor::DupDescriptorPeter Collingbourne2011-06-141-4/+4
| | | | llvm-svn: 132971
* If ProcessMonitor::Launch fails, post semaphore to notify callerPeter Collingbourne2011-06-141-1/+3
| | | | llvm-svn: 132970
* Add license header to InferiorCallPOSIX.cppPeter Collingbourne2011-06-141-0/+9
| | | | llvm-svn: 132966
* Created a std::string in the base StopInfo class for the description andGreg Clayton2011-06-041-1/+104
| | | | | | | cleaned up all base classes that had their own copy. Added a SetDescription accessor to the StopInfo class. llvm-svn: 132615
* Implement RegisterContextLinux_x86_64::{Read,Write}AllRegisterValuesPeter Collingbourne2011-06-034-1/+118
| | | | llvm-svn: 132587
* Move SaveFrameZeroState and RestoreSaveFrameZero implementations to Thread ↵Peter Collingbourne2011-06-036-86/+0
| | | | | | base class llvm-svn: 132586
* Implement ProcessLinux::Do{Allocate,Deallocate}Memory using inferior ↵Peter Collingbourne2011-06-032-12/+34
| | | | | | mmap/munmap calls llvm-svn: 132585
* Move inferior mmap/munmap call code into their own functions in utility libPeter Collingbourne2011-06-033-154/+241
| | | | llvm-svn: 132584
* When emulating an ill-formed instruction, we should bail out instead of ↵Johnny Chen2011-06-021-35/+87
| | | | | | asserting and bringing down the whole process. llvm-svn: 132506
* Remove asserts that will crash LLDB. These should be changed to returnGreg Clayton2011-06-022-12/+15
| | | | | | | true/false in an extra boolean parameter and not cause the the binary that us using the LLDB framework to crash. llvm-svn: 132501
* Make sure we don't lose our stop reply packet in the case where the otherGreg Clayton2011-06-022-22/+7
| | | | | | GDB server doesn't support the LLDB specific qThreadStopInfo packet. llvm-svn: 132499
* Added some comments.Greg Clayton2011-05-251-0/+2
| | | | llvm-svn: 132066
* ABI plug-ins must implement the following pure virtual functions:Greg Clayton2011-05-242-28/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | virtual bool ABI::StackUsesFrames () = 0; Should return true if your ABI uses frames when doing stack backtraces. This means a frame pointer is used that points to the previous stack frame in some way or another. virtual bool ABI::CallFrameAddressIsValid (lldb::addr_t cfa) = 0; Should take a look at a call frame address (CFA) which is just the stack pointer value upon entry to a function. ABIs usually impose alignment restrictions (4, 8 or 16 byte aligned), and zero is usually not allowed. This function should return true if "cfa" is valid call frame address for the ABI, and false otherwise. This is used by the generic stack frame unwinding code to help determine when a stack ends. virtual bool ABI::CodeAddressIsValid (lldb::addr_t pc) = 0; Validates a possible PC value and returns true if an opcode can be at "pc". Some ABIs or architectures have fixed width instructions and must be aligned to a 2 or 4 byte boundary. "pc" can be an opcode or a callable address which means the load address might be decorated with extra bits (such as bit zero to indicate a thumb function call for ARM targets), so take this into account when returning true or false. The address should also be validated to ensure it is a valid address for the address size of the inferior process. 32 bit targets should make sure the address is less than UINT32_MAX. Modified UnwindLLDB to use the new ABI functions to help it properly terminate stacks. Modified the mach-o function that extracts dependent files to not resolve the path as the paths inside a binary might not match those on the current host system. llvm-svn: 132021
* Fixed an issue in the EmulateInstructionARM there the IT opcode was trying toGreg Clayton2011-05-232-3/+13
| | | | | | | | | | | | | | | | | | | | | | | | parse NOP instructions. I added the new table entries for the NOP for the plain NOP, Yield, WFE, WFI, and SEV variants. Modified the opcode emulation function EmulateInstructionARM::EmulateMOVRdSP(...) to notify us when it is creating a frame. Also added an abtract way to detect the frame pointer register for both the standard ARM ABI and for Darwin. Fixed GDBRemoteRegisterContext::WriteAllRegisterValues(...) to correctly be able to individually write register values back if case the 'G' packet is not implemented or returns an error. Modified the StopInfoMachException to "trace" stop reasons. On ARM we currently use the BVR/BCR register pairs to say "stop when the PC is not equal to the current PC value", and this results in a EXC_BREAKPOINT mach exception that has 0x102 in the code. Modified debugserver to create the short option string from long option definitions to make sure it doesn't get out of date. The short option string was missing many of the newer short option values due to a modification of the long options defs, and not modifying the short option string. llvm-svn: 131911
* Added functions to lldb_private::Address to set an address from a load addressGreg Clayton2011-05-221-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | and set the address as an opcode address or as a callable address. This is needed in various places in the thread plans to make sure that addresses that might be found in symbols or runtime might already have extra bits set (ARM/Thumb). The new functions are: bool Address::SetCallableLoadAddress (lldb::addr_t load_addr, Target *target); bool Address::SetOpcodeLoadAddress (lldb::addr_t load_addr, Target *target); SetCallableLoadAddress will initialize a section offset address if it can, and if so it might possibly set some bits in the address to make the address callable (bit zero might get set for ARM for Thumb functions). SetOpcodeLoadAddress will initialize a section offset address using the specified target and it will strip any special address bits if needed depending on the target. Fixed the ABIMacOSX_arm::GetArgumentValues() function to require arguments 1-4 to be in the needed registers (previously this would incorrectly fallback to the stack) and return false if unable to get the register values. The function was also modified to first look for the generic argument registers and then fall back to finding the registers by name. Fixed the objective trampoline handler to use the new Address::SetOpcodeLoadAddress function when needed to avoid address mismatches when trying to complete steps into objective C methods. Make similar fixes inside the AppleThreadPlanStepThroughObjCTrampoline::ShouldStop() function. Modified ProcessGDBRemote::BuildDynamicRegisterInfo(...) to be able to deal with the new generic argument registers. Modified RNBRemote::HandlePacket_qRegisterInfo() to handle the new generic argument registers on the debugserver side. Modified DNBArchMachARM::NumSupportedHardwareBreakpoints() to be able to detect how many hardware breakpoint registers there are using a darwin sysctl. Did the same for hardware watchpoints in DNBArchMachARM::NumSupportedHardwareWatchpoints(). llvm-svn: 131834
* Centralize the code that gathers the thread ID list from the remote GDBGreg Clayton2011-05-203-26/+66
| | | | | | | server so that it happens in command sequence where no other packets can sneak between. llvm-svn: 131769
* Fixed an issue in GDBRemoteCommunicationClient where we weren't listening toGreg Clayton2011-05-203-22/+24
| | | | | | | | | | | | | | | | | | | | the "payload_length" argument for the "payload" packet data. This meant we could end up sending random extra data with a packet depending on how the packet was constructed. Fixed GDBRemoteRegisterContext to properly save and restore all registers. Previous fixes had been added to work around the "payload_length" issues fixed above and aren't needed anymore. Fix logging in GDBRemoteCommunication to make sure we log the correct packet data being sent by using the packet length when dumping the packet contents. Added register definitions for 'arm-lldb' in the "disasm-gdb-remote.pl" script so if you have a register dump from the GDB remote that doesn't include the qRegisterInfo packets, you can manually tell the script which registers are which. llvm-svn: 131715
* A bit of clean up.Johnny Chen2011-05-193-113/+9
| | | | | | | | Removed ifdeffed out functions and added the implementation of WriteRegister for x86_64 architecture. Signed-off-by: Johnny Chen <johnny.chen@apple.com> llvm-svn: 131696
* Fixed a crasher that was happened when a log shared pointer wasn't valid.Greg Clayton2011-05-191-5/+13
| | | | | | | | | | | 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
* Added a way to resolve an load address from a target:Greg Clayton2011-05-182-58/+59
| | | | | | | | | | | | | | | | | | | | bool Address::SetLoadAddress (lldb::addr_t load_addr, Target *target); Added an == and != operator to RegisterValue. Modified the ThreadPlanTracer to use RegisterValue objects to store the register values when single stepping. Also modified the output to be a bit less wide. Fixed the ABIMacOSX_arm to not overwrite stuff on the stack. Also made the trivial function call be able to set the ARM/Thumbness of the target correctly, and also sets the return value ARM/Thumbness. Fixed the encoding on the arm s0-s31 and d16 - d31 registers when the default register set from a standard GDB server register sets. llvm-svn: 131517
* Fixed an issue that broke expression parsing related to backing upGreg Clayton2011-05-171-1/+1
| | | | | | | | | | | | | | | | | | | | all register values. There is some junk that was appearing at the end of the result the 'g' packet (read all register values). This function was being called in: bool GDBRemoteRegisterContext::ReadAllRegisterValues (lldb::DataBufferSP &data_sp) Then the packet data for the 'G' packet (write all registers) was being placed into "data_sp" so the: bool GDBRemoteRegisterContext::WriteAllRegisterValues (const lldb::DataBufferSP &data_sp) could restore it. In attempting to clean up the extra junk at the end of this packet data, the packet was getting truncated. llvm-svn: 131468
* Fixed the "mmap" to work on MacOSX/darwin by supplying the correct arguemnts.Greg Clayton2011-05-172-15/+56
| | | | | | | | | | | Modified ClangUserExpression and ClangUtilityFunction to display the actual error (if one is available) that made the JIT fail instead of a canned response. Fixed the restoring of all register values when the 'G' packet doesn't work to use the correct data. llvm-svn: 131454
* Added an allocated memory cache to avoid having to allocate memory over andGreg Clayton2011-05-171-1/+1
| | | | | | | | over when running JITed expressions. The allocated memory cache will cache allocate memory a page at a time for each permission combination and divvy up the memory and hand it out in 16 byte increments. llvm-svn: 131453
* Add support for the 'G' packet not being implemented or returning an error.Greg Clayton2011-05-162-7/+44
| | | | | | | If we are asked to restore all register values, we need to fall back to restoring each register one by one. llvm-svn: 131398
* Fixed an issue where large memory writes might not get chunked up into smallerGreg Clayton2011-05-161-0/+8
| | | | | | | | packets in GDB remote. Also fixed a compiler warning for an unhandled case for a switch. llvm-svn: 131397
* Dump JIT memory requirements when "log enable lldb expr" logging is enabled.Greg Clayton2011-05-151-1/+7
| | | | | | Correctly handle invalid 32-bit mmap fail return value in ProcessGDBRemote. llvm-svn: 131394
* Properly handle when commands are not unsupported in the GDB remote clients.Greg Clayton2011-05-151-55/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Prior to this fix we would often call SendPacketAndWaitForResponse() which returns the number of bytes in the response. The UNSUPPORTED response in the GDB remote protocol is zero bytes and we were checking for it inside an if statement: if (SendPacketAndWaitForResponse(...)) { if (response.IsUnsupportedResponse()) { // UNSUPPORTED... // This will never happen... } } We now handle is properly as: if (SendPacketAndWaitForResponse(...)) { } else { // UNSUPPORTED... } llvm-svn: 131393
* Fixed the default ARM registers to have the generic argumentGreg Clayton2011-05-151-5/+5
| | | | | | definitions and names. llvm-svn: 131387
* Added the ability to get the return value from a ThreadPlanCallFunctionGreg Clayton2011-05-155-47/+139
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-143-19/+140
| | | | llvm-svn: 131334
* This patch add a "fake" attach waiting for a real implementation andJohnny Chen2011-05-136-10/+63
| | | | | | | | | | | | | | | | solve the build break due to the lack of this method. It also propose a solution to the API changes in RegisterContext. I upgraded also the the python version in the makefile. My linux installation has python2.7 and AFAIK also the latest ubuntu has this version of python so maybe is worth upgrading. Patch by Marco Minutoli <mminutoli@gmail.com> [Note: I had to hand merge in the diffs since patch thinks it is a corrupt patch.] llvm-svn: 131313
* PATH_MAX is in limits.h on Linux.Johnny Chen2011-05-131-0/+1
| | | | | | Patch by Marco Minutoli <mminutoli@gmail.com> llvm-svn: 131304
* Moved all code from ArchDefaultUnwindPlan and ArchVolatileRegs into theirGreg Clayton2011-05-113-24/+29
| | | | | | | | | | | | | | | 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
* While implementing unwind information using UnwindAssemblyInstEmulation I ranGreg Clayton2011-05-0914-1104/+260
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | into some cleanup I have been wanting to do when reading/writing registers. Previously all RegisterContext subclasses would need to implement: virtual bool ReadRegisterBytes (uint32_t reg, DataExtractor &data); virtual bool WriteRegisterBytes (uint32_t reg, DataExtractor &data, uint32_t data_offset = 0); There is now a new class specifically designed to hold register values: lldb_private::RegisterValue The new register context calls that subclasses must implement are: virtual bool ReadRegister (const RegisterInfo *reg_info, RegisterValue &reg_value) = 0; virtual bool WriteRegister (const RegisterInfo *reg_info, const RegisterValue &reg_value) = 0; The RegisterValue class must be big enough to handle any register value. The class contains an enumeration for the value type, and then a union for the data value. Any integer/float values are stored directly in an appropriate host integer/float. Anything bigger is stored in a byte buffer that has a length and byte order. The RegisterValue class also knows how to copy register value bytes into in a buffer with a specified byte order which can be used to write the register value down into memory, and this does the right thing when not all bytes from the register values are needed (getting a uint8 from a uint32 register value..). All RegiterContext and other sources have been switched over to using the new regiter value class. llvm-svn: 131096
* Fixed an issue with the MacOSX backchain register context where the pc wasGreg Clayton2011-05-091-1/+1
| | | | | | being returned for both the PC and FP. llvm-svn: 131081
* Fixed not being able to launch the i386 slice of a universal binary by addingGreg Clayton2011-05-083-0/+23
| | | | | | | | a new "QLaunchArch:<arch-name>" where <arch-name> is the architecture name. This allows us to remotely launch a debugserver and then set the architecture for the binary we will launch. llvm-svn: 131064
* Added the ability to set the Platform path for a module through the SBModuleGreg Clayton2011-04-301-8/+1
| | | | | | | | | | | | | | interface. Added a quick way to set the platform though the SBDebugger interface. I will actually an a SBPlatform support soon, but for now this will do. ConnectionFileDescriptor can be passed a url formatted as: "fd://<fd>" where <fd> is a file descriptor in the current process. This is handy if you have services, deamons, or other tools that can spawn processes and give you a file handle. llvm-svn: 130565
* Got the EmulateInstruction CFI code a lot closer to producing CFI data.Greg Clayton2011-04-261-2/+2
| | | | | | | | | | | | | Switch the EmulateInstruction to use the standard RegisterInfo structure that is defined in the lldb private types intead of passing the reg kind and reg num everywhere. EmulateInstruction subclasses also need to provide RegisterInfo structs given a reg kind and reg num. This eliminates the need for the GetRegisterName() virtual function and allows more complete information to be passed around in the read/write register callbacks. Subclasses should always provide RegiterInfo structs with the generic register info filled in as well as at least one kind of register number in the RegisterInfo.kinds[] array. llvm-svn: 130256
* Changed the emulate instruction function to take emulate options whichGreg Clayton2011-04-262-7/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | are defined as enumerations. Current bits include: eEmulateInstructionOptionAutoAdvancePC eEmulateInstructionOptionIgnoreConditions Modified the EmulateInstruction class to have a few more pure virtuals that can help clients understand how many instructions the emulator can handle: virtual bool SupportsEmulatingIntructionsOfType (InstructionType inst_type) = 0; Where instruction types are defined as: //------------------------------------------------------------------ /// Instruction types //------------------------------------------------------------------ typedef enum InstructionType { eInstructionTypeAny, // Support for any instructions at all (at least one) eInstructionTypePrologueEpilogue, // All prologue and epilogue instructons that push and pop register values and modify sp/fp eInstructionTypePCModifying, // Any instruction that modifies the program counter/instruction pointer eInstructionTypeAll // All instructions of any kind } InstructionType; This allows use to tell what an emulator can do and also allows us to request these abilities when we are finding the plug-in interface. Added the ability for an EmulateInstruction class to get the register names for any registers that are part of the emulation. This helps with being able to dump and log effectively. The UnwindAssembly class now stores the architecture it was created with in case it is needed later in the unwinding process. Added a function that can tell us DWARF register names for ARM that goes along with the source/Utility/ARM_DWARF_Registers.h file: source/Utility/ARM_DWARF_Registers.c Took some of plug-ins out of the lldb_private namespace. llvm-svn: 130189
OpenPOWER on IntegriCloud