Commit Graph

4277 Commits

Author SHA1 Message Date
Johnny Chen fb05d23789 Add some description for this test directory.
llvm-svn: 148075
2012-01-13 00:24:11 +00:00
Johnny Chen 7840c81df2 Modify a couple of Makefiles to use clang instead of gcc, since gcc is being deprecated.
llvm-svn: 148071
2012-01-12 23:50:28 +00:00
Johnny Chen fe14162e71 rdar://problem/10680957
Need a test case that tests DWARF with .o in .a files

test/functionalities/archives:

Produces libfoo.a from a.o and b.o.  Test breaking inside functions defined
inside the libfoo.a BSD Archive.

test/make/makefile.rules:

Some additional rules to sepcify archive building.  For example:

ARCHIVE_NAME := libfoo.a
ARCHIVE_C_SOURCES := a.c b.c

llvm-svn: 148066
2012-01-12 23:09:42 +00:00
Jim Ingham 18f4629c78 Discriminate between the lldb_private::Type's for ObjC Classes that come from debug info, and those that
are made up from the ObjC runtime symbols.  For now the latter contain nothing but the fact that the name
describes an ObjC class, and so are not useful for things like dynamic types.

llvm-svn: 148059
2012-01-12 22:45:31 +00:00
Jim Ingham 5cfbe4aa53 Fix a comment typo.
llvm-svn: 148057
2012-01-12 22:42:34 +00:00
Jim Ingham 50b3d507bd Let the Module FindType do the stripping of namespace components, that's not expensive
and doing it both at the ModuleList and Module levels means we look 4 times for a negative
search.  Also, don't do the search for the stripped name if that is the same as the original
one.

llvm-svn: 148054
2012-01-12 22:35:29 +00:00
Greg Clayton 4d4c988c6a Bumped Xcode project versions for lldb-104 and debugserver-163.
llvm-svn: 148018
2012-01-12 05:29:50 +00:00
Greg Clayton 44435ed07a Big change in the way ObjectFile file contents are managed. We now
mmap() the entire object file contents into memory with MAP_PRIVATE.
We do this because object file contents can change on us and currently
this helps alleviate this situation. It also make the code for accessing
object file data much easier to manage and we don't end up opening the
file, reading some data and closing the file over and over.

llvm-svn: 148017
2012-01-12 05:25:17 +00:00
Greg Clayton c7f03b6155 <rdar://problem/10681814>
Fix DWARF parsing issue we can run into when using llvm-gcc based dSYM files.

Also fix the parsing of objective C built-in types (Class, id and SEL) so
they don't parse more information that is not needed due to the way they
are represented in DWARF.

llvm-svn: 148016
2012-01-12 04:33:28 +00:00
Jim Ingham c07fe69850 Don't dereference the oso_dwarf without checking for NULL.
llvm-svn: 148005
2012-01-12 01:45:53 +00:00
Greg Clayton fa8c004aba Revert some changes I did for logging that affected the ability to
load .o files in BSD archive parsing.

llvm-svn: 147987
2012-01-12 01:21:31 +00:00
Johnny Chen 5886fb5bd3 rdar://problem/10492827
SBProcess.GetSTDERR() not getting stderr of the launched process

Since we are launch the inferior with:

    process = target.LaunchSimple(None, None, os.getcwd())

i.e., without specifying stdin/out/err.  A pseudo terminal is used for
handling the process I/O, and we are satisfied once the expected output
appears in process.GetSTDOUT().

llvm-svn: 147983
2012-01-12 00:29:46 +00:00
Sean Callanan ee458a7785 After thinking about it, it doesn't seem right
to make assumptions if the type is unsized.  We
just give up (and let the JIT handle it) instead.

llvm-svn: 147915
2012-01-11 02:23:25 +00:00
Jim Ingham c354928786 Don't assert but report & return a NULL type if we end up parsing a type we are in the middle of parsing.
llvm-svn: 147914
2012-01-11 02:21:12 +00:00
Johnny Chen 4876b5fccd Add more usage examples.
llvm-svn: 147909
2012-01-11 01:59:55 +00:00
Greg Clayton 8b35334e0c Fixed a missing space when reporting errors and warning through the module
and also print out the full path and architecture.

llvm-svn: 147908
2012-01-11 01:59:18 +00:00
Johnny Chen e9f97704ea Add usage examples of recently added functionality.
llvm-svn: 147907
2012-01-11 01:42:58 +00:00
Sean Callanan 285e4b22f5 If the size of a type can't be determined, default
to assume it's of pointer size.

llvm-svn: 147906
2012-01-11 01:36:21 +00:00
Johnny Chen 17b4ea54bf Snapshot of initial work for ARM watchpoint support on the debugserver.
It is incomplete and untested; passes the compilation only.

llvm-svn: 147901
2012-01-11 00:35:13 +00:00
Johnny Chen c260232dfa Add comment for build_and_run_with_source_atoms_expr() and remove redundant #include from basic_type.cpp.
llvm-svn: 147895
2012-01-10 23:36:06 +00:00
Johnny Chen 0d81fe7a77 Add documentation for the generic functions build_and_run() and build_and_run_expr() called from
the Test*Types*.py test cases.

llvm-svn: 147893
2012-01-10 23:22:57 +00:00
Greg Clayton 8ffc4f11ce Disable ARMDisassembler.framework support which was used for software single stepping.
llvm-svn: 147886
2012-01-10 22:33:56 +00:00
Jim Ingham 82283e8e91 Check the return value of GetBasicInfo before dereferencing it. <rdar://problem/10568492>
llvm-svn: 147883
2012-01-10 22:21:42 +00:00
Sean Callanan 30ce74f9b4 Updating Xcode project version numbers for lldb-103 and debugserver-162
llvm-svn: 147865
2012-01-10 18:37:32 +00:00
Jim Ingham f714d3d7f2 As we are grubbing through memory chasing down the hierarchy of an ObjC object, protect against the possibility that that object might be just random memory with loops.
llvm-svn: 147838
2012-01-10 03:58:23 +00:00
Greg Clayton 7d7850af64 Since clang modifies .o files in place, use MAP_PRIVATE as it seems
to fix the issues we run into on darwin even though the docs don't
seems to say it will.

llvm-svn: 147835
2012-01-10 02:53:13 +00:00
Greg Clayton 99e6e2f6f0 Fix for linux build.
llvm-svn: 147834
2012-01-10 02:52:21 +00:00
Jim Ingham aa1bc80f5d Don't call lldb_private::Process::GetLoadAddressPermissions to sanity check the unwind addresses
when you already know that the address is contained in a bona fide function.  This can be a 
slow call.

llvm-svn: 147829
2012-01-10 02:14:47 +00:00
Johnny Chen c256b99a17 Refactor the test/types directory to reduce some stupid reduant code.
Also add test cases to the test suite to exercise displaying of variables captured inside a block (Darwin-only).

llvm-svn: 147828
2012-01-10 02:04:04 +00:00
Johnny Chen 38ef9a9b94 Fix make errors (define the DYLIB_ONLY make variable).
llvm-svn: 147823
2012-01-10 01:29:35 +00:00
Johnny Chen beac8f991f Add a CFLAGS_EXTRAS make variable to be able to pass things (like '-DTEST_BLOCK_CAPTURED_VARS') to the compile phase.
Plus add a DYLIB_ONLY make variable that can be used to turn off compilation/building of a.out. Example:

[16:39:21] johnny:/Volumes/data/lldb/svn/trunk/test/lang/c/global_variables $ make clean
rm -rf "a.out" "a.out.dSYM"  main.o main.d a.o a.d liba.dylib liba.dylib.dSYM
[16:39:24] johnny:/Volumes/data/lldb/svn/trunk/test/lang/c/global_variables $ make DYLIB_ONLY=YES
clang -gdwarf-2 -O0   -arch x86_64   -c -o a.o a.c
clang -gdwarf-2 -O0   -arch x86_64  a.o -install_name "@executable_path/liba.dylib" -dynamiclib -o "liba.dylib"
[16:39:30] johnny:/Volumes/data/lldb/svn/trunk/test/lang/c/global_variables $

llvm-svn: 147821
2012-01-10 00:41:11 +00:00
Greg Clayton 33289908f9 Added a file descriptor interposing library for darwin. This can catch all
functions that can create file descriptors and close them. It will warn when
there close file descriptor call that returns with EBADF and show the 
corresponding stack backtraces that caused the issue. It will also log all
file descriptor create and delete calls. See the comments at the top of
FDInterposing.cpp for all of the details.

llvm-svn: 147816
2012-01-10 00:29:36 +00:00
Greg Clayton e51363857f When doing a "target modules lookup --address <addr>", show the file address
in the module when dumping the information in addition to all info that we
were previously showing.

llvm-svn: 147815
2012-01-10 00:25:18 +00:00
Greg Clayton d50d23808b Update makefile rules to support C++ files in shared libraries and fix how
the linker driver is found.

llvm-svn: 147814
2012-01-10 00:00:15 +00:00
Greg Clayton aecb12b5c6 Make a log timer for the BSD archive creation so we can track the time it
takes to open and index BSD archives.

llvm-svn: 147813
2012-01-09 23:59:30 +00:00
Sean Callanan 8ca9025216 Updating Xcode project version numbers for lldb-102 and debugserver-161
llvm-svn: 147794
2012-01-09 19:41:28 +00:00
Greg Clayton 01a82d1918 Fixed a return value problem with the new ABI::FixCodeAddress () function:
it was checked in as:
 virtual bool ABI::FixCodeAddress (lldb::addr_t pc);

when it should have been:

virtual lldb::addr_t ABI::FixCodeAddress (lldb::addr_t pc);


 

llvm-svn: 147790
2012-01-09 19:23:34 +00:00
Johnny Chen c2a64b9b90 Fix comment.
llvm-svn: 147789
2012-01-09 19:19:23 +00:00
Greg Clayton 4abd6eaaa0 <rdar://problem/10645694>
Fixed an ARM backtracing issue where if the previous frame was a thumb
function and it was a tail call so that the current frame returned to
an address that would fall into the next function, we would use the
next function as the basis for how we unwound the previous frame's
registers and of course get things wrong. We now fix the PC code
address using the current ABI plug-in, and the ARM ABI plug-in has
been modified to correctly fix the code address. So when we do the
symbol context lookup, instead of taking an address like 0x1001 and
decrementing 1, and looking up the symbol context for a frame, we
now correctly fix 0x1001 to 0x1000, then decrement that by 1 to
get the correct symbol context.

I added a bunch more logging to "log enable lldb uwnind" to help
us in the future. We now log the PC, FP and SP (if they are available),
and we also dump the "active_row" that we find for unwinding a frame.

llvm-svn: 147747
2012-01-08 05:54:35 +00:00
Greg Clayton 6e527321b3 <rdar://problem/10660369>
Fixed the default ARM regiter set to be able to refer to "r7" as "fp" for the apple debugserver.

llvm-svn: 147746
2012-01-08 05:49:22 +00:00
Greg Clayton 48ca8b8fe2 Recursive calls to ValueObject::GetSummaryAsCString() are causing crashes.
The previous approach to controlling the recursion was doing it from
outside the function which is not reliable. Now it is being done inside
the function. This might not solve all of the crashes that we were seeing
since there are other functions that clear the bit that indicates that
the summary is in the process of being generated, but it might solve some.

llvm-svn: 147741
2012-01-07 20:58:07 +00:00
Greg Clayton 11c99162c4 <rdar://problem/10658091>
Fixed dynamic types for objective C to not try and make everything dynamic including base classes.

llvm-svn: 147722
2012-01-07 04:21:42 +00:00
Greg Clayton 0f28986a54 Patch from Enrico Granata that moves SBData related functions into the SBData
class instead of requiring a live process in order to be able to create useful
SBData objects.

llvm-svn: 147702
2012-01-07 00:45:50 +00:00
Sean Callanan d1a5e01ff9 Fixed a bug where the DWARF location expression
parser was creating malformed resuls.  When the
location of a variable is computed by reading a
register and adding an offset, we shouldn't say
that the variable's value is located in that
register.  This was confusing the expression
parser when trying to read a variable captured
by a block.

llvm-svn: 147668
2012-01-06 18:24:47 +00:00
Greg Clayton 4017fa399b <rdar://problem/10652336>
Fixed a crasher when trying to load an expression prefix file:

% touch /tmp/carp.txt
% xcrun lldb
(lldb) settings set target.expr-prefix /tmp/carp.txt
Segmentation fault

llvm-svn: 147646
2012-01-06 02:01:06 +00:00
Greg Clayton 1a0be3b1f2 <rdar://problem/10649734>
Fixed an issue where the python interpreter could deadlock LLDB.

llvm-svn: 147640
2012-01-06 00:47:38 +00:00
Johnny Chen 39c6d0f9ae http://llvm.org/bugs/show_bug.cgi?id=11619
Allow creating SBData values from arrays or primitives in Python

Patch submitted by Enrico Granata.

llvm-svn: 147639
2012-01-06 00:46:12 +00:00
Greg Clayton 650e3b014e <rdar://problem/10647191>
Removed an extra call to close that was causing problems and also
now use the Host::File class to open the file.

llvm-svn: 147638
2012-01-06 00:43:54 +00:00
Johnny Chen b49440fa92 http://llvm.org/bugs/show_bug.cgi?id=11618
lldb::SBValue::AddressOf does not work on dereferenced registers in synthetic children provider

Patch submitted by Enrico Granata.

llvm-svn: 147637
2012-01-06 00:35:38 +00:00
Greg Clayton ae920b69f5 We finalized on the new .apple_types accelerator table format where we don't
emit fully qualified names, so now we make sure the DW_TAG values match and
still lookup using the basename.

llvm-svn: 147634
2012-01-06 00:17:16 +00:00
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