Commit Graph

4277 Commits

Author SHA1 Message Date
Johnny Chen 1e4cd1fc97 Commenting out the two @expectedFailureClang decorators as the tests have been passing for a while
with the recent clang compilers.

The latest I tried is: Apple clang version 3.1 (tags/Apple/clang-318.0.9) (based on LLVM 3.1svn)

llvm-svn: 146427
2011-12-12 22:07:36 +00:00
Johnny Chen 64bab4894e rdar://problem/10227672
There were two problems associated with this radar:
1. "settings show target.source-map" failed to show the source-map after, for example,
   "settings set target.source-map /Volumes/data/lldb/svn/trunk/test/source-manager /Volumes/data/lldb/svn/trunk/test/source-manager/hidden"
   has been executed to set the source-map.
2. "list -n main" failed to display the source of the main() function after we properly set the source-map.

The first was fixed by adding the missing functionality to TargetInstanceSettings::GetInstanceSettingsValue (Target.cpp)
and updating the support files PathMappingList.h/.cpp; the second by modifying SourceManager.cpp to fix several places
with incorrect logic.

Also added a test case test_move_and_then_display_source() to TestSourceManager.py, which moves main.c to hidden/main.c,
sets target.source-map to perform the directory mapping, and then verifies that "list -n main" can still show the main()
function.

llvm-svn: 146422
2011-12-12 21:59:28 +00:00
Greg Clayton 42ce2f35fd Use forward types where possible to avoid having to parse extra DWARF when
it is not required.

llvm-svn: 146418
2011-12-12 21:50:19 +00:00
Greg Clayton fc5dd29ef7 Always return a valid answer for qMemoryRegionInfo if the packet is supported.
We will return a valid range when possible and omit the "permissions" key
when the memory is not readable, writeable or executeable. This will help us
know the difference between an error back from this packet and unsupported,
from just "this address isn't in a valid region".

llvm-svn: 146394
2011-12-12 18:51:14 +00:00
Greg Clayton 6f6bf26a3e <rdar://problem/9958446>
<rdar://problem/10561406>

Stopped the SymbolFileDWARF::FindFunctions (...) from always calculating
the line table entry for all functions that were found. This can slow down
the expression parser if it ends up finding a bunch of matches. Fixed the 
places that were relying on the line table entry being filled in.

Discovered a recursive stack blowout that happened when "main" didn't have
line info for it and there was no line information for "main"

llvm-svn: 146330
2011-12-10 21:05:26 +00:00
Johnny Chen a9e77784e0 Move some print stmts to the test method, where they get printed only if the test is qualified to run
under the current test driver run configuration.

llvm-svn: 146320
2011-12-10 07:18:11 +00:00
Sean Callanan fd1ba911f8 Fixed a problem where if a frame was present the
expression parser would never try getting typed
variables from the target.

llvm-svn: 146317
2011-12-10 04:03:38 +00:00
Sean Callanan 9b3569bacc Two fixes for file variables:
- Even if a frame isn't present, we always try
  to use FindGlobalVariable to find variables.
  Instead of using frame->TrackGlobalVariable()
  to promote the VariableSP into a ValueObject,
  we now simply use ValueObjectVariable.

- When requesting the value of a variable, we
  allow returning of the "live version" of the
  variable -- that is, the variable in the
  target instead of a pointer to its freeze
  dried version in LLDB -- even if there is no
  process present.

llvm-svn: 146315
2011-12-10 03:12:34 +00:00
Greg Clayton 3bffb085f4 <rdar://problem/10559329>
An assertion was firing when parsing types due to trying to complete parent
class decl contenxt types too often.

Also, relax where "dsymutil" binary can come from in the Makefile.rules.

llvm-svn: 146310
2011-12-10 02:15:28 +00:00
Jim Ingham 9ee0115147 Don't try to cache the ExecutionContextScope in the ValueObject::EvaluationPoint, it is too
hard to ensure it doesn't get invalidated out from under us.  Instead look it up from the ThreadID
and StackID when asked for it.
<rdar://problem/10554409>

llvm-svn: 146309
2011-12-10 01:49:43 +00:00
Sean Callanan 8a6a6acd1f Fixed a problem with properties where LLDB was not
creating appropriate setter/getter methods for
property definitions.

llvm-svn: 146295
2011-12-09 23:24:26 +00:00
Jim Ingham 703588540e Don't spam warnings about not being able to read memory at 0x0.
llvm-svn: 146271
2011-12-09 19:48:22 +00:00
Greg Clayton 220a00772a Tested a theory on the where when we lookup things in the accelerator tables
that if we prefer the current compile unit, followed by any compile units that
already had their DIEs parsed, followed by the rest of the matches, that we
might save some memory. This turned out not to help much. The code is commented
out, but I want to check it in so I don't lose the code in case it could help
later.

Added the ability to efficiently find the objective C class implementation
when using the new .apple_types acclerator tables with the type flags. If the
type flags are not available, we default back to what we were doing before.

llvm-svn: 146250
2011-12-09 08:48:30 +00:00
Jason Molenda d74db47a41 Move the ARM specific arch picker from PlatformRemoteiOS.cpp to
PlatformDarwin.cpp -- call it from both PlatformRemoteiOS.cpp
and the native process PlatformDarwin.cpp when running on an arm
system.

Bump lldb version number to 94.

llvm-svn: 146249
2011-12-09 07:50:50 +00:00
Jim Ingham 79ea1d8877 Rework how the breakpoint conditions & callbacks are handled. We now iterate over all the locations at the site
that got hit, and first check the condition, and if that location's condition says we should stop, then we
run the callback.  In the end if any location's condition and callback say we should stop, then we stop. 

llvm-svn: 146242
2011-12-09 04:17:31 +00:00
Greg Clayton 8f192cea00 We now have a test case for stopping within a module in a place where the
translation unit has a interface for a class "Bar" that contains hidden ivars
in the implementation and we make sure we can see these hidden ivars. We also
test the case where we stop in translation unit that contains the 
implementation first. So the test runs two tests:

1 - run and stop where we have an interface, run to main and print and make
    sure we find the hidden ivar
2 - run and stop where we have an implementation, run to main and print and make
    sure we find the hidden ivar
    

llvm-svn: 146216
2011-12-09 00:58:33 +00:00
Sean Callanan 12014a0471 If the expression parser is unable to complete a TagDecl
in the context in which it was originally found, the
expression parser now goes hunting for it in all modules
(in the appropriate namespace, if applicable).  This means
that forward-declared types that exist in another shared
library will now be resolved correctly.

Added a test case to cover this.  The test case also tests
"frame variable," which does not have this functionality
yet.

llvm-svn: 146204
2011-12-08 23:45:45 +00:00
Jason Molenda 10c480a461 Move CPUHasAVX() prototype out of an #ifdef block of code.
llvm-svn: 146198
2011-12-08 22:36:41 +00:00
Jim Ingham 60dbabbaa7 Add SBValue::GetDynamicValue and SBValue::GetStaticValue API's.
<rdar://problem/10545069>

llvm-svn: 146173
2011-12-08 19:44:08 +00:00
Sean Callanan 5780f9df56 Added the ability to dereference an Objective-C object
pointer to make the result of an expression.  LLDB now
dumps the ivars of the Objective-C object and all of
its parents.  This just required fixing a bug where we
didn't distinguish between Objective-C object pointers
and regular C-style pointers.

Also added a testcase to verify that this continues to
work.

llvm-svn: 146164
2011-12-08 19:04:34 +00:00
Peter Collingbourne dd3e9ccd04 libEnhancedDisassembly.a is gone from recent LLVM.
llvm-svn: 146148
2011-12-08 10:43:04 +00:00
Greg Clayton cab36a3a59 Fixed an issue where we are asking to get the decl context for a function
that is in a class from the expression parser, and it was causing an
assertion. There is now a function that will correctly resolve a type
even if it is in a class.

llvm-svn: 146141
2011-12-08 05:16:30 +00:00
Greg Clayton a64e446e4c <rdar://problem/10544202>
Fixed detection of AVX on darwin now that our kernel supports it.

llvm-svn: 146135
2011-12-08 03:19:36 +00:00
Jim Ingham f80bc3f447 Get the bit-field offset & size for ObjC ivars that are bitfields.
<rdar://problem/10535460> lldb expression evaluation doesn't handle bit fields in ObjC classes properly

llvm-svn: 146134
2011-12-08 02:53:10 +00:00
Sean Callanan 56d6fdf695 Tightened up the variable list to deal with
variables that might not have valid names.

llvm-svn: 146133
2011-12-08 02:51:25 +00:00
Greg Clayton d1767f05b5 Added a new class called lldb_private::SymbolFileType which is designed to
take a SymbolFile reference and a lldb::user_id_t and be used in objects
which represent things in debug symbols that have types where we don't need
to know the true type yet, such as in lldb_private::Variable objects. This
allows us to defer resolving the type until something is used. More specifically
this allows us to get 1000 local variables from the current function, and if
the user types "frame variable argc", we end up _only_ resolving the type for
"argc" and not for the 999 other local variables. We can expand the use of this
as needed in the future.

Modified the DWARFMappedHash class to be able to read the HashData that has
more than just the DIE offset. It currently will read the atoms in the header
definition and read the data correctly. Currently only the DIE offset and 
type flags are supported. This is needed for adding type flags to the 
.apple_types hash accelerator tables.

Fixed a assertion crash that would happen if we have a variable that had a
DW_AT_const_value instead of a location where "location.LocationContains_DW_OP_addr()"
would end up asserting when it tried to parse the variable location as a
DWARF opcode list.

Decreased the amount of memory that LLDB would use when evaluating an expression
by 3x - 4x for clang. There was a place in the namespace lookup code that was
parsing all namespaces with a certain name in a DWARF file instead of stopping
when it found the first match. This was causing all of the compile units with
a matching namespace to get parsed into memory and causing unnecessary memory
bloat. 

Improved "Target::EvaluateExpression(...)" to not try and find a variable
when the expression contains characters that would certainly cause an expression
to need to be evaluated by the debugger. 

llvm-svn: 146130
2011-12-08 02:13:16 +00:00
Sean Callanan 6c62c83c12 Removed function information from the symbol table
for now to fix testcases.  Once we have a valid use
for the function information (i.e., once properties
returning UnknownAnyTy are allowed, once we read
return type information from the runtime, among
other uses) I will re-enable this.

llvm-svn: 146129
2011-12-08 02:08:40 +00:00
Jason Molenda a86588c4b0 Expose the DNBArchMachARM::DBG typedef, specify the type with the
class scoping in DumpDBGState()'s definiton.

llvm-svn: 146128
2011-12-08 01:59:17 +00:00
Greg Clayton 161f367047 Don't crash due to not checking log shared pointer.
llvm-svn: 146126
2011-12-08 01:32:28 +00:00
Sean Callanan 610baf42ce Fixed a few details of method lookup in Objective-C
symbols.  Now we find the correct method.

Unfortunately we don't get the superclass from the
runtime yet so the method doesn't import correctly
(and I added a check to make sure that doesn't hurt
us) but once we get that information right we will
report methods correctly to the parser as well.

Getting superclass information requires a common AST
context for all Objective-C runtime information,
meaning that the superclass and the subclass are in
the same AST context in all cases.  That is the next
thing that needs to be done here.

llvm-svn: 146089
2011-12-07 22:39:39 +00:00
Eli Friedman 00fda923b6 Fix <title> on webpage.
llvm-svn: 146085
2011-12-07 22:09:43 +00:00
Sean Callanan ae6d614118 Fixed a potential crasher if the frame is not
avalable when a global variable is looked up.
In ClangExpressionDeclMap, a frame should usually
be available.

llvm-svn: 146066
2011-12-07 20:41:47 +00:00
Jim Ingham b35274095c Fix assert string to be more informative.
llvm-svn: 146061
2011-12-07 20:10:58 +00:00
Johnny Chen 1669f67776 Modified the script to have the flexibility of specifying the gdb executable path
for use in the benchmark against lldb's disassembly speed.  Note that the lldb
executable path can already be specified using the LLDB_EXEC env variable.

rdar://problem/7511194

llvm-svn: 146050
2011-12-07 19:27:06 +00:00
Jason Molenda 42bb552c7e Use the shorter form of the LLDB framework binary path.
llvm-svn: 145982
2011-12-06 22:48:52 +00:00
Johnny Chen 5700922945 Add a typedef for arm_debug_state_t as DBG. Plus some minor comment changes.
llvm-svn: 145978
2011-12-06 22:19:09 +00:00
Greg Clayton 09c3e3d7f5 <rdar://problem/10487848>
Protect a member variable from being modified by multiple threads.

llvm-svn: 145920
2011-12-06 04:51:14 +00:00
Jason Molenda 5e2192adb5 Skip over lldb-93.
llvm-svn: 145917
2011-12-06 04:21:20 +00:00
Sean Callanan 0eed0d42a0 As part of the work to make Objective-C type information
from symbols more accessible, I have added a second
map to the ClangASTImporter: the ObjCInterfaceMetaMap.
This map keeps track of all type definitions found for
a particular Objective-C interface, allowing the
ClangASTSource to refer to all possible sources when
looking for method definitions.

There is a bug in lookup that I still need to figure out,
but after that we should be able to report full method
information for Objective-C classes shown in symbols.

Also fixed some errors I ran into when enabling the maps
for the persistent type store.  The persistent type store
previously did not use the ClangASTImporter to import
types, instead using ASTImporters that got allocated each
time a type needed copying.  To support the requirements
of the persistent type store -- namely, that types must be
copied, completed, and then completely severed from their
origin in the parser's AST context (which will go away) --
I added a new function called DeportType which severs all
these connections.

llvm-svn: 145914
2011-12-06 03:41:14 +00:00
Sean Callanan 853604d596 Set a flag on the AST type dump to see Objective-C
methods.  The Clang dump is now much more verbose,
but when somebody types "target modules lookup -t"
that is typically what they're looking for.

llvm-svn: 145892
2011-12-06 01:44:41 +00:00
Jim Ingham 7d1c115d2e Correct typo in method name (AddSymbolFileRepresendation...)
llvm-svn: 145884
2011-12-06 01:07:22 +00:00
Jim Ingham ac01260545 Sanity check the inputs to SBCommandInterpreter::HandleCompletion
llvm-svn: 145840
2011-12-05 19:24:15 +00:00
Sean Callanan 458bba71be Because we now call StartTagDeclarationDefinition()
and CompleteTagDeclarationDefinition() on Objective-C
interfaces populated by SymbolFileSymtab::FindTypes(),
we should mark the interface as forward-declared when
we create it.

llvm-svn: 145825
2011-12-05 18:49:06 +00:00
Greg Clayton 2a4c2f7998 Bumped Xcode project version for lldb-92.
llvm-svn: 145814
2011-12-05 17:41:20 +00:00
Greg Clayton 3649ef008d Fixed the remaining test suite failures after the recent objective C cleanup
and fixes we did. Now that objective C classes are represented by symbols with
their own type, there were a few more places in the objective C code that needed
to be fixed when searching for dynamic types.

Cleaned up the objective C runtime plug-in a bit to not keep having to create
constant strings and make one less memory access when we find an "isa" in the
objective C cache.

llvm-svn: 145799
2011-12-05 06:07:35 +00:00
Greg Clayton 1075acafeb Added the ability for clients to grab a set of symbol table indexes and then
add them to a fast lookup map. lldb_private::Symtab now export the following
public typedefs:

namespace lldb_private {

	class Symtab {
		typedef std::vector<uint32_t> IndexCollection;
		typedef UniqueCStringMap<uint32_t> NameToIndexMap;
	};
}

Clients can then find symbols by name and or type and end up with a 
Symtab::IndexCollection that is filled with indexes. These indexes can then
be put into a name to index lookup map and control if the mangled and 
demangled names get added to the map:

bool add_demangled = true;
bool add_mangled = true;
Symtab::NameToIndexMap name_to_index;
symtab->AppendSymbolNamesToMap (indexes, add_demangled, add_mangled, name_to_index).

This can be repeated as many times as needed to get a lookup table that
you are happy with, and then this can be sorted:

name_to_index.Sort();

Now name lookups can be done using a subset of the symbols you extracted from
the symbol table. This is currently being used to extract objective C types
from object files when there is no debug info in SymbolFileSymtab.

Cleaned up how the objective C types were being vended to be more efficient
and fixed some errors in the regular expression that was being used.

llvm-svn: 145777
2011-12-03 20:02:42 +00:00
Greg Clayton 901c5ca15b Added code to make sure we don't recursively try to find an objective C
class. The thing with Objective C classes is the debug info might have a
definition that isn't just a forward decl, but it is incomplete. So we need to
look and see if we can find the complete definition and avoid recursing a lot
due to the fact that our accelerator tables will have many versions of the 
type, but only one complete one. We might not also have the complete type
and we need to deal with this correctly.

llvm-svn: 145759
2011-12-03 04:40:03 +00:00
Sean Callanan bfaf54d665 Testcase fixes with the new symbol lookup code for
Objective-C, making symbol lookups for various raw
Objective-C symbols work correctly.  The IR interpreter
makes these lookups because Clang has emitted raw
symbol references for ivars and classes.

Also improved performance in SymbolFiles, caching the
result of asking for SymbolFile abilities.

llvm-svn: 145758
2011-12-03 04:38:43 +00:00
Greg Clayton dfb6dc9187 Added a code for a test to find the real Objective C class definition. I
still need to write the test case file.

llvm-svn: 145756
2011-12-03 04:35:51 +00:00
Sean Callanan 3b107b172d Added ClangExternalASTSourceCommon, a local superclass
for all our external AST sources that lets us associate
arbitrary flags with the types we put into the AST
contexts.  Also added an API on ClangASTContext that
allows access to these flags given only an ASTContext
and a type.

Because we don't have access to RTTI, and because at
some point in the future we might encounter external
AST sources that we didn't make (so they don't subclass
ClangExternalASTSourceCommon) I added a magic number
that we check before doing anything else, so that we
can catch that problem as soon as it appears.

llvm-svn: 145748
2011-12-03 03:15:28 +00:00
Greg Clayton ef3ad87ac6 Remove accidental "else" that was left in in prior checking.
llvm-svn: 145746
2011-12-03 03:02:17 +00:00
Greg Clayton 456809c161 Added new symbol types for Objective C classes, metaclasses, and ivars. Each
object file can correctly make these symbols which will abstract us from the
file format and ABI and we can then ask for the objective C class symbol for
a class and find out which object file it was defined in.

llvm-svn: 145744
2011-12-03 02:30:59 +00:00
Jim Ingham 25f6670003 Make the ThreadPlanStepThrough set a backstop breakpoint on the return address from
the function it is being asked to step through, so that even if we get the trampoline
target wrong (for instance) we will still not lose control.

The other fix here is to tighten up the handling of the case where the current plan
doesn't explain the stop, but a plan above us does.  In that case, if the plan that
does explain the stop says it is done, we need to clean up the plans below it and 
continue on with our processing.

llvm-svn: 145740
2011-12-03 01:52:59 +00:00
Greg Clayton c91d804af9 Fixed some extra warnings that show up with the new clang.
llvm-svn: 145735
2011-12-03 00:46:21 +00:00
Greg Clayton 934cb05e40 <rdar://problem/10522194>
Fixed an issue where if we have the DWARF equivalent of:

struct foo;

class foo { ... };

Or vice versa, we wouldn't be able to find the complete type. Since many
compilers allow forward declarations to have struct and definitions to have
class, we need to be able to deal with both cases. This commit fixes this in
the DWARF parser.

llvm-svn: 145733
2011-12-03 00:27:05 +00:00
Johnny Chen 5daa6de433 Let's also record the compiler version used for compiling the inferior into the session info
llvm-svn: 145732
2011-12-03 00:16:59 +00:00
Greg Clayton 4c3b8fb7e6 <rdar://problem/10410131>
Fixed an issue that could cause an infinite recursion when using "type filter".

llvm-svn: 145720
2011-12-02 22:48:25 +00:00
Sean Callanan 3ed3bca38e Modified the Objective-C type map in SymbolFileSymtab
to use ConstStrings.  The const char*s were assumed to
be from ConstStrings before, but since storing a full-on
ConstString is no more expensive than storing a const
char* it makes better sense to enforce uniqueness with
the type checker.

llvm-svn: 145688
2011-12-02 18:06:45 +00:00
Sean Callanan 596ab8ee08 Added support for extracting method information from
Objective-C symbols.  The methods aren't used yet if
there is a competing definition in the DWARF; I will
resolve that next.

llvm-svn: 145675
2011-12-02 03:41:39 +00:00
Greg Clayton 1ba6cfd1e6 After moving lldb::pid_t to 64 bits, keep a deprecated version around for
previous binaries that link against this for a few builds to make sure we
can continue to run against previous binaries.

llvm-svn: 145668
2011-12-02 02:10:57 +00:00
Greg Clayton e04741d03a <rdar://problem/10394517>
Fixed templates with NonTypeTemplateParmDecl objects. For example:

template <unsigned N>
....

This fixes SmallVector and all of the other classes that have template params
that are non types.

llvm-svn: 145667
2011-12-02 02:09:28 +00:00
Jim Ingham 6d6d107167 "f" should be an alias for "frame select" not "finish" to match the gdb usage.
llvm-svn: 145660
2011-12-02 01:12:59 +00:00
Greg Clayton 61e7a58c0c Process IDs (lldb::pid_t) and thread IDs (lldb::tid_t) are now 64 bit. This
will allow us to represent a process/thread ID using a pointer for the OS
plug-ins where they might want to represent the process or thread ID using
the address of the process or thread structure.

llvm-svn: 145644
2011-12-01 23:28:38 +00:00
Sean Callanan e0a64f7302 Modified clients of ClangASTImporter to be more robust
in the face of failures to import types, since blithely
passing on NULL types can sometimes lead to trouble.

Also eliminated a use of getAs and replaced it with
dyn_cast, which is more robust.

llvm-svn: 145628
2011-12-01 21:04:37 +00:00
Jim Ingham 87c665fb8d Protect a few log->Printf calls with "if (log)"...
llvm-svn: 145625
2011-12-01 20:26:15 +00:00
Sean Callanan a5230ce303 Picked up a new revision of Clang to pull in Objective-C
enhancements.  With these enhancements, the return values
of Objective-C methods with unknown return types can be
implicitly cast to id for the purpose of making method
calls.

So what would have required this:

(int)[(id)[ClassWithNoDebugInfo methodReturningObject] methodReturningInt]

can now be written as:

(int)[[ClassWithNoDebugInfo methodReturningObject] methodReturningInt]

llvm-svn: 145567
2011-12-01 04:31:46 +00:00
Greg Clayton eaeaf6f906 <rdar://problem/10507811>
Avoid a crash for the new DW_OP_stack_value and DW_OP_implicit_value opcodes
that was due to an assertion.

llvm-svn: 145564
2011-12-01 04:06:15 +00:00
Greg Clayton b1a0292240 Bumping Xcode project version for lldb-91.
llvm-svn: 145561
2011-12-01 03:52:18 +00:00
Jim Ingham f220d59399 If we are going to assert due to an unhanded opcode, stuff the opcode value into the CrashReporter string first.
llvm-svn: 145558
2011-12-01 03:01:30 +00:00
Sean Callanan 947ccc7396 Made symbol lookup in the expression parser more
robust:

- Now a client can specify what kind of symbols
  are needed; notably, this allows looking up
  Objective-C class symbols specifically.

- In the class of symbols being looked up, if
  one is non-NULL and others are NULL, LLDB now
  prefers the non-NULL one.

llvm-svn: 145554
2011-12-01 02:04:16 +00:00
Johnny Chen 60e2c6aa43 rdar://problem/10501020
ClangASTSource::~ClangASTSource() was calling

    ClangASTContext *scratch_clang_ast_context = m_target->GetScratchClangASTContext();

which had the side effect of deleting this very ClangASTSource instance.  Not good.
Change it to

    // We are in the process of destruction, don't create clang ast context on demand
    // by passing false to Target::GetScratchClangASTContext(create_on_demand).
    ClangASTContext *scratch_clang_ast_context = m_target->GetScratchClangASTContext(false);

The Target::GetScratchClangASTContext(bool create_on_demand=true) has a new signature.

llvm-svn: 145537
2011-11-30 23:18:53 +00:00
Greg Clayton e54399dbdf Bumped Xcode project versions for lldb-90 and debugserver-154
llvm-svn: 145528
2011-11-30 22:18:41 +00:00
Sean Callanan 09ab4b777c Added support to the Objective-C language runtime
to find Objective-C class types by looking in the
symbol tables for the individual object files.

I did this as follows:

- I added code to SymbolFileSymtab that vends
  Clang types for symbols matching the pattern
  "_OBJC_CLASS_$_NSMyClassName," making them
  appear as Objective-C classes.  This only occurs
  in modules that do not have debug information,
  since otherwise SymbolFileDWARF would be in
  charge of looking up types.

- I made a new SymbolVendor subclass for the
  Apple Objective-C runtime that is in charge of
  making global lookups of Objective-C types.  It
  currently just sends out type lookup requests to
  the appropriate SymbolFiles, but in the future we
  will probably extend it to query the runtime more
  completely.

I also modified a testcase whose behavior is changed
by the fact that we now actually return an Objective-C
type for __NSCFString.

llvm-svn: 145526
2011-11-30 22:11:59 +00:00
Johnny Chen 442b57c64d Add processing of '-help' option.
llvm-svn: 145516
2011-11-30 19:46:37 +00:00
Greg Clayton 1bba2bedde Make sure that we print out function or symbol information. If we disassembled
a symbol, were weren't showing the "<module>`<symbol>" header.

llvm-svn: 145511
2011-11-30 19:36:42 +00:00
Johnny Chen d0cff1ea9b I broke the test suite (4 failures) with r145459 check-in.
Fix the breakage by properly setting the result status before returning.

llvm-svn: 145507
2011-11-30 19:09:20 +00:00
Jim Ingham 5a14c543c7 Turn off the resolver detection till we find a better method to do so.
llvm-svn: 145472
2011-11-30 03:15:08 +00:00
Greg Clayton 3a5f29a073 Add a work around to deal with incorrect forward class definitions in
objective C DWARF emitted by clang.

llvm-svn: 145471
2011-11-30 02:48:28 +00:00
Johnny Chen 99bb50c10d rdar://problem/9211445
Fix wrong test logic in test_modules_search_paths().  Add additional exercising of 'target modules search-paths list/query".
There is a reproducible crash if 'target modules search-paths clear' is exercised during test teardown.
So we currently comment out the stmt as follows:

        # Add teardown hook to clear image-search-paths after the test.
        # rdar://problem/10501020
        # Uncomment the following to reproduce 10501020.
        #self.addTearDownHook(lambda: self.runCmd("target modules search-paths clear"))

llvm-svn: 145466
2011-11-30 01:33:59 +00:00
Johnny Chen faa5c13d8f Remove possible cut-and-paste code which doesn't belong.
llvm-svn: 145459
2011-11-29 23:56:14 +00:00
Greg Clayton 187748456a <rdar://problem/10500242>
Find the one true objective C type definition if there is one within a module.

llvm-svn: 145457
2011-11-29 23:40:34 +00:00
Sean Callanan 8b9ccfe270 Added #ifdef wrappers around the contents of
ASTDumper.h.

llvm-svn: 145446
2011-11-29 22:47:44 +00:00
Sean Callanan 0712f46f4f Modified ClangExpressionDeclMap to use existing
ValueObjects when creating variables referring to
live data rather than constructing
ValueObjectConstResults.

llvm-svn: 145437
2011-11-29 22:03:21 +00:00
Jim Ingham 9c97844404 Missing return in error handling for "source list".
llvm-svn: 145435
2011-11-29 21:21:26 +00:00
Jim Ingham e309e75d5a Typo in error string.
llvm-svn: 145434
2011-11-29 21:16:36 +00:00
Greg Clayton 28041352cb Patch from Dawn that fixes up linux debugging and a first passs at an
implementation of the linux platform.

llvm-svn: 145433
2011-11-29 20:50:10 +00:00
Johnny Chen 9db304ac7a Add bench entries.
llvm-svn: 145417
2011-11-29 19:13:38 +00:00
Greg Clayton ad9e828c89 <rdar://problem/10429064>
Fixed an issue where if we are debugging on a remote platform and set a
platform path for our executable, it was not being honored by the new
launch functions that used the ProcessLaunchInfo.

llvm-svn: 145371
2011-11-29 04:03:30 +00:00
Greg Clayton bda72b83f4 I added more complete documentation on all of the new packets we use in LLDB
as well as attached a new priority description as to why and when you would
want to implement each packet.

Also documented the additions we have made to the stop reply packet and why
the extra information is necessary.

llvm-svn: 145357
2011-11-29 01:44:07 +00:00
Johnny Chen 62212f0e62 Patch from Daniel Dunbar for future-proof against http://llvm.org/viewvc/llvm-project?view=rev&revision=145331.
llvm-svn: 145345
2011-11-29 01:09:49 +00:00
Sean Callanan 9973231fb0 Changed ClangASTImporter to allow finer-grained
management of what allocations remain after an
expression finishes executing.  This saves around
2.5KiB per expression for simple expressions.

llvm-svn: 145342
2011-11-29 00:42:02 +00:00
Greg Clayton 1167c4e379 Added some documentation on the new GDB remote packets we have added and use
in LLDB.

llvm-svn: 145314
2011-11-28 23:30:42 +00:00
Johnny Chen 49cb85db64 SBProcess.PutSTDIN() needs to be properly typemapped when swigging,
so that we can do Python scripting like this:

        target = self.dbg.CreateTarget(self.exe)

        self.dbg.SetAsync(True)
        process = target.LaunchSimple(None, None, os.getcwd())

        process.PutSTDIN("Line 1 Entered.\n")
        process.PutSTDIN("Line 2 Entered.\n")
        process.PutSTDIN("Line 3 Entered.\n")

Add TestProcessIO.py to exercise the process IO API: PutSTDIN()/GetSTDOUT()/GetSTDERR().

llvm-svn: 145282
2011-11-28 21:39:07 +00:00
Johnny Chen d80e5e9dd8 Clarify the SBProcess Python API GetSTDOUT()/GetSTDERR(). They look different from
the C++ API due to swig typemapping.

llvm-svn: 145260
2011-11-28 19:12:25 +00:00
Greg Clayton 129d12c00c <rdar://problem/10413589>
Fixed a potential crasher where we weren't checking we got a valid DIE in
a compile unit.

llvm-svn: 145226
2011-11-28 03:29:03 +00:00
Greg Clayton cbe1a331ae Fixed an issue where we might cause our test suite to exit if we end up
concatenating a string with "None" in python. Using a python format string
gets us around this by handling it gracefully.

llvm-svn: 145225
2011-11-28 03:17:13 +00:00
Greg Clayton cc23eb6fbf Now the linux platform lets it be known that it can't launch processes for
debugging.

llvm-svn: 145221
2011-11-28 01:47:46 +00:00
Greg Clayton c982b3d6e6 CommandObjectProcess was recently changed to automatically use the platform
to launch a process for debugging. Since this isn't supported on all platforms,
we need to do what we used to do if this isn't supported. I added:

    bool
    Platform::CanDebugProcess ();
    
This will get checked before trying to launch a process for debugging and then
fall back to launching the process through the current host debugger. This
should solve the issue for linux and keep the platform code clean.

Centralized logging code for logging errors, warnings and logs when reporting
things for modules or symbol files. Both lldb_private::Module and 
lldb_private::SymbolFile now have the following member functions:

    void                    
    LogMessage (Log *log, const char *format, ...);

    void
    ReportWarning (const char *format, ...);

    void
    ReportError (const char *format, ...);

These will all output the module name and object (if any) such as:

    "error: lldb.so ...."
    "warning: my_archive.a(foo.o) ...."
    
This will keep the output consistent and stop a lot of logging calls from 
having to try and output all of the information that uniquely identifies
a module or symbol file. Many places in the code were grabbing the path to the
object file manually and if the module represented a .o file in an archive, we
would see log messages like:

    error: foo.a - some error happened

llvm-svn: 145219
2011-11-28 01:45:00 +00:00
Greg Clayton 1abfe04d79 Fixed an issue in the DWARFLocationList::Dump() function where default
arguments were quietly masked as the code changed (modified version of a path
from Dawn).

llvm-svn: 145216
2011-11-28 00:51:27 +00:00
Greg Clayton 5bd374d48e Remove incorrect return type from SetHeaderDataByteSize accessor (partial
patch from Dawn).

llvm-svn: 145212
2011-11-28 00:42:24 +00:00
Greg Clayton 1959df2c9c Shrink-to-fit our std::vector<DWARFDebugInfoEntry> collections and save 20%
to 30% of memory. The size doubling was killing us and we ended up with up to
just under 50% of empty capacity. Cleaning this up saves us a ton of memory.

llvm-svn: 145086
2011-11-22 21:35:27 +00:00
Greg Clayton 01575f86aa Got the sizeof(lldb_private::Symbol) down to 64 bytes (from 72 bytes) by not
having the enumeration take up 32 bits for the type and by putting it into the
bitfields that were already being used.

llvm-svn: 145084
2011-11-22 21:20:33 +00:00
Greg Clayton ddfda81ab8 12% allocated memory savings when debugging clang with DWARF in .o files by
making sure we perfectly size our vector of symbols on the symbol table.

llvm-svn: 145069
2011-11-22 18:47:24 +00:00
Greg Clayton 8388955fd9 <rdar://problem/10033754>
Fixed an issue with the options for memory read where --count couldn't be used
with the --binary option when writing data to a file.

Also removed the GDB format option from the --binary version of memory read.

llvm-svn: 145067
2011-11-22 18:07:35 +00:00
Greg Clayton 162b597c4c Save the arguments for a process launch in the target.run-args so they can
easily be used in the next run.

llvm-svn: 145051
2011-11-21 21:51:18 +00:00
Greg Clayton e372b98d18 Many GDB users always want to display disassembly when they stop by using
something like "display/4i $pc" (or something like this). With LLDB we already
were showing 3 lines of source before and 3 lines of source after the current
source line when showing a stop context. We now improve this by allowing the
user to control the number of lines with the new "stop-line-count-before" and
"stop-line-count-after" settings. Also, there is a new setting for how many
disassembly lines to show: "stop-disassembly-count". This will control how many
source lines are shown when there is no source or when we have no source line
info. 

settings set stop-line-count-before 3
settings set stop-line-count-after 3
settings set stop-disassembly-count 4
settings set stop-disassembly-display no-source

The default values are set as shown above and allow 3 lines of source before 
and after (what we used to do) the current stop location, and will display 4 
lines of disassembly if the source is not available or if we have no debug
info. If both "stop-source-context-before" and "stop-source-context-after" are
set to zero, this will disable showing any source when stopped. The 
"stop-disassembly-display" setting is an enumeration that allows you to control
when to display disassembly. It has 3 possible values:

"never" - never show disassembly no matter what
"no-source" - only show disassembly when there is no source line info or the source files are missing
"always" - always show disassembly.

llvm-svn: 145050
2011-11-21 21:44:34 +00:00
Peter Collingbourne 2c67b9a69a Update ProcessMonitor::MonitorCallback signature.
llvm-svn: 145021
2011-11-21 00:10:19 +00:00
Peter Collingbourne fb2b629dc0 Update PlatformLinux::Attach signature.
llvm-svn: 145020
2011-11-21 00:10:14 +00:00
Sean Callanan 7f27d6044e Pulled in a new revision of LLVM/Clang and added
several patches.  These patches fix a problem
where templated types were not being completed the
first time they were used, and fix a variety of
minor issues I discovered while fixing that problem.

One of the previous local patches was resolved in
the most recent Clang, so I removed it.  The others
will be removed in due course.

llvm-svn: 144984
2011-11-19 02:54:21 +00:00
Greg Clayton 3b608422e8 Further performance improvements in the DWARF parser:
1 - the DIE collections no longer have the NULL tags which saves up to 25%
    of the memory on typical C++ code
2 - faster parsing by not having to run the SetDIERelations() function anymore
    it is done when parsing the DWARF very efficiently.

llvm-svn: 144983
2011-11-19 02:11:30 +00:00
Sean Callanan b5c796215d Ensure that the empty RecordDecl generated for
templates is properly complete (though still
empty).

llvm-svn: 144982
2011-11-19 01:35:08 +00:00
Jim Ingham 9683ff1211 Handle stepping through a trampoline where the jump target is calculated a runtime - and so doesn't match
the name of the PLT entry.  This solution assumes a naming convention agreed upon by us and the system folks,
and isn't general.  The general solution requires actually finding & calling the resolver function if it
hasn't been called yet.  That's more tricky.

llvm-svn: 144981
2011-11-19 00:19:25 +00:00
Greg Clayton 46fb558df1 Added optional calls to lldb_private::Process for getting memory region info
from a process and hooked it up to the new packet that was recently added
to our GDB remote executable named debugserver. Now Process has the following
new calls:

virtual Error
Process::GetMemoryRegionInfo (lldb::addr_t load_addr, MemoryRegionInfo &range_info);

virtual uint32_t
GetLoadAddressPermissions (lldb::addr_t load_addr);

Only the first one needs to be implemented by subclasses that can add this
support.

Cleaned up the way the new packet was implemented in debugserver to be more
useful as an API inside debugserver. Also found an error where finding a region
for an address actually will pick up the next region that follows the address
in the query so we also need ot make sure that the address we requested the
region for falls into the region that gets returned.

llvm-svn: 144976
2011-11-18 07:03:08 +00:00
Greg Clayton 7ba18027e9 Looking at our memory usage with Instruments when debugging a large application
we say that the vectors of DWARFDebugInfoEntry objects were the highest on the
the list. 

With these changes we cut our memory usage by 40%!!! I did this by reducing
the size of the DWARFDebugInfoEntry from a previous:

uint32_t offset
uint32_t parent_idx
uint32_t sibling_idx
Abbrev * abbrev_ptr

which was 20 bytes, but rounded up to 24 bytes due to alignment. Now we have:

uint32_t offset
uint32_t parent_idx
uint32_t sibling_idx
uint32_t abbr_idx:15,       // 32767 possible abbreviation codes
         has_children:1,    // 0 = no children, 1 = has children
         tag:16;            // DW_TAG_XXX value

This gets us down to 16 bytes per DIE. I tested some VERY large DWARF files
(900MB) and found there were only ~700 unique abbreviations, so 32767 should
be enough for any sane compiler. If it isn't there are built in assertions
that will fire off and tell us.

llvm-svn: 144975
2011-11-18 04:43:59 +00:00
Sean Callanan 00f43622e1 This commit completes the rearchitecting of ClangASTSource
to allow variables in the persistent variable store to know
how to complete themselves from debug information.  That
fixes a variety of bugs during dematerialization of 
expression results and also makes persistent variable and
result variables ($foo, $4, ...) more useful.

I have also added logging improvements that make it much
easier to figure out how types are moving from place to 
place, and made some checking a little more aggressive.

The commit includes patches to Clang which are currently being
integrated into Clang proper; once these fixes are in Clang
top-of-tree, these patches will be removed.  The patches don't
fix API; rather, they fix some internal bugs in Clang's 
ASTImporter that were exposed when LLDB was moving types from
place to place multiple times.

llvm-svn: 144969
2011-11-18 03:28:09 +00:00
Johnny Chen 5d77667f28 Redirect the stderr output into a file so as to not pollute the terminal.
llvm-svn: 144958
2011-11-18 00:58:29 +00:00
Johnny Chen 6949f38985 Do not print debug messages if self.TraceON() is False.
llvm-svn: 144945
2011-11-18 00:30:58 +00:00
Johnny Chen 316651ab21 Add a simple progress bar when neither '-v' nor '-t' is specified.
llvm-svn: 144940
2011-11-18 00:19:29 +00:00
Greg Clayton ee95ed5055 Use a pseudoterminal for local processes if no STDIO redirection or other
file actions have been specified.

llvm-svn: 144922
2011-11-17 22:14:31 +00:00
Johnny Chen 0fddfb2ceb Add an option '-S' to skip the build and cleanup while running the test.
Use this option with care as you would need to build the inferior(s) by hand
and build the executable(s) with the correct name(s).  This option can be used
with '-# n' to stress test certain test cases for n number of times.

An example:

[11:55:11] johnny:/Volumes/data/lldb/svn/trunk/test/python_api/value $ ls
Makefile		TestValueAPI.pyc	linked_list
TestValueAPI.py		change_values		main.c
[11:55:14] johnny:/Volumes/data/lldb/svn/trunk/test/python_api/value $ make EXE=test_with_dsym
clang -gdwarf-2 -O0  -arch x86_64   -c -o main.o main.c
clang -gdwarf-2 -O0  -arch x86_64   main.o -o "test_with_dsym"
/usr/bin/dsymutil  -o "test_with_dsym.dSYM" "test_with_dsym"
[11:55:20] johnny:/Volumes/data/lldb/svn/trunk/test/python_api/value $ cd ../..
[11:55:24] johnny:/Volumes/data/lldb/svn/trunk/test $ ./dotest.py -v -# 10 -S -f ValueAPITestCase.test_with_dsym
LLDB build dir: /Volumes/data/lldb/svn/trunk/build/Debug
LLDB-89
Path: /Volumes/data/lldb/svn/trunk
URL: https://johnny@llvm.org/svn/llvm-project/lldb/trunk
Repository Root: https://johnny@llvm.org/svn/llvm-project
Repository UUID: 91177308-0d34-0410-b5e6-96231b3b80d8
Revision: 144914
Node Kind: directory
Schedule: normal
Last Changed Author: gclayton
Last Changed Rev: 144911
Last Changed Date: 2011-11-17 09:22:31 -0800 (Thu, 17 Nov 2011)



Session logs for test failures/errors/unexpected successes will go into directory '2011-11-17-11_55_29'
Command invoked: python ./dotest.py -v -# 10 -S -f ValueAPITestCase.test_with_dsym
----------------------------------------------------------------------
Collected 1 test

1: test_with_dsym (TestValueAPI.ValueAPITestCase)
   Exercise some SBValue APIs. ... ok

----------------------------------------------------------------------
Ran 1 test in 1.163s

OK
1: test_with_dsym (TestValueAPI.ValueAPITestCase)
   Exercise some SBValue APIs. ... ok

----------------------------------------------------------------------
Ran 1 test in 0.200s

OK
1: test_with_dsym (TestValueAPI.ValueAPITestCase)
   Exercise some SBValue APIs. ... ok

----------------------------------------------------------------------
Ran 1 test in 0.198s

OK
1: test_with_dsym (TestValueAPI.ValueAPITestCase)
   Exercise some SBValue APIs. ... ok

----------------------------------------------------------------------
Ran 1 test in 0.199s

OK
1: test_with_dsym (TestValueAPI.ValueAPITestCase)
   Exercise some SBValue APIs. ... ok

----------------------------------------------------------------------
Ran 1 test in 0.239s

OK
1: test_with_dsym (TestValueAPI.ValueAPITestCase)
   Exercise some SBValue APIs. ... ok

----------------------------------------------------------------------
Ran 1 test in 1.215s

OK
1: test_with_dsym (TestValueAPI.ValueAPITestCase)
   Exercise some SBValue APIs. ... ok

----------------------------------------------------------------------
Ran 1 test in 0.105s

OK
1: test_with_dsym (TestValueAPI.ValueAPITestCase)
   Exercise some SBValue APIs. ... ok

----------------------------------------------------------------------
Ran 1 test in 0.098s

OK
1: test_with_dsym (TestValueAPI.ValueAPITestCase)
   Exercise some SBValue APIs. ... ok

----------------------------------------------------------------------
Ran 1 test in 0.195s

OK
1: test_with_dsym (TestValueAPI.ValueAPITestCase)
   Exercise some SBValue APIs. ... ok

----------------------------------------------------------------------
Ran 1 test in 1.197s

OK
[11:55:34] johnny:/Volumes/data/lldb/svn/trunk/test $ 

llvm-svn: 144919
2011-11-17 19:57:27 +00:00
Greg Clayton 1c4cd07aff Now that I fixed the uninitialized callback problem, I can enable GCD pid
monitoring on darwin in the host layer.

llvm-svn: 144918
2011-11-17 19:41:57 +00:00
Johnny Chen 14c62c8d02 Rename test class appropriately.
llvm-svn: 144915
2011-11-17 18:47:38 +00:00
Greg Clayton f9d851b2ca Bumped Xcode project versions for lldb-89 and debugserver-153.
llvm-svn: 144911
2011-11-17 17:22:31 +00:00
Greg Clayton e24c4acf6c Fixed the issue that was causing our monitor process threads to crash, it
turned out to be unitialized data in the ProcessLaunchInfo default constructor. 
Turning on MallocScribble in the environment helped track this down. 

When we launch and attach using the host layer, we now inform the process that
it shouldn't detach when by calling an accessor.

llvm-svn: 144882
2011-11-17 04:46:02 +00:00
Greg Clayton 2637f82542 Fixed an issue with the pthread_setspecific() where we weren't NULL-ing out
the thread specific data and were destroying the thread specfic data more
than once.

Also added the ability to ask a lldb::StateType if it is stopped with an
additional paramter of "must_exist" which means that the state must be a
stopped state for a process that still exists. This means that eStateExited
and eStateUnloaded will no longer return true if "must_exist" is set to true.

llvm-svn: 144875
2011-11-17 01:23:07 +00:00
Jim Ingham 78d614883f (no commit message)
llvm-svn: 144874
2011-11-17 01:22:00 +00:00
Johnny Chen 8eb14a9500 Docstring clarification.
llvm-svn: 144848
2011-11-16 22:44:28 +00:00
Johnny Chen 0bd8c311cb Also dump the pid of the process launching through the lldbtest.system(*popenargs, **kwargs) API.
This helps track down possible zombie processes.

llvm-svn: 144846
2011-11-16 22:41:53 +00:00
Sean Callanan b0b87a5617 Added support to the ASTImporter for passing
completion information between different AST
contexts.  It works like this:

- If a Decl is imported from a context that
  has completion metadata, then that Decl
  is associated with the same completion
  information (possibly none) as the Decl
  it was imported from.

- If a Decl is imported from a context that
  does not have completion metadata, then it
  is marked as completable by consulting the
  Decl and context it was imported from.

llvm-svn: 144838
2011-11-16 22:23:28 +00:00
Sean Callanan f487bd877f Changed the ClangASTImporter to store metadata
for each AST context it knows about in a single
object.  This makes it faster to look up the
appropriate ASTImpoter for a given ASTContext
pair and also makes it much easier to delete all
metadata for a given AST context.

In the future, this fix will allow the
ClangASTImporter to propagate completion
information between the metadata for different
AST contexts as its minions move AST objects
around.

llvm-svn: 144835
2011-11-16 21:40:57 +00:00
Sean Callanan 80f7867b51 Added a CopyType method to the ASTImporter that
handles opaque QualTypes.

llvm-svn: 144813
2011-11-16 19:07:39 +00:00
Johnny Chen 5faba0cc06 Remove invalid docstring (due to cut-and-paste error).
llvm-svn: 144807
2011-11-16 18:48:48 +00:00
Sean Callanan 686b2319e5 I made the ClangASTImporter owned by the target
rather than individually on behalf of each
ASTContext.  This allows the ASTImporter to know
about all containers of types, which will let it
be smarter about forwarding information about
type origins.  That means that the following
sequence of steps will be possible (after a few
more changes):

- Import a type from a Module's ASTContext into
  an expression parser ASTContext, tracking its
  origin information -- this works now.

- Because the result of the expression uses that
  type, import it from the expression parser
  ASTContext into the Target's scratch AST
  context, forwarding the origin information --
  this needs to be added.

- For a later expression that uses the result,
  import the type from the Target's scratch AST
  context, still forwarding origin information
  -- this also needs to be added.

- Use the intact origin information to complete
  the type as needed -- this works now if the
  origin information is present.

To this end, I made the following changes:

- ASTImporter top-level copy functions now
  require both a source and a destination AST
  context parameter.

- The ASTImporter now knows how to purge
  records related to an ASTContext that is
  going away.

- The Target now owns and creates the ASTImporter
  whenever the main executable changes or (in the
  absence of a main executable) on demand.

llvm-svn: 144802
2011-11-16 18:20:47 +00:00
Greg Clayton e4e45924d7 Made the darwin host layer properly reap any child processes that it spawns.
After recent changes we weren't reaping child processes resulting in many
zombie processes. 

This was fixed by adding more settings to the ProcessLaunchOptions class
that allow clients to specify a callback function and baton to be notified
when their process dies. If one is not supplied a default callback will be
used that "does the right thing". 

Cleaned up a race condition in the ProcessGDBRemote class that would attempt
to monitor when debugserver died. 

Added an extra boolean to the process monitor callbacks that indicate if a
process exited or not. If your process exited with a zero exit status and no
signal, both items could be zero.

Modified the process monitor functions to not require a callback function
in order to reap the child process.

llvm-svn: 144780
2011-11-16 05:37:56 +00:00
Sean Callanan 6d6acc89ad Fixed a problem where the target didn't use a
NULL-terminated C string to store the contents
of the expression prefix file.  This meant that
expressions, when printing the contents of the
prefix into the expression's text, would
invariably put in bad data after the end of the
expression.

Now, instead, we store the prefix contents in a
std::string, which handles null-termination
correctly.

llvm-svn: 144760
2011-11-16 01:54:57 +00:00
Sean Callanan ed8d58fcc1 Fixed a crash when we merrily went on to try to log
information about a nonexistent function declaration.

llvm-svn: 144744
2011-11-16 00:40:13 +00:00
Sean Callanan a6cbf06d0a Two fixes for Objetive-C methods that return struct
types.  First, I added handling for the memset intrinsic
in the IR, which is used to zero out the returned struct.
Second, I fixed the object-checking instrumentation
to objc_msgSend_stret, and generally tightened up how
the object-checking functions get inserted.

llvm-svn: 144741
2011-11-16 00:20:50 +00:00
Johnny Chen 4c1b096743 While we are at it, verify that 'my_int_ptr' points to 'g_my_int', using the SBTarget.ResolveLoadAddress() to get its SBAddress,
and SBAddress.GetSymbol() to get the corresponding symbol.

llvm-svn: 144728
2011-11-15 23:30:39 +00:00
Johnny Chen f031bb192f Fix objc runtime warnings from the inferior program.
llvm-svn: 144717
2011-11-15 22:42:53 +00:00
Sean Callanan 4bf80d5544 Made Target own a ClangASTSource that will be used
to complete types in the scratch AST context.

llvm-svn: 144712
2011-11-15 22:27:19 +00:00
Sean Callanan 100d74e267 Eliminated a compile warning by removing dyn_cast
where isa is good enough.

llvm-svn: 144704
2011-11-15 21:50:18 +00:00
Sean Callanan b4db660cff Removed the ClangASTImporter pointer from
ClangExpressionDeclMap, which actually uses the
one it inherits from ClangASTSource.

llvm-svn: 144702
2011-11-15 21:49:24 +00:00
Johnny Chen 2341380033 Add test scenario for value.GetChildAtIndex(0) where value is a pointer to a simple type.
llvm-svn: 144697
2011-11-15 21:13:13 +00:00
Johnny Chen b057196543 File renaming.
llvm-svn: 144693
2011-11-15 20:36:57 +00:00
Sean Callanan fe5d139b51 Fixed a bug where the variable-resolution code
would occasionally try to resolve the placeholder
variable used for static data allocation.

llvm-svn: 144677
2011-11-15 19:13:54 +00:00
Greg Clayton 2d8d63a927 Bumped Xcode project version for lldb-88 and debugserver-152.
llvm-svn: 144616
2011-11-15 03:56:34 +00:00
Greg Clayton 144f3a9c90 Added a new class to Process.h: ProcessAttachInfo. This class contains enough
info for us to attach by pid, or by name and will also allow us to eventually
do a lot more powerful attaches. If you look at the options for the "platform
process list" command, there are many options which we should be able to
specify. This will allow us to do things like "attach to a process named 'tcsh'
that has a parent process ID of 123", or "attach to a process named 'x' which
has an effective user ID of 345". 

I finished up the --shell implementation so that it can be used without the
--tty option in "process launch". The "--shell" option now can take an 
optional argument which is the path to the shell to use (or a partial name
like "sh" which we will find using the current PATH environment variable).

Modified the Process::Attach to use the new ProcessAttachInfo as the sole
argument and centralized a lot of code that was in the "process attach"
Execute function so that everyone can take advantage of the powerful new
attach functionality.

llvm-svn: 144615
2011-11-15 03:53:30 +00:00
Sean Callanan d5c17edb04 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.

llvm-svn: 144607
2011-11-15 02:11:17 +00:00
Johnny Chen 8bb27b23aa Add bench entries.
llvm-svn: 144584
2011-11-14 23:04:06 +00:00
Greg Clayton 02947e04f6 Speed improvements for ULEB128 reading from James McIlree.
llvm-svn: 144581
2011-11-14 22:56:58 +00:00
Jim Ingham c8b47586bb Confirm should accept both "Y" and "y" in case somebody confuses the "default answer" indicator for a
directive to enter a capital letter.

llvm-svn: 144562
2011-11-14 20:02:01 +00:00
Johnny Chen 6b0a1e3662 Dependency file for dylib source was not being cleaned up.
llvm-svn: 144546
2011-11-14 18:37:49 +00:00
Johnny Chen 9b54724cf7 Add more info on the failure.
llvm-svn: 144545
2011-11-14 18:33:39 +00:00
Sean Callanan 4fb79b790f Fixed Objective-C method lookup for methods with
a single argument.  We assumed that the : was
omitted from the selector name, but actually Clang
adds the : in the one-argument case.

llvm-svn: 144544
2011-11-14 18:29:46 +00:00
Greg Clayton ba174beaa6 Don't build optimized unless we are trying to test inlining.
llvm-svn: 144539
2011-11-14 17:57:30 +00:00
Greg Clayton da7bc7d000 <rdar://problem/10126482>
Fixed an issues with the SBType and SBTypeMember classes:
- Fixed SBType to be able to dump itself from python
- Fixed SBType::GetNumberOfFields() to return the correct value for objective C interfaces
- Fixed SBTypeMember to be able to dump itself from python
- Fixed the SBTypeMember ability to get a field offset in bytes (the value
  being returned was wrong)
- Added the SBTypeMember ability to get a field offset in bits


Cleaned up a lot of the Stream usage in the SB API files.

llvm-svn: 144493
2011-11-13 06:57:31 +00:00
Greg Clayton 93e8619ded <rdar://problem/10103980>
A long time ago we started to centralized the STDOUT in lldb_private::Process
but we missed a few things still in ProcessGDBRemote.

llvm-svn: 144491
2011-11-13 04:45:22 +00:00
Greg Clayton 2fc93eabf7 <rdar://problem/10338439>
This is the actual fix for the above radar where global variables that weren't
initialized were not being shown correctly when leaving the DWARF in the .o 
files. Global variables that aren't intialized have symbols in the .o files
that specify they are undefined and external to the .o file, yet document the
size of the variable. This allows the compiler to emit a single copy, but makes
it harder for our DWARF in .o files with the executable having a debug map
because the symbol for the global in the .o file doesn't exist in a section
that we can assign a fixed up linked address to, and also the DWARF contains
an invalid address in the "DW_OP_addr" location (always zero). This means that
the DWARF is incorrect and actually maps all such global varaibles to the
first file address in the .o file which is usually the first function. So we
can fix this in either of two ways: make a new fake section in the .o file
so that we have a file address in the .o file that we can relink, or fix the 
the variable as it is created in the .o file DWARF parser and actually give it
the file address from the executable. Each variable contains a 
SymbolContextScope, or a single pointer that helps us to recreate where the
variables came from (which module, file, function, etc). This context helps
us to resolve any file addresses that might be in the location description of
the variable by pointing us to which file the file address comes from, so we
can just replace the SymbolContextScope and also fix up the location, which we
would have had to do for the other case as well, and update the file address.
Now globals display correctly.

The above changes made it possible to determine if a variable is a global
or static variable when parsing DWARF. The DWARF emits a DW_TAG_variable tag
for each variable (local, global, or static), yet DWARF provides no way for
us to classify these variables into these categories. We can now detect when
a variable has a simple address expressions as its location and this will help
us classify these correctly.

While making the above changes I also noticed that we had two symbol types:
eSymbolTypeExtern and eSymbolTypeUndefined which mean essentially the same
thing: the symbol is not defined in the current object file. Symbol objects
also have a bit that specifies if a symbol is externally visible, so I got
rid of the eSymbolTypeExtern symbol type and moved all code locations that
used it to use the eSymbolTypeUndefined type.
 

llvm-svn: 144489
2011-11-13 04:15:56 +00:00
Johnny Chen 10d7e4fe59 Make the test case more robust by using line number to break, instead.
llvm-svn: 144450
2011-11-12 02:30:23 +00:00
Greg Clayton c9ed478a39 Added the ability to run a process in a shell on MacOSX currently when using
the --tty option. So you can now get shell expansion and file redirection:

(lldb) process launch --tty --shell -- *.jpg < in.txt > out.txt

Again, the "--tty" is mandatory for now until we hook this up to other 
functions. The shell is also currently hard coded to "/bin/bash" and not the
"SHELL" variable. "/bin/tcsh" was causing problems which I need to dig into.

llvm-svn: 144443
2011-11-12 02:10:56 +00:00
Jim Ingham e3ae82af89 Add code that reads the APPLE_property debug info, and makes up properties from them.
llvm-svn: 144440
2011-11-12 01:36:43 +00:00
Daniel Dunbar 4d32481618 build/Make: Tweak Clang include paths to use LLVM_{SRC,OBJ}_ROOT instead of
level based, so that lldb itself can be a symlink inside the tools dir.

llvm-svn: 144429
2011-11-11 23:36:19 +00:00
Sean Callanan 46198ff824 Updated LLVM/Clang to pull in a fix for Objective-C
interfaces.  This allows us to pull in Objective-C
method types on demand, which is also now implemented.

Also added a minor fix to prevent multiple-definition
errors for "Class" and "id".

llvm-svn: 144405
2011-11-11 20:37:26 +00:00
Sean Callanan b889f8b4b8 Fixed a bug that inhibited symbol lookup. The
problem is that we had a bitfield that kept
track of what had been found so far, and inhibited
searches when the local variable bit was set.
This bitfield was not being initialized correctly.

llvm-svn: 144400
2011-11-11 18:37:32 +00:00
Greg Clayton 95d87908f9 Added report errors for when the .apple_XXXX hashed name table lookups contain
invalid information. This will help us perfect the tables that are emitted by
clang.

llvm-svn: 144359
2011-11-11 03:16:25 +00:00
Greg Clayton b2469060de Allow the Apple hash tables to be emtpy.
llvm-svn: 144353
2011-11-11 01:21:03 +00:00
Jason Molenda ef5f6a2391 Fix order of arguments for target stop-hook list/delete. Having
the argument description in the command name could cause a command
alias to crash, e.g.
command alias zzz target stop-hook delete 1
because the "name" is used to re-fetch the exact CommandObject when
adding the final arg.

<rdar://problem/10423753>

llvm-svn: 144330
2011-11-10 23:03:44 +00:00
Jason Molenda 69c12ccb9f Fix help strings that refer to the "commands" top-level noun.
It's "command", "commands" is not recognized.

llvm-svn: 144327
2011-11-10 22:43:35 +00:00
Greg Clayton 66016fd806 <rdar://problem/9334299>
Added the ability to get a type without qualifiers (const, volatile, restrict, etc).

llvm-svn: 144302
2011-11-10 19:20:52 +00:00
Greg Clayton f49e65ae7c Made the Host::SetCrashDescription(const char *) function copy the incoming
string to avoid possible later crashes.

Modified the locations that do set the crash description to NULL out the 
string when they are done doing their tasks.

llvm-svn: 144297
2011-11-10 18:31:53 +00:00
Greg Clayton 6f4c06069c Fixed the eFormatChar, eFormatCharPrintable and eFormatCharArray to print
things out correctly again.

llvm-svn: 144261
2011-11-10 03:38:56 +00:00
Greg Clayton 16d2320c97 <rdar://problem/10338439>
Fixed an issue where if you had an initialized global variable, we would not
link it up correctly in the debug info if the .o file had the symbols as
UNDF + EXT (undefined external). We now properly link the globals.

llvm-svn: 144259
2011-11-10 03:08:08 +00:00
Greg Clayton dac5efa8c4 Removed debug printf statements.
llvm-svn: 144257
2011-11-10 01:30:05 +00:00
Greg Clayton 8ee6438235 Added the ability for many of the "target modules dump xxx" commands to find
modules first in the target, then fall back to the global shared module
cache, then fall back to the global module list.

llvm-svn: 144256
2011-11-10 01:18:58 +00:00
Jim Ingham f58a048776 Using the wrong type for the break id's (user_id_t is an unsigned int, but internal breakpoints can be negative, and anyway it is a good idea to use break_id_t for breakpoints, no?)
llvm-svn: 144254
2011-11-10 01:12:26 +00:00
Greg Clayton 93c62e6607 <rdar://problem/10374840>
Fixed an issue with the gdb format stuff for any aliases that expand to
contain a "--".

llvm-svn: 144240
2011-11-09 23:25:03 +00:00
Sean Callanan 0730e9c992 Added a function to ClangASTSource to service
lookups for Objective-C methods by selector.
Right now all it does is print log information.

Also improved the logging for imported TagDecls
to indicate whether or not the definition for
the imported TagDecl is complete.

llvm-svn: 144203
2011-11-09 19:33:21 +00:00
Greg Clayton ed3ae7005d Cleanup some warnings.
llvm-svn: 144200
2011-11-09 19:04:58 +00:00
Jim Ingham aea81795a6 "source list -n" should use eFunctionNameTypeAuto not eFunctionNameTypeBase for the name lookup.
llvm-svn: 144199
2011-11-09 19:02:04 +00:00
Jason Molenda 3dc8583c96 Remove the QAddressIsExecutable packet I added last night.
Add a more general purpose qMemoryRegionInfo packet which can
describe various attributes about a memory region.  Currently it
will return the start address, size, and permissions (read, write,
executable) for the memory region.  It may be possible to add
additional attributes in the future such as whether the region is
designated as stack memory or jitted code a la vmmap.

I still haven't implemented the lldb side of the code to use this
packet yet so there may be unexpected behavior - but the basic implementation looks
about right.  I'll hook it up to lldb soon and fix any problems that crop up.

llvm-svn: 144175
2011-11-09 08:03:56 +00:00
Johnny Chen 1738fad337 Add a missing ')' in the comment.
llvm-svn: 144145
2011-11-08 23:08:03 +00:00
Jason Molenda 1f3966bebd Add "QAddressIsExecutable" packet to debugserver. Used to test
whether a given address is in an executable region of memory or
not.  I haven't written the lldb side that will use this packet it
hasn't been tested yet but it's a simple enough bit of code.

I want to have this feature available for the unwinder code.  When
we're stopped at an address with no valid symbol context, there are
a number of questions I'd like to ask --

  is the current pc value in an executable region (e.g. did they
  jump to unallocated/unexecutable memory?  we know how to unwind
  from here if so.)

  Is the stack pointer or the frame pointer the correct register
  to use to find the caller's saved pc value?

Once we're past the first frame we can trust things like eh_frame
and ABI unwind schemes but the first frame is challenging and having
a way to check potential addresses to see if they're executable or
not would help narrow down the possibilities a lot.

llvm-svn: 144074
2011-11-08 04:28:12 +00:00
Jason Molenda e519824641 Bitfields in uint8_t's will have format eFormatChar and DataExtractor::Dump
doesn't handle bitfields in eFormatChar's correctly, only eFormatUnsigned.
Fix DataExtractor::Dump to dump the bitfield eFormatChars correctly.

llvm-svn: 144069
2011-11-08 03:52:17 +00:00
Jim Ingham 0faa43f964 Do a better job of detecting when a breakpoint command has set the target running again (except you have to ignore
cases where the breakpoint runs expressions, those don't count as really "running again").

llvm-svn: 144064
2011-11-08 03:00:11 +00:00
Greg Clayton 1d8859668f Moved many of the "settings" that used to be in "target.process.*" to just
be in the target. All of the environment, args, stdin/out/err files, etc have
all been moved. Also re-enabled the ability to launch a process in a separate
terminal on MacOSX.

llvm-svn: 144061
2011-11-08 02:43:13 +00:00
Greg Clayton 87ad55334b Moved the fixed ScriptSummaryFormat forward declaration into the #ifndef LLDB_DISABLE_PYTHON so it doesn't show up in builds where it is supposed to be disabled.
llvm-svn: 144045
2011-11-07 23:54:13 +00:00
Sean Callanan c7b650670e 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.

llvm-svn: 144042
2011-11-07 23:35:40 +00:00
Sean Callanan 82695d6259 Additional logging to track original versions of
imported variables.

llvm-svn: 144041
2011-11-07 23:32:52 +00:00
Eric Christopher 4a9bc07d99 Remove duplicate and contradictory forward declaration.
llvm-svn: 144040
2011-11-07 23:29:56 +00:00
Johnny Chen db02f3b4f4 Fix the test suite failure. The particular line in the test case was there since the initial version
dated 2010-21-15.  The test started failure recently probably due to work done on the command parsing.
Anyway, the specific test sequence is invalid and is fixed now.

llvm-svn: 144039
2011-11-07 23:26:12 +00:00
Enrico Granata 0a305db796 this patch addresses several issues with "command script" subcommands:
a) adds a new --synchronicity (-s) setting for "command script add" that allows the user to decide if scripted commands should run synchronously or asynchronously (which can make a difference in how events are handled)
 b) clears up several error messages
 c) adds a new --allow-reload (-r) setting for "command script import" that allows the user to reload a module even if it has already been imported before
 d) allows filename completion for "command script import" (much like what happens for "target create")
 e) prevents "command script add" from replacing built-in commands with scripted commands
 f) changes AddUserCommand() to take an std::string instead of a const char* (for performance reasons)
plus, it fixes an issue in "type summary add" command handling which caused several test suite errors

llvm-svn: 144035
2011-11-07 22:57:04 +00:00
Greg Clayton 44148b367f Bumped Xcode project version for lldb-86 and debugserver-151
llvm-svn: 144032
2011-11-07 22:50:17 +00:00
Greg Clayton c64b5c7c47 Xcode project changes to install "lldb" into "/usr/bin" and have LLDB.framework
in "/System/Library/PrivateFrameworks", and also have "lldb" in the Xcode.app
and the LLDB.framework in Xcode.app as well.

llvm-svn: 144030
2011-11-07 22:45:39 +00:00
Peter Collingbourne 1f6198d404 Update a missed getHostTriple call, fixes non-__APPLE__ build
llvm-svn: 143774
2011-11-05 01:35:31 +00:00
Greg Clayton abd7061c4e Missed part of a previous patch.
llvm-svn: 143773
2011-11-05 01:12:05 +00:00
Greg Clayton 386ff18a4a Patch from Dragos Tatulea which was a modified version of a patch from
Joel Dillon that fixed 64 debugging for Linux.

I also added a patch to fix up the ProcessLinux::DoLaunch() to be up to date.
I wasn't able to verify it compiles, but it should b really close.

llvm-svn: 143772
2011-11-05 01:09:16 +00:00
Sean Callanan d5145b36ef Wrapped some logging statements in conditionals, to prevent
crashes.

llvm-svn: 143756
2011-11-05 00:08:12 +00:00
Sean Callanan bfb237bc02 Updated LLVM/Clang to pick up a fix for imports of
C++ vtables, fixing a record layout problem in the
expression parser.

Also fixed various problems with the generation 
and unpacking of llvm.zip given our new better
handling of multiple architectures in the LLVM
build.

(And added a log message that will hopefully catch
record layout problems in the future.)

llvm-svn: 143741
2011-11-04 22:46:46 +00:00
Greg Clayton 9a67c268f8 For "Debug" and "Release" builds, don't build llvm into the $(OBJROOT) since
we often nuke our "build" folder so we can do clean builds. This way if you
are building your own LLVM you won't have to rebuild LLVM when you do remove
your build folder. The new location for the LLVM build is:

lldb/llvm-build

llvm-svn: 143713
2011-11-04 17:36:00 +00:00
Greg Clayton 755c73f1e1 Fixed the LD_DYLIB_INSTALL_NAME to the LLDB.framework.
llvm-svn: 143710
2011-11-04 17:18:16 +00:00
Benjamin Kramer 44030f12f1 Fix linux build after r143679.
llvm-svn: 143703
2011-11-04 16:06:40 +00:00
Benjamin Kramer 110f5039b1 Include limits.h for PATH_MAX.
llvm-svn: 143694
2011-11-04 13:33:49 +00:00
Greg Clayton 0ddf6be103 Fixed a build issue on an older Xcode.
llvm-svn: 143679
2011-11-04 03:42:38 +00:00
Greg Clayton dce502ede0 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.

llvm-svn: 143678
2011-11-04 03:34:56 +00:00
Sean Callanan 744756e389 Occasionally LLDB runs into contexts where the
target is stopped in a C++ or Objective-C method
but the "self" pointer's valid range actually
doesn't cover the current location.  Before, that
was confusing Clang to the point where it crashed;
now, we sanity-check and fall back to pretending
we're in a C function if "self" or "this" isn't
available.

llvm-svn: 143676
2011-11-04 02:09:33 +00:00
Johnny Chen e79a8d3dce Add a utility script:
Greps and returns the first svn log entry containing a line matching the regular
expression pattern passed as the only arg.

Example:

svn log -v | grep-svn-log.py '^   D.+why_are_you_missing.h$'

llvm-svn: 143671
2011-11-04 01:05:29 +00:00
Sean Callanan 3dea5c7cad Fixed a problem where the "this" pointer didn't
have the correct value in the IRInterpreter.

llvm-svn: 143663
2011-11-03 22:48:37 +00:00
Jim Ingham cf0bca9e85 Print out the task suspend count as well.
llvm-svn: 143659
2011-11-03 21:43:55 +00:00
Greg Clayton 982c9762a2 Modified all Process::Launch() calls to use a ProcessLaunchInfo structure
on internal only (public API hasn't changed) to simplify the paramter list
to the launch calls down into just one argument. Also all of the argument,
envronment and stdio things are now handled in a much more centralized fashion.

llvm-svn: 143656
2011-11-03 21:22:33 +00:00
Benjamin Kramer f82d8064d4 The alpha and system z backends were removed.
llvm-svn: 143613
2011-11-03 12:13:52 +00:00
Sean Callanan 9c95fd2ed6 Fixed the function that gets values for the
IRInterpreter to get the value, not the location,
of references.  The location of a reference has
type T&&, which is meaningless to Clang.

llvm-svn: 143592
2011-11-02 23:24:30 +00:00
Greg Clayton e59da1688e Bumping Xcode project versions for lldb-85 and debugserver-150.
llvm-svn: 143587
2011-11-02 23:11:17 +00:00
Sean Callanan f90597993a ...And forgot to check in build-llvm.pl. Sigh.
llvm-svn: 143586
2011-11-02 23:09:23 +00:00
Benjamin Kramer 4832e29795 Try to unbreak Makefile builds.
llvm-svn: 143566
2011-11-02 19:52:07 +00:00
Sean Callanan c832475cd2 Updated LLVM/Clang to pull in an MCJIT fix that
allows us to set __attribute__ ((used)) on expressions
that masquerade as methods.  When we are stopped in
classes in anonymous namespaces, this fix (and enabling
__attribute__ ((used)) on the method) will allow
expressions to run.

llvm-svn: 143560
2011-11-02 18:09:01 +00:00
Greg Clayton 8b867b475b <rdar://problem/10020849>
Fixed an issue where the DWARF might mention that a class has a constructor
(default, copy or move), destructor, or an assignment operator (copy or move)
and it might not have an actual implementation in your code. Then you try and
use this struct or class in an expression and the JIT would ask for the 
address of these methods that were in the declaration, yet there are none.
We now "do the right thing" for trivial ctors, dtors and assignment operators
by telling the methods that they are are defaulted and trivial, and clang will
then just do all of the work with builtins!

llvm-svn: 143528
2011-11-02 02:06:20 +00:00
Sean Callanan dbb583992a Sometimes the debug information includes artifically-
generated special member functions (constructors,
destructors, etc.) for classes that don't really have
them.  We needed to mark these as artificial to reflect
the debug information; this bug does that for
constructors and destructors.

The "etc." case (certain assignment operators, mostly)
remains to be fixed.

llvm-svn: 143526
2011-11-02 01:38:59 +00:00
Sean Callanan fc89c142d3 Added functionality to call Objective-C class methods
correctly, and added a testcase to check that it works.

The main problem here is that Objective-C class method
selectors are external references stored in a special
data structure in the LLVM IR module for an expression.
I just had to extract them and ensure that the real
class object locations were properly resolved.

llvm-svn: 143520
2011-11-01 23:38:03 +00:00
Johnny Chen a8df2c7a74 Add bench entries.
llvm-svn: 143476
2011-11-01 19:22:09 +00:00
Johnny Chen 5e27d5e033 Change the expected substrings for 'frame variable' output to:
'::my_uint_t', 'anon_uint = 0'

from:

    '(my_uint_t) anon_uint = 0'

to make the test suite clean with ToT.

llvm-svn: 143474
2011-11-01 18:46:52 +00:00
Sean Callanan c1b732d782 Added the capability (turned off for now) to mark a
method as __attribute__ ((used)) when adding it to a
class.  This functionality is useful when stopped in
anonymous namespaces: expressions attached to classes
in anonymous namespaces are typically elided by Clang's
CodeGen because they have no namespaces are intended
not to be externally visible.  __attribute__ ((used))
forces CodeGen to emit the function.

Right now, __attribute__ ((used)) causes the JIT not to
emit the function, so we're not enabling it until we
fix that.

llvm-svn: 143469
2011-11-01 18:07:13 +00:00
Sean Callanan ea685aeb3c Minor logging changes: added logging right before
the expression makes it to the JIT, and made some
logging only appear in verbose mode.

llvm-svn: 143467
2011-11-01 17:33:54 +00:00
Daniel Dunbar 8d365a1749 build: liblldb now depends on the linker library
llvm-svn: 143466
2011-11-01 17:32:01 +00:00
Jason Molenda 707fec479c Restructure the relationship between UnwindLLDB and the
RegisterContextLLDBs it contains.

Previously RegisterContextLLDB objects had a pointer to their "next"
frame down the stack.  e.g. stack starts at frame 0; frame 3 has a
pointer to frame 2.  This is used to retreive callee saved register
values.  When debugging an inferior that has blown out its own stack,
however, this could result in lldb blowing out its own stack while
recursing down to retrieve register values.

RegisterContextLLDB no longer has a pointer to its next frame; it 
has a reference to the UnwindLLDB which contains it.  When it needs
to retrieve a reg value, it asks the UnwindLLDB for that reg value
and UnwindLLDB iterates through the frames until it finds a location.

llvm-svn: 143423
2011-11-01 03:21:25 +00:00
Jim Ingham ce553d885a Enhanced the ObjC DynamicCheckerFunction to test for "object responds to selector" as well as
"object borked"...  Also made the error when the checker fails reflect this fact rather than
report a crash at 0x0.

Also a little cleanup:
- StopInfoMachException had a redundant copy of the description string.
- ThreadPlanCallFunction had a redundant copy of the thread, and had a 
copy of the process that it didn't really need.

llvm-svn: 143419
2011-11-01 02:46:54 +00:00
Greg Clayton 93d217889e Bumped Xcode project version to lldb-84 and debugserver-149.
llvm-svn: 143408
2011-11-01 01:10:56 +00:00
Greg Clayton 9d3d6886e6 Fixed some warnings after enabling some stricter warnings in the Xcode project
settings.

Also fixed an issue where we weren't creating anonymous namepaces correctly:
<rdar://problem/10371295>

llvm-svn: 143403
2011-10-31 23:51:19 +00:00
Jim Ingham 549f737453 We can't have the global vector of modules be a static object, or it might get destroyed
before all the modules, which will then crash when the next modules tries to take itself off it.

llvm-svn: 143402
2011-10-31 23:47:10 +00:00
Daniel Dunbar 3344d2b9ea build: Add the Darwin-Kernel Makefile.
llvm-svn: 143398
2011-10-31 23:38:34 +00:00
Daniel Dunbar a6ad0e2979 warnings: Fix another place with extension warnings I somehow missed.
llvm-svn: 143397
2011-10-31 23:38:30 +00:00
Johnny Chen 5fede4bfba Add expectedFailure decorators.
rdar://problem/10373783

llvm-svn: 143396
2011-10-31 23:35:33 +00:00
Johnny Chen 9a1e9af2ba Add some expr evaluations for simple STL data types.
Radar to be filed soon.

llvm-svn: 143395
2011-10-31 23:28:52 +00:00
Daniel Dunbar 16d88ff045 tests: Improve Makefile/dotest to properly set LLDB_HERE variable used in some
tests.

llvm-svn: 143394
2011-10-31 23:27:06 +00:00
Jim Ingham 56bbb88689 ValueObjectVariable::GetClangAST should check that it has a valid Type before accessing it.
llvm-svn: 143393
2011-10-31 23:06:45 +00:00
Daniel Dunbar f1a7d2253a build: Fix SWIG include paths on Darwin.
llvm-svn: 143390
2011-10-31 22:51:14 +00:00
Daniel Dunbar 3257a7714d build: Build in the Darwin-Kernel OperatingSystem plugin.
llvm-svn: 143389
2011-10-31 22:51:11 +00:00
Daniel Dunbar f9031c4ff5 build: Fix Makefiles on Darwin to link proper dynamic loader plugin.
llvm-svn: 143388
2011-10-31 22:51:08 +00:00
Daniel Dunbar 12a199040c warnings: Use LLVM_EXTENSION to suppress a bunch of pedantic warnings.
llvm-svn: 143387
2011-10-31 22:51:05 +00:00
Daniel Dunbar 0d23d03b7c warnings: Fix a non-standard escape sequence.
llvm-svn: 143386
2011-10-31 22:51:02 +00:00
Daniel Dunbar 108228bf5b warnings: Fix use of a non-standard escape.
llvm-svn: 143385
2011-10-31 22:51:00 +00:00
Daniel Dunbar dacdfb52b0 warnings: Get rid of spurious semicolon.
llvm-svn: 143384
2011-10-31 22:50:57 +00:00
Daniel Dunbar 807d2c6b27 build: Add some -Wno's for things LLDB isn't clean on yet.
llvm-svn: 143383
2011-10-31 22:50:55 +00:00
Daniel Dunbar 5ae8732394 build: Fix an improperly formed include path (works under Xcode's promiscuous include additions, but not Makefiles).
llvm-svn: 143382
2011-10-31 22:50:53 +00:00
Daniel Dunbar a08823fd10 warnings: Fix a bunch of -Wreorder problems.
llvm-svn: 143381
2011-10-31 22:50:49 +00:00
Daniel Dunbar daed340b57 warnings: Fix several uses of trailing comma on enumeration extensions.
llvm-svn: 143380
2011-10-31 22:50:41 +00:00
Daniel Dunbar f9f7032b5d warnings: Fix up several const qualified return types.
llvm-svn: 143379
2011-10-31 22:50:37 +00:00
Daniel Dunbar 8914cba576 warnings: Fixup a number of mismatched tags problems.
llvm-svn: 143378
2011-10-31 22:50:33 +00:00
Daniel Dunbar d56f63f06c build: Fix Darwin linker flags which weren't properly passed (and aren't valid).
llvm-svn: 143377
2011-10-31 22:50:30 +00:00
Daniel Dunbar e6fb049d3d build: Fixup Darwin process plugin build for Makefiles.
llvm-svn: 143376
2011-10-31 22:50:27 +00:00
Daniel Dunbar 647bf23510 AppleObjCTrampolineHandler: Use array_lengthof instead of unnecessary sentinel.
llvm-svn: 143375
2011-10-31 22:50:24 +00:00
Johnny Chen 8e9383d69c Revert 143359 and modify the test case to not include non-valid c identifier character.
llvm-svn: 143372
2011-10-31 22:22:06 +00:00
Sean Callanan fc8feb8137 The IRDynamicChecks subsystem was not properly
detecting Objective-C method calls because the
"lldb.call.realName" metadata was no longer
being correctly installed.  I fixed this problem.

llvm-svn: 143371
2011-10-31 22:11:40 +00:00
Greg Clayton 4f8e86979a <rdar://problem/10368163>
Fixed an issue where if a mach-o symbol table was corrupt and had a string
table offset that is invalid, we could crash. We now properly check the string
table offset and ignore any symbols with invalid strings.

llvm-svn: 143362
2011-10-31 20:50:40 +00:00
Johnny Chen ced5e7b99b Add bench entries.
llvm-svn: 143361
2011-10-31 20:29:36 +00:00
Johnny Chen 773f8ad66b Fix the r143266 check-in which broke TestCommandRegex.py.
llvm-svn: 143359
2011-10-31 20:12:14 +00:00
Johnny Chen e8d9dc60be Add a Python script to invoke each test file under the test root using a separate process.
Example:

[11:33:09] johnny:/Volumes/data/lldb/svn/trunk/test $ ./dosep.ty -o "-v -n"
dotest.py options: -v -n
Running /Volumes/data/lldb/svn/trunk/test/dotest.py -v -n -p TestPublicAPIHeaders.py /Volumes/data/lldb/svn/trunk/test/api/check_public_api_headers
1: test_sb_api_directory (TestPublicAPIHeaders.SBDirCheckerCase)
   Test the SB API directory and make sure there's no unwanted stuff. ... ok

----------------------------------------------------------------------
Ran 1 test in 4.404s

OK
Running /Volumes/data/lldb/svn/trunk/test/dotest.py -v -n -p TestEmulations.py /Volumes/data/lldb/svn/trunk/test/arm_emulation
1: test_arm_emulations (TestEmulations.ARMEmulationTestCase) ... ok
2: test_thumb_emulations (TestEmulations.ARMEmulationTestCase) ... ok

----------------------------------------------------------------------
Ran 2 tests in 1.399s

OK

...

llvm-svn: 143355
2011-10-31 19:04:07 +00:00
Peter Collingbourne 43459974f1 When running tests, prepend our LibDir to the user's SHLIBPATH_VAR
instead of replacing it.

llvm-svn: 143323
2011-10-31 00:43:12 +00:00
Jason Molenda ada22aa0e9 finish removal of alpha arch -- previous half-removal caused lldb to assert on startup
llvm-svn: 143294
2011-10-29 20:32:56 +00:00
Sean Callanan fb3e4306af Cloned FindExternalVisibleDecls from
ClangExpressionDeclMap to ClangASTSource, and
moved all general type and namespace lookups
into ClangASTSource.  Now ClangASTSource is ready
to complete types given nothing more than a target
and an AST context.

llvm-svn: 143292
2011-10-29 19:50:43 +00:00
Sean Callanan ba0aca72f0 Moved FindExternalLexicalDecls and a few smaller
functions from ClangExpressionDeclMap to ClangASTSource.

llvm-svn: 143276
2011-10-29 02:28:18 +00:00
Sean Callanan 1ee44b741d I moved the responsibility for interacting with the
AST importer on completing namespace mappings from
ClangExpressionDeclMap to ClangASTSource.

ClangASTSource now contains a TargetSP which it
uses to lookup namespaces in all of a target's
modules.  I will use the TargetSP in the future to
look up globals.

llvm-svn: 143275
2011-10-29 01:58:46 +00:00
Johnny Chen 61200b31db Add a simple regression test to go with r143260.
CommandInterpreter::PreprocessCommand() should not infinite loop
when a target has not been specified yet.

llvm-svn: 143274
2011-10-29 01:58:39 +00:00
Jason Molenda 2fae235365 Remove alpha from list of known architectures -- it was just removed
from llvm TOT.

llvm-svn: 143273
2011-10-29 01:34:50 +00:00
Greg Clayton c05203ba81 Updated the project to use the "DEVELOPER_DIR" build setting that specifies
the path to the /Developer directory, and also bumped the Xcode project version
for lldb-83 and debugserver-148.

llvm-svn: 143269
2011-10-29 01:19:08 +00:00
Greg Clayton 52ec56ccd0 Fixed the "expression" command when it comes to using it with the new GDB format
command suffix:

(lldb) expression/x 3+3

Since "expression" is a raw command that has options, we need to make sure the
command gets its options properly terminated with a "--".

Also fixed an issue where if you try to use the GDB command suffix on a 
command that doesn't support the "--gdb-format" command, it will report an
appropriate error.

For the fix above, you can query an lldb_private::Options object to see if it
supports a long option by name.

llvm-svn: 143266
2011-10-29 00:57:28 +00:00
Jim Ingham c30ee56fdf Fix a type in Symbol::Compare which was causing calls to Compare with type eSymbolTypeAny to fail.
llvm-svn: 143264
2011-10-29 00:54:12 +00:00
Johnny Chen ed00fa4554 Add bench entries.
llvm-svn: 143261
2011-10-29 00:35:28 +00:00
Johnny Chen 51ea0ad7ca Get a dummy target to allow for calculator mode while processing backticks.
This also helps break the infinite loop caused when target is null.

So that we can have:

$ /Volumes/data/lldb/svn/trunk/build/Debug/lldb
(lldb) itob `0x123 - 0x321` 32 v
 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10  9  8  7  6  5  4  3  2  1  0
 [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0]
(lldb) 

llvm-svn: 143260
2011-10-29 00:21:50 +00:00
Greg Clayton 1848afbbe8 Fixed the continuation dumping of instructions to properly advance the
previous address only by the number of bytes consumed by the disassembly:

(lldb) x/4i 0x0000000100000ea9
0x100000ea9:  66 c7 45 fa 10 00     movw   $16, -6(%rbp)
0x100000eaf:  c7 45 f4 20 00 00 00  movl   $32, -12(%rbp)
0x100000eb6:  e8 47 00 00 00        callq  0x0000000100000f02       ; void f<nullptr_t>(nullptr_t)
0x100000ebb:  8b 45 fc              movl   -4(%rbp), %eax
(lldb) 
0x100000ebe:  48 83 c4 10  addq   $16, %rsp
0x100000ec2:  5d           popq   %rbp
0x100000ec3:  c3           ret    
0x100000ec4:  90           nop    
(lldb) 
0x100000ec5:  90  nop    
0x100000ec6:  90  nop    
0x100000ec7:  90  nop    
0x100000ec8:  90  nop    
(lldb) 
0x100000ec9:  90  nop    
0x100000eca:  90  nop    
0x100000ecb:  90  nop    
0x100000ecc:  90  nop    
(lldb) 
0x100000ecd:  90  nop    
0x100000ece:  90  nop    
0x100000ecf:  90  nop    
0x100000ed0:  55  pushq  %rbp

llvm-svn: 143254
2011-10-28 23:44:55 +00:00
Sean Callanan eddeb3b96f As part of a general refactoring of ClangASTSource to
allow it to complete types on behalf of any AST context
(including the "scratch" AST context associated with
the target), I scrapped its role as intermediary between
the Clang parser and ClangExpressionDeclMap, and instead
made ClangExpressionDeclMap inherit from ClangASTSource.

After this, I will migrate the functions that complete
types and perform namespace lookups from
ClangExpressionDeclMap to ClangASTSource.  Ultimately
ClangExpressionDeclMap's only responsiblity will be to
look up variables and ensure that they are materialized
and dematerialized correctly.

llvm-svn: 143253
2011-10-28 23:38:38 +00:00
Johnny Chen 8763780961 Add an example customization directory which uses a binutils.py module to provide
commands to print the binary representaion of an integer.

llvm-svn: 143252
2011-10-28 23:30:28 +00:00
Greg Clayton 7c533b2447 Fixed the GDB format to allow the size and format characters to come in any
order. Also hooked up the new formats for instruction, hex float and address
to the new formats.

llvm-svn: 143251
2011-10-28 23:27:55 +00:00
Jim Ingham c6674fd597 Added the ability for the target to specify Modules that will not be searched
when setting breakpoints, but only if no module is specified.  The Darwin 
platform uses this to not set breakpoints in dyld.

llvm-svn: 143249
2011-10-28 23:14:11 +00:00
Greg Clayton 605684ec20 Added support for C++0x char16_t and char32_t types.
llvm-svn: 143246
2011-10-28 23:06:08 +00:00
Greg Clayton 490fbbe270 Enabled the "printf" attribute on all debugserver logging functions and fixed
the ensuing mayhem.

llvm-svn: 143244
2011-10-28 22:59:14 +00:00
Greg Clayton 5521f99a42 Added the ability to have GDB formats appended to any command so you can do
things like:

(lldb) x/32xb 0x1000

"x" is an alias to "memory read", so this will actually turn into:

(lldb) memory read --gdb-format=32xb 0x1000

This applies to all commands, so the GDB formats will work with "register read",
"frame variable", "target variable" and others. All commands that can accept
formats, counts and sizes have been modified to support the "--gdb-format"
option.

llvm-svn: 143230
2011-10-28 21:38:01 +00:00
Johnny Chen a4c6a7b2b6 Remove extra newline in the docstring.
llvm-svn: 143228
2011-10-28 21:23:58 +00:00
Greg Clayton d443641291 Added support for the C++Ox "nullptr_t" type.
llvm-svn: 143225
2011-10-28 21:00:00 +00:00
Johnny Chen 57fe0e2e7e Add bench entries.
llvm-svn: 143210
2011-10-28 18:21:00 +00:00
Johnny Chen 6c75b61f08 Fix a typo.
llvm-svn: 143207
2011-10-28 17:56:02 +00:00
Greg Clayton e3c3d724c9 Bumping Xcode project version in mainline to match the latest build that was
submitted.

llvm-svn: 143199
2011-10-28 16:41:16 +00:00
Sean Callanan da1452dc29 Added a bunch of logging to CompleteType for TagDecls
and ObjCInterfaceDecls.

llvm-svn: 143181
2011-10-28 02:08:32 +00:00
Greg Clayton 708c1ab6f5 Python does some bad things to the signal masks in the current process and
then we spawn child processes (debugserver, etc) and those bad settings get 
inherited. We stop this from happening by correctly mucking with the posix
spawn attributes.

llvm-svn: 143176
2011-10-28 01:24:12 +00:00
Jim Ingham 52c7d20241 Grab the address of the breakpoint site for the StopInfoBreakpoint so if
it gets deleted before GetDescription is called we still at least know
where it was.

llvm-svn: 143175
2011-10-28 01:12:19 +00:00
Jim Ingham aab78371b9 Fix up how we shut down the communication with debugserver so we don't rely on
debugserver being responsive to shut down.

llvm-svn: 143174
2011-10-28 01:11:35 +00:00
Johnny Chen 2a781097f3 Add a binutils.py which contains Python functions for displaying bit representation of numbers.
llvm-svn: 143173
2011-10-28 01:09:53 +00:00
Johnny Chen d9809f542b Print out the version of the locally built 'lldb' binary, not the one found in your PATH env variable.
llvm-svn: 143170
2011-10-28 00:59:00 +00:00
Johnny Chen c2d6974702 This benchmark is meant to run the locally built 'lldb' binary, not the binary on the PATH env variable.
llvm-svn: 143169
2011-10-28 00:46:47 +00:00
Sean Callanan 7bf37d7904 Fixed a leak in the LLVM disassembler where the
InstructionLLVM class dropped its instruction
handle on the floor instead of releasing it
correctly.

llvm-svn: 143156
2011-10-27 22:16:42 +00:00
Greg Clayton e889ad65cc <rdar://problem/10357230>
Fixed an issue where async packets were incurring a delay even though they
were sent correctly. We now properly broadcast the private run state being
resumed correctly. Also fixed logging to reflect what is happening.

llvm-svn: 143154
2011-10-27 22:04:16 +00:00
Sean Callanan c0a6e0619d Added a function to the Host that gets a dummy target
for it, so that people who want to use LLDB as a
calculator can run simple expressions without needing
a target or process.

llvm-svn: 143147
2011-10-27 21:22:25 +00:00
Sean Callanan 9829801437 Changed the way the expression parser handles variables
of reference types.  Previously, such variables were
materialized as references to those references, which
caused undesried behavior in Clang and was useless anyway
(the benefit of using references to variables is that it
allows expressions to modify variables in place, but for
references that's not required).

Now we just materialize the references directly, which
fixes a variety of expressions that use references.

llvm-svn: 143137
2011-10-27 19:41:13 +00:00
Johnny Chen 0071778a3b Add bench history entries.
llvm-svn: 143121
2011-10-27 18:43:39 +00:00
Johnny Chen ea3a9af832 Undo r142549 and r142543 which temporarily relax the expected substrings for
watchpoint creation output due to wrong debug info from clang.  It has been
fixed.

llvm-svn: 143118
2011-10-27 18:27:52 +00:00
Greg Clayton 5009f9d501 Added support for the new ".apple_objc" accelerator tables. These tables are
in the same hashed format as the ".apple_names", but they map objective C
class names to all of the methods and class functions. We need to do this 
because in the DWARF the methods for Objective C are never contained in the
class definition, they are scattered about at the translation unit level and
they don't even have attributes that say the are contained within the class
itself. 

Added 3 new formats which can be used to display data:

    eFormatAddressInfo
    eFormatHexFloat
    eFormatInstruction
    
eFormatAddressInfo describes an address such as function+offset and file+line,
or symbol + offset, or constant data (c string, 2, 4, 8, or 16 byte constants).
The format character for this is "A", the long format is "address".

eFormatHexFloat will print out the hex float format that compilers tend to use.
The format character for this is "X", the long format is "hex float".

eFormatInstruction will print out disassembly with bytes and it will use the
current target's architecture. The format character for this is "i" (which
used to be being used for the integer format, but the integer format also has
"d", so we gave the "i" format to disassembly), the long format is 
"instruction".

Mate the lldb::FormatterChoiceCriterion enumeration private as it should have
been from the start. It is very specialized and doesn't belong in the public 
API.

llvm-svn: 143114
2011-10-27 17:55:14 +00:00
Sean Callanan 7f9be0fdc1 Liberalized the "id" check a little; now "id" can
be found in namespaces.

llvm-svn: 143096
2011-10-27 02:10:28 +00:00
Sean Callanan fb40b0d4b5 Disabled lookups for the Objective-C builtin type "id;"
the compiler should pick this type up automatically.

llvm-svn: 143094
2011-10-27 02:06:03 +00:00
Greg Clayton 04b78e9f20 Updated the grossly out of date status page.
llvm-svn: 143092
2011-10-27 01:33:27 +00:00
Johnny Chen 09e87a6622 Add display of min and max samples to Stopwatch's string representation.
llvm-svn: 143087
2011-10-27 00:32:03 +00:00
Sean Callanan 7ba9636f0a Added an extra parameter to the object-checker
functions in the Objective-C language runtime
that is set to the selector that is being passed
to the object.

llvm-svn: 143083
2011-10-27 00:02:05 +00:00
Johnny Chen 66d362e9bf Establish a baseline for bench.py score by using a fixed lldb executable as the
inferior program for the lldb debugger to operate on.  The fixed lldb executable
corresponds to r142902.

Plus some minor modifications to the test benchmark to conform to way bench.py
is meant to be invoked.

llvm-svn: 143075
2011-10-26 22:58:02 +00:00
Sean Callanan d2cb626ac1 Extended the IR interpreter to handle the variables
"_cmd", "this", and "self".  These variables are handled
differently from all other external variables used by
the expression.  Other variables are used indirectly
through the $__lldb_arg operand; only _cmd, this, and
self are passed directly through the ABI.

There are two modifications:

 - I added a function to ClangExpressionDeclMap that
   retrives the value of one of these variables by name;
   and

 - I made IRInterpreter fetch these values when needed,
   and ensured that the proper level of indirection is
   used.

llvm-svn: 143065
2011-10-26 21:20:00 +00:00
Greg Clayton 63f8cc6aca Fixed the display of OSTypes (the four character codes).
llvm-svn: 143056
2011-10-26 21:01:16 +00:00
Jim Ingham 1d18ebf62a When completing "help foo bar" if "foo" is not a real command, don't ask its NULL command object to complete the line.
llvm-svn: 143047
2011-10-26 19:32:01 +00:00
Greg Clayton f91381e82c Update the GDB format text to be a bit more clear.
llvm-svn: 143043
2011-10-26 18:35:21 +00:00
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
Johnny Chen 457e786932 Fix typo in the docstring.
llvm-svn: 142996
2011-10-26 00:44:40 +00:00
Johnny Chen 6e5b330fb4 Add another metric for startup delay -- run to breakpoint, which measures the time from issuing
the run command till the first breakpoint hit.  Example:

 $ ./dotest.py -v +b -n -x '-F Driver::MainLoop()' -p TestStartupDelays.py
1: test_startup_delay (TestStartupDelays.StartupDelaysBench)
   Test start up delays creating a target and setting a breakpoint. ... 
lldb startup delay (create fresh target) benchmark: Avg: 0.124496 (Laps: 30, Total Elapsed Time: 3.734883)
lldb startup delay (set first breakpoint) benchmark: Avg: 0.220828 (Laps: 30, Total Elapsed Time: 6.624847)
lldb startup delay (run to breakpoint) benchmark: Avg: 0.478159 (Laps: 30, Total Elapsed Time: 14.344774)
ok

llvm-svn: 142993
2011-10-26 00:35:10 +00:00
Sean Callanan efa7d1f117 Fixed a problem where local variables conflict with
types of the same name.  If a local variable with the
given name is found (and we are not searching a
specific namespace) we stop right then and there and
report it.

llvm-svn: 142962
2011-10-25 20:36:57 +00:00
Johnny Chen fc9e79fb95 Benchmark the turnaround time starting a debugger and run to the breakpoint with lldb vs. gdb.
An example (with /Developer/usr/bin/lldb vs. /usr/bin/gdb):

[13:05:04] johnny:/Volumes/data/lldb/svn/trunk/test $ ./dotest.py -v +b -n -p TestCompileRunToBreakpointTurnaround.py
1: test_run_lldb_then_gdb (TestCompileRunToBreakpointTurnaround.CompileRunToBreakpointBench)
   Benchmark turnaround time with lldb vs. gdb. ... 
lldb turnaround benchmark: Avg: 4.574600 (Laps: 3, Total Elapsed Time: 13.723799)
gdb turnaround benchmark: Avg: 7.966713 (Laps: 3, Total Elapsed Time: 23.900139)
lldb_avg/gdb_avg: 0.574214
ok

----------------------------------------------------------------------
Ran 1 test in 55.462s

OK

llvm-svn: 142949
2011-10-25 20:08:03 +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
Sean Callanan f463856fd0 Fixed our handling of const functions, compensating
for debug information that occasionally gets the
const-ness of member functions wrong.  We used to
demangle the name, add "const," and remangle it; now
we handle the mangled name directly, which is more
robust.

llvm-svn: 142933
2011-10-25 18:02:05 +00:00
Johnny Chen 3d0fcf5eae Patch from Dragos to fix Linux build!
llvm-svn: 142932
2011-10-25 17:58:16 +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
Jason Molenda 0c8e006987 Prefix display/undisplay regexp command alises with "_regexp" as per the
style of the other regexp command aliases.

llvm-svn: 142902
2011-10-25 02:11:20 +00:00
Jason Molenda 4223b3b380 typeo
llvm-svn: 142900
2011-10-25 01:28:56 +00:00
Jason Molenda b278f1e191 Add examples of shortest-possible lldb commands where appropriate.
Add new "Examining Variables" section.
Updated a few command entries to match current lldb behavior.

llvm-svn: 142898
2011-10-25 01:28:31 +00:00
Greg Clayton 4495393fed <rdar://problem/10335756>
Fixed an issue where bad DWARF from clang would get recycled from DWARF back
into types and cause clang to assert and die, killing the lldb binary, when
it tried to used the type in an expression.

llvm-svn: 142897
2011-10-25 01:25:35 +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
Johnny Chen 447a2507a4 Add a bench-history file to keep track of simple bench results.
llvm-svn: 142874
2011-10-24 23:18:17 +00:00
Johnny Chen aeab25c70f Add more context information to the stop-hook mechanism by displaying the stop-hook
command in the '- Hook id' header.  This should improve readbility of the 'display'
command if, for example, we have issued 'display a' and 'display b' which turn into
"target stop-hook add -o 'expr -- a'" and "target stop-hook add -o 'expr -- b'".

Plus some minor change in TestAbbreviations.py to conditionalize the platform-specific
checkings of the "image list" output.

llvm-svn: 142868
2011-10-24 23:01:06 +00:00
Johnny Chen 51a4655201 Minor change.
llvm-svn: 142858
2011-10-24 22:06:48 +00:00
Johnny Chen 0deafe065a Test some lldb command abbreviations to make sure the common short spellings of
many commands remain available even after we add/delte commands in the future.

llvm-svn: 142857
2011-10-24 22:03:01 +00:00
Johnny Chen 7149b6f115 Add two new @expectedFailure decorators.
rdar://problem/10334911

llvm-svn: 142839
2011-10-24 20:06:23 +00:00
Jim Ingham 7e18e42235 Add "di" and "dis" aliases to "disassemble" so they will win over "display".
llvm-svn: 142834
2011-10-24 18:37:00 +00:00
Jim Ingham c10312cea2 Add a "-a" option to "image list" to show the image at a given address.
llvm-svn: 142833
2011-10-24 18:36:33 +00:00
Johnny Chen 9593622b08 Fix test regressions due to the addition of 'display' alias to the top level commands, which conflicts
with the original 'dis' -> 'disassemble' unique expansion.  Change it to 'disass' now.

llvm-svn: 142825
2011-10-24 18:24:54 +00:00
Johnny Chen e5b190304d Removed the @expectedFailure decorators from test cases. They have been fixed with the r142717 check-in.
llvm-svn: 142823
2011-10-24 18:11:16 +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 607ddc571e Bumped versions for lldb-81 and debugserver-146.
llvm-svn: 142718
2011-10-22 03:38: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
Jason Molenda a98d106d49 Document nexti, show some shorter versions of long lldb
commands.

llvm-svn: 142715
2011-10-22 02:31:42 +00:00
Sean Callanan a76eadd8bb Made the expression parser handle persistent variables
correctly even after the process has quit.

llvm-svn: 142712
2011-10-22 01:58:08 +00:00
Jason Molenda bc7748b7d3 Add "display" and "undisplay" aliases for target stop-hook add/delete.
A patina of gdb's "display" command, intended mostly for simply monitoring
a variable as you step through source code.  Formatters do not work, e.g.
display/x $pc does not work.

llvm-svn: 142710
2011-10-22 01:30:52 +00:00
Johnny Chen b8da426285 Add bench.py as a driver script to run some benchmarks on lldb.
Add benchmarks for expression evaluations (TestExpressionCmd.py) and disassembly (TestDoAttachThenDisassembly.py).

An example:
[17:45:55] johnny:/Volumes/data/lldb/svn/trunk/test $ ./bench.py 2>&1 | grep -P '^lldb.*benchmark:'
lldb startup delay (create fresh target) benchmark: Avg: 0.104274 (Laps: 30, Total Elapsed Time: 3.128214)
lldb startup delay (set first breakpoint) benchmark: Avg: 0.102216 (Laps: 30, Total Elapsed Time: 3.066470)
lldb frame variable benchmark: Avg: 1.649162 (Laps: 20, Total Elapsed Time: 32.983245)
lldb stepping benchmark: Avg: 0.104409 (Laps: 50, Total Elapsed Time: 5.220461)
lldb expr cmd benchmark: Avg: 0.206774 (Laps: 25, Total Elapsed Time: 5.169350)
lldb disassembly benchmark: Avg: 0.089086 (Laps: 10, Total Elapsed Time: 0.890859)

llvm-svn: 142708
2011-10-22 00:57:05 +00:00
Jason Molenda f385f12e17 Add "stepi" as an alias for thread step-inst in addition to "si".
Add "nexti" an "ni" as aliases for thread step-inst-over.

llvm-svn: 142707
2011-10-22 00:47:41 +00:00
Sean Callanan 2e2b8b844c Enabled dedicated debugger support in Clang, meaning
that Objective-C methods returning types incompatible
with "id" can be properly cast.

llvm-svn: 142702
2011-10-21 23:40:00 +00:00
Greg Clayton 7c6d7b83c1 Fixed a missing quote.
llvm-svn: 142698
2011-10-21 23:04:20 +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
Greg Clayton 596ed24e43 If a process plug-in was specified by name, always let the plug-in get used.
llvm-svn: 142688
2011-10-21 21:41:45 +00:00
Johnny Chen 31fdfb1f33 Add a benchmark for measuring the response time of the 'frame variable' command.
Example (start the lldb inferior, break at the Driver::MainLoop() function, and
issue 'frame variable'):

 $ ./dotest.py -v +b -x '-F Driver::MainLoop()' -n -p TestFrameVariableResponse.py
----------------------------------------------------------------------
Collected 1 test

1: test_startup_delay (TestFrameVariableResponse.FrameVariableResponseBench)
   Test response time for the 'frame variable' command. ... 
lldb frame variable benchmark: Avg: 1.636897 (Laps: 20, Total Elapsed Time: 32.737944)
ok

----------------------------------------------------------------------
Ran 1 test in 65.105s

OK

llvm-svn: 142678
2011-10-21 20:19:51 +00:00
Johnny Chen 99904b33b7 Rephrase benchmark output display.
llvm-svn: 142676
2011-10-21 20:11:40 +00:00