Commit Graph

474 Commits

Author SHA1 Message Date
Sean Callanan 6b1b95376f Added extra logging, and made sure that the argument
struct for expressions is deallocated when the
ClangExpressionDeclMap is taken down.

llvm-svn: 116028
2010-10-08 01:58:41 +00:00
Greg Clayton 8941142af8 Hooked up ability to look up data symbols so they show up in disassembly
if the address comes from a data section. 

Fixed an issue that could occur when looking up a symbol that has a zero
byte size where no match would be returned even if there was an exact symbol
match.

Cleaned up the section dump output and added the section type into the output.

llvm-svn: 116017
2010-10-08 00:21:05 +00:00
Sean Callanan 5c67a628b0 Fixed a launching issue.
llvm-svn: 115999
2010-10-07 22:51:14 +00:00
Greg Clayton 68f4b4f2a2 Make sure to lock down the sequence mutex and select the thread we want when read or write all registers.
llvm-svn: 115992
2010-10-07 22:06:19 +00:00
Sean Callanan 4451136102 Changed the timeout for expressions from 10
milliseconds to 10 seconds, which was the
original intent.

llvm-svn: 115942
2010-10-07 18:17:31 +00:00
Greg Clayton c6ed542c90 More SWIG cleanup. Moved the breakpoint callback function back to the
ScriptInterpreterPython class and made a simple callback function that
ScriptInterpreterPython::BreakpointCallbackFunction() now calls so we don't
include any internal API stuff into the cpp file that is generated by SWIG.

Fixed a few build warnings in debugserver.

llvm-svn: 115926
2010-10-07 17:14:24 +00:00
Greg Clayton 05faeb7135 Cleaned up the SWIG stuff so all includes happen as they should, no pulling
tricks to get types to resolve. I did this by correctly including the correct
files: stdint.h and all lldb-*.h files first before including the API files.
This allowed me to remove all of the hacks that were in the lldb.swig file
and it also allows all of the #defines in lldb-defines.h and enumerations
in lldb-enumerations.h to appear in the lldb.py module. This will make the
python script code a lot more readable.

Cleaned up the "process launch" command to not execute a "process continue"
command, it now just does what it should have with the internal API calls
instead of executing another command line command.

Made the lldb_private::Process set the state to launching and attaching if
WillLaunch/WillAttach return no error respectively.

llvm-svn: 115902
2010-10-07 04:19:01 +00:00
Johnny Chen 0ed37c9615 o SBtarget.cpp/.h:
Temporarily commenting out the deprecated LaunchProcess() method.
  SWIG is not able to handle the overloaded functions.

o dotest.py/lldbtest.py:

  Add an '-w' option to insert some wait time between consecutive test cases.

o TestClassTypes.py:

  Make the breakpoint_creation_by_filespec_python() test method more robust and
  more descriptive by printing out a more insightful assert message.

o lldb.swig: Coaches swig to treat StateType as an int type, instead of a C++ class.

llvm-svn: 115899
2010-10-07 02:04:14 +00:00
Greg Clayton 524e60b4e4 Expose the error contained within an SBValue.
Move anything that creates a new process into SBTarget. Marked some functions
as deprecated. I will remove them after our new API changes make it through
a build cycle.

llvm-svn: 115854
2010-10-06 22:10:17 +00:00
Greg Clayton b4fb2a991c Leaving in deprecated functions until we can get a clean build with the new APIs in place before removing the deprecated functions.
llvm-svn: 115815
2010-10-06 18:44:26 +00:00
Greg Clayton 5d5028b54e Added the first of hopefully many python example scripts that show how to
use the python API that is exposed through SWIG to do some cool stuff.

Also fixed synchronous debugging so that all process control APIs exposed
through the python API will now wait for the process to stop if you set
the async mode to false (see disasm.py).

llvm-svn: 115738
2010-10-06 03:53:16 +00:00
Greg Clayton 1d27316606 Added the ability to get the disassembly instructions from the function and
symbol.

llvm-svn: 115734
2010-10-06 03:09:58 +00:00
Greg Clayton 32c4085ba2 Restored the ability to set the format for expressions after changing the expression results over to ValueObjectSP objects.
llvm-svn: 115733
2010-10-06 03:09:11 +00:00
Greg Clayton f4abd0db15 Fixed an issue with the mach-o file parser when parsing indirect symbol stubs
where the symbol index was set to INDIRECT_SYMBOL_ABS and was causing an
assertion to fire when we loaded older Mac OS X binaries.

llvm-svn: 115729
2010-10-06 01:26:32 +00:00
Sean Callanan 2ab40fecf6 Updated the expression parser to ignore non-external
functions it finds in libraries unless it cannot find
an external function with the desired name.

llvm-svn: 115721
2010-10-06 00:10:07 +00:00
Sean Callanan 85a0a83a26 Added handling for external variables in function
arguments to the expression parser.  This means that
structs can be returned from the "expr" command.

llvm-svn: 115698
2010-10-05 22:26:43 +00:00
Sean Callanan f4b9bd3e74 Added support for (de)materializing values in registers,
so that expressions can use them.

llvm-svn: 115658
2010-10-05 20:18:48 +00:00
Greg Clayton b71f384455 Added the notion that a value object can be constant by adding:
bool ValueObject::GetIsConstant() const;
    void ValueObject::SetIsConstant();

This will stop anything from being re-evaluated within the value object so
that constant result value objects can maintain their frozen values without
anything being updated or changed within the value object.

Made it so the ValueObjectConstResult can be constructed with an 
lldb_private::Error object to allow for expression results to have errors.

Since ValueObject objects contain error objects, I changed the expression
evaluation in ClangUserExpression from 

    static Error
    ClangUserExpression::Evaluate (ExecutionContext &exe_ctx, 
                                  const char *expr_cstr, 
                                  lldb::ValueObjectSP &result_valobj_sp);

to:

    static lldb::ValueObjectSP
    Evaluate (ExecutionContext &exe_ctx, const char *expr_cstr);
    
Even though expression parsing is borked right now (pending fixes coming from
Sean Callanan), I filled in the implementation for:
    
    SBValue SBFrame::EvaluateExpression (const char *expr);
    
Modified all expression code to deal with the above changes.

llvm-svn: 115589
2010-10-05 03:13:51 +00:00
Greg Clayton 0184f01936 Moved expression evaluation from CommandObjectExpression into
ClangUserExpression::Evaluate () as a public static function so anyone can
evaluate an expression.

llvm-svn: 115581
2010-10-05 00:31:29 +00:00
Greg Clayton 1d3afba3a3 Added a new ValueObject type that will be used to freeze dry expression
results. The clang opaque type for the expression result will be added to the
Target's ASTContext, and the bytes will be stored in a DataBuffer inside
the new object. The class is named: ValueObjectConstResult

Now after an expression is evaluated, we can get a ValueObjectSP back that
contains a ValueObjectConstResult object.

Relocated the value object dumping code into a static function within
the ValueObject class instead of being in the CommandObjectFrame.cpp file
which is what contained the code to dump variables ("frame variables").

llvm-svn: 115578
2010-10-05 00:00:42 +00:00
Jim Ingham 3bcdb29cab Add an "auto-confirm" setting to the debugger so you can turn off the confirmations if you want to.
llvm-svn: 115572
2010-10-04 22:44:14 +00:00
Caroline Tice 405fe67f14 Modify existing commands with arguments to use the new argument mechanism
(for standardized argument names, argument help, etc.)

llvm-svn: 115570
2010-10-04 22:28:36 +00:00
Chris Lattner 69d23282b4 Use the LLVM Macho.h header instead of relying on the system one,
patch by Arvid Picciani!

llvm-svn: 115563
2010-10-04 21:24:01 +00:00
Jim Ingham 97a6dc7e16 Add a "Confirm" function to the CommandInterpreter so you can confirm potentially dangerous operations in a generic way.
llvm-svn: 115546
2010-10-04 19:49:29 +00:00
Greg Clayton 3b06557e4f Added GetSymbol to the frame.
llvm-svn: 115535
2010-10-04 18:37:52 +00:00
Greg Clayton 0d9c993401 Fixed and issue where we weren't seeing inlined functions anymore. We also now show the correct pc-offset within the inlined function.
llvm-svn: 115522
2010-10-04 17:26:49 +00:00
Greg Clayton cf4b9078f2 Added file and line back to the default thread format.
llvm-svn: 115519
2010-10-04 17:04:23 +00:00
Greg Clayton bb562b13db Fixed an issue with the default frame format settings string where if a frame
was stopped in a module, yet had no valid function for the PC, no module would
be displayed.

llvm-svn: 115490
2010-10-04 02:44:26 +00:00
Greg Clayton 0603aa9dc8 There are now to new "settings set" variables that live in each debugger
instance:

settings set frame-format <string>
settings set thread-format <string>

This allows users to control the information that is seen when dumping
threads and frames. The default values are set such that they do what they
used to do prior to changing over the the user defined formats.

This allows users with terminals that can display color to make different
items different colors using the escape control codes. A few alias examples
that will colorize your thread and frame prompts are:

settings set frame-format 'frame #${frame.index}: \033[0;33m${frame.pc}\033[0m{ \033[1;4;36m${module.file.basename}\033[0;36m ${function.name}{${function.pc-offset}}\033[0m}{ \033[0;35mat \033[1;35m${line.file.basename}:${line.number}}\033[0m\n'

settings set thread-format 'thread #${thread.index}: \033[1;33mtid\033[0;33m = ${thread.id}\033[0m{, \033[0;33m${frame.pc}\033[0m}{ \033[1;4;36m${module.file.basename}\033[0;36m ${function.name}{${function.pc-offset}}\033[0m}{, \033[1;35mstop reason\033[0;35m = ${thread.stop-reason}\033[0m}{, \033[1;36mname = \033[0;36m${thread.name}\033[0m}{, \033[1;32mqueue = \033[0;32m${thread.queue}}\033[0m\n'

A quick web search for "colorize terminal output" should allow you to see what
you can do to make your output look like you want it.

The "settings set" commands above can of course be added to your ~/.lldbinit
file for permanent use.

Changed the pure virtual 
    void ExecutionContextScope::Calculate (ExecutionContext&);
To:
    void ExecutionContextScope::CalculateExecutionContext (ExecutionContext&);
    
I did this because this is a class that anything in the execution context
heirarchy inherits from and "target->Calculate (exe_ctx)" didn't always tell
you what it was really trying to do unless you look at the parameter.

llvm-svn: 115485
2010-10-04 01:05:56 +00:00
Greg Clayton 90a2acd441 One final patch for all of this class constructor, destructor, and conversion
operator naming stuff. We now get the constructor and destructor names right
after passing in the type, and we get the correct conversion operator name
after passing in the return type when getting the DeclarationNameInfo.

llvm-svn: 115398
2010-10-02 01:40:05 +00:00
Greg Clayton a3c444ac23 Get the declaration names for C++ ctors, dtors, and operators from the
right name pools.

llvm-svn: 115371
2010-10-01 23:13:49 +00:00
Caroline Tice 8d88020e92 Uncomment/fix "-f" command option for disassemble command.
llvm-svn: 115351
2010-10-01 21:34:54 +00:00
Greg Clayton c93237c991 Fixed an issue where if a method funciton was asked to be parsed before
its containing class was parsed, we would crash.

llvm-svn: 115343
2010-10-01 20:48:32 +00:00
Caroline Tice deaab2220e Modify command options to use the new arguments mechanism. Now all command option
arguments are specified in a standardized way, will have a standardized name, and
have functioning help.

The next step is to start writing useful help for all the argument types.

llvm-svn: 115335
2010-10-01 19:59:14 +00:00
Caroline Tice e139cf2320 Add infrastructure for standardizing arguments for commands and
command options; makes it easier to ensure that the same type of
argument will have the same name everywhere, hooks up help for command
arguments, so that users can ask for help when they are confused about
what an argument should be; puts in the beginnings of the ability to
do tab-completion for certain types of arguments, allows automatic
syntax help generation for commands with arguments, and adds command
arguments into command options help correctly.

Currently only the breakpoint-id and breakpoint-id-range arguments, in
the breakpoint commands, have been hooked up to use the new mechanism.
The next steps will be to fix the command options arguments to use
this mechanism, and to fix the rest of the regular command arguments
to use this mechanism.  Most of the help text is currently missing or
dummy text; this will need to be filled in, and the existing argument
help text will need to be cleaned up a bit (it was thrown in quickly,
mostly for testing purposes).

Help command now works for all argument types, although the help may not
be very helpful yet.

Those commands that take "raw" command strings now indicate it in their
help text.

llvm-svn: 115318
2010-10-01 17:46:38 +00:00
Greg Clayton 878eaf188c Added correct C++ method declarations for destructors and for conversion
operators.

llvm-svn: 115290
2010-10-01 03:45:20 +00:00
Greg Clayton f51de67640 Make C++ constructors and destructors correctly within the clang types we
generate from DWARF.

llvm-svn: 115268
2010-10-01 02:31:07 +00:00
Sean Callanan e1314273b6 Fixed handling of signed short types in expressions.
llvm-svn: 115267
2010-10-01 02:06:46 +00:00
Greg Clayton 16c880f080 Fixed an issue where byte sizes were not able to be calculated for forward
declarations because we lost the original context which was needed to be
able to figure out the byte size.

llvm-svn: 115223
2010-09-30 22:25:09 +00:00
Greg Clayton 4957bf69e5 Cleaned up a unused member variable in Debugger.
Added the start of Host specific launch services, though it currently isn't
hookup up to anything. We want to be able to launch a process and use the
native launch services to launch an app like it would be launched by the
user double clicking on the app. We also eventually want to be able to run
a command line app in a newly spawned terminal to avoid terminal sharing.

Fixed an issue with the new DWARF forward type declaration stuff. A crasher
was found that was happening when trying to properly expand the forward
declarations.

llvm-svn: 115213
2010-09-30 21:49:03 +00:00
Jim Ingham 86103ea237 Change how we call Target::CreateBreakpoint to account for the new "name type" parameter.
llvm-svn: 115210
2010-09-30 21:21:43 +00:00
Sean Callanan 038df50315 Switched the expression parser from using TargetData
to using Clang to get type sizes.  This fixes a bug
where the type size for a double[2] was being wrongly
reported as 8 instead of 16 bytes, causing problems
for IRForTarget.

Also improved logging so that the next bug in this
area will be easier to find.

llvm-svn: 115208
2010-09-30 21:18:25 +00:00
Johnny Chen f7edb1c813 Fixed indentation.
llvm-svn: 115186
2010-09-30 18:30:25 +00:00
Johnny Chen a9a764e65d Fixed 'expr' help message.
llvm-svn: 115185
2010-09-30 18:16:58 +00:00
Jim Ingham 6c68fb4549 Add "-o" option to "expression" which prints the object description if available.
llvm-svn: 115115
2010-09-30 00:54:27 +00:00
Johnny Chen eb1db1c547 Verify that we have a valid breakpoint ID before proceeding with retrieving its
number of locations.  This fixed a crasher.

llvm-svn: 115092
2010-09-29 21:57:51 +00:00
Caroline Tice 9068d794fd Fix breakpoint id range testing to disallow ranges that specify breakpoint locations from
crossing major breakpoint boundaries (must be within a single breakpoint if specifying locations).

Add .* as a means of specifying all the breakpoint locations under a major breakpoint, e.g. "3.*"
means "all the breakpoint locations of breakpoint 3".

Fix error message to make more sense, if user attempts to specify a breakpoint command when there
isn't a target yet.

llvm-svn: 115077
2010-09-29 19:42:33 +00:00
Greg Clayton 1437224a7c Updated LLVM to: --revision '{2010-09-28T19:30}'
This gets us the new clang::CXXRecordDecl improvments in clang so that when we
add fields, methods and other things to the clang::CXXRecordDecl, the correct
bits are automatically set by clang::CXXRecordDecl itself instead of having 
SEMA and our lldb_private::ClangASTContext functions that create types for
DWARF do it all manually. This allows the clang::ASTContext deep copying of
types to work correctly and it means that the expression parser can now 
evaluate expressions in the context of a class method correctly. Previously
when a class was copied from the DWARF generated ASTContext over into the
expression ASTContext, we were losing CXXRecordDecl bits in the conversion
which caused all classes to think they were at offset zero because the the 
bools for empty, POD, and others would end up being incorrect.

llvm-svn: 115023
2010-09-29 03:44:17 +00:00
Greg Clayton 6d01ad92c7 Fixed an LLVM/Clang assertion that would happen for C++ and ObjC methods if the DWARF doesn't specify the accessibility for the method. Currently gcc 4.2 and clang++ do not set the accessibility correctly on methods. We currently shouldn't default to private since public methods don't have the accessibility specified.
Bottom line: we currently default to public for both C++ and ObjC if the accessibility isn't set.

llvm-svn: 115016
2010-09-29 01:57:37 +00:00
Greg Clayton 1be10fca5f Fixed the forward declaration issue that was present in the DWARF parser after
adding methods to C++ and objective C classes. In order to make methods, we
need the function prototype which means we need the arguments. Parsing these
could cause a circular reference that caused an  assertion.

Added a new typedef for the clang opaque types which are just void pointers:
lldb::clang_type_t. This appears in lldb-types.h.

This was fixed by enabling struct, union, class, and enum types to only get
a forward declaration when we make the clang opaque qual type for these
types. When they need to actually be resolved, lldb_private::Type will call
a new function in the SymbolFile protocol to resolve a clang type when it is
not fully defined (clang::TagDecl::getDefinition() returns NULL). This allows
us to be a lot more lazy when parsing clang types and keeps down the amount
of data that gets parsed into the ASTContext for each module. 

Getting the clang type from a "lldb_private::Type" object now takes a boolean
that indicates if a forward declaration is ok:

    clang_type_t lldb_private::Type::GetClangType (bool forward_decl_is_ok);
    
So function prototypes that define parameters that are "const T&" can now just
parse the forward declaration for type 'T' and we avoid circular references in
the type system.

llvm-svn: 115012
2010-09-29 01:12:09 +00:00