OpenCores
URL https://opencores.org/ocsvn/open8_urisc/open8_urisc/trunk

Subversion Repositories open8_urisc

[/] [open8_urisc/] [trunk/] [gnu/] [binutils/] [gold/] [reduced_debug_output.h] - Blame information for rev 196

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 27 khays
// reduced_debug_output.h -- reduce debugging information  -*- C++ -*-
2
 
3
// Copyright 2008 Free Software Foundation, Inc.
4
// Written by Caleb Howe <cshowe@google.com>.
5
 
6
// This file is part of gold.
7
 
8
// This program is free software; you can redistribute it and/or modify
9
// it under the terms of the GNU General Public License as published by
10
// the Free Software Foundation; either version 3 of the License, or
11
// (at your option) any later version.
12
 
13
// This program is distributed in the hope that it will be useful,
14
// but WITHOUT ANY WARRANTY; without even the implied warranty of
15
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
// GNU General Public License for more details.
17
 
18
// You should have received a copy of the GNU General Public License
19
// along with this program; if not, write to the Free Software
20
// Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
21
// MA 02110-1301, USA.
22
 
23
// Reduce the size of the debug sections by emitting only debug line number
24
// information.  We still need to emit skeleton debug_info and debug_abbrev
25
// sections for standard tools to parse the debug information correctly.  These
26
// classes remove all debug information entries from the .debug_info section
27
// except for those describing compilation units as these DIEs contain
28
// references to the debug line information needed by most parsers.
29
 
30
#ifndef GOLD_REDUCED_DEBUG_OUTPUT_H
31
#define GOLD_REDUCED_DEBUG_OUTPUT_H
32
 
33
#include <map>
34
#include <utility>
35
#include <vector>
36
 
37
#include "output.h"
38
 
39
namespace gold
40
{
41
 
42
class Output_reduced_debug_abbrev_section : public Output_section
43
{
44
 public:
45
  Output_reduced_debug_abbrev_section(const char* name, elfcpp::Elf_Word flags,
46
                                      elfcpp::Elf_Xword type)
47
    : Output_section(name, flags, type), sized_(false),
48
      abbrev_count_(0), failed_(false)
49
  { this->set_requires_postprocessing(); }
50
 
51
  unsigned char* get_new_abbrev(uint64_t* abbrev_number,
52
                                uint64_t abbrev_offset);
53
 
54
 protected:
55
  // Set the final data size.
56
  void
57
  set_final_data_size();
58
 
59
  // Write out the new debug abbreviations
60
  void
61
  do_write(Output_file*);
62
 
63
 private:
64
  void
65
  failed(std::string reason)
66
  {
67
    gold_warning("%s", reason.c_str());
68
    failed_ = true;
69
  }
70
 
71
  // The reduced debug abbreviations
72
  std::vector<unsigned char> data_;
73
 
74
  // We map the abbreviation table offset and abbreviation number of the
75
  // old abbreviation to the number and size of the new abbreviation.
76
  std::map<std::pair<uint64_t, uint64_t>,
77
           std::pair<uint64_t, uint64_t> > abbrev_mapping_;
78
 
79
  bool sized_;
80
 
81
  // The count of abbreviations in the output data
82
  int abbrev_count_;
83
 
84
  // Whether or not the debug reduction has failed for any reason
85
  bool failed_;
86
};
87
 
88
class Output_reduced_debug_info_section : public Output_section
89
{
90
 public:
91
  Output_reduced_debug_info_section(const char* name, elfcpp::Elf_Word flags,
92
                                    elfcpp::Elf_Xword type)
93
    : Output_section(name, flags, type), failed_(false)
94
  { this->set_requires_postprocessing(); }
95
 
96
  void
97
  set_abbreviations(Output_reduced_debug_abbrev_section* abbrevs)
98
  { associated_abbrev_ = abbrevs; }
99
 
100
 protected:
101
  // Set the final data size.
102
  void
103
  set_final_data_size();
104
 
105
  // Write out the new debug info
106
  void
107
  do_write(Output_file*);
108
 
109
 private:
110
  void
111
  failed(std::string reason)
112
  {
113
    gold_warning("%s", reason.c_str());
114
    this->failed_ = true;
115
  }
116
 
117
  // Given a pointer to the beginning of a die and the beginning of the
118
  // associated abbreviation fills in die_end with the end of the information
119
  // entry.  If successful returns true.  Get_die_end also takes a pointer to
120
  // the end of the buffer containing the die. If die_end would be beyond the
121
  // end of the buffer, or if an unsupported dwarf form is encountered returns
122
  // false.
123
  bool
124
  get_die_end(unsigned char* die, unsigned char* abbrev,
125
              unsigned char** die_end, unsigned char* buffer_end,
126
              int address_size, bool is64);
127
 
128
  // The reduced debug info
129
  std::vector<unsigned char> data_;
130
 
131
  // Each debug info section needs to be associated with a debug abbrev section
132
  Output_reduced_debug_abbrev_section* associated_abbrev_;
133
 
134
  // Whether or not the debug reduction has failed for any reason
135
  bool failed_;
136
};
137
 
138
} // End namespace gold.
139
 
140
#endif // !defined(GOLD_REDUCED_DEBUG_OUTPUT_H)

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.