Commit Graph

4277 Commits

Author SHA1 Message Date
Johnny Chen e7526b7daf http://llvm.org/bugs/show_bug.cgi?id=11715
comma at end of enumerator list

llvm-svn: 147633
2012-01-06 00:05:01 +00:00
Johnny Chen 3e8cd274e8 Fix indentation.
llvm-svn: 147629
2012-01-05 23:51:37 +00:00
Johnny Chen 2a189134b9 Add back the file I wrongly deleted in r147613.
llvm-svn: 147627
2012-01-05 23:50:14 +00:00
Sean Callanan 3c88eae154 Fixed a problem in our local Clang's method for
performing Objective-C instance variable lookup.
Previously, it only completed the derived class
that was the beginning of the search.  Now, as
it walks up the superclass chain looking for the
ivar, it completes each superclass in turn.

Also added a testcase covering this issue.

llvm-svn: 147621
2012-01-05 22:35:40 +00:00
Johnny Chen 9ed5b49c45 Fix incomplete commit of http://llvm.org/viewvc/llvm-project?rev=147609&view=rev:
This patch combines common code from Linux and FreeBSD into
a new POSIX platform.  It also contains fixes for 64bit FreeBSD.

The patch is based on changes by Mark Peek <mp@FreeBSD.org> and
"K. Macy" <kmacy@freebsd.org> in their github repo located at
https://github.com/fbsd/lldb.

llvm-svn: 147613
2012-01-05 21:48:15 +00:00
Johnny Chen 30213ffc28 This patch combines common code from Linux and FreeBSD into
a new POSIX platform.  It also contains fixes for 64bit FreeBSD.

The patch is based on changes by Mark Peek <mp@FreeBSD.org> and
"K. Macy" <kmacy@freebsd.org> in their github repo located at
https://github.com/fbsd/lldb.

llvm-svn: 147609
2012-01-05 19:17:38 +00:00
Greg Clayton 0f6fb756a1 Bumped Xcode project versions for lldb-101 and debugserver-160.
llvm-svn: 147597
2012-01-05 04:00:49 +00:00
Greg Clayton e38a5edd9e Added code in the Host layer that can report system log messages
so that we don't have "fprintf (stderr, ...)" calls sprinkled everywhere.
Changed all needed locations over to using this.

For non-darwin, we log to stderr only. On darwin, we log to stderr _and_
to ASL (Apple System Log facility). This will allow GUI apps to have a place
for these error and warning messages to go, and also allows the command line
apps to log directly to the terminal.

llvm-svn: 147596
2012-01-05 03:57:59 +00:00
Sean Callanan c1b312a5c3 Fixed a potential hang while trying to execute
a function in the inferior.

llvm-svn: 147592
2012-01-05 02:00:14 +00:00
Johnny Chen cdc21d4c85 Add comment explaining the default constructor (ArchSpec) used in CreateTarget().
llvm-svn: 147590
2012-01-05 01:26:01 +00:00
Sean Callanan 31a8d051dd Fixed a dangling pointer bug associated with the
result variable on a "finish" statement.  The
ownership of the result value was not being properly
assigned to the newly-created persistent result
variable; now it is.

llvm-svn: 147587
2012-01-05 01:11:09 +00:00
Greg Clayton 96c09687bc <rdar://problem/10507811>
Be better at detecting when DWARF changes and handle this more
gracefully than asserting and exiting.

Also fixed up a bunch of system calls that weren't properly checking
for EINTR.

llvm-svn: 147559
2012-01-04 22:56:43 +00:00
Sean Callanan 3441d5ae34 Added logging to track when the IR interpreter
resolves values in registers.

llvm-svn: 147551
2012-01-04 21:42:46 +00:00
Sean Callanan 49e446d9ea Added examples of commands that list and delete
breakpoints.

llvm-svn: 147549
2012-01-04 21:20:39 +00:00
Sean Callanan a4c6ad1914 Fixed the help text for raw commands like "expr"
to include -- in sample command lines.  Now LLDB
prints

  expression [-f <format>] -- <expr>

instead of

  expression [-f <format>] <expr>

and also adds a new example line:

  expression <expr>

to show that in the absense of arguments the --
can be ommitted.

llvm-svn: 147540
2012-01-04 19:11:25 +00:00
Sean Callanan 06d3d01295 Instead of blindly printing a string when
eFormatCString is specified, I have made
DataExtractor::Dump properly escape the string.
This prevents LLDB from printing characters
that confuse terminals.

llvm-svn: 147536
2012-01-04 17:36:30 +00:00
Greg Clayton 77ccca718d <rdar://problem/10368163>
Watch for empty symbol tables by doing a lot more error checking on
all mach-o symbol table load command values and data that is obtained.
This avoids a crash that was happening when there was no string table.

llvm-svn: 147358
2011-12-30 00:32:24 +00:00
Greg Clayton 360f9a7663 <rdar://problem/10551280>
Fixed a crasher that can occur when parsing invalid DWARF.

llvm-svn: 147350
2011-12-29 19:47:20 +00:00
Greg Clayton d344484865 <rdar://problem/10568905>
Fixed an issue where our new accelerator tables could cause a crash
when we got a full 32 bit hash match, yet a C string mismatch.

We had a member variable in DWARFMappedHash::Prologue named 
"min_hash_data_byte_size" the would compute the byte size of HashData
so we could skip hash data efficiently. It started out with a byte size
value of 4. When we read the table in from disk, we would clear the
atom array and read it from disk, and the byte size would still be set
to 4. We would then, as we read each atom from disk, increment this count. 
So the byte size of the HashData was off, which means when we get a lookup
whose 32 bit hash does matches, but the C string does NOT match (which is
very very rare), then we try and skip the data for that hash and we would
add an incorrect offset and get off in our parsing of the hash data and 
cause this crash. 

To fix this I added a few safeguards:
1 - I now correctly clear the hash data size when we reset the atom array using the new DWARFMappedHash::Prologue::ClearAtoms() function. 
2 - I now correctly always let the AppendAtom() calculate the byte size of the hash (before we were doing things manually some times, which was correct, but not good)
3 - I also track if the size of each HashData is a fixed byte size or not, and "do the right thing" when we need to skip the data.
4 - If we do get off in the weeds, then I make sure to return an error and stop any further parsing from happening. 

llvm-svn: 147334
2011-12-29 02:58:31 +00:00
Greg Clayton dcad5021d4 <rdar://problem/10546739>
Fixed SBValue::GetValueAsUnsigned() and SBValue::GetValueAsSigned() calls to
work for bitfields.

llvm-svn: 147332
2011-12-29 01:26:56 +00:00
Greg Clayton f97c521368 Centralize the code the reads the CFI so that we always log.
llvm-svn: 147330
2011-12-29 00:05:26 +00:00
Greg Clayton 12a14e270e Cleaned up the usage to show the BuildAndIntegration configuration.
llvm-svn: 147325
2011-12-28 22:34:32 +00:00
Greg Clayton d2c46a6e39 Save a little bit of memory that was being reserved in a UniqueCStringMap
vector that can be sized to fit.

llvm-svn: 147324
2011-12-28 22:24:04 +00:00
Jim Ingham 6aa664641e Sanity check the data I am going to read from the extractor to avoid asserting.
llvm-svn: 147214
2011-12-23 00:57:42 +00:00
Johnny Chen 3f0b90dcd0 rdar://problem/10216227
LLDB (python bindings) Crashing in lldb::SBDebugger::DeleteTarget(lldb::SBTarget&)

Need to check the validity of (SBTarget&)target passed to SBDebugger::DeleteTarget()
before calling target->Destroy().

llvm-svn: 147213
2011-12-23 00:53:45 +00:00
Jim Ingham f74c2348b7 Added a bunch more structure return tests.
llvm-svn: 147212
2011-12-23 00:49:32 +00:00
Jim Ingham 8570abdc56 Fixed a thinko when returning a struct like {short a; short b; short c; float d}.
llvm-svn: 147209
2011-12-23 00:30:10 +00:00
Sean Callanan a0f6401ce9 Updating Xcode project version numbers for lldb-100 and debugserver-159
llvm-svn: 147193
2011-12-22 22:45:54 +00:00
Sean Callanan 694e244176 Added checking to prevent a rare crash when getting
the name for an external variable in the IR.

llvm-svn: 147178
2011-12-22 21:24:49 +00:00
Johnny Chen a33843f5b4 Decorate the two test cases in TestReturnValue.py as i386 only expectedFailure, aka @expectedFailurei386.
llvm-svn: 147177
2011-12-22 21:14:31 +00:00
Johnny Chen 3239124460 Indentation.
llvm-svn: 147172
2011-12-22 20:21:46 +00:00
Johnny Chen 025c58fc15 Patches for running some of the Linux tests from Dawn, thanks!
With some minor modification from me.

llvm-svn: 147160
2011-12-22 19:21:46 +00:00
Jim Ingham ef65160016 Improve the x86_64 return value decoder to handle most structure returns.
Switch from GetReturnValue, which was hardly ever used, to GetReturnValueObject
which is much more convenient.
Return the "return value object" as a persistent variable if requested.

llvm-svn: 147157
2011-12-22 19:12:40 +00:00
Jim Ingham b7c91a27fb Add check for non-NULL Variable with a NULL Type.
llvm-svn: 147149
2011-12-22 17:03:37 +00:00
Sean Callanan 960534c866 Made IRForTarget error out correctly when it can't
complete the result type, preventing crashes later.

llvm-svn: 147107
2011-12-21 23:44:05 +00:00
Sean Callanan 20bb3aa53a The "desired result type" code in the expression
parser has hitherto been an implementation waiting
for a use.  I have now tied the '-o' option for
the expression command -- which indicates that the
result is an Objective-C object and needs to be
printed -- to the ExpressionParser, which
communicates the desired type to Clang.

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

Also added a testcase for -o enabled and disabled.

llvm-svn: 147099
2011-12-21 22:22:58 +00:00
Sean Callanan b952354d58 I accidentally committed some changes to the
Xcode workspace that aren't actually desirable.
Reverted.

llvm-svn: 147097
2011-12-21 21:30:33 +00:00
Johnny Chen 4b730a73a2 Fix wrong test method name.
llvm-svn: 147072
2011-12-21 19:56:51 +00:00
Sean Callanan 9b5eaa07e9 Updating Xcode project version numbers for lldb-99 and debugserver-158
llvm-svn: 147061
2011-12-21 18:02:24 +00:00
Jason Molenda 0ffc16cef3 Bump version number past lldb-98.
llvm-svn: 147033
2011-12-21 03:14:42 +00:00
Sean Callanan febbd63db1 Tightened Clang against a bug in which RecordDecls
with incomplete definition data were being converted.
Now Clang attempts to complete RecordDecls before
converting them, avoiding a nasty crash.

llvm-svn: 147029
2011-12-21 01:47:05 +00:00
Sean Callanan 5bc5a76d9b Fixed a bug in the ASTImporter that affects
types that have been imported multiple times.

The discussion below uses this diagram:

ASTContext     A      B      C
Decl           Da     Db     Dc
ASTImporter    \-Iab-/\-Iac-/
               \-----Iac----/

When a Decl D is imported from ASTContext A to
ASTContext B, the ASTImporter Iab records the
pair <Da, Db> in a DenseMap.  That way, if Iab
ever encounters Da again (for example, as the
DeclContext for another Decl), it can use the
imported version.  This is not an optimization,
it is critical: if I import the field "st_dev"
as part of importing "struct stat," the field
must have DeclContext equal to the parent
structure or we end up with multiple different
Decls containing different parts of "struct
stat."  "struct stat" is imported once and
recorded in the DenseMap; then the ASTImporter
finds that same version when looking for the
DeclContext of "st_dev."

The bug arises when Db is imported into another
ASTContext C and ASTContext B goes away.  This
often occurs when LLDB produces result variables
for expressions.  Ibc is aware of the transport
of Db to Dc, but a brand new ASTImporter, Iac,
is responsible for completing Dc from its source
upon request.  That ASTImporter has no mappings,
so it will produce a clone of Dc when attempting
to import its children.  That means that type
completion operations on Dc will fail.

The solution is to create Iac as soon as Ibc
imports D from B to C, and inform Iac of the
mapping between Da and Dc.  This allows type
completion to happen correctly.

llvm-svn: 147016
2011-12-20 23:55:47 +00:00
Sean Callanan 9735fc9abd Updating Xcode project version numbers for lldb-97 and debugserver-157
llvm-svn: 146978
2011-12-20 17:39:37 +00:00
Johnny Chen 5d95a87c4b Properly name the test class as well as the test methods.
llvm-svn: 146957
2011-12-20 02:14:01 +00:00
Johnny Chen 2c684f00a3 Properly name the test class as well as the test methods.
llvm-svn: 146956
2011-12-20 02:11:37 +00:00
Johnny Chen 50660440a1 Work in progress for:
rdar://problem/10577182
Audit lldb API impl for places where we need to perform a NULL check

Add a NULL check for SBValue.CreateValueFromExpression().

llvm-svn: 146954
2011-12-20 01:52:44 +00:00
Johnny Chen 3ac503e042 Work in progress for:
rdar://problem/10577182
Audit lldb API impl for places where we need to perform a NULL check

Add a NULL check for SBTarget.AttachToProcessWithName() so it will not hang.

llvm-svn: 146948
2011-12-20 01:22:03 +00:00
Johnny Chen 9530770bd6 Remove dead code found.
llvm-svn: 146936
2011-12-20 00:58:20 +00:00
Johnny Chen c89c74ec2d Add fuzz call to SBStringList.AppendString(None). LLDB should not crash.
llvm-svn: 146935
2011-12-20 00:49:06 +00:00
Johnny Chen 4f8189bc6b Work in progress for:
rdar://problem/10577182
Audit lldb API impl for places where we need to perform a NULL check

Add NULL checks for SBStream APIs.

llvm-svn: 146934
2011-12-20 00:41:28 +00:00
Johnny Chen 1cbbdac108 Minor format update (no semantic change).
llvm-svn: 146930
2011-12-20 00:04:58 +00:00
Johnny Chen 1317b165fa Add test_frame_api_boundary_condition() test case to exercise a bunch of boundary condition inputs.
llvm-svn: 146924
2011-12-19 23:41:29 +00:00
Johnny Chen a7bd08be8d Add a test sequence which passes None to lldb.SBFileSpec(). LLDB should not crash.
llvm-svn: 146922
2011-12-19 23:09:54 +00:00
Johnny Chen c5c0247d98 Tes passing None to SetErrorString() and SetErrorStringWithFormat().
llvm-svn: 146919
2011-12-19 22:56:47 +00:00
Johnny Chen fee6e493b0 Work in progress for:
rdar://problem/10577182
Audit lldb API impl for places where we need to perform a NULL check

Add NULL checks for SBDebugger APIs.

llvm-svn: 146917
2011-12-19 22:51:27 +00:00
Johnny Chen b146f53de7 Add a fuzz call for SBCommunication: obj.connect(None).
llvm-svn: 146912
2011-12-19 21:47:43 +00:00
Johnny Chen a715452757 Work in progress for:
rdar://problem/10577182
Audit lldb API impl for places where we need to perform a NULL check

Add NULL checks for SBCommandReturnObject.AppendMessage().

llvm-svn: 146911
2011-12-19 21:36:23 +00:00
Johnny Chen 872e062566 Work in progress for:
rdar://problem/10577182
Audit lldb API impl for places where we need to perform a NULL check

Add NULL checks for SBCommandInterpreter APIs.

llvm-svn: 146909
2011-12-19 21:16:29 +00:00
Jim Ingham 5d3bca4ec3 Add needed Clear methods.
<rdar://problem/10596340>

llvm-svn: 146902
2011-12-19 20:39:44 +00:00
Johnny Chen 4efffd9ae5 Work in progress for:
rdar://problem/10577182
Audit lldb API impl for places where we need to perform a NULL check

Add NULL checks for SBModule and SBSection APIs.

llvm-svn: 146899
2011-12-19 20:16:22 +00:00
Sean Callanan bfb7c68b5f Added some strength to the checks that prevent
"id" from being found by the parser as an
externally-defined type.  Before, "id" would
sometimes make it through if it was defined in
a namespace, but this sometimes caused
confusion, for example when it conflicted with
std::locale::id.

llvm-svn: 146891
2011-12-19 19:38:39 +00:00
Johnny Chen cdd7e8b14a Fix Python docstring for SBThread.GetStopDescription().
llvm-svn: 146890
2011-12-19 19:38:09 +00:00
Johnny Chen 290fa41bf6 Fixed code rot pointed out by Jim.
SBThread::GetStopReasonDataCount/GetStopReasonDataAtIndex() need to handle eStopReasonWatchpoint.

llvm-svn: 146812
2011-12-17 02:07:52 +00:00
Sean Callanan 4de1090322 Added a version of the LLVM/Clang checkout and
build script that applies any local patches to
LLVM/Clang.

llvm-svn: 146811
2011-12-17 02:00:57 +00:00
Sean Callanan 4b72920796 Updating Xcode project version numbers for LLDB-96
and debugserver-156.

llvm-svn: 146808
2011-12-17 01:43:50 +00:00
Jim Ingham 73ca05a2a0 Add the ability to capture the return value in a thread's stop info, and print it
as part of the thread format output.
Currently this is only done for the ThreadPlanStepOut.
Add a convenience API ABI::GetReturnValueObject.
Change the ValueObject::EvaluationPoint to BE an ExecutionContextScope, rather than
trying to hand out one of its subsidiary object's pointers.  That way this will always
be good.

llvm-svn: 146806
2011-12-17 01:35:57 +00:00
Greg Clayton 3cac132d05 Modified LLDB to be able to handle our updated __apple_types accelerator tables
which have the dwarf DIE tag (DW_TAG_XXX enum) and TypeFlags for each type.

llvm-svn: 146802
2011-12-17 01:16:39 +00:00
Sean Callanan e71e5cae5c I have added a new patch to LLVM that makes the
enhanced disassembler classify disassemblers by
target triple (as a string) rather than just by
the architecture component of the triple.  This
fixes a problem where different variants of the
Thumb instruction set were lumped into the same
hash bucket.

llvm-svn: 146799
2011-12-17 00:59:49 +00:00
Jim Ingham 105d7234df Remove an unnecessary #include.
llvm-svn: 146798
2011-12-17 00:58:46 +00:00
Jim Ingham f7f36dc694 Make the objc-dynamic-value test a little trickier (still passes) and test the GetDynamicValue API.
llvm-svn: 146777
2011-12-16 23:24:58 +00:00
Johnny Chen b456b792e0 http://llvm.org/bugs/show_bug.cgi?id=11588
valobj.AddressOf() returns None when an address is expected in a SyntheticChildrenProvider

Patch from Enrico Granata:

The problem was that the frozen object created by the expression parser was a copy of the contents of the StgClosure, rather than a pointer to it. Thus, the expression parser was correctly computing the result of the arithmetic&cast operation along with its address, but only saving it in the live object. This meant that the frozen copy acted as an address-less variable, hence the problem.

The fix attached to this email lets the expression parser store the "live address" in the frozen copy of the address when the object is built without a valid address of its own.
Doing so, along with delegating ValueObjectConstResult to calculate its own address when necessary, solves the issue. I have also added a new test case to check for regressions in this area, and checked that existing test cases pass correctly.

llvm-svn: 146768
2011-12-16 23:04:52 +00:00
Sean Callanan bb12004c38 Updated Clang to take an enhancement to the way
we handle Objective-C method calls.  Currently,
LLDB treats the result of an Objective-C method
as unknown if the type information doesn't have
the method's signature.  Now Clang can cast the
result to id if it isn't explicitly cast.

I also added a test case for this, as well as a
fix for a type import problem that this feature
exposed.

llvm-svn: 146756
2011-12-16 21:06:35 +00:00
Greg Clayton b5c39fe9cc Handle all of the "thumb" target triple architecture variants that llvm
handles.

llvm-svn: 146746
2011-12-16 18:15:52 +00:00
Jason Molenda 9d828ac0aa When we're unwinding out of frame 0 and we end up with a bogus frame
1 -- an address pointing off into non-executable memory -- don't
abort the unwind.  We'll use the ABI's default UnwindPlan to try
to get out of frame 1 and on many platforms with a standard frame
chain stack layout we can get back on track and get a valid frame
2.  This preserves the lldb behavior to-date; the change last week
to require the memory region to be executable broke it.

I'd like to mark this frame specially when displayed to the user;
I tried to override the places where the frame's pc value is returned
to change it to a sentinel value (e.g. LLDB_INVALID_ADDRESS) but
couldn't get that to work cleanly so I backed that part out for
now.  When this happens we'll often miss one of the user's actual
frames, the one that's of most interest to the user, so I'd like
to make this visually distinctive.

Note that a frame in non-executable memory region is only allowed
for frame 1.  After that we should be solid on the unwind and any
pc address in non-executable memory indicates a failure and we
should stop unwinding.

llvm-svn: 146723
2011-12-16 04:30:31 +00:00
Johnny Chen 7cc3d31e15 Simplify the setup leading to the testing of ReadMemory(), ReadCStringFromMemory(), and ReadUnsignedFromMemory().
Instead of getting the location of the variable and converting the hex string to an int, just use
val.AddressOf().GetValueAsUnsigned() to compute the address of the memory region to read from.

llvm-svn: 146719
2011-12-16 01:56:27 +00:00
Jim Ingham 30b74fa886 Remove unnecessary #include.
llvm-svn: 146717
2011-12-16 00:46:12 +00:00
Johnny Chen e7e8af807a Add a test sequence of SBProcess.ReadCStringFromMemory() with (char *)my_char_ptr as the address to read from.
char *my_char_ptr = (char *)"Does it work?";

llvm-svn: 146716
2011-12-16 00:25:30 +00:00
Jim Ingham 918533bcfe Fix a bug where when debugging with .o files, we end up with two symbols for each real OBJC_CLASS_$_whatever, one of which is correctly classified as an ObjCClass symbol, and the other is just a data symbol. This was messing up the ObjC dynamic type detection.
<rdar://problem/10589527>

llvm-svn: 146712
2011-12-16 00:05:58 +00:00
Johnny Chen 6e55cd5e29 Add test scenario for newly added SBProcess APIs: ReadCStringFromMemory() and ReadUnsignedFromMemory().
llvm-svn: 146704
2011-12-15 23:30:05 +00:00
Johnny Chen 10437fd336 Add fuzz call for newly added method SBTarget.GetInstructions().
llvm-svn: 146696
2011-12-15 22:45:30 +00:00
Johnny Chen 80e3e84ddb Add fuzz calls for newly added SBProcess methods. Fix a typo in the audodoc of SBProcess.ReadCStringFromMemory().
llvm-svn: 146695
2011-12-15 22:34:59 +00:00
Johnny Chen 1917bc8de4 Move disassemble-raw-data dir to reside under test/python_api where they belong.
Add debug statements for the raw bytes and the disassembled instruction.

llvm-svn: 146676
2011-12-15 19:56:28 +00:00
Greg Clayton 58c33f8f0b Bumped Xcode project version to lldb-95 and debugserver-155.
llvm-svn: 146643
2011-12-15 05:23:23 +00:00
Greg Clayton f9322415dc <rdar://problem/10584789>
Added a static memory pressure function in SBDebugger:

    void SBDebugger::MemoryPressureDetected ()

This can be called by applications that detect memory pressure to cause LLDB to release cached information.

llvm-svn: 146640
2011-12-15 04:38:41 +00:00
Greg Clayton e91b7957b2 Expose new read memory fucntion through python in SBProcess:
size_t
    SBProcess::ReadCStringFromMemory (addr_t addr, void *buf, size_t size, lldb::SBError &error);

    uint64_t
    SBProcess::ReadUnsignedFromMemory (addr_t addr, uint32_t byte_size, lldb::SBError &error);

    lldb::addr_t
    SBProcess::ReadPointerFromMemory (addr_t addr, lldb::SBError &error);

These ReadCStringFromMemory() has some SWIG type magic that makes it return the
python string directly and the "buf" is not needed:

error = SBError()
max_cstr_len = 256
cstr = lldb.process.ReadCStringFromMemory (0x1000, max_cstr_len, error)
if error.Success():
    ....

The other two functions behave as expteced. This will make it easier to get integer values
from the inferior process that are correctly byte swapped. Also for pointers, the correct
pointer byte size will be used.

Also cleaned up a few printf style warnings for the 32 bit lldb build on darwin.

llvm-svn: 146636
2011-12-15 03:14:23 +00:00
Johnny Chen 95873a68f4 http://llvm.org/bugs/show_bug.cgi?id=11579
lldb::SBValue::CreateValueFromAddress does not verify SBType::GetPointerType succeeds

SBValue::CreateValueFromAddress() should check the validity of type and its derived pointer type
before using it.  Add a test case.

llvm-svn: 146629
2011-12-15 01:55:36 +00:00
Sean Callanan 50952e9571 I have added a function to SBTarget that allows
clients to disassemble a series of raw bytes as
demonstrated by a new testcase.

In the future, this API will also allow clients
to provide a callback that adds comments for
addresses in the disassembly.

I also modified the SWIG harness to ensure that
Python ByteArrays work as well as strings as
sources of raw data.

llvm-svn: 146611
2011-12-14 23:49:37 +00:00
Johnny Chen a2b514a3f2 Add more robustness - use PyString_CheckExact(pvalue) to check whether pvalue is a Python string before
calling PyString_AsString(pvalue).  Similar to http://llvm.org/viewvc/llvm-project?rev=146584&view=rev.

llvm-svn: 146606
2011-12-14 23:27:53 +00:00
Johnny Chen 1d9cb8a184 http://llvm.org/bugs/show_bug.cgi?id=11569
LLDBSwigPythonCallCommand crashes when a command script returns an object 

Add more robustness to LLDBSwigPythonCallCommand.  It should check whether the returned Python object
is a string, and only assign it as the error msg when the check holds.
Also add a regression test.

llvm-svn: 146584
2011-12-14 20:40:27 +00:00
Jason Molenda 4f6f5f9cd2 On Mac OS X the Objective-C runtime (libobjc) has many critical
dispatch functions that are implemented in hand-written assembly.
There is also hand-written eh_frame instructions for unwinding
from these functions.

Normally we don't use eh_frame instructions for the currently
executing function, prefering the assembly instruction profiling
method.  But in these hand-written dispatch functions, the
profiling is doomed and we should use the eh_frame instructions.

Unfortunately there's no easy way to flag/extend the eh_frame/debug_frame
sections to annotate if the unwind instructions are accurate at
all addresses ("asynchronous") or if they are only accurate at locations
that can throw an exception ("synchronous" and the normal case for 
gcc/clang generated eh_frame/debug_frame CFI).

<rdar://problem/10508134>

llvm-svn: 146551
2011-12-14 04:22:18 +00:00
Johnny Chen c6770763e6 http://llvm.org/bugs/show_bug.cgi?id=11560 lldb::SBTarget::FindFirstType crashes when passed None
Add null checks to several functions.  Plus add test scenario for passing None to SBTarget.FindFirstType(None) and friends.

llvm-svn: 146540
2011-12-14 01:43:31 +00:00
Johnny Chen 798b0c8340 Print out the breakpoint description only if self.TraceOn() is True.
llvm-svn: 146539
2011-12-14 01:36:04 +00:00
Sean Callanan fc4f2fb0da This commit is the result of a general audit of
the expression parser to locate instances where
dyn_cast<>() and isa<>() are used on types, and
replace them with getAs<>() as appropriate.

The difference is that dyn_cast<>() and isa<>()
are essentially LLVM/Clang's equivalent of RTTI
-- that is, they try to downcast the object and
return NULL if they cannot -- but getAs<>() can
traverse typedefs to perform a semantic cast.

llvm-svn: 146537
2011-12-14 01:13:04 +00:00
Jason Molenda 87698349b3 Add two new memory region based checks to the Unwinder:
Check that the pc value for frames up the stack is in a
mapped+executable region of memory.

Check that the stack pointer for frames up the stack is
in a mapped+readable region of memory.

If the unwinder ever makes a mistake walking the stack,
these checks will help to keep it from going too far into
the weeds.

These aren't fixing any bugs that I know of, but they
add extra robustness to a complicated task.

llvm-svn: 146478
2011-12-13 06:00:49 +00:00
Jason Molenda cb349ee19c When unwinding from the first frame, try to ask the remote debugserver
if this is a mapped/executable region of memory.  If it isn't, we've jumped
through a bad pointer and we know how to unwind the stack correctly based
on the ABI.  

Previously I had 0x0 special cased but if you jumped to 0x2 on x86_64 one
frame would be skipped because the unwinder would try using the x86_64 
ArchDefaultUnwindPlan which relied on the rbp.

Fixes <rdar://problem/10508291>

llvm-svn: 146477
2011-12-13 05:39:38 +00:00
Greg Clayton 8eb732e9e5 Use forward declarations more of the time to save on things that we need to
parse.

llvm-svn: 146473
2011-12-13 04:34:06 +00:00
Jim Ingham e81fc8e514 Add a pthreads testcase to make sure the two-step of running and expression,
having the block, then timing out & letting all threads run actually works.

llvm-svn: 146471
2011-12-13 04:04:44 +00:00
Sean Callanan d5cc132b98 I have modified the part of the code that finds and
validates the "self," "this," and "_cmd" pointers
that get passed into expressions.  It used to check
them aggressively for validity before allowing the
expression to run as an object method; now, this
functionality is gated by a bool and off by default.

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

llvm-svn: 146465
2011-12-13 01:42:04 +00:00
Greg Clayton 799c7f914c Fixed the Xcode project to correctly not strip anything for Debug and Release builds.
Modified the Xcode project to not strip liblldb-core.a for BuildAndIntegration builds
and to correctly strip only debug symbols from the command line binaries.

llvm-svn: 146462
2011-12-13 01:12:21 +00:00
Johnny Chen 055d0c961b Rename some test methods, with no functionality change.
llvm-svn: 146429
2011-12-12 22:26:27 +00:00
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