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