]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm-project/lldb/include/lldb/Core/DumpDataExtractor.h
Move all sources from the llvm project into contrib/llvm-project.
[FreeBSD/FreeBSD.git] / contrib / llvm-project / lldb / include / lldb / Core / DumpDataExtractor.h
1 //===-- DumpDataExtractor.h -------------------------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8
9 #ifndef LLDB_CORE_DUMPDATAEXTRACTOR_H
10 #define LLDB_CORE_DUMPDATAEXTRACTOR_H
11
12 #include "lldb/lldb-enumerations.h"
13 #include "lldb/lldb-types.h"
14
15 #include <stddef.h>
16 #include <stdint.h>
17
18 namespace lldb_private {
19 class DataExtractor;
20 class ExecutionContextScope;
21 class Stream;
22
23 /// Dumps \a item_count objects into the stream \a s.
24 ///
25 /// Dumps \a item_count objects using \a item_format, each of which
26 /// are \a item_byte_size bytes long starting at offset \a offset
27 /// bytes into the contained data, into the stream \a s. \a
28 /// num_per_line objects will be dumped on each line before a new
29 /// line will be output. If \a base_addr is a valid address, then
30 /// each new line of output will be preceded by the address value
31 /// plus appropriate offset, and a colon and space. Bitfield values
32 /// can be dumped by calling this function multiple times with the
33 /// same start offset, format and size, yet differing \a
34 /// item_bit_size and \a item_bit_offset values.
35 ///
36 /// \param[in] s
37 ///     The stream to dump the output to. This value can not be nullptr.
38 ///
39 /// \param[in] offset
40 ///     The offset into the data at which to start dumping.
41 ///
42 /// \param[in] item_format
43 ///     The format to use when dumping each item.
44 ///
45 /// \param[in] item_byte_size
46 ///     The byte size of each item.
47 ///
48 /// \param[in] item_count
49 ///     The number of items to dump.
50 ///
51 /// \param[in] num_per_line
52 ///     The number of items to display on each line.
53 ///
54 /// \param[in] base_addr
55 ///     The base address that gets added to the offset displayed on
56 ///     each line if the value is valid. Is \a base_addr is
57 ///     LLDB_INVALID_ADDRESS then no address values will be prepended
58 ///     to any lines.
59 ///
60 /// \param[in] item_bit_size
61 ///     If the value to display is a bitfield, this value should
62 ///     be the number of bits that the bitfield item has within the
63 ///     item's byte size value. This function will need to be called
64 ///     multiple times with identical \a offset and \a item_byte_size
65 ///     values in order to display multiple bitfield values that
66 ///     exist within the same integer value. If the items being
67 ///     displayed are not bitfields, this value should be zero.
68 ///
69 /// \param[in] item_bit_offset
70 ///     If the value to display is a bitfield, this value should
71 ///     be the offset in bits, or shift right amount, that the
72 ///     bitfield item occupies within the item's byte size value.
73 ///     This function will need to be called multiple times with
74 ///     identical \a offset and \a item_byte_size values in order
75 ///     to display multiple bitfield values that exist within the
76 ///     same integer value. If the items being displayed are not
77 ///     bitfields, this value should be zero.
78 ///
79 /// \return
80 ///     The offset at which dumping ended.
81 lldb::offset_t
82 DumpDataExtractor(const DataExtractor &DE, Stream *s, lldb::offset_t offset,
83                   lldb::Format item_format, size_t item_byte_size,
84                   size_t item_count, size_t num_per_line, uint64_t base_addr,
85                   uint32_t item_bit_size, uint32_t item_bit_offset,
86                   ExecutionContextScope *exe_scope = nullptr);
87
88 void DumpHexBytes(Stream *s, const void *src, size_t src_len,
89                   uint32_t bytes_per_line, lldb::addr_t base_addr);
90 }
91
92 #endif