diff options
| author | Petr Machata <[email protected]> | 2011-04-19 12:56:10 +0200 |
|---|---|---|
| committer | Petr Machata <[email protected]> | 2011-04-19 12:56:10 +0200 |
| commit | 8e24ba6ab4a83318dd9db821cb80a1bef934699d (patch) | |
| tree | 766f08a176765965aef43142d9c7ac92544d675c /dwarflint/locus.cc | |
| parent | 6dc33ae6e429195d9852d23ae3953125f8c09061 (diff) | |
dwarflint: where.* -> locus.*, drop locus::next
Diffstat (limited to 'dwarflint/locus.cc')
| -rw-r--r-- | dwarflint/locus.cc | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/dwarflint/locus.cc b/dwarflint/locus.cc new file mode 100644 index 00000000..8109e3c6 --- /dev/null +++ b/dwarflint/locus.cc @@ -0,0 +1,48 @@ +/* Pedantic checking of DWARF files + Copyright (C) 2008,2009,2010,2011 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat 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 a copy of the GNU General Public License along + with Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#include "locus.hh" +#include "section_id.hh" +#include <sstream> + +std::string +format_simple_locus (char const *(*N) (), + void (*F) (std::ostream &, uint64_t), + bool brief, + section_id sec, + uint64_t off) +{ + std::stringstream ss; + if (!brief) + ss << section_name[sec]; + if (off != (uint64_t)-1) + { + if (!brief) + ss << ": "; + ss << N() << " "; + F (ss, off); + } + return ss.str (); +} |
