| '''Module that contains the test TestBacktrace.''' |
| |
| from __future__ import absolute_import |
| |
| from harness.test_base_remote import TestBaseRemote |
| from harness.decorators import ( |
| ordered_test, |
| cpp_only_test, |
| ) |
| |
| |
| class TestBacktrace(TestBaseRemote): |
| '''Tests breaking on a kernel and a function, and viewing the call stack.''' |
| |
| bundle_target = { |
| 'java': 'BranchingFunCalls', |
| 'jni': 'JNIBranchingFunCalls', |
| 'cpp': 'CppBranchingFunCalls' |
| } |
| |
| def test_kernel_backtrace(self): |
| # pylint: disable=line-too-long |
| self.try_command('language renderscript status', |
| ['Runtime Library discovered', |
| 'Runtime Driver discovered']) |
| |
| self.try_command('language renderscript kernel breakpoint set simple_kernel', |
| ['Breakpoint(s) created', |
| '(pending)']) |
| |
| self.try_command('process continue', |
| ['resuming', |
| 'stopped', |
| 'stop reason = breakpoint']) |
| |
| self.try_command('bt', |
| ['stop reason = breakpoint', |
| # We should be able to see three functions in bt: |
| # libRSCpuRef, kernel.expand and the kernel |
| 'frame #2:', |
| 'librs.scalars.so', |
| 'simple_kernel'], |
| [r'scalars\.rs:4[567]']) |
| |
| self.try_command('breakpoint delete 1', |
| ['1 breakpoints deleted']) |
| |
| self.try_command('b set_i', |
| ['Breakpoint 2', |
| 'set_i'], |
| [r'scalars\.rs:2[012]']) |
| |
| self.try_command('breakpoint list', |
| ['set_i', 'resolved']) |
| |
| self.try_command('process continue', |
| ['resuming', |
| 'stopped', |
| 'stop reason = breakpoint']) |
| |
| self.try_command('bt', |
| ['stop reason = breakpoint', |
| # We should be able to see five functions in bt: |
| # libRSCpuRef, kernel.expand, kernel and two functions |
| 'frame #4:', |
| 'librs.scalars.so', |
| 'modify_i', |
| 'set_i'], |
| [r'scalars\.rs:2[012]']) |
| |
| @ordered_test('last') |
| @cpp_only_test() |
| def test_cpp_cleanup(self): |
| self.try_command('breakpoint delete 2', |
| ['1 breakpoints deleted']) |
| |
| self.try_command('process continue', |
| ['exited with status = 0']) |