Commit Graph

722 Commits

Author SHA1 Message Date
Greg Clayton 4df8ddfc97 Completed more work on the KDP darwin kernel debugging Process plug-in.
Implemented connect, disconnect, reattach, version, and hostinfo.

Modified the ConnectionFileDescriptor class to be able to handle UDP. 

Added a new Stream subclass called StreamBuffer that is backed by a
llvm::SmallVector for better efficiency.

Modified the DataExtractor class to have a static function that can
dump hex bytes into a stream. This is currently being used to dump incoming
binary packet data in the KDP plug-in.

llvm-svn: 135338
2011-07-16 03:19:08 +00:00
Greg Clayton 59ec512c46 Fixed the comment lines in the file comment headers.
llvm-svn: 135284
2011-07-15 18:02:58 +00:00
Greg Clayton 57508026c2 Added the ability to connect using "tcp://<host>:<port>" which is the
same as the old "connect://<host>:<port>". Also added the ability to
connect using "udp://<host>:<port>" which will open a connected 
datagram socket. I need to find a way to specify a non connected
datagram socket as well. 

We might need to start setting some settings in the URL itself, 
maybe something like:

udp://<host>:<port>?connected=yes
udp://<host>:<port>?connected=no

I am open to suggestions for URL settings.

Also did more work on the KDP darwin kernel plug-in.

 

llvm-svn: 135277
2011-07-15 16:31:38 +00:00
Greg Clayton f9765acddd Hollowed out process plug-in to do KDP darwin kernel debugging.
llvm-svn: 135240
2011-07-15 03:27:12 +00:00
Enrico Granata f2bbf717f7 Python summary strings:
- 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
2011-07-15 02:26:42 +00:00
Greg Clayton d16e1e596a Added the ability to _not_ skip the prologue when settings breakpoints
by name by adding an extra parameter to the lldb_private::Target breakpoint 
setting functions.

Added a function in the DWARF symbol file plug-in that can dump errors
and prints out which DWARF file the error is happening in so we can track
down what used to be assertions easily.

Fixed the MacOSX kernel plug-in to properly read the kext images and set
the kext breakpoint to watch for kexts as they are loaded.

llvm-svn: 134990
2011-07-12 17:06:17 +00:00
Greg Clayton dda0d1274e Fixed an assertion crasher. We now handle things correclty and
emit an error to stderr when we see this issue.

llvm-svn: 134872
2011-07-10 17:32:33 +00:00
Greg Clayton 374972eebd More cleanup on the this plug-in and tried to set the notification
breakpoint. I haven't been able to see this breakpoint get hit yet
so I still have testing I need to do with the kernel dynamic loader.

llvm-svn: 134825
2011-07-09 17:15:55 +00:00
Greg Clayton ed49aed3af Fixed an issue where we weren't zeroing out the type fully
thanks to a nice clang warning!

llvm-svn: 134824
2011-07-09 17:14:57 +00:00
Greg Clayton 9e00b6a654 Added the ability to get an abstract file type (executable, object file,
shared library, etc) and strata (user/kernel) from an object file. This will
help with plug-in and platform selection when given a new binary with the
"target create <file>" command.

llvm-svn: 134779
2011-07-09 00:41:34 +00:00
Greg Clayton df0b7d5c31 LLDB now has a Kernel dynamic linker that can detect where kexts are
loaded. It locks onto *-apple-darwin binaries where the binary has
a "__KLD" segment. Soon I will modify the lldb_private::ObjectFile
class to return an executable type which will be an enum with values
something like:
eObjectFileTypeUserExectable,
eObjectFileTypeUserSharedLibrary,
eObjectFileTypeKernelExectable,
eObjectFileTypeKernelSharedLibrary,
eObjectFileTypeObjectFile,
eObjectFileTypeCoreFile

But for now we look at the section since a user and kernel mach-o
executable have the same mach-o file type.

llvm-svn: 134682
2011-07-08 04:11:42 +00:00
Greg Clayton 0d9fc764d2 Make the kernel able to do its initial load from target memory with the
process being preferred for all memory reads.

llvm-svn: 134681
2011-07-08 03:21:57 +00:00
Greg Clayton 7b242381b8 Added the start of the darwin dynamic loader plug-in. It isn't hooked up to
be detected yet, but most of the initial code is there and needs to be 
debugged more.

llvm-svn: 134672
2011-07-08 00:48:09 +00:00
Greg Clayton 1d4313b261 Stop the lldb_private::RegularExpression class from implicitly
constructing itself and causing unexpected things to happen
in LLDB.

llvm-svn: 134598
2011-07-07 04:49:07 +00:00
Greg Clayton 644247c1dc Added "target variable" command that allows introspection of global
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
2011-07-07 01:59:51 +00:00
Greg Clayton 34132754bd Fixed some issues with ARM backtraces by not processing any push/pop
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
2011-07-06 04:07:21 +00:00
Greg Clayton 0c51ac3295 When we use the "fd://%u" for file descriptors, we need to detect if this is
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
2011-07-02 23:21:06 +00:00
Greg Clayton 197bacfffa Cleanup errors that come out of commands and make sure they all have newlines
_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
2011-07-02 21:07:54 +00:00
Greg Clayton e305594277 Centralize all of the type name code so that we always strip the leading
"struct ", "class ", and "union " from the start of any type names that are
extracted from clang QualType objects. I had to fix test suite cases that
were expecting the struct/union/class prefix to be there.

llvm-svn: 134132
2011-06-30 02:28:26 +00:00
Greg Clayton a2721476e7 This commit adds broad architectural support for hierarchical
inspection of namespaces in the expression parser.

ClangExpressionDeclMap hitherto reported that namespaces had
been completely imported, even though the namespaces are
returned empty.  To deal with this situation, ClangASTSource
was recently extended with an API to complete incomplete type
definitions, and, for greater efficiency, to complete these
definitions partially, returning only those objects that have
a given name.

This commit supports these APIs on LLDB's side, and uses it
to provide information on types resident in namespaces.
Namespaces are now imported as they were -- that is to say,
empty -- but with minimal import mode on.  This means that
Clang will come back and request their contents by name as
needed.  We now respond with information on the contained
types; this will be followed soon by information on functions
and variables.

llvm-svn: 133852
2011-06-25 00:44:06 +00:00
Greg Clayton f58c269aa1 Removed an member variable "m_local_debugserver" that is no longer needed.
We now check with the platform to see if we are doing local or remote 
debugging and setup the stdio accordingly.

llvm-svn: 133835
2011-06-24 22:32:10 +00:00
Jim Ingham d555bacca3 Add support for looking up ivar offset from the ObjC runtime.
llvm-svn: 133831
2011-06-24 22:03:24 +00:00
Greg Clayton 0c74e78d63 Fixed SBTarget attach calls to properly deal with being connected to a remotely
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
2011-06-24 03:21:43 +00:00
Peter Collingbourne d155c0b451 Remove duplicate m_monitor field from LaunchArgs
Fixes segfault when launching process on Linux.

llvm-svn: 133484
2011-06-20 23:55:58 +00:00
Jim Ingham f72ce3a216 Use the dyld_mode, image_infos & image_infos_count passed into the shared library notification function
to update libraries rather than reading the whole all_imaage_infos structure every time we get notified.

llvm-svn: 133448
2011-06-20 17:32:44 +00:00
Greg Clayton 5cf21f5f06 Fixed a crasher where we were accessing a symbol with a bad index.
llvm-svn: 133377
2011-06-19 04:26:01 +00:00
Greg Clayton 5861d3e6f0 Make sure we have a valid object file before we try getting the symbol table
so we avoid crashing.

llvm-svn: 133376
2011-06-19 04:02:02 +00:00
Peter Collingbourne ba23ca085f Switch from USEC_PER_SEC/NSEC_PER_SEC/NSEC_PER_USEC to TimeValue constants
Fixes the Linux build.

llvm-svn: 133370
2011-06-18 23:52:14 +00:00
Greg Clayton c662ec8bd3 Fixed variable parsing to not parse block variables over and over due to an
issue in the way block variables are marked as parsed. In the DWARF parser we
always parse all blocks for a function at once, so we can mark all blocks as
having all variables parsed and avoid recursive function calls to try and
reparse things that have already been handled.

Fixed an issue with how variables get scoped into blocks. The DWARF parser can
now handle abtract class definitions that contain concrete static variables.
When the concrete instance of the class functions get instantiated, they will
track down the concrete block for the abtract block and add the variable to
each block.

llvm-svn: 133302
2011-06-17 22:10:16 +00:00
Greg Clayton f3dd93c888 Added the notion of an system root for SDKs. This is a directory where all
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
2011-06-17 03:31:01 +00:00
Greg Clayton 73bf5dbd16 Improved the packet throughput when debugging with GDB remote by over 3x on
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
2011-06-17 01:22:15 +00:00
Johnny Chen 25e68e3c1b Primitive attach support for linux
This patch is a starting point for the attach functionality.

Signed-off-by: Johnny Chen <johnny.chen@apple.com>
llvm-svn: 133006
2011-06-14 19:19:50 +00:00
Peter Collingbourne 6a520222d0 Improve error reporting in ProcessMonitor::Launch
llvm-svn: 132972
2011-06-14 03:55:58 +00:00
Peter Collingbourne 6234320933 Fix mistakes relating to ProcessMonitor::DupDescriptor
llvm-svn: 132971
2011-06-14 03:55:54 +00:00
Peter Collingbourne 4aeb47e23c If ProcessMonitor::Launch fails, post semaphore to notify caller
llvm-svn: 132970
2011-06-14 03:55:49 +00:00
Peter Collingbourne 933f6f617d Add license header to InferiorCallPOSIX.cpp
llvm-svn: 132966
2011-06-14 03:55:34 +00:00
Greg Clayton c0094b1be3 Remove assert() calls that were firing off and crashing the LLDB framework.
llvm-svn: 132960
2011-06-14 01:53:36 +00:00
Greg Clayton b677cb893d Header file cleanup and moved an inline to the implementation file.
llvm-svn: 132828
2011-06-10 01:37:29 +00:00
Greg Clayton a658fd26c3 Created a std::string in the base StopInfo class for the description and
cleaned up all base classes that had their own copy. Added a SetDescription
accessor to the StopInfo class.

llvm-svn: 132615
2011-06-04 01:26:29 +00:00
Peter Collingbourne 10bc01032c Implement RegisterContextLinux_x86_64::{Read,Write}AllRegisterValues
llvm-svn: 132587
2011-06-03 20:41:02 +00:00
Peter Collingbourne 5a6fa540dc Move SaveFrameZeroState and RestoreSaveFrameZero implementations to Thread base class
llvm-svn: 132586
2011-06-03 20:40:54 +00:00
Peter Collingbourne 70969ef102 Implement ProcessLinux::Do{Allocate,Deallocate}Memory using inferior mmap/munmap calls
llvm-svn: 132585
2011-06-03 20:40:44 +00:00
Peter Collingbourne 99f9aa02c2 Move inferior mmap/munmap call code into their own functions in utility lib
llvm-svn: 132584
2011-06-03 20:40:38 +00:00
Peter Collingbourne b4aabeb8d7 Scan dynamic symbol table of ELF object files
llvm-svn: 132582
2011-06-03 20:39:58 +00:00
Johnny Chen b1fa6b466b Bail out if we have an invalid thumb instruction.
llvm-svn: 132511
2011-06-02 23:19:06 +00:00
Johnny Chen 8a71c0b771 Turn the commented-out assert()'s into appropriate bail-out actions.
llvm-svn: 132507
2011-06-02 23:07:03 +00:00
Johnny Chen 6ef2735631 When emulating an ill-formed instruction, we should bail out instead of asserting and bringing down the whole process.
llvm-svn: 132506
2011-06-02 22:50:51 +00:00
Greg Clayton 850cc8998c Remove asserts that will crash LLDB. These should be changed to return
true/false in an extra boolean parameter and not cause the the binary that
us using the LLDB framework to crash.

llvm-svn: 132501
2011-06-02 22:23:35 +00:00
Greg Clayton dd0e5a5258 Make sure we don't lose our stop reply packet in the case where the other
GDB server doesn't support the LLDB specific qThreadStopInfo packet.

llvm-svn: 132499
2011-06-02 22:22:38 +00:00
Johnny Chen 8a742f5f37 EmulateShiftReg() also accepts shifter type of SRType_ROR.
llvm-svn: 132484
2011-06-02 21:00:34 +00:00