summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Rationalize how we do Halt-ing before Destroy and Detach.Jim Ingham2013-03-291-93/+0
| | | | | | <rdar://problem/13527167> llvm-svn: 178325
* <rdar://problem/13521159>Greg Clayton2013-03-271-22/+22
| | | | | | | | 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
* A little cleanup. {Disable/Enable}Breakpoint actually disables/enables ↵Jim Ingham2013-02-151-7/+7
| | | | | | | | | BreakpointSites not breakpoints, it is confusing to have it not named appropriately. Also in StopInfoMachException, we aren't testing for software or not software, just whether the thing is a breakpoint we set. So don't use "software"... llvm-svn: 175241
* <rdar://problem/12693921>Greg Clayton2013-02-141-3/+3
| | | | | | Rename the monitor command from "qCmd" (incorrect) to "qRcmd". llvm-svn: 175191
* <rdar://problem/12693921>Greg Clayton2013-02-011-0/+54
| | | | | | Added the ability to send monitor command to the remote GDB server with "process plugin packet monitor". llvm-svn: 174231
* <rdar://problem/12491235> Jason Molenda2013-01-301-115/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | Enhance lldb so it can search for a kernel in memory when attaching to a remote system. Remove some of the code that was doing this from ProcessMachCore and ProcessGDBRemote and put it in DynamicLoaderDarwinKernel. I've added a new setting, plugin.dynamic-loader.darwin-kernel.scan-type which can be set to none - for environments where reading random memory can cause a device crash basic - look at one fixed location in memory for a kernel load address, plus the contents of that address fast-scan - the default, tries "basic" and then looks for the kernel's mach header near the current pc value when lldb connects exhaustive-scan - on 32-bit targets, step through the entire range where the kernel can be loaded, looking for the kernel binary I don't have the setting set up correctly right now, I'm getting back unexpected values from the Property system, but I'll figure that out tomorrow and fix. Besides that, all of the different communication methods / types of kernels appear to be working correctly with these changes. llvm-svn: 173891
* <rdar://problem/13069948>Greg Clayton2013-01-251-3/+3
| | | | | | | | | | | | Major fixed to allow reading files that are over 4GB. The main problems were that the DataExtractor was using 32 bit offsets as a data cursor, and since we mmap all of our object files we could run into cases where if we had a very large core file that was over 4GB, we were running into the 4GB boundary. So I defined a new "lldb::offset_t" which should be used for all file offsets. After making this change, I enabled warnings for data loss and for enexpected implicit conversions temporarily and found a ton of things that I fixed. Any functions that take an index internally, should use "size_t" for any indexes and also should return "size_t" for any sizes of collections. llvm-svn: 173463
* Changed the register number lists for the qRegisterInfo packet response to ↵Greg Clayton2013-01-211-2/+6
| | | | | | be raw hex to match all other register reading and writing APIs. llvm-svn: 173105
* <rdar://problem/13020634>Greg Clayton2013-01-211-5/+39
| | | | | | | | | | Fixed the 32, 16, and 8 bit pseudo regs for x86_64 (real reg of "rax" which subvalues "eax", "ax", etc...) to correctly get updated when stepping. Also fixed it so actual registers can specify what other registers must be invalidated when a register is modified. Previously, only pseudo registers could invalidate other registers. Modified the LLDB qRegisterInfo extension to the GDB remote interface to support specifying the containing registers with the new "container-regs" key whose value is a comma separated list of register numbers. Also added a "invalidate-regs" key whose value is also a comma separated list of register numbers. Removed the hack GDBRemoteDynamicRegisterInfo::Addx86_64ConvenienceRegisters() function and modified "debugserver" to specify the registers correctly using the new "container-regs" and "invalidate-regs" keys. llvm-svn: 173096
* <rdar://problem/12976277>Han Ming Ong2013-01-181-1/+7
| | | | | | Swap in index ids for thread ids in GDBRemoteCommunicationClient. Besides dealing with the async logic, I have to take care of the situation when the inferior paused as well. llvm-svn: 172869
* <rdar://problem/12976225>Han Ming Ong2013-01-081-2/+16
| | | | | | Checking in the support for doing index ids reservation when given a thread id. llvm-svn: 171904
* <rdar://problem/11961650> Jason Molenda2012-12-191-3/+24
| | | | | | | | | | | | | | | | | Update the debugserver "qProcessInfo" implementation to return the cpu type, cpu subtype, OS and vendor information just like qHostInfo does so lldb can create an ArchSpec based on the returned values. Add a new GetProcessArchitecture to GDBRemoteCommunicationClient akin to GetHostArchitecture. If the qProcessInfo packet is supported, GetProcessArchitecture will return the cpu type / subtype of the process -- e.g. a 32-bit user process running on a 64-bit x86_64 Mac system. Have ProcessGDBRemote set the Target's architecture based on the GetProcessArchitecture when we've completed an attach/launch/connect. llvm-svn: 170491
* Adding events when watchpoints are set or changed.Jim Ingham2012-12-181-5/+6
| | | | | | <rdar://problem/11597849> llvm-svn: 170400
* <rdar://problem/12820334>Greg Clayton2012-12-061-2/+2
| | | | | | | | | | | | | I modified the "Args::StringtoAddress(...)" function to be able to evaluate address expressions. This is now used for any command line arguments or options that takes addresses like: memory read <addr> [<end-addr>] memory write <addr> breakpoint set --address <addr> disassemble --start-address <addr> --end-address <addr> It calls the expression parser to evaluate the address expression and will also work around the issue where the compiler doesn't like to add offsets to function pointers (which is what happens when you try to evaluate "main + 12"). So there is a temp fix in the Args::StringtoAddress() to work around this until we can get special compiler support for debug expressions with function pointers. llvm-svn: 169556
* Fix Linux build warnings due to redefinition of macros:Daniel Malea2012-12-051-0/+2
| | | | | | | | | - add new header lldb-python.h to be included before other system headers - short term fix (eventually python dependencies must be cleaned up) Patch by Matt Kopec! llvm-svn: 169341
* <rdar://problem/12649160>Greg Clayton2012-12-051-0/+11
| | | | | | Added the ability to debug through your process exec'ing itself to the same architecture. llvm-svn: 169340
* Read full 64 bits of kernel address when locating aJason Molenda2012-12-011-1/+1
| | | | | | | 64-bit kernel in ProcessGDBRemote. <rdar://problem/12657369> llvm-svn: 169080
* Resolve printf formatting warnings on Linux:Daniel Malea2012-11-291-34/+34
| | | | | | | | - use macros from inttypes.h for format strings instead of OS-specific types Patch from Matt Kopec! llvm-svn: 168945
* <rdar://problem/12723044> For 'process plugin packet send…', we just send ↵Han Ming Ong2012-11-261-25/+13
| | | | | | | | it async by default There is no good reason not to use async. llvm-svn: 168606
* Add support for libdispatch version 4 structure layout for findingJason Molenda2012-11-101-7/+24
| | | | | | | | | | GCD queue names of threads to ProcessGDBRemote::GetDispatchQueueNameForThread() May need tweaking once this version is rolled out but visual inspection looks fine. <rdar://problem/12333100> llvm-svn: 167667
* Remove a debugging printf that was left in the code.Greg Clayton2012-11-091-1/+0
| | | | llvm-svn: 167637
* Removed use of non-standard escape character '\%'Filipe Cabecinhas2012-11-091-1/+1
| | | | llvm-svn: 167636
* There seems to be some odd corner case where we shut down the ↵Jim Ingham2012-11-011-12/+51
| | | | | | | | ProcessGDBRemote, but we haven't managed to shut down the async thread. That causes the ProcessGDBRemote::AsyncThread to crash when it wakes up. So I changed StartAsyncThread and StopAsyncThread to be callable multiple times (only the first one does anything) so that we can just shut it down unequivocally in the ProcessGDBRemote destructor. <rdar://problem/12602981> llvm-svn: 167197
* If we got what looks like a single step exception but we weren't single ↵Jim Ingham2012-10-271-3/+7
| | | | | | | | stepping then just report the raw exception. llvm-svn: 166859
* <rdar://problem/12491387>Greg Clayton2012-10-191-2/+2
| | | | | | | | | | Added commands to the KDP plug-in that allow sending raw commands through the KDP protocol. You specify a command byte and a payload as ASCII hex bytes, and the packet is created with a valid header/sequenceID/length and sent. The command responds with a raw ASCII hex string that contains all bytes in the reply including the header. An example of sending a read register packet for the GPR on x86_64: (lldb) process plugin packet send --command 0x07 --payload 0100000004000000 llvm-svn: 166346
* Added "process plugin packet send" and "process plugin packet history" for ↵Greg Clayton2012-10-151-8/+106
| | | | | | GDB remote. "process plugin packet send" will send a packet and receive a response. "process plugin packet history" will dump the packet history buffer. llvm-svn: 165991
* <rdar://problem/12491387>Greg Clayton2012-10-131-1/+57
| | | | | | | | | | | I added the ability for a process plug-in to implement custom commands. All the lldb_private::Process plug-in has to do is override: virtual CommandObject * GetPluginCommandObject(); This object returned should be a multi-word command that vends LLDB commands. There is a sample implementation in ProcessGDBRemote that is hollowed out. It is intended to be used for sending a custom packet, though the body of the command execute function has yet to be implemented! llvm-svn: 165861
* Change the Thread constructor over to take a Process& rather than a ↵Jim Ingham2012-10-101-2/+2
| | | | | | | | | | | | | ProcessSP. We can't create Threads with a NULL ProcessSP, so it makes no sense to use the SP. Then make the Thread a Broadcaster, and get it to broadcast when the selected frame is changed (but only from the Command Line) and when Thread::ReturnFromFrame changes the stack. Made the Driver use this notification to print the new thread status rather than doing it in the command. Fixed a few places where people were setting their broadcaster class by hand rather than using the static broadcaster class call. <rdar://problem/12383087> llvm-svn: 165640
* In ↵Jason Molenda2012-10-061-0/+5
| | | | | | | | | | | | | | | | | | DynamicLoaderDarwinKernel::OSKextLoadedKextSummary::LoadImageUsingMemoryModule(), if we have a kernel binary, set the target's architecture to match. Include the target's architecture in the ModuleSpec when we're searching for the kext binaries on the local system -- otherwise we won't get a specific slice of a fat file picked out for us and we won't use the returned Module correctly. Remove the redundant attempt to find a file on the local filesystem from this method. In ProcessGDBRemote::CheckForKernel(), if we have a kernel binary in memory, mark the canJIT as false. There is no jitting code in kernel debug sessions. llvm-svn: 165357
* Don't turn on the debugserver log by default.Jim Ingham2012-10-031-2/+2
| | | | llvm-svn: 165176
* The kernel loading code is now isolated in the DynamicLoaderDarwinKernel;Jason Molenda2012-10-031-103/+30
| | | | | | | | | | remove the duplicates of this code in ProcessGDBRemote and ProcessKDP. These two Process plugins will hardcode their DynamicLoader name to be the DynamicLoaderDarwinKernel so the correct DynamicLoader is picked, and return the kernel load address as the ImageInfosAddress. <rdar://problem/12417038> llvm-svn: 165080
* Add the RelocateOrLoadKernel and LoadKernel methods to ↵Jason Molenda2012-09-291-18/+191
| | | | | | | | | | | | | | ProcessGDBRemote::DoRemoteConnect(). When attaching to a remote system that does not look like a typical vendor system, and no executable binary was specified to lldb, check a couple of fixed locations where kernels running in ASLR mode (slid in memory to a random address) store their load addr when booted in debug mode, and relocate the symbols or load the kernel wholesale from the host computer if we can find it. <rdar://problem/7714201> llvm-svn: 164888
* Add support for debugging KASLR kernels via kdp (the kernel beingJason Molenda2012-09-291-1/+20
| | | | | | | | | | | | | | | | | | loaded at a random offset). To get the kernel's UUID and load address I need to send a kdp packet so I had to implement the kernel relocation (and attempt to find the kernel if none was provided to lldb already) in ProcessKDP -- but this code really properly belongs in DynamicLoaderDarwinKernel. I also had to add an optional Stream to ConnectRemote so ProcessKDP::DoConnectRemote can print feedback about the remote kernel's UUID, load address, and notify the user if we auto-loaded the kernel via the UUID. <rdar://problem/7714201> llvm-svn: 164881
* <rdar://problem/11752499>Greg Clayton2012-09-191-6/+6
| | | | | | Improve error messages when memory read/write fails. llvm-svn: 164188
* Stop using the "%z" size_t modifier and cast all size_t values to uint64_t. ↵Greg Clayton2012-09-181-3/+3
| | | | | | Some platforms don't support this modification. llvm-svn: 164148
* Typed too fast adding lockers. Actually put them in a locker.Jim Ingham2012-09-111-2/+2
| | | | llvm-svn: 163575
* <rdar://problem/11757916>Greg Clayton2012-08-291-0/+1
| | | | | | | | | | | | 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
* Added Args::StringForEncoding(), Args::StringToGenericRegister() and ↵Greg Clayton2012-08-241-36/+8
| | | | | | | | centralized the parsing of the string to encoding and string to generic register. Added code the initialize the register context in the OperatingSystemPython plug-in with the new PythonData classes, and added a test OperatingSystemPython module in lldb/examples/python/operating_system.py that we can use for testing. llvm-svn: 162530
* Cope with the case where the user-supplied callbacks want the watchpoint ↵Johnny Chen2012-08-231-0/+4
| | | | | | | | | | | | itself to be disabled! Previously we put a WatchpointSentry object within StopInfo.cpp to disable-and-then-enable the watchpoint itself while we are performing the actions associated with the triggered watchpoint, which can cause the user-initiated watchpoint disabling action to be negated. Add a test case to verify that a watchpoint can be disabled during the callbacks. llvm-svn: 162483
* Added a test for the Python part of SBInputReader callbacks.Filipe Cabecinhas2012-08-221-2/+6
| | | | llvm-svn: 162357
* Added an lldb_private & equivalent SB API to send an AsyncInterrupt to the ↵Jim Ingham2012-07-271-1/+1
| | | | | | | | | | | | | | event loop. Convert from calling Halt in the lldb Driver.cpp's input reader's sigint handler to sending this AsyncInterrupt so it can be handled in the event loop. If you are attaching and get an async interrupt, abort the attach attempt. Also remember to destroy the process if get interrupted while attaching. Getting this to work also required handing the eBroadcastBitInterrupt in a few more places in Process WaitForEvent & friends. <rdar://problem/10792425> llvm-svn: 160903
* Provide subdir of StopInfoMachException.h in #include.Jason Molenda2012-07-251-1/+1
| | | | llvm-svn: 160704
* Add "vAttachOrWait" to debugserver, so you can implement "attach to the ↵Jim Ingham2012-07-201-1/+14
| | | | | | process if it exists OR wait for it" without race conditions. Use that in lldb. llvm-svn: 160578
* Changed ProcessGDBRemote to avoid the reservedSean Callanan2012-07-191-1/+14
| | | | | | | | | port range. Also added a comment indicating that more work is needed. <rdar://problem/11580051> llvm-svn: 160514
* Ran the static analyzer on the codebase and found a few things.Greg Clayton2012-07-171-9/+1
| | | | llvm-svn: 160338
* <rdar://problem/11782789> Changes to the watchpoint implementation on ARM so ↵Enrico Granata2012-07-131-0/+7
| | | | | | that we single-step before stopping at the WP. This is necessary because on ARM the WP triggers before the opcode is actually executed, so we would be unable to continue since we would keep hitting the WP. We work around this by disabling the WP, single stepping and then putting the WP back in place. llvm-svn: 160199
* If we hit a breakpoint but there's a thread specifier which doesn't match ↵Jim Ingham2012-07-111-8/+14
| | | | | | this thread, return no stop reason. llvm-svn: 160080
* Work around some problems destroying a process with older debugservers.Jim Ingham2012-07-041-1/+108
| | | | | | rdar://problem/11359989 llvm-svn: 159697
* Add an "extra-startup-commands" process setting so we can send some command ↵Jim Ingham2012-07-021-0/+8
| | | | | | strings to the actual process plugin to interpret as it wishes. llvm-svn: 159511
* Change the Mutex::Locker class so that it takes the Mutex object and locks ↵Jim Ingham2012-06-081-3/+0
| | | | | | | | | | | | | | it, rather than being given the pthread_mutex_t from the Mutex and locks that. That allows us to track ownership of the Mutex better. Used this to switch the LLDB_CONFIGURATION_DEBUG enabled assert when we can't get the gdb-remote sequence mutex to assert when the thread that had the mutex releases it. This is generally more useful information than saying just who failed to get it (since the code that had it locked often had released it by the time the assert fired.) llvm-svn: 158240
OpenPOWER on IntegriCloud