Commit Graph

19 Commits

Author SHA1 Message Date
Gabriel Laskar
cba67108a0 Add configure --enable-code-coverage option
* m4/ax_code_coverage.m4: New file.
* configure.ac: Use AX_CODE_COVERAGE.
* Makefile.am: Add @CODE_COVERAGE_RULES@.
(CODE_COVERAGE_LCOV_OPTIONS, CODE_COVERAGE_GENHTML_OPTIONS,
CODE_COVERAGE_IGNORE_PATTERN): New variables.
(strace_CPPFLAGS): Add $(CODE_COVERAGE_CPPFLAGS).
(strace_CFLAGS): Add $(CODE_COVERAGE_CFLAGS).
(strace_LDADD): Add $(CODE_COVERAGE_LDFLAGS).
* .gitignore: Add *.gcda and *.gcno.

Signed-off-by: Gabriel Laskar <gabriel@lse.epita.fr>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
2016-02-04 03:36:11 +00:00
db9af94715 .gitignore: add mpers_xlat.h
Ignore mpers_xlat.h generated since commit v4.10-454-g5cb45b2.

* .gitignore: Add /mpers_xlat.h.

Reported-by: Elvira Khabirova <lineprinter0@gmail.com>
2015-11-26 01:49:36 +00:00
370eb16ed2 Fix *_printer_defs.h rules ambiguousness
There is an ambiguousness in *_printer_defs.h rules definition:

$ grep '^[^ ]*_defs\.h: ' Makefile.am
m%_defs.h: $(srcdir_mpers_source_files)
%_printer_defs.h: $(srcdir_mpers_source_files)

While it appears to work with GNU make, it has to be fixed nevertheless.

* Makefile.am (m%_defs.h): Rename to m%_type_defs.h.
(mpers_m32_targets): Rename m32_defs.h to m32_type_defs.h.
(mpers_mx32_targets): Rename mx32_defs.h to mx32_type_defs.h.
* mpers_type.h: Rename m32_defs.h to m32_type_defs.h,
mx32_defs.h to mx32_type_defs.h.
* .gitignore: Likewise.

Reported-by: Elliott Hughes <enh@google.com>
2015-11-07 23:33:47 +00:00
Elvira Khabirova
092942206c Add mpers support
Add a subsystem for semi-automatical definition of how parsers should
work with personality-dependent (mpers) types of tracee's data.  Create
auxiliary libraries containing mpers syscall parsers and printer
functions, one library for each possible nonnative target personality.

Currently some parsers do not handle differences in definitions of data
types between personalities, namely LP64 and ILP32.  When
this is the case, long integers, pointers, and all compound
types containing long and pointer members may be printed incorrectly,
because of differences in sizes, offsets and alignments.

Since in most cases these are the only differences in desired behaviour
of parsers and printers for different personalities, a correct way
would be to compile one source code into multiple parsers, differing
only in definitions of mpers types.

To get a definition of a given type for nonnative personality
a very basic .c file containing a declaration of a variable of this type
is being compiled for this personality (using -m32 or -mx32 compiler
flag).  Information about the type is then being extracted from
this binary's DWARF debug info with an awk script and put
into a corresponding header file.  Resulting headers are being used to
compile mpers variations of syscall parsers and printer functions.

In addition to syscall parsers, there can occur a need to create mpers
printing functions, which then can be called from many places
in the code (for example, printsiginfo_at).  Such functions (printers)
are marked in a special manner.

For each possible nonnative target personality a library is being
created, containing mpers variations of syscall parsers and printers.
Only syscall parsers from files marked in a special manner and specially
marked functions from such files are being recompiled and included
in these libraries.

generate_mpers_am.sh is called by bootstrap to find the files
from strace_SOURCES which include MPERS_DEFS.  During compilation,
these files are being inspected for inclusions of DEF_MPERS_TYPE,
and nonnative variations of each included type are being generated
by an awk script.

Mpers parser names are being modified during inclusions of syscallent
headers for nonnative personalities.  Pointers to printers are
being stored in structs struct_printers, and a master
pointer printers is being updated on every set_personality.

* README-mpers: New README explaining how to use mpers support.
* empty.h: New empty file.
* generate_mpers_am.sh: New file.
* mpers.awk: Likewise.
* mpers.sh: Likewise.
* mpers_test.sh: Likewise.
* mpers_type.h: Likewise.
* Makefile.am (strace_SOURCES): Add empty.h and mpers_type.h.
(strace_CPPFLAGS, strace_LDFLAGS, strace_LDADD): Move to the beginning
of the file.
(strace_LDADD, noinst_LIBRARIES): Add libmpers-%.a.
(EXTRA_DIST): Add mpers.awk, mpers.sh, mpers_test.sh.
(BUILT_SOURCES, CLEANFILES): Add new generated files:
native_printer_decls.h, native_printer_defs.h, printers.h,
[HAVE_M32_MPERS] $(mpers_m32_targets), and [HAVE_MX32_MPERS]
$(mpers_mx32_targets).
(mpers_NAME, mpers_PREFIX, mpers_DEFS, mpers_INCLUDES, mpers_CPPFLAGS,
mpers_sh_opts, libmpers_CPPFLAGS, libmpers_m[x]32_a_SOURCES,
libmpers_m[x]32_a_CPPFLAGS, mpers_m[x]32_targets): New variables.
(mpers-m[x]32.stamp, m[x]32_defs.h, m[x]32_funcs.h, printers.h,
%_printer_decls.h, %_printer_defs.h, clean-local,
native_printer_decls.h, native_printer_defs.h, $mpers_m[x]32_targets):
New targets.
* bootstrap: Add generate_mpers_am.sh.
* configure.ac: Add AC_PROG_RANLIB.
* m4/mpers.m4: Add HAVE_MPERS variable.  Add $st_cv_mpers checks.
* defs.h: Include mpers_type.h.
Include printers.h, native_printer_decls.h, define MPERS_PRINTER_NAME.
Redefine SYS_FUNC_NAME.  Define MPERS_PRINTER_DECL.
[HAVE_M32_MPERS]: define PERSONALITY1_INCLUDE_FUNCS,
PERSONALITY1_INCLUDE_PRINTERS_DECLS, PERSONALITY1_INCLUDE_PRINTERS_DEFS
for X86_64, X32.
[HAVE_MX32_MPERS]: define PERSONALITY2_INCLUDE_FUNCS,
PERSONALITY2_INCLUDE_PRINTERS_DECLS, PERSONALITY2_INCLUDE_PRINTERS_DEFS
for X86_64.
Add fallback definitions of
PERSONALITY1_INCLUDE_FUNCS, PERSONALITY2_INCLUDE_FUNCS,
PERSONALITY0_INCLUDE_PRINTERS_DECLS, PERSONALITY0_INCLUDE_PRINTERS_DEFS,
PERSONALITY1_INCLUDE_PRINTERS_DECLS, PERSONALITY1_INCLUDE_PRINTERS_DEFS,
PERSONALITY2_INCLUDE_PRINTERS_DECLS, PERSONALITY2_INCLUDE_PRINTERS_DEFS.
* syscall.c: Include PERSONALITY1_INCLUDE_FUNCS,
PERSONALITY2_INCLUDE_FUNCS,
PERSONALITY0_INCLUDE_PRINTERS_DECLS, PERSONALITY0_INCLUDE_PRINTERS_DEFS,
PERSONALITY1_INCLUDE_PRINTERS_DECLS, PERSONALITY1_INCLUDE_PRINTERS_DEFS,
PERSONALITY2_INCLUDE_PRINTERS_DECLS, PERSONALITY2_INCLUDE_PRINTERS_DEFS.
(printers): New struct.  Update it when needed.
* .gitignore: Add 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, and printers.h.
2015-08-28 08:46:23 +00:00
Elvira Khabirova
af86bd5bb3 .gitignore: add sen.h and sys_func.h 2015-08-20 22:21:04 +03:00
Mike Frysinger
bf8dfe8aaf ignore core/compile files
Newer autotools includes a compile helper script.

* .gitignore: Add /compile and core.
2015-02-26 20:00:03 +00:00
679c47c348 tests: run tests for each supported personality
When strace supports more than one personality, run test suite
for each personality supported by the host system.

* bootstrap: Create tests-m32 and tests-mx32 subtrees from tests.
* configure.ac: Check for -m32 and -mx32 runtime support.
(AC_CONFIG_FILES): Add tests-m32/Makefile and tests-mx32/Makefile.
* Makefile.am [HAVE_M32_RUNTIME] (TESTS_M32): Define.
[HAVE_MX32_RUNTIME] (TESTS_MX32): Define.
(SUBDIRS): Add $(TESTS_M32) $(TESTS_MX32).
* .gitignore: Add /tests-m32 and /tests-mx32.
2015-01-24 03:39:34 +00:00
df7aa2b19e ioctl: take all 32 bits of ioctl commands into account
Historically, only 16 bits (8-bit number and 8-bit type) of 32-bit ioctl
commands were used for decoding, which was the source for numerous
annoying collisions like this:

	ioctl(0, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, {B38400 opost isig icanon echo ...}) = 0
	ioctl(0, MGSL_IOCGPARAMS or MMTIMER_GETRES or MTIOCTOP or SNDCTL_MIDI_MPUMODE, 0x7fffd47f7338) = -1 ENOTTY (Inappropriate ioctl for device)

The solution is to use all 32 bits for decoding, not just "number" and
"type", but also "size" and "direction".

As some architectures override defaults that come from asm-generic/ and
provide alternative definitions for some ioctl commands, we support
per-architecture ioctl definitions and merge them with common
definitions at build time.  During the merge, we used to keep both
generic and architecture-specific definitions, now architecture-specific
definitions have precedence over generic ones -- ioctlsort omits
definitions from asm-generic/ for those ioctl names that have different
definitions in asm/.

Additional bits of "direction" are architecture specific -- the number
of bits and their values differ between architectures.  To reduce
architecture differences in the source code, we keep "direction" in
symbolic form and compile it in ioctlsort.

Additional bits of "size" are also architecture specific -- not only the
number of bits differ between architectures, but sizes of many types
depend on sizeof(long).  To reduce architecture differences in the
source code, we keep 32-bit and 64-bit versions of common ioctl
definitions, and use the appropriate version for each architecture and
personality.

To implement this, the tools for generating ioctl definitions from
kernel headers have been rewritten, and the source format of ioctl
definitions has been extended.   The final ioctlent*.h files that are
included by syscall.c are now generated from source ioctls_inc*.h and
ioctls_arch*.h files at build time with ioctlsort.

* ioctl.c (ioctl_lookup): Use all 32 bits of ioctl command code.
* ioctlsort.c: Rewritten.
* linux/32/ioctls_inc.h: New file.
* linux/64/ioctls_inc.h: New file.
* linux/aarch64/ioctls_arch0.h: New file.
* linux/aarch64/ioctls_arch1.h: New file.
* linux/aarch64/ioctls_inc0.h: New file.
* linux/aarch64/ioctls_inc1.h: New file.
* linux/alpha/ioctls_arch0.h: New file.
* linux/alpha/ioctls_inc0.h: New file.
* linux/arc/ioctls_arch0.h: New file.
* linux/arc/ioctls_inc0.h: New file.
* linux/arm/ioctls_arch0.h: New file.
* linux/arm/ioctls_inc0.h: New file.
* linux/avr32/ioctls_arch0.h: New file.
* linux/avr32/ioctls_inc0.h: New file.
* linux/bfin/ioctls_arch0.h: New file.
* linux/bfin/ioctls_inc0.h: New file.
* linux/hppa/ioctls_arch0.h: New file.
* linux/hppa/ioctls_inc0.h: New file.
* linux/i386/ioctls_arch0.h: New file.
* linux/i386/ioctls_inc0.h: New file.
* linux/ia64/ioctls_arch0.h: New file.
* linux/ia64/ioctls_inc0.h: New file.
* linux/m68k/ioctls_arch0.h: New file.
* linux/m68k/ioctls_inc0.h: New file.
* linux/metag/ioctls_arch0.h: New file.
* linux/metag/ioctls_inc0.h: New file.
* linux/microblaze/ioctls_arch0.h: New file.
* linux/microblaze/ioctls_inc0.h: New file.
* linux/mips/ioctls_arch0.h: New file.
* linux/mips/ioctls_inc0.h: New file.
* linux/or1k/ioctls_arch0.h: New file.
* linux/or1k/ioctls_inc0.h: New file.
* linux/powerpc/ioctls_arch0.h: New file.
* linux/powerpc/ioctls_inc0.h: New file.
* linux/powerpc64/ioctls_arch0.h: New file.
* linux/powerpc64/ioctls_arch1.h: New file.
* linux/powerpc64/ioctls_inc0.h: New file.
* linux/powerpc64/ioctls_inc1.h: New file.
* linux/s390/ioctls_arch0.h: New file.
* linux/s390/ioctls_inc0.h: New file.
* linux/s390x/ioctls_arch0.h: New file.
* linux/s390x/ioctls_inc0.h: New file.
* linux/sh/ioctls_arch0.h: New file.
* linux/sh/ioctls_inc0.h: New file.
* linux/sh64/ioctls_arch0.h: New file.
* linux/sh64/ioctls_inc0.h: New file.
* linux/sparc/ioctls_arch0.h: New file.
* linux/sparc/ioctls_inc0.h: New file.
* linux/sparc64/ioctls_arch0.h: New file.
* linux/sparc64/ioctls_arch2.h: New file.
* linux/sparc64/ioctls_inc0.h: New file.
* linux/sparc64/ioctls_inc2.h: New file.
* linux/tile/ioctls_arch0.h: New file.
* linux/tile/ioctls_arch1.h: New file.
* linux/tile/ioctls_inc0.h: New file.
* linux/tile/ioctls_inc1.h: New file.
* linux/x32/ioctls_arch0.h: New file.
* linux/x32/ioctls_arch1.h: New file.
* linux/x32/ioctls_inc0.h: New file.
* linux/x32/ioctls_inc1.h: New file.
* linux/x86_64/ioctls_arch0.h: New file.
* linux/x86_64/ioctls_arch1.h: New file.
* linux/x86_64/ioctls_inc0.h: New file.
* linux/x86_64/ioctls_inc1.h: New file.
* linux/xtensa/ioctls_arch0.h: New file.
* linux/xtensa/ioctls_inc0.h: New file.
* linux/aarch64/ioctlent.h.in: Remove.
* linux/aarch64/ioctlent1.h: Remove.
* linux/alpha/ioctlent.h.in: Remove.
* linux/arc/ioctlent.h.in: Remove.
* linux/arm/ioctlent.h.in: Remove.
* linux/avr32/ioctlent.h.in: Remove.
* linux/bfin/ioctlent.h.in: Remove.
* linux/hppa/ioctlent.h.in: Remove.
* linux/i386/ioctlent.h.in: Remove.
* linux/ia64/ioctlent.h.in: Remove.
* linux/ioctlent.h.in: Remove.
* linux/ioctlent.sh: Remove.
* linux/m68k/ioctlent.h.in: Remove.
* linux/metag/ioctlent.h.in: Remove.
* linux/microblaze/ioctlent.h.in: Remove.
* linux/mips/ioctlent.h.in: Remove.
* linux/mips/ioctlent.sh: Remove.
* linux/or1k/ioctlent.h.in: Remove.
* linux/powerpc/ioctlent.h.in: Remove.
* linux/powerpc64/ioctlent.h: Remove.
* linux/powerpc64/ioctlent1.h: Remove.
* linux/s390/ioctlent.h.in: Remove.
* linux/s390x/ioctlent.h.in: Remove.
* linux/sh/ioctlent.h.in: Remove.
* linux/sh64/ioctlent.h.in: Remove.
* linux/sparc/ioctlent.h.in: Remove.
* linux/sparc64/ioctlent.h.in: Remove.
* linux/sparc64/ioctlent2.h: Remove.
* linux/tile/ioctlent.h.in: Remove.
* linux/tile/ioctlent1.h: Remove.
* linux/x32/ioctlent.h.in: Remove.
* linux/x32/ioctlent1.h: Remove.
* linux/x86_64/ioctlent.h.in: Remove.
* linux/x86_64/ioctlent1.h: Remove.
* linux/xtensa/ioctlent.h.in: Remove.
* linux/x86_64/ioctlent2.h: Include ioctlent0.h instead of ioctlent.h.
* syscall.c (struct_ioctlent ioctlent0): Likewise.
* Makefile.am: Remove all ioctlent-related definitions.
Define the list of ioctlent*.h files that have to be generated by
presence of $(srcdir)/$(OS)/$(ARCH)/ioctls_inc*.h files.
Add rules for ioctlent*.h files generation.
(EXTRA_DIST): Update.
* maint/ioctls_gen.sh: New file.
* maint/ioctls_hex.sh: New file.
* maint/ioctls_sym.sh: New file.
* maint/print_ioctlent.c: New file.
* HACKING-scripts: Update for ioctlent.sh -> ioctls_gen.sh migration.
* .gitignore: Add ioctlent[012].h and ioctls_all[012].h.
* configure.ac (AC_CHECK_HEADERS): Add linux/hiddev.h
and linux/mmtimer.h for tests.
* tests/ioctl.c: New file.
* tests/ioctl.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add ioctl.
(TESTS): Add ioctl.test.
* tests/.gitignore: Add ioctl.
2015-01-22 00:27:38 +00:00
Mike Frysinger
d26d011078 Ignore more files
* .gitignore: Add gdb related files.
* tests/.gitignore: Ignore test logs.
2013-05-02 22:06:12 +00:00
dce7593cab build: introduce git-version-gen
* .gitignore: Add .version.
* Makefile.am (EXTRA_DIST, BUILT_SOURCES): Add $(srcdir)/.version.
Add rules to check NEWS, generate $(srcdir)/.version and
$(distdir)/.tarball-version files.
Change ChangeLog and CREDITS generation rules to depend on
$(srcdir)/.version instead of $(srcdir)/.git/refs/heads/*.
* NEWS: Add dates to recent releases.
* configure.ac (AC_INIT): Use git-version-gen.
(AM_INIT_AUTOMAKE): Remove check-news.
* git-version-gen: Import from gnulib.
* make-dist: Check NEWS.
2013-04-30 23:52:12 +00:00
Mike Frysinger
9004e12a91 linux/ioctlent: unify them all
This unifies all the ioctlent.h's in the linux subdir while still
allowing each arch to maintain its own minor list.

The basic method is:
- each arch has linux/<arch>/ioctlent.h.in which defines only the
arch-specific ioctls;
- linux/ioctlent.h.in which defines only the common ioctls;
- at build time, these two headers are combined and sorted to produce
the linux/ioctlent.h file.

This also requires a little tweaking of the include files since the
common ioctlent.h is a built file.

* linux/ioctlent.h: Split into linux/ioctlent.h.in and
linux/i386/ioctlent.h.in, remove asm entries from the former, remove
non-asm entries from the latter.
* linux/alpha/ioctlent.h: Rename to linux/alpha/ioctlent.h.in, remove
non-asm entries.
* linux/bfin/ioctlent.h: Rename to linux/bfin/ioctlent.h.in, remove
non-asm entries.
* linux/hppa/ioctlent.h: Rename to linux/hppa/ioctlent.h.in, remove
non-asm entries.
* linux/ia64/ioctlent.h: Rename to linux/ia64/ioctlent.h.in, remove
non-asm entries.
* linux/mips/ioctlent.h: Rename to linux/mips/ioctlent.h.in, remove
non-asm entries.
* linux/powerpc/ioctlent.h: Rename to linux/powerpc/ioctlent.h.in,
remove non-asm entries.
* linux/s390/ioctlent.h: Rename to linux/s390/ioctlent.h.in, remove
non-asm entries.
* linux/sh/ioctlent.h: Rename to linux/sh/ioctlent.h.in, remove
non-asm entries.
* linux/sparc/ioctlent.h: Rename to linux/sparc/ioctlent.h.in, remove
non-asm entries.
* linux/arm/ioctlent.h.in: New file.
* linux/avr32/ioctlent.h.in: Likewise.
* linux/i386/ioctlent.h.in: Likewise.
* linux/m68k/ioctlent.h.in: Likewise.
* linux/microblaze/ioctlent.h.in: Likewise.
* linux/tile/ioctlent.h.in: Likewise.
* linux/x86_64/ioctlent.h.in: Likewise.
* linux/s390x/ioctlent.h.in: Include ioctlent.h.in instead of
ioctlent.h.
* linux/sh64/ioctlent.h.in: Likewise.
* linux/sparc64/ioctlent.h.in: Likewise.
* linux/arm/ioctlent1.h: Update ioctlent.h include.
* linux/powerpc/ioctlent1.h: Likewise.
* linux/sparc/ioctlent1.h: Likewise.
* linux/sparc64/ioctlent1.h: Likewise.
* linux/x86_64/ioctlent1.h: Likewise.
* Makefile.am (AM_CPPFLAGS): Add -I$(builddir)/$(OS).
(EXTRA_DIST): Update.
[MAINTAINER_MODE && LINUX]: Convert from ioctlent_h to ioctlent_h_in.
[LINUX]: Add $(builddir)/$(OS)/ioctlent.h generation rules.
* .gitignore: Add linux/ioctlent.h.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-03-14 15:32:38 +00:00
525a39a01a Generate an xz tar archive of the distribution
* configure.ac (AM_INIT_AUTOMAKE): Replace dist-bzip2 with dist-xz.
* Makefile.am: Update srpm target.
* make-dist: Update for dist-xz.
* strace.spec: Update Source tag.
* debian/watch: Update regexp.
* .gitignore: Add strace-*.tar.xz.
2011-02-27 14:05:58 +00:00
796d3a8679 Ignore generated intermediate header files
* .gitignore: Add ioctls.h and ioctldefs.h.
2011-02-25 16:47:51 +00:00
59138a2b0d Generate much of the CREDITS file from git log
* CREDITS.in: New file, derived from CREDITS, without names of
those who are listed as git log 'Author:'s.
* CREDITS: Remove file.
* Makefile.am [MAINTAINER_MODE] (CREDITS): New rule.
* .gitignore: Add CREDITS.
* .mailmap: New file, required to map git author names and email
addresses to canonical/preferred form.
2011-02-24 01:51:15 +00:00
Mike Frysinger
aab05bd713 Ignore .gdb files from FLAT toolchains
* .gitignore: Add /*.gdb.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2009-10-07 19:06:22 +00:00
Mike Frysinger
8b1218e5ff Ignore ioctlsort helper program
* .gitignore: Add ioctlsort.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2009-09-18 12:07:02 +00:00
08f922a574 Generate ChangeLog from git log
* .gitignore: Add ChangeLog
* ChangeLog: Rename to ChangeLog-CVS.
* Makefile.am (gen-changelog): New rule.
(dist-hook): Depend on it.
(EXTRA_DIST): Add ChangeLog-CVS.
* README-hacking: Describe changes.
* gitlog-to-changelog: Import from gnulib.

Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
2009-07-08 21:01:21 +00:00
Denys Vlasenko
8ed5727642 By Hans-Christian Egtvedt (hans-christian.egtvedt AT atmel.com):
strace.c: suppress "warning: unused static" message by adding #ifdef's around
 a variable
.gitignore: trivial
test/*.c: cleanup (suppress warnings, much better style).
2009-02-25 14:24:02 +00:00
Denys Vlasenko
c43a515f3b More cleanups from Mike Frysingler:
README: update an URL
.gitignore: added
config.guess config.sub install-sh: removed, they are revenerated
 by autoconf anyway
2009-02-23 08:07:45 +00:00