Commit Graph

281 Commits

Author SHA1 Message Date
Sean Callanan b269b6eabb Documented ClangExpression and made parts of it
more sane (i.e., removed dead arguments, made
sensible defaults, etc.)

llvm-svn: 110990
2010-08-13 00:28:39 +00:00
Sean Callanan 04949cc65e Added documentation to ClangASTSource and
NameSearchContext.

llvm-svn: 110980
2010-08-12 23:45:38 +00:00
Sean Callanan 384cae6e06 Fixed copyright notice on ClangASTSource.h.
llvm-svn: 110977
2010-08-12 23:08:37 +00:00
Sean Callanan 35053747cc Removed the ClangStmtVisitor, which is old code
that translates Clang ASTs straight to DWARF.  We
are now using IR instead.

llvm-svn: 110957
2010-08-12 21:29:03 +00:00
Johnny Chen 03b5a8a9ab Applied Pawel Wodnicki's fix for "missing" lldb-forward-rtti.h header file.
llvm-svn: 110943
2010-08-12 19:42:59 +00:00
Jim Ingham 87c1191e0e Now that we are using the Unwinder (or Jason's new unwinder when that comes about) all the plugin-specific details of getting stack frames
should be hidden behind that, and the "GetStackFrameAtIndex" and "GetStackFrameCount" algorithms become generic.  So I moved them to Thread.cpp.

llvm-svn: 110899
2010-08-12 02:14:28 +00:00
Sean Callanan d1e5b439c9 Added automatically generated result variables for each
expression.  It is now possible to do things like this:

(lldb) expr int $i = 5; $i + 1
$0 = (int) 6
(lldb) expr $i + 3
$1 = (int) 8
(lldb) expr $1 + $0
$2 = (int) 14

As a bonus, this allowed us to move printing of
expression results into the ClangPersistentVariable
class.  This code needs a bit of refactoring -- in
particular, ClangExpressionDeclMap has eaten one too
many bacteria and needs to undergo mitosis -- but the
infrastructure appears to be holding up nicely.

llvm-svn: 110896
2010-08-12 01:56:52 +00:00
Sean Callanan 2235f32bbd Added support for persistent variables to the
expression parser.  It is now possible to type:

(lldb) expr int $i = 5; $i + 1
(int) 6
(lldb) expr $i + 2
(int) 7

The skeleton for automatic result variables is
also implemented.  The changes affect:

- the process, which now contains a 
  ClangPersistentVariables object that holds
  persistent variables associated with it
- the expression parser, which now uses
  the persistent variables during variable
  lookup
- TaggedASTType, where I loaded some commonly
  used tags into a header so that they are
  interchangeable between different clients of
  the class

llvm-svn: 110777
2010-08-11 03:57:18 +00:00
Jim Ingham 3ebcf7f09b Make breakpoint commands work again. Added a PerformAction to the stop info - actions are run when the
stop event is pulled from the event queue.  Then made the StopInfoBreakpoint's PerformAction do the 
breakpoint command.
Also fixed the StopInfoBreakpoint's GetDescription so it gets the breakpoint location info, not the breakpoint
site info.

llvm-svn: 110637
2010-08-10 00:59:59 +00:00
Jim Ingham 5aee162f97 Change Target & Process so they can really be initialized with an invalid architecture.
Arrange that this then gets properly set on attach, or when a "file" is set.
Add a completer for "process attach -n".

Caveats: there isn't currently a way to handle multiple processes with the same name.  That
will have to wait on a way to pass annotations along with the completion strings.

llvm-svn: 110624
2010-08-09 23:31:02 +00:00
Sean Callanan fc16cc0a0c Removed the -i option from the expr command, and
made IR-based expression evaluation the default.

Also added a new class to hold persistent variables.
The class is empty as yet while I write up a design
document for what it will do.  Also the place where
it is currently created (by the Expression command)
is certainly wrong.

llvm-svn: 110415
2010-08-06 00:35:32 +00:00
Sean Callanan c503e784c7 Fixed namespace issues that were breaking the
SWIG wrappers on a non-internal SnowLeopard
system.

llvm-svn: 110413
2010-08-06 00:33:35 +00:00
Greg Clayton c86103d4d6 More missing files from my previous checkin.
llvm-svn: 110299
2010-08-05 01:57:25 +00:00
Greg Clayton 7620000aa6 Added functionality to our API for SBType. This will allow users to eventually find and peruse static type information from modules.
llvm-svn: 110298
2010-08-05 01:56:48 +00:00
Greg Clayton ba9fbbb880 Added functionality to our API for SBType. This will allow users to eventually find and peruse static type information from modules.
llvm-svn: 110297
2010-08-05 01:56:31 +00:00
Greg Clayton f4b47e1579 Abtracted the old "lldb_private::Thread::StopInfo" into an abtract class.
This will allow debugger plug-ins to make any instance of "lldb_private::StopInfo"
that can completely describe any stop reason. It also provides a framework for
doing intelligent things with the stop info at important times in the lifetime
of the inferior. 

Examples include the signal stop info in StopInfoUnixSignal. It will check with
the process to see that the current action is for the signal. These actions
include wether to stop for the signal, wether the notify that the signal was
hit, and wether to pass the signal along to the inferior process. The 
StopInfoUnixSignal class overrides the "ShouldStop()" method of StopInfo and
this allows the stop info to determine if it should stop at the signal or 
continue the process. 


StopInfo subclasses must override the following functions:

    virtual lldb::StopReason
    GetStopReason () const = 0;

    virtual const char *
    GetDescription () = 0;


StopInfo subclasses can override the following functions:


    // If the subclass returns "false", the inferior will resume. The default
    // version of this function returns "true" which means the default stop
    // info will stop the process. The breakpoint subclass will check if
    // the breakpoint wants us to stop by calling any installed callback on
    // the breakpoint, and also checking if the breakpoint is for the current
    // thread. Signals will check if they should stop based off of the 
    // UnixSignal settings in the process.
    virtual bool
    ShouldStop (Event *event_ptr);

    // Sublasses can state if they want to notify the debugger when "ShouldStop"
    // returns false. This would be handy for breakpoints where you want to
    // log information and continue and is also used by the signal stop info
    // to notify that a signal was received (after it checks with the process
    // signal settings).
    virtual bool
    ShouldNotify (Event *event_ptr)
    {
        return false;
    }

    // Allow subclasses to do something intelligent right before we resume.
    // The signal class will figure out if the signal should be propagated
    // to the inferior process and pass that along to the debugger plug-ins.
    virtual void
    WillResume (lldb::StateType resume_state)
    {
        // By default, don't do anything
    }


The support the Mach exceptions was moved into the lldb/source/Plugins/Process/Utility
folder and now doesn't polute the lldb_private::Thread class with platform
specific code.

llvm-svn: 110184
2010-08-04 01:40:35 +00:00
Sean Callanan 5666b674f3 Added support for accessing members of C++ objects,
including superclass members.  This involved ensuring
that access control was ignored, and ensuring that
the operands of BitCasts were properly scanned for
variables that needed importing.

Also laid the groundwork for declaring objects of
custom types; however, this functionality is disabled
for now because of a potential loop in ASTImporter.

llvm-svn: 110174
2010-08-04 01:02:13 +00:00
Greg Clayton 3504eee8a8 Added FindTypes to Module and ModuleList.
llvm-svn: 110093
2010-08-03 01:26:16 +00:00
Greg Clayton b0b9fe610a Added support for objective C built-in types: id, Class, and SEL. This
involved watching for the objective C built-in types in DWARF and making sure
when we convert the DWARF types into clang types that we use the appropriate
ASTContext types.

Added a way to find and dump types in lldb (something equivalent to gdb's 
"ptype" command):

    image lookup --type <TYPENAME>

This only works for looking up types by name and won't work with variables.
It also currently dumps out verbose internal information. I will modify it
to dump more appropriate user level info in my next submission.

Hookup up the "FindTypes()" functions in the SymbolFile and SymbolVendor so
we can lookup types by name in one or more images.

Fixed "image lookup --address <ADDRESS>" to be able to correctly show all
symbol context information, but it will only show this extra information when
the new "--verbose" flag is used.

Updated to latest LLVM to get a few needed fixes.

llvm-svn: 110089
2010-08-03 00:35:52 +00:00
Sean Callanan 5300d37aa7 Added support for rewriting objc_msgSend so we can
call Objective-C methods from expressions.  Also added
some more logging to the function-calling thread plan
so that we can see the registers when a function
finishes.

Also documented things maybe a bit better.

llvm-svn: 109938
2010-07-31 01:32:05 +00:00
Johnny Chen 7dc2e4784e We can do better when reporting the status of one-liner script execution.
Change the prototype of ScriptInterpreter::ExecuteOneLine() to return bool
instead of void and take one additional parameter as CommandReturnObject *.

Propagate the status of one-liner execution back appropriately.

llvm-svn: 109899
2010-07-30 22:33:14 +00:00
Greg Clayton 48e4254989 Added "void Clear();" methods to SBDebugger, SBTarget and SBThread so they can release their shared pointers.
llvm-svn: 109882
2010-07-30 20:12:55 +00:00
Greg Clayton 9e40956aea Created lldb::LanguageType by moving an enumeration from the
lldb_private::Language class into the enumerations header so it can be freely
used by other interfaces.

Added correct objective C class support to the DWARF symbol parser. Prior to
this fix we were parsing objective C classes as C++ classes and now that the
expression parser is ready to call functions we need to make sure the objective
C classes have correct AST types.

llvm-svn: 109574
2010-07-28 02:04:09 +00:00
Sean Callanan cc54bd3cef Added and improved logging. This is helping us as we
diagnose a problem where we're not correctly emitting
PIC code.

llvm-svn: 109568
2010-07-28 01:00:59 +00:00
Sean Callanan 7ea3501bd8 Added support for calling functions from expressions.
Right now we mock up the function as a variadic
function when generating the IR for the call; we need
to eventually make the function be the right type if
the type is available.

llvm-svn: 109543
2010-07-27 21:39:39 +00:00
Sean Callanan 4edba2d130 Added support for locating a function that is
referenced in the IR.  We don't yet support updating
the call to that function.

llvm-svn: 109483
2010-07-27 02:07:53 +00:00
Sean Callanan 8ade104a0a Changed SymbolContext so when you search for functions
it returns a list of functions as a SymbolContextList.

Rewrote the clients of SymbolContext to use this
SymbolContextList.

Rewrote some of the providers of the data to SymbolContext
to make them respect preferences as to whether the list
should be cleared first; propagated that change out.

ClangExpressionDeclMap and ClangASTSource use this new
function list to properly generate function definitions -
even for functions that don't have a prototype in the
debug information.

llvm-svn: 109476
2010-07-27 00:55:47 +00:00
Sean Callanan ddb46efcca Updated the IR converter for the target to eliminate
spurious guard variables on expression statics.

Updated the AST result synthesizer to eliminate the
unneeded result pointer.

Very rudimentary expressions now evaluate correctly
in the target using the new JIT-based mechanism.

llvm-svn: 109317
2010-07-24 01:37:44 +00:00
Greg Clayton 9fed0d85b2 Added needed breakpoint functionality to the public API that includes:
SBTarget:
    - get breakpoint count
    - get breakpoint at index
  SBBreakpoint:
    - Extract data from breakpoint events

llvm-svn: 109289
2010-07-23 23:33:17 +00:00
Sean Callanan 289e07b9d0 Added logging:
- When we JIT an expression, we print the disassembly
  of the generated code
- When we put the structure into the target, we print
  the individual entries in the structure byte for
  byte.

llvm-svn: 109278
2010-07-23 22:19:18 +00:00
Benjamin Kramer 5ea4192b72 Remove useless typedef keyword, fix a clang warning.
llvm-svn: 109254
2010-07-23 18:59:12 +00:00
Greg Clayton aaa58c6679 Added a new utility class that I have wanted for a while. The CleanUp
class is a templatized class that allows you to have a cleanup function called
on a data value of type T when the value is set or when the object goes
out of scope. It has support for very rudimentary invalid value detection that
can be enabled by using the appropriate constructor. 

Anyone with template experience that can see ways of improving this class
please let me know. The example code shows a few typical scenarios in which
I would like to use it. It is currently coded with simple type T values
in mind (integer file descriptors, pointers, etc), but I am sure some 
specialization might help out the class for more complex types.

There is a lot of documentation including examples in the CleanUp.h header 
file. 

llvm-svn: 109239
2010-07-23 17:42:15 +00:00
Greg Clayton 896dff661a Centralized the Mach exception stop info code by adding it as a first
class citizen on the StopInfo class. 

llvm-svn: 109235
2010-07-23 16:45:51 +00:00
Greg Clayton 19503a2a78 Warnings cleanup patch from Jean-Daniel Dupas.
llvm-svn: 109226
2010-07-23 15:37:46 +00:00
Sean Callanan 6dde30e964 Added extensive logging of the code that is actually going
to be executed by the inferior.  This required explicit support
from RecordingMemoryManager for finding the address range
belonging to a particular function.

Also fixed a bug in DisassemblerLLVM where the disassembler
assumed there was an AddressRange available even when it was
NULL.

llvm-svn: 109209
2010-07-23 02:19:15 +00:00
Sean Callanan ebf7707e53 Modified TaggedASTType to inherit from ClangASTType
and moved it to its own header file for cleanliness.

Added more logging to ClangFunction so that we can
diagnose crashes in the executing expression.

Added code to extract the result of the expression
from the struct that is passed to the JIT-compiled
code.

llvm-svn: 109199
2010-07-23 00:16:21 +00:00
Greg Clayton 8cf0593c87 Added a new enumeration named "ClangASTContext::AccessType" that abstracts the type creation from the various access enumerations in Clang. Currently there are clang::AccessSpecifier and the objective C ivars have their own enumeration. So I added a new enumeration that will allow a consistent interface when creating types through ClangASTContext.
I also added new functions to create an Objective C class, ivar and set an objective C superclass. They aren't hooked up in the DWARF parser yet. That is the next step, though I am unsure if I will do this in the DWARF parser or try and do it generically in the existing Record manipulation functions.

llvm-svn: 109130
2010-07-22 18:30:50 +00:00
Greg Clayton 4ceb9980c8 Modified both the ObjectFileMachO and ObjectFileELF to correctly set the
SectionType for Section objects for DWARF.

Modified the DWARF plug-in to get the DWARF sections by SectionType so we
can safely abstract the LLDB core from section names for the various object
file formats.

Modified the SectionType definitions for .debug_pubnames and .debug_pubtypes
to use the correct case.

llvm-svn: 109054
2010-07-21 22:54:26 +00:00
Greg Clayton e1a916a74d Change over to using the definitions for mach-o types and defines to the
defines that are in "llvm/Support/MachO.h". This should allow ObjectFileMachO
and ObjectContainerUniversalMachO to be able to be cross compiled in Linux.

Also did some cleanup on the ASTType by renaming it to ClangASTType and
renaming the header file. Moved a lot of "AST * + opaque clang type *"
functionality from lldb_private::Type over into ClangASTType.

llvm-svn: 109046
2010-07-21 22:12:05 +00:00
Greg Clayton 8c920840a4 Add new SectionType enumerations for all DWARF sections. ObjectFile parsers should start properly setting the section types for DWARF sections, then we can move the DWARF SymbolFile parser over to finding the sections by the appropriate SectionType.
llvm-svn: 109041
2010-07-21 21:51:36 +00:00
Greg Clayton 70e33eb06e Allow searching for a section by SectionType.
llvm-svn: 109040
2010-07-21 21:49:46 +00:00
Sean Callanan b3706e6dd2 Whoops, forgot to guard ASTType.h. Fixed.
llvm-svn: 108970
2010-07-20 23:53:01 +00:00
Sean Callanan 1d18066411 Added functionality to dematerialize values that were
used by the JIT compiled expression, including the
result of the expression.

Also added a new class, ASTType, which encapsulates an
opaque Clang type and its associated AST context.

Refactored ClangExpressionDeclMap to use ASTTypes,
significantly reducing the possibility of mixups of
types from different AST contexts.

llvm-svn: 108965
2010-07-20 23:31:16 +00:00
Greg Clayton 471b31ce62 Remove use of STL collection class use of the "data()" method since it isn't
part of C++'98. Most of these were "std::vector<T>::data()" and 
"std::string::data()".

llvm-svn: 108957
2010-07-20 22:52:08 +00:00
Stephen Wilson 645767aeca Add missing include.
llvm-svn: 108878
2010-07-20 18:40:23 +00:00
Stephen Wilson 50bd94f961 Have Process::CreateBreakpointSite return a break_id_t instead of a user_id_t.
Also, update BreakpointLocation::ResolveBreakpointSite to check for invalid
breakpoint ID's using the proper magic constant.

llvm-svn: 108598
2010-07-17 00:56:13 +00:00
Sean Callanan 6b4067c14e Added the necessary code to copy variables used by
an expression into the struct prepared for the JIT
compiled code to use.

llvm-svn: 108596
2010-07-17 00:43:37 +00:00
Sean Callanan ea22d4288a Wrote the code that looks at a context to see
if the variables in that context allow a particular
JIT compiled expression to run in that context.

llvm-svn: 108485
2010-07-16 00:09:46 +00:00
Sean Callanan 4dcca262f4 Added a function to test whether two types are
the same.

llvm-svn: 108467
2010-07-15 22:30:52 +00:00
Greg Clayton b132097b45 I enabled some extra warnings for hidden local variables and for hidden
virtual functions and caught some things and did some general code cleanup.

llvm-svn: 108299
2010-07-14 00:18:15 +00:00
Sean Callanan 549c9f7f9a "expr -i" now performs the required transforms to
prepare the IR for JIT compilation.  We still need
to do the JIT compilation and move the arguments
in/out of target memory.

llvm-svn: 108279
2010-07-13 21:41:46 +00:00
Jim Ingham a56c800607 Add an "Avoid Frames matching this regular expression" to ThreadPlanStepInRange.
This relies on ThreadPlanStepOut working correctly, which it doesn't currently for Inlined functions, so this feature is only partially useful until we take care of Stepping Out of inlined functions.
Added an option to "thread step-in" to set the avoid regular expression.  This is mostly for testing, once the Setting code is redone, we'll move this to a general setting.

llvm-svn: 108036
2010-07-10 02:27:39 +00:00
Greg Clayton c982c768d2 Merged Eli Friedman's linux build changes where he added Makefile files that
enabled LLVM make style building and made this compile LLDB on Mac OS X. We
can now iterate on this to make the build work on both linux and macosx.

llvm-svn: 108009
2010-07-09 20:39:50 +00:00
Greg Clayton 69b518f6ef typedef fixups, patch from Jean-Daniel Dupas.
llvm-svn: 107794
2010-07-07 17:07:17 +00:00
Jim Ingham ebc09c36e9 Fix GetRepeatCommand so it works with multi-word commands.
Move the "source", "alias", and "unalias" commands to "commands *".
Move "source-file" to "source list".
Added a "source info" command but it isn't implemented yet.

llvm-svn: 107751
2010-07-07 03:36:20 +00:00
Jim Ingham 1308bb2791 Added a "GetRepeatCommand" to the command object. The Interpreter uses this
instead of the last history item to provide a command for the "empty" command.
Use this in the source-file command to make <RETURN> continue the listing rather
than relist the first listing...

llvm-svn: 107736
2010-07-06 23:48:33 +00:00
Jim Ingham 279a6c2669 Hide the logic for command resolution for commands, aliases & user commands behind a single
interface so everybody does it the same way.  Add an "exact" lookup for internal uses.

Fix up a few little cases where we weren't reporting command lookup errors correctly.

Added "b" as an alias for "breakpoint" so it doesn't collide with "bt".

llvm-svn: 107718
2010-07-06 22:46:59 +00:00
Jason Molenda ea84e76479 Switch over to using llvm's dwarf constants file.
llvm-svn: 107716
2010-07-06 22:38:03 +00:00
Sean Callanan 2ab712f212 Added the skeleton of an IR transformer that will
prepare IR for execution in the target.  Wired the
expression command to use this IR transformer when
conversion to DWARF fails, and wired conversion to
DWARF to always fail (well, we don't generate any
DWARF...)

llvm-svn: 107559
2010-07-03 01:35:46 +00:00
Sean Callanan 2df8a1f39c Added the skeleton of a transformation pass to
convert IR to DWARF.  So far, this pass only
performs a depth-first traversal of the IR,
logging each basic block as it finds it.

llvm-svn: 107515
2010-07-02 21:09:36 +00:00
Greg Clayton d2d60ce388 Updated to llvm/clang from July 2, 2010 at 8:00AM.
llvm-svn: 107494
2010-07-02 18:39:06 +00:00
Sean Callanan 609f8c584a Added a method to get a stream's byte order.
llvm-svn: 107460
2010-07-02 02:43:42 +00:00
Greg Clayton 0b42ac32c8 More leaks detection:
- fixed 3 posix spawn attributes leaks 
- fixed us always leaking CXXBaseSpecifier objects when we create class 
  base classes. Clang apparently copies the base classes we pass in.

Fixed some code formatting in ClangASTContext.cpp.

llvm-svn: 107459
2010-07-02 01:29:13 +00:00
Jim Ingham 4fdf181a00 Remember to save first...
llvm-svn: 107457
2010-07-02 01:03:49 +00:00
Jim Ingham a302bb1608 Resolve dueling commits... Plus add docs for Resolve & ResolveUsername.
llvm-svn: 107456
2010-07-02 00:57:26 +00:00
Jim Ingham 7cc478b9a2 Remove duplicate def'n from FileSpec.h.
Add user name completion to the file completer.

llvm-svn: 107455
2010-07-02 00:45:55 +00:00
Sean Callanan 116be5347e Added a SemaConsumer that transforms the ASTs for
an expression, adding code to put the value of the
last expression (if there is one) into a variable
and write the address of that variable to a global
pointer.

llvm-svn: 107419
2010-07-01 20:08:22 +00:00
Greg Clayton 735753d19c Undid extra changes I already checked in.
llvm-svn: 107413
2010-07-01 18:31:14 +00:00
Jim Ingham 2f1881f6bd Missed one file in my last commit.
llvm-svn: 107410
2010-07-01 18:05:02 +00:00
Greg Clayton a5d24f6683 Added a missing static function prototype to FileSpec.h for ResolveUsername.
Did a bit of code formatting and cleanup.

llvm-svn: 107403
2010-07-01 17:07:48 +00:00
Greg Clayton 54b8b8c1a7 Fixed up disassembly to not emit the module name before all function names
that are in the disassembly comments since most of them are in the same
module (shared library). 

Fixed a crasher that could happen when disassembling special section data.

Added an address dump style that shows the symbol context without the module
(used in the disassembly code).

llvm-svn: 107366
2010-07-01 01:26:43 +00:00
Greg Clayton dda4f7b520 Centralized all disassembly into static functions in source/Core/Disassembler.cpp.
Added the ability to read memory from the target's object files when we aren't
running, so disassembling works before you run!

Cleaned up the API to lldb_private::Target::ReadMemory().

Cleaned up the API to the Disassembler to use actual "lldb_private::Address"
objects instead of just an "addr_t". This is nice because the Address objects
when resolved carry along their section and module which can get us the 
object file. This allows Target::ReadMemory to be used when we are not 
running.

Added a new lldb_private::Address dump style: DumpStyleDetailedSymbolContext
This will show a full breakdown of what an address points to. To see some
sample output, execute a "image lookup --address <addr>".

Fixed SymbolContext::DumpStopContext(...) to not require a live process in
order to be able to print function and symbol offsets.

llvm-svn: 107350
2010-06-30 23:03:03 +00:00
Caroline Tice ebc1bb277c Add a unique ID to each debugger instance.
Add functions to look up debugger by id
Add global variable to lldb python module, to hold debugger id
Modify embedded Python interpreter to update the global variable with the
 id of its current debugger.
Modify the char ** typemap definition in lldb.swig to accept 'None' (for NULL)
 as a valid value.

The point of all this is so that, when you drop into the embedded interpreter
from the command interpreter (or when doing Python-based breakpoint commands),
there is a way for the Python side to find/get the correct debugger
instance ( by checking debugger_unique_id, then calling 
SBDebugger::FindDebuggerWithID  on it).

llvm-svn: 107287
2010-06-30 16:22:25 +00:00
Jim Ingham 558ce124eb Add a source file completer to the CommandCompleters.
Add a way for the completers to say whether the completed argument should have a space inserted after is
or not.
Added the file name completer to the "file" command.

llvm-svn: 107247
2010-06-30 05:02:46 +00:00
Greg Clayton 8d38ac4536 Fixed debug map in executable + DWARF in .o debugging on Mac OS X.
Added the ability to dump any file in the global module cache using any of
the "image dump" commands. This allows us to dump the .o files that are used
with DWARF + .o since they don't belong the the target list for the current
target.

llvm-svn: 107100
2010-06-28 23:51:11 +00:00
Greg Clayton 0c5cd90d63 Added function name types to allow us to set breakpoints by name more
intelligently. The four name types we currently have are:

eFunctionNameTypeFull       = (1 << 1), // The function name.
                                        // For C this is the same as just the name of the function
                                        // For C++ this is the demangled version of the mangled name.
                                        // For ObjC this is the full function signature with the + or
                                        // - and the square brackets and the class and selector
eFunctionNameTypeBase       = (1 << 2), // The function name only, no namespaces or arguments and no class 
                                        // methods or selectors will be searched.
eFunctionNameTypeMethod     = (1 << 3), // Find function by method name (C++) with no namespace or arguments
eFunctionNameTypeSelector   = (1 << 4)  // Find function by selector name (ObjC) names


this allows much more flexibility when setting breakoints:

(lldb) breakpoint set --name main --basename
(lldb) breakpoint set --name main --fullname
(lldb) breakpoint set --name main --method
(lldb) breakpoint set --name main --selector

The default:

(lldb) breakpoint set --name main

will inspect the name "main" and look for any parens, or if the name starts
with "-[" or "+[" and if any are found then a full name search will happen.
Else a basename search will be the default.

Fixed some command option structures so not all options are required when they
shouldn't be.

Cleaned up the breakpoint output summary.

Made the "image lookup --address <addr>" output much more verbose so it shows
all the important symbol context results. Added a GetDescription method to 
many of the SymbolContext objects for the more verbose output.

llvm-svn: 107075
2010-06-28 21:30:43 +00:00
Jim Ingham d43e0094b7 Handle completing "-" and "--".
llvm-svn: 106784
2010-06-24 20:31:04 +00:00
Jim Ingham d6ccc60035 Convert direct access to the required & optional option sets to an accessor so we can lazily run BuildValidOptionSet, but make sure it is done before access.
llvm-svn: 106783
2010-06-24 20:30:15 +00:00
Sean Callanan 1d389c4b02 Added the temporary -i option to expr, which
switches the expression parsing over to use the
LLVM IR as opposed to Clang ASTs.  Right now,
that functionality only logs.

llvm-svn: 106695
2010-06-23 23:18:04 +00:00
Sean Callanan 4be3990f3b Fixed the log streams for logs that output to
standard output, resolving a crasher.

llvm-svn: 106682
2010-06-23 21:28:25 +00:00
Greg Clayton 6611103cfe Very large changes that were needed in order to allow multiple connections
to the debugger from GUI windows. Previously there was one global debugger
instance that could be accessed that had its own command interpreter and
current state (current target/process/thread/frame). When a GUI debugger
was attached, if it opened more than one window that each had a console
window, there were issues where the last one to setup the global debugger
object won and got control of the debugger.

To avoid this we now create instances of the lldb_private::Debugger that each 
has its own state:
- target list for targets the debugger instance owns
- current process/thread/frame
- its own command interpreter
- its own input, output and error file handles to avoid conflicts
- its own input reader stack

So now clients should call:

    SBDebugger::Initialize(); // (static function)

    SBDebugger debugger (SBDebugger::Create());
    // Use which ever file handles you wish
    debugger.SetErrorFileHandle (stderr, false);
    debugger.SetOutputFileHandle (stdout, false);
    debugger.SetInputFileHandle (stdin, true);

    // main loop
    
    SBDebugger::Terminate(); // (static function)
    
SBDebugger::Initialize() and SBDebugger::Terminate() are ref counted to
ensure nothing gets destroyed too early when multiple clients might be
attached.

Cleaned up the command interpreter and the CommandObject and all subclasses
to take more appropriate arguments.

llvm-svn: 106615
2010-06-23 01:19:29 +00:00
Sean Callanan 468574bd34 Added support to the expression parser for locating
externally-defined functions.

llvm-svn: 106606
2010-06-22 23:46:24 +00:00
Jim Ingham 05407f6b25 Make an explicit GetThreadSpecNoCreate accessor so you don't have to get the const-ness right to ensure you are not making a copy of the owning breakpoint's ThreadSpec in a breakpoint location. Also change the name from NoCopy to NoCreate since that's clearer.
llvm-svn: 106578
2010-06-22 21:12:54 +00:00
Benjamin Kramer 104819c6eb Move trivial parts of UserID into the header.
llvm-svn: 106535
2010-06-22 10:44:12 +00:00
Benjamin Kramer 466b31e900 Move a bunch of trivial methods into the header. These compile down to 1-2
instructions so it's really profitable to inline them.

llvm-svn: 106450
2010-06-21 19:26:54 +00:00
Jim Ingham b01e742af7 Two changes in this checkin. Added a ThreadPlanKind so that I can do some reasoning based on the kind of thread plan
without having to use RTTI.
Removed the ThreadPlanContinue and replaced with a ShouldAutoContinue query that serves the same purpose.  Having to push
another plan to assert that if there's no other indication the target should continue when this plan is popped was flakey
and error prone.  This method is more stable, and fixed problems we were having with thread specific breakpoints.

llvm-svn: 106378
2010-06-19 04:45:32 +00:00
Jim Ingham 62b02c61c9 Adding setting thread specific breakpoints by name, ID, index & queue name to the SB interfaces.
llvm-svn: 106268
2010-06-18 01:47:08 +00:00
Jim Ingham 0136309f5a Change the Breakpoint & BreakpointLocation GetDescription methods so they call the BreakpointOptions::GetDescription rather
than picking bits out of the breakpoint options.  Added BreakpointOptions::GetDescription to do this job.  Some more mucking
around to keep the breakpoint listing from getting too verbose.

llvm-svn: 106262
2010-06-18 01:00:58 +00:00
Johnny Chen 22ce5b62b0 Fixed a typo in comment.
llvm-svn: 106133
2010-06-16 19:30:20 +00:00
Owen Anderson c7da5f413b Switch from qsort_r to std::stable_sort for a performance win and improved portability.
llvm-svn: 106116
2010-06-16 17:34:05 +00:00
Jim Ingham 1b54c88cc4 Add a "thread specification" class that specifies thread specific breakpoints by name, index, queue or TID.
Push this through all the breakpoint management code.  Allow this to be set when the breakpoint is created.
Fix the Process classes so that a breakpoint hit that is not for a particular thread is not reported as a 
breakpoint hit event for that thread.
Added a "breakpoint configure" command to allow you to reset any of the thread 
specific options (or the ignore count.)

llvm-svn: 106078
2010-06-16 02:00:15 +00:00
Jason Molenda e166ecadad Add definition for DW_LANG_MIPS_Assembler. This file was originally
generated by a script.  I don't know if we're still regenerating
it or not; will have to check with Greg about how he's handling this
now.  Should update it for the final DWARF3 and soon-to-be-released
DWARF4 constants while I'm at it..

llvm-svn: 106045
2010-06-15 21:20:35 +00:00
Jason Molenda 9eb41c35ce It makes me nervous seeing those bitfield shift values without parens.
llvm-svn: 106036
2010-06-15 20:04:41 +00:00
Jim Ingham 40af72e106 Move Args.{cpp,h} and Options.{cpp,h} to Interpreter where they really belong.
llvm-svn: 106034
2010-06-15 19:49:27 +00:00
Jim Ingham 64f78a310d Fix a typo in a comment...
llvm-svn: 106022
2010-06-15 18:50:32 +00:00
Jim Ingham 8651121c11 Change the Options parser over to use a mask rather than an ordinal for option sets.
Fixed the Disassemble arguments so you can't specify start address or name in multiple ways.
Fixed the command line input so you can specify the filename without "-f" even if you use other options.

llvm-svn: 106020
2010-06-15 18:47:14 +00:00
Greg Clayton 13238c4455 patch from: Jean-Daniel Dupas
BreakpointLocation::GetLoadAddress() does not match the 'StoppointLocation::GetLoadAddress() const' virtual function prototype, and so, does not override the superclass function.

llvm-svn: 105927
2010-06-14 04:18:27 +00:00
Greg Clayton 474966a41e I have eliminated RTTI from LLDB!
Also added a shell script build phase that fixes the headers in 
LLDB.framework.

llvm-svn: 105899
2010-06-12 18:59:55 +00:00
Eli Friedman a84b380d46 Add missing include.
llvm-svn: 105898
2010-06-12 18:38:40 +00:00
Eli Friedman 1978d861c3 Add missing includes.
llvm-svn: 105897
2010-06-12 18:37:54 +00:00
Eli Friedman 81ad726f04 Move SharingPtr.h into include/.
llvm-svn: 105896
2010-06-12 18:29:53 +00:00
Greg Clayton ef59f829e4 Switched over to using the new lldb::SharingPtr from Howard Hinnant.
We need to put this in LLDB since we need to vend this in our API
because our public API uses shared pointers to our private objects.

Removed a deprecated file: include/lldb/Host/Types.h

Added the new SharingPtr.cpp/.h files into source/Utility.

Added a shell script build phase that fixes up all headers in the
LLDB.framework.

llvm-svn: 105895
2010-06-12 17:45:57 +00:00
Greg Clayton af3cf2caa3 Reverted changes for eByteOrderHost detection, but added linux support for using <endian.h>. No files in "API" can include any LLVM header files. We must keep LLVM behind our API.
llvm-svn: 105892
2010-06-12 16:46:01 +00:00
Greg Clayton 9b81a3146f Anders Carlsson patch for member pointers. Thanks Anders.
llvm-svn: 105868
2010-06-12 01:20:30 +00:00
Eli Friedman 2a16001328 Remove platform-specific includes from platform-independent code. Mac users,
please check whether this breaks anything.

llvm-svn: 105863
2010-06-12 00:22:37 +00:00
Owen Anderson 571e864e84 Revert my previous patch. Apparently the code-size impact of std::sort isn't acceptable.
llvm-svn: 105835
2010-06-11 21:07:26 +00:00
Owen Anderson dc433611a2 Replace qsort_r with std::sort. This gets rid of a lot of portability
ickiness, and is cleaner to boot.

I'm fairly confident that I converted the comparator over properly,
and what testing I could figure out how to run seemed to pass, but it
would be great if someone in the know could check behind me.

llvm-svn: 105834
2010-06-11 20:52:57 +00:00
Eli Friedman 8d860d557f Fix TimeValue::Offset* to take uint64_t
llvm-svn: 105812
2010-06-11 04:50:35 +00:00
Eli Friedman 102b925db8 Fix warning.
llvm-svn: 105808
2010-06-11 04:24:36 +00:00
Greg Clayton 41f923275e Made lldb_private::ArchSpec more generic so that it can take a mach-o cpu
type and sub-type, or an ELF e_machine value. Also added a generic CPU type
to the arch spec class so we can have a single arch definition that the LLDB
core code can use. Previously a lot of places in the code were using the
mach-o definitions from a macosx header file. 

Switches over to using "llvm/Support/MachO.h" for the llvm::MachO::XXX for the
CPU types and sub types for mach-o ArchSpecs. Added "llvm/Support/ELF.h" so 
we can use the "llvm::ELF::XXX" defines for the ELF ArchSpecs.

Got rid of all CPU_TYPE_ and CPU_SUBTYPE_ defines that were previously being
used in LLDB.

llvm-svn: 105806
2010-06-11 03:25:34 +00:00
Eli Friedman 6eb685c264 Make Error.h and Error.cpp compile on Linux.
llvm-svn: 105798
2010-06-10 23:45:58 +00:00
Eli Friedman a92e332b09 Make qsort_r usage "portable". Why does a function which seems so simple
have to be so complicated?

llvm-svn: 105797
2010-06-10 23:36:31 +00:00
Eli Friedman 892c22c244 Remove global init constructor from r105746.
llvm-svn: 105794
2010-06-10 23:00:15 +00:00
Eli Friedman 8c3ad54bc2 Remove unused uuid_t constructor for lldb_private::UUID.
llvm-svn: 105780
2010-06-10 03:08:05 +00:00
Eli Friedman 2c472ee18d Don't use std::tr1::shared_ptr directly.
llvm-svn: 105773
2010-06-10 01:36:54 +00:00
Eli Friedman fa95352569 Warning fix.
llvm-svn: 105754
2010-06-09 21:39:50 +00:00
Jason Molenda a34a0c61ae Move source/Utility/PseudoTerminal.h into include/lldb/Utility.
The top of the header file seems to indicate that this was
intended to be over at include/lldb/Core but we should be in line
with the .cpp file's location so it's include/lldb/Utility for now.

llvm-svn: 105753
2010-06-09 21:28:42 +00:00
Eli Friedman a8f1aaabe2 Use portable endianness routine from LLVM.
llvm-svn: 105746
2010-06-09 19:26:51 +00:00
Eli Friedman d0edb5b4a8 Don't include Python.h in the shared header.
llvm-svn: 105737
2010-06-09 18:31:38 +00:00
Eli Friedman a2460bf9e5 Revert this fix for now, since it breaks the build.
llvm-svn: 105729
2010-06-09 17:25:16 +00:00
Eli Friedman 53444d394f A few more minor fixes.
llvm-svn: 105721
2010-06-09 09:53:11 +00:00
Eli Friedman b3c7ff50a0 A couple more minor error/warning fixes.
llvm-svn: 105715
2010-06-09 09:19:13 +00:00
Eli Friedman 65c8cd0094 More warning/error fixes.
llvm-svn: 105714
2010-06-09 08:57:38 +00:00
Eli Friedman 3c61077a56 Misc warning/error fixes.
llvm-svn: 105713
2010-06-09 08:53:28 +00:00
Eli Friedman 9c68da971f Per surrounding style, use stdarg.h instead of cstdio, etc.
llvm-svn: 105711
2010-06-09 08:46:23 +00:00
Eli Friedman e8b582256b And a few more warning/error fixes.
llvm-svn: 105698
2010-06-09 07:22:30 +00:00
Eli Friedman 891d56baec More random error/warning fixes.
llvm-svn: 105695
2010-06-09 07:14:21 +00:00
Eli Friedman 4ce61e1f5d Minor warning fixes.
llvm-svn: 105691
2010-06-09 06:55:48 +00:00
Christopher Friesen 4cd709640c missed a greater than to quote conversion
llvm-svn: 105690
2010-06-09 06:55:11 +00:00
Eli Friedman f841bc881d Fix include lines to use more conventional paths, part 1.
llvm-svn: 105688
2010-06-09 06:46:09 +00:00
Chris Lattner 30fdc8d841 Initial checkin of lldb code from internal Apple repo.
llvm-svn: 105619
2010-06-08 16:52:24 +00:00