From 27fb8a40831ac0c952cafd0108f0d59a3e339e14 Mon Sep 17 00:00:00 2001 From: Justin Seyster Date: Mon, 31 Jan 2011 20:06:55 -0500 Subject: [PATCH] Added source files for tracecuts feature. --- Doxyfile | 2 +- src/Makefile.am | 2 +- src/aop-doxy-main.c | 12 ++++++ src/tracecut.c | 96 +++++++++++++++++++++++++++++++++++++++++++++ src/tracecut.h | 48 +++++++++++++++++++++++ 5 files changed, 158 insertions(+), 2 deletions(-) create mode 100644 src/tracecut.c create mode 100644 src/tracecut.h diff --git a/Doxyfile b/Doxyfile index af94294..a537fa5 100644 --- a/Doxyfile +++ b/Doxyfile @@ -585,7 +585,7 @@ INPUT_ENCODING = UTF-8 # *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx # *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90 -FILE_PATTERNS = aop.h *.c +FILE_PATTERNS = aop.h tracecut.h *.c # The RECURSIVE tag can be used to turn specify whether or not subdirectories # should be searched for input files as well. Possible values are YES and NO. diff --git a/src/Makefile.am b/src/Makefile.am index b596c80..377553e 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,7 +1,7 @@ lib_LTLIBRARIES = libinteraspect.la libinteraspect_la_SOURCES = aop-pc-assign.c aop-main.c aop-type.c aop-weave.c \ aop-pc-entry.c aop-pc-exit.c aop-pc-fun-call.c aop-header.c \ - aop-pointcut.c aop-duplicate.c + aop-pointcut.c aop-duplicate.c tracecut.c libinteraspect_la_CFLAGS = -Wall -Werror -fvisibility=hidden -prefer-pic libinteraspect_la_LDFLAGS = -static -prefer-pic -version-info 1:0:0 libinteraspect_la_CPPFLAGS = -DHAVE_CONFIG_H -DIN_GCC -I$(gcc_includes) diff --git a/src/aop-doxy-main.c b/src/aop-doxy-main.c index 3fb1070..7e5cd60 100644 --- a/src/aop-doxy-main.c +++ b/src/aop-doxy-main.c @@ -252,6 +252,18 @@ * objects for you when the compiler exits. */ +/** + * \struct tc_tracecut + * \brief A tracecut object. + * + * A tracecut event represents a set of program events parameterized + * on program objects. The tracecut runtime can monitor program + * objects to see when an object performs a sequence of events + * (specified with a regular expression). + * + * Each tracecut must be freed manually with tc_free_tracecut(). + */ + /** * \example hello.c * A "hello world" example that shows the minimum setup necessary to diff --git a/src/tracecut.c b/src/tracecut.c new file mode 100644 index 0000000..5ea4103 --- /dev/null +++ b/src/tracecut.c @@ -0,0 +1,96 @@ +/* Copyright (c) 2011 Justin Seyster + Copyright (c) 2011 Erez Zadok + Copyright (c) 2011 Stony Brook University + Copyright (c) 2011 The Research Foundation of SUNY + + 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. + + Under Section 7 of GPL version 3, you are granted additional + permissions described in the GCC Runtime Library Exception, version + 3.1, as published by the Free Software Foundation. + + You should have received a copy of the GNU General Public License + and a copy of the GCC Runtime Library Exception along with this + program; see the files COPYING and COPYING.RUNTIME respectively. + If not, see . */ + +/* Whether we want them or not (we don't), Autoconf _insists_ on + defining these. Since GCC's config.h (which we must include) also + defines them, we have to undef them here. */ +#undef PACKAGE_BUGREPORT +#undef PACKAGE_NAME +#undef PACKAGE_STRING +#undef PACKAGE_TARNAME +#undef PACKAGE_VERSION + +#include +#include + +#include "aop.h" +#include "tracecut.h" + +/** + * \cond HIDDEN_SYMBOLS + */ +struct tc_call_symbol { + const char *name; + const char *func_name; + + struct tc_call_symbol *next; +}; + +struct tc_tracecut { + struct tracecut_symbol *tc_symbol_list; +}; +/** + * \endcond + */ + +/** + * \defgroup tracecut Tracecut Functions + * \{ + */ + +/** + * Create an empty tc_tracecut object. The caller is responsible for + * freeing the object using tc_free_tracecut(). + * \return A new tc_tracecut that must be freed with + * tc_free_tracecut(). + */ +struct tc_tracecut * +tc_create_tracecut (void) +{ + struct tc_tracecut *tc; + + tc = (struct tc_tracecut *)malloc (sizeof (struct tc_tracecut)); + aop_assert (tc != NULL); + + tc->tc_symbol_list = NULL; + + return tc; +} + +/** + * Free all the memory used by a tc_object. Every call to + * tc_create_tracecut() should have a matching call to + * tc_free_tracecut(). + * \param tc The tracecut object to free. + */ +void +tc_free_tracecut (struct tc_tracecut *tc) +{ + free(tc); +} + +/* Close Doxygen defgroup block. */ +/** + * \} + */ diff --git a/src/tracecut.h b/src/tracecut.h new file mode 100644 index 0000000..407f1c6 --- /dev/null +++ b/src/tracecut.h @@ -0,0 +1,48 @@ +#ifndef __AOP_TRACECUT_H__ +#define __AOP_TRACECUT_H__ + +/* Copyright (c) 2011 Justin Seyster + Copyright (c) 2011 Erez Zadok + Copyright (c) 2011 Stony Brook University + Copyright (c) 2011 The Research Foundation of SUNY + + 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. + + Under Section 7 of GPL version 3, you are granted additional + permissions described in the GCC Runtime Library Exception, version + 3.1, as published by the Free Software Foundation. + + You should have received a copy of the GNU General Public License + and a copy of the GCC Runtime Library Exception along with this + program; see the files COPYING and COPYING.RUNTIME respectively. + If not, see . */ + +/** + * \file tracecut.h + * \brief The public interface for InterAspect tracecuts, an extension + * to the InterAspect framework. + * + * A tracecut can track sequences of events on a program object (or a + * set of program objects) using regular expressions. + * + * Though included in the InterAspect distribution, the tracecut + * extension only uses InterAspect's external API, making it a good + * example of how to use the API. + * + * All tracecut functions have a tc_ prefix. + */ + +struct tc_tracecut; + +extern struct tc_tracecut *tc_create_tracecut (void); +extern void tc_free_tracecut (struct tc_tracecut *tc); + +#endif -- 2.34.1