Commit Graph

928 Commits

Author SHA1 Message Date
Johnny Chen 1a5d93d589 Use the SBTarget process launch API for api testings.
llvm-svn: 115822
2010-10-06 20:03:28 +00:00
Johnny Chen 2c2d69dff5 Change the regular expression used to grok the data type associated the output of
expression parser in light of the recent check ins.

Example:
    runCmd: expr a
    output: (double) $0 = 1100.12

llvm-svn: 115821
2010-10-06 20:00:48 +00:00
Johnny Chen bcbb69856d Change the expected term-width output string to be a substring instead of a startstring
for the test case test_set_term_width() after the recent changes.

llvm-svn: 115820
2010-10-06 19:42:37 +00:00
Johnny Chen 77d8fa362b Modification of the expected start strings for simple 'expr' output involving persistent variables.
llvm-svn: 115819
2010-10-06 19:38:08 +00:00
Johnny Chen 7731457ac9 Modification of the expected pattern for 'expr this->m_c_int' output.
llvm-svn: 115818
2010-10-06 19:32:50 +00:00
Greg Clayton b4fb2a991c Leaving in deprecated functions until we can get a clean build with the new APIs in place before removing the deprecated functions.
llvm-svn: 115815
2010-10-06 18:44:26 +00:00
Johnny Chen df2dc0f6f2 Modification of the expected substrings for the print representations of SBProcess and SBThread.
llvm-svn: 115804
2010-10-06 18:16:19 +00:00
Greg Clayton cf4f56c4cb Fixed a few issues with the example script.
llvm-svn: 115801
2010-10-06 17:33:30 +00:00
Greg Clayton 5d5028b54e Added the first of hopefully many python example scripts that show how to
use the python API that is exposed through SWIG to do some cool stuff.

Also fixed synchronous debugging so that all process control APIs exposed
through the python API will now wait for the process to stop if you set
the async mode to false (see disasm.py).

llvm-svn: 115738
2010-10-06 03:53:16 +00:00
Greg Clayton 1d27316606 Added the ability to get the disassembly instructions from the function and
symbol.

llvm-svn: 115734
2010-10-06 03:09:58 +00:00
Greg Clayton 32c4085ba2 Restored the ability to set the format for expressions after changing the expression results over to ValueObjectSP objects.
llvm-svn: 115733
2010-10-06 03:09:11 +00:00
Greg Clayton f4abd0db15 Fixed an issue with the mach-o file parser when parsing indirect symbol stubs
where the symbol index was set to INDIRECT_SYMBOL_ABS and was causing an
assertion to fire when we loaded older Mac OS X binaries.

llvm-svn: 115729
2010-10-06 01:26:32 +00:00
Sean Callanan 2ab40fecf6 Updated the expression parser to ignore non-external
functions it finds in libraries unless it cannot find
an external function with the desired name.

llvm-svn: 115721
2010-10-06 00:10:07 +00:00
Johnny Chen 36e40a8449 Modified to accomodate gcc, llvm-gcc, and clang as compilers.
Add a comment for 'breakpoint set -M C' not working correctly for clang.

llvm-svn: 115712
2010-10-05 23:15:41 +00:00
Sean Callanan 85a0a83a26 Added handling for external variables in function
arguments to the expression parser.  This means that
structs can be returned from the "expr" command.

llvm-svn: 115698
2010-10-05 22:26:43 +00:00
Sean Callanan f4b9bd3e74 Added support for (de)materializing values in registers,
so that expressions can use them.

llvm-svn: 115658
2010-10-05 20:18:48 +00:00
Johnny Chen 1d4cc2f06c Add a test class to call lldb 'disassemble -n function' command on each call frame when stopped on C's ctor.
This is not a long running test so it shall always be exercised.

llvm-svn: 115653
2010-10-05 19:34:06 +00:00
Johnny Chen 67af43f04f Make the test module with unique name instead of just the generic name TestDisassembly.
Add a utility function to lldbtest.py to get the native pointer size of the host os.

llvm-svn: 115652
2010-10-05 19:27:32 +00:00
Johnny Chen 68e37439a9 Filename renamings.
llvm-svn: 115636
2010-10-05 17:34:07 +00:00
Greg Clayton b71f384455 Added the notion that a value object can be constant by adding:
bool ValueObject::GetIsConstant() const;
    void ValueObject::SetIsConstant();

This will stop anything from being re-evaluated within the value object so
that constant result value objects can maintain their frozen values without
anything being updated or changed within the value object.

Made it so the ValueObjectConstResult can be constructed with an 
lldb_private::Error object to allow for expression results to have errors.

Since ValueObject objects contain error objects, I changed the expression
evaluation in ClangUserExpression from 

    static Error
    ClangUserExpression::Evaluate (ExecutionContext &exe_ctx, 
                                  const char *expr_cstr, 
                                  lldb::ValueObjectSP &result_valobj_sp);

to:

    static lldb::ValueObjectSP
    Evaluate (ExecutionContext &exe_ctx, const char *expr_cstr);
    
Even though expression parsing is borked right now (pending fixes coming from
Sean Callanan), I filled in the implementation for:
    
    SBValue SBFrame::EvaluateExpression (const char *expr);
    
Modified all expression code to deal with the above changes.

llvm-svn: 115589
2010-10-05 03:13:51 +00:00
Greg Clayton 0184f01936 Moved expression evaluation from CommandObjectExpression into
ClangUserExpression::Evaluate () as a public static function so anyone can
evaluate an expression.

llvm-svn: 115581
2010-10-05 00:31:29 +00:00
Johnny Chen 57e5efa2e3 Move two files to the 'attic'.
llvm-svn: 115579
2010-10-05 00:08:08 +00:00
Greg Clayton 1d3afba3a3 Added a new ValueObject type that will be used to freeze dry expression
results. The clang opaque type for the expression result will be added to the
Target's ASTContext, and the bytes will be stored in a DataBuffer inside
the new object. The class is named: ValueObjectConstResult

Now after an expression is evaluated, we can get a ValueObjectSP back that
contains a ValueObjectConstResult object.

Relocated the value object dumping code into a static function within
the ValueObject class instead of being in the CommandObjectFrame.cpp file
which is what contained the code to dump variables ("frame variables").

llvm-svn: 115578
2010-10-05 00:00:42 +00:00
Johnny Chen bb5f078ce0 Do 'disassemble -s start_addr -e end_addr' on stdc++ library function entries.
llvm-svn: 115574
2010-10-04 23:03:34 +00:00
Jim Ingham 3bcdb29cab Add an "auto-confirm" setting to the debugger so you can turn off the confirmations if you want to.
llvm-svn: 115572
2010-10-04 22:44:14 +00:00
Caroline Tice 405fe67f14 Modify existing commands with arguments to use the new argument mechanism
(for standardized argument names, argument help, etc.)

llvm-svn: 115570
2010-10-04 22:28:36 +00:00
Chris Lattner 69d23282b4 Use the LLVM Macho.h header instead of relying on the system one,
patch by Arvid Picciani!

llvm-svn: 115563
2010-10-04 21:24:01 +00:00
Jim Ingham 97a6dc7e16 Add a "Confirm" function to the CommandInterpreter so you can confirm potentially dangerous operations in a generic way.
llvm-svn: 115546
2010-10-04 19:49:29 +00:00
Jim Ingham 4b9395ca82 Have to friend SBFrame or it can't make symbols for the frame.
llvm-svn: 115543
2010-10-04 19:38:50 +00:00
Johnny Chen fe9f456291 Initial version of a test case meant to disassemble each and every function from
the stdc++ library module.  Right now, it doesn't do any disassembly at all.  It
merely locates the stdc++ library.  Also tests the SBProcess object description
and verifies it is in a 'Stopped' state.

llvm-svn: 115536
2010-10-04 18:39:14 +00:00
Greg Clayton 3b06557e4f Added GetSymbol to the frame.
llvm-svn: 115535
2010-10-04 18:37:52 +00:00
Greg Clayton 0d9c993401 Fixed and issue where we weren't seeing inlined functions anymore. We also now show the correct pc-offset within the inlined function.
llvm-svn: 115522
2010-10-04 17:26:49 +00:00
Greg Clayton cf4b9078f2 Added file and line back to the default thread format.
llvm-svn: 115519
2010-10-04 17:04:23 +00:00
Johnny Chen 262d619be7 Remove file:lineno from the expected substrings. Matching 'a_function, i.e.,
the {function.name}, is sufficient for this test case.

Plus added @expectedfailure decorator for a filed bug.

llvm-svn: 115517
2010-10-04 16:58:16 +00:00
Johnny Chen f32a446bc8 Remove file:lineno from the expected substrings. Matching 'a.out`string_not_empty', i.e.,
${module.file.basename}{`${function.name}, is sufficient for this test case.

llvm-svn: 115514
2010-10-04 16:38:12 +00:00
Johnny Chen 33e1313a01 The 'thread list' command no longer displays the file:lineno after the recent check-in.
Remove file:lineno from the expected substrings.

llvm-svn: 115512
2010-10-04 16:23:16 +00:00
Greg Clayton 7a98e5b4e5 Clarified some caveats for thread format strings.
llvm-svn: 115491
2010-10-04 03:06:05 +00:00
Greg Clayton bb562b13db Fixed an issue with the default frame format settings string where if a frame
was stopped in a module, yet had no valid function for the PC, no module would
be displayed.

llvm-svn: 115490
2010-10-04 02:44:26 +00:00
Greg Clayton 877b59dc9c Added documentation for the new frame and thread format strings.
llvm-svn: 115488
2010-10-04 02:33:45 +00:00
Greg Clayton 0603aa9dc8 There are now to new "settings set" variables that live in each debugger
instance:

settings set frame-format <string>
settings set thread-format <string>

This allows users to control the information that is seen when dumping
threads and frames. The default values are set such that they do what they
used to do prior to changing over the the user defined formats.

This allows users with terminals that can display color to make different
items different colors using the escape control codes. A few alias examples
that will colorize your thread and frame prompts are:

settings set frame-format 'frame #${frame.index}: \033[0;33m${frame.pc}\033[0m{ \033[1;4;36m${module.file.basename}\033[0;36m ${function.name}{${function.pc-offset}}\033[0m}{ \033[0;35mat \033[1;35m${line.file.basename}:${line.number}}\033[0m\n'

settings set thread-format 'thread #${thread.index}: \033[1;33mtid\033[0;33m = ${thread.id}\033[0m{, \033[0;33m${frame.pc}\033[0m}{ \033[1;4;36m${module.file.basename}\033[0;36m ${function.name}{${function.pc-offset}}\033[0m}{, \033[1;35mstop reason\033[0;35m = ${thread.stop-reason}\033[0m}{, \033[1;36mname = \033[0;36m${thread.name}\033[0m}{, \033[1;32mqueue = \033[0;32m${thread.queue}}\033[0m\n'

A quick web search for "colorize terminal output" should allow you to see what
you can do to make your output look like you want it.

The "settings set" commands above can of course be added to your ~/.lldbinit
file for permanent use.

Changed the pure virtual 
    void ExecutionContextScope::Calculate (ExecutionContext&);
To:
    void ExecutionContextScope::CalculateExecutionContext (ExecutionContext&);
    
I did this because this is a class that anything in the execution context
heirarchy inherits from and "target->Calculate (exe_ctx)" didn't always tell
you what it was really trying to do unless you look at the parameter.

llvm-svn: 115485
2010-10-04 01:05:56 +00:00
Johnny Chen 2f71831ceb Remove the @skip() and @expectedFaiure decorators, the previously affected tests
have now all passed.

rdar://problem/8502549 and rdar://problem/8493023 are fixed

llvm-svn: 115399
2010-10-02 01:46:20 +00:00
Greg Clayton 90a2acd441 One final patch for all of this class constructor, destructor, and conversion
operator naming stuff. We now get the constructor and destructor names right
after passing in the type, and we get the correct conversion operator name
after passing in the return type when getting the DeclarationNameInfo.

llvm-svn: 115398
2010-10-02 01:40:05 +00:00
Johnny Chen 1e190a552f Use a more robust regexp to search for the 'Code' symbol. Plus compile the
regexp once and use it within the for loop for some speedup.

llvm-svn: 115397
2010-10-02 01:23:40 +00:00
Sean Callanan 9c5fe130e1 Update to the latest Clang, which fixes a problem
with importing class/struct types.

llvm-svn: 115394
2010-10-02 01:07:50 +00:00
Johnny Chen 7fce877aa5 I committed too fast. Both "struct objc_selector *" and "SEL" are possible,
depending on the compiler used.  Former if gcc/llvm-gcc, and latter if clang.

llvm-svn: 115380
2010-10-01 23:34:28 +00:00
Johnny Chen 9eaa69699a Updated the expected match string when stopped on an objc instance method from:
ARG: (struct objc_selector *) _cmd

to

    ARG: (SEL) _cmd

The change most likely resulted from an update from the llvm tot with a newer clang.

llvm-svn: 115372
2010-10-01 23:21:20 +00:00
Greg Clayton a3c444ac23 Get the declaration names for C++ ctors, dtors, and operators from the
right name pools.

llvm-svn: 115371
2010-10-01 23:13:49 +00:00
Johnny Chen b781cf0022 Commented out two debug prints.
llvm-svn: 115369
2010-10-01 23:05:03 +00:00
Johnny Chen da88434b39 o Added a new feature to the test framework to skip long running tests conditionally.
To not skip long running tests, pass '-l' to the test driver (dotest.py).

  An example:

    @unittest2.skipIf(TestBase.skipLongRunningTest(), "Skip this long running test")
    def test_foundation_disasm(self):
        ...

o Added a long running disassemble test to the foundation directory, which iterates
  the code symbols from Foundation.framework and kicks off a disassemble command for
  for the named function symbol.  Found a crasher: rdar://problem/8504895.

o Plus added/updated some comments for the TestBase class.

llvm-svn: 115368
2010-10-01 22:59:49 +00:00
Caroline Tice 8d88020e92 Uncomment/fix "-f" command option for disassemble command.
llvm-svn: 115351
2010-10-01 21:34:54 +00:00
Greg Clayton c93237c991 Fixed an issue where if a method funciton was asked to be parsed before
its containing class was parsed, we would crash.

llvm-svn: 115343
2010-10-01 20:48:32 +00:00
Caroline Tice deaab2220e Modify command options to use the new arguments mechanism. Now all command option
arguments are specified in a standardized way, will have a standardized name, and
have functioning help.

The next step is to start writing useful help for all the argument types.

llvm-svn: 115335
2010-10-01 19:59:14 +00:00
Johnny Chen f14331f5c3 Only skip the test cases which are currently crashing, instead of the whole class.
Also, the break by location needs to be modified after changees made to the main.cpp source code.

llvm-svn: 115320
2010-10-01 18:08:29 +00:00
Caroline Tice e139cf2320 Add infrastructure for standardizing arguments for commands and
command options; makes it easier to ensure that the same type of
argument will have the same name everywhere, hooks up help for command
arguments, so that users can ask for help when they are confused about
what an argument should be; puts in the beginnings of the ability to
do tab-completion for certain types of arguments, allows automatic
syntax help generation for commands with arguments, and adds command
arguments into command options help correctly.

Currently only the breakpoint-id and breakpoint-id-range arguments, in
the breakpoint commands, have been hooked up to use the new mechanism.
The next steps will be to fix the command options arguments to use
this mechanism, and to fix the rest of the regular command arguments
to use this mechanism.  Most of the help text is currently missing or
dummy text; this will need to be filled in, and the existing argument
help text will need to be cleaned up a bit (it was thrown in quickly,
mostly for testing purposes).

Help command now works for all argument types, although the help may not
be very helpful yet.

Those commands that take "raw" command strings now indicate it in their
help text.

llvm-svn: 115318
2010-10-01 17:46:38 +00:00
Johnny Chen b5051dc529 Added bug number to the @skip decorator.
llvm-svn: 115317
2010-10-01 16:34:53 +00:00
Johnny Chen 179543890e These currently crash (from running 'expr' command). Disable the entire class for the time being.
llvm-svn: 115316
2010-10-01 16:26:42 +00:00
Greg Clayton 878eaf188c Added correct C++ method declarations for destructors and for conversion
operators.

llvm-svn: 115290
2010-10-01 03:45:20 +00:00
Greg Clayton f51de67640 Make C++ constructors and destructors correctly within the clang types we
generate from DWARF.

llvm-svn: 115268
2010-10-01 02:31:07 +00:00
Sean Callanan e1314273b6 Fixed handling of signed short types in expressions.
llvm-svn: 115267
2010-10-01 02:06:46 +00:00
Johnny Chen ec67219617 Add a simple test for the lldb 'disassemble' command. The initial version just
sets some breakpoints and invokes 'disassemble' when the breakpoint hits, which
just disassembles the bytes in the current function, i.e., frame #0's function.

llvm-svn: 115249
2010-10-01 00:10:17 +00:00
Johnny Chen 9ea6e21f91 Updated to remove most of the @expectedFailure decorators for:
# rdar://problem/8493023
    # test/types failures for Test*TypesExpr.py: element offset computed wrong and sign error?

Two failures remain for test_short* test cases.

llvm-svn: 115229
2010-09-30 22:49:07 +00:00
Greg Clayton 16c880f080 Fixed an issue where byte sizes were not able to be calculated for forward
declarations because we lost the original context which was needed to be
able to figure out the byte size.

llvm-svn: 115223
2010-09-30 22:25:09 +00:00
Johnny Chen c63bf9961c Modification required to test clang, gcc, and llvm-gcc.
llvm-svn: 115216
2010-09-30 22:11:33 +00:00
Greg Clayton 4957bf69e5 Cleaned up a unused member variable in Debugger.
Added the start of Host specific launch services, though it currently isn't
hookup up to anything. We want to be able to launch a process and use the
native launch services to launch an app like it would be launched by the
user double clicking on the app. We also eventually want to be able to run
a command line app in a newly spawned terminal to avoid terminal sharing.

Fixed an issue with the new DWARF forward type declaration stuff. A crasher
was found that was happening when trying to properly expand the forward
declarations.

llvm-svn: 115213
2010-09-30 21:49:03 +00:00
Jim Ingham 86103ea237 Change how we call Target::CreateBreakpoint to account for the new "name type" parameter.
llvm-svn: 115210
2010-09-30 21:21:43 +00:00
Sean Callanan 038df50315 Switched the expression parser from using TargetData
to using Clang to get type sizes.  This fixes a bug
where the type size for a double[2] was being wrongly
reported as 8 instead of 16 bytes, causing problems
for IRForTarget.

Also improved logging so that the next bug in this
area will be easier to find.

llvm-svn: 115208
2010-09-30 21:18:25 +00:00
Johnny Chen e8a3093296 Add a more complex test scenario for breakpoint locations, with breakpoint enable/disable.
llvm-svn: 115202
2010-09-30 20:46:47 +00:00
Johnny Chen f7edb1c813 Fixed indentation.
llvm-svn: 115186
2010-09-30 18:30:25 +00:00
Johnny Chen a9a764e65d Fixed 'expr' help message.
llvm-svn: 115185
2010-09-30 18:16:58 +00:00
Greg Clayton eae9cc6dc7 Retry task_for_pid a few times to avoid some cases where task_for_pid fails.
llvm-svn: 115184
2010-09-30 18:10:44 +00:00
Johnny Chen a92bf08038 Test new feature with r115115:
Add "-o" option to "expression" which prints the object description if available.

llvm-svn: 115182
2010-09-30 18:02:47 +00:00
Johnny Chen 92609b52ab Stop using LLDB_CC/LLDB_ARCH in the plugins for test configurations. Use make
friendly CC and ARCH, instead.

llvm-svn: 115169
2010-09-30 17:11:58 +00:00
Johnny Chen cf11e6066b These prints should go to stderr as well. Plus add a global assert string.
llvm-svn: 115167
2010-09-30 17:06:27 +00:00
Johnny Chen 703dbd049a These prints should go to stderr as well. Plus add a global assert string.
llvm-svn: 115166
2010-09-30 17:06:24 +00:00
Johnny Chen 448718a863 Add extra value string to self.expect().
llvm-svn: 115150
2010-09-30 16:00:12 +00:00
Johnny Chen 832d2333a5 Added a utility function to return the counterpart C++ compiler of $(CC) and use
it inside Makefile.rules to return clang++ on clang and llvm-g++ on llvm-gcc.

Removed CPLUSPLUSFLAGS which is simply wrong and CPPFLAGS which is unnecessary.

llvm-svn: 115125
2010-09-30 01:22:34 +00:00
Jim Ingham 6c68fb4549 Add "-o" option to "expression" which prints the object description if available.
llvm-svn: 115115
2010-09-30 00:54:27 +00:00
Johnny Chen eb1db1c547 Verify that we have a valid breakpoint ID before proceeding with retrieving its
number of locations.  This fixed a crasher.

llvm-svn: 115092
2010-09-29 21:57:51 +00:00
Caroline Tice 9068d794fd Fix breakpoint id range testing to disallow ranges that specify breakpoint locations from
crossing major breakpoint boundaries (must be within a single breakpoint if specifying locations).

Add .* as a means of specifying all the breakpoint locations under a major breakpoint, e.g. "3.*"
means "all the breakpoint locations of breakpoint 3".

Fix error message to make more sense, if user attempts to specify a breakpoint command when there
isn't a target yet.

llvm-svn: 115077
2010-09-29 19:42:33 +00:00
Johnny Chen d8ed43cde0 Simple refactoring.
llvm-svn: 115075
2010-09-29 19:36:25 +00:00
Johnny Chen b19cd0fff4 Wrapped the regexp grokking of data type within a try:expect: instead of letting
the Python runtime take over in case there isn't a match.

llvm-svn: 115073
2010-09-29 19:29:42 +00:00
Johnny Chen 2c48dbec96 Added an example 'frame variable' output to demonstrate how the generic_type_tester
groks the data type of the variable.

llvm-svn: 115070
2010-09-29 19:12:10 +00:00
Johnny Chen c0ba019a19 Added @expectedFailure decorators for test suite failures:
# rdar://problem/8493023
    # test/types failures for Test*TypesExpr.py: element offset computed wrong?

llvm-svn: 115065
2010-09-29 19:02:20 +00:00
Johnny Chen cfd405fb42 Turn on generic type tester for expression parser; preparing to file bugs.
llvm-svn: 115063
2010-09-29 18:46:14 +00:00
Caroline Tice bd13b8d5ce Fix various timing/threading problems in IOChannel & Driver that
were causing the prompt to be stomped on, mangled or omitted occasionally.

llvm-svn: 115059
2010-09-29 18:35:42 +00:00
Johnny Chen f3d3d1c743 Removed the two @skip class decorators. The assert failures have been fixed.
llvm-svn: 115055
2010-09-29 18:14:50 +00:00
Johnny Chen 2e566e040a Updated the comment section for running 'expr self->string' and 'expr self->date'.
The failures are similar in nature to the radar already filed:

        # rdar://problem/8492646
        # test/foundation fails after updating to tot r115023
        # self->str displays nothing as output

llvm-svn: 115052
2010-09-29 18:05:03 +00:00
Johnny Chen 8eb3850886 Added two @expectedFailure decorators for test_data_type_and_expr_with_dsym() and
test_data_type_and_expr_with_dwarf().

rdar://problem/8492646
test/foundation fails after updating to tot r115023: self->str displays nothing as output

llvm-svn: 115050
2010-09-29 17:58:12 +00:00
Johnny Chen 620f9d1548 Updated to reflect the updated tot r115023. Will be filing a bug next.
llvm-svn: 115046
2010-09-29 17:50:35 +00:00
Johnny Chen 3801fbdee8 Removed the two @expectedFailure decorators for expression parser, they have been fixed.
Also chnaged the expected string for 'frame variable this' from '(class C *const) this ='
to 'C *const) this =' for the time being, while investigating the different output for
tot r115023.

runCmd: frame variable this
output: (struct C *const) this = 0x0000000100000c2e
llvm-svn: 115042
2010-09-29 17:29:13 +00:00
Greg Clayton 1437224a7c Updated LLVM to: --revision '{2010-09-28T19:30}'
This gets us the new clang::CXXRecordDecl improvments in clang so that when we
add fields, methods and other things to the clang::CXXRecordDecl, the correct
bits are automatically set by clang::CXXRecordDecl itself instead of having 
SEMA and our lldb_private::ClangASTContext functions that create types for
DWARF do it all manually. This allows the clang::ASTContext deep copying of
types to work correctly and it means that the expression parser can now 
evaluate expressions in the context of a class method correctly. Previously
when a class was copied from the DWARF generated ASTContext over into the
expression ASTContext, we were losing CXXRecordDecl bits in the conversion
which caused all classes to think they were at offset zero because the the 
bools for empty, POD, and others would end up being incorrect.

llvm-svn: 115023
2010-09-29 03:44:17 +00:00
Greg Clayton 6d01ad92c7 Fixed an LLVM/Clang assertion that would happen for C++ and ObjC methods if the DWARF doesn't specify the accessibility for the method. Currently gcc 4.2 and clang++ do not set the accessibility correctly on methods. We currently shouldn't default to private since public methods don't have the accessibility specified.
Bottom line: we currently default to public for both C++ and ObjC if the accessibility isn't set.

llvm-svn: 115016
2010-09-29 01:57:37 +00:00
Greg Clayton 1be10fca5f Fixed the forward declaration issue that was present in the DWARF parser after
adding methods to C++ and objective C classes. In order to make methods, we
need the function prototype which means we need the arguments. Parsing these
could cause a circular reference that caused an  assertion.

Added a new typedef for the clang opaque types which are just void pointers:
lldb::clang_type_t. This appears in lldb-types.h.

This was fixed by enabling struct, union, class, and enum types to only get
a forward declaration when we make the clang opaque qual type for these
types. When they need to actually be resolved, lldb_private::Type will call
a new function in the SymbolFile protocol to resolve a clang type when it is
not fully defined (clang::TagDecl::getDefinition() returns NULL). This allows
us to be a lot more lazy when parsing clang types and keeps down the amount
of data that gets parsed into the ASTContext for each module. 

Getting the clang type from a "lldb_private::Type" object now takes a boolean
that indicates if a forward declaration is ok:

    clang_type_t lldb_private::Type::GetClangType (bool forward_decl_is_ok);
    
So function prototypes that define parameters that are "const T&" can now just
parse the forward declaration for type 'T' and we avoid circular references in
the type system.

llvm-svn: 115012
2010-09-29 01:12:09 +00:00
Sean Callanan 58c6273b84 Removed a dreadful hack to get at the name of the
intrinsic being used.  Thanks to Chris Lattner for
pointing out the proper way to do it.

llvm-svn: 115006
2010-09-28 23:55:00 +00:00
Johnny Chen bc84b99f16 Removed the @expectedFailure decorator from test_persistent_variables().
llvm-svn: 115000
2010-09-28 22:47:28 +00:00
Sean Callanan 46ae9e51cc Fixed two bugs in the expression parser:
- the guard variable for the static result
   variable was being mistaken for the actual
   result value, causing IRForTarget to fail

 - LLVM builtins like memcpy were not being
   properly resolved; now they are resolved
   to the corresponding function in the target

llvm-svn: 114990
2010-09-28 21:13:03 +00:00
Johnny Chen 06325d3020 Added TestIntegerTypesExpr.py and TestFloatTypesExpr.py which exercise 'expr'
command on the various basic types, similar to TestIntegerTypes.py and
TestFloatTypes.py, which exercise 'frame variable' on the various basic types.

Right now, they don't employ the self.expect() facility to compare against the
golden output.  They just invoke the self.runCmd() method to run the 'expr'
command.  Decorated the two classes with @unittest2.skip decorators for the time
being.

llvm-svn: 114987
2010-09-28 21:03:58 +00:00
Johnny Chen 7bfa538551 Sanity check the print representations of SBThread, SBFrame, and SBValue.
llvm-svn: 114970
2010-09-28 18:13:04 +00:00
Johnny Chen c0cd18d1f7 Another patch from Jean-Daniel. Thanks.
Error in dbg server -> MachProcess::SetProcessID() and misc changes to make clang++ happy.

llvm-svn: 114962
2010-09-28 16:34:56 +00:00
Johnny Chen d440bccb16 Fix from Jean-Daniel. Thanks.
Error in object runtime language detection code	(spurious '; ')
Also replace false by NULL in a place where the compiler expects a pointer instead of a bool.

llvm-svn: 114957
2010-09-28 16:10:54 +00:00
Jim Ingham a8298d3ba5 Make sure we've read in the ObjC runtime library data before trying to use it...
llvm-svn: 114956
2010-09-28 16:06:31 +00:00
Jim Ingham 5a369128f6 Replace the vestigial Value::GetOpaqueCLangQualType with the more correct Value::GetValueOpaqueClangQualType.
But mostly, move the ObjC Trampoline handling code from the MacOSX dyld plugin to the AppleObjCRuntime classes.

llvm-svn: 114935
2010-09-28 01:25:32 +00:00
Greg Clayton 6adffa27ba Added a DIE to clang opaque type map.
Removed code that shouldn't have been checked in.

llvm-svn: 114932
2010-09-28 01:04:25 +00:00
Sean Callanan 8fd3244af3 Added type lookup, so variables with user-defined types
can be allocated and manipulated.

llvm-svn: 114928
2010-09-27 23:54:58 +00:00
Johnny Chen ecb17ffca1 Trivial assert message modification.
llvm-svn: 114927
2010-09-27 23:53:07 +00:00
Johnny Chen 58aa345df6 Use a better name for the abstract base class which contains the generic_type_tester()
method.  Renamed it to be AbstractBase.py, which contains the GenericTester class that
both IntegerTypesTestCase and FloatTypesTestCase inherit from.

llvm-svn: 114926
2010-09-27 23:46:46 +00:00
Johnny Chen 6316021bae Added "float" and "double" to types/TestBasicTypes.py. Abstracted the generic
type tester method into its own abstarct base class 'AbstractBase'.  And
added TestIntegerTypes.py and TestFloatTypes.py.

Added an option "-p reg-exp-pattern" to the test driver to specify a regular
expression pattern to match against eligible filenames as our test cases.

An example: 

/Volumes/data/lldb/svn/trunk/test $ ./dotest.py -v -p "TestFloat.*" types
----------------------------------------------------------------------
Collected 4 tests

test_double_type_with_dsym (TestFloatTypes.FloatTypesTestCase)
Test that double-type variables are displayed correctly. ... ok
test_double_type_with_dwarf (TestFloatTypes.FloatTypesTestCase)
Test that double-type variables are displayed correctly. ... ok
test_float_type_with_dwarf (TestFloatTypes.FloatTypesTestCase)
Test that float-type variables are displayed correctly. ... ok
test_float_types_with_dsym (TestFloatTypes.FloatTypesTestCase)
Test that float-type variables are displayed correctly. ... ok

----------------------------------------------------------------------
Ran 4 tests in 5.592s

OK

llvm-svn: 114923
2010-09-27 23:29:54 +00:00
Caroline Tice 988efc1ba2 Fix one-liner Python breakpoint commands to be wrapped up in an automatically
generated Python function, and passed the stoppoint context frame and
bp_loc as parameters.

llvm-svn: 114894
2010-09-27 21:35:15 +00:00
Greg Clayton 594e5ed939 Hooked up detach for ProcessGDBRemote.
Remove the GetUserData()/SetUserData() from the DWARFDebugInfoEntry
class. We now track everything with dense maps.

llvm-svn: 114876
2010-09-27 21:07:38 +00:00
Johnny Chen ff745c02ff Modified doc string.
llvm-svn: 114875
2010-09-27 21:04:54 +00:00
Johnny Chen ca54e280d5 Added @expectedFailure decorator for the "long long" and "unsigned long long"
test cases.

llvm-svn: 114872
2010-09-27 20:55:52 +00:00
Johnny Chen e1030cd883 Added "long long" and "unsigned long long" to the TestBasicTypes.py.
Added a special "clean" target to the types/Makefile to clean up all the *.o/.d
files.

The generic_type_tester() method is modified to take a set of atoms, instead of
type string as a required parameter, for example:

o unsigned int => set(['unsigned', 'int'])
o unsigned long long => set(['unsigned', 'long long'])
o long long => set(['long long'])

llvm-svn: 114871
2010-09-27 20:44:46 +00:00
Caroline Tice 18474c933c Automatically wrap *all* Python code entered for a breakpoint command inside
an auto-generated Python function, and pass the stoppoint context frame and
breakpoint location as parameters to the function (named 'frame' and 'bp_loc'),
to be used inside the breakpoint command Python code, if desired.

llvm-svn: 114849
2010-09-27 18:00:20 +00:00
Johnny Chen 23cb3716df Updated test case to "settings set prompt 'lldb2'" since the '-o' option is gone.
Also added "settings set -r prompt" to reset the prompt afterwards.

llvm-svn: 114846
2010-09-27 17:36:59 +00:00
Caroline Tice 0f564dbc8c Change command option "--no_override" to "--no-override" (hypen instead of underscore).
llvm-svn: 114840
2010-09-27 16:58:16 +00:00
Caroline Tice 1559a46b3e Create more useful instance names for target, process and thread instances.
Change default 'set' behavior so that all instance settings for the specified variable will be
updated, unless the "-n" ("--no_override") command options is specified.

llvm-svn: 114808
2010-09-27 00:30:10 +00:00
Greg Clayton 384b0dec68 Bumped Xcode lldb build number to 25 for lldb-25 and debugserver build to
113 for debugserver-113.

llvm-svn: 114777
2010-09-25 00:31:52 +00:00
Greg Clayton 943cdebb63 Added two needed exports.
llvm-svn: 114775
2010-09-24 23:57:12 +00:00
Greg Clayton 5573fde342 Cleaned a few build related things up:
Added a virtual destructor to ClangUtilityFunction with a body to it cleans
itself up.

Moved our SharingPtr into the lldb_private namespace to keep it easy to make
an exports file that exports only what is needed ("lldb::*").

llvm-svn: 114771
2010-09-24 23:07:41 +00:00
Johnny Chen cdf612277a Commented out a debug stmt.
llvm-svn: 114770
2010-09-24 22:57:32 +00:00
Johnny Chen febf65f6fe Added 'char'/'unsigned char'/'short'/'unsigned short' to the test suite.
Extended generic_type_tester() method to take an additional keyword argument
quoteDisplay (default to False) to facilitate comparison with frame variable
display output of character types.

llvm-svn: 114769
2010-09-24 22:54:18 +00:00
Johnny Chen 264d65924b Added comments about the usage of int(string, 0) and long(string, 0) which pass
a base of 0 so that the radix of the string is determined based on the contents
of string.

llvm-svn: 114764
2010-09-24 21:52:37 +00:00
Johnny Chen c01b78e7b2 Added two new .cpp files to be tested via TestBasicTypes.py for correct display
of various combinations of data structures with unsigned int or unsigned long
builtin types.

llvm-svn: 114756
2010-09-24 20:41:17 +00:00
Johnny Chen 61464fa6e7 Made 'frame variable' printing of unsigned types more readable, like gdb.
llvm-svn: 114739
2010-09-24 17:33:29 +00:00
Greg Clayton 0fffff5816 Added the ability to create an objective C method for an objective C
interface in ClangASTContext. Also added two bool returning functions that
indicated if an opaque clang qual type is a CXX class type, and if it is an
ObjC class type.

Objective C classes now will get their methods added lazily as they are
encountered. The reason for this is currently, unlike C++, the 
DW_TAG_structure_type and owns the ivars, doesn't not also contain the
member functions. This means when we parse the objective C class interface
we either need to find all functions whose names start with "+[CLASS_NAME"
or "-[CLASS_NAME" and add them all to the class, or when we parse each objective
C function, we slowly add it to the class interface definition. Since objective
C's class doesn't change internal bits according to whether it has certain types
of member functions (like C++ does if it has virtual functions, or if it has
user ctors/dtors), I currently chose to lazily populate the class when each
functions is parsed. Another issue we run into with ObjC method declarations
is the "self" and "_cmd" implicit args are not marked as artificial in the
DWARF (DW_AT_artifical), so we currently have to look for the parameters by
name if we are trying to omit artificial function args if the language of the
compile unit is ObjC or ObjC++.

llvm-svn: 114722
2010-09-24 05:15:53 +00:00
Johnny Chen b052f6c595 Added a generic_type_tester() to the TestBasicTypes class to be used for
testing various combinations of displaying variales of basic types.

The generic_type_tester() works by first capturing the golden output produced
by the printf stmts of ./a.out, creating a list of (var, value) pairs, and then
running the a.out to a stop point, and comparing the 'frame variable var' output
against the list of (var, value) pairs.

Modified int_type() and added long_type() to use generic_type_tester().

Also modified TestBase.expect() such that substring matching also return ok if
the substring starts at the 0-th position.

llvm-svn: 114708
2010-09-23 23:35:28 +00:00
Jim Ingham e4284b719c Add GetSP to the StackFrame.
llvm-svn: 114674
2010-09-23 17:40:12 +00:00
Johnny Chen 820b4c5153 Fixed a typo in member name; should be m_b, not b_a.
llvm-svn: 114660
2010-09-23 16:49:40 +00:00
Johnny Chen 99052de1de Changed 'frame variable' output to match '(const char *)' instead of '(char const *)'.
llvm-svn: 114652
2010-09-23 16:04:46 +00:00
Johnny Chen 0a241de067 Changed 'frame variable' output to match '(const char *)' instead of '(char const *)'.
llvm-svn: 114649
2010-09-23 15:57:32 +00:00
Sean Callanan e2ef6e380b Updated to latest LLVM. Major LLVM changes:
- Sema is now exported (and there was much rejoicing.)

 - Storage classes are now centrally defined.

Also fixed some bugs that the new LLVM picked up.

llvm-svn: 114622
2010-09-23 03:01:22 +00:00
Jim Ingham 2277701c7b Committing the skeleton of Language runtime plugin classes.
llvm-svn: 114620
2010-09-23 02:01:19 +00:00
Greg Clayton a51ed9bb49 Added motheds to C++ classes as we parse them to keep clang happy.
llvm-svn: 114616
2010-09-23 01:09:21 +00:00
Caroline Tice dac97f31a3 Remove all the __repr__ methods from the API/*.h files, and put them
into python-extensions.swig, which gets included into lldb.swig, and
adds them back into the classes when swig generates it's C++ file.  This
keeps the Python stuff out of the general API classes.

Also fixed a small bug in the copy constructor for SBSymbolContext.

llvm-svn: 114602
2010-09-22 23:01:29 +00:00
Johnny Chen c70b02a324 Checked in an initial template for the types directory. Right now, it doesn't
actually test-and-compare anything yet.  The lldbtest.TestBase has an added
method setTearDownCleanup(dictionary=None) to facilitate running the cleanup
right after each data type test is run.  The test case can pass a dictionary
object when registering the test case cleanup.

There is currently only int_type test in the repository.

llvm-svn: 114600
2010-09-22 23:00:20 +00:00
Johnny Chen 6594b8cc9b Changed to facilitate 'breakpoint set -n Puts', then 'thread step-out' to workaround
rdar://problem/8464339 test/types directory: b basic_type.cpp:171 does not work, while gdb does work.

llvm-svn: 114557
2010-09-22 17:46:07 +00:00
Caroline Tice 7740412f2b Remove SBCommandContext which was not needed or doing anything.
Add SBValueList.h & SBStream.h to build-swig-Python.sh; add SBValueList.h to lldb.swig

llvm-svn: 114549
2010-09-22 16:41:52 +00:00
Jason Molenda 0c7cc85649 Add a new ArchVolatileRegs plugin class to identify
whether a given register number is treated as volatile
or not for a given architecture/platform.

approx 450 lines of boilerplate, 50 lines of actual code. :)

llvm-svn: 114537
2010-09-22 07:37:07 +00:00
Greg Clayton a4ddf7f802 Added the start of a test case that will test all basic types and all the
variety of ways they can be displayed in variable views.

llvm-svn: 114530
2010-09-22 04:50:38 +00:00
Greg Clayton 4f432e719b Added some comments explaining why we currently have to manually set CXXRecordDecl variables. This is because SEMA is actually calling the accessors that should be built into the CXXRecordDecl class. We have an internal bug tracking this change and will remove the affected work around code when a solution is available.
llvm-svn: 114516
2010-09-22 00:40:49 +00:00
Sean Callanan c31ba26e0c Improved the logging for ASTs generated on the
expression parser's behalf so that now we see the
full TranslationUnitDecl instead of just the
FunctionDecl.

llvm-svn: 114514
2010-09-22 00:33:31 +00:00
Johnny Chen 9bb7dade7b Sanity check the print representation of lldb.SBProcess object.
llvm-svn: 114513
2010-09-22 00:25:33 +00:00
Greg Clayton 60e1aa56f7 Fixed CXXRecordDecl declaration settings for whether a class in a POD type
or not.

llvm-svn: 114512
2010-09-22 00:24:45 +00:00
Greg Clayton d7aa114ecc Fixed a build warning where no return values was being returned.
llvm-svn: 114511
2010-09-22 00:23:59 +00:00
Johnny Chen d64c3e7913 Trivial change of a trace output string.
llvm-svn: 114505
2010-09-21 23:47:01 +00:00
Johnny Chen 9c48b8d79c Added a subtest to exercise the capability of lldb Python objects to print
themselves.  Right now, it tests a breakpoint both before and after it has been
resolved.

Updated lldbtest.TestBase.expect() with an additional keyword argument 'exe' (
default to True), which if set to False, will treat the mandatory first argument
as just the string to be matched/or not-matched against the golden input.

llvm-svn: 114501
2010-09-21 23:33:30 +00:00
Caroline Tice 867b185d8d Update help text for breakpoint command one-liners.
Fix minor bug in 'commands alias'; alias commands can now handle command options 
and arguments in the same alias.  Also fixes problem that disallowed "process launch --" as
an alias.

Fix typo in comment in Python script interpreter.

llvm-svn: 114499
2010-09-21 23:25:40 +00:00
Johnny Chen 90312a8492 Wrapped the subclass-specific cleanup call within a try:except: clause.
And removed the informational output from the conditional_break test case.

llvm-svn: 114493
2010-09-21 22:34:45 +00:00
Greg Clayton 9e826e3292 Fixed an issue with the clang type creation code for C++ classes where we wouldn't set a CXXRecordDecl to be NOT empty if we had base classes that were not empty or had virtual functions.
llvm-svn: 114484
2010-09-21 21:22:23 +00:00
Johnny Chen ea88e94318 Added a more complex test case of breakpoint commands, which executes a sequence
of 'breakpoint command add/list/remove' commands to set breakpoint callbacks,
list them, and then remove one.

Modified the lldbtest.TestBase.expect() method to add two additional keyword
arguments:

o matching (default to True), which, if set to False, reverses the semantics of
  'expect' to 'expect not'

o patterns (default to None), which specifies a list of regexp patterns to match
  against the output from running the command

TestBreakpointCommand.py uses the matching=False and the patterns=[...] expect()
API.

llvm-svn: 114480
2010-09-21 21:08:53 +00:00