File: stack-fcall.h

package info (click to toggle)
strace 6.13%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 71,488 kB
  • sloc: ansic: 176,497; sh: 9,675; makefile: 4,133; cpp: 885; awk: 353; perl: 267; exp: 62; sed: 9
file content (45 lines) | stat: -rw-r--r-- 909 bytes parent folder | download | duplicates (12)
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
/*
 * Copyright (c) 2017-2020 The strace developers.
 * All rights reserved.
 *
 * SPDX-License-Identifier: GPL-2.0-or-later
 */

#include <unistd.h>
#include "scno.h"
#include "gcc_compat.h"

#ifdef MANGLE

# define f0 _ZN2ns2f0Ei
# define f1 _ZN2ns2f1Ei
# define f2 _ZN2ns2f2Ei
# define f3 _ZN2ns2f3Ei

#endif

int f0(int i, unsigned long) ATTRIBUTE_NOINLINE;
int f1(int i, unsigned long) ATTRIBUTE_NOINLINE;
int f2(int i, unsigned long) ATTRIBUTE_NOINLINE;
int f3(int i, unsigned long) ATTRIBUTE_NOINLINE;

#define COMPLEX_BODY(i, f)				\
	do {						\
		int tid = syscall(__NR_gettid, f);	\
		if (i == tid)				\
			return 0;			\
		switch ((unsigned int) tid & 3) {	\
			case 0:				\
				i += f0(tid, f);	\
				break;			\
			case 1:				\
				i += f1(tid, f);	\
				break;			\
			case 2:				\
				i += f2(tid, f);	\
				break;			\
			case 3:				\
				i += f3(tid, f);	\
				break;			\
		}					\
	} while (0)