]>
sourceware.org Git - systemtap.git/blob - translate.h
2 // Copyright (C) 2005 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
18 // ------------------------------------------------------------------------
20 // Output context for systemtap translation, intended to allow
22 class translator_output
30 translator_output (std::ostream
& file
);
31 translator_output (const std::string
& filename
, size_t bufsize
= 8192);
32 ~translator_output ();
34 std::ostream
& newline (int indent
= 0);
35 void indent (int indent
= 0);
36 void assert_0_indent () { assert (tablevel
== 0); }
39 std::ostream::pos_type
tellp() { return o
.tellp(); }
40 std::ostream
& seekp(std::ostream::pos_type p
) { return o
.seekp(p
); }
44 // An unparser instance is in charge of emitting code for generic
45 // probe bodies, functions, globals.
48 virtual ~unparser () {}
50 virtual void emit_common_header () = 0;
53 // #define MAXNESTING nnn
54 // #define MAXCONCURRENCY mmm
55 // #define MAXSTRINGLEN ooo
57 // enum session_state_t {
58 // starting, begin, running, suspended, errored, ending, ended
60 // static atomic_t session_state;
63 // unsigned errorcount;
66 // } context [MAXCONCURRENCY];
69 virtual void emit_global (vardecl
* v
) = 0;
70 // TYPE s_NAME; // NAME is prefixed with "s_" to avoid kernel id collisions
71 // rwlock_t s_NAME_lock;
73 virtual void emit_global_init (vardecl
* v
) = 0;
76 virtual void emit_global_param (vardecl
* v
) = 0;
77 // module_param_... -- at end of file
79 virtual void emit_functionsig (functiondecl
* v
) = 0;
80 // static void function_NAME (context* c);
82 virtual void emit_module_init () = 0;
83 virtual void emit_module_exit () = 0;
86 virtual void emit_function (functiondecl
* v
) = 0;
87 // void function_NAME (struct context* c) {
91 virtual void emit_probe (derived_probe
* v
) = 0;
92 // void probe_NUMBER (struct context* c) {
96 // ... then call over to the derived_probe's emit_probe_entries() fn
100 int translate_pass (systemtap_session
& s
);
103 #endif // TRANSLATE_H
105 /* vim: set sw=2 ts=8 cino=>4,n-2,{2,^-2,t0,(0,u0,w1,M1 : */
This page took 0.058895 seconds and 6 git commands to generate.