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 |
11 | |
12 | #include "lldb/lldb-enumerations.h" |
13 | #include "lldb/lldb-types.h" |
14 | |
15 | #include <cstddef> |
16 | #include <cstdint> |
17 | |
18 | namespace lldb_private { |
19 | class ; |
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 | /// \param[in] exe_scope |
80 | /// If provided, this will be used to lookup language specific |
81 | /// information, address information and memory tags. |
82 | /// (if they are requested by the other options) |
83 | /// |
84 | /// \param[in] show_memory_tags |
85 | /// If exe_scope and base_addr are valid, include memory tags |
86 | /// in the output. This does not apply to certain formats. |
87 | /// |
88 | /// \return |
89 | /// The offset at which dumping ended. |
90 | lldb::offset_t |
91 | (const DataExtractor &DE, Stream *s, lldb::offset_t offset, |
92 | lldb::Format item_format, size_t item_byte_size, |
93 | size_t item_count, size_t num_per_line, uint64_t base_addr, |
94 | uint32_t item_bit_size, uint32_t item_bit_offset, |
95 | ExecutionContextScope *exe_scope = nullptr, |
96 | bool show_memory_tags = false); |
97 | |
98 | void DumpHexBytes(Stream *s, const void *src, size_t src_len, |
99 | uint32_t bytes_per_line, lldb::addr_t base_addr); |
100 | } |
101 | |
102 | #endif |
103 | |