scanmem-0.13/0000775000175000017500000000000012002431472010056 500000000000000scanmem-0.13/list.h0000644000175000017500000000147711311453216011133 00000000000000/* $Id: list.h,v 1.9 2007-06-05 01:45:35+01 taviso Exp $ A very simple linked list implementation. */ #ifndef _LIST_INC #define _LIST_INC typedef struct element { void *data; struct element *next; } element_t; typedef struct { unsigned size; element_t *head; element_t *tail; } list_t; /* create a new list */ list_t *l_init(void); /* destroy the whole list */ void l_destroy(list_t * list); /* add a new element to the list */ int l_append(list_t * list, element_t * element, void *data); /* remove the element at element->next */ void l_remove(list_t * list, element_t * element, void **data); /* remove the nth element from head */ void l_remove_nth(list_t * list, unsigned n, void **data); /* remove all elements from *src, and append to dst */ int l_concat(list_t *dst, list_t **src); #endif scanmem-0.13/README0000644000175000017500000000230111321346621010654 00000000000000$Id: README,v 1.5 2007-06-05 19:58:02+01 taviso Exp $ Scanmem ============ scanmem is a debugging utility designed to isolate the address of an arbitrary variable in an executing process. scanmem simply needs to be told the pid of the process, and the value of the variable at several different times. After several scans of the process, scanmem isolates the position of the variable and allows you to modify it's value. Requirements ============ scanmem requires libreadline to read commands interactively, and /proc must be mounted. Install ======= To build with gui: ./configure --enable-gui && make sudo make install To build without gui: ./configure && make sudo make install GUI === Now scanmem has a GUI front-end called GameConqueror, to use it, add --enable-gui when configure See gui/README for more detail. Known Issues ============ * some hardened systems have unusable maps files, where all entries are zeroed. * the snapshot command uses too much memory on large processes. * performance is currently very poor. Author: Tavis Ormandy Eli Dupree WANG Lu License: GPLv3 scanmem-0.13/Makefile.in0000644000175000017500000014154011553203351012051 00000000000000# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 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@ VPATH = @srcdir@ 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 = : @ENABLE_GUI_TRUE@am__append_1 = gui @ENABLE_GUI_FALSE@am__append_2 = bin_PROGRAMS = scanmem$(EXEEXT) subdir = . DIST_COMMON = README $(am__configure_deps) $(dist_doc_DATA) \ $(dist_man_MANS) $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ $(srcdir)/config.h.in $(top_srcdir)/configure COPYING \ ChangeLog NEWS TODO depcomp install-sh missing ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno config.status.lineno mkinstalldirs = $(install_sh) -d CONFIG_HEADER = config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)" \ "$(DESTDIR)$(docdir)" PROGRAMS = $(bin_PROGRAMS) am_scanmem_OBJECTS = scanmem-main.$(OBJEXT) scanmem-maps.$(OBJEXT) \ scanmem-ptrace.$(OBJEXT) \ scanmem-target_memory_info_array.$(OBJEXT) \ scanmem-list.$(OBJEXT) scanmem-menu.$(OBJEXT) \ scanmem-commands.$(OBJEXT) scanmem-handlers.$(OBJEXT) \ scanmem-value.$(OBJEXT) scanmem-scanroutines.$(OBJEXT) \ scanmem-show_message.$(OBJEXT) scanmem_OBJECTS = $(am_scanmem_OBJECTS) scanmem_LDADD = $(LDADD) scanmem_LINK = $(CCLD) $(scanmem_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ DEFAULT_INCLUDES = -I.@am__isrc@ depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(scanmem_SOURCES) DIST_SOURCES = $(scanmem_SOURCES) RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ install-dvi-recursive install-exec-recursive \ install-html-recursive install-info-recursive \ install-pdf-recursive install-ps-recursive install-recursive \ installcheck-recursive installdirs-recursive pdf-recursive \ ps-recursive uninstall-recursive am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' man1dir = $(mandir)/man1 NROFF = nroff MANS = $(dist_man_MANS) DATA = $(dist_doc_DATA) RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ distdir dist dist-all distcheck ETAGS = etags CTAGS = ctags DIST_SUBDIRS = test gui DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) am__remove_distdir = \ { test ! -d "$(distdir)" \ || { find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ && rm -fr "$(distdir)"; }; } am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" DIST_ARCHIVES = $(distdir).tar.gz GZIP_ENV = --best distuninstallcheck_listfiles = find . -type f -print distcleancheck_listfiles = find . -type f -print ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ 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@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ OBJEXT = @OBJEXT@ 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@ PKGDATADIR = @PKGDATADIR@ POW_LIB = @POW_LIB@ 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_CC = @ac_ct_CC@ 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_alias = @build_alias@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host_alias = @host_alias@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ 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@ # $Id: Makefile.am,v 1.5 2007-04-14 18:47:39+01 taviso Exp $ SUBDIRS = test $(am__append_1) $(am__append_2) scanmem_SOURCES = main.c maps.c ptrace.c target_memory_info_array.c \ list.c menu.c commands.c handlers.c value.c commands.h \ handlers.h interrupt.h list.h scanmem.h value.h licence.h \ maps.h target_memory_info_array.h scanroutines.h \ scanroutines.c show_message.h show_message.c scanmem_CFLAGS = -O2 -g -Wall dist_man_MANS = scanmem.1 dist_doc_DATA = README EXTRA_DIST = gpl-2.0.txt gpl-3.0.txt all: config.h $(MAKE) $(AM_MAKEFLAGS) all-recursive .SUFFIXES: .SUFFIXES: .c .o .obj am--refresh: @: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ echo ' cd $(srcdir) && $(AUTOMAKE) --foreign'; \ $(am__cd) $(srcdir) && $(AUTOMAKE) --foreign \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ echo ' $(SHELL) ./config.status'; \ $(SHELL) ./config.status;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck $(top_srcdir)/configure: $(am__configure_deps) $(am__cd) $(srcdir) && $(AUTOCONF) $(ACLOCAL_M4): $(am__aclocal_m4_deps) $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) $(am__aclocal_m4_deps): config.h: stamp-h1 @if test ! -f $@; then \ rm -f stamp-h1; \ $(MAKE) $(AM_MAKEFLAGS) stamp-h1; \ else :; fi stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status @rm -f stamp-h1 cd $(top_builddir) && $(SHELL) ./config.status config.h $(srcdir)/config.h.in: $(am__configure_deps) ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) rm -f stamp-h1 touch $@ distclean-hdr: -rm -f config.h stamp-h1 install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)" @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ for p in $$list; do echo "$$p $$p"; done | \ sed 's/$(EXEEXT)$$//' | \ while read p p1; do if test -f $$p; \ then echo "$$p"; echo "$$p"; else :; fi; \ done | \ sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ sed 'N;N;N;s,\n, ,g' | \ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ if ($$2 == $$4) files[d] = files[d] " " $$1; \ else { print "f", $$3 "/" $$4, $$1; } } \ END { for (d in files) print "f", d, files[d] }' | \ while read type dir files; do \ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ test -z "$$files" || { \ echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ } \ ; done uninstall-binPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ -e 's/$$/$(EXEEXT)/' `; \ test -n "$$list" || exit 0; \ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(bindir)" && rm -f $$files clean-binPROGRAMS: -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) scanmem$(EXEEXT): $(scanmem_OBJECTS) $(scanmem_DEPENDENCIES) @rm -f scanmem$(EXEEXT) $(scanmem_LINK) $(scanmem_OBJECTS) $(scanmem_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scanmem-commands.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scanmem-handlers.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scanmem-list.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scanmem-main.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scanmem-maps.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scanmem-menu.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scanmem-ptrace.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scanmem-scanroutines.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scanmem-show_message.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scanmem-target_memory_info_array.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scanmem-value.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` scanmem-main.o: main.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(scanmem_CFLAGS) $(CFLAGS) -MT scanmem-main.o -MD -MP -MF $(DEPDIR)/scanmem-main.Tpo -c -o scanmem-main.o `test -f 'main.c' || echo '$(srcdir)/'`main.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/scanmem-main.Tpo $(DEPDIR)/scanmem-main.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='main.c' object='scanmem-main.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(scanmem_CFLAGS) $(CFLAGS) -c -o scanmem-main.o `test -f 'main.c' || echo '$(srcdir)/'`main.c scanmem-main.obj: main.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(scanmem_CFLAGS) $(CFLAGS) -MT scanmem-main.obj -MD -MP -MF $(DEPDIR)/scanmem-main.Tpo -c -o scanmem-main.obj `if test -f 'main.c'; then $(CYGPATH_W) 'main.c'; else $(CYGPATH_W) '$(srcdir)/main.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/scanmem-main.Tpo $(DEPDIR)/scanmem-main.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='main.c' object='scanmem-main.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(scanmem_CFLAGS) $(CFLAGS) -c -o scanmem-main.obj `if test -f 'main.c'; then $(CYGPATH_W) 'main.c'; else $(CYGPATH_W) '$(srcdir)/main.c'; fi` scanmem-maps.o: maps.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(scanmem_CFLAGS) $(CFLAGS) -MT scanmem-maps.o -MD -MP -MF $(DEPDIR)/scanmem-maps.Tpo -c -o scanmem-maps.o `test -f 'maps.c' || echo '$(srcdir)/'`maps.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/scanmem-maps.Tpo $(DEPDIR)/scanmem-maps.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='maps.c' object='scanmem-maps.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(scanmem_CFLAGS) $(CFLAGS) -c -o scanmem-maps.o `test -f 'maps.c' || echo '$(srcdir)/'`maps.c scanmem-maps.obj: maps.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(scanmem_CFLAGS) $(CFLAGS) -MT scanmem-maps.obj -MD -MP -MF $(DEPDIR)/scanmem-maps.Tpo -c -o scanmem-maps.obj `if test -f 'maps.c'; then $(CYGPATH_W) 'maps.c'; else $(CYGPATH_W) '$(srcdir)/maps.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/scanmem-maps.Tpo $(DEPDIR)/scanmem-maps.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='maps.c' object='scanmem-maps.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(scanmem_CFLAGS) $(CFLAGS) -c -o scanmem-maps.obj `if test -f 'maps.c'; then $(CYGPATH_W) 'maps.c'; else $(CYGPATH_W) '$(srcdir)/maps.c'; fi` scanmem-ptrace.o: ptrace.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(scanmem_CFLAGS) $(CFLAGS) -MT scanmem-ptrace.o -MD -MP -MF $(DEPDIR)/scanmem-ptrace.Tpo -c -o scanmem-ptrace.o `test -f 'ptrace.c' || echo '$(srcdir)/'`ptrace.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/scanmem-ptrace.Tpo $(DEPDIR)/scanmem-ptrace.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ptrace.c' object='scanmem-ptrace.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(scanmem_CFLAGS) $(CFLAGS) -c -o scanmem-ptrace.o `test -f 'ptrace.c' || echo '$(srcdir)/'`ptrace.c scanmem-ptrace.obj: ptrace.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(scanmem_CFLAGS) $(CFLAGS) -MT scanmem-ptrace.obj -MD -MP -MF $(DEPDIR)/scanmem-ptrace.Tpo -c -o scanmem-ptrace.obj `if test -f 'ptrace.c'; then $(CYGPATH_W) 'ptrace.c'; else $(CYGPATH_W) '$(srcdir)/ptrace.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/scanmem-ptrace.Tpo $(DEPDIR)/scanmem-ptrace.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ptrace.c' object='scanmem-ptrace.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(scanmem_CFLAGS) $(CFLAGS) -c -o scanmem-ptrace.obj `if test -f 'ptrace.c'; then $(CYGPATH_W) 'ptrace.c'; else $(CYGPATH_W) '$(srcdir)/ptrace.c'; fi` scanmem-target_memory_info_array.o: target_memory_info_array.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(scanmem_CFLAGS) $(CFLAGS) -MT scanmem-target_memory_info_array.o -MD -MP -MF $(DEPDIR)/scanmem-target_memory_info_array.Tpo -c -o scanmem-target_memory_info_array.o `test -f 'target_memory_info_array.c' || echo '$(srcdir)/'`target_memory_info_array.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/scanmem-target_memory_info_array.Tpo $(DEPDIR)/scanmem-target_memory_info_array.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='target_memory_info_array.c' object='scanmem-target_memory_info_array.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(scanmem_CFLAGS) $(CFLAGS) -c -o scanmem-target_memory_info_array.o `test -f 'target_memory_info_array.c' || echo '$(srcdir)/'`target_memory_info_array.c scanmem-target_memory_info_array.obj: target_memory_info_array.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(scanmem_CFLAGS) $(CFLAGS) -MT scanmem-target_memory_info_array.obj -MD -MP -MF $(DEPDIR)/scanmem-target_memory_info_array.Tpo -c -o scanmem-target_memory_info_array.obj `if test -f 'target_memory_info_array.c'; then $(CYGPATH_W) 'target_memory_info_array.c'; else $(CYGPATH_W) '$(srcdir)/target_memory_info_array.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/scanmem-target_memory_info_array.Tpo $(DEPDIR)/scanmem-target_memory_info_array.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='target_memory_info_array.c' object='scanmem-target_memory_info_array.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(scanmem_CFLAGS) $(CFLAGS) -c -o scanmem-target_memory_info_array.obj `if test -f 'target_memory_info_array.c'; then $(CYGPATH_W) 'target_memory_info_array.c'; else $(CYGPATH_W) '$(srcdir)/target_memory_info_array.c'; fi` scanmem-list.o: list.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(scanmem_CFLAGS) $(CFLAGS) -MT scanmem-list.o -MD -MP -MF $(DEPDIR)/scanmem-list.Tpo -c -o scanmem-list.o `test -f 'list.c' || echo '$(srcdir)/'`list.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/scanmem-list.Tpo $(DEPDIR)/scanmem-list.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='list.c' object='scanmem-list.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(scanmem_CFLAGS) $(CFLAGS) -c -o scanmem-list.o `test -f 'list.c' || echo '$(srcdir)/'`list.c scanmem-list.obj: list.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(scanmem_CFLAGS) $(CFLAGS) -MT scanmem-list.obj -MD -MP -MF $(DEPDIR)/scanmem-list.Tpo -c -o scanmem-list.obj `if test -f 'list.c'; then $(CYGPATH_W) 'list.c'; else $(CYGPATH_W) '$(srcdir)/list.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/scanmem-list.Tpo $(DEPDIR)/scanmem-list.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='list.c' object='scanmem-list.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(scanmem_CFLAGS) $(CFLAGS) -c -o scanmem-list.obj `if test -f 'list.c'; then $(CYGPATH_W) 'list.c'; else $(CYGPATH_W) '$(srcdir)/list.c'; fi` scanmem-menu.o: menu.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(scanmem_CFLAGS) $(CFLAGS) -MT scanmem-menu.o -MD -MP -MF $(DEPDIR)/scanmem-menu.Tpo -c -o scanmem-menu.o `test -f 'menu.c' || echo '$(srcdir)/'`menu.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/scanmem-menu.Tpo $(DEPDIR)/scanmem-menu.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='menu.c' object='scanmem-menu.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(scanmem_CFLAGS) $(CFLAGS) -c -o scanmem-menu.o `test -f 'menu.c' || echo '$(srcdir)/'`menu.c scanmem-menu.obj: menu.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(scanmem_CFLAGS) $(CFLAGS) -MT scanmem-menu.obj -MD -MP -MF $(DEPDIR)/scanmem-menu.Tpo -c -o scanmem-menu.obj `if test -f 'menu.c'; then $(CYGPATH_W) 'menu.c'; else $(CYGPATH_W) '$(srcdir)/menu.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/scanmem-menu.Tpo $(DEPDIR)/scanmem-menu.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='menu.c' object='scanmem-menu.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(scanmem_CFLAGS) $(CFLAGS) -c -o scanmem-menu.obj `if test -f 'menu.c'; then $(CYGPATH_W) 'menu.c'; else $(CYGPATH_W) '$(srcdir)/menu.c'; fi` scanmem-commands.o: commands.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(scanmem_CFLAGS) $(CFLAGS) -MT scanmem-commands.o -MD -MP -MF $(DEPDIR)/scanmem-commands.Tpo -c -o scanmem-commands.o `test -f 'commands.c' || echo '$(srcdir)/'`commands.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/scanmem-commands.Tpo $(DEPDIR)/scanmem-commands.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='commands.c' object='scanmem-commands.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(scanmem_CFLAGS) $(CFLAGS) -c -o scanmem-commands.o `test -f 'commands.c' || echo '$(srcdir)/'`commands.c scanmem-commands.obj: commands.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(scanmem_CFLAGS) $(CFLAGS) -MT scanmem-commands.obj -MD -MP -MF $(DEPDIR)/scanmem-commands.Tpo -c -o scanmem-commands.obj `if test -f 'commands.c'; then $(CYGPATH_W) 'commands.c'; else $(CYGPATH_W) '$(srcdir)/commands.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/scanmem-commands.Tpo $(DEPDIR)/scanmem-commands.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='commands.c' object='scanmem-commands.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(scanmem_CFLAGS) $(CFLAGS) -c -o scanmem-commands.obj `if test -f 'commands.c'; then $(CYGPATH_W) 'commands.c'; else $(CYGPATH_W) '$(srcdir)/commands.c'; fi` scanmem-handlers.o: handlers.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(scanmem_CFLAGS) $(CFLAGS) -MT scanmem-handlers.o -MD -MP -MF $(DEPDIR)/scanmem-handlers.Tpo -c -o scanmem-handlers.o `test -f 'handlers.c' || echo '$(srcdir)/'`handlers.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/scanmem-handlers.Tpo $(DEPDIR)/scanmem-handlers.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='handlers.c' object='scanmem-handlers.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(scanmem_CFLAGS) $(CFLAGS) -c -o scanmem-handlers.o `test -f 'handlers.c' || echo '$(srcdir)/'`handlers.c scanmem-handlers.obj: handlers.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(scanmem_CFLAGS) $(CFLAGS) -MT scanmem-handlers.obj -MD -MP -MF $(DEPDIR)/scanmem-handlers.Tpo -c -o scanmem-handlers.obj `if test -f 'handlers.c'; then $(CYGPATH_W) 'handlers.c'; else $(CYGPATH_W) '$(srcdir)/handlers.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/scanmem-handlers.Tpo $(DEPDIR)/scanmem-handlers.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='handlers.c' object='scanmem-handlers.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(scanmem_CFLAGS) $(CFLAGS) -c -o scanmem-handlers.obj `if test -f 'handlers.c'; then $(CYGPATH_W) 'handlers.c'; else $(CYGPATH_W) '$(srcdir)/handlers.c'; fi` scanmem-value.o: value.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(scanmem_CFLAGS) $(CFLAGS) -MT scanmem-value.o -MD -MP -MF $(DEPDIR)/scanmem-value.Tpo -c -o scanmem-value.o `test -f 'value.c' || echo '$(srcdir)/'`value.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/scanmem-value.Tpo $(DEPDIR)/scanmem-value.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='value.c' object='scanmem-value.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(scanmem_CFLAGS) $(CFLAGS) -c -o scanmem-value.o `test -f 'value.c' || echo '$(srcdir)/'`value.c scanmem-value.obj: value.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(scanmem_CFLAGS) $(CFLAGS) -MT scanmem-value.obj -MD -MP -MF $(DEPDIR)/scanmem-value.Tpo -c -o scanmem-value.obj `if test -f 'value.c'; then $(CYGPATH_W) 'value.c'; else $(CYGPATH_W) '$(srcdir)/value.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/scanmem-value.Tpo $(DEPDIR)/scanmem-value.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='value.c' object='scanmem-value.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(scanmem_CFLAGS) $(CFLAGS) -c -o scanmem-value.obj `if test -f 'value.c'; then $(CYGPATH_W) 'value.c'; else $(CYGPATH_W) '$(srcdir)/value.c'; fi` scanmem-scanroutines.o: scanroutines.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(scanmem_CFLAGS) $(CFLAGS) -MT scanmem-scanroutines.o -MD -MP -MF $(DEPDIR)/scanmem-scanroutines.Tpo -c -o scanmem-scanroutines.o `test -f 'scanroutines.c' || echo '$(srcdir)/'`scanroutines.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/scanmem-scanroutines.Tpo $(DEPDIR)/scanmem-scanroutines.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='scanroutines.c' object='scanmem-scanroutines.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(scanmem_CFLAGS) $(CFLAGS) -c -o scanmem-scanroutines.o `test -f 'scanroutines.c' || echo '$(srcdir)/'`scanroutines.c scanmem-scanroutines.obj: scanroutines.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(scanmem_CFLAGS) $(CFLAGS) -MT scanmem-scanroutines.obj -MD -MP -MF $(DEPDIR)/scanmem-scanroutines.Tpo -c -o scanmem-scanroutines.obj `if test -f 'scanroutines.c'; then $(CYGPATH_W) 'scanroutines.c'; else $(CYGPATH_W) '$(srcdir)/scanroutines.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/scanmem-scanroutines.Tpo $(DEPDIR)/scanmem-scanroutines.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='scanroutines.c' object='scanmem-scanroutines.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(scanmem_CFLAGS) $(CFLAGS) -c -o scanmem-scanroutines.obj `if test -f 'scanroutines.c'; then $(CYGPATH_W) 'scanroutines.c'; else $(CYGPATH_W) '$(srcdir)/scanroutines.c'; fi` scanmem-show_message.o: show_message.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(scanmem_CFLAGS) $(CFLAGS) -MT scanmem-show_message.o -MD -MP -MF $(DEPDIR)/scanmem-show_message.Tpo -c -o scanmem-show_message.o `test -f 'show_message.c' || echo '$(srcdir)/'`show_message.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/scanmem-show_message.Tpo $(DEPDIR)/scanmem-show_message.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='show_message.c' object='scanmem-show_message.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(scanmem_CFLAGS) $(CFLAGS) -c -o scanmem-show_message.o `test -f 'show_message.c' || echo '$(srcdir)/'`show_message.c scanmem-show_message.obj: show_message.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(scanmem_CFLAGS) $(CFLAGS) -MT scanmem-show_message.obj -MD -MP -MF $(DEPDIR)/scanmem-show_message.Tpo -c -o scanmem-show_message.obj `if test -f 'show_message.c'; then $(CYGPATH_W) 'show_message.c'; else $(CYGPATH_W) '$(srcdir)/show_message.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/scanmem-show_message.Tpo $(DEPDIR)/scanmem-show_message.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='show_message.c' object='scanmem-show_message.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(scanmem_CFLAGS) $(CFLAGS) -c -o scanmem-show_message.obj `if test -f 'show_message.c'; then $(CYGPATH_W) 'show_message.c'; else $(CYGPATH_W) '$(srcdir)/show_message.c'; fi` install-man1: $(dist_man_MANS) @$(NORMAL_INSTALL) test -z "$(man1dir)" || $(MKDIR_P) "$(DESTDIR)$(man1dir)" @list=''; test -n "$(man1dir)" || exit 0; \ { for i in $$list; do echo "$$i"; done; \ l2='$(dist_man_MANS)'; for i in $$l2; do echo "$$i"; done | \ sed -n '/\.1[a-z]*$$/p'; \ } | while read p; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; echo "$$p"; \ done | \ sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ sed 'N;N;s,\n, ,g' | { \ list=; while read file base inst; do \ if test "$$base" = "$$inst"; then list="$$list $$file"; else \ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \ fi; \ done; \ for i in $$list; do echo "$$i"; done | $(am__base_list) | \ while read files; do \ test -z "$$files" || { \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \ done; } uninstall-man1: @$(NORMAL_UNINSTALL) @list=''; test -n "$(man1dir)" || exit 0; \ files=`{ for i in $$list; do echo "$$i"; done; \ l2='$(dist_man_MANS)'; for i in $$l2; do echo "$$i"; done | \ sed -n '/\.1[a-z]*$$/p'; \ } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ test -z "$$files" || { \ echo " ( cd '$(DESTDIR)$(man1dir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(man1dir)" && rm -f $$files; } install-dist_docDATA: $(dist_doc_DATA) @$(NORMAL_INSTALL) test -z "$(docdir)" || $(MKDIR_P) "$(DESTDIR)$(docdir)" @list='$(dist_doc_DATA)'; test -n "$(docdir)" || list=; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(docdir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(docdir)" || exit $$?; \ done uninstall-dist_docDATA: @$(NORMAL_UNINSTALL) @list='$(dist_doc_DATA)'; test -n "$(docdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ test -n "$$files" || exit 0; \ echo " ( cd '$(DESTDIR)$(docdir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(docdir)" && rm -f $$files # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. # To change the values of `make' variables: instead of editing Makefiles, # (1) if the variable is set in `config.status', edit `config.status' # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. $(RECURSIVE_TARGETS): @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" $(RECURSIVE_CLEAN_TARGETS): @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ rev=''; for subdir in $$list; do \ if test "$$subdir" = "."; then :; else \ rev="$$subdir $$rev"; \ fi; \ done; \ rev="$$rev ."; \ target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done ctags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ done ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ 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 CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ 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" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @list='$(MANS)'; if test -n "$$list"; then \ list=`for p in $$list; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ if test -f "$$d$$p"; then echo "$$d$$p"; else :; fi; done`; \ if test -n "$$list" && \ grep 'ab help2man is required to generate this page' $$list >/dev/null; then \ echo "error: found man pages containing the \`missing help2man' replacement text:" >&2; \ grep -l 'ab help2man is required to generate this page' $$list | sed 's/^/ /' >&2; \ echo " to fix them, install help2man, remove and regenerate the man pages;" >&2; \ echo " typically \`make maintainer-clean' will remove them" >&2; \ exit 1; \ else :; fi; \ else :; fi $(am__remove_distdir) test -d "$(distdir)" || mkdir "$(distdir)" @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 @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done -test -n "$(am__skip_mode_fix)" \ || find "$(distdir)" -type d ! -perm -755 \ -exec chmod u+rwx,go+rx {} \; -o \ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r "$(distdir)" dist-gzip: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) dist-bzip2: distdir tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 $(am__remove_distdir) dist-lzma: distdir tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma $(am__remove_distdir) dist-xz: distdir tardir=$(distdir) && $(am__tar) | xz -c >$(distdir).tar.xz $(am__remove_distdir) dist-tarZ: distdir tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z $(am__remove_distdir) dist-shar: distdir shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz $(am__remove_distdir) dist-zip: distdir -rm -f $(distdir).zip zip -rq $(distdir).zip $(distdir) $(am__remove_distdir) dist dist-all: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) # This target untars the dist file and tries a VPATH configuration. Then # it guarantees that the distribution is self-contained by making another # tarfile. distcheck: dist case '$(DIST_ARCHIVES)' in \ *.tar.gz*) \ GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ *.tar.lzma*) \ lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\ *.tar.xz*) \ xz -dc $(distdir).tar.xz | $(am__untar) ;;\ *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ esac chmod -R a-w $(distdir); chmod a+w $(distdir) mkdir $(distdir)/_build mkdir $(distdir)/_inst chmod a-w $(distdir) test -d $(distdir)/_build || exit 0; \ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ && am__cwd=`pwd` \ && $(am__cd) $(distdir)/_build \ && ../configure --srcdir=.. --prefix="$$dc_install_base" \ $(DISTCHECK_CONFIGURE_FLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) dvi \ && $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ && $(MAKE) $(AM_MAKEFLAGS) uninstall \ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ distuninstallcheck \ && chmod -R a-w "$$dc_install_base" \ && ({ \ (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ } || { rm -rf "$$dc_destdir"; exit 1; }) \ && rm -rf "$$dc_destdir" \ && $(MAKE) $(AM_MAKEFLAGS) dist \ && rm -rf $(DIST_ARCHIVES) \ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \ && cd "$$am__cwd" \ || exit 1 $(am__remove_distdir) @(echo "$(distdir) archives ready for distribution: "; \ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' distuninstallcheck: @$(am__cd) '$(distuninstallcheck_dir)' \ && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ || { echo "ERROR: files left after uninstall:" ; \ if test -n "$(DESTDIR)"; then \ echo " (check DESTDIR support)"; \ fi ; \ $(distuninstallcheck_listfiles) ; \ exit 1; } >&2 distcleancheck: distclean @if test '$(srcdir)' = . ; then \ echo "ERROR: distcleancheck can only run from a VPATH build" ; \ exit 1 ; \ fi @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left in build directory after distclean:" ; \ $(distcleancheck_listfiles) ; \ exit 1; } >&2 check-am: all-am check: check-recursive all-am: Makefile $(PROGRAMS) $(MANS) $(DATA) config.h installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(docdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install 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) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-binPROGRAMS clean-generic mostlyclean-am distclean: distclean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-hdr distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-dist_docDATA install-man install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-binPROGRAMS install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-man1 install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf $(top_srcdir)/autom4te.cache -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-compile mostlyclean-generic pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: uninstall-binPROGRAMS uninstall-dist_docDATA \ uninstall-man uninstall-man: uninstall-man1 .MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) all \ ctags-recursive install-am install-strip tags-recursive .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ all all-am am--refresh check check-am clean clean-binPROGRAMS \ clean-generic ctags ctags-recursive dist dist-all dist-bzip2 \ dist-gzip dist-lzma dist-shar dist-tarZ dist-xz dist-zip \ distcheck distclean distclean-compile distclean-generic \ distclean-hdr distclean-tags distcleancheck distdir \ distuninstallcheck dvi dvi-am html html-am info info-am \ install install-am install-binPROGRAMS install-data \ install-data-am install-dist_docDATA install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-man1 install-pdf install-pdf-am install-ps \ install-ps-am install-strip installcheck installcheck-am \ installdirs installdirs-am maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic pdf pdf-am ps ps-am tags tags-recursive \ uninstall uninstall-am uninstall-binPROGRAMS \ uninstall-dist_docDATA uninstall-man uninstall-man1 # 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: scanmem-0.13/Makefile.am0000644000175000017500000000111211322616765012041 00000000000000# $Id: Makefile.am,v 1.5 2007-04-14 18:47:39+01 taviso Exp $ SUBDIRS = test if ENABLE_GUI SUBDIRS += gui else SUBDIRS += endif bin_PROGRAMS = scanmem scanmem_SOURCES = main.c maps.c ptrace.c target_memory_info_array.c list.c menu.c commands.c handlers.c value.c scanmem_SOURCES += commands.h handlers.h interrupt.h list.h scanmem.h value.h licence.h maps.h target_memory_info_array.h scanmem_SOURCES += scanroutines.h scanroutines.c show_message.h show_message.c scanmem_CFLAGS = -O2 -g -Wall dist_man_MANS = scanmem.1 dist_doc_DATA = README EXTRA_DIST = gpl-2.0.txt gpl-3.0.txt scanmem-0.13/main.c0000644000175000017500000002501511734004723011075 00000000000000/* $Id: main.c,v 1.25 2007-06-07 15:16:46+01 taviso Exp taviso $ Copyright (C) 2006,2007,2009 Tavis Ormandy Copyright (C) 2009 Eli Dupree Copyright (C) 2009,2010 WANG Lu 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 */ #ifndef _GNU_SOURCE # define _GNU_SOURCE #endif #include "config.h" #include #include #include #include #include /*lint -e537 */ #include #include #include "scanmem.h" #include "commands.h" #include "handlers.h" #include "show_message.h" static void printhelp(void); static void sighandler(int n); /* global settings */ globals_t globals = { 0, /* exit flag */ 0, /* pid target */ NULL, /* matches */ 0, /* match count */ NULL, /* regions */ NULL, /* commands */ NULL, /* current_cmdline */ /* options */ { 1, /* alignment */ 0, /* debug */ 0, /* backend */ ANYINTEGER, /* scan_data_type */ REGION_HEAP_STACK_EXECUTABLE_BSS, /* region_detail_level */ 0, /* detect_reverse_change */ 1, /* dump_with_ascii */ } }; int main(int argc, char **argv) { char *end; int optindex, ret = EXIT_SUCCESS; globals_t *vars = &globals; struct option longopts[] = { {"pid", 1, NULL, 'p'}, /* target pid */ {"version", 0, NULL, 'v'}, /* print version */ {"help", 0, NULL, 'h'}, /* print help summary */ {"backend", 0, NULL, 'b'}, /* run as backend */ {"debug", 0, NULL, 'd'}, /* enable debug mode */ {NULL, 0, NULL, 0}, }; /* process command line */ while (true) { switch (getopt_long(argc, argv, "vhbdp:", longopts, &optindex)) { case 'p': vars->target = (pid_t) strtoul(optarg, &end, 0); /* check if that parsed correctly */ if (*end != '\0' || *optarg == '\0' || vars->target == 0) { show_error("invalid pid specified.\n"); return EXIT_FAILURE; } break; case 'v': printversion(stderr); return EXIT_SUCCESS; case 'h': printhelp(); return EXIT_SUCCESS; case 'b': vars->options.backend = 1; break; case 'd': vars->options.debug = 1; break; case -1: goto done; default: printhelp(); return EXIT_FAILURE; } } done: /* parse any pid specified after arguments */ if (optind <= argc && argv[optind]) { vars->target = (pid_t) strtoul(argv[optind], &end, 0); /* check if that parsed correctly */ if (*end != '\0' || argv[optind][0] == '\0' || vars->target == 0) { show_error("invalid pid specified.\n"); return EXIT_FAILURE; } } /* before attaching to target, install signal handler to detach on error */ if (vars->options.debug == 0) /* in debug mode, let it crash and see the core dump */ { (void) signal(SIGHUP, sighandler); (void) signal(SIGINT, sighandler); (void) signal(SIGSEGV, sighandler); (void) signal(SIGABRT, sighandler); (void) signal(SIGILL, sighandler); (void) signal(SIGFPE, sighandler); (void) signal(SIGTERM, sighandler); } /* linked list of commands, and function pointers to their handlers */ if ((vars->commands = l_init()) == NULL) { show_error("sorry, there was a memory allocation error.\n"); ret = EXIT_FAILURE; goto end; } /* NULL shortdoc means dont display this command in `help` listing */ registercommand("set", handler__set, vars->commands, SET_SHRTDOC, SET_LONGDOC); registercommand("list", handler__list, vars->commands, LIST_SHRTDOC, LIST_LONGDOC); registercommand("delete", handler__delete, vars->commands, DELETE_SHRTDOC, DELETE_LONGDOC); registercommand("reset", handler__reset, vars->commands, RESET_SHRTDOC, RESET_LONGDOC); registercommand("pid", handler__pid, vars->commands, PID_SHRTDOC, PID_LONGDOC); registercommand("snapshot", handler__snapshot, vars->commands, SNAPSHOT_SHRTDOC, SNAPSHOT_LONGDOC); registercommand("dregion", handler__dregion, vars->commands, DREGION_SHRTDOC, DREGION_LONGDOC); registercommand("dregions", handler__dregion, vars->commands, NULL, DREGION_LONGDOC); registercommand("lregions", handler__lregions, vars->commands, LREGIONS_SHRTDOC, LREGIONS_LONGDOC); registercommand("version", handler__version, vars->commands, VERSION_SHRTDOC, VERSION_LONGDOC); registercommand("=", handler__decinc, vars->commands, NOTCHANGED_SHRTDOC, NOTCHANGED_LONGDOC); registercommand("!=", handler__decinc, vars->commands, CHANGED_SHRTDOC, CHANGED_LONGDOC); registercommand("<", handler__decinc, vars->commands, LESSTHAN_SHRTDOC, LESSTHAN_LONGDOC); registercommand(">", handler__decinc, vars->commands, GREATERTHAN_SHRTDOC, GREATERTHAN_LONGDOC); registercommand("+", handler__decinc, vars->commands, INCREASED_SHRTDOC, INCREASED_LONGDOC); registercommand("-", handler__decinc, vars->commands, DECREASED_SHRTDOC, DECREASED_LONGDOC); registercommand("\"", handler__string, vars->commands, STRING_SHRTDOC, STRING_LONGDOC); registercommand("update", handler__update, vars->commands, UPDATE_SHRTDOC, UPDATE_LONGDOC); registercommand("exit", handler__exit, vars->commands, EXIT_SHRTDOC, EXIT_LONGDOC); registercommand("quit", handler__exit, vars->commands, NULL, EXIT_LONGDOC); registercommand("q", handler__exit, vars->commands, NULL, EXIT_LONGDOC); registercommand("help", handler__help, vars->commands, HELP_SHRTDOC, HELP_LONGDOC); registercommand("shell", handler__shell, vars->commands, SHELL_SHRTDOC, SHELL_LONGDOC); registercommand("watch", handler__watch, vars->commands, WATCH_SHRTDOC, WATCH_LONGDOC); registercommand("show", handler__show, vars->commands, SHOW_SHRTDOC, SHOW_LONGDOC); registercommand("dump", handler__dump, vars->commands, DUMP_SHRTDOC, DUMP_LONGDOC); registercommand("write", handler__write, vars->commands, WRITE_SHRTDOC, WRITE_LONGDOC); registercommand("option", handler__option, vars->commands, OPTION_SHRTDOC, OPTION_LONGDOC); /* commands beginning with __ have special meaning */ registercommand("__eof", handler__eof, vars->commands, NULL, NULL); /* special value NULL means no other matches */ registercommand(NULL, handler__default, vars->commands, DEFAULT_SHRTDOC, DEFAULT_LONGDOC); if (!(globals.options.backend)) { // show welcome message printversion(stderr); } else { // tell front-end our version printf("%s\n", PACKAGE_VERSION); } if (getuid() != 0) { show_error("*** YOU ARE NOT RUNNING scanmem AS ROOT, IT MAY NOT WORK WELL. ***\n\n"); } /* this will initialise matches and regions */ if (execcommand(vars, "reset") == false) { vars->target = 0; } /* check if there is a target already specified */ if (vars->target == 0) { show_user("Enter the pid of the process to search using the \"pid\" command.\n"); show_user("Enter \"help\" for other commands.\n"); } else { show_user("Please enter current value, or \"help\" for other commands.\n"); } /* main loop, read input and process commands */ while (!vars->exit) { char *line; /* reads in a commandline from the user, and returns a pointer to it in *line */ if (getcommand(vars, &line) == false) { show_error("failed to read in a command.\n"); ret = EXIT_FAILURE; break; } /* execcommand returning failure isnt fatal, just the a command couldnt complete. */ if (execcommand(vars, line) == false) { if (vars->target == 0) { show_user("Enter the pid of the process to search using the \"pid\" command.\n"); show_user("Enter \"help\" for other commands.\n"); } else { show_user("Please enter current value, or \"help\" for other commands.\n"); } } free(line); } end: /* now free any allocated memory used */ l_destroy(vars->regions); l_destroy(vars->commands); /* attempt to detach just in case */ (void) detach(vars->target); return ret; } void sighandler(int n) { show_error("\nKilled by signal %d.\n", n); if (globals.target) { (void) detach(globals.target); } exit(EXIT_FAILURE); } /* print quick usage message to stderr */ void printhelp() { printversion(stderr); show_user("Usage: scanmem [OPTION]... [PID]\n" "Interactively locate and modify variables in an executing process.\n" "\n" "-p, --pid=pid\t\tset the target process pid\n" "-b, --backend\t\trun as backend, used by frontend\n" "-h, --help\t\tprint this message\n" "-v, --version\t\tprint version information\n" "\n" "scanmem is an interactive debugging utility, enter `help` at the prompt\n" "for further assistance.\n" "\n" "Report bugs to <%s>.\n", PACKAGE_BUGREPORT); return; } scanmem-0.13/missing0000644000175000017500000002623311313675116011407 00000000000000#! /bin/sh # Common stub for a few missing GNU programs while installing. scriptversion=2009-04-28.21; # UTC # Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006, # 2008, 2009 Free Software Foundation, Inc. # Originally by Fran,cois Pinard , 1996. # 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, 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 . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. if test $# -eq 0; then echo 1>&2 "Try \`$0 --help' for more information" exit 1 fi run=: sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' sed_minuso='s/.* -o \([^ ]*\).*/\1/p' # In the cases where this matters, `missing' is being run in the # srcdir already. if test -f configure.ac; then configure_ac=configure.ac else configure_ac=configure.in fi msg="missing on your system" case $1 in --run) # Try to run requested program, and just exit if it succeeds. run= shift "$@" && exit 0 # Exit code 63 means version mismatch. This often happens # when the user try to use an ancient version of a tool on # a file that requires a minimum version. In this case we # we should proceed has if the program had been absent, or # if --run hadn't been passed. if test $? = 63; then run=: msg="probably too old" fi ;; -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an error status if there is no known handling for PROGRAM. Options: -h, --help display this help and exit -v, --version output version information and exit --run try to run the given command, and emulate it if it fails Supported PROGRAM values: aclocal touch file \`aclocal.m4' autoconf touch file \`configure' autoheader touch file \`config.h.in' autom4te touch the output file, or create a stub one automake touch all \`Makefile.in' files bison create \`y.tab.[ch]', if possible, from existing .[ch] flex create \`lex.yy.c', if possible, from existing .c help2man touch the output file lex create \`lex.yy.c', if possible, from existing .c makeinfo touch the output file tar try tar, gnutar, gtar, then tar without non-portable flags yacc create \`y.tab.[ch]', if possible, from existing .[ch] Version suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and \`g' are ignored when checking the name. Send bug reports to ." exit $? ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing $scriptversion (GNU Automake)" exit $? ;; -*) echo 1>&2 "$0: Unknown \`$1' option" echo 1>&2 "Try \`$0 --help' for more information" exit 1 ;; esac # normalize program name to check for. program=`echo "$1" | sed ' s/^gnu-//; t s/^gnu//; t s/^g//; t'` # Now exit if we have it, but it failed. Also exit now if we # don't have it and --version was passed (most likely to detect # the program). This is about non-GNU programs, so use $1 not # $program. case $1 in lex*|yacc*) # Not GNU programs, they don't have --version. ;; tar*) if test -n "$run"; then echo 1>&2 "ERROR: \`tar' requires --run" exit 1 elif test "x$2" = "x--version" || test "x$2" = "x--help"; then exit 1 fi ;; *) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 elif test "x$2" = "x--version" || test "x$2" = "x--help"; then # Could not run --version or --help. This is probably someone # running `$TOOL --version' or `$TOOL --help' to check whether # $TOOL exists and not knowing $TOOL uses missing. exit 1 fi ;; esac # If it does not exist, or fails to run (possibly an outdated version), # try to emulate it. case $program in aclocal*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." touch aclocal.m4 ;; autoconf*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." touch configure ;; autoheader*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acconfig.h' or \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` test -z "$files" && files="config.h" touch_files= for f in $files; do case $f in *:*) touch_files="$touch_files "`echo "$f" | sed -e 's/^[^:]*://' -e 's/:.*//'`;; *) touch_files="$touch_files $f.in";; esac done touch $touch_files ;; automake*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." find . -type f -name Makefile.am -print | sed 's/\.am$/.in/' | while read f; do touch "$f"; done ;; autom4te*) echo 1>&2 "\ WARNING: \`$1' is needed, but is $msg. You might have modified some files without having the proper tools for further handling them. You can get \`$1' as part of \`Autoconf' from any GNU archive site." file=`echo "$*" | sed -n "$sed_output"` test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` if test -f "$file"; then touch $file else test -z "$file" || exec >$file echo "#! /bin/sh" echo "# Created by GNU Automake missing as a replacement of" echo "# $ $@" echo "exit 0" chmod +x $file exit 1 fi ;; bison*|yacc*) echo 1>&2 "\ WARNING: \`$1' $msg. You should only need it if you modified a \`.y' file. You may need the \`Bison' package in order for those modifications to take effect. You can get \`Bison' from any GNU archive site." rm -f y.tab.c y.tab.h if test $# -ne 1; then eval LASTARG="\${$#}" case $LASTARG in *.y) SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` if test -f "$SRCFILE"; then cp "$SRCFILE" y.tab.c fi SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` if test -f "$SRCFILE"; then cp "$SRCFILE" y.tab.h fi ;; esac fi if test ! -f y.tab.h; then echo >y.tab.h fi if test ! -f y.tab.c; then echo 'main() { return 0; }' >y.tab.c fi ;; lex*|flex*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a \`.l' file. You may need the \`Flex' package in order for those modifications to take effect. You can get \`Flex' from any GNU archive site." rm -f lex.yy.c if test $# -ne 1; then eval LASTARG="\${$#}" case $LASTARG in *.l) SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` if test -f "$SRCFILE"; then cp "$SRCFILE" lex.yy.c fi ;; esac fi if test ! -f lex.yy.c; then echo 'main() { return 0; }' >lex.yy.c fi ;; help2man*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a dependency of a manual page. You may need the \`Help2man' package in order for those modifications to take effect. You can get \`Help2man' from any GNU archive site." file=`echo "$*" | sed -n "$sed_output"` test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` if test -f "$file"; then touch $file else test -z "$file" || exec >$file echo ".ab help2man is required to generate this page" exit $? fi ;; makeinfo*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a \`.texi' or \`.texinfo' file, or any other file indirectly affecting the aspect of the manual. The spurious call might also be the consequence of using a buggy \`make' (AIX, DU, IRIX). You might want to install the \`Texinfo' package or the \`GNU make' package. Grab either from any GNU archive site." # The file to touch is that specified with -o ... file=`echo "$*" | sed -n "$sed_output"` test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` if test -z "$file"; then # ... or it is the one specified with @setfilename ... infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` file=`sed -n ' /^@setfilename/{ s/.* \([^ ]*\) *$/\1/ p q }' $infile` # ... or it is derived from the source name (dir/f.texi becomes f.info) test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info fi # If the file does not exist, the user really needs makeinfo; # let's fail without touching anything. test -f $file || exit 1 touch $file ;; tar*) shift # We have already tried tar in the generic part. # Look for gnutar/gtar before invocation to avoid ugly error # messages. if (gnutar --version > /dev/null 2>&1); then gnutar "$@" && exit 0 fi if (gtar --version > /dev/null 2>&1); then gtar "$@" && exit 0 fi firstarg="$1" if shift; then case $firstarg in *o*) firstarg=`echo "$firstarg" | sed s/o//` tar "$firstarg" "$@" && exit 0 ;; esac case $firstarg in *h*) firstarg=`echo "$firstarg" | sed s/h//` tar "$firstarg" "$@" && exit 0 ;; esac fi echo 1>&2 "\ WARNING: I can't seem to be able to run \`tar' with the given arguments. You may want to install GNU tar or Free paxutils, or check the command line arguments." exit 1 ;; *) echo 1>&2 "\ WARNING: \`$1' is needed, and is $msg. You might have modified some files without having the proper tools for further handling them. Check the \`README' file, it often tells you about the needed prerequisites for installing this package. You may also peek at any GNU archive site, in case some other package would contain this missing \`$1' program." exit 1 ;; esac exit 0 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: scanmem-0.13/configure0000644000175000017500000057444411621754300011726 00000000000000#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.68 for scanmem 0.13. # # Report bugs to . # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, # 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software # Foundation, Inc. # # # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi " as_required="as_fn_return () { (exit \$1); } as_fn_success () { as_fn_return 0; } as_fn_failure () { as_fn_return 1; } as_fn_ret_success () { return 0; } as_fn_ret_failure () { return 1; } exitcode=0 as_fn_success || { exitcode=1; echo as_fn_success failed.; } as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : else exitcode=1; echo positional parameters were not saved. fi test x\$exitcode = x0 || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 test \$(( 1 + 1 )) = 2 || exit 1" if (eval "$as_required") 2>/dev/null; then : as_have_required=yes else as_have_required=no fi if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. as_found=: case $as_dir in #( /*) for as_base in sh bash ksh sh5; do # Try only shells that exist, to save several forks. as_shell=$as_dir/$as_base if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : CONFIG_SHELL=$as_shell as_have_required=yes if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : break 2 fi fi done;; esac as_found=false done $as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : CONFIG_SHELL=$SHELL as_have_required=yes fi; } IFS=$as_save_IFS if test "x$CONFIG_SHELL" != x; then : # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV export CONFIG_SHELL case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"} fi if test x$as_have_required = xno; then : $as_echo "$0: This script requires a shell more modern than all" $as_echo "$0: the shells that I found on your system." if test x${ZSH_VERSION+set} = xset ; then $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" $as_echo "$0: be upgraded to zsh 4.3.4 or later." else $as_echo "$0: Please tell bug-autoconf@gnu.org and $0: http://code.google.com/p/scanmem/ about your system, $0: including any error possibly output before this $0: message. Then install a modern shell, or manually run $0: the script under such a shell if you do have one." fi exit 1 fi fi fi SHELL=${CONFIG_SHELL-/bin/sh} export SHELL # Unset more variables known to interfere with behavior of common tools. CLICOLOR_FORCE= GREP_OPTIONS= unset CLICOLOR_FORCE GREP_OPTIONS ## --------------------- ## ## M4sh Shell Functions. ## ## --------------------- ## # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits as_lineno_1=$LINENO as_lineno_1a=$LINENO as_lineno_2=$LINENO as_lineno_2a=$LINENO eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in #( -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" test -n "$DJDIR" || exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= # Identity of this package. PACKAGE_NAME='scanmem' PACKAGE_TARNAME='scanmem' PACKAGE_VERSION='0.13' PACKAGE_STRING='scanmem 0.13' PACKAGE_BUGREPORT='http://code.google.com/p/scanmem/' PACKAGE_URL='' ac_unique_file="main.c" # Factoring default headers for most tests. ac_includes_default="\ #include #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_SYS_STAT_H # include #endif #ifdef STDC_HEADERS # include # include #else # ifdef HAVE_STDLIB_H # include # endif #endif #ifdef HAVE_STRING_H # if !defined STDC_HEADERS && defined HAVE_MEMORY_H # include # endif # include #endif #ifdef HAVE_STRINGS_H # include #endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif #ifdef HAVE_UNISTD_H # include #endif" ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS ENABLE_GUI_FALSE ENABLE_GUI_TRUE PKGDATADIR POW_LIB LIBOBJS ALLOCA EGREP GREP CPP am__fastdepCC_FALSE am__fastdepCC_TRUE CCDEPMODE AMDEPBACKSLASH AMDEP_FALSE AMDEP_TRUE am__quote am__include DEPDIR OBJEXT EXEEXT ac_ct_CC CPPFLAGS LDFLAGS CFLAGS CC am__untar am__tar AMTAR am__leading_dot SET_MAKE AWK mkdir_p MKDIR_P INSTALL_STRIP_PROGRAM STRIP install_sh MAKEINFO AUTOHEADER AUTOMAKE AUTOCONF ACLOCAL VERSION PACKAGE CYGPATH_W am__isrc INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM target_alias host_alias build_alias LIBS ECHO_T ECHO_N ECHO_C DEFS mandir localedir libdir psdir pdfdir dvidir htmldir infodir docdir oldincludedir includedir localstatedir sharedstatedir sysconfdir datadir datarootdir libexecdir sbindir bindir program_transform_name prefix exec_prefix PACKAGE_URL PACKAGE_BUGREPORT PACKAGE_STRING PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR SHELL' ac_subst_files='' ac_user_opts=' enable_option_checking enable_dependency_tracking enable_largefile enable_gui ' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS CPP' # Initialize some variables set by options. ac_init_help= ac_init_version=false ac_unrecognized_opts= ac_unrecognized_sep= # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *=) ac_optarg= ;; *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=\$ac_optarg ;; -without-* | --without-*) ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=no ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) as_fn_error $? "unrecognized option: \`$ac_option' Try \`$0 --help' for more information" ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. case $ac_envvar in #( '' | [0-9]* | *[!_$as_cr_alnum]* ) as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; esac eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` as_fn_error $? "missing argument to $ac_option" fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi # Check all directory arguments for consistency. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir do eval ac_val=\$$ac_var # Remove trailing slashes. case $ac_val in */ ) ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` eval $ac_var=\$ac_val;; esac # Be sure to have absolute directory names. case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used" >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || as_fn_error $? "working directory cannot be determined" test "X$ac_ls_di" = "X$ac_pwd_ls_di" || as_fn_error $? "pwd does not report name of working directory" # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$as_myself" || $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures scanmem 0.13 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking ...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/scanmem] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF Program names: --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of scanmem 0.13:";; esac cat <<\_ACEOF Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --disable-largefile omit support for large files --enable-gui enable gameconqueror, the gui front-end of scanmem Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to . _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested configure. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF scanmem configure 0.13 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi ## ------------------------ ## ## Autoconf initialization. ## ## ------------------------ ## # ac_fn_c_try_compile LINENO # -------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_compile # ac_fn_c_try_cpp LINENO # ---------------------- # Try to preprocess conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_cpp () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } > conftest.i && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_cpp # ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists, giving a warning if it cannot be compiled using # the include files in INCLUDES and setting the cache variable VAR # accordingly. ac_fn_c_check_header_mongrel () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if eval \${$3+:} false; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } else # Is the header compilable? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 $as_echo_n "checking $2 usability... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_header_compiler=yes else ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 $as_echo_n "checking $2 presence... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <$2> _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : ac_header_preproc=yes else ac_header_preproc=no fi rm -f conftest.err conftest.i conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 $as_echo "$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( yes:no: ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ;; no:yes:* ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ( $as_echo "## ------------------------------------------------ ## ## Report this to http://code.google.com/p/scanmem/ ## ## ------------------------------------------------ ##" ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=\$ac_header_compiler" fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_mongrel # ac_fn_c_try_run LINENO # ---------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. Assumes # that executables *can* be run. ac_fn_c_try_run () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then : ac_retval=0 else $as_echo "$as_me: program exited with status $ac_status" >&5 $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=$ac_status fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_run # ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists and can be compiled using the include files in # INCLUDES, setting the cache variable VAR accordingly. ac_fn_c_check_header_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_compile # ac_fn_c_check_type LINENO TYPE VAR INCLUDES # ------------------------------------------- # Tests whether TYPE exists after having included INCLUDES, setting cache # variable VAR accordingly. ac_fn_c_check_type () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=no" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { if (sizeof ($2)) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { if (sizeof (($2))) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else eval "$3=yes" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_type # ac_fn_c_try_link LINENO # ----------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_link # ac_fn_c_check_func LINENO FUNC VAR # ---------------------------------- # Tests whether FUNC exists, setting the cache variable VAR accordingly ac_fn_c_check_func () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Define $2 to an innocuous variant, in case declares $2. For example, HP-UX 11i declares gettimeofday. */ #define $2 innocuous_$2 /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $2 (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $2 /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char $2 (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_$2 || defined __stub___$2 choke me #endif int main () { return $2 (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_func # ac_fn_c_find_intX_t LINENO BITS VAR # ----------------------------------- # Finds a signed integer type with width BITS, setting cache variable VAR # accordingly. ac_fn_c_find_intX_t () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for int$2_t" >&5 $as_echo_n "checking for int$2_t... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=no" # Order is important - never check a type that is potentially smaller # than half of the expected target width. for ac_type in int$2_t 'int' 'long int' \ 'long long int' 'short int' 'signed char'; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default enum { N = $2 / 2 - 1 }; int main () { static int test_array [1 - 2 * !(0 < ($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 1))]; test_array [0] = 0 ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default enum { N = $2 / 2 - 1 }; int main () { static int test_array [1 - 2 * !(($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 1) < ($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 2))]; test_array [0] = 0 ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else case $ac_type in #( int$2_t) : eval "$3=yes" ;; #( *) : eval "$3=\$ac_type" ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if eval test \"x\$"$3"\" = x"no"; then : else break fi done fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_find_intX_t # ac_fn_c_find_uintX_t LINENO BITS VAR # ------------------------------------ # Finds an unsigned integer type with width BITS, setting cache variable VAR # accordingly. ac_fn_c_find_uintX_t () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for uint$2_t" >&5 $as_echo_n "checking for uint$2_t... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=no" # Order is important - never check a type that is potentially smaller # than half of the expected target width. for ac_type in uint$2_t 'unsigned int' 'unsigned long int' \ 'unsigned long long int' 'unsigned short int' 'unsigned char'; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !((($ac_type) -1 >> ($2 / 2 - 1)) >> ($2 / 2 - 1) == 3)]; test_array [0] = 0 ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : case $ac_type in #( uint$2_t) : eval "$3=yes" ;; #( *) : eval "$3=\$ac_type" ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if eval test \"x\$"$3"\" = x"no"; then : else break fi done fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_find_uintX_t cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by scanmem $as_me 0.13, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. $as_echo "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; 2) as_fn_append ac_configure_args1 " '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi as_fn_append ac_configure_args " '$ac_arg'" ;; esac done done { ac_configure_args0=; unset ac_configure_args0;} { ac_configure_args1=; unset ac_configure_args1;} # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo $as_echo "## ---------------- ## ## Cache variables. ## ## ---------------- ##" echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo $as_echo "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then $as_echo "## ------------------- ## ## File substitutions. ## ## ------------------- ##" echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then $as_echo "## ----------- ## ## confdefs.h. ## ## ----------- ##" echo cat confdefs.h echo fi test "$ac_signal" != 0 && $as_echo "$as_me: caught signal $ac_signal" $as_echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h $as_echo "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_URL "$PACKAGE_URL" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. ac_site_file1=NONE ac_site_file2=NONE if test -n "$CONFIG_SITE"; then # We do not want a PATH search for config.site. case $CONFIG_SITE in #(( -*) ac_site_file1=./$CONFIG_SITE;; */*) ac_site_file1=$CONFIG_SITE;; *) ac_site_file1=./$CONFIG_SITE;; esac elif test "x$prefix" != xNONE; then ac_site_file1=$prefix/share/config.site ac_site_file2=$prefix/etc/config.site else ac_site_file1=$ac_default_prefix/share/config.site ac_site_file2=$ac_default_prefix/etc/config.site fi for ac_site_file in "$ac_site_file1" "$ac_site_file2" do test "x$ac_site_file" = xNONE && continue if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 $as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" \ || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file See \`config.log' for more details" "$LINENO" 5; } fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special files # actually), so we avoid doing that. DJGPP emulates it as a regular file. if test /dev/null != "$cache_file" && test -f "$cache_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 $as_echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 $as_echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then # differences in whitespace do not lead to failure. ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 $as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 $as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 $as_echo "$as_me: former value: \`$ac_old_val'" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 $as_echo "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) as_fn_append ac_configure_args " '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## ## -------------------- ## ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu am__api_version='1.11' ac_aux_dir= for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f "$ac_dir/install.sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f "$ac_dir/shtool"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 fi # These three variables are undocumented and unsupported, # and are intended to be withdrawn in a future Autoconf release. # They can cause serious problems if a builder's source tree is in a directory # whose full name contains unusual characters. ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. # Reject install programs that cannot install multiple files. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 $as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then if ${ac_cv_path_install+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in #(( ./ | .// | /[cC]/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else rm -rf conftest.one conftest.two conftest.dir echo one > conftest.one echo two > conftest.two mkdir conftest.dir if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && test -s conftest.one && test -s conftest.two && test -s conftest.dir/conftest.one && test -s conftest.dir/conftest.two then ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi fi done done ;; esac done IFS=$as_save_IFS rm -rf conftest.one conftest.two conftest.dir fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 $as_echo "$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 $as_echo_n "checking whether build environment is sane... " >&6; } # Just in case sleep 1 echo timestamp > conftest.file # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[\\\"\#\$\&\'\`$am_lf]*) as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;; esac case $srcdir in *[\\\"\#\$\&\'\`$am_lf\ \ ]*) as_fn_error $? "unsafe srcdir value: \`$srcdir'" "$LINENO" 5;; esac # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$*" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi rm -f conftest.file if test "$*" != "X $srcdir/configure conftest.file" \ && test "$*" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". as_fn_error $? "ls -t appears to fail. Make sure there is not a broken alias in your environment" "$LINENO" 5 fi test "$2" = conftest.file ) then # Ok. : else as_fn_error $? "newly created file is older than distributed files! Check your system clock" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } test "$program_prefix" != NONE && program_transform_name="s&^&$program_prefix&;$program_transform_name" # Use a double $ so make ignores it. test "$program_suffix" != NONE && program_transform_name="s&\$&$program_suffix&;$program_transform_name" # Double any \ or $. # By default was `s,x,x', remove it if useless. ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`missing' script is too old or missing" >&5 $as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} fi if test x"${install_sh}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi # Installed binaries are usually stripped using `strip' when the user # run `make install-strip'. However `strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the `STRIP' environment variable to overrule this program. if test "$cross_compiling" != no; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 $as_echo "$STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 $as_echo "$ac_ct_STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 $as_echo_n "checking for a thread-safe mkdir -p... " >&6; } if test -z "$MKDIR_P"; then if ${ac_cv_path_mkdir+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in mkdir gmkdir; do for ac_exec_ext in '' $ac_executable_extensions; do { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( 'mkdir (GNU coreutils) '* | \ 'mkdir (coreutils) '* | \ 'mkdir (fileutils) '4.1*) ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext break 3;; esac done done done IFS=$as_save_IFS fi test -d ./--version && rmdir ./--version if test "${ac_cv_path_mkdir+set}" = set; then MKDIR_P="$ac_cv_path_mkdir -p" else # As a last resort, use the slow shell script. Don't cache a # value for MKDIR_P within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. MKDIR_P="$ac_install_sh -d" fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 $as_echo "$MKDIR_P" >&6; } mkdir_p="$MKDIR_P" case $mkdir_p in [\\/$]* | ?:[\\/]*) ;; */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; esac for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AWK+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_AWK="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 $as_echo "$AWK" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AWK" && break done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering ...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } SET_MAKE= else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." am__isrc=' -I$(srcdir)' # test to see if srcdir already configured if test -f $srcdir/config.status; then as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi # Define the identity of the package. PACKAGE='scanmem' VERSION='0.13' cat >>confdefs.h <<_ACEOF #define PACKAGE "$PACKAGE" _ACEOF cat >>confdefs.h <<_ACEOF #define VERSION "$VERSION" _ACEOF # Some tools Automake needs. ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} # We need awk for the "check" target. The system "awk" is bad on # some platforms. # Always define AMTAR for backward compatibility. AMTAR=${AMTAR-"${am_missing_run}tar"} am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' ac_config_headers="$ac_config_headers config.h" DEPDIR="${am__leading_dot}deps" ac_config_commands="$ac_config_commands depfiles" am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo this is the am__doit target .PHONY: am__doit END # If we don't find an include directive, just comment out the code. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5 $as_echo_n "checking for style of include used by $am_make... " >&6; } am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # Ignore all kinds of additional output from `make'. case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=include am__quote= _am_result=GNU ;; esac # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=.include am__quote="\"" _am_result=BSD ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5 $as_echo "$_am_result" >&6; } rm -f confinc confmf # Check whether --enable-dependency-tracking was given. if test "${enable_dependency_tracking+set}" = set; then : enableval=$enable_dependency_tracking; fi if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' fi if test "x$enable_dependency_tracking" != xno; then AMDEP_TRUE= AMDEP_FALSE='#' else AMDEP_TRUE='#' AMDEP_FALSE= fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 $as_echo_n "checking whether the C compiler works... " >&6; } ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { { ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link_default") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi if test -z "$ac_file"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "C compiler cannot create executables See \`config.log' for more details" "$LINENO" 5; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 $as_echo_n "checking for C compiler default output file name... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 $as_echo "$ac_file" >&6; } ac_exeext=$ac_cv_exeext rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 $as_echo_n "checking for suffix of executables... " >&6; } if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 $as_echo "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { FILE *f = fopen ("conftest.out", "w"); return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF ac_clean_files="$ac_clean_files conftest.out" # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 $as_echo_n "checking whether we are cross compiling... " >&6; } if test "$cross_compiling" != yes; then { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if { ac_try='./conftest$ac_cv_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details" "$LINENO" 5; } fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 $as_echo "$cross_compiling" >&6; } rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } if ${ac_cv_objext+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 $as_echo "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } if ${ac_cv_c_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_compiler_gnu=yes else ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 $as_echo "$ac_cv_c_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } if ${ac_cv_prog_cc_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes else CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 $as_echo "$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } if ${ac_cv_prog_cc_c89+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c89=$ac_arg fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac if test "x$ac_cv_prog_cc_c89" != xno; then : fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu depcc="$CC" am_compiler_list= { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 $as_echo_n "checking dependency style of $depcc... " >&6; } if ${am_cv_CC_dependencies_compiler_type+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CC_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi am__universal=false case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvisualcpp | msvcmsys) # This compiler won't grok `-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CC_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CC_dependencies_compiler_type=none fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 $as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then am__fastdepCC_TRUE= am__fastdepCC_FALSE='#' else am__fastdepCC_TRUE='#' am__fastdepCC_FALSE= fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 $as_echo_n "checking how to run the C preprocessor... " >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if ${ac_cv_prog_CPP+:} false; then : $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 $as_echo "$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details" "$LINENO" 5; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 $as_echo_n "checking for grep that handles long lines and -e... " >&6; } if ${ac_cv_path_GREP+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$GREP"; then ac_path_GREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in *GNU*) ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_GREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_GREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_GREP"; then as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_GREP=$GREP fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 $as_echo "$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 $as_echo_n "checking for egrep... " >&6; } if ${ac_cv_path_EGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 then ac_cv_path_EGREP="$GREP -E" else if test -z "$EGREP"; then ac_path_EGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in *GNU*) ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_EGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_EGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_EGREP"; then as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_EGREP=$EGREP fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 $as_echo "$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdc=yes else ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : else ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then $as_echo "#define STDC_HEADERS 1" >>confdefs.h fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default " if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done ac_fn_c_check_header_mongrel "$LINENO" "minix/config.h" "ac_cv_header_minix_config_h" "$ac_includes_default" if test "x$ac_cv_header_minix_config_h" = xyes; then : MINIX=yes else MINIX= fi if test "$MINIX" = yes; then $as_echo "#define _POSIX_SOURCE 1" >>confdefs.h $as_echo "#define _POSIX_1_SOURCE 2" >>confdefs.h $as_echo "#define _MINIX 1" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether it is safe to define __EXTENSIONS__" >&5 $as_echo_n "checking whether it is safe to define __EXTENSIONS__... " >&6; } if ${ac_cv_safe_to_define___extensions__+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ # define __EXTENSIONS__ 1 $ac_includes_default int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_safe_to_define___extensions__=yes else ac_cv_safe_to_define___extensions__=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_safe_to_define___extensions__" >&5 $as_echo "$ac_cv_safe_to_define___extensions__" >&6; } test $ac_cv_safe_to_define___extensions__ = yes && $as_echo "#define __EXTENSIONS__ 1" >>confdefs.h $as_echo "#define _ALL_SOURCE 1" >>confdefs.h $as_echo "#define _GNU_SOURCE 1" >>confdefs.h $as_echo "#define _POSIX_PTHREAD_SEMANTICS 1" >>confdefs.h $as_echo "#define _TANDEM_SOURCE 1" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdbool.h that conforms to C99" >&5 $as_echo_n "checking for stdbool.h that conforms to C99... " >&6; } if ${ac_cv_header_stdbool_h+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #ifndef bool "error: bool is not defined" #endif #ifndef false "error: false is not defined" #endif #if false "error: false is not 0" #endif #ifndef true "error: true is not defined" #endif #if true != 1 "error: true is not 1" #endif #ifndef __bool_true_false_are_defined "error: __bool_true_false_are_defined is not defined" #endif struct s { _Bool s: 1; _Bool t; } s; char a[true == 1 ? 1 : -1]; char b[false == 0 ? 1 : -1]; char c[__bool_true_false_are_defined == 1 ? 1 : -1]; char d[(bool) 0.5 == true ? 1 : -1]; /* See body of main program for 'e'. */ char f[(_Bool) 0.0 == false ? 1 : -1]; char g[true]; char h[sizeof (_Bool)]; char i[sizeof s.t]; enum { j = false, k = true, l = false * true, m = true * 256 }; /* The following fails for HP aC++/ANSI C B3910B A.05.55 [Dec 04 2003]. */ _Bool n[m]; char o[sizeof n == m * sizeof n[0] ? 1 : -1]; char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1]; /* Catch a bug in an HP-UX C compiler. See http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html */ _Bool q = true; _Bool *pq = &q; int main () { bool e = &s; *pq |= q; *pq |= ! q; /* Refer to every declared value, to avoid compiler optimizations. */ return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l + !m + !n + !o + !p + !q + !pq); ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdbool_h=yes else ac_cv_header_stdbool_h=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdbool_h" >&5 $as_echo "$ac_cv_header_stdbool_h" >&6; } ac_fn_c_check_type "$LINENO" "_Bool" "ac_cv_type__Bool" "$ac_includes_default" if test "x$ac_cv_type__Bool" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE__BOOL 1 _ACEOF fi if test $ac_cv_header_stdbool_h = yes; then $as_echo "#define HAVE_STDBOOL_H 1" >>confdefs.h fi for ac_func in memset strcasecmp strchr strdup strerror strtoul do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in fcntl.h limits.h stddef.h sys/time.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" if test "x$ac_cv_type_size_t" = xyes; then : else cat >>confdefs.h <<_ACEOF #define size_t unsigned int _ACEOF fi # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works # for constant arguments. Useless! { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working alloca.h" >&5 $as_echo_n "checking for working alloca.h... " >&6; } if ${ac_cv_working_alloca_h+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { char *p = (char *) alloca (2 * sizeof (int)); if (p) return 0; ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_working_alloca_h=yes else ac_cv_working_alloca_h=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_working_alloca_h" >&5 $as_echo "$ac_cv_working_alloca_h" >&6; } if test $ac_cv_working_alloca_h = yes; then $as_echo "#define HAVE_ALLOCA_H 1" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for alloca" >&5 $as_echo_n "checking for alloca... " >&6; } if ${ac_cv_func_alloca_works+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __GNUC__ # define alloca __builtin_alloca #else # ifdef _MSC_VER # include # define alloca _alloca # else # ifdef HAVE_ALLOCA_H # include # else # ifdef _AIX #pragma alloca # else # ifndef alloca /* predefined by HP cc +Olibcalls */ void *alloca (size_t); # endif # endif # endif # endif #endif int main () { char *p = (char *) alloca (1); if (p) return 0; ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_func_alloca_works=yes else ac_cv_func_alloca_works=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_alloca_works" >&5 $as_echo "$ac_cv_func_alloca_works" >&6; } if test $ac_cv_func_alloca_works = yes; then $as_echo "#define HAVE_ALLOCA 1" >>confdefs.h else # The SVR3 libPW and SVR4 libucb both contain incompatible functions # that cause trouble. Some versions do not even contain alloca or # contain a buggy version. If you still want to use their alloca, # use ar to extract alloca.o from them instead of compiling alloca.c. ALLOCA=\${LIBOBJDIR}alloca.$ac_objext $as_echo "#define C_ALLOCA 1" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether \`alloca.c' needs Cray hooks" >&5 $as_echo_n "checking whether \`alloca.c' needs Cray hooks... " >&6; } if ${ac_cv_os_cray+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if defined CRAY && ! defined CRAY2 webecray #else wenotbecray #endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "webecray" >/dev/null 2>&1; then : ac_cv_os_cray=yes else ac_cv_os_cray=no fi rm -f conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_os_cray" >&5 $as_echo "$ac_cv_os_cray" >&6; } if test $ac_cv_os_cray = yes; then for ac_func in _getb67 GETB67 getb67; do as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define CRAY_STACKSEG_END $ac_func _ACEOF break fi done fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking stack direction for C alloca" >&5 $as_echo_n "checking stack direction for C alloca... " >&6; } if ${ac_cv_c_stack_direction+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_c_stack_direction=0 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int find_stack_direction () { static char *addr = 0; auto char dummy; if (addr == 0) { addr = &dummy; return find_stack_direction (); } else return (&dummy > addr) ? 1 : -1; } int main () { return find_stack_direction () < 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_c_stack_direction=1 else ac_cv_c_stack_direction=-1 fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_stack_direction" >&5 $as_echo "$ac_cv_c_stack_direction" >&6; } cat >>confdefs.h <<_ACEOF #define STACK_DIRECTION $ac_cv_c_stack_direction _ACEOF fi for ac_header in stdlib.h do : ac_fn_c_check_header_mongrel "$LINENO" "stdlib.h" "ac_cv_header_stdlib_h" "$ac_includes_default" if test "x$ac_cv_header_stdlib_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STDLIB_H 1 _ACEOF fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU libc compatible malloc" >&5 $as_echo_n "checking for GNU libc compatible malloc... " >&6; } if ${ac_cv_func_malloc_0_nonnull+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_func_malloc_0_nonnull=no else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if defined STDC_HEADERS || defined HAVE_STDLIB_H # include #else char *malloc (); #endif int main () { return ! malloc (0); ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_malloc_0_nonnull=yes else ac_cv_func_malloc_0_nonnull=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_malloc_0_nonnull" >&5 $as_echo "$ac_cv_func_malloc_0_nonnull" >&6; } if test $ac_cv_func_malloc_0_nonnull = yes; then : $as_echo "#define HAVE_MALLOC 1" >>confdefs.h else $as_echo "#define HAVE_MALLOC 0" >>confdefs.h case " $LIBOBJS " in *" malloc.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS malloc.$ac_objext" ;; esac $as_echo "#define malloc rpl_malloc" >>confdefs.h fi for ac_header in stdlib.h do : ac_fn_c_check_header_mongrel "$LINENO" "stdlib.h" "ac_cv_header_stdlib_h" "$ac_includes_default" if test "x$ac_cv_header_stdlib_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STDLIB_H 1 _ACEOF fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU libc compatible realloc" >&5 $as_echo_n "checking for GNU libc compatible realloc... " >&6; } if ${ac_cv_func_realloc_0_nonnull+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_func_realloc_0_nonnull=no else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if defined STDC_HEADERS || defined HAVE_STDLIB_H # include #else char *realloc (); #endif int main () { return ! realloc (0, 0); ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_realloc_0_nonnull=yes else ac_cv_func_realloc_0_nonnull=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_realloc_0_nonnull" >&5 $as_echo "$ac_cv_func_realloc_0_nonnull" >&6; } if test $ac_cv_func_realloc_0_nonnull = yes; then : $as_echo "#define HAVE_REALLOC 1" >>confdefs.h else $as_echo "#define HAVE_REALLOC 0" >>confdefs.h case " $LIBOBJS " in *" realloc.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS realloc.$ac_objext" ;; esac $as_echo "#define realloc rpl_realloc" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working strtod" >&5 $as_echo_n "checking for working strtod... " >&6; } if ${ac_cv_func_strtod+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_func_strtod=no else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default #ifndef strtod double strtod (); #endif int main() { { /* Some versions of Linux strtod mis-parse strings with leading '+'. */ char *string = " +69"; char *term; double value; value = strtod (string, &term); if (value != 69 || term != (string + 4)) return 1; } { /* Under Solaris 2.4, strtod returns the wrong value for the terminating character under some conditions. */ char *string = "NaN"; char *term; strtod (string, &term); if (term != string && *(term - 1) == 0) return 1; } return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_strtod=yes else ac_cv_func_strtod=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_strtod" >&5 $as_echo "$ac_cv_func_strtod" >&6; } if test $ac_cv_func_strtod = no; then case " $LIBOBJS " in *" strtod.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS strtod.$ac_objext" ;; esac ac_fn_c_check_func "$LINENO" "pow" "ac_cv_func_pow" if test "x$ac_cv_func_pow" = xyes; then : fi if test $ac_cv_func_pow = no; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pow in -lm" >&5 $as_echo_n "checking for pow in -lm... " >&6; } if ${ac_cv_lib_m_pow+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char pow (); int main () { return pow (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_m_pow=yes else ac_cv_lib_m_pow=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_pow" >&5 $as_echo "$ac_cv_lib_m_pow" >&6; } if test "x$ac_cv_lib_m_pow" = xyes; then : POW_LIB=-lm else { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cannot find library containing definition of pow" >&5 $as_echo "$as_me: WARNING: cannot find library containing definition of pow" >&2;} fi fi fi ac_fn_c_find_intX_t "$LINENO" "8" "ac_cv_c_int8_t" case $ac_cv_c_int8_t in #( no|yes) ;; #( *) cat >>confdefs.h <<_ACEOF #define int8_t $ac_cv_c_int8_t _ACEOF ;; esac ac_fn_c_find_intX_t "$LINENO" "16" "ac_cv_c_int16_t" case $ac_cv_c_int16_t in #( no|yes) ;; #( *) cat >>confdefs.h <<_ACEOF #define int16_t $ac_cv_c_int16_t _ACEOF ;; esac ac_fn_c_find_intX_t "$LINENO" "32" "ac_cv_c_int32_t" case $ac_cv_c_int32_t in #( no|yes) ;; #( *) cat >>confdefs.h <<_ACEOF #define int32_t $ac_cv_c_int32_t _ACEOF ;; esac ac_fn_c_find_intX_t "$LINENO" "64" "ac_cv_c_int64_t" case $ac_cv_c_int64_t in #( no|yes) ;; #( *) cat >>confdefs.h <<_ACEOF #define int64_t $ac_cv_c_int64_t _ACEOF ;; esac ac_fn_c_find_uintX_t "$LINENO" "8" "ac_cv_c_uint8_t" case $ac_cv_c_uint8_t in #( no|yes) ;; #( *) $as_echo "#define _UINT8_T 1" >>confdefs.h cat >>confdefs.h <<_ACEOF #define uint8_t $ac_cv_c_uint8_t _ACEOF ;; esac ac_fn_c_find_uintX_t "$LINENO" "16" "ac_cv_c_uint16_t" case $ac_cv_c_uint16_t in #( no|yes) ;; #( *) cat >>confdefs.h <<_ACEOF #define uint16_t $ac_cv_c_uint16_t _ACEOF ;; esac ac_fn_c_find_uintX_t "$LINENO" "32" "ac_cv_c_uint32_t" case $ac_cv_c_uint32_t in #( no|yes) ;; #( *) $as_echo "#define _UINT32_T 1" >>confdefs.h cat >>confdefs.h <<_ACEOF #define uint32_t $ac_cv_c_uint32_t _ACEOF ;; esac ac_fn_c_find_uintX_t "$LINENO" "64" "ac_cv_c_uint64_t" case $ac_cv_c_uint64_t in #( no|yes) ;; #( *) $as_echo "#define _UINT64_T 1" >>confdefs.h cat >>confdefs.h <<_ACEOF #define uint64_t $ac_cv_c_uint64_t _ACEOF ;; esac ac_fn_c_check_type "$LINENO" "off_t" "ac_cv_type_off_t" "$ac_includes_default" if test "x$ac_cv_type_off_t" = xyes; then : else cat >>confdefs.h <<_ACEOF #define off_t long int _ACEOF fi ac_fn_c_check_type "$LINENO" "pid_t" "ac_cv_type_pid_t" "$ac_includes_default" if test "x$ac_cv_type_pid_t" = xyes; then : else cat >>confdefs.h <<_ACEOF #define pid_t int _ACEOF fi ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" if test "x$ac_cv_type_size_t" = xyes; then : else cat >>confdefs.h <<_ACEOF #define size_t unsigned int _ACEOF fi ac_fn_c_check_type "$LINENO" "ssize_t" "ac_cv_type_ssize_t" "$ac_includes_default" if test "x$ac_cv_type_ssize_t" = xyes; then : else cat >>confdefs.h <<_ACEOF #define ssize_t int _ACEOF fi # check if termcap is present, sometimes required by readline { $as_echo "$as_me:${as_lineno-$LINENO}: checking for tgetent in -ltermcap" >&5 $as_echo_n "checking for tgetent in -ltermcap... " >&6; } if ${ac_cv_lib_termcap_tgetent+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ltermcap $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char tgetent (); int main () { return tgetent (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_termcap_tgetent=yes else ac_cv_lib_termcap_tgetent=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_termcap_tgetent" >&5 $as_echo "$ac_cv_lib_termcap_tgetent" >&6; } if test "x$ac_cv_lib_termcap_tgetent" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBTERMCAP 1 _ACEOF LIBS="-ltermcap $LIBS" fi # check for libreadline { $as_echo "$as_me:${as_lineno-$LINENO}: checking for readline in -lreadline" >&5 $as_echo_n "checking for readline in -lreadline... " >&6; } if ${ac_cv_lib_readline_readline+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lreadline $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char readline (); int main () { return readline (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_readline_readline=yes else ac_cv_lib_readline_readline=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_readline_readline" >&5 $as_echo "$ac_cv_lib_readline_readline" >&6; } if test "x$ac_cv_lib_readline_readline" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBREADLINE 1 _ACEOF LIBS="-lreadline $LIBS" else echo "libreadline could not be found, which is required to continue." echo "The libreadline-dev package may be required." exit 1 fi # also need to check if the file is zero'ed (some hardened systems) { $as_echo "$as_me:${as_lineno-$LINENO}: checking for /proc/self/maps" >&5 $as_echo_n "checking for /proc/self/maps... " >&6; } if ${ac_cv_file__proc_self_maps+:} false; then : $as_echo_n "(cached) " >&6 else test "$cross_compiling" = yes && as_fn_error $? "cannot check for file existence when cross compiling" "$LINENO" 5 if test -r "/proc/self/maps"; then ac_cv_file__proc_self_maps=yes else ac_cv_file__proc_self_maps=no fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_file__proc_self_maps" >&5 $as_echo "$ac_cv_file__proc_self_maps" >&6; } if test "x$ac_cv_file__proc_self_maps" = xyes; then : else echo "This system does not seem to have /proc/pid/maps files." exit 1 fi # also need to check this file works { $as_echo "$as_me:${as_lineno-$LINENO}: checking for /proc/self/mem" >&5 $as_echo_n "checking for /proc/self/mem... " >&6; } if ${ac_cv_file__proc_self_mem+:} false; then : $as_echo_n "(cached) " >&6 else test "$cross_compiling" = yes && as_fn_error $? "cannot check for file existence when cross compiling" "$LINENO" 5 if test -r "/proc/self/mem"; then ac_cv_file__proc_self_mem=yes else ac_cv_file__proc_self_mem=no fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_file__proc_self_mem" >&5 $as_echo "$ac_cv_file__proc_self_mem" >&6; } if test "x$ac_cv_file__proc_self_mem" = xyes; then : # LARGEFILE support required for this to work # Check whether --enable-largefile was given. if test "${enable_largefile+set}" = set; then : enableval=$enable_largefile; fi if test "$enable_largefile" != no; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for special C compiler options needed for large files" >&5 $as_echo_n "checking for special C compiler options needed for large files... " >&6; } if ${ac_cv_sys_largefile_CC+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_sys_largefile_CC=no if test "$GCC" != yes; then ac_save_CC=$CC while :; do # IRIX 6.2 and later do not support large files by default, # so use the C compiler's -n32 option if that helps. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include /* Check that off_t can represent 2**63 - 1 correctly. We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : break fi rm -f core conftest.err conftest.$ac_objext CC="$CC -n32" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_sys_largefile_CC=' -n32'; break fi rm -f core conftest.err conftest.$ac_objext break done CC=$ac_save_CC rm -f conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_largefile_CC" >&5 $as_echo "$ac_cv_sys_largefile_CC" >&6; } if test "$ac_cv_sys_largefile_CC" != no; then CC=$CC$ac_cv_sys_largefile_CC fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _FILE_OFFSET_BITS value needed for large files" >&5 $as_echo_n "checking for _FILE_OFFSET_BITS value needed for large files... " >&6; } if ${ac_cv_sys_file_offset_bits+:} false; then : $as_echo_n "(cached) " >&6 else while :; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include /* Check that off_t can represent 2**63 - 1 correctly. We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_sys_file_offset_bits=no; break fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #define _FILE_OFFSET_BITS 64 #include /* Check that off_t can represent 2**63 - 1 correctly. We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_sys_file_offset_bits=64; break fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_sys_file_offset_bits=unknown break done fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_file_offset_bits" >&5 $as_echo "$ac_cv_sys_file_offset_bits" >&6; } case $ac_cv_sys_file_offset_bits in #( no | unknown) ;; *) cat >>confdefs.h <<_ACEOF #define _FILE_OFFSET_BITS $ac_cv_sys_file_offset_bits _ACEOF ;; esac rm -rf conftest* if test $ac_cv_sys_file_offset_bits = unknown; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _LARGE_FILES value needed for large files" >&5 $as_echo_n "checking for _LARGE_FILES value needed for large files... " >&6; } if ${ac_cv_sys_large_files+:} false; then : $as_echo_n "(cached) " >&6 else while :; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include /* Check that off_t can represent 2**63 - 1 correctly. We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_sys_large_files=no; break fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #define _LARGE_FILES 1 #include /* Check that off_t can represent 2**63 - 1 correctly. We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_sys_large_files=1; break fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_sys_large_files=unknown break done fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_large_files" >&5 $as_echo "$ac_cv_sys_large_files" >&6; } case $ac_cv_sys_large_files in #( no | unknown) ;; *) cat >>confdefs.h <<_ACEOF #define _LARGE_FILES $ac_cv_sys_large_files _ACEOF ;; esac rm -rf conftest* fi fi $as_echo "#define HAVE_PROCMEM 1" >>confdefs.h else # This will hurt performance. echo "This system does not seem to have /proc/pid/mem files." echo "Falling back to ptrace() only support." $as_echo "#define HAVE_PROCMEM 0" >>confdefs.h fi # copied from ubuntu-tweak # end copy EXP_VAR=PKGDATADIR FROM_VAR=$datadir/gameconqueror prefix_save=$prefix exec_prefix_save=$exec_prefix if test "x$prefix" = "xNONE"; then prefix=$ac_default_prefix fi if test "x$exec_prefix" = "xNONE"; then exec_prefix=$prefix fi full_var="$FROM_VAR" while true; do new_full_var="`eval echo $full_var`" if test "x$new_full_var" = "x$full_var"; then break; fi full_var=$new_full_var done full_var=$new_full_var PKGDATADIR="$full_var" prefix=$prefix_save exec_prefix=$exec_prefix_save ac_config_files="$ac_config_files Makefile test/Makefile" # Check whether --enable-gui was given. if test "${enable_gui+set}" = set; then : enableval=$enable_gui; enable_gui=true ac_config_files="$ac_config_files gui/Makefile gui/consts.py gui/gameconqueror" else enable_gui=false fi if test x$enable_gui = xtrue; then ENABLE_GUI_TRUE= ENABLE_GUI_FALSE='#' else ENABLE_GUI_TRUE='#' ENABLE_GUI_FALSE= fi cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes: double-quote # substitution turns \\\\ into \\, and sed turns \\ into \. sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then if test "x$cache_file" != "x/dev/null"; then { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} if test ! -f "$cache_file" || test -h "$cache_file"; then cat confcache >"$cache_file" else case $cache_file in #( */* | ?:*) mv -f confcache "$cache_file"$$ && mv -f "$cache_file"$$ "$cache_file" ;; #( *) mv -f confcache "$cache_file" ;; esac fi fi else { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`$as_echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs if test -n "$EXEEXT"; then am__EXEEXT_TRUE= am__EXEEXT_FALSE='#' else am__EXEEXT_TRUE='#' am__EXEEXT_FALSE= fi if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then as_fn_error $? "conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then as_fn_error $? "conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${ENABLE_GUI_TRUE}" && test -z "${ENABLE_GUI_FALSE}"; then as_fn_error $? "conditional \"ENABLE_GUI\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi : "${CONFIG_STATUS=./config.status}" ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 $as_echo "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in #( -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 ## ----------------------------------- ## ## Main body of $CONFIG_STATUS script. ## ## ----------------------------------- ## _ASEOF test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Save the log message, to keep $0 and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by scanmem $as_me 0.13, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF case $ac_config_files in *" "*) set x $ac_config_files; shift; ac_config_files=$*;; esac case $ac_config_headers in *" "*) set x $ac_config_headers; shift; ac_config_headers=$*;; esac cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # Files that config.status was made for. config_files="$ac_config_files" config_headers="$ac_config_headers" config_commands="$ac_config_commands" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ \`$as_me' instantiates files and other configuration actions from templates according to the current configuration. Unless the files and actions are specified as TAGs, all are instantiated by default. Usage: $0 [OPTION]... [TAG]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit --config print configuration, then exit -q, --quiet, --silent do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Configuration commands: $config_commands Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ scanmem config.status 0.13 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" Copyright (C) 2010 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' MKDIR_P='$MKDIR_P' AWK='$AWK' test -n "\$AWK" || AWK=awk _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # The default lists apply if the user does not specify any file. ac_need_defaults=: while test $# != 0 do case $1 in --*=?*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; --*=) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg= ac_shift=: ;; *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) $as_echo "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) $as_echo "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append CONFIG_HEADERS " '$ac_optarg'" ac_need_defaults=false;; --he | --h) # Conflict between --help and --header as_fn_error $? "ambiguous option: \`$1' Try \`$0 --help' for more information.";; --help | --hel | -h ) $as_echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) as_fn_error $? "unrecognized option: \`$1' Try \`$0 --help' for more information." ;; *) as_fn_append ac_config_targets " $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX $as_echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # # INIT-COMMANDS # AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "test/Makefile") CONFIG_FILES="$CONFIG_FILES test/Makefile" ;; "gui/Makefile") CONFIG_FILES="$CONFIG_FILES gui/Makefile" ;; "gui/consts.py") CONFIG_FILES="$CONFIG_FILES gui/consts.py" ;; "gui/gameconqueror") CONFIG_FILES="$CONFIG_FILES gui/gameconqueror" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= ac_tmp= trap 'exit_status=$? : "${ac_tmp:=$tmp}" { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 ac_tmp=$tmp # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. # This happens for instance with `./config.status config.h'. if test -n "$CONFIG_FILES"; then ac_cr=`echo X | tr X '\015'` # On cygwin, bash can eat \r inside `` if the user requested igncr. # But we know of no other shell where ac_cr would be empty at this # point, so we can use a bashism as a fallback. if test "x$ac_cr" = x; then eval ac_cr=\$\'\\r\' fi ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then ac_cs_awk_cr='\\r' else ac_cs_awk_cr=$ac_cr fi echo 'BEGIN {' >"$ac_tmp/subs1.awk" && _ACEOF { echo "cat >conf$$subs.awk <<_ACEOF" && echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h s/^/S["/; s/!.*/"]=/ p g s/^[^!]*!// :repl t repl s/'"$ac_delim"'$// t delim :nl h s/\(.\{148\}\)..*/\1/ t more1 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ p n b repl :more1 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t nl :delim h s/\(.\{148\}\)..*/\1/ t more2 s/["\\]/\\&/g; s/^/"/; s/$/"/ p b :more2 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t delim ' >$CONFIG_STATUS || ac_write_fail=1 rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" } { line = $ 0 nfields = split(line, field, "@") substed = 0 len = length(field[1]) for (i = 2; i < nfields; i++) { key = field[i] keylen = length(key) if (S_is_set[key]) { value = S[key] line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) len += length(value) + length(field[++i]) substed = 1 } else len += 1 + keylen } print line } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF # VPATH may cause trouble with some makes, so we remove sole $(srcdir), # ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ h s/// s/^/:/ s/[ ]*$/:/ s/:\$(srcdir):/:/g s/:\${srcdir}:/:/g s/:@srcdir@:/:/g s/^:*// s/:*$// x s/\(=[ ]*\).*/\1/ G s/\n// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 fi # test -n "$CONFIG_FILES" # Set up the scripts for CONFIG_HEADERS section. # No need to generate them if there are no CONFIG_HEADERS. # This happens for instance with `./config.status Makefile'. if test -n "$CONFIG_HEADERS"; then cat >"$ac_tmp/defines.awk" <<\_ACAWK || BEGIN { _ACEOF # Transform confdefs.h into an awk script `defines.awk', embedded as # here-document in config.status, that substitutes the proper values into # config.h.in to produce config.h. # Create a delimiter string that does not exist in confdefs.h, to ease # handling of long lines. ac_delim='%!_!# ' for ac_last_try in false false :; do ac_tt=`sed -n "/$ac_delim/p" confdefs.h` if test -z "$ac_tt"; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done # For the awk script, D is an array of macro values keyed by name, # likewise P contains macro parameters if any. Preserve backslash # newline sequences. ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* sed -n ' s/.\{148\}/&'"$ac_delim"'/g t rset :rset s/^[ ]*#[ ]*define[ ][ ]*/ / t def d :def s/\\$// t bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3"/p s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p d :bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3\\\\\\n"\\/p t cont s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p t cont d :cont n s/.\{148\}/&'"$ac_delim"'/g t clear :clear s/\\$// t bsnlc s/["\\]/\\&/g; s/^/"/; s/$/"/p d :bsnlc s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p b cont ' >$CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 for (key in D) D_is_set[key] = 1 FS = "" } /^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { line = \$ 0 split(line, arg, " ") if (arg[1] == "#") { defundef = arg[2] mac1 = arg[3] } else { defundef = substr(arg[1], 2) mac1 = arg[2] } split(mac1, mac2, "(") #) macro = mac2[1] prefix = substr(line, 1, index(line, defundef) - 1) if (D_is_set[macro]) { # Preserve the white space surrounding the "#". print prefix "define", macro P[macro] D[macro] next } else { # Replace #undef with comments. This is necessary, for example, # in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. if (defundef == "undef") { print "/*", prefix defundef, macro, "*/" next } } } { print } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 fi # test -n "$CONFIG_HEADERS" eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS" shift for ac_tag do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$ac_tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 $as_echo "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) ac_sed_conf_input=`$as_echo "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac case $ac_tag in *:-:* | *:-) cat >"$ac_tmp/stdin" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac ac_MKDIR_P=$MKDIR_P case $MKDIR_P in [\\/$]* | ?:[\\/]* ) ;; */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; esac _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= ac_sed_dataroot=' /datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 $as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_sed_extra="$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s|@configure_input@|$ac_sed_conf_input|;t t s&@top_builddir@&$ac_top_builddir_sub&;t t s&@top_build_prefix@&$ac_top_build_prefix&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t s&@MKDIR_P@&$ac_MKDIR_P&;t t $ac_datarootdir_hack " eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ "$ac_tmp/out"`; test -z "$ac_out"; } && { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$ac_tmp/stdin" case $ac_file in -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; esac \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; :H) # # CONFIG_HEADER # if test x"$ac_file" != x-; then { $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" } >"$ac_tmp/config.h" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 $as_echo "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" mv "$ac_tmp/config.h" "$ac_file" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 fi else $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ || as_fn_error $? "could not create -" "$LINENO" 5 fi # Compute "$ac_file"'s index in $config_headers. _am_arg="$ac_file" _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" || $as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$_am_arg" : 'X\(//\)[^/]' \| \ X"$_am_arg" : 'X\(//\)$' \| \ X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$_am_arg" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'`/stamp-h$_am_stamp_count ;; :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 $as_echo "$as_me: executing $ac_file commands" >&6;} ;; esac case $ac_file$ac_mode in "depfiles":C) test x"$AMDEP_TRUE" != x"" || { # Autoconf 2.62 quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. case $CONFIG_FILES in *\'*) eval set x "$CONFIG_FILES" ;; *) set x $CONFIG_FILES ;; esac shift for mf do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named `Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`$as_dirname -- "$mf" || $as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$mf" : 'X\(//\)[^/]' \| \ X"$mf" : 'X\(//\)$' \| \ X"$mf" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running `make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n 's/^U = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`$as_dirname -- "$file" || $as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$file" : 'X\(//\)[^/]' \| \ X"$file" : 'X\(//\)$' \| \ X"$file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir=$dirpart/$fdir; as_fn_mkdir_p # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done } ;; esac done # for ac_tag as_fn_exit 0 _ACEOF ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || as_fn_exit 1 fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi scanmem-0.13/gui/0000775000175000017500000000000012002431472010642 500000000000000scanmem-0.13/gui/README0000644000175000017500000000365511320121055011444 00000000000000Game Conqueror ============== Game Conqueror is a graphical game cheating tool under Linux, as a frontend of scanmem. Interface and user-feeling are expected to be similar and hopefully better than CheatEngine (a powerful cheating tool under Windows). Requirement =========== scanmem (latest version) Python PyGTK Usage ===== You are supposed to be familiar with cheating tools like CheatEngine - Search for a value in the Value entry, then press Enter or the scan buttons * Use syntax supported by scanmem 1. : search for the number -- so far you should provide an integer even when search for a float number, and rounding will be used 2. <, =, >: search for values that decreased, not changed, and increased, respectively * You scan enable/disable searching for integer/float using the checkboxes. * Pay attention to 'Found: XX' at topleft * Results will be displayed in the left list if there are not too many - Add a candidate address to the list below by double-click on it or use the context-menu - There you can edit description, value, and lock it. !! Currently only '=' locking is supported, which means the '>' and '<' flags are useless !! Pay attention to the output of GameConqueror, you'll see error messages from scanmem -- so GameConqueror is recommended to be executed in a shell Comparing with CheatEngine ========================== You may have a feeling of deja vu, because the UI is almost a clone of CheatEngine, yep, that's right And here's the differences: Adv. of GameConqueror/scanmem --------------------- * data type/width auto detected -- you won't need to struggle among them anymore! * flexible syntax -- to be implemented Disadv.of GameConqueror/scanmem ----------------------- * memory editing might be supported * currently, assemble/disassemble/pointers are not taken into consideration Author ====== WANG Lu License ======= GPL v3 scanmem-0.13/gui/Makefile.in0000644000175000017500000004470111553203351012636 00000000000000# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 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@ VPATH = @srcdir@ 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 = : subdir = gui DIST_COMMON = README $(dist_bin_SCRIPTS) $(dist_desktop_DATA) \ $(dist_doc_DATA) $(dist_gameconqueror_DATA) $(dist_icons_DATA) \ $(dist_man_MANS) $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ $(srcdir)/consts.py.in $(srcdir)/gameconqueror.in COPYING TODO ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(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 = consts.py gameconqueror CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)" \ "$(DESTDIR)$(desktopdir)" "$(DESTDIR)$(docdir)" \ "$(DESTDIR)$(gameconquerordir)" "$(DESTDIR)$(iconsdir)" SCRIPTS = $(dist_bin_SCRIPTS) SOURCES = DIST_SOURCES = man1dir = $(mandir)/man1 NROFF = nroff MANS = $(dist_man_MANS) DATA = $(dist_desktop_DATA) $(dist_doc_DATA) \ $(dist_gameconqueror_DATA) $(dist_icons_DATA) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ 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@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ OBJEXT = @OBJEXT@ 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@ PKGDATADIR = @PKGDATADIR@ POW_LIB = @POW_LIB@ 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_CC = @ac_ct_CC@ 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_alias = @build_alias@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host_alias = @host_alias@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ 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@ dist_bin_SCRIPTS = gameconqueror dist_gameconqueror_DATA = GameConqueror.xml GameConqueror_128x128.png \ GameConqueror_72x72.png backend.py consts.py misc.py \ hexview.py GameConqueror.py dist_icons_DATA = GameConqueror_128x128.png GameConqueror_72x72.png dist_desktop_DATA = GameConqueror.desktop dist_man_MANS = gameconqueror.1 dist_doc_DATA = README TODO COPYING EXTRA_DIST = gameconqueror.in consts.py.in gameconquerordir = $(datadir)/gameconqueror iconsdir = $(datadir)/pixmaps desktopdir = $(datadir)/applications all: all-am .SUFFIXES: $(srcdir)/Makefile.in: $(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 gui/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign gui/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: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): consts.py: $(top_builddir)/config.status $(srcdir)/consts.py.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ gameconqueror: $(top_builddir)/config.status $(srcdir)/gameconqueror.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ install-dist_binSCRIPTS: $(dist_bin_SCRIPTS) @$(NORMAL_INSTALL) test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)" @list='$(dist_bin_SCRIPTS)'; test -n "$(bindir)" || list=; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \ done | \ sed -e 'p;s,.*/,,;n' \ -e 'h;s|.*|.|' \ -e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ if ($$2 == $$4) { files[d] = files[d] " " $$1; \ if (++n[d] == $(am__install_max)) { \ print "f", d, files[d]; n[d] = 0; files[d] = "" } } \ else { print "f", d "/" $$4, $$1 } } \ END { for (d in files) print "f", d, files[d] }' | \ while read type dir files; do \ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ test -z "$$files" || { \ echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(bindir)$$dir'"; \ $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ } \ ; done uninstall-dist_binSCRIPTS: @$(NORMAL_UNINSTALL) @list='$(dist_bin_SCRIPTS)'; test -n "$(bindir)" || exit 0; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 's,.*/,,;$(transform)'`; \ test -n "$$list" || exit 0; \ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(bindir)" && rm -f $$files install-man1: $(dist_man_MANS) @$(NORMAL_INSTALL) test -z "$(man1dir)" || $(MKDIR_P) "$(DESTDIR)$(man1dir)" @list=''; test -n "$(man1dir)" || exit 0; \ { for i in $$list; do echo "$$i"; done; \ l2='$(dist_man_MANS)'; for i in $$l2; do echo "$$i"; done | \ sed -n '/\.1[a-z]*$$/p'; \ } | while read p; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; echo "$$p"; \ done | \ sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ sed 'N;N;s,\n, ,g' | { \ list=; while read file base inst; do \ if test "$$base" = "$$inst"; then list="$$list $$file"; else \ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \ fi; \ done; \ for i in $$list; do echo "$$i"; done | $(am__base_list) | \ while read files; do \ test -z "$$files" || { \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \ done; } uninstall-man1: @$(NORMAL_UNINSTALL) @list=''; test -n "$(man1dir)" || exit 0; \ files=`{ for i in $$list; do echo "$$i"; done; \ l2='$(dist_man_MANS)'; for i in $$l2; do echo "$$i"; done | \ sed -n '/\.1[a-z]*$$/p'; \ } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ test -z "$$files" || { \ echo " ( cd '$(DESTDIR)$(man1dir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(man1dir)" && rm -f $$files; } install-dist_desktopDATA: $(dist_desktop_DATA) @$(NORMAL_INSTALL) test -z "$(desktopdir)" || $(MKDIR_P) "$(DESTDIR)$(desktopdir)" @list='$(dist_desktop_DATA)'; test -n "$(desktopdir)" || list=; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(desktopdir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(desktopdir)" || exit $$?; \ done uninstall-dist_desktopDATA: @$(NORMAL_UNINSTALL) @list='$(dist_desktop_DATA)'; test -n "$(desktopdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ test -n "$$files" || exit 0; \ echo " ( cd '$(DESTDIR)$(desktopdir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(desktopdir)" && rm -f $$files install-dist_docDATA: $(dist_doc_DATA) @$(NORMAL_INSTALL) test -z "$(docdir)" || $(MKDIR_P) "$(DESTDIR)$(docdir)" @list='$(dist_doc_DATA)'; test -n "$(docdir)" || list=; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(docdir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(docdir)" || exit $$?; \ done uninstall-dist_docDATA: @$(NORMAL_UNINSTALL) @list='$(dist_doc_DATA)'; test -n "$(docdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ test -n "$$files" || exit 0; \ echo " ( cd '$(DESTDIR)$(docdir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(docdir)" && rm -f $$files install-dist_gameconquerorDATA: $(dist_gameconqueror_DATA) @$(NORMAL_INSTALL) test -z "$(gameconquerordir)" || $(MKDIR_P) "$(DESTDIR)$(gameconquerordir)" @list='$(dist_gameconqueror_DATA)'; test -n "$(gameconquerordir)" || list=; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(gameconquerordir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(gameconquerordir)" || exit $$?; \ done uninstall-dist_gameconquerorDATA: @$(NORMAL_UNINSTALL) @list='$(dist_gameconqueror_DATA)'; test -n "$(gameconquerordir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ test -n "$$files" || exit 0; \ echo " ( cd '$(DESTDIR)$(gameconquerordir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(gameconquerordir)" && rm -f $$files install-dist_iconsDATA: $(dist_icons_DATA) @$(NORMAL_INSTALL) test -z "$(iconsdir)" || $(MKDIR_P) "$(DESTDIR)$(iconsdir)" @list='$(dist_icons_DATA)'; test -n "$(iconsdir)" || list=; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(iconsdir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(iconsdir)" || exit $$?; \ done uninstall-dist_iconsDATA: @$(NORMAL_UNINSTALL) @list='$(dist_icons_DATA)'; test -n "$(iconsdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ test -n "$$files" || exit 0; \ echo " ( cd '$(DESTDIR)$(iconsdir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(iconsdir)" && rm -f $$files tags: TAGS TAGS: ctags: CTAGS CTAGS: distdir: $(DISTFILES) @list='$(MANS)'; if test -n "$$list"; then \ list=`for p in $$list; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ if test -f "$$d$$p"; then echo "$$d$$p"; else :; fi; done`; \ if test -n "$$list" && \ grep 'ab help2man is required to generate this page' $$list >/dev/null; then \ echo "error: found man pages containing the \`missing help2man' replacement text:" >&2; \ grep -l 'ab help2man is required to generate this page' $$list | sed 's/^/ /' >&2; \ echo " to fix them, install help2man, remove and regenerate the man pages;" >&2; \ echo " typically \`make maintainer-clean' will remove them" >&2; \ exit 1; \ else :; fi; \ else :; fi @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 $(SCRIPTS) $(MANS) $(DATA) installdirs: for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(desktopdir)" "$(DESTDIR)$(docdir)" "$(DESTDIR)$(gameconquerordir)" "$(DESTDIR)$(iconsdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done 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: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install 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) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dist_desktopDATA install-dist_docDATA \ install-dist_gameconquerorDATA install-dist_iconsDATA \ install-man install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-dist_binSCRIPTS install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-man1 install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-dist_binSCRIPTS uninstall-dist_desktopDATA \ uninstall-dist_docDATA uninstall-dist_gameconquerorDATA \ uninstall-dist_iconsDATA uninstall-man uninstall-man: uninstall-man1 .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic distclean \ distclean-generic distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am \ install-dist_binSCRIPTS install-dist_desktopDATA \ install-dist_docDATA install-dist_gameconquerorDATA \ install-dist_iconsDATA install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-man install-man1 install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic pdf \ pdf-am ps ps-am uninstall uninstall-am \ uninstall-dist_binSCRIPTS uninstall-dist_desktopDATA \ uninstall-dist_docDATA uninstall-dist_gameconquerorDATA \ uninstall-dist_iconsDATA uninstall-man uninstall-man1 # 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: scanmem-0.13/gui/Makefile.am0000644000175000017500000000103311363326070012617 00000000000000dist_bin_SCRIPTS = gameconqueror dist_gameconqueror_DATA = GameConqueror.xml GameConqueror_128x128.png GameConqueror_72x72.png dist_gameconqueror_DATA += backend.py consts.py misc.py hexview.py GameConqueror.py dist_icons_DATA = GameConqueror_128x128.png GameConqueror_72x72.png dist_desktop_DATA = GameConqueror.desktop dist_man_MANS = gameconqueror.1 dist_doc_DATA = README TODO COPYING EXTRA_DIST = gameconqueror.in consts.py.in gameconquerordir=$(datadir)/gameconqueror iconsdir=$(datadir)/pixmaps desktopdir=$(datadir)/applications scanmem-0.13/gui/consts.py0000644000175000017500000000036211746500624012456 00000000000000# constants # should be defined by autotools VERSION = '0.13' DATA_DIR = '/usr/local/share/gameconqueror' SETTINGS = {'scan_data_type':'int32' ,'lock_data_type':'int32' ,'search_scope' : 1 # normal } scanmem-0.13/gui/GameConqueror.xml0000644000175000017500000023104311630610364014061 00000000000000 True GameConqueror center-always 600 600 GameConqueror_128x128.png True True 320 True True 150 True 200 True 28 True 0.10000000149011612 1 Found: 0 False False 0 True True automatic automatic True True 1 False False 420 300 True 105 32 32 True True True Select a process system_image 14 28 263 25 True True 80 98 35 35 True True True Scan find_image 350 93 57 28 True Syntax: For number types: (N is any number, like 12, 0x34 or 5.67) <span font_family="monospace"> <b>N</b> Exactly this number <b>?</b> Unknown initial value <b>&gt; or +</b> Increased values <b>&lt; or -</b> Decreased values <b>=</b> Unchanged values <b>!=</b> Changed values <b>&gt; N</b> Greater than N <b>&lt; N</b> Less than N <b>+ N</b> Increased by N <b>- N</b> Decreased by N </span> For bytearray: use 2-byte hexadecimal notation for each byte, separated by spaces <span font_family="monospace"> e.g. FE DC BA 98 76 54 32 10 </span> For string: enter the string directly 1 Value: <span color="blue"><u>?</u></span> True True 14 98 287 28 True Select a process 0 No process selected 56 28 72 72 True False 72 72 True GameConqueror_72x72.png 350 32 32 True True True Reset refresh_image 385 96 399 154 True 0 out True 12 True 100 28 True Specify type of target data 0 Data Type: 100 35 True True discontinuous 0 bottom 98 63 100 28 True <b>Basic:</b> Fastest but may miss values <b>Normal:</b> Works for most cases <b>Full:</b> Never miss values but slowest 0 Search Scope: 56 100 28 True 98 100 28 True Specify how float numbers should be rounded. Avaiable in the next version 0 Round Type: 28 100 28 True False 98 28 True 14 126 350 10 True 14 70 32 32 True True True True Manually add an entry add_image 385 287 32 32 True True True Remove all entries delete_image 194 287 32 32 True True True Memory Editor edit_image 14 287 True False True False True True automatic automatic 100 True True True False 5 normal False GameConqueror Copyright (C) 2009,2010,2011 WANG Lu <coolwanglu@gmail.com> Copyright (C) 2010 Bryan Cain Special thanks: Zhang Zhe A graphical frontend of scanmem http://code.google.com/p/scanmem/ Homepage GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. <one line to give the program's name and a brief idea of what it does.> Copyright (C) <year> <name of author> 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/>. Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: <program> Copyright (C) <year> <name of author> This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see <http://www.gnu.org/licenses/>. The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read <http://www.gnu.org/philosophy/why-not-lgpl.html>. Wang Lu <coolwanglu(a)gmail.com> GameConqueror_128x128.png True 2 True end False end 0 350 500 Press Ctrl+F to search for a process True GameConqueror_128x128.png normal False True 2 True False 0 in True False 12 True False True False 100 True False 0 Process: False True 0 100 True True • False True 1 False True 0 True False 100 True False 0 User: False True 0 100 True True • False True 1 False True 1 True False Filter True 0 False start True True automatic automatic True True 1 True start True end gtk-ok True True True True False False 0 gtk-cancel True True True True False False 1 False end 2 ProcessListDialog_OK_Button ProcessListDialog_Cancel_Button True gtk-refresh True gtk-find True system True gtk-add True gtk-delete True gtk-edit 280 False GameConqueror_128x128.png True True 70 28 True Address: 140 28 True True 70 28 28 True True True jumpto_image 210 False False 0 True gtk-jump-to 5 False True GameConqueror_128x128.png Manually add an entry normal False True 2 True 12 True 100 28 True Specify type of target data 0 Type: 56 100 28 True Memory address of the value 0 Address: 150 28 True True 98 0 100 28 True 98 56 100 28 True Give a brief description of the value 0 Description: 28 150 28 True True 98 28 1 True end gtk-close True True True True False False 0 gtk-add True True True True False False 1 False end 0 CloseAddCheat_Button ConfirmAddCheat_Button scanmem-0.13/gui/TODO0000644000175000017500000000115611457032240011256 00000000000000TODOs ===== - error handling (target process quitted) for data_worker --> error codes - different color for different addresses (heap, stack, module etc) - limit size of bytes read for memory editor - processlist sortable - popup in memory editor -- like `add entry for this address` - manually add cheat - icon in processlist - Documentation - logging - custom address region scan - real-time update cheatlist/scanlist -- add a 'set' column - different types of locking ('+' & '-') - plugin-like system to support different datatypes (or actually representations) - different representation (dec, hex ...) for cheatlist scanmem-0.13/gui/gameconqueror.in0000644000175000017500000000016211555565070013774 00000000000000#!/bin/bash DATADIR=@PKGDATADIR@ exec gksu --description "GameConqueror" "python -OO $DATADIR/GameConqueror.py" scanmem-0.13/gui/gameconqueror.10000644000175000017500000000163111621754300013516 00000000000000.TH gameconqueror 1 "2011-07-02" "" "" .SH NAME gameconqueror \- A GUI for scanmem, a game hacking tool. .SH SYNOPSIS .B gameconqueror has no options. .SH DESCRIPTION .PP Scanmem is a simple interactive debugging utility for Linux, used to locate the address of a variable in a running process. This can be used for the analysis or modification of a hostile process on a compromised machine, for reverse engineering, or as a "pokefinder" to cheat at video games. .PP GameConqueror is a GUI for scanmem, aims to provide more features than scanmem, and CheatEngline-alike user-friendly interface. .PP .SH USAGE gameconqueror .SH SEE ALSO Website: .SH AUTHOR gameconqueror was written by WANG Lu . See copyright file for full list of authors. .PP This manual page was written by Kartik Mistry , for the Debian project (but may be used by others). scanmem-0.13/gui/backend.py0000644000175000017500000001030311621754300012522 00000000000000#!/usr/bin/env python """ GameConquerorBackend: communication with scanmem Copyright (C) 2010,2011 Wang Lu 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 . """ import subprocess import tempfile import re import gobject BACKEND = ['scanmem', '-b'] BACKEND_END_OF_OUTPUT_PATTERN = re.compile(r'(\d+)>\s*') STDERR_MONITOR_INTERVAL = 100 class GameConquerorBackend(): def __init__(self): self.match_count = 0 self.backend = None self.stderr_monitor_id = None self.error_listeners = [] self.progress_listeners = [] self.version = '' self.restart() def add_error_listener(self, listener): self.error_listeners.append(listener) def add_progress_listener(self, listener): self.progress_listeners.append(listener) def restart(self): if self.backend is not None: self.backend.kill() self.last_pos = 0; self.stderrfile = tempfile.TemporaryFile() self.backend = subprocess.Popen(BACKEND, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=self.stderrfile.fileno()) if self.stderr_monitor_id is not None: gobject.source_remove(self.stderr_monitor_id) self.stderr_monitor_id = gobject.timeout_add(STDERR_MONITOR_INTERVAL, self.stderr_monitor) # read initial info l = self.get_output_lines() if len(l) > 0: self.version = l[0].strip() def stderr_monitor(self): while True: self.stderrfile.seek(0, 2) # to the end if self.stderrfile.tell() == self.last_pos: break self.stderrfile.seek(self.last_pos, 0) msg = self.stderrfile.readline() self.last_pos = self.stderrfile.tell() if msg.startswith('error:'): # error happened msg = msg[len('error:'):] for listener in self.error_listeners: listener(msg) elif msg.startswith('info:'): pass elif msg.startswith('warn:'): pass elif msg.startswith('scan_progress:'): try: l = msg.split(' ') if len(l) == 3: cur = int(l[1]) total = int(l[2]) for listener in self.progress_listeners: listener(cur, total) else: # invalid scan_progress text pass except: pass else: # unknown type of message, maybe log it? pass return True def get_output_lines(self): lines = [] while True: line = self.backend.stdout.readline() match = BACKEND_END_OF_OUTPUT_PATTERN.match(line) if match is None: lines.append(line) else: self.match_count = int(match.groups()[0]) break return lines # for scan command, we don't want get_output immediately def send_command(self, cmd, get_output = True): # for debug print 'Send Command:',cmd self.backend.stdin.write(cmd+'\n') if get_output: output_lines = self.get_output_lines() # for debug # print 'Output:\n'+'\n'.join(output_lines) return output_lines else: return [] # for test only def run(self): while True: print '\n'.join(self.get_output_lines()) l = sys.stdin.readline() self.backend.stdin.write(l) scanmem-0.13/gui/GameConqueror.py0000644000175000017500000012053011666157453013725 00000000000000#!/usr/bin/env python """ Game Conqueror: a graphical game cheating tool, using scanmem as its backend Copyright (C) 2009,2010,2011 Wang Lu Copyright (C) 2010 Bryan Cain 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 . """ import sys import os import re import struct import tempfile import platform import threading import time import pygtk import gtk import gobject from consts import * from hexview import HexView from backend import GameConquerorBackend import misc CLIPBOARD = gtk.clipboard_get() WORK_DIR = os.path.dirname(sys.argv[0]) DATA_WORKER_INTERVAL = 500 # for read(update)/write(lock) SCAN_RESULT_LIST_LIMIT = 1000 # maximal number of entries that can be displayed SCAN_VALUE_TYPES = misc.build_simple_str_liststore(['int' ,'int8' ,'int16' ,'int32' ,'int64' ,'float' ,'float32' ,'float64' ,'number' ,'bytearray' ,'string' ]) LOCK_FLAG_TYPES = misc.build_simple_str_liststore(['=', '+', '-']) LOCK_VALUE_TYPES = misc.build_simple_str_liststore(['int8' ,'int16' ,'int32' ,'int64' ,'float32' ,'float64' ,'bytearray' ,'string' ]) SEARCH_SCOPE_NAMES = ['Basic', 'Normal', 'Full'] # convert type names used by scanmem into ours TYPENAMES_S2G = {'I64':'int64' ,'I64s':'int64' ,'I64u':'int64' ,'I32':'int32' ,'I32s':'int32' ,'I32u':'int32' ,'I16':'int16' ,'I16s':'int16' ,'I16u':'int16' ,'I8':'int8' ,'I8s':'int8' ,'I8u':'int8' ,'F32':'float32' ,'F64':'float64' ,'bytearray':'bytearray' ,'string':'string' } # convert our typenames into struct format characters TYPENAMES_G2STRUCT = {'int8':'b' ,'int16':'h' ,'int32':'i' ,'int64':'q' ,'float32':'f' ,'float64':'d' } # sizes in bytes of integer and float types TYPESIZES = {'int8':1 ,'int16':2 ,'int32':4 ,'int64':8 ,'float32':4 ,'float64':8 } class GameConqueror(): def __init__(self): gtk.settings_get_default().set_long_property('gtk-tooltip-timeout', 0, '') ################################## # init GUI self.builder = gtk.Builder() self.builder.add_from_file(os.path.join(WORK_DIR, 'GameConqueror.xml')) self.main_window = self.builder.get_object('MainWindow') self.main_window.set_title('GameConqueror %s' % (VERSION,)) self.about_dialog = self.builder.get_object('AboutDialog') # set version self.about_dialog.set_version(VERSION) self.process_list_dialog = self.builder.get_object('ProcessListDialog') self.addcheat_dialog = self.builder.get_object('AddCheatDialog') # init memory editor self.memoryeditor_window = self.builder.get_object('MemoryEditor_Window') self.memoryeditor_hexview = HexView() self.memoryeditor_window.child.pack_start(self.memoryeditor_hexview) self.memoryeditor_hexview.show_all() self.memoryeditor_address_entry = self.builder.get_object('MemoryEditor_Address_Entry') self.memoryeditor_hexview.connect('char-changed', self.memoryeditor_hexview_char_changed_cb) self.found_count_label = self.builder.get_object('FoundCount_Label') self.process_label = self.builder.get_object('Process_Label') self.value_input = self.builder.get_object('Value_Input') self.scanoption_frame = self.builder.get_object('ScanOption_Frame') self.scanprogress_progressbar = self.builder.get_object('ScanProgress_ProgressBar') self.scan_button = self.builder.get_object('Scan_Button') self.reset_button = self.builder.get_object('Reset_Button') ### # Set scan data type self.scan_data_type_combobox = self.builder.get_object('ScanDataType_ComboBox') misc.build_combobox(self.scan_data_type_combobox, SCAN_VALUE_TYPES) # apply setting misc.combobox_set_active_item(self.scan_data_type_combobox, SETTINGS['scan_data_type']) ### # set search scope self.search_scope_scale = self.builder.get_object('SearchScope_Scale') self.search_scope_scale_adjustment = gtk.Adjustment(lower=0, upper=2, step_incr=1, page_incr=1, page_size=0) self.search_scope_scale.set_adjustment(self.search_scope_scale_adjustment) # apply setting self.search_scope_scale.set_value(SETTINGS['search_scope']) # init scanresult treeview # we may need a cell data func here # create model self.scanresult_tv = self.builder.get_object('ScanResult_TreeView') self.scanresult_liststore = gtk.ListStore(str, str, str, bool) #addr, value, type, valid self.scanresult_tv.set_model(self.scanresult_liststore) # init columns misc.treeview_append_column(self.scanresult_tv, 'Address', attributes=(('text',0),), properties = (('family', 'monospace'),)) misc.treeview_append_column(self.scanresult_tv, 'Value', attributes=(('text',1),), properties = (('family', 'monospace'),)) # init CheatList TreeView self.cheatlist_tv = self.builder.get_object('CheatList_TreeView') self.cheatlist_liststore = gtk.ListStore(str, bool, str, str, str, str, bool) #lockflag, locked, description, addr, type, value, valid self.cheatlist_tv.set_model(self.cheatlist_liststore) self.cheatlist_tv.set_reorderable(True) self.cheatlist_updates = [] self.cheatlist_editing = False self.cheatlist_tv.connect('key-press-event', self.cheatlist_keypressed) # Lock Flag misc.treeview_append_column(self.cheatlist_tv, '' ,renderer_class = gtk.CellRendererCombo ,attributes = (('text',0),) ,properties = (('editable', True) ,('has-entry', False) ,('model', LOCK_FLAG_TYPES) ,('text-column', 0) ) ,signals = (('edited', self.cheatlist_toggle_lock_flag_cb), ('editing-started', self.cheatlist_edit_start), ('editing-canceled', self.cheatlist_edit_cancel),) ) # Lock misc.treeview_append_column(self.cheatlist_tv, 'Lock' ,renderer_class = gtk.CellRendererToggle ,attributes = (('active',1),) ,properties = (('activatable', True) ,('radio', False) ,('inconsistent', False)) ,signals = (('toggled', self.cheatlist_toggle_lock_cb),) ) # Description misc.treeview_append_column(self.cheatlist_tv, 'Description' ,attributes = (('text',2),) ,properties = (('editable', True),) ,signals = (('edited', self.cheatlist_edit_description_cb), ('editing-started', self.cheatlist_edit_start), ('editing-canceled', self.cheatlist_edit_cancel),) ) # Address misc.treeview_append_column(self.cheatlist_tv, 'Address' ,attributes = (('text',3),) ,properties = (('family', 'monospace'),) ) # Type misc.treeview_append_column(self.cheatlist_tv, 'Type' ,renderer_class = gtk.CellRendererCombo ,attributes = (('text',4),) ,properties = (('editable', True) ,('has-entry', False) ,('model', LOCK_VALUE_TYPES) ,('text-column', 0)) ,signals = (('edited', self.cheatlist_edit_type_cb), ('editing-started', self.cheatlist_edit_start), ('editing-canceled', self.cheatlist_edit_cancel),) ) # Value misc.treeview_append_column(self.cheatlist_tv, 'Value' ,attributes = (('text',5),) ,properties = (('editable', True) ,('family', 'monospace')) ,signals = (('edited', self.cheatlist_edit_value_cb), ('editing-started', self.cheatlist_edit_start), ('editing-canceled', self.cheatlist_edit_cancel),) ) # init ProcessList self.processfilter_input = self.builder.get_object('ProcessFilter_Input') self.userfilter_input = self.builder.get_object('UserFilter_Input') # init ProcessList_TreeView self.processlist_tv = self.builder.get_object('ProcessList_TreeView') self.processlist_tv.get_selection().set_mode(gtk.SELECTION_SINGLE) self.processlist_liststore = gtk.ListStore(str, str, str) self.processlist_filter = self.processlist_liststore.filter_new(root=None) self.processlist_filter.set_visible_func(self.processlist_filter_func, data=None) self.processlist_tv.set_model(self.processlist_filter) self.processlist_tv.set_enable_search(True) self.processlist_tv.set_search_column(1) # first col misc.treeview_append_column(self.processlist_tv, 'PID' ,attributes = (('text',0),) ) # second col misc.treeview_append_column(self.processlist_tv, 'User' ,attributes = (('text',1),) ) # third col misc.treeview_append_column(self.processlist_tv, 'Process' ,attributes = (('text',2),) ) # init AddCheatDialog self.addcheat_address_input = self.builder.get_object('Address_Input') self.addcheat_description_input = self.builder.get_object('Description_Input') self.addcheat_type_combobox = self.builder.get_object('Type_ComboBox') misc.build_combobox(self.addcheat_type_combobox, LOCK_VALUE_TYPES) misc.combobox_set_active_item(self.addcheat_type_combobox, SETTINGS['lock_data_type']) # init popup menu for scanresult self.scanresult_popup = gtk.Menu() misc.menu_append_item(self.scanresult_popup ,'Add to cheat list' ,self.scanresult_popup_cb ,'add_to_cheat_list') misc.menu_append_item(self.scanresult_popup ,'Browse this address' ,self.scanresult_popup_cb ,'browse_this_address') misc.menu_append_item(self.scanresult_popup ,'Scan for this address' ,self.scanresult_popup_cb ,'scan_for_this_address') self.scanresult_popup.show_all() # init popup menu for cheatlist self.cheatlist_popup = gtk.Menu() misc.menu_append_item(self.cheatlist_popup ,'Browse this address' ,self.cheatlist_popup_cb ,'browse_this_address') misc.menu_append_item(self.cheatlist_popup ,'Copy address' ,self.cheatlist_popup_cb ,'copy_address') misc.menu_append_item(self.cheatlist_popup ,'Remove this entry' ,self.cheatlist_popup_cb ,'remove_entry') self.cheatlist_popup.show_all() self.builder.connect_signals(self) self.main_window.connect('destroy', self.exit) ########################### # init others (backend, flag...) self.pid = 0 # target pid self.maps = [] self.last_hexedit_address = (0,0) # used for hexview self.is_scanning = False self.exit_flag = False # currently for data_worker only, other 'threads' may also use this flag self.is_data_worker_working = False self.backend = GameConquerorBackend() self.backend.add_error_listener(self.backend_error_cb) self.backend.add_progress_listener(self.backend_progress_cb) self.check_backend_version() self.search_count = 0 self.data_worker_id = gobject.timeout_add(DATA_WORKER_INTERVAL, self.data_worker) self.command_lock = threading.RLock() ########################### # GUI callbacks def MemoryEditor_Window_delete_event_cb(self, widget, event, data=None): self.memoryeditor_window.hide() return True def MemoryEditor_Button_clicked_cb(self, button, data=None): if self.pid == 0: self.show_error('Please select a process') return self.browse_memory() return True def MemoryEditor_Address_Entry_activate_cb(self, entry, data=None): txt = self.memoryeditor_address_entry.get_text() if txt == '': return try: addr = int(txt, 16) self.browse_memory(addr) except: self.show_error('Invalid address') def MemoryEditor_JumpTo_Button_clicked_cb(self, button, data=None): txt = self.memoryeditor_address_entry.get_text() if txt == '': return try: addr = int(txt, 16) self.browse_memory(addr) except: self.show_error('Invalid address') def RemoveAllCheat_Button_clicked_cb(self, button, data=None): self.cheatlist_liststore.clear() return True def ManuallyAddCheat_Button_clicked_cb(self, button, data=None): self.addcheat_dialog.show() return True def SearchScope_Scale_format_value_cb(self, scale, value, Data=None): return SEARCH_SCOPE_NAMES[int(value)] def Value_Input_activate_cb(self, entry, data=None): self.do_scan() return True def ScanResult_TreeView_button_release_event_cb(self, widget, event, data=None): if event.button == 3: # right click (model, iter) = self.scanresult_tv.get_selection().get_selected() if iter is not None: self.scanresult_popup.popup(None, None, None, event.button, event.get_time()) return True return False return False def ScanResult_TreeView_popup_menu_cb(self, widget, data=None): (model, iter) = self.scanresult_tv.get_selection().get_selected() if iter is not None: self.scanresult_popup.popup(None, None, None, 0, 0) return True return False def ScanResult_TreeView_row_activated_cb(self, treeview, path, view_column, data=None): # add to cheat list (model, iter) = self.scanresult_tv.get_selection().get_selected() if iter is not None: (addr, value, typestr) = model.get(iter, 0, 1, 2) self.add_to_cheat_list(addr, value, typestr) return True return False def CheatList_TreeView_button_release_event_cb(self, widget, event, data=None): if event.button == 3: # right click (model, iter) = self.cheatlist_tv.get_selection().get_selected() if iter is not None: self.cheatlist_popup.popup(None, None, None, event.button, event.get_time()) return True return False return False def CheatList_TreeView_popup_menu_cb(self, widget, data=None): (model, iter) = self.cheatlist_tv.get_selection().get_selected() if iter is not None: self.cheatlist_popup.popup(None, None, None, 0, 0) return True return False def ProcessFilter_Input_changed_cb(self, widget, data=None): self.processlist_filter.refilter() def UserFilter_Input_changed_cb(self, widget, data=None): self.processlist_filter.refilter() def ProcessList_TreeView_row_activated_cb(self, treeview, path, view_column, data=None): (model, iter) = self.processlist_tv.get_selection().get_selected() if iter is not None: (pid, user, process) = model.get(iter, 0, 1, 2) self.select_process(int(pid), process) self.process_list_dialog.response(gtk.RESPONSE_CANCEL) return True return False def SelectProcess_Button_clicked_cb(self, button, data=None): self.processlist_liststore.clear() pl = self.get_process_list() for p in pl: # self.processlist_liststore.append([p[0], (p[1][:50] if len(p) > 1 else '')]) # limit the length here, otherwise it may crash (why?) self.processlist_liststore.append([p[0], (p[1] if len(p) > 1 else ''),(p[2] if len(p) > 2 else '')]) self.process_list_dialog.show() while True: res = self.process_list_dialog.run() if res == gtk.RESPONSE_OK: # -5 (model, iter) = self.processlist_tv.get_selection().get_selected() if iter is None: self.show_error('Please select a process') continue else: (pid, process) = model.get(iter, 0, 1) self.select_process(int(pid), process) break else: # for None and Cancel break self.process_list_dialog.hide() return True def ConfirmAddCheat_Button_clicked_cb(self, button, data=None): try: addr = self.addcheat_address_input.get_text() except ValueError: self.show_error('Please enter a valid address.') return False description = self.addcheat_description_input.get_text() if not description: description = 'No Description' typestr = LOCK_VALUE_TYPES[self.addcheat_type_combobox.get_active()][0] if 'int' in typestr: value = 0 elif 'float' in typestr: value = 0.0 elif 'string' in typestr: value = '' else: value = None self.add_to_cheat_list(addr, value, typestr, description) self.addcheat_dialog.hide() return True def CloseAddCheat_Button_clicked_cb(self, button, data=None): self.addcheat_dialog.hide() return True def Scan_Button_clicked_cb(self, button, data=None): self.do_scan() return True def Reset_Button_clicked_cb(self, button, data=None): self.reset_scan() return True def Logo_EventBox_button_release_event_cb(self, widget, data=None): self.about_dialog.run() self.about_dialog.hide() return True ####################### # customed callbacks # (i.e. not standard event names are used) def memoryeditor_hexview_char_changed_cb(self, hexview, offset, charval): addr = hexview.base_addr + offset self.write_value(addr, 'int8', charval) # return False such that the byte the default handler will be called, and will be displayed correctly return False def cheatlist_edit_start(self, a, b, c): self.cheatlist_editing = True def cheatlist_edit_cancel(self, a): self.cheatlist_editing = False def scanresult_popup_cb(self, menuitem, data=None): (model, iter) = self.scanresult_tv.get_selection().get_selected() (addr, value, typestr) = model.get(iter, 0, 1, 2) if iter is None: return False if data == 'add_to_cheat_list': self.add_to_cheat_list(addr, value, typestr) return True elif data == 'browse_this_address': self.browse_memory(int(addr,16)) return True elif data == 'scan_for_this_address': self.scan_for_addr(int(addr,16)) return True return False def cheatlist_keypressed(self, cheatlist_tv, event, selection=None): keycode = event.keyval pressedkey = gtk.gdk.keyval_name(keycode) if pressedkey == 'Delete': (model, iter) = self.cheatlist_tv.get_selection().get_selected() if iter is None: return self.cheatlist_liststore.remove(iter) def cheatlist_popup_cb(self, menuitem, data=None): self.cheatlist_editing = False (model, iter) = self.cheatlist_tv.get_selection().get_selected() addr = model.get(iter, 3)[0] if iter is None: return False if data == 'remove_entry': self.cheatlist_liststore.remove(iter) return True elif data == 'browse_this_address': self.browse_memory(int(addr,16)) return True elif data == 'copy_address': CLIPBOARD.set_text(addr) return True return False def cheatlist_toggle_lock_cb(self, cellrenderertoggle, path, data=None): row = int(path) if self.cheatlist_liststore[row][6]: # valid locked = self.cheatlist_liststore[row][1] locked = not locked self.cheatlist_liststore[row][1] = locked if locked: #TODO: check value(valid number & not overflow), if failed, unlock it and do nothing pass else: #TODO: update its value? pass return True def cheatlist_toggle_lock_flag_cb(self, cell, path, new_text, data=None): self.cheatlist_editing = False # currently only one lock flag is supported return True row = int(path) self.cheatlist_liststore[row][0] = new_text # data_worker will handle this later return True def cheatlist_edit_description_cb(self, cell, path, new_text, data=None): self.cheatlist_editing = False row = int(path) self.cheatlist_liststore[row][2] = new_text return True def cheatlist_edit_value_cb(self, cell, path, new_text, data=None): self.cheatlist_editing = False # ignore empty value if new_text == '': return True row = int(path) if not self.cheatlist_liststore[row][6]: #not valid return True self.cheatlist_liststore[row][5] = new_text if self.cheatlist_liststore[row][1]: # locked # data_worker will handle this pass else: # write it for once (lockflag, locked, desc, addr, typestr, value, valid) = self.cheatlist_liststore[row] self.cheatlist_updates.append(row) self.write_value(addr, typestr, value) return True def cheatlist_edit_type_cb(self, cell, path, new_text, data=None): self.cheatlist_editing = False row = int(path) self.cheatlist_liststore[row][4] = new_text if self.cheatlist_liststore[row][1]: # locked # false unlock it self.cheatlist_liststore[row][1] = False pass return True def processlist_filter_func(self, model, iter, data=None): (pid, user, process) = model.get(iter, 0, 1, 2) return process is not None and \ process.find(self.processfilter_input.get_text()) != -1 and \ user is not None and \ user.find(self.userfilter_input.get_text()) != -1 ############################ # core functions def show_error(self, msg): dialog = gtk.MessageDialog(None ,gtk.DIALOG_MODAL ,gtk.MESSAGE_ERROR ,gtk.BUTTONS_OK ,msg) dialog.run() dialog.destroy() # return None if unknown def get_pointer_width(self): bits = platform.architecture()[0] if not bits.endswith('bit'): return None try: bitn = int(bits[:-len('bit')]) if bitn not in [8,16,32,64]: return None else: return bitn except: return None # return the size in bytes of the value in memory def get_type_size(self, typename, value): if typename in TYPESIZES.keys(): # int or float type; fixed length return TYPESIZES[typename] elif typename == 'bytearray': return (len(value.strip())+1)/3 elif typename == 'string': return len(eval('\''+value+'\'')) return None # parse bytes dumped by scanmem into number, string, etc. def bytes2value(self, typename, bytes): if bytes is None: return None if typename in TYPENAMES_G2STRUCT.keys(): return struct.unpack(TYPENAMES_G2STRUCT[typename], bytes)[0] elif typename == 'string': return repr('%s'%(bytes,))[1:-1] elif typename == 'bytearray': return ' '.join(['%02x'%ord(i) for i in bytes]) else: return bytes def scan_for_addr(self, addr): bits = self.get_pointer_width() if bits is None: show_error('Unknown architecture, you may report to developers') return self.reset_scan() self.value_input.set_text('%#x'%(addr,)) misc.combobox_set_active_item(self.scan_data_type_combobox, 'int%d'%(bits,)) self.do_scan() def browse_memory(self, addr=None): # select a region contains addr try: self.read_maps() except: show_error('Cannot retieve memory maps of that process, maybe it has exited (crashed), or you don\'t have enough privilege') selected_region = None if addr: for m in self.maps: if m['start_addr'] <= addr and addr < m['end_addr']: selected_region = m break if selected_region: if selected_region['flags'][0] != 'r': # not readable show_error('Address %x is not readable' % (addr,)) return else: show_error('Address %x is not valid' % (addr,)) return else: # just select the first readable region for m in self.maps: if m['flags'][0] == 'r': selected_region = m break if selected_region is None: self.show_error('Cannot find a readable region') return addr = selected_region['start_addr'] # read region if necessary start_addr = max(addr - 1024, selected_region['start_addr']) end_addr = min(addr + 1024, selected_region['end_addr']) if self.last_hexedit_address[0] != start_addr or \ self.last_hexedit_address[1] != end_addr: data = self.read_memory(start_addr, end_addr - start_addr) if data is None: self.show_error('Cannot read memory') return self.last_hexedit_address = (start_addr, end_addr) self.memoryeditor_hexview.payload=data self.memoryeditor_hexview.base_addr = start_addr # set editable flag self.memoryeditor_hexview.editable = (selected_region['flags'][1] == 'w') if addr: self.memoryeditor_hexview.show_addr(addr) self.memoryeditor_window.show() # this callback will be called from other thread def backend_error_cb(self, msg): gtk.gdk.threads_enter() # we don't want massive error output for data worker if not self.is_data_worker_working: self.show_error('Backend error: %s'%(msg,)) if self.is_scanning: self.finish_scan() gtk.gdk.threads_leave() # this callback will be called from other thread def backend_progress_cb(self, cur, total): gtk.gdk.threads_enter() # cur and total may be 0! if (cur == total) and self.is_scanning: self.scanprogress_progressbar.set_fraction(1.0) self.finish_scan() else: self.scanprogress_progressbar.set_fraction(float(cur)/total) gtk.gdk.threads_leave() def add_to_cheat_list(self, addr, value, typestr, description='No Description'): # determine longest possible type types = typestr.split() vt = typestr for t in types: if TYPENAMES_S2G.has_key(t): vt = TYPENAMES_S2G[t] break self.cheatlist_liststore.prepend(['=', False, description, addr, vt, value, True]) def get_process_list(self): return [map(str.strip, e.strip().split(' ',2)) for e in os.popen('ps -wweo pid=,user=,command= --sort=-pid').readlines()] def select_process(self, pid, process_name): # ask backend for attaching the target process # update 'current process' # reset flags # for debug/log # print 'Select process: %d - %s' % (pid, process_name) self.pid = pid try: self.read_maps() except: self.pid = 0 self.process_label.set_text('No process selected') self.process_label.set_property('tooltip-text', 'Select a process') self.show_error('Cannot retieve memory maps of that process, maybe it has exited (crashed), or you don\'t have enough privilege') self.process_label.set_text('%d - %s' % (pid, process_name)) self.process_label.set_property('tooltip-text', process_name) self.command_lock.acquire() self.backend.send_command('pid %d' % (pid,)) self.reset_scan() self.command_lock.release() # unlock all entries in cheat list for i in xrange(len(self.cheatlist_liststore)): self.cheatlist_liststore[i][1] = False def read_maps(self): lines = open('/proc/%d/maps' % (self.pid,)).readlines() self.maps = [] for l in lines: item = {} info = l.split(' ', 5) addr = info[0] idx = addr.index('-') item['start_addr'] = int(addr[:idx],16) item['end_addr'] = int(addr[idx+1:],16) item['size'] = item['end_addr'] - item['start_addr'] item['flags'] = info[1] item['offset'] = info[2] item['dev'] = info[3] item['inode'] = int(info[4]) if len(info) < 6: item['pathname'] = '' else: item['pathname'] = info[5].lstrip() # don't use strip self.maps.append(item) def reset_scan(self): self.command_lock.acquire() self.search_count = 0 # reset search type and value type self.scanresult_liststore.clear() self.command_lock.acquire() self.backend.send_command('reset') self.update_scan_result() self.command_lock.release() self.scanoption_frame.set_sensitive(True) def apply_scan_settings (self): # scan data type active = self.scan_data_type_combobox.get_active() assert(active >= 0) dt = self.scan_data_type_combobox.get_model()[active][0] self.command_lock.acquire() self.backend.send_command('option scan_data_type %s' % (dt,)) # search scope self.backend.send_command('option region_scan_level %d' %(1 + int(self.search_scope_scale.get_value()),)) # TODO: ugly, reset to make region_scan_level taking effect self.backend.send_command('reset') self.command_lock.release() # perform scanning through backend # set GUI if needed def do_scan(self): if self.pid == 0: self.show_error('Please select a process') return active = self.scan_data_type_combobox.get_active() assert(active >= 0) data_type = self.scan_data_type_combobox.get_model()[active][0] cmd = self.value_input.get_text() try: cmd = misc.check_scan_command(data_type, cmd) except Exception,e: # this is not quite good self.show_error(e.args[0]) return # disable the window before perform scanning, such that if result come so fast, we won't mess it up self.search_count +=1 self.scanoption_frame.set_sensitive(False) # no need to check search_count here self.main_window.set_sensitive(False) self.memoryeditor_window.set_sensitive(False) self.is_scanning = True # set scan options only when first scan, since this will reset backend self.command_lock.acquire() if self.search_count == 1: self.apply_scan_settings() self.backend.send_command(cmd, get_output = False) # command_lock will be released when scanning is finished def finish_scan(self): self.main_window.set_sensitive(True) self.memoryeditor_window.set_sensitive(True) self.backend.get_output_lines() self.is_scanning = False self.update_scan_result() self.command_lock.release() def update_scan_result(self): self.found_count_label.set_text('Found: %d' % (self.backend.match_count,)) if (self.backend.match_count > SCAN_RESULT_LIST_LIMIT): self.scanresult_liststore.clear() else: self.command_lock.acquire() lines = self.backend.send_command('list') self.command_lock.release() self.scanresult_tv.set_model(None) # temporarily disable model for scanresult_liststore for the sake of performance self.scanresult_liststore.clear() for line in lines: line = line[line.find(']')+1:] (a, v, t) = map(str.strip, line.split(',')[:3]) a = '%x'%(int(a,16),) t = t[1:-1] self.scanresult_liststore.append([a, v, t, True]) self.scanresult_tv.set_model(self.scanresult_liststore) # return (r1, r2) where all rows between r1 and r2 (INCLUSIVE) are visible # return None if no row visible def get_visible_rows(self, treeview): rect = treeview.get_visible_rect() (x1,y1) = treeview.tree_to_widget_coords(rect.x,rect.y) (x2,y2) = treeview.tree_to_widget_coords(rect.x+rect.width,rect.y+rect.height) tup = treeview.get_path_at_pos(x1, y1) if tup is None: return None r1 = tup[0][0] tup = treeview.get_path_at_pos(x2, y2) if tup is None: r2 = len(treeview.get_model()) - 1 else: r2 = tup[0][0] return (r1, r2) # read/write data periodically def data_worker(self): if (not self.is_scanning) and self.command_lock.acquire(0): # non-blocking self.is_data_worker_working = True rows = self.get_visible_rows(self.scanresult_tv) if rows is not None: (r1, r2) = rows # [r1, r2] rows are visible for i in xrange(r1, r2+1): row = self.scanresult_liststore[i] addr, cur_value, scanmem_type, valid = row if valid: new_value = self.read_value(addr, TYPENAMES_S2G[scanmem_type.strip()], cur_value) if new_value is not None: row[1] = str(new_value) else: row[1] = '??' row[3] = False # write locked values in cheat list and read unlocked values for i in xrange(len(self.cheatlist_liststore)): (lockflag, locked, desc, addr, typestr, value, valid) = self.cheatlist_liststore[i] if not valid: continue if locked: self.write_value(addr, typestr, value) elif i in self.cheatlist_updates: self.write_value(addr, typestr, value) self.cheatlist_updates.remove(i) else: newvalue = self.read_value(addr, typestr, value) if newvalue is None: self.cheatlist_liststore[i] = (lockflag, False, desc, addr, typestr, '??', False) elif newvalue != value and not locked and not self.cheatlist_editing: self.cheatlist_liststore[i] = (lockflag, locked, desc, addr, typestr, newvalue, valid) self.command_lock.release() self.is_data_worker_working = False return not self.exit_flag def read_value(self, addr, typestr, prev_value): return self.bytes2value(typestr, self.read_memory(addr, self.get_type_size(typestr, prev_value))) # addr could be int or str def read_memory(self, addr, length): if not isinstance(addr,str): addr = '%x'%(addr,) f = tempfile.NamedTemporaryFile() self.command_lock.acquire() self.backend.send_command('dump %s %d %s' % (addr, length, f.name)) self.command_lock.release() data = f.read() # lines = self.backend.send_command('dump %s %d' % (addr, length)) # data = '' # for line in lines: # bytes = line.strip().split() # for byte in bytes: data += chr(int(byte, 16)) # TODO raise Exception here isn't good if len(data) != length: # self.show_error('Cannot access target memory') data = None return data # addr could be int or str def write_value(self, addr, typestr, value): if not isinstance(addr,str): addr = '%x'%(addr,) self.command_lock.acquire() self.backend.send_command('write %s %s %s'%(typestr, addr, value)) self.command_lock.release() def exit(self, object, data=None): self.exit_flag = True gtk.main_quit() def main(self): gtk.main() def check_backend_version(self): if self.backend.version != VERSION: self.show_error('Version of scanmem mismatched, you may encounter problems. Please make sure you are using the same version of Gamconqueror as scanmem.') if __name__ == '__main__': gobject.threads_init() gtk.gdk.threads_init() GameConqueror().main() scanmem-0.13/gui/hexview.py0000644000175000017500000006130411513032516012617 00000000000000#!/usr/bin/env python # -*- coding: utf-8 -*- # HexView.py # # Extended by Wang Lu # Added editing and cursor moving stuff # Copyright (C) 2010,2011 WANG Lu # # First version # Copyright (C) 2008, 2009 Adriano Monteiro Marques # Author: Francesco Piccinno # # 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA import gtk import pango import gobject class BaseText(gtk.TextView): __gtype_name__ = "BaseText" def __init__(self, parent): self.buffer = gtk.TextBuffer(parent.table) gtk.TextView.__init__(self, self.buffer) self._parent = parent self.modify_font(pango.FontDescription(parent.font)) self.set_editable(False) gobject.type_register(BaseText) class OffsetText(BaseText): def __init__(self, parent): BaseText.__init__(self, parent) self.off_len = 1 self.connect('button-press-event', self.__on_button_press) self.connect('size-request', self.__on_size_request) self.connect('realize', self.__on_realize) self.set_cursor_visible(False) def __on_button_press(self, widget, evt): return True def __on_realize(self, widget): self.modify_base(gtk.STATE_NORMAL, self.style.dark[gtk.STATE_NORMAL]) return True def render(self, txt): self.buffer.set_text('') base_addr = self._parent.base_addr bpl = self._parent.bpl tot_lines = int(len(txt) / bpl) if len(txt) % bpl != 0: tot_lines += 1 self.off_len = len('%x'%(base_addr+len(txt),)) output = [] for i in xrange(tot_lines): output.append(("%0" + str(self.off_len) + "x") % (base_addr + i*bpl)) if output: self.buffer.insert_with_tags( self.buffer.get_end_iter(), "\n".join(output), self._parent.tag_offset ) def __on_size_request(self, widget, alloc): ctx = self.get_pango_context() font = ctx.load_font(pango.FontDescription(self._parent.font)) metric = font.get_metrics(ctx.get_language()) w = pango.PIXELS(metric.get_approximate_char_width()) * (self.off_len + 1) w += 2 if alloc.width < w: alloc.width = w return True class AsciiText(BaseText): _printable = \ "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!\"#$%" \ "&'()*+,-./:;<=>?@[\]^_`{|}~ " def __init__(self, parent): BaseText.__init__(self, parent) self.connect('size-request', self.__on_size_request) self.connect('key-press-event', self.__on_key_press) self.connect('button-release-event', self.__on_button_release) self.connect_after('move-cursor', self.__on_move_cursor) self.prev_start = None self.prev_end = None def __on_move_cursor(self, textview, step_size, count, extend_selection, data=None): if True: #step_size == gtk.MOVEMENT_VISUAL_POSITIONS: buffer = self.get_buffer() insert_mark = buffer.get_insert() insert_iter = buffer.get_iter_at_mark(insert_mark) insert_off = insert_iter.get_offset() if not extend_selection: if (insert_off+1) % (self._parent.bpl+1) == 0: if count > 0: # try to move forward if insert_iter.is_end(): end_iter = insert_iter.copy() insert_iter.backward_char() else: insert_iter.forward_char() end_iter = insert_iter.copy() end_iter.forward_char() elif count < 0: # try to move backward if insert_iter.is_start(): end_iter = insert_iter.copy() end_iter.forward_char() else: end_iter = insert_iter.copy() insert_iter.backward_char() else: if insert_iter.is_end(): end_iter = insert_iter.copy() insert_iter.backward_char() else: end_iter = insert_iter.copy() end_iter.forward_char() # select one char buffer.select_range(insert_iter, end_iter) # select one char buffer.select_range(insert_iter, end_iter) return True def __on_key_press(self, widget, evt, data=None): if not self._parent.editable: return False c = evt.keyval if c < 256 and (chr(c) in AsciiText._printable): buffer = self.get_buffer() bounds = buffer.get_selection_bounds() if bounds and (bounds[1].get_offset() - bounds[0].get_offset() > 1): self.select_a_char() else: iter = buffer.get_iter_at_mark(buffer.get_insert()) off = iter.get_offset() org_off = off - off / (self._parent.bpl + 1) self._parent.emit('char-changed', org_off, c) self.select_a_char(buffer.get_iter_at_offset(off+1)) return True return False def __on_button_release(self, widget, event, data=None): buffer = self.get_buffer() bounds = buffer.get_selection_bounds() if (not bounds) or (bounds[1].get_offset() - bounds[0].get_offset() == 1): self.select_a_char() # return False in order to let other handler handle it return False # we want at least one char is selected all the time def select_a_char(self, insert_iter = None): buffer = self.get_buffer() if insert_iter is None: insert_iter = buffer.get_iter_at_mark(buffer.get_insert()) insert_off = insert_iter.get_offset() if (insert_off+1) % (self._parent.bpl+1) == 0: if insert_iter.is_end(): end_iter = insert_iter.copy() insert_iter.backward_char() else: insert_iter.forward_char() end_iter = insert_iter.copy() end_iter.forward_char() else: end_iter = insert_iter.copy() end_iter.forward_char() buffer.select_range(insert_iter, end_iter) self.scroll_to_iter(insert_iter, 0) def render(self, txt): self.buffer.set_text('') bpl = self._parent.bpl tot_lines = len(txt) / bpl if len(txt) % bpl != 0: tot_lines += 1 output = [] convert = lambda i: "".join( map(lambda x: (x in AsciiText._printable) and (x) or ('.'), list(i))) for i in xrange(tot_lines): if i * bpl + bpl > len(txt): output.append( convert(txt[i * bpl:]) ) else: output.append( convert(txt[i * bpl:(i * bpl) + bpl]) ) if output: self.buffer.insert_with_tags( self.buffer.get_end_iter(), "\n".join(output), self._parent.tag_ascii ) def __on_size_request(self, widget, alloc): ctx = self.get_pango_context() font = ctx.load_font(pango.FontDescription(self._parent.font)) metric = font.get_metrics(ctx.get_language()) w = pango.PIXELS(metric.get_approximate_char_width()) * self._parent.bpl w += 2 if alloc.width < w: alloc.width = w return True # start and end are offset to the original text def select_blocks(self, start=None, end=None): if not start and not end: # deselect if self.prev_start and self.prev_end and \ self.prev_start != self.prev_end: self.buffer.remove_tag(self._parent.tag_sec_sel, self.buffer.get_iter_at_mark(self.prev_start), self.buffer.get_iter_at_mark(self.prev_end)) self.buffer.delete_mark(self.prev_start) self.prev_start = None self.buffer.delete_mark(self.prev_end) self.prev_end = None return bpl = self._parent.bpl start += start/bpl end += end/bpl if self.prev_start and self.prev_end: if self.buffer.get_iter_at_mark(self.prev_start).get_offset() == start \ and self.buffer.get_iter_at_mark(self.prev_end).get_offset() == end: # nothing to do return else: # remove old selection self.buffer.remove_tag(self._parent.tag_sec_sel, self.buffer.get_iter_at_mark(self.prev_start), self.buffer.get_iter_at_mark(self.prev_end)) # apply new selection start_iter = self.buffer.get_iter_at_offset(start) end_iter = self.buffer.get_iter_at_offset(end) self.buffer.apply_tag(self._parent.tag_sec_sel, start_iter, end_iter) if self.prev_start: self.buffer.move_mark(self.prev_start, start_iter) else: self.prev_start = self.buffer.create_mark(None, start_iter, True) if self.prev_end: self.buffer.move_mark(self.prev_end, end_iter) else: self.prev_end = self.buffer.create_mark(None, end_iter, False) class HexText(BaseText): _hexdigits = '0123456789abcdefABCDEF' def __init__(self, parent): BaseText.__init__(self, parent) self.connect('size-request', self.__on_size_request) self.connect('realize', self.__on_realize) self.connect('button-release-event', self.__on_button_release) self.connect('key-press-event', self.__on_key_press) self.connect_after('move-cursor', self.__on_move_cursor) self.prev_start = None self.prev_end = None def __on_key_press(self, widget, evt, data=None): if not self._parent.editable: return False char = evt.keyval if char < 256 and (chr(char) in HexText._hexdigits): buffer = self.get_buffer() bounds = buffer.get_selection_bounds() if bounds and (bounds[1].get_offset() - bounds[0].get_offset() > 1): self.select_a_char() else: c = chr(char).upper() iter = buffer.get_iter_at_mark(buffer.get_insert()) off = iter.get_offset() pos = off % 3 org_off = off / 3 txt = buffer.get_text( buffer.get_iter_at_offset(org_off*3), buffer.get_iter_at_offset(org_off*3+2), True) if pos < 2: l = list(txt) l[pos] = c self._parent.emit('char-changed', org_off, int(''.join(l),16)) self.select_a_char(buffer.get_iter_at_offset(off+1)) return True return False def __on_button_release(self, widget, event, data=None): buffer = self.get_buffer() bounds = buffer.get_selection_bounds() if (not bounds) or (bounds[1].get_offset() - bounds[0].get_offset() == 1): self.select_a_char() # return False in order to let other handler handle it return False # we want at least one char is selected all the time def select_a_char(self, insert_iter = None): buffer = self.get_buffer() if insert_iter is None: insert_iter = buffer.get_iter_at_mark(buffer.get_insert()) insert_off = insert_iter.get_offset() if insert_off % 3 == 2: if insert_iter.is_end(): end_iter = insert_iter.copy() insert_iter.backward_char() else: insert_iter.forward_char() end_iter = insert_iter.copy() end_iter.forward_char() else: end_iter = insert_iter.copy() end_iter.forward_char() buffer.select_range(insert_iter, end_iter) self.scroll_to_iter(insert_iter, 0) def __on_move_cursor(self, textview, step_size, count, extend_selection, data=None): if True: #step_size == gtk.MOVEMENT_VISUAL_POSITIONS: buffer = self.get_buffer() insert_mark = buffer.get_insert() insert_iter = buffer.get_iter_at_mark(insert_mark) insert_off = insert_iter.get_offset() if not extend_selection: if insert_off % 3 == 2: if count > 0: # try to move forward if insert_iter.is_end(): end_iter = insert_iter.copy() insert_iter.backward_char() else: insert_iter.forward_char() end_iter = insert_iter.copy() end_iter.forward_char() elif count < 0: # try to move backward if insert_iter.is_start(): end_iter = insert_iter.copy() end_iter.forward_char() else: end_iter = insert_iter.copy() insert_iter.backward_char() else: if insert_iter.is_end(): end_iter = insert_iter.copy() insert_iter.backward_char() else: end_iter = insert_iter.copy() end_iter.forward_char() # select one char buffer.select_range(insert_iter, end_iter) return True return False def __on_realize(self, widget): self.modify_base(gtk.STATE_NORMAL, self.style.mid[gtk.STATE_NORMAL]) def render(self, txt): self.buffer.set_text('') bpl = self._parent.bpl tot_lines = int(len(txt) / bpl) if len(txt) % bpl != 0: tot_lines += 1 output = [] convert = lambda x: '%02X'%(ord(x),) for i in xrange(tot_lines): if i * bpl + bpl > len(txt): output.append( " ".join(map(convert, txt[i * bpl:])) ) else: output.append( " ".join(map(convert, txt[i * bpl:(i * bpl) + bpl])) ) if output: self.buffer.insert_with_tags( self.buffer.get_end_iter(), "\n".join(output).upper(), self._parent.tag_hex ) def __on_size_request(self, widget, alloc): ctx = self.get_pango_context() font = ctx.load_font(pango.FontDescription(self._parent.font)) metric = font.get_metrics(ctx.get_language()) w = pango.PIXELS(metric.get_approximate_char_width()) * \ (self._parent.bpl * 3 - 1) w += 2 if alloc.width < w: alloc.width = w # start and end are offset to the original text def select_blocks(self, start=None, end=None): if not start and not end: # deselect if self.prev_start and self.prev_end and \ self.prev_start != self.prev_end: self.buffer.remove_tag(self._parent.tag_sec_sel, self.buffer.get_iter_at_mark(self.prev_start), self.buffer.get_iter_at_mark(self.prev_end)) self.buffer.delete_mark(self.prev_start) self.prev_start = None self.buffer.delete_mark(self.prev_end) self.prev_end = None return start *= 3 end = end * 3 -1 if self.prev_start and self.prev_end: if self.buffer.get_iter_at_mark(self.prev_start).get_offset() == start \ and self.buffer.get_iter_at_mark(self.prev_end).get_offset() == end: return else: # remove old selection self.buffer.remove_tag(self._parent.tag_sec_sel, self.buffer.get_iter_at_mark(self.prev_start), self.buffer.get_iter_at_mark(self.prev_end)) start_iter = self.buffer.get_iter_at_offset(start) end_iter = self.buffer.get_iter_at_offset(end) self.buffer.apply_tag(self._parent.tag_sec_sel, start_iter, end_iter) if self.prev_start: self.buffer.move_mark(self.prev_start, start_iter) else: self.prev_start = self.buffer.create_mark(None, start_iter, True) if self.prev_end: self.buffer.move_mark(self.prev_end, end_iter) else: self.prev_end = self.buffer.create_mark(None, end_iter, False) class HexView(gtk.HBox): __gtype_name__ = "HexView" def __init__(self): gtk.HBox.__init__(self, False, 4) self.set_border_width(4) self.table = gtk.TextTagTable() self.tag_offset = gtk.TextTag('hex-o-view') # offset view self.tag_hex = gtk.TextTag('hex-x-view') # hex view self.tag_ascii = gtk.TextTag('hex-a-view') # ascii view self.tag_sec_sel = gtk.TextTag('hex-s-selection') # secondary selection self.table.add(self.tag_offset) self.table.add(self.tag_hex) self.table.add(self.tag_ascii) self.table.add(self.tag_sec_sel) self._bpl = 16 self._font = "Monospace 10" self._payload = "" self._base_addr = 0; self.scroll_mark = None self.editable = False self.vadj = gtk.Adjustment() self.vscroll = gtk.VScrollbar(self.vadj) self.offset_text = OffsetText(self) self.hex_text = HexText(self) self.ascii_text = AsciiText(self) self.offset_text.set_scroll_adjustments(None, self.vadj) self.hex_text.set_scroll_adjustments(None, self.vadj) self.ascii_text.set_scroll_adjustments(None, self.vadj) self.hex_text.buffer.connect('mark-set', self.__on_hex_change) self.ascii_text.buffer.connect('mark-set', self.__on_ascii_change) self.offset_text.connect('scroll-event', self.__on_scroll_event) self.hex_text.connect('scroll-event', self.__on_scroll_event) self.ascii_text.connect('scroll-event', self.__on_scroll_event) def scroll(widget): widget.set_size_request(-1, 128) frame = gtk.Frame() frame.set_shadow_type(gtk.SHADOW_IN) frame.add(widget) return frame self.pack_start(scroll(self.offset_text), False, False) self.pack_start(scroll(self.hex_text), False, False) self.pack_start(scroll(self.ascii_text), False, False) self.pack_end(self.vscroll, False, False) # self.connect('char-changed', self.do_char_changed) def __on_scroll_event(self, widget, event, data=None): self.vscroll.emit('scroll-event', event) # scroll to the addr # select the byte at addr # set focus def show_addr(self, addr): gobject.idle_add(self.show_addr_helper, addr) def show_addr_helper(self, addr): off = addr - self._base_addr off *= 3 buf = self.hex_text.get_buffer() off_iter = buf.get_iter_at_offset(off) if self.scroll_mark is None: self.scroll_mark = buf.create_mark(None, off_iter) else: buf.move_mark(self.scroll_mark, off_iter) self.hex_text.scroll_to_mark(self.scroll_mark, 0, True, 0, 0) iter2 = off_iter.copy() iter2.forward_char() buf.select_range(off_iter, iter2) self.hex_text.grab_focus() def do_realize(self): gtk.HBox.do_realize(self) # Offset view self.tag_offset.set_property('weight', pango.WEIGHT_BOLD) # Hex View self.tag_hex.set_property( 'background-gdk', self.style.mid[gtk.STATE_NORMAL] ) # Selection tags self.tag_sec_sel.set_property( 'background-gdk', self.style.text_aa[gtk.STATE_NORMAL] ) # set font self.modify_font(self._font) def __on_hex_change(self, buffer, iter, mark): if not buffer.get_selection_bounds(): self.ascii_text.select_blocks() # Deselect return True start, end = buffer.get_selection_bounds() s_off = start.get_offset() e_off = end.get_offset() self.ascii_text.select_blocks((s_off+1) / 3, (e_off-1) / 3+1) return True def __on_ascii_change(self, buffer, iter, mark): if not self.ascii_text.buffer.get_selection_bounds(): self.hex_text.select_blocks() # Deselect return True start_iter, end_iter = self.ascii_text.buffer.get_selection_bounds() start_off = start_iter.get_offset() end_off = end_iter.get_offset() bpl = self._bpl self.hex_text.select_blocks( start_off - start_off / (bpl + 1), end_off - end_off / (bpl + 1) ) return True def do_char_changed(self, offset, charval): hex_buffer = self.hex_text.get_buffer() ascii_buffer = self.ascii_text.get_buffer() # set text # set hex iter1 = hex_buffer.get_iter_at_offset(offset * 3) iter2 = hex_buffer.get_iter_at_offset(offset * 3 + 2) hex_buffer.delete(iter1, iter2) hex_buffer.insert(iter1, '%02X'%(charval,)) # set ascii iter1 = ascii_buffer.get_iter_at_offset(offset + offset / self._bpl) iter2 = ascii_buffer.get_iter_at_offset(offset + offset / self._bpl + 1) ascii_buffer.delete(iter1, iter2) char = chr(charval) ascii_buffer.insert(iter1, (char in AsciiText._printable and char or '.')) return True def get_payload(self): return self._payload def set_payload(self, val): self._payload = val for view in (self.offset_text, self.hex_text, self.ascii_text): # Invalidate previous iters if hasattr(view, 'prev_start'): view.prev_start = None if hasattr(view, 'prev_end'): view.prev_end = None view.render(self._payload) def get_font(self): return self._font def modify_font(self, val): try: desc = pango.FontDescription(val) self._font = val for view in (self.offset_text, self.hex_text, self.ascii_text): view.modify_font(desc) except Exception: pass def get_bpl(self): return self._bpl def set_bpl(self, val): self._bpl = val # Redraw! self.payload = self.payload def get_base_addr(self): return self._base_addr def set_base_addr(self, val): self._base_addr = val view = self.offset_text # Invalidate previous iters if hasattr(view, 'prev_start'): view.prev_start = None if hasattr(view, 'prev_end'): view.prev_end = None view.render(self._payload) payload = property(get_payload, set_payload) font = property(get_font, modify_font) bpl = property(get_bpl, set_bpl) base_addr = property(get_base_addr, set_base_addr) gobject.type_register(HexView) gobject.signal_new('char-changed', HexView, gobject.SIGNAL_RUN_LAST, gobject.TYPE_BOOLEAN, (int,int)) if __name__ == "__main__": def char_changed_handler(hexview, offset, charval): print 'handler:','%X' % (offset,), chr(charval), '%02X' % (charval,) return False w = gtk.Window() w.resize(500,500) view = HexView() view.payload = "Woo welcome this is a simple read/only HexView widget for PacketManipulator"*16 view.base_addr = 0x6fff000000000000; # view.connect('char-changed', char_changed_handler) view.editable = True w.add(view) w.show_all() w.connect('delete-event', lambda *w: gtk.main_quit()) gtk.main() scanmem-0.13/gui/COPYING0000644000175000017500000010451311320142463011620 00000000000000 GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 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 . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . scanmem-0.13/gui/gameconqueror0000644000175000017500000000020411746500624013360 00000000000000#!/bin/bash DATADIR=/usr/local/share/gameconqueror exec gksu --description "GameConqueror" "python -OO $DATADIR/GameConqueror.py" scanmem-0.13/gui/consts.py.in0000644000175000017500000000034511363763747013100 00000000000000# constants # should be defined by autotools VERSION = '@VERSION@' DATA_DIR = '@PKGDATADIR@' SETTINGS = {'scan_data_type':'int32' ,'lock_data_type':'int32' ,'search_scope' : 1 # normal } scanmem-0.13/gui/GameConqueror_72x72.png0000644000175000017500000001235311311453333014714 00000000000000‰PNG  IHDRHHUí³GgAMA± üabKGDùC» pHYs  šœ vpAgHHÎyðßIDATxÚíœytUսǿ{Ÿé޹¹7óH „B"SPpª`E±N8´µêóU;<ûÖ{öµ®Õjë{Õö9–×ZëÓg}UZ««€TBH $!óœ;äÞÜùža¿?àR©!$êã·Ö]w­{ÏÙgŸÏÙ¿ßoÿöï·pQ.ÊE¹(³'Ül\” Êq¡ „ŒNÇbl¶ÙÌŽPÊ!aÎ`ìá$X @>nÉ—îÇ‹ „ÎvwAfòb…+ÐÓ¸/AgŠ]2oÉÆ˜„ôù1qi±¼¨#A_pÔÙç xíöî¦]£öžjÇó—_n­ú T%üÅD(Ó4QgŠ]7gáêoÍ+»jeêü%“5 „òãG1hª‚€ÇWÿ e¨³¾¿ïxÕÇö¼ÎþÝ7<ü¿ý|ü60Mýb¢œM•-qé¹,Zs˃ù—|9ÁdKC´³;D¡P•ün;ú[;ëvéªßýÛQGïVŽGT%2c€.¸‘fLKLž»ø‘Šßþváª,:£Œ1ìÎ3Þ¢ÁŒøŒ¯€ ¬ÚôóÒ«¾ž-êŒ8is!ð¹‡qèçêv¿~oÁòë?´w7iªƒ¦ÊPä8^Ô$CŒËëèÝÛßZ½ËÑs<ufŽ ´K{Þ¨é¨ýà9ì¯Å'Yùi”évó¦9‹V?¿fó#·'d.˜ rЇCÛ¶tyÿ·ßHÎ]²££fç93ÄÄ#0êä°èZûÕÇ»?øí¿Ì›éd²&߾ꖇŸ/\µÉmwÓÐðáï]û·>ñ=ßÈàK´¿·MN6>g"š"Ï`4儌쒵÷甬3EÿNEOÓÇjý‡¯ý·odðµOTyæ&…“Þ×4µÃÅ&gÝ’W±a©ÞlÅÉÑC…ÇÞƒ£;_þ` õð„Ðà¬Þíl"”æä,¾ìŽ´Ü¥|´j©JÇö¿ÙßÕ°ç§¶Ôùý“…Ÿu™£qi¹›æ.¹"WÐÁ´1„Pô6W©ÍûßúUÈçþ(äsÏö½Níæ¦¡ôô‚KnHÌZ$œ=„ èÁñýoUÛ»›^0³!øg %qκ¬E« %ƒùT E@ÐÓ¸/ØÓ¸ï=3yCÀ<› ÓŽ#çç¨Ï!ÆÄ9…צÌ+Õ6̯íG>8äê|gºèx1’„úï|çÔoŒ1üâÚk¡ã80@rƒ›*srž(IKû‘ÊXqQrò”¯w^6ˆR˜^PQ¡‰‹ŠÀ ÛŽ†{ü=€áé“c³¡Ýå¢!EÉÖ›¿ñå—³/™3'£”+ÏÌ Ûýþሪö¥˜Íß_»öÁuóçǺƒA<µwïª76èžq@qi¹«’²‹8އ¦©”H={Û=C]ïb áÇ‹àDT9 UÃf0ÀH}OÙªìì[Wfe­,NMŸÙ%‰#U4MóF"ê€ÇYÓø›Š‹‰$Š!¸Õï¿dGKKeHQ^™i@†øŒü+âÒs©6î¾ %ðØ»0Ø~t'cZß'L9„r Io†¨7ÃÕßÊ«JD§* @Ȥ/ÏÊúêÆÂ›¾TP<×fƒ$Šg5‡“æbÜ‹BÓJ‘c³ñóâãóÝݦà,¦ ˆ¤y ™s%CÌiõb ŽÞ– £·y7€IcB(xI9ä§Pƒ*‡Ó%½y"‡2Ss—¦Z3³ 1 Y¡Àh¨·êí_YXø¥»ËË—•¦§~|í„s c°êõ˜—{ »[ð©'ªS$êŒ â3ò3(Çšû¨ª‚¡¶£í‘ ¯æÌã)'à¶oÃ+_Ç4mIrÎâ•q鹫-I™)ñiy©&[ŠIgŠ…¤7ƒâ8ööSûï\Syï]ee© &Ó˜è•ÆÉ¼Ó$¹4£(¢ӥ˜Q@ÔlKÍ5Ç¥‰§â]Bò¹á±÷tªrx‚zmxp Þyú¾9~æ¾¼`Õ3 W”$dX,‰™ôæ±¥WBA„C{ù]ï^yë’•6½ L f4€Ë`*cŒRJ-:lÃYÀt‚ã̘¢Çž* }|F^©Ñ°Ó3gŸk@ó Vc¢z »^þá E—mþîüeW/N™·DÐcBÇ"tÆÆc7 ‘Hh°áõGÜa-¿¥´Ì*òüY£¢ÓéÄö–f{­W ;TÚêqÛ½œßéM6›çÜXT´ìªü|1š„@)(!"¦¸r1U@’Î;W2Æ"zþãwkÎÞ–&Dy/½9îš’+¿ö‹âuw$ëÍV0m›h/5Ué­ãñ¿"º.½¹´Ü*rÜi8„ ,ËxïX“÷å–®£êÒYÊ•—æY#¡²–·ž9QWsàë€ÖÓãvÿ"Ûf»µ )‰ ª_=S4Õ‰¢YÔ›uÚ›0¦!ä÷(r$h~)óJï*\}c²Þd·UG¡„rýGÞzzëÚHGùæ¥Kã%>깂ÑP¿üxÿðSvº7áΧCóWݸÂh¶%6íy=p¢êÝŸÚÏÛ÷uvny¯¹yX‹2â!YFP–}˜b¸3%@”ôf›m'5UE$èõRŽ÷G*êñ:cì„$áXÁÂXrÐ=Ô¥µV¿ß’×ýÑòoT\’i’¤ #Ç âÙ½õl3,¾íÑåfkÒ:¦1ŒÂÑÛr40êØ @ ) BŠRý§††·õŒE7ŒìëêÒõôlà?çM"SR1Q2Z$£eBfi*"¡€OSäèŽ(^×@³¯uEʼÅãê¥aÔуÁöº`_ó¡ŽÞ–y‘¡œ¯¹zi¢Ù<Ž?ƯìÝe-9\´áJJ©…1B9x†»µQGïL´w¡=ÿÛ{ïY®ÊÏ¿$¢ªlGKËîÃ}}[ð7¦¡G)wÖ¹šªÈª‰îˆ6ÐzøW5ïýfÙ¢Ko^¦3Æ’¾æC®Îºw ´Õ¾éÚ7×{Ó7¿|Ýæ‚ädmUÅ«55Î_· 7\úà-•¥V5ßrõŸÙ»÷ãìÙzûÎ'îÞÕÖ–§ Ûf½ øƒòÔ–j§1/Æ0îÒ&tXS•†ãûÞ¼k¨ýÈFÊ ¯kðÃ׵ןæ³êõ+î([vÿºÜ\ý™®|gkkèÉÝ»·Å®ºm•Þd±Fÿ-‡è?QÓ¤DB “õD Ô«„j ¢(+Ê”ïjJ€˜¦(šzæU åxB(wæÊ¡>&î¸-mþOÉB8ÈA¼Ž>놂‚ïn.)Éœ0×!ƒƒìÙ½{ß,}‹­NåEÝ„…¸‘Ám¨ýèý“õOÖ4Èáé)—™ 9ôEB¾ ¹qB)DÑÄ‹’QOœ°úÝCh­zwÂoYVëõ·/Yrev|<‰†ãðBUÕÑmÍͯ—m¸ÿ‘äœb‰iQMEOÓ~§½«éø” €©È”¼˜ªDœÁQW$Z—(å!êÍMUcþŽ&2®ÊË»çòÜ\#‰Ò1¼ÙØèÙZwô¹´üò5¹åëˆzN')ÜÃݬãÈ®÷åp öBÙ2 #!¿; FNcB)Œ–xAcË<×Éy ¯+,,‰ÕG9BBÐ48È~WSó¦“èŒ +oÞœ”]DYÔœFÓ´×ìîlx @à³ (èw7¼ÎSu„LÓ›4‡KÈ\p)>YuSVçäÜ´<+Kˆ6Ì!YÆïéÚÛ;Ð[zÅ]ßÊ«Xo!ôt÷¥îh`Íÿüz`Ô±&àœ ÐPGÝA¯£ Ó`ŽO'ÉsK* ¡E’Ñ2é‰ FcåÕyy¥f.ªÕÝÝÚï[ü¥ëï¿kñåwåõ£òkÁQ'êþújÍPGÝs˜BT>Ó€˜ß=\5Øvd0ºfãäU¬ÏÊ.Yûðߓ•Wq-ÄñŰqÒʬ¬ë—edèÆ*¦TMEmOž?Þ…œkÌ-[oºÞt:Æ9„Æ=oØ[«¶=¦Êáæ™‚œGu‡¦*NŽ—¥å-+Ð-ŸÁ`‰Glbf®ª(e­Õ,à±»U%B \¿pá·Wçd[^/ö à•ænü!l~åí$»ä2ŽãÅ ëÛLSÐ|àÏÃyá'^gߢÏ-ç•Ñc7¬ºù__.Z»9vB£„Œ`¶T†:놂£®Î€ÏÕ­ø,ê-äTm´ßã@[Íõ¶-ïÖÿõµ‡ÂÏÛ¦H}FPÎ92оÇÞ}Ìç÷Ø3yA²ˆ:å/Œ«=‚ J90¦Aá±÷ ­f»çèÎWöÕíúŸŸµýNZ? Õ ÓVaÆ‹z(‘ `AâœÂëâ2òW$e/*6Å&ÅêÌV’Aày‘ƒª@øö¹¡x°wÖ{;»[þ82ص5èuÈ-_ïh¯ýJä³QJ4í[ –Üñï;±å¾b+€ ÊñÉæ¸Ô½(®¾fþ¼ÛJSR$3Ä‹,’ˆWkjž?p`}Z~y×@k 4ufKìÎ%Ó^'ðرå¾bŽáxaD”Œu +oBç{Ï{®I¯Ø´±¨@@)dYÆöÖV úŽœm3è¤0U¢*PÂAì{ãgˆ7ÃAEŒ Ú±ì(!&Q´BŒl6ÐB`Õëa®@Úy¶;c;Ö\@߀×;a‹çy$›ÍqzžO?ßö)!`ŒqÞP¨„rGH–WiŒIçÛîŒmÉd)JN¾©2''§ž _Û×çìv»w`ŠÅá96\Á`Ò¢ä亷¢â'__¶lsAbâúÞÑQÑá÷Ÿ™Èül š%iQeNN©5*Ek0·;qOGÇžX½~0ô)Ö)!`ñE"˯_¸ðç¯]{çæÒÒ¸ÉÉ\yf¦‰0VúQggUDUÛ>€”@$b,MK»ª )éTÆ‘ç8$™LÖv—ËÖ08ø¡Y’õ“s|"Ç!ÙlÆh8›ŸpÏ=ååoÍšeK32N•ÜqRé@W׉þÑÑÝŸ@«ªÓ(Š—Væä¤ë„ÓÛâM&$¹##–Nç¡Î/«*t‚EÓ P ³$AÑ4EAYdU½äÊÜÜǾ[Yù_++KœSBplhHûC}ýŸ\@ÕTû|Á¼Ød"«êàö––w´´m*.>¥gÀºÜ\r÷³û÷§ìhm}Jcì`P–CŒ1F'âÄRB–¬Îξöª¼¼ë6¥Íkä 8=##x½®®ñ„ÃqîM!Ÿ 3ºëy\b¯ÉÏáÉ nÈKL<«zã„Ó‰wú¸«ëȰÏW7; ‚`ˆ7çÇs+23ç—gfZsÀG8DÁ©ëïgOïÝ[µµ¾þŸ=¡ÐžÏ ‰çV”âû**^øÁºuKS-–³ž>c ®@££)Š&PJ­M&èx~lur0aEÁŽ––È3ûöýa{KË+srŽín?¿‰³1‚ÀƒÍ`X{ç’%Ï<´fMAÚ™ÆoxÂ÷™fg×éráµÚÚžßÕÖniú/£(:ý‘óß3+€N^Ûª×_vâE?y`ÅŠeE))“Œ¿yöX×í>v¶¶úߨ«Û¹½¥å?ý‘È^‘ã”sy¿WfåÝ'å©k¯íøÑÎûÛœN³¬iÙ F£d’$Ž›8‚(=0¢ªhs8°íØ1ï³ûöíþMUÕcU==O̵َ;MÆ÷~ÌæÄpøý&›Á°nUvöæåsæ,]œšš‘d6S³(Bà8Èš†@$ÂF‚AÒ922r¸§§³ixøÐÇ]]où"‘_]ºÔõRuõÙ£9ë€Nvbqj*jûûu! lÔ˜˜Œ´˜˜ƒ(š²ìöù†û<žþ,w¹C¡Fƒ™‹Ú?: åÿÛbnì¥zA€e,©H0Vº+Ó$“ &QGΈç.ÊE¹(å )ÿÞ.ÆÎTzctEXtCommentCreated with GIMPW%tEXtcreate-date2009-12-12T20:08:57+08:00‡Å£Õ%tEXtmodify-date2009-12-12T19:30:08+08:00¢ªIEND®B`‚scanmem-0.13/gui/misc.py0000644000175000017500000001331511513032505012070 00000000000000""" Misc funtions for Game Conqueror Copyright (C) 2010,2011 Wang Lu 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 . """ import gtk # check syntax, data range etc. # translate if neccesary # return (success, msg) # if success == True, msg is converted command # else msg is error message def check_scan_command (data_type, cmd): if cmd == '': raise ValueError('No value provided') if data_type == 'string': return '" ' + cmd elif data_type == 'bytearray': cmd = cmd.strip() bytes = cmd.split(' ') for byte in bytes: if byte.strip() == '': continue if len(byte) != 2: raise ValueError('Bad value: %s' % (byte, )) if byte == '??': continue try: _ = int(byte,16) except: raise ValueError('Bad value: %s' % (byte, )) return cmd else: # for numbers cmd = cmd.strip() # hack for snapshot if cmd == '?': return 'snapshot' # these two commands has no parameters if cmd == '=' or cmd == '!=': return cmd cmdl = cmd.split() if len(cmdl) > 2: raise ValueError('Too many parameters') # TODO: these commands should not be the initial scan if cmdl[0] in ['>', '<', '+', '-']: if len(cmdl) == 1: return cmd else: num_to_check = cmdl[1] else: if len(cmdl) > 1: raise ValueError('Bad command %s' % (cmd,)) else: num_to_check = cmdl[0] (cbn, iv, fv) = test_number(num_to_check) if data_type.startswith('int'): if iv is None: raise ValueError('%s is not an integer' % (num_to_check,)) if data_type == 'int': width = 64 else: width = int(data_type[len('int'):]) if iv > ((1<aËgAMA± üabKGDÿÿÿ ½§“ pHYs  šœtIMEÙ   íòtEXtCommentCreated with GIMPW IDATx@€¿2+ êÛÓñf^þüû%ö* ýüûùóíæûìäÙýñëâ åýüú¸ýûù´½ù* †ÿÿþF'9Nÿ/C] "/þýüêàÔáÔÃüÚÉ´óíäÚ¸ûøõ»û „h7Pn1Fa õðêÚʶþѼ¢òñêáÿ›üúøšÝ4 ° .?Ec‰ íåÜѼ¡øÔÁ©þÆúøô|ÉZœGgŽ(9OüúøÔÀ¨ýΉùþþý½ûøõqÝU’Ô- IDATz ‹Y± +;#01Hcÿþþ!çÜÏfÿÿêÿΙ XV}¬ ìäÙ­‡Zõ÷óî˜ýüút"V[ƒµ  +?VØÆ°.ú÷ôùÿÇŒ!eY° ïçÞ¢yEõüúø#éu fX~®  ÷ôïàÑÀçÜÎÿú÷ó÷)$2 "(8þàÒÀX‘[ €W~­  öòîÇ­ŒúÓÀ¨ Èù÷ó»þüûê # 7ú÷ô/ý.A[ (:O (7 àÒÀ:»Z‚´ )Ü̹·–nù£ùöò{êC düúøM"2E:Sr(³’hôÚȳ~ÓMp›"0BÿÿÿƬ‹ýͶ›ïûùöMÈlv+:>Y| &ú÷ô—i/øüúø+Þ ¸3Ie/D]ÿÿÿ»wùÓ¿¦àûùö2ÚùÿþýÃþýü’òíæùÓ¿¦6óíå'6þþý´“jöñêâ±þýüœu&VKm• §„úÕÁªÝûøõ7ïûÿþýÄþýü˜ïèÞζ›' %éÞÒ²dõèÜÏÑüú÷Tû. Ç_‰½ л þç‡äúøô1î2 „ú÷ôHüòþýü‹ÿþýú ×FdŠ)U ØÇ±ÿ²üú÷÷vwQ--|BB +B$$#ôÚìì.Èýûù-.?ÔÀ§ôøõðš ¡; –QQ #2Úìì-È«[r. IDATD%2öðéáòìæÁ (%! ($ÿýýýýûýûù  _£WW L**/ ¯ÔÔ)ùýýG$3GÝ͹ ·üú÷ý68 >0ûùö õ$ÿ'    —i/ Ì9!©[[  ! (ù÷÷D(8Ýλõ÷óîª+N Pûú÷/ö+<&4 *$Z9Ò{BB v@@ýûù*þýüæÛÍÀ_ c%5J#3F (8 ZI¼¬]] K)) üþþ8)õéßÓ éýûùí8 ÿþý?(:Qþ,@W %4ZW ¬ºdd 8 ûþþ 7+< æÛÍÃ/ • /9Ss ,>V ZV ŸÂii 0ÿÿÿÉââÈââØëëü÷ûûø B$$! þþþ 9".éÞÑù÷òíÀ‰iZ ¨T..m;;·ØØ=––÷ñ÷÷^eŸÞps¦åúßÒÀüÿþý9Ûúùüü‰‡¿¿ô»ÛÛ Ê ÿöñëèÿþþ{">›SS ±ÕÕT££ôôúúBp¥äªõñëúöóÙüþþ™µ××ÿÈááýþþ~ººôñøø—÷óîèííäÙóíæÏ¹Ÿ«…VöŽ\B w·bb ³ÖÖZ¦¦óöûû?s¦åÇãÕÅÊþñúýý^D››øÒççûýý_©©øãððÑ¥ ÷ôïëÿÿÿ¥Ñ¼£fCa…÷óîÙȳӿ§óîæÛ ¹÷óîfÛ®^^ ÉââZ¦¦ôöûûCs¦åÍßÑÀöú÷ó°°÷ûûc2 C%%õ9 Ýííý´ÖÖÿüþþÆõúúRÿþýýýüúúýûùŠÓÀ§_"2E!/@ëâ×ʲ•ùÛ˶ »øôïš¹üúøú ¹c55 C%%ÜììHõôúúOg•ÎÊÞλþºþÿÿ¦¸ºÚÚNºÚÚ&ìÂÌüúøøåýûùN±a·3Kg-@X çÜÏË´—öãÕÅüŒýûù”ýûùïd :‰JJïöö@™™÷÷ûûm(8² êàÔýüùóØî ÆO^ IDATÀ?€þýüýÂýüú.ϸ†Î·›Güúø áûùö•ÿÿ•ö °__ ýþþR¢¢öòøø¡ i0F_ ØÇ±ûþýý¦ÿþýÿþýÝûùöWûøõ  {CC*|¹¹üÏææÓóùùmõ$4HÿÿÿÔÁ©ùýüú¤þýüúýW2v??¶××”ÅÅòñøøM Ÿ2GbåÙÊüúøëÐñùöòý  –¡WW èóóZ§§÷ôúúN þýüU2IeÌ´—ôûøõîõñìú Q,,: ÿÿÿY¦¦õúýý’Å ·6Mj ôïéàÓ¢êôîèÿ #eLL ”ÆÆÿÏååá÷ûû}C?3Jf̵˜÷¢ðáôïçûùö ‡r>> ßîîy··øõúúP  ¥Ed‰ öòíл¡ýûù†ãùõò üúø (Lt>>f­­öˆÛ §$4I$3Gȯø¤ãý âìäÙ!-û9 …yAA ®ÓÓÉââìôúú‡ z @Dc‡ñêâÒ¾¥ýûùö}ÊêàÔ!/A  P$Gl::øûûj¯¯÷óùù^Q~Sw¤  ¸™róþýü†éú÷ó¾ßоó&7MýüúRoj99 ’ÅÅþúýýÆ¢V|« ×ůÿéßÒêÿþý‹½ãÖÆÿÿÿ#1` al:: òøø„½½ùòüþØ šX°*ôïè»wöûøõ[ûÝþþýîéÞÑ=Xy ŠY: ü†¾¾þüó"a^ˆ» )þþý²dôýûúŽÉÿþþ5"1D üú÷ìâ×Hýûù£û œ‹KK!'ÿÿÿšÉÊ}½¿(=TNp𠦄øßÑ¿Ñýûø_ÿ Ùj™Ó þþý¹™rúÛË·êûøõNÏ Öð þþþ´××z¾Áï Ad‹"/Õ«ý»wìýûù-ëñ=  %2%5I âÓÃ_ =üûøíßÿ`U..AT..þþþËããŽÆÇ]ª¬ºêò(Oq@_„ âÕĶ•löýûù@ß6,¶8 IDAT1 Äg”Í  ùöó×Ä­Ò¾¥óíåÚ ÙþýüÐù÷óØÿÿëyb55 ÛðóÒéêÖæã5K)=U%äØÉ­ˆZôüúøFÇ «.B[LA^÷ôïêßÓïèßñëãÿ÷óîùþýýþÿþý   %( àÒÁ±Žcõüú÷O½ÚSx§(6ׯ°ýºšsõüúøIÆK ª_‰½ þþýÂ¥ƒùѽ£îüúøEÕÛÿÿþÚʵ6);R òí嬇YóàÓÁÎüù÷?áÿþþÃüúøÖì2$4G ÿÿÿÒ¾¤þ±Œaöóîç‰ýûùdõÿþý¼üûøðÓ¿§@"&äØÊ¯Š]òÚȳÛûùöIÿÿ¬ÿ9 ª&4Ca† !ãÖÇÄ©ˆóêâÕöüù÷x¢þ tv-?5Mi %4õðêØÆ°þιžõ÷òíñûùö‚¡úf k%6J!/B%3 ÷óîèÞÒæ×ÆÚË·üðëãû³üú÷–Âÿ.J Küù÷1ø   ýöñü÷óùôíôìäìéâüûú- ýËãã³ôúúRü%K5EB$$   ˆ¿¿ƒ¼¼öûûqèè B$$GˆJJ÷üüùþÿÿüþúýýû íãððú'+Ö0þž IDATÜÛììþ,ôùù&ÓÛìì ÿÿÿ  þ9 oÏÛ ®<÷rY11  óùùÍääùýý±S ÀF%%E‚FFh88&(ÆááYýÿÿ· µ˜RRJ[22ãðð%‰‰øùýýî œ M©[[ \22ÞîîýÝííúýý¶2 ÄO++3ºee $ J((—ÇÇ@þÿÿ’ù®¿ÜÜïöö‰JJa2z ÄšTT¤YY &>ýþþ­ÓÓÿÁÿõúúnl¯¯õöúú£XXe66/ ×<8 ¿ ¼”PP(Çll &~ººûøüüÓÊÞ6óùù!F&&F&&+ ¹ÚÚZ;øüüÛå%c ¥ j}DD%¦YY3ººúŒÁÁð÷ûûBóÚÆkk 2õúúšÈÈþˆÀÀøøûûõÁñøøÉþÿÿøú ! 1õúú2N**`33>""ùüü_©©ô´××âõúúCèV Ùuu  ÿÿÿÓèèÈááÔééýð÷÷ù#2%âïïGôâïï¾öûûZõ‹-gÁhh ·ØØÿX¥¥÷øüüúýýÿ ¬6G¸cc öúúr³³ö¢ÎÎô÷ûûTà ¶: 8³`` ¾ÜÜ[§§õôùù¶ôúúfðëñ,Ë IDAT ©&C´bb  âïïr´´óµ××øøüü_·† m«\\ B$$îöö„½½ø™ÈÈýûþþ“ûýý…ôF §V.. ‹KK  ÞííÃÃ÷œÊʨ÷ûûzç …ÿal::r>> óøø³××•ÆÆïÎååš÷üü‘ã! xûýý]9û]22E%%úüüÏææÆááý®ÓÓòËãã Èòùù›®÷ M Yüþþ?'÷$ èôôúïööûáððþÝííéóó âøüü¾øüü¼¹ð*ðïåáÚùûè<•IDAT€ÿÏcesüQøIEND®B`‚scanmem-0.13/install-sh0000644000175000017500000003253711313675116012020 00000000000000#!/bin/sh # install - install a program, script, or datafile scriptversion=2009-04-28.21; # UTC # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the # following copyright and license. # # Copyright (C) 1994 X Consortium # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or # sell copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # # Except as contained in this notice, the name of the X Consortium shall not # be used in advertising or otherwise to promote the sale, use or other deal- # ings in this Software without prior written authorization from the X Consor- # tium. # # # FSF changes to this file are in the public domain. # # Calling this script install-sh is preferred over install.sh, to prevent # `make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. nl=' ' IFS=" "" $nl" # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit=${DOITPROG-} if test -z "$doit"; then doit_exec=exec else doit_exec=$doit fi # Put in absolute file names if you don't have them in your path; # or use environment vars. chgrpprog=${CHGRPPROG-chgrp} chmodprog=${CHMODPROG-chmod} chownprog=${CHOWNPROG-chown} cmpprog=${CMPPROG-cmp} cpprog=${CPPROG-cp} mkdirprog=${MKDIRPROG-mkdir} mvprog=${MVPROG-mv} rmprog=${RMPROG-rm} stripprog=${STRIPPROG-strip} posix_glob='?' initialize_posix_glob=' test "$posix_glob" != "?" || { if (set -f) 2>/dev/null; then posix_glob= else posix_glob=: fi } ' posix_mkdir= # Desired mode of installed file. mode=0755 chgrpcmd= chmodcmd=$chmodprog chowncmd= mvcmd=$mvprog rmcmd="$rmprog -f" stripcmd= src= dst= dir_arg= dst_arg= copy_on_change=false no_target_directory= usage="\ Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE or: $0 [OPTION]... SRCFILES... DIRECTORY or: $0 [OPTION]... -t DIRECTORY SRCFILES... or: $0 [OPTION]... -d DIRECTORIES... In the 1st form, copy SRCFILE to DSTFILE. In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. In the 4th, create DIRECTORIES. Options: --help display this help and exit. --version display version info and exit. -c (ignored) -C install only if different (preserve the last data modification time) -d create directories instead of installing files. -g GROUP $chgrpprog installed files to GROUP. -m MODE $chmodprog installed files to MODE. -o USER $chownprog installed files to USER. -s $stripprog installed files. -t DIRECTORY install into DIRECTORY. -T report an error if DSTFILE is a directory. Environment variables override the default commands: CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG " while test $# -ne 0; do case $1 in -c) ;; -C) copy_on_change=true;; -d) dir_arg=true;; -g) chgrpcmd="$chgrpprog $2" shift;; --help) echo "$usage"; exit $?;; -m) mode=$2 case $mode in *' '* | *' '* | *' '* | *'*'* | *'?'* | *'['*) echo "$0: invalid mode: $mode" >&2 exit 1;; esac shift;; -o) chowncmd="$chownprog $2" shift;; -s) stripcmd=$stripprog;; -t) dst_arg=$2 shift;; -T) no_target_directory=true;; --version) echo "$0 $scriptversion"; exit $?;; --) shift break;; -*) echo "$0: invalid option: $1" >&2 exit 1;; *) break;; esac shift done if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then # When -d is used, all remaining arguments are directories to create. # When -t is used, the destination is already specified. # Otherwise, the last argument is the destination. Remove it from $@. for arg do if test -n "$dst_arg"; then # $@ is not empty: it contains at least $arg. set fnord "$@" "$dst_arg" shift # fnord fi shift # arg dst_arg=$arg done fi if test $# -eq 0; then if test -z "$dir_arg"; then echo "$0: no input file specified." >&2 exit 1 fi # It's OK to call `install-sh -d' without argument. # This can happen when creating conditional directories. exit 0 fi if test -z "$dir_arg"; then trap '(exit $?); exit' 1 2 13 15 # Set umask so as not to create temps with too-generous modes. # However, 'strip' requires both read and write access to temps. case $mode in # Optimize common cases. *644) cp_umask=133;; *755) cp_umask=22;; *[0-7]) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw='% 200' fi cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; *) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw=,u+rw fi cp_umask=$mode$u_plus_rw;; esac fi for src do # Protect names starting with `-'. case $src in -*) src=./$src;; esac if test -n "$dir_arg"; then dst=$src dstdir=$dst test -d "$dstdir" dstdir_status=$? else # Waiting for this to be detected by the "$cpprog $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if test ! -f "$src" && test ! -d "$src"; then echo "$0: $src does not exist." >&2 exit 1 fi if test -z "$dst_arg"; then echo "$0: no destination specified." >&2 exit 1 fi dst=$dst_arg # Protect names starting with `-'. case $dst in -*) dst=./$dst;; esac # If destination is a directory, append the input filename; won't work # if double slashes aren't ignored. if test -d "$dst"; then if test -n "$no_target_directory"; then echo "$0: $dst_arg: Is a directory" >&2 exit 1 fi dstdir=$dst dst=$dstdir/`basename "$src"` dstdir_status=0 else # Prefer dirname, but fall back on a substitute if dirname fails. dstdir=` (dirname "$dst") 2>/dev/null || expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$dst" : 'X\(//\)[^/]' \| \ X"$dst" : 'X\(//\)$' \| \ X"$dst" : 'X\(/\)' \| . 2>/dev/null || echo X"$dst" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q' ` test -d "$dstdir" dstdir_status=$? fi fi obsolete_mkdir_used=false if test $dstdir_status != 0; then case $posix_mkdir in '') # Create intermediate dirs using mode 755 as modified by the umask. # This is like FreeBSD 'install' as of 1997-10-28. umask=`umask` case $stripcmd.$umask in # Optimize common cases. *[2367][2367]) mkdir_umask=$umask;; .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; *[0-7]) mkdir_umask=`expr $umask + 22 \ - $umask % 100 % 40 + $umask % 20 \ - $umask % 10 % 4 + $umask % 2 `;; *) mkdir_umask=$umask,go-w;; esac # With -d, create the new directory with the user-specified mode. # Otherwise, rely on $mkdir_umask. if test -n "$dir_arg"; then mkdir_mode=-m$mode else mkdir_mode= fi posix_mkdir=false case $umask in *[123567][0-7][0-7]) # POSIX mkdir -p sets u+wx bits regardless of umask, which # is incompatible with FreeBSD 'install' when (umask & 300) != 0. ;; *) tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 if (umask $mkdir_umask && exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 then if test -z "$dir_arg" || { # Check for POSIX incompatibilities with -m. # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or # other-writeable bit of parent directory when it shouldn't. # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. ls_ld_tmpdir=`ls -ld "$tmpdir"` case $ls_ld_tmpdir in d????-?r-*) different_mode=700;; d????-?--*) different_mode=755;; *) false;; esac && $mkdirprog -m$different_mode -p -- "$tmpdir" && { ls_ld_tmpdir_1=`ls -ld "$tmpdir"` test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" } } then posix_mkdir=: fi rmdir "$tmpdir/d" "$tmpdir" else # Remove any dirs left behind by ancient mkdir implementations. rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null fi trap '' 0;; esac;; esac if $posix_mkdir && ( umask $mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" ) then : else # The umask is ridiculous, or mkdir does not conform to POSIX, # or it failed possibly due to a race condition. Create the # directory the slow way, step by step, checking for races as we go. case $dstdir in /*) prefix='/';; -*) prefix='./';; *) prefix='';; esac eval "$initialize_posix_glob" oIFS=$IFS IFS=/ $posix_glob set -f set fnord $dstdir shift $posix_glob set +f IFS=$oIFS prefixes= for d do test -z "$d" && continue prefix=$prefix$d if test -d "$prefix"; then prefixes= else if $posix_mkdir; then (umask=$mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break # Don't fail if two instances are running concurrently. test -d "$prefix" || exit 1 else case $prefix in *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; *) qprefix=$prefix;; esac prefixes="$prefixes '$qprefix'" fi fi prefix=$prefix/ done if test -n "$prefixes"; then # Don't fail if two instances are running concurrently. (umask $mkdir_umask && eval "\$doit_exec \$mkdirprog $prefixes") || test -d "$dstdir" || exit 1 obsolete_mkdir_used=true fi fi fi if test -n "$dir_arg"; then { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 else # Make a couple of temp file names in the proper directory. dsttmp=$dstdir/_inst.$$_ rmtmp=$dstdir/_rm.$$_ # Trap to clean up those temp files at exit. trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 # Copy the file name to the temp name. (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && # and set any options; do chmod last to preserve setuid bits. # # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $cpprog $src $dsttmp" command. # { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && # If -C, don't bother to copy if it wouldn't change the file. if $copy_on_change && old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && eval "$initialize_posix_glob" && $posix_glob set -f && set X $old && old=:$2:$4:$5:$6 && set X $new && new=:$2:$4:$5:$6 && $posix_glob set +f && test "$old" = "$new" && $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 then rm -f "$dsttmp" else # Rename the file to the real destination. $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || # The rename failed, perhaps because mv can't rename something else # to itself, or perhaps because mv is so ancient that it does not # support -f. { # Now remove or move aside any old file at destination location. # We try this two ways since rm can't unlink itself on some # systems and the destination file might be busy for other # reasons. In this case, the final cleanup might fail but the new # file should still install successfully. { test ! -f "$dst" || $doit $rmcmd -f "$dst" 2>/dev/null || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } } || { echo "$0: cannot unlink or rename $dst" >&2 (exit 1); exit 1 } } && # Now rename the file to the real destination. $doit $mvcmd "$dsttmp" "$dst" } fi || exit 1 trap '' 0 fi done # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: scanmem-0.13/scanmem.10000644000175000017500000002620511513033372011511 00000000000000.TH scanmem 1 "January 01, 2010" "version 0.08" .SH NAME scanmem - locate and modify a variable in an executing process. .SH SYNOPSIS .B scanmem .RB [\-\-version] .RB [\-\-help] .RB [\-\-debug] .RB [\-\-backend] .IR target-program-pid .SH DESCRIPTION .B scanmem is an interactive debugging utility that can be used to isolate the address of a variable in an executing process by successively scanning the process' address space looking for matching values. By informing .B scanmem how the value of the variable changes over time, it can determine the actual location (or locations) of the variable by successively eliminating non-matches. .B scanmem determines where to look by searching for mappings with .I read / .I write permission, these are referred to as regions. Users can eliminate regions they believe are likely unrelated to the target variable (for example, located in a shared library unrelated to the variable in question), this will improve the speed of the scan, which can initially be quite slow in large programs. Once a variable has been found, .B scanmem can monitor the variable, or change it to a user specified value, either once, or continually over a period of time. .B scanmem works similarly to the " .I pokefinders " once commonly used to cheat at video games, this function is a good demonstration of how to use .B scanmem , and is used in the documentation. .SH USAGE .B scanmem should be invoked with the process id of the program you wish to debug as an argument. Once started, scanmem accepts interactive commands. These are described below, however entering .IR help at the .B > prompt will allow you to access .B scanmem's online documentation. The .IR target-program-pid can be specified in decimal, hexadecimal, or octal using the standard C language notation (leading 0x for hexadecimal, leading 0 for octal, anything else is assumed to be decimal). .B "\-\-version" Print version and exit. .B "\-\-help" Print a short description of command line options then exit. .B "\-\-debug" Run in debug mode, more information will be outputted. .B "\-\-backend" Work as backend, normal users should not use this paratmeter. .SH COMMANDS While in interactive mode, .B scanmem prints a decimal number followed by .B > , the number is the current number of possible candidates for the target variable that are known. 0 indicates that no possible variables have been eliminated yet. .B n Where .B n represents any number in decimal, octal or hexadecimal, this command tells .B scanmem that the current value of the target variable is exactly .B n. .B scanmem will begin a search of the entire address space, or the existsing known matches (if any), eliminating any variable that does not have this value. .B set .I [match-id][,match-id,...]=]value[/delay] [...] Set the value .I value into the match numbers .I match-id , or if just .I value is specified, all known matches. .I value can be specified in standard C language notation. All known matches, along with their match-id's can be displayed using the .B list command. Multiple .I match-id's can be specified, separated with commas and terminated with an .I = sign. To set a value continually, suffix the command with .I / followed by the number of seconds to wait between sets. You can interrupt the set command with ^C to return to the .B scanmem prompt. This can be used to sustain the value of a variable which decreases overtime, for example a timer that is decremented every second can be set to 100 every 10 seconds to prevent some property from ever changing. This command is used to change the value of the variable(s) once found by elimination. Please note, some applications will store values in multiple locations. .B dump .I
[] Dump the memory region starting from .I
of length .I into a human-readable format. If .I is given, data will be saved into the file, otherwise data will be displayed into stdout in a human readable format .B write .I
Manually set the value of the variable at the speicified address. Names of value_type are subject to change in different versions of scanmem, see more info using the `help write' command. .B > Tells .B scanmem that it should eliminate all matched variables that have not increased since the last search. For example, if the value of a variable is known to be zero when a program is executed, but increases over time, this command can be used several times to eliminate variables that have decreased or not changed. .B < As for .B > but indicates that the target variable has decreased since the last scan. .B = As for .B > but indicates that the target variable has not changed since last scan. .B snapshot Save a snapshot of existing program state, for use with .B > , .B < , and .B = , although other commands can still be used. .B list List all the possible candidates currently known, including their address, last known value and possible types. The value in the first column is the match id, and can be used in conjunction with the .B delete command to eliminate matches. .B delete .I [match-id] Delete match .I match-id , which can be found from the output of the .B list command. To delete all matches, see the .B reset command, or to delete all matches associated with a particular library, see the .B dregion command, which also removes any associated matches. Pleae note that match-ids may be recalculated after matches are removed or added. .B watch .I [match-id] Monitor the value of .I match-id , and print its value as it changes. Every change is printed along with a timestamp, you can interrupt this command with ^C to stop monitoring. .B pid .I [new-pid] Print out the process id of the current target program, or change the target to .I new-pid , which will reset existing regions and matches. .B lregions List all the known regions, this can be used in combination with the .B dregion command to eliminate regions that the user believes are not related to the variable in question, thus reducing the address space required to search. The value in the first column is the .I region-id which must be passed to the .B dregion command. The size and path (if applicable) is also printed. This can be used to eliminate regions located in shared libraries that are unlikely to be relevant to the variable required. .B dregion .I [!][region-id][,region-id][,...] Delete the region .I region-id , along with any matches from the match list. The .I region-id can be found in the output of the .B lregions command. A leading .I ! indicates the list should be inverted. .B reset Forget all known matches and start again. .B shell .I [shell-command] Execute .I shell-command using /bin/sh, then return. .B option Change options in runtime. See `help option` for all possible names/values. .B version Print the version of .B scanmem in use. .B help Print a short summary of available commands. .B exit Detach from the target program and exit immediately. .SH EXAMPLES Cheat at nethack, on systems where nethack is not installed sgid. .nf $ scanmem `pidof nethack` info: attaching to pid 13070. info: maps file located at /proc/13070/maps opened. info: 17 suitable regions found. Please enter current value, or "help" for other commands. 0> .fi The 0 in the .B scanmem prompt indicates we currently have no candidates, so I enter how much gold I currently have (91 pieces) and let scanmem find the potential candidates. .nf 0> 91 info: searching 0xbfffa000 - 0xc0000000...........ok info: searching 0x401c2000 - 0x401e3000...........ok info: searching 0x401c1000 - 0x401c2000...........ok info: searching 0x401b6000 - 0x401b8000...........ok info: searching 0x401b5000 - 0x401b6000...........ok info: searching 0x40189000 - 0x4018a000...........ok info: searching 0x40188000 - 0x40189000...........ok info: searching 0x40181000 - 0x40183000...........ok info: searching 0x4017f000 - 0x40181000...........ok info: searching 0x40070000 - 0x40071000...........ok info: searching 0x40068000 - 0x40070000...........ok info: searching 0x40030000 - 0x40031000...........ok info: searching 0x40029000 - 0x4002a000...........ok info: searching 0x4001f000 - 0x40020000...........ok info: searching 0x40016000 - 0x40017000...........ok info: searching 0x081d4000 - 0x0820a000...........ok info: searching 0x081b7000 - 0x081d4000...........ok info: we currently have 16 matches. 16> list [ 0] 0x081c1f34 { 91} (/usr/share/games/nethack/nethack) [ 1] 0x081c1780 { 91} (/usr/share/games/nethack/nethack) [ 2] 0x081be436 { 91} (/usr/share/games/nethack/nethack) [ 3] 0x081eeffc { 91} (unassociated, typically .bss) [ 4] 0x081ee0c0 { 91} (unassociated, typically .bss) [ 5] 0x081eddb8 { 91} (unassociated, typically .bss) [ 6] 0x081d6d88 { 91} (unassociated, typically .bss) [ 7] 0x4001fcd3 { 91} (/lib/libnss_compat-2.3.5.so) [ 8] 0x40029fe3 { 91} (/lib/libnss_nis-2.3.5.so) [ 9] 0x40029f8b { 91} (/lib/libnss_nis-2.3.5.so) [10] 0x40029efb { 91} (/lib/libnss_nis-2.3.5.so) [11] 0x40029bff { 91} (/lib/libnss_nis-2.3.5.so) [12] 0x401d18d3 { 91} (unassociated, typically .bss) [13] 0x401d156f { 91} (unassociated, typically .bss) [14] 0x401d120b { 91} (unassociated, typically .bss) [15] 0xbfffd76c { 91} (unassociated, typically .bss) 16> .fi 16 potential matches were found, many of them are clearly unrelated, as they're part of unrelated libraries (libnss_nis.so). We could make .B scanmem eliminate these manually using the .B delete command, however just waiting until the amount of gold changes and telling scanmem the new value should be enough. I find some more gold, and tell .B scanmem the new value, 112. .nf 16> 112 info: we currently have 1 matches. info: match identified, use "set" to modify value. info: enter "help" for other commands. 1> list [ 0] 0x081d6d88 { 112} (unassociated, typically .bss) .fi Only one of the 16 original candidates now have the value 112, so this must be where the amount of gold is stored. I'll try setting it to 10,000 pieces. .nf 1> set 10000 info: setting *0x081d6d88 to 10000... 1> .fi The resulting nethack status: .nf Dlvl:1 $:10000 HP:15(15) Pw:2(2) AC:7 Exp:1 .fi .SH NOTES .B scanmem has been tested on multiple large programs, including the 3d shoot-em-up quake3 linux. Obviously, .B scanmem can crash your program if used incorrectly. Some programs store values in multiple locations, this is why .B set will change all known matches. .SH BUGS The first scan can be very slow on large programs, this is not a problem for subsequent scans as huge portions of the address space are usually eliminated. This could be improved in future, perhaps by assuming all integers are aligned by default. Suggestions welcome. The .B snapshot command uses memory inefficiently, and should probably not be used on large programs. In future this will use a more intelligent format. .SH HOMEPAGE http://code.google.com/p/scanmem/ .SH AUTHORS Tavis Ormandy http://taviso.decsystem.org/ .br Eli Dupree .br WANG Lu All bug reports, suggestions or feedback welcome. .SH SEE ALSO gdb(1) ptrace(2) nethack(6) pidof(8) scanmem-0.13/gpl-2.0.txt0000644000175000017500000004310310641012126011613 00000000000000 GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Lesser General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 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 Street, Fifth Floor, Boston, MA 02110-1301 USA. Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. scanmem-0.13/value.h0000644000175000017500000001405611375713526011306 00000000000000/* $Id: value.h,v 1.5 2007-04-11 10:43:27+01 taviso Exp taviso $ simple routines for working with the value_t data structure. Copyright (C) 2006,2007,2009 Tavis Ormandy Copyright (C) 2009 Eli Dupree Copyright (C) 2009,2010 WANG Lu 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 */ #ifndef _VALUE_INC #define _VALUE_INC #include #include /* some routines for working with value_t structures */ /* this is memory-efficient but DANGEROUS */ /* always keep in mind that don't mess up with bytearray_length or string_length when scanning for BYTEARRAY of STRING */ typedef union { struct __attribute__ ((packed)) { unsigned u8b:1; /* could be an unsigned 8-bit variable (e.g. unsigned char) */ unsigned u16b:1; /* could be an unsigned 16-bit variable (e.g. unsigned short) */ unsigned u32b:1; /* could be an unsigned 32-bit variable (e.g. unsigned int) */ unsigned u64b:1; /* could be an unsigned 64-bit variable (e.g. unsigned long long) */ unsigned s8b:1; /* could be a signed 8-bit variable (e.g. signed char) */ unsigned s16b:1; /* could be a signed 16-bit variable (e.g. short) */ unsigned s32b:1; /* could be a signed 32-bit variable (e.g. int) */ unsigned s64b:1; /* could be a signed 64-bit variable (e.g. long long) */ unsigned f32b:1; /* could be a 32-bit floating point variable (i.e. float) */ unsigned f64b:1; /* could be a 64-bit floating point variable (i.e. double) */ unsigned ineq_forwards:1; /* Whether this value has matched inequalities used the normal way */ unsigned ineq_reverse:1; /* Whether this value has matched inequalities in reverse */ }; uint16_t bytearray_length; /* used when search for an array of bytes or text, I guess uint16_t is enough */ uint16_t string_length; /* used when search for a string */ } match_flags; /* this struct describing values retrieved from target memory */ typedef struct { union { int8_t int8_value; uint8_t uint8_value; int16_t int16_value; uint16_t uint16_value; int32_t int32_value; uint32_t uint32_value; int64_t int64_value; uint64_t uint64_value; float float32_value; double float64_value; int8_t bytes[sizeof(int64_t)]; }; match_flags flags; } value_t; typedef struct{ int8_t byte; int8_t is_wildcard; } bytearray_element_t; /* this struct describing values provided by users */ typedef struct { int8_t int8_value; uint8_t uint8_value; int16_t int16_value; uint16_t uint16_value; int32_t int32_value; uint32_t uint32_value; int64_t int64_value; uint64_t uint64_value; float float32_value; double float64_value; bytearray_element_t *bytearray_value; const char *string_value; match_flags flags; } uservalue_t; /* used when output values to user */ /* only work for numbers */ bool valtostr(const value_t * val, char *str, size_t n); bool parse_uservalue_bytearray(char **argv, unsigned argc, bytearray_element_t *array, uservalue_t * val); /* parse bytearray, the parameter array should be allocated beforehand */ bool parse_uservalue_number(const char *nptr, uservalue_t * val); /* parse int or float */ bool parse_uservalue_int(const char *nptr, uservalue_t * val); bool parse_uservalue_float(const char *nptr, uservalue_t * val); void valcpy(value_t * dst, const value_t * src); void uservalue2value(value_t * dst, const uservalue_t * src); /* dst.flags must be set beforehand */ void truncval_to_flags(value_t * dst, match_flags flags); void truncval(value_t * dst, const value_t * src); void valnowidth(value_t * val); int flags_to_max_width_in_bytes(match_flags flags); int val_max_width_in_bytes(value_t *val); #define get_s8b(val) ((val)->int8_value) #define get_u8b(val) ((val)->uint8_value) #define get_s16b(val) ((val)->int16_value) #define get_u16b(val) ((val)->uint16_value) #define get_s32b(val) ((val)->int32_value) #define get_u32b(val) ((val)->uint32_value) #define get_s64b(val) ((val)->int64_value) #define get_u64b(val) ((val)->uint64_value) #define get_f32b(val) ((val)->float32_value) #define get_f64b(val) ((val)->float64_value) #define set_s8b(val, v) (((val)->int8_value) = v) #define set_u8b(val, v) (((val)->uint8_value) = v) #define set_s16b(val, v) (((val)->int16_value) = v) #define set_u16b(val, v) (((val)->uint16_value) = v) #define set_s32b(val, v) (((val)->int32_value) = v) #define set_u32b(val, v) (((val)->uint32_value) = v) #define set_s64b(val, v) (((val)->int64_value) = v) #define set_u64b(val, v) (((val)->uint64_value) = v) #define set_f32b(val, v) (((val)->float32_value) = v) #define set_f64b(val, v) (((val)->float64_value) = v) #define DECLARE_GET_BY_SYSTEM_DEPENDENT_TYPE_FUNCTIONS(type, typename) \ unsigned type get_u##typename (const value_t const *val); \ signed type get_s##typename (const value_t const *val); DECLARE_GET_BY_SYSTEM_DEPENDENT_TYPE_FUNCTIONS(char, char); DECLARE_GET_BY_SYSTEM_DEPENDENT_TYPE_FUNCTIONS(short, short); DECLARE_GET_BY_SYSTEM_DEPENDENT_TYPE_FUNCTIONS(int, int); DECLARE_GET_BY_SYSTEM_DEPENDENT_TYPE_FUNCTIONS(long, long); DECLARE_GET_BY_SYSTEM_DEPENDENT_TYPE_FUNCTIONS(long long, longlong); #endif scanmem-0.13/config.h.in0000644000175000017500000001550111553203362012026 00000000000000/* config.h.in. Generated from configure.ac by autoheader. */ /* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP systems. This function is required for `alloca.c' support on those systems. */ #undef CRAY_STACKSEG_END /* Define to 1 if using `alloca.c'. */ #undef C_ALLOCA /* Define to 1 if you have `alloca', as a function or macro. */ #undef HAVE_ALLOCA /* Define to 1 if you have and it should be used (not on Ultrix). */ #undef HAVE_ALLOCA_H /* Define to 1 if you have the header file. */ #undef HAVE_FCNTL_H /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define to 1 if you have the `readline' library (-lreadline). */ #undef HAVE_LIBREADLINE /* Define to 1 if you have the `termcap' library (-ltermcap). */ #undef HAVE_LIBTERMCAP /* Define to 1 if you have the header file. */ #undef HAVE_LIMITS_H /* Define to 1 if your system has a GNU libc compatible `malloc' function, and to 0 otherwise. */ #undef HAVE_MALLOC /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H /* Define to 1 if you have the `memset' function. */ #undef HAVE_MEMSET /* Enable /proc/pid/mem support */ #undef HAVE_PROCMEM /* Define to 1 if your system has a GNU libc compatible `realloc' function, and to 0 otherwise. */ #undef HAVE_REALLOC /* Define to 1 if stdbool.h conforms to C99. */ #undef HAVE_STDBOOL_H /* Define to 1 if you have the header file. */ #undef HAVE_STDDEF_H /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* Define to 1 if you have the `strcasecmp' function. */ #undef HAVE_STRCASECMP /* Define to 1 if you have the `strchr' function. */ #undef HAVE_STRCHR /* Define to 1 if you have the `strdup' function. */ #undef HAVE_STRDUP /* Define to 1 if you have the `strerror' function. */ #undef HAVE_STRERROR /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the `strtoul' function. */ #undef HAVE_STRTOUL /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TIME_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* Define to 1 if the system has the type `_Bool'. */ #undef HAVE__BOOL /* Name of package */ #undef PACKAGE /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the home page for this package. */ #undef PACKAGE_URL /* Define to the version of this package. */ #undef PACKAGE_VERSION /* If using the C implementation of alloca, define if you know the direction of stack growth for your system; otherwise it will be automatically deduced at runtime. STACK_DIRECTION > 0 => grows toward higher addresses STACK_DIRECTION < 0 => grows toward lower addresses STACK_DIRECTION = 0 => direction of growth unknown */ #undef STACK_DIRECTION /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* Enable extensions on AIX 3, Interix. */ #ifndef _ALL_SOURCE # undef _ALL_SOURCE #endif /* Enable GNU extensions on systems that have them. */ #ifndef _GNU_SOURCE # undef _GNU_SOURCE #endif /* Enable threading extensions on Solaris. */ #ifndef _POSIX_PTHREAD_SEMANTICS # undef _POSIX_PTHREAD_SEMANTICS #endif /* Enable extensions on HP NonStop. */ #ifndef _TANDEM_SOURCE # undef _TANDEM_SOURCE #endif /* Enable general extensions on Solaris. */ #ifndef __EXTENSIONS__ # undef __EXTENSIONS__ #endif /* Version number of package */ #undef VERSION /* Number of bits in a file offset, on hosts where this is settable. */ #undef _FILE_OFFSET_BITS /* Define for large files, on AIX-style hosts. */ #undef _LARGE_FILES /* Define to 1 if on MINIX. */ #undef _MINIX /* Define to 2 if the system does not provide POSIX.1 features except with this defined. */ #undef _POSIX_1_SOURCE /* Define to 1 if you need to in order for `stat' and other things to work. */ #undef _POSIX_SOURCE /* Define for Solaris 2.5.1 so the uint32_t typedef from , , or is not used. If the typedef were allowed, the #define below would cause a syntax error. */ #undef _UINT32_T /* Define for Solaris 2.5.1 so the uint64_t typedef from , , or is not used. If the typedef were allowed, the #define below would cause a syntax error. */ #undef _UINT64_T /* Define for Solaris 2.5.1 so the uint8_t typedef from , , or is not used. If the typedef were allowed, the #define below would cause a syntax error. */ #undef _UINT8_T /* Define to the type of a signed integer type of width exactly 16 bits if such a type exists and the standard includes do not define it. */ #undef int16_t /* Define to the type of a signed integer type of width exactly 32 bits if such a type exists and the standard includes do not define it. */ #undef int32_t /* Define to the type of a signed integer type of width exactly 64 bits if such a type exists and the standard includes do not define it. */ #undef int64_t /* Define to the type of a signed integer type of width exactly 8 bits if such a type exists and the standard includes do not define it. */ #undef int8_t /* Define to rpl_malloc if the replacement function should be used. */ #undef malloc /* Define to `long int' if does not define. */ #undef off_t /* Define to `int' if does not define. */ #undef pid_t /* Define to rpl_realloc if the replacement function should be used. */ #undef realloc /* Define to `unsigned int' if does not define. */ #undef size_t /* Define to `int' if does not define. */ #undef ssize_t /* Define to the type of an unsigned integer type of width exactly 16 bits if such a type exists and the standard includes do not define it. */ #undef uint16_t /* Define to the type of an unsigned integer type of width exactly 32 bits if such a type exists and the standard includes do not define it. */ #undef uint32_t /* Define to the type of an unsigned integer type of width exactly 64 bits if such a type exists and the standard includes do not define it. */ #undef uint64_t /* Define to the type of an unsigned integer type of width exactly 8 bits if such a type exists and the standard includes do not define it. */ #undef uint8_t scanmem-0.13/aclocal.m40000644000175000017500000010346311553203350011645 00000000000000# generated automatically by aclocal 1.11.1 -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. # This file 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. m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.67],, [m4_warning([this file was generated for autoconf 2.67. You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically `autoreconf'.])]) # Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. # # This file 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. # AM_AUTOMAKE_VERSION(VERSION) # ---------------------------- # Automake X.Y traces this macro to ensure aclocal.m4 has been # generated from the m4 files accompanying Automake X.Y. # (This private macro should not be called outside this file.) AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version='1.11' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. m4_if([$1], [1.11.1], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) # _AM_AUTOCONF_VERSION(VERSION) # ----------------------------- # aclocal traces this macro to find the Autoconf version. # This is a private macro too. Using m4_define simplifies # the logic in aclocal, which can simply ignore this definition. m4_define([_AM_AUTOCONF_VERSION], []) # AM_SET_CURRENT_AUTOMAKE_VERSION # ------------------------------- # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], [AM_AUTOMAKE_VERSION([1.11.1])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- # Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. # # This file 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. # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets # $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to # `$srcdir', `$srcdir/..', or `$srcdir/../..'. # # Of course, Automake must honor this variable whenever it calls a # tool from the auxiliary directory. The problem is that $srcdir (and # therefore $ac_aux_dir as well) can be either absolute or relative, # depending on how configure is run. This is pretty annoying, since # it makes $ac_aux_dir quite unusable in subdirectories: in the top # source directory, any form will work fine, but in subdirectories a # relative path needs to be adjusted first. # # $ac_aux_dir/missing # fails when called from a subdirectory if $ac_aux_dir is relative # $top_srcdir/$ac_aux_dir/missing # fails if $ac_aux_dir is absolute, # fails when called from a subdirectory in a VPATH build with # a relative $ac_aux_dir # # The reason of the latter failure is that $top_srcdir and $ac_aux_dir # are both prefixed by $srcdir. In an in-source build this is usually # harmless because $srcdir is `.', but things will broke when you # start a VPATH build or use an absolute $srcdir. # # So we could use something similar to $top_srcdir/$ac_aux_dir/missing, # iff we strip the leading $srcdir from $ac_aux_dir. That would be: # am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` # and then we would define $MISSING as # MISSING="\${SHELL} $am_aux_dir/missing" # This will work as long as MISSING is not called from configure, because # unfortunately $(top_srcdir) has no meaning in configure. # However there are other variables, like CC, which are often used in # configure, and could therefore not use this "fixed" $ac_aux_dir. # # Another solution, used here, is to always expand $ac_aux_dir to an # absolute PATH. The drawback is that using absolute paths prevent a # configured tree to be moved without reconfiguration. AC_DEFUN([AM_AUX_DIR_EXPAND], [dnl Rely on autoconf to set up CDPATH properly. AC_PREREQ([2.50])dnl # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` ]) # AM_CONDITIONAL -*- Autoconf -*- # Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008 # Free Software Foundation, Inc. # # This file 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. # serial 9 # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- # Define a conditional. AC_DEFUN([AM_CONDITIONAL], [AC_PREREQ(2.52)dnl ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl AC_SUBST([$1_TRUE])dnl AC_SUBST([$1_FALSE])dnl _AM_SUBST_NOTMAKE([$1_TRUE])dnl _AM_SUBST_NOTMAKE([$1_FALSE])dnl m4_define([_AM_COND_VALUE_$1], [$2])dnl if $2; then $1_TRUE= $1_FALSE='#' else $1_TRUE='#' $1_FALSE= fi AC_CONFIG_COMMANDS_PRE( [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then AC_MSG_ERROR([[conditional "$1" was never defined. Usually this means the macro was only invoked conditionally.]]) fi])]) # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009 # Free Software Foundation, Inc. # # This file 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. # serial 10 # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be # written in clear, in which case automake, when reading aclocal.m4, # will think it sees a *use*, and therefore will trigger all it's # C support machinery. Also note that it means that autoscan, seeing # CC etc. in the Makefile, will ask for an AC_PROG_CC use... # _AM_DEPENDENCIES(NAME) # ---------------------- # See how the compiler implements dependency checking. # NAME is "CC", "CXX", "GCJ", or "OBJC". # We try a few techniques and use that to set a single cache variable. # # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was # modified to invoke _AM_DEPENDENCIES(CC); we would have a circular # dependency, and given that the user is not expected to run this macro, # just rely on AC_PROG_CC. AC_DEFUN([_AM_DEPENDENCIES], [AC_REQUIRE([AM_SET_DEPDIR])dnl AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl AC_REQUIRE([AM_MAKE_INCLUDE])dnl AC_REQUIRE([AM_DEP_TRACK])dnl ifelse([$1], CC, [depcc="$CC" am_compiler_list=], [$1], CXX, [depcc="$CXX" am_compiler_list=], [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'], [$1], UPC, [depcc="$UPC" am_compiler_list=], [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], [depcc="$$1" am_compiler_list=]) AC_CACHE_CHECK([dependency style of $depcc], [am_cv_$1_dependencies_compiler_type], [if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_$1_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` fi am__universal=false m4_case([$1], [CC], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac], [CXX], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac]) for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvisualcpp | msvcmsys) # This compiler won't grok `-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_$1_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_$1_dependencies_compiler_type=none fi ]) AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) AM_CONDITIONAL([am__fastdep$1], [ test "x$enable_dependency_tracking" != xno \ && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) ]) # AM_SET_DEPDIR # ------------- # Choose a directory name for dependency files. # This macro is AC_REQUIREd in _AM_DEPENDENCIES AC_DEFUN([AM_SET_DEPDIR], [AC_REQUIRE([AM_SET_LEADING_DOT])dnl AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl ]) # AM_DEP_TRACK # ------------ AC_DEFUN([AM_DEP_TRACK], [AC_ARG_ENABLE(dependency-tracking, [ --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors]) if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' fi AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) AC_SUBST([AMDEPBACKSLASH])dnl _AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl ]) # Generate code to set up dependency tracking. -*- Autoconf -*- # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008 # Free Software Foundation, Inc. # # This file 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. #serial 5 # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], [{ # Autoconf 2.62 quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. case $CONFIG_FILES in *\'*) eval set x "$CONFIG_FILES" ;; *) set x $CONFIG_FILES ;; esac shift for mf do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named `Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`AS_DIRNAME("$mf")` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running `make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n 's/^U = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`AS_DIRNAME(["$file"])` AS_MKDIR_P([$dirpart/$fdir]) # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done } ])# _AM_OUTPUT_DEPENDENCY_COMMANDS # AM_OUTPUT_DEPENDENCY_COMMANDS # ----------------------------- # This macro should only be invoked once -- use via AC_REQUIRE. # # This code is only required when automatic dependency tracking # is enabled. FIXME. This creates each `.P' file that we will # need in order to bootstrap the dependency handling code. AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AC_CONFIG_COMMANDS([depfiles], [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) ]) # Do all the work for Automake. -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 2005, 2006, 2008, 2009 Free Software Foundation, Inc. # # This file 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. # serial 16 # This macro actually does too much. Some checks are only needed if # your package does certain things. But this isn't really a big deal. # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) # AM_INIT_AUTOMAKE([OPTIONS]) # ----------------------------------------------- # The call with PACKAGE and VERSION arguments is the old style # call (pre autoconf-2.50), which is being phased out. PACKAGE # and VERSION should now be passed to AC_INIT and removed from # the call to AM_INIT_AUTOMAKE. # We support both call styles for the transition. After # the next Automake release, Autoconf can make the AC_INIT # arguments mandatory, and then we can depend on a new Autoconf # release and drop the old call support. AC_DEFUN([AM_INIT_AUTOMAKE], [AC_PREREQ([2.62])dnl dnl Autoconf wants to disallow AM_ names. We explicitly allow dnl the ones we care about. m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl AC_REQUIRE([AC_PROG_INSTALL])dnl if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl # test to see if srcdir already configured if test -f $srcdir/config.status; then AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi AC_SUBST([CYGPATH_W]) # Define the identity of the package. dnl Distinguish between old-style and new-style calls. m4_ifval([$2], [m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl AC_SUBST([PACKAGE], [$1])dnl AC_SUBST([VERSION], [$2])], [_AM_SET_OPTIONS([$1])dnl dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,, [m4_fatal([AC_INIT should be called with package and version arguments])])dnl AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl _AM_IF_OPTION([no-define],, [AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl # Some tools Automake needs. AC_REQUIRE([AM_SANITY_CHECK])dnl AC_REQUIRE([AC_ARG_PROGRAM])dnl AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}) AM_MISSING_PROG(AUTOCONF, autoconf) AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) AM_MISSING_PROG(AUTOHEADER, autoheader) AM_MISSING_PROG(MAKEINFO, makeinfo) AC_REQUIRE([AM_PROG_INSTALL_SH])dnl AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl AC_REQUIRE([AM_PROG_MKDIR_P])dnl # We need awk for the "check" target. The system "awk" is bad on # some platforms. AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AM_SET_LEADING_DOT])dnl _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], [_AM_PROG_TAR([v7])])]) _AM_IF_OPTION([no-dependencies],, [AC_PROVIDE_IFELSE([AC_PROG_CC], [_AM_DEPENDENCIES(CC)], [define([AC_PROG_CC], defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl AC_PROVIDE_IFELSE([AC_PROG_CXX], [_AM_DEPENDENCIES(CXX)], [define([AC_PROG_CXX], defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJC], [_AM_DEPENDENCIES(OBJC)], [define([AC_PROG_OBJC], defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl ]) _AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl dnl The `parallel-tests' driver may need to know about EXEEXT, so add the dnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This macro dnl is hooked onto _AC_COMPILER_EXEEXT early, see below. AC_CONFIG_COMMANDS_PRE(dnl [m4_provide_if([_AM_COMPILER_EXEEXT], [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl ]) dnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion. Do not dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further dnl mangled by Autoconf and run in a shell conditional statement. m4_define([_AC_COMPILER_EXEEXT], m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) # When config.status generates a header, we must update the stamp-h file. # This file resides in the same directory as the config header # that is generated. The stamp files are numbered to have different names. # Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the # loop where config.status creates the headers, so we can generate # our stamp files there. AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], [# Compute $1's index in $config_headers. _am_arg=$1 _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) # Copyright (C) 2001, 2003, 2005, 2008 Free Software Foundation, Inc. # # This file 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. # AM_PROG_INSTALL_SH # ------------------ # Define $install_sh. AC_DEFUN([AM_PROG_INSTALL_SH], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl if test x"${install_sh}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi AC_SUBST(install_sh)]) # Copyright (C) 2003, 2005 Free Software Foundation, Inc. # # This file 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. # serial 2 # Check whether the underlying file-system supports filenames # with a leading dot. For instance MS-DOS doesn't. AC_DEFUN([AM_SET_LEADING_DOT], [rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null AC_SUBST([am__leading_dot])]) # Check to see how 'make' treats includes. -*- Autoconf -*- # Copyright (C) 2001, 2002, 2003, 2005, 2009 Free Software Foundation, Inc. # # This file 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. # serial 4 # AM_MAKE_INCLUDE() # ----------------- # Check to see how make treats includes. AC_DEFUN([AM_MAKE_INCLUDE], [am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo this is the am__doit target .PHONY: am__doit END # If we don't find an include directive, just comment out the code. AC_MSG_CHECKING([for style of include used by $am_make]) am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # Ignore all kinds of additional output from `make'. case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=include am__quote= _am_result=GNU ;; esac # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=.include am__quote="\"" _am_result=BSD ;; esac fi AC_SUBST([am__include]) AC_SUBST([am__quote]) AC_MSG_RESULT([$_am_result]) rm -f confinc confmf ]) # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- # Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008 # Free Software Foundation, Inc. # # This file 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. # serial 6 # AM_MISSING_PROG(NAME, PROGRAM) # ------------------------------ AC_DEFUN([AM_MISSING_PROG], [AC_REQUIRE([AM_MISSING_HAS_RUN]) $1=${$1-"${am_missing_run}$2"} AC_SUBST($1)]) # AM_MISSING_HAS_RUN # ------------------ # Define MISSING if not defined so far and test if it supports --run. # If it does, set am_missing_run to use it, otherwise, to nothing. AC_DEFUN([AM_MISSING_HAS_RUN], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([missing])dnl if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= AC_MSG_WARN([`missing' script is too old or missing]) fi ]) # Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc. # # This file 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. # AM_PROG_MKDIR_P # --------------- # Check for `mkdir -p'. AC_DEFUN([AM_PROG_MKDIR_P], [AC_PREREQ([2.60])dnl AC_REQUIRE([AC_PROG_MKDIR_P])dnl dnl Automake 1.8 to 1.9.6 used to define mkdir_p. We now use MKDIR_P, dnl while keeping a definition of mkdir_p for backward compatibility. dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile. dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of dnl Makefile.ins that do not define MKDIR_P, so we do our own dnl adjustment using top_builddir (which is defined more often than dnl MKDIR_P). AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl case $mkdir_p in [[\\/$]]* | ?:[[\\/]]*) ;; */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; esac ]) # Helper functions for option handling. -*- Autoconf -*- # Copyright (C) 2001, 2002, 2003, 2005, 2008 Free Software Foundation, Inc. # # This file 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. # serial 4 # _AM_MANGLE_OPTION(NAME) # ----------------------- AC_DEFUN([_AM_MANGLE_OPTION], [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) # _AM_SET_OPTION(NAME) # ------------------------------ # Set option NAME. Presently that only means defining a flag for this option. AC_DEFUN([_AM_SET_OPTION], [m4_define(_AM_MANGLE_OPTION([$1]), 1)]) # _AM_SET_OPTIONS(OPTIONS) # ---------------------------------- # OPTIONS is a space-separated list of Automake options. AC_DEFUN([_AM_SET_OPTIONS], [m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) # _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) # ------------------------------------------- # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) # Check to make sure that the build environment is sane. -*- Autoconf -*- # Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008 # Free Software Foundation, Inc. # # This file 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. # serial 5 # AM_SANITY_CHECK # --------------- AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) # Just in case sleep 1 echo timestamp > conftest.file # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[[\\\"\#\$\&\'\`$am_lf]]*) AC_MSG_ERROR([unsafe absolute working directory name]);; esac case $srcdir in *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);; esac # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$[*]" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi rm -f conftest.file if test "$[*]" != "X $srcdir/configure conftest.file" \ && test "$[*]" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken alias in your environment]) fi test "$[2]" = conftest.file ) then # Ok. : else AC_MSG_ERROR([newly created file is older than distributed files! Check your system clock]) fi AC_MSG_RESULT(yes)]) # Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. # # This file 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. # AM_PROG_INSTALL_STRIP # --------------------- # One issue with vendor `install' (even GNU) is that you can't # specify the program used to strip binaries. This is especially # annoying in cross-compiling environments, where the build's strip # is unlikely to handle the host's binaries. # Fortunately install-sh will honor a STRIPPROG variable, so we # always use install-sh in `make install-strip', and initialize # STRIPPROG with the value of the STRIP variable (set by the user). AC_DEFUN([AM_PROG_INSTALL_STRIP], [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl # Installed binaries are usually stripped using `strip' when the user # run `make install-strip'. However `strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the `STRIP' environment variable to overrule this program. dnl Don't test for $cross_compiling = yes, because it might be `maybe'. if test "$cross_compiling" != no; then AC_CHECK_TOOL([STRIP], [strip], :) fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) # Copyright (C) 2006, 2008 Free Software Foundation, Inc. # # This file 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. # serial 2 # _AM_SUBST_NOTMAKE(VARIABLE) # --------------------------- # Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. # This macro is traced by Automake. AC_DEFUN([_AM_SUBST_NOTMAKE]) # AM_SUBST_NOTMAKE(VARIABLE) # --------------------------- # Public sister of _AM_SUBST_NOTMAKE. AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) # Check how to create a tarball. -*- Autoconf -*- # Copyright (C) 2004, 2005 Free Software Foundation, Inc. # # This file 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. # serial 2 # _AM_PROG_TAR(FORMAT) # -------------------- # Check how to create a tarball in format FORMAT. # FORMAT should be one of `v7', `ustar', or `pax'. # # Substitute a variable $(am__tar) that is a command # writing to stdout a FORMAT-tarball containing the directory # $tardir. # tardir=directory && $(am__tar) > result.tar # # Substitute a variable $(am__untar) that extract such # a tarball read from stdin. # $(am__untar) < result.tar AC_DEFUN([_AM_PROG_TAR], [# Always define AMTAR for backward compatibility. AM_MISSING_PROG([AMTAR], [tar]) m4_if([$1], [v7], [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'], [m4_case([$1], [ustar],, [pax],, [m4_fatal([Unknown tar format])]) AC_MSG_CHECKING([how to create a $1 tar archive]) # Loop over all known methods to create a tar archive until one works. _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' _am_tools=${am_cv_prog_tar_$1-$_am_tools} # Do not fold the above two line into one, because Tru64 sh and # Solaris sh will not grok spaces in the rhs of `-'. for _am_tool in $_am_tools do case $_am_tool in gnutar) for _am_tar in tar gnutar gtar; do AM_RUN_LOG([$_am_tar --version]) && break done am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' am__untar="$_am_tar -xf -" ;; plaintar) # Must skip GNU tar: if it does not support --format= it doesn't create # ustar tarball either. (tar --version) >/dev/null 2>&1 && continue am__tar='tar chf - "$$tardir"' am__tar_='tar chf - "$tardir"' am__untar='tar xf -' ;; pax) am__tar='pax -L -x $1 -w "$$tardir"' am__tar_='pax -L -x $1 -w "$tardir"' am__untar='pax -r' ;; cpio) am__tar='find "$$tardir" -print | cpio -o -H $1 -L' am__tar_='find "$tardir" -print | cpio -o -H $1 -L' am__untar='cpio -i -H $1 -d' ;; none) am__tar=false am__tar_=false am__untar=false ;; esac # If the value was cached, stop now. We just wanted to have am__tar # and am__untar set. test -n "${am_cv_prog_tar_$1}" && break # tar/untar a dummy directory, and stop if the command works rm -rf conftest.dir mkdir conftest.dir echo GrepMe > conftest.dir/file AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) rm -rf conftest.dir if test -s conftest.tar; then AM_RUN_LOG([$am__untar /dev/null 2>&1 && break fi done rm -rf conftest.dir AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) AC_MSG_RESULT([$am_cv_prog_tar_$1])]) AC_SUBST([am__tar]) AC_SUBST([am__untar]) ]) # _AM_PROG_TAR scanmem-0.13/show_message.c0000644000175000017500000000520511332540735012636 00000000000000/* show_message.c Copyright (C) 2010 WANG Lu 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 . */ #include "config.h" #include #include #include "show_message.h" #include "scanmem.h" void show_info(const char *fmt, ...) { va_list args; va_start (args, fmt); fprintf(stderr, "info: "); vfprintf(stderr, fmt, args); /* make sure this line ends, it's ok if this creates a new line, since the front-end will ignore it */ if (globals.options.backend) fprintf(stderr, "\n"); va_end (args); } void show_error(const char *fmt, ...) { va_list args; va_start (args, fmt); fprintf(stderr, "error: "); vfprintf(stderr, fmt, args); /* make sure this line ends, it's ok if this creates a new line, since the front-end will ignore it */ if (globals.options.backend) fprintf(stderr, "\n"); va_end (args); } void show_warn(const char *fmt, ...) { va_list args; va_start (args, fmt); fprintf(stderr, "warn: "); vfprintf(stderr, fmt, args); /* make sure this line ends, it's ok if this creates a new line, since the front-end will ignore it */ if (globals.options.backend) fprintf(stderr, "\n"); va_end (args); } void show_user(const char *fmt, ...) { va_list args; va_start (args, fmt); if (!(globals.options.backend)) { vfprintf(stderr, fmt, args); } va_end (args); } void show_debug(const char *fmt, ...) { va_list args; va_start (args, fmt); if (globals.options.debug) { fprintf(stderr, "debug: "); vfprintf(stderr, fmt, args); /* make sure this line ends, it's ok if this creates a new line, since the front-end will ignore it */ if (globals.options.backend) fprintf(stderr, "\n"); } va_end (args); } void show_scan_progress(unsigned long cur, unsigned long total) { if (!(globals.options.backend)) { fprintf(stderr, "."); fflush(stderr); } else { fprintf(stderr, "scan_progress: %lu %lu\n", cur, total); } } scanmem-0.13/maps.h0000644000175000017500000000401011323555512011107 00000000000000/* $Id: maps.h,v 1.2 2007-06-05 01:45:35+01 taviso Exp $ Copyright (C) 2006,2007,2009 Tavis Ormandy Copyright (C) 2009 Eli Dupree Copyright (C) 2009,2010 WANG Lu 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 */ #ifndef _MAPS_INC #define _MAPS_INC /* include guard */ #include "list.h" /* determine what regions we need */ typedef enum { REGION_ALL, /* each of them */ REGION_HEAP_STACK_EXECUTABLE, /* heap, stack, executable */ REGION_HEAP_STACK_EXECUTABLE_BSS /* heap, stack, executable, bss */ } region_scan_level_t; /* a region obtained from /proc/pid/maps, these are searched for matches */ typedef struct { void *start; /* start address. Hack: If HAVE_PROCMEM, this is actually an (unsigned long) offset into /proc/{pid}/mem */ unsigned long size; /* size */ struct __attribute__((packed)) { unsigned read:1; unsigned write:1; unsigned exec:1; unsigned shared:1; unsigned private:1; } flags; unsigned id; /* unique identifier */ char filename[1]; /* associated file, must be last */ } region_t; bool readmaps(pid_t target, list_t * regions); int compare_region_id(const region_t *a, const region_t *b); #endif /* _MAPS_INC */ scanmem-0.13/scanmem.h0000644000175000017500000000616611734004723011607 00000000000000/* $Id: scanmem.h,v 1.21 2007-06-05 01:45:35+01 taviso Exp taviso $ */ #ifndef _SCANMEM_INC #define _SCANMEM_INC /* include guard */ /*lint +libh(config.h) */ #include "config.h" #include #include #include /*lint !e537 */ #include "scanroutines.h" #include "list.h" #include "value.h" #include "target_memory_info_array.h" /* list of functions where i dont want to be warned about ignored return value */ /*lint -esym(534,detach,printversion,strftime,fflush,sleep) */ #ifndef PACKAGE_VERSION # define PACKAGE_VERSION "(unknown)" #endif /* #ifndef NDEBUG # define eprintf(x, y...) fprintf(stderr, x, ## y) #else # define eprintf(x, y...) #endif */ #ifdef _lint /*lint -save -e652 -e683 -e547 */ # define snprintf(a, b, c...) (((void) b), sprintf(a, ## c)) # define strtoll(a,b,c) ((long long) strtol(a,b,c)) # define WIFSTOPPED # define sighandler_t _sigfunc_t /*lint -restore */ /*lint -save -esym(526,getline,strdupa,strdup,strndupa,strtoll,pread) */ ssize_t getline(char **lineptr, size_t * n, FILE * stream); char *strndupa(const char *s, size_t n); char *strdupa(const char *s); char *strdup(const char *s); ssize_t pread(int fd, void *buf, size_t count, off_t offset); /*lint -restore */ #endif #ifdef __CSURF__ # define waitpid(x,y,z) ((*(y)=0),-rand()) # define WIFSTOPPED(x) (rand()) # define ptrace(w,x,y,z) ((errno=rand()),(ptrace(w,x,y,z))) #endif #ifndef MIN # define MIN(a,b) ((a) < (b) ? (a) : (b)) #endif /* global settings */ typedef struct { unsigned exit:1; pid_t target; matches_and_old_values_array *matches; long num_matches; list_t *regions; list_t *commands; /* command handlers */ const char *current_cmdline; /* the command being executed */ struct { unsigned short alignment; unsigned short debug; unsigned short backend; /* if 1, scanmem will work as a backend, and output would be more machine-readable */ /* options that can be changed during runtime */ scan_data_type_t scan_data_type; region_scan_level_t region_scan_level; unsigned short detect_reverse_change; unsigned short dump_with_ascii; } options; } globals_t; /* this structure represents one known match, its address and type. */ #if 0 typedef struct { void *address; /* address of variable */ region_t *region; /* region it belongs to */ value_t lvalue; /* last seen value */ unsigned matchid; /* unique identifier */ } match_t; #endif /* global settings */ extern globals_t globals; bool detach(pid_t target); bool setaddr(pid_t target, void *addr, const value_t * to); bool checkmatches(globals_t * vars, scan_match_type_t match_type, const uservalue_t *uservalue); bool searchregions(globals_t * vars, scan_match_type_t match_type, const uservalue_t *uservalue); bool peekdata(pid_t pid, void *addr, value_t * result); bool attach(pid_t target); bool getcommand(globals_t * vars, char **line); void printversion(); bool read_array(pid_t target, void *addr, char *buf, int len); bool write_array(pid_t target, void *addr, const void *data, int len); #endif scanmem-0.13/ptrace.c0000644000175000017500000006417011744672453011450 00000000000000/* $Id: ptrace.c,v 1.22 2007-06-07 15:16:46+01 taviso Exp taviso $ Copyright (C) 2006,2007,2009 Tavis Ormandy Copyright (C) 2009 Eli Dupree Copyright (C) 2009,2010 WANG Lu 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" /* for pread */ # ifdef _XOPEN_SOURCE # undef _XOPEN_SOURCE # endif # define _XOPEN_SOURCE 500 #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #ifdef __GNUC__ # define EXPECT(x,y) __builtin_expect(x, y) #else # define EXPECT(x,y) x #endif // Dirty hack for FreeBSD #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) #define PTRACE_ATTACH PT_ATTACH #define PTRACE_DETACH PT_DETACH #define PTRACE_PEEKDATA PT_READ_D #define PTRACE_POKEDATA PT_WRITE_D #endif #include "value.h" #include "scanroutines.h" #include "scanmem.h" #include "show_message.h" #define min(a,b) (((a)<(b))?(a):(b)) /* ptrace peek buffer, used by peekdata() */ /* make it larger in order to reduce shift */ /* #define MAX_PEEKBUF_SIZE (4*sizeof(int64_t)) */ #define MAX_PEEKBUF_SIZE (1024) static struct { uint8_t cache[MAX_PEEKBUF_SIZE]; /* read from ptrace() */ unsigned size; /* number of entries (in bytes) */ char *base; /* base address of cached region */ pid_t pid; /* what pid this applies to */ } peekbuf; bool attach(pid_t target) { int status; /* attach, to the target application, which should cause a SIGSTOP */ if (ptrace(PTRACE_ATTACH, target, NULL, NULL) == -1L) { show_error("failed to attach to %d, %s\n", target, strerror(errno)); return false; } /* wait for the SIGSTOP to take place. */ if (waitpid(target, &status, 0) == -1 || !WIFSTOPPED(status)) { show_error("there was an error waiting for the target to stop.\n"); show_info("%s\n", strerror(errno)); return false; } /* flush the peek buffer */ memset(&peekbuf, 0x00, sizeof(peekbuf)); /* everything looks okay */ return true; } bool detach(pid_t target) { // addr is ignore under Linux, but should be 1 under FreeBSD in order to let the child process continue at what it had been interrupted return ptrace(PTRACE_DETACH, target, 1, 0) == 0; } /* * peekdata - caches overlapping ptrace reads to improve performance. * * This routine could just call ptrace(PEEKDATA), but using a cache reduces * the number of peeks required by 70% when reading large chunks of * consecutive addresses. */ bool peekdata(pid_t pid, void *addr, value_t * result) { char *reqaddr = addr; int i, j; int shift_size1 = 0, shift_size2 = 0; char *last_address_gathered = 0; assert(peekbuf.size <= MAX_PEEKBUF_SIZE); assert(result != NULL); memset(result, 0x00, sizeof(value_t)); valnowidth(result); /* check if we have a cache hit */ if (pid == peekbuf.pid && reqaddr >= peekbuf.base && (unsigned long) (reqaddr + sizeof(int64_t) - peekbuf.base) <= peekbuf.size) { result->int64_value = *((int64_t *)&peekbuf.cache[reqaddr - peekbuf.base]); /*lint !e826 */ return true; } else if (pid == peekbuf.pid && reqaddr >= peekbuf.base && (unsigned long) (reqaddr - peekbuf.base) < peekbuf.size) { assert(peekbuf.size != 0); /* partial hit, we have some of the data but not all, so remove old entries - shift the frame by as far as is necessary */ /* tail shift, round up to nearest long size, for ptrace efficiency */ shift_size1 = (reqaddr + sizeof(int64_t)) - (peekbuf.base + peekbuf.size); shift_size1 = sizeof(long) * (1 + (shift_size1-1) / sizeof(long)); /* head shift if necessary*/ if (peekbuf.size + shift_size1 > MAX_PEEKBUF_SIZE) { shift_size2 = reqaddr-peekbuf.base; shift_size2 = sizeof(long) * (shift_size2 / sizeof(long)); for (i = shift_size2; i < peekbuf.size; ++i) { peekbuf.cache[i - shift_size2] = peekbuf.cache[i]; } peekbuf.size -= shift_size2; peekbuf.base += shift_size2; } } else { /* cache miss, invalidate cache */ shift_size1 = shift_size2 = sizeof(int64_t); peekbuf.pid = pid; peekbuf.size = 0; peekbuf.base = addr; } /* we need a ptrace() to complete request */ errno = 0; for (i = 0; i < shift_size1; i += sizeof(long)) { char *ptrace_address = peekbuf.base + peekbuf.size; long ptraced_long = ptrace(PTRACE_PEEKDATA, pid, ptrace_address, NULL); /* check if ptrace() succeeded */ if (EXPECT(ptraced_long == -1L && errno != 0, false)) { /* its possible i'm trying to read partially oob */ if (errno == EIO || errno == EFAULT) { /* read backwards until we get a good read, then shift out the right value */ for (j = 1, errno = 0; j < sizeof(long); j++, errno = 0) { /* Try for a shifted ptrace - 'continue' (i.e. try an increased shift) if it fails */ if ((ptraced_long = ptrace(PTRACE_PEEKDATA, pid, ptrace_address - j, NULL)) == -1L && (errno == EIO || errno == EFAULT)) continue; /* Cache it with the appropriate offset */ if(peekbuf.size >= j) { *((long *)&peekbuf.cache[peekbuf.size - j]) = ptraced_long; } else { *((long *)&peekbuf.cache[0]) = ptraced_long; peekbuf.base -= j; } peekbuf.size += sizeof(long) - j; last_address_gathered = ptrace_address + sizeof(long) - j; /* Interrupt the gathering process */ goto doublebreak; } } /* i wont print a message here, would be very noisy if a region is unmapped */ return false; } /* Otherwise, ptrace() worked - cache the data, increase the size */ *((long *)&peekbuf.cache[peekbuf.size]) = ptraced_long; peekbuf.size += sizeof(long); last_address_gathered = ptrace_address + sizeof(long); } doublebreak: /* Return result to caller */ if (reqaddr + sizeof(int64_t) <= last_address_gathered) { /* The values are fine - read away */ result->int64_value = *((int64_t *)&peekbuf.cache[reqaddr - peekbuf.base]); /*lint !e826 */ } else { int successful_gathering = last_address_gathered - reqaddr; /* We didn't get enough - add zeroes at the end */ for (i = 0; i < sizeof(int64_t); ++i) { uint8_t val = (i < successful_gathering) ? peekbuf.cache[reqaddr - peekbuf.base + i] : 0; *(((uint8_t *)&result->int64_value) + i) = val; } /* Mark which values this can't be */ if (successful_gathering < sizeof(int64_t)) result->flags.u64b = result->flags.s64b = result->flags.f64b = 0; if (successful_gathering < sizeof(int32_t)) result->flags.u32b = result->flags.s32b = result->flags.f32b = 0; if (successful_gathering < sizeof(int16_t)) result->flags.u16b = result->flags.s16b = 0; if (successful_gathering < sizeof(int8_t)) result->flags.u8b = result->flags.s8b = 0; } /* success */ return true; } /* This is the function that handles when you enter a value (or >, <, =) for the second or later time (i.e. when there's already a list of matches); it reduces the list to those that still match. It returns false on failure to attach, detach, or reallocate memory, otherwise true. "value" is what to compare to. It is meaningless when the match type is not MATCHEXACT. */ bool checkmatches(globals_t * vars, scan_match_type_t match_type, const uservalue_t *uservalue) { matches_and_old_values_swath *reading_swath_index = (matches_and_old_values_swath *)vars->matches->swaths; matches_and_old_values_swath reading_swath = *reading_swath_index; long bytes_scanned = 0; long total_scan_bytes = 0; matches_and_old_values_swath *tmp_swath_index = reading_swath_index; while(tmp_swath_index->number_of_bytes) { total_scan_bytes += tmp_swath_index->number_of_bytes; tmp_swath_index = (matches_and_old_values_swath *)(&tmp_swath_index->data[tmp_swath_index->number_of_bytes]); } int reading_iterator = 0; matches_and_old_values_swath *writing_swath_index = (matches_and_old_values_swath *)vars->matches->swaths; writing_swath_index->first_byte_in_child = NULL; writing_swath_index->number_of_bytes = 0; /* used to fill in non-match regions */ match_flags zero_flag; memset(&zero_flag, 0, sizeof(zero_flag)); int required_extra_bytes_to_record = 0; vars->num_matches = 0; if (choose_scanroutine(vars->options.scan_data_type, match_type) == false) { show_error("unsupported scan for current data type.\n"); return false; } assert(g_scan_routine); /* stop and attach to the target */ if (attach(vars->target) == false) return false; while (reading_swath.first_byte_in_child) { int match_length = 0; value_t data_value; match_flags checkflags; void *address = reading_swath.first_byte_in_child + reading_iterator; /* Read value from this address */ if (EXPECT(peekdata(vars->target, address, &data_value) == false, false)) { /* Uhh, what? We couldn't look at the data there? I guess this doesn't count as a match then */ } else { value_t old_val = data_to_val_aux(reading_swath_index, reading_iterator, reading_swath.number_of_bytes /* ,MATCHES_AND_VALUES */); match_flags flags = reading_swath_index->data[reading_iterator].match_info; /* these are not harmful for bytearray routine, since it will ignore flags of new_value & old_value */ truncval_to_flags(&old_val, flags); truncval_to_flags(&data_value, flags); memset(&checkflags, 0, sizeof(checkflags)); match_length = (*g_scan_routine)(&data_value, &old_val, uservalue, &checkflags, address); } if (match_length > 0) { /* Still a candidate. Write data. (We can get away with overwriting in the same array because it is guaranteed to take up the same number of bytes or fewer, and because we copied out the reading swath metadata already.) (We can get away with assuming that the pointers will stay valid, because as we never add more data to the array than there was before, it will not reallocate.) */ old_value_and_match_info new_value = { get_u8b(&data_value), checkflags }; writing_swath_index = add_element((&vars->matches), writing_swath_index, address, &new_value /* ,MATCHES_AND_VALUES */); ++vars->num_matches; required_extra_bytes_to_record = match_length - 1; } else if (required_extra_bytes_to_record) { old_value_and_match_info new_value = { get_u8b(&data_value), zero_flag }; writing_swath_index = add_element(&vars->matches, writing_swath_index, address, &new_value /* ,MATCHES_AND_VALUES */); --required_extra_bytes_to_record; } if (EXPECT((total_scan_bytes >= 110) && (bytes_scanned % ((total_scan_bytes) / 10) == 10), false)) { /* for user, just print a dot */ show_scan_progress(bytes_scanned, total_scan_bytes); } ++ bytes_scanned; /* Go on to the next one... */ ++reading_iterator; if (reading_iterator >= reading_swath.number_of_bytes) { assert(((matches_and_old_values_swath *)(&reading_swath_index->data[reading_swath.number_of_bytes]))->number_of_bytes >= 0); reading_swath_index = (matches_and_old_values_swath *)(&reading_swath_index->data[reading_swath.number_of_bytes]); reading_swath = *reading_swath_index; reading_iterator = 0; required_extra_bytes_to_record = 0; /* just in case */ } } if (!(vars->matches = null_terminate(vars->matches, writing_swath_index /* ,MATCHES_AND_VALUES */))) { show_error("memory allocation error while reducing matches-array size\n"); return false; } /* hack for front-end, it needs this information */ /* TODO: we'll need progress for checkmatches too */ if (vars->options.backend == 1) { show_scan_progress(total_scan_bytes, total_scan_bytes); } show_info("we currently have %ld matches.\n", vars->num_matches); /* okay, detach */ return detach(vars->target); } /* read region using /proc/pid/mem */ ssize_t readregion(pid_t target, void *buf, size_t count, unsigned long offset) { char mem[32]; int fd; ssize_t len; /* print the path to mem file */ snprintf(mem, sizeof(mem), "/proc/%d/mem", target); /* attempt to open the file */ if ((fd = open(mem, O_RDONLY)) == -1) { show_error("unable to open %s.\n", mem); return -1; } /* try to honour the request */ len = pread(fd, buf, count, offset); /* clean up */ close(fd); return len; } /* searchregions() performs an initial search of the process for values matching value */ bool searchregions(globals_t * vars, scan_match_type_t match_type, const uservalue_t *uservalue) { matches_and_old_values_swath *writing_swath_index; int required_extra_bytes_to_record = 0; unsigned long total_size = 0; unsigned regnum = 0; element_t *n = vars->regions->head; region_t *r; unsigned long total_scan_bytes = 0; unsigned long bytes_scanned = 0; void *address = NULL; #if HAVE_PROCMEM unsigned char *data = NULL; ssize_t len = 0; #endif /* used to fill in non-match regions */ match_flags zero_flag; memset(&zero_flag, 0, sizeof(zero_flag)); if (choose_scanroutine(vars->options.scan_data_type, match_type) == false) { show_error("unsupported scan for current data type.\n"); return false; } assert(g_scan_routine); /* stop and attach to the target */ if (attach(vars->target) == false) return false; /* make sure we have some regions to search */ if (vars->regions->size == 0) { show_warn("no regions defined, perhaps you deleted them all?\n"); show_info("use the \"reset\" command to refresh regions.\n"); return detach(vars->target); } total_size = sizeof(matches_and_old_values_array); while (n) { total_size += ((region_t *)(n->data))->size * sizeof(old_value_and_match_info) + sizeof(matches_and_old_values_swath); n = n->next; } total_size += sizeof(matches_and_old_values_swath); /* for null terminate */ show_debug("allocate array, max size %ld\n", total_size); if (!(vars->matches = allocate_array(vars->matches, total_size))) { show_error("could not allocate match array\n"); return false; } writing_swath_index = (matches_and_old_values_swath *)vars->matches->swaths; writing_swath_index->first_byte_in_child = NULL; writing_swath_index->number_of_bytes = 0; /* get total byte */ for(n = vars->regions->head; n; n = n->next) total_scan_bytes += ((region_t *)n->data)->size; n = vars->regions->head; /* check every memory region */ while (n) { unsigned offset, nread = 0; /* load the next region */ r = n->data; #if HAVE_PROCMEM /* over allocate by enough bytes set to zero that the last bytes can be read as 64-bit ints */ if ((data = calloc(r->size + sizeof(int64_t) - 1, 1)) == NULL) { show_error("sorry, there was a memory allocation error.\n"); return false; } /* keep reading until completed */ while (nread < r->size) { if ((len = readregion(vars->target, data+nread, r->size-nread, (unsigned long)(r->start+nread))) == -1) { /* no, continue with whatever data was read */ break; } else { /* some data was read */ nread += len; } } #else /* cannot use /proc/pid/mem */ nread = r->size; #endif /* print a progress meter so user knows we havent crashed */ /* cannot use show_info here because it'll append a '\n' */ show_info("%02u/%02u searching %#10lx - %#10lx.", ++regnum, vars->regions->size, (unsigned long)r->start, (unsigned long)r->start + r->size); fflush(stderr); /* for every offset, check if we have a match */ for (offset = 0; offset < nread; offset++) { match_flags checkflags; value_t data_value; /* initialise check */ memset(&data_value, 0x00, sizeof(data_value)); valnowidth(&data_value); address = r->start + offset; #if HAVE_PROCMEM data_value.int64_value = *((int64_t *)(&data[offset])); /* Mark which values this can't be */ if (EXPECT((nread - offset < sizeof(int64_t)), false)) { data_value.flags.u64b = data_value.flags.s64b = data_value.flags.f64b = 0; if (nread - offset < sizeof(int32_t)) { data_value.flags.u32b = data_value.flags.s32b = data_value.flags.f32b = 0; if (nread - offset < sizeof(int16_t)) { data_value.flags.u16b = data_value.flags.s16b = 0; if (nread - offset < sizeof(int8_t)) { data_value.flags.u8b = data_value.flags.s8b = 0; } } } } #else if (EXPECT(peekdata(vars->target, address, &data_value) == false, false)) { break; } #endif memset(&checkflags, 0, sizeof(checkflags)); int match_length; /* check if we have a match */ if (EXPECT(((match_length = (*g_scan_routine)(&data_value, NULL, uservalue, &checkflags, address)) > 0), false)) { /* only set these flags for numbers */ if ((globals.options.scan_data_type != BYTEARRAY) && (globals.options.scan_data_type != STRING)) { checkflags.ineq_forwards = checkflags.ineq_reverse = 1; } old_value_and_match_info new_value = { get_u8b(&data_value), checkflags }; writing_swath_index = add_element((&vars->matches), writing_swath_index, r->start + offset, &new_value); ++vars->num_matches; required_extra_bytes_to_record = match_length - 1; } else if (required_extra_bytes_to_record) { old_value_and_match_info new_value = { get_u8b(&data_value), zero_flag }; writing_swath_index = add_element((&vars->matches), writing_swath_index, r->start + offset, &new_value); --required_extra_bytes_to_record; } /* print a simple progress meter. */ if (EXPECT((r->size >= 110) && (offset % ((r->size) / 10) == 10), false)) { /* for user, just print a dot */ show_scan_progress(bytes_scanned+offset, total_scan_bytes); } } bytes_scanned += r->size; n = n->next; show_user("ok\n"); #if HAVE_PROCMEM free(data); #endif } /* tell front-end we've done */ if(vars->options.backend == 1) show_scan_progress(total_scan_bytes, total_scan_bytes); if (!(vars->matches = null_terminate(vars->matches, writing_swath_index /* ,MATCHES_AND_VALUES */))) { show_error("memory allocation error while reducing matches-array size\n"); return false; } show_info("we currently have %ld matches.\n", vars->num_matches); /* okay, detach */ return detach(vars->target); } bool setaddr(pid_t target, void *addr, const value_t * to) { value_t saved; int i; if (attach(target) == false) { return false; } if (peekdata(target, addr, &saved) == false) { show_error("couldnt access the target address %10p\n", addr); return false; } /* Basically, overwrite as much of the data as makes sense, and no more. */ /* about float/double: now value_t is a union, we can use the following way instead of the commented way, in order to avoid compiler warning */ if (saved.flags.u64b && to->flags.u64b) { set_u64b(&saved, get_u64b(to)); } else if (saved.flags.s64b && to->flags.s64b) { set_s64b(&saved, get_s64b(to)); } else if (saved.flags.f64b && to->flags.f64b) { set_s64b(&saved, get_s64b(to)); } /* *((int64_t *)&(to->float64_value))); } */ else if (saved.flags.u32b && to->flags.u32b) { set_u32b(&saved, get_u32b(to)); } else if (saved.flags.s32b && to->flags.s32b) { set_s32b(&saved, get_s32b(to)); } else if (saved.flags.f32b && to->flags.f32b) { set_s32b(&saved, get_s32b(to)); } /* *((int32_t *)&(to->float32_value))); } */ else if (saved.flags.u16b && to->flags.u16b) { set_u16b(&saved, get_u16b(to)); } else if (saved.flags.s16b && to->flags.s16b) { set_s16b(&saved, get_s16b(to)); } else if (saved.flags.u8b && to->flags.u8b ) { set_u8b(&saved, get_u8b(to)); } else if (saved.flags.s8b && to->flags.s8b ) { set_s8b(&saved, get_s8b(to)); } else { show_error("could not determine type to poke.\n"); return false; } /* TODO: may use /proc//mem here */ /* assume that sizeof(save.int64_value) (int64_t) is multiple of sizeof(long) */ for (i = 0; i < sizeof(saved.int64_value); i += sizeof(long)) { if (ptrace(PTRACE_POKEDATA, target, addr + i, *(long *)(((int8_t *)&saved.int64_value) + i)) == -1L) { return false; } } return detach(target); } bool read_array(pid_t target, void *addr, char *buf, int len) { if (attach(target) == false) { return false; } #if HAVE_PROCMEM unsigned nread=0; ssize_t tmpl; while (nread < len) { if ((tmpl = readregion(target, buf+nread, len-nread, (unsigned long)(addr+nread))) == -1) { /* no, continue with whatever data was read */ break; } else { /* some data was read */ nread += tmpl; } } if (nread < len) { detach(target); return false; } return detach(target); #else int i; /* here we just read long by long, this should be ok for most of time */ /* partial hit is not handled */ for(i = 0; i < len; i += sizeof(long)) { errno = 0; *((long *)(buf+i)) = ptrace(PTRACE_PEEKDATA, target, addr+i, NULL); if (EXPECT((*((long *)(buf+i)) == -1L) && (errno != 0), false)) { detach(target); return false; } } return detach(target); #endif } /* TODO: may use /proc//mem here */ bool write_array(pid_t target, void *addr, const void *data, int len) { int i,j; long peek_value; if (attach(target) == false) { return false; } for (i = 0; i + sizeof(long) < len; i += sizeof(long)) { if (ptrace(PTRACE_POKEDATA, target, addr + i, *(long *)(data + i)) == -1L) { return false; } } if (len - i > 0) /* something left (shorter than a long) */ { if (len > sizeof(long)) /* rewrite last sizeof(long) bytes of the buffer */ { if (ptrace(PTRACE_POKEDATA, target, addr + len - sizeof(long), *(long *)(data + len - sizeof(long))) == -1L) { return false; } } else /* we have to play with bits... */ { /* try all possible shifting read & write */ for(j = 0; j <= sizeof(long) - (len - i); ++j) { errno = 0; if(((peek_value = ptrace(PTRACE_PEEKDATA, target, addr - j, NULL)) == -1L) && (errno != 0)) { if (errno == EIO || errno == EFAULT) /* may try next shift */ continue; else { show_error("write_array failed.\n"); return false; } } else /* peek success */ { /* write back */ memcpy(((int8_t*)&peek_value)+j, data+i, len-i); if (ptrace(PTRACE_POKEDATA, target, addr - j, peek_value) == -1L) { show_error("write_array failed.\n"); return false; } break; } } } } return detach(target); } scanmem-0.13/TODO0000644000175000017500000000233011513304502010461 00000000000000Current ============ * ask for root privilege * error code in show_messages * option: whether to search in readonly regions * optional float rounding method, eg floor(), ceil(), round(), rint(), etc? * performance * speedhack * bytearray flag check (truncval_to_flags, checkmatches, update command for bytearray&string) Future ====== * use PT_IO on freebsd, instead of PT_READ/WRITE_D * in target_memory_info_array.c, need check return value of allocate_enough_to_reach everywhere * save state to a file, so you can apply it to a different pid. * search for values in files? (eg saved state) * macro support * read symbol table, and print its name if we have a match. * support more esoteric number formats, such as bcd, ascii, etc. * pagination * some sort of regression testing, probably using dejagnu. - test target that mmaps testfile, then dregions the rest using dejagnu - then can test searching using tests. * automatically support zero and one based values. * show log -> ring buffer of 512 debug messages, that may help on debug -> eg push("a region was removed as it appears to have been umapped"); -> show log - [xx:yy] a region.." * dont read the whole region at a time, read max 8M or something. scanmem-0.13/configure.ac0000644000175000017500000000613711553203270012274 00000000000000# $Id: configure.ac,v 1.1 2007/06/04 22:51:13 taviso Exp $ AC_INIT([scanmem], [0.13], [http://code.google.com/p/scanmem/]) AM_INIT_AUTOMAKE([-Wall -Werror foreign]) AC_CONFIG_SRCDIR([main.c]) AC_CONFIG_HEADER([config.h]) AC_GNU_SOURCE AC_HEADER_STDBOOL AC_CHECK_FUNCS(memset strcasecmp strchr strdup strerror strtoul) AC_CHECK_HEADERS(fcntl.h limits.h stddef.h sys/time.h) AC_FUNC_ALLOCA AC_FUNC_MALLOC AC_FUNC_REALLOC AC_FUNC_STRTOD AC_TYPE_INT8_T AC_TYPE_INT16_T AC_TYPE_INT32_T AC_TYPE_INT64_T AC_TYPE_UINT8_T AC_TYPE_UINT16_T AC_TYPE_UINT32_T AC_TYPE_UINT64_T AC_TYPE_OFF_T AC_TYPE_PID_T AC_TYPE_SIZE_T AC_TYPE_SSIZE_T # check if termcap is present, sometimes required by readline AC_CHECK_LIB([termcap], [tgetent], [], []) # check for libreadline AC_CHECK_LIB([readline], [readline], [], [ echo "libreadline could not be found, which is required to continue." echo "The libreadline-dev package may be required." exit 1 ]) # also need to check if the file is zero'ed (some hardened systems) AC_CHECK_FILE([/proc/self/maps], [], [ echo "This system does not seem to have /proc/pid/maps files." exit 1 ]) # also need to check this file works AC_CHECK_FILE([/proc/self/mem], [ # LARGEFILE support required for this to work AC_SYS_LARGEFILE AC_DEFINE(HAVE_PROCMEM, [1], [Enable /proc/pid/mem support]) ],[ # This will hurt performance. echo "This system does not seem to have /proc/pid/mem files." echo "Falling back to ptrace() only support." AC_DEFINE(HAVE_PROCMEM, [0], [Enable /proc/pid/mem support]) ]) # copied from ubuntu-tweak dnl AS_AC_EXPAND(VAR, CONFIGURE_VAR) dnl dnl example dnl AS_AC_EXPAND(SYSCONFDIR, $sysconfdir) dnl will set SYSCONFDIR to /usr/local/etc if prefix=/usr/local AC_DEFUN([AS_AC_EXPAND], [ EXP_VAR=[$1] FROM_VAR=[$2] dnl first expand prefix and exec_prefix if necessary prefix_save=$prefix exec_prefix_save=$exec_prefix dnl if no prefix given, then use /usr/local, the default prefix if test "x$prefix" = "xNONE"; then prefix=$ac_default_prefix fi dnl if no exec_prefix given, then use prefix if test "x$exec_prefix" = "xNONE"; then exec_prefix=$prefix fi full_var="$FROM_VAR" dnl loop until it doesn't change anymore while true; do new_full_var="`eval echo $full_var`" if test "x$new_full_var" = "x$full_var"; then break; fi full_var=$new_full_var done dnl clean up full_var=$new_full_var AC_SUBST([$1], "$full_var") dnl restore prefix and exec_prefix prefix=$prefix_save exec_prefix=$exec_prefix_save ]) # end copy AS_AC_EXPAND(PKGDATADIR, $datadir/gameconqueror) AC_CONFIG_FILES([ Makefile test/Makefile ]) AC_ARG_ENABLE(gui, [AS_HELP_STRING([--enable-gui], [enable gameconqueror, the gui front-end of scanmem])], [enable_gui=true AC_CONFIG_FILES([ gui/Makefile gui/consts.py gui/gameconqueror ])], [enable_gui=false] ) AM_CONDITIONAL([ENABLE_GUI], [test x$enable_gui = xtrue]) AC_OUTPUT scanmem-0.13/test/0000775000175000017500000000000012002431472011035 500000000000000scanmem-0.13/test/Makefile.in0000644000175000017500000002124711553203351013031 00000000000000# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 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@ VPATH = @srcdir@ 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 = : subdir = test DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(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 = SOURCES = DIST_SOURCES = DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ 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@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ OBJEXT = @OBJEXT@ 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@ PKGDATADIR = @PKGDATADIR@ POW_LIB = @POW_LIB@ 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_CC = @ac_ct_CC@ 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_alias = @build_alias@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host_alias = @host_alias@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ 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@ EXTRA_DIST = smtest.c smtest.dat config/unix.exp scanmem/dregion.exp \ scanmem/iterchar.exp scanmem/lregions.exp scanmem/popchar.exp \ scanmem/shell.exp scanmem/testrun.log scanmem/testrun.sum \ scanmem/version.exp all: all-am .SUFFIXES: $(srcdir)/Makefile.in: $(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 test/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign test/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: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): tags: TAGS TAGS: ctags: CTAGS CTAGS: 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 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: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install 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) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic 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 -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic distclean \ distclean-generic 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-generic pdf pdf-am ps ps-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: scanmem-0.13/test/Makefile.am0000644000175000017500000000035511321344112013007 00000000000000EXTRA_DIST = smtest.c smtest.dat EXTRA_DIST += config/unix.exp EXTRA_DIST += scanmem/dregion.exp scanmem/iterchar.exp scanmem/lregions.exp scanmem/popchar.exp scanmem/shell.exp scanmem/testrun.log scanmem/testrun.sum scanmem/version.exp scanmem-0.13/test/smtest.c0000644000175000017500000001310411311453215012436 00000000000000/* * * $Id: smtest.c,v 1.2 2007-04-14 18:47:39+01 taviso Exp taviso $ */ #ifndef _GNU_SOURCE # define _GNU_SOURCE #endif #include #include #include #include #include #include #include /*lint -e537 */ #include #include #include #include #include #include #define MSIZE 4096 /* list of functions where i dont want to be warned about ignored return value */ /*lint -esym(534,strftime,fflush,sleep,alarm) */ typedef enum { TYPE_CHAR, TYPE_SHORT, TYPE_FLOAT, TYPE_INT, TYPE_LONG } type_t; typedef enum { MODE_UNKNOWN, MODE_POPULATE, MODE_INDEX, MODE_SEARCH, MODE_ITER, MODE_EXIT } tmode_t; /* empty signal handler for use with pause() */ static void null(int n) { (void) n; return; } int main(int argc, char **argv) { unsigned offset = 0, value = 0xff, count = MSIZE; int fd, optindex, i = 0; type_t type = TYPE_CHAR; tmode_t mode = MODE_UNKNOWN; pid_t pid; char *end; struct option longopts[] = { {"type", 0, NULL, 't'}, {"value", 1, NULL, 'v'}, {"mode", 1, NULL, 'm'}, {"offset", 1, NULL, 'o'}, {"count", 1, NULL, 'c'}, {NULL, 0, NULL, 0}, }; union { void *region; unsigned char *region_char; unsigned short *region_short; unsigned int *region_int; unsigned long *region_long; float *region_float; } region_ptr; /* process command line */ while (true) { switch (getopt_long(argc, argv, "c:m:v:t:o:", longopts, &optindex)) { case 'm': /* mode of operation */ if (strcmp(optarg, "populate") == 0) { mode = MODE_POPULATE; } else if (strcmp(optarg, "index") == 0) { mode = MODE_INDEX; } else if (strcmp(optarg, "search") == 0) { mode = MODE_SEARCH; } else if (strcmp(optarg, "iter") == 0) { mode = MODE_ITER; } else if (strcmp(optarg, "exit") == 0) { mode = MODE_EXIT; } else { fprintf(stderr, "error: unrecognised mode %s.\n", optarg); return 1; } break; case 'o': /* offset to place into region */ offset = strtoul(optarg, &end, 0x00); if (*end != '\0' || *optarg == '\0') { fprintf(stderr, "error: unable to parse offset.\n"); return 1; } break; case 'v': /* value to use */ value = strtoul(optarg, &end, 0x00); if (*end != '\0' || *optarg == '\0') { fprintf(stderr, "error: unable to parse value.\n"); return 1; } break; case 't': if (strcmp(optarg, "char") == 0) { type = TYPE_CHAR; } else if (strcmp(optarg, "short") == 0) { type = TYPE_SHORT; } else if (strcmp(optarg, "int") == 0) { type = TYPE_INT; } else if (strcmp(optarg, "long") == 0) { type = TYPE_LONG; } else { fprintf(stderr, "error: unrecognised type.\n"); return 1; } break; case 'c': /* value to use */ count = strtoul(optarg, &end, 0x00); if (*end != '\0' || *optarg == '\0') { fprintf(stderr, "error: unable to parse count.\n"); return 1; } break; case -1: goto done; default: return 1; } } done: /* now fork() and parent exit() */ switch ((pid = fork())) { case -1: fprintf(stderr, "error: fork() failed.\n"); return 1; case 0: /* child */ break; default: fprintf(stdout, "smtest pid %u\n", pid); fflush(stdout); return 0; } /* schedule an alarm() to kill us if we're forgotten about */ alarm(600); /* catch SIGUSR1 for use with pause() */ (void) signal(SIGUSR1, null); if ((fd = open("./smtest.dat", O_RDONLY)) == -1) { fprintf(stderr, "error: couldnt open %s.\n", argv[1]); return 1; } if ((region_ptr.region = mmap(NULL, MSIZE, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0)) == MAP_FAILED) { fprintf(stderr, "error: failed to mmap.\n"); return 1; } switch (mode) { case MODE_POPULATE: while (pause()) { region_ptr.region_char[i++] = value; if (i >= count) break; } pause(); break; case MODE_ITER: pause(); region_ptr.region_char[0] = 0xff; while (pause()) { region_ptr.region_char[++i] = value; region_ptr.region_char[i-1] = 0x00; if (i > count) break; } pause(); break; case MODE_EXIT: pause(); break; case MODE_UNKNOWN: case MODE_SEARCH: case MODE_INDEX: default: break; } return 0; } scanmem-0.13/test/scanmem/0000775000175000017500000000000012002431472012460 500000000000000scanmem-0.13/test/scanmem/version.exp0000644000175000017500000000102311311453215014576 00000000000000# check the version command functions expect_after { -re "\[^\n\r\]*$prompt$" { fail "$test (bad match)" } timeout { fail "$test (timeout)" } } set test "version command" scanmem_start set subtest "correct version" send "version\n" expect { -re "scanmem version $version, .*$prompt$" { pass "$test ($subtest)" } } set subtest "unexpected arguments" send "version xyzzy\n" expect { -re "scanmem version $version, .*$prompt$" { pass "$test ($subtest)" } } scanmem_exit scanmem-0.13/test/scanmem/dregion.exp0000644000175000017500000000520011311453215014541 00000000000000# check the dregion command functions as expected expect_after { -re "\[^\n\r\]*$prompt$" { fail "$test (bad match)" } timeout { fail "$test (timeout)" } } # name the tests set test "delete regions" set subtest "default" scanmem_start # try dregion with no arguments set subtest "no argument" send "dregion\n" expect { -re "error: expected an argument.*$prompt$" { pass "$test ($subtest)" } } # try using dregion without any pid set subtest "no target" send "dregion 0\n" expect { -re "error: no target.*$prompt$" { pass "$test ($subtest)" } } # start and attach to test process smtest_start "--mode=exit" # check regions are really deleted set subtest "delete specific region" send "dregion $smregionid\n" expect { -re "error:.*$prompt$" { fail "$test ($subtest)" } -re "$prompt$" { pass "$test ($subtest)" } } set subtest "check its gone" send "lregions\n" expect { -re "\\\[\[ \]*$smregionid\\\].*$prompt$" { fail "$test ($subtest)" } -re ".*$prompt$" { pass "$test ($subtest)" } } # delete all regions, then try again set subtest "no match" send "reset\n" send "dregion 0\n" send "dregion 0\n" expect { -re "error: no region matching.*$prompt$" { pass "$test ($subtest)" } } # inverted matches set subtest "inverted match" send "reset\n" send "dregion !0\n" send "lregions\n" expect { -re "\\\[\[ \]*\[^0\]\\\].*$prompt$" { fail "$test ($subtest)" } -re "\\\[\[ \]*0\\\].*$prompt$" { pass "$test ($subtest)" } } # delete the last match set subtest "delete all" send "dregion 0\n" expect { -re ".*$prompt$" { pass "$test ($subtest)" } } # and restore them set subtest "regions restored" send "reset\n" send "lregions\n" expect { -re "\\\[\[ 0-9\]+\\\].*$prompt$" { pass "$test ($subtest)" } } # try using unexpected arguments set subtest "unexpected arguments" send "dregion xyzzy\n" expect { -re "error: could not parse.*$prompt$" { pass "$test ($subtest)" } } # try a short list # XXX: improve these tests set subtest "list" send "reset\n" send "dregion 0,1\n" expect { -re "error:.*$prompt$" { fail "$test ($subtest)" } -re ".*$prompt$" { pass "$test ($subtest)" } } # try a list that cant be parsed # what about a lone ',' #set subtest "bad list" #send "reset\n" #send "dregion !0,4,,abc,995," # all done, terminate the test process. smtest_exit scanmem_exit scanmem-0.13/test/scanmem/testrun.log0000644000175000017500000000161011311453215014604 00000000000000Test Run By taviso on Sun Dec 16 22:48:02 2007 Native configuration is i686-redhat-linux-gnu === tests === Schedule of variations: unix Running target unix Using /usr/share/dejagnu/baseboards/unix.exp as board description file for target. Using /usr/share/dejagnu/config/unix.exp as generic interface file for target. Using ./../config/unix.exp as tool-and-target-specific interface file. ERROR: tcl error sourcing tool-and-target-specific interface file ./../config/unix.exp. couldn't execute "../scanmem": permission denied couldn't execute "../scanmem": permission denied while executing "exec $program --version" (procedure "scanmem_version" line 5) invoked from within "scanmem_version" (file "./../config/unix.exp" line 150) invoked from within "source ./../config/unix.exp" ("uplevel" body line 1) invoked from within "uplevel #0 source ./../config/unix.exp" scanmem-0.13/test/scanmem/lregions.exp0000644000175000017500000000253511311453215014744 00000000000000# check the lregions command functions as expected expect_after { -re "\[^\n\r\]*$prompt$" { fail "$test (bad match)" } timeout { fail "$test ($subtest) (timeout)" } } # name the tests set test "list regions" set subtest "defailt" scanmem_start # try using lregions without any pid set subtest "no target" send "lregions\n" expect { -re "error: no target.*$prompt$" { pass "$test ($subtest)" } } # start and attach to test process smtest_start "--mode=exit" # check regions are listed set subtest "regions listed" send "lregions\n" expect { -re "\\\[\[ 0-9\]+\\\].*$prompt$" { pass "$test ($subtest)" } } # delete all regions, then try again set subtest "no regions left" send "dregion !0\n" send "dregion 0\n" send "lregions\n" expect { -re "info: no regions.*$prompt$" { pass "$test ($subtest)" } } # and restore them set subtest "regions restored" send "reset\n" send "lregions\n" expect { -re "\\\[\[ 0-9\]+\\\].*$prompt$" { pass "$test ($subtest)" } } # try using unexpected arguments set subtest "unexpected arguments" send "lregions xyzzy\n" expect { -re "\\\[\[ 0-9\]+\\\].*$prompt$" { pass "$test ($subtest)" } } # all done, terminate the test process. smtest_exit scanmem_exit scanmem-0.13/test/scanmem/iterchar.exp0000644000175000017500000000310011311453215014710 00000000000000# check searching for a character at various offsets expect_after { -re "\[^\n\r\]*$prompt$" { fail "$test (bad match)" } timeout { fail "$test ($subtest) (timeout)" } } # name the tests set test "character at various offsets" set subtest "default" scanmem_start # start and attach to test process smtest_start "--mode=iter --value=0xff --count=$smiter" # delete all other regions set subtest "delete irrelevant regions" send "dregion !$smregionid\n" send "lregions\n" expect { -re "\\\[\[ 0-9\]+\\\]\[^\n\]*$smtestdat\[^\n\]*\n$prompt$" { pass "$test ($subtest)" } } # search for 0x0, there should be $smregionsize matches set subtest "match everything" send "0x00\n" expect { -re "info: we currently have $smregionsize matches.*$prompt$" { pass "$test ($subtest)" } } # now run all tests, signalling smtest when ready set subtest "test $smiter variations" for {set i 0} {$i < $smiter} {incr i} { # tell the test program to place another 0xff smtest_sigusr send "reset\n" send "dregion !$smregionid\n" send "0xff\n" expect { -re "info: we currently have (\[0-9\]+) matches.*$prompt$" { if {$expect_out(1,string) != 1} { fail "$test ($subtest)" break } } } } # check that worked if {$i == $smiter} { pass "$test ($subtest)" } # all done, terminate the test process. smtest_exit scanmem_exit scanmem-0.13/test/scanmem/testrun.sum0000644000175000017500000000024611311453215014633 00000000000000Test Run By taviso on Sun Dec 16 22:48:02 2007 Native configuration is i686-redhat-linux-gnu === tests === Schedule of variations: unix Running target unix scanmem-0.13/test/scanmem/popchar.exp0000644000175000017500000000310511311453215014550 00000000000000# name the tests set test "populate with characters" set subtest "default" # check searching for a character at various offsets expect_after { -re "\[^\n\r\]*$prompt$" { fail "$test (bad match)" } timeout { fail "$test ($subtest) (timeout)" } } scanmem_start # start and attach to test process smtest_start "--mode=populate --value=0xff --count=$smiter" # delete all other regions set subtest "delete irrelevant regions" send "dregion !$smregionid\n" send "lregions\n" expect { -re "\\\[\[ 0-9\]+\\\]\[^\n\]*$smtestdat\[^\n\]*\n$prompt$" { pass "$test ($subtest)" } } # search for 0x0, there should be $smregionsize matches set subtest "match everything" send "0x00\n" expect { -re "info: we currently have $smregionsize matches.*$prompt$" { pass "$test ($subtest)" } } # now run all tests, signalling smtest when ready set subtest "test $smiter variations" for {set i 0} {$i < $smiter} {incr i} { # tell the test program to place another 0xff smtest_sigusr send "reset\n" send "dregion !$smregionid\n" send "0xff\n" expect { -re "info: we currently have (\[0-9\]+) matches.*$prompt$" { if {$expect_out(1,string) != $i + 1} { fail "$test ($subtest)" break } } } } # check that worked if {$i == $smiter} { pass "$test ($subtest)" } # all done, terminate the test process. smtest_exit scanmem_exit scanmem-0.13/test/scanmem/shell.exp0000644000175000017500000000126011311453215014223 00000000000000# check the shell command functions expect_after { -re "\[^\n\r\]*$prompt$" { fail "$test (bad match)" } timeout { fail "$test (timeout)" } } set test "shell command" scanmem_start set subtest "simple command" send "shell echo xyzzy\n" expect { -re "xyzzy.*$prompt$" { pass "$test ($subtest)" } } set subtest "no arguments" send "shell\n" expect { -re "error:.*$prompt$" { pass "$test ($subtest)" } } set subtest "unknown command" send "shell __no_such_command__\n" expect { -re ".*: __no_such_command__: command not found.*$prompt$" { pass "$test ($subtest)" } } scanmem_exit scanmem-0.13/test/smtest.dat0000644000175000017500000000010011311453215012754 00000000000000scanmem-0.13/test/config/0000775000175000017500000000000012002431472012302 500000000000000scanmem-0.13/test/config/unix.exp0000644000175000017500000000610211311453215013721 00000000000000 # set the default test timeout set timeout 3 # set target binaries set program "../scanmem" set smtest "./smtest" set smtestdat "./smtest.dat" set smpid -1 set smregionid -1 set smregionsize -1 # iterations for iterative tests set smiter 64 # set the default scanmem prompt set prompt "\[0-9\]+> " # default test name set test "unknown" set subtest "unknown" proc scanmem_exit {} { send "exit\n" } proc scanmem_version {} { global program global prompt global version set tmp [exec $program --version] regexp "^scanmem version (.*), Copyright.*$" $tmp tmp version } proc scanmem_start {} { global prompt global program global spawn_id global test global subtest #spawn valgrind --error-exitcode=2 --quiet $program spawn $program expect { -re "$prompt$" { } timeout { perror "timeout waiting for prompt"; exit 1 } } } proc smtest_start {smtestargs} { global smregionsize global smregionid global smtestdat global smpid global smtest global prompt global test # start the smtest process send "shell $smtest $smtestargs\n" expect { # wait for the process to report its pid and fork() -re "smtest pid (\[0-9\]*).*$prompt$" { set smpid "$expect_out(1,string)" pass "$test (start test process)" } # process prints error -re "error:.*$prompt$" { perror "$test (start test process failed)" exit 1 } } # attach to smtest scanmem_attach $smpid # find the regionid and size of the test region send "lregions\n" expect { -re "\\\[\[ \]*(\[0-9\]+)\\\]\[^\n\]+,\[ \]*(\[0-9\]+) bytes,\[^\n\]+$smtestdat.*$prompt$" { set smregionid "$expect_out(1,string)" set smregionsize "$expect_out(2,string)" pass "$test (find test region)" } } } proc smtest_sigusr {} { global smpid global test global subtest # check this is valid if {$smpid == -1} { perror "$test (signal test process)" exit 1 } # okay, send the sig send "shell kill -USR1 $smpid\n" send "shell sleep 0.1\n" } proc smtest_exit {} { global prompt global smpid global test global subtest # check theres a valid pid if {$smpid == -1} { perror "$test (terminate test process)" exit 1 } # terminate it send "shell kill $smpid\n" expect { -re "kill:.*No such process.*$prompt$" { perror "$test (terminate test process)" exit 1 } -re "$prompt$" { pass "$test (terminate test process)" } } } proc scanmem_attach {pid} { global test global prompt send "pid $pid\n" send "pid\n" expect { -re "info: target pid is $pid.*$prompt$" { pass "$test (attach to process)" } # process prints error -re "error:.*$prompt$" { perror "$test (attach to process failed)" exit 1 } } } # set the version scanmem_version scanmem-0.13/handlers.c0000644000175000017500000013634611734005704011763 00000000000000/* $Id: handlers.c,v 1.12 2007-06-05 01:45:34+01 taviso Exp taviso $ Copyright (C) 2006,2007,2009 Tavis Ormandy Copyright (C) 2009 Eli Dupree Copyright (C) 2009,2010 WANG Lu 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 */ #ifndef _GNU_SOURCE # define _GNU_SOURCE #endif #include "config.h" #include #include #include #include #include #include #include #include #include #include /*lint -esym(526,strcasecmp) */ #include #include #include #include #include /* to determine the word width */ #include #include #include #include "commands.h" #include "handlers.h" #include "interrupt.h" #include "show_message.h" #define USEPARAMS() ((void) vars, (void) argv, (void) argc) /* macro to hide gcc unused warnings */ /*lint -esym(818, vars, argv) dont want want to declare these as const */ /* * This file defines all the command handlers used, each one is registered using * registercommand(), and when a matching command is entered, the commandline is * tokenized and parsed into an argv/argc. * * argv[0] will contain the command entered, so one handler can handle multiple * commands by checking whats in there, but you still need seperate documentation * for each command when you register it. * * Most commands will also need some documentation, see handlers.h for the format. * * Commands are allowed to read and modify settings in the vars structure. * */ #define calloca(x,y) (memset(alloca((x) * (y)), 0x00, (x) * (y))) bool handler__set(globals_t * vars, char **argv, unsigned argc) { unsigned block, seconds = 1; char *delay = NULL; char *end; bool cont = false; struct setting { char *matchids; char *value; unsigned seconds; } *settings = NULL; assert(argc != 0); assert(argv != NULL); assert(vars != NULL); if (argc < 2) { show_error("expected an argument, type `help set` for details.\n"); return false; } /* supporting `set` for bytearray will cause annoying syntax problems... */ if ((vars->options.scan_data_type == BYTEARRAY) ||(vars->options.scan_data_type == STRING)) { show_error("`set` is not supported for bytearray or string, use `write` instead.\n"); return false; } /* check if there are any matches */ if (vars->num_matches == 0) { show_error("no matches are known.\n"); return false; } /* --- parse arguments into settings structs --- */ settings = calloca(argc - 1, sizeof(struct setting)); /* parse every block into a settings struct */ for (block = 0; block < argc - 1; block++) { /* first seperate the block into matches and value, which are separated by '=' */ if ((settings[block].value = strchr(argv[block + 1], '=')) == NULL) { /* no '=' found, whole string must be the value */ settings[block].value = argv[block + 1]; } else { /* there is a '=', value+1 points to value string. */ /* use strndupa() to copy the matchids into a new buffer */ settings[block].matchids = strndupa(argv[block + 1], (size_t) (settings[block].value++ - argv[block + 1])); } /* value points to the value string, possibly with a delay suffix */ /* matchids points to the match-ids (possibly multiple) or NULL */ /* now check for a delay suffix (meaning continuous mode), eg 0xff/10 */ if ((delay = strchr(settings[block].value, '/')) != NULL) { char *end = NULL; /* parse delay count */ settings[block].seconds = strtoul(delay + 1, &end, 10); if (*(delay + 1) == '\0') { /* empty delay count, eg: 12=32/ */ show_error("you specified an empty delay count, `%s`, see `help set`.\n", settings[block].value); return false; } else if (*end != '\0') { /* parse failed before end, probably trailing garbage, eg 34=9/16foo */ show_error("trailing garbage after delay count, `%s`.\n", settings[block].value); return false; } else if (settings[block].seconds == 0) { /* 10=24/0 disables continous mode */ show_info("you specified a zero delay, disabling continuous mode.\n"); } else { /* valid delay count seen and understood */ show_info("setting %s every %u seconds until interrupted...\n", settings[block].matchids ? settings[block]. matchids : "all", settings[block].seconds); /* continuous mode on */ cont = true; } /* remove any delay suffix from the value */ settings[block].value = strndupa(settings[block].value, (size_t) (delay - settings[block].value)); } /* if (strchr('/')) */ } /* for(block...) */ /* --- setup a longjmp to handle interrupt --- */ if (INTERRUPTABLE()) { /* control returns here when interrupted */ free(settings); detach(vars->target); ENDINTERRUPTABLE(); return true; } /* --- execute the parsed setting structs --- */ while (true) { uservalue_t userval; /* for every settings struct */ for (block = 0; block < argc - 1; block++) { /* check if this block has anything to do this iteration */ if (seconds != 1) { /* not the first iteration (all blocks get executed first iteration) */ /* if settings.seconds is zero, then this block is only executed once */ /* if seconds % settings.seconds is zero, then this block must be executed */ if (settings[block].seconds == 0 || (seconds % settings[block].seconds) != 0) continue; } /* convert value */ if (!parse_uservalue_number(settings[block].value, &userval)) { show_error("bad number `%s` provided\n", settings[block].value); goto fail; } /* check if specific match(s) were specified */ if (settings[block].matchids != NULL) { char *id, *lmatches = NULL; unsigned num = 0; /* create local copy of the matchids for strtok() to modify */ lmatches = strdupa(settings[block].matchids); /* now seperate each match, spearated by commas */ while ((id = strtok(lmatches, ",")) != NULL) { match_location loc; /* set to NULL for strtok() */ lmatches = NULL; /* parse this id */ num = strtoul(id, &end, 0x00); /* check that succeeded */ if (*id == '\0' || *end != '\0') { show_error("could not parse match id `%s`\n", id); goto fail; } /* check this is a valid match-id */ loc = nth_match(vars->matches, num); if (loc.swath) { value_t v; value_t old; void *address = remote_address_of_nth_element(loc.swath, loc.index /* ,MATCHES_AND_VALUES */); /* copy val onto v */ /* XXX: valcmp? make sure the sizes match */ old = data_to_val(loc.swath, loc.index /* ,MATCHES_AND_VALUES */); v.flags = old.flags = loc.swath->data[loc.index].match_info; uservalue2value(&v, &userval); show_info("setting *%p to %#"PRIx64"...\n", address, v.int64_value); /* set the value specified */ if (setaddr(vars->target, address, &v) == false) { show_error("failed to set a value.\n"); goto fail; } } else { /* match-id > than number of matches */ show_error("found an invalid match-id `%s`\n", id); goto fail; } } } else { matches_and_old_values_swath *reading_swath_index = (matches_and_old_values_swath *)vars->matches->swaths; int reading_iterator = 0; /* user wants to set all matches */ while (reading_swath_index->first_byte_in_child) { /* Only actual matches are considered */ if (flags_to_max_width_in_bytes(reading_swath_index->data[reading_iterator].match_info) > 0) { void *address = remote_address_of_nth_element(reading_swath_index, reading_iterator /* ,MATCHES_AND_VALUES */); /* XXX: as above : make sure the sizes match */ value_t old = data_to_val(reading_swath_index, reading_iterator /* ,MATCHES_AND_VALUES */); value_t v; v.flags = old.flags = reading_swath_index->data[reading_iterator].match_info; uservalue2value(&v, &userval); show_info("setting *%p to %"PRIx64"...\n", address, v.int64_value); if (setaddr(vars->target, address, &v) == false) { show_error("failed to set a value.\n"); goto fail; } } /* Go on to the next one... */ ++reading_iterator; if (reading_iterator >= reading_swath_index->number_of_bytes) { reading_swath_index = local_address_beyond_last_element(reading_swath_index /* ,MATCHES_AND_VALUES */); reading_iterator = 0; } } } /* if (matchid != NULL) else ... */ } /* for(block) */ if (cont) { sleep(1); } else { break; } seconds++; } /* while(true) */ ENDINTERRUPTABLE(); return true; fail: ENDINTERRUPTABLE(); return false; } /* XXX: add yesno command to check if matches > 099999 */ /* FORMAT (don't change, front-end depends on this): * [#no] addr, value, [possible types (separated by space)] */ bool handler__list(globals_t * vars, char **argv, unsigned argc) { unsigned i = 0; int buf_len = 128; /* will be realloc later if necessary */ char *v = malloc(buf_len); if (v == NULL) { show_error("memory allocation failed.\n"); return false; } char *bytearray_suffix = ", [bytearray]"; char *string_suffix = ", [string]"; USEPARAMS(); if(!(vars->matches)) return true; matches_and_old_values_swath *reading_swath_index = (matches_and_old_values_swath *)vars->matches->swaths; int reading_iterator = 0; /* list all known matches */ while (reading_swath_index->first_byte_in_child) { match_flags flags = reading_swath_index->data[reading_iterator].match_info; /* Only actual matches are considered */ if (flags_to_max_width_in_bytes(flags) > 0) { switch(globals.options.scan_data_type) { case BYTEARRAY: ; /* cheat gcc */ buf_len = flags.bytearray_length * 3 + 32; v = realloc(v, buf_len); /* for each byte and the suffix', this should be enough */ if (v == NULL) { show_error("memory allocation failed.\n"); return false; } data_to_bytearray_text(v, buf_len, reading_swath_index, reading_iterator, flags.bytearray_length); assert(strlen(v) + strlen(bytearray_suffix) + 1 <= buf_len); /* or maybe realloc is better? */ strcat(v, bytearray_suffix); break; case STRING: ; /* cheat gcc */ buf_len = flags.string_length + strlen(string_suffix) + 32; /* for the string and suffix, this should be enough */ v = realloc(v, buf_len); if (v == NULL) { show_error("memory allocation failed.\n"); return false; } data_to_printable_string(v, buf_len, reading_swath_index, reading_iterator, flags.string_length); assert(strlen(v) + strlen(string_suffix) + 1 <= buf_len); /* or maybe realloc is better? */ strcat(v, string_suffix); break; default: /* numbers */ ; /* cheat gcc */ value_t val = data_to_val(reading_swath_index, reading_iterator /* ,MATCHES_AND_VALUES */); truncval_to_flags(&val, flags); if (valtostr(&val, v, buf_len) != true) { strncpy(v, "unknown", buf_len); } break; } /* try to determine the size of a pointer */ #if ULONGMAX == 4294967295UL #define POINTER_FMT "%10p" #elif ULONGMAX == 18446744073709551615UL #define POINTER_FMT "%20p" #else #define POINTER_FMT "%20p" #endif fprintf(stdout, "[%2u] "POINTER_FMT", %s\n", i++, remote_address_of_nth_element(reading_swath_index, reading_iterator /* ,MATCHES_AND_VALUES */), v); } /* Go on to the next one... */ ++reading_iterator; if (reading_iterator >= reading_swath_index->number_of_bytes) { assert(((matches_and_old_values_swath *)(local_address_beyond_last_element(reading_swath_index /* ,MATCHES_AND_VALUES */)))->number_of_bytes >= 0); reading_swath_index = local_address_beyond_last_element(reading_swath_index /* ,MATCHES_AND_VALUES */); reading_iterator = 0; } } free(v); return true; } /* XXX: handle multiple deletes, eg delete !1 2 3 4 5 6 */ bool handler__delete(globals_t * vars, char **argv, unsigned argc) { unsigned id; char *end = NULL; match_location loc; if (argc != 2) { show_error("was expecting one argument, see `help delete`.\n"); return false; } /* parse argument */ id = strtoul(argv[1], &end, 0x00); /* check that strtoul() worked */ if (argv[1][0] == '\0' || *end != '\0') { show_error("sorry, couldnt parse `%s`, try `help delete`\n", argv[1]); return false; } loc = nth_match(vars->matches, id); if (loc.swath) { /* It is not convenient to check whether anything else relies on this, so just mark it as not a REAL match */ memset(&(loc.swath->data[loc.index].match_info), 0, sizeof(match_flags)); return true; } else { /* I guess this is not a valid match-id */ show_warn("you specified a non-existant match `%u`.\n", id); show_info("use \"list\" to list matches, or \"help\" for other commands.\n"); return false; } } bool handler__reset(globals_t * vars, char **argv, unsigned argc) { USEPARAMS(); if (vars->matches) { free(vars->matches); vars->matches = NULL; vars->num_matches = 0; } /* refresh list of regions */ l_destroy(vars->regions); /* create a new linked list of regions */ if ((vars->regions = l_init()) == NULL) { show_error("sorry, there was a problem allocating memory.\n"); return false; } /* read in maps if a pid is known */ if (vars->target && readmaps(vars->target, vars->regions) != true) { show_error("sorry, there was a problem getting a list of regions to search.\n"); show_warn("the pid may be invalid, or you don't have permission.\n"); vars->target = 0; return false; } return true; } bool handler__pid(globals_t * vars, char **argv, unsigned argc) { char *resetargv[] = { "reset", NULL }; char *end = NULL; if (argc == 2) { vars->target = (pid_t) strtoul(argv[1], &end, 0x00); if (vars->target == 0) { show_error("`%s` does not look like a valid pid.\n", argv[1]); return false; } } else if (vars->target) { /* print the pid of the target program */ show_info("target pid is %u.\n", vars->target); return true; } else { show_info("no target is currently set.\n"); return false; } return handler__reset(vars, resetargv, 1); } bool handler__snapshot(globals_t * vars, char **argv, unsigned argc) { USEPARAMS(); /* check that a pid has been specified */ if (vars->target == 0) { show_error("no target set, type `help pid`.\n"); return false; } /* remove any existing matches */ if (vars->matches) { free(vars->matches); vars->matches = NULL; vars->num_matches = 0; } if (searchregions(vars, MATCHANY, NULL) != true) { show_error("failed to save target address space.\n"); return false; } return true; } /* dregion [!][x][,x,...] */ bool handler__dregion(globals_t * vars, char **argv, unsigned argc) { unsigned id; bool invert = false; char *end = NULL, *idstr = NULL, *block = NULL; element_t *np, *pp; list_t *keep = NULL; region_t *save; /* need an argument */ if (argc < 2) { show_error("expected an argument, see `help dregion`.\n"); return false; } /* check that there is a process known */ if (vars->target == 0) { show_error("no target specified, see `help pid`\n"); return false; } /* check for an inverted match */ if (*argv[1] == '!') { invert = true; /* create a copy of the argument for strtok(), +1 to skip '!' */ block = strdupa(argv[1] + 1); /* check for lone '!' */ if (*block == '\0') { show_error("inverting an empty set, maybe try `reset` instead?\n"); return false; } /* create a list to keep the specified regions */ if ((keep = l_init()) == NULL) { show_error("memory allocation error.\n"); return false; } } else { invert = false; block = strdupa(argv[1]); } /* loop for every number specified, eg "1,2,3,4,5" */ while ((idstr = strtok(block, ",")) != NULL) { region_t *r = NULL; /* set block to NULL for strtok() */ block = NULL; /* attempt to parse as a regionid */ id = strtoul(idstr, &end, 0x00); /* check that worked, "1,abc,4,,5,6foo" */ if (*end != '\0' || *idstr == '\0') { show_error("could not parse argument %s.\n", idstr); if (invert) { if (l_concat(vars->regions, &keep) == -1) { show_error("there was a problem restoring saved regions.\n"); l_destroy(vars->regions); l_destroy(keep); return false; } } assert(keep == NULL); return false; } /* initialise list pointers */ np = vars->regions->head; pp = NULL; /* find the correct region node */ while (np) { r = np->data; /* compare the node id to the id the user specified */ if (r->id == id) break; pp = np; /* keep track of prev for l_remove() */ np = np->next; } /* check if a match was found */ if (np == NULL) { show_error("no region matching %u, or already moved.\n", id); if (invert) { if (l_concat(vars->regions, &keep) == -1) { show_error("there was a problem restoring saved regions.\n"); l_destroy(vars->regions); l_destroy(keep); return false; } } if (keep) l_destroy(keep); return false; } np = pp; /* save this region if the match is inverted */ if (invert) { assert(keep != NULL); l_remove(vars->regions, np, (void *) &save); if (l_append(keep, keep->tail, save) == -1) { show_error("sorry, there was an internal memory error.\n"); free(save); return false; } continue; } /* check for any affected matches before removing it */ if(vars->num_matches > 0) { region_t *s; /* determine the correct pointer we're supposed to be checking */ if (np) { assert(np->next); s = np->next->data; } else { /* head of list */ s = vars->regions->head->data; } if (!(vars->matches = delete_by_region(vars->matches, &vars->num_matches, s, false))) { show_error("memory allocation error while deleting matches\n"); } } l_remove(vars->regions, np, NULL); } if (invert) { region_t *s = keep->head->data; if (vars->num_matches > 0) { if (!(vars->matches = delete_by_region(vars->matches, &vars->num_matches, s, true))) { show_error("memory allocation error while deleting matches\n"); } } /* okay, done with the regions list */ l_destroy(vars->regions); /* and switch to the keep list */ vars->regions = keep; } return true; } bool handler__lregions(globals_t * vars, char **argv, unsigned argc) { element_t *np = vars->regions->head; USEPARAMS(); if (vars->target == 0) { show_error("no target has been specified, see `help pid`.\n"); return false; } if (vars->regions->size == 0) { show_info("no regions are known.\n"); } /* print a list of regions that are searched */ while (np) { region_t *region = np->data; fprintf(stderr, "[%2u] %#10lx, %7lu bytes, %c%c%c, %s\n", region->id, (unsigned long)region->start, region->size, region->flags.read ? 'r' : '-', region->flags.write ? 'w' : '-', region->flags.exec ? 'x' : '-', region->filename[0] ? region->filename : "unassociated"); np = np->next; } return true; } /* the name of the function is for history reason, now GREATERTHAN & LESSTHAN are also handled by this function */ bool handler__decinc(globals_t * vars, char **argv, unsigned argc) { uservalue_t val; scan_match_type_t m; USEPARAMS(); if(argc == 1) { memset(&val, 0x00, sizeof(val)); } else if (argc > 2) { show_error("too many values specified, see `help %s`", argv[0]); return false; } else { if (!parse_uservalue_number(argv[1], &val)) { show_error("bad value specified, see `help %s`", argv[0]); return false; } } if (strcmp(argv[0], "=") == 0) { m = MATCHNOTCHANGED; } else if (strcmp(argv[0], "!=") == 0) { m = (argc == 1) ? MATCHCHANGED : MATCHNOTEQUALTO; } else if (strcmp(argv[0], "<") == 0) { m = (argc == 1) ? MATCHDECREASED : MATCHLESSTHAN; } else if (strcmp(argv[0], ">") == 0) { m = (argc == 1) ? MATCHINCREASED : MATCHGREATERTHAN; } else if (strcmp(argv[0], "+") == 0) { m = (argc == 1) ? MATCHINCREASED : MATCHINCREASEDBY; } else if (strcmp(argv[0], "-") == 0) { m = (argc == 1) ? MATCHDECREASED : MATCHDECREASEDBY; } else { show_error("unrecogised match type seen at decinc handler.\n"); return false; } if (vars->matches) { if (checkmatches(vars, m, &val) == false) { show_error("failed to search target address space.\n"); return false; } } else { /* < > = != cannot be the initial scan */ if (argc == 1) { show_error("cannot use that search without matches\n"); return false; } else { if (searchregions(vars, m, &val) != true) { show_error("failed to search target address space.\n"); return false; } } } if (vars->num_matches == 1) { show_info("match identified, use \"set\" to modify value.\n"); show_info("enter \"help\" for other commands.\n"); } return true; } bool handler__version(globals_t * vars, char **argv, unsigned argc) { USEPARAMS(); printversion(stderr); return true; } bool handler__string(globals_t * vars, char **argv, unsigned argc) { /* test scan_data_type */ if (vars->options.scan_data_type != STRING) { show_error("scan_data_type is not string, see `help option`.\n"); return false; } /* test the length */ int i; for(i = 0; (i < 3) && vars->current_cmdline[i]; ++i) {} if (i != 3) /* cmdline too short */ { show_error("please specify a string\n"); return false; } /* the string being scanned */ uservalue_t val; val.string_value = vars->current_cmdline+2; val.flags.string_length = strlen(val.string_value); /* need a pid for the rest of this to work */ if (vars->target == 0) { return false; } /* user has specified an exact value of the variable to find */ if (vars->matches) { /* already know some matches */ if (checkmatches(vars, MATCHEQUALTO, &val) != true) { show_error("failed to search target address space.\n"); return false; } } else { /* initial search */ if (searchregions(vars, MATCHEQUALTO, &val) != true) { show_error("failed to search target address space.\n"); return false; } } /* check if we now know the only possible candidate */ if (vars->num_matches == 1) { show_info("match identified, use \"set\" to modify value.\n"); show_info("enter \"help\" for other commands.\n"); } return true; } bool handler__default(globals_t * vars, char **argv, unsigned argc) { uservalue_t val; bool ret; bytearray_element_t *array = NULL; USEPARAMS(); switch(vars->options.scan_data_type) { case ANYNUMBER: case ANYINTEGER: case ANYFLOAT: case INTEGER8: case INTEGER16: case INTEGER32: case INTEGER64: case FLOAT32: case FLOAT64: /* attempt to parse command as a number */ if (argc != 1) { show_error("unknown command\n"); ret = false; goto retl; } if (!parse_uservalue_number(argv[0], &val)) { show_error("unable to parse command `%s`\n", argv[0]); ret = false; goto retl; } break; case BYTEARRAY: /* attempt to parse command as a bytearray */ array = calloc(argc, sizeof(bytearray_element_t)); if (array == NULL) { show_error("there's a memory allocation error.\n"); ret = false; goto retl; } if (!parse_uservalue_bytearray(argv, argc, array, &val)) { show_error("unable to parse command `%s`\n", argv[0]); ret = false; goto retl; } break; case STRING: show_error("unable to parse command `%s`\nIf you want to scan for a string, use command `\"`.\n", argv[0]); ret = false; goto retl; break; default: assert(false); break; } /* need a pid for the rest of this to work */ if (vars->target == 0) { ret = false; goto retl; } /* user has specified an exact value of the variable to find */ if (vars->matches) { /* already know some matches */ if (checkmatches(vars, MATCHEQUALTO, &val) != true) { show_error("failed to search target address space.\n"); ret = false; goto retl; } } else { /* initial search */ if (searchregions(vars, MATCHEQUALTO, &val) != true) { show_error("failed to search target address space.\n"); ret = false; goto retl; } } /* check if we now know the only possible candidate */ if (vars->num_matches == 1) { show_info("match identified, use \"set\" to modify value.\n"); show_info("enter \"help\" for other commands.\n"); } ret = true; retl: if (array) free(array); return ret; } bool handler__update(globals_t * vars, char **argv, unsigned argc) { USEPARAMS(); if (vars->matches) { if (checkmatches(vars, MATCHANY, NULL) == false) { show_error("failed to scan target address space.\n"); return false; } } else { show_error("cannot use that command without matches\n"); return false; } return true; } bool handler__exit(globals_t * vars, char **argv, unsigned argc) { USEPARAMS(); vars->exit = 1; return true; } #define DOC_COLUMN 11 /* which column descriptions start on with help command */ bool handler__help(globals_t * vars, char **argv, unsigned argc) { bool ret = false; list_t *commands = vars->commands; element_t *np = NULL; command_t *def = NULL; assert(commands != NULL); assert(argc >= 1); np = commands->head; /* pager support, dirty ugly hardcoded */ FILE *outfd = popen("more", "w"); if (outfd == NULL) { show_warn("Cannot execute pager, fall back to normal output\n"); outfd = stderr; } /* print version information for generic help */ if (argv[1] == NULL) printversion(outfd); /* traverse the commands list, printing out the relevant documentation */ while (np) { command_t *command = np->data; /* remember the default command */ if (command->command == NULL) def = command; /* just `help` with no argument */ if (argv[1] == NULL) { /* NULL shortdoc means dont print in help listing */ if (command->shortdoc == NULL) { np = np->next; continue; } /* print out command name */ fprintf(outfd, "%-*s%s\n", DOC_COLUMN, command->command ? command->command : "default", command->shortdoc); /* detailed information requested about specific command */ } else if (command->command && strcasecmp(argv[1], command->command) == 0) { fprintf(outfd, "%s\n", command->longdoc ? command-> longdoc : "missing documentation"); ret = true; goto retl; } np = np->next; } if (argc > 1) { show_error("unknown command `%s`\n", argv[1]); ret = false; } else if (def) { fprintf(outfd, "\n%s\n", def->longdoc ? def->longdoc : ""); ret = true; } ret = true; retl: if (outfd != stderr) pclose(outfd); return ret; } bool handler__eof(globals_t * vars, char **argv, unsigned argc) { show_user("exit\n"); return handler__exit(vars, argv, argc); } /* XXX: handle !ls style escapes */ bool handler__shell(globals_t * vars, char **argv, unsigned argc) { size_t len = argc; unsigned i; char *command; USEPARAMS(); if (argc < 2) { show_error("shell command requires an argument, see `help shell`.\n"); return false; } /* convert arg vector into single string, first calculate length */ for (i = 1; i < argc; i++) len += strlen(argv[i]); /* allocate space */ command = calloca(len, 1); /* concatenate strings */ for (i = 1; i < argc; i++) { strcat(command, argv[i]); strcat(command, " "); } /* finally execute command */ if (system(command) == -1) { free(command); show_error("system() failed, command was not executed.\n"); return false; } free(command); return true; } bool handler__watch(globals_t * vars, char **argv, unsigned argc) { value_t o, n; unsigned id; char *end = NULL, buf[128], timestamp[64]; time_t t; match_location loc; value_t old_val; void *address; if (argc != 2) { show_error("was expecting one argument, see `help watch`.\n"); return false; } /* parse argument */ id = strtoul(argv[1], &end, 0x00); /* check that strtoul() worked */ if (argv[1][0] == '\0' || *end != '\0') { show_error("sorry, couldn't parse `%s`, try `help watch`\n", argv[1]); return false; } loc = nth_match(vars->matches, id); /* check this is a valid match-id */ if (!loc.swath) { show_error("you specified a non-existent match `%u`.\n", id); show_info("use \"list\" to list matches, or \"help\" for other commands.\n"); return false; } address = remote_address_of_nth_element(loc.swath, loc.index /* ,MATCHES_AND_VALUES */); old_val = data_to_val(loc.swath, loc.index /* ,MATCHES_AND_VALUES */); valcpy(&o, &old_val); valcpy(&n, &o); if (valtostr(&o, buf, sizeof(buf)) == false) { strncpy(buf, "unknown", sizeof(buf)); } if (INTERRUPTABLE()) { (void) detach(vars->target); ENDINTERRUPTABLE(); return true; } /* every entry is timestamped */ t = time(NULL); strftime(timestamp, sizeof(timestamp), "[%T]", localtime(&t)); show_info("%s monitoring %10p for changes until interrupted...\n", timestamp, address); while (true) { if (attach(vars->target) == false) return false; if (peekdata(vars->target, address, &n) == false) return false; truncval(&n, &old_val); /* check if the new value is different */ match_flags tmpflags; memset(&tmpflags, 0x00, sizeof(tmpflags)); scan_routine_t valuecmp_routine = (get_scanroutine(ANYNUMBER, MATCHCHANGED)); if (valuecmp_routine(&o, &n, NULL, &tmpflags, address)) { valcpy(&o, &n); truncval(&o, &old_val); if (valtostr(&o, buf, sizeof(buf)) == false) { strncpy(buf, "unknown", sizeof(buf)); } /* fetch new timestamp */ t = time(NULL); strftime(timestamp, sizeof(timestamp), "[%T]", localtime(&t)); show_info("%s %10p -> %s\n", timestamp, address, buf); } /* detach after valuecmp_routine, since it may read more data (e.g. bytearray) */ detach(vars->target); (void) sleep(1); } } #include "licence.h" bool handler__show(globals_t * vars, char **argv, unsigned argc) { USEPARAMS(); if (argv[1] == NULL) { show_error("expecting an argument.\n"); return false; } if (strcmp(argv[1], "copying") == 0) show_user(SM_COPYING); else if (strcmp(argv[1], "warranty") == 0) show_user(SM_WARRANTY); else if (strcmp(argv[1], "version") == 0) printversion(stderr); else { show_error("unrecognized show command `%s`\n", argv[1]); return false; } return true; } bool handler__dump(globals_t * vars, char **argv, unsigned argc) { void *addr; char *endptr; char *buf = NULL; int len; bool dump_to_file = false; FILE *dump_f = NULL; if (argc < 3 || argc > 4) { show_error("bad argument, see `help dump`.\n"); return false; } /* check address */ errno = 0; addr = (void *)(strtoll(argv[1], &endptr, 16)); if ((errno != 0) || (*endptr != '\0')) { show_error("bad address, see `help dump`.\n"); return false; } /* check length */ errno = 0; len = strtoll(argv[2], &endptr, 0); if ((errno != 0) || (*endptr != '\0')) { show_error("bad length, see `help dump`.\n"); return false; } /* check filename */ if (argc == 4) { if((dump_f = fopen(argv[3], "wb")) == NULL) { show_error("failed to open file\n"); return false; } dump_to_file = true; } buf = malloc(len + sizeof(long)); if (buf == NULL) { show_error("memory allocation failed.\n"); return false; } if (!read_array(vars->target, addr, buf, len)) { show_error("read memory failed.\n"); free(buf); return false; } if(dump_to_file) { size_t s = fwrite(buf,1,len,dump_f); fclose(dump_f); if (s != len) { show_error("write to file failed.\n"); free(buf); return false; } } else { /* print it out */ int i,j; int buf_idx = 0; for (i = 0; i + 16 < len; i += 16) { if (vars->options.backend == 0) printf("%p: ", addr+i); for (j = 0; j < 16; ++j) { printf("%02X ", (unsigned char)(buf[buf_idx++])); } if(vars->options.dump_with_ascii == 1) { for (j = 0; j < 16; ++j) { char c = buf[i+j]; printf("%c", isprint(c) ? c : '.'); } } printf("\n"); } if (i < len) { if (vars->options.backend == 0) printf("%p: ", addr+i); for (j = i; j < len; ++j) { printf("%02X ", (unsigned char)(buf[buf_idx++])); } if(vars->options.dump_with_ascii == 1) { while(j%16 !=0) // skip "empty" numbers { printf(" "); ++j; } for (j = 0; i+j < len; ++j) { char c = buf[i+j]; printf("%c", isprint(c) ? c : '.'); } } printf("\n"); } } free(buf); return true; } bool handler__write(globals_t * vars, char **argv, unsigned argc) { int data_width = 0; const char *fmt = NULL; void *addr; char *buf = NULL; char *endptr; int datatype; /* 0 for numbers, 1 for bytearray, 2 for string */ bool ret; const char *string_parameter = NULL; /* used by string type */ if (argc < 4) { show_error("bad arguments, see `help write`.\n"); ret = false; goto retl; } /* try int first */ if ((strcasecmp(argv[1], "i8") == 0) ||(strcasecmp(argv[1], "int8") == 0)) { data_width = 1; datatype = 0; fmt = "%"PRId8; } else if ((strcasecmp(argv[1], "i16") == 0) ||(strcasecmp(argv[1], "int16") == 0)) { data_width = 2; datatype = 0; fmt = "%"PRId16; } else if ((strcasecmp(argv[1], "i32") == 0) ||(strcasecmp(argv[1], "int32") == 0)) { data_width = 4; datatype = 0; fmt = "%"PRId32; } else if ((strcasecmp(argv[1], "i64") == 0) ||(strcasecmp(argv[1], "int64") == 0)) { data_width = 8; datatype = 0; fmt = "%"PRId64; } else if ((strcasecmp(argv[1], "f32") == 0) ||(strcasecmp(argv[1], "float32") == 0)) { data_width = 4; datatype = 0; fmt = "%f"; } else if ((strcasecmp(argv[1], "f64") == 0) ||(strcasecmp(argv[1], "float64") == 0)) { data_width = 8; datatype = 0; fmt = "%lf"; } else if (strcasecmp(argv[1], "bytearray") == 0) { data_width = argc - 3; datatype = 1; } else if (strcasecmp(argv[1], "string") == 0) { /* locate the string parameter, say locate the beginning of the 4th parameter (2 characters after the end of the 3rd paramter)*/ int i; string_parameter = vars->current_cmdline; for(i = 0; i < 3; ++i) { while(((*string_parameter) == ' ') ||(*string_parameter) == '\t') ++ string_parameter; while(((*string_parameter) != ' ') &&(*string_parameter) != '\t') ++ string_parameter; } ++ string_parameter; data_width = strlen(string_parameter); datatype = 2; } /* may support more types here */ else { show_error("bad data_type, see `help write`.\n"); ret = false; goto retl; } /* check argc again */ if ((datatype == 0) && (argc != 4)) { show_error("bad arguments, see `help write`.\n"); ret = false; goto retl; } /* check address */ errno = 0; addr = (void *)strtoll(argv[2], &endptr, 16); if ((errno != 0) || (*endptr != '\0')) { show_error("bad address, see `help write`.\n"); ret = false; goto retl; } buf = malloc(data_width + 8); /* allocate a little bit more, just in case */ if (buf == NULL) { show_error("memory allocation failed.\n"); ret = false; goto retl; } /* load value into buffer */ switch(datatype) { case 0: // numbers if(sscanf(argv[3], fmt, buf) < 1) /* should be OK even for max uint64 */ { show_error("bad value, see `help write`.\n"); ret = false; goto retl; } break; case 1: // bytearray ; /* cheat gcc */ /* call parse_uservalue_bytearray */ bytearray_element_t *array = calloc(data_width, sizeof(bytearray_element_t)); uservalue_t val_buf; if (array == NULL) { show_error("memory allocation failed.\n"); ret = false; goto retl; } if(!parse_uservalue_bytearray(argv+3, argc-3, array, &val_buf)) { show_error("bad byte array speicified.\n"); free(array); ret = false; goto retl; } int i; { // if wildcard is provided in the bytearray, we need the original data. bool wildcard_used = false; for(i = 0; i < data_width; ++i) { if(array[i].is_wildcard == 1) { wildcard_used = true; break; } } if (wildcard_used) { if(!read_array(vars->target, addr, buf, data_width)) { show_error("read memory failed.\n"); free(array); ret = false; goto retl; } } } for(i = 0; i < data_width; ++i) { bytearray_element_t *cur_element = array+i; if(cur_element->is_wildcard == 0) { buf[i] = cur_element->byte; } } free(array); break; case 2: //string strncpy(buf, string_parameter, data_width); break; default: assert(false); } /* write into memory */ ret = write_array(vars->target, addr, buf, data_width); retl: if(buf) free(buf); return ret; } bool handler__option(globals_t * vars, char **argv, unsigned argc) { /* this might need to change */ if (argc != 3) { show_error("bad arguments, see `help option`.\n"); return false; } if (strcasecmp(argv[1], "scan_data_type") == 0) { if (strcasecmp(argv[2], "number") == 0) { vars->options.scan_data_type = ANYNUMBER; } else if (strcasecmp(argv[2], "int") == 0) { vars->options.scan_data_type = ANYINTEGER; } else if (strcasecmp(argv[2], "int8") == 0) { vars->options.scan_data_type = INTEGER8; } else if (strcasecmp(argv[2], "int16") == 0) { vars->options.scan_data_type = INTEGER16; } else if (strcasecmp(argv[2], "int32") == 0) { vars->options.scan_data_type = INTEGER32; } else if (strcasecmp(argv[2], "int64") == 0) { vars->options.scan_data_type = INTEGER64; } else if (strcasecmp(argv[2], "float") == 0) { vars->options.scan_data_type = ANYFLOAT; } else if (strcasecmp(argv[2], "float32") == 0) { vars->options.scan_data_type = FLOAT32; } else if (strcasecmp(argv[2], "float64") == 0) { vars->options.scan_data_type = FLOAT64; } else if (strcasecmp(argv[2], "bytearray") == 0) { vars->options.scan_data_type = BYTEARRAY; } else if (strcasecmp(argv[2], "string") == 0) { vars->options.scan_data_type = STRING; } else { show_error("bad value for scan_data_type, see `help option`.\n"); return false; } } else if (strcasecmp(argv[1], "region_scan_level") == 0) { if (strcmp(argv[2], "1") == 0) {vars->options.region_scan_level = REGION_HEAP_STACK_EXECUTABLE; } else if (strcmp(argv[2], "2") == 0) {vars->options.region_scan_level = REGION_HEAP_STACK_EXECUTABLE_BSS; } else if (strcmp(argv[2], "3") == 0) {vars->options.region_scan_level = REGION_ALL; } else { show_error("bad value for region_scan_level, see `help option`.\n"); return false; } } else if (strcasecmp(argv[1], "detect_reverse_change") == 0) { if (strcmp(argv[2], "0") == 0) {vars->options.detect_reverse_change = 0; } else if (strcmp(argv[2], "1") == 0) {vars->options.detect_reverse_change = 1; } else { show_error("bad value for detect_reverse_change, see `help option`.\n"); return false; } } else if (strcasecmp(argv[1], "dump_with_ascii") == 0) { if (strcmp(argv[2], "0") == 0) {vars->options.dump_with_ascii = 0; } else if (strcmp(argv[2], "1") == 0) {vars->options.dump_with_ascii = 1; } else { show_error("bad value for dump_with_ascii, see `help option`.\n"); return false; } } else { show_error("unknown option specified, see `help option`.\n"); return false; } return true; } scanmem-0.13/target_memory_info_array.h0000644000175000017500000001132411547056367015260 00000000000000/* target_memory_info_array.h Copyright (C) 2009 Eli Dupree Copyright (C) 2010 WANG Lu 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 */ #ifndef _SEOIGROIYIOOBKOB_INC #define _SEOIGROIYIOOBKOB_INC /* include guard */ #include #include "value.h" #include "maps.h" /* These two structs are not used; pointers to them are used to refer to arrays containing copied_data_swaths / matches_swaths, in the following ormat: - the array begins with the first_byte_in_child pointer; immediately after that is the number_of_bytes, and then the struct's data describing that many bytes. (Note that the number refers to the number of bytes in the child process's memory that are covered, not the number of bytes the struct takes up.) - in the first position after each such block is another such block (first byte pointer and number of bytes), or a null pointer and a 0 number of bytes to terminate the data. (The first_byte_in_child pointers refer to locations in the child - they cannot be followed except using ptrace())*/ typedef struct { uint8_t old_value; match_flags match_info; } old_value_and_match_info; /* typedef struct { void *first_byte_in_child; unsigned long number_of_bytes; } unknown_type_of_swath; typedef struct { void *first_byte_in_child; unsigned long number_of_bytes; uint8_t copied_bytes[0]; } copied_data_swath; typedef struct { void *first_byte_in_child; unsigned long number_of_bytes; match_flags match_info[0]; } matches_swath; */ typedef struct { void *first_byte_in_child; unsigned long number_of_bytes; old_value_and_match_info data[0]; } matches_and_old_values_swath; /* typedef struct { unsigned long bytes_allocated; unsigned long max_needed_bytes; } unknown_type_of_array; typedef struct { unsigned long bytes_allocated; unsigned long max_needed_bytes; copied_data_swath swaths[0]; } copied_data_array; typedef struct { unsigned long bytes_allocated; unsigned long max_needed_bytes; matches_swath swaths[0]; } matches_array; */ typedef struct { unsigned long bytes_allocated; unsigned long max_needed_bytes; matches_and_old_values_swath swaths[0]; } matches_and_old_values_array; /* * now we use MATCHES_AND_VALUES only * typedef enum { MATCHES, MATCHES_AND_VALUES, VALUES } data_array_type_t; */ typedef struct { matches_and_old_values_swath *swath; long index; } match_location; matches_and_old_values_array * allocate_array(matches_and_old_values_array *array, unsigned long max_bytes); matches_and_old_values_array * allocate_enough_to_reach(matches_and_old_values_array *array, void *last_byte_to_reach_plus_one, matches_and_old_values_swath **swath_pointer_to_correct); matches_and_old_values_swath * add_element(matches_and_old_values_array **array, matches_and_old_values_swath *swath, void *remote_address, void *new_element); matches_and_old_values_array * null_terminate(matches_and_old_values_array *array, matches_and_old_values_swath *swath); /* only at most sizeof(int64_t) bytes will be readed, if more bytes needed (e.g. bytearray), read it separatedly (for performance) */ value_t data_to_val_aux(matches_and_old_values_swath *swath, long index, long swath_length); value_t data_to_val(matches_and_old_values_swath *swath, long index); /* for printable text representation */ void data_to_printable_string(char *buf, int buf_length, matches_and_old_values_swath *swath, long index, int string_length); /* for bytearray representation */ void data_to_bytearray_text(char *buf, int buf_length, matches_and_old_values_swath *swath, long index, int bytearray_length); void * remote_address_of_nth_element(matches_and_old_values_swath *swath, long n); void * remote_address_of_last_element(matches_and_old_values_swath *swath); void * local_address_beyond_nth_element(matches_and_old_values_swath *swath, long n); void * local_address_beyond_last_element(matches_and_old_values_swath *swath); match_location nth_match(matches_and_old_values_array *matches, unsigned n); matches_and_old_values_array * delete_by_region(matches_and_old_values_array *array, long *num_matches, region_t *which, bool invert); #endif scanmem-0.13/scanroutines.c0000644000175000017500000004370611332757663012711 00000000000000/* scanroutines.c Routines of scanning for different data types Copyright (C) 2009,2010 WANG Lu 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 . */ #include "config.h" #include #include "scanroutines.h" #include "value.h" #include "scanmem.h" /* for convenience */ #define SCAN_ROUTINE_ARGUMENTS (const value_t *new_value, const value_t *old_value, const uservalue_t *user_value, match_flags *saveflags, void *address) int (*g_scan_routine) SCAN_ROUTINE_ARGUMENTS; #define VALUE_COMP(a,b,field,op) (((a)->flags.field && (b)->flags.field) && (get_##field(a) op get_##field(b))) #define VALUE_COPY(a,b,field) ((set_##field(a, get_##field(b))), ((a)->flags.field = 1)) #define SET_FLAG(f, field) ((f)->field = 1) /********************/ /* Integer specific */ /********************/ /* for MATCHANY */ #define DEFINE_INTEGER_MATCHANY_ROUTINE(DATATYPENAME, DATAWIDTH) \ int scan_routine_##DATATYPENAME##_ANY SCAN_ROUTINE_ARGUMENTS \ { \ int ret = 0; \ if ((new_value)->flags.s##DATAWIDTH##b) { ret = (DATAWIDTH)/8; SET_FLAG(saveflags, s##DATAWIDTH##b); } \ if ((new_value)->flags.u##DATAWIDTH##b) { ret = (DATAWIDTH)/8; SET_FLAG(saveflags, u##DATAWIDTH##b); } \ return ret; \ } DEFINE_INTEGER_MATCHANY_ROUTINE(INTEGER8, 8) DEFINE_INTEGER_MATCHANY_ROUTINE(INTEGER16, 16) DEFINE_INTEGER_MATCHANY_ROUTINE(INTEGER32, 32) DEFINE_INTEGER_MATCHANY_ROUTINE(INTEGER64, 64) #define DEFINE_INTEGER_ROUTINE(DATATYPENAME, DATAWIDTH, MATCHTYPENAME, MATCHTYPE, VALUE_TO_COMPARE_WITH) \ int scan_routine_##DATATYPENAME##_##MATCHTYPENAME SCAN_ROUTINE_ARGUMENTS \ { \ assert(VALUE_TO_COMPARE_WITH); \ int ret = 0; \ if(VALUE_COMP(new_value, VALUE_TO_COMPARE_WITH, s##DATAWIDTH##b, MATCHTYPE)) { \ SET_FLAG(saveflags, s##DATAWIDTH##b); \ ret = (DATAWIDTH)/8; \ } \ if(VALUE_COMP(new_value, VALUE_TO_COMPARE_WITH, u##DATAWIDTH##b, MATCHTYPE)) { \ SET_FLAG(saveflags, u##DATAWIDTH##b); \ ret = (DATAWIDTH)/8; \ } \ return ret; \ } #define DEFINE_INTEGER_ROUTINE_FOR_ALL_INTEGER_TYPE(MATCHTYPENAME, MATCHTYPE, VALUE_TO_COMPARE_WITH) \ DEFINE_INTEGER_ROUTINE(INTEGER8, 8, MATCHTYPENAME, MATCHTYPE, VALUE_TO_COMPARE_WITH) \ DEFINE_INTEGER_ROUTINE(INTEGER16, 16, MATCHTYPENAME, MATCHTYPE, VALUE_TO_COMPARE_WITH) \ DEFINE_INTEGER_ROUTINE(INTEGER32, 32, MATCHTYPENAME, MATCHTYPE, VALUE_TO_COMPARE_WITH) \ DEFINE_INTEGER_ROUTINE(INTEGER64, 64, MATCHTYPENAME, MATCHTYPE, VALUE_TO_COMPARE_WITH) DEFINE_INTEGER_ROUTINE_FOR_ALL_INTEGER_TYPE(EQUALTO, ==, user_value) DEFINE_INTEGER_ROUTINE_FOR_ALL_INTEGER_TYPE(NOTEQUALTO, !=, user_value) DEFINE_INTEGER_ROUTINE_FOR_ALL_INTEGER_TYPE(GREATERTHAN, >, user_value) DEFINE_INTEGER_ROUTINE_FOR_ALL_INTEGER_TYPE(LESSTHAN, <, user_value) DEFINE_INTEGER_ROUTINE_FOR_ALL_INTEGER_TYPE(NOTCHANGED, ==, old_value) DEFINE_INTEGER_ROUTINE_FOR_ALL_INTEGER_TYPE(CHANGED, !=, old_value) DEFINE_INTEGER_ROUTINE_FOR_ALL_INTEGER_TYPE(INCREASED, >, old_value) DEFINE_INTEGER_ROUTINE_FOR_ALL_INTEGER_TYPE(DECREASED, <, old_value) /******************/ /* Float specific */ /******************/ /* for MATCHANY */ #define DEFINE_FLOAT_MATCHANY_ROUTINE(DATATYPENAME, DATAWIDTH) \ int scan_routine_##DATATYPENAME##_ANY SCAN_ROUTINE_ARGUMENTS \ { \ int ret = 0; \ if ((new_value)->flags.f##DATAWIDTH##b) { ret = (DATAWIDTH)/8; SET_FLAG(saveflags, f##DATAWIDTH##b); } \ return ret; \ } DEFINE_FLOAT_MATCHANY_ROUTINE(FLOAT32, 32) DEFINE_FLOAT_MATCHANY_ROUTINE(FLOAT64, 64) #define DEFINE_FLOAT_ROUTINE(DATATYPENAME, DATAWIDTH, MATCHTYPENAME, MATCHTYPE, VALUE_TO_COMPARE_WITH) \ int scan_routine_##DATATYPENAME##_##MATCHTYPENAME SCAN_ROUTINE_ARGUMENTS \ { \ assert(VALUE_TO_COMPARE_WITH); \ int ret = 0; \ if(VALUE_COMP(new_value, VALUE_TO_COMPARE_WITH, f##DATAWIDTH##b, MATCHTYPE)) { \ SET_FLAG(saveflags, f##DATAWIDTH##b); \ ret = (DATAWIDTH)/8; \ } \ return ret; \ } \ #define DEFINE_FLOAT_ROUTINE_FOR_ALL_FLOAT_TYPE(MATCHTYPENAME, MATCHTYPE, VALUE_TO_COMPARE_WITH) \ DEFINE_FLOAT_ROUTINE(FLOAT32, 32, MATCHTYPENAME, MATCHTYPE, VALUE_TO_COMPARE_WITH) \ DEFINE_FLOAT_ROUTINE(FLOAT64, 64, MATCHTYPENAME, MATCHTYPE, VALUE_TO_COMPARE_WITH) DEFINE_FLOAT_ROUTINE_FOR_ALL_FLOAT_TYPE(NOTEQUALTO, !=, user_value) /* TODO: this should be consistent with !EQUALTO */ DEFINE_FLOAT_ROUTINE_FOR_ALL_FLOAT_TYPE(NOTCHANGED, ==, old_value) /* this is bad */ DEFINE_FLOAT_ROUTINE_FOR_ALL_FLOAT_TYPE(CHANGED, !=, old_value) /* this is bad, but better than above */ DEFINE_FLOAT_ROUTINE_FOR_ALL_FLOAT_TYPE(INCREASED, >, old_value) DEFINE_FLOAT_ROUTINE_FOR_ALL_FLOAT_TYPE(DECREASED, <, old_value) DEFINE_FLOAT_ROUTINE_FOR_ALL_FLOAT_TYPE(GREATERTHAN, >, user_value) DEFINE_FLOAT_ROUTINE_FOR_ALL_FLOAT_TYPE(LESSTHAN, <, user_value) /********************/ /* Special routines */ /********************/ /*-----------------------------------*/ /* special EQUALTO for float numbers */ /*-----------------------------------*/ /* currently we round both of them to integers and compare them */ /* TODO: let user specify a float number */ #define DEFINE_FLOAT_EQUALTO_ROUTINE(FLOATTYPENAME, WIDTH) \ int scan_routine_##FLOATTYPENAME##_EQUALTO SCAN_ROUTINE_ARGUMENTS \ { \ int ret = 0; \ if((new_value->flags.f##WIDTH##b) && (user_value->flags.f##WIDTH##b) && ((int##WIDTH##_t)get_f##WIDTH##b(new_value) == (int##WIDTH##_t)get_f##WIDTH##b(user_value))) \ { \ SET_FLAG(saveflags, f##WIDTH##b); \ ret = (WIDTH)/8; \ } \ return ret; \ } DEFINE_FLOAT_EQUALTO_ROUTINE(FLOAT32, 32) DEFINE_FLOAT_EQUALTO_ROUTINE(FLOAT64, 64) /*-----------------------------*/ /* for reverse changing detect */ /*-----------------------------*/ #define DEFINE_ROUTINE_WITH_REVERSE_DETECT(DATATYPENAME, DATAWIDTH, MATCHTYPENAME, REVERSEMATCHTYPENAME) \ int scan_routine_##DATATYPENAME##_##MATCHTYPENAME##_WITH_REVERSE SCAN_ROUTINE_ARGUMENTS \ { \ int ret = 0; \ if ((new_value->flags.ineq_forwards) && scan_routine_##DATATYPENAME##_##MATCHTYPENAME (new_value, old_value, user_value, saveflags, address)) { ret = (DATAWIDTH)/8; SET_FLAG(saveflags, ineq_forwards); } \ if ((new_value->flags.ineq_reverse) && scan_routine_##DATATYPENAME##_##REVERSEMATCHTYPENAME (new_value, old_value, user_value, saveflags, address)) { ret = (DATAWIDTH)/8; SET_FLAG(saveflags, ineq_reverse); } \ return ret; \ } #define DEFINE_ROUTINE_WITH_REVERSE_DETECT_FOR_DATATYPE(DATATYPENAME, DATAWIDTH) \ DEFINE_ROUTINE_WITH_REVERSE_DETECT(DATATYPENAME, DATAWIDTH, INCREASED, DECREASED) \ DEFINE_ROUTINE_WITH_REVERSE_DETECT(DATATYPENAME, DATAWIDTH, DECREASED, INCREASED) DEFINE_ROUTINE_WITH_REVERSE_DETECT_FOR_DATATYPE(INTEGER8, 8) DEFINE_ROUTINE_WITH_REVERSE_DETECT_FOR_DATATYPE(INTEGER16, 16) DEFINE_ROUTINE_WITH_REVERSE_DETECT_FOR_DATATYPE(INTEGER32, 32) DEFINE_ROUTINE_WITH_REVERSE_DETECT_FOR_DATATYPE(INTEGER64, 64) DEFINE_ROUTINE_WITH_REVERSE_DETECT_FOR_DATATYPE(FLOAT32, 32) DEFINE_ROUTINE_WITH_REVERSE_DETECT_FOR_DATATYPE(FLOAT64, 64) /*---------------------------------*/ /* for INCREASEDBY and DECREASEDBY */ /*---------------------------------*/ #define DEFINE_INTEGER_INCREASEDBY_DECREASEDBY_ROUTINE(DATATYPENAME, DATAWIDTH) \ int scan_routine_##DATATYPENAME##_INCREASEDBY SCAN_ROUTINE_ARGUMENTS \ { \ int ret = 0; \ if ((new_value->flags.s##DATAWIDTH##b) && (old_value->flags.s##DATAWIDTH##b) && (user_value->flags.s##DATAWIDTH##b) \ && (get_s##DATAWIDTH##b(new_value) == get_s##DATAWIDTH##b(old_value) + get_s##DATAWIDTH##b(user_value))) \ { ret = (DATAWIDTH)/8; SET_FLAG(saveflags, s##DATAWIDTH##b); } \ if ((new_value->flags.u##DATAWIDTH##b) && (old_value->flags.u##DATAWIDTH##b) && (user_value->flags.u##DATAWIDTH##b) \ && (get_u##DATAWIDTH##b(new_value) == get_u##DATAWIDTH##b(old_value) + get_u##DATAWIDTH##b(user_value))) \ { ret = (DATAWIDTH)/8; SET_FLAG(saveflags, u##DATAWIDTH##b); } \ return ret; \ } \ int scan_routine_##DATATYPENAME##_DECREASEDBY SCAN_ROUTINE_ARGUMENTS \ { \ int ret = 0; \ if ((new_value->flags.s##DATAWIDTH##b) && (old_value->flags.s##DATAWIDTH##b) && (user_value->flags.s##DATAWIDTH##b) \ && (get_s##DATAWIDTH##b(new_value) == get_s##DATAWIDTH##b(old_value) - get_s##DATAWIDTH##b(user_value))) \ { ret = (DATAWIDTH)/8; SET_FLAG(saveflags, s##DATAWIDTH##b); } \ if ((new_value->flags.u##DATAWIDTH##b) && (old_value->flags.u##DATAWIDTH##b) && (user_value->flags.u##DATAWIDTH##b) \ && (get_u##DATAWIDTH##b(new_value) == get_u##DATAWIDTH##b(old_value) - get_u##DATAWIDTH##b(user_value))) \ { ret = (DATAWIDTH)/8; SET_FLAG(saveflags, u##DATAWIDTH##b); } \ return ret; \ } DEFINE_INTEGER_INCREASEDBY_DECREASEDBY_ROUTINE(INTEGER8, 8) DEFINE_INTEGER_INCREASEDBY_DECREASEDBY_ROUTINE(INTEGER16, 16) DEFINE_INTEGER_INCREASEDBY_DECREASEDBY_ROUTINE(INTEGER32, 32) DEFINE_INTEGER_INCREASEDBY_DECREASEDBY_ROUTINE(INTEGER64, 64) #define DEFINE_FLOAT_INCREASEDBY_DECREASEDBY_ROUTINE(DATATYPENAME, DATAWIDTH) \ int scan_routine_##DATATYPENAME##_INCREASEDBY SCAN_ROUTINE_ARGUMENTS \ { \ int ret = 0; \ if ((new_value->flags.f##DATAWIDTH##b) && (old_value->flags.f##DATAWIDTH##b) && (user_value->flags.f##DATAWIDTH##b) \ && (get_f##DATAWIDTH##b(new_value) == get_f##DATAWIDTH##b(old_value) + get_f##DATAWIDTH##b(user_value))) \ { ret = (DATAWIDTH)/8; SET_FLAG(saveflags, f##DATAWIDTH##b); } \ return ret; \ } \ int scan_routine_##DATATYPENAME##_DECREASEDBY SCAN_ROUTINE_ARGUMENTS \ { \ int ret = 0; \ if ((new_value->flags.f##DATAWIDTH##b) && (old_value->flags.f##DATAWIDTH##b) && (user_value->flags.f##DATAWIDTH##b) \ && (get_f##DATAWIDTH##b(new_value) == get_f##DATAWIDTH##b(old_value) - get_f##DATAWIDTH##b(user_value))) \ { ret = (DATAWIDTH)/8; SET_FLAG(saveflags, f##DATAWIDTH##b); } \ return ret; \ } DEFINE_FLOAT_INCREASEDBY_DECREASEDBY_ROUTINE(FLOAT32, 32) DEFINE_FLOAT_INCREASEDBY_DECREASEDBY_ROUTINE(FLOAT64, 64) /*----------------*/ /* for BYTEARRAY */ /*----------------*/ int scan_routine_BYTEARRAY_ANY SCAN_ROUTINE_ARGUMENTS { return saveflags->bytearray_length = ((old_value)->flags.bytearray_length); } int scan_routine_BYTEARRAY_EQUALTO SCAN_ROUTINE_ARGUMENTS { bytearray_element_t *array = user_value->bytearray_value; int length = user_value->flags.bytearray_length; int cur_idx = 0; int i, j; value_t val_buf = *new_value; for(i = 0; i + sizeof(int64_t) < length; i += sizeof(int64_t)) { /* match current block */ for(j = 0; j < sizeof(int64_t); ++j) { if( (array[cur_idx].is_wildcard == 1) || (array[cur_idx].byte == val_buf.bytes[j])) { /* pass */ } else { /* not matched */ return 0; } ++ cur_idx; } /* read next block */ if (!peekdata(globals.target, address+i+sizeof(int64_t), &val_buf)) { /* cannot read */ return 0; } } /* match bytes left */ for(j = 0; j < length - i; ++j) { if( (array[cur_idx].is_wildcard == 1) || (array[cur_idx].byte == val_buf.bytes[j])) { /* pass */ } else { /* not matched */ return 0; } ++ cur_idx; } /* matched */ saveflags->bytearray_length = length; return length; } /*------------*/ /* for STRING */ /*------------*/ int scan_routine_STRING_ANY SCAN_ROUTINE_ARGUMENTS { return saveflags->string_length = ((old_value)->flags.string_length); } int scan_routine_STRING_EQUALTO SCAN_ROUTINE_ARGUMENTS { const char *scan_string = user_value->string_value; int length = user_value->flags.string_length; int i, j; value_t val_buf = *new_value; for(i = 0; i + sizeof(int64_t) < length; i += sizeof(int64_t)) { if(val_buf.int64_value != *((int64_t*)(scan_string+i))) { /* not matched */ return 0; } /* read next block */ if (!peekdata(globals.target, address+i+sizeof(int64_t), &val_buf)) { /* cannot read */ return 0; } } /* match bytes left */ for(j = 0; j < length - i; ++j) { if(val_buf.bytes[j] != *(scan_string+i+j)) { /* not matched */ return 0; } } /* matched */ saveflags->string_length = length; return length; } /*-------------------------*/ /* Any-xxx types specifiec */ /*-------------------------*/ /* this is for anynumber, anyinteger, anyfloat */ #define DEFINE_ANYTYPE_ROUTINE(MATCHTYPENAME) \ int scan_routine_ANYINTEGER_##MATCHTYPENAME SCAN_ROUTINE_ARGUMENTS \ { \ int ret = 0, tmp_ret;\ if ((tmp_ret = scan_routine_INTEGER8_##MATCHTYPENAME (new_value, old_value, user_value, saveflags, address)) > ret) { ret = tmp_ret; } \ if ((tmp_ret = scan_routine_INTEGER16_##MATCHTYPENAME (new_value, old_value, user_value, saveflags, address)) > ret) { ret = tmp_ret; } \ if ((tmp_ret = scan_routine_INTEGER32_##MATCHTYPENAME (new_value, old_value, user_value, saveflags, address)) > ret) { ret = tmp_ret; } \ if ((tmp_ret = scan_routine_INTEGER64_##MATCHTYPENAME (new_value, old_value, user_value, saveflags, address)) > ret) { ret = tmp_ret; } \ return ret; \ } \ int scan_routine_ANYFLOAT_##MATCHTYPENAME SCAN_ROUTINE_ARGUMENTS \ { \ int ret = 0, tmp_ret; \ if ((tmp_ret = scan_routine_FLOAT32_##MATCHTYPENAME (new_value, old_value, user_value, saveflags, address)) > ret) { ret = tmp_ret; } \ if ((tmp_ret = scan_routine_FLOAT64_##MATCHTYPENAME (new_value, old_value, user_value, saveflags, address)) > ret) { ret = tmp_ret; } \ return ret; \ } \ int scan_routine_ANYNUMBER_##MATCHTYPENAME SCAN_ROUTINE_ARGUMENTS \ { \ int ret1 = scan_routine_ANYINTEGER_##MATCHTYPENAME (new_value, old_value, user_value, saveflags, address); \ int ret2 = scan_routine_ANYFLOAT_##MATCHTYPENAME (new_value, old_value, user_value, saveflags, address); \ return (ret1 > ret2 ? ret1 : ret2); \ } \ DEFINE_ANYTYPE_ROUTINE(ANY) DEFINE_ANYTYPE_ROUTINE(EQUALTO) DEFINE_ANYTYPE_ROUTINE(NOTEQUALTO) DEFINE_ANYTYPE_ROUTINE(CHANGED) DEFINE_ANYTYPE_ROUTINE(NOTCHANGED) DEFINE_ANYTYPE_ROUTINE(INCREASED) DEFINE_ANYTYPE_ROUTINE(DECREASED) DEFINE_ANYTYPE_ROUTINE(GREATERTHAN) DEFINE_ANYTYPE_ROUTINE(LESSTHAN) DEFINE_ANYTYPE_ROUTINE(INCREASED_WITH_REVERSE) DEFINE_ANYTYPE_ROUTINE(DECREASED_WITH_REVERSE) DEFINE_ANYTYPE_ROUTINE(INCREASEDBY) DEFINE_ANYTYPE_ROUTINE(DECREASEDBY) /***************************************************************/ /* choose a routine according to scan_data_type and match_type */ /***************************************************************/ #define CHOOSE_ROUTINE(SCANDATATYPE, ROUTINEDATATYPENAME, SCANMATCHTYPE, ROUTINEMATCHTYPENAME) \ if ((dt == SCANDATATYPE) && (mt == SCANMATCHTYPE)) \ { \ return &scan_routine_##ROUTINEDATATYPENAME##_##ROUTINEMATCHTYPENAME; \ } #define CHOOSE_ROUTINE_FOR_ALL_NUMBER_TYPES(SCANMATCHTYPE, ROUTINEMATCHTYPENAME) \ CHOOSE_ROUTINE(INTEGER8, INTEGER8, SCANMATCHTYPE, ROUTINEMATCHTYPENAME) \ CHOOSE_ROUTINE(INTEGER16, INTEGER16, SCANMATCHTYPE, ROUTINEMATCHTYPENAME) \ CHOOSE_ROUTINE(INTEGER32, INTEGER32, SCANMATCHTYPE, ROUTINEMATCHTYPENAME) \ CHOOSE_ROUTINE(INTEGER64, INTEGER64, SCANMATCHTYPE, ROUTINEMATCHTYPENAME) \ CHOOSE_ROUTINE(FLOAT32, FLOAT32, SCANMATCHTYPE, ROUTINEMATCHTYPENAME) \ CHOOSE_ROUTINE(FLOAT64, FLOAT64, SCANMATCHTYPE, ROUTINEMATCHTYPENAME) \ CHOOSE_ROUTINE(ANYINTEGER, ANYINTEGER, SCANMATCHTYPE, ROUTINEMATCHTYPENAME) \ CHOOSE_ROUTINE(ANYFLOAT, ANYFLOAT, SCANMATCHTYPE, ROUTINEMATCHTYPENAME) \ CHOOSE_ROUTINE(ANYNUMBER, ANYNUMBER, SCANMATCHTYPE, ROUTINEMATCHTYPENAME) \ bool choose_scanroutine(scan_data_type_t dt, scan_match_type_t mt) { return (g_scan_routine = get_scanroutine(dt, mt)) != NULL; } scan_routine_t get_scanroutine(scan_data_type_t dt, scan_match_type_t mt) { if (globals.options.detect_reverse_change) { CHOOSE_ROUTINE_FOR_ALL_NUMBER_TYPES(MATCHINCREASED, INCREASED_WITH_REVERSE) CHOOSE_ROUTINE_FOR_ALL_NUMBER_TYPES(MATCHDECREASED, DECREASED_WITH_REVERSE) } CHOOSE_ROUTINE_FOR_ALL_NUMBER_TYPES(MATCHANY, ANY) CHOOSE_ROUTINE_FOR_ALL_NUMBER_TYPES(MATCHEQUALTO, EQUALTO) CHOOSE_ROUTINE_FOR_ALL_NUMBER_TYPES(MATCHNOTEQUALTO, NOTEQUALTO) CHOOSE_ROUTINE_FOR_ALL_NUMBER_TYPES(MATCHCHANGED, CHANGED) CHOOSE_ROUTINE_FOR_ALL_NUMBER_TYPES(MATCHNOTCHANGED, NOTCHANGED) CHOOSE_ROUTINE_FOR_ALL_NUMBER_TYPES(MATCHINCREASED, INCREASED) CHOOSE_ROUTINE_FOR_ALL_NUMBER_TYPES(MATCHDECREASED, DECREASED) CHOOSE_ROUTINE_FOR_ALL_NUMBER_TYPES(MATCHINCREASEDBY, INCREASEDBY) CHOOSE_ROUTINE_FOR_ALL_NUMBER_TYPES(MATCHDECREASEDBY, DECREASEDBY) CHOOSE_ROUTINE_FOR_ALL_NUMBER_TYPES(MATCHGREATERTHAN, GREATERTHAN) CHOOSE_ROUTINE_FOR_ALL_NUMBER_TYPES(MATCHLESSTHAN, LESSTHAN) CHOOSE_ROUTINE(BYTEARRAY, BYTEARRAY, MATCHEQUALTO, EQUALTO) CHOOSE_ROUTINE(STRING, STRING, MATCHEQUALTO, EQUALTO) return NULL; } scanmem-0.13/interrupt.h0000644000175000017500000000126311311453216012205 00000000000000/* $Id: interrupt.h,v 1.5 2007-04-11 10:43:26+01 taviso Exp $ */ #ifndef _INTERRUPT_INC #define _INTERRUPT_INC /* small header file to manage interrupted commands */ static sigjmp_buf jmpbuf; /* used when aborting a command due to interrupt */ static sighandler_t oldsig; /* reinstalled before longjmp */ static unsigned intused; /* signal handler to handle interrupt during a commands */ static void interrupted(int n) { (void) n; siglongjmp(jmpbuf, 1); } #define INTERRUPTABLE() ((oldsig = signal(SIGINT, interrupted)), intused = 1, sigsetjmp(jmpbuf, 1)) #define ENDINTERRUPTABLE() (intused ? ((void) signal(SIGINT, oldsig), intused = 0) : (intused = 0)) #endif scanmem-0.13/show_message.h0000644000175000017500000000415411512675266012655 00000000000000/* show_message.h Copyright (C) 2010 WANG Lu 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 . */ /* * This file declares all types of output functions, in order to provide well-formatted messages that a front-end can understand * * Basically, all data go through stdout, and all message (to user or to front-end) go through stderr * * In stderr: * all messages prefixed with 'error:' will be considered fatal error, front-end may notify user to re-start backend * all messages prefixed with 'warn:' will be considered nonfatal error * all messages prefixed with 'info:' will be ignored (by the front-end) * * DO NOT output multi-line messages with above prefix, use multiple show_xxx instead * And you may or may not append a '\n' to the message. * * To display message to user only, use show_user, nothing will be prepended, and the message will be ignore if scanmem is running as a backend */ #ifndef SHOW_MESSAGE_H__ #define SHOW_MESSAGE_H__ /* prepend 'info: ', output to stderr */ void show_info(const char *fmt, ...); /* prepend 'error: ', output to stderr */ void show_error(const char *fmt, ...); /* prepend 'warn: ', output to stderr */ void show_warn(const char *fmt, ...); /* display message only when in debug mode */ void show_debug(const char *fmt, ...); /* display message only when not running as a backend */ void show_user(const char *fmt, ...); /* display progress of scan */ void show_scan_progress(unsigned long cur, unsigned long total); #endif /* SHOW_MESSAGE_H__ */ scanmem-0.13/target_memory_info_array.c0000644000175000017500000003020411547056170015241 00000000000000/* target_memory_info_array.c Copyright (C) 2009 Eli Dupree Copyright (C) 2010 WANG Lu 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 #include "target_memory_info_array.h" #include "show_message.h" matches_and_old_values_array * allocate_array (matches_and_old_values_array *array, unsigned long max_bytes) { /* Make enough space for the array header and a null first swath. */ unsigned long bytes_to_allocate = sizeof(matches_and_old_values_array) + sizeof(matches_and_old_values_swath); if (!(array = realloc(array, bytes_to_allocate))) return NULL; array->bytes_allocated = bytes_to_allocate; array->max_needed_bytes = max_bytes; return array; } matches_and_old_values_array * allocate_enough_to_reach(matches_and_old_values_array *array, void *last_byte_to_reach_plus_one, matches_and_old_values_swath **swath_pointer_to_correct) { unsigned long bytes_needed = (last_byte_to_reach_plus_one - (void *)array); if (bytes_needed <= array->bytes_allocated) return array; else { matches_and_old_values_array *original_location = array; /* Allocate twice as much each time, so we don't have to do it too often */ unsigned long bytes_to_allocate = array->bytes_allocated; while(bytes_to_allocate < bytes_needed) bytes_to_allocate *= 2; show_debug("to_allocate %ld, max %ld\n", bytes_to_allocate, array->max_needed_bytes); /* Sometimes we know an absolute max that we will need */ if (array->max_needed_bytes < bytes_to_allocate) { assert(array->max_needed_bytes >= bytes_needed); bytes_to_allocate = array->max_needed_bytes; } if (!(array = realloc(array, bytes_to_allocate))) return NULL; array->bytes_allocated = bytes_to_allocate; /* Put the swath pointer back where it should be, if needed. We cast everything to void pointers in this line to make sure the math works out. */ if (swath_pointer_to_correct) (*swath_pointer_to_correct) = (matches_and_old_values_swath *)(((void *)(*swath_pointer_to_correct)) + ((void *)array - (void *)original_location)); return array; } } /* Returns a pointer to the swath to which the element was added - i.e. the last swath in the array after the operation */ matches_and_old_values_swath * add_element (matches_and_old_values_array **array, matches_and_old_values_swath *swath, void *remote_address, void *new_element ) { if (swath->number_of_bytes == 0) { assert(swath->first_byte_in_child == NULL); /* We have to overwrite this as a new swath */ *array = allocate_enough_to_reach(*array, (void *)swath + sizeof(matches_and_old_values_swath) + sizeof(old_value_and_match_info), &swath); swath->first_byte_in_child = remote_address; } else { unsigned long local_index_excess = remote_address - remote_address_of_last_element(swath ); unsigned long local_address_excess = local_index_excess * sizeof(old_value_and_match_info); if (local_address_excess >= sizeof(matches_and_old_values_swath) + sizeof(old_value_and_match_info)) { /* It is most memory-efficient to start a new swath */ *array = allocate_enough_to_reach(*array, local_address_beyond_last_element(swath ) + sizeof(matches_and_old_values_swath) + sizeof(old_value_and_match_info), &swath); swath = local_address_beyond_last_element(swath ); swath->first_byte_in_child = remote_address; swath->number_of_bytes = 0; } else { /* It is most memory-efficient to write over the intervening space with null values */ *array = allocate_enough_to_reach(*array, local_address_beyond_last_element(swath ) + local_address_excess, &swath); memset(local_address_beyond_last_element(swath), 0, local_address_excess); swath->number_of_bytes += local_index_excess - 1; } } /* Add me */ *(old_value_and_match_info *)(local_address_beyond_last_element(swath )) = *(old_value_and_match_info *)new_element; ++swath->number_of_bytes; return swath; } matches_and_old_values_array * null_terminate (matches_and_old_values_array *array, matches_and_old_values_swath *swath ) { unsigned long bytes_needed; if (swath->number_of_bytes == 0) { assert(swath->first_byte_in_child == NULL); } else { swath = local_address_beyond_last_element(swath ); array = allocate_enough_to_reach(array, ((void *)swath) + sizeof(matches_and_old_values_swath), &swath); swath->first_byte_in_child = NULL; swath->number_of_bytes = 0; } bytes_needed = ((void *)swath + sizeof(matches_and_old_values_swath) - (void *)array); if (bytes_needed < array->bytes_allocated) { /* Reduce array to its final size */ if (!(array = realloc(array, bytes_needed))) return NULL; array->bytes_allocated = bytes_needed; } return array; } long index_of_last_element(matches_and_old_values_swath *swath ) { return swath->number_of_bytes - 1; } value_t data_to_val_aux(matches_and_old_values_swath *swath, long index, long swath_length ) { int i; value_t val; int max_bytes = swath_length - index; memset(&val, 0x00, sizeof(val)); if (max_bytes > 8) max_bytes = 8; if (max_bytes >= 8) val.flags.u64b = val.flags.s64b = val.flags.f64b = 1; if (max_bytes >= 4) val.flags.u32b = val.flags.s32b = val.flags.f32b = 1; if (max_bytes >= 2) val.flags.u16b = val.flags.s16b = 1; if (max_bytes >= 1) val.flags.u8b = val.flags.s8b = 1; for (i = 0; i < max_bytes; ++i) { uint8_t byte; byte = ((matches_and_old_values_swath *)swath)->data[index + i].old_value; *((uint8_t *)(&val.int64_value) + i) = byte; } return val; } value_t data_to_val(matches_and_old_values_swath *swath, long index ) { return data_to_val_aux(swath, index, swath->number_of_bytes ); } void data_to_printable_string(char *buf, int buf_length, matches_and_old_values_swath *swath, long index, int string_length) { long swath_length = swath->number_of_bytes - index; /* TODO: what if length is too large ? */ long max_length = (swath_length >= string_length) ? string_length : swath_length; int i; for(i = 0; i < max_length; ++i) { uint8_t byte = ((matches_and_old_values_swath *)swath)->data[index+i].old_value; buf[i] = isprint(byte) ? byte : '.'; } buf[i] = 0; /* null-terminate */ } void data_to_bytearray_text(char *buf, int buf_length, matches_and_old_values_swath *swath, long index, int bytearray_length) { long swath_length = swath->number_of_bytes - index; /* TODO: what if length is too large ? */ long max_length = (swath_length >= bytearray_length) ? bytearray_length : swath_length; int i; int bytes_used = 0; for(i = 0; i < max_length; ++i) { uint8_t byte = ((matches_and_old_values_swath *)swath)->data[index+i].old_value; /* TODO: check error here */ snprintf(buf+bytes_used, buf_length-bytes_used, (ifirst_byte_in_child + n; } void * remote_address_of_last_element(matches_and_old_values_swath *swath ) { return (remote_address_of_nth_element(swath, index_of_last_element(swath ) )); } void * local_address_beyond_nth_element(matches_and_old_values_swath *swath, long n ) { return &((matches_and_old_values_swath *)swath)->data[n + 1]; } void * local_address_beyond_last_element(matches_and_old_values_swath *swath ) { return (local_address_beyond_nth_element(swath, index_of_last_element(swath ) )); } match_location nth_match(matches_and_old_values_array *matches, unsigned n) { unsigned i = 0; matches_and_old_values_swath *reading_swath_index = (matches_and_old_values_swath *)matches->swaths; int reading_iterator = 0; if (!matches) return (match_location){ NULL, 0 }; while (reading_swath_index->first_byte_in_child) { /* Only actual matches are considered */ if (flags_to_max_width_in_bytes(reading_swath_index->data[reading_iterator].match_info) > 0) { if (i == n) { return (match_location){ reading_swath_index, reading_iterator }; } ++i; } /* Go on to the next one... */ ++reading_iterator; if (reading_iterator >= reading_swath_index->number_of_bytes) { reading_swath_index = local_address_beyond_last_element((matches_and_old_values_swath *)reading_swath_index ); reading_iterator = 0; } } /* I guess this is not a valid match-id */ return (match_location){ NULL, 0 }; } matches_and_old_values_array * delete_by_region(matches_and_old_values_array *matches, long *num_matches, region_t *which, bool invert) { matches_and_old_values_swath *reading_swath_index = (matches_and_old_values_swath *)matches->swaths; matches_and_old_values_swath reading_swath = *reading_swath_index; int reading_iterator = 0; matches_and_old_values_swath *writing_swath_index = (matches_and_old_values_swath *)matches->swaths; writing_swath_index->first_byte_in_child = NULL; writing_swath_index->number_of_bytes = 0; *num_matches = 0; while (reading_swath.first_byte_in_child) { void *address = reading_swath.first_byte_in_child + reading_iterator; bool in_region = (address >= which->start && address < which->start + which->size); if ((in_region && invert) || (!in_region && !invert)) { match_flags flags = reading_swath_index->data[reading_iterator].match_info; /* Still a candidate. Write data. (We can get away with overwriting in the same array because it is guaranteed to take up the same number of bytes or fewer, and because we copied out the reading swath metadata already.) (We can get away with assuming that the pointers will stay valid, because as we never add more data to the array than there was before, it will not reallocate.) */ writing_swath_index = add_element((matches_and_old_values_array **)(&matches), (matches_and_old_values_swath *)writing_swath_index, address, &reading_swath_index->data[reading_iterator] ); /* Actual matches are recorded */ if (flags_to_max_width_in_bytes(flags) > 0) ++(*num_matches); } /* Go on to the next one... */ ++reading_iterator; if (reading_iterator >= reading_swath.number_of_bytes) { assert(((matches_and_old_values_swath *)(&reading_swath_index->data[reading_swath.number_of_bytes]))->number_of_bytes >= 0); reading_swath_index = (matches_and_old_values_swath *)(&reading_swath_index->data[reading_swath.number_of_bytes]); reading_swath = *reading_swath_index; reading_iterator = 0; } } if (!(matches = null_terminate((matches_and_old_values_array *)matches, (matches_and_old_values_swath *)writing_swath_index ))) { return NULL; } return matches; } scanmem-0.13/handlers.h0000644000175000017500000003762611734006022011763 00000000000000/* $Id: handlers.h,v 1.13 2007-06-05 01:45:35+01 taviso Exp taviso $ */ #ifndef _INC_HANDLERS #define _INC_HANDLERS /* include guard */ /* * SHRTDOC's are one line descriptions of the supported command (shown with `help`). * LONGDOC's are detailed descriptions (shown with `help command`) (wrap them before column 80). * * The DOC's are passed to the registercommand() routine, and are read by the help * command. You can define SHRTDOC to NULL and help will not print it. * However, a NULL longdoc will print "missing documentation" if specific help is requested, * if you really dont want it to print anything, use "". * * Each handler is passed an argv and argc, argv[0] is the command called, along with * a pointer to the global settings structure, which contains various settings and lists * that handlers are allowed to change. One handler can handle multiple commands, but * you need register each command with its own documentation. */ #define SET_SHRTDOC "change known matches to specified value" #define SET_LONGDOC "usage: set [match-id[,match-id,...]=]n[/d] [...]\n" \ "Inject the value `n` into the match numbers `match-id`, or if just `n` is\n" \ "specified, all known matches. `n` can be specified in standard C language\n" \ "notation, a leading 0x for hexadecimal, leading 0 for octal, and everything\n" \ "else is assumed to be decimal. All known matches, along with their match-ids\n" \ "can be displayed with the `list` command. Multiple match-ids can be specified,\n" \ "separated with commas and terminated with an '=' sign.\n" \ "To set a value continually, for example to prevent a counter from decreasing,\n" \ "suffix the command with '/', followed by the number of seconds to wait between\n" \ "sets. Interrupt scanmem with ^C to stop the setting.\n\n" \ "Note that this command cannot work for bytearray or string.\n\n" \ "Examples:\n" \ "\tset 10 - set all known matches to 10\n" \ "\tset 0=0x03 - set match 0 to 0x03.\n" \ "\tset 0,1,2,7=0x32 - set matches 0,1,2 and 7 to 0x32\n" \ "\tset 0,3=42/8 - set matches 0 and 3 to 42 every 8 seconds\n" \ "\tset 12,13,14=0x23/2 23,19=0/8 6=4 0 - complex example, can be combined" \ bool handler__set(globals_t * vars, char **argv, unsigned argc); #define LIST_SHRTDOC "list all currently known matches" #define LIST_LONGDOC "usage: list\n" \ "Print all the currently known matches, along with details about the\n" \ "match, such as its type, location, and last known value. The number in\n" \ "the left column is the `match-id`, this can be passed to other commands\n" \ "such as `set`, `delete`, etc.\n" \ "The flags displayed indicate the possible types of the variable\n" bool handler__list(globals_t * vars, char **argv, unsigned argc); #define DELETE_SHRTDOC "delete a known match by match-id" #define DELETE_LONGDOC "usage: delete match-id\n" \ "Remove the match `match-id` from the match list. The `match-id` can\n" \ "be found using the `list` command. To delete all matches, see\n" \ "the `reset` command.\n" \ "To delete all matches associated with a particular library, see the\n" \ "`dregion` command, which will also remove any associated matches.\n" \ "Example:\n" \ "\tdelete 0 - delete match 0\n" \ "NOTE: match-ids may be recalculated after matches are removed or added." bool handler__delete(globals_t * vars, char **argv, unsigned argc); #define RESET_SHRTDOC "forget all matches, and reinitialise regions" #define RESET_LONGDOC "usage: reset\n" \ "Forget all matches and regions, and reread regions from the relevant\n" \ "maps file. Useful if you have made an error, or want to find a new\n" \ "variable.\n" bool handler__reset(globals_t * vars, char **argv, unsigned argc); #define PID_SHRTDOC "print current pid, or attach to a new process" #define PID_LONGDOC "usage: pid [pid]\n" \ "If `pid` is specified, reset current session and then attach to new\n" \ "process `pid`. If `pid` is not specified, print information about\n" \ "current process." bool handler__pid(globals_t * vars, char **argv, unsigned argc); #define SNAPSHOT_SHRTDOC "take a snapshot of the current process state" #define SNAPSHOT_LONGDOC "usage: snapshot\n" \ "Take a snapshot of the entire process in its current state, this is useful\n" \ "If you don't know the exact value of the variable you are searching for, but\n" \ "can describe it in terms of higher, lower or equal (see commands `>`,`<` and\n" \ "`=`).\n\n" \ "NOTE: this can use a lot of memory with large processes." bool handler__snapshot(globals_t * vars, char **argv, unsigned argc); #define DREGION_SHRTDOC "delete a known region by region-id" #define DREGION_LONGDOC "usage: dregion [!]region-id[,region-id[,...]]\n" \ "Remove the region `region-id` from the regions list, along with any matches\n" \ "affected from the match list. The `region-id` can be found using the `lregions`\n" \ "command. A leading `!` indicates the list should be inverted.\n" bool handler__dregion(globals_t * vars, char **argv, unsigned argc); #define LREGIONS_SHRTDOC "list all known regions" #define LREGIONS_LONGDOC "usage: lregions\n" \ "Print all the currently known regions, along with details such as the\n" \ "start address, size, permissions and associated filename. The number in\n" \ "the left column is the `region-id`, this can be passed to other commands\n" \ "that process regions, such as `dregion`." bool handler__lregions(globals_t * vars, char **argv, unsigned argc); #define GREATERTHAN_SHRTDOC "match values that have increased or greater than some number" #define LESSTHAN_SHRTDOC "match values that have decreased or less than some number" #define NOTCHANGED_SHRTDOC "match all variables that have changed since last scan" #define CHANGED_SHRTDOC "match all variables that have not changed since last scan" #define INCREASED_SHRTDOC "match values that have increased by some given number" #define DECREASED_SHRTDOC "match values that have decreased by some given number" #define GREATERTHAN_LONGDOC "usage: > [n]\n" \ "If n is given, match values that are greater than n.\n" \ "Otherwise all current matches that have not increased since the last scan are discarded. (same as `+`)\n" \ "You can use this in conjunction with `snapshot` if you never know its value." #define LESSTHAN_LONGDOC "usage: < [n]\n" \ "If n is given, match values that are less than n.\n" \ "Otherwise all current matches that have not decreased since the last scan are discarded.(same as `-`)\n" \ "You can use this in conjunction with `snapshot` if you never know its value." #define NOTCHANGED_LONGDOC "usage: =\n" \ "All current matches that have changed since the last scan are discarded.\n" \ "You can use this in conjunction with `snapshot` if you never know its value." #define CHANGED_LONGDOC "usage: !=\n" \ "All current matches that have not changed since the last scan are discarded.\n" \ "You can use this in conjunction with `snapshot` if you never know its value." #define INCREASED_LONGDOC "usage: + [n]\n" \ "If n is given, match values that have been increased by n\n" \ "Otherwise match all values that have increased. (same as `>`)\n" \ "You can use this in conjunction with `snapshot` if you never know its value." #define DECREASED_LONGDOC "usage: - [n]\n" \ "If n is given, match values that have been decreased by n\n" \ "Otherwise match all values that have decreased. (same as `<`)\n" \ "You can use this in conjunction with `snapshot` if you never know its value." bool handler__decinc(globals_t * vars, char **argv, unsigned argc); #define VERSION_SHRTDOC "print current version" #define VERSION_LONGDOC "usage: version\n" \ "Display the current version of scanmem in use." bool handler__version(globals_t * vars, char **argv, unsigned argc); #define EXIT_SHRTDOC "exit the program immediately" #define EXIT_LONGDOC "usage: exit\n" \ "Exit scanmem immediately, zero will be returned." bool handler__exit(globals_t * vars, char **argv, unsigned argc); #define HELP_SHRTDOC "access online documentation, use `help command` for specific help" #define HELP_LONGDOC "usage: help [command]\n" \ "If `command` is specified, print detailed information about command `command`\n" \ "including options and usage summary. If `command` is not specified, print a\n" \ "one line description of each command supported." bool handler__help(globals_t * vars, char **argv, unsigned argc); #define DEFAULT_SHRTDOC NULL #define DEFAULT_LONGDOC "When searching for a number, use any notation in standard C language (leading 0x for\n" \ "hexadecimal, leading 0 for octal, everything else is assumed to be decimal)\n" \ "float numbers are also acceptable, but will be rounded if scanning integers\n" \ "\n" \ "When searching for an array of byte, use 2-byte hexadecimal notation, \n" \ "separated by spaces, wildcard '?\?' is also supported. E.g. FF ?\? EE ?\? 02 01\n" \ "\n" \ "When searching for strings, use the \" command\n" \ "\n" \ "Scan the current process for variables with given value.\n" \ "By entering the value of the variable as it changes multiple times, scanmem can\n" \ "eliminate matches, eventually identifying where the variable is located.\n" \ "Once the variable is found, use `set` to change its value.\n" bool handler__default(globals_t * vars, char **argv, unsigned argc); #define STRING_SHRTDOC "match a given string" #define STRING_LONGDOC "usage \" \n" \ " is counted since the 2nd character following the leading \"\n" \ "This can only be used when scan_data_type is set to be string\n" \ "Example:\n" \ "\t\" Scan for string, spaces and ' \" are all acceptable.\n" bool handler__string(globals_t * vars, char **argv, unsigned argc); #define UPDATE_SHRTDOC "update match values without culling list" #define UPDATE_LONGDOC "usage: update\n" \ "Scans the current process, getting the current values of all matches.\n" \ "These values can be viewed with `list`, and are also the old values that\n" \ "scanmem compares to when using `>`, `<`, or `=`. This command is equivalent\n" \ "to a search command that all current results match.\n" bool handler__update(globals_t * vars, char **argv, unsigned argc); bool handler__eof(globals_t * vars, char **argv, unsigned argc); #define SHELL_SHRTDOC "execute a shell command without leaving scanmem" #define SHELL_LONGDOC "usage: shell [shell-command]\n" \ "Execute `shell-command` using /bin/sh then return, useful for reading man\n" \ "pages, checking top, or making notes with an external editor.\n" \ "Examples:\n" \ "\tshell vi notes.txt\n" \ "\tshell man scanmem\n" \ "\tshell cat > notes.txt\n" bool handler__shell(globals_t * vars, char **argv, unsigned argc); #define WATCH_SHRTDOC "monitor the value of a memory location as it changes" #define WATCH_LONGDOC "usage: watch [match-id]\n" \ "Monitors the match `match-id`, by testing its value every second. When the\n" \ "value changes, its new value is printed along with an timestamp. Interrupt\n" \ "with ^C to stop monitoring.\n" \ "Examples:\n" \ "\twatch 12 - watch match 12 for any changes.\n" bool handler__watch(globals_t * vars, char **argv, unsigned argc); /*XXX: improve this */ #define SHOW_SHRTDOC "display information about scanmem." #define SHOW_LONGDOC "usage: show \n" \ "Display information relating to .\n" bool handler__show(globals_t * vars, char **argv, unsigned argc); #define DUMP_SHRTDOC "dump a memory region to screen or a file" #define DUMP_LONGDOC "usage: dump
[]\n" \ "\n" \ "If is given, save the region of memory to the file \n" \ "Otherwise display it in a human-readable format.\n" bool handler__dump(globals_t * vars, char **argv, unsigned argc); #define WRITE_SHRTDOC "change the value of a specific memory location" #define WRITE_LONGDOC "usage: write
\n" \ "\n" \ "Write into
\n" \ " should be one of:\n" \ "\tint{8|16|32|64} (or i{8|16|32|64} for short)\n" \ "\tfloat{32|64} (or f{32|64} for short)\n" \ "\tbytearray\n" \ "\n" \ "Example:\n" \ "\twrite i16 60103e 0\n" \ "\twrite float32 60103e 0\n" \ "\twrite bytearray 60103e ff 01 32\n" bool handler__write(globals_t * vars, char **argv, unsigned argc); #define OPTION_SHRTDOC "set runtime options of scanmem, see `help option`" #define OPTION_LONGDOC "usage: option \n" \ "\n" \ "Here are all options and their possible values\n" \ "\n" \ "scan_data_type\t\tspecify what type of data should be considered\n" \ "\t\t\tDefault:int\n" \ "\tMOST OF TIME YOU MUST EXECUTE `reset' IMMEDIATELY AFTER CHANGING scan_data_type\n" \ "\n" \ "\tPossible Values:\n" \ "\tnumber:\t\t\tinteger or float\n" \ "\tint:\t\t\tinteger of any width\n" \ "\tfloat:\t\t\tfloat of any width\n" \ "\tint{8|16|32|64}:\tinteger of given width\n" \ "\tfloat{32|64}:\t\tfloat of given width\n" \ "\tbytearray:\t\tan array of bytes\n" \ "\tstring:\t\t\tstring\n" \ "\n" \ "region_scan_level\tspecify which regions should be scanned\n" \ "\t\t\tDefault:2\n" \ "\n" \ "\tPossible Values:\n" \ "\t1:\theap, stack and executable only\n" \ "\t2:\theap, stack executable and bss only\n" \ "\t3:\teverything(e.g. other libs)\n" \ "\n" \ "detect_reverse_change\twhether to (also) search for values that changes oppositely as given order\n" \ "\t\t\tDefault:0\n" \ "\tIf you want to use this feature, you can only search for INCREASED or DECREASED after initial search\n" \ "\n" \ "\tpossible values:\n" \ "\t0:\tdisabled\n" \ "\t1:\tenabled\n" \ "\n" \ "dump_with_ascii\twhether to print ascii characters with a memory dump\n" \ "\t\t\tDefault:1\n" \ "\n" \ "\tpossible values:\n" \ "\t0:\tdisabled\n" \ "\t1:\tenabled\n" \ "\n" \ "Example:\n" \ "\toption scan_data_type int32\n" bool handler__option(globals_t * vars, char **argv, unsigned argc); #endif scanmem-0.13/commands.h0000644000175000017500000000113611325260404011751 00000000000000/* $Id: commands.h,v 1.5 2007-04-11 10:43:26+01 taviso Exp $ */ #ifndef _COMMANDS_INC #define _COMMANDS_INC /* include guard */ #include #include "scanmem.h" /*lint -esym(534,registercommand) okay to ignore return value */ typedef struct { bool(*handler) (globals_t * vars, char **argv, unsigned argc); char *command; char *shortdoc; char *longdoc; } command_t; bool registercommand(const char *command, void *handler, list_t * commands, char *shortdoc, char *longdoc); bool execcommand(globals_t * vars, const char *commandline); #endif scanmem-0.13/NEWS0000644000175000017500000000074411311453216010502 00000000000000$Id: NEWS,v 1.3 2007-06-05 02:15:05+01 taviso Exp $ +---------------------------- |Version 0.07, 5th June 2007 +------------------------------ * Performance improvements for initial scan by using /proc/pid/mem interface. * Could miss misaligned variables close to page boundaries, fixed. * Miscellaneous bugfixes. * Improved dregion command. * Autotooled build. * Began work on dejagnu testsuite. This should allow more drastic changes in future without fear of major breakage. scanmem-0.13/ChangeLog0000644000175000017500000001710211734006345011557 000000000000002011-03-26 WANG Lu * Fix for '!=' as 'not equal to' * Typo * Option 'dump_with_ascii' added (Thanks to sec) 2011-12-16 WANG Lu * Support wildcards when writing bytearrays [Thanks to Incarus6] * Delete an item upon DELETE key is pressed * Copy address & cheatlist reorderable 2011-08-16 WANG Lu * Fix freeze after switching the target process 2011-08-15 WANG Lu * Improve the process selection dialog * Make tooltip for the 'Value' label more obvious 2011-08-02 WANG Lu * Fix memory browser 2011-07-08 WANG Lu * Fix manpage * Fix process list displaying (Issue 26) 2011-03-14 WANG Lu * Ignore empty input at cheatlist * Process list dialog is resizable 2011-01-13 WANG Lu * Run as root * Skip when readlink on /proc/pid/exe fails * Added a script for building packages for PPA 2011-01-12 WANG Lu * Using pager when showing help messages 2011-01-11 WANG Lu * Check version of scanmem right after GameConqueror starts 2010-09-19 WANG Lu * Fixed memory leak * Set monospace font to the lists * Fixed value parsing for strings 2010-05-22 Wang Lu * Fixed `set' command 2010-05-16 Wang Lu * Fixed build on FreeBSD * Bug fixed: freezing when scanning multiple variables 2010-04-28 Wang Lu * Bug fixed: dump_to_file [Thanks to Bryan Cain] * Manually add a cheat entry * Update values in the lists 2010-01-19 WANG Lu * Bug fixed: read /proc//mem on 32bit machines * Bug fixed: scan for double variables on 32bit machines * a little improvement on peekbuf * Better communication, replace readline with printf when running as backend * `scan for address` supported 2010-01-16 WANG Lu * Memory Editor * Fix copyright strings (again) * new 'dump' command 2010-01-12 WANG Lu * Bugs fixed * Better DEFAULT_LONGDOC * Better GUI * Better communication between GUI & backend * Progress bar in GUI * Several other UI improvement 2010-01-10 WANG Lu * STRING supported * Fixed a bug relacted to match_flag, now match_flags seems to be `dangerous` since I made it a union now. * Fixed a memory bug in target_memory_info_array.c 2010-01-09 WANG Lu * BYTEARRAY supported, oh yeah 2010-01-07 WANG Lu * Added uservalue_t and clean up some value_t, this make it more flexible, and make it possible to support more data types and even user-specific scan routine * in scan routines old_value and user_value are both provided * clean up MATCHES_AND_VALUES stuff, since currently we don't use MATCHES or VALUES * removed snapshot and use MATCHANY instead, such that this can be used to filter out data types * now user can provide float numbers * INCREASEDBY and DECREASEDBY support 2010-01-06 WANG Lu * Fixed detection of reverse change, but it's now working partially, see comments in `help option` * MATCHANY can be used to filter out types now * GREATERTHAN & LESSTHAN supported 2010-01-03 WANG Lu * better GUI * support scanning for a speicific type of data * autotools-ized gui * added an option to determine which regions to be searched 2009-12-20 WANG Lu * basic float/double support * fixed a peek buffer bug, that the buffer is not shifted correctly * change format of some commands for the front-end * added a new 'write' command * fixed a data overwritten issue (Issue 1) xxxx-xx-xx Tavis Ormandy * fixed infinite loop if a command was just leading whitespace. * add message to configure script about `libreadline-dev` package. * correct some typos reported by debian. 2007-06-07 Tavis Ormandy * make license clearer, added gpl notice to all source files, and added a show command. - eg, show copying, show warranty, etc. * handle unspecified value in set properly, eg set /4 * autotooled the build process. * fixed bug where unaligned variables might be missed at end of region. * begin testsuite using dejagnu, to help prevent any regressions in future. * use /proc/pid/mem if available. 2007-04-08 Tavis Ormandy * corrected lots of lint errors. * include copy of GPL in COPYING file. * use more EXPECT(). * fixed two memory leaks (very small). * much more scalable commandline parsing, simple switch/case was getting too unwieldy. * deprecated cont command, and re-wrote set to make it much more powerful. - use set x/y instead of cont, cont will print a warning if you try to use it. * preliminary support for float type (WARNING: experimental) * implemented simple custom completer for readline, so tab completion now works for commands. - arguments will work with completion in next version. * massive improvements to online help, each command can register its own documentation. - example : `help set` will now print detailed usage information. * added quick shell escape support (shell command). * added interrupt support to commands that continue until stopped. * changed the format of list output, which now has a set of flags that represent the possible formats that this variable could be, eg 'CSi' means could be a char or a short, but cant be an int. * new command `watch` that monitors how a variable changes. * updated manual 2007-03-04 Tavis Ormandy * buffered overlapping peeks to improve scan performance. * automatically support chars, shorts and ints. - removed width command * pid command can change target. * = command, to accompany < and > to indicate variable has not changed. * snapshot command to enhance <, > and =. WARNING: experimental, very inefficient. - snapshot will use a more efficient format next version, right now it should not be used on large programs, or will eat all your free memory. 2007-01-11 Tavis Ormandy * cleaned up some lintian errors * used __builtin_expect() to try to improve performance in some areas * minor UI tweaks, give region counts during scan. * start using readline(), should implement completion at some point. * fixed memory leak. 2006-11-16 Tavis Ormandy * Made buffer management more intelligent. * Add commands to list and delete regions (lregions, dregion). * Add commands to indicate variable has increased or decreased (<, >). * Improved usability of set, cont, list, etc. * Add progress meter, large programs can take a long time for initial scan. * Testing support for variable width targets, signedness not currenlty handled. * delete command to eliminate matches. * list command now shows where a variable is located. * General code cleanup. * Eliminate useless command line options, use interactive versions instead. * Improved documentation. 2006-11-14 Tavis Ormandy * Applied patch from Brian Lewis * Install signal handler to detach from target on sigint/sighup/sigquit. * Improved Makefile * Added initial man page 2006-11-13 Tavis Ormandy * Initial version scanmem-0.13/value.c0000644000175000017500000002744011375713513011276 00000000000000/* $Id: value.c,v 1.5 2007-04-11 10:43:27+01 taviso Exp taviso $ simple routines for working with the value_t data structure. Copyright (C) 2006,2007,2009 Tavis Ormandy Copyright (C) 2009 Eli Dupree Copyright (C) 2009,2010 WANG Lu 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 #include #include #include #include "value.h" #include "scanroutines.h" #include "scanmem.h" bool valtostr(const value_t * val, char *str, size_t n) { char buf[128]; int max_bytes = 0; bool print_as_unsigned = false; #define FLAG_MACRO(bytes, string) (val->flags.u##bytes##b && val->flags.s##bytes##b) ? (string " ") : (val->flags.u##bytes##b) ? (string "u ") : (val->flags.s##bytes##b) ? (string "s ") : "" /* set the flags */ snprintf(buf, sizeof(buf), "[%s%s%s%s%s%s%s]", FLAG_MACRO(64, "I64"), FLAG_MACRO(32, "I32"), FLAG_MACRO(16, "I16"), FLAG_MACRO(8, "I8"), val->flags.f64b ? "F64 " : "", val->flags.f32b ? "F32 " : "", (val->flags.ineq_reverse && !val->flags.ineq_forwards) ? "(reversed inequality) " : ""); if (val->flags.u64b) { max_bytes = 8; print_as_unsigned = true; } else if (val->flags.s64b) { max_bytes = 8; print_as_unsigned = false; } else if (val->flags.u32b) { max_bytes = 4; print_as_unsigned = true; } else if (val->flags.s32b) { max_bytes = 4; print_as_unsigned = false; } else if (val->flags.u16b) { max_bytes = 2; print_as_unsigned = true; } else if (val->flags.s16b) { max_bytes = 2; print_as_unsigned = false; } else if (val->flags.u8b ) { max_bytes = 1; print_as_unsigned = true; } else if (val->flags.s8b ) { max_bytes = 1; print_as_unsigned = false; } /* find the right format, considering different integer size implementations */ if (max_bytes == sizeof(long long)) snprintf(str, n, print_as_unsigned ? "%llu, %s" : "%lld, %s", print_as_unsigned ? get_ulonglong(val) : get_slonglong(val), buf); else if (max_bytes == sizeof(long)) snprintf(str, n, print_as_unsigned ? "%lu, %s" : "%ld, %s" , print_as_unsigned ? get_ulong(val) : get_slong(val), buf); else if (max_bytes == sizeof(int)) snprintf(str, n, print_as_unsigned ? "%u, %s" : "%d, %s" , print_as_unsigned ? get_uint(val) : get_sint(val), buf); else if (max_bytes == sizeof(short)) snprintf(str, n, print_as_unsigned ? "%hu, %s" : "%hd, %s" , print_as_unsigned ? get_ushort(val) : get_sshort(val), buf); else if (max_bytes == sizeof(char)) snprintf(str, n, print_as_unsigned ? "%hhu, %s" : "%hhd, %s", print_as_unsigned ? get_uchar(val) : get_schar(val), buf); else if (val->flags.f64b) snprintf(str, n, "%lf, %s", get_f64b(val), buf); else if (val->flags.f32b) snprintf(str, n, "%f, %s", get_f32b(val), buf); else { snprintf(str, n, "%#llx?, %s", get_slonglong(val), buf); return false; } return true; } void valcpy(value_t * dst, const value_t * src) { memcpy(dst, src, sizeof(value_t)); return; } /* dst.falgs must be set beforehand */ void uservalue2value(value_t *dst, const uservalue_t *src) { if(dst->flags.u8b) set_u8b(dst, get_u8b(src)); if(dst->flags.s8b) set_s8b(dst, get_s8b(src)); if(dst->flags.u16b) set_u16b(dst, get_u16b(src)); if(dst->flags.s16b) set_s16b(dst, get_s16b(src)); if(dst->flags.u32b) set_u32b(dst, get_u32b(src)); if(dst->flags.s32b) set_s32b(dst, get_s32b(src)); if(dst->flags.u64b) set_u64b(dst, get_u64b(src)); if(dst->flags.s64b) set_s64b(dst, get_s64b(src)); /* I guess integer and float cannot be matched together */ if(dst->flags.f32b) set_f32b(dst, get_f32b(src)); if(dst->flags.f64b) set_f64b(dst, get_f64b(src)); } void truncval_to_flags(value_t * dst, match_flags flags) { assert(dst != NULL); dst->flags.u64b &= flags.u64b; dst->flags.s64b &= flags.s64b; dst->flags.f64b &= flags.f64b; dst->flags.u32b &= flags.u32b; dst->flags.s32b &= flags.s32b; dst->flags.f32b &= flags.f32b; dst->flags.u16b &= flags.u16b; dst->flags.s16b &= flags.s16b; dst->flags.u8b &= flags.u8b ; dst->flags.s8b &= flags.s8b ; /* Hack - simply overwrite the inequality flags (this should have no effect except to make them display properly) */ dst->flags.ineq_forwards = flags.ineq_forwards; dst->flags.ineq_reverse = flags.ineq_reverse ; } void truncval(value_t * dst, const value_t * src) { assert(src != NULL); truncval_to_flags(dst, src->flags); } /* set all possible width flags, if nothing is known about val */ void valnowidth(value_t * val) { assert(val); val->flags.u64b = 1; val->flags.s64b = 1; val->flags.u32b = 1; val->flags.s32b = 1; val->flags.u16b = 1; val->flags.s16b = 1; val->flags.u8b = 1; val->flags.s8b = 1; val->flags.f64b = 1; val->flags.f32b = 1; val->flags.ineq_forwards = 1; val->flags.ineq_reverse = 1; /* don't bother with bytearray_length and string_length */ return; } bool parse_uservalue_bytearray(char **argv, unsigned argc, bytearray_element_t *array, uservalue_t *val) { int i,j; const char *cur_str; char cur_char; char *endptr; bytearray_element_t *cur_element; for(i = 0; i < argc; ++i) { /* get current string */ cur_str = argv[i]; /* test its length */ for(j = 0; (j < 3) && (cur_str[j]); ++j) {} if (j != 2) /* length is not 2 */ return false; cur_element = array + i; if (strcmp(cur_str, "??") == 0) { cur_element->is_wildcard = 1; continue; } else { /* parse as hex integer */ cur_char = (char)strtol(cur_str, &endptr, 16); if (*endptr != '\0') return false; cur_element->is_wildcard = 0; cur_element->byte = cur_char; } } /* everything is ok */ val->bytearray_value = array; val->flags.bytearray_length = argc; return true; } bool parse_uservalue_number(const char *nptr, uservalue_t * val) { /* TODO multiple rounding method */ if (parse_uservalue_int(nptr, val)) { val->flags.f32b = val->flags.f64b = 1; val->float32_value = (float) val->int64_value; val->float64_value = (double) val->int64_value; return true; } else if(parse_uservalue_float(nptr, val)) { double num = val->float64_value; if (num >= (double)(0) && num < (double)(1LL<< 8)) { val->flags.u8b = 1; set_u8b(val, (uint8_t)num); } if (num >= (double)-(1LL<< 7) && num < (double)(1LL<< 7)) { val->flags.s8b = 1; set_s8b(val, (int8_t)num); } if (num >= (double)(0) && num < (double)(1LL<<16)) { val->flags.u16b = 1; set_u16b(val, (uint16_t)num); } if (num >= (double)-(1LL<<15) && num < (double)(1LL<<15)) { val->flags.s16b = 1; set_s16b(val, (int16_t)num); } if (num >= (double)(0) && num < (double)(1LL<<32)) { val->flags.u32b = 1; set_u32b(val, (uint32_t)num); } if (num >= (double)-(1LL<<31) && num < (double)(1LL<<31)) { val->flags.s32b = 1; set_s32b(val, (int32_t)num); } if ( (double)(true) && (double)(true)) { val->flags.u64b = 1; set_u64b(val, (uint64_t)num); } if ( (double)(true) && (double)(true)) { val->flags.s64b = 1; set_s64b(val, (int64_t)num); } return true; } return false; } bool parse_uservalue_int(const char *nptr, uservalue_t * val) { int64_t num; char *endptr; assert(nptr != NULL); assert(val != NULL); memset(val, 0x00, sizeof(uservalue_t)); /* skip past any whitespace */ while (isspace(*nptr)) ++nptr; /* now parse it using strtoul */ errno = 0; num = strtoll(nptr, &endptr, 0); if ((errno != 0) || (*endptr != '\0')) return false; /* determine correct flags */ if (num >= (0) && num < (1LL<< 8)) { val->flags.u8b = 1; set_u8b(val, (uint8_t)num); } if (num >= -(1LL<< 7) && num < (1LL<< 7)) { val->flags.s8b = 1; set_s8b(val, (int8_t)num); } if (num >= (0) && num < (1LL<<16)) { val->flags.u16b = 1; set_u16b(val, (uint16_t)num); } if (num >= -(1LL<<15) && num < (1LL<<15)) { val->flags.s16b = 1; set_s16b(val, (int16_t)num); } if (num >= (0) && num < (1LL<<32)) { val->flags.u32b = 1; set_u32b(val, (uint32_t)num); } if (num >= -(1LL<<31) && num < (1LL<<31)) { val->flags.s32b = 1; set_s32b(val, (int32_t)num); } if ( (true) && (true)) { val->flags.u64b = 1; set_u64b(val, (uint64_t)num); } if ( (true) && (true)) { val->flags.s64b = 1; set_s64b(val, (int64_t)num); } return true; } bool parse_uservalue_float(const char *nptr, uservalue_t * val) { double num; char *endptr; assert(nptr); assert(val); memset(val, 0x00, sizeof(uservalue_t)); while (isspace(*nptr)) ++nptr; errno = 0; num = strtod(nptr, &endptr); if ((errno != 0) || (*endptr != '\0')) return false; /* I'm not sure how to distinguish float & double, but I guess it's not necessary here */ val->flags.f32b = val->flags.f64b = 1; val->float32_value = (float) num; val->float64_value = num; return true; } int flags_to_max_width_in_bytes(match_flags flags) { switch(globals.options.scan_data_type) { case BYTEARRAY: return flags.bytearray_length; break; case STRING: return flags.string_length; break; default: /* numbers */ if (flags.u64b || flags.s64b || flags.f64b) return 8; else if (flags.u32b || flags.s32b || flags.f32b) return 4; else if (flags.u16b || flags.s16b ) return 2; else if (flags.u8b || flags.s8b ) return 1; else /* It can't be a variable of any size */ return 0; break; } } int val_max_width_in_bytes(value_t *val) { return flags_to_max_width_in_bytes(val->flags); } #define DEFINE_GET_BY_SYSTEM_DEPENDENT_TYPE_FUNCTION(type, typename, signedness_letter) \ type get_##signedness_letter##typename (const value_t const* val) \ { \ if (sizeof(type) <= 1) return (type)get_##signedness_letter##8b(val); \ else if (sizeof(type) <= 2) return (type)get_##signedness_letter##16b(val); \ else if (sizeof(type) <= 4) return (type)get_##signedness_letter##32b(val); \ else if (sizeof(type) <= 8) return (type)get_##signedness_letter##64b(val); \ else assert(false); \ } #define DEFINE_GET_BY_SYSTEM_DEPENDENT_TYPE_FUNCTIONS(type, typename) \ DEFINE_GET_BY_SYSTEM_DEPENDENT_TYPE_FUNCTION(unsigned type, typename, u) \ DEFINE_GET_BY_SYSTEM_DEPENDENT_TYPE_FUNCTION(signed type, typename, s) DEFINE_GET_BY_SYSTEM_DEPENDENT_TYPE_FUNCTIONS(char, char) DEFINE_GET_BY_SYSTEM_DEPENDENT_TYPE_FUNCTIONS(short, short) DEFINE_GET_BY_SYSTEM_DEPENDENT_TYPE_FUNCTIONS(int, int) DEFINE_GET_BY_SYSTEM_DEPENDENT_TYPE_FUNCTIONS(long, long) DEFINE_GET_BY_SYSTEM_DEPENDENT_TYPE_FUNCTIONS(long long, longlong) scanmem-0.13/COPYING0000644000175000017500000010451310642030347011037 00000000000000 GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 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 . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . scanmem-0.13/maps.c0000644000175000017500000001466011513542131011110 00000000000000/* $Id: maps.c,v 1.16 2007-06-05 01:45:35+01 taviso Exp taviso $ Copyright (C) 2006,2007,2009 Tavis Ormandy Copyright (C) 2009 Eli Dupree Copyright (C) 2009,2010 WANG Lu 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 */ #ifndef _GNU_SOURCE # define _GNU_SOURCE #endif #include "config.h" #include #include #include #include #include #include #include #include #include "list.h" #include "maps.h" #include "scanmem.h" #include "show_message.h" bool readmaps(pid_t target, list_t * regions) { FILE *maps; char name[128], *line = NULL; char exename[128]; size_t len = 0; #define MAX_LINKBUF_SIZE 256 char linkbuf[MAX_LINKBUF_SIZE]; int linkbuf_size; /* check if target is valid */ if (target == 0) return false; /* construct the maps filename */ snprintf(name, sizeof(name), "/proc/%u/maps", target); /* attempt to open the maps file */ if ((maps = fopen(name, "r")) == NULL) { show_error("failed to open maps file %s.\n", name); return false; } show_info("maps file located at %s opened.\n", name); /* read every line of the maps file */ while (getline(&line, &len, maps) != -1) { unsigned long start, end; region_t *map = NULL; char read, write, exec, cow, *filename; int offset, dev_major, dev_minor, inode; /* slight overallocation */ if ((filename = alloca(len)) == NULL) { show_error("failed to allocate %lu bytes for filename.\n", (unsigned long)len); goto error; } /* initialise to zero */ memset(filename, '\0', len); /* parse each line */ if (sscanf(line, "%lx-%lx %c%c%c%c %x %x:%x %u %s", &start, &end, &read, &write, &exec, &cow, &offset, &dev_major, &dev_minor, &inode, filename) >= 6) { /* must have permissions to read and write, and be non-zero size */ if ((write == 'w') && (read == 'r') && ((end - start) > 0)) { /* determine if this region is useful */ bool useful = false; switch (globals.options.region_scan_level) { case REGION_ALL: useful = true; break; case REGION_HEAP_STACK_EXECUTABLE_BSS: if (filename[0] == '\0') { useful = true; break; } /* fall through */ case REGION_HEAP_STACK_EXECUTABLE: if ((!strcmp(filename, "[heap]")) || (!strcmp(filename, "[stack]"))) { useful = true; break; } /* test if the region is mapped to the executable */ snprintf(exename, sizeof(exename), "/proc/%u/exe", target); if((linkbuf_size = readlink(exename, linkbuf, MAX_LINKBUF_SIZE)) > 0) { linkbuf[linkbuf_size] = 0; } else /* readlink may fail for special processes, just treat as empty in order not to miss those regions */ { linkbuf[0] = 0; } if (strncmp(filename, linkbuf, MAX_LINKBUF_SIZE) == 0) useful = true; break; } if (!useful) continue; /* allocate a new region structure */ if ((map = calloc(1, sizeof(region_t) + strlen(filename))) == NULL) { show_error("failed to allocate memory for region.\n"); goto error; } /* initialise this region */ map->flags.read = true; map->flags.write = true; map->start = (void *) start; map->size = (unsigned long) (end - start); /* setup other permissions */ map->flags.exec = (exec == 'x'); map->flags.shared = (cow == 's'); map->flags.private = (cow == 'p'); /* save pathname */ if (strlen(filename) != 0) { /* the pathname is concatenated with the structure */ if ((map = realloc(map, sizeof(*map) + strlen(filename))) == NULL) { show_error("failed to allocate memory.\n"); goto error; } strcpy(map->filename, filename); } /* add a unique identifier */ map->id = regions->size; /* okay, add this guy to our list */ if (l_append(regions, regions->tail, map) == -1) { show_error("failed to save region.\n"); goto error; } } } } show_info("%d suitable regions found.\n", regions->size); /* release memory allocated */ free(line); fclose(maps); return true; error: free(line); fclose(maps); return false; } int compare_region_id(const region_t *a, const region_t *b) { return (int) (a->id - b->id); } scanmem-0.13/gpl-3.0.txt0000644000175000017500000010451310642030347011625 00000000000000 GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 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 . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . scanmem-0.13/menu.c0000644000175000017500000001152111513304236011107 00000000000000/* $Id: menu.c,v 1.15 2007-04-11 10:43:27+01 taviso Exp taviso $ Copyright (C) 2006,2007,2009 Tavis Ormandy 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 */ #ifndef _GNU_SOURCE # define _GNU_SOURCE #endif #include "config.h" #include #include #include #include #include #include #include #include #include "scanmem.h" #include "commands.h" #include "show_message.h" static char *commandgenerator(const char *text, int state); static char **commandcompletion(const char *text, int start, int end); /* * getcommand() reads in a command using readline, and places a pointer to the * read string into *line, _which must be free'd by caller_. * returns true on success, or false on error. */ bool getcommand(globals_t * vars, char **line) { char prompt[64]; bool success = true; assert(vars != NULL); snprintf(prompt, sizeof(prompt), "%ld> ", vars->num_matches); rl_readline_name = "scanmem"; rl_attempted_completion_function = commandcompletion; while (true) { if (vars->options.backend == 0) { /* for normal user, read in the next command using readline library */ success = ((*line = readline(prompt)) != NULL); } else { /* disable readline for front-end, since readline may produce ansi escape codes, which is terrible for front-end */ printf("%s\n", prompt); /* add a newline for front-end */ fflush(stdout); /* otherwise front-end may not receive this */ *line = NULL; /* let getline malloc it */ size_t n; ssize_t bytes_read = getline(line, &n, stdin); success = (bytes_read > 0); if (success) (*line)[bytes_read-1] = '\0'; /* remove the trialing newline */ } if (!success) { /* EOF */ if ((*line = strdup("__eof")) == NULL) { fprintf(stderr, "error: sorry, there was a memory allocation error.\n"); return false; } } if (strlen(*line)) { break; } free(*line); } /* record this line to readline history */ add_history(*line); return true; } /* custom completor program for readline */ static char **commandcompletion(const char *text, int start, int end) { (void) end; /* never use default completer (filenames), even if I dont generate any matches */ rl_attempted_completion_over = 1; /* only complete on the first word, the command */ return start ? NULL : rl_completion_matches(text, commandgenerator); } /* command generator for readline completion */ static char *commandgenerator(const char *text, int state) { static unsigned index = 0; unsigned i; size_t len; element_t *np; /* reset generator if state == 0, otherwise continue from last time */ index = state ? index : 0; np = globals.commands ? globals.commands->head : NULL; len = strlen(text); /* skip to the last node checked */ for (i = 0; np && i < index; i++) np = np->next; /* traverse the commands list, checking for matches */ while (np) { command_t *command = np->data; np = np->next; /* record progress */ index++; /* if shortdoc is NULL, this is not supposed to be user visible */ if (command == NULL || command->command == NULL || command->shortdoc == NULL) continue; /* check if we have a match */ if (strncmp(text, command->command, len) == 0) { return strdup(command->command); } } return NULL; } void printversion(FILE *outfd) { fprintf(outfd, "scanmem version %s\n" "Copyright (C) 2009,2010 Tavis Ormandy, Eli Dupree, WANG Lu\n" "Copyright (C) 2006-2009 Tavis Ormandy\n" "scanmem comes with ABSOLUTELY NO WARRANTY; for details type `show warranty'.\n" "This is free software, and you are welcome to redistribute it\n" "under certain conditions; type `show copying' for details.\n\n", PACKAGE_VERSION); } scanmem-0.13/licence.h0000644000175000017500000000460511317205006011554 00000000000000/* $Id: licence.h,v 1.2 2007-04-11 10:43:26+01 taviso Exp $ */ #ifndef _INC_LICENCE #define _INC_LICENCE #define SM_WARRANTY \ "15. Disclaimer of Warranty.\n\n" \ "THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY\n" \ "APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT\n" \ "HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM \"AS IS\" WITHOUT WARRANTY\n" \ "OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,\n" \ "THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n" \ "PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM\n" \ "IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF\n" \ "ALL NECESSARY SERVICING, REPAIR OR CORRECTION.\n" \ "\n" \ "16. Limitation of Liability.\n\n" \ "IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING\n" \ "WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS\n" \ "THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY\n" \ "GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE\n" \ "USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF\n" \ "DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD\n" \ "PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),\n" \ "EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF\n" \ "SUCH DAMAGES.\n" #define SM_COPYING \ "This program is free software; you can redistribute it and/or modify\n" \ "it under the terms of the GNU General Public License as published by\n" \ "the Free Software Foundation; either version 3 of the License, or\n" \ "(at your option) any later version.\n" \ "\n" \ "This program is distributed in the hope that it will be useful,\n" \ "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" \ "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" \ "GNU General Public License for more details.\n" \ "\n" \ "You should have received a copy of the GNU General Public License\n" \ "along with this program; if not, see .\n" #endif scanmem-0.13/scanroutines.h0000644000175000017500000000506211322122546012670 00000000000000/* scanroutines.h Definition of routines of scanning for different data types Copyright (C) 2009,2010 WANG Lu 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 . */ #ifndef SCANROUTINES_H__ #define SCANROUTINES_H__ #include #include "value.h" typedef enum { ANYNUMBER, /* ANYINTEGER or ANYFLOAT */ ANYINTEGER, /* INTEGER of whatever width */ ANYFLOAT, /* FLOAT of whatever width */ INTEGER8, INTEGER16, INTEGER32, INTEGER64, FLOAT32, FLOAT64, BYTEARRAY, STRING } scan_data_type_t; typedef enum { MATCHANY, /* to update */ /* following: compare with a given value */ MATCHEQUALTO, MATCHNOTEQUALTO, MATCHGREATERTHAN, MATCHLESSTHAN, /* following: compare with the old value */ MATCHNOTCHANGED, MATCHCHANGED, MATCHINCREASED, MATCHDECREASED, /* folowing: compare with both given value and old value */ MATCHINCREASEDBY, MATCHDECREASEDBY } scan_match_type_t; /* match old_value against new_value or user_value (or both, depending on the matching type, store the result into save */ /* NOTE: saveflag must be set to 0, since only useful bits are set, but extra bits are not cleared! */ /* address is pointing to new_value in TARGET PROCESS MEMORY SPACE, used when searching for a byte array */ /* return the number of bytes needed to store old_value, 0 for not matched */ typedef int (*scan_routine_t)(const value_t *new_value, const value_t *old_value, const uservalue_t *user_value, match_flags *saveflag, void *address); extern scan_routine_t g_scan_routine; /* * choose the global scanroutine according to the given parameters, g_scan_routine will be set * return whether a proper routine has been found */ bool choose_scanroutine(scan_data_type_t dt, scan_match_type_t mt); scan_routine_t get_scanroutine(scan_data_type_t dt, scan_match_type_t mt); #endif /* SCANROUTINES_H__ */ scanmem-0.13/depcomp0000644000175000017500000004426711313675017011374 00000000000000#! /bin/sh # depcomp - compile a program generating dependencies as side-effects scriptversion=2009-04-28.21; # UTC # Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009 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 2, 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 . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Alexandre Oliva . case $1 in '') echo "$0: No command. Try \`$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: depcomp [--help] [--version] PROGRAM [ARGS] Run PROGRAMS ARGS to compile a file, generating dependencies as side-effects. Environment variables: depmode Dependency tracking mode. source Source file read by `PROGRAMS ARGS'. object Object file output by `PROGRAMS ARGS'. DEPDIR directory where to store dependencies. depfile Dependency file to output. tmpdepfile Temporary file to use when outputing dependencies. libtool Whether libtool is used (yes/no). Report bugs to . EOF exit $? ;; -v | --v*) echo "depcomp $scriptversion" exit $? ;; esac if test -z "$depmode" || test -z "$source" || test -z "$object"; then echo "depcomp: Variables source, object and depmode must be set" 1>&2 exit 1 fi # Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. depfile=${depfile-`echo "$object" | sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} rm -f "$tmpdepfile" # Some modes work just like other modes, but use different flags. We # parameterize here, but still list the modes in the big case below, # to make depend.m4 easier to write. Note that we *cannot* use a case # here, because this file can only contain one case statement. if test "$depmode" = hp; then # HP compiler uses -M and no extra arg. gccflag=-M depmode=gcc fi if test "$depmode" = dashXmstdout; then # This is just like dashmstdout with a different argument. dashmflag=-xM depmode=dashmstdout fi cygpath_u="cygpath -u -f -" if test "$depmode" = msvcmsys; then # This is just like msvisualcpp but w/o cygpath translation. # Just convert the backslash-escaped backslashes to single forward # slashes to satisfy depend.m4 cygpath_u="sed s,\\\\\\\\,/,g" depmode=msvisualcpp fi case "$depmode" in gcc3) ## gcc 3 implements dependency tracking that does exactly what ## we want. Yay! Note: for some reason libtool 1.4 doesn't like ## it if -MD -MP comes after the -MF stuff. Hmm. ## Unfortunately, FreeBSD c89 acceptance of flags depends upon ## the command line argument order; so add the flags where they ## appear in depend2.am. Note that the slowdown incurred here ## affects only configure: in makefiles, %FASTDEP% shortcuts this. for arg do case $arg in -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; *) set fnord "$@" "$arg" ;; esac shift # fnord shift # $arg done "$@" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi mv "$tmpdepfile" "$depfile" ;; gcc) ## There are various ways to get dependency output from gcc. Here's ## why we pick this rather obscure method: ## - Don't want to use -MD because we'd like the dependencies to end ## up in a subdir. Having to rename by hand is ugly. ## (We might end up doing this anyway to support other compilers.) ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like ## -MM, not -M (despite what the docs say). ## - Using -M directly means running the compiler twice (even worse ## than renaming). if test -z "$gccflag"; then gccflag=-MD, fi "$@" -Wp,"$gccflag$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz ## The second -e expression handles DOS-style file names with drive letters. sed -e 's/^[^:]*: / /' \ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" ## This next piece of magic avoids the `deleted header file' problem. ## The problem is that when a header file which appears in a .P file ## is deleted, the dependency causes make to die (because there is ## typically no way to rebuild the header). We avoid this by adding ## dummy dependencies for each header file. Too bad gcc doesn't do ## this for us directly. tr ' ' ' ' < "$tmpdepfile" | ## Some versions of gcc put a space before the `:'. On the theory ## that the space means something, we add a space to the output as ## well. ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; sgi) if test "$libtool" = yes; then "$@" "-Wp,-MDupdate,$tmpdepfile" else "$@" -MDupdate "$tmpdepfile" fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files echo "$object : \\" > "$depfile" # Clip off the initial element (the dependent). Don't try to be # clever and replace this with sed code, as IRIX sed won't handle # lines with more than a fixed number of characters (4096 in # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; # the IRIX cc adds comments like `#:fec' to the end of the # dependency line. tr ' ' ' ' < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ tr ' ' ' ' >> "$depfile" echo >> "$depfile" # The second pass generates a dummy entry for each header file. tr ' ' ' ' < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ >> "$depfile" else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; aix) # The C for AIX Compiler uses -M and outputs the dependencies # in a .u file. In older versions, this file always lives in the # current directory. Also, the AIX compiler puts `$object:' at the # start of each line; $object doesn't have directory information. # Version 6 uses the directory in both cases. dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` test "x$dir" = "x$object" && dir= base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then tmpdepfile1=$dir$base.u tmpdepfile2=$base.u tmpdepfile3=$dir.libs/$base.u "$@" -Wc,-M else tmpdepfile1=$dir$base.u tmpdepfile2=$dir$base.u tmpdepfile3=$dir$base.u "$@" -M fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then # Each line is of the form `foo.o: dependent.h'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" # That's a tab and a space in the []. sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; icc) # Intel's C compiler understands `-MD -MF file'. However on # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c # ICC 7.0 will fill foo.d with something like # foo.o: sub/foo.c # foo.o: sub/foo.h # which is wrong. We want: # sub/foo.o: sub/foo.c # sub/foo.o: sub/foo.h # sub/foo.c: # sub/foo.h: # ICC 7.1 will output # foo.o: sub/foo.c sub/foo.h # and will wrap long lines using \ : # foo.o: sub/foo.c ... \ # sub/foo.h ... \ # ... "$@" -MD -MF "$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each line is of the form `foo.o: dependent.h', # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this invocation # correctly. Breaking it into two sed invocations is a workaround. sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp2) # The "hp" stanza above does not work with aCC (C++) and HP's ia64 # compilers, which have integrated preprocessors. The correct option # to use with these is +Maked; it writes dependencies to a file named # 'foo.d', which lands next to the object file, wherever that # happens to be. # Much of this is similar to the tru64 case; see comments there. dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` test "x$dir" = "x$object" && dir= base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then tmpdepfile1=$dir$base.d tmpdepfile2=$dir.libs/$base.d "$@" -Wc,+Maked else tmpdepfile1=$dir$base.d tmpdepfile2=$dir$base.d "$@" +Maked fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile1" "$tmpdepfile2" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile" # Add `dependent.h:' lines. sed -ne '2,${ s/^ *// s/ \\*$// s/$/:/ p }' "$tmpdepfile" >> "$depfile" else echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" "$tmpdepfile2" ;; tru64) # The Tru64 compiler uses -MD to generate dependencies as a side # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put # dependencies in `foo.d' instead, so we check for that too. # Subdirectories are respected. dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` test "x$dir" = "x$object" && dir= base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then # With Tru64 cc, shared objects can also be used to make a # static library. This mechanism is used in libtool 1.4 series to # handle both shared and static libraries in a single compilation. # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. # # With libtool 1.5 this exception was removed, and libtool now # generates 2 separate objects for the 2 libraries. These two # compilations output dependencies in $dir.libs/$base.o.d and # in $dir$base.o.d. We have to check for both files, because # one of the two compilations can be disabled. We should prefer # $dir$base.o.d over $dir.libs/$base.o.d because the latter is # automatically cleaned when .libs/ is deleted, while ignoring # the former would cause a distcleancheck panic. tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4 tmpdepfile2=$dir$base.o.d # libtool 1.5 tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 "$@" -Wc,-MD else tmpdepfile1=$dir$base.o.d tmpdepfile2=$dir$base.d tmpdepfile3=$dir$base.d tmpdepfile4=$dir$base.d "$@" -MD fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" # That's a tab and a space in the []. sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" else echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; #nosideeffect) # This comment above is used by automake to tell side-effect # dependency tracking mechanisms from slower ones. dashmstdout) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout, regardless of -o. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove `-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done test -z "$dashmflag" && dashmflag=-M # Require at least two characters before searching for `:' # in the target name. This is to cope with DOS-style filenames: # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. "$@" $dashmflag | sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" tr ' ' ' ' < "$tmpdepfile" | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; dashXmstdout) # This case only exists to satisfy depend.m4. It is never actually # run, as this mode is specially recognized in the preamble. exit 1 ;; makedepend) "$@" || exit $? # Remove any Libtool call if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # X makedepend shift cleared=no eat=no for arg do case $cleared in no) set ""; shift cleared=yes ;; esac if test $eat = yes; then eat=no continue fi case "$arg" in -D*|-I*) set fnord "$@" "$arg"; shift ;; # Strip any option that makedepend may not understand. Remove # the object too, otherwise makedepend will parse it as a source file. -arch) eat=yes ;; -*|$object) ;; *) set fnord "$@" "$arg"; shift ;; esac done obj_suffix=`echo "$object" | sed 's/^.*\././'` touch "$tmpdepfile" ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" sed '1,2d' "$tmpdepfile" | tr ' ' ' ' | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" "$tmpdepfile".bak ;; cpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove `-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done "$@" -E | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | sed '$ s: \\$::' > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" cat < "$tmpdepfile" >> "$depfile" sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; msvisualcpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi IFS=" " for arg do case "$arg" in -o) shift ;; $object) shift ;; "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") set fnord "$@" shift shift ;; *) set fnord "$@" "$arg" shift shift ;; esac done "$@" -E 2>/dev/null | sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" echo " " >> "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" rm -f "$tmpdepfile" ;; msvcmsys) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; none) exec "$@" ;; *) echo "Unknown depmode $depmode" 1>&2 exit 1 ;; esac exit 0 # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: scanmem-0.13/commands.c0000644000175000017500000001064511325260443011754 00000000000000/* $Id: commands.c,v 1.8 2007-06-05 19:58:03+01 taviso Exp taviso $ Copyright (C) 2006,2007,2009 Tavis Ormandy Copyright (C) 2009 Eli Dupree Copyright (C) 2009,2010 WANG Lu 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 */ #ifndef _GNU_SOURCE # define _GNU_SOURCE #endif #include "config.h" #include #include #include #include #include #include #include #include #include #include "commands.h" #include "show_message.h" /* * registercommand - add the command and a pointer to its handler to the commands list. * * so that free(data) works when destroying the list, I just concatenate the string * with the command structure. I could have used a static vector of commands, but this * way I can add aliases and macros at runtime (planned in future). * */ /*lint -esym(818,handler) dont declare handler const */ bool registercommand(const char *command, void *handler, list_t * commands, char *shortdoc, char *longdoc) { command_t *data; assert(commands != NULL); if (command != NULL) { if ((data = malloc(sizeof(command_t) + strlen(command) + 1)) == NULL) { show_error("sorry, there was a memory allocation problem.\n"); return false; } data->command = (char *) data + sizeof(*data); /* command points to the extra space allocated after data */ strcpy(data->command, command); } else { if ((data = malloc(sizeof(command_t))) == NULL) { show_error("sorry, there was a memory allocation problem.\n"); return false; } data->command = NULL; } data->handler = handler; data->shortdoc = shortdoc; data->longdoc = longdoc; /* add new command to list */ if (l_append(commands, NULL, data) == -1) { free(data); return false; } return true; } bool execcommand(globals_t * vars, const char *commandline) { unsigned argc; char *str = NULL, *tok = NULL; char **argv = NULL; command_t *err = NULL; bool ret = false; list_t *commands = vars->commands; element_t *np = NULL; assert(commandline != NULL); assert(commands != NULL); vars->current_cmdline = commandline; np = commands->head; str = tok = strdupa(commandline); /* tokenize command line into an argument vector */ for (argc = 0; tok; argc++, str = NULL) { /* make enough size for another pointer (+1 for NULL at end) */ if ((argv = realloc(argv, (argc + 1) * sizeof(char *))) == NULL) { show_error("sorry there was a memory allocation error.\n"); return false; } /* insert next token */ argv[argc] = tok = strtok(str, " \t"); } assert(argc >= 1); assert(argv != NULL); /* just leading whitespace? */ if (argv[0] == NULL) { free(argv); /* legal i guess, just dont do anything */ return true; } /* search commands list for appropriate handler */ while (np) { command_t *command = np->data; /* check if this command matches */ if (command->command == NULL) { /* the default handler has a NULL command */ err = command; } else if (strcasecmp(argv[0], command->command) == 0) { /* match found, execute handler */ ret = command->handler(vars, argv, argc - 1); free(argv); return ret; } np = np->next; } /* no match, if there was a default handler found, run it now */ if (err != NULL) { ret = err->handler(vars, argv, argc - 1); } free(argv); return ret; } scanmem-0.13/list.c0000644000175000017500000000637611325260501011127 00000000000000/* $Id: list.c,v 1.12 2007-06-05 01:45:35+01 taviso Exp taviso $ A simple linked list implementation. Copyright (C) 2006,2007,2009 Tavis Ormandy 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 "list.h" /* create a new list */ list_t *l_init(void) { return calloc(1, sizeof(list_t)); } /* destroy the whole list */ void l_destroy(list_t * list) { void *data; if (list == NULL) return; /* remove every element */ while (list->size) { l_remove(list, NULL, &data); free(data); } free(list); } /*lint -e429 take custody of pointer data */ /* add a new element to the list */ int l_append(list_t * list, element_t * element, void *data) { element_t *n = calloc(1, sizeof(element_t)); if (n == NULL) return -1; n->data = data; /* insert at head or tail */ if (element == NULL) { if (list->size == 0) { list->tail = n; } n->next = list->head; list->head = n; } else { /* insertion in the middle of a list */ if (element->next == NULL) { list->tail = n; } n->next = element->next; element->next = n; } list->size++; return 0; } /* concatenate list src with list dst */ int l_concat(list_t *dst, list_t **src) { void *data; element_t *n; n = (*src)->head; while (n) { l_remove(*src, NULL, &data); if (l_append(dst, NULL, data) == -1) return -1; n = (*src)->head; } l_destroy(*src); *src = NULL; return 0; } /* remove the element at element->next */ void l_remove(list_t * list, element_t * element, void **data) { element_t *o; /* remove from head */ if (element == NULL) { if (data) { *data = list->head->data; } o = list->head; list->head = o->next; if (list->size == 1) { list->tail = NULL; } } else { if (data) { *data = element->next->data; } o = element->next; if ((element->next = element->next->next) == NULL) { list->tail = element; } } if (data == NULL) free(o->data); free(o); list->size--; return; } /* remove the nth element */ void l_remove_nth(list_t * list, unsigned n, void **data) { element_t *np = list->head; /* traverse to correct element */ while (n--) { if ((np = np->next) == NULL) /* return */ abort(); } l_remove(list, np, data); }