#include <string.h>
#include <inttypes.h>
-
namespace
{
template <class X>
}
}
+std::string
+range_fmt (uint64_t start, uint64_t end)
+{
+ std::ostringstream os;
+ os << std::hex << "[0x" << start << ", 0x" << end << ")";
+ return os.str ();
+}
+
+char *
+range_fmt (char *buf, size_t buf_size, uint64_t start, uint64_t end)
+{
+ std::string s = range_fmt (start, end);
+ strncpy (buf, s.c_str (), buf_size);
+ return buf;
+}
+
bool
coverage_is_overlap (struct coverage const *cov,
uint64_t start, uint64_t length)
#endif
};
+char *range_fmt (char *buf, size_t buf_size,
+ uint64_t start, uint64_t end);
+
struct coverage *coverage_clone (struct coverage const *cov)
__attribute__ ((malloc));
void coverage_free (struct coverage *cov);
#include <sstream>
#include "dwarflint-coverage.h"
+std::string range_fmt (uint64_t start, uint64_t end);
+
namespace cov
{
class _format_base
{
if (_m_seen)
_m_os << _m_delim;
- _m_os << "[" << start << ", " << start + length << ")";
+ _m_os << range_fmt (start, start + length);
_m_seen = true;
return true;
}
delete hlctx;
}
-std::string
-range_fmt (uint64_t start, uint64_t end)
-{
- char buf[128];
- return std::string (range_fmt (buf, sizeof buf, start, end));
-}
-
static const expected_at_map expected_at;
//static const expected_children_map expected_children;
va_end (ap);
}
-char *
-range_fmt (char *buf, size_t buf_size, uint64_t start, uint64_t end)
-{
- snprintf (buf, buf_size, "[%#" PRIx64 ", %#" PRIx64 ")", start, end);
- return buf;
-}
-
void
wr_format_padding_message (enum message_category category,
struct where *wh,
struct where *wh,
uint64_t start, uint64_t end);
- extern char *range_fmt (char *buf, size_t buf_size, uint64_t start, uint64_t end);
-
struct relocation
{
uint64_t offset;
#ifdef __cplusplus
}
-
-extern std::string range_fmt (uint64_t start, uint64_t end);
#endif
#endif/*DWARFLINT_HL_H*/