summaryrefslogtreecommitdiffstats
path: root/lldb/tools/debugserver/source/MacOSX
Commit message (Collapse)AuthorAgeFilesLines
...
* <rdar://problem/10544202>Greg Clayton2011-12-084-35/+53
| | | | | | Fixed detection of AVX on darwin now that our kernel supports it. llvm-svn: 146135
* Expose the DNBArchMachARM::DBG typedef, specify the type with theJason Molenda2011-12-082-2/+3
| | | | | | class scoping in DumpDBGState()'s definiton. llvm-svn: 146128
* Add a typedef for arm_debug_state_t as DBG. Plus some minor comment changes.Johnny Chen2011-12-062-7/+7
| | | | llvm-svn: 145978
* Added optional calls to lldb_private::Process for getting memory region infoGreg Clayton2011-11-188-41/+53
| | | | | | | | | | | | | | | | | | | | | | | from a process and hooked it up to the new packet that was recently added to our GDB remote executable named debugserver. Now Process has the following new calls: virtual Error Process::GetMemoryRegionInfo (lldb::addr_t load_addr, MemoryRegionInfo &range_info); virtual uint32_t GetLoadAddressPermissions (lldb::addr_t load_addr); Only the first one needs to be implemented by subclasses that can add this support. Cleaned up the way the new packet was implemented in debugserver to be more useful as an API inside debugserver. Also found an error where finding a region for an address actually will pick up the next region that follows the address in the query so we also need ot make sure that the address we requested the region for falls into the region that gets returned. llvm-svn: 144976
* Remove the QAddressIsExecutable packet I added last night.Jason Molenda2011-11-098-21/+45
| | | | | | | | | | | | | | | Add a more general purpose qMemoryRegionInfo packet which can describe various attributes about a memory region. Currently it will return the start address, size, and permissions (read, write, executable) for the memory region. It may be possible to add additional attributes in the future such as whether the region is designated as stack memory or jitted code a la vmmap. I still haven't implemented the lldb side of the code to use this packet yet so there may be unexpected behavior - but the basic implementation looks about right. I'll hook it up to lldb soon and fix any problems that crop up. llvm-svn: 144175
* Add "QAddressIsExecutable" packet to debugserver. Used to testJason Molenda2011-11-087-1/+39
| | | | | | | | | | | | | | | | | | | | | | | | whether a given address is in an executable region of memory or not. I haven't written the lldb side that will use this packet it hasn't been tested yet but it's a simple enough bit of code. I want to have this feature available for the unwinder code. When we're stopped at an address with no valid symbol context, there are a number of questions I'd like to ask -- is the current pc value in an executable region (e.g. did they jump to unallocated/unexecutable memory? we know how to unwind from here if so.) Is the stack pointer or the frame pointer the correct register to use to find the caller's saved pc value? Once we're past the first frame we can trust things like eh_frame and ABI unwind schemes but the first frame is challenging and having a way to check potential addresses to see if they're executable or not would help narrow down the possibilities a lot. llvm-svn: 144074
* Fixed the Xcode project building of LLVM to be a bit more user friendly:Greg Clayton2011-11-042-30/+30
| | | | | | | | | | | | | | | | | | | - If you download and build the sources in the Xcode project, x86_64 builds by default using the "llvm.zip" checkpointed LLVM. - If you delete the "lldb/llvm.zip" and the "lldb/llvm" folder, and build the Xcode project will download the right LLVM sources and build them from scratch - If you have a "lldb/llvm" folder already that contains a "lldb/llvm/lib" directory, we will use the sources you have placed in the LLDB directory. Python can now be disabled for platforms that don't support it. Changed the way the libllvmclang.a files get used. They now all get built into arch specific directories and never get merged into universal binaries as this was causing issues where you would have to go and delete the file if you wanted to build an extra architecture slice. llvm-svn: 143678
* Enabled the "printf" attribute on all debugserver logging functions and fixed Greg Clayton2011-10-287-70/+60
| | | | | | the ensuing mayhem. llvm-svn: 143244
* Python does some bad things to the signal masks in the current process and Greg Clayton2011-10-281-2/+10
| | | | | | | | then we spawn child processes (debugserver, etc) and those bad settings get inherited. We stop this from happening by correctly mucking with the posix spawn attributes. llvm-svn: 143176
* Modify the delegation chain from MachThreadList -> MachThread -> ↵Johnny Chen2011-09-297-4/+77
| | | | | | | | | | | | | | DNBArchProtocol so that when the watchpoint state is changed, not only does the change propagate to all the thread instances, it also updates a global debug state, if chosen by the DNBArchProtocol derivative. Once implemented, the DNBArchProtocol derivative, also makes sure that when new thread comes along, it tries to inherit from the global debug state, if it is valid. Modify TestWatchpointMultipleThreads.py to test this functionality. llvm-svn: 140811
* Fix a bug in the current MacOSX MachThreadList::EnableHardwareWatchpoint() ↵Johnny Chen2011-09-291-22/+23
| | | | | | | | | impl so that it enables the hardware watchpoint for all existing threads. Add a test file for that. Also fix MachThreadList::DisableHardwareWatchpoint(). llvm-svn: 140757
* The r139982 patch has a bug by using the constant "x86_AVX_STATE64".Johnny Chen2011-09-191-1/+1
| | | | | | Patch by Filipe. llvm-svn: 140037
* Convert lldb::ModuleSP to use an instrusive ref counted pointer.Greg Clayton2011-09-172-2/+3
| | | | | | | | | We had some cases where getting the shared pointer for a module from the global module list was causing a performance issue when debugging with DWARF in .o files. Now that the module uses intrusive ref counts, we can easily convert any pointer to a shared pointer. llvm-svn: 139983
* Added more logging, and renamed FPR to FPU in a the register set/flavor enum.Greg Clayton2011-09-174-19/+77
| | | | llvm-svn: 139982
* Foe x86_64/i386, piggyback the hardware index of the fired watchpoint in the ↵Johnny Chen2011-09-172-0/+8
| | | | | | | | | | exception data sent back to the debugger. On the debugger side, use the opportunity during the StopInfoMachException::CreateStopReasonWithMachException() method to set the hardware index for the very watchpoint location. llvm-svn: 139975
* Add comment regarding method call to DNBArchProtocol::NotifyException().Johnny Chen2011-09-151-0/+1
| | | | llvm-svn: 139800
* Modify MachThread::NotifyException() to allow the arch specific protocol to ↵Johnny Chen2011-09-151-26/+5
| | | | | | | | | | process the passed in (MachException::Data &)exc first before possible reassignment of the member m_stop_exception with exc. This allows lldb to stop at the watchpoint of a simple test program. llvm-svn: 139767
* Update I386 DNB impl to fix the same errors as DNBArchImplX86_64: ('==' ↵Johnny Chen2011-09-131-12/+12
| | | | | | instead of '=') and (by value instead of by reference). llvm-svn: 139667
* Watchpoint WIP:Johnny Chen2011-09-131-12/+12
| | | | | | | | | | | | | | | | | o WatchpointLocationList: Add a GetListMutex() method. o WatchpointLocation: Fix Dump() method where there was an extra % in the format string. o Target.cpp: Add implementation to CreateWatchpointLocation() to create and enable a watchpoint. o DNBArchImplX86_64.cpp: Fix bugs in SetWatchpoint()/ClearWatchpoint() where '==' was used, instead of '=', to assign/reset the data break address to a debug register. Also fix bugs where a by reference debug_state should have been used, not by value. llvm-svn: 139666
* Reset the debug status register, only if necessary, before we resume,Johnny Chen2011-09-092-9/+27
| | | | | | which saves unnecessary traffic to the kernel. llvm-svn: 139410
* Basic infrastructure code to exploit malloc stack logging as available on ↵Enrico Granata2011-09-093-0/+244
| | | | | | Mac OS X to track the allocation history of pointers on the target process llvm-svn: 139337
* Added comments about exception code.Johnny Chen2011-09-082-0/+4
| | | | llvm-svn: 139294
* Add logic to the DNBArchImplX86_64/DNBArchImplI386::NotifyException() ↵Johnny Chen2011-09-084-27/+95
| | | | | | | | | | | | | callback method in order to distinguish the real single step exception from a watchpoint exception which uses the same exc_type of EXC_BREAKPOINT and exc_code of EXC_I386_SGL. This is done by checking the debug status register to find out whether the watchpoint data break event has fired, and, if yes, stuff the data break address into the exception's exc_sub_code field on the debugserver side for lldb to consume on the other end. llvm-svn: 139274
* Add logic to MachThreadList::GetThreadID() for the use case of setting a ↵Johnny Chen2011-09-071-4/+16
| | | | | | | | | | | | | watchpoint (MachThreadList::EnableHardwareWatchpoint()) where the watchpoint is not associated with a thread and the current thread, if set, is returned, otherwise we return the first thread. Plus minor change to RNBRemote::HandlePacket_z() to use the existing macros to check the validity of break_id/watch_id. llvm-svn: 139246
* Watchpoint work in progress:Johnny Chen2011-09-024-0/+70
| | | | | | | | | | | Add a virtual method GetHardwareWatchpointHit() to the DNBArchProtocol base class which consults the architecture to return the watchpoint hit; otherwise return an invalid index. Add impl. of the method to X86_64 and I386 subclasses, plus reset the debug status register before we resume execution of the inferior thread. llvm-svn: 139034
* Renaming: from IsVacantWatchpoint() to IsWatchpointVacant().Johnny Chen2011-08-314-8/+8
| | | | llvm-svn: 138907
* Renamed the helper method to ClearWatchpointHits() for clarity of its purpose.Johnny Chen2011-08-314-4/+4
| | | | llvm-svn: 138899
* Add a couple of helper methods to check/clear the debug status registerJohnny Chen2011-08-314-0/+50
| | | | | | which contains the watchpoint hit information. llvm-svn: 138881
* Fix the shift amount applied to size_and_rw_bits() for debug control register,Johnny Chen2011-08-312-2/+4
| | | | | | which did not take into account the hardware index. llvm-svn: 138867
* Update comments.Johnny Chen2011-08-312-4/+4
| | | | llvm-svn: 138863
* Watchpoint work in progress: add helper methods to DNB arch impl for I386 to ↵Johnny Chen2011-08-313-48/+122
| | | | | | implment Enable/DisableHardwareWatchpoint. llvm-svn: 138847
* Watchpoint work in progress: add helper methods to DNB arch impl for X86_64 ↵Johnny Chen2011-08-313-44/+118
| | | | | | to implment Enable/DisableHardwareWatchpoint. llvm-svn: 138844
* Add stubs of incomplete watchpoint implementation with "FIXME" markers.Johnny Chen2011-08-304-0/+230
| | | | llvm-svn: 138790
* Added the debug registers for i386 and x86_64 in preparation for watchpoints.Greg Clayton2011-08-296-14/+104
| | | | llvm-svn: 138770
* In the case where we are trying to resume a thread all the way to 0, if we getJim Ingham2011-08-111-1/+3
| | | | llvm-svn: 137287
* Ignore the static analyzer, instead; and add comment why.Johnny Chen2011-08-101-2/+2
| | | | llvm-svn: 137275
* Incremental fixes of issues found by Xcode static analyzer.Johnny Chen2011-08-101-1/+2
| | | | llvm-svn: 137267
* Fixed a problem where the HasAVX() code inSean Callanan2011-08-093-16/+20
| | | | | | | | debugserver did not back up %ebx/%rbx, even though it was being clobbered by the CPUID instruction. llvm-svn: 137131
* The "bool HasAVX()" function doesn't backup and restore theGreg Clayton2011-08-092-0/+14
| | | | | | | | cpu registers it uses and it crashes the release version of debugserver. We just get lucky in Debug builds. Until this is fixed I am disabling AVX detection to avoid the crashes. llvm-svn: 137113
* Added some logging and did some member renaming.Greg Clayton2011-08-092-46/+57
| | | | llvm-svn: 137112
* If we are telling only one thread to run in debugserver, and that thread has ↵Jim Ingham2011-07-213-31/+99
| | | | | | | | been suspended from outside the debugger, resume it before running so we will actually make progress. llvm-svn: 135655
* Added support for dynamic detection of AVX, andSean Callanan2011-07-166-16/+77
| | | | | | | | | | | | | | | | | | | | fixed a few bugs that revealed. Now the "register read" command should show AVX registers (ymm0-ymm15) on Mac OS X platforms that support them. When testing this on Mac OS X, run debugserver manually, like this: debugserver --native-regs localhost:1111 /path/to/executable Then lldb /path/to/executable ... (lldb) process connect connect://localhost:1111 llvm-svn: 135331
* Added the ability to see block variables when looking up addressesGreg Clayton2011-07-111-7/+7
| | | | | | | | | | | | with the "target modules lookup --address <addr>" command. The variable ID's, names, types, location for the address, and declaration is displayed. This can really help with crash logs since we get, on MacOSX at least, the registers for the thread that crashed so it is often possible to figure out some of the variable contents. llvm-svn: 134886
* Fixed an issue in the EmulateInstructionARM there the IT opcode was trying toGreg Clayton2011-05-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | 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 new lldb_private::Process memory read/write functions to stop a bunchGreg Clayton2011-05-221-67/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | of duplicated code from appearing all over LLDB: lldb::addr_t Process::ReadPointerFromMemory (lldb::addr_t vm_addr, Error &error); bool Process::WritePointerToMemory (lldb::addr_t vm_addr, lldb::addr_t ptr_value, Error &error); size_t Process::ReadScalarIntegerFromMemory (lldb::addr_t addr, uint32_t byte_size, bool is_signed, Scalar &scalar, Error &error); size_t Process::WriteScalarToMemory (lldb::addr_t vm_addr, const Scalar &scalar, uint32_t size, Error &error); in lldb_private::Process the following functions were renamed: From: uint64_t Process::ReadUnsignedInteger (lldb::addr_t load_addr, size_t byte_size, Error &error); To: uint64_t Process::ReadUnsignedIntegerFromMemory (lldb::addr_t load_addr, size_t byte_size, uint64_t fail_value, Error &error); Cleaned up a lot of code that was manually doing what the above functions do to use the functions listed above. Added the ability to get a scalar value as a buffer that can be written down to a process (byte swapping the Scalar value if needed): uint32_t Scalar::GetAsMemoryData (void *dst, uint32_t dst_len, lldb::ByteOrder dst_byte_order, Error &error) const; The "dst_len" can be smaller that the size of the scalar and the least significant bytes will be written. "dst_len" can also be larger and the most significant bytes will be padded with zeroes. Centralized the code that adds or removes address bits for callable and opcode addresses into lldb_private::Target: lldb::addr_t Target::GetCallableLoadAddress (lldb::addr_t load_addr, AddressClass addr_class) const; lldb::addr_t Target::GetOpcodeLoadAddress (lldb::addr_t load_addr, AddressClass addr_class) const; All necessary lldb_private::Address functions now use the target versions so changes should only need to happen in one place if anything needs updating. Fixed up a lot of places that were calling : addr_t Address::GetLoadAddress(Target*); to call the Address::GetCallableLoadAddress() or Address::GetOpcodeLoadAddress() as needed. There were many places in the breakpoint code where things could go wrong for ARM if these weren't used. llvm-svn: 131878
* Added functions to lldb_private::Address to set an address from a load addressGreg Clayton2011-05-221-55/+76
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Added generic register numbers for simple ABI argument registers and definedGreg Clayton2011-05-152-15/+16
| | | | | | | | | | | | | | | | | the appropriate registers for arm and x86_64. The register names for the arguments that are the size of a pointer or less are all named "arg1", "arg2", etc. This allows you to read these registers by name: (lldb) register read arg1 arg2 arg3 ... You can also now specify you want to see alternate register names when executing the read register command: (lldb) register read --alternate (lldb) register read -A llvm-svn: 131376
* Change an unconditional log to a conditional one.Jim Ingham2011-05-091-2/+2
| | | | llvm-svn: 131079
* Added new OptionGroup classes for UInt64, UUID, File and Boolean values.Greg Clayton2011-05-033-2/+4
| | | | | | | | | | | | | | | | | | | | | Removed the "image" command and moved it to "target modules". Added an alias for "image" to "target modules". Added some new target commands to be able to add and load modules to a target: (lldb) target modules add <path> (lldb) target modules load [--file <path>] [--slide <offset>] [<sect-name> <sect-load-addr> ...] So you can load individual sections without running a target: (lldb) target modules load --file /usr/lib/libSystem.B.dylib __TEXT 0x7fccc80000 __DATA 0x1234000000 Or you can rigidly slide an entire shared library: (lldb) target modules load --file /usr/lib/libSystem.B.dylib --slid 0x7fccc80000 This should improve bare board debugging when symbol files need to be slid around manually. llvm-svn: 130796
* Moved the execution context that was in the Debugger intoGreg Clayton2011-04-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | the CommandInterpreter where it was always being used. Make sure that Modules can track their object file offsets correctly to allow opening of sub object files (like the "__commpage" on darwin). Modified the Platforms to be able to launch processes. The first part of this move is the platform soon will become the entity that launches your program and when it does, it uses a new ProcessLaunchInfo class which encapsulates all process launching settings. This simplifies the internal APIs needed for launching. I want to slowly phase out process launching from the process classes, so for now we can still launch just as we used to, but eventually the platform is the object that should do the launching. Modified the Host::LaunchProcess in the MacOSX Host.mm to correctly be able to launch processes with all of the new eLaunchFlag settings. Modified any code that was manually launching processes to use the Host::LaunchProcess functions. Fixed an issue where lldb_private::Args had implicitly defined copy constructors that could do the wrong thing. This has now been fixed by adding an appropriate copy constructor and assignment operator. Make sure we don't add empty ModuleSP entries to a module list. Fixed the commpage module creation on MacOSX, but we still need to train the MacOSX dynamic loader to not get rid of it when it doesn't have an entry in the all image infos. Abstracted many more calls from in ProcessGDBRemote down into the GDBRemoteCommunicationClient subclass to make the classes cleaner and more efficient. Fixed the default iOS ARM register context to be correct and also added support for targets that don't support the qThreadStopInfo packet by selecting the current thread (only if needed) and then sending a stop reply packet. Debugserver can now start up with a --unix-socket (-u for short) and can then bind to port zero and send the port it bound to to a listening process on the other end. This allows the GDB remote platform to spawn new GDB server instances (debugserver) to allow platform debugging. llvm-svn: 129351
OpenPOWER on IntegriCloud