summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/Process/gdb-remote
Commit message (Collapse)AuthorAgeFilesLines
...
* Added a new class to Process.h: ProcessAttachInfo. This class contains enoughGreg Clayton2011-11-152-2/+2
| | | | | | | | | | | | | | | | | | | | | info for us to attach by pid, or by name and will also allow us to eventually do a lot more powerful attaches. If you look at the options for the "platform process list" command, there are many options which we should be able to specify. This will allow us to do things like "attach to a process named 'tcsh' that has a parent process ID of 123", or "attach to a process named 'x' which has an effective user ID of 345". I finished up the --shell implementation so that it can be used without the --tty option in "process launch". The "--shell" option now can take an optional argument which is the path to the shell to use (or a partial name like "sh" which we will find using the current PATH environment variable). Modified the Process::Attach to use the new ProcessAttachInfo as the sole argument and centralized a lot of code that was in the "process attach" Execute function so that everyone can take advantage of the powerful new attach functionality. llvm-svn: 144615
* <rdar://problem/10103980>Greg Clayton2011-11-132-53/+0
| | | | | | | A long time ago we started to centralized the STDOUT in lldb_private::Process but we missed a few things still in ProcessGDBRemote. llvm-svn: 144491
* Modified all Process::Launch() calls to use a ProcessLaunchInfo structureGreg Clayton2011-11-032-28/+41
| | | | | | | | on internal only (public API hasn't changed) to simplify the paramter list to the launch calls down into just one argument. Also all of the argument, envronment and stdio things are now handled in a much more centralized fashion. llvm-svn: 143656
* Fix up how we shut down the communication with debugserver so we don't rely onJim Ingham2011-10-281-12/+4
| | | | | | debugserver being responsive to shut down. llvm-svn: 143174
* <rdar://problem/10357230>Greg Clayton2011-10-271-1/+11
| | | | | | | | Fixed an issue where async packets were incurring a delay even though they were sent correctly. We now properly broadcast the private run state being resumed correctly. Also fixed logging to reflect what is happening. llvm-svn: 143154
* Cleaned up many error codes. For any who is filling in error strings intoGreg Clayton2011-10-262-4/+4
| | | | | | | | | | | | | lldb_private::Error objects the rules are: - short strings that don't start with a capitol letter unless the name is a class or anything else that is always capitolized - no trailing newline character - should be one line if possible Implemented a first pass at adding "--gdb-format" support to anything that accepts format with optional size/count. llvm-svn: 142999
* If a process plug-in was specified by name, always let the plug-in get used.Greg Clayton2011-10-211-0/+3
| | | | llvm-svn: 142688
* Moved lldb::user_id_t values to be 64 bit. This was going to be needed forGreg Clayton2011-10-193-25/+25
| | | | | | | | | | | 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
* Quiet the default "log enable lldb step" output down a little bit.Jim Ingham2011-10-152-4/+4
| | | | llvm-svn: 142024
* SBValue::Watch() and SBValue::WatchPointee() are now the official API for ↵Johnny Chen2011-10-143-9/+9
| | | | | | | | | | | | | | | | | | creating a watchpoint for either the variable encapsulated by SBValue (Watch) or the pointee encapsulated by SBValue (WatchPointee). Removed SBFrame::WatchValue() and SBFrame::WatchLocation() API as a result of that. Modified the watchpoint related test suite to reflect the change. Plus replacing WatchpointLocation with Watchpoint throughout the code base. There are still cleanups to be dome. This patch passes the whole test suite. Check it in so that we aggressively catch regressions. llvm-svn: 141925
* ProcessGDBRemote::BuildDynamicRegisterInfo() - even if we don't have a ↵Jason Molenda2011-10-061-1/+11
| | | | | | | | | Target architecture set up yet, if we're talking to an Apple arm device set the register set based on the arm device's attributes; this is a safe assumption to make in this particular environment. llvm-svn: 141265
* Cleaned up the the code that figures out the inlined stack frames given a Greg Clayton2011-10-011-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | symbol context that represents an inlined function. This function has been renamed internally to: bool SymbolContext::GetParentOfInlinedScope (const Address &curr_frame_pc, SymbolContext &next_frame_sc, Address &next_frame_pc) const; And externally to: SBSymbolContext SBSymbolContext::GetParentOfInlinedScope (const SBAddress &curr_frame_pc, SBAddress &parent_frame_addr) const; The correct blocks are now correctly calculated. Switched the stack backtracing engine (in StackFrameList) and the address context printing over to using the internal SymbolContext::GetParentOfInlinedScope(...) so all inlined callstacks will match exactly. llvm-svn: 140910
* Added the ability to restrict breakpoints by function name, function regexp, ↵Jim Ingham2011-09-231-1/+1
| | | | | | | | | | selector etc to specific source files. Added SB API's to specify these source files & also more than one module. Added an "exact" option to CompileUnit's FindLineEntry API. llvm-svn: 140362
* Update declarations for all functions/methods that accept printf-styleJason Molenda2011-09-203-6/+6
| | | | | | | | stdarg formats to use __attribute__ format so the compiler can flag incorrect uses. Fix all incorrect uses. Most of these are innocuous, a few were resulting in crashes. llvm-svn: 140185
* Foe x86_64/i386, piggyback the hardware index of the fired watchpoint in the ↵Johnny Chen2011-09-171-1/+2
| | | | | | | | | | 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
* Set the OS in the triple correctly in response to the qHostInfo packet.Greg Clayton2011-09-151-1/+1
| | | | llvm-svn: 139759
* Fixed the logging output to be done consistently across all plug-ins.Greg Clayton2011-09-121-15/+15
| | | | | | | Added a new log category for DWARF called "aranges" to log the parsing of address ranges. llvm-svn: 139489
* Fix compiler warnings for GetGDBStoppointType().Johnny Chen2011-09-091-2/+2
| | | | llvm-svn: 139402
* Fill out implementation of Enable/DisableWatchpoint() for ProcessGDBRemote ↵Johnny Chen2011-09-061-4/+46
| | | | | | | | class (Not Tested Yet). Also update the signature of WatchpointLocation::SetEnable() to take a bool as input arg. llvm-svn: 139198
* Added a new plug-in type: lldb_private::OperatingSystem. The operating system Greg Clayton2011-08-224-75/+20
| | | | | | | | | | | | | | | | | | | | plug-ins are add on plug-ins for the lldb_private::Process class that can add thread contexts that are read from memory. It is common in kernels to have a lot of threads that are not currently executing on any cores (JTAG debugging also follows this sort of thing) and are context switched out whose state is stored in memory data structures. Clients can now subclass the OperatingSystem plug-ins and then make sure their Create functions correcltly only enable themselves when the right binary/target triple are being debugged. The operating system plug-ins get a chance to attach themselves to processes just after launching or attaching and are given a lldb_private::Process object pointer which can be inspected to see if the main executable, target triple, or any shared libraries match a case where the OS plug-in should be used. Currently the OS plug-ins can create new threads, define the register contexts for these threads (which can all be different if desired), and populate and manage the thread info (stop reason, registers in the register context) as the debug session goes on. llvm-svn: 138228
* Added the ability to remove orphaned module shared pointers from a ModuleList.Greg Clayton2011-08-111-3/+3
| | | | | | | | | | | | | | 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
* Include the qLaunchSuccess and qC packets in the Greg Clayton2011-08-101-1/+2
| | | | | | | | 10 second timeout zone. When launching we increase the timeout to 10 seconds to ensure we have time to launch a process, and then set it back. llvm-svn: 137256
* While tracking down memory consumption issue a few things were needed: the Greg Clayton2011-08-102-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ability to dump more information about modules in "target modules list". We can now dump the shared pointer reference count for modules, the pointer to the module itself (in case performance tools can help track down who has references to said pointer), and the modification time. Added "target delete [target-idx ...]" to be able to delete targets when they are no longer needed. This will help track down memory usage issues and help to resolve when module ref counts keep getting incremented. If the command gets no arguments, the currently selected target will be deleted. If any arguments are given, they must all be valid target indexes (use the "target list" command to get the current target indexes). Took care of a bunch of "no newline at end of file" warnings. TimeValue objects can now dump their time to a lldb_private::Stream object. Modified the "target modules list --global" command to not error out if there are no targets since it doesn't require a target. Fixed an issue in the MacOSX DYLD dynamic loader plug-in where if a shared library was updated on disk, we would keep using the older one, even if it was updated. Don't allow the ModuleList::GetSharedModule(...) to return an empty module. Previously we could specify a valid path on disc to a module, and specify an architecture that wasn't contained in that module and get a shared pointer to a module that wouldn't be able to return an object file or a symbol file. We now make sure an object file can be extracted prior to adding the shared pointer to the module to get added to the shared list. llvm-svn: 137196
* Fix a crash while running the test suite. Need to check the (LogSP)log ↵Johnny Chen2011-08-091-3/+6
| | | | | | shared pointer before using it. llvm-svn: 137136
* Added some logging and did some member renaming.Greg Clayton2011-08-091-0/+9
| | | | llvm-svn: 137112
* Initialize the all important automatic variable 'lldb::ConnectionStatus ↵Johnny Chen2011-07-191-1/+1
| | | | | | | | | status' before invoking the Read(...) method to read in bytes. This seems to fix the infinite looping I was seeing on SnowLeopard while running the test suite. llvm-svn: 135461
* Added a boolean to the pure virtual lldb_private::Process::CanDebug(...)Greg Clayton2011-07-172-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | method so process plug-ins that are requested by name can answer yes when asked if they can debug a target that might not have any file in the target. Modified the ConnectionFileDescriptor to have both a read and a write file descriptor. This allows us to support UDP, and eventually will allow us to support pipes. The ConnectionFileDescriptor class also has a file descriptor type for each of the read and write file decriptors so we can use the correct read/recv/recvfrom call when reading, or write/send/sendto for writing. Finished up an initial implementation of UDP where you can use the "udp://" URL to specify a host and port to connect to: (lldb) process connect --plugin kdp-remote udp://host:41139 This will cause a ConnectionFileDescriptor to be created that can send UDP packets to "host:41139", and it will also bind to a localhost port that can be given out to receive the connectionless UDP reply. Added the ability to get to the IPv4/IPv6 socket port number from a ConnectionFileDescriptor instance if either file descriptor is a socket. The ProcessKDP can now successfully connect to a remote kernel and detach using the above "processs connect" command!!! So far we have the following packets working: KDP_CONNECT KDP_DISCONNECT KDP_HOSTINFO KDP_VERSION KDP_REATTACH Now that the packets are working, adding new packets will go very quickly. llvm-svn: 135363
* Python summary strings:Enrico Granata2011-07-151-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | - you can use a Python script to write a summary string for data-types, in one of three ways: -P option and typing the script a line at a time -s option and passing a one-line Python script -F option and passing the name of a Python function these options all work for the "type summary add" command your Python code (if provided through -P or -s) is wrapped in a function that accepts two parameters: valobj (a ValueObject) and dict (an LLDB internal dictionary object). if you use -F and give a function name, you're expected to define the function on your own and with the right prototype. your function, however defined, must return a Python string - test case for the Python summary feature - a few quirks: Python summaries cannot have names, and cannot use regex as type names both issues will be fixed ASAP major redesign of type summary code: - type summary working with strings and type summary working with Python code are two classes, with a common base class SummaryFormat - SummaryFormat classes now are able to actively format objects rather than just aggregating data - cleaner code to print descriptions for summaries the public API now exports a method to easily navigate a ValueObject hierarchy New InputReaderEZ and PriorityPointerPair classes Several minor fixes and improvements llvm-svn: 135238
* Added "target variable" command that allows introspection of globalGreg Clayton2011-07-072-7/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | variables prior to running your binary. Zero filled sections now get section data correctly filled with zeroes when Target::ReadMemory reads from the object file section data. Added new option groups and option values for file lists. I still need to hook up all of the options to "target variable" to allow more complete introspection by file and shlib. Added the ability for ValueObjectVariable objects to be created with only the target as the execution context. This allows them to be read from the object files through Target::ReadMemory(...). Added a "virtual Module * GetModule()" function to the ValueObject class. By default it will look to the parent variable object and return its module. The module is needed when we have global variables that have file addresses (virtual addresses that are specific to module object files) and in turn allows global variables to be displayed prior to running. Removed all of the unused proxy object support that bit rotted in lldb_private::Value. Replaced a lot of places that used "FileSpec::Compare (lhs, rhs) == 0" code with the more efficient "FileSpec::Equal (lhs, rhs)". Improved logging in GDB remote plug-in. llvm-svn: 134579
* Fixed some issues with ARM backtraces by not processing any push/pop Greg Clayton2011-07-062-3/+2
| | | | | | | | | | | | | | instructions if they are conditional. Also fixed issues where the PC wasn't getting bit zero stripped for ARM targets when a stack frame was thumb. We now properly call through the GetOpcodeLoadAddress() functions to make sure the addresses are properly stripped for any targets that may decorate up their addresses. We now don't pass the SIGSTOP signals along. We can revisit this soon, but currently this was interfering with debugging some older ARM targets that don't have vCont support in the GDB server. llvm-svn: 134461
* 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
* Switch from USEC_PER_SEC/NSEC_PER_SEC/NSEC_PER_USEC to TimeValue constantsPeter Collingbourne2011-06-182-7/+8
| | | | | | 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-175-149/+148
| | | | | | | | | | | | | 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
* 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
* Move SaveFrameZeroState and RestoreSaveFrameZero implementations to Thread ↵Peter Collingbourne2011-06-032-32/+0
| | | | | | base class llvm-svn: 132586
* Move inferior mmap/munmap call code into their own functions in utility libPeter Collingbourne2011-06-031-154/+21
| | | | llvm-svn: 132584
* 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
* Fixed an issue in the EmulateInstructionARM there the IT opcode was trying toGreg Clayton2011-05-231-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | 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
* 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-181-57/+57
| | | | | | | | | | | | | | | | | | | | 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
OpenPOWER on IntegriCloud