Commit Graph

3353 Commits

Author SHA1 Message Date
Jim Ingham e610d64bda Add missing check for non-NULL frame_sp.
llvm-svn: 137692
2011-08-16 00:07:28 +00:00
Johnny Chen c5cc625c79 Test driver should also report skipped tests because there were cases when tests were skipped
due to incorrect skip-logic.

llvm-svn: 137678
2011-08-15 23:09:08 +00:00
Enrico Granata 109c4c7f71 One-line fix for a possible spurious truncation warning
llvm-svn: 137640
2011-08-15 19:24:02 +00:00
Greg Clayton 6bc11b2756 Removed debug printf that was left in.
llvm-svn: 137630
2011-08-15 18:24:44 +00:00
Johnny Chen 0dc84d093e Add new SBAddress APIs to the fuzz tests.
llvm-svn: 137625
2011-08-15 18:19:51 +00:00
Enrico Granata 379447a7f2 Refactoring of ValueObject::DumpValueObject and 'frame variable', 'target variable' commands to use an Options object instead of passing an ever-increasing number of arguments to the DumpValueObject() method, with the ultimate aim of making that call private implementation
llvm-svn: 137622
2011-08-15 18:01:31 +00:00
Enrico Granata d0b8505a64 Objective-C runtime now caches resolved ISA information for increased efficiency
llvm-svn: 137612
2011-08-15 15:56:02 +00:00
Greg Clayton f6a5fc2e8b Patch from Matt Johnson that cleans up usage of APInt
to keep GCC 4.5.2 happy and also to not use a deprecated
llvm API.

llvm-svn: 137605
2011-08-15 07:23:47 +00:00
Greg Clayton 8753c1e057 Added the ability to use llvm::APInt class to view
any integers that are larger than a 8 bytes. We can now
display signed decimal, unsigned decimal, octal, and binary
(we could already view hex before this fix).

llvm-svn: 137602
2011-08-15 02:24:40 +00:00
Jim Ingham ff5f5ff963 Factor out the code that parses ObjC Method names into a static method
in ObjCLanguageRuntime.
Add the category-free name of symbols to the Symtab name-to-index list.

llvm-svn: 137600
2011-08-15 01:32:22 +00:00
Greg Clayton 98fcc4e60f Bumped Xcode project versions for lldb-72 and debugserver-143.
llvm-svn: 137547
2011-08-13 01:48:45 +00:00
Jim Ingham 66243847a5 Remember to restore the frame in the exe_ctx passed in to RunThreadPlan.
Also, default "source_init_file" to False in the version of SBDebugger::Create
so that we don't pick up the init file in Python.

llvm-svn: 137545
2011-08-13 00:56:10 +00:00
Johnny Chen fc7483f699 Add a simple test case to exercise the SBDebugger.CreateTargetWithFileAndTargetTriple() API.
llvm-svn: 137544
2011-08-13 00:55:56 +00:00
Jim Ingham a5636fc823 Test case for changing ValueObjects with SBValue::SetValueFromCString.
llvm-svn: 137543
2011-08-13 00:45:23 +00:00
Johnny Chen f017e8d6d7 Modify the skipUnless() logic to work for OSX Lion.
llvm-svn: 137542
2011-08-13 00:27:46 +00:00
Jim Ingham 06942690b1 Add a version of SBDebugger::Create which allows us to specify whether to source
in the init files or not.

llvm-svn: 137541
2011-08-13 00:22:20 +00:00
Johnny Chen 60726fab78 Fix a test driver bug where multiple filter specs (through the -f TestClassName.test_method_name
command line option) belonging to the same Test*.py file are ignored, except for the first one.

llvm-svn: 137540
2011-08-12 23:55:07 +00:00
Jim Ingham 16e0c68627 Make ValueObject::SetValueFromCString work correctly.
Also change the SourceInitFile to look for .lldb-<APPNAME> and source that
preferentially if it exists.
Also made the breakpoint site report its address as well as its breakpoint number
when it gets hit and can't find any the associated locations (usually because the
breakpoint got disabled or deleted programmatically between the time it was hit
and reported.)
Changed ThreadPlanCallFunction to initialize the ivar m_func in the initializers of the
constructor, rather than waiting to initialize till later on in the function.
Fixed a bug where if you make an SBError and the ask it Success, it returns false.
Fixed ValueObject::ResolveValue so that it resolves a temporary value, rather than
overwriting the one in the value object.

llvm-svn: 137536
2011-08-12 23:34:31 +00:00
Greg Clayton 23aca09205 Fixed an incorrect static analyzer fix.
llvm-svn: 137534
2011-08-12 23:32:52 +00:00
Greg Clayton b8171ddf3e Removed an initialization that wasn't needed.
llvm-svn: 137533
2011-08-12 23:32:17 +00:00
Johnny Chen 53cb46ebd7 Update the SBAddress.i Python interface file to the latest SBAddress.h,
and add some docstrings.

llvm-svn: 137528
2011-08-12 22:52:11 +00:00
Greg Clayton 7e9b1fd045 We were leaking a stack frame in StackFrameList in Thread.cpp which could
cause extra shared pointer references to one or more modules to be leaked.
This would cause many object files to stay around the life of LLDB, so after
a recompile and rexecution, we would keep adding more and more memory. After
fixing the leak, we found many cases where leaked stack frames were still
being used and causing crashes in the test suite. These are now all resolved.

llvm-svn: 137516
2011-08-12 21:40:01 +00:00
Johnny Chen 7687d3c116 Add radar info for self.skipTest().
llvm-svn: 137504
2011-08-12 20:41:20 +00:00
Johnny Chen 8f5ebce99c Skip the TestObjCDymaicValue.py tests for i386 due to dynamic types for ObjC V1 runtime not implemented yet.
Radar to be filed.

llvm-svn: 137503
2011-08-12 20:39:00 +00:00
Johnny Chen 9f4f5d94cd Add TestInferiorChanged.py to test that lldb reloads the inferior after it was changed during the debug session.
First, main.c causes a crash, the inferior then gets re-built with main2.c which is not crashing.

Add Base.cleanup(self, dictionary=None) for platform specfic way to do cleanup after build.
This plugin method is used by the above test case to cleanup the main.c build before rebuild for main2.c.

llvm-svn: 137500
2011-08-12 20:19:22 +00:00
Enrico Granata 68eb4bb421 Added an error message when the user tries to add a filter when a synthetic provider for the same type is already defined in the same category
The converse is also true: an error is shown when the user tries to add a synthetic provider to a category that already has a filter for the same type

llvm-svn: 137493
2011-08-12 19:14:27 +00:00
Johnny Chen 70cb84a0f6 When running dotest.py under pdb (the python debugger), define DOTEST_PDB=YES and
DOTEST_SCRIPT_DIR=/path/leading/to/your/dotest/script/directory.

llvm-svn: 137492
2011-08-12 18:54:11 +00:00
Enrico Granata 4a04dbc749 Taking care of an issue relating to mapping DeclContext's to DIE's
llvm-svn: 137490
2011-08-12 18:43:16 +00:00
Johnny Chen 7feabf0643 Fix a logic error (Division by zero) uncovered by the static analyzer.
A8.6.391 VST1 (multiple single elements)
alignment = if align == '00' then 1 else 4 << UInt(align);

llvm-svn: 137477
2011-08-12 17:59:58 +00:00
Greg Clayton dd7feaf664 Fixed the issue of a DW_TAG_subprogram in a DW_TAG_subprogram correctly this
time after recently backing out another fix.

llvm-svn: 137475
2011-08-12 17:54:33 +00:00
Enrico Granata 61a80ba6c3 Giving a warning to the user the first time children are truncated by the new cap setting
llvm-svn: 137462
2011-08-12 16:42:31 +00:00
Greg Clayton b4d3733fca Backout previous fix that was designed to allow functions within functions
as this function is what parses the blocks for a function...

llvm-svn: 137461
2011-08-12 16:22:48 +00:00
Greg Clayton 3771927056 Fixed an assertion issue that can arise when a function
is contained inside a function.

llvm-svn: 137438
2011-08-12 07:35:23 +00:00
Greg Clayton 5113dc8e54 Fixed some issues with parsing C++ methods where our detection
was failing if the DWARF was laid out in a certain way. The way
we detect C++ classes is now more robust so that a class method
can be defined outside of the class and refer to a definition inside
the class with a DW_AT_specification or DW_AT_abstract_origin attribute.

Fixed a case in Thread.cpp where we were looking up info in the frame
when we didn't need to. This was from some changes to support external
editors. Now the info is only looked up if needed.

llvm-svn: 137436
2011-08-12 06:47:54 +00:00
Jason Molenda 7efc7e949c Fixes the occasional crash on exit when quitting lldb with control-D.
If the IOChannel has already freed out its m_driver member, and
there's still a character to be read/written (that is, the ^D
character), just skip that char instead of trying to write through
a null object pointer.

llvm-svn: 137421
2011-08-12 02:40:17 +00:00
Enrico Granata 22c55d180d *Some more optimizations in usage of ConstString
*New setting target.max-children-count gives an upper-bound to the number of child objects that will be displayed at each depth-level
  This might be a breaking change in some scenarios. To override the new limit you can use the --show-all-children (-A) option
  to frame variable or increase the limit in your lldbinit file
*Command "type synthetic" has been split in two:
  - "type synthetic" now only handles Python synthetic children providers
  - the new command "type filter" handles filters
  Because filters and synthetic providers are both ways to replace the children of a ValueObject, only one can be effective at any given time.

llvm-svn: 137416
2011-08-12 02:00:06 +00:00
Johnny Chen ff7f3cd277 Fix a logic error caught by the static analyzer.
llvm-svn: 137407
2011-08-12 01:22:56 +00:00
Johnny Chen 160ee8b43d Fix some warnings from static analyzer.
The initialization of 'replicated_element' to 0 is needed, otherwise we get a garbage value to start with.

llvm-svn: 137405
2011-08-12 01:10:45 +00:00
Johnny Chen 1cee80c081 Silence the static analyzer.
llvm-svn: 137396
2011-08-12 00:21:20 +00:00
Johnny Chen d397dc80eb Fix two 'dereference of a null pointer' detected by the static analyzer.
llvm-svn: 137394
2011-08-12 00:02:24 +00:00
Sean Callanan 912855fd27 Fixed LLDB's handling of ElaboratedTypes, which was
causing problems with printing the values of persistent
variables with struct types.

llvm-svn: 137392
2011-08-11 23:56:13 +00:00
Johnny Chen ec34c6aba5 Silence the static analyzer.
llvm-svn: 137387
2011-08-11 23:47:21 +00:00
Johnny Chen ec95565a9d Fix 'Undefined or garbage value returned to caller' (static analyzer).
llvm-svn: 137374
2011-08-11 22:23:44 +00:00
Johnny Chen 0861be0c30 Silence the static analyzer.
llvm-svn: 137360
2011-08-11 21:43:13 +00:00
Enrico Granata 5c7b8e682c changed some variables from char* to std::string
llvm-svn: 137357
2011-08-11 21:37:21 +00:00
Johnny Chen cbbd9bea53 To silence the static analyzer.
llvm-svn: 137355
2011-08-11 21:24:08 +00:00
Johnny Chen d5e00ba6c4 Fix the expect patterns to work for both OSX SnowLeopard and Lion.
On Lion, printf is defined in libsystem_c.dylib.

llvm-svn: 137348
2011-08-11 20:51:45 +00:00
Johnny Chen d08a834a68 Patch by Matt Johnson to build on his Linux machine with recent versions of libstdc++ and glibc!
llvm-svn: 137343
2011-08-11 20:40:21 +00:00
Sean Callanan 793d6330cd Updated LLVM/Clang to to pick up fixes for a
problem in which the following cast:
–
expr (int (*)(const char*, ...))printf
-
caused a crash.  This had several causes:

  - First, Clang did not support implicit
    casts of a function of unknown type to
    a function pointer.

  - Second, after this was fixed, the
    Clang AST importer did not support
    importing function pointer types
    produced by resolving these casts.

These two problems are now resolved, and
I have added a test case to verify that
they work.  I also did a little bit of
build-system cleanup because we now use
libEnhancedDisassembly.a instead of the
.dylib.

llvm-svn: 137338
2011-08-11 20:11:18 +00:00
Johnny Chen 3e99bc3a07 Fix a logic error caught by the static analyzer.
llvm-svn: 137334
2011-08-11 19:40:36 +00:00
Enrico Granata a365f296e6 Fixed an issue where LLDB was complaining about the lack of 'update' in a synthetic provider, despite it being optional
llvm-svn: 137330
2011-08-11 19:20:44 +00:00
Johnny Chen 0a76c28a87 To silence the static analyzer.
llvm-svn: 137329
2011-08-11 19:17:45 +00:00
Johnny Chen 8446277c11 Fix a logic error caught by the static analyzer.
llvm-svn: 137328
2011-08-11 19:12:10 +00:00
Johnny Chen 64503c8168 To silence the static analyzer.
llvm-svn: 137326
2011-08-11 19:03:44 +00:00
Johnny Chen d14651afaf To silence the static analyzer.
llvm-svn: 137319
2011-08-11 18:21:06 +00:00
Enrico Granata 8c9d35603e Fixed an issue where a pointer's address was being logged instead of its value
Access to synthetic children by name:
 if your object has a synthetic child named foo you can now type
  frame variable object.foo (or ->foo if you have a pointer)
  and that will print the value of the synthetic child
  (if your object has an actual child named foo, the actual child prevails!)
 this behavior should also work in summaries, and you should be able to use
 ${var.foo} and ${svar.foo} interchangeably
  (but using svar.foo will mask an actual child named foo)

llvm-svn: 137314
2011-08-11 17:08:01 +00:00
Greg Clayton aa51684318 Patch for "process load" by Filipe Cabecinhas.
Filipe was attempting to do a:

(lldb) process load ~/path/foo.dylib

But the process load command wasn't resolving the path. We have to be careful
about resolving the path here because we want to do it in terms of the platform
we are using. the "~/" can mean a completely different path if you are remotely
debugging on another machine as another user. So to support this, platforms now
can resolve remote paths:

bool
Platform::ResolveRemotePath (const FileSpec &platform_path,
                             FileSpec &resolved_platform_path);

The host/local platform will just resolve the path.
                             

llvm-svn: 137307
2011-08-11 16:25:18 +00:00
Greg Clayton 0c02e4eaea Fix the broken build that happened with my last checkin.
llvm-svn: 137300
2011-08-11 04:30:39 +00:00
Greg Clayton aa149cbd86 Added the ability to remove orphaned module shared pointers from a ModuleList.
This is helping us track down some extra references to ModuleSP objects that
are causing things to get kept around for too long. 

Added a module pointer accessor to target and change a lot of code to use 
it where it would be more efficient.

"taret delete" can now specify "--clean=1" which will cleanup the global module
list for any orphaned module in the shared module cache which can save memory
and also help track down module reference leaks like we have now.

llvm-svn: 137294
2011-08-11 02:48:45 +00:00
Johnny Chen e1894cf97c Add logic to SBValue.linked_list_iter() to detect infinite loop and to bail out early.
Add code to test case to create an evil linked list with:

    task_evil -> task_2 -> task_3 -> task_evil ...

and to check that the linked list iterator only iterates 3 times.

llvm-svn: 137291
2011-08-11 01:19:46 +00:00
Johnny Chen 9c1b703ac4 Change the SBValue.linked_list_iter() to treat the value object as a homogeneous linked list data structure
where an empty linked list is represented as a value object with a NULL value, instead of a special value
object which 'points' to NULL.

Also modifies the test case to comply.

rdar://problem/9933692

llvm-svn: 137289
2011-08-11 00:49:03 +00:00
Johnny Chen 3c24a17c7c Incremental fixes of issues found by Xcode static analyzer.
llvm-svn: 137288
2011-08-11 00:43:20 +00:00
Jim Ingham 478235d882 In the case where we are trying to resume a thread all the way to 0, if we get
llvm-svn: 137287
2011-08-11 00:38:52 +00:00
Johnny Chen 8082a00dcb When a benchmarks test fails, the re-run command should include the '+b' option instead of the '-t' option.
llvm-svn: 137285
2011-08-11 00:16:28 +00:00
Johnny Chen 119fd6c03b Ignore the static analyzer, instead; and add comment why.
llvm-svn: 137275
2011-08-10 23:19:32 +00:00
Johnny Chen 2fe7dd445b Incremental fixes of issues found by Xcode static analyzer.
llvm-svn: 137267
2011-08-10 23:01:39 +00:00
Johnny Chen 25f3a3cde2 Incremental fixes of issues found by Xcode static analyzer.
llvm-svn: 137257
2011-08-10 22:06:24 +00:00
Greg Clayton 8b45bee0e4 Include the qLaunchSuccess and qC packets in the
10 second timeout zone. When launching we increase the
timeout to 10 seconds to ensure we have time to launch a
process, and then set it back.

llvm-svn: 137256
2011-08-10 22:05:39 +00:00
Sean Callanan 5207a340e5 Fixed a problem that prevented access to members
of string literals ("hello"[2]).  Also fixed a
problem in which empty string literals were not
being compiled correctly ((int)printf("") would
print garbage).

Added a testcase that covers both.

llvm-svn: 137247
2011-08-10 21:05:52 +00:00
Johnny Chen 9e916e8096 Check log shared pointer before using it.
llvm-svn: 137228
2011-08-10 17:58:11 +00:00
Enrico Granata 6680421015 renaming command "type synth" to "type synthetic" for added readability
llvm-svn: 137213
2011-08-10 15:29:15 +00:00
Jason Molenda a985d411bc Remove extra newline from end of 'frame info' command output.
llvm-svn: 137208
2011-08-10 10:51:24 +00:00
Greg Clayton 3418c85771 While tracking down memory consumption issue a few things were needed: the
ability to dump more information about modules in "target modules list". We
can now dump the shared pointer reference count for modules, the pointer to
the module itself (in case performance tools can help track down who has
references to said pointer), and the modification time.

Added "target delete [target-idx ...]" to be able to delete targets when they
are no longer needed. This will help track down memory usage issues and help 
to resolve when module ref counts keep getting incremented. If the command gets
no arguments, the currently selected target will be deleted. If any arguments 
are given, they must all be valid target indexes (use the "target list" 
command to get the current target indexes).

Took care of a bunch of "no newline at end of file" warnings.

TimeValue objects can now dump their time to a lldb_private::Stream object.

Modified the "target modules list --global" command to not error out if there
are no targets since it doesn't require a target.

Fixed an issue in the MacOSX DYLD dynamic loader plug-in where if a shared 
library was updated on disk, we would keep using the older one, even if it was
updated.

Don't allow the ModuleList::GetSharedModule(...) to return an empty module.
Previously we could specify a valid path on disc to a module, and specify an
architecture that wasn't contained in that module and get a shared pointer to
a module that wouldn't be able to return an object file or a symbol file. We
now make sure an object file can be extracted prior to adding the shared pointer
to the module to get added to the shared list.

llvm-svn: 137196
2011-08-10 02:10:13 +00:00
Enrico Granata ce68b02c99 CFString.py now shows contents in a more NSString-like way (e.g. you get @"Hello" instead of "Hello")
new --raw-output (-R) option to frame variable prevents using summaries and synthetic children
 other future formatting enhancements will be excluded by using the -R option
 test case enhanced to check that -R works correctly

llvm-svn: 137185
2011-08-09 23:50:01 +00:00
Johnny Chen d62fe94b45 Fix indentation for a log statement.
llvm-svn: 137178
2011-08-09 23:26:20 +00:00
Johnny Chen ee7a359d59 Check log shared pointer before using it.
llvm-svn: 137173
2011-08-09 23:10:20 +00:00
Johnny Chen e95fcf7860 Check log shared pointer before using it.
llvm-svn: 137169
2011-08-09 22:52:27 +00:00
Sean Callanan 1c49954b51 Fixed the type code to print "<invalid>" for NULL
types instead of letting Clang crash.

llvm-svn: 137167
2011-08-09 22:42:51 +00:00
Johnny Chen 4a871f989e Fix indentation.
llvm-svn: 137165
2011-08-09 22:38:07 +00:00
Jim Ingham 20829ac4da Fix a bunch of places where we were calling log->Printf to put CStrings.
llvm-svn: 137164
2011-08-09 22:24:33 +00:00
Sean Callanan 39821ac827 Fixed a potential crash in Process.cpp when we
used a log unchecked.

llvm-svn: 137157
2011-08-09 22:07:08 +00:00
Jim Ingham ae24c42fc4 Typo in the test case for i386.
llvm-svn: 137149
2011-08-09 21:27:48 +00:00
Jim Ingham 04f5672c5b When unloading a library, pass the old complete version of the library to UnloadImageLoadAddress, since that
one is completely filled in.  The one we make up from the event doesn't have section info since the
library has already been unloaded by the time we get to it.

llvm-svn: 137143
2011-08-09 20:45:45 +00:00
Sean Callanan 85a96b12de Fixed the Objective-C "self" test case, which
was behaving erratically because it didn't
have a return statement in -[A init].

Also made minor cosmetic changes to that test
case.

llvm-svn: 137142
2011-08-09 20:28:32 +00:00
Johnny Chen 356b818882 Silence clang warning.
llvm-svn: 137141
2011-08-09 20:22:44 +00:00
Johnny Chen 53e2edbc5c Simplify lang/objc/self/Makefile, plus it's wrong. :-)
For Makefile.rules, the modification of CFLAGS (addition of -arch $(ARCH) for Darwin) needs to come before
the consuming of CFLAGS, not after.

llvm-svn: 137140
2011-08-09 20:07:16 +00:00
Johnny Chen 4c1e920640 Fix a crash while running the test suite. Need to check the (LogSP)log shared pointer before using it.
llvm-svn: 137136
2011-08-09 18:56:45 +00:00
Sean Callanan 677f2a263a Fixed a problem where the HasAVX() code in
debugserver did not back up %ebx/%rbx, even
though it was being clobbered by the CPUID
instruction.

llvm-svn: 137131
2011-08-09 18:10:15 +00:00
Johnny Chen 606e049cca Add a negative self.expect() to verify that the bug has been fixed.
rdar://problem/9747668

llvm-svn: 137129
2011-08-09 17:48:29 +00:00
Greg Clayton dee205a31e The "bool HasAVX()" function doesn't backup and restore the
cpu registers it uses and it crashes the release version of 
debugserver. We just get lucky in Debug builds. Until this 
is fixed I am disabling AVX detection to avoid the crashes. 

llvm-svn: 137113
2011-08-09 05:27:14 +00:00
Greg Clayton c235ac763f Added some logging and did some member renaming.
llvm-svn: 137112
2011-08-09 05:20:29 +00:00
Jim Ingham 4b53618247 Move the handling of breakpoint conditions from the Private event loop to the StopInfoBreakpoint::DoActions, which happens as the
event is removed.  Also use the return value of asynchronous breakpoint callbacks, they get checked before, and override the 
breakpoint conditions.

Added ProcessModInfo class, to unify "stop_id generation" and "memory modification generation", and use where needed.

llvm-svn: 137102
2011-08-09 02:12:22 +00:00
Enrico Granata 27b625e12f Basic support for reading synthetic children by index:
if your datatype provides synthetic children, "frame variable object[index]" should now do the right thing
 in cases where the above syntax would have been rejected before, i.e.
  object is not a pointer nor an array (frame variable ignores potential overload of [])
  object is a pointer to an Objective-C class (which cannot be dereferenced)
 expression will still run operator[] if available and complain if it cannot do so
 synthetic children by name do not work yet

llvm-svn: 137097
2011-08-09 01:04:56 +00:00
Johnny Chen 250a501702 Check in a customized benchmark which compares the Xcode 4.1 vs. Xcode 4.2's gdb disassembly speed
on lldb's Driver::MainLoop function which is ~1190 lines of x86 assembly code.  This file is not
exercised during the normal test suite run, i.e., no +b option specified.  So it should be ok.

The following is the benchmark result on my MBP running OSX Lion:

[17:38:46] johnny:/Volumes/data/lldb/svn/trunk/test $ ./dotest.py -v +b -p TestFlintVsSlate
/Volumes/data/lldb/svn/trunk/build/Debug
LLDB-71
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: 137008
Node Kind: directory
Schedule: normal
Last Changed Author: gclayton
Last Changed Rev: 137008
Last Changed Date: 2011-08-05 17:50:36 -0700 (Fri, 05 Aug 2011)



Session logs for test failures/errors/unexpected successes will go into directory '2011-08-08-17_38_52'
Command invoked: python ./dotest.py -v +b -p TestFlintVsSlate
----------------------------------------------------------------------
Collected 2 tests

1: test_run_41_then_42 (TestFlintVsSlateGDBDisassembly.FlintVsSlateGDBDisassembly)
   Test disassembly on a large function with 4.1 vs. 4.2's gdb. ... 
4.1 gdb benchmark: Avg: 0.205623 (Laps: 5, Total Elapsed Time: 1.028113)
4.2 gdb benchmark: Avg: 0.201970 (Laps: 5, Total Elapsed Time: 1.009849)
gdb_42_avg/gdb_41_avg: 0.982236
ok
2: test_run_42_then_41 (TestFlintVsSlateGDBDisassembly.FlintVsSlateGDBDisassembly)
   Test disassembly on a large function with 4.1 vs. 4.2's gdb. ... 
4.2 gdb benchmark: Avg: 0.202602 (Laps: 5, Total Elapsed Time: 1.013012)
4.1 gdb benchmark: Avg: 0.204418 (Laps: 5, Total Elapsed Time: 1.022089)
gdb_42_avg/gdb_41_avg: 0.991119
ok

----------------------------------------------------------------------
Ran 2 tests in 15.688s

OK

llvm-svn: 137092
2011-08-09 00:56:07 +00:00
Jim Ingham 79c35da776 Don't create a new stop info if we've already calculated one and it is still valid.
llvm-svn: 137084
2011-08-09 00:32:52 +00:00
Jim Ingham 7d6811d60e Remove some commented out code that doesn't connect to anything yet...
llvm-svn: 137081
2011-08-09 00:26:56 +00:00
Greg Clayton 65a0399197 Added a "--global" option to the "target modules list"
command that allows us to see all modules that exist and
their corresponding global shared pointer count. This will
help us track down memory issues when modules aren't being
removed and cleaned up from the module list.

llvm-svn: 137078
2011-08-09 00:01:09 +00:00
Jim Ingham 41c7591a1a Add EvaluateWithError static method. Fix a bug in handling constant expressions - we weren't setting the result even though the expression evaluation succeeded...
llvm-svn: 137077
2011-08-09 00:00:49 +00:00
Greg Clayton 2d0e7a4a2e Fixed a loop that I was testing changes with and forgot
to revert to zero.

llvm-svn: 137008
2011-08-06 00:50:36 +00:00
Sean Callanan 69b5341c6a Made the expression parser use the StackFrame's
variable search API rather than rolling its own,
fixing one of our testcases.

llvm-svn: 137004
2011-08-06 00:28:14 +00:00
Sean Callanan 72e4940bd1 This is an overhaul of the expression parser code
that detects what context the current expression is
meant to execute in.  LLDB now properly consults
the method declaration in the debug information
rather than trying to hunt down the "this" or "self"
pointer by name, which can be misleading.

Other fixes include:

- LLDB now properly detects that it is inside
  an inlined C++ member function.

- LLDB now allows access to non-const members when
  in const code.

- The functions in SymbolFile that locate the
  DeclContext containing a DIE have been renamed
  to reflect what they actually do.  I have added
  new functions that find the DeclContext for the
  DIE itself.

I have also introduced testcases for C++ and 
Objective-C.

llvm-svn: 136999
2011-08-05 23:43:37 +00:00
Johnny Chen 76ea84eaf4 On second thought, add the IsValid() method to SBTypeList, making it similar to SBSymbolContextList and SBValueList.
Modify the test suite accordingly.

llvm-svn: 136990
2011-08-05 22:23:26 +00:00
Johnny Chen 7af935ed9a Fixed test suite failure of test_SBTypeList().
SBTypeList does not have IsValid() method defined.  It's always valid in a sense.
So the Python's truth value testing in turn delegates to __len__() method, which
is defined for SBTypeList, and returns 0.

llvm-svn: 136985
2011-08-05 21:55:15 +00:00
Johnny Chen cbf1737ea1 Add SBType.GetBasicType() to the test scenario.
Add docstring for SBType, too.

llvm-svn: 136983
2011-08-05 21:35:43 +00:00
Greg Clayton a17ec9d84d Fixed issues for iOS debugging where if a device has
a native architecture that doesn't match the universal
slice that is being used for all executables, we weren't
correctly descending through the platform architectures
and resolving the binaries.

llvm-svn: 136980
2011-08-05 20:48:30 +00:00
Johnny Chen 9b97f1c3e6 Add docstring & example usage for SBTypeList.
llvm-svn: 136979
2011-08-05 20:48:02 +00:00
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