From 177a8ead26e48a61efd904103a9d189cb27009dd Mon Sep 17 00:00:00 2001 From: fche Date: Tue, 1 Nov 2005 16:13:35 +0000 Subject: 2005-11-01 Frank Ch. Eigler PR 1425. * configure.ac: Look for rpm-devel headers and libs. * configure: Regenerated. * session.h: New file to contain systemtap_session decl. * staptree.h: Likewise evict statistics_decl. * elaborate.h: Corresponding changes. * main.cxx (usage): Elaborate. Re-enable "-r RELEASE" option. * parse.cxx (parser): Add systemtap_session& field. Update users. (scan_pp, eval_pp_conditional): New routines for preprocessing. (peek, next): Call it. (lexer::scan): Lex the preprocessor operators. (parser::parse): Include an extra level of exception catching for parse errors that occur during recovery. * parse.h: Corresponding changes. (parse_error): Allow explicit token parameter. * stap.1.in: Document preprocessing. * testsuite/parseok/fourteen.stp: New test. --- session.h | 104 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100644 session.h (limited to 'session.h') diff --git a/session.h b/session.h new file mode 100644 index 00000000..666d8ce2 --- /dev/null +++ b/session.h @@ -0,0 +1,104 @@ +// -*- C++ -*- +// Copyright (C) 2005 Red Hat Inc. +// +// This file is part of systemtap, and is free software. You can +// redistribute it and/or modify it under the terms of the GNU General +// Public License (GPL); either version 2, or (at your option) any +// later version. + +#ifndef SESSION_H +#define SESSION_H + +#include +#include +#include +#include +#include + + +// forward decls for all referenced systemtap types +struct match_node; +struct stapfile; +struct vardecl; +struct functiondecl; +struct derived_probe; +struct embeddedcode; +struct translator_output; +struct unparser; +struct semantic_error; + + +// XXX: a generalized form of this descriptor could be associated with +// a vardecl instead of out here at the systemtap_session level. +struct statistic_decl +{ + statistic_decl() + : type(none), + logarithmic_buckets(0), + linear_low(0), linear_high(0), linear_step(0) + {} + enum { none, linear, logarithmic } type; + int64_t logarithmic_buckets; + int64_t linear_low; + int64_t linear_high; + int64_t linear_step; +}; + + +struct systemtap_session +{ + systemtap_session (); + + // command line args + std::vector include_path; + std::vector macros; + std::vector args; + std::string kernel_release; + std::string runtime_path; + std::string module_name; + std::string output_file; + std::string cmd; + int target_pid; + int last_pass; + bool test_mode; + bool verbose; + bool keep_tmpdir; + bool guru_mode; + bool bulk_mode; + int buffer_size; + + // temporary directory for module builds etc. + // hazardous - it is "rm -rf"'d at exit + std::string tmpdir; + std::string translated_source; // C source code + + match_node* pattern_root; + void register_library_aliases(); + + // parse trees for the various script files + stapfile* user_file; + std::vector library_files; + + // resolved globals/functions/probes for the run as a whole + std::vector files; + std::vector globals; + std::vector functions; + std::vector probes; + std::vector embeds; + std::map stat_decls; + // XXX: vector<*> instead please? + + // module-referencing file handles + std::map module_fds; + + // unparser data + translator_output* op; + unparser* up; + + unsigned num_errors; + // void print_error (const parse_error& e); + void print_error (const semantic_error& e); +}; + + +#endif // SESSION_H -- cgit