diff options
author | Doug Kwan <dougkwan@google.com> | 2009-12-09 03:02:28 +0000 |
---|---|---|
committer | Doug Kwan <dougkwan@google.com> | 2009-12-09 03:02:28 +0000 |
commit | 4f7872716e8b73149e9024e1b95db6c3cfa66bd1 (patch) | |
tree | c33f338158eadac574de9434ef24c217bfb2cb08 /gold/reduced_debug_output.cc | |
parent | 829da89821d7f0b7663b8314128fa06878d228e0 (diff) | |
download | binutils-gdb-4f7872716e8b73149e9024e1b95db6c3cfa66bd1.tar.gz |
2009-12-08 Doug Kwan <dougkwan@google.com>
* Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
(HFILES): Add attributes.h and int_encoding.h.
* Makefile.in: Regenerate.
* dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
function definitions to int_encoding.cc
* dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
prototypes to int_encoding.h
* reduced_debug_output.cc (int_encoding.h): New include.
(write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
function definitions to int_encoding.cc
(insert_into_vector, read_from_pointer): Move template definitions to
int_encoding.h
* attributes.cc: New file.
* attributes.h: New file.
* int_encoding.cc: New file.
* int_encoding.h: New file.
Diffstat (limited to 'gold/reduced_debug_output.cc')
-rw-r--r-- | gold/reduced_debug_output.cc | 60 |
1 files changed, 1 insertions, 59 deletions
diff --git a/gold/reduced_debug_output.cc b/gold/reduced_debug_output.cc index 48346943dd5..5bc8053f978 100644 --- a/gold/reduced_debug_output.cc +++ b/gold/reduced_debug_output.cc @@ -27,71 +27,13 @@ #include "dwarf.h" #include "dwarf_reader.h" #include "reduced_debug_output.h" +#include "int_encoding.h" #include <vector> namespace gold { -void -write_unsigned_LEB_128(std::vector<unsigned char>* buffer, uint64_t value) -{ - do - { - unsigned char current_byte = value & 0x7f; - value >>= 7; - if (value != 0) - { - current_byte |= 0x80; - } - buffer->push_back(current_byte); - } - while (value != 0); -} - -size_t -get_length_as_unsigned_LEB_128(uint64_t value) -{ - size_t length = 0; - do - { - unsigned char current_byte = value & 0x7f; - value >>= 7; - if (value != 0) - { - current_byte |= 0x80; - } - length++; - } - while (value != 0); - return length; -} - -template <int valsize> -void insert_into_vector(std::vector<unsigned char>* destination, - typename elfcpp::Valtype_base<valsize>::Valtype value) -{ - unsigned char buffer[valsize / 8]; - if (parameters->target().is_big_endian()) - elfcpp::Swap_unaligned<valsize, true>::writeval(buffer, value); - else - elfcpp::Swap_unaligned<valsize, false>::writeval(buffer, value); - destination->insert(destination->end(), buffer, buffer + valsize / 8); -} - -template <int valsize> -typename elfcpp::Valtype_base<valsize>::Valtype -read_from_pointer(unsigned char** source) -{ - typename elfcpp::Valtype_base<valsize>::Valtype return_value; - if (parameters->target().is_big_endian()) - return_value = elfcpp::Swap_unaligned<valsize, true>::readval(*source); - else - return_value = elfcpp::Swap_unaligned<valsize, false>::readval(*source); - *source += valsize / 8; - return return_value; -} - // Given a pointer to the beginning of a die and the beginning of the associated // abbreviation fills in die_end with the end of the information entry. If // successful returns true. Get_die_end also takes a pointer to the end of the |