From d1843238dceda9b9d2196e384dad43aabfcdae82 Mon Sep 17 00:00:00 2001 From: herengui Date: Tue, 29 Aug 2023 09:31:13 +0800 Subject: [PATCH 2/2] add loongarch support not upstream sysdeps Signed-off-by: herengui --- sysdeps/linux-gnu/sw_64/Makefile.am | 34 ++ sysdeps/linux-gnu/sw_64/Makefile.in | 629 +++++++++++++++++++++++++++ sysdeps/linux-gnu/sw_64/arch.h | 29 ++ sysdeps/linux-gnu/sw_64/plt.c | 36 ++ sysdeps/linux-gnu/sw_64/ptrace.h | 21 + sysdeps/linux-gnu/sw_64/regs.c | 61 +++ sysdeps/linux-gnu/sw_64/signalent.h | 52 +++ sysdeps/linux-gnu/sw_64/syscallent.h | 384 ++++++++++++++++ sysdeps/linux-gnu/sw_64/trace.c | 97 +++++ 9 files changed, 1343 insertions(+) create mode 100644 sysdeps/linux-gnu/sw_64/Makefile.am create mode 100644 sysdeps/linux-gnu/sw_64/Makefile.in create mode 100644 sysdeps/linux-gnu/sw_64/arch.h create mode 100644 sysdeps/linux-gnu/sw_64/plt.c create mode 100644 sysdeps/linux-gnu/sw_64/ptrace.h create mode 100644 sysdeps/linux-gnu/sw_64/regs.c create mode 100644 sysdeps/linux-gnu/sw_64/signalent.h create mode 100644 sysdeps/linux-gnu/sw_64/syscallent.h create mode 100644 sysdeps/linux-gnu/sw_64/trace.c diff --git a/sysdeps/linux-gnu/sw_64/Makefile.am b/sysdeps/linux-gnu/sw_64/Makefile.am new file mode 100644 index 0000000..5c6ecc2 --- /dev/null +++ b/sysdeps/linux-gnu/sw_64/Makefile.am @@ -0,0 +1,34 @@ +# This file is part of ltrace. +# Copyright (C) 2010 Marc Kleine-Budde, Pengutronix +# +# 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 2 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, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA +# 02110-1301 USA + +noinst_LTLIBRARIES = \ + ../libcpu.la + +___libcpu_la_SOURCES = \ + plt.c \ + regs.c \ + trace.c + +noinst_HEADERS = \ + arch.h \ + ptrace.h \ + signalent.h \ + syscallent.h + +MAINTAINERCLEANFILES = \ + Makefile.in diff --git a/sysdeps/linux-gnu/sw_64/Makefile.in b/sysdeps/linux-gnu/sw_64/Makefile.in new file mode 100644 index 0000000..8d71f51 --- /dev/null +++ b/sysdeps/linux-gnu/sw_64/Makefile.in @@ -0,0 +1,629 @@ +# Makefile.in generated by automake 1.14.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2013 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# This file is part of ltrace. +# Copyright (C) 2010 Marc Kleine-Budde, Pengutronix +# +# 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 2 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, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA +# 02110-1301 USA + + +VPATH = @srcdir@ +am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = sysdeps/linux-gnu/sw_64 +DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ + $(top_srcdir)/config/autoconf/depcomp $(noinst_HEADERS) +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/config/m4/libtool.m4 \ + $(top_srcdir)/config/m4/ltoptions.m4 \ + $(top_srcdir)/config/m4/ltsugar.m4 \ + $(top_srcdir)/config/m4/ltversion.m4 \ + $(top_srcdir)/config/m4/lt~obsolete.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +LTLIBRARIES = $(noinst_LTLIBRARIES) +___libcpu_la_LIBADD = +am____libcpu_la_OBJECTS = plt.lo regs.lo trace.lo +___libcpu_la_OBJECTS = $(am____libcpu_la_OBJECTS) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +am__dirstamp = $(am__leading_dot)dirstamp +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/config/autoconf/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(___libcpu_la_SOURCES) +DIST_SOURCES = $(___libcpu_la_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +HEADERS = $(noinst_HEADERS) +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_CFLAGS = @AM_CFLAGS@ +AM_CPPFLAGS = @AM_CPPFLAGS@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AM_LDFLAGS = @AM_LDFLAGS@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GREP = @GREP@ +HAVE_VALGRIND = @HAVE_VALGRIND@ +HOST_CPU = @HOST_CPU@ +HOST_OS = @HOST_OS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libelf_LD_LIBRARY_PATH = @libelf_LD_LIBRARY_PATH@ +liberty_LIBS = @liberty_LIBS@ +libexecdir = @libexecdir@ +libstdcxx_LIBS = @libstdcxx_LIBS@ +libsupcxx_LIBS = @libsupcxx_LIBS@ +libunwind_LD_LIBRARY_PATH = @libunwind_LD_LIBRARY_PATH@ +libunwind_LIBS = @libunwind_LIBS@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +noinst_LTLIBRARIES = \ + ../libcpu.la + +___libcpu_la_SOURCES = \ + plt.c \ + regs.c \ + trace.c + +noinst_HEADERS = \ + arch.h \ + ptrace.h \ + signalent.h \ + syscallent.h + +MAINTAINERCLEANFILES = \ + Makefile.in + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign sysdeps/linux-gnu/sw_64/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign sysdeps/linux-gnu/sw_64/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } +../$(am__dirstamp): + @$(MKDIR_P) .. + @: > ../$(am__dirstamp) + +../libcpu.la: $(___libcpu_la_OBJECTS) $(___libcpu_la_DEPENDENCIES) $(EXTRA____libcpu_la_DEPENDENCIES) ../$(am__dirstamp) + $(AM_V_CCLD)$(LINK) $(___libcpu_la_OBJECTS) $(___libcpu_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/plt.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/regs.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/trace.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + -rm -rf ../.libs ../_libs + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(HEADERS) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + -rm -f ../$(am__dirstamp) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-am + +clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-noinstLTLIBRARIES cscopelist-am ctags \ + ctags-am distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags tags-am uninstall uninstall-am + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/sysdeps/linux-gnu/sw_64/arch.h b/sysdeps/linux-gnu/sw_64/arch.h new file mode 100644 index 0000000..55400a4 --- /dev/null +++ b/sysdeps/linux-gnu/sw_64/arch.h @@ -0,0 +1,29 @@ +/* + * This file is part of ltrace. + * Copyright (C) 2004 Juan Cespedes + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA + */ + +#define BREAKPOINT_VALUE { 0x80, 0x00, 0x00, 0x00 } +#define BREAKPOINT_LENGTH 4 +#define DECR_PC_AFTER_BREAK 4 +#define ARCH_ENDIAN_LITTLE + +#define LT_ELFCLASS ELFCLASS64 +#define LT_ELF_MACHINE EM_SW_64 +#define LT_ELFCLASS2 ELFCLASS64 +#define LT_ELF_MACHINE2 EM_FAKE_SW_64 diff --git a/sysdeps/linux-gnu/sw_64/plt.c b/sysdeps/linux-gnu/sw_64/plt.c new file mode 100644 index 0000000..2e6342d --- /dev/null +++ b/sysdeps/linux-gnu/sw_64/plt.c @@ -0,0 +1,36 @@ +/* + * This file is part of ltrace. + * Copyright (C) 2004,2008,2009 Juan Cespedes + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA + */ + +#include +#include "proc.h" +#include "common.h" +#include "library.h" + +GElf_Addr +arch_plt_sym_val(struct ltelf *lte, size_t ndx, GElf_Rela *rela) +{ + return lte->plt_addr + ndx * 12 + 32; +} + +void * +sym2addr(struct process *proc, struct library_symbol *sym) +{ + return sym->enter_addr; +} diff --git a/sysdeps/linux-gnu/sw_64/ptrace.h b/sysdeps/linux-gnu/sw_64/ptrace.h new file mode 100644 index 0000000..ad7e0d6 --- /dev/null +++ b/sysdeps/linux-gnu/sw_64/ptrace.h @@ -0,0 +1,21 @@ +/* + * This file is part of ltrace. + * Copyright (C) 2004 Juan Cespedes + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA + */ + +#include diff --git a/sysdeps/linux-gnu/sw_64/regs.c b/sysdeps/linux-gnu/sw_64/regs.c new file mode 100644 index 0000000..9ccd8f2 --- /dev/null +++ b/sysdeps/linux-gnu/sw_64/regs.c @@ -0,0 +1,61 @@ +/* + * This file is part of ltrace. + * Copyright (C) 2013 Petr Machata, Red Hat Inc. + * Copyright (C) 2004,2008,2009 Juan Cespedes + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA + */ + +#include "config.h" + +#include +#include +#include + +#include "proc.h" +#include "common.h" + +#if (!defined(PTRACE_PEEKUSER) && defined(PTRACE_PEEKUSR)) +# define PTRACE_PEEKUSER PTRACE_PEEKUSR +#endif + +#if (!defined(PTRACE_POKEUSER) && defined(PTRACE_POKEUSR)) +# define PTRACE_POKEUSER PTRACE_POKEUSR +#endif + +void * +get_instruction_pointer(struct process *proc) +{ + return (void *)ptrace(PTRACE_PEEKUSER, proc->pid, 64 /* REG_PC */ , 0); +} + +void +set_instruction_pointer(struct process *proc, void *addr) +{ + ptrace(PTRACE_POKEUSER, proc->pid, 64 /* REG_PC */ , addr); +} + +void * +get_stack_pointer(struct process *proc) +{ + return (void *)ptrace(PTRACE_PEEKUSER, proc->pid, 30 /* REG_FP */ , 0); +} + +void * +get_return_addr(struct process *proc, void *stack_pointer) +{ + return (void *)ptrace(PTRACE_PEEKUSER, proc->pid, 26 /* RA */ , 0); +} diff --git a/sysdeps/linux-gnu/sw_64/signalent.h b/sysdeps/linux-gnu/sw_64/signalent.h new file mode 100644 index 0000000..e9588fa --- /dev/null +++ b/sysdeps/linux-gnu/sw_64/signalent.h @@ -0,0 +1,52 @@ +/* + * This file is part of ltrace. + * Copyright (C) 2006 Ian Wienand + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA + */ + +"SIG_0", /* 0 */ + "SIGHUP", /* 1 */ + "SIGINT", /* 2 */ + "SIGQUIT", /* 3 */ + "SIGILL", /* 4 */ + "SIGTRAP", /* 5 */ + "SIGABRT", /* 6 */ + "SIGEMT", /* 7 */ + "SIGFPE", /* 8 */ + "SIGKILL", /* 9 */ + "SIGBUS", /* 10 */ + "SIGSEGV", /* 11 */ + "SIGSYS", /* 12 */ + "SIGPIPE", /* 13 */ + "SIGALRM", /* 14 */ + "SIGTERM", /* 15 */ + "SIGURG", /* 16 */ + "SIGSTOP", /* 17 */ + "SIGTSTP", /* 18 */ + "SIGCONT", /* 19 */ + "SIGCHLD", /* 20 */ + "SIGTTIN", /* 21 */ + "SIGTTOU", /* 22 */ + "SIGIO", /* 23 */ + "SIGXCPU", /* 24 */ + "SIGXFSZ", /* 25 */ + "SIGVTALRM", /* 26 */ + "SIGPROF", /* 27 */ + "SIGWINCH", /* 28 */ + "SIGINFO", /* 29 */ + "SIGUSR1", /* 30 */ + "SIGUSR2", /* 31 */ diff --git a/sysdeps/linux-gnu/sw_64/syscallent.h b/sysdeps/linux-gnu/sw_64/syscallent.h new file mode 100644 index 0000000..586f4a2 --- /dev/null +++ b/sysdeps/linux-gnu/sw_64/syscallent.h @@ -0,0 +1,384 @@ +/* + * This file is part of ltrace. + * Copyright (C) 2006 Ian Wienand + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA + */ + + "exit", /* 1 */ + "fork", /* 2 */ + "read", /* 3 */ + "write", /* 4 */ + "close", /* 6 */ + "link", /* 9 */ + "unlink", /* 10 */ + "chdir", /* 12 */ + "fchdir", /* 13 */ + "mknod", /* 14 */ + "chmod", /* 15 */ + "chown", /* 16 */ + "brk", /* 17 */ + "lseek", /* 19 */ + "getxpid", /* 20 */ + "umount", /* 22 */ + "setuid", /* 23 */ + "getxuid", /* 24 */ + "ptrace", /* 26 */ + "access", /* 33 */ + "sync", /* 36 */ + "kill", /* 37 */ + "setpgid", /* 39 */ + "dup", /* 41 */ + "pipe", /* 42 */ + "open", /* 45 */ + "getxgid", /* 47 */ + "odd_sigprocmask", /* 48 */ + "acct", /* 51 */ + "sigpending", /* 52 */ + "ioctl", /* 54 */ + "symlink", /* 57 */ + "readlink", /* 58 */ + "execve", /* 59 */ + "umask", /* 60 */ + "chroot", /* 61 */ + "getpgrp", /* 63 */ + "vfork", /* 66 */ + "stat", /* 67 */ + "lstat", /* 68 */ + "mmap", /* 71 */ + "munmap", /* 73 */ + "mprotect", /* 74 */ + "madvise", /* 75 */ + "vhangup", /* 76 */ + "getgroups", /* 79 */ + "setgroups", /* 80 */ + "setpgrp", /* 82 */ + "gethostname", /* 87 */ + "sethostname", /* 88 */ + "dup2", /* 90 */ + "fstat", /* 91 */ + "fcntl", /* 92 */ + "poll", /* 94 */ + "fsync", /* 95 */ + "setpriority", /* 96 */ + "socket", /* 97 */ + "connect", /* 98 */ + "accept", /* 99 */ + "osf_getpriority", /* 100 */ + "send", /* 101 */ + "recv", /* 102 */ + "sigreturn", /* 103 */ + "bind", /* 104 */ + "setsockopt", /* 105 */ + "listen", /* 106 */ + "sigsuspend", /* 111 */ + "recvmsg", /* 113 */ + "sendmsg", /* 114 */ + "getsockopt", /* 118 */ + "SYS_119", /* 119 */ + "readv", /* 120 */ + "writev", /* 121 */ + "fchown", /* 123 */ + "fchmod", /* 124 */ + "recvfrom", /* 125 */ + "setreuid", /* 126 */ + "setregid", /* 127 */ + "rename", /* 128 */ + "truncate", /* 129 */ + "ftruncate", /* 130 */ + "flock", /* 131 */ + "setgid", /* 132 */ + "sendto", /* 133 */ + "shutdown", /* 134 */ + "socketpair", /* 135 */ + "mkdir", /* 136 */ + "rmdir", /* 137 */ + "getpeername", /* 141 */ + "getrlimit", /* 144 */ + "setrlimit", /* 145 */ + "setsid", /* 147 */ + "quotactl", /* 148 */ + "getsockname", /* 150 */ + "sigaction", /* 156 */ + "setdomainname", /* 166 */ + "bpf", /* 170 */ + "userfaultfd", /* 171 */ + "membarrier", /* 172 */ + "mlock2", /* 173 */ + "getpid", /* 174 */ + "getppid", /* 175 */ + "getuid", /* 176 */ + "geteuid", /* 177 */ + "getgid", /* 178 */ + "getegid", /* 179 */ + "msgctl", /* 200 */ + "msgget", /* 201 */ + "msgrcv", /* 202 */ + "msgsnd", /* 203 */ + "semctl", /* 204 */ + "semget", /* 205 */ + "semop", /* 206 */ + "lchown", /* 208 */ + "osf_shmat", /* 209 */ + "shmctl", /* 210 */ + "shmdt", /* 211 */ + "shmget", /* 212 */ + "msync", /* 217 */ + "statfs64", /* 229 */ + "fstatfs64", /* 230 */ + "getpgid", /* 233 */ + "getsid", /* 234 */ + "sigaltstack", /* 235 */ + "sysfs", /* 254 */ + "getsysinfo", /* 256 */ + "setsysinfo", /* 257 */ + "pidfd_send_signal", /* 271 */ + "io_uring_setup", /* 272 */ + "io_uring_enter", /* 273 */ + "io_uring_register", /* 274 */ + "open_tree", /* 275 */ + "move_mount", /* 276 */ + "fsopen", /* 277 */ + "fsconfig", /* 278 */ + "fsmount", /* 279 */ + "fspick", /* 280 */ + "pidfd_open", /* 281 */ + "clone3", /* 282 */ + "close_range", /* 283 */ + "openat2", /* 284 */ + "pidfd_getfd", /* 285 */ + "faccessat2", /* 286 */ + "process_madvise", /* 287 */ + "pkey_mprotect", /* 288 */ + "pkey_alloc", /* 289 */ + "pkey_free", /* 290 */ + "getpriority", /* 298 */ + "sigprocmask", /* 299 */ + "bdflush", /* 300 */ + "mount", /* 302 */ + "swapoff", /* 304 */ + "getdents", /* 305 */ + "create_module", /* 306 */ + "init_module", /* 307 */ + "delete_module", /* 308 */ + "get_kernel_syms", /* 309 */ + "syslog", /* 310 */ + "reboot", /* 311 */ + "clone", /* 312 */ + "uselib", /* 313 */ + "mlock", /* 314 */ + "munlock", /* 315 */ + "mlockall", /* 316 */ + "munlockall", /* 317 */ + "sysinfo", /* 318 */ + "oldumount", /* 321 */ + "swapon", /* 322 */ + "times", /* 323 */ + "personality", /* 324 */ + "setfsuid", /* 325 */ + "setfsgid", /* 326 */ + "ustat", /* 327 */ + "statfs", /* 328 */ + "fstatfs", /* 329 */ + "sched_setparam", /* 330 */ + "sched_getparam", /* 331 */ + "sched_setscheduler", /* 332 */ + "sched_getscheduler", /* 333 */ + "sched_yield", /* 334 */ + "sched_get_priority_max", /* 335 */ + "sched_get_priority_min", /* 336 */ + "sched_rr_get_interval", /* 337 */ + "afs_syscall", /* 338 */ + "uname", /* 339 */ + "nanosleep", /* 340 */ + "mremap", /* 341 */ + "nfsservctl", /* 342 */ + "setresuid", /* 343 */ + "getresuid", /* 344 */ + "pciconfig_read", /* 345 */ + "pciconfig_write", /* 346 */ + "query_module", /* 347 */ + "prctl", /* 348 */ + "pread", /* 349 */ + "pwrite", /* 350 */ + "rt_sigreturn", /* 351 */ + "rt_sigaction", /* 352 */ + "rt_sigprocmask", /* 353 */ + "rt_sigpending", /* 354 */ + "rt_sigtimedwait", /* 355 */ + "rt_sigqueueinfo", /* 356 */ + "rt_sigsuspend", /* 357 */ + "select", /* 358 */ + "gettimeofday", /* 359 */ + "settimeofday", /* 360 */ + "getitimer", /* 361 */ + "setitimer", /* 362 */ + "utimes", /* 363 */ + "getrusage", /* 364 */ + "wait4", /* 365 */ + "adjtimex", /* 366 */ + "getcwd", /* 367 */ + "capget", /* 368 */ + "capset", /* 369 */ + "sendfile", /* 370 */ + "setresgid", /* 371 */ + "getresgid", /* 372 */ + "dipc", /* 373, not implemented */ + "pivot_root", /* 374 */ + "mincore", /* 375 */ + "pciconfig_iobase", /* 376 */ + "getdents64", /* 377 */ + "gettid", /* 378 */ + "readahead", /* 379 */ + "tkill", /* 381 */ + "setxattr", /* 382 */ + "lsetxattr", /* 383 */ + "fsetxattr", /* 384 */ + "getxattr", /* 385 */ + "lgetxattr", /* 386 */ + "fgetxattr", /* 387 */ + "listxattr", /* 388 */ + "llistxattr", /* 389 */ + "flistxattr", /* 390 */ + "removexattr", /* 391 */ + "lremovexattr", /* 392 */ + "fremovexattr", /* 393 */ + "futex", /* 394 */ + "sched_setaffinity", /* 395 */ + "sched_getaffinity", /* 396 */ + "tuxcall", /* 397 */ + "io_setup", /* 398 */ + "io_destroy", /* 399 */ + "io_getevents", /* 400 */ + "io_submit", /* 401 */ + "io_cancel", /* 402 */ + "SYS_403", /* 403 */ + "SYS_404", /* 404 */ + "exit_group", /* 405 */ + "lookup_dcookie", /* 406 */ + "epoll_create", /* 407 */ + "epoll_ctl", /* 408 */ + "epoll_wait", /* 409 */ + "remap_file_pages", /* 410 */ + "set_tid_address", /* 411 */ + "restart_syscall", /* 412 */ + "fadvise", /* 413 */ + "timer_create", /* 414 */ + "timer_settime", /* 415 */ + "timer_gettime", /* 416 */ + "timer_getoverrun", /* 417 */ + "timer_delete", /* 418 */ + "clock_settime", /* 419 */ + "clock_gettime", /* 420 */ + "clock_getres", /* 421 */ + "clock_nanosleep", /* 422 */ + "semtimedop", /* 423 */ + "tgkill", /* 424 */ + "stat64", /* 425 */ + "lstat64", /* 426 */ + "fstat64", /* 427 */ + "vserver", /* 428 */ + "mbind", /* 429 */ + "get_mempolicy", /* 430 */ + "set_mempolicy", /* 431 */ + "mq_open", /* 432 */ + "mq_unlink", /* 433 */ + "mq_timedsend", /* 434 */ + "mq_timedreceive", /* 435 */ + "mq_notify", /* 436 */ + "mq_getsetattr", /* 437 */ + "waitid", /* 438 */ + "add_key", /* 439 */ + "request_key", /* 440 */ + "keyctl", /* 441 */ + "request_key", /* 442 */ + "ioprio_set", /* 443 */ + "inotify_init", /* 444 */ + "inotify_add_watch", /* 445 */ + "inotify_rm_watch", /* 446 */ + "fdatasync", /* 447 */ + "kexec_load", /* 448 */ + "migrate_pages", /* 449 */ + "openat", /* 450 */ + "mkdirat", /* 451 */ + "mknodat", /* 452 */ + "fchownat", /* 453 */ + "futimesat", /* 454 */ + "fstatat64", /* 455 */ + "unlinkat", /* 456 */ + "renameat", /* 457 */ + "linkat", /* 458 */ + "symlinkat", /* 459 */ + "readlinkat", /* 460 */ + "fchmodat", /* 461 */ + "faccessat", /* 462 */ + "pselect6", /* 463 */ + "ppoll", /* 464 */ + "unshare", /* 465 */ + "set_robust_list", /* 466 */ + "get_robust_list", /* 467 */ + "splice", /* 468 */ + "sync_file_range", /* 469 */ + "tee", /* 470 */ + "vmsplice", /* 471 */ + "move_pages", /* 472 */ + "getcpu", /* 473 */ + "epoll_pwait", /* 474 */ + "utimensat", /* 475 */ + "signalfd", /* 476 */ + "timerfd", /* 477 */ + "eventfd", /* 478 */ + "recvmmsg", /* 479 */ + "fallocate", /* 480 */ + "timerfd_create", /* 481 */ + "timerfd_settime", /* 482 */ + "timerfd_gettime", /* 483 */ + "signalfd4", /* 484 */ + "eventfd2", /* 485 */ + "epoll_create1", /* 486 */ + "dup3", /* 487 */ + "pipe2", /* 488 */ + "inotify_init1", /* 489 */ + "preadv", /* 490 */ + "pwritev", /* 491 */ + "rt_tgsigqueueinfo", /* 492 */ + "perf_event_open", /* 493 */ + "fanotify_init", /* 494 */ + "fanotify_mark", /* 495 */ + "prlimit64", /* 496 */ + "name_to_handle_at", /* 497 */ + "open_by_handle_at", /* 498 */ + "clock_adjtime", /* 499 */ + "syncfs", /* 500 */ + "setns", /* 501 */ + "accept4", /* 502 */ + "sendmmsg", /* 503 */ + "process_vm_readv", /* 504 */ + "process_vm_writev", /* 505 */ + "kcmp", /* 506 */ + "finit_module", /* 507 */ + "sched_setattr", /* 508 */ + "sched_getattr", /* 509 */ + "renameat2", /* 510 */ + "getrandom", /* 511 */ + "memfd_create", /* 512 */ + "execveat", /* 513 */ + "seccomp", /* 514 */ + "copy_file_range", /* 515 */ + "preadv2", /* 516 */ + "pwritev2", /* 517 */ + "statx" /* 518 */ + diff --git a/sysdeps/linux-gnu/sw_64/trace.c b/sysdeps/linux-gnu/sw_64/trace.c new file mode 100644 index 0000000..c6f7494 --- /dev/null +++ b/sysdeps/linux-gnu/sw_64/trace.c @@ -0,0 +1,97 @@ +/* + * This file is part of ltrace. + * Copyright (C) 2004,2008,2009 Juan Cespedes + * Copyright (C) 2006 Ian Wienand + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA + */ + +#include "config.h" + +#include +#include +#include +#include +#include + +#include "proc.h" +#include "common.h" +#include "debug.h" + +#if (!defined(PTRACE_PEEKUSER) && defined(PTRACE_PEEKUSR)) +# define PTRACE_PEEKUSER PTRACE_PEEKUSR +#endif + +#if (!defined(PTRACE_POKEUSER) && defined(PTRACE_POKEUSR)) +# define PTRACE_POKEUSER PTRACE_POKEUSR +#endif + +void +get_arch_dep(struct process *proc) +{ +} + +/* Returns 1 if syscall, 2 if sysret, 0 otherwise. + */ +int +syscall_p(struct process *proc, int status, int *sysnum) +{ + if (WIFSTOPPED(status) + && WSTOPSIG(status) == (SIGTRAP | proc->tracesysgood)) { + char *ip = get_instruction_pointer(proc) - 4; + long x = ptrace(PTRACE_PEEKTEXT, proc->pid, ip, 0); + debug(2, "instr: %016lx", x); + if ((x & 0xffffffff) != 0x00000083) + return 0; + *sysnum = + ptrace(PTRACE_PEEKUSER, proc->pid, 0 /* REG_R0 */ , 0); + if (proc->callstack_depth > 0 && + proc->callstack[proc->callstack_depth - 1].is_syscall && + proc->callstack[proc->callstack_depth - 1].c_un.syscall == *sysnum) { + return 2; + } + if (*sysnum >= 0 && *sysnum < 500) { + return 1; + } + } + return 0; +} + +long +gimme_arg(enum tof type, struct process *proc, int arg_num, + struct arg_type_info *info) +{ + if (arg_num == -1) { /* return value */ + return ptrace(PTRACE_PEEKUSER, proc->pid, 0 /* REG_R0 */ , 0); + } + + if (type == LT_TOF_FUNCTION || type == LT_TOF_FUNCTIONR) { + if (arg_num <= 5) + return ptrace(PTRACE_PEEKUSER, proc->pid, + arg_num + 16 /* REG_A0 */ , 0); + else + return ptrace(PTRACE_PEEKTEXT, proc->pid, + proc->stack_pointer + 8 * (arg_num - 6), + 0); + } else if (type == LT_TOF_SYSCALL || type == LT_TOF_SYSCALLR) { + return ptrace(PTRACE_PEEKUSER, proc->pid, + arg_num + 16 /* REG_A0 */ , 0); + } else { + fprintf(stderr, "gimme_arg called with wrong arguments\n"); + exit(1); + } + return 0; +} -- 2.41.0