1 /**************************************************************************
3 * Copyright 2010 VMware, Inc.
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights
9 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 * copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24 **************************************************************************/
26 #ifndef _TRACE_PARSER_HPP_
27 #define _TRACE_PARSER_HPP_
34 #include "trace_format.hpp"
35 #include "trace_model.hpp"
46 typedef std::list<Call *> CallList;
49 typedef std::vector<Call::Signature *> FunctionMap;
50 FunctionMap functions;
52 typedef std::vector<Struct::Signature *> StructMap;
55 typedef std::vector<Enum::Signature *> EnumMap;
58 typedef std::vector<Bitmask::Signature *> BitmaskMap;
61 unsigned next_call_no;
64 unsigned long long version;
70 bool open(const char *filename);
74 Call *parse_call(void);
77 void parse_enter(void);
79 Call *parse_leave(void);
81 bool parse_call_details(Call *call);
83 void parse_arg(Call *call);
85 Value *parse_value(void);
93 Value *parse_double();
95 Value *parse_string();
99 Value *parse_bitmask();
101 Value *parse_array(void);
103 Value *parse_blob(void);
105 Value *parse_struct();
107 Value *parse_opaque();
109 std::string read_string(void);
111 unsigned long long read_uint(void);
113 inline int read_byte(void);
117 } /* namespace Trace */
119 #endif /* _TRACE_PARSER_HPP_ */