Commit Graph

3959 Commits

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

from:

    '(my_uint_t) anon_uint = 0'

to make the test suite clean with ToT.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

OK

...

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

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

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

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

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

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

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

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

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

(lldb) expression/x 3+3

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

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

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

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

So that we can have:

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

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

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

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

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

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

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

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

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

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

(lldb) x/32xb 0x1000

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

There are two modifications:

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

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

llvm-svn: 143065
2011-10-26 21:20:00 +00:00
Greg Clayton 63f8cc6aca Fixed the display of OSTypes (the four character codes).
llvm-svn: 143056
2011-10-26 21:01:16 +00:00
Jim Ingham 1d18ebf62a When completing "help foo bar" if "foo" is not a real command, don't ask its NULL command object to complete the line.
llvm-svn: 143047
2011-10-26 19:32:01 +00:00
Greg Clayton f91381e82c Update the GDB format text to be a bit more clear.
llvm-svn: 143043
2011-10-26 18:35:21 +00:00
Peter Collingbourne 46df6a252a Use full path to ClangForward.h
Fixes Linux build.

llvm-svn: 143038
2011-10-26 17:55:48 +00:00
Sean Callanan 3b1d4f6785 Added a new #define, LLVM_NDEBUG_OFF, that should
be set if linking against an LLVM compiled with
NDEBUG off.  If it is set, we do not enable NDEBUG
in any place where we include LLVM headers.

llvm-svn: 143036
2011-10-26 17:46:51 +00:00
Sean Callanan 580b29f9cb Fixed VerifyDecl to use shared forward declarations.
llvm-svn: 143029
2011-10-26 16:20:57 +00:00
Greg Clayton 82f4cf46aa A simple fix for the GDB format strings so the byte size parameter gets
properly marked as valid.

Also modified the "memory read" command to be able to intelligently repeat
subsequent memory requests, so now you can do:

(lldb) memory read --format hex --count 32 0x1000

Then hit enter to keep viewing the memory that follows the last valid request.

llvm-svn: 143015
2011-10-26 04:32:38 +00:00
Greg Clayton 55561e942b Fixed an issue where a class that resides inside another class wasn't getting
an access specifier set on it, causing an assertion to fire when building
with a Debug+Asserts build of clang.

llvm-svn: 143010
2011-10-26 03:31:36 +00:00
Sean Callanan 5e9e1991e9 Added VerifyDecl, a function that, when LLDB is
linked against a debug LLVM, runs a variety of
functions -- currently just one -- that verify
that the Decls we create are valid.

ClangASTContext now calls this verifier whenever
it adds a Decl to a DeclContext, and the verifier
checks that the AccessSpecifier is sane.

llvm-svn: 143000
2011-10-26 01:06:27 +00:00
Greg Clayton 86edbf41d1 Cleaned up many error codes. For any who is filling in error strings into
lldb_private::Error objects the rules are:
- short strings that don't start with a capitol letter unless the name is a
  class or anything else that is always capitolized
- no trailing newline character
- should be one line if possible

Implemented a first pass at adding "--gdb-format" support to anything that
accepts format with optional size/count.

llvm-svn: 142999
2011-10-26 00:56:27 +00:00
Johnny Chen 457e786932 Fix typo in the docstring.
llvm-svn: 142996
2011-10-26 00:44:40 +00:00
Johnny Chen 6e5b330fb4 Add another metric for startup delay -- run to breakpoint, which measures the time from issuing
the run command till the first breakpoint hit.  Example:

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

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

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

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

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

OK

llvm-svn: 142949
2011-10-25 20:08:03 +00:00
Sean Callanan c70ed46dda Improved handling of static data in the expression
parser.  Now expression like the following work as
expected:

-
(lldb) expr struct { int a; int b; } $blah = { 10, 20 }
<no result>
(lldb) expr $blah
(<anonymous struct at Parse:6:5>) $blah = {
  (int) a = 10
  (int) b = 20
}
-

Now the IRForTarget subsystem knows how to handle
static initializers of various composite types.

Also removed an unnecessary parameter from
ClangExpressionDeclMap::GetFunctionInfo.

llvm-svn: 142936
2011-10-25 18:36:40 +00:00
Sean Callanan f463856fd0 Fixed our handling of const functions, compensating
for debug information that occasionally gets the
const-ness of member functions wrong.  We used to
demangle the name, add "const," and remangle it; now
we handle the mangled name directly, which is more
robust.

llvm-svn: 142933
2011-10-25 18:02:05 +00:00
Johnny Chen 3d0fcf5eae Patch from Dragos to fix Linux build!
llvm-svn: 142932
2011-10-25 17:58:16 +00:00
Greg Clayton 1deb796238 Updated all commands that use a "--format" / "-f" options to use the new
OptionGroupFormat. Updated OptionGroupFormat to be able to also use the
"--size" and "--count" options. Commands that use a OptionGroupFormat instance
can choose which of the options they want by initializing OptionGroupFormat
accordingly. Clients can either get only the "--format", "--format" + "--size",
or "--format" + "--size" + "--count". This is in preparation for upcoming
chnages where there are alternate ways (GDB format specification) to set a
format. 

llvm-svn: 142911
2011-10-25 06:44:01 +00:00
Jason Molenda 0c8e006987 Prefix display/undisplay regexp command alises with "_regexp" as per the
style of the other regexp command aliases.

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

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

llvm-svn: 142897
2011-10-25 01:25:35 +00:00
Greg Clayton 5196416772 Simplified the CommandInterpreter::StripFirstWord logic by making it a static
function and having it not require both a bool and a quote char to fill in.
We intend to get rid of this functionality when we rewrite the command 
interpreter for streams eventually, but not for now.

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

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

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

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

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

llvm-svn: 142825
2011-10-24 18:24:54 +00:00
Johnny Chen e5b190304d Removed the @expectedFailure decorators from test cases. They have been fixed with the r142717 check-in.
llvm-svn: 142823
2011-10-24 18:11:16 +00:00
Enrico Granata 47c6f6d43d Decoupling of lock-related code from the core of ScriptInterpreterPython. All that concerns locking the Python interpreter is now delegated to the internal ScriptInterpreterPython::Locker class. Several changes in ScriptInterpreterPython to accommodate this new pattern.
llvm-svn: 142802
2011-10-24 17:22:21 +00:00
Benjamin Kramer 1695466fe3 Move Python.h includes out of the headers into the .cpp file where it's actually used.
Python.h includes a ton of macros that can cause weird behavior down the road.

llvm-svn: 142754
2011-10-23 16:49:03 +00:00
Benjamin Kramer d34a329c68 Remove unused include of deprecated header.
llvm-svn: 142753
2011-10-23 16:31:38 +00:00
Greg Clayton 607ddc571e Bumped versions for lldb-81 and debugserver-146.
llvm-svn: 142718
2011-10-22 03:38:38 +00:00
Greg Clayton f0705c8b90 Added template support when parsing DWARF into types. We can now use STL
classes in the expression parser.

llvm-svn: 142717
2011-10-22 03:33:13 +00:00
Jason Molenda a98d106d49 Document nexti, show some shorter versions of long lldb
commands.

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

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

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

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

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

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

llvm-svn: 142702
2011-10-21 23:40:00 +00:00
Greg Clayton 7c6d7b83c1 Fixed a missing quote.
llvm-svn: 142698
2011-10-21 23:04:20 +00:00
Sean Callanan b226916528 Implemented an extension to the namespace map that
permits a namespace map to be created and populated
when the namespace is imported, not just when it is
requested via FindExternalVisibleDecls().

llvm-svn: 142690
2011-10-21 22:18:07 +00:00
Greg Clayton 596ed24e43 If a process plug-in was specified by name, always let the plug-in get used.
llvm-svn: 142688
2011-10-21 21:41:45 +00:00
Johnny Chen 31fdfb1f33 Add a benchmark for measuring the response time of the 'frame variable' command.
Example (start the lldb inferior, break at the Driver::MainLoop() function, and
issue 'frame variable'):

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

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

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

OK

llvm-svn: 142678
2011-10-21 20:19:51 +00:00
Johnny Chen 99904b33b7 Rephrase benchmark output display.
llvm-svn: 142676
2011-10-21 20:11:40 +00:00
Johnny Chen 4d4363ba56 Add a '-n' option to turn off printings of build dir, lldb version, svn info, and other headers
which happen before the listingings of test cases.

llvm-svn: 142668
2011-10-21 18:33:27 +00:00
Johnny Chen f7a0062869 Fix the compilation warning while running the test case.
llvm-svn: 142663
2011-10-21 17:57:04 +00:00
Sean Callanan 8a518d5b54 Updated LLVM/Clang to pull in a variety of type
importation fixes, reducing the amount of requests
made to LLDB for unknown types and increasing 
fidelity of the expression parser.

llvm-svn: 142639
2011-10-21 05:19:47 +00:00
Sean Callanan 80c48c10d0 Made the IR interpreter more robust in the presence
of arbitrary pointers, allowing direct dereferences
of literal addresses.  Also disabled special-cased
generation of certain expression results (especially
casts), substituting the IR interpreter.

llvm-svn: 142638
2011-10-21 05:18:02 +00:00
Jim Ingham 8f07716139 Lock the Unwinder before accessing it.
llvm-svn: 142632
2011-10-21 01:49:48 +00:00
Johnny Chen edb677c3c7 Fix wrong directory name.
llvm-svn: 142629
2011-10-21 01:09:29 +00:00
Johnny Chen 7f63fdaa74 Add a benchmark for measuring start up delays of lldb, including:
o create a fresh target; and
o set the first breakpoint

Example (using lldb to set a breakpoint on lldb's Driver::MainLoop function):

./dotest.py -v +b -x '-F Driver::MainLoop()' -p TestStartupDelays.py

...

1: test_startup_delay (TestStartupDelays.StartupDelaysBench)
   Test start up delays creating a target and setting a breakpoint. ... 
lldb startup delays benchmark:
create fresh target: Avg: 0.106732 (Laps: 15, Total Elapsed Time: 1.600985)
set first breakpoint: Avg: 0.102589 (Laps: 15, Total Elapsed Time: 1.538832)
ok

llvm-svn: 142628
2011-10-20 22:37:45 +00:00
Greg Clayton 97fbc34276 Fixed some issues where we might not have one of the new apple accelerator
tables (like the .apple_namespaces) and it would cause us to index DWARF that
didn't need to be indexed.

Updated the MappedHash.h (generic Apple accelerator table) and the DWARF
specific one (HashedNameToDIE.h) to be up to date with the latest and
greatest hash table format.

llvm-svn: 142627
2011-10-20 22:30:33 +00:00
Johnny Chen ff7fc9cfa4 Breakpoint specification can have the form '-n main', so it's not a good idea to
check that the option arg in '-x opt_arg' does not start with a '-' char.

llvm-svn: 142625
2011-10-20 22:16:24 +00:00
Johnny Chen 8241d378f8 Directory renaming: example -> expression.
llvm-svn: 142602
2011-10-20 18:58:28 +00:00
Johnny Chen f4ca4b5f57 Directory renaming: example -> expression.
llvm-svn: 142601
2011-10-20 18:57:04 +00:00
Johnny Chen 38f9daa303 Parameterize the iteration count used when running benchmarks, instead of hard-coded inside the test case.
Add a '-y count' option to the test driver for this purpose.  An example:

 $  ./dotest.py -v -y 25 +b -p TestDisassembly.py

...

----------------------------------------------------------------------
Collected 2 tests

1: test_run_gdb_then_lldb (TestDisassembly.DisassembleDriverMainLoop)
   Test disassembly on a large function with lldb vs. gdb. ... 
gdb benchmark: Avg: 0.226305 (Laps: 25, Total Elapsed Time: 5.657614)
lldb benchmark: Avg: 0.113864 (Laps: 25, Total Elapsed Time: 2.846606)
lldb_avg/gdb_avg: 0.503146
ok
2: test_run_lldb_then_gdb (TestDisassembly.DisassembleDriverMainLoop)
   Test disassembly on a large function with lldb vs. gdb. ... 
lldb benchmark: Avg: 0.113008 (Laps: 25, Total Elapsed Time: 2.825201)
gdb benchmark: Avg: 0.225240 (Laps: 25, Total Elapsed Time: 5.631001)
lldb_avg/gdb_avg: 0.501723
ok

----------------------------------------------------------------------
Ran 2 tests in 41.346s

OK

llvm-svn: 142598
2011-10-20 18:43:28 +00:00
Johnny Chen 5a328cc8c6 Remove stale code.
llvm-svn: 142595
2011-10-20 17:49:44 +00:00
Johnny Chen 29b3f6b616 Remove stale code.
llvm-svn: 142594
2011-10-20 17:45:39 +00:00
Johnny Chen 2a6eab04b1 Up until now, we have been using pexpect to spawn an lldb process and use lldb commands to
bring the debugger to the desired state.

This patch makes BenchBase inherit from TestBase, instead of Base (which is a parent class of
TestBase).  This is so that we can also enjoy the Pythonic way of bringing the lldb debugger
to a desired state before running the benchmark and collect statistics.

llvm-svn: 142562
2011-10-20 01:35:57 +00:00
Greg Clayton 64bc6ca595 Modified the ASTDumper to return a "const char *" instead of a copy of the
std::string and modified all places that used the std::string it returned
to use the "const char *".

Also modified the expression parser to not crash when a function type fails
to copy into the expression AST context.

llvm-svn: 142561
2011-10-20 00:47:21 +00:00
Johnny Chen c54de2ca54 Missed this file when doing r142543 to temporarily relax the expected substrings for watchpoint creation output.
llvm-svn: 142549
2011-10-19 22:17:06 +00:00
Johnny Chen d72b178a45 Temporarily relax the expected substrings for watchpoint creation output
due a bug in the decl file info of a global variable emitted by clang.

llvm-svn: 142543
2011-10-19 20:51:28 +00:00
Greg Clayton 81c22f6104 Moved lldb::user_id_t values to be 64 bit. This was going to be needed for
process IDs, and thread IDs, but was mainly needed for for the UserID's for
Types so that DWARF with debug map can work flawlessly. With DWARF in .o files
the type ID was the DIE offset in the DWARF for the .o file which is not
unique across all .o files, so now the SymbolFileDWARFDebugMap class will
make the .o file index part (the high 32 bits) of the unique type identifier
so it can uniquely identify the types.

llvm-svn: 142534
2011-10-19 18:09:39 +00:00
Johnny Chen 2a80858903 Modify lldbtest.Base.runHooks() to now take the following keyword arguments:
child=None, child_prompt=None, use_cmd_api=False

By default, expect a pexpect spawned child and child prompt to be
supplied (use_cmd_api=False).  If use_cmd_api is true, ignore the child
and child prompt and use self.runCmd() to run the hooks one by one.

Modify existing client to reflect the change.

llvm-svn: 142532
2011-10-19 16:48:07 +00:00
Johnny Chen a737ba55af Extract the run hooks functionality into the base class lldbtest.Base.
llvm-svn: 142469
2011-10-19 01:06:21 +00:00
Greg Clayton 85ae2e1349 Changed lldb_private::Type over to use the intrusive ref counted pointers
so we don't have to lookup types in a type list by ID.

Changed the DWARF parser to remove the "can externally complete myself" bits
from the type when we are in the process of completing the type itself to
avoid an onslaught of external visible decl requests from the 
clang::ExternalASTSource.

llvm-svn: 142461
2011-10-18 23:36:41 +00:00
Johnny Chen f5df537d26 Fix build under gcc.
Patch from Dawn.

llvm-svn: 142402
2011-10-18 19:28:30 +00:00
Johnny Chen 85ced807f5 Add docstrings for SetCondition() and GetCondition() APIs.
llvm-svn: 142396
2011-10-18 19:13:06 +00:00
Johnny Chen 9e320909f5 Remove stale comment.
llvm-svn: 142392
2011-10-18 18:33:33 +00:00
Johnny Chen 7d97b1c274 Modify the help text for watching a variable or its pointee.
llvm-svn: 142391
2011-10-18 18:31:06 +00:00
Johnny Chen 0d5f2d425a This patch fixes debugging of single threaded apps on Linux.
It also adds some asserts and additional logging support.

from dawn@burble.org

llvm-svn: 142384
2011-10-18 18:09:30 +00:00
Sean Callanan 80a3f3c8a9 Removed some debug support I accidentally
committed.

llvm-svn: 142376
2011-10-18 17:45:25 +00:00
Sean Callanan 35c7f98734 Improved logging, replacing the old ASTDumper (which
we never used) with a much simpler class that wraps
the relevant dump functions in Clang.  This class also
knows to disable external lookups on DeclContexts
being dumped so it should be safe to print incomplete
Decls.

llvm-svn: 142359
2011-10-18 16:46:55 +00:00
Jason Molenda e858e33200 Add code to RegisterContextLLDB::InitializeNonZerothFrame to detect a multiple stack frames
with the same CFA (or an alternating sequence between two CFA values) to catch a handful of
unwind cases where lldb will inf loop trying to unwind a stack.

llvm-svn: 142331
2011-10-18 02:57:27 +00:00
Johnny Chen fc79b400b2 This patch alloows lldb to build under GCC.
from dawn@burble.org

llvm-svn: 142305
2011-10-17 23:18:19 +00:00
Johnny Chen 9df05592f0 Add test cases for setting condition on a watchpoint for both command and API.
llvm-svn: 142291
2011-10-17 22:17:47 +00:00
Enrico Granata a9dbf4325e this patch introduces a new command script import command which takes as input a filename for a Python script and imports the module contained in that file. the containing directory is added to the Python path such that dependencies are honored. also, the module may contain an __lldb_init_module(debugger,dict) function, which gets called after importing, and which can somehow initialize the module's interaction with lldb
llvm-svn: 142283
2011-10-17 21:45:27 +00:00
Johnny Chen 9c7b04cb26 Rename test file.
llvm-svn: 142242
2011-10-17 20:28:39 +00:00
Johnny Chen 8289e36506 Fix wrong docstring.
llvm-svn: 142241
2011-10-17 20:26:07 +00:00
Johnny Chen 16dcf718d3 Add a commnad to set a condition for a watchpoint. Example:
watchpoint modify -c 'global==5'

modifies the last created watchpoint so that the condition expression
is evaluated at the stop point to decide whether we should proceed with
the stopping.

Also add SBWatchpont::SetCondition(const char *condition) to set condition
programmatically.

Test cases to come later.

llvm-svn: 142227
2011-10-17 18:58:00 +00:00
Sean Callanan 6d9f5db468 Handled the call operator properly.
llvm-svn: 142033
2011-10-15 01:15:07 +00:00
Jim Ingham a5ce6c88f9 Make "next" and "step-out" work when in stepping over or out of inlined functions.
llvm-svn: 142031
2011-10-15 00:57:28 +00:00
Jim Ingham c4c9fedc72 Make the step range plans capable of supporting multiple ranges. Also make their constructors public, there isn't any good reason why you shouldn't be able to make these plans.
llvm-svn: 142026
2011-10-15 00:24:48 +00:00
Jim Ingham 10c4b249fc Make the "log enable lldb-step" output easier to parse.
llvm-svn: 142025
2011-10-15 00:23:43 +00:00
Jim Ingham 37cfeab3c0 Quiet the default "log enable lldb step" output down a little bit.
llvm-svn: 142024
2011-10-15 00:21:37 +00:00
Greg Clayton 147e1fa298 Add function decls to their parent decl context.
llvm-svn: 142011
2011-10-14 22:47:18 +00:00
Sean Callanan 4b4f9b40fa Added a buildbot script that automatically checks
out the latest LLDB, LLVM and Clang and makes sure
they work okay together.  The buildbot is currently
Mac OS X only because it uses xcodebuild.

Right now, the portion that runs the LLDB test
suite is commented out because of code-signing
problems (specifically, on Mac OS 10.7 a UI dialog
appears asking for the user's permission to attach
to the inferior process).

You can use the buildbot like this:

./scripts/buildbot.py -b /tmp/lldb-build -l /tmp/lldb.log

/tmp/lldb-build and /tmp/lldb.log should not exist
when the script is run.

/tmp/lldb-build is a temporary directory and is
removed at the end of a normal execution.

/tmp/lldb.log is a log file that sticks around.

The buildbot does not require built versions of anything;
it will do the building itself.

llvm-svn: 142006
2011-10-14 21:43:51 +00:00
Greg Clayton 030a204664 Make sure we create only unique one namespace per AST when parsing the DWARF.
llvm-svn: 142005
2011-10-14 21:34:45 +00:00
Sean Callanan 7dd9812675 Improved expression logging. Now all calls to
FindExternalVisibleDecls and FindExternalLexicalDecls
are marked and given unique IDs, so that all logging
done as part of their execution can be traced back to
the proper call.

Also there was some logging that really wasn't helpful
in most cases so I disabled it unless verbose logging
(log enable -v lldb expr) is enabled.

llvm-svn: 141987
2011-10-14 20:34:21 +00:00
Johnny Chen ed456eb0a9 Add SBWatchpoint::GetError() API, which is not currently populated as yet.
llvm-svn: 141979
2011-10-14 19:15:48 +00:00
Johnny Chen 6283f4b67a Remove debug 'print watchpoint' statement.
llvm-svn: 141965
2011-10-14 18:10:00 +00:00
Johnny Chen fc807f84ed Rename directory command_python to command_script, and the test file, too.
llvm-svn: 141963
2011-10-14 17:37:38 +00:00
Greg Clayton 5a31471e72 Added the ability to run expressions in any command. Expressions can be
inserted in commands by using backticks:

(lldb) memory read `$rsp-16` `$rsp+16`
(lldb) memory read  -c `(int)strlen(argv[0])` `argv[0]`

The result of the expression will be inserted into the command as a sort of
preprocess stage where this gets done first. We might need to tweak where this
preprocess stage goes, but it is very functional already.

Added ansi color support to the Debugger::FormatPrompt() so you can use things
like "${ansi.fg.blue}" and "${ansi.bold}" many more. This helps in adding 
colors to your prompts without needing to know the ANSI color code strings.

llvm-svn: 141948
2011-10-14 07:41:33 +00:00
Johnny Chen f5be9e3759 Add a test case to exercise the newly added SB API:
lldb::SBWatchpoint
SBTarget::WatchAddress (lldb::addr_t addr, size_t size, bool read, bool write)

llvm-svn: 141931
2011-10-14 01:16:39 +00:00
Sean Callanan 187de46132 Improved logging for FindExternalLexicalDecls to
make it easier to track down which members belong
to which structs (and which call to 
FindExternalLexicalDecls is doing the reporting).

llvm-svn: 141930
2011-10-14 01:15:27 +00:00
Johnny Chen 4c3e140247 Fix wrong docstring with respect to API usage.
llvm-svn: 141928
2011-10-14 00:56:28 +00:00
Johnny Chen 01a678603a SBValue::Watch() and SBValue::WatchPointee() are now the official API for creating
a watchpoint for either the variable encapsulated by SBValue (Watch) or the pointee
encapsulated by SBValue (WatchPointee).

Removed SBFrame::WatchValue() and SBFrame::WatchLocation() API as a result of that.

Modified the watchpoint related test suite to reflect the change.

Plus replacing WatchpointLocation with Watchpoint throughout the code base.

There are still cleanups to be dome.  This patch passes the whole test suite.
Check it in so that we aggressively catch regressions.

llvm-svn: 141925
2011-10-14 00:42:25 +00:00
Greg Clayton cb5860a70b Modified the DWARF parser to take care of a 1 clang::DeclContext to many
DIEs. Prior to this fix, there was a 1 to 1 mapping.

llvm-svn: 141917
2011-10-13 23:49:28 +00:00
Greg Clayton 20568dd981 Fixed a case where we might end up trying to parse a type in the DWARF parser for a method whose class isn't currently in the process of completing itself. Currently, methods of a class, must be parsed when the class type that contains the method is asked to complete itself through the clang::ExternalASTSource virtual functions. Now we "do the right thing" by checking if the class is being defined, and if so we parse it, else we tell the class to complete itself so everything happens correctly.
llvm-svn: 141908
2011-10-13 23:13:20 +00:00
Sean Callanan c6bba3e46d Cleaned up a few functions that never get used.
Specifically, the expression parser used to use
functions attached to SymbolContext to do lookups,
but nowadays it searches a ModuleList or Module
directly instead.  These functions had no
remaining clients so I removed them to prevent
bit rot.

I also removed a stray callback function from
ClangExpressionDeclMap.

llvm-svn: 141899
2011-10-13 22:18:56 +00:00
Sean Callanan ebe6067a8c Enabled the namespace-specific search functionality,
which had previously been commented out while I tested
it.  It's not fully working yet, but it doesn't break
our testsuite and it's an important piece of
functionality.

Also added some logging to SymbolFileDWARF to help
diagnose entities that are found in a symbol file,
but do not reside in the expected namespace.

llvm-svn: 141894
2011-10-13 21:50:33 +00:00
Sean Callanan c41e68b127 Moved the list of found namespaces into the search
context object.  Having it populated and registered
within a single FindExternalVisibleDecls call worked
fine when there was only one call (i.e., when we were
just looking in the global namespace).  

However, now FindExternalVisibleDecls is called for
nested namespaces as well, which means that it is
called not once but many times (once per module in
which the parent namespace appears).  This means that
the namespace mapping is built up across many calls
to the inferior FindExternalVisibleDecls, so I moved
it into a data structure (the search context) that is
shared by all calls.

I also added some logging to make it easier to see
what is happening during a namespace search, and 
cleaned up some existing logging.

llvm-svn: 141888
2011-10-13 21:08:11 +00:00
Greg Clayton 2a14f17a65 Revert the change to "target variable" that was causing test suite failures.
llvm-svn: 141879
2011-10-13 18:31:02 +00:00
Greg Clayton 1b282f9619 Cleaned up the SBWatchpoint public API.
llvm-svn: 141876
2011-10-13 18:08:26 +00:00
Sean Callanan b96ff33b0e Removed namespace qualification from symbol queries.
llvm-svn: 141866
2011-10-13 16:49:47 +00:00
Sean Callanan 213fdb8bf6 Completed the glue that passes a ClangNamespaceDecl *
down through Module and SymbolVendor into SymbolFile.
Added checks to SymbolFileDWARF that restrict symbol
searches when a namespace is passed in.

llvm-svn: 141847
2011-10-13 01:49:10 +00:00
Johnny Chen 7596f9373a Add 'cd -' feature to change to the previous working directory.
llvm-svn: 141846
2011-10-13 01:20:34 +00:00
Greg Clayton 4f76b23764 Always use the full variable name when dumping globals since they might
be in namespaces.

llvm-svn: 141845
2011-10-13 01:14:39 +00:00
Greg Clayton aa044960b5 Add a version of ResolveFunction that takes a "const DWARFDebugInfoEntry *"
and a "DWARFCompileUnit *" to avoid doing a DIE lookup twice and to prepare
for using namespaces in the lookups.

llvm-svn: 141843
2011-10-13 00:59:38 +00:00
Sean Callanan 8e5b8b9631 Now that we know the values are going to stick around,
we don't need to look them up again when materializing.

Switched over the materialization mechanism (for JIT
expressions) and the lookup mechanism (for interpreted
expressions) to use the VariableSP/Symbol that were
found during parsing.

llvm-svn: 141839
2011-10-13 00:09:20 +00:00
Greg Clayton bfe3dd4d8b Added a function to test if a ClangNamespaceDecl matches the current symbol
file. This will help us to minimize lookups that can't possibly match anything
in the current symbol file.

llvm-svn: 141838
2011-10-13 00:00:53 +00:00
Greg Clayton 2506a7a959 Added the ability to see if a DIE is contained in a namespace.
llvm-svn: 141832
2011-10-12 23:34:26 +00:00
Johnny Chen c6d3b6e7a6 Minor fix.
llvm-svn: 141826
2011-10-12 22:25:13 +00:00
Johnny Chen 4ffde88b42 Add pointer to the examples/customization directory for examples of lldb customizations.
llvm-svn: 141823
2011-10-12 22:22:09 +00:00
Sean Callanan e3aef1d063 Extended the lifetime of Clang parser objects to the
lifetime of ClangExpressionDeclMap.  This allows
ClangExpressionVariables found during parsing to be
queried for their containing namespaces during
expression execution.

Other clients (like ClangFunction) explicitly delete
this state, so they should not result in any memory
leaks.

llvm-svn: 141821
2011-10-12 22:20:02 +00:00
Johnny Chen 724e62bb4a Prepend '~' to the sys.path so that ~/utils.py takes precedence.
llvm-svn: 141817
2011-10-12 21:51:58 +00:00
Johnny Chen 7f01ac39b9 Patch by Enrico to provide an example of 'import' commnad for importing .py/.pyc files.
llvm-svn: 141810
2011-10-12 20:47:04 +00:00
Sean Callanan ca4e0fd7e6 Refactoring in preparation for having multiple
calls to the FindExternalVisibleDecls function.

FindExternalVisibleDecls was recording whether
it had found generic function symbols in variables
that were local to the function.  Now, however,
multiple calls occur in response to one request
from Clang, since we may be searching across
namespaces.  To support that, I moved the local
variables into a bitfield in NameSearchContext.

llvm-svn: 141808
2011-10-12 20:29:25 +00:00
Johnny Chen de2ff3b64e Add reference to ToT/examples/customization for more customization examples.
llvm-svn: 141800
2011-10-12 19:20:04 +00:00
Johnny Chen de6ade01d0 Add an examples/customization directory and add a subdirectory pwd-cd-and-system
which contains the lldb init file and a utils.py Python module in order to add
the 'pwd', 'cd', and 'system' lldb commands.

llvm-svn: 141799
2011-10-12 19:16:06 +00:00
Sean Callanan 1a2c5386cd Made the expression parser's type search call the
proper namespace-aware APIs.

llvm-svn: 141797
2011-10-12 18:44:30 +00:00
Sean Callanan 4c3977c278 Added support to ClagnExpressionDeclMap for finding
data symbols in namespaces.

llvm-svn: 141792
2011-10-12 18:00:53 +00:00
Johnny Chen 04a101d475 Add cleanups for 'command script add' to TestCommandPython.py.
llvm-svn: 141790
2011-10-12 17:50:41 +00:00
Sean Callanan 25ea08ef8c Changed FindExternalVisibleDecls() to use the module
level FindFunctions() where appropriate and not use
SymbolContext::FindFunctionsByName().

llvm-svn: 141789
2011-10-12 17:38:09 +00:00
Sean Callanan 03267a7068 Oops, committed my local build settings. Fixed that.
llvm-svn: 141784
2011-10-12 17:08:22 +00:00
Sean Callanan 1fd3f4f14c Made FindGlobalVariable() optionally search a specific
module and namespace.  Also made it use FindGlobalVariables()
instead of the more heavyweight 
GetVariablesForVariableExpressionPath().

llvm-svn: 141783
2011-10-12 16:59:31 +00:00
Sean Callanan b6d70ebc0a Added ClangNamespaceDecl * parameters to several
core Module functions that the expression parser
will soon be using.

llvm-svn: 141766
2011-10-12 02:08:07 +00:00
Sean Callanan 8897224363 Cleanups in preparation for making FindExternalVisibleDecls
look in individual modules rather than globally.

Also some whitespace fixes.

llvm-svn: 141765
2011-10-12 01:39:28 +00:00
Johnny Chen c79eec0c18 Add description of a more capable 'cd' command using 'command script add'.
llvm-svn: 141764
2011-10-12 01:28:23 +00:00
Greg Clayton d4e2552c73 Fix preprocessor warnings for no newline at the end of the source files.
llvm-svn: 141755
2011-10-12 00:53:29 +00:00
Sean Callanan 503aa525ea Implemented a namespace map that allows searching
of namespaces (only in the modules where they've
been found) for entities inside those namespaces.

For each NamespaceDecl that has been imported into
the parser, we maintain a map containing
[ModuleSP, ClangNamespaceDecl] pairs in the ASTImporter.
This map has one entry for each module in which the
namespace has been found.  When we later scan for an
entity inside a namespace, we search only the modules
in which that namespace was found.

Also made a small whitespace fix in 
ClangExpressionParser.cpp.

llvm-svn: 141748
2011-10-12 00:12:34 +00:00
Johnny Chen 8a7f3f5bac Add a more generic stepping benchmark, which uses the '-k' option of the test driver
to be able to specify the runhook(s) to bring the debug session to a certain state
before running the benchmarking logic.  An example,

./dotest.py -v -t +b -k 'process attach -n Mail' -k 'thread backtrace all' -p TestRunHooksThenSteppings.py

spawns lldb, attaches to the 'Mail' application, does a backtrace for all threads, and then
runs the benchmark to step the inferior multiple times.

llvm-svn: 141740
2011-10-11 23:22:02 +00:00
Johnny Chen 6dcbeaeecb Patch by Dawn to add the logging capabilities to ProcessLinux.cpp.
llvm-svn: 141712
2011-10-11 21:21:57 +00:00
Johnny Chen 54cb8f83d9 Fix a typo in ProcessKDP::DidAttach().
Patch by Dawn.

llvm-svn: 141711
2011-10-11 21:17:10 +00:00
Greg Clayton 199a0bb529 Added a missing file from a previous checkin.
llvm-svn: 141707
2011-10-11 20:23:29 +00:00
Johnny Chen ef9e2ef2a5 Add documentation on providing the 'cd' and 'pwd' commands to lldb with the help of the embedded Python interpreter and
the 'command regex' command.

llvm-svn: 141698
2011-10-11 19:39:48 +00:00
Greg Clayton f324a89c25 Patch from Dragos Tatulea to re-enable the PECOFF object file parser for all
builds on all systems.

llvm-svn: 141677
2011-10-11 16:42:21 +00:00
Jim Ingham 32fc9601a1 Added some simple testcases for figuring out breakpoints by name in
classes & namespaces.

llvm-svn: 141629
2011-10-11 01:43:50 +00:00
Jim Ingham d3238352c3 Remove a debugging printf...
llvm-svn: 141627
2011-10-11 01:30:59 +00:00
Johnny Chen 999f7ab9bd Add '-k' option to the test driver to be able to specify a runhook, which is an lldb command
for the debugger to execute for certain kind of tests (for example, a benchmark).
A list of runhooks can be used to steer the debugger into the desired state before more
actions can be performed.

llvm-svn: 141626
2011-10-11 01:30:27 +00:00
Jim Ingham 2dd7f7fb71 Add a SBTarget::BreakpointCreateByName API that allows you to specify the name
type mask.

llvm-svn: 141625
2011-10-11 01:18:55 +00:00
Jim Ingham ea8005a786 Fix a couple of places in FindFunctions where I was using the passed in name_type_mask
rather than the computed effective_name_type_mask.

llvm-svn: 141624
2011-10-11 01:18:11 +00:00
Johnny Chen 541b98517e Remove test logic to check for clang and skip the rest due to insufficient debug info.
Recent changes in lldb inlining robustness seem to have fixed it.

llvm-svn: 141595
2011-10-10 23:26:54 +00:00
Johnny Chen 48d042b659 Patch from dawn@burble.org to build on linux!
llvm-svn: 141593
2011-10-10 23:11:50 +00:00
Johnny Chen a10e6c1052 Add '-e' and '-x' options to the test driver to be able to specify an executable (full path)
and the breakpoint specification for the benchmark purpose.  This is used by TestSteppingSpeed.py
to benchmark the lldb stepping speed.  Without '-e' and 'x' specified, the test defaults to
run the built lldb against itself and stopped on Driver::MainLoop, then stepping for 50 times.

rdar://problem/7511193

llvm-svn: 141584
2011-10-10 22:03:44 +00:00
Johnny Chen a319b84f6a Modify sidebar.incl and remove files to reflect r141554 change.
llvm-svn: 141556
2011-10-10 18:06:09 +00:00
Johnny Chen 7571ba7015 Remove utils/emacs directory from lldb.
llvm-svn: 141554
2011-10-10 17:58:30 +00:00
Greg Clayton 995e10ac9b Patch from Dragos Tatulea regarding typedefs with the new RangeArray template class.
llvm-svn: 141546
2011-10-10 16:33:44 +00:00
Greg Clayton 2e9f7a0f01 Remove unneeded exports.
llvm-svn: 141504
2011-10-08 22:26:32 +00:00
Greg Clayton 2215230040 Changed RangeMap over to use llvm::SmallVector and updated the RangeArray and the RangeDataArray to have an extra "unsigned N" template parameter. Updated the lldb_private::Block to use a RangeArray with a uint32_t for both the function base offset and block range size, and then a 1 for the small vector size since most lexical blocks in DWARF only have 1 range. Updates the DWARFDebugRanges RangeArray to use an unsigned of 2 since most blocks that have more than one range usually have 2. Also updated a DWARFDebugAranges to default their RangeArray to use a SmallVector with unsigned size of 1 since this will take care of the .o files when doing DWARF in .o files and since there really isn't any good size we can guess with.
llvm-svn: 141480
2011-10-08 06:59:54 +00:00
Greg Clayton 892d898605 Added some debug code that can verify that all RangeMap.h maps are sorted when needed since RangeArray and RangeDataArray instantiations depend on it. I ran the test suite with ASSERT_RANGEMAP_ARE_SORTED defined and I got no assertions, so I disabled it prior to checkin.
llvm-svn: 141478
2011-10-08 03:59:55 +00:00
Greg Clayton 2e4b5c0d9d Removed unneeded content.
llvm-svn: 141477
2011-10-08 03:53:14 +00:00
Greg Clayton e7b6681863 Started on the export table for the MappedHash.
llvm-svn: 141469
2011-10-08 01:13:27 +00:00
Jim Ingham eb6ba39033 Fix the last testsuite regression from the apple-names stuff.
llvm-svn: 141468
2011-10-08 01:11:42 +00:00
Greg Clayton ea3e7d5ccf Added more functionality to Range template classes in RangeMap.h and converted remaining DWARF areas that were using ranges over to this class. Also converted lldb_private::Block to use it.
llvm-svn: 141460
2011-10-08 00:49:15 +00:00
Sean Callanan 2590b9ac6f Fixed a memory leak of ASTResultSynthesizers,
by attaching them to the ClangExpressionParser.

llvm-svn: 141452
2011-10-08 00:21:35 +00:00
Johnny Chen a4e8baeb33 Add fuzz call for SBBreakpointLocation.GetAddress().
llvm-svn: 141443
2011-10-07 23:54:04 +00:00
Sean Callanan 880e680fa3 Updated LLVM/Clang to pull in the latest ARM disassembler.
This involved minor changes to the way we report Objective-C
methods, as well as cosmetic changes and added parameters
for a variety of Clang APIs.

llvm-svn: 141437
2011-10-07 23:18:13 +00:00
Jim Ingham e71c18dff0 Remove some commented out code.
llvm-svn: 141431
2011-10-07 22:28:49 +00:00
Jim Ingham adedc1f48b Clean up some documentation.
llvm-svn: 141430
2011-10-07 22:28:29 +00:00
Jim Ingham 1b040c157a Mention SBBreakpointLocation::GetAddress in the Python .i file.
llvm-svn: 141429
2011-10-07 22:27:25 +00:00
Jim Ingham 4cda6e058b Move the responsibility for translating the various eFunctionNameType lookups to the
SymbolFIle (it was done mostly in the BreakpointResolverName resolver before.)  Then
tailor our searches to the way the indexed maps are laid out.  This removes a bunch 
of test case failures using indexed dSYM's.

llvm-svn: 141428
2011-10-07 22:23:45 +00:00