aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.dwarf2/dw2-epilogue-begin.c
blob: 4ff445cf37d5d475942882de7732d5e52f9e5004 (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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/* Copyright 2023-2024 Free Software Foundation, Inc.

   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 3 of the License, or
   (at your option) any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */

void
__attribute__((used))
trivial (void)
{
  asm ("trivial_label: .global trivial_label");		/* trivial function */
}

char global;

void
watch (void)
{							/* watch start */
  asm ("watch_label: .global watch_label");
  asm ("mov $0x0, %rax");
  int local = 0;					/* watch prologue */

  asm ("watch_start: .global watch_start");
  asm ("mov $0x1, %rax");
  local = 1;						/* watch assign */
  asm ("watch_reassign: .global watch_reassign");
  asm ("mov $0x2, %rax");
  local = 2;						/* watch reassign */
  asm ("watch_end: .global watch_end");			/* watch end */
}

int
main (void)
{							/* main prologue */
  asm ("main_label: .global main_label");
  global = 0;
  asm ("main_fun_call: .global main_fun_call");
  watch ();						/* main function call */
  asm ("main_epilogue: .global main_epilogue");
  global = 10;
  return 0;						/* main end */
}