Commit Graph

3147 Commits

Author SHA1 Message Date
Johnny Chen 20208b37e3 Fix indentation and remove the private section of SBTypeList.
SWIG doesn't care about the private section of class SBTypeList.

llvm-svn: 136976
2011-08-05 20:30:56 +00:00
Johnny Chen 36c5eb1327 o modify-python-lldb.py:
Add the rich comparison methods (__eq__, __ne__) to SBType, too.

o lldbtest.py:

  Add debug utility method TestBase.DebugSBType().

o test/python_api/type:

  Add tests for exercising SBType/SBTypeList API, including the SBTarget.FindTypes(type_name)
  API which returns a SBTypeList matching the type_name.

llvm-svn: 136975
2011-08-05 20:17:27 +00:00
Johnny Chen 05c998ceda The recently introduced SBTypeList is also iterable.
This patch takes some time because the old Python constructor pattern was not a valid one,
and breaks with SBTypeList's __init__ signature.  Oops.

llvm-svn: 136958
2011-08-05 01:35:49 +00:00
Enrico Granata f1af1ed6d2 Option --regex (-x) now also works for synthetic children:
- Added a test case in python-synth
Minor code improvements in categories, making them ready for adding new element types

llvm-svn: 136957
2011-08-05 01:32:50 +00:00
Peter Collingbourne 2ced913c9c Complete Host::Backtrace prototype. Fixes Linux build.
llvm-svn: 136951
2011-08-05 00:35:43 +00:00
Johnny Chen 190f2b1c21 Remove expectedFailure decorator for test_SBType, which does not take an empty constructor after the recent changes.
And remove expectedFailure decorator for test_SBTypeMember, which no longer exists after the recent changes, replace
it with test_SBTypeList.

llvm-svn: 136947
2011-08-05 00:07:41 +00:00
Enrico Granata cd1c0236fe fixed a potential memory leak ; small improvement in the formatters lookup algorithm
llvm-svn: 136945
2011-08-04 23:37:18 +00:00
Johnny Chen 0affe0213d Print out the stopwatch (which contains laps, total elapsed time, and average)
instead of just the average.

llvm-svn: 136932
2011-08-04 22:05:36 +00:00
Johnny Chen e464282f29 Add a benchmark comparing lldb vs. gdb with disassembly on a large function (lldb's Driver::MainLoop()).
Sample run on my OSX Lion (MacBook Pro):

1: test_run_gdb_then_lldb (TestDisassembly.DisassembleDriverMainLoop)
   Test disassembly on a large function with lldb vs. gdb. ... 
gdb benchmark: Avg: 0.201802 (Laps: 5, Total Elapsed Time: 1.009008)
lldb benchmark: Avg: 0.109569 (Laps: 5, Total Elapsed Time: 0.547843)
lldb_avg/gdb_avg: 0.542952
ok
2: test_run_lldb_then_gdb (TestDisassembly.DisassembleDriverMainLoop)
   Test disassembly on a large function with lldb vs. gdb. ... 
lldb benchmark: Avg: 0.109580 (Laps: 5, Total Elapsed Time: 0.547902)
gdb benchmark: Avg: 0.201587 (Laps: 5, Total Elapsed Time: 1.007936)
lldb_avg/gdb_avg: 0.543588
ok

llvm-svn: 136931
2011-08-04 22:01:21 +00:00
Sean Callanan 0c4d8d25a7 Fixed a problem that caused LLDB to fail to execute
expressions that used function pointers.  The problem
was that IRForTarget previously only scanned the IR
for the expression for call instructions; if a function
was used in another context, it was ignored.

Now LLDB scans the Module for functions that are only
declared (not also defined -- so these are externals);
it then constructs function pointers for these
functions and substitutes them wherever the function
is used.

Also made some changes so that "expr main" works just
as well as "expr &main"; they end up being the same
code, but LLDB was generating the result variable in
different ways.

llvm-svn: 136928
2011-08-04 21:37:47 +00:00
Greg Clayton 2c5f0e96c4 Make sure we track CXX and objc method decls.
llvm-svn: 136920
2011-08-04 21:02:57 +00:00
Johnny Chen d63991ca4a Fix some typos.
llvm-svn: 136919
2011-08-04 21:01:04 +00:00
Johnny Chen 2cce3f394c Remove an extra 'for' in the comment.
llvm-svn: 136918
2011-08-04 20:48:50 +00:00
Johnny Chen 189bff103d Fix makefile rules to prevent CFLAGS from appearing twice in the command line.
llvm-svn: 136917
2011-08-04 20:44:56 +00:00
Johnny Chen 19bfde34ed Add a test to check the integrity of the lldb public api directory containing SB*.h headers.
There should be nothing unwanted there and a simpe main.cpp (generated from main.cpp.template)
which includes SB*.h should compile and link with the LLDB framework.

llvm-svn: 136894
2011-08-04 18:17:16 +00:00
Enrico Granata 4443d8c321 changing CFString.py to reflect the new behavior of CreateValueFromAddress
llvm-svn: 136887
2011-08-04 17:14:03 +00:00
Enrico Granata 61408e0856 more logical behavior for SBValue::CreateValueFromAddress
llvm-svn: 136886
2011-08-04 17:07:02 +00:00
Enrico Granata 15dbe2a491 copying std:: SynthProviders in examples/synthetic
llvm-svn: 136863
2011-08-04 02:35:14 +00:00
Enrico Granata 5dfd49ccba New formatting symbol %# can be used in summary strings to get the "count of children" of a variable
- accordingly, the test cases for the synthetic providers for the std:: containers have been edited to use
   ${svar%#} instead of ${svar.len} to print out the count of elements ; the .len synthetic child has been
   removed from the synthetic providers
The synthetic children providers for the std:: containers now return None when asked for children indexes >= num_children()
Basic code to support filter names based on regular expressions (WIP)

llvm-svn: 136862
2011-08-04 02:34:29 +00:00
Enrico Granata 6fd87d5d33 APIs to GetValueAsSigned/Unsigned() in SBValue now also accept an SBError parameter to give more info about any problem
The synthetic children providers now use the new (safer) APIs to get the values of objects
As a side effect, fixed an issue in ValueObject where ResolveValue() was not always updating the value before reading it

llvm-svn: 136861
2011-08-04 01:41:02 +00:00
Greg Clayton fe42ac4d0a Cleaned up the SBType.h file to not include internal headers and reorganized
the SBType implementation classes.

Fixed LLDB core and the test suite to not use deprecated SBValue APIs.

Added a few new APIs to SBValue:

    int64_t
    SBValue::GetValueAsSigned(int64_t fail_value=0);

    uint64_t
    SBValue::GetValueAsUnsigned(uint64_t fail_value=0)

 

llvm-svn: 136829
2011-08-03 22:57:10 +00:00
Enrico Granata 890af72acc Basic handling of Objective-C tagged pointers: return a custom ISA and typename when one is detected
llvm-svn: 136819
2011-08-03 22:01:27 +00:00
Johnny Chen 1b93d0233f Minor modification to get the full path to the target program.
llvm-svn: 136815
2011-08-03 21:18:23 +00:00
Johnny Chen 16fc2cc9fa Remove copy-and-paste residues.
llvm-svn: 136812
2011-08-03 20:58:02 +00:00
Johnny Chen c99dd97fc5 Fix typos.
llvm-svn: 136809
2011-08-03 20:40:35 +00:00
Johnny Chen a8d4df429a Add license header comment.
llvm-svn: 136808
2011-08-03 20:39:26 +00:00
Johnny Chen d855d82a16 Conditionize the 'print "Set environment ..."' stmt.
llvm-svn: 136806
2011-08-03 20:28:34 +00:00
Jim Ingham b7f0bfc5dc Add a directory to make the second copy of libd.dylib in, so we don't have
to make & delete directories in the test case.  Make a real copy of libd.dylib
in that directory so the two libraries are actually different.  Use (and remove)
the DYLD_LIBRARY_PATH to point to the new library.

llvm-svn: 136801
2011-08-03 19:32:42 +00:00
Johnny Chen f044a1e788 Patch from David Forsythe for FreeBSD build!
llvm-svn: 136800
2011-08-03 18:55:26 +00:00
Johnny Chen 5ad1245b0e Add expectedFailure decorator.
rdar://problem/9890530

llvm-svn: 136798
2011-08-03 18:35:48 +00:00
Johnny Chen e5ffe78c13 Unquote the env_cmd_string variable.
Skip the test case test_dyld_library_path(self) because it causes the debugserver to crash.

llvm-svn: 136796
2011-08-03 18:28:41 +00:00
Jim Ingham f169c394ca Don't set DYLD_LIBRARY_PATH in the Python environment (which will get passed down to
debugserver) but set it in the debugger settings (which will just get passed down to
the target).

llvm-svn: 136793
2011-08-03 17:41:28 +00:00
Enrico Granata 9bb48e6407 temporarily blacklisting a test case causing hangs on Mac OS X
llvm-svn: 136791
2011-08-03 17:20:19 +00:00
Enrico Granata 7823ee3307 testing for a previous issue where formats in summaries where not enforced in all cases ; removed an unused local variable
llvm-svn: 136785
2011-08-03 16:23:33 +00:00
Sean Callanan a789aa770e Improved the expression parser's detection of the
current context.  Previously, if there was a variable
called "self" available, the expression parser
assumed it was inside a method.  But class methods
in Objective-C also take a "self" parameter, of DWARF
type "id".  We now detect this properly, and only
assume we're in an instance method if "self" is a
pointer to an Objective-C object.

llvm-svn: 136784
2011-08-03 16:23:08 +00:00
Johnny Chen 9bfd9144e6 Fixed an issue of wrong (by +2) branch target calculation in the disassembler's symbolic information output.
A8.6.23 BLX (immediate T2)
Target Address = Align(PC, 4) + offset value

rdar://problem/9885678

llvm-svn: 136766
2011-08-03 04:50:37 +00:00
Greg Clayton fad9eef23b Fixed an issue with parsing object files from .a archives.
The entire .a file gets cached, and after the first .o file
gets loaded, a cached version would get used when trying to
extract the skinny slice from a fat BSD archive and would
cause a code path to get taken in the BSD archive parser
even if we aren't at a BSD archive offset.

llvm-svn: 136765
2011-08-03 04:39:36 +00:00
Enrico Granata 9910bc855d Fixed an issue where the KVO swizzled type would be returned as the dynamic type instead of the actual user-level type
- see the test case in lang/objc/objc-dynamic-value for an example
Objective-C dynamic type lookup now works for every Objective-C type
 - previously, true dynamic lookup was only performed for type id

llvm-svn: 136763
2011-08-03 02:18:51 +00:00
Johnny Chen cf901ed229 Add a test file to go with r136745. It fails, though, for:
expr ptr[i]->point.x

Radar to be filed.

llvm-svn: 136760
2011-08-03 01:34:29 +00:00
Greg Clayton 73da24413c Create the scratch AST context in the accessor function, not
only when the executable is set.

llvm-svn: 136758
2011-08-03 01:23:55 +00:00
Jim Ingham b53cb271ca Add method Module::IsLoadedInTarget, and then in the MacOS X dynamic loader, after we
have initialized our shared library state, discard all the modules that didn't make
it into the running process.

llvm-svn: 136755
2011-08-03 01:03:17 +00:00
Jim Ingham e716ae02a9 Fix a copy/paste error in a comment.
llvm-svn: 136754
2011-08-03 01:00:06 +00:00
Greg Clayton d41f032a45 Fixed an issue where StackFrame::GetValueForVariableExpressionPath(...)
was previously using the entire frame variable list instead of using the
in scope variable list. I added a new function to a stack frame:

	lldb::VariableListSP
	StackFrame::GetInScopeVariableList (bool get_file_globals);

This gets only variables that are in scope and they will be ordered such
that the variables from the current scope are first.

llvm-svn: 136745
2011-08-02 23:35:43 +00:00
Jason Molenda 2f7af6a15a Change CommandObjectTargetModulesAdd to set the return status
object on successful adding of a module.

llvm-svn: 136744
2011-08-02 23:28:55 +00:00
Enrico Granata d8b5fce230 bug fix in SBValue::CreateValueFromAddress() where using the resulting VO as a pointer would crash LLDB ; minor improvements in dynamic formatters lookup
llvm-svn: 136743
2011-08-02 23:12:24 +00:00
Johnny Chen aaa82ff9ad Add the real benchmarks comparing lldb against gdb for repeated expression evaluations.
Modify lldbbench.py so that lldbtest.line_number() utility function is available to
BenchBase client as just line_number(), and modify lldbtest.py so that self.lldbExec
(the full path for the 'lldb' executable) is available to BenchBase client as well.

An example run of the test case on my MacBook Pro running Lion:

1: test_compare_lldb_to_gdb (TestRepeatedExprs.RepeatedExprsCase)
   Test repeated expressions with lldb vs. gdb. ... 
lldb_avg: 0.204339
gdb_avg: 0.205721
lldb_avg/gdb_avg: 0.993284
ok

llvm-svn: 136740
2011-08-02 22:54:37 +00:00
Sean Callanan 763d72a1fd Fixed a bug in which the DWARF reader did not distinguish
appropriately between C++ static methods and non-static
methods.  This bug made it impossible to call most static
methods, either because Clang did not recognize that a
method could be called without providing a "this"
parameter, or because Clang did not properly mangle the
name of the method when searching for it in the target.

Also added a testcase.

llvm-svn: 136733
2011-08-02 22:21:50 +00:00
Johnny Chen 8f3d8384be Patch by David Forsythe to build lldb on FreeBSD!
I did not take the patch for ClangExpressionParser.cpp since there was a
recent change by Peter for the same line.  Feel free to disagree. :-)

Reference:
----------------------------------------------------------------------
r136580 | pcc | 2011-07-30 15:42:24 -0700 (Sat, 30 Jul 2011) | 3 lines

Add reloc arg to standard JIT createJIT()

Fixes non-__APPLE__ build.  Patch by Matt Johnson!
----------------------------------------------------------------------

Also, I ignore the part of the patch to remove the RegisterContextDarwin*.h/.cpp.

llvm-svn: 136720
2011-08-02 20:52:42 +00:00
Greg Clayton 819122dc1a Remove libEnhancedDisassembly.dylib
llvm-svn: 136713
2011-08-02 19:00:17 +00:00
Enrico Granata c3e320a7a0 Fixed a bug where a variable could not be formatted in a summary if its datatype already had a custom format
Fixed a bug where Objective-C variables coming out of the expression parser could crash the Python synthetic providers:
 - expression parser output has a "frozen data" component, which is a byte-exact copy of the value (in host memory),
   if trying to read into memory based on the host address, LLDB would crash. we are now passing the correct (target)
   pointer to the Python code
Objective-C "id" variables are now formatted according to their dynamic type, if the -d option to frame variable is used:
 - Code based on the Objective-C 2.0 runtime is used to obtain this information without running code on the target

llvm-svn: 136695
2011-08-02 17:27:39 +00:00
Johnny Chen da0384c90e Simple renaming: self.swatch -> self.stopwatch.
llvm-svn: 136666
2011-08-02 00:50:55 +00:00
Johnny Chen 2352af85f9 Add a Stopwatch utility class to lldbench.py module and initialize an instance of
Stopwatch (self.swatch) within the BenchBase's setUp() instance method to be available
to all the child classes.

Use self.swatch to measure elapsed time in TestRepeatedExprs.py, which needs to be
modified later on to actually measure repeated expression evaluations within the
context of lldb as well as gdb.

llvm-svn: 136664
2011-08-02 00:43:09 +00:00
Johnny Chen c96a0476cd Remove unittest.skip() as 'rdar://problem/9691614 Expression parser crashes' is fixed.
llvm-svn: 136651
2011-08-01 21:36:02 +00:00
Johnny Chen 098781b55e Remove the @expectedFailure decorator as rdar://problem/8668674 is fixed.
llvm-svn: 136650
2011-08-01 21:30:30 +00:00
Johnny Chen 985e740cd9 Add an abstract base class called BenchBase to be inherited by benchmark tests.
Modify the example TestRepeatedExprs.py to use BenchBase, instead.

llvm-svn: 136649
2011-08-01 21:13:26 +00:00
Sean Callanan 7f3755b5ff Fixed a problem in the expression parser that
caused functions that were cast as part of the
call to have that cast ignored once their 
addresses were resolved.

Notably, in the case of objc_msgSend(), if
the function was cast from something returning
i8* to something returning i8, the expression
parser was discarding the cast as part of its
resolution.  This caused crashes later on.

llvm-svn: 136648
2011-08-01 20:53:53 +00:00
Johnny Chen fb4264c501 More refactorings to migrate logic from TestBase to its parent class.
llvm-svn: 136641
2011-08-01 19:50:58 +00:00
Johnny Chen a74bb0ae6f Start refactoring lldbtest.TestBase so that it inherits from a newly created lldbtest.Base class,
while its API clients remain unchanged.  The new lldbtest.Base class is to capture common behaviors
when working with the test driver to accomplish things.  The clients of lldbtest.Base can be
lldb command line and api tests as well as other generic tests like a benchmark test.

llvm-svn: 136636
2011-08-01 18:46:13 +00:00
Johnny Chen f57119bc21 Remove the @expectedFailure decorator since the bug has been fixed.
rdar://problem/9673664

llvm-svn: 136633
2011-08-01 18:26:32 +00:00
Sean Callanan b995119900 Added checking to make sure that the target has a
scratch AST context before attempting to parse.

llvm-svn: 136631
2011-08-01 18:18:33 +00:00
Sean Callanan af8e96c185 Fixed a bug where named constants were being
treated as externals, causing problems when we
tried to look their locations up in the debug
info.  For example:

expr char c[] = "foo"; c[0]

would terminate when trying to find c in the
debug information, despite the fact that c was
defined inside the expression.

llvm-svn: 136629
2011-08-01 17:41:38 +00:00
Greg Clayton 89f138ae63 Remove the deprecated MacOSX native plug-in.
llvm-svn: 136626
2011-08-01 17:08:02 +00:00
Greg Clayton 0516c503ec Copy the native darwin register stuff out of the ProcessMacOSX
plug-in folder.

llvm-svn: 136625
2011-08-01 17:06:30 +00:00
Sean Callanan 789ee677d9 Updated LLVM to pick up a few new ARM targets.
llvm-svn: 136622
2011-08-01 16:38:39 +00:00
Greg Clayton 0b099a432b Update Xcode project versions to lldb-70 and debugserver-142.
llvm-svn: 136606
2011-08-01 05:05:43 +00:00
Peter Collingbourne eb72547f09 Add reloc arg to standard JIT createJIT()
Fixes non-__APPLE__ build.  Patch by Matt Johnson!

llvm-svn: 136580
2011-07-30 22:42:24 +00:00
Greg Clayton 3ae5a18656 Protect a bit against uninitialized std::list objects, but there is more
work to be done.

llvm-svn: 136579
2011-07-30 22:26:17 +00:00
Greg Clayton 3883bca4f4 Protect a bit better against uninitialized vectors.
llvm-svn: 136578
2011-07-30 22:25:25 +00:00
Sean Callanan cc427fadec This change brings in the latest LLVM/Clang, and
completes the support in the LLDB expression parser
for incomplete types.  Clang now imports types
lazily, and we complete those types as necessary.

Changes include:

- ClangASTSource now supports three APIs which it
  passes to ClangExpressionDeclMap.  CompleteType
  completes a TagDecl or an ObjCInterfaceDecl when
  needed; FindExternalVisibleDecls finds named
  entities that are visible in the expression's
  scope; and FindExternalLexicalDecls performs a
  (potentially restricted) search for entities
  inside a lexical scope like a namespace.  These
  changes mean that entities in namespaces should
  work normally.

- The SymbolFileDWARF code for searching a context
  for a specific name is now more general, and can
  search arbitrary contexts.

- We are continuing to adapt our calls into LLVM
  from interfaces that take start and end iterators
  when accepting multiple items to interfaces that
  use ArrayRef.

- I have cleaned up some code, especially our use
  of namespaces.

This change is neutral for our testsuite and greatly
improves correctness for large programs (like Clang)
with complicated type systems.  It should also lay
the groundwork for improving the expression parser's
performance as we are lazier and lazier about
providing type information.

llvm-svn: 136555
2011-07-30 02:42:06 +00:00
Greg Clayton fc1aa292ad Cleaned up the NSString summary formatter to not print "<invalid object>" when
we have a nil NSString *. Also added blank lines between functions in the
CFString.py files.

llvm-svn: 136554
2011-07-30 01:47:41 +00:00
Johnny Chen 5ccbccfce0 Add a @benchmarks_test decorator for test method we want to categorize as benchmarks test.
The test driver now takes an option "+b" which enables to run just the benchmarks tests.
By default, tests decorated with the @benchmarks_test decorator do not get run.

Add an example benchmarks test directory which contains nothing for the time being,
just to demonstrate the @benchmarks_test concept.

For example,

$ ./dotest.py -v benchmarks

...

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

1: test_with_gdb (TestRepeatedExprs.RepeatedExprssCase)
   Test repeated expressions with gdb. ... skipped 'benchmarks tests'
2: test_with_lldb (TestRepeatedExprs.RepeatedExprssCase)
   Test repeated expressions with lldb. ... skipped 'benchmarks tests'

----------------------------------------------------------------------
Ran 2 tests in 0.047s

OK (skipped=2)
$ ./dotest.py -v +b benchmarks

...

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

1: test_with_gdb (TestRepeatedExprs.RepeatedExprssCase)
   Test repeated expressions with gdb. ... running test_with_gdb
benchmarks result for test_with_gdb
ok
2: test_with_lldb (TestRepeatedExprs.RepeatedExprssCase)
   Test repeated expressions with lldb. ... running test_with_lldb
benchmarks result for test_with_lldb
ok

----------------------------------------------------------------------
Ran 2 tests in 0.270s

OK

Also mark some Python API tests which are missing the @python_api_test decorator.

llvm-svn: 136553
2011-07-30 01:39:58 +00:00
Greg Clayton 880cbb04b3 Fixed a compile error.
llvm-svn: 136551
2011-07-30 01:26:02 +00:00
Enrico Granata 3bcee02643 changes in the new GetMinimumLanguages() ; robustness improvements in the CFStringSynthProvider object ; made a CFString_SummaryProvider function you can use if all you care about is the summary string for your NSString objects
llvm-svn: 136544
2011-07-29 23:59:08 +00:00
Greg Clayton 92eac7f501 Moved some functionality from ValueObject to ClangASTType.
llvm-svn: 136536
2011-07-29 23:21:00 +00:00
Johnny Chen 4a57d122fe Add a redo.py script which takes a session directory name as arg and digs into the directory
to find out the tests which failed/errored and need re-running.  The dotest.py test driver
script is modified to allow specifying multiple -f testclass.testmethod in the command line
to accommodate the redo functionality.

An example,

 $ ./redo.py -n 2011-07-29-11_50_14
adding filterspec: TargetAPITestCase.test_find_global_variables_with_dwarf
adding filterspec: DisasmAPITestCase.test_with_dsym
Running ./dotest.py -v  -f TargetAPITestCase.test_find_global_variables_with_dwarf -f DisasmAPITestCase.test_with_dsym

...

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

1: test_with_dsym (TestDisasmAPI.DisasmAPITestCase)
   Exercise getting SBAddress objects, disassembly, and SBAddress APIs. ... ok
2: test_find_global_variables_with_dwarf (TestTargetAPI.TargetAPITestCase)
   Exercise SBTarget.FindGlobalVariables() API. ... ok

----------------------------------------------------------------------
Ran 2 tests in 15.328s

OK

llvm-svn: 136533
2011-07-29 22:54:56 +00:00
Greg Clayton 5b442374e9 Logging and return code fixes.
llvm-svn: 136530
2011-07-29 22:26:36 +00:00
Enrico Granata ebbe5643b2 new synthetic children provider for CFString and related classes ; test case for it
llvm-svn: 136525
2011-07-29 21:31:46 +00:00
Enrico Granata 6f3533fb1d Public API changes:
- Completely new implementation of SBType
 - Various enhancements in several other classes
Python synthetic children providers for std::vector<T>, std::list<T> and std::map<K,V>:
 - these return the actual elements into the container as the children of the container
 - basic template name parsing that works (hopefully) on both Clang and GCC
 - find them in examples/synthetic and in the test suite in functionalities/data-formatter/data-formatter-python-synth
New summary string token ${svar :
 - the syntax is just the same as in ${var but this new token lets you read the values
   coming from the synthetic children provider instead of the actual children
 - Python providers above provide a synthetic child len that returns the number of elements
   into the container
Full bug fix for the issue in which getting byte size for a non-complete type would crash LLDB
Several other fixes, including:
 - inverted the order of arguments in the ClangASTType constructor
 - EvaluationPoint now only returns SharedPointer's to Target and Process
 - the help text for several type subcommands now correctly indicates argument-less options as such

llvm-svn: 136504
2011-07-29 19:53:35 +00:00
Johnny Chen b15c1dbfa1 Add regression test for rdar://problem/9531204.
llvm-svn: 136425
2011-07-28 23:17:20 +00:00
Johnny Chen 09f24bc769 Add test case for rdar://problem/9673664.
llvm-svn: 136409
2011-07-28 22:12:12 +00:00
Johnny Chen 27603dea5c Add some descriptions about the default executable name being 'a.out' and can be overwritten
by specifying your EXE make variable via your Makefile or within the Python test script.

llvm-svn: 136394
2011-07-28 21:15:39 +00:00
Johnny Chen 342927c522 Add a reproducible test case (expression parser crashes) to the lldb test suite.
rdar://problem/9691614.

llvm-svn: 136386
2011-07-28 20:46:14 +00:00
Johnny Chen 8a815152c2 Make the test criteria more stringent with respect to rdar://problem/8668674 to prevent accidental pass.
llvm-svn: 136316
2011-07-28 00:52:23 +00:00
Enrico Granata 7703020e1b another possible incarnation of a C++ string straight from llvm-gcc build 5658
llvm-svn: 136293
2011-07-27 23:33:58 +00:00
Johnny Chen 847f511300 Modify:
self.expect("expression -- '(anonymous namespace)::i'", VARIABLES_DISPLAYED_CORRECTLY,
            substrs = [" = 3"])

to get rid of the '(anonymous namespace)', which is not c++ syntax, thingy fed to the expression parser.
According to rdar://problem/8668674.  It is still marked expectedFailure since the bug has not been fixed.

llvm-svn: 136290
2011-07-27 23:17:56 +00:00
Johnny Chen bfdf9a36d9 The SBValue.linked_list_iter() API failed for an empty list.
Fix the bug and add a test case.

llvm-svn: 136265
2011-07-27 21:14:01 +00:00
Enrico Granata e594b1aaec make the C++stdlib string summary work even if for some reason std::basic_string<char> ends up in the debug info instead of std::string
llvm-svn: 136246
2011-07-27 19:01:14 +00:00
Johnny Chen 07c10246b5 Add docstrings and cross refs to SBCompileUnit and SBLineEntry.
llvm-svn: 136230
2011-07-27 18:28:07 +00:00
Johnny Chen 3b67d57ae2 Add cross reference to SBThread from the SBFrame docstring. Also add a simple iteration example.
llvm-svn: 136227
2011-07-27 18:13:32 +00:00
Johnny Chen 2af257cd0d Add deprecation docstrings for some APIs which take an SBFrame - SBValues know their own frames.
llvm-svn: 136194
2011-07-27 00:08:59 +00:00
Johnny Chen 33c0c77073 Fix indentation and add a docstring for the ctor.
llvm-svn: 136187
2011-07-26 23:42:01 +00:00
Johnny Chen 94b431ab63 Add skip test for clang, which has insufficient debug info for call site in main().
llvm-svn: 136184
2011-07-26 23:35:38 +00:00
Enrico Granata 0efa71aeb6 adding required utility function to SWIG interface
llvm-svn: 136147
2011-07-26 21:02:56 +00:00
Johnny Chen e33b166da1 We can do better with the SBValue.linked_list_iter() API by supplying a default
end of list test function as __eol_test__.

The simple example can be reduced to:

    for t in task_head.linked_list_iter('next'):
        print t

Modify the test program to exercise the API for both cases: supplying or not
supplying an end of list test function.

llvm-svn: 136144
2011-07-26 20:57:10 +00:00
Johnny Chen 6b092e821b The test function to determine whether we have reached the end of the list was
too complex in the test case.  We can just simply test that the SBValue object
is a valid object and it does not correspond to a null pointer in order to say
that EOL has not been reached.

Modify the test case and the lldb.py docstring to have a more compact test
function.

llvm-svn: 136123
2011-07-26 20:20:13 +00:00
Johnny Chen 11346d3136 lldb.swig (the SWIG input file) has become too large. Modularize a bit by introducing two files
to be included from lldb.swig: python-typemaps.swig and python-wrapper.swig.

llvm-svn: 136117
2011-07-26 19:09:03 +00:00
Jason Molenda 26a27fb832 RNBRemote.cpp, RNBRemote.h: Add a new qGetPid packet which returns
the pid of the process currently being debugged by debugserer in
hex, or 0 if unavailable.

This is effectively the same as the qC packet but that packet is
not clear in either its documentation or implementation (in gdb et al)
as to whether it is intended to return a pid or a thread id.  qGetPid
is unambiguous.

If qGetPid is unimplemented in the remote debugserver, the debugger may
try qC and see what kind of value is returned..

llvm-svn: 136055
2011-07-26 03:34:52 +00:00
Jim Ingham 5c4df7a4d6 Indent the frames in the "thread.GetStatus" frame listing. Also put the same space after each thread listing for "thread backtrace all" as "thread backtrace 1 3 5"
llvm-svn: 136052
2011-07-26 02:39:59 +00:00
Johnny Chen 7af9a33d45 Add newline at end of file.
llvm-svn: 136028
2011-07-26 00:24:30 +00:00
Johnny Chen f6fb627ffe Minor modification.
llvm-svn: 136026
2011-07-26 00:22:58 +00:00
Johnny Chen 882b28b7bf Rename the parameter for the end-of-list test function from end_of_list to end_of_list_test.
llvm-svn: 136016
2011-07-25 23:44:48 +00:00
Johnny Chen a4bc3a7091 Add cross references between the docstrings for regular SBValue iteration:
for child in value:
        # do something with the child value

and SBValue.linked_list_iter():

    for task in task_head.linked_list_iter('next', eol_test):
        # visit each item in the linked list

llvm-svn: 136015
2011-07-25 23:41:08 +00:00
Johnny Chen bb034f9f5d Add an example type summary -- for lldb::ConnectionStatus.
llvm-svn: 135997
2011-07-25 22:47:54 +00:00
Enrico Granata 77d24d374a bug fix in ClangASTType when trying to get size of a non-complete type
llvm-svn: 135989
2011-07-25 22:19:19 +00:00
Johnny Chen ca24cfa427 Add a stronger assert for the test to ensure that the visited items from iterating through
the SBValue.linked_list_iter() API is equal to [1, 2, 4, 5].

llvm-svn: 135944
2011-07-25 19:57:43 +00:00
Johnny Chen 4822505338 Provide an add-on API to SBValue class by post-processing to provide a way
to iterate through an SBValue instance by treating it as the head of a linked
list.  API program must provide two args to the linked_list_iter() method:
the first being the child member name which points to the next item on the list
and the second being a Python function which an SBValue (for the next item) and
returns True if end of list is reached, otherwise it returns False.

For example, suppose we have the following sample program.

#include <stdio.h>

class Task {
public:
    int id;
    Task *next;
    Task(int i, Task *n):
        id(i),
        next(n)
    {}
};


int main (int argc, char const *argv[])
{
    Task *task_head = new Task(-1, NULL);
    Task *task1 = new Task(1, NULL);
    Task *task2 = new Task(2, NULL);
    Task *task3 = new Task(3, NULL); // Orphaned.
    Task *task4 = new Task(4, NULL);
    Task *task5 = new Task(5, NULL);

    task_head->next = task1;
    task1->next = task2;
    task2->next = task4;
    task4->next = task5;

    int total = 0; // Break at this line
    Task *t = task_head;
    while (t != NULL) {
        if (t->id >= 0)
            ++total;
        t = t->next;
    }
    printf("We have a total number of %d tasks\n", total);
    return 0;
}

The test program produces the following output while exercising the linked_list_iter() SBVAlue API:

task_head:
	TypeName      -> Task *
	ByteSize      -> 8
	NumChildren   -> 2
	Value         -> 0x0000000106400380
	ValueType     -> local_variable
	Summary       -> None
	IsPointerType -> True
	Location      -> 0x00007fff65f06e60
(Task *) next = 0x0000000106400390
  (int) id = 1
  (Task *) next = 0x00000001064003a0

(Task *) next = 0x00000001064003a0
  (int) id = 2
  (Task *) next = 0x00000001064003c0

(Task *) next = 0x00000001064003c0
  (int) id = 4
  (Task *) next = 0x00000001064003d0

(Task *) next = 0x00000001064003d0
  (int) id = 5
  (Task *) next = 0x0000000000000000

llvm-svn: 135938
2011-07-25 19:32:35 +00:00
Enrico Granata f73dcc7b71 Python synthetic providers must provide a num_children call; this was not specified in the docs up to now
llvm-svn: 135933
2011-07-25 18:59:15 +00:00
Enrico Granata c53114e30a new flag -P to type synth add lets you type a Python class interactively
added a final newline to fooSynthProvider.py
new option to automatically save user input in InputReaderEZ
checking for NULL pointers in several new places

llvm-svn: 135916
2011-07-25 16:59:05 +00:00
Enrico Granata a37a065c33 Python synthetic children:
- you can now define a Python class as a synthetic children producer for a type
   the class must adhere to this "interface":
        def __init__(self, valobj, dict):
     	def get_child_at_index(self, index):
     	def get_child_index(self, name):
   then using type synth add -l className typeName
   (e.g. type synth add -l fooSynthProvider foo)
   (This is still WIP with lots to be added)
   A small test case is available also as reference

llvm-svn: 135865
2011-07-24 00:14:56 +00:00
Jim Ingham e3846fd16a Don't delete & remake the exception breakpoints every time you need them. Make them once & enable/disable
them as appropriate.
Also reformatted the lldb summaries to make them easier to read, and added one.  I'll do more as I get time.

llvm-svn: 135827
2011-07-23 00:12:05 +00:00
Johnny Chen 36d7d91616 Add an additional formatter class RecursiveDecentFormatter which prints the
value and the decendents.  For an example,

rdf = lldbutil.RecursiveDecentFormatter(indent_child=2)
print rdf.format(g_table)

produces:

(const char **[2]) g_table = 0x00000001055a80f0 (location)
  (const char **) [0] = 0x00000001055a8080
    (const char *) *[0] = "Sunday"
  (const char **) [1] = 0x00000001055a80c0
    (const char *) *[1] = "Monday"

llvm-svn: 135815
2011-07-22 22:01:35 +00:00
Johnny Chen 08c0910026 Add new API for SBAddress to the fuzz test:
SetLoadAddress (lldb::addr_t load_addr, 
               	lldb::SBTarget &target);

llvm-svn: 135793
2011-07-22 19:18:45 +00:00
Peter Collingbourne a67dd8fccc Disable compilation of RegisterContextDarwin_arm.cpp on non-Darwin platforms,
and fix RegisterContextDarwin_x86_64.cpp build

RegisterContextDarwin_arm.cpp contains too much platform specific code
to easily fix.

llvm-svn: 135792
2011-07-22 19:13:02 +00:00
Peter Collingbourne 027ab7e512 Update ProcessLinux::CanDebug prototype
llvm-svn: 135791
2011-07-22 19:12:53 +00:00
Peter Collingbourne 9a8d848caf Add support for platforms without sa_len to SocketAddress, and modify
some code to use it

llvm-svn: 135790
2011-07-22 19:12:42 +00:00
Enrico Granata e992a0899e some editing of data visualization error messages to make them more meaningful
debugging printfs() for data visualization turned into a meaningful log:
 - introduced a new log category `types' in channel `lldb'

llvm-svn: 135773
2011-07-22 17:03:19 +00:00
Greg Clayton 00e6fbfee9 Make the SBAddress class easier to use when using the public
API. 

SBTarget changes include changing:

bool
SBTarget::ResolveLoadAddress (lldb::addr_t vm_addr, 
                              lldb::SBAddress& addr);

to be:

lldb::SBAddress
SBTarget::ResolveLoadAddress (lldb::addr_t vm_addr);

SBAddress can how contruct itself using a load address and a target 
which can be used to resolve the address:

SBAddress (lldb::addr_t load_addr, lldb::SBTarget &target);

This will actually just call the new SetLoadAddress accessor:

void
SetLoadAddress (lldb::addr_t load_addr, 
                lldb::SBTarget &target);

This function will always succeed in making a SBAddress object
that can be used in API calls (even if "target" isn't valid).
If "target" is valid and there are sections currently loaded,
then it will resolve the address to a section offset address if
it can. Else an address with a NULL section and an offset that is
the "load_addr" that was passed in. We do this because a load address
might be from the heap or stack.

llvm-svn: 135770
2011-07-22 16:46:35 +00:00
Johnny Chen efee1cdc2b Fix comment.
llvm-svn: 135737
2011-07-22 00:51:54 +00:00
Johnny Chen 989b7efd8a Add BasicFormatter and ChildVisitingFormatter utility classes to the lldbutil.py module
which provide some convenient ways to print an SBValue object.  Use that in TestValueAPI.py
to print the 'days_of_week' char* array variable.

For an example:

cvf = lldbutil.ChildVisitingFormatter(indent=2)
print cvf.format(days_of_week)

produces:

(const char *[7]) days_of_week = 0x00000001026a5060 (location)
  (const char *) [0] = "Sunday"
  (const char *) [1] = "Monday"
  (const char *) [2] = "Tuesday"
  (const char *) [3] = "Wednesday"
  (const char *) [4] = "Thursday"
  (const char *) [5] = "Friday"
  (const char *) [6] = "Saturday"

llvm-svn: 135736
2011-07-22 00:47:58 +00:00
Enrico Granata d55546b27a when typing a summary string you can use the %S symbol to explicitly indicate that you want the summary to be used to print the target object
(e.g. ${var%S}). this might already be the default if your variable is of an aggregate type
new feature: synthetic filters. you can restrict the number of children for your variables to only a meaningful subset
 - the restricted list of children obeys the typical rules (e.g. summaries prevail over children)
 - one-line summaries show only the filtered (synthetic) children, if you type an expanded summary string, or you use Python scripts, all the real children are accessible
 - to provide a synthetic children list use the "type synth add" command, as in:
   type synth add foo_type --child varA --child varB[0] --child varC->packet->flags[1-4]
   (you can use ., ->, single-item array operator [N] and bitfield operator [N-M]; array slice access is not supported, giving simplified names to expression paths is not supported)
 - a new -S option to frame variable and target variable lets you override synthetic children and instead show real ones

llvm-svn: 135731
2011-07-22 00:16:08 +00:00
Johnny Chen 6cbb8d684f Add test scenario of SBValue APIs for the 'days_of_week' global variable.
llvm-svn: 135716
2011-07-21 23:02:00 +00:00
Johnny Chen 6853cf66d1 Add test scenario for exercising SBValue API: TypeIsPointerType() and GetByteSize().
llvm-svn: 135699
2011-07-21 19:31:59 +00:00
Johnny Chen becabe0e81 Initialize the all important automatic variable 'lldb::ConnectionStatus status' before
invoking the Read(...) method to read in bytes.  Similar to r135461.

llvm-svn: 135695
2011-07-21 19:00:59 +00:00
Jim Ingham 9411ddb65f If we are telling only one thread to run in debugserver, and that thread has been suspended from outside
the debugger, resume it before running so we will actually make progress.

llvm-svn: 135655
2011-07-21 01:54:41 +00:00
Enrico Granata 6d54d89af1 essentials contains two small summaries that you might really want to use; lldb contains some basic summaries for use in debugging LLDB itself. to use them, you must type category enable lldb
llvm-svn: 135653
2011-07-21 01:40:17 +00:00
Greg Clayton 5b88216ddc More KDP fixes and logging cleanup.
llvm-svn: 135652
2011-07-21 01:12:01 +00:00
Johnny Chen c7ed223d2a Change docstring wording: from 'method' to 'function'.
llvm-svn: 135648
2011-07-21 00:50:54 +00:00
Johnny Chen 3a31573f31 Add docstring for SBInstructionList class.
llvm-svn: 135647
2011-07-21 00:48:02 +00:00
Johnny Chen 098ca0e7e6 Add docstring for SBCommandReturnObject class.
llvm-svn: 135642
2011-07-21 00:32:12 +00:00
Johnny Chen ad4fe1b46e Add docstring for SBCommandInterpreter class.
llvm-svn: 135631
2011-07-20 22:50:58 +00:00
Johnny Chen 2e16d5dc8f Add docstring for SBBroadcaster class.
llvm-svn: 135630
2011-07-20 22:29:58 +00:00
Johnny Chen 424e55933a Add a note.
llvm-svn: 135615
2011-07-20 20:28:36 +00:00
Johnny Chen 15a6ac4821 Minor modification.
llvm-svn: 135606
2011-07-20 19:29:08 +00:00
Johnny Chen a17c7e0517 Skip the remaining -Y? (skipping ? layers of summaries) tests if using a known version
of Apple gcc build which produces wrong namespace for std::string in debug info.

llvm-svn: 135597
2011-07-20 18:29:32 +00:00
Greg Clayton 07e66e3ebe Added KDP resume, suspend, set/remove breakpoint, and kernel version support.
Also we now display a live update of the kexts that we are loading.

llvm-svn: 135563
2011-07-20 03:41:06 +00:00
Greg Clayton 87b0c1e63c Remove extra launch arguments.
llvm-svn: 135560
2011-07-20 02:22:21 +00:00
Greg Clayton 0c54d8a97c Added register reading support for ARM, i386 and x86_64.
llvm-svn: 135557
2011-07-20 01:32:50 +00:00
Johnny Chen 5cb19e7725 Add some docstrings for SBFileSpec class.
llvm-svn: 135553
2011-07-20 01:06:37 +00:00
Johnny Chen 8957729268 Add some docstrings for SBError class.
llvm-svn: 135547
2011-07-20 00:23:11 +00:00
Johnny Chen 2494f555b6 A more succinct assertTrue.
llvm-svn: 135544
2011-07-20 00:14:20 +00:00
Johnny Chen cd1211ef81 Minor change; add an assertTrue stmt.
llvm-svn: 135542
2011-07-20 00:11:54 +00:00
Johnny Chen 755e083ef6 Add some docstrings for SBSourceManager class.
llvm-svn: 135539
2011-07-19 23:35:10 +00:00
Johnny Chen e012858bd6 Add some docstrings for SBStream class.
llvm-svn: 135536
2011-07-19 23:24:36 +00:00
Johnny Chen fdc4a86c05 Move the rest of the SB headers to interface files.
They are not docstring'ed yet.

llvm-svn: 135531
2011-07-19 22:41:47 +00:00
Enrico Granata 2dee16e883 type category list now supports a regular expression argument that filters categories to only include the ones matching the regex
type summary list now supports a -w flag with a regular expression argument that filters categories to only include the ones matching the regex
in category and summary listings, categories are printed in a meaningful order:
 - enabled ones first, in the order in which they are searched for summaries
 - disabled ones, in an unspecified order
type summary list by default only expands non-empty enabled categories. to obtain a full listing, you must use the -w flag giving a "match-all" regex

llvm-svn: 135529
2011-07-19 22:35:10 +00:00
Johnny Chen 0f5196844d Rearrange the %include SWIG directives into two groups. One is the pure .h headers and the other is the .i interface files.
The objective is to move the .h header into .i interface file eventually.

llvm-svn: 135526
2011-07-19 21:49:34 +00:00
Enrico Granata 9df29e32c9 Applied Matt Johnson patch to ValueObject and FormatManager
llvm-svn: 135523
2011-07-19 20:57:44 +00:00
Greg Clayton 72c66dde39 Avoid calling accessor function more than once when result is already in
a local.

llvm-svn: 135512
2011-07-19 20:06:26 +00:00
Greg Clayton 9189b20875 Added some more functionality to SocketAddress and modified
ConnectionFileDescriptor to use it.

llvm-svn: 135511
2011-07-19 20:03:42 +00:00
Johnny Chen 4480530a0f Patch by Matt Johnson to silence G++ warnings!
Used hand merge to apply the diffs.  I did not apply the diffs for FormatManager.h and
the diffs for memberwise initialization for ValueObject.cpp because they changed since.
I will ask my colleague to apply them later.

llvm-svn: 135508
2011-07-19 19:48:13 +00:00