Commit Graph

1523 Commits

Author SHA1 Message Date
Johnny Chen f4a75d880d Fix compile time warnings for the inferior program.
llvm-svn: 150205
2012-02-09 20:29:11 +00:00
Johnny Chen 235df4f687 Setting terminal type to 'xterm' on Darwin; otherwise, to 'vt100'.
llvm-svn: 150198
2012-02-09 19:34:25 +00:00
Johnny Chen acdde195fb Add error handling for missing option terminator "--" and a test scenario for it.
Also fix a logic error for a missing return stmt. Oops.

llvm-svn: 150195
2012-02-09 18:44:27 +00:00
Johnny Chen 57816730f0 Add safe guard for when the 'expect' program cannot be located and skip the test.
llvm-svn: 150133
2012-02-09 02:01:59 +00:00
Johnny Chen 177df6f35c Set the terminal type to 'xterm' before doing 'stty -a'.
llvm-svn: 150127
2012-02-09 01:16:04 +00:00
Johnny Chen 4dcad1437c Make the expect_prompt more strict.
llvm-svn: 150124
2012-02-09 00:51:41 +00:00
Johnny Chen 7cc99dc40f Add a case to test that 'stty -a' displays the same output before and after running the lldb command.
llvm-svn: 150119
2012-02-09 00:27:01 +00:00
Johnny Chen 2ffa754a6f After discussions with Jim and Greg, modify the 'watchpoint set' command to become a mutiword command
with subcommand 'expression' and 'variable'.  The first subcommand is for supplying an expression to
be evaluated into an address to watch for, while the second is for watching a variable.

'watchpoint set expression' is a raw command, which means that you need to use the "--" option terminator
to end the '-w' or '-x' option processing and to start typing your expression.

Also update several test cases to comply and add a couple of test cases into TestCompletion.py,
in particular, test that 'watchpoint set ex' completes to 'watchpoint set expression ' and that
'watchpoint set var' completes to 'watchpoint set variable '.

llvm-svn: 150109
2012-02-08 22:37:48 +00:00
Johnny Chen 34ddc8db22 Refine the 'watchpoint set' command to now require either the '-v' option (for watching of a variable) or
the '-e' option (for watching of an address) to be present.

Update some existing test cases with the required option and add some more test cases.

Since the '-v' option takes <variable-name> and the '-e' option takes <expr> as the command arg,
the existing infrastructure for generating the option usage can produce confusing help message,
like:

  watchpoint set -e [-w <watch-type>] [-x <byte-size>] <variable-name | expr>
  watchpoint set -v [-w <watch-type>] [-x <byte-size>] <variable-name | expr>

The solution adopted is to provide an extra member field to the struct CommandArgumentData called
(uint32_t)arg_opt_set_association, whose purpose is to link this particular argument data with some
option set(s).  Also modify the signature of CommandObject::GetFormattedCommandArguments() to:

  GetFormattedCommandArguments (Stream &str, uint32_t opt_set_mask = LLDB_OPT_SET_ALL)

it now takes an additional opt_set_mask which can be used to generate a filtered formatted command
args for help message.

Options::GenerateOptionUsage() impl is modified to call the GetFormattedCommandArguments() appropriately.
So that the help message now looks like:

  watchpoint set -e [-w <watch-type>] [-x <byte-size>] <expr>
  watchpoint set -v [-w <watch-type>] [-x <byte-size>] <variable-name>

rdar://problem/10703256

llvm-svn: 150032
2012-02-08 01:13:31 +00:00
Johnny Chen a2791f8aeb Special build dictionary needs the same dictionary when specifying the after-the-test cleanup.
llvm-svn: 149900
2012-02-06 21:11:17 +00:00
Johnny Chen 3397e7cd22 Fix a typo in specifying the error path when launching the inferior.
llvm-svn: 149899
2012-02-06 21:07:21 +00:00
Johnny Chen a27a16c04d Print out the frame only if self.TraceOn() is True.
llvm-svn: 149893
2012-02-06 19:36:29 +00:00
Johnny Chen 2eb6c3d246 Add regular C++ inheritance in addition to the virtual inheritance to TestCppValueCast.py.
Plus mark the virtual inheritance test cases as expected failures.

llvm-svn: 149891
2012-02-06 19:14:44 +00:00
Greg Clayton 5569e64ea7 Removed all of the "#ifndef SWIG" from the SB header files since we are using
interface (.i) files for each class.

Changed the FindFunction class from:

uint32_t
SBTarget::FindFunctions (const char *name, 
                         uint32_t name_type_mask, 
                         bool append, 
                         lldb::SBSymbolContextList& sc_list)

uint32_t
SBModule::FindFunctions (const char *name, 
                         uint32_t name_type_mask, 
                         bool append, 
                         lldb::SBSymbolContextList& sc_list)

To:

lldb::SBSymbolContextList
SBTarget::FindFunctions (const char *name, 
                         uint32_t name_type_mask = lldb::eFunctionNameTypeAny);

lldb::SBSymbolContextList
SBModule::FindFunctions (const char *name,
                         uint32_t name_type_mask = lldb::eFunctionNameTypeAny);

This makes the API easier to use from python. Also added the ability to
append a SBSymbolContext or a SBSymbolContextList to a SBSymbolContextList.

Exposed properties for lldb.SBSymbolContextList in python:

lldb.SBSymbolContextList.modules => list() or all lldb.SBModule objects in the list
lldb.SBSymbolContextList.compile_units => list() or all lldb.SBCompileUnits objects in the list
lldb.SBSymbolContextList.functions => list() or all lldb.SBFunction objects in the list
lldb.SBSymbolContextList.blocks => list() or all lldb.SBBlock objects in the list
lldb.SBSymbolContextList.line_entries => list() or all lldb.SBLineEntry objects in the list
lldb.SBSymbolContextList.symbols => list() or all lldb.SBSymbol objects in the list

This allows a call to the SBTarget::FindFunctions(...) and SBModule::FindFunctions(...)
and then the result can be used to extract the desired information:

sc_list = lldb.target.FindFunctions("erase")

for function in sc_list.functions:
    print function
for symbol in sc_list.symbols:
    print symbol

Exposed properties for the lldb.SBSymbolContext objects in python:

lldb.SBSymbolContext.module => lldb.SBModule
lldb.SBSymbolContext.compile_unit => lldb.SBCompileUnit
lldb.SBSymbolContext.function => lldb.SBFunction
lldb.SBSymbolContext.block => lldb.SBBlock
lldb.SBSymbolContext.line_entry => lldb.SBLineEntry
lldb.SBSymbolContext.symbol => lldb.SBSymbol


Exposed properties for the lldb.SBBlock objects in python:

lldb.SBBlock.parent => lldb.SBBlock for the parent block that contains
lldb.SBBlock.sibling => lldb.SBBlock for the sibling block to the current block
lldb.SBBlock.first_child => lldb.SBBlock for the first child block to the current block
lldb.SBBlock.call_site => for inline functions, return a lldb.declaration object that gives the call site file, line and column
lldb.SBBlock.name => for inline functions this is the name of the inline function that this block represents
lldb.SBBlock.inlined_block => returns the inlined function block that contains this block (might return itself if the current block is an inlined block)
lldb.SBBlock.range[int] => access the address ranges for a block by index, a list() with start and end address is returned
lldb.SBBlock.ranges => an array or all address ranges for this block
lldb.SBBlock.num_ranges => the number of address ranges for this blcok

SBFunction objects can now get the SBType and the SBBlock that represents the
top scope of the function.

SBBlock objects can now get the variable list from the current block. The value
list returned allows varaibles to be viewed prior with no process if code
wants to check the variables in a function. There are two ways to get a variable
list from a SBBlock:

lldb::SBValueList
SBBlock::GetVariables (lldb::SBFrame& frame,
                       bool arguments,
                       bool locals,
                       bool statics,
                       lldb::DynamicValueType use_dynamic);

lldb::SBValueList
SBBlock::GetVariables (lldb::SBTarget& target,
                       bool arguments,
                       bool locals,
                       bool statics);

When a SBFrame is used, the values returned will be locked down to the frame
and the values will be evaluated in the context of that frame.

When a SBTarget is used, global an static variables can be viewed without a
running process.

llvm-svn: 149853
2012-02-06 01:44:54 +00:00
Sean Callanan 5b26f27f46 I have brought LLDB up-to-date with top of tree
LLVM/Clang.  This brings in several fixes, including:

- Improvements in the Just-In-Time compiler's
  allocation of memory: the JIT now allocates
  memory in chunks of sections, improving its
  ability to generate relocations.  I have
  revamped the RecordingMemoryManager to reflect
  these changes, as well as to get the memory
  allocation and data copying out fo the
  ClangExpressionParser code.  Jim Grosbach wrote
  the updates to the JIT on the LLVM side.

- A new ExternalASTSource interface to allow LLDB to
  report accurate structure layout information to
  Clang.  Previously we could only report the sizes
  of fields, not their offsets.  This meant that if
  data structures included field alignment
  directives, we could not communicate the necessary
  alignment to Clang and accesses to the data would
  fail.  Now we can (and I have update the relevant
  test case).  Thanks to Doug Gregor for implementing
  the Clang side of this fix.

- The way Objective-C interfaces are completed by
  Clang has been made consistent with RecordDecls;
  with help from Doug Gregor and Greg Clayton I have
  ensured that this still works.

- I have eliminated all local LLVM and Clang patches,
  committing the ones that are still relevant to LLVM
  and Clang as needed.

I have tested the changes extensively locally, but
please let me know if they cause any trouble for you.

llvm-svn: 149775
2012-02-04 08:49:35 +00:00
Greg Clayton 81e871ed76 Convert all python objects in our API to use overload the __str__ method
instead of the __repr__. __repr__ is a function that should return an
expression that can be used to recreate an python object and we were using
it to just return a human readable string.

Fixed a crasher when using the new implementation of SBValue::Cast(SBType).

Thread hardened lldb::SBValue and lldb::SBWatchpoint and did other general
improvements to the API.

Fixed a crasher in lldb::SBValue::GetChildMemberWithName() where we didn't
correctly handle not having a target.

llvm-svn: 149743
2012-02-04 02:27:34 +00:00
Johnny Chen b428b69745 Add test cases for SBValue.Cast(SBType). The test logic needs more polishing.
llvm-svn: 149741
2012-02-04 02:07:33 +00:00
Johnny Chen 9dad8ae6c6 Fix typos.
llvm-svn: 149710
2012-02-03 20:50:56 +00:00
Johnny Chen 15f247ad8c Add test cases for APIs to get template arguments from an SBType.
llvm-svn: 149707
2012-02-03 20:43:00 +00:00
Enrico Granata 4cee9e5247 Fixing issues where synthetic children providers for STL containers std::list and std::map where not doing their job properly
llvm-svn: 149700
2012-02-03 18:11:52 +00:00
Johnny Chen 60b4f13c11 Add a couple of simple completion test cases for 'target ' and 'target va'.
llvm-svn: 149656
2012-02-03 01:14:42 +00:00
Enrico Granata a6a60d0d87 Added a new --omit-names (-O, uppercase letter o) option to "type summary add".
When used in conjunction with --inline-children, this option will cause the names of the values to be omitted from the output. This can be beneficial in cases such as vFloat, where it will compact the representation from
([0]=1,[1]=2,[2]=3,[3]=4) to (1, 2, 3, 4).
Added a test case to check that the new option works correctly.
Also took some time to revisit SummaryFormat and related classes and tweak them for added readability and maintainability.
Finally, added a new class name to which the std::string summary should be applied.

llvm-svn: 149644
2012-02-02 23:34:52 +00:00
Johnny Chen fd72fbef41 For processes which are not in one of the "launched and stopped" state, 'target variable' command
should use Target::ReadMemory() call to read from the file section offset address.
Also remove the @expectedFailure decorator..

'target variable' command fails if the target program has been run
rdar://problem/9763907

llvm-svn: 149629
2012-02-02 19:55:18 +00:00
Johnny Chen ccfa90a5fe Fix indentation.
llvm-svn: 149529
2012-02-01 19:35:55 +00:00
Johnny Chen 3cfb9c672c Add @expectedFailure decorators.
llvm-svn: 149519
2012-02-01 18:26:25 +00:00
Johnny Chen fdc80a5cf7 lldb should warn when dSYM does not match the binary.
o Symbols.cpp:

  Emit a warning message when dSYM does not match the binary.

o warnings/uuid:

  Added regression test case.

o lldbtest.py:

  Modified to allow test case writer to demand that the build command does not begin
  with a clean first; required to make TestUUIDMismatchWanring.py work.

rdar://problem/10515708

llvm-svn: 149465
2012-02-01 01:49:50 +00:00
Enrico Granata 8680c713a6 remove spurious leftover code from std::list testcase
llvm-svn: 149461
2012-02-01 00:43:33 +00:00
Greg Clayton fbf1b64173 Added fuzz testing for when we call API calls with an invalid object.
We previously weren't catching that SBValue::Cast(...) would crash
if we had an invalid (empty) SBValue object.

Cleaned up the SBType API a bit.

llvm-svn: 149447
2012-01-31 23:19:33 +00:00
Enrico Granata 896e4bd7d5 Test case for std::map synthetic children provider (currently an expected failure)
llvm-svn: 149421
2012-01-31 21:30:00 +00:00
Enrico Granata 726fa56fcb Test case for std::list synthetic children provider (currently an expected failure)
llvm-svn: 149420
2012-01-31 21:27:09 +00:00
Enrico Granata d197e7b24f Test case for std::vector synthetic children provider
llvm-svn: 149419
2012-01-31 21:03:57 +00:00
Enrico Granata 56a27bb5fa Splitting test case for Python synthetic children: part 1 test is only testing the synthetic children feature itself. More test cases will be commited for individual STL containers
llvm-svn: 149393
2012-01-31 17:50:00 +00:00
Johnny Chen 6b68c98f7d Add some more test cases for the "watchpoint set" command.
llvm-svn: 149324
2012-01-31 01:26:28 +00:00
Johnny Chen 5d0d607b6b Add a period.
llvm-svn: 149305
2012-01-31 00:48:02 +00:00
Johnny Chen 8f8a2a7774 Add a '-u ENV_VAR_NAME' option to the test driver, whose purpose is to unset the said
environment variable before starting the test runner which executes the test cases and
may spawn child processes.  An example:

    ./dotest.py -u MY_ENV1 -u MY_ENV2 -v -p TestWatchLocationWithWatchSet.py

llvm-svn: 149304
2012-01-31 00:38:03 +00:00
Johnny Chen 5b3b5f07fe Fixed a typo in the test case. Updated comment.
llvm-svn: 149295
2012-01-30 23:17:07 +00:00
Johnny Chen dedb67ab9b Add "watch set" command as a more general interface in conjunction with "frame var -w".
Also add test cases for watching a variable as well as a location expressed as an expression.

o TestMyFirstWatchpoint.py:

  Modified to test "watchpoint set -w write global".

o TestWatchLocationWithWatchSet.py:

  Added to test "watchpoint set -w write -x 1 g_char_ptr + 7" where a contrived example program
  with several threads is supposed to only access the array index within the range [0..6], but
  there's some misbehaving thread writing past the range.

rdar://problem/10701761

llvm-svn: 149280
2012-01-30 21:46:17 +00:00
Johnny Chen 11c00fc7b2 Move argument checking/manipulation into the front of the function.
llvm-svn: 148974
2012-01-25 20:50:21 +00:00
Johnny Chen 8d24390cad Clearify some comment.
llvm-svn: 148972
2012-01-25 20:29:26 +00:00
Johnny Chen 78e49e7fee Cleanup docstring and remove dead code.
llvm-svn: 148971
2012-01-25 20:25:38 +00:00
Johnny Chen f41385f9be Add some more test cases for command completion:
o complete an unambiguous option
  o complete/list the available option values
  o complete/list the candidate command names

llvm-svn: 148899
2012-01-25 01:37:36 +00:00
Johnny Chen d0077903d0 Modify redo.py script so that if sessin_dir is left unspecified, it uses the heuristic
to find the possible session directories with names starting with %Y-%m-%d- (for example,
2012-01-23-) and employs the one with the latest timestamp.  For example:

johnny:/Volumes/data/lldb/svn/latest/test $ ./redo.py 
Using session dir path: /Volumes/data/lldb/svn/latest/test/2012-01-23-11_28_30
adding filterspec: DisassembleRawDataTestCase.test_disassemble_raw_data
Running ./dotest.py  -C clang  -v -t -f DisassembleRawDataTestCase.test_disassemble_raw_data
LLDB build dir: /Volumes/data/lldb/svn/latest/build/Debug
LLDB-108
Path: /Volumes/data/lldb/svn/latest
URL: https://johnny@llvm.org/svn/llvm-project/lldb/trunk
Repository Root: https://johnny@llvm.org/svn/llvm-project
Repository UUID: 91177308-0d34-0410-b5e6-96231b3b80d8
Revision: 148710
Node Kind: directory
Schedule: normal
Last Changed Author: gclayton
Last Changed Rev: 148650
Last Changed Date: 2012-01-21 18:55:08 -0800 (Sat, 21 Jan 2012)



Session logs for test failures/errors/unexpected successes will go into directory '2012-01-23-17_04_48'
Command invoked: python ./dotest.py -C clang -v -t -f DisassembleRawDataTestCase.test_disassemble_raw_data

Configuration:  compiler=clang
----------------------------------------------------------------------
Collected 1 test

Change dir to: /Volumes/data/lldb/svn/latest/test/python_api/disassemble-raw-data
1: test_disassemble_raw_data (TestDisassembleRawData.DisassembleRawDataTestCase)
   Test disassembling raw bytes with the API. ... 
Raw bytes:    ['0x48', '0x89', '0xe5']
Disassembled: movq   %rsp, %rbp
ok
Restore dir to: /Volumes/data/lldb/svn/latest/test

----------------------------------------------------------------------
Ran 1 test in 0.233s

OK

llvm-svn: 148766
2012-01-24 01:53:02 +00:00
Johnny Chen 8cc80b2914 Followup check in for http://llvm.org/viewvc/llvm-project?rev=148491&view=rev,
where we changed the CommandObjectSettingsSet object impl to require raw command string.

Do the same for CommandObjectSettingsAppend/InsertBefore/InsertAfter classes and
add test cases for basic functionalities as well as for variable name completion.

llvm-svn: 148719
2012-01-23 19:49:28 +00:00
Johnny Chen e20e9aeb25 Dump the raw bytes and the disassembled instruction before calling self.assertTrue() instead of after,
in case the assert fails for any reason.

llvm-svn: 148717
2012-01-23 19:37:53 +00:00
Johnny Chen 5928f64e2c Followup check in for http://llvm.org/viewvc/llvm-project?rev=148491&view=rev,
where we changed the CommandObjectSettingsSet object impl to require raw command string.

Do the same for CommandObjectSettingsReplace class and add two test cases; one for
the "settings replace" command and the other to ensure that completion for variable
name still works. 

llvm-svn: 148615
2012-01-21 01:45:18 +00:00
Johnny Chen 5b201cf86c Add comment.
llvm-svn: 148602
2012-01-21 00:08:37 +00:00
Johnny Chen 384dd63189 A little bit of cleanup to make the code more understandable.
llvm-svn: 148600
2012-01-20 23:34:35 +00:00
Johnny Chen 98aceb08f8 o CommandObjectSettingsSet.cpp:
Fix a bug where "settings set -r th" wouldn't complete.

o UserSettingsController.cpp:

  Fix a bug where "settings set target.process." wouldn't complete.

o test/functionalities/completion:

  Add various completion test cases related to 'settings set' command.

llvm-svn: 148596
2012-01-20 23:02:51 +00:00
Johnny Chen a28b89c700 rdar://problem/10712130
Fixed an issue where backtick char is not properly honored when setting the frame-format variable, like the following:

(lldb) settings set frame-format frame #${frame.index}: ${frame.pc}{ ${module.file.basename}{`${function.name-with-args}${function.pc-offset}}}{ at ${line.file.basename}:${line.number}}\n
(lldb) settings show frame-format
frame-format (string) = "frame #${frame.index}: ${frame.pc}{ `${module.file.basename}{${function.name-with-args}${function.pc-offset}}}{` at ${line.file.basename}:${line.number}}\n"
(lldb)

o CommandObjectSettings.h/.cpp:

  Modify the command object impl to require raw command string instead of parsed command string,
  which also fixes an outstanding issue that customizing the prompt with trailing spaces doesn't
  work.

o Args.cpp:

  During CommandInterpreter::HandleCommand(), there is a PreprocessCommand phase which already
  strips/processes pairs of backticks as an expression eval step.  There's no need to treat
  a backtick as starting a quote.

o TestAbbreviations.py and change_prompt.lldb:

  Fixed incorrect test case/logic.

o TestSettings.py:

  Remove expectedFailure decorator.

llvm-svn: 148491
2012-01-19 19:22:41 +00:00
Johnny Chen 8715c517d5 Add comment regarding TestHelloWorld.py's use of a dictionary to specify/overwrite the EXE name.
llvm-svn: 148418
2012-01-18 21:22:38 +00:00
Johnny Chen fef3e2797a Modify the test cases so that each uses a unique executable name for the debugger to attach/launch.
I've see cases where there are lingering processes ("hello_world") staying around and the
test_with_dsym_and_attach_to_process_with_name_api() test case just hangs.

llvm-svn: 148417
2012-01-18 21:20:03 +00:00
Johnny Chen 41b780d704 Add a test case where 'settings set frame-format' supplies a format string containing, among other things, a single backtick character.
rdar://problem/10712130

llvm-svn: 148403
2012-01-18 19:07:08 +00:00
Johnny Chen bc774c1156 Add a '-X excluded-dir' option to the test driver to exclude a directory from consideration during test discovery. For example:
./dotest.py -X types -v

from the test dir will ignore test cases under test/types.

llvm-svn: 148379
2012-01-18 05:15:00 +00:00
Jim Ingham 5c93906cbf Fix the test properly now that SBValue::GetValueAsUnsigned works for bitfields.
llvm-svn: 148280
2012-01-17 02:17:45 +00:00
Johnny Chen 2e275c9e6a Add usage example of specifying the full path to the compiler used while building the debuggees for running the test suite.
llvm-svn: 148273
2012-01-17 01:26:06 +00:00
Johnny Chen 64a7e741b0 Add usage example from test/functionalities/archives/Makefile.
llvm-svn: 148269
2012-01-17 00:58:08 +00:00
Johnny Chen fb05d23789 Add some description for this test directory.
llvm-svn: 148075
2012-01-13 00:24:11 +00:00
Johnny Chen 7840c81df2 Modify a couple of Makefiles to use clang instead of gcc, since gcc is being deprecated.
llvm-svn: 148071
2012-01-12 23:50:28 +00:00
Johnny Chen fe14162e71 rdar://problem/10680957
Need a test case that tests DWARF with .o in .a files

test/functionalities/archives:

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

test/make/makefile.rules:

Some additional rules to sepcify archive building.  For example:

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

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

Since we are launch the inferior with:

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

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

llvm-svn: 147983
2012-01-12 00:29:46 +00:00
Johnny Chen 4876b5fccd Add more usage examples.
llvm-svn: 147909
2012-01-11 01:59:55 +00:00
Johnny Chen e9f97704ea Add usage examples of recently added functionality.
llvm-svn: 147907
2012-01-11 01:42:58 +00:00
Johnny Chen c260232dfa Add comment for build_and_run_with_source_atoms_expr() and remove redundant #include from basic_type.cpp.
llvm-svn: 147895
2012-01-10 23:36:06 +00:00
Johnny Chen 0d81fe7a77 Add documentation for the generic functions build_and_run() and build_and_run_expr() called from
the Test*Types*.py test cases.

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

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

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

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

llvm-svn: 147814
2012-01-10 00:00:15 +00:00
Johnny Chen c2a64b9b90 Fix comment.
llvm-svn: 147789
2012-01-09 19:19:23 +00:00
Greg Clayton 0f28986a54 Patch from Enrico Granata that moves SBData related functions into the SBData
class instead of requiring a live process in order to be able to create useful
SBData objects.

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

Patch submitted by Enrico Granata.

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

Patch submitted by Enrico Granata.

llvm-svn: 147637
2012-01-06 00:35:38 +00:00
Sean Callanan 3c88eae154 Fixed a problem in our local Clang's method for
performing Objective-C instance variable lookup.
Previously, it only completed the derived class
that was the beginning of the search.  Now, as
it walks up the superclass chain looking for the
ivar, it completes each superclass in turn.

Also added a testcase covering this issue.

llvm-svn: 147621
2012-01-05 22:35:40 +00:00
Greg Clayton dcad5021d4 <rdar://problem/10546739>
Fixed SBValue::GetValueAsUnsigned() and SBValue::GetValueAsSigned() calls to
work for bitfields.

llvm-svn: 147332
2011-12-29 01:26:56 +00:00
Johnny Chen 3f0b90dcd0 rdar://problem/10216227
LLDB (python bindings) Crashing in lldb::SBDebugger::DeleteTarget(lldb::SBTarget&)

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

llvm-svn: 147213
2011-12-23 00:53:45 +00:00
Jim Ingham f74c2348b7 Added a bunch more structure return tests.
llvm-svn: 147212
2011-12-23 00:49:32 +00:00
Johnny Chen a33843f5b4 Decorate the two test cases in TestReturnValue.py as i386 only expectedFailure, aka @expectedFailurei386.
llvm-svn: 147177
2011-12-22 21:14:31 +00:00
Johnny Chen 3239124460 Indentation.
llvm-svn: 147172
2011-12-22 20:21:46 +00:00
Johnny Chen 025c58fc15 Patches for running some of the Linux tests from Dawn, thanks!
With some minor modification from me.

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

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

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

Also added a testcase for -o enabled and disabled.

llvm-svn: 147099
2011-12-21 22:22:58 +00:00
Johnny Chen 4b730a73a2 Fix wrong test method name.
llvm-svn: 147072
2011-12-21 19:56:51 +00:00
Johnny Chen 5d95a87c4b Properly name the test class as well as the test methods.
llvm-svn: 146957
2011-12-20 02:14:01 +00:00
Johnny Chen 2c684f00a3 Properly name the test class as well as the test methods.
llvm-svn: 146956
2011-12-20 02:11:37 +00:00
Johnny Chen 50660440a1 Work in progress for:
rdar://problem/10577182
Audit lldb API impl for places where we need to perform a NULL check

Add a NULL check for SBValue.CreateValueFromExpression().

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

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

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

Add NULL checks for SBStream APIs.

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

Add NULL checks for SBDebugger APIs.

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

Add NULL checks for SBCommandReturnObject.AppendMessage().

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

Add NULL checks for SBCommandInterpreter APIs.

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

Add NULL checks for SBModule and SBSection APIs.

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

llvm-svn: 146891
2011-12-19 19:38:39 +00:00
Johnny Chen cdd7e8b14a Fix Python docstring for SBThread.GetStopDescription().
llvm-svn: 146890
2011-12-19 19:38:09 +00:00
Jim Ingham f7f36dc694 Make the objc-dynamic-value test a little trickier (still passes) and test the GetDynamicValue API.
llvm-svn: 146777
2011-12-16 23:24:58 +00:00
Johnny Chen b456b792e0 http://llvm.org/bugs/show_bug.cgi?id=11588
valobj.AddressOf() returns None when an address is expected in a SyntheticChildrenProvider

Patch from Enrico Granata:

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

llvm-svn: 146540
2011-12-14 01:43:31 +00:00
Johnny Chen 798b0c8340 Print out the breakpoint description only if self.TraceOn() is True.
llvm-svn: 146539
2011-12-14 01:36:04 +00:00
Jim Ingham e81fc8e514 Add a pthreads testcase to make sure the two-step of running and expression,
having the block, then timing out & letting all threads run actually works.

llvm-svn: 146471
2011-12-13 04:04:44 +00:00
Johnny Chen 055d0c961b Rename some test methods, with no functionality change.
llvm-svn: 146429
2011-12-12 22:26:27 +00:00
Johnny Chen 1e4cd1fc97 Commenting out the two @expectedFailureClang decorators as the tests have been passing for a while
with the recent clang compilers.

The latest I tried is: Apple clang version 3.1 (tags/Apple/clang-318.0.9) (based on LLVM 3.1svn)

llvm-svn: 146427
2011-12-12 22:07:36 +00:00
Johnny Chen 64bab4894e rdar://problem/10227672
There were two problems associated with this radar:
1. "settings show target.source-map" failed to show the source-map after, for example,
   "settings set target.source-map /Volumes/data/lldb/svn/trunk/test/source-manager /Volumes/data/lldb/svn/trunk/test/source-manager/hidden"
   has been executed to set the source-map.
2. "list -n main" failed to display the source of the main() function after we properly set the source-map.

The first was fixed by adding the missing functionality to TargetInstanceSettings::GetInstanceSettingsValue (Target.cpp)
and updating the support files PathMappingList.h/.cpp; the second by modifying SourceManager.cpp to fix several places
with incorrect logic.

Also added a test case test_move_and_then_display_source() to TestSourceManager.py, which moves main.c to hidden/main.c,
sets target.source-map to perform the directory mapping, and then verifies that "list -n main" can still show the main()
function.

llvm-svn: 146422
2011-12-12 21:59:28 +00:00
Johnny Chen a9e77784e0 Move some print stmts to the test method, where they get printed only if the test is qualified to run
under the current test driver run configuration.

llvm-svn: 146320
2011-12-10 07:18:11 +00:00
Greg Clayton 3bffb085f4 <rdar://problem/10559329>
An assertion was firing when parsing types due to trying to complete parent
class decl contenxt types too often.

Also, relax where "dsymutil" binary can come from in the Makefile.rules.

llvm-svn: 146310
2011-12-10 02:15:28 +00:00
Greg Clayton 8f192cea00 We now have a test case for stopping within a module in a place where the
translation unit has a interface for a class "Bar" that contains hidden ivars
in the implementation and we make sure we can see these hidden ivars. We also
test the case where we stop in translation unit that contains the 
implementation first. So the test runs two tests:

1 - run and stop where we have an interface, run to main and print and make
    sure we find the hidden ivar
2 - run and stop where we have an implementation, run to main and print and make
    sure we find the hidden ivar
    

llvm-svn: 146216
2011-12-09 00:58:33 +00:00
Sean Callanan 12014a0471 If the expression parser is unable to complete a TagDecl
in the context in which it was originally found, the
expression parser now goes hunting for it in all modules
(in the appropriate namespace, if applicable).  This means
that forward-declared types that exist in another shared
library will now be resolved correctly.

Added a test case to cover this.  The test case also tests
"frame variable," which does not have this functionality
yet.

llvm-svn: 146204
2011-12-08 23:45:45 +00:00
Jim Ingham 60dbabbaa7 Add SBValue::GetDynamicValue and SBValue::GetStaticValue API's.
<rdar://problem/10545069>

llvm-svn: 146173
2011-12-08 19:44:08 +00:00
Sean Callanan 5780f9df56 Added the ability to dereference an Objective-C object
pointer to make the result of an expression.  LLDB now
dumps the ivars of the Objective-C object and all of
its parents.  This just required fixing a bug where we
didn't distinguish between Objective-C object pointers
and regular C-style pointers.

Also added a testcase to verify that this continues to
work.

llvm-svn: 146164
2011-12-08 19:04:34 +00:00
Jim Ingham f80bc3f447 Get the bit-field offset & size for ObjC ivars that are bitfields.
<rdar://problem/10535460> lldb expression evaluation doesn't handle bit fields in ObjC classes properly

llvm-svn: 146134
2011-12-08 02:53:10 +00:00
Johnny Chen 1669f67776 Modified the script to have the flexibility of specifying the gdb executable path
for use in the benchmark against lldb's disassembly speed.  Note that the lldb
executable path can already be specified using the LLDB_EXEC env variable.

rdar://problem/7511194

llvm-svn: 146050
2011-12-07 19:27:06 +00:00
Greg Clayton dfb6dc9187 Added a code for a test to find the real Objective C class definition. I
still need to write the test case file.

llvm-svn: 145756
2011-12-03 04:35:51 +00:00
Johnny Chen 5daa6de433 Let's also record the compiler version used for compiling the inferior into the session info
llvm-svn: 145732
2011-12-03 00:16:59 +00:00
Johnny Chen 60e2c6aa43 rdar://problem/10501020
ClangASTSource::~ClangASTSource() was calling

    ClangASTContext *scratch_clang_ast_context = m_target->GetScratchClangASTContext();

which had the side effect of deleting this very ClangASTSource instance.  Not good.
Change it to

    // We are in the process of destruction, don't create clang ast context on demand
    // by passing false to Target::GetScratchClangASTContext(create_on_demand).
    ClangASTContext *scratch_clang_ast_context = m_target->GetScratchClangASTContext(false);

The Target::GetScratchClangASTContext(bool create_on_demand=true) has a new signature.

llvm-svn: 145537
2011-11-30 23:18:53 +00:00
Sean Callanan 09ab4b777c Added support to the Objective-C language runtime
to find Objective-C class types by looking in the
symbol tables for the individual object files.

I did this as follows:

- I added code to SymbolFileSymtab that vends
  Clang types for symbols matching the pattern
  "_OBJC_CLASS_$_NSMyClassName," making them
  appear as Objective-C classes.  This only occurs
  in modules that do not have debug information,
  since otherwise SymbolFileDWARF would be in
  charge of looking up types.

- I made a new SymbolVendor subclass for the
  Apple Objective-C runtime that is in charge of
  making global lookups of Objective-C types.  It
  currently just sends out type lookup requests to
  the appropriate SymbolFiles, but in the future we
  will probably extend it to query the runtime more
  completely.

I also modified a testcase whose behavior is changed
by the fact that we now actually return an Objective-C
type for __NSCFString.

llvm-svn: 145526
2011-11-30 22:11:59 +00:00
Johnny Chen 442b57c64d Add processing of '-help' option.
llvm-svn: 145516
2011-11-30 19:46:37 +00:00
Johnny Chen 99bb50c10d rdar://problem/9211445
Fix wrong test logic in test_modules_search_paths().  Add additional exercising of 'target modules search-paths list/query".
There is a reproducible crash if 'target modules search-paths clear' is exercised during test teardown.
So we currently comment out the stmt as follows:

        # Add teardown hook to clear image-search-paths after the test.
        # rdar://problem/10501020
        # Uncomment the following to reproduce 10501020.
        #self.addTearDownHook(lambda: self.runCmd("target modules search-paths clear"))

llvm-svn: 145466
2011-11-30 01:33:59 +00:00
Johnny Chen 9db304ac7a Add bench entries.
llvm-svn: 145417
2011-11-29 19:13:38 +00:00
Johnny Chen 49cb85db64 SBProcess.PutSTDIN() needs to be properly typemapped when swigging,
so that we can do Python scripting like this:

        target = self.dbg.CreateTarget(self.exe)

        self.dbg.SetAsync(True)
        process = target.LaunchSimple(None, None, os.getcwd())

        process.PutSTDIN("Line 1 Entered.\n")
        process.PutSTDIN("Line 2 Entered.\n")
        process.PutSTDIN("Line 3 Entered.\n")

Add TestProcessIO.py to exercise the process IO API: PutSTDIN()/GetSTDOUT()/GetSTDERR().

llvm-svn: 145282
2011-11-28 21:39:07 +00:00
Greg Clayton cbe1a331ae Fixed an issue where we might cause our test suite to exit if we end up
concatenating a string with "None" in python. Using a python format string
gets us around this by handling it gracefully.

llvm-svn: 145225
2011-11-28 03:17:13 +00:00
Johnny Chen 5d77667f28 Redirect the stderr output into a file so as to not pollute the terminal.
llvm-svn: 144958
2011-11-18 00:58:29 +00:00
Johnny Chen 6949f38985 Do not print debug messages if self.TraceON() is False.
llvm-svn: 144945
2011-11-18 00:30:58 +00:00
Johnny Chen 316651ab21 Add a simple progress bar when neither '-v' nor '-t' is specified.
llvm-svn: 144940
2011-11-18 00:19:29 +00:00
Johnny Chen 0fddfb2ceb Add an option '-S' to skip the build and cleanup while running the test.
Use this option with care as you would need to build the inferior(s) by hand
and build the executable(s) with the correct name(s).  This option can be used
with '-# n' to stress test certain test cases for n number of times.

An example:

[11:55:11] johnny:/Volumes/data/lldb/svn/trunk/test/python_api/value $ ls
Makefile		TestValueAPI.pyc	linked_list
TestValueAPI.py		change_values		main.c
[11:55:14] johnny:/Volumes/data/lldb/svn/trunk/test/python_api/value $ make EXE=test_with_dsym
clang -gdwarf-2 -O0  -arch x86_64   -c -o main.o main.c
clang -gdwarf-2 -O0  -arch x86_64   main.o -o "test_with_dsym"
/usr/bin/dsymutil  -o "test_with_dsym.dSYM" "test_with_dsym"
[11:55:20] johnny:/Volumes/data/lldb/svn/trunk/test/python_api/value $ cd ../..
[11:55:24] johnny:/Volumes/data/lldb/svn/trunk/test $ ./dotest.py -v -# 10 -S -f ValueAPITestCase.test_with_dsym
LLDB build dir: /Volumes/data/lldb/svn/trunk/build/Debug
LLDB-89
Path: /Volumes/data/lldb/svn/trunk
URL: https://johnny@llvm.org/svn/llvm-project/lldb/trunk
Repository Root: https://johnny@llvm.org/svn/llvm-project
Repository UUID: 91177308-0d34-0410-b5e6-96231b3b80d8
Revision: 144914
Node Kind: directory
Schedule: normal
Last Changed Author: gclayton
Last Changed Rev: 144911
Last Changed Date: 2011-11-17 09:22:31 -0800 (Thu, 17 Nov 2011)



Session logs for test failures/errors/unexpected successes will go into directory '2011-11-17-11_55_29'
Command invoked: python ./dotest.py -v -# 10 -S -f ValueAPITestCase.test_with_dsym
----------------------------------------------------------------------
Collected 1 test

1: test_with_dsym (TestValueAPI.ValueAPITestCase)
   Exercise some SBValue APIs. ... ok

----------------------------------------------------------------------
Ran 1 test in 1.163s

OK
1: test_with_dsym (TestValueAPI.ValueAPITestCase)
   Exercise some SBValue APIs. ... ok

----------------------------------------------------------------------
Ran 1 test in 0.200s

OK
1: test_with_dsym (TestValueAPI.ValueAPITestCase)
   Exercise some SBValue APIs. ... ok

----------------------------------------------------------------------
Ran 1 test in 0.198s

OK
1: test_with_dsym (TestValueAPI.ValueAPITestCase)
   Exercise some SBValue APIs. ... ok

----------------------------------------------------------------------
Ran 1 test in 0.199s

OK
1: test_with_dsym (TestValueAPI.ValueAPITestCase)
   Exercise some SBValue APIs. ... ok

----------------------------------------------------------------------
Ran 1 test in 0.239s

OK
1: test_with_dsym (TestValueAPI.ValueAPITestCase)
   Exercise some SBValue APIs. ... ok

----------------------------------------------------------------------
Ran 1 test in 1.215s

OK
1: test_with_dsym (TestValueAPI.ValueAPITestCase)
   Exercise some SBValue APIs. ... ok

----------------------------------------------------------------------
Ran 1 test in 0.105s

OK
1: test_with_dsym (TestValueAPI.ValueAPITestCase)
   Exercise some SBValue APIs. ... ok

----------------------------------------------------------------------
Ran 1 test in 0.098s

OK
1: test_with_dsym (TestValueAPI.ValueAPITestCase)
   Exercise some SBValue APIs. ... ok

----------------------------------------------------------------------
Ran 1 test in 0.195s

OK
1: test_with_dsym (TestValueAPI.ValueAPITestCase)
   Exercise some SBValue APIs. ... ok

----------------------------------------------------------------------
Ran 1 test in 1.197s

OK
[11:55:34] johnny:/Volumes/data/lldb/svn/trunk/test $ 

llvm-svn: 144919
2011-11-17 19:57:27 +00:00
Johnny Chen 14c62c8d02 Rename test class appropriately.
llvm-svn: 144915
2011-11-17 18:47:38 +00:00
Johnny Chen 8eb14a9500 Docstring clarification.
llvm-svn: 144848
2011-11-16 22:44:28 +00:00
Johnny Chen 0bd8c311cb Also dump the pid of the process launching through the lldbtest.system(*popenargs, **kwargs) API.
This helps track down possible zombie processes.

llvm-svn: 144846
2011-11-16 22:41:53 +00:00
Johnny Chen 5faba0cc06 Remove invalid docstring (due to cut-and-paste error).
llvm-svn: 144807
2011-11-16 18:48:48 +00:00
Johnny Chen 4c1b096743 While we are at it, verify that 'my_int_ptr' points to 'g_my_int', using the SBTarget.ResolveLoadAddress() to get its SBAddress,
and SBAddress.GetSymbol() to get the corresponding symbol.

llvm-svn: 144728
2011-11-15 23:30:39 +00:00
Johnny Chen f031bb192f Fix objc runtime warnings from the inferior program.
llvm-svn: 144717
2011-11-15 22:42:53 +00:00
Johnny Chen 2341380033 Add test scenario for value.GetChildAtIndex(0) where value is a pointer to a simple type.
llvm-svn: 144697
2011-11-15 21:13:13 +00:00
Johnny Chen b057196543 File renaming.
llvm-svn: 144693
2011-11-15 20:36:57 +00:00
Sean Callanan d5c17edb04 Pulled in a new version of LLVM/Clang to solve a variety
of problems with Objective-C object completion.  To go
along with the LLVM/Clang-side fixes, we have a variety
of Objective-C improvements.

Fixes include:

- It is now possible to run expressions when stopped in
  an Objective-C class method and have "self" act just
  like "self" would act in the class method itself (i.e.,
  [self classMethod] works without casting the return
  type if debug info is present).  To accomplish this,
  the expression masquerades as a class method added by
  a category.

- Objective-C objects can now provide methods and
  properties and methods to Clang on demand (i.e., the
  ASTImporter sets hasExternalVisibleDecls on Objective-C
  interface objects).

- Objective-C built-in types, which had long been a bone
  of contention (should we be using "id"?  "id*"?), are
  now fetched correctly using accessor functions on
  ClangASTContext.  We inhibit searches for them in the
  debug information.

There are also a variety of logging fixes, and I made two
changes to the test suite:

- Enabled a test case for Objective-C properties in the
  current translation unit.

- Added a test case for calling Objective-C class methods
  when stopped in a class method.

llvm-svn: 144607
2011-11-15 02:11:17 +00:00
Johnny Chen 8bb27b23aa Add bench entries.
llvm-svn: 144584
2011-11-14 23:04:06 +00:00
Johnny Chen 6b0a1e3662 Dependency file for dylib source was not being cleaned up.
llvm-svn: 144546
2011-11-14 18:37:49 +00:00
Johnny Chen 9b54724cf7 Add more info on the failure.
llvm-svn: 144545
2011-11-14 18:33:39 +00:00
Greg Clayton ba174beaa6 Don't build optimized unless we are trying to test inlining.
llvm-svn: 144539
2011-11-14 17:57:30 +00:00
Greg Clayton 2fc93eabf7 <rdar://problem/10338439>
This is the actual fix for the above radar where global variables that weren't
initialized were not being shown correctly when leaving the DWARF in the .o 
files. Global variables that aren't intialized have symbols in the .o files
that specify they are undefined and external to the .o file, yet document the
size of the variable. This allows the compiler to emit a single copy, but makes
it harder for our DWARF in .o files with the executable having a debug map
because the symbol for the global in the .o file doesn't exist in a section
that we can assign a fixed up linked address to, and also the DWARF contains
an invalid address in the "DW_OP_addr" location (always zero). This means that
the DWARF is incorrect and actually maps all such global varaibles to the
first file address in the .o file which is usually the first function. So we
can fix this in either of two ways: make a new fake section in the .o file
so that we have a file address in the .o file that we can relink, or fix the 
the variable as it is created in the .o file DWARF parser and actually give it
the file address from the executable. Each variable contains a 
SymbolContextScope, or a single pointer that helps us to recreate where the
variables came from (which module, file, function, etc). This context helps
us to resolve any file addresses that might be in the location description of
the variable by pointing us to which file the file address comes from, so we
can just replace the SymbolContextScope and also fix up the location, which we
would have had to do for the other case as well, and update the file address.
Now globals display correctly.

The above changes made it possible to determine if a variable is a global
or static variable when parsing DWARF. The DWARF emits a DW_TAG_variable tag
for each variable (local, global, or static), yet DWARF provides no way for
us to classify these variables into these categories. We can now detect when
a variable has a simple address expressions as its location and this will help
us classify these correctly.

While making the above changes I also noticed that we had two symbol types:
eSymbolTypeExtern and eSymbolTypeUndefined which mean essentially the same
thing: the symbol is not defined in the current object file. Symbol objects
also have a bit that specifies if a symbol is externally visible, so I got
rid of the eSymbolTypeExtern symbol type and moved all code locations that
used it to use the eSymbolTypeUndefined type.
 

llvm-svn: 144489
2011-11-13 04:15:56 +00:00
Johnny Chen 10d7e4fe59 Make the test case more robust by using line number to break, instead.
llvm-svn: 144450
2011-11-12 02:30:23 +00:00
Jim Ingham e3ae82af89 Add code that reads the APPLE_property debug info, and makes up properties from them.
llvm-svn: 144440
2011-11-12 01:36:43 +00:00
Jim Ingham 0faa43f964 Do a better job of detecting when a breakpoint command has set the target running again (except you have to ignore
cases where the breakpoint runs expressions, those don't count as really "running again").

llvm-svn: 144064
2011-11-08 03:00:11 +00:00
Greg Clayton 1d8859668f Moved many of the "settings" that used to be in "target.process.*" to just
be in the target. All of the environment, args, stdin/out/err files, etc have
all been moved. Also re-enabled the ability to launch a process in a separate
terminal on MacOSX.

llvm-svn: 144061
2011-11-08 02:43:13 +00:00
Johnny Chen db02f3b4f4 Fix the test suite failure. The particular line in the test case was there since the initial version
dated 2010-21-15.  The test started failure recently probably due to work done on the command parsing.
Anyway, the specific test sequence is invalid and is fixed now.

llvm-svn: 144039
2011-11-07 23:26:12 +00:00
Enrico Granata 0a305db796 this patch addresses several issues with "command script" subcommands:
a) adds a new --synchronicity (-s) setting for "command script add" that allows the user to decide if scripted commands should run synchronously or asynchronously (which can make a difference in how events are handled)
 b) clears up several error messages
 c) adds a new --allow-reload (-r) setting for "command script import" that allows the user to reload a module even if it has already been imported before
 d) allows filename completion for "command script import" (much like what happens for "target create")
 e) prevents "command script add" from replacing built-in commands with scripted commands
 f) changes AddUserCommand() to take an std::string instead of a const char* (for performance reasons)
plus, it fixes an issue in "type summary add" command handling which caused several test suite errors

llvm-svn: 144035
2011-11-07 22:57:04 +00:00
Sean Callanan fc89c142d3 Added functionality to call Objective-C class methods
correctly, and added a testcase to check that it works.

The main problem here is that Objective-C class method
selectors are external references stored in a special
data structure in the LLVM IR module for an expression.
I just had to extract them and ensure that the real
class object locations were properly resolved.

llvm-svn: 143520
2011-11-01 23:38:03 +00:00
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
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
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
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
Johnny Chen ced5e7b99b Add bench entries.
llvm-svn: 143361
2011-10-31 20:29:36 +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
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
Johnny Chen ed00fa4554 Add bench entries.
llvm-svn: 143261
2011-10-29 00:35:28 +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
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
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
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
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
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
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
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
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
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
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
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
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