Commit Graph

1019 Commits

Author SHA1 Message Date
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