History log of /external/lldb/include/lldb/Expression/ClangUserExpression.h
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
cdc3ea5398f251d3eca482595f103b1874e51538 27-Apr-2013 Sean Callanan <scallanan@apple.com> Performance optimizations to ClangUserExpression,
mostly related to management of the stack frame
for the interpreter.

- First, if the expression can be interpreted,
allocate the stack frame in the target process
(to make sure pointers are valid) but only
read/write to the copy in the host's memory.

- Second, keep the memory allocations for the
stack frame and the materialized struct as
member variables of ClangUserExpression. This
avoids memory allocations and deallocations
each time the expression runs.

<rdar://problem/13043685>


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@180664 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/include/lldb/Expression/ClangUserExpression.h
28195f9e55173cd06c3c5f9e69cefeb1d03cc129 19-Apr-2013 Sean Callanan <scallanan@apple.com> Optimized the way breakpoint conditions are evaluated.
Previously, the options for a breakopint or its
locations stored only the text of the breakpoint
condition (ironically, they used ClangUserExpression
as a glorified std::string) and, each time the condition
had to be evaluated in the StopInfo code, the expression
parser would be invoked via a static method to parse and
then execute the expression.

I made several changes here:

- Each breakpoint location now has its own
ClangUserExpressionSP containing a version of
the breakpoint expression compiled for that exact
location.

- Whenever the breakpoint is hit, the breakpoint
condition expression is simply re-run to determine
whether to stop.

- If the process changes (e.g., it's re-run) or
the source code of the expression changes (we use
a hash so as to avoid doing string comparisons)
the ClangUserExpressionSP is re-generated.

This should improve performance of breakpoint
conditions significantly, and takes advantage of
the recent expression re-use work.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@179838 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/include/lldb/Expression/ClangUserExpression.h
102b2c2681c9a830afe25bfea35557421905e42c 19-Apr-2013 Greg Clayton <gclayton@apple.com> After discussing with Chris Lattner, we require C++11, so lets get rid of the macros and just use C++11.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@179805 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/include/lldb/Expression/ClangUserExpression.h
0f0551e67d8ea8d63ace5456f7d42d951827b017 19-Apr-2013 Sean Callanan <scallanan@apple.com> This commit changes the way LLDB executes user
expressions.

Previously, ClangUserExpression assumed that if
there was a constant result for an expression
then it could be determined during parsing. In
particular, the IRInterpreter ran while parser
state (in particular, ClangExpressionDeclMap)
was present. This approach is flawed, because
the IRInterpreter actually is capable of using
external variables, and hence the result might
be different each run. Until now, we papered
over this flaw by re-parsing the expression each
time we ran it.

I have rewritten the IRInterpreter to be
completely independent of the ClangExpressionDeclMap.
Instead of special-casing external variable lookup,
which ties the IRInterpreter closely to LLDB,
we now interpret the exact same IR that the JIT
would see. This IR assumes that materialization
has occurred; hence the recent implementation of the
Materializer, which does not require parser state
(in the form of ClangExpressionDeclMap) to be
present.

Materialization, interpretation, and dematerialization
are now all independent of parsing. This means that
in theory we can parse expressions once and run them
many times. I have three outstanding tasks before
shutting this down:

- First, I will ensure that all of this works with
core files. Core files have a Process but do not
allow allocating memory, which currently confuses
materialization.

- Second, I will make expression breakpoint
conditions remember their ClangUserExpression and
re-use it.

- Third, I will tear out all the redundant code
(for example, materialization logic in
ClangExpressionDeclMap) that is no longer used.

While implementing this fix, I also found a bug in
IRForTarget's handling of floating-point constants.
This should be fixed.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@179801 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/include/lldb/Expression/ClangUserExpression.h
81a96aa6242f7b559770f5dc62316253cb8cb0d4 18-Apr-2013 Greg Clayton <gclayton@apple.com> Since we use C++11, we should switch over to using std::unique_ptr when C++11 is being used. To do this, we follow what we have done for shared pointers and we define a STD_UNIQUE_PTR macro that can be used and it will "do the right thing". Due to some API differences in std::unique_ptr and due to the fact that we need to be able to compile without C++11, we can't use move semantics so some code needed to change so that it can compile with either C++.

Anyone wanting to use a unique_ptr or auto_ptr should now use the "STD_UNIQUE_PTR(TYPE)" macro.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@179779 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/include/lldb/Expression/ClangUserExpression.h
3b16eb9d424068446fea9cd0e0fe5e7d435f5b6e 11-Apr-2013 Sean Callanan <scallanan@apple.com> Added a Materializer class that contains
information about each variable that needs to
be materialized for an expression to work. The
next step is to migrate all materialization code
from ClangExpressionDeclMap to Materializer, and
to use it for variable materialization.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@179245 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/include/lldb/Expression/ClangUserExpression.h
9e6f6a6f394bb570c5f1f9a850ec0befe4a59fef 05-Apr-2013 Sean Callanan <scallanan@apple.com> Factored out memory access into the target process
from IRExecutionUnit into a superclass called
IRMemoryMap. IRMemoryMap handles all reading and
writing, ensuring that areas are kept track of and
memory is properly cached (and deleted).

Also fixed several cases where we would simply leak
binary data in the target process over time. Now
the expression objects explicitly own their
IRExecutionUnit and delete it when they go away. This
is why I had to modify ClangUserExpression,
ClangUtilityFunction, and ClangFunction.

As a side effect of this, I am removing the JIT
mutex for an IRMemoryMap. If it turns out that we
need this mutex, I'll add it in then, but right now
it's just adding complexity.

This is part of a more general project to make
expressions fully reusable. The next step is to
make materialization and dematerialization use
the IRMemoryMap API rather than writing and
reading directly from the process's memory.
This will allow the IR interpreter to use the
same data, but in the host's memory, without having
to use a different set of pointers.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@178832 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/include/lldb/Expression/ClangUserExpression.h
1cf3da8b0fb0cabf2431b5fe521842929fca69a3 19-Mar-2013 Sean Callanan <scallanan@apple.com> Refactored the expression parser so that the IR
and the JITted code are managed by a standalone
class that handles memory management itself.

I have removed RecordingMemoryManager and
ProcessDataAllocator, which filled similar roles
and had confusing ownership, with a common class
called IRExecutionUnit. The IRExecutionUnit
manages all allocations ever made for an expression
and frees them when it goes away. It also contains
the code generator and can vend the Module for an
expression to other clases.

The end goal here is to make the output of the
expression parser re-usable; that is, to avoid
re-parsing when re-parsing isn't necessary.

I've also cleaned up some code and used weak pointers
in more places. Please let me know if you see any
leaks; I checked myself as well but I might have
missed a case.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@177364 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/include/lldb/Expression/ClangUserExpression.h
b794020ffbd6473c59a6e98be044df50abf7fc30 15-Jan-2013 Jim Ingham <jingham@apple.com> Separated the "expr --unwind-on-error" behavior into two parts, actual errors (i.e. crashes) which continue to be
controlled by the --unwind-on-error flag, and --ignore-breakpoint which separately controls behavior when a called
function hits a breakpoint. For breakpoints, we don't unwind, we either stop, or ignore the breakpoint, which makes
more sense.
Also make both these behaviors globally settable through "settings set".
Also handle the case where a breakpoint command calls code that ends up re-hitting the breakpoint. We were recursing
and crashing. Now we just stop without calling the second command.

<rdar://problem/12986644>
<rdar://problem/9119325>


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@172503 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/include/lldb/Expression/ClangUserExpression.h
34507e41794909465d168af4048ebd07ee7819e8 31-Oct-2012 Greg Clayton <gclayton@apple.com> Carlo Kok found an issue where default parameters were causing the wrong argument to be passed. I got rid of the default args so we don't run into this.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@167167 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/include/lldb/Expression/ClangUserExpression.h
47beabb1386be44e3f90dbc30a0b22c23b93a4dc 16-Oct-2012 Jim Ingham <jingham@apple.com> Add the ability to set timeout & "run all threads" options both from the "expr" command and from
the SB API's that evaluate expressions.

<rdar://problem/12457211>


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@166062 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/include/lldb/Expression/ClangUserExpression.h
6cca9695637b27bd583eaae310d5c09dede7cc49 17-Jul-2012 Enrico Granata <egranata@apple.com> <rdar://problem/11672978> Fixing an issue where an ObjC object might come out without a description because the expression used to obtain it would timeout before running to completion

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@160326 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/include/lldb/Expression/ClangUserExpression.h
598df88bd6fc33c6fb330bc859bdc277795501f3 14-Mar-2012 Greg Clayton <gclayton@apple.com> <rdar://problem/10434005>

Prepare LLDB to be built with C++11 by hiding all accesses to std::tr1 behind
macros that allows us to easily compile for either C++.




git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@152698 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/include/lldb/Expression/ClangUserExpression.h
dd1dcfdbad297562951169ad621f895daf32b382 10-Feb-2012 Sean Callanan <scallanan@apple.com> Fixed a bunch of ownership problems with the expression
parser. Specifically:

- ClangUserExpression now keeps weak pointers to the
structures it needs and then locks them when needed.
This ensures that they continue to be valid without
leaking memory if the ClangUserExpression is long
lived.

- ClangExpressionDeclMap, instead of keeping a pointer
to an ExecutionContext, now contains an
ExecutionContext. This prevents bugs if the pointer
or its contents somehow become stale. It also no
longer requires that ExecutionContexts be passed
into any function except its initialization function,
since it can count on the ExecutionContext still
being around.

There's a lot of room for improvement (specifically,
ClangExpressionDeclMap should also use weak pointers
insetad of shared pointers) but this is an important
first step that codifies assumptions that already
existed in the code.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@150217 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/include/lldb/Expression/ClangUserExpression.h
13d24fb1817faa7ccc4cfd799113ba1a2b8968eb 29-Jan-2012 Greg Clayton <gclayton@apple.com> Switching back to using std::tr1::shared_ptr. We originally switched away
due to RTTI worries since llvm and clang don't use RTTI, but I was able to
switch back with no issues as far as I can tell. Once the RTTI issue wasn't
an issue, we were looking for a way to properly track weak pointers to objects
to solve some of the threading issues we have been running into which naturally
led us back to std::tr1::weak_ptr. We also wanted the ability to make a shared
pointer from just a pointer, which is also easily solved using the
std::tr1::enable_shared_from_this class.

The main reason for this move back is so we can start properly having weak
references to objects. Currently a lldb_private::Thread class has a refrence
to its parent lldb_private::Process. This doesn't work well when we now hand
out a SBThread object that contains a shared pointer to a lldb_private::Thread
as this SBThread can be held onto by external clients and if they end up
using one of these objects we can easily crash.

So the next task is to start adopting std::tr1::weak_ptr where ever it makes
sense which we can do with lldb_private::Debugger, lldb_private::Target,
lldb_private::Process, lldb_private::Thread, lldb_private::StackFrame, and
many more objects now that they are no longer using intrusive ref counted
pointer objects (you can't do std::tr1::weak_ptr functionality with intrusive
pointers).



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@149207 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/include/lldb/Expression/ClangUserExpression.h
daa6efe771f5f068e29328a774fa5bf2358ce14a 21-Dec-2011 Sean Callanan <scallanan@apple.com> The "desired result type" code in the expression
parser has hitherto been an implementation waiting
for a use. I have now tied the '-o' option for
the expression command -- which indicates that the
result is an Objective-C object and needs to be
printed -- to the ExpressionParser, which
communicates the desired type to Clang.

Now, if the result of an expression is determined
by an Objective-C method call for which there is
no type information, that result is implicitly
cast to id if and only if the -o option is passed
to the expression command. (Otherwise if there
is no explicit cast Clang will issue an error.
This behavior is identical to what happened before
r146756.)

Also added a testcase for -o enabled and disabled.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@147099 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/include/lldb/Expression/ClangUserExpression.h
5ed59a78c1970fab44b393cd9d20f0e6fc2e326a 13-Dec-2011 Sean Callanan <scallanan@apple.com> I have modified the part of the code that finds and
validates the "self," "this," and "_cmd" pointers
that get passed into expressions. It used to check
them aggressively for validity before allowing the
expression to run as an object method; now, this
functionality is gated by a bool and off by default.

Now the default is that when LLDB is stopped in a
method of a class, code entered using "expr" will
always masquerade as an instance method. If for
some reason "self," "this," or "_cmd" is unavailable
it will be reported as NULL. This may cause the
expression to crash if it relies on those pointers,
but for example getting the addresses of ivars will
now work as the user would expect.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@146465 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/include/lldb/Expression/ClangUserExpression.h
e6ea5fe8e76b028a0565bc01543bc15f8c120e8a 15-Nov-2011 Sean Callanan <scallanan@apple.com> Pulled in a new version of LLVM/Clang to solve a variety
of problems with Objective-C object completion. To go
along with the LLVM/Clang-side fixes, we have a variety
of Objective-C improvements.

Fixes include:

- It is now possible to run expressions when stopped in
an Objective-C class method and have "self" act just
like "self" would act in the class method itself (i.e.,
[self classMethod] works without casting the return
type if debug info is present). To accomplish this,
the expression masquerades as a class method added by
a category.

- Objective-C objects can now provide methods and
properties and methods to Clang on demand (i.e., the
ASTImporter sets hasExternalVisibleDecls on Objective-C
interface objects).

- Objective-C built-in types, which had long been a bone
of contention (should we be using "id"? "id*"?), are
now fetched correctly using accessor functions on
ClangASTContext. We inhibit searches for them in the
debug information.

There are also a variety of logging fixes, and I made two
changes to the test suite:

- Enabled a test case for Objective-C properties in the
current translation unit.

- Added a test case for calling Objective-C class methods
when stopped in a class method.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@144607 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/include/lldb/Expression/ClangUserExpression.h
5b658cc411e8810073f7f633f3c5d6f177cb3dcd 08-Nov-2011 Sean Callanan <scallanan@apple.com> Added a language parameter to the expression parser,
which will in the future allow expressions to be
compiled as C, C++, and Objective-C instead of the
current default Objective-C++. This feature requires
some additional support from Clang -- specifically, it
requires reference types in the parser regardless of
language -- so it is not yet exposed to the user.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@144042 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/include/lldb/Expression/ClangUserExpression.h
3e4238d47a6d1a3106f357d2e7b495870721c7ae 04-Nov-2011 Greg Clayton <gclayton@apple.com> Fixed the Xcode project building of LLVM to be a bit more user friendly:

- If you download and build the sources in the Xcode project, x86_64 builds
by default using the "llvm.zip" checkpointed LLVM.
- If you delete the "lldb/llvm.zip" and the "lldb/llvm" folder, and build the
Xcode project will download the right LLVM sources and build them from
scratch
- If you have a "lldb/llvm" folder already that contains a "lldb/llvm/lib"
directory, we will use the sources you have placed in the LLDB directory.

Python can now be disabled for platforms that don't support it.

Changed the way the libllvmclang.a files get used. They now all get built into
arch specific directories and never get merged into universal binaries as this
was causing issues where you would have to go and delete the file if you wanted
to build an extra architecture slice.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@143678 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/include/lldb/Expression/ClangUserExpression.h
060d53f1559d08a6923e45bdeffe8f22ca663049 08-Oct-2011 Sean Callanan <scallanan@apple.com> Fixed a memory leak of ASTResultSynthesizers,
by attaching them to the ClangExpressionParser.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@141452 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/include/lldb/Expression/ClangUserExpression.h
47dc457387b690c5e4df1c0c7dd8c4337b92e630 15-Sep-2011 Sean Callanan <scallanan@apple.com> This patch modifies the expression parser to allow it
to execute expressions even in the absence of a process.
This allows expressions to run in situations where the
target cannot run -- e.g., to perform calculations based
on type information, or to inspect a binary's static
data.

This modification touches the following files:

lldb-private-enumerations.h
Introduce a new enum specifying the policy for
processing an expression. Some expressions should
always be JITted, for example if they are functions
that will be used over and over again. Some
expressions should always be interpreted, for
example if the target is unsafe to run. For most,
it is acceptable to JIT them, but interpretation
is preferable when possible.

Target.[h,cpp]
Have EvaluateExpression now accept the new enum.

ClangExpressionDeclMap.[cpp,h]
Add support for the IR interpreter and also make
the ClangExpressionDeclMap more robust in the
absence of a process.

ClangFunction.[cpp,h]
Add support for the new enum.

IRInterpreter.[cpp,h]
New implementation.

ClangUserExpression.[cpp,h]
Add support for the new enum, and for running
expressions in the absence of a process.

ClangExpression.h
Remove references to the old DWARF-based method
of evaluating expressions, because it has been
superseded for now.

ClangUtilityFunction.[cpp,h]
Add support for the new enum.

ClangExpressionParser.[cpp,h]
Add support for the new enum, remove references
to DWARF, and add support for checking whether
the expression could be evaluated statically.

IRForTarget.[h,cpp]
Add support for the new enum, and add utility
functions to support the interpreter.

IRToDWARF.cpp
Removed

CommandObjectExpression.cpp
Remove references to the obsolete -i option.

Process.cpp
Modify calls to ClangUserExpression::Evaluate
to pass the correct enum (for dlopen/dlclose)

SBValue.cpp
Add support for the new enum.

SBFrame.cpp
Add support for he new enum.

BreakpointOptions.cpp
Add support for the new enum.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@139772 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/include/lldb/Expression/ClangUserExpression.h
2431244f929e269c6ecd51aa3eb606b6a2474f19 23-Aug-2011 Sean Callanan <scallanan@apple.com> Added support for persistent types to the
expression parser. You can use a persistent
type like this:

(lldb) expr struct $foo { int a; int b; };
(lldb) struct $foo i; i.a = 2; i.b = 3; i
($foo) $0 = {
(int) a = 2
(int) b = 3
}

typedefs work similarly.

This patch affects the following files:

test/expression_command/persistent_types/*
A test case for persistent types,
in particular structs and typedefs.

ClangForward.h
Added TypeDecl, needed to declare some
functions in ASTResultSynthesizer.h

ClangPersistentVariables.[h,cpp]
Added a list of persistent types to the
persistent variable store.

ASTResultSynthesizer.[h,cpp]
Made the AST result synthesizer iterate
across TypeDecls in the expression, and
record any persistent types found. Also
made a minor documentation fix.

ClangUserExpression.[h,cpp]
Extended the user expression class to
keep the state needed to report the
persistent variable store for the target
to the AST result synthesizers.

Also introduced a new error code for
expressions that executed normally but
did not return a result.

CommandObjectExpression.cpp
Improved output for expressions (like
declarations of new persistent types) that
don't return a result. This is no longer
treated as an error.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@138383 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/include/lldb/Expression/ClangUserExpression.h
ec07c0dde27ae022b87423ee106f10437864c219 09-Aug-2011 Jim Ingham <jingham@apple.com> Add EvaluateWithError static method. Fix a bug in handling constant expressions - we weren't setting the result even though the expression evaluation succeeded...

git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@137077 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/include/lldb/Expression/ClangUserExpression.h
c0492741dc594cd02736521048fe0d8f4c9a0a61 23-May-2011 Sean Callanan <scallanan@apple.com> This commit integrates support for the LLVM MCJIT
into the mainline LLDB codebase. MCJIT introduces
API improvements and better architectural support.

This commit adds a new subsystem, the
ProcessDataAllocator, which is responsible for
performing static data allocations on behalf of the
IR transformer. MCJIT currently does not support
the relocations required to store the constant pool
in the same allocation as the function body, so we
allocate a heap region separately and redirect
static data references from the expression to that
heap region in a new IR modification pass.

This patch also fixes bugs in the IR
transformations that were exposed by the transition
to the MCJIT. Finally, the patch also pulls in a
more recent revision of LLVM so that the MCJIT is
available for use.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@131923 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/include/lldb/Expression/ClangUserExpression.h
0ddf806dd9e71637846bf0ad46e1b2df7d02cbce 10-May-2011 Sean Callanan <scallanan@apple.com> Fixed a bug in which expression-local variables were
treated as being permanently resident in target
memory. In fact, since the expression's stack frame
is deleted and potentially re-used after the
expression completes, the variables need to be treated
as being freeze-dried.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@131104 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/include/lldb/Expression/ClangUserExpression.h
696cf5f6f2a77b87a4b06cdf0f697749b494665f 07-May-2011 Sean Callanan <scallanan@apple.com> Made expressions that are just casts of pointer
variables be evaluated statically.

Also fixed a bug that caused the results of
statically-evaluated expressions to be materialized
improperly.

This bug also removes some duplicate code.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@131042 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/include/lldb/Expression/ClangUserExpression.h
b344843f75ef893762c93fd0a22d2d45712ce74d 24-Mar-2011 Greg Clayton <gclayton@apple.com> Fixed the LLDB build so that we can have private types, private enums and
public types and public enums. This was done to keep the SWIG stuff from
parsing all sorts of enums and types that weren't needed, and allows us to
abstract our API better.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@128239 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/include/lldb/Expression/ClangUserExpression.h
d0882d062a09effb7a22ce81cb327e9b9fa108bd 20-Jan-2011 Greg Clayton <gclayton@apple.com> Make expressions clean up their JIT'ed code allocation.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@123855 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/include/lldb/Expression/ClangUserExpression.h
6a92553d2cc2b7a3b853fcb6da101583435c2dc0 13-Jan-2011 Sean Callanan <scallanan@apple.com> Implemented a major overhaul of the way variables are handled
by LLDB. Instead of being materialized into the input structure
passed to the expression, variables are left in place and pointers
to them are materialzied into the structure. Variables not resident
in memory (notably, registers) get temporary memory regions allocated
for them.

Persistent variables are the most complex part of this, because they
are made in various ways and there are different expectations about
their lifetime. Persistent variables now have flags indicating their
status and what the expectations for longevity are. They can be
marked as residing in target memory permanently -- this is the
default for result variables from expressions entered on the command
line and for explicitly declared persistent variables (but more on
that below). Other result variables have their memory freed.

Some major improvements resulting from this include being able to
properly take the address of variables, better and cleaner support
for functions that return references, and cleaner C++ support in
general. One problem that remains is the problem of explicitly
declared persistent variables; I have not yet implemented the code
that makes references to them into indirect references, so currently
materialization and dematerialization of these variables is broken.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@123371 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/include/lldb/Expression/ClangUserExpression.h
05a5a1bcbed5c0f31fed29153bb2912d71836e91 16-Dec-2010 Sean Callanan <scallanan@apple.com> Implemented a feature where the expression parser
can avoid running the code in the target if the
expression's result is known and the expression
has no side effects.

Right now this feature is quite conservative in
its guess about side effects, and it only computes
integer results, but the machinery to make it more
sophisticated is there.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@121952 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/include/lldb/Expression/ClangUserExpression.h
427f290ff96f3ab9f2cf3a1af7001d2c560424c7 14-Dec-2010 Greg Clayton <gclayton@apple.com> Modified LLDB expressions to not have to JIT and run code just to see variable
values or persistent expression variables. Now if an expression consists of
a value that is a child of a variable, or of a persistent variable only, we
will create a value object for it and make a ValueObjectConstResult from it to
freeze the value (for program variables only, not persistent variables) and
avoid running JITed code. For everything else we still parse up and JIT code
and run it in the inferior.

There was also a lot of clean up in the expression code. I made the
ClangExpressionVariables be stored in collections of shared pointers instead
of in collections of objects. This will help stop a lot of copy constructors on
these large objects and also cleans up the code considerably. The persistent
clang expression variables were moved over to the Target to ensure they persist
across process executions.

Added the ability for lldb_private::Target objects to evaluate expressions.
We want to evaluate expressions at the target level in case we aren't running
yet, or we have just completed running. We still want to be able to access the
persistent expression variables between runs, and also evaluate constant
expressions.

Added extra logging to the dynamic loader plug-in for MacOSX. ModuleList objects
can now dump their contents with the UUID, arch and full paths being logged with
appropriate prefix values.

Thread hardened the Communication class a bit by making the connection auto_ptr
member into a shared pointer member and then making a local copy of the shared
pointer in each method that uses it to make sure another thread can't nuke the
connection object while it is being used by another thread.

Added a new file to the lldb/test/load_unload test that causes the test a.out file
to link to the libd.dylib file all the time. This will allow us to test using
the DYLD_LIBRARY_PATH environment variable after moving libd.dylib somewhere else.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@121745 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/include/lldb/Expression/ClangUserExpression.h
047923c7bc90275f29c2e179d2385df26b8d81a1 14-Dec-2010 Sean Callanan <scallanan@apple.com> Bugfixes for the new "self" pointer handling. Specifically,
the code to pass the _cmd pointer has been improved, and _cmd
is now set to the value of _cmd for the current context, as
opposed to being simply NULL.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@121739 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/include/lldb/Expression/ClangUserExpression.h
e8e5557af333aba8183ce6e9fed9996221eb1547 01-Dec-2010 Sean Callanan <scallanan@apple.com> Fixed ClangUserExpression's wrapping of expressions
in C++ methods. There were two fixes involved:

- For an object whose contents are not known, the
expression should be treated as a non-member, and
"this" should have no meaning.

- For a const object, the method should be declared
const as well.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@120606 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/include/lldb/Expression/ClangUserExpression.h
360f53f3c216ee4fb433da0a367168785328a856 30-Nov-2010 Jim Ingham <jingham@apple.com> Moved the code in ClangUserExpression that set up & ran the thread plan with timeouts, and restarting with all threads into a utility function in Process. This required a bunch of renaming.

Added a ThreadPlanCallUserExpression that differs from ThreadPlanCallFunction in that it holds onto a shared pointer to its ClangUserExpression so that can't go away before the thread plan is done using it.

Fixed the stop message when you hit a breakpoint while running a user expression so it is more obvious what has happened.

git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@120386 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/include/lldb/Expression/ClangUserExpression.h
a91dd997b1e809c67901b7ac481942cacae19150 19-Nov-2010 Sean Callanan <scallanan@apple.com> Added support for indicating to the expression parser
that the result of an expression should be coerced to
a specific type. Also made breakpoint conditions pass
in the bool type for this type.

The expression parser ignores this indication for now.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@119779 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/include/lldb/Expression/ClangUserExpression.h
ea9d4267a629a1c732eb0400fa0288cee31ad49d 05-Nov-2010 Jim Ingham <jingham@apple.com> Added the equivalent of gdb's "unwind-on-signal" to the expression command, and a parameter to control it in ClangUserExpression, and on down to ClangFunction.

git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@118290 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/include/lldb/Expression/ClangUserExpression.h
77e9394f0af653ac0842066a9c7766a28d6c6b94 29-Oct-2010 Sean Callanan <scallanan@apple.com> Added a user-settable variable, 'target.expr-prefix',
which holds the name of a file whose contents are
prefixed to each expression. For example, if the file
~/lldb.prefix.header contains:

typedef unsigned short my_type;

then you can do this:

(lldb) settings set target.expr-prefix '~/lldb.prefix.header'
(lldb) expr sizeof(my_type)
(unsigned long) $0 = 2

When the variable is changed, the corresponding file
is loaded and its contents are fetched into a string
that is stored along with the target. This string
is then passed to each expression and inserted into
it during parsing, like this:

typedef unsigned short my_type;

void
$__lldb_expr(void *$__lldb_arg)
{
sizeof(my_type);
}


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@117627 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/include/lldb/Expression/ClangUserExpression.h
ab06af92020fd4a21eaa5daac3853596b9c45398 20-Oct-2010 Sean Callanan <scallanan@apple.com> Fixed a silly bug that was causing the "this" pointer
to be passed improperly to expressions in certain
cases.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@116884 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/include/lldb/Expression/ClangUserExpression.h
8de27c761a22187ef63fb60000894be163e7285f 16-Oct-2010 Greg Clayton <gclayton@apple.com> Made many ConstString functions inlined in the header file.

Changed all of our synthesized "___clang" functions, types and variables
that get used in expressions over to have a prefix of "$_lldb". Now when we
do name lookups we can easily switch off of the first '$' character to know
if we should look through only our internal (when first char is '$') stuff,
or when we should look through program variables, functions and types.

Converted all of the clang expression code over to using "const ConstString&"
values for names instead of "const char *" since there were many places that
were converting the "const char *" names into ConstString names and them
throwing them away. We now avoid making a lot of ConstString conversions and
benefit from the quick comparisons in a few extra spots.

Converted a lot of code from LLVM coding conventions into LLDB coding
conventions.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@116634 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/include/lldb/Expression/ClangUserExpression.h
d168690e51f9020b926d3d0d57dc9a2cfb2095a8 15-Oct-2010 Jim Ingham <jingham@apple.com> Added support for breakpoint conditions. I also had to separate the "run the expression" part of ClangFunction::Execute from the "Gather the expression result" so that in the case of the Breakpoint condition I can move the condition evaluation into the normal thread plan processing.

Also added support for remembering the "last set breakpoint" so that "break modify" will act on the last set breakpoint.

git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@116542 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/include/lldb/Expression/ClangUserExpression.h
d171972ecc7788bdb02d3e81420a24841e09a2bf 05-Oct-2010 Greg Clayton <gclayton@apple.com> 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.




git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@115589 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/include/lldb/Expression/ClangUserExpression.h
377e0b4b4677128244b151396f77b3421bf2b9fa 05-Oct-2010 Greg Clayton <gclayton@apple.com> Moved expression evaluation from CommandObjectExpression into
ClangUserExpression::Evaluate () as a public static function so anyone can
evaluate an expression.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@115581 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/include/lldb/Expression/ClangUserExpression.h
6a5aa8ab240a13f397e3e09f2ca1ea3f16b451c2 25-Sep-2010 Greg Clayton <gclayton@apple.com> Cleaned a few build related things up:

Added a virtual destructor to ClangUtilityFunction with a body to it cleans
itself up.

Moved our SharingPtr into the lldb_private namespace to keep it easy to make
an exports file that exports only what is needed ("lldb::*").



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@114771 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/include/lldb/Expression/ClangUserExpression.h
3c9c5eb466869ede185e879d14a47335fb43194d 21-Sep-2010 Sean Callanan <scallanan@apple.com> Removed the hacky "#define this ___clang_this" handler
for C++ classes. Replaced it with a less hacky approach:

- If an expression is defined in the context of a
method of class A, then that expression is wrapped as
___clang_class::___clang_expr(void*) { ... }
instead of ___clang_expr(void*) { ... }.

- ___clang_class is resolved as the type of the target
of the "this" pointer in the method the expression
is defined in.

- When reporting the type of ___clang_class, a method
with the signature ___clang_expr(void*) is added to
that class, so that Clang doesn't complain about a
method being defined without a corresponding
declaration.

- Whenever the expression gets called, "this" gets
looked up, type-checked, and then passed in as the
first argument.

This required the following changes:

- The ABIs were changed to support passing of the "this"
pointer as part of trivial calls.

- ThreadPlanCallFunction and ClangFunction were changed
to support passing of an optional "this" pointer.

- ClangUserExpression was extended to perform the
wrapping described above.

- ClangASTSource was changed to revert the changes
required by the hack.

- ClangExpressionParser, IRForTarget, and
ClangExpressionDeclMap were changed to handle
different manglings of ___clang_expr flexibly. This
meant no longer searching for a function called
___clang_expr, but rather looking for a function whose
name *contains* ___clang_expr.

- ClangExpressionParser and ClangExpressionDeclMap now
remember whether "this" is required, and know how to
look it up as necessary.

A few inheritance bugs remain, and I'm trying to resolve
these. But it is now possible to use "this" as well as
refer implicitly to member variables, when in the proper
context.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@114384 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/include/lldb/Expression/ClangUserExpression.h
e8a59a8ec92e71203e434f28b5bac6606aacaf3c 13-Sep-2010 Sean Callanan <scallanan@apple.com> Bugfixes to the expression parser. Fixes include:

- If you put a semicolon at the end of an expression,
this no longer causes the expression parser to
error out. This was a two-part fix: first,
ClangExpressionDeclMap::Materialize now handles
an empty struct (such as when there is no return
value); second, ASTResultSynthesizer walks backward
from the end of the ASTs until it reaches something
that's not a NullStmt.

- ClangExpressionVariable now properly byte-swaps when
printing itself.

- ClangUtilityFunction now cleans up after itself when
it's done compiling itself.

- Utility functions can now use external functions just
like user expressions.

- If you end your expression with a statement that does
not return a value, the expression now runs correctly
anyway.

Also, added the beginnings of an Objective-C object
validator function, which is neither installed nor used
as yet.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@113789 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/include/lldb/Expression/ClangUserExpression.h
830a903fd7cd4595cf52e1630b6491930ada0400 28-Aug-2010 Sean Callanan <scallanan@apple.com> Added a ClangUtilityFunction class that allows the
debugger to insert self-contained functions for use by
expressions (mainly for error-checking).

In order to support detecting whether a crash occurred
in one of these helpers -- currently our preferred way
of reporting that an error-check failed -- added a bit
of support for getting the extent of a JITted function
in addition to just its base.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@112324 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/include/lldb/Expression/ClangUserExpression.h
65dafa8344c8c018e346dd331a7782081a896239 27-Aug-2010 Sean Callanan <scallanan@apple.com> This is a major refactoring of the expression parser.
The goal is to separate the parser's data from the data
belonging to the parser's clients. This allows clients
to use the parser to obtain (for example) a JIT compiled
function or some DWARF code, and then discard the parser
state.

Previously, parser state was held in ClangExpression and
used liberally by ClangFunction, which inherited from
ClangExpression. The main effects of this refactoring
are:

- reducing ClangExpression to an abstract class that
declares methods that any client must expose to the
expression parser,

- moving the code specific to implementing the "expr"
command from ClangExpression and
CommandObjectExpression into ClangUserExpression,
a new class,

- moving the common parser interaction code from
ClangExpression into ClangExpressionParser, a new
class, and

- making ClangFunction rely only on
ClangExpressionParser and not depend on the
internal implementation of ClangExpression.

Side effects include:

- the compiler interaction code has been factored
out of ClangFunction and is now in an AST pass
(ASTStructExtractor),

- the header file for ClangFunction is now fully
documented,

- several bugs that only popped up when Clang was
deallocated (which never happened, since the
lifetime of the compiler was essentially infinite)
are now fixed, and

- the developer-only "call" command has been
disabled.

I have tested the expr command and the Objective-C
step-into code, which use ClangUserExpression and
ClangFunction, respectively, and verified that they
work. Please let me know if you encounter bugs or
poor documentation.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@112249 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/include/lldb/Expression/ClangUserExpression.h