Commit Graph

1407 Commits

Author SHA1 Message Date
Greg Clayton 7d07a45fff Fixed an issue where the macosx dynamic loader, on the first shared library loaded notification, wasn't properly removing shared libraries from the target that didn't get loaded. This usually happens when a different shared library is loaded in place of another due to DYLD_LIBRARY_PATH or DYLD_FRAMEWORK_PATH environment variables. We now properly remove any images that didn't make it into the executable.
llvm-svn: 121641
2010-12-12 21:03:32 +00:00
Greg Clayton ac2eb9b1ec Added the ability for SBTarget to resolve load addresses (convert lldb::addr_t values into resolved SBAddress objects). These SBAddress objects can then be used to resolve a symbol context using "lldb::SBSymbolContext ResolveSymbolContextForAddress (const lldb::SBAddress& addr, uint32_t resolve_scope);".
llvm-svn: 121638
2010-12-12 19:25:26 +00:00
Caroline Tice 01274c098b Fix bug where using incomplete strings for command names causes
lldb to crash (because of attempt to look for full names when full
names were not used).

llvm-svn: 121607
2010-12-11 08:16:56 +00:00
Johnny Chen f6eaba85a8 Add test_display_source_python() test case to TestSourceManager.py which uses
the lldb PyThon API SBSourceManager to display source files.

To accomodate this, the C++ SBSourceManager API has been changed to take an
lldb::SBStream as the destination for display of source lines.  Modify SBStream::ctor()
so that its opaque pointer is initialized with an StreamString instance.

llvm-svn: 121605
2010-12-11 01:20:39 +00:00
Sean Callanan 7fddd4c1f2 Made all LLDB-generated ASTContexts have valid
DiagnosticClients, and removed code that was patching
over the original problem.

llvm-svn: 121601
2010-12-11 00:08:56 +00:00
Johnny Chen de1451ef4b Make sure that @python_api_test is only used to decorate a test method, not the
test class.

llvm-svn: 121538
2010-12-10 21:33:31 +00:00
Sean Callanan a43f20df95 Simplified the code that handles overloaded
operator names.

llvm-svn: 121511
2010-12-10 19:51:54 +00:00
Johnny Chen 240f8c7dd1 Do not specify both '-a' and '+a' at the same time.
llvm-svn: 121501
2010-12-10 19:02:23 +00:00
Johnny Chen f3e22ac3c7 Add a '+a' command line option to the test driver to run only the Python API tests.
Add an attribute __python_api_test__ (set to True) to the @python_api_test decorated
test method to distinguish them from the lldb command line tests.

llvm-svn: 121500
2010-12-10 18:52:10 +00:00
Johnny Chen 47ed69e72c Add the @python_api_test decorator for two test cases.
llvm-svn: 121499
2010-12-10 18:42:07 +00:00
Johnny Chen 63d045d560 Fix some typo in method names and docstrings.
llvm-svn: 121494
2010-12-10 17:15:34 +00:00
Jim Ingham 484ef8003e Added some tests for ObjC stepping, step into ordinary and stret methods, and stepping
through a KVO swizzled object's method calls.

llvm-svn: 121457
2010-12-10 02:33:02 +00:00
Sean Callanan bfeff8c4a2 Fixed detection of overloaded operators in type
information.  Previously, "operator[]" was not
being recognized because the detector was looking
for "operator " as a prefix.  Now we handle both
cases.

llvm-svn: 121456
2010-12-10 02:15:55 +00:00
Johnny Chen a47d7cb9b9 Add @python_api_test decorator to the remaining Test*.py files.
llvm-svn: 121448
2010-12-10 01:21:27 +00:00
Johnny Chen 8906814057 Fix a test method docstring.
llvm-svn: 121446
2010-12-10 00:58:18 +00:00
Johnny Chen 7c7d936e48 Add an infrastructure to mark the Python APIs only test using a decorator.
Example:

    @python_api_test
    def test_evaluate_expression_python(self):
        """Test SBFrame.EvaluateExpression() API for evaluating an expression."""
    ...

The opposite of Python APIs only test is an lldb command line test, which sends
commands to the lldb command interpreter.  Add a '-a' option to the test driver
to skip Python API only tests.

Modify TestExprs.py to mark a test as @python_api_test and remove an @expectedFailure
decorator as the bug has been fixed.

llvm-svn: 121442
2010-12-10 00:51:23 +00:00
Jim Ingham a58f548369 Added the source file for some ObjC stepping tests. No test yet.
llvm-svn: 121440
2010-12-10 00:27:27 +00:00
Caroline Tice 2d5289d621 Various fixes mostly relating to the User Settings stuff:
- Added new utility function to Arg, GetQuotedCommandString, which re-assembles
the args into a string, replacing quotes that were originally there.

- Modified user settings stuff to always show individual elements when printing out
arrays and dictionaries.

- Added more extensive help to 'settings set', explaining more about dictionaries
and arrays (including current dictionary syntax).

- Fixed bug in user settings  where quotes were being stripped and lost, so that
sometimes array or dictionary elements that ought to have been a single element
were being split up.

llvm-svn: 121438
2010-12-10 00:26:54 +00:00
Jim Ingham 957373fc84 Changing the ObjC find method implementation to use a ClangUtilityFunction inserted into the target. Consolidate all the
logic for finding the target of a method dispatch into this function, insert & call it.  Gets calls to super, and all the
fixup & fixedup variants working properly.  Also gets the class from the object so that we step through KVO wrapper methods
into the actual user code.

llvm-svn: 121437
2010-12-10 00:26:25 +00:00
Caroline Tice 844d230332 Modify HandleCommand to not do any argument processing until it has determined whether or
not the command should take raw input, then handle & dispatch the arguments appropriately.

Also change the 'alias' command to be a command that takes raw input.  This is necessary to
allow aliases to be created for other commands that take raw input and might want to include
raw input in the alias itself.

Fix a bug in the aliasing mechanism when creating aliases for commands with 3-or-more words.

Raw input should now be properly handled by all the command and alias mechanisms.

llvm-svn: 121423
2010-12-09 22:52:49 +00:00
Johnny Chen 2bac54fe0c Add more module docstring.
llvm-svn: 121421
2010-12-09 22:11:59 +00:00
Johnny Chen de2c8bd877 Minor docstring change.
llvm-svn: 121419
2010-12-09 22:06:05 +00:00
Jim Ingham bb9caf73fa process launch now asks to kill the current process if it is alive, and if you affirm, does so for you.
Also added #pragma mark for the command objects defined in the file.

llvm-svn: 121396
2010-12-09 18:58:16 +00:00
Johnny Chen 67f73ac7f2 Remove unnecessary imports.
llvm-svn: 121393
2010-12-09 18:38:52 +00:00
Johnny Chen 5b3a357dec Add a test/source-manager directory for testing lldb core component SourceManager.
Initial test case test_modify_source_file_while_debugging() in TestSourceManager.py
tests the caching mechanism of the source manager.

llvm-svn: 121389
2010-12-09 18:22:12 +00:00
Greg Clayton 8d846daa81 Any arguments that are not options to the "lldb" command line driver, now get
used as the arguments for the inferior program. So for example you can do

% lldb /bin/ls /tmp ~/Documents

And "lldb" will use "/bin/ls" as the program and send arguments "/tmp" and
"~/Documents" as the launch args.

If you specify a file, then all remaining args after option parsing
will be used for program arguments:

% lldb -f /bin/ls /tmp ~/Documents

If you need to pass option values to your inferior program, just terminate
the "lldb" command line driver options with "--":

% lldb -- /bin/ls -AFl /tmp

The arguments are placed into the "settings" variable named 
"target.process.run-args". This allows you to just run the program using
"process launch" and, if no args are specified on that command, the 
"target.process.run-args" values will be used:

% lldb -- /bin/ls -AFl /tmp
Current executable set to '/bin/ls' (x86_64).
(lldb) settings show target.process.run-args 
target.process.run-args (array):
  [0]: '-AFl'
  [1]: '/tmp'
(lldb) 
(lldb) r
Process 56753 launched: '/bin/ls' (x86_64)
lrwxr-xr-x@ 1 root  wheel  11 Nov 19  2009 /tmp@ -> private/tmp

llvm-svn: 121295
2010-12-08 22:23:24 +00:00
Greg Clayton 9625d08cec Fixed an issue in our source manager where we were permanently caching source
file data, so if a source file was modified, we would always show the first
cached copy of the source data. We now check file modification times when
displaying source info so we can show the update source info.

llvm-svn: 121278
2010-12-08 20:16:12 +00:00
Johnny Chen b340e6bb15 Add more docstring for the lldb_iter() utility function which provides a compact
way of iterating through an aggregate data structure.  The added example usage
is from an actual use in test/foundation/TestSymbolTable.py:

    2. Pass a container of aggregate which provides APIs to get to the size and
       the element of the aggregate:

    # Module is a container of symbol table 
    module = target.FindModule(filespec)
    for symbol in lldb_iter(module, 'GetNumSymbols', 'GetSymbolAtIndex'):
        name = symbol.GetName()
        ...

llvm-svn: 121271
2010-12-08 19:19:08 +00:00
Johnny Chen 7b81dfd1cc Modify the TestObjCMethods2.py test to fix a typo (should be str_id, not id).
Also, add bug info for expected failures that remain:

    <rdar://problem/8741897> Expressions should support properties

llvm-svn: 121268
2010-12-08 18:14:20 +00:00
Greg Clayton 5e0ab134c6 Bumped lldb Xcode version to 35 for lldb-35, and debugserver to 121 for
debugserver-121.

llvm-svn: 121237
2010-12-08 05:24:05 +00:00
Greg Clayton 10177aa05e Added the ability to dump sections to a certain depth (for when sections
have children sections).

Modified SectionLoadList to do it's own multi-threaded protected on its map.
The ThreadSafeSTLMap class was difficult to deal with and wasn't providing
much utility, it was only getting in the way.

Make sure when the communication read thread is about to exit, it clears the
thread in the main class.

Fixed the ModuleList to correctly ignore architectures and UUIDs if they aren't
valid when searching for a matching module. If we specified a file with no arch,
and then modified the file and loaded it again, it would not match on subsequent
searches if the arch was invalid since it would compare an invalid architecture
to the one that was found or selected within the shared library or executable.
This was causing stale modules to stay around in the global module list when they
should have been removed.

Removed deprecated functions from the DynamicLoaderMacOSXDYLD class.

Modified "ProcessGDBRemote::IsAlive" to check if we are connected to a gdb
server and also make sure our process hasn't exited.

llvm-svn: 121236
2010-12-08 05:08:21 +00:00
Greg Clayton bc5cad6c6b Fixed up the error message for when a file is not supported.
llvm-svn: 121235
2010-12-08 04:55:11 +00:00
Sean Callanan e97ae90da0 Fixed a problem where the AST importer would assert()
because the diagnostic client for one of the AST
contexts is NULL.  Now we provide a form of Miranda
rights to AST contexts: they are provided with a very
simple diagnostic client if they do not have one
themselves.

llvm-svn: 121225
2010-12-08 01:51:31 +00:00
Johnny Chen 025d1b8f95 For SBTarget.Launch()/LaunchProcess(), there's no need to pass an empty string
as the args and the envs to the launched process.

o lldbtest.py:

  Forgot to check in some assertion messages changes for lldbtest.py.

o dotest.py:

  Also add "api" category to the default lldb log option list.

llvm-svn: 121220
2010-12-08 01:25:21 +00:00
Johnny Chen 0ecec99eb2 Add test_evaluate_expression_python() to exercise SBFrame.EvaluateExpression() Python API.
Launch the process with ['X', 'Y', 'Z'] as the args to make argc == 4 and verify that's the case,
plus some other EvaluateExpression() calls.

llvm-svn: 121218
2010-12-08 01:08:27 +00:00
Johnny Chen aa92f631b4 Use Python raw string literal to avoid escaping the escape sequence and to make
the command given to lldb command interpreter more readable.

llvm-svn: 121199
2010-12-07 23:12:51 +00:00
Sean Callanan a162ebafdb More logging for use in debugging the interactions
between clients of the LLDB API and the expression
parser.

llvm-svn: 121193
2010-12-07 22:55:01 +00:00
Johnny Chen 56d8ac4e80 Make the various expression command test sequences more strict by also verifying
the results against our golden ones.

llvm-svn: 121185
2010-12-07 21:17:12 +00:00
Johnny Chen 74481444ab Add a test sequence for test_expr_commands_can_handle_quotes(self):
# runCmd: command alias print_hi expression printf ("\n\tHi!")
        # output: 
        self.runCmd('command alias print_hi expression printf ("\\n\\tHi!")')
        # This fails currently.
        self.runCmd('print_hi')

and modify existing test sequences to escape the escape character '\ to prevent it
from being interpreted by Python before passing on to the lldb command interpreter.

llvm-svn: 121183
2010-12-07 20:52:36 +00:00
Johnny Chen 5be1db9c71 Remove comment no longer applied.
llvm-svn: 121178
2010-12-07 20:22:32 +00:00
Caroline Tice d9d63369df - Fix alias-building & resolving to properly handle optional arguments for command options.
- Add logging for command resolution ('log enable lldb commands')
- Fix alias resolution to properly handle commands that take raw input (resolve the alias, but
  don't muck up the raw arguments).

Net result:  Among other things, 'expr' command can now take strings with escaped characters and
not have the command handling & alias resolution code muck up the escaped characters. E.g.
 'expr printf ("\n\n\tHello there!")' should now work properly.


Not working yet:  Creating aliases with raw input for commands that take raw input.  Working on that.
e.g. 'command alias print_hi expr printf ("\n\tHi!")' does not work yet.

llvm-svn: 121171
2010-12-07 19:58:26 +00:00
Johnny Chen d43384f608 Add test/foundation/TestSymbolTable.py to exercise accessing the symbol table
entries (including synthesized properties) through the lldb Python APIs.

llvm-svn: 121168
2010-12-07 19:37:52 +00:00
Greg Clayton 2a43368a03 Cleanup before making the objective C ivar changes.
llvm-svn: 121158
2010-12-07 18:26:09 +00:00
Greg Clayton f66935840d Improved the "image dump section" command output by making sure
it indents and shows things correctly. When we are debugging DWARF
in .o files with debug map, we can see the remapped sections by
dumping the sections for the .o files by explicitly dumping the
module by name. For example, debugging the lldb/test/class_types
example on MacOSX without a dSYM file we can make a query that 
causes the main.o file to be loaded, then we can do a:

(lldb) image dump section main.o

This will show the exact section map that is used and can help
track down when things are going wrong with DWARF in .o files with
debug map.

llvm-svn: 121154
2010-12-07 18:05:22 +00:00
Johnny Chen d732156bed 'thread backtrace', not 'thread backtrac'.
llvm-svn: 121151
2010-12-07 17:10:46 +00:00
Johnny Chen 74721273c6 The do_simple_disasm() also needs to be modified to accommodate the recent changes
to main.m.

llvm-svn: 121150
2010-12-07 17:08:16 +00:00
Sean Callanan c673a6e93e Logging improvements to help identify major events in
LLDB expression execution.
We also now print the argument structure after execution,
to allow us to verify that the expression did indeed
execute correctly.

llvm-svn: 121126
2010-12-07 10:00:20 +00:00
Greg Clayton 65e364e5da Fixed an issue when debugging with DWARF in the .o files where
if two functions had the same demangled names (constructors where
we have the in charge and not in charge version) we could end up
mixing the two up when making the function in the DWARF. This was
because we need to lookup the symbol by name and we need to use the
mangled name if there is one. This ensures we get the correct address
and that we resolve the linked addresses correctly for DWARf with debug
map.

llvm-svn: 121116
2010-12-07 07:37:38 +00:00
Greg Clayton 75dbe3c799 Forgot to qualify SBSymbol with the lldb namespace for SWIG.
llvm-svn: 121115
2010-12-07 05:59:16 +00:00
Greg Clayton bbdabce2f7 Added symbol table access through the module for now. We might need to expose
a SBSymtab class, but for now, we expose the symbols through the module.

llvm-svn: 121112
2010-12-07 05:40:31 +00:00