Commit Graph

47 Commits

Author SHA1 Message Date
Johnny Chen d0fef81e38 For lldbutil.py, Change a bunch of function names to all lower case formats to be consistent.
And modify the test cases accordingly.

llvm-svn: 130174
2011-04-25 23:38:13 +00:00
Johnny Chen fc87e2dd5c Make SBBreakpointLocation::GetDescription() API to be consistent with SBTarget,
i.e., with 'SBStream &description' first, followed by 'DescriptionLevel level'.

Modify lldbutil.py so that get_description() for a target or breakpoint location
can just take the lldb object itself without specifying an option to mean option
lldb.eDescriptionLevelBrief.  Modify TestTargetAPI.py to exercise this logic path.

llvm-svn: 130147
2011-04-25 20:23:05 +00:00
Johnny Chen 9ae982053f Convert the rest of the test suite to use the lldbutil.get_description() utility function.
llvm-svn: 130041
2011-04-23 00:34:56 +00:00
Johnny Chen 90256cdaba Add a simple utility function get_description(lldb_obj, option=None) to lldbutil.py
and use it from TestTargetAPI.py.

llvm-svn: 130038
2011-04-23 00:13:34 +00:00
Johnny Chen 787f71f269 Add test cases for the SBTarget.GetDescription() API which takes an extra lldb::DescriptionLevel enum.
llvm-svn: 130029
2011-04-22 23:20:17 +00:00
Johnny Chen 0b8fd43397 Rename test/threads to python_api/lldbutil; it uses lldbutil functions to print stack traces.
llvm-svn: 129828
2011-04-19 22:44:20 +00:00
Johnny Chen c1c92a2ab3 Converted to use SBProcess.LaunchSimple().
And use self.TraceOn() API.

llvm-svn: 129797
2011-04-19 20:11:58 +00:00
Johnny Chen bd9b6e9ffb Converted to use SBProcess.LaunchSimple().
llvm-svn: 129795
2011-04-19 19:54:06 +00:00
Johnny Chen aedbe0f347 Converted to use SBProcess.LaunchSimple().
llvm-svn: 129793
2011-04-19 19:50:43 +00:00
Johnny Chen 90da3ccadb Use self.TraceOn() API.
llvm-svn: 129792
2011-04-19 19:49:09 +00:00
Johnny Chen 9efcb0ec4d Converted to use SBProcess.LaunchSimple() API.
And use self.TraceOn() in order to print more debug output.

llvm-svn: 129791
2011-04-19 19:44:26 +00:00
Johnny Chen fbf1cfea12 Converted to use SBProcess.LaunchSimple().
And use self.TraceOn() API.

llvm-svn: 129790
2011-04-19 19:34:41 +00:00
Johnny Chen 272ae4df7c Converted to use SBProcess.LaunchSimple().
llvm-svn: 129789
2011-04-19 19:25:37 +00:00
Jim Ingham 78a685aa2d Add support for "dynamic values" for C++ classes. This currently only works for "frame var" and for the
expressions that are simple enough to get passed to the "frame var" underpinnings.  The parser code will
have to be changed to also query for the dynamic types & offsets as it is looking up variables.

The behavior of "frame var" is controlled in two ways.  You can pass "-d {true/false} to the frame var
command to get the dynamic or static value of the variables you are printing.

There's also a general setting:

target.prefer-dynamic-value (boolean) = 'true'

which is consulted if you call "frame var" without supplying a value for the -d option.

llvm-svn: 129623
2011-04-16 00:01:13 +00:00
Johnny Chen df2963ed46 Add TestSymbolAPI.py to test the newly added SBSymbol and SBAddress APIs:
lldb::SymbolType SBSymbol::GetType();

  lldb::SectionType SBAddress::GetSectionType ();
  lldb::SBModule SBAddress::GetModule ();

Also add an lldb::SBModule::GetUUIDString() API which is easier for Python
to work with in the test script.

llvm-svn: 128695
2011-04-01 00:35:55 +00:00
Jim Ingham 8d543de400 Remove unneeded ExecutionContextScope variables.
llvm-svn: 128685
2011-03-31 23:01:21 +00:00
Johnny Chen fdc94ff97e Add test cases to exercise the SBThread.GetProcess() API. We launch the process using the
SBTarget.Launch() API, stop at a breakpoint, get the stopped thread, and verify that the
pid of the stopped thread's process is equal to the pid of the process returned by
SBTarget.Launch().

llvm-svn: 127444
2011-03-11 01:16:03 +00:00
Johnny Chen 2d799cca03 Add a test case test_run_to_address() to exercise the SBThread.RunToAddress(lldb::addr_t addr) API.
The test itself is not working yet.

llvm-svn: 127436
2011-03-11 00:00:15 +00:00
Johnny Chen f93286f20c Add test cases to TestThreadAPI.py to exercise SBThread.StepOver() by stopping at a breakpoint,
doing three step-over's, then verifying that the correct source line number is reached.

llvm-svn: 127432
2011-03-10 22:32:47 +00:00
Johnny Chen d9f2c08a0a Test cleanup. Check for the full caller symbol of malloc -- b(int).
llvm-svn: 127421
2011-03-10 19:18:04 +00:00
Johnny Chen a460316d81 Add test cases for Python SBThread.StepOut() API by stepping out of a malloc call where the call site is at function b().
Verifies that after the thread.StepOut(), we are at the correct line within function b.

llvm-svn: 127374
2011-03-09 23:45:56 +00:00
Johnny Chen d648135902 Add an extra twist of stopping the inferior in a breakpoint, and then continue till it's done.
We should still see the entire stdout redirected once the process is finished.

llvm-svn: 127184
2011-03-07 22:46:30 +00:00
Johnny Chen 75625aa118 Add test cases for SBTarget.Launch() API with the stdout of the inferior redirected to a file.
llvm-svn: 127179
2011-03-07 22:29:04 +00:00
Johnny Chen 2f6f7ba879 Add TestThreadAPI.py file to house the Python SBThread API test cases.
Currently it has only test cases for SBThread.GetStopDescription() API.

Also modified lldb.swig to add typemap for (char *dst, size_t dst_len)
which occurs for SBThread::GetStopDescription() C++ API.  For Python
scripting:

    # Due to the typemap magic (see lldb.swig), we pass in an (int)length to GetStopDescription
    # and expect to get a Python string as the result object!
    # The 100 is just an arbitrary number specifying the buffer size.
    stop_description = thread.GetStopDescription(100)

llvm-svn: 127173
2011-03-07 21:28:57 +00:00
Johnny Chen 930e3ad51e Add a test case ProcessAPITestCase.test_remote_launch() which tests SBProcess.RemoteLaunch()
API with a process not in eStateConnected, and checks that the remote launch failed.

Modify SBProcess::RemoteLaunch()/RemoteAttachToProcessWithID()'s log statements to fix a
crasher when logging is turned on.

llvm-svn: 127055
2011-03-05 01:20:11 +00:00
Johnny Chen 05178f6e54 Add a test case for the lldb command 'process connect'.
We start a fake debugserver listening on localhost:12345 and issue the command
'process connect connect://localhost:12345' to connect to it.

llvm-svn: 127048
2011-03-04 23:40:06 +00:00
Johnny Chen ed4019802d Add TestDisasmAPI.py which exercises the newly added SBFunction/SBSymbol.GetStartAddress(),
among other things:

// When stopped on breakppint 1, we can get the line entry using SBFrame API
// SBFrame.GetLineEntry().  We'll get the start address for the the line entry
// with the SBAddress type, resolve the symbol context using the SBTarget API
// SBTarget.ResolveSymbolContextForAddress() in order to get the SBSymbol.
//
// We then stop at breakpoint 2, get the SBFrame, and the the SBFunction object.
//
// The address from calling GetStartAddress() on the symbol and the function
// should point to the same address, and we also verify that.

And add one utility function disassemble(target, function_or_symbol) to lldbutil.py:

    """Disassemble the function or symbol given a target.

    It returns the disassembly content in a string object.
    """

TestDisasm.py uses the disassemble() function to do disassembly on the SBSymbol, and
then the SBFunction object.

llvm-svn: 126955
2011-03-03 19:14:00 +00:00
Johnny Chen d61816b5b8 Add TestTargetAPI.py:
// When stopped on breakppint 1, and then 2, we can get the line entries using
// SBFrame API SBFrame.GetLineEntry().  We'll get the start addresses for the
// two line entries; with the start address (of SBAddress type), we can then
// resolve the symbol context using the SBTarget API
// SBTarget.ResolveSymbolContextForAddress().
//
// The two symbol context should point to the same symbol, i.e., 'a' function.


Add two utility functions to lldbutil.py:

o get_stopped_threads(process, reason):

  return the list of threads with the specified stop reason or an empty list if not found

o get_stopped_thread(process, reason):

  return the first thread with the given stop reason or None if not found

llvm-svn: 126916
2011-03-03 01:41:57 +00:00
Johnny Chen 4e90a7e503 Add some comments.
llvm-svn: 126867
2011-03-02 19:49:27 +00:00
Johnny Chen 43766d6f12 Add two utility functions to lldbutil.py:
o int_to_bytearray()
o bytearray_to_int()

They return/interpret the bytearray in the little endian format.
For big endian, simply perform ba.reverse() on the bytearray object.

And modify TestProcessAPI.py to take advantage of the functions.

llvm-svn: 126813
2011-03-02 01:36:45 +00:00
Johnny Chen cf386e24ab Add an API SBProcess::GetByteOrder() and add test cases which utilizes GetByteOrder(),
among other SBProcess APIs, to write (int)256 into a memory location of a global variable
(int)my_int and reads/checks the variable afterwards.

llvm-svn: 126792
2011-03-01 22:56:31 +00:00
Johnny Chen 0dd049204c Fix wrong placement of skipUnless() decorator.
llvm-svn: 126774
2011-03-01 19:53:43 +00:00
Johnny Chen 90aa594c5e Add test methods for SBProcess.WriteMemory() API to the TestProcessAPI.py file.
This makes the number of total tests equal to 201.

llvm-svn: 126769
2011-03-01 18:51:47 +00:00
Johnny Chen 37f99fdb73 Add TestProcessAPI.py which exercises some Python SBProcess API. In particular, this tests
the SBProcess.ReadMemory() API, which, due to SWIG typemap'ing, expects 3 arguments (the location
to read from, the size in bytes to read, and an SBError object), and returns the result as a
Python string object.

On SnowLeopard where this has been tested, the SWIG script needs to be pampered (use the exact
same parameter names as in SBProcess.h) in order for this to work.

llvm-svn: 126736
2011-03-01 02:20:14 +00:00
Johnny Chen d762ff1faa Modify test scripts to accomodate SBTarget.Launch() API change.
llvm-svn: 124828
2011-02-03 23:15:53 +00:00
Greg Clayton 6f907e69e9 Deprecated old forms of SBTarget::Launch. There is not just one and no
SWIG renaming done to work around deprecated APIs.

llvm-svn: 124075
2011-01-23 17:46:22 +00:00
Johnny Chen 7ad4ac47ca Fix wrong test case in main.c. Oops!
llvm-svn: 123181
2011-01-10 17:44:08 +00:00
Johnny Chen d5f66fcbac Add a test case for the SBFrame APIs. In particular, it uses the frame API to
get the argument values of the call stacks when stopped on the breakpoint.

Radar has been filed for the expected failures:
test failure: ./dotest.py -v -w -t -p TestFrames (argument values are wrong)

llvm-svn: 122460
2010-12-23 01:12:19 +00:00
Johnny Chen cdbe594841 No need to pass an empty string as an arg or as an env string to the SBTarget.LaunchProcess() API.
llvm-svn: 122450
2010-12-22 22:56:19 +00:00
Johnny Chen 77c4697735 Fix some typos in the docstrings and also update the test method names.
llvm-svn: 122382
2010-12-22 00:56:47 +00:00
Johnny Chen f2df189b72 Add test cases for registering a listener object with the broadcaster of a process
and waiting for two expected state changed events to arrive: "running" followed by
"stopped".

llvm-svn: 122380
2010-12-22 00:32:54 +00:00
Johnny Chen 3635eae697 Rename the test methods to be more meaningful.
llvm-svn: 122352
2010-12-21 19:52:54 +00:00
Johnny Chen 4f8caab924 Set the debugger to asynchronous mode before using the Python API call to kill
the process.  The custom thread started before this point is running in a loop
waiting for events to come.

llvm-svn: 122316
2010-12-21 05:43:37 +00:00
Johnny Chen 0b0c57806b Fix typo.
llvm-svn: 122306
2010-12-21 02:10:18 +00:00
Johnny Chen f667ab526b Added python_api/event/TestEvents.py to get the listener object associated with the
debugger and to exercise some event APIs.

llvm-svn: 122304
2010-12-21 02:06:56 +00:00
Johnny Chen 62f68ee564 Use SBModule.GetDescription(SBStream) API to get the module description to match
against.

llvm-svn: 121989
2010-12-16 18:37:46 +00:00
Johnny Chen 6becf1c924 Add python_api/symbol-context to test getting the symbol context while stopped
on a frame and to exercise the methods of SBSymbolContext.

llvm-svn: 121941
2010-12-16 01:41:37 +00:00