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