aboutsummaryrefslogtreecommitdiff
path: root/lldb/test/API/tools/lldb-dap/stackTrace-x86/main.c
blob: 52ee3132d0df0feca0609f0cb955c8e8d0e1f3b7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include <stdio.h>

__attribute__((nodebug)) int no_branch_func(void) {
  int result = 0;

  __asm__ __volatile__("movl $0, %%eax;" // Assembly start
                       "incl %%eax;"
                       "incl %%eax;"
                       "incl %%eax;"
                       "incl %%eax;"
                       "incl %%eax;"
                       "incl %%eax;"
                       "incl %%eax;"
                       "incl %%eax;"
                       "incl %%eax;"
                       "incl %%eax;"
                       "movl %%eax, %0;" // Assembly end
                       : "=r"(result)
                       :
                       : "%eax");

  return result;
}

int main(void) {
  int result = no_branch_func(); // Break here
  printf("Result: %d\n", result);
  return 0;
}