Commit Graph

620 Commits

Author SHA1 Message Date
Johnny Chen bce48fb06f Removed the @expectedFailure decorator for test_with_dwarf() test case. It has
been fixed.

llvm-svn: 113981
2010-09-15 16:59:20 +00:00
Greg Clayton d88d759a74 15-20% speed improvement when parsing DWARF. I used instruments to
find the hotspots in our code when indexing the DWARF. A combination of
using SmallVector to avoid collection allocations, using fixed form
sizes when possible, and optimizing the hot loops contributed to the
speedup.

llvm-svn: 113961
2010-09-15 08:33:30 +00:00
Caroline Tice 7d9edf670b Modify "settings list" so you can specify a particular instance setting name,
or a settings prefix, and it will list information about the subset of settings
you requested.  Also added tab-completion (now that it takes an optional argument).

llvm-svn: 113952
2010-09-15 06:56:39 +00:00
Greg Clayton 6dbd39838d Fixed a missing newline when dumping mixed disassembly.
Added a "bool show_fullpaths" to many more objects that were
previously always dumping full paths.

Fixed a few places where the DWARF was not indexed when we
we needed it to be when making queries. Also fixed an issue
where the DWARF in .o files wasn't searching all .o files
for the types.

Fixed an issue with the output from "image lookup --type <TYPENAME>"
where the name and byte size might not be resolved and might not
display. We now call the accessors so we end up seeing all of the
type info.

llvm-svn: 113951
2010-09-15 05:51:24 +00:00
Caroline Tice ded2fa3991 Remove all visible uses of "[DEFAULT]" instance name.
Add ability to rename UserSettingsInstances after they have been created
(via UserSettingsController::RenameInstanceSettings.

llvm-svn: 113950
2010-09-15 05:35:14 +00:00
Greg Clayton 86c3f345c6 Fixed a race condition that was sometimes stopping our command line
interpreter from working. The communication read thread could
startup and immediately exit if m_read_thread_enabled was
checked in the thread function before it was set by the
thread that spawns the read thread. Now m_read_thread_enabled is set
to true prior to spawning the read thread to avoid this issue.

Hopefully this will clear up the sporatic failures in our test suite.

llvm-svn: 113947
2010-09-15 05:19:45 +00:00
Greg Clayton c685f8e540 So we can't use .debug_pubtypes as it, as designed, does not tell us about
all types in all compile units. I added a new kind of accelerator table to
the DWARF that allows us to index the DWARF compile units and DIEs in a way
that doesn't require the data to stay loaded. Currently when indexing the
DWARF we check if the compile unit had parsed its DIEs and if it hasn't we
index the data and free all of the DIEs so we can reparse later when we need
to after using one of our complete accelerator tables to determine we need
to reparse some DWARF. If the DIEs had already been parsed we leave them 
loaded. The new accelerator table uses the "const char *" pointers from our
ConstString class as the keys, and NameToDIE::Info as the value. This info
contains the compile unit index and the DIE index which means we are pointed
right to the DIE we need unlike the other DWARF accelerator tables that often
just point us to the compile unit we would find our answer in. 

llvm-svn: 113933
2010-09-15 04:15:46 +00:00
Jim Ingham 3a0b9cdf47 If you have already loaded a file into the debugger, "process attach" will attach to a process with the filename, unless you specify otherwise.
llvm-svn: 113916
2010-09-15 01:34:14 +00:00
Jim Ingham 89bf5e9105 The Mangled name comparision should prefer the mangled name.
llvm-svn: 113908
2010-09-15 00:13:44 +00:00
Jim Ingham af0f17596c Adding a bit more logging.
llvm-svn: 113907
2010-09-15 00:06:51 +00:00
Johnny Chen 93f336a203 Fixed typo in the doc strings.
llvm-svn: 113906
2010-09-15 00:02:30 +00:00
Johnny Chen ae74556ff6 Added two test cases to exercise 'expr this->m_c_int' with @expectedFailure
decorators for the time being.

llvm-svn: 113905
2010-09-15 00:00:54 +00:00
Greg Clayton 17f692087a Clear the section list when a our current process is destroyed.
Add missing files that I forgot to checkin.

llvm-svn: 113902
2010-09-14 23:52:43 +00:00
Johnny Chen 32a7044a84 Updated to add a printf() stmt.
llvm-svn: 113901
2010-09-14 23:49:44 +00:00
Greg Clayton d0b89f8cc2 Fixed a case where Mangled::GetName(...) could return a invalid demangled name when one could be calculated.
llvm-svn: 113900
2010-09-14 23:48:44 +00:00
Greg Clayton 8742543591 Fixed a compiler warning.
llvm-svn: 113899
2010-09-14 23:44:49 +00:00
Greg Clayton f5e56de080 Moved the section load list up into the target so we can use the target
to symbolicate things without the need for a valid process subclass.

llvm-svn: 113895
2010-09-14 23:36:40 +00:00
Johnny Chen 1d8ab8a26b Test order file with both dsym and dwarf combination.
llvm-svn: 113884
2010-09-14 22:55:48 +00:00
Johnny Chen 6c3f6862cc Need to call self.buildDefault() before running the test logic.
llvm-svn: 113881
2010-09-14 22:50:50 +00:00
Caroline Tice e7e92b771a Remove help text that is no longer correct.
Fix Python script interpreter to not fail when the Debugger does
not have input/output file handles.

llvm-svn: 113880
2010-09-14 22:49:06 +00:00
Johnny Chen e049051e68 More appropriate headings for the traceoutput: stdout & stderr.
llvm-svn: 113879
2010-09-14 22:39:02 +00:00
Johnny Chen d0c40ddfc6 Added logging of an error message in GDBRemoteCommunication::SendPacketNoLock()
if sending of the packet fails for any reason.

llvm-svn: 113874
2010-09-14 22:10:43 +00:00
Jim Ingham 08b87e0ded Add the ability for "ThreadPlanRunToAddress" to run to multiple addresses.
Added the ability to specify a preference for mangled or demangled to Mangled::GetName.
Changed one place where mangled was prefered in GetName.
The Dynamic loader should look up the target of a stub by mangled name if it exists.

llvm-svn: 113869
2010-09-14 22:03:00 +00:00
Johnny Chen 1aad5c61f8 Removed the expectedFailure decorator from test_with_dwarf_and_run_command() test case
as it now passes.  Added some extra tests to breakpoint_creation_by_filespec_python().

More clarification for the "os command" output and error as defined in
lldbtest.system() function.

Cleaned up the option processing of the test driver (dotest.py) and fixed the comment
about enabling gdb-remote logging.  Example:

$ GDB_REMOTE_LOG=/tmp/log.txt ./dotest.py -v -t enum_types

llvm-svn: 113868
2010-09-14 22:01:40 +00:00
Sean Callanan 44096b1a7e Added code to support use of "this" and "self" in
expressions.  This involved three main changes:

 - In ClangUserExpression::ClangUserExpression(),
   we now insert the following lines into the
   expression:
     #define this ___clang_this
     #define self ___clang_self

 - In ClangExpressionDeclMap::GetDecls(), we
   special-case ___clang_(this|self) and instead
   look up "this" or "self"

 - In ClangASTSource, we introduce the capability
   to generate Decls with a different, overridden,
   name from the one that was requested, e.g.
   this for ___clang_this.

llvm-svn: 113866
2010-09-14 21:59:34 +00:00
Greg Clayton 95112df653 Fixed display for long double and cleaned up float and doubles as well.
llvm-svn: 113832
2010-09-14 04:09:57 +00:00
Greg Clayton a52c155e01 Fixed an issue that was always causing an extra empty argument to be sent
to any inferior process because the code was checking if no run args were
set and then adding and empty string. This was happening for environment
vars as well.

llvm-svn: 113831
2010-09-14 03:47:41 +00:00
Greg Clayton 6f00abd546 Fixed the implementation of "bool Block::Contains (const Block *block) const"
to return the correct result.

Fixed "bool Variable::IsInScope (StackFrame *frame)" to return the correct
result when there are no location lists.

Modified the "frame variable" command such that:
- if no arguments are given (dump all frame variables), then we only show
  variables that are currently in scope
- if some arguments are given, we show an error if the variable is out of 
  scope

llvm-svn: 113830
2010-09-14 03:16:58 +00:00
Greg Clayton 016a95eb04 Looking at some of the test suite failures in DWARF in .o files with the
debug map showed that the location lists in the .o files needed some 
refactoring in order to work. The case that was failing was where a function
that was in the "__TEXT.__textcoal_nt" in the .o file, and in the 
"__TEXT.__text" section in the main executable. This made symbol lookup fail
due to the way we were finding a real address in the debug map which was
by finding the section that the function was in in the .o file and trying to
find this in the main executable. Now the section list supports finding a
linked address in a section or any child sections. After fixing this, we ran
into issue that were due to DWARF and how it represents locations lists. 
DWARF makes a list of address ranges and expressions that go along with those
address ranges. The location addresses are expressed in terms of a compile
unit address + offset. This works fine as long as nothing moves around. When
stuff moves around and offsets change between the remapped compile unit base
address and the new function address, then we can run into trouble. To deal
with this, we now store supply a location list slide amount to any location
list expressions that will allow us to make the location list addresses into
zero based offsets from the object that owns the location list (always a
function in our case). 

With these fixes we can now re-link random address ranges inside the debugger
for use with our DWARF + debug map, incremental linking, and more.

Another issue that arose when doing the DWARF in the .o files was that GCC
4.2 emits a ".debug_aranges" that only mentions functions that are externally
visible. This makes .debug_aranges useless to us and we now generate a real
address range lookup table in the DWARF parser at the same time as we index
the name tables (that are needed because .debug_pubnames is just as useless).
llvm-gcc doesn't generate a .debug_aranges section, though this could be 
fixed, we aren't going to rely upon it.

Renamed a bunch of "UINT_MAX" to "UINT32_MAX".

llvm-svn: 113829
2010-09-14 02:20:48 +00:00
Johnny Chen c13ee52c2f Fixed an error in Debugger::UpdateExecutionContext() where an invalid index ID 0
was used to set the selected thread if none was selected.  Use a more robust
API to accomplish the task.

Also fixed an error found, while investigating, in CommandObjectThreadSelect::
Execute() where the return status was not properly set if successful.

As a result, both the stl step-in test cases with expectedFailure decorators now
passed.

llvm-svn: 113825
2010-09-14 00:53:53 +00:00
Sean Callanan 9e6ed53ea5 Bugfixes to the expression parser. Fixes include:
- If you put a semicolon at the end of an expression,
   this no longer causes the expression parser to
   error out.  This was a two-part fix: first,
   ClangExpressionDeclMap::Materialize now handles
   an empty struct (such as when there is no return
   value); second, ASTResultSynthesizer walks backward
   from the end of the ASTs until it reaches something
   that's not a NullStmt.

 - ClangExpressionVariable now properly byte-swaps when
   printing itself.

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

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

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

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

llvm-svn: 113789
2010-09-13 21:34:21 +00:00
Johnny Chen 1394a4b715 Extend the build mechanism to allow for specifying the compiler used to build
the binaries.

If the build* function is passed the compiler argument, for example, 'llvm-gcc',
it is passed as a make variable to the make command.  Otherwise, we check the
LLDB_CC environment variable; if it is defined, it is passed as a make variable
to the make command.

If neither the compiler keyword argument nor the LLDB_CC environment variable is
specified, no CC make variable is passed to the make command.  The Makefile gets
to define the default CC being used.

--------------------------------------------------------------------------------
Example usage follows:

o Via the keyword argument:

class ArrayTypesTestCase(TestBase):

    mydir = "array_types"

    @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
    def test_with_dsym_and_run_command(self):
        """Test 'frame variable var_name' on some variables with array types."""
        self.buildDsym(compiler='llvm-gcc')
        self.array_types()
...

o Via LLDB_CC environment variable:

$ LLDB_CC=llvm-gcc ./dotest.py -v -t array_types
----------------------------------------------------------------------
Collected 4 tests

test_with_dsym_and_python_api (TestArrayTypes.ArrayTypesTestCase)
Use Python APIs to inspect variables with array types. ... 
os command: [['/bin/sh', '-c', 'make clean; make MAKE_DSYM=YES CC=llvm-gcc']]
output: rm -rf "a.out" "a.out.dSYM"  main.o main.d
llvm-gcc -arch x86_64 -gdwarf-2 -O0 -arch x86_64 -gdwarf-2 -O0  -c -o main.o main.c
llvm-gcc -arch x86_64 -gdwarf-2 -O0  main.o -o "a.out"
/usr/bin/dsymutil  -o "a.out.dSYM" "a.out"

...

llvm-svn: 113781
2010-09-13 20:54:30 +00:00
Johnny Chen 9440d1c008 Updated the expected matching strings.
llvm-svn: 113756
2010-09-13 16:59:11 +00:00
Johnny Chen 661f8069c7 Updated the expected matching strings.
llvm-svn: 113755
2010-09-13 16:45:59 +00:00
Johnny Chen 8458405a36 Updated the expected matching strings, and added a radar comment.
llvm-svn: 113753
2010-09-13 16:31:46 +00:00
Johnny Chen e00234e0c7 Updated the expected matching strings.
llvm-svn: 113751
2010-09-13 16:19:09 +00:00
Johnny Chen eb1b8dabc0 Removed the two expectedFailure decorators from the test cases. They have been fixed.
llvm-svn: 113750
2010-09-13 16:14:55 +00:00
Johnny Chen 9aae728ef6 Updated the expected matching string after the recent flurry of check ins.
llvm-svn: 113748
2010-09-13 16:06:19 +00:00
Caroline Tice 8830091a1a Clean up help text.
llvm-svn: 113738
2010-09-13 05:27:16 +00:00
Greg Clayton ffc1d6672d Fixed an assertion that happened when debugging DWARF in .o files with debug
map on macosx.

llvm-svn: 113737
2010-09-13 04:34:30 +00:00
Greg Clayton 9df87c1706 Make sure we have a variable list so we don't crash when a frame has no
frame variables.

llvm-svn: 113736
2010-09-13 03:44:33 +00:00
Greg Clayton 737b932995 Added the summary values for function pointers so we can show where they
point to.

llvm-svn: 113735
2010-09-13 03:32:57 +00:00
Greg Clayton 5804fa4152 Removed unused variable.
llvm-svn: 113734
2010-09-13 02:54:20 +00:00
Greg Clayton a134cc1bf8 Added a work in the DWARF parser when we parse an array that ends up having
no elements so that they at least have 1 element. 

Added the ability to show the declaration location of variables to the 
"frame variables" with the "--show-declaration" option ("-c" for short).

Changed the "frame variables" command over to use the value object code
so that we use the same code path as the public API does when accessing and
displaying variable values.

llvm-svn: 113733
2010-09-13 02:37:44 +00:00
Greg Clayton 0c5550a998 A few modifications to the class arrays test case.
llvm-svn: 113732
2010-09-13 02:31:18 +00:00
Greg Clayton ac32b4ddc0 I made this example after noting that I was unable to display an unsized
static class array. It turns out that gcc 4.2 will emit DWARF that correctly
describes the PointType, but it will incorrectly emit debug info for the
"g_points" array where the following things are wrong:
 - the DW_TAG_array_type won't have a subrange info
 - the DW_TAG_variable for "g_points" won't have a valid byte size, so even
   though we know the size of PointType, we can't infer the actual size
   of the array by dividing the size of the variable by the number of
   elements.

We want to make sure clang and llvm-gcc handle this correctly.

llvm-svn: 113730
2010-09-13 00:50:27 +00:00
Greg Clayton 83ff3898f7 Fixed a crash that would happen when using "frame variables" on any struct,
union, or class that contained an enumeration type. When I was creating
the clang enumeration decl, I wasn't calling "EnumDecl::setIntegerType (QualType)" 
which means that if the enum decl was ever asked to figure out it's bit width
(getTypeInfo()) it would crash. We didn't run into this with enum types that 
weren't inside classes because the DWARF already told us how big the type was
and when we printed an enum we would never need to calculate the size, we
would use the pre-cached byte size we got from the DWARF. When the enum was 
in a struct/union/class and we tried to layout the struct, the layout code
would attempt to get the type info and segfault.

llvm-svn: 113729
2010-09-12 23:17:56 +00:00
Greg Clayton fd26915742 Bug #: 8408441
Fixed an issue where LLDB would fail to set a breakpoint by
file and line if the DWARF line table has multiple file entries
in the support files for a source file.

llvm-svn: 113721
2010-09-12 06:24:05 +00:00
Greg Clayton 0c38b0deb8 Fixed an issue I found in the mach-o symbol table parsing where
we cached remapping information using the old nlist index to the
new symbol index, yet we tried to lookup the symbol stubs that
were for symbols that had been remapped by ID instead of using
the new symbol index. This is now fixed and the mach-o symbol tables
are fixed.

Use the delta between two vector entries to determine the stride
in case any padding is inserted by compilers for bsearch calls
on symbol tables when finding symbols by their original ID.

llvm-svn: 113719
2010-09-12 05:25:16 +00:00
Caroline Tice 86ddae50f6 Add 'unalias' to the commands sub-command dictionary.
llvm-svn: 113715
2010-09-12 04:56:10 +00:00