Where Online Learning is simpler!
The C and C++ Include Header Files
cat -n /usr/include/wabt/binary-reader-objdump.h
1 /* 2 * Copyright 2016 WebAssembly Community Group participants 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #ifndef WABT_BINARY_READER_OBJDUMP_H_ 18 #define WABT_BINARY_READER_OBJDUMP_H_ 19 20 #include <map> 21 #include <string> 22 23 #include "wabt/common.h" 24 #include "wabt/feature.h" 25 #include "wabt/stream.h" 26 27 namespace wabt { 28 29 struct Module; 30 struct ReadBinaryOptions; 31 32 enum class ObjdumpMode { 33 Prepass, 34 Headers, 35 Details, 36 Disassemble, 37 RawData, 38 }; 39 40 struct ObjdumpOptions { 41 Stream* log_stream; 42 bool headers; 43 bool details; 44 bool raw; 45 bool disassemble; 46 bool debug; 47 bool relocs; 48 bool section_offsets; 49 ObjdumpMode mode; 50 const char* filename; 51 const char* section_name; 52 }; 53 54 struct ObjdumpSymbol { 55 wabt::SymbolType kind; 56 std::string name; 57 Index index; 58 }; 59 60 struct ObjdumpNames { 61 std::string_view Get(Index index) const; 62 void Set(Index index, std::string_view name); 63 64 std::map<Index, std::string> names; 65 }; 66 67 struct ObjdumpLocalNames { 68 std::string_view Get(Index function_index, Index local_index) const; 69 void Set(Index function_index, Index local_index, std::string_view name); 70 71 std::map<std::pair<Index, Index>, std::string> names; 72 }; 73 74 // read_binary_objdump uses this state to store information from previous runs 75 // and use it to display more useful information. 76 struct ObjdumpState { 77 std::vector<Reloc> code_relocations; 78 std::vector<Reloc> data_relocations; 79 ObjdumpNames type_names; 80 ObjdumpNames function_names; 81 ObjdumpNames global_names; 82 ObjdumpNames section_names; 83 ObjdumpNames tag_names; 84 ObjdumpNames segment_names; 85 ObjdumpNames table_names; 86 ObjdumpLocalNames local_names; 87 std::vector<ObjdumpSymbol> symtab; 88 std::map<Index, Index> function_param_counts; 89 std::map<Index, Index> function_types; 90 }; 91 92 Result ReadBinaryObjdump(const uint8_t* data, 93 size_t size, 94 ObjdumpOptions* options, 95 ObjdumpState* state); 96 97 } // namespace wabt 98 99 #endif /* WABT_BINARY_READER_OBJDUMP_H_ */