• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
2 // -*- mode: C++ -*-
3 //
4 // Copyright 2022 Google LLC
5 //
6 // Licensed under the Apache License v2.0 with LLVM Exceptions (the
7 // "License"); you may not use this file except in compliance with the
8 // License.  You may obtain a copy of the License at
9 //
10 //     https://llvm.org/LICENSE.txt
11 //
12 // Unless required by applicable law or agreed to in writing, software
13 // distributed under the License is distributed on an "AS IS" BASIS,
14 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 // See the License for the specific language governing permissions and
16 // limitations under the License.
17 //
18 // Author: Aleksei Vetrov
19 
20 #ifndef STG_DWARF_PROCESSOR_H_
21 #define STG_DWARF_PROCESSOR_H_
22 
23 #include <cstddef>
24 #include <optional>
25 #include <string>
26 #include <vector>
27 
28 #include "dwarf_wrappers.h"
29 #include "filter.h"
30 #include "graph.h"
31 
32 namespace stg {
33 namespace dwarf {
34 
35 struct Types {
36   struct Symbol {
37     std::string name;
38     std::optional<std::string> linkage_name;
39     Address address;
40     Id id;
41   };
42 
43   size_t processed_entries = 0;
44   // Container for all named type IDs allocated during DWARF processing.
45   std::vector<Id> named_type_ids;
46   std::vector<Symbol> symbols;
47 };
48 
49 // Process every compilation unit from DWARF and returns processed STG along
50 // with information needed for matching to ELF symbols.
51 Types Process(Handler& dwarf, bool is_little_endian_binary,
52               const std::unique_ptr<Filter>& file_filter, Graph& graph);
53 
54 }  // namespace dwarf
55 }  // namespace stg
56 
57 #endif  // STG_DWARF_PROCESSOR_H_
58