Files
binutils-gdb/gold/debug.h
Cary Coutant f0c3f9ad7b Add gold support for two-level line tables.
2015-01-30  Cary Coutant  <ccoutant@google.com>

elfcpp/
	* dwarf.h (enum DW_LNS): Add experimental two-level line table opcodes.
	(enum DW_LNCT): New enum for DWARF-5.

gold/
	* debug.h (DEBUG_LOCATION): New constant.
	(debug_string_to_enum): Add DEBUG_LOCATION.
	* dwarf_reader.cc (struct LineStateMachine): Add context field.
	(ResetLineStateMachine): Likewise.
	(Sized_dwarf_line_info::Sized_dwarf_line_info): Add support for
	two-level line tables.
	(Sized_dwarf_line_info::read_header_prolog): Likewise. Also add
	support for DWARF-3+ line tables.
	(Sized_dwarf_line_info::read_header_tables_v5): New method.
	(Sized_dwarf_line_info::process_one_opcode): Add support for two-level
	line tables.
	(Sized_dwarf_line_info::read_lines): Likewise.
	(Sized_dwarf_line_info::read_line_mappings): Likewise.
	(Sized_dwarf_line_info::do_addr2line): Add debug output.
	* dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
	Delete str_buffer_start_.
	(DWARF5_EXPERIMENTAL_LINE_TABLE): New constant.
	(Sized_dwarf_line_info::read_header_tables_v5): New method.
	(Sized_dwarf_line_info::read_lines): Update prototype.
	(Sized_dwarf_line_info::process_one_opcode): Likewise.
	(Sized_dwarf_line_info::max_ops_per_insn): New data member.
	(Sized_dwarf_line_info::str_buffer_): New data member.
	(Sized_dwarf_line_info::str_buffer_end_): New data member.
	(Sized_dwarf_line_info::str_buffer_start_): New data member.
	(Sized_dwarf_line_info::end_of_header_length_): New data member.
	(Sized_dwarf_line_info::logicals_start_): New data member.
	(Sized_dwarf_line_info::actuals_start_): New data member.
	(Sized_dwarf_line_info::end_of_unit_): New data member.
2015-02-22 23:43:57 -08:00

84 lines
2.4 KiB
C++

// debug.h -- gold internal debugging support -*- C++ -*-
// Copyright (C) 2007-2015 Free Software Foundation, Inc.
// Written by Ian Lance Taylor <iant@google.com>.
// This file is part of gold.
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 3 of the License, or
// (at your option) any later version.
// This program 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 a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
// MA 02110-1301, USA.
#ifndef GOLD_DEBUG_H
#define GOLD_DEBUG_H
#include <cstring>
#include "parameters.h"
#include "errors.h"
namespace gold
{
// The different types of debugging we support. These are bitflags.
const int DEBUG_TASK = 0x1;
const int DEBUG_SCRIPT = 0x2;
const int DEBUG_FILES = 0x4;
const int DEBUG_RELAXATION = 0x8;
const int DEBUG_INCREMENTAL = 0x10;
const int DEBUG_LOCATION = 0x20;
const int DEBUG_ALL = (DEBUG_TASK | DEBUG_SCRIPT | DEBUG_FILES
| DEBUG_RELAXATION | DEBUG_INCREMENTAL
| DEBUG_LOCATION);
// Convert a debug string to the appropriate enum.
inline int
debug_string_to_enum(const char* arg)
{
static const struct { const char* name; int value; }
debug_options[] =
{
{ "task", DEBUG_TASK },
{ "script", DEBUG_SCRIPT },
{ "files", DEBUG_FILES },
{ "relaxation", DEBUG_RELAXATION },
{ "incremental", DEBUG_INCREMENTAL },
{ "location", DEBUG_LOCATION },
{ "all", DEBUG_ALL }
};
int retval = 0;
for (size_t i = 0; i < sizeof(debug_options) / sizeof(*debug_options); ++i)
if (strstr(arg, debug_options[i].name))
retval |= debug_options[i].value;
return retval;
}
// Print a debug message if TYPE is enabled. This is a macro so that
// we only evaluate the arguments if necessary.
#define gold_debug(TYPE, FORMAT, ...) \
do \
{ \
if (is_debugging_enabled(TYPE)) \
parameters->errors()->debug(FORMAT, __VA_ARGS__); \
} \
while (0)
} // End namespace gold.
#endif // !defined(GOLD_DEBUG_H)