diff options
author | Johnny Chen <johnny.chen@apple.com> | 2011-07-20 00:23:11 +0000 |
---|---|---|
committer | Johnny Chen <johnny.chen@apple.com> | 2011-07-20 00:23:11 +0000 |
commit | 8957729268c201cf56f9c7a59913b8985b7ecf33 (patch) | |
tree | d110ac14161de17a58538d0ebcb5d19d9eddf8fd /lldb/scripts/Python | |
parent | 969edcdf74e4c6b6f8878a938a17a4f0560b4ab2 (diff) | |
download | bcm5719-llvm-8957729268c201cf56f9c7a59913b8985b7ecf33.tar.gz bcm5719-llvm-8957729268c201cf56f9c7a59913b8985b7ecf33.zip |
Add some docstrings for SBError class.
llvm-svn: 135547
Diffstat (limited to 'lldb/scripts/Python')
-rw-r--r-- | lldb/scripts/Python/interface/SBError.i | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/lldb/scripts/Python/interface/SBError.i b/lldb/scripts/Python/interface/SBError.i index d3e3f756ab0..61bd4ba8e02 100644 --- a/lldb/scripts/Python/interface/SBError.i +++ b/lldb/scripts/Python/interface/SBError.i @@ -9,6 +9,53 @@ namespace lldb { +%feature("docstring", +"Represents a container for holding any error code. + +For example (from test/python_api/hello_world/TestHelloWorld.py), + + def hello_world_attach_with_id_api(self): + '''Create target, spawn a process, and attach to it by id.''' + + target = self.dbg.CreateTarget(self.exe) + + # Spawn a new process and don't display the stdout if not in TraceOn() mode. + import subprocess + popen = subprocess.Popen([self.exe, 'abc', 'xyz'], + stdout = open(os.devnull, 'w') if not self.TraceOn() else None) + + listener = lldb.SBListener('my.attach.listener') + error = lldb.SBError() + process = target.AttachToProcessWithID(listener, popen.pid, error) + + self.assertTrue(error.Success() and process, PROCESS_IS_VALID) + + # Let's check the stack traces of the attached process. + import lldbutil + stacktraces = lldbutil.print_stacktraces(process, string_buffer=True) + self.expect(stacktraces, exe=False, + substrs = ['main.c:%d' % self.line2, + '(int)argc=3']) + + listener = lldb.SBListener('my.attach.listener') + error = lldb.SBError() + process = target.AttachToProcessWithID(listener, popen.pid, error) + + self.assertTrue(error.Success() and process, PROCESS_IS_VALID) + +checks that after the attach, there is no error condition by asserting +that error.Success() is True and we get back a valid process object. + +And (from test/python_api/event/TestEvent.py), + + # Now launch the process, and do not stop at entry point. + error = lldb.SBError() + process = target.Launch(listener, None, None, None, None, None, None, 0, False, error) + self.assertTrue(error.Success() and process, PROCESS_IS_VALID) + +checks that after calling the target.Launch() method there's no error +condition and we get back a void process object. +") SBError; class SBError { public: SBError (); |