Commit Graph

1491 Commits

Author SHA1 Message Date
Jim Ingham 0d8bcc79f4 Added an "Interrupted" bit to the ProcessEventData. Halt now generates an event
with the Interrupted bit set.  Process::HandlePrivateEvent ignores Interrupted events.
DoHalt is changed to ensure that the stop even is processed, and an event with
the Interrupted event is posted.  Finally ClangFunction is rationalized to use this
facility so the that Halt is handled more deterministically.

llvm-svn: 119453
2010-11-17 02:32:00 +00:00
Johnny Chen 80e6db9c79 Make the string matching for 'frame variable' more stringent with respect to
output from clang and llvm-gcc compiled program; both generate the correct debug
info with respect to the typedef scoped inside a namespace.

Add a TestBase.getCompiler(self) method which returns the compiler in effect the
test suite is now running with.  Subclasses (like TestNamespace) can use it to
distinguish among different compilers.

llvm-svn: 119445
2010-11-17 00:52:41 +00:00
Johnny Chen ecb072d840 Add an option '-# count' to run the specified test suite for a said number of times.
This is not to be used during normal test suite run, but to be used to stress test
specific test sequences repeatedly.

Example:

./dotest.py -# 3 -v breakpoint_conditions

will repeat the test suite 3 times for tests under the breakpoint_conditions directory.

llvm-svn: 119399
2010-11-16 22:42:58 +00:00
Greg Clayton 47fbf1aecb Use different qualifier enums on the request of a clang engineer.
llvm-svn: 119396
2010-11-16 22:09:25 +00:00
Johnny Chen 43b3bad58b Initial check-in of a Python utility to run the lldb test suite and send the
result including the session logs of test failures/errors as a MIME message.

llvm-svn: 119371
2010-11-16 19:44:50 +00:00
Johnny Chen 7826b0a721 Disambiguate the name lookup for the data type of anon_uint variable.
llvm-svn: 119353
2010-11-16 18:11:55 +00:00
Caroline Tice ef5c6d02f5 Make processes use InputReaders for their input. Move the process
ReadThread stuff into the main Process class (out of the Process Plugins).
This has the (intended) side effect of disabling the command line tool
from reading input/commands while the process is running (the input is
directed to the running process rather than to the command interpreter).

llvm-svn: 119329
2010-11-16 05:07:41 +00:00
Jason Molenda 5920333be1 Add an UnwindPlan Row for the last instruction of a function when
we're using the stack pointer to define the CFA again.  Makes unwinds
while sitting at the 'ret' instruction work, assuming we have accurate
function address bounds.

llvm-svn: 119327
2010-11-16 03:01:20 +00:00
Greg Clayton 7fedea2c6f First attempt and getting "const" C++ method function signatures correct.
It currently isn't working, but it should be close. I will work on this more
when I figure out what I am not doing correctly.

llvm-svn: 119324
2010-11-16 02:10:54 +00:00
Johnny Chen 13e64a7411 Check in a test case for rdar://problem/8668740:
'frame variable' output for namespace variables look wrong

llvm-svn: 119172
2010-11-15 19:10:53 +00:00
Johnny Chen 8ed80e6360 Add radar info for failed expression command test sequences which are now commented out.
llvm-svn: 119171
2010-11-15 18:49:03 +00:00
Johnny Chen 913af510c7 Also add a test for "frame variable '(anonymous namespace)::i'",
plus expression command using fully qualified names.

llvm-svn: 119168
2010-11-15 18:40:06 +00:00
Johnny Chen 6ba9d1f944 Add test sequences for 'frame variable' address-of operator and 'frame variable' fully-qualified name variable.
Also add some comments.

llvm-svn: 119165
2010-11-15 18:27:57 +00:00
Johnny Chen 92dac7ae1b Add test sequence for 'frame variable this' and 'expression this' when stopped
inside a ctor.

llvm-svn: 119162
2010-11-15 18:04:54 +00:00
Johnny Chen deac523f7c Remove the @expectedFailure decorator and uncomment 'expression -- i + j" test,
as both rdar://problem/8659840 and rdar://problem/8660275 have been fixed.

llvm-svn: 119160
2010-11-15 17:42:22 +00:00
Greg Clayton cb7e3b3505 Added quotes around names that are being lookup up or inspected in the
expression logging.

Added some properties to the "objc" test. The expression parser can currently
display properties that are backed by the default functions "expr myStr.string"
will work. But it won't currently work when the property is backed by a 
different function such as "expr myStr.date".

llvm-svn: 119103
2010-11-15 01:47:11 +00:00
Greg Clayton 471da24dfa Added recursive name lookup logging with depth which is commented out and is currently only enabled when we blow the stack.
llvm-svn: 119101
2010-11-15 01:34:18 +00:00
Greg Clayton ce5c9a8f31 Added the address of operator for the "frame variable" command.
llvm-svn: 119100
2010-11-15 01:32:26 +00:00
Greg Clayton 5a2c6d583d Fixed the initWithNSString: function to properly initialize self.
llvm-svn: 119091
2010-11-14 23:12:29 +00:00
Greg Clayton 83c5cd9dfd Just like functions can have a basename and a mangled/demangled name, variable
can too. So now the lldb_private::Variable class has support for this.

Variables now have support for having a basename ("i"), and a mangled name 
("_ZN12_GLOBAL__N_11iE"), and a demangled name ("(anonymous namespace)::i").

Nowwhen searching for a variable by name, users might enter the fully qualified
name, or just the basename. So new test functions were added to the Variable 
and Mangled classes as:

	bool NameMatches (const ConstString &name);
	bool NameMatches (const RegularExpression &regex);

I also modified "ClangExpressionDeclMap::FindVariableInScope" to also search
for global variables that are not in the current file scope by first starting
with the current module, then moving on to all modules.

Fixed an issue in the DWARF parser that could cause a varaible to get parsed
more than once. Now, once we have parsed a VariableSP for a DIE, we cache
the result even if a variable wasn't made so we don't do any re-parsing. Some
DW_TAG_variable DIEs don't have locations, or are missing vital info that 
stops a debugger from being able to display anything for it, we parse a NULL
variable shared pointer for these DIEs so we don't keep trying to reparse it.

llvm-svn: 119085
2010-11-14 22:13:40 +00:00
Greg Clayton 32d2a48369 Fixed an issue where we were trying to resolve lldb_private::Type encoding
types to their full definitions more than we needed to. This caused an assertion
in the DWARF parser to fire -- which is an indication that we are parsing too much.

llvm-svn: 119020
2010-11-14 01:03:55 +00:00
Greg Clayton d7e054694e Fixed a crasher (an assert was firing in the DWARF parser) when setting
breakpoints on inlined functions by name. This involved fixing the DWARF parser
to correctly back up and parse the concrete function when we find inlined
functions by name, then grabbing any appropriate inlined blocks and returning
symbol contexts with the block filled in. After this was fixed, the breakpoint
by name resolver needed to correctly deal with symbol contexts that had the
inlined block filled in in the symbol contexts.

llvm-svn: 119017
2010-11-14 00:22:48 +00:00
Greg Clayton ba2d22d8ee Fixed an issue where we might not find global variables by name when we have
a debug map with DWARF in the .o files due to the attemted shortcut that was
being taken where the global variables were being searched for by looking in
the symbol table. The problem with the symbols in the symbol table is we don't
break apart the symbol names for symbols when they are mangled into basename
and the fully mangled name since this would take a lot of CPU time to chop up
the mangled names and try and find the basenames. The DWARF info typically has
this broken up for us where the basename of the variable is in a the DW_AT_name
attribute, and the mangled name is in the DW_AT_MIPS_linkage_name attribute.
Now we correctly find globals by searching all OSO's for the information so we
can take advantage of this split information. 

llvm-svn: 119012
2010-11-13 22:57:37 +00:00
Greg Clayton 580c5dacd0 Got namespace lookup working and was able to print a complex "this" as an
expression. This currently takes waaaayyyyy too much time to evaluate. We will
need to look at the expression parser and find ways to optimize the info we
provide and get this to evaluate quicker. I believe the performance issue is
currently related to us always providing a complete C++ class type when asked
about a C++ class which can cause a lot of information to be pulled since all
classes will be fully created (methods, base classes, members, all their 
types). We will need to give the classes back the parser and mark them as 
having external sources and get parser (Sema) to query us when it needs more
info. This should bring things up to an acceptable level.

llvm-svn: 118979
2010-11-13 04:18:24 +00:00
Greg Clayton 526e5afb2d Modified the lldb_private::Type clang type resolving code to handle three
cases when getting the clang type:
- need only a forward declaration
- need a clang type that can be used for layout (members and args/return types)
- need a full clang type

This allows us to partially parse the clang types and be as lazy as possible.
The first case is when we just need to declare a type and we will complete it
later. The forward declaration happens only for class/union/structs and enums.
The layout type allows us to resolve the full clang type _except_ if we have
any modifiers on a pointer or reference (both R and L value). In this case
when we are adding members or function args or return types, we only need to
know how the type will be laid out and we can defer completing the pointee
type until we later need it. The last type means we need a full definition for
the clang type.

Did some renaming of some enumerations to get rid of the old "DC" prefix (which
stands for DebugCore which is no longer around).

Modified the clang namespace support to be almost ready to be fed to the
expression parser. I made a new ClangNamespaceDecl class that can carry around
the AST and the namespace decl so we can copy it into the expression AST. I
modified the symbol vendor and symbol file plug-ins to use this new class.

llvm-svn: 118976
2010-11-13 03:52:47 +00:00
Johnny Chen 27e50be528 Implement TODO's of using expression command to set vaiables and to verify that
they are displayed correctly.

llvm-svn: 118930
2010-11-12 21:50:28 +00:00
Jason Molenda cabd1b71c7 I'm not thrilled with how I structured this but RegisterContextLLDB
needs to use the current pc and current offset in two ways:  To 
determine which function we are currently executing, and the decide
how much of that function has executed so far.  For the former use,
we need to back up the saved pc value by one byte if we're going to
use the correct function's unwind information -- we may be executing
a CALL instruction at the end of a function and the following instruction
belongs to a new function, or we may be looking at unwind information
which only covers the call instruction and not the subsequent instruction.

But when we're talking about deciding which row of an UnwindPlan to
execute, we want to use the actual byte offset in the function, not the
byte offset - 1.

Right now RegisterContextLLDB is tracking both the "real" offset and
an "offset minus one" and different parts of the class have to know 
which one to use and they need to be updated/set in tandem.  I want
to revisit this at some point.

The second change made in looking up eh_frame information; it was
formerly done by looking for the start address of the function we
are currently executing.  But it is possible to have unwind information
for a function which only covers a small section of the function's
address range.  In which case looking up by the start pc value may not
find the eh_frame FDE.

The hand-written _sigtramp() unwind info on Mac OS X, which covers
exactly one instruction in the middle of the function, happens to
trigger both of these issues.

I still need to get the UnwindPlan runner to handle arbitrary dwarf
expressions in the FDE but there's a good chance it will be easy to
reuse the DWARFExpression class to do this.

llvm-svn: 118882
2010-11-12 05:23:10 +00:00
Sean Callanan 8c9e538384 Added a thread plan tracer that prints lines of
assembly as well as registers that changed.

llvm-svn: 118879
2010-11-12 03:22:21 +00:00
Greg Clayton 0dd2c6277a Fixed more thread suspend/resume issues.
llvm-svn: 118877
2010-11-12 02:37:39 +00:00
Jim Ingham 929937286b Added OnStart and OnEnd methods to the tracer.
llvm-svn: 118876
2010-11-12 02:30:38 +00:00
Sean Callanan c126acc1a9 Temporary extension of the timeout for Objective-C
object diagnostic expressions while we work on the
logic for handling the timeout.

llvm-svn: 118873
2010-11-12 01:49:03 +00:00
Sean Callanan 6f86aa630f Removed redundant code for object introspection.
llvm-svn: 118872
2010-11-12 01:41:35 +00:00
Sean Callanan 36695cdecd Excised a version of the low-level function calling
logic that supported calling functions with arbitrary
arguments.  We use ClangFunction for this, and the
low-level logic is only required to support one or two
pointer arguments.

llvm-svn: 118871
2010-11-12 01:37:02 +00:00
Johnny Chen 6df2cd3fbf Add information for two bugs exposed by this test file.
llvm-svn: 118869
2010-11-12 01:00:56 +00:00
Johnny Chen 99ff489086 Run commands 'expression self->str' and 'expression self->date'.
They should not fail.

llvm-svn: 118868
2010-11-12 00:55:31 +00:00
Johnny Chen 064d7f5e4e Fix the @expectedFailure usage error and add a commented out section of code to
exercise 'expression' command on namespaced variables.

llvm-svn: 118867
2010-11-12 00:50:45 +00:00
Greg Clayton 1b946bf636 Fixed an issue with the MachThread class where we might not get the initial
thread basic info state and not realize that a thread was already suspended
or if a thread was starting up and not ready to be displayed to the user
(in an uninterruptable state). If it is not user ready yet, we don't add it
to our list of threads that can be played with.

llvm-svn: 118866
2010-11-12 00:49:23 +00:00
Johnny Chen 1e57493196 Add @expectedFailure decorator for test_with_dwarf_and_run_command() test method:
rdar://problem/8659840
    test failure: ./dotest.py -v -t -f NamespaceTestCase.test_with_dwarf_and_run_command

llvm-svn: 118861
2010-11-12 00:00:15 +00:00
Johnny Chen 285371e32a The session log entry containing the command to rerun the same test now also includes
the architecture and compiler specs.

llvm-svn: 118860
2010-11-11 23:54:12 +00:00
Johnny Chen 3d57ee7b43 Add TestNamespace.py to exercise printing of anonymous and named namespace variables.
llvm-svn: 118856
2010-11-11 23:29:54 +00:00
Johnny Chen 667429d6b1 Simplify Makefile.
llvm-svn: 118851
2010-11-11 22:58:37 +00:00
Johnny Chen 5f98696f51 Add help message for the scenario of using lldb.py module distributed by Xcode4
to invoke the test driver.

llvm-svn: 118847
2010-11-11 22:14:56 +00:00
Johnny Chen cdab9f1933 Make clang happy.
llvm-svn: 118839
2010-11-11 21:22:12 +00:00
Johnny Chen c043de11e8 Fixed compilation warnings emitted by clang.
Plus make finding the break line number in main.cpp more robust.

llvm-svn: 118832
2010-11-11 20:18:36 +00:00
Greg Clayton c3b849970d Fixed an issue with Function::GetPrologueByteSize() where if a function's first line table entry didn't have the same address as the start address of the function itself, we could end up returning and incorrect value.
llvm-svn: 118830
2010-11-11 20:13:30 +00:00
Jim Ingham 06e827cc43 Add ThreadPlanTracer class to allow instruction step tracing of execution.
Also changed eSetVarTypeBool to eSetVarTypeBoolean to make it consistent with eArgTypeBoolean.

llvm-svn: 118824
2010-11-11 19:26:09 +00:00
Johnny Chen 07f06c4e96 Added a simple test for:
rdar://problem/8651752
    don't crash trying to ask clang how many children an empty record has

llvm-svn: 118820
2010-11-11 19:15:04 +00:00
Greg Clayton 6ed689bfcb Bumped Xcode versions to lldb-32 and debugserver-119.
llvm-svn: 118772
2010-11-11 02:22:58 +00:00
Greg Clayton a63012e9bf Fixed an issue where we might not be able to track down a real definition of
a forward declaration to a struct and hangle it gracefully (don't crash
trying to ask clang how many children an empty record has).

llvm-svn: 118770
2010-11-11 02:14:53 +00:00
Greg Clayton 62742b1402 Disable the debug logging I accidentally left enabled.
llvm-svn: 118758
2010-11-11 01:09:45 +00:00
Johnny Chen 5d6c464f46 Some rewordings of the assert messages for process stopped due to breakpoint.
llvm-svn: 118739
2010-11-10 23:46:38 +00:00
Greg Clayton 96d7d7453c Added initial support to the lldb_private::SymbolFile for finding
namespaces by name given an optional symbol context. I might end up
dressing up the "clang::NamespaceDecl" into a lldb_private::Namespace
class if we need to do more than is currenlty required of namespaces.
Currently we only need to be able to lookup a namespace by name when
parsing expressions, so I kept it simple for now. The idea here is
even though we are passing around a "clang::NamespaceDecl *", that
we always have it be an opaque pointer (it is forward declared inside
of "lldb/Core/ClangForward.h") and we only use clang::NamespaceDecl
implementations inside of ClangASTContext, or ClangASTType when we need
to extract information from the namespace decl object.

llvm-svn: 118737
2010-11-10 23:42:09 +00:00
Johnny Chen 378ed7f3e7 Slight changes to how to phrase the assert for Python API thread.GetStopReason().
llvm-svn: 118731
2010-11-10 23:14:41 +00:00
Johnny Chen e9ad7fecf0 Finish adding the actual stop reason as part of the assert message when asserting:
thread.GetStopReason() == lldb.eStopReasonBreakpoint

llvm-svn: 118713
2010-11-10 20:30:37 +00:00
Johnny Chen de0338bac9 Add the actual stop reason to an assert message for bitfields_variable_python()
test method when asserting:

    thread.GetStopReason() == lldb.eStopReasonBreakpoint

llvm-svn: 118711
2010-11-10 20:20:06 +00:00
Benjamin Kramer 2c88643a22 Silence a bunch of clang warnings.
llvm-svn: 118710
2010-11-10 20:16:47 +00:00
Greg Clayton cf7e9a0485 Don't keep appending to the current crash description with each formatted crash description call.
llvm-svn: 118703
2010-11-10 19:43:40 +00:00
Caroline Tice 5c2816d903 Move the embedded Python interpreter onto a separate thread, to prevent
main thread from having to wait on it (which was causing some I/O 
hangs).

llvm-svn: 118700
2010-11-10 19:18:14 +00:00
Johnny Chen fec456da47 Trivial fix for an error message.
llvm-svn: 118697
2010-11-10 19:02:11 +00:00
Johnny Chen b1a06f3fff Remove @skip decorator:
@unittest2.skip("rdar://problem/8648070 'expression *bar_ptr' seg faults")

It has been fixed by r118672.

llvm-svn: 118695
2010-11-10 18:25:18 +00:00
Jim Ingham 08feef8861 Remove an obsolete reference to immediate plans.
llvm-svn: 118691
2010-11-10 18:17:03 +00:00
Greg Clayton 2d95dc9b22 Modified lldb_private::SymboleFile to be able to override where its TypeList
comes from by using a virtual function to provide it from the Module's
SymbolVendor by default. This allows the DWARF parser, when being used to
parse DWARF in .o files with a parent DWARF + debug map parser, to get its
type list from the DWARF + debug map parser so when we go and find full 
definitions for types (that might come from other .o files), we can use the
type list from the debug map parser. Otherwise we ended up mixing clang types
from one .o file (say a const pointer to a forward declaration "class A") with
the a full type from another .o file. This causes expression parsing, when 
copying the clang types from those parsed by the DWARF parser into the 
expression AST, to fail -- for good reason. Now all types are created in the
same list.

Also added host support for crash description strings that can be set before
doing a piece of work. On MacOSX, this ties in with CrashReporter support
that allows a string to be dispalyed when the app crashes and allows 
LLDB.framework to print a description string in the crash log. Right now this
is hookup up the the CommandInterpreter::HandleCommand() where each command
notes that it is about to be executed, so if we crash while trying to do this
command, we should be able to see the command that caused LLDB to exit. For
all other platforms, this is a nop.

llvm-svn: 118672
2010-11-10 04:57:04 +00:00
Sean Callanan b1620224e6 Fixed a bug where the LLVM disassembler was
ignoring the show_address parameter.

llvm-svn: 118666
2010-11-10 01:38:28 +00:00
Johnny Chen cc78b0b67f Add more comments on LLDBTestResult class.
llvm-svn: 118655
2010-11-09 23:56:14 +00:00
Greg Clayton 7a34528d68 Did a lot of code cleanup.
Fixed the DWARF plug-in such that when it gets all attributes for a DIE, that
it omits the DW_AT_sibling and DW_AT_declaration when getting attributes
from a DW_AT_abstract_origin or DW_AT_specification DIE.

llvm-svn: 118654
2010-11-09 23:46:37 +00:00
Johnny Chen bb4f8e6f7b Rephrase the output message about session information; make it both "session logs".
llvm-svn: 118650
2010-11-09 23:42:00 +00:00
Johnny Chen 07569be70c When dumping the session log for a failed/errored test, also emit the command to
invoke the test driver to rerun the very same test.  Example output:

/Volumes/data/lldb/svn/trunk/test $ tail 2010-11-09-14_51_34/ExpectedFailure-TestSettings.SettingsCommandTestCase.test_set_output_path.log 

Traceback (most recent call last):
  File "/Volumes/data/lldb/svn/trunk/test/settings/TestSettings.py", line 136, in test_set_output_path
    "'stdout.txt' exists due to target.process.output-path.")
AssertionError: False is not True : 'stdout.txt' exists due to target.process.output-path.


To rerun this test, issue the following command from the 'test' directory:

./dotest.py -v -t -f SettingsCommandTestCase.test_set_output_path

llvm-svn: 118646
2010-11-09 22:56:12 +00:00
Sean Callanan 0617fcb1f1 Added a named container for the source QualType
in the type copy routine to make type problems
easier to debug.

llvm-svn: 118638
2010-11-09 22:37:10 +00:00
Johnny Chen 021d0e3173 Remove the @skip decorator for the whole class:
@unittest2.skip("rdar://problem/8641483 ./dotest.py -v -t -w forward seg faults")

and add a @skip decorator for test_with_dwarf_and_run_command() method:

    @unittest2.skip("rdar://problem/8648070 'expression *bar_ptr' seg faults")

llvm-svn: 118632
2010-11-09 21:14:23 +00:00
Johnny Chen 94ce9711c1 We should make the class name of test cases which emphasize expression command
be different than the class name which uses frame variable command.

llvm-svn: 118602
2010-11-09 18:49:57 +00:00
Johnny Chen c0c67f275d Distinguish between the assert messages for runCmd and expect. The former now
takes the form:

    "Command '%s' returns successfully" % str

and the latter takes the form:

    "'%s' returns expected result" % str
    or
    "'%s' matches expected result" % str

llvm-svn: 118599
2010-11-09 18:42:22 +00:00
Johnny Chen 27eb0bf281 Move the persistent_variables directory under expression_command directory.
llvm-svn: 118591
2010-11-09 17:57:37 +00:00
Johnny Chen 22c3f3028d Add a test for expression parser crash which has been fixed.
llvm-svn: 118590
2010-11-09 17:51:11 +00:00
Johnny Chen 98d9c79e7d Make the specification of relative directory more robust.
llvm-svn: 118511
2010-11-09 17:09:20 +00:00
Greg Clayton 1ac093b9ea Bumped versions in Xcode projects to lldb-31 and debugserver-118.
llvm-svn: 118489
2010-11-09 04:43:39 +00:00
Greg Clayton c615ce4964 Fixed an issue in the DWARF parser that was causing forward declarations
to not get resolved.

Fixed the "void **isa_ptr" variable inside the objective C verifier to start
with a '$' character so we don't go looking for it in our program.

Moved the lookup for "$__lldb_class" into the part that knows we are looking
for internal types that start with a '$'.

llvm-svn: 118488
2010-11-09 04:42:43 +00:00
Jason Molenda b4f65501fc Implement RegisterContext::WriteRegisterBytes in RegisterContextLLDB.
I only did a tiny bit of testing; in the one case I tried changing the
contents of a radar in the middle of a stack and it was still current in
the live register context so it filtered down to frame 0 and was handed
over to the live register set RegisterContext.  I need to test a case
where a register is saved on the stack in memory before I check this
one off.

llvm-svn: 118486
2010-11-09 04:31:16 +00:00
Jason Molenda 8fed295cee Refactor UnwindLLDB so it doesn't populate the entire stack unless
the frame count is requested or each frame is individually requested.

In practice this doesn't seem to help anything because we have
functions like StackFrameList::GetNumFrames() which is going to
request each frame anyway.  And classes like ThreadPlanStepRange
and ThreadPlanStepOverRange get the stack depth in their ctor forcing
a full stack walk.  But at least UnwindLLDB will delay doing a full
walk if it can.

llvm-svn: 118477
2010-11-09 02:31:21 +00:00
Jason Molenda 45b4924550 Fix thinko in UnwindTable.cpp where it wouldn't provde a
FuncUnwinders object if the eh_frame section was missing
from an objfile.  Worked fine on x86_64 but on i386 where
eh_frame is unusual, that resulted in the arch default 
UnwindPlan being used all the time instead of picking up
an assembly profile based unwindplan.

llvm-svn: 118467
2010-11-09 01:21:22 +00:00
Johnny Chen 31f29e98bf Add keyboard shortcuts:
'run'          => Control-C r (gud-run)            "Run the program."
'process kill' => Control-C s (gud-stop-subjoball) "Stop the program."

llvm-svn: 118460
2010-11-09 00:24:51 +00:00
Johnny Chen 99adaf4cc1 Minor comment fix.
llvm-svn: 118450
2010-11-08 22:08:21 +00:00
Johnny Chen 27f391be61 Better wording of the help text for the '-f testclass.testmethod' option usage.
llvm-svn: 118438
2010-11-08 20:17:04 +00:00
Johnny Chen c06f422d73 Let's also emit the informational message for where to find the session logs for
failed/errored tests at the start of the test run, in case the test run crashes
for any reason.  That way, it is easy to locate the session logs for accumulated
failures/errors.

llvm-svn: 118427
2010-11-08 19:03:37 +00:00
Johnny Chen 2ddfebd9af Skipped due to rdar://problem/8641483 ./dotest.py -v -t -w forward seg faults.
llvm-svn: 118415
2010-11-08 16:53:27 +00:00
Greg Clayton a78ff2ef32 Cleaned up the pseudo terminal code in ProcessGDBRemote as it was spawning
a pseudo terminal even when the process being attached to. 

Fixed a possible crasher in the in:

    bool
    ClangASTContext::IsAggregateType (clang_type_t clang_type);
    
It seems that if you pass in a record decl, enum decl, or objc class decl
and ask it if it is an aggregate type, clang will crash. 

llvm-svn: 118404
2010-11-08 04:29:11 +00:00
Sean Callanan ece9649264 Added more logging so we see the register state
when a function starts and ends, and also the 
disassembly for anything that is a client of
ClangExpressionParser after it has been JIT
compiled.

llvm-svn: 118401
2010-11-08 03:49:50 +00:00
Greg Clayton 21184644af Fixed an issue where if you try and run something in a TTY that isn't
the same architecture as a default program, the attach architecture auto
detection would change the architecture to the architecture of the darwin-debug
(which was always x86_64) and hose up your debug session.

llvm-svn: 118399
2010-11-08 03:06:10 +00:00
Greg Clayton 40328bf5f3 Fixed some type parsing that was causing types to thing they were forward
declarations when they should have been.

llvm-svn: 118393
2010-11-08 02:05:08 +00:00
Johnny Chen fa491601b5 Change the test driver so that simply specifying '-f testclass.testmethod' means that
we want to run just the instance of testclass-testmethod combination and nothing else.

Specifying '-g' now will admit the whole .py test module if it does not contain a matching
testclass-testmethod combination at all.

This option arrangement adheres to the RISC principle of making the common cases fast. :-)

rdar://problem/8584914 Can the default for dotest.py's "-g" flag be switched?

llvm-svn: 118392
2010-11-08 01:21:03 +00:00
Sean Callanan a4e55178bc Made variable resolution more robust by handling
every external variable reference in the module,
and returning a clean error (instead of letting
LLVM issue a fatal error) if the variable could
not be resolved.

llvm-svn: 118388
2010-11-08 00:31:32 +00:00
Greg Clayton 7481c20f09 Fixed FileSpec's operator == to deal with equivalent paths such as "/tmp/a.c"
and "/private/tmp/a.c". This was done by adding a "mutable bool m_is_resolved;"
member to FileSpec and then modifying the equal operator to check if the
filenames are equal, and if they are, then check the directories. If they are
not equal, then both paths are checked to see if they have been resolved. If
they have been resolved, we resolve the paths in temporary FileSpec objects
and set each of the m_is_resolved bools to try (for lhs and rhs) if the paths
match what is contained in the path. This allows us to do more intelligent
compares without having to resolve all paths found in the debug info (which
can quickly get costly if the files are on remote NFS mounts).

llvm-svn: 118387
2010-11-08 00:28:40 +00:00
Greg Clayton 2ccf8cfc4b Modified the DWARF parser for both the single DWARF file and for the case
where the DWARF is in the .o files so they can track down the actual type for
a forward declaration. This was working before for just DWARF files, but not
for DWARF in .o files where the actual definition was in another .o file.

Modified the main thread name in the driver to be more consistent with the
other LLDB thread names.

llvm-svn: 118383
2010-11-07 21:02:03 +00:00
Greg Clayton 2d4edfbc6a Modified all logging calls to hand out shared pointers to make sure we
don't crash if we disable logging when some code already has a copy of the
logger. Prior to this fix, logs were handed out as pointers and if they were
held onto while a log got disabled, then it could cause a crash. Now all logs
are handed out as shared pointers so this problem shouldn't happen anymore.
We are also using our new shared pointers that put the shared pointer count
and the object into the same allocation for a tad better performance.

llvm-svn: 118319
2010-11-06 01:53:30 +00:00
Greg Clayton c52df286ea Howard Hinnant gave us changes for lldb_private::SharingPtr that gives us the ability have a single allocation contain both the class and the ref count without having to do intrusive pointer type stuff. They will intermingle correctly with other shared pointers as well. In order to take advantage of this you need to create your pointer in your class with the make_shared function:
lldb_private::SharingPtr<A> p = llvm::make_shared<A>(i, j);

Currently up to five constructor arguments are supported and each must be an LValue.

llvm-svn: 118317
2010-11-06 00:12:48 +00:00
Sean Callanan c70f8ff417 Fixed a bug where variables in the source operands
of store statements were not being marked for
resolution.

llvm-svn: 118316
2010-11-06 00:09:34 +00:00
Johnny Chen f7f9d9d880 Make the type of session log part of the filename itself. It allows for easier
identification of the test failures/errors by human beings as well as automatic
processings.

The prefix which identifies the type can be: Error, Failure, or ExpectedFailure.

llvm-svn: 118315
2010-11-06 00:07:07 +00:00
Greg Clayton efabb123af Added copy constructors and assignment operators to all lldb::SB* classes
so we don't end up with weak exports with some compilers.

llvm-svn: 118312
2010-11-05 23:17:00 +00:00
Caroline Tice 5e254d37a6 If debugserver is running on the local machine, pass it a
pseudoterminal to pass to the inferior for the inferior's I/O
(to allow direct writing, rather than passing all the I/O around
via packets).

llvm-svn: 118308
2010-11-05 22:37:44 +00:00
Johnny Chen 76c381b6f5 Fix the infinite recursion crash reported by Antoine Missout:
rdar://problem/8557095 lldb disas crashed (from lldb developer)

llvm-svn: 118299
2010-11-05 21:43:19 +00:00
Jim Ingham 399f1cafa6 Added the equivalent of gdb's "unwind-on-signal" to the expression command, and a parameter to control it in ClangUserExpression, and on down to ClangFunction.
llvm-svn: 118290
2010-11-05 19:25:48 +00:00
Johnny Chen a29c14e40d Fix comments.
llvm-svn: 118285
2010-11-05 18:10:11 +00:00
Jim Ingham e4caae4f48 Don't need both LIBLLDB_LOG_DYNAMIC_LOADER and LIBLLDB_LOG_SHLIB. Go with the former.
llvm-svn: 118284
2010-11-05 17:59:46 +00:00
Jim Ingham d403f26bbe Don't need both LIBLLDB_LOG_DYNAMIC_LOADER and LIBLLDB_LOG_SHLIB. Go with the former.
llvm-svn: 118283
2010-11-05 17:59:33 +00:00
Jim Ingham 3cbb931504 Don't need both LIBLLDB_LOG_DYNAMIC_LOADER and LIBLLDB_LOG_SHLIB. Go with the former.
llvm-svn: 118282
2010-11-05 17:59:19 +00:00
Johnny Chen 9a6706bca4 Add comment about iterating over possible architecture and compiler combinations.
llvm-svn: 118279
2010-11-05 17:30:53 +00:00
Johnny Chen 2f53b943e4 Make lldb dump fullpath instead of just basename when printing out frame or
thread descriptions.  This allows for correctly finding and obeying the last
filename-and-line marker from the debugger.

Add a delay for gud-up and gud-down.  This makes tracking filename-and-line
more reliable when moving up/down the stack.

llvm-svn: 118277
2010-11-05 16:51:44 +00:00
Sean Callanan 2a39652303 Fixed error handling when the utility functions
that check pointer validity fail to parse.  Now
lldb does not crash in that case.  Also added
support for checking Objective-C class validity
in the Version 1 runtime as well as Version 2
runtimes with varying levels of available debug
support.

llvm-svn: 118271
2010-11-05 00:57:06 +00:00
Jim Ingham 5822173bc8 Handle stepping through ObjC vtable trampoline code.
llvm-svn: 118270
2010-11-05 00:18:21 +00:00
Jim Ingham f7f4f50113 Added a setting to "log timer" so you can see the incremental timings as well:
log timer increment true/false

llvm-svn: 118268
2010-11-04 23:19:21 +00:00
Jim Ingham 302448352c Added a top level Timer to the interpreter execute command. Also added an option to pass the depth to "log timer enable". That allows you to time just command execution with:
log timer enable 1
<command>
log timer dump

llvm-svn: 118267
2010-11-04 23:08:45 +00:00
Jim Ingham 932725fa11 Added a top level Timer to the interpreter execute command. Also added an option to pass the depth to "log timer enable". That allows you to time just command execution with:
log timer enable 1
<command>
log timer dump

llvm-svn: 118266
2010-11-04 23:08:26 +00:00
Johnny Chen c1fa8c5644 Remove the @skip decorators for assertion aborts. Jim fixed them in r118255.
llvm-svn: 118265
2010-11-04 22:49:00 +00:00
Jason Molenda 744aa8a14d Use the new native unwinder by default.
llvm-svn: 118264
2010-11-04 22:29:24 +00:00
Jim Ingham 2a5e0f03fb Add a ObjC V1 runtime, and a generic AppleObjCRuntime plugin.
Also move the Checker creation into the Apple Runtime code.

llvm-svn: 118255
2010-11-04 18:30:59 +00:00
Johnny Chen 9b70bd4169 Add one @skip decorator for assertion abort:
@unittest2.skip("rdar://problem/8630601 Assertion failed: (result_valobj_sp.get()), function EvaluateExpression, file CommandObjectExpression.cpp, line 227.")

llvm-svn: 118252
2010-11-04 17:37:20 +00:00
Johnny Chen 0fcb0365e0 Add two @skip decorators for assertion abort:
@unittest2.skip("rdar://problem/8630601 Assertion failed: (result_valobj_sp.get()), function EvaluateExpression, file CommandObjectExpression.cpp, line 227.")

llvm-svn: 118251
2010-11-04 17:26:50 +00:00
Jason Molenda 504d3f51ff Revert last checkin to DisassemblerLLVM.cpp; that was some temporary
debug printfs that got left behind by accident.

llvm-svn: 118244
2010-11-04 09:53:38 +00:00
Jason Molenda c311c23402 Add #ifdef to easily switch between the current libunwind-remote based unwinder
or the native unwinder (UnwindLLDB).  I'll make the native unwinder the default
once I check in with everyone tomorrow.

llvm-svn: 118243
2010-11-04 09:51:29 +00:00
Jason Molenda 311eb2deec Revert last checking to ThreadGDBRemote.cpp; I accidentally checked
that in along with some cleanup work with the native unwinder code.

llvm-svn: 118242
2010-11-04 09:46:43 +00:00
Jason Molenda dae97b4a29 Revert last checking to CommandObjectDisassemble.cpp; that was
some diagnostic test code I was using while debugging the 
native unwinder and didn't mean to check in.

llvm-svn: 118241
2010-11-04 09:43:27 +00:00
Jason Molenda fa19c3e7d6 Built the native unwinder with all the warnings c++-4.2 could muster;
fixed them.  Added DISALLOW_COPY_AND_ASSIGN to classes that should
not be bitwise copied.  Added default initializers for member
variables that weren't being initialized in the ctor.  Fixed a few
shadowed local variable mistakes.

llvm-svn: 118240
2010-11-04 09:40:56 +00:00
Greg Clayton 923cf1c32e Removed the hardcoding of the system compiler to gcc 4.2
llvm-svn: 118231
2010-11-04 02:01:34 +00:00
Greg Clayton 61fba2935b Bumped version for lldb-29 and debugserver-116 in the Xcode projects.
llvm-svn: 118229
2010-11-04 01:56:14 +00:00
Greg Clayton 8f343b09e9 Added support for loading and unloading shared libraries. This was done by
adding support into lldb_private::Process:

    virtual uint32_t
    lldb_private::Process::LoadImage (const FileSpec &image_spec, 
                                      Error &error);

    virtual Error
    lldb_private::Process::UnloadImage (uint32_t image_token);

There is a default implementation that should work for both linux and MacOSX.
This ability has also been exported through the SBProcess API:

    uint32_t
    lldb::SBProcess::LoadImage (lldb::SBFileSpec &image_spec, 
                                lldb::SBError &error);

    lldb::SBError
    lldb::SBProcess::UnloadImage (uint32_t image_token);

Modified the DynamicLoader plug-in interface to require it to be able to 
tell us if it is currently possible to load/unload a shared library:

    virtual lldb_private::Error
    DynamicLoader::CanLoadImage () = 0;

This way the dynamic loader plug-ins are allows to veto whether we can 
currently load a shared library since the dynamic loader might know if it is
currenlty loading/unloading shared libraries. It might also know about the
current host system and know where to check to make sure runtime or malloc
locks are currently being held.

Modified the expression parser to have ClangUserExpression::Evaluate() be
the one that causes the dynamic checkers to be loaded instead of other code
that shouldn't have to worry about it.

llvm-svn: 118227
2010-11-04 01:54:29 +00:00
Sean Callanan 10af7c430a Re-enabled LLDB's pointer checkers, and moved the
implementation of the Objective-C object checkers
into the Objective-C language runtime.

llvm-svn: 118226
2010-11-04 01:51:38 +00:00
Jason Molenda 5976200d43 Handle the case where no eh_frame section is present.
RegisterContextLLDB holds a reference to the SymbolContext
in the vector of Cursors that UnwindLLDB maintains.  Switch
UnwindLLDB to hold a vector of shared pointers of Cursors
so this reference doesn't become invalid.

Correctly falling back from the "fast" UnwindPlan to the
"full" UnwindPlan when additional registers need to be
retrieved.

llvm-svn: 118218
2010-11-04 00:53:20 +00:00
Sean Callanan f211510ff6 Factored the code that implements breakpoints on
exceptions for different languages out of 
ThreadPlanCallFunction and put it into the 
appropriate language runtimes.

llvm-svn: 118200
2010-11-03 22:19:38 +00:00
Johnny Chen fb53d5069d Fix an incorrect comment in main.c and TestConditionalBreak.py.
It should be c's parent frame being a instead of the other way around.

llvm-svn: 118198
2010-11-03 22:00:28 +00:00
Johnny Chen 87bb589c4d Add a test for Python API SBValue.GetValueType() inside TestArrayTypes.py for a
local variable and an argument variable.

Add ValueTypeString() utility function into lldbutil.py which converts the enum
into a human readable string.

Modify TestBase.DebugSBValue() to also dump the value type of an SBValue object.

llvm-svn: 118197
2010-11-03 21:37:58 +00:00
Johnny Chen a67d2981b9 Fix comment about eValueTypeConstResult.
llvm-svn: 118196
2010-11-03 21:10:38 +00:00
Sean Callanan c98aca605f Modified ThreadPlanCallFunction to perform the
exception checks at the right time, and modified
ClangFunction so that it doesn't misinterpret the
stop as a timeout stop.

llvm-svn: 118189
2010-11-03 19:36:28 +00:00
Johnny Chen 110bd0f8cf Now that the test suite has very few expected failures remaining (2), it is a good
idea to also dump the session information for expected failures in addition to
failures and errors (tests with unexpected exceptions).

Modify the LLDBTestResult class which derives from unittest2.TextTestResult to
intercept the addExpectedFailure() method in order to mark the test instance as
needing its session information dumped.

llvm-svn: 118185
2010-11-03 18:17:03 +00:00
Johnny Chen 0a5f9c96fd Really remove the @expectedFailure decorator this time.
llvm-svn: 118180
2010-11-03 17:12:54 +00:00
Johnny Chen 64b47bd57d Remove the @expectedFailure decorator. The bug rdar://problem/8508987 has been fixed.
llvm-svn: 118179
2010-11-03 17:05:34 +00:00
Greg Clayton 6ba508507e Fixed shared library unloads when the unloaded library doesn't come off
the end of the list. We had an issue in the MacOSX dynamic loader where if
we had shlibs:
1 - a.out
2 - a.dylib
3 - b.dylib

And then a.dylib got unloaded, we would unload b.dylib due to the assumption
that only shared libraries could come off the end of the list. We now properly
search and find which ones get loaded.

Added a new internal logging category for the "lldb" log channel named "dyld".
This should allow all dynamic loaders to use this as a generic log channel so
we can track shared library loads and unloads in the logs without having to 
have each plug-in make up its own logging channel.

llvm-svn: 118147
2010-11-03 04:08:06 +00:00
Sean Callanan 6db73ca5e2 Modified the thread plan that calls functions to
set breakpoints at the different locations where
an exception could be thrown, so that exceptions
thrown by expressions are properly caught.

llvm-svn: 118142
2010-11-03 01:37:52 +00:00
Johnny Chen b2d4f7f20e Add more comment for dumpSessionInfo(self) method.
llvm-svn: 118129
2010-11-03 00:09:38 +00:00
Sean Callanan 951f6ce903 Fixed a bug where we left a definition hanging
for a global variable that we had replaced with
a reference to a slot in the input array.

llvm-svn: 118123
2010-11-02 23:51:17 +00:00
Sean Callanan c2afd25ea1 Fixed a bug that was confusing the code generator
on i386 platforms, leading to crashes on simple
expressions.

llvm-svn: 118114
2010-11-02 23:20:00 +00:00
Johnny Chen d2ed5dbf83 Clean up the test case by removing the filtering code related to fixed radars.
Also modify the:

    self.runCmd("expr %s" % var)

to be:

    self.runCmd("expression %s" % var)

since 'expr' is an alias of expression.  And fix the assert message to be either
'frame variable -t %s' or 'expression %s'.

llvm-svn: 118085
2010-11-02 22:01:37 +00:00
Johnny Chen fa3fa41d09 The remaining reference-related variable display failures have been fixed.
Comment out the filtering code.  The next check in will clean up the test case
by wiping off the filtering related logic.

llvm-svn: 118081
2010-11-02 21:43:50 +00:00
Greg Clayton df797c12e7 Fixed a case where children of pointers or references that had had multiple
children always incorrectly displayed the child at offset zero.

llvm-svn: 118070
2010-11-02 21:21:20 +00:00
Johnny Chen d66bb225fd Add a test case for a bug fixed:
rdar://problem/8464339 test/types directory: b basic_type.cpp:171 does not work, while gdb does work

It tests that 'breakpoint set -f basic_type.cpp:176' works when int.cpp #include's basic_type.cpp.

llvm-svn: 118038
2010-11-02 19:46:35 +00:00
Caroline Tice f415eeb4d3 Fix error message when attempting to generate invalid alias.
llvm-svn: 118036
2010-11-02 19:00:04 +00:00
Greg Clayton 3bcbf84235 Fixed a missing newline when you type "apropos somethingthatdoesnotexist".
llvm-svn: 118033
2010-11-02 18:23:13 +00:00
Johnny Chen 9a4c23635b Remove the reference-related variable displays that now pass from the 'notnow' set.
The failures that remain are:

        # rdar://problem/8620735 test/types: frame variable -t a_class_ref.m_b fails
        # The reference type related failures that remain are:
        notnow = set(['a_class_ref.m_b',
                      'a_struct_ref.b',
                      'a_union_nonzero_ref.u.a'])

llvm-svn: 118021
2010-11-02 17:06:08 +00:00
Caroline Tice 5d7be2e617 Fix problem where "process detach" was not working properly. The
ptrace thread update that was replying to the SIGSTOP was also causing the
process to not really be sigstop'd any more so then the call to ptrace
detach was failing, and when debugserver exited the attached process
was being killed.  Now the ptrace thread update does not disturb the sigstop
state of the thread, so the detach works properly.

llvm-svn: 118018
2010-11-02 16:16:53 +00:00
Johnny Chen 321ab7a1c8 Remove 8 @expectedFailure decorators, the following bug has been fixed:
# rdar://problem/8482903
    # test suite failure for types dir -- "long long" and "unsigned long long"

llvm-svn: 118017
2010-11-02 16:04:18 +00:00
Greg Clayton 19de37f730 Fixed cases where we were translating "long long" types to use the "long"
types when they are the same size. The new code will use the correct type 
now when converting DWARF built-in types into clang types.

llvm-svn: 118003
2010-11-02 03:48:39 +00:00
Greg Clayton 2856d46252 Fixed the default file and line breakpoints to include inlined breakpoints.
llvm-svn: 118002
2010-11-02 03:02:38 +00:00
Greg Clayton 315d2cab27 Fixed our overly verbose stop reasons which by default included the thread
name and thread queue. Users can modify the thread-format strings to add these
back if needed.

llvm-svn: 118000
2010-11-02 01:53:21 +00:00
Greg Clayton 7c8a966442 Print better error messages when memory reads fail when displaying variable
values.

Always show the variable types for the top level items when dumping program
variables.

llvm-svn: 117999
2010-11-02 01:50:16 +00:00
Sean Callanan 53078294ed Improved logging and cleaned up a redundant return
statement.  Now when ClangExpressionDeclMap returns
a variable for a name, it pretty-prints that
variable to the log instead of printing a (fairly
useless) NamedDecl pointer.

llvm-svn: 117972
2010-11-01 23:22:47 +00:00
Johnny Chen 79e007d574 Add comment on test class failing for clang as well as llvm-gcc.
llvm-svn: 117962
2010-11-01 21:52:20 +00:00
Johnny Chen ab9c1dd9ba Replace the two call sites of inspect.getsource(obj) with a utility function
getsource_if_available(obj) which also handles the exception if it occurs.

llvm-svn: 117949
2010-11-01 20:35:01 +00:00
Greg Clayton 4b3dc10e65 Fixed globals not showing up for any but the first compile unit due to a
mismatch: I was using the compile unit user ID (the compile unit offset in
the DWARF) as the compile unit index.

llvm-svn: 117948
2010-11-01 20:32:12 +00:00
Sean Callanan 57bbc6ecc6 Print notes for expressions as well as errors
and warnings.

llvm-svn: 117947
2010-11-01 20:28:09 +00:00
Johnny Chen 7e329d0d2a Add keyboard shortcuts:
'thread backtrace'     => Control-C b (gud-bt)     "Show stack for the current thread."
'thread backtrace all' => Control-C B (gud-bt-all) "Show stacks for all the threads."

Change the function name of one existing shortcut:

'breakpoint list"      => Control-C l (gud-listb)  "List all breakpoints."

llvm-svn: 117933
2010-11-01 17:29:38 +00:00
Johnny Chen 2e1615ea8e Change the README to reflect the new the screen shot file name lldb-gud-window.png.
llvm-svn: 117926
2010-11-01 16:39:24 +00:00
Johnny Chen 6713a9b317 Python API changes: SBValue.IsPtrType() -> SBValue.IsPointerType().
SBFrame print representation: idx: 0 -> #0

llvm-svn: 117924
2010-11-01 16:08:47 +00:00
Sean Callanan 7c0962dc89 Fixed StackFrame::GetVariableList to add global
variables to the list of found variables if they
have not yet been added.

llvm-svn: 117896
2010-11-01 04:38:59 +00:00
Greg Clayton b9c7a9ae07 Make sure darwin-debug gets installed in /Developer/usr/bin instead of
/usr/local/bin.

llvm-svn: 117866
2010-10-31 20:13:10 +00:00
Greg Clayton fac83d83d1 Bumped lldb Xcode project version to 28 for lldb-28.
llvm-svn: 117865
2010-10-31 19:58:25 +00:00
Greg Clayton 38adbbb88b Fixed an include so case sensitive builders can build.
llvm-svn: 117864
2010-10-31 19:57:43 +00:00
Greg Clayton e6f21e4e6e Bumped version in Xcode project to lldb-27, and debugserver to debugserver-115.
llvm-svn: 117852
2010-10-31 03:02:30 +00:00
Greg Clayton cfd1aced7e Cleaned up the API logging a lot more to reduce redundant information and
keep the file size a bit smaller.

Exposed SBValue::GetExpressionPath() so SBValue users can get an expression
path for their values.

llvm-svn: 117851
2010-10-31 03:01:06 +00:00
Greg Clayton 92ef573550 Fixed the copy constructor for SBThread.
llvm-svn: 117825
2010-10-30 18:26:59 +00:00
Benjamin Kramer e1e6797b07 Compress screenshot.
llvm-svn: 117778
2010-10-30 08:27:07 +00:00
Johnny Chen 886ec7800a Submit the screen capture as a followup of r117752.
llvm-svn: 117777
2010-10-30 07:36:05 +00:00
Greg Clayton 4838131baf Improved API logging.
llvm-svn: 117772
2010-10-30 04:51:46 +00:00
Sean Callanan 5a477cfd90 Added a hack that allows expressions to ignore
Objective-C member accessibility restrictions.
Ultimately Clang should have a flag that ignores
accessibility for Objective-C like it has one
for C++.

llvm-svn: 117768
2010-10-30 01:56:10 +00:00
Sean Callanan 0d546439b9 Using proper Objective-C types doesn't seem to
make the sky fall.

llvm-svn: 117767
2010-10-30 01:46:19 +00:00
Johnny Chen 6aa0dc1e26 Initial port of lldb debugging mode to run under Emacs's Grand Unified Debugger (gud.el).
The gud.el is modified from 22.3.1 version to add lldb stuffs, the gud-diffs.txt is the
diff file.

lldb-gud-window.tiff is a screen capture of Aquamacs 2.1 (which has 23.2.50.1) after
loading this modified gud.el, changing directory to test/conditional_break, and then
'M-x lldb' with the a.out file.

The lldb-gud-window.tiff will be submitted in another check in.

llvm-svn: 117752
2010-10-30 00:34:37 +00:00
Johnny Chen 2ed83824af Delete the directory, will try to resubmit later.
llvm-svn: 117751
2010-10-30 00:30:24 +00:00
Johnny Chen 7d5cd97080 Initial port of lldb debugging mode to run under Emacs's Grand Unified Debugger (gud.el).
The gud.el is modified from 22.3.1 version to add lldb stuffs, the gud-diffs.txt is the
diff file.

lldb-gud-window.tiff is a screen capture of Aquamacs 2.1 (which has 23.2.50.1) after
loading this modified gud.el, changing directory to test/conditional_break, and then
'M-x lldb' with the a.out file.

llvm-svn: 117748
2010-10-29 23:55:46 +00:00
Johnny Chen 721f298a60 Add some comment about the default session dir name which is a timestamp.
llvm-svn: 117730
2010-10-29 22:26:38 +00:00
Johnny Chen 8ff5d56c20 The informational message for where to find the session logs for failed/errored
tests should be near the test summary message, instead of way up in the beginning.

llvm-svn: 117726
2010-10-29 22:20:36 +00:00
Johnny Chen 2a9177c3de These two casts are up casts, no need to use dynamic_cast.
llvm-svn: 117725
2010-10-29 22:18:43 +00:00
Caroline Tice 7149fab4d3 Update arguments & help information for "log disable" command.
llvm-svn: 117717
2010-10-29 21:56:41 +00:00
Caroline Tice eec5877a31 Missed a file in my last commit.
llvm-svn: 117716
2010-10-29 21:49:29 +00:00
Caroline Tice 20ad3c40f4 Add the ability to disable individual log categories, rather
than just the entire log channel.

Add checks, where appropriate, to make sure a log channel/category has 
not been disabled before attempting to write to it.

llvm-svn: 117715
2010-10-29 21:48:37 +00:00
Sean Callanan e35831a23c Overloading is not broken any more. No need for
an #ifndef.

llvm-svn: 117706
2010-10-29 20:30:26 +00:00
Johnny Chen b00c8e83dd Remove the @expectedFailure as the following bug is fixed with newer clang bits with lldb r117700:
rdar://problem/8584431 Assert in clang while evaluating expression

llvm-svn: 117705
2010-10-29 20:28:28 +00:00
Johnny Chen dabefd0120 ClangUserExpression ctor should not crash if given a null expr_prefix char*.
llvm-svn: 117700
2010-10-29 20:19:44 +00:00
Johnny Chen 8ceb8ba2fb The r117616 check in broken these two test cases:
1. FoundationDisassembleTestCase.test_simple_disasm_with_dsym; and
2. FoundationDisassembleTestCase.test_simple_disasm_with_dwarf

the reason being the test was issuing 'disassemble' command to disassemble the current
frame function when stopped.  The 'disassemble' command worked previously but it was a
result of bad option specification.

Fix the disassemble command so that it will require 'disassemble -f' for disassembly of
the current frame function.

llvm-svn: 117688
2010-10-29 19:33:40 +00:00
Sean Callanan 31e851c9f3 Updated LLVM to latest version as of 10/28 at
7pm, and made minor integration fixes.

llvm-svn: 117680
2010-10-29 18:38:40 +00:00
Johnny Chen 7d105260e3 The r117641 check in removed the SBValue's print description of type and size.
Change the test case to not check it for an SBVariable's print description.

llvm-svn: 117668
2010-10-29 17:31:47 +00:00
Greg Clayton 93aa84e83b Modified the lldb_private::TypeList to use a std::multimap for quicker lookup
by type ID (the most common type of type lookup).

Changed the API logging a bit to always show the objects in the OBJECT(POINTER)
format so it will be easy to locate all instances of an object or references
to it when looking at logs.

llvm-svn: 117641
2010-10-29 04:59:35 +00:00
Sean Callanan 322f529b37 Added a user-settable variable, 'target.expr-prefix',
which holds the name of a file whose contents are
prefixed to each expression.  For example, if the file
~/lldb.prefix.header contains:

typedef unsigned short my_type;

then you can do this:

(lldb) settings set target.expr-prefix '~/lldb.prefix.header'
(lldb) expr sizeof(my_type)
(unsigned long) $0 = 2

When the variable is changed, the corresponding file
is loaded and its contents are fetched into a string
that is stored along with the target.  This string
is then passed to each expression and inserted into
it during parsing, like this:

typedef unsigned short my_type;
                             
void                           
$__lldb_expr(void *$__lldb_arg)          
{                              
    sizeof(my_type);                        
}

llvm-svn: 117627
2010-10-29 00:29:03 +00:00
Caroline Tice e79417951b Add alias information, including aliased command options &
arguments, to help text for alias commands.

llvm-svn: 117617
2010-10-28 23:17:48 +00:00
Caroline Tice dbaf18361e Comment out uninmplemented command option (-f) for disassemble
command.

llvm-svn: 117616
2010-10-28 22:19:36 +00:00
Caroline Tice 3cc8751d59 Remove references to particular Python version (use the system default
version);  change include statements to use Python.h in the Python framework
on Mac OS X systems; leave it using regular Python.h on other systems.

Note:  I think this *ought* to work properly on Linux systems, but I don't have
a system to test it on...

llvm-svn: 117612
2010-10-28 21:51:20 +00:00
Johnny Chen 62d4f8684f Add comment on passing the assert message to self.runCmd().
llvm-svn: 117604
2010-10-28 21:10:32 +00:00
Sean Callanan 48ae719dc5 Explicatory comment for folks that may not be
familiar with the ownership relationships
involving Diagnostic.

llvm-svn: 117573
2010-10-28 18:43:33 +00:00
Johnny Chen ebfff955b6 If TestBase.expect() is passed an assert message, pass it along when delegating to TestBase.runCmd()
to execute the debugger command.  This will result in a more semantic assert message than just the
command failed message like before:

AssertionError: False is not True : Command 'thread list' returns successfully

And now, we will have:

AssertionError: False is not True : Process state is stopped due to breakpoint
llvm-svn: 117569
2010-10-28 18:24:22 +00:00
Sean Callanan fb8b7098a1 Logging fixes. Added a simple class to handle
logging for type importing, making errors much
easier to diagnose.  Also removed some Objective-C
related logging.

llvm-svn: 117568
2010-10-28 18:19:36 +00:00
Johnny Chen b7234e4014 Check in an initial implementation of the "breakpoint clear" command, whose purpose is clear
the breakpoint associated with the (filename, line_number) combo when an arrow is pointing to
a source position using Emacs Grand Unified Debugger library to interact with lldb.

The current implmentation is insufficient in that it only asks the breakpoint whether it is
associated with a breakpoint resolver with FileLine type and whether it matches the (filename, line_number)
combo.  There are other breakpoint resolver types whose breakpoint locations can potentially
match the (filename, line_number) combo.

The BreakpointResolver, BreakpointResolverName, BreakpointResolverAddress, and BreakpointResolverFileLine
classes have extra static classof methods to support LLVM style type inquiry through isa, cast, and dyn_cast.

The Breakpoint class has an API method bool GetMatchingFileLine(...) which is invoked from CommandObjectBreak.cpp
to implement the "breakpoint clear" command.

llvm-svn: 117562
2010-10-28 17:27:46 +00:00
Johnny Chen bdc5c27894 Fix the test driver as part of the fix for http://llvm.org/bugs/show_bug.cgi?id=8493
File name "2010-10-19-14:10:49.059609" is non-portable.

Do not use ':' in the pathname as it is not permitted on windows platforms.

llvm-svn: 117556
2010-10-28 16:32:13 +00:00
Caroline Tice be484f413d Add warning if no actual locations were resolved when attempting
to set a breakpoint.

llvm-svn: 117555
2010-10-28 16:28:56 +00:00
Johnny Chen 22b881dc34 Fix http://llvm.org/bugs/show_bug.cgi?id=8493 File name "2010-10-19-14:10:49.059609" is non-portable.
llvm-svn: 117554
2010-10-28 16:24:26 +00:00
Greg Clayton bcf1217e28 Fixed the "frame variable -G NAME" that would print global
variables by name. It was accidentally getting all the globals
for the compile unit that contained the global variable named
NAME.

llvm-svn: 117516
2010-10-28 00:56:11 +00:00
Jim Ingham 517b3b21ca Replace unnecessary dynamic_cast with static_cast.
llvm-svn: 117503
2010-10-27 22:58:34 +00:00
Caroline Tice 7d54a2e8d5 Make SBFrame::GetDescription a little more descriptive.
llvm-svn: 117497
2010-10-27 22:07:28 +00:00
Caroline Tice 7b9da4a550 Fix bugs attempting to write to API log after it has been
disabled.

llvm-svn: 117493
2010-10-27 21:23:37 +00:00
Caroline Tice 04a339a084 Flush the prompts immediately in the breakpoint command input readers, to make
sure they come out at the correct times.

llvm-svn: 117470
2010-10-27 18:34:42 +00:00
Greg Clayton 90f90cdae1 Don't include the ":" character when building the selector identifiers
when making objective C classes from the DWARF.

llvm-svn: 117438
2010-10-27 04:01:14 +00:00
Greg Clayton 73b472d42a Updated the lldb_private::Flags class to have better method names and made
all of the calls inlined in the header file for better performance.

Fixed the summary for C string types (array of chars (with any combo if
modifiers), and pointers to chars) work in all cases.

Fixed an issue where a forward declaration to a clang type could cause itself
to resolve itself more than once if, during the resolving of the type itself
it caused something to try and resolve itself again. We now remove the clang
type from the forward declaration map in the DWARF parser when we start to 
resolve it and avoid this additional call. This should stop any duplicate
members from appearing and throwing all the alignment of structs, unions and
classes.

llvm-svn: 117437
2010-10-27 03:32:59 +00:00
Greg Clayton 307de25449 After a recent fix to not set the default architecture to "x86_64", the string value for the default arch was coming out as a value that shouldn't be user visible. Now we don't show any value when it isn't set.
llvm-svn: 117432
2010-10-27 02:06:37 +00:00
Sean Callanan 11d00c22e9 Removed an inappropriate function lookup path.
Also made type lookup lazy for types that are
hidden behind pointers.

llvm-svn: 117430
2010-10-27 01:36:51 +00:00
Caroline Tice 750cd1755d Clean up the API logging code:
- Try to reduce logging to one line per function call instead of tw
      - Put all arguments & their values into log for calls
      - Add 'this' parameter information to function call logging, making it show the appropriate
        internal pointer (this.obj, this.sp, this.ap...)
      - Clean up some return values
      - Remove logging of constructors that construct empty objects
      - Change '==>' to '=>'  for showing result values...
      - Fix various minor bugs
      - Add some protected 'get' functions to help getting the internal pointers for the 'this' arguments...      

llvm-svn: 117417
2010-10-26 23:49:36 +00:00
Greg Clayton ab7b6d6197 Fixed vAttachWait by fixing a missed "else if".
llvm-svn: 117395
2010-10-26 21:04:55 +00:00
Caroline Tice 6dfb484139 Remove inappropriate if-clause in regex name resolution that was
causing modules that haven't already been parsed from being searched.

llvm-svn: 117383
2010-10-26 18:33:57 +00:00
Jason Molenda e6194f17a1 Add an unwind log Printf to note when an eh_frame section is
loaded/parsed.  Should add timers to this eventually.

Delay getting a full UnwindPlan if it's possible to unwind with
just a fast UnwindPlan.  This keeps us from reading the eh_frame
section unless we hit something built -fomit-frame pointer or we
hit a frame with no symbol (read: no start address) available.

It doesn't look like it is correctly falling back to using the
full UnwindPlan to provide additional registers that the fast
UnwindPlan doesn't supply; e.g. go to the middle of a stack and
ask for r12 and it will show you the value of r12 in frame 0.
That's a bug for tomorrow.

llvm-svn: 117361
2010-10-26 12:01:35 +00:00
Jason Molenda 49ea23e266 Don't indent log lines by frame # spaces if the frame # exceeds 100 - the indentation
gets to be a problem if you have a unbounded stack walk.

Fix the CFA sanity checks.  Add one to the arch default UnwindPlan run which was giving
one extra stack frame on the main thread.  Fix a couple of logging lines that had their
argument order incorrect.

llvm-svn: 117350
2010-10-26 04:14:12 +00:00
Caroline Tice ceb6b1393d First pass at adding logging capabilities for the API functions. At the moment
it logs the function calls, their arguments and the return values.  This is not
complete or polished, but I am committing it now, at the request of someone who
really wants to use it, even though it's not really done.  It currently does not
attempt to log all the functions, just the most important ones.  I will be 
making further adjustments to the API logging code over the next few days/weeks.
(Suggestions for improvements are welcome).


Update the Python build scripts to re-build the swig C++ file whenever 
the python-extensions.swig file is modified.

Correct the help for 'log enable' command (give it the correct number & type of
arguments).

llvm-svn: 117349
2010-10-26 03:11:13 +00:00
Jason Molenda 5c01cb6b77 Get a disassembler based on the correct architecture for assembly
prologue profiling.

Change the log print statements to elide the thread number, make
some of them only print when IsLogVerbose().

Add a couple of sanity checks for impossible CFA values so backtraces
don't go too far off into the weeds.

llvm-svn: 117343
2010-10-26 00:47:17 +00:00
Sean Callanan be3a1b14dc Fixed a problem where function calls on i386 weren't
being generated correctly.

Also added a messy way to single-step through expressions
that I will improve soon.

llvm-svn: 117342
2010-10-26 00:31:56 +00:00
Jim Ingham 40d871fa24 The call function thread plan should allow internal breakpoints to continue on. Also made stopping
in mid-expression evaluation when we hit a breakpoint/signal work.

llvm-svn: 117341
2010-10-26 00:27:45 +00:00
Johnny Chen 8c0142fd62 Add an extra SPC character after '.' for the 'frame variable' help text.
llvm-svn: 117330
2010-10-25 23:57:26 +00:00
Johnny Chen a3a113e2d2 Add comment explaining the options used to invoke the test driver.
llvm-svn: 117318
2010-10-25 21:38:35 +00:00
Johnny Chen e137df2624 A simple config to test both x86_64 and i386 architectures.
llvm-svn: 117304
2010-10-25 20:39:20 +00:00
Greg Clayton 0668d1e039 Don't set the default architecture to x86_64. Leave it NULL so that it isn't set to anything and so that any single architecture binary will adopt that architecture instead of posting an error stating the binary doesn't contain "x86_64".
llvm-svn: 117292
2010-10-25 20:08:15 +00:00
Johnny Chen 567a045fe3 Only prints out the stop reason if it is not invalid.
llvm-svn: 117287
2010-10-25 19:13:52 +00:00
Johnny Chen 4badfb8a1f Also prints out the stop reason string for lldbutil.PrintStackTrace(thread).
llvm-svn: 117281
2010-10-25 18:43:29 +00:00
Johnny Chen ae5de9b269 Skip this test module for the time being until we get a newer clang on lldb tot.
llvm-svn: 117278
2010-10-25 18:26:20 +00:00
Jason Molenda ab4f1924db Check in the native lldb unwinder.
Not yet enabled as the default unwinder but there are no known
backtrace problems with the code at this point.

Added 'log enable lldb unwind' to help diagnose backtrace problems;
this output needs a little refining but it's a good first step.

eh_frame information is currently read unconditionally - the code
is structured to allow this to be delayed until it's actually needed.
There is a performance hit when you have to parse the eh_frame
information for any largeish executable/library so it's necessary
to avoid if possible.

It's confusing having both the UnwindPlan::RegisterLocation struct
and the RegisterConextLLDB::RegisterLocation struct, I need to rename
one of them.

The writing of registers isn't done in the RegisterConextLLDB subclass
yet; neither is the running of complex DWARF expressions from eh_frame
(e.g. used for _sigtramp on Mac OS X).

llvm-svn: 117256
2010-10-25 11:12:07 +00:00
Sean Callanan a242417a90 Fixes to Objective-C built-in type handling.
Specifically, we fixed handling of the objc_class
built-in type, which allowed us to pass
named Objective-C objects to functions,
call variable list -t on objects safely, etc.

llvm-svn: 117249
2010-10-25 00:29:48 +00:00
Sean Callanan 64186e7faa Added a hack so that "unichar" is resolved to
"unsigned short."  As discussed in the comments,
this is pending a better solution to the problem
of types not in the debug information but readily
available through headers.

llvm-svn: 117247
2010-10-24 20:45:49 +00:00
Sean Callanan 672ad94681 Fixed value objects so that they return an
informative message when they have no description.

llvm-svn: 117190
2010-10-23 00:18:49 +00:00
Jim Ingham 65a0e595e6 If we hit a thread specific breakpoint for another thread, don't report the Exception as the stop reason, you have to report no stop reason.
llvm-svn: 117179
2010-10-22 23:28:32 +00:00
Sean Callanan cf5498f1c7 Added a temporary hack to allow casting of Objective-C
method results to int.  This will only last until we
get accurate type information for Objective-C methods
or some way of making their types inferred by the
parser.

llvm-svn: 117178
2010-10-22 23:25:16 +00:00
Johnny Chen 8334dadb62 Add more docstring for the lldbtest.TestBase class.
llvm-svn: 117175
2010-10-22 23:15:46 +00:00
Johnny Chen f3f1e00e24 Just use 'test harness', not 'test harness runtime'.
llvm-svn: 117153
2010-10-22 21:37:51 +00:00
Johnny Chen f4f70bb890 Comment heading changes.
llvm-svn: 117152
2010-10-22 21:31:03 +00:00
Greg Clayton 54180398fa Fix the default prompt to have a space.
llvm-svn: 117150
2010-10-22 21:15:00 +00:00
Johnny Chen a91b9474da Add text about test class cleanup.
llvm-svn: 117148
2010-10-22 21:06:04 +00:00
Johnny Chen d9bebeb2be Comment out the debug statement for printing the SBBreakpoint object.
llvm-svn: 117140
2010-10-22 20:08:56 +00:00
Johnny Chen bc095dbe68 The test should remove 'output.txt' if it exists before launching the inferior
process which is supposed to create the file.

llvm-svn: 117136
2010-10-22 19:51:42 +00:00
Johnny Chen 8c251f4209 Add some more usage text.
llvm-svn: 117129
2010-10-22 19:00:18 +00:00
Jim Ingham 49e80a1142 Changed "run" to alias "process launch --".
Added "po" alias for "expression -o --"

llvm-svn: 117125
2010-10-22 18:47:16 +00:00
Johnny Chen 5bfb8ee64e Add test case for using SBBreakpointLocation to set break condition.
llvm-svn: 117116
2010-10-22 18:10:25 +00:00
Johnny Chen 962b799070 Fix misnamed test method names.
llvm-svn: 117101
2010-10-22 16:17:39 +00:00
Greg Clayton 0188eb9a5f Fixed a error formatting output issue when dumping variables where the error had no space before it and was missing a newline.
llvm-svn: 117086
2010-10-22 02:39:02 +00:00
Jim Ingham 041a12fc31 Add and SB API to set breakpoint conditions.
llvm-svn: 117082
2010-10-22 01:15:49 +00:00
Sean Callanan 6608f07a79 Fixed IRForTarget to not recognize $__lldb variables
as persistent variables.  These are special markers
used by LLDB.

llvm-svn: 117078
2010-10-21 22:41:32 +00:00
Johnny Chen de7cd9229e Mark these test methods to be eligible for running only under the 'darwin' platform.
llvm-svn: 117071
2010-10-21 21:58:02 +00:00
Johnny Chen 05ac744e3d Add more information.
llvm-svn: 117066
2010-10-21 21:39:02 +00:00
Johnny Chen c14e08f437 Rewording of output message.
llvm-svn: 117030
2010-10-21 17:00:35 +00:00
Johnny Chen 096011eebf Add an option '-s session-dir-name' to overwrite the default timestamp-named
directory used to dump the session info for test failures/errors.

Example:

/Volumes/data/lldb/svn/trunk/test $ ./dotest.py -s jason -v array_types

Session info for test errors or failures will go into directory jason
----------------------------------------------------------------------
Collected 4 tests

test_with_dsym_and_python_api (TestArrayTypes.ArrayTypesTestCase)
Use Python APIs to inspect variables with array types. ... ok
test_with_dsym_and_run_command (TestArrayTypes.ArrayTypesTestCase)
Test 'frame variable var_name' on some variables with array types. ... ok
test_with_dwarf_and_python_api (TestArrayTypes.ArrayTypesTestCase)
Use Python APIs to inspect variables with array types. ... ok
test_with_dwarf_and_run_command (TestArrayTypes.ArrayTypesTestCase)
Test 'frame variable var_name' on some variables with array types. ... FAIL

======================================================================
FAIL: test_with_dwarf_and_run_command (TestArrayTypes.ArrayTypesTestCase)
Test 'frame variable var_name' on some variables with array types.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Volumes/data/lldb/svn/trunk/test/array_types/TestArrayTypes.py", line 27, in test_with_dwarf_and_run_command
    self.array_types()
  File "/Volumes/data/lldb/svn/trunk/test/array_types/TestArrayTypes.py", line 62, in array_types
    'stop reason = breakpoint'])
  File "/Volumes/data/lldb/svn/trunk/test/lldbtest.py", line 594, in expect
    self.runCmd(str, trace = (True if trace else False), check = not error)
  File "/Volumes/data/lldb/svn/trunk/test/lldbtest.py", line 564, in runCmd
    msg if msg else CMD_MSG(cmd, True))
AssertionError: False is not True : Command 'thread list' returns successfully

----------------------------------------------------------------------
Ran 4 tests in 3.086s

FAILED (failures=1)
/Volumes/data/lldb/svn/trunk/test $ ls jason
TestArrayTypes.ArrayTypesTestCase.test_with_dwarf_and_run_command.log
/Volumes/data/lldb/svn/trunk/test $ head -10 jason/TestArrayTypes.ArrayTypesTestCase.test_with_dwarf_and_run_command.log 
Session info generated @ Thu Oct 21 09:54:15 2010

os command: [['/bin/sh', '-c', 'make clean; make MAKE_DSYM=NO']]
stdout: rm -rf "a.out" "a.out.dSYM"  main.o main.d
cc -arch x86_64 -gdwarf-2 -O0   -c -o main.o main.c
cc -arch x86_64 -gdwarf-2 -O0  main.o -o "a.out"

stderr: None
retcode: 0

/Volumes/data/lldb/svn/trunk/test $ 

llvm-svn: 117028
2010-10-21 16:55:35 +00:00
Johnny Chen 5858df1315 Get rid of the microsecond field in the timestamp directory name used to dump the
session information files to.  This makes the directory name less intimidating.
Currently, the directory only gets created if there are failures/errors while
running the test suite.

llvm-svn: 116982
2010-10-21 01:03:38 +00:00
Johnny Chen 12672250c1 Add an example of option combination for running a single test method to the help text.
llvm-svn: 116980
2010-10-21 00:47:52 +00:00
Johnny Chen d7e27687c7 Initial check in of best-practice documentation for building test cases.
llvm-svn: 116964
2010-10-20 22:56:32 +00:00
Greg Clayton 58fc50e0e1 Fixed a crasher that could happen if a FileSpec had a filename only, or vice
versa.

llvm-svn: 116963
2010-10-20 22:52:05 +00:00
Johnny Chen 9695636cdb Add more bug info.
llvm-svn: 116950
2010-10-20 21:56:26 +00:00
Johnny Chen a9b56f68be Fixed a typo in the comment.
llvm-svn: 116949
2010-10-20 21:44:39 +00:00
Johnny Chen 1ee3853fc9 Fixed a crasher. The cmd_file needs to be resolved before reading lines from it.
llvm-svn: 116948
2010-10-20 21:40:50 +00:00
Greg Clayton 274060b6f1 Fixed an issue where we were resolving paths when we should have been.
So the issue here was that we have lldb_private::FileSpec that by default was 
always resolving a path when using the:

FileSpec::FileSpec (const char *path);

and in the:

void FileSpec::SetFile(const char *pathname, bool resolve = true);

This isn't what we want in many many cases. One example is you have "/tmp" on
your file system which is really "/private/tmp". You compile code in that
directory and end up with debug info that mentions "/tmp/file.c". Then you 
type:

(lldb) breakpoint set --file file.c --line 5

If your current working directory is "/tmp", then "file.c" would be turned 
into "/private/tmp/file.c" which won't match anything in the debug info.
Also, it should have been just a FileSpec with no directory and a filename
of "file.c" which could (and should) potentially match any instances of "file.c"
in the debug info.

So I removed the constructor that just takes a path:

FileSpec::FileSpec (const char *path); // REMOVED

You must now use the other constructor that has a "bool resolve" parameter that you must always supply:

FileSpec::FileSpec (const char *path, bool resolve);

I also removed the default parameter to SetFile():

void FileSpec::SetFile(const char *pathname, bool resolve);

And fixed all of the code to use the right settings.

llvm-svn: 116944
2010-10-20 20:54:39 +00:00
Johnny Chen 6ec94e3731 Remove the two @expectedFailure decorators as the bug has been fixed on tot.
llvm-svn: 116941
2010-10-20 18:51:01 +00:00
Johnny Chen 2e431cea84 Make the breakpoint condition test more robust with regard to checking the correct
parent call frame information.  And comment out the check for stop reason for the
time being.  The stop reason disappeared from the "thread backtrace" output for
breakpoint stop with condition.

llvm-svn: 116939
2010-10-20 18:38:48 +00:00
Johnny Chen bf45719408 Clean up the teardown logic to make it more robust and to record the additions and
invocations of them into session object.

Remove a debug statement.

llvm-svn: 116938
2010-10-20 18:12:58 +00:00
Johnny Chen f0888a3e8c Fix wrong test logic with regard to hit count and resolved status of disabled/enabled breakpoints.
llvm-svn: 116936
2010-10-20 17:26:59 +00:00
Jim Ingham d4ce0a1597 Don't re-insert disabled breakpoint locations.
llvm-svn: 116908
2010-10-20 03:36:33 +00:00
Johnny Chen 73b4f71125 For UserSettingsController::UpdateDictionaryVariable(), clear the dictionary
if passed in a NULL new_value and the operation intended is eVarSetOperationAssign.
This fixed a bug where in TestSettings.py:

        # Set the run-args and the env-vars.
        self.runCmd('settings set target.process.run-args A B C')
        self.runCmd('settings set target.process.env-vars ["MY_ENV_VAR"]=YES')
        # And add hooks to restore the settings during tearDown().
        self.addTearDownHook(
            lambda: self.runCmd("settings set -r target.process.run-args"))
        self.addTearDownHook(
            lambda: self.runCmd("settings set -r target.process.env-vars"))

"settings set -r target.process.env-vars" was not restoring the original env-vars
setting.

llvm-svn: 116895
2010-10-20 01:03:00 +00:00
Jim Ingham b15bfc753c Don't cache the public stop reason, since it can change as plan completion gets processed. That means GetStopReason needs to return a shared pointer, not a pointer to the thread's cached version. Also allow the thread plans to get and set the thread private stop reason - that is usually more appropriate for the logic the thread plans need to do.
llvm-svn: 116892
2010-10-20 00:39:53 +00:00
Sean Callanan 104a6e9baa Fixed a silly bug that was causing the "this" pointer
to be passed improperly to expressions in certain
cases.

llvm-svn: 116884
2010-10-19 23:57:21 +00:00
Johnny Chen 707d8228df Restoring the original setting should be done more robustly by adding a hook function
to be run during tearDown() to effect the restore action instead of executing it inline
during the test method, because the test may already fail and bailout before the inline
restore action.

Fix test_set_output_path() and pass_run_args_and_env_vars() to use this mechanism.

llvm-svn: 116881
2010-10-19 23:40:13 +00:00
Greg Clayton 913c4fa15b Ok, last commit for the running processes in a new window. Now you can
optionally specify the tty you want to use if you want to use an existing
terminal window by giving a partial or full path name:

(lldb) process launch --tty=ttys002

This would find the terminal window (or tab on MacOSX) that has ttys002 in its
tty path and use it. If it isn't found, it will use a new terminal window.

llvm-svn: 116878
2010-10-19 23:16:00 +00:00
Johnny Chen 1e4fc3c9be Add Python doc string for setTearDownCleanup() method.
llvm-svn: 116874
2010-10-19 22:45:25 +00:00
Johnny Chen 030709d085 test_set_output_path() should restore the original setting of target.process.output-path
after running the program.

llvm-svn: 116873
2010-10-19 22:31:50 +00:00
Sean Callanan 49249493cd Removed a bit of dead code. Thanks to Eric
Christopher for pointing it out.

llvm-svn: 116871
2010-10-19 22:29:33 +00:00
Sean Callanan 3e6fedcaa1 Expressions now claim responsibility for all stops
that occur while they run.  This means that they
clean up after themselves even when they crash.

llvm-svn: 116870
2010-10-19 22:24:06 +00:00
Johnny Chen 7f48df3017 Finish the first draft of a detailed walkthrough of an lldb test method.
llvm-svn: 116865
2010-10-19 21:46:48 +00:00
Sean Callanan c57f64d1bf Fixed the message that reports that an expression
did not return a result.  The result is nonexistent
(or void), not NULL.

llvm-svn: 116855
2010-10-19 20:15:00 +00:00
Johnny Chen a913ea479e Add more descriptive messages to expect() instead of using the default assert messages.
llvm-svn: 116850
2010-10-19 19:39:20 +00:00
Johnny Chen 3343f04bf8 Add a little helper function SETTING_MSG(setting) to be used from TestSettings.test_set_output_path().
llvm-svn: 116847
2010-10-19 19:11:38 +00:00
Johnny Chen a295fd8045 Remove the two @skip decorators now that we are not seeing the hang while running the test suite.
llvm-svn: 116844
2010-10-19 18:43:57 +00:00
Greg Clayton 6162f9774a Fixed all known race conditions with starting a process in a new terminal.
We now spawn a thread to accept a unix socket connection from the inferior
when it spawns in the terminal, then we launch the process, then we get
the pid back through the unix socket, and then wait for it to SIGSTOP.

darwin-debug now clears the terminal screen and prints out the program and
arguments that are about to be launched.

llvm-svn: 116841
2010-10-19 18:15:50 +00:00
Johnny Chen 63a9e14164 Initial version of a detailed walkthrough of a test case (test/settings/TestSettings.py).
It's an in-progress snapshot, and not complete.

llvm-svn: 116822
2010-10-19 17:37:52 +00:00
Greg Clayton add29982be Use AppleScript when lauching inferior in terminal so the command that
is being run is visible in the terminal as opposed to just seeing a path
to a .command file.

llvm-svn: 116814
2010-10-19 17:03:58 +00:00
Johnny Chen 430eb7607d Change the environment variable name to be more descriptive from LLDB_TIME_WAIT to LLDB_TIME_WAIT_NEXT_LAUNCH.
llvm-svn: 116809
2010-10-19 16:00:42 +00:00
Greg Clayton 3fcbed6bda Stop the driver from handling SIGPIPE in case we communicate with stale
sockets so the driver doesn't just crash.

Added support for connecting to named sockets (unix IPC sockets) in
ConnectionFileDescriptor.

Modified the Host::LaunchInNewTerminal() for MacOSX to return the process
ID of the inferior process instead of the process ID of the Terminal.app. This
was done by modifying the "darwin-debug" executable to connect to lldb through
a named unix socket which is passed down as an argument. This allows a quick
handshake between "lldb" and "darwin-debug" so we can get the process ID
of the inferior and then attach by process ID and avoid attaching to the 
inferior by process name since there could be more than one process with 
that name. This still has possible race conditions, those will be fixed
in the near future. This fixes the SIGPIPE issues that were sometimes being
seen when task_for_pid was failing.

llvm-svn: 116792
2010-10-19 03:25:40 +00:00
Johnny Chen a8807f93b7 Modify the command passed to command interpreter from 'expr' (which is an alias of 'expression')
to 'expression' to avoid cases where 'expr' has been unaliased.

llvm-svn: 116780
2010-10-19 00:52:07 +00:00
Johnny Chen 04d2c5cb0e Modify the test driver and lldbtest.TestBase so that the dumping of session info
now goes into a timestamp-specific directory instead of the previous .session-*
files.

[17:24:34] johnny:/Volumes/data/lldb/svn/trunk $ ls -l test/2010-10-18-16:56:12.935342
total 48
-rw-r--r--  1 johnny  admin  1695 Oct 18 16:56 TestArrayTypes.ArrayTypesTestCase.test_with_dsym_and_run_command.log
-rw-r--r--  1 johnny  admin  1652 Oct 18 16:56 TestArrayTypes.ArrayTypesTestCase.test_with_dwarf_and_run_command.log
-rw-r--r--  1 johnny  admin  2967 Oct 18 16:56 TestBreakpointCommand.BreakpointCommandTestCase.test_with_dsym.log
-rw-r--r--  1 johnny  admin  1648 Oct 18 16:56 TestClassTypes.ClassTypesTestCase.test_with_dwarf_and_run_command.log
-rw-r--r--  1 johnny  admin  1665 Oct 18 16:56 TestClassTypesDisassembly.IterateFrameAndDisassembleTestCase.test_with_dsym_and_python_api.log
-rw-r--r--  1 johnny  admin  3873 Oct 18 16:58 TestFloatTypesExpr.FloatTypesTestCase.test_float_types_with_dsym.log
[17:24:37] johnny:/Volumes/data/lldb/svn/trunk $ 

Also, the dumping happens when a test errored in additioned to when it failed.

llvm-svn: 116778
2010-10-19 00:25:01 +00:00
Johnny Chen 92b9e6e323 Add an assert that 'output.txt' exists before opening it.
llvm-svn: 116775
2010-10-19 00:16:14 +00:00
Caroline Tice e206be2129 Add header files that were added to lldb.swig to the build
script, so it can keep track of dependencies accurately (for
knowing when to re-build LLDBWrapPython.cpp).

llvm-svn: 116765
2010-10-18 23:00:51 +00:00
Caroline Tice c0dbdfb6c2 Combine eArgTypeSignalName and eArgTypeUnixSignalNumber into a single
argument type, eArgTypeUnixSignal.

llvm-svn: 116764
2010-10-18 22:56:57 +00:00
Johnny Chen 5517f64dae Uncomment the @skip decorator to reproduce the hang while running the test suite.
llvm-svn: 116763
2010-10-18 22:54:25 +00:00
Caroline Tice 9bc6dbb027 Fix small mistake in previous commit (fixing aliases for commands that
take raw input).

llvm-svn: 116760
2010-10-18 22:38:05 +00:00
Johnny Chen 5a7b94d97d Remove out-dated comments.
llvm-svn: 116748
2010-10-18 21:14:58 +00:00
Caroline Tice 38c22f5692 Fix bug where aliases for commands that take raw input were not
executing properly.

llvm-svn: 116735
2010-10-18 19:18:31 +00:00
Caroline Tice dc8f777f6b Prevent Python script interpreter initialization from changing
the termios settings on the debugger's input handle.

llvm-svn: 116725
2010-10-18 18:24:17 +00:00
Johnny Chen 3e9c50c7c0 Add a case to test that after 'set auto-confirm true', manual confirmation should not kick in.
Also add a more useful assert message for test_set_output_path(), which is currently decorated
with @expectedFailure.

llvm-svn: 116718
2010-10-18 17:51:45 +00:00
Johnny Chen 8b6b189422 Also change the utility functions in lldbutil.py, too, to correspond to the StateType representation change.
llvm-svn: 116706
2010-10-18 15:46:54 +00:00
Johnny Chen 0c724effb8 The StateType representation has been changed. Modify the test cases to accommodate.
llvm-svn: 116705
2010-10-18 15:44:42 +00:00
Greg Clayton 58d1c9a44f Still trying to get detach to work with debugserver. Got a bit closer,
but something is still killing our inferior.

Fixed an issue with darwin-debug where it wasn't passing all needed arguments
to the inferior.

Fixed a race condition with the attach to named process code.

llvm-svn: 116697
2010-10-18 04:14:23 +00:00
Greg Clayton 19388cfc6e Fixed debugserver to properly attach to a process by name with the
"vAttachName;<PROCNAME>" packet, and wait for a new process by name to launch 
with the "vAttachWait;<PROCNAME>".

Fixed a few issues with attaching where if DoAttach() returned no error, yet
there was no valid process ID, we would deadlock waiting for an event that
would never happen.

Added a new "process launch" option "--tty" that will launch the process 
in a new terminal if the Host layer supports the "Host::LaunchInNewTerminal(...)"
function. This currently works on MacOSX and will allow the debugging of 
terminal applications that do complex operations with the terminal. 

Cleaned up the output when the process resumes, stops and halts to be 
consistent with the output format.

llvm-svn: 116693
2010-10-18 01:45:30 +00:00
Greg Clayton dd36defda7 Added a new Host call to find LLDB related paths:
static bool
    Host::GetLLDBPath (lldb::PathType path_type, FileSpec &file_spec);
    
This will fill in "file_spec" with an appropriate path that is appropriate
for the current Host OS. MacOSX will return paths within the LLDB.framework,
and other unixes will return the paths they want. The current PathType
enums are:

typedef enum PathType
{
    ePathTypeLLDBShlibDir,          // The directory where the lldb.so (unix) or LLDB mach-o file in LLDB.framework (MacOSX) exists
    ePathTypeSupportExecutableDir,  // Find LLDB support executable directory (debugserver, etc)
    ePathTypeHeaderDir,             // Find LLDB header file directory
    ePathTypePythonDir              // Find Python modules (PYTHONPATH) directory
} PathType;

All places that were finding executables are and python paths are now updated
to use this Host call.

Added another new host call to launch the inferior in a terminal. This ability
will be very host specific and doesn't need to be supported on all systems.
MacOSX currently will create a new .command file and tell Terminal.app to open
the .command file. It also uses the new "darwin-debug" app which is a small
app that uses posix to exec (no fork) and stop at the entry point of the 
program. The GDB remote plug-in is almost able launch a process and attach to
it, it currently will spawn the process, but it won't attach to it just yet.
This will let LLDB not have to share the terminal with another process and a
new terminal window will pop up when you launch. This won't get hooked up
until we work out all of the kinks. The new Host function is:

    static lldb::pid_t
    Host::LaunchInNewTerminal (
        const char **argv,   // argv[0] is executable
        const char **envp,
        const ArchSpec *arch_spec,
        bool stop_at_entry,
        bool disable_aslr);

Cleaned up FileSpec::GetPath to not use strncpy() as it was always zero 
filling the entire path buffer.

Fixed an issue with the dynamic checker function where I missed a '$' prefix
that should have been added.

llvm-svn: 116690
2010-10-17 22:03:32 +00:00
Greg Clayton d59cea2d23 prefix more stuff with '$' to make sure we don't go trying to lookup anything
we don't need to.

llvm-svn: 116676
2010-10-16 21:09:32 +00:00
Greg Clayton 556658c79e Fixed an issue with MachTask::TaskResume () where if the task was already
suspended, we would call "int ::task_resume (task_t task);" as many times as
it took to resume the task which isn't what we want to do.

llvm-svn: 116674
2010-10-16 18:11:41 +00:00
Johnny Chen 24d6ea25f8 Missed this spot where module.cleanup() can be passed a test instance to
facilitate session recording.  This happens inside an instance method where the
test instance is well known.

llvm-svn: 116649
2010-10-16 00:08:49 +00:00