Commit Graph

928 Commits

Author SHA1 Message Date
Johnny Chen 164f1e18b1 Add a const string for assert message. Remove extra printing of newlines from
the session recordings.

llvm-svn: 116596
2010-10-15 18:07:09 +00:00
Johnny Chen 8f6fca7f30 There's no need to explicitly call lldb.SBDebugger.Initialize() now. It is done
when importing the lldb module.

llvm-svn: 116585
2010-10-15 16:33:17 +00:00
Johnny Chen fd64df4f92 Add more comments.
llvm-svn: 116583
2010-10-15 16:22:10 +00:00
Johnny Chen ab254f5da4 Be more specific about cases whenthe runCmd() check flag is False, meaning there
is no need to check the return status of the command execution, and an error
status is not deemed a failure in the test.

llvm-svn: 116582
2010-10-15 16:13:00 +00:00
Greg Clayton ee4b5dd664 Skip checking for a bunch of built-ins when evaluating an expression.
llvm-svn: 116565
2010-10-15 03:36:13 +00:00
Greg Clayton 9476d957ef Did a bit of parameter renaming.
llvm-svn: 116562
2010-10-15 02:45:05 +00:00
Greg Clayton 8dbc336da9 Added short names and descriptions to the UnixSignals class. Also cleaned up
the code a bit.

llvm-svn: 116561
2010-10-15 02:39:01 +00:00
Johnny Chen 56f7939cdc Simply use the TestBase.markFailure() callback method to set the __failed__ flag.
llvm-svn: 116559
2010-10-15 02:28:13 +00:00
Greg Clayton 69b0488d7a Separated the DWARF index for types from that the index of the namespaces
since we can't parse DW_TAG_namespace DIEs as types. They are only decls in
clang. All of the types we handle right now have both clang "XXXType" classes
to go with the "XXXDecl" classes which means they can be used within the 
lldb_private::Type class. I need to check to see which other decls that don't
have associated type objects need to float around the debugger and possibly
make a lldb_private::Decl class to manage them.

llvm-svn: 116558
2010-10-15 02:03:22 +00:00
Johnny Chen 150c3cc825 This is an initial version of test driver enhanceent to be able to dump the
session info after a test case failure, allowing more direct inspection of
debugger session which leads to the test failure.

For a simple usage scenario:

[18:06:26] johnny:/Volumes/data/lldb/svn/trunk/test $ ./dotest.py -v . 2> ~/Developer/Log/lldbtest.log 

...

[18:14:43] johnny:/Volumes/data/lldb/svn/trunk/test $ ls -l .session-*
-rw-r--r--  1 johnny  admin  1359 Oct 14 18:06 .session-TestArrayTypes.ArrayTypesTestCase.test_with_dwarf_and_run_command
-rw-r--r--  1 johnny  admin  2054 Oct 14 18:07 .session-TestClassTypes.ClassTypesTestCase.test_with_dsym_and_expr_parser
-rw-r--r--  1 johnny  admin  2055 Oct 14 18:07 .session-TestClassTypes.ClassTypesTestCase.test_with_dwarf_and_expr_parser
-rw-r--r--  1 johnny  admin  1351 Oct 14 17:57 .session-TestClassTypes.ClassTypesTestCase.test_with_dwarf_and_run_command
[18:14:51] johnny:/Volumes/data/lldb/svn/trunk/test $ 

The test case which failed will have its recorded session info dumped to a
.session-* file in the current working directory.  For test suite using
relocated directory, expect to find the .session-* files there.

In this checkin, I also add @skip decorator to the two test methods in
test/foundation/TestObjCMethods.py as it looks like the test suite is
deadlocking when running the tests.  More investigations are needed.

llvm-svn: 116552
2010-10-15 01:18:29 +00:00
Jim Ingham 36f3b369d2 Added support for breakpoint conditions. I also had to separate the "run the expression" part of ClangFunction::Execute from the "Gather the expression result" so that in the case of the Breakpoint condition I can move the condition evaluation into the normal thread plan processing.
Also added support for remembering the "last set breakpoint" so that "break modify" will act on the last set breakpoint.

llvm-svn: 116542
2010-10-14 23:45:03 +00:00
Greg Clayton 8f92f0a35c Fixed an expression parsing issue where if you were stopped somewhere without
debug information and you evaluated an expression, a crash would occur as a
result of an unchecked pointer.

Added the ability to get the expression path for a ValueObject. For a rectangle
point child "x" the expression path would be something like: "rect.top_left.x".
This will allow GUI and command lines to get ahold of the expression path for
a value object without having to explicitly know about the hierarchy. This
means the ValueObject base class now has a "ValueObject *m_parent;" member.
All ValueObject subclasses now correctly track their lineage and are able
to provide value expression paths as well.

Added a new "--flat" option to the "frame variable" to allow for flat variable
output. An example of the current and new outputs:

(lldb) frame variable 
argc = 1
argv = 0x00007fff5fbffe80
pt = {
  x = 2
  y = 3
}
rect = {
  bottom_left = {
    x = 1
    y = 2
  }
  top_right = {
    x = 3
    y = 4
  }
}
(lldb) frame variable --flat 
argc = 1
argv = 0x00007fff5fbffe80
pt.x = 2
pt.y = 3
rect.bottom_left.x = 1
rect.bottom_left.y = 2
rect.top_right.x = 3
rect.top_right.y = 4


As you can see when there is a lot of hierarchy it can help flatten things out.
Also if you want to use a member in an expression, you can copy the text from
the "--flat" output and not have to piece it together manually. This can help
when you want to use parts of the STL in expressions:

(lldb) frame variable --flat
argc = 1
argv = 0x00007fff5fbffea8
hello_world._M_dataplus._M_p = 0x0000000000000000
(lldb) expr hello_world._M_dataplus._M_p[0] == '\0'

llvm-svn: 116532
2010-10-14 22:52:14 +00:00
Caroline Tice 10ad799386 Modify "process handle" so that if no signals are specified it lists/updates them all,
if no update commands are specified it just lists the current values, and show that
it always shows the new values for a signal after it has been updated.  Also updated
the help text to match the new functionality.

llvm-svn: 116520
2010-10-14 21:31:13 +00:00
Johnny Chen aadcef54de Make calling the super class's setUp() method less fragile.
llvm-svn: 116490
2010-10-14 17:31:24 +00:00
Johnny Chen 7518ff0dda Wrap the file writing operations inside a with statement to simplify code.
llvm-svn: 116486
2010-10-14 16:57:08 +00:00
Johnny Chen cd8b2bbed2 Change the call within lldb.py to 'SBDebugger.Initialize()' from 'lldb.SBDebugger.Initialize()'.
Inside the lldb module, there's no need (and as a matter of fact, incorrect) to specify the 'lldb'
module name.

Comment out the call to lldb.SBDebugger.Initialize() within the test driver itself, since it is
already done when we import the lldb.py module.

llvm-svn: 116485
2010-10-14 16:36:49 +00:00
Johnny Chen b7fd763369 Add more comments and wait a little bit after resuming the inferior process before
sending it a signal.

llvm-svn: 116481
2010-10-14 15:58:53 +00:00
Johnny Chen c066ab4385 Add an initial version of test that exercise the lldb commands: 'process signal'
and 'process handle'.  The test suite would like to control the asynch/sync
execution of the interpreter during the middle of the test method, so the
CommandInterpreter::SetSynchronous(bool value) is modified to allow the mode to
be changed more than once.

In practice, it would be advisable to control the process and to set the
async/sync mode from a single thread, too.

llvm-svn: 116467
2010-10-14 01:22:03 +00:00
Johnny Chen 3c230654a7 Fix a regression introduced in r116430 with the added 'break' statement,
which broke test/breakpoint_locations.

Add a comment about intentional fall-through in the case statement.

llvm-svn: 116463
2010-10-14 00:54:32 +00:00
Caroline Tice 357313573e Add new argument type, eArgSignalName,
Add missing break statment to case statement in Process::ShouldBroadcastEvent.

Add new command, "process handle" to allow users to control process behavior on
the receipt of various Unix signals (whether the process should stop; whether the
process should be passed the signal; whether the debugger user should be notified
that the signal came in).

llvm-svn: 116430
2010-10-13 20:44:39 +00:00
Johnny Chen 6e8ab6496a Fix these comments and the commented out code about 'frame variable -t', too.
llvm-svn: 116420
2010-10-13 19:25:42 +00:00
Johnny Chen 456c9c343e Apply (query-replace "frame variable" "frame variable -t") and fix a comment about 'expr var',
not 'frame variable var'.

llvm-svn: 116419
2010-10-13 19:22:50 +00:00
Greg Clayton b6e8cf9663 Default "frame variable" to not show types before values by default. You now enable type display with --show-types or -t (instead of disabling it with --no-types or -t).
llvm-svn: 116418
2010-10-13 18:56:36 +00:00
Johnny Chen 1fd394170a Add a test case for the test/forward directory with @expectedFailure decorator
for test_with_dwarf_and_run_command(self).

llvm-svn: 116416
2010-10-13 18:47:36 +00:00
Greg Clayton 247399230d Fixed C++ class clang type creation and display by making sure we omit
artifical members (like the vtable pointer member that shows up in the DWARF).
We were adding this to each class which was making all member variables be off
by a pointer size.

Added a test case so we can track this with "test/forward".

Fixed the type name index in DWARF to include all the types after finding
some types were being omitted due to the DW_AT_specification having the
DW_AT_declaration attribute which was being read into the real type instances
when there were forward declarations in the DWARF, causing the type to be
omitted. We now check to make sure any DW_AT_declaration values are only
respected when parsing types if the attribute is from the current DIE.

After fixing the missing types, we ran into some issues with the expression
parser finding duplicate entries for __va_list_tag since they are built in
types and would result in a "duplicate __va_list_tag definition" error. We
are now just ignoring this name during lookup, but we will need to see if
we can get the name lookup function to not get called in these cases.

Fixed an issue that would cause an assertion where DW_TAG_subroutine_types
that had no children, would not properly make a clang function type of:
"void (*) (void)".

llvm-svn: 116392
2010-10-13 03:15:28 +00:00
Johnny Chen ff1b28f3ab Avoid using hardcoded line number to break on. Use the line_number() utility
function to get the line numbers for breakpoints 1-5 during setUp().

Use a pattern to match the output from both gcc-compiled and clang-compiled binary.

This finishes the conversion of the test suite to avoid hardcoded line numbers
when setting breakpoints with either the lldb command:

    breakpoint set -f filename -l lineno

or the Python API:

    target.BreakpointCreateByLocation(filename, lineno)

llvm-svn: 116378
2010-10-12 23:53:59 +00:00
Johnny Chen da349bab8a Avoid using hardcoded line number to break on. Use the line_number() utility
function to get the line number to break on during setUp().

Use a pattern to match the output from both gcc-compiled and clang-compiled binary.

llvm-svn: 116374
2010-10-12 23:33:57 +00:00
Johnny Chen 7d033402f8 Avoid using hardcoded line number to break on. Use the line_number() utility
function to get the line number to break on as well as the line number of the
first executable statement during setUp().

llvm-svn: 116369
2010-10-12 23:20:04 +00:00
Johnny Chen 67d411ac95 Avoid using hardcoded line number to break on. Use the line_number() utility
function to get the line number to break on during setUp().

llvm-svn: 116363
2010-10-12 23:08:18 +00:00
Johnny Chen 78c0aeb4b3 Update the comment with reagard to a bug filed against possible clang-generated
debug info which results in the breakpoint locations of 3, instead of 1 (as in gcc).

llvm-svn: 116361
2010-10-12 23:01:50 +00:00
Johnny Chen 77ca1a4af9 Avoid using hardcoded line number to break on. Use the line_number() utility
function to get the line number to break on during setUp().

llvm-svn: 116358
2010-10-12 22:53:02 +00:00
Caroline Tice 4239eadeee Comment out code that was preventing commands that take raw input strings
from being alias-able.

llvm-svn: 116357
2010-10-12 22:46:01 +00:00
Johnny Chen 0924b41201 Avoid using hardcoded line number to break on. Use the line_number() utility
function to get the line number to break on during setUp().

llvm-svn: 116356
2010-10-12 22:39:52 +00:00
Johnny Chen d759c21029 Avoid using hardcoded line number to break on. Use the line_number() utility
function to get the line number to break on during setUp().

Also modify main.c to use g_file_static_cstr within main() so clang does not
optimize this variable out.

llvm-svn: 116355
2010-10-12 22:35:26 +00:00
Johnny Chen 62d16fc738 Avoid using hardcoded line number to break on. Use the line_number() utility
function to get the line number to break on during setUp().

llvm-svn: 116352
2010-10-12 22:19:26 +00:00
Caroline Tice 4b6fbf370a Replace contains_string with 'strcasestr' from libc.
llvm-svn: 116351
2010-10-12 22:16:53 +00:00
Johnny Chen f389d7290e Avoid using hardcoded line number to break on. Use the line_number() utility
function to get the line number to break on during setUp().

llvm-svn: 116350
2010-10-12 22:14:43 +00:00
Johnny Chen 1a28439b96 Avoid using hardcoded line number to break on. Use the line_number() utility
function to get the line number to break on during setUp().

llvm-svn: 116349
2010-10-12 22:09:54 +00:00
Johnny Chen 3bfb8c01d8 Avoid using hardcoded line number to break on. Use the line_number() utility
function to get the line number to break on during setUp().

llvm-svn: 116346
2010-10-12 21:57:42 +00:00
Caroline Tice 4ab31c98e6 Fix some memory leaks.
Add call to lldb.SBDebugger.Initialize() to lldb.py, so it automatically gets called when
the lldb Python module gets loaded.

llvm-svn: 116345
2010-10-12 21:57:09 +00:00
Johnny Chen 48daa1fddb Avoid using hardcoded line number to break on. Use the line_number() utility
function to get the line number to break on during setUp().

llvm-svn: 116344
2010-10-12 21:52:29 +00:00
Johnny Chen 370799c272 Fix an obvious cut-and-paste error.
llvm-svn: 116343
2010-10-12 21:50:36 +00:00
Johnny Chen 10093aa534 Added the capability for the test driver to split the sys.stderr/sys.stdout into
different configuration-based files using the config file.  For example:

    sys.stderr = open("/tmp/lldbtest-stderr", "w")
    sys.stdout = open("/tmp/lldbtest-stdout", "w")
    compilers = ["gcc", "llvm-gcc"]
    archs = ["x86_64", "i386"]
    split_stderr = True # This will split the stderr into configuration-specific file
    split_stdout = True # This will split the stdout into configuration-specific file

will produce:

/tmp/lldbtest-stderr
/tmp/lldbtest-stderr.arch=i386-compiler=gcc
/tmp/lldbtest-stderr.arch=i386-compiler=llvm-gcc
/tmp/lldbtest-stderr.arch=x86_64-compiler=gcc
/tmp/lldbtest-stderr.arch=x86_64-compiler=llvm-gcc
/tmp/lldbtest-stdout
/tmp/lldbtest-stdout.arch=i386-compiler=gcc
/tmp/lldbtest-stdout.arch=i386-compiler=llvm-gcc
/tmp/lldbtest-stdout.arch=x86_64-compiler=gcc
/tmp/lldbtest-stdout.arch=x86_64-compiler=llvm-gcc

as a result of splitting stderr and stdout.  In addition, each configuration can have
its individual top level relocated directory to house the test files as well as the
intermediate files by using '-r dir' to relocate the tests into a new relocated directory
instead of running the tests in place.

llvm-svn: 116341
2010-10-12 21:35:54 +00:00
Johnny Chen 6b66081626 Forgor to also check in this change with r116337.
llvm-svn: 116340
2010-10-12 21:24:25 +00:00
Johnny Chen f8afe89a75 Update the @expectedFailure decorator with additional bug info:
rdar://problem/8542091 test/foundation: expr -o -- my not working?

Add an additional test for 'frame variable *self' when stopped in '-[MyString initWithNSString:]'
and move the 'expr -o -- self' to after MyString has been constructed and change it to
'expr -o -- my'.

llvm-svn: 116337
2010-10-12 21:20:11 +00:00
Johnny Chen f062c2fb59 The 'regexp-break' command now prints out the command that results from
expanding the regular expression command.  So change the more stringent:

    self.expect(..., startstr = matching_string)

to:

    self.expect(..., substrs = [matched_string])

to pass the test.

llvm-svn: 116331
2010-10-12 19:29:49 +00:00
Greg Clayton f220088295 Regular expression commands now print the command that results from expanding the regular expression command.
llvm-svn: 116320
2010-10-12 18:04:53 +00:00
Caroline Tice 636d6ed0c1 Fix bug where alias command options were being duplicated as command arguments as well.
llvm-svn: 116316
2010-10-12 17:45:19 +00:00
Greg Clayton 897f96a5d3 Fixed the dispatch queue name retrieval for threads by looking in an extra
shlib.

llvm-svn: 116315
2010-10-12 17:33:06 +00:00
Johnny Chen ae19e46ca5 Update comments.
llvm-svn: 116309
2010-10-12 15:53:22 +00:00