]>
sourceware.org Git - systemtap.git/blob - translate.h
2 // Copyright (C) 2005, 2009 Red Hat Inc.
4 // This file is part of systemtap, and is free software. You can
5 // redistribute it and/or modify it under the terms of the GNU General
6 // Public License (GPL); either version 2, or (at your option) any
17 // ------------------------------------------------------------------------
19 #include "translator-output.h" // translator_output moved to separate file
21 // An unparser instance is in charge of emitting code for generic
22 // probe bodies, functions, globals.
25 virtual ~unparser () {}
27 virtual void emit_common_header () = 0;
30 // #define MAXNESTING nnn
31 // #define MAXCONCURRENCY mmm
32 // #define MAXSTRINGLEN ooo
34 // enum session_state_t {
35 // starting, begin, running, suspended, errored, ending, ended
37 // static atomic_t session_state;
40 // unsigned errorcount;
43 // } context [MAXCONCURRENCY];
46 virtual void emit_global (vardecl
* v
) = 0;
47 // TYPE s_NAME; // NAME is prefixed with "s_" to avoid kernel id collisions
48 // rwlock_t s_NAME_lock;
50 virtual void emit_global_init (vardecl
* v
) = 0;
54 virtual void emit_global_init_type (vardecl
* v
) = 0;
58 // }; // variation of the above for dyninst static-initialization
60 virtual void emit_global_param (vardecl
* v
) = 0; // for kernel
61 // module_param_... -- at end of file
63 virtual void emit_global_init_setters () = 0; // for dyninst
64 // int stp_global_setter (const char *name, const char *value);
65 // -- at end of file; returns -EINVAL on error
67 virtual void emit_functionsig (functiondecl
* v
) = 0;
68 // static void function_NAME (context* c);
70 virtual void emit_kernel_module_init () = 0;
71 virtual void emit_kernel_module_exit () = 0;
72 // kernel module startup, shutdown
74 virtual void emit_module_init () = 0;
75 virtual void emit_module_refresh () = 0;
76 virtual void emit_module_exit () = 0;
77 // startup, probe refresh/activation, shutdown
79 virtual void emit_function (functiondecl
* v
) = 0;
80 // void function_NAME (struct context* c) {
84 virtual void emit_probe (derived_probe
* v
) = 0;
85 // void probe_NUMBER (struct context* c) {
89 // ... then call over to the derived_probe's emit_probe_entries() fn
91 // The following helper functions must be used by any code-generation
92 // infrastructure outside this file to properly mangle identifiers
93 // appearing in the final code:
94 virtual std::string
c_localname (const std::string
& e
, bool mangle_oldstyle
= false) = 0;
95 virtual std::string
c_globalname (const std::string
&e
) = 0;
96 virtual std::string
c_funcname (const std::string
&e
) = 0;
100 // Preparation done before checking the script cache, especially
101 // anything that might affect the hashed name.
102 int prepare_translate_pass (systemtap_session
& s
);
104 int translate_pass (systemtap_session
& s
);
106 #endif // TRANSLATE_H
108 /* vim: set sw=2 ts=8 cino=>4,n-2,{2,^-2,t0,(0,u0,w1,M1 : */
This page took 0.039673 seconds and 5 git commands to generate.