OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <algorithm> | 5 #include <algorithm> |
6 #include <iostream> | 6 #include <iostream> |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 | 11 |
12 // Include once to get the type definitions | 12 // Include once to get the type definitions |
13 #include "tools/ipc_fuzzer/message_lib/all_messages.h" | 13 #include "tools/ipc_fuzzer/message_lib/all_messages.h" |
14 | 14 |
15 struct msginfo { | 15 struct msginfo { |
16 const char* name; | 16 const char* name; |
17 const char* file; | 17 const char* file; |
18 int id; | 18 int id; |
19 int in_count; | |
20 int out_count; | |
21 | 19 |
22 bool operator< (const msginfo& other) const { | 20 bool operator< (const msginfo& other) const { |
23 return id < other.id; | 21 return id < other.id; |
24 } | 22 } |
25 }; | 23 }; |
26 | 24 |
27 // Redefine macros to generate table | 25 // Redefine macros to generate table |
28 #include "tools/ipc_fuzzer/message_lib/all_message_null_macros.h" | 26 #include "tools/ipc_fuzzer/message_lib/all_message_null_macros.h" |
29 #undef IPC_MESSAGE_DECL | 27 #undef IPC_MESSAGE_DECL |
30 #define IPC_MESSAGE_DECL(kind, type, name, in, out, ilist, olist) \ | 28 #define IPC_MESSAGE_DECL(name, ...) \ |
31 { #name, __FILE__, IPC_MESSAGE_ID(), in, out }, | 29 { #name, __FILE__, IPC_MESSAGE_ID() } \ |
| 30 , |
32 | 31 |
33 static msginfo msgtable[] = { | 32 static msginfo msgtable[] = { |
34 #include "tools/ipc_fuzzer/message_lib/all_messages.h" | 33 #include "tools/ipc_fuzzer/message_lib/all_messages.h" |
35 }; | 34 }; |
36 #define MSGTABLE_SIZE (sizeof(msgtable)/sizeof(msgtable[0])) | 35 #define MSGTABLE_SIZE (sizeof(msgtable)/sizeof(msgtable[0])) |
37 static_assert(MSGTABLE_SIZE, "check your headers for an extra semicolon"); | 36 static_assert(MSGTABLE_SIZE, "check your headers for an extra semicolon"); |
38 | 37 |
39 static bool check_msgtable() { | 38 static bool check_msgtable() { |
40 bool result = true; | 39 bool result = true; |
41 int previous_class_id = 0; | 40 int previous_class_id = 0; |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 if (show_comma) { | 133 if (show_comma) { |
135 if (!first) | 134 if (!first) |
136 std::cout << ","; | 135 std::cout << ","; |
137 first = false; | 136 first = false; |
138 std::cout << msgtable[i].id; | 137 std::cout << msgtable[i].id; |
139 } else { | 138 } else { |
140 if (show_ids) | 139 if (show_ids) |
141 std::cout << msgtable[i].id << " " << | 140 std::cout << msgtable[i].id << " " << |
142 IPC_MESSAGE_ID_CLASS(msgtable[i].id) << "," << | 141 IPC_MESSAGE_ID_CLASS(msgtable[i].id) << "," << |
143 IPC_MESSAGE_ID_LINE(msgtable[i].id) << " "; | 142 IPC_MESSAGE_ID_LINE(msgtable[i].id) << " "; |
144 std::cout << msgtable[i].name; | 143 std::cout << msgtable[i].name << "\n"; |
145 if (show_args) { | |
146 std::cout << "(" << msgtable[i].in_count << " IN, " << | |
147 msgtable[i].out_count << " OUT)"; | |
148 } | |
149 std::cout << "\n"; | |
150 } | 144 } |
151 } | 145 } |
152 } | 146 } |
153 if (show_comma) | 147 if (show_comma) |
154 std::cout << "\n"; | 148 std::cout << "\n"; |
155 } | 149 } |
156 | 150 |
157 int main(int argc, char **argv) { | 151 int main(int argc, char **argv) { |
158 bool show_args = false; | 152 bool show_args = false; |
159 bool show_ids = false; | 153 bool show_ids = false; |
(...skipping 23 matching lines...) Expand all Loading... |
183 } | 177 } |
184 | 178 |
185 std::sort(msgtable, msgtable + MSGTABLE_SIZE); | 179 std::sort(msgtable, msgtable + MSGTABLE_SIZE); |
186 | 180 |
187 if (!skip_check && check_msgtable() == false) | 181 if (!skip_check && check_msgtable() == false) |
188 return 1; | 182 return 1; |
189 | 183 |
190 dump_msgtable(show_args, show_ids, show_comma, filter); | 184 dump_msgtable(show_args, show_ids, show_comma, filter); |
191 return 0; | 185 return 0; |
192 } | 186 } |
193 | |
OLD | NEW |