/tests-m32
/tests-mx32
+
+/libmpers-m32.a
+/libmpers-mx32.a
+/m32_defs.h
+/m32_funcs.h
+/m32_printer_decls.h
+/m32_printer_defs.h
+/mpers-m32
+/mpers-m32.stamp
+/mpers-mx32
+/mpers-mx32.stamp
+/mpers.am
+/mx32_defs.h
+/mx32_funcs.h
+/mx32_printer_decls.h
+/mx32_printer_defs.h
+/native_printer_decls.h
+/native_printer_defs.h
+/printers.h
include xlat/Makemodule.am
+strace_CPPFLAGS = $(AM_CPPFLAGS)
+strace_LDFLAGS =
+strace_LDADD =
+noinst_LIBRARIES =
+
strace_SOURCES = \
access.c \
affinity.c \
count.c \
desc.c \
dirent.c \
+ empty.h \
epoll.c \
evdev.c \
eventfd.c \
memfd_create.c \
mknod.c \
mount.c \
+ mpers_type.h \
mq.c \
mtd.c \
net.c \
vsprintf.c \
wait.c \
xattr.c \
- xmalloc.c
+ xmalloc.c \
+ # end of strace_SOURCES
if USE_LIBUNWIND
strace_SOURCES += unwind.c
-strace_CPPFLAGS = $(AM_CPPFLAGS) $(libunwind_CPPFLAGS)
-strace_LDFLAGS = $(libunwind_LDFLAGS)
-strace_LDADD = $(libunwind_LIBS)
-else
-strace_CPPFLAGS = $(AM_CPPFLAGS)
+strace_CPPFLAGS += $(libunwind_CPPFLAGS)
+strace_LDFLAGS += $(libunwind_LDFLAGS)
+strace_LDADD += $(libunwind_LIBS)
endif
noinst_HEADERS = defs.h
maint/ioctls_hex.sh \
maint/ioctls_sym.sh \
maint/print_ioctlent.c \
+ mpers.awk \
+ mpers.sh \
+ mpers_test.sh \
signalent.sh \
strace-graph \
strace-log-merge \
srpm: dist-xz
rpmbuild --define '%_srcrpmdir .' -ts $(distdir).tar.xz
-BUILT_SOURCES = .version sys_func.h sen.h
-
$(srcdir)/.version:
$(AM_V_GEN)echo $(VERSION) > $@-t && mv $@-t $@
ioctls_inc_h = $(wildcard $(srcdir)/$(OS)/$(ARCH)/ioctls_inc*.h)
ioctlent_h = $(patsubst $(srcdir)/$(OS)/$(ARCH)/ioctls_inc%,ioctlent%,$(ioctls_inc_h))
-BUILT_SOURCES += $(ioctlent_h)
-CLEANFILES = sys_func.h sen.h $(ioctlent_h)
ioctlent%.h: ioctlsort%
./$< > $@
ioctls_all%.h: $(srcdir)/$(OS)/$(ARCH)/ioctls_inc%.h $(srcdir)/$(OS)/$(ARCH)/ioctls_arch%.h
cat $^ > $@
+BUILT_SOURCES = $(ioctlent_h) native_printer_decls.h native_printer_defs.h printers.h sen.h sys_func.h .version
+CLEANFILES = $(ioctlent_h) native_printer_decls.h native_printer_defs.h printers.h sen.h sys_func.h
+
+# defines mpers_source_files
+include mpers.am
+srcdir_mpers_source_files = $(patsubst %,$(srcdir)/%,$(mpers_source_files))
+
+mpers_NAME =
+mpers_PREFIX = $(mpers_NAME)_
+mpers_DEFS = $(DEFS)
+mpers_INCLUDES = $(DEFAULT_INCLUDES) $(INCLUDES)
+mpers_CPPFLAGS = $(strace_CPPFLAGS) $(CPPFLAGS)
+mpers_sh_opts = $(mpers_DEFS) $(mpers_INCLUDES) $(mpers_CPPFLAGS)
+libmpers_CPPFLAGS = $(AM_CPPFLAGS) -DIN_MPERS
+
+# mpers targets
+
+mpers-m%.stamp: $(srcdir_mpers_source_files)
+ for f in $^; do \
+ CC="$(CC)" CFLAGS="$(mpers_sh_opts)" \
+ CPP="$(CPP)" CPPFLAGS="$(mpers_CPPFLAGS) $(mpers_INCLUDES) -DIN_MPERS -DMPERS_IS_$(mpers_NAME)" \
+ $(srcdir)/mpers.sh -$(mpers_NAME) $$f || exit; \
+ done
+ > $@
+
+m%_defs.h: $(srcdir_mpers_source_files)
+ for f in $^; do \
+ sed -n 's/^#include DEF_MPERS_TYPE(\([^)]\+\))/#ifdef MPERS_$(mpers_PREFIX)\1\n# define \1 MPERS_$(mpers_PREFIX)\1\n#endif/p' $$f || exit; \
+ done > $@-t
+ mv $@-t $@
+
+m%_funcs.h: $(srcdir_mpers_source_files)
+ for f in $^; do \
+ sed -n 's/^SYS_FUNC(\([^)]\+\))/#undef sys_\1\n#define sys_\1 $(mpers_PREFIX)sys_\1/p' $$f || exit; \
+ done > $@-t && \
+ echo '#include "sys_func.h"' >> $@-t
+ mv $@-t $@
+
+# printers
+
+printers.h: $(srcdir_mpers_source_files)
+ echo '/* Generated by Makefile from $^; do not edit. */' > $@-t
+ echo 'typedef struct {' >> $@-t
+ for f in $^; do \
+ sed -n 's/^MPERS_PRINTER_DECL(\([^,]\+\),[[:space:]]*\([^)]\+\))\(.*\)/ \1 (*\2) \3;/p' $$f || exit; \
+ done >> $@-t
+ echo '} struct_printers;' >> $@-t
+ mv $@-t $@
+
+%_printer_decls.h: $(srcdir_mpers_source_files)
+ echo '/* Generated by Makefile from $^; do not edit. */' > $@-t
+ for f in $^; do \
+ sed -n 's/^MPERS_PRINTER_DECL(\([^,]\+\),[[:space:]]*\([^)]\+\))\(.*\)/extern \1 $(mpers_PREFIX)\2\3;/p' $$f || exit; \
+ done >> $@-t
+ mv $@-t $@
+
+%_printer_defs.h: $(srcdir_mpers_source_files)
+ echo '/* Generated by Makefile from $^; do not edit. */' > $@-t
+ for f in $^; do \
+ sed -n 's/^MPERS_PRINTER_DECL(\([^,]\+\),[[:space:]]*\([^)]\+\))\(.*\)/\.\2 = $(mpers_PREFIX)\2,/p' $$f || exit; \
+ done >> $@-t
+ mv $@-t $@
+
+native_printer_decls.h native_printer_defs.h: mpers_PREFIX =
+
+if HAVE_M32_MPERS
+
+strace_LDADD += libmpers-m32.a
+noinst_LIBRARIES += libmpers-m32.a
+libmpers_m32_a_SOURCES = $(mpers_source_files)
+libmpers_m32_a_CPPFLAGS = $(libmpers_CPPFLAGS) -DMPERS_IS_m32 -I$(builddir)/mpers-m32
+mpers_m32_targets = mpers-m32.stamp m32_defs.h m32_funcs.h m32_printer_decls.h m32_printer_defs.h
+
+BUILT_SOURCES += $(mpers_m32_targets)
+CLEANFILES += $(mpers_m32_targets)
+
+$(mpers_m32_targets): mpers_NAME = m32
+
+endif # HAVE_M32_MPERS
+
+if HAVE_MX32_MPERS
+
+strace_LDADD += libmpers-mx32.a
+noinst_LIBRARIES += libmpers-mx32.a
+libmpers_mx32_a_SOURCES = $(mpers_source_files)
+libmpers_mx32_a_CPPFLAGS = $(libmpers_CPPFLAGS) -DMPERS_IS_mx32 -I$(builddir)/mpers-mx32
+mpers_mx32_targets = mpers-mx32.stamp mx32_defs.h mx32_funcs.h mx32_printer_decls.h mx32_printer_defs.h
+
+BUILT_SOURCES += $(mpers_mx32_targets)
+CLEANFILES += $(mpers_mx32_targets)
+
+$(mpers_mx32_targets): mpers_NAME = mx32
+
+endif # HAVE_MX32_MPERS
+
+clean-local:
+ -rm -rf mpers-m32 mpers-mx32
+
if MAINTAINER_MODE
gen_changelog_start_date = 2009-07-08 20:00
--- /dev/null
+To use mpers functionality, one should:
+* typedef all of the target types which are compound and not typedefed
+already;
+* for each target type, include DEF_MPERS_TYPE(target_type_t), these can
+be included conditionally;
+* include MPERS_DEFS once;
+* before inclusion of MPERS_DEFS include all important headers
+(containing definitions of these types or other behaviour-affecting
+defines);
+* printers should be defined
+as MPERS_PRINTER_DECL(return type, function name)(args) and called
+as MPERS_PRINTER_NAME(function name)(args).
done
./xlat/gen.sh
+./generate_mpers_am.sh
exec autoreconf -f -i "$@"
AC_PROG_CC
AX_PROG_CC_FOR_BUILD
AC_USE_SYSTEM_EXTENSIONS
+AC_PROG_RANLIB
AC_MSG_CHECKING([for supported architecture])
case "$host_cpu" in
#include <sys/time.h>
#include <sys/syscall.h>
+#include "mpers_type.h"
+
#ifndef HAVE_STRERROR
const char *strerror(int);
#endif
# define PERSONALITY0_WORDSIZE 8
# define PERSONALITY1_WORDSIZE 4
# define PERSONALITY2_WORDSIZE 4
+# ifdef HAVE_M32_MPERS
+# define PERSONALITY1_INCLUDE_FUNCS "m32_funcs.h"
+# define PERSONALITY1_INCLUDE_PRINTERS_DECLS "m32_printer_decls.h"
+# define PERSONALITY1_INCLUDE_PRINTERS_DEFS "m32_printer_defs.h"
+# endif
+# ifdef HAVE_MX32_MPERS
+# define PERSONALITY2_INCLUDE_FUNCS "mx32_funcs.h"
+# define PERSONALITY2_INCLUDE_PRINTERS_DECLS "mx32_printer_decls.h"
+# define PERSONALITY2_INCLUDE_PRINTERS_DEFS "mx32_printer_defs.h"
+# endif
#endif
#ifdef X32
# define SUPPORTED_PERSONALITIES 2
# define PERSONALITY0_WORDSIZE 4
# define PERSONALITY1_WORDSIZE 4
+# ifdef HAVE_M32_MPERS
+# define PERSONALITY1_INCLUDE_FUNCS "m32_funcs.h"
+# define PERSONALITY1_INCLUDE_PRINTERS_DECLS "m32_printer_decls.h"
+# define PERSONALITY1_INCLUDE_PRINTERS_DEFS "m32_printer_defs.h"
+# endif
#endif
#ifdef ARM
# define PERSONALITY0_WORDSIZE SIZEOF_LONG
#endif
+#ifndef PERSONALITY0_INCLUDE_PRINTERS_DECLS
+# define PERSONALITY0_INCLUDE_PRINTERS_DECLS "native_printer_decls.h"
+#endif
+#ifndef PERSONALITY0_INCLUDE_PRINTERS_DEFS
+# define PERSONALITY0_INCLUDE_PRINTERS_DEFS "native_printer_defs.h"
+#endif
+
+#ifndef PERSONALITY1_INCLUDE_PRINTERS_DECLS
+# define PERSONALITY1_INCLUDE_PRINTERS_DECLS "native_printer_decls.h"
+#endif
+#ifndef PERSONALITY1_INCLUDE_PRINTERS_DEFS
+# define PERSONALITY1_INCLUDE_PRINTERS_DEFS "native_printer_defs.h"
+#endif
+
+#ifndef PERSONALITY2_INCLUDE_PRINTERS_DECLS
+# define PERSONALITY2_INCLUDE_PRINTERS_DECLS "native_printer_decls.h"
+#endif
+#ifndef PERSONALITY2_INCLUDE_PRINTERS_DEFS
+# define PERSONALITY2_INCLUDE_PRINTERS_DEFS "native_printer_defs.h"
+#endif
+
+#ifndef PERSONALITY1_INCLUDE_FUNCS
+# define PERSONALITY1_INCLUDE_FUNCS "empty.h"
+#endif
+#ifndef PERSONALITY2_INCLUDE_FUNCS
+# define PERSONALITY2_INCLUDE_FUNCS "empty.h"
+#endif
+
typedef struct sysent {
unsigned nargs;
int sys_flags;
extern const struct_ioctlent ioctlent0[];
extern qualbits_t *qual_vec[SUPPORTED_PERSONALITIES];
#define qual_flags (qual_vec[current_personality])
+
#if SUPPORTED_PERSONALITIES > 1
extern const struct_sysent *sysent;
extern const char *const *errnoent;
# define signalent signalent0
# define ioctlent ioctlent0
#endif
+
extern unsigned nsyscalls;
extern unsigned nerrnos;
extern unsigned nsignals;
extern unsigned nioctlents;
extern unsigned num_quals;
+#if SUPPORTED_PERSONALITIES > 1
+# include "printers.h"
+extern const struct_printers *printers;
+# define MPERS_PRINTER_NAME(printer_name) printers->printer_name
+#else
+# include "native_printer_decls.h"
+# define MPERS_PRINTER_NAME(printer_name) printer_name
+#endif
+
/*
* If you need non-NULL sysent[scno].sys_func and sysent[scno].sys_name
*/
#define SCNO_IN_RANGE(scno) \
((unsigned long)(scno) < nsyscalls)
-#ifndef SYS_FUNC_NAME
-# define SYS_FUNC_NAME(syscall_name) sys_ ## syscall_name
-#endif
+#define MPERS_FUNC_NAME__(prefix, name) prefix ## name
+#define MPERS_FUNC_NAME_(prefix, name) MPERS_FUNC_NAME__(prefix, name)
+#define MPERS_FUNC_NAME(name) MPERS_FUNC_NAME_(MPERS_PREFIX, name)
+
+#define SYS_FUNC_NAME(syscall_name) MPERS_FUNC_NAME(sys_ ## syscall_name)
#define SYS_FUNC(syscall_name) int SYS_FUNC_NAME(syscall_name)(struct tcb *tcp)
+
+#define MPERS_PRINTER_DECL(type, name) type MPERS_FUNC_NAME(name)
--- /dev/null
+#!/bin/sh -e
+
+exec > mpers.am
+
+echo "# Generated by $0; do not edit."
+echo -n 'mpers_source_files = '
+
+sed -n '/^strace_SOURCES[[:space:]]*=/,/^[[:space:]]*# end of strace_SOURCES/ s/^[[:space:]]*\([[:alnum:]][^.]*\.c\)[[:space:]]*\\$/\1/p' Makefile.am |
+ xargs -r grep -lx '#[[:space:]]*include[[:space:]]\+MPERS_DEFS' |
+ tr '\n' ' '
+echo
AC_DEFUN([st_MPERS],[
pushdef([MPERS_NAME], translit([$1], [a-z], [A-Z]))
+pushdef([HAVE_MPERS], [HAVE_]MPERS_NAME[_MPERS])
pushdef([HAVE_RUNTIME], [HAVE_]MPERS_NAME[_RUNTIME])
pushdef([CFLAG], [-$1])
pushdef([st_cv_cc], [st_cv_$1_cc])
pushdef([st_cv_runtime], [st_cv_$1_runtime])
+pushdef([st_cv_mpers], [st_cv_$1_mpers])
case "$arch" in
[$2])
[st_cv_runtime=yes],
[st_cv_runtime=no],
[st_cv_runtime=no])])
+ AC_CACHE_CHECK([whether mpers.sh CFLAG works], [st_cv_mpers],
+ [if CC="$CC" CPP="$CPP" CPPFLAGS="$CPPFLAGS" \
+ $srcdir/mpers_test.sh [$1]; then
+ st_cv_mpers=yes
+ else
+ st_cv_mpers=no
+ fi])
+ if test $st_cv_mpers = yes; then
+ AC_DEFINE(HAVE_MPERS, [1],
+ [Define to 1 if you have CFLAG mpers support])
+ fi
fi
CFLAGS="$saved_CFLAGS"
;;
*)
st_cv_runtime=no
+ st_cv_mpers=no
;;
esac
AM_CONDITIONAL(HAVE_RUNTIME, [test "$st_cv_runtime" = yes])
+AM_CONDITIONAL(HAVE_MPERS, [test "$st_cv_mpers" = yes])
+popdef([st_cv_mpers])
popdef([st_cv_runtime])
popdef([st_cv_cc])
popdef([CFLAG])
popdef([HAVE_RUNTIME])
+popdef([HAVE_MPERS])
popdef([MPERS_NAME])
])
--- /dev/null
+function compare_indices(i1, v1, i2, v2) {
+ c1 = strtonum(sprintf("%s", i1))
+ c2 = strtonum(sprintf("%s", i2))
+ if (c1 < c2)
+ return -1
+ return (c1 != c2)
+}
+function what_is(what_idx, type_idx, special, item)
+{
+ type_idx = array[what_idx]["type"]
+ special = array[what_idx]["special"]
+ switch (special) {
+ case "base_type":
+ switch (array[what_idx]["encoding"]) {
+ case 5: # signed
+ printf("%s ", "int" \
+ 8*array[what_idx]["byte_size"] "_t")
+ break
+ case 7: # unsigned
+ printf("%s ", "uint" \
+ 8*array[what_idx]["byte_size"] "_t")
+ break
+ default: # float, signed/unsigned char
+ printf("%s ", array[what_idx]["name"])
+ break
+ }
+ break
+ case "enumeration_type":
+ printf("%s ", "uint" 8*array[type_idx]["byte_size"] "_t")
+ break
+ case "pointer_type":
+ printf("%s", "mpers_ptr_t ")
+ break
+ case "array_type":
+ what_is(type_idx)
+ to_return = array[what_idx]["upper_bound"]
+ return to_return
+ break
+ case "structure_type":
+ case "union_type":
+ if (special == "structure_type") {
+ print "struct {"
+ } else {
+ print "union {"
+ }
+ for (item in array) {
+ if ("parent" in array[item] && array[item]["parent"] \
+ == what_idx) {
+ returned = what_is(item)
+ printf("%s", array[item]["name"])
+ if (returned) {
+ printf("%s", "[" returned "]")
+ }
+ print ";"
+ }
+ }
+ printf("%s", "} ")
+ break
+ case "typedef":
+ return what_is(type_idx)
+ break
+ case "member":
+ return what_is(type_idx)
+ break
+ default:
+ what_is(type_idx)
+ break
+ }
+ return 0
+}
+BEGIN {
+ print "#include <inttypes.h>"
+}
+/^<[[:xdigit:]]+>/ {
+ match($0, /([[:alnum:]]+)><([[:alnum:]]+)/, matches)
+ level = matches[1]
+ idx = "0x" matches[2]
+ array[idx]["idx"] = idx
+ parent[level] = idx
+ if (level > 1) {
+ array[idx]["parent"] = parent[level-1]
+ }
+}
+/^DW_AT_data_member_location/ {
+ match($0, /[[:digit:]]+/, temparray)
+ array[idx]["location"] = temparray[1]
+}
+/^DW_AT_name/ {
+ match($0, /:[[:space:]]+([[:alpha:]_][[:alnum:]_[:space:]]*)/, temparray)
+ array[idx]["name"] = temparray[1]
+}
+/^DW_AT_byte_size/ {
+ match($0, /[[:digit:]]+/, temparray)
+ array[idx]["byte_size"] = temparray[0]
+}
+/^DW_AT_encoding/ {
+ match($0, /[[:digit:]]+/, temparray)
+ array[idx]["encoding"] = temparray[0]
+}
+/^DW_AT_type/ {
+ match($0, /:[[:space:]]+<(0x[[:xdigit:]]*)>$/, temparray)
+ array[idx]["type"] = temparray[1]
+}
+/^DW_AT_upper_bound/ {
+ match($0, /[[:digit:]]+/, temparray)
+ array[parent[level-1]]["upper_bound"] = temparray[0] + 1
+}
+/^Abbrev Number:[^(]+\(DW_TAG_/ {
+ if (match($0, /typedef|union_type|structure_type|pointer_type\
+|enumeration_type|array_type|base_type|member/, temparray)) {
+ array[idx]["special"] = temparray[0]
+ }
+}
+END {
+ PROCINFO["sorted_in"] = "compare_indices"
+ for (item in array) {
+ if (array[item]["special"] == "pointer_type") {
+ print "typedef uint" \
+ 8*array[item]["byte_size"] "_t mpers_ptr_t;"
+ break
+ }
+ }
+ for (item in array) {
+ if (array[item]["name"] == VAR_NAME) {
+ type=array[item]["type"]
+ print "typedef"
+ what_is(array[item]["type"])
+ print ARCH_FLAG "_" array[type]["name"] ";"
+ print "#define MPERS_" \
+ ARCH_FLAG "_" array[type]["name"] " " \
+ ARCH_FLAG "_" array[type]["name"]
+ break
+ }
+ }
+}
--- /dev/null
+#!/bin/sh -e
+
+export LC_ALL=C
+
+MPERS_AWK="${0%/*}/mpers.awk"
+ARCH_FLAG=$1
+PARSER_FILE=$2
+
+CC="${CC-gcc}"
+CFLAGS="$CFLAGS -gdwarf-4 -c"
+CPP="${CPP-$CC -E}"
+CPPFLAGS="$CPPFLAGS -MM -MG"
+
+VAR_NAME='mpers_target_var'
+BITS_DIR="mpers${ARCH_FLAG}"
+
+mkdir -p ${BITS_DIR}
+set -- $(sed -n \
+ 's/^#[[:space:]]*include[[:space:]]\+DEF_MPERS_TYPE(\([^)[:space:]]*\))$/\1/p' \
+ "${PARSER_FILE}")
+for m_type; do
+ f_h="${BITS_DIR}/${m_type}.h"
+ f_c="${BITS_DIR}/${m_type}.c"
+ f_i="${BITS_DIR}/${m_type}.i"
+ f_o="${BITS_DIR}/${m_type}.o"
+ f_d1="${BITS_DIR}/${m_type}.d1"
+ f_d2="${BITS_DIR}/${m_type}.d2"
+ sed -e '
+ /DEF_MPERS_TYPE('"${m_type}"')$/n
+ /DEF_MPERS_TYPE/d
+ /^[[:space:]]*#[[:space:]]*include[[:space:]]\+\"xlat\//d
+ /^#[[:space:]]*include[[:space:]]\+MPERS_DEFS$/ {s//'"${m_type} ${VAR_NAME}"';/;q}
+ ' "${PARSER_FILE}" > "${f_c}"
+ $CPP $CPPFLAGS "${f_c}" > "${f_i}"
+ grep -F -q "${m_type}.h" "${f_i}" ||
+ continue
+ sed -i -e '/DEF_MPERS_TYPE/d' "${f_c}"
+ $CC $CFLAGS $ARCH_FLAG "${f_c}" -o "${f_o}"
+ readelf --debug-dump=info "${f_o}" > "${f_d1}"
+ sed -n '
+ /^[[:space:]]*<1>/,/^[[:space:]]*<1><[^>]\+>: Abbrev Number: 0/!d
+ /^[[:space:]]*<[^>]\+><[^>]\+>: Abbrev Number: 0/d
+ s/^[[:space:]]*<[[:xdigit:]]\+>[[:space:]]\+//
+ s/^[[:space:]]*\(\(<[[:xdigit:]]\+>\)\{2\}\):[[:space:]]\+/\1\n/
+ s/[[:space:]]\+$//
+ p' "${f_d1}" > "${f_d2}"
+ gawk -v VAR_NAME="$VAR_NAME" -v ARCH_FLAG="${ARCH_FLAG#-}" \
+ -f "$MPERS_AWK" "${f_d2}" > "${f_h}"
+done
--- /dev/null
+#!/bin/sh -efu
+
+mpers_name="$1"; shift
+srcdir=${0%/*}
+mpers_sh="${srcdir}/mpers.sh"
+
+mpers_dir="mpers-$mpers_name"
+mkdir -p "$mpers_dir"
+
+sample="$mpers_dir/sample.c"
+cat > "$sample" <<EOF
+#include "mpers_type.h"
+#include DEF_MPERS_TYPE(int)
+#include MPERS_DEFS
+EOF
+
+expected="$mpers_dir/sample.expected"
+cat > "$expected" <<EOF
+#include <inttypes.h>
+typedef
+int32_t ${mpers_name}_int;
+#define MPERS_${mpers_name}_int ${mpers_name}_int
+EOF
+
+CFLAGS="$CPPFLAGS -I${srcdir}" \
+CPPFLAGS="$CPPFLAGS -I${srcdir} -DIN_MPERS -DMPERS_IS_${mpers_name}" \
+"$mpers_sh" "-$mpers_name" "$sample"
+cmp "$expected" "$mpers_dir"/int.h > /dev/null
--- /dev/null
+#ifdef IN_MPERS
+# define STRINGIFY(a) #a
+# define DEF_MPERS_TYPE(args) STRINGIFY(args.h)
+# ifdef MPERS_IS_m32
+# define MPERS_PREFIX m32_
+# define MPERS_DEFS "m32_defs.h"
+# elif defined MPERS_IS_mx32
+# define MPERS_PREFIX mx32_
+# define MPERS_DEFS "mx32_defs.h"
+# endif
+#else
+# define MPERS_PREFIX
+# define DEF_MPERS_TYPE(args) "empty.h"
+# define MPERS_DEFS "empty.h"
+#endif
};
#if SUPPORTED_PERSONALITIES > 1
+# include PERSONALITY1_INCLUDE_FUNCS
static const struct_sysent sysent1[] = {
# include "syscallent1.h"
};
#endif
#if SUPPORTED_PERSONALITIES > 2
+# include PERSONALITY2_INCLUDE_FUNCS
static const struct_sysent sysent2[] = {
# include "syscallent2.h"
};
static const struct_ioctlent ioctlent1[] = {
# include "ioctlent1.h"
};
+# include PERSONALITY0_INCLUDE_PRINTERS_DECLS
+static const struct_printers printers0 = {
+# include PERSONALITY0_INCLUDE_PRINTERS_DEFS
+};
+# include PERSONALITY1_INCLUDE_PRINTERS_DECLS
+static const struct_printers printers1 = {
+# include PERSONALITY1_INCLUDE_PRINTERS_DEFS
+};
#endif
#if SUPPORTED_PERSONALITIES > 2
static const struct_ioctlent ioctlent2[] = {
# include "ioctlent2.h"
};
+# include PERSONALITY2_INCLUDE_PRINTERS_DECLS
+static const struct_printers printers2 = {
+# include PERSONALITY2_INCLUDE_PRINTERS_DEFS
+};
#endif
enum {
const char *const *errnoent = errnoent0;
const char *const *signalent = signalent0;
const struct_ioctlent *ioctlent = ioctlent0;
+const struct_printers *printers = &printers0;
#endif
+
unsigned nsyscalls = nsyscalls0;
unsigned nerrnos = nerrnos0;
unsigned nsignals = nsignals0;
nioctlents = nioctlents0;
signalent = signalent0;
nsignals = nsignals0;
+ printers = &printers0;
break;
case 1:
nioctlents = nioctlents1;
signalent = signalent1;
nsignals = nsignals1;
+ printers = &printers1;
break;
# if SUPPORTED_PERSONALITIES > 2
nioctlents = nioctlents2;
signalent = signalent2;
nsignals = nsignals2;
+ printers = &printers2;
break;
# endif
}