summaryrefslogtreecommitdiff
path: root/libdw/c++/edit-values.cc
blob: ca83a967ddc73d5a6acbfa94bb8dfac2e7517d34 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/* elfutils::dwarf_edit attribute value interfaces.
   Copyright (C) 2009-2010 Red Hat, Inc.
   This file is part of elfutils.

   This file is free software; you can redistribute it and/or modify
   it under the terms of either

     * the GNU Lesser General Public License as published by the Free
       Software Foundation; either version 3 of the License, or (at
       your option) any later version

   or

     * the GNU General Public License as published by the Free
       Software Foundation; either version 2 of the License, or (at
       your option) any later version

   or both in parallel, as here.

   elfutils is distributed in the hope that it will be useful, but
   WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   General Public License for more details.

   You should have received copies of the GNU General Public License and
   the GNU Lesser General Public License along with this program.  If
   not, see <http://www.gnu.org/licenses/>.  */

#include <config.h>
#include "dwarf_edit"
#include "data-values.hh"

using namespace elfutils;

// Explicit instantiations.
template class dwarf_data::line_entry<dwarf_edit::source_file>;
template class dwarf_data::line_table<dwarf_edit::line_entry>;
template class dwarf_data::line_info_table<dwarf_edit::line_table>;
template class dwarf_data::attr_value<dwarf_edit>;
template class dwarf_data::value<dwarf_edit>;

template<>
std::string
elfutils::to_string<dwarf_edit::attribute> (const dwarf_edit::attribute &attr)
{
  return attribute_string (attr);
}

namespace elfutils
{
  template<>
  std::string to_string (const dwarf_edit::debug_info_entry &die)
  {
    return die_string (die);
  }
};

std::string
dwarf_data::source_file::to_string () const
{
  if (likely (_m_mtime == 0) && likely (_m_size == 0))
    return "\"" + _m_name + "\"";

  std::ostringstream os;
  os << "{\"" << _m_name << "," << _m_mtime << "," << _m_size << "}";
  return os.str ();
}