Commit Graph

951 Commits

Author SHA1 Message Date
Peter Collingbourne 46df6a252a Use full path to ClangForward.h
Fixes Linux build.

llvm-svn: 143038
2011-10-26 17:55:48 +00:00
Sean Callanan 3b1d4f6785 Added a new #define, LLVM_NDEBUG_OFF, that should
be set if linking against an LLVM compiled with
NDEBUG off.  If it is set, we do not enable NDEBUG
in any place where we include LLVM headers.

llvm-svn: 143036
2011-10-26 17:46:51 +00:00
Sean Callanan 580b29f9cb Fixed VerifyDecl to use shared forward declarations.
llvm-svn: 143029
2011-10-26 16:20:57 +00:00
Greg Clayton 82f4cf46aa A simple fix for the GDB format strings so the byte size parameter gets
properly marked as valid.

Also modified the "memory read" command to be able to intelligently repeat
subsequent memory requests, so now you can do:

(lldb) memory read --format hex --count 32 0x1000

Then hit enter to keep viewing the memory that follows the last valid request.

llvm-svn: 143015
2011-10-26 04:32:38 +00:00
Greg Clayton 55561e942b Fixed an issue where a class that resides inside another class wasn't getting
an access specifier set on it, causing an assertion to fire when building
with a Debug+Asserts build of clang.

llvm-svn: 143010
2011-10-26 03:31:36 +00:00
Sean Callanan 5e9e1991e9 Added VerifyDecl, a function that, when LLDB is
linked against a debug LLVM, runs a variety of
functions -- currently just one -- that verify
that the Decls we create are valid.

ClangASTContext now calls this verifier whenever
it adds a Decl to a DeclContext, and the verifier
checks that the AccessSpecifier is sane.

llvm-svn: 143000
2011-10-26 01:06:27 +00:00
Greg Clayton 86edbf41d1 Cleaned up many error codes. For any who is filling in error strings into
lldb_private::Error objects the rules are:
- short strings that don't start with a capitol letter unless the name is a
  class or anything else that is always capitolized
- no trailing newline character
- should be one line if possible

Implemented a first pass at adding "--gdb-format" support to anything that
accepts format with optional size/count.

llvm-svn: 142999
2011-10-26 00:56:27 +00:00
Sean Callanan c70ed46dda Improved handling of static data in the expression
parser.  Now expression like the following work as
expected:

-
(lldb) expr struct { int a; int b; } $blah = { 10, 20 }
<no result>
(lldb) expr $blah
(<anonymous struct at Parse:6:5>) $blah = {
  (int) a = 10
  (int) b = 20
}
-

Now the IRForTarget subsystem knows how to handle
static initializers of various composite types.

Also removed an unnecessary parameter from
ClangExpressionDeclMap::GetFunctionInfo.

llvm-svn: 142936
2011-10-25 18:36:40 +00:00
Greg Clayton 1deb796238 Updated all commands that use a "--format" / "-f" options to use the new
OptionGroupFormat. Updated OptionGroupFormat to be able to also use the
"--size" and "--count" options. Commands that use a OptionGroupFormat instance
can choose which of the options they want by initializing OptionGroupFormat
accordingly. Clients can either get only the "--format", "--format" + "--size",
or "--format" + "--size" + "--count". This is in preparation for upcoming
chnages where there are alternate ways (GDB format specification) to set a
format. 

llvm-svn: 142911
2011-10-25 06:44:01 +00:00
Greg Clayton 5196416772 Simplified the CommandInterpreter::StripFirstWord logic by making it a static
function and having it not require both a bool and a quote char to fill in.
We intend to get rid of this functionality when we rewrite the command 
interpreter for streams eventually, but not for now.

llvm-svn: 142888
2011-10-25 00:36:27 +00:00
Enrico Granata 47c6f6d43d Decoupling of lock-related code from the core of ScriptInterpreterPython. All that concerns locking the Python interpreter is now delegated to the internal ScriptInterpreterPython::Locker class. Several changes in ScriptInterpreterPython to accommodate this new pattern.
llvm-svn: 142802
2011-10-24 17:22:21 +00:00
Benjamin Kramer 1695466fe3 Move Python.h includes out of the headers into the .cpp file where it's actually used.
Python.h includes a ton of macros that can cause weird behavior down the road.

llvm-svn: 142754
2011-10-23 16:49:03 +00:00
Benjamin Kramer d34a329c68 Remove unused include of deprecated header.
llvm-svn: 142753
2011-10-23 16:31:38 +00:00
Greg Clayton f0705c8b90 Added template support when parsing DWARF into types. We can now use STL
classes in the expression parser.

llvm-svn: 142717
2011-10-22 03:33:13 +00:00
Sean Callanan b226916528 Implemented an extension to the namespace map that
permits a namespace map to be created and populated
when the namespace is imported, not just when it is
requested via FindExternalVisibleDecls().

llvm-svn: 142690
2011-10-21 22:18:07 +00:00
Sean Callanan 80c48c10d0 Made the IR interpreter more robust in the presence
of arbitrary pointers, allowing direct dereferences
of literal addresses.  Also disabled special-cased
generation of certain expression results (especially
casts), substituting the IR interpreter.

llvm-svn: 142638
2011-10-21 05:18:02 +00:00
Jim Ingham 8f07716139 Lock the Unwinder before accessing it.
llvm-svn: 142632
2011-10-21 01:49:48 +00:00
Greg Clayton 97fbc34276 Fixed some issues where we might not have one of the new apple accelerator
tables (like the .apple_namespaces) and it would cause us to index DWARF that
didn't need to be indexed.

Updated the MappedHash.h (generic Apple accelerator table) and the DWARF
specific one (HashedNameToDIE.h) to be up to date with the latest and
greatest hash table format.

llvm-svn: 142627
2011-10-20 22:30:33 +00:00
Greg Clayton 64bc6ca595 Modified the ASTDumper to return a "const char *" instead of a copy of the
std::string and modified all places that used the std::string it returned
to use the "const char *".

Also modified the expression parser to not crash when a function type fails
to copy into the expression AST context.

llvm-svn: 142561
2011-10-20 00:47:21 +00:00
Greg Clayton 81c22f6104 Moved lldb::user_id_t values to be 64 bit. This was going to be needed for
process IDs, and thread IDs, but was mainly needed for for the UserID's for
Types so that DWARF with debug map can work flawlessly. With DWARF in .o files
the type ID was the DIE offset in the DWARF for the .o file which is not
unique across all .o files, so now the SymbolFileDWARFDebugMap class will
make the .o file index part (the high 32 bits) of the unique type identifier
so it can uniquely identify the types.

llvm-svn: 142534
2011-10-19 18:09:39 +00:00
Greg Clayton 85ae2e1349 Changed lldb_private::Type over to use the intrusive ref counted pointers
so we don't have to lookup types in a type list by ID.

Changed the DWARF parser to remove the "can externally complete myself" bits
from the type when we are in the process of completing the type itself to
avoid an onslaught of external visible decl requests from the 
clang::ExternalASTSource.

llvm-svn: 142461
2011-10-18 23:36:41 +00:00
Sean Callanan 35c7f98734 Improved logging, replacing the old ASTDumper (which
we never used) with a much simpler class that wraps
the relevant dump functions in Clang.  This class also
knows to disable external lookups on DeclContexts
being dumped so it should be safe to print incomplete
Decls.

llvm-svn: 142359
2011-10-18 16:46:55 +00:00
Johnny Chen fc79b400b2 This patch alloows lldb to build under GCC.
from dawn@burble.org

llvm-svn: 142305
2011-10-17 23:18:19 +00:00
Enrico Granata a9dbf4325e this patch introduces a new command script import command which takes as input a filename for a Python script and imports the module contained in that file. the containing directory is added to the Python path such that dependencies are honored. also, the module may contain an __lldb_init_module(debugger,dict) function, which gets called after importing, and which can somehow initialize the module's interaction with lldb
llvm-svn: 142283
2011-10-17 21:45:27 +00:00
Johnny Chen 16dcf718d3 Add a commnad to set a condition for a watchpoint. Example:
watchpoint modify -c 'global==5'

modifies the last created watchpoint so that the condition expression
is evaluated at the stop point to decide whether we should proceed with
the stopping.

Also add SBWatchpont::SetCondition(const char *condition) to set condition
programmatically.

Test cases to come later.

llvm-svn: 142227
2011-10-17 18:58:00 +00:00
Jim Ingham a5ce6c88f9 Make "next" and "step-out" work when in stepping over or out of inlined functions.
llvm-svn: 142031
2011-10-15 00:57:28 +00:00
Jim Ingham c4c9fedc72 Make the step range plans capable of supporting multiple ranges. Also make their constructors public, there isn't any good reason why you shouldn't be able to make these plans.
llvm-svn: 142026
2011-10-15 00:24:48 +00:00
Greg Clayton 147e1fa298 Add function decls to their parent decl context.
llvm-svn: 142011
2011-10-14 22:47:18 +00:00
Greg Clayton 030a204664 Make sure we create only unique one namespace per AST when parsing the DWARF.
llvm-svn: 142005
2011-10-14 21:34:45 +00:00
Sean Callanan 7dd9812675 Improved expression logging. Now all calls to
FindExternalVisibleDecls and FindExternalLexicalDecls
are marked and given unique IDs, so that all logging
done as part of their execution can be traced back to
the proper call.

Also there was some logging that really wasn't helpful
in most cases so I disabled it unless verbose logging
(log enable -v lldb expr) is enabled.

llvm-svn: 141987
2011-10-14 20:34:21 +00:00
Johnny Chen ed456eb0a9 Add SBWatchpoint::GetError() API, which is not currently populated as yet.
llvm-svn: 141979
2011-10-14 19:15:48 +00:00
Greg Clayton 5a31471e72 Added the ability to run expressions in any command. Expressions can be
inserted in commands by using backticks:

(lldb) memory read `$rsp-16` `$rsp+16`
(lldb) memory read  -c `(int)strlen(argv[0])` `argv[0]`

The result of the expression will be inserted into the command as a sort of
preprocess stage where this gets done first. We might need to tweak where this
preprocess stage goes, but it is very functional already.

Added ansi color support to the Debugger::FormatPrompt() so you can use things
like "${ansi.fg.blue}" and "${ansi.bold}" many more. This helps in adding 
colors to your prompts without needing to know the ANSI color code strings.

llvm-svn: 141948
2011-10-14 07:41:33 +00:00
Johnny Chen 01a678603a SBValue::Watch() and SBValue::WatchPointee() are now the official API for creating
a watchpoint for either the variable encapsulated by SBValue (Watch) or the pointee
encapsulated by SBValue (WatchPointee).

Removed SBFrame::WatchValue() and SBFrame::WatchLocation() API as a result of that.

Modified the watchpoint related test suite to reflect the change.

Plus replacing WatchpointLocation with Watchpoint throughout the code base.

There are still cleanups to be dome.  This patch passes the whole test suite.
Check it in so that we aggressively catch regressions.

llvm-svn: 141925
2011-10-14 00:42:25 +00:00
Greg Clayton 20568dd981 Fixed a case where we might end up trying to parse a type in the DWARF parser for a method whose class isn't currently in the process of completing itself. Currently, methods of a class, must be parsed when the class type that contains the method is asked to complete itself through the clang::ExternalASTSource virtual functions. Now we "do the right thing" by checking if the class is being defined, and if so we parse it, else we tell the class to complete itself so everything happens correctly.
llvm-svn: 141908
2011-10-13 23:13:20 +00:00
Sean Callanan c6bba3e46d Cleaned up a few functions that never get used.
Specifically, the expression parser used to use
functions attached to SymbolContext to do lookups,
but nowadays it searches a ModuleList or Module
directly instead.  These functions had no
remaining clients so I removed them to prevent
bit rot.

I also removed a stray callback function from
ClangExpressionDeclMap.

llvm-svn: 141899
2011-10-13 22:18:56 +00:00
Sean Callanan c41e68b127 Moved the list of found namespaces into the search
context object.  Having it populated and registered
within a single FindExternalVisibleDecls call worked
fine when there was only one call (i.e., when we were
just looking in the global namespace).  

However, now FindExternalVisibleDecls is called for
nested namespaces as well, which means that it is
called not once but many times (once per module in
which the parent namespace appears).  This means that
the namespace mapping is built up across many calls
to the inferior FindExternalVisibleDecls, so I moved
it into a data structure (the search context) that is
shared by all calls.

I also added some logging to make it easier to see
what is happening during a namespace search, and 
cleaned up some existing logging.

llvm-svn: 141888
2011-10-13 21:08:11 +00:00
Greg Clayton 1b282f9619 Cleaned up the SBWatchpoint public API.
llvm-svn: 141876
2011-10-13 18:08:26 +00:00
Sean Callanan b96ff33b0e Removed namespace qualification from symbol queries.
llvm-svn: 141866
2011-10-13 16:49:47 +00:00
Sean Callanan 213fdb8bf6 Completed the glue that passes a ClangNamespaceDecl *
down through Module and SymbolVendor into SymbolFile.
Added checks to SymbolFileDWARF that restrict symbol
searches when a namespace is passed in.

llvm-svn: 141847
2011-10-13 01:49:10 +00:00
Sean Callanan 8e5b8b9631 Now that we know the values are going to stick around,
we don't need to look them up again when materializing.

Switched over the materialization mechanism (for JIT
expressions) and the lookup mechanism (for interpreted
expressions) to use the VariableSP/Symbol that were
found during parsing.

llvm-svn: 141839
2011-10-13 00:09:20 +00:00
Sean Callanan ca4e0fd7e6 Refactoring in preparation for having multiple
calls to the FindExternalVisibleDecls function.

FindExternalVisibleDecls was recording whether
it had found generic function symbols in variables
that were local to the function.  Now, however,
multiple calls occur in response to one request
from Clang, since we may be searching across
namespaces.  To support that, I moved the local
variables into a bitfield in NameSearchContext.

llvm-svn: 141808
2011-10-12 20:29:25 +00:00
Sean Callanan 4c3977c278 Added support to ClagnExpressionDeclMap for finding
data symbols in namespaces.

llvm-svn: 141792
2011-10-12 18:00:53 +00:00
Sean Callanan 1fd3f4f14c Made FindGlobalVariable() optionally search a specific
module and namespace.  Also made it use FindGlobalVariables()
instead of the more heavyweight 
GetVariablesForVariableExpressionPath().

llvm-svn: 141783
2011-10-12 16:59:31 +00:00
Sean Callanan b6d70ebc0a Added ClangNamespaceDecl * parameters to several
core Module functions that the expression parser
will soon be using.

llvm-svn: 141766
2011-10-12 02:08:07 +00:00
Sean Callanan 8897224363 Cleanups in preparation for making FindExternalVisibleDecls
look in individual modules rather than globally.

Also some whitespace fixes.

llvm-svn: 141765
2011-10-12 01:39:28 +00:00
Greg Clayton d4e2552c73 Fix preprocessor warnings for no newline at the end of the source files.
llvm-svn: 141755
2011-10-12 00:53:29 +00:00
Sean Callanan 503aa525ea Implemented a namespace map that allows searching
of namespaces (only in the modules where they've
been found) for entities inside those namespaces.

For each NamespaceDecl that has been imported into
the parser, we maintain a map containing
[ModuleSP, ClangNamespaceDecl] pairs in the ASTImporter.
This map has one entry for each module in which the
namespace has been found.  When we later scan for an
entity inside a namespace, we search only the modules
in which that namespace was found.

Also made a small whitespace fix in 
ClangExpressionParser.cpp.

llvm-svn: 141748
2011-10-12 00:12:34 +00:00
Jim Ingham 2dd7f7fb71 Add a SBTarget::BreakpointCreateByName API that allows you to specify the name
type mask.

llvm-svn: 141625
2011-10-11 01:18:55 +00:00
Greg Clayton 995e10ac9b Patch from Dragos Tatulea regarding typedefs with the new RangeArray template class.
llvm-svn: 141546
2011-10-10 16:33:44 +00:00
Greg Clayton 2215230040 Changed RangeMap over to use llvm::SmallVector and updated the RangeArray and the RangeDataArray to have an extra "unsigned N" template parameter. Updated the lldb_private::Block to use a RangeArray with a uint32_t for both the function base offset and block range size, and then a 1 for the small vector size since most lexical blocks in DWARF only have 1 range. Updates the DWARFDebugRanges RangeArray to use an unsigned of 2 since most blocks that have more than one range usually have 2. Also updated a DWARFDebugAranges to default their RangeArray to use a SmallVector with unsigned size of 1 since this will take care of the .o files when doing DWARF in .o files and since there really isn't any good size we can guess with.
llvm-svn: 141480
2011-10-08 06:59:54 +00:00