ROSE 0.11.145.147
Hexdump.h
1#ifndef ROSE_BinaryAnalysis_Hexdump_H
2#define ROSE_BinaryAnalysis_Hexdump_H
3#include <featureTests.h>
4#ifdef ROSE_ENABLE_BINARY_ANALYSIS
5
6#include <Rose/BinaryAnalysis/Address.h>
7
8#include <sageContainer.h>
9
10#include <map>
11#include <ostream>
12#include <string>
13#include <stdio.h>
14
15namespace Rose {
16namespace BinaryAnalysis {
17
21 : width(16), colsize(8), multiline(false), show_numeric(true), pad_numeric(true),
22 show_chars(true), pad_chars(false) {}
23
24 /* General settings */
25 std::string prefix;
26 size_t width;
27 size_t colsize;
28 std::string addr_fmt;
29 bool multiline;
31 /* Settings for numeric output of bytes */
33 std::string numeric_fmt;
34 std::map<unsigned char,std::string> numeric_fmt_special;
35 std::string numeric_sep;
38 /* Settings for ASCII output of bytes */
40 bool pad_chars;
41};
42
52void hexdump(std::ostream&, rose_addr_t base_addr, const unsigned char *data, size_t data_sz, const HexdumpFormat&);
53void hexdump(std::ostream&, rose_addr_t base_addr, const std::string &prefix, const SgUnsignedCharList& data, bool multiline=true);
54void hexdump(std::ostream&, rose_addr_t base_addr, const std::string &prefix, const SgFileContentList& data, bool multiline=true);
55
56// Same, but returning a string instead.
57std::string hexdump(rose_addr_t base_addr, const unsigned char *data, size_t data_sz, const HexdumpFormat&);
58std::string hexdump(rose_addr_t base_addr, const std::string &prefix, const SgUnsignedCharList& data, bool multiline=true);
59std::string hexdump(rose_addr_t base_addr, const std::string &prefix, const SgFileContentList& data, bool multiline=true);
60
61// Same, but output to a FILE* instead.
62void hexdump(FILE*, rose_addr_t base_addr, const unsigned char *data, size_t data_sz, const HexdumpFormat&);
63void hexdump(FILE*, rose_addr_t base_addr, const std::string &prefix, const SgUnsignedCharList& data, bool multiline=true);
64void hexdump(FILE*, rose_addr_t base_addr, const std::string &prefix, const SgFileContentList& data, bool multiline=true);
67} // namespace
68} // namespace
69
70#endif
71#endif
void hexdump(std::ostream &, rose_addr_t base_addr, const unsigned char *data, size_t data_sz, const HexdumpFormat &)
Display binary data.
The ROSE library.
Settings that control how the lowest-level hexdump function behaves.
Definition Hexdump.h:19
std::string numeric_sep
String to print between numeric values (default " ").
Definition Hexdump.h:35
std::string prefix
Characters to emit after internal linefeeds.
Definition Hexdump.h:25
std::string addr_fmt
Printf format for addresses (default "0x%08llx: ").
Definition Hexdump.h:28
std::string numeric_fmt
Printf format for bytes (default "%02x").
Definition Hexdump.h:33
bool pad_numeric
Pad numeric part of output with spaces for partial final line (default true).
Definition Hexdump.h:36
bool show_numeric
Show numeric format of bytes (default true).
Definition Hexdump.h:32
std::map< unsigned char, std::string > numeric_fmt_special
Special formatting for certain values.
Definition Hexdump.h:34
size_t colsize
Bytes per column group (default 8).
Definition Hexdump.h:27
bool show_chars
Show ASCII characters after bytes (default true).
Definition Hexdump.h:39
bool pad_chars
Pad character part of output with spaces for partial final line (default true).
Definition Hexdump.h:40
size_t width
Bytes per line of output (default 16).
Definition Hexdump.h:26
bool multiline
Emit prefix at beginning and line feed at end of output.
Definition Hexdump.h:29