1094881f513ab366f7ffd0b2c7778ab50281ca59eDaniel Malea// RUN: %build_test_apk --driver driver-simple --out %t --testcase %s %build_test_apk_opts
2094881f513ab366f7ffd0b2c7778ab50281ca59eDaniel Malea// RUN: %Test_jit_debuginfo %s %t
3094881f513ab366f7ffd0b2c7778ab50281ca59eDaniel Malea// DEBUGGER: source android-commands.py
4094881f513ab366f7ffd0b2c7778ab50281ca59eDaniel Malea// DEBUGGER: load-android-app %t
5094881f513ab366f7ffd0b2c7778ab50281ca59eDaniel Malea// DEBUGGER: run-android-app
6094881f513ab366f7ffd0b2c7778ab50281ca59eDaniel Malea// DEBUGGER: bt
7094881f513ab366f7ffd0b2c7778ab50281ca59eDaniel Malea// CHECK: entry
8094881f513ab366f7ffd0b2c7778ab50281ca59eDaniel Malea
9094881f513ab366f7ffd0b2c7778ab50281ca59eDaniel Malea#pragma version(1)
10094881f513ab366f7ffd0b2c7778ab50281ca59eDaniel Malea#pragma rs java_package_name(%PACKAGE%)
11094881f513ab366f7ffd0b2c7778ab50281ca59eDaniel Malea
12094881f513ab366f7ffd0b2c7778ab50281ca59eDaniel Maleastatic int function_with_a_segfault() {
13094881f513ab366f7ffd0b2c7778ab50281ca59eDaniel Malea  int* bla = 0;
14094881f513ab366f7ffd0b2c7778ab50281ca59eDaniel Malea  *bla = 5;
15094881f513ab366f7ffd0b2c7778ab50281ca59eDaniel Malea  return 0;
16094881f513ab366f7ffd0b2c7778ab50281ca59eDaniel Malea}
17094881f513ab366f7ffd0b2c7778ab50281ca59eDaniel Malea
18094881f513ab366f7ffd0b2c7778ab50281ca59eDaniel Maleastatic int some_function() {
19094881f513ab366f7ffd0b2c7778ab50281ca59eDaniel Malea  return function_with_a_segfault();
20094881f513ab366f7ffd0b2c7778ab50281ca59eDaniel Malea}
21094881f513ab366f7ffd0b2c7778ab50281ca59eDaniel Malea
22094881f513ab366f7ffd0b2c7778ab50281ca59eDaniel Maleastatic int foo() {
23094881f513ab366f7ffd0b2c7778ab50281ca59eDaniel Malea  return some_function();
24094881f513ab366f7ffd0b2c7778ab50281ca59eDaniel Malea}
25094881f513ab366f7ffd0b2c7778ab50281ca59eDaniel Malea
26094881f513ab366f7ffd0b2c7778ab50281ca59eDaniel Maleastatic int bar() {
27094881f513ab366f7ffd0b2c7778ab50281ca59eDaniel Malea  return foo();
28094881f513ab366f7ffd0b2c7778ab50281ca59eDaniel Malea}
29094881f513ab366f7ffd0b2c7778ab50281ca59eDaniel Malea
30094881f513ab366f7ffd0b2c7778ab50281ca59eDaniel Maleaint root() {
31094881f513ab366f7ffd0b2c7778ab50281ca59eDaniel Malea  return bar();
32094881f513ab366f7ffd0b2c7778ab50281ca59eDaniel Malea}
33094881f513ab366f7ffd0b2c7778ab50281ca59eDaniel Malea
34094881f513ab366f7ffd0b2c7778ab50281ca59eDaniel Maleavoid entry() {
35094881f513ab366f7ffd0b2c7778ab50281ca59eDaniel Malea  bar();
36094881f513ab366f7ffd0b2c7778ab50281ca59eDaniel Malea}
37