1//===-- DataExtractor.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 liblldb_DataExtractor_h_ 11#define liblldb_DataExtractor_h_ 12 13// C Includes 14#include <limits.h> 15#include <stdint.h> 16#include <string.h> 17 18// C++ Includes 19// Other libraries and framework includes 20#include "llvm/ADT/SmallVector.h" 21 22// Project includes 23#include "lldb/lldb-private.h" 24 25namespace lldb_private { 26 27//---------------------------------------------------------------------- 28/// @class DataExtractor DataExtractor.h "lldb/Core/DataExtractor.h" 29/// @brief An data extractor class. 30/// 31/// DataExtractor is a class that can extract data (swapping if needed) 32/// from a data buffer. The data buffer can be caller owned, or can be 33/// shared data that can be shared between multiple DataExtractor 34/// instances. Multiple DataExtractor objects can share the same data, 35/// yet extract values in different address sizes and byte order modes. 36/// Each object can have a unique position in the shared data and extract 37/// data from different offsets. 38/// 39/// @see DataBuffer 40//---------------------------------------------------------------------- 41class DataExtractor 42{ 43public: 44 //------------------------------------------------------------------ 45 /// @typedef DataExtractor::Type 46 /// @brief Type enumerations used in the dump routines. 47 /// @see DataExtractor::Dump() 48 /// @see DataExtractor::DumpRawHexBytes() 49 //------------------------------------------------------------------ 50 typedef enum 51 { 52 TypeUInt8, ///< Format output as unsigned 8 bit integers 53 TypeChar, ///< Format output as characters 54 TypeUInt16, ///< Format output as unsigned 16 bit integers 55 TypeUInt32, ///< Format output as unsigned 32 bit integers 56 TypeUInt64, ///< Format output as unsigned 64 bit integers 57 TypePointer, ///< Format output as pointers 58 TypeULEB128, ///< Format output as ULEB128 numbers 59 TypeSLEB128 ///< Format output as SLEB128 numbers 60 } Type; 61 62 static void 63 DumpHexBytes (Stream *s, 64 const void *src, 65 size_t src_len, 66 uint32_t bytes_per_line, 67 lldb::addr_t base_addr); // Pass LLDB_INVALID_ADDRESS to not show address at start of line 68 69 //------------------------------------------------------------------ 70 /// Default constructor. 71 /// 72 /// Initialize all members to a default empty state. 73 //------------------------------------------------------------------ 74 DataExtractor (); 75 76 //------------------------------------------------------------------ 77 /// Construct with a buffer that is owned by the caller. 78 /// 79 /// This constructor allows us to use data that is owned by the 80 /// caller. The data must stay around as long as this object is 81 /// valid. 82 /// 83 /// @param[in] data 84 /// A pointer to caller owned data. 85 /// 86 /// @param[in] data_length 87 /// The length in bytes of \a data. 88 /// 89 /// @param[in] byte_order 90 /// A byte order of the data that we are extracting from. 91 /// 92 /// @param[in] addr_size 93 /// A new address byte size value. 94 /// 95 /// @param[in] target_byte_size 96 /// A size of a target byte in 8-bit host bytes 97 //------------------------------------------------------------------ 98 DataExtractor (const void* data, lldb::offset_t data_length, lldb::ByteOrder byte_order, uint32_t addr_size, uint32_t target_byte_size = 1); 99 100 //------------------------------------------------------------------ 101 /// Construct with shared data. 102 /// 103 /// Copies the data shared pointer which adds a reference to the 104 /// contained in \a data_sp. The shared data reference is reference 105 /// counted to ensure the data lives as long as anyone still has a 106 /// valid shared pointer to the data in \a data_sp. 107 /// 108 /// @param[in] data_sp 109 /// A shared pointer to data. 110 /// 111 /// @param[in] byte_order 112 /// A byte order of the data that we are extracting from. 113 /// 114 /// @param[in] addr_size 115 /// A new address byte size value. 116 /// 117 /// @param[in] target_byte_size 118 /// A size of a target byte in 8-bit host bytes 119 //------------------------------------------------------------------ 120 DataExtractor (const lldb::DataBufferSP& data_sp, lldb::ByteOrder byte_order, uint32_t addr_size, uint32_t target_byte_size = 1); 121 122 //------------------------------------------------------------------ 123 /// Construct with a subset of \a data. 124 /// 125 /// Initialize this object with a subset of the data bytes in \a 126 /// data. If \a data contains shared data, then a reference to the 127 /// shared data will be added to ensure the shared data stays around 128 /// as long as any objects have references to the shared data. The 129 /// byte order value and the address size settings are copied from \a 130 /// data. If \a offset is not a valid offset in \a data, then no 131 /// reference to the shared data will be added. If there are not 132 /// \a length bytes available in \a data starting at \a offset, 133 /// the length will be truncated to contain as many bytes as 134 /// possible. 135 /// 136 /// @param[in] data 137 /// Another DataExtractor object that contains data. 138 /// 139 /// @param[in] offset 140 /// The offset into \a data at which the subset starts. 141 /// 142 /// @param[in] length 143 /// The length in bytes of the subset of data. 144 /// 145 /// @param[in] target_byte_size 146 /// A size of a target byte in 8-bit host bytes 147 //------------------------------------------------------------------ 148 DataExtractor (const DataExtractor& data, lldb::offset_t offset, lldb::offset_t length, uint32_t target_byte_size = 1); 149 150 DataExtractor (const DataExtractor& rhs); 151 152 //------------------------------------------------------------------ 153 /// Assignment operator. 154 /// 155 /// Copies all data, byte order and address size settings from \a rhs into 156 /// this object. If \a rhs contains shared data, a reference to that 157 /// shared data will be added. 158 /// 159 /// @param[in] rhs 160 /// Another DataExtractor object to copy. 161 /// 162 /// @return 163 /// A const reference to this object. 164 //------------------------------------------------------------------ 165 const DataExtractor& 166 operator= (const DataExtractor& rhs); 167 168 //------------------------------------------------------------------ 169 /// Destructor 170 /// 171 /// If this object contains a valid shared data reference, the 172 /// reference count on the data will be decremented, and if zero, 173 /// the data will be freed. 174 //------------------------------------------------------------------ 175 ~DataExtractor (); 176 177 //------------------------------------------------------------------ 178 /// Clears the object state. 179 /// 180 /// Clears the object contents back to a default invalid state, and 181 /// release any references to shared data that this object may 182 /// contain. 183 //------------------------------------------------------------------ 184 void 185 Clear (); 186 187 //------------------------------------------------------------------ 188 /// Dumps the binary data as \a type objects to stream \a s (or to 189 /// Log() if \a s is nullptr) starting \a offset bytes into the data 190 /// and stopping after dumping \a length bytes. The offset into the 191 /// data is displayed at the beginning of each line and can be 192 /// offset by base address \a base_addr. \a num_per_line objects 193 /// will be displayed on each line. 194 /// 195 /// @param[in] s 196 /// The stream to dump the output to. If nullptr the output will 197 /// be dumped to Log(). 198 /// 199 /// @param[in] offset 200 /// The offset into the data at which to start dumping. 201 /// 202 /// @param[in] length 203 /// The number of bytes to dump. 204 /// 205 /// @param[in] base_addr 206 /// The base address that gets added to the offset displayed on 207 /// each line. 208 /// 209 /// @param[in] num_per_line 210 /// The number of \a type objects to display on each line. 211 /// 212 /// @param[in] type 213 /// The type of objects to use when dumping data from this 214 /// object. See DataExtractor::Type. 215 /// 216 /// @param[in] type_format 217 /// The optional format to use for the \a type objects. If this 218 /// is nullptr, the default format for the \a type will be used. 219 /// 220 /// @return 221 /// The offset at which dumping ended. 222 //------------------------------------------------------------------ 223 lldb::offset_t 224 PutToLog(Log *log, 225 lldb::offset_t offset, 226 lldb::offset_t length, 227 uint64_t base_addr, 228 uint32_t num_per_line, 229 Type type, 230 const char *type_format = nullptr) const; 231 232 //------------------------------------------------------------------ 233 /// Dumps \a item_count objects into the stream \a s. 234 /// 235 /// Dumps \a item_count objects using \a item_format, each of which 236 /// are \a item_byte_size bytes long starting at offset \a offset 237 /// bytes into the contained data, into the stream \a s. \a 238 /// num_per_line objects will be dumped on each line before a new 239 /// line will be output. If \a base_addr is a valid address, then 240 /// each new line of output will be preceded by the address value 241 /// plus appropriate offset, and a colon and space. Bitfield values 242 /// can be dumped by calling this function multiple times with the 243 /// same start offset, format and size, yet differing \a 244 /// item_bit_size and \a item_bit_offset values. 245 /// 246 /// @param[in] s 247 /// The stream to dump the output to. This value can not be nullptr. 248 /// 249 /// @param[in] offset 250 /// The offset into the data at which to start dumping. 251 /// 252 /// @param[in] item_format 253 /// The format to use when dumping each item. 254 /// 255 /// @param[in] item_byte_size 256 /// The byte size of each item. 257 /// 258 /// @param[in] item_count 259 /// The number of items to dump. 260 /// 261 /// @param[in] num_per_line 262 /// The number of items to display on each line. 263 /// 264 /// @param[in] base_addr 265 /// The base address that gets added to the offset displayed on 266 /// each line if the value is valid. Is \a base_addr is 267 /// LLDB_INVALID_ADDRESS then no address values will be prepended 268 /// to any lines. 269 /// 270 /// @param[in] item_bit_size 271 /// If the value to display is a bitfield, this value should 272 /// be the number of bits that the bitfield item has within the 273 /// item's byte size value. This function will need to be called 274 /// multiple times with identical \a offset and \a item_byte_size 275 /// values in order to display multiple bitfield values that 276 /// exist within the same integer value. If the items being 277 /// displayed are not bitfields, this value should be zero. 278 /// 279 /// @param[in] item_bit_offset 280 /// If the value to display is a bitfield, this value should 281 /// be the offset in bits, or shift right amount, that the 282 /// bitfield item occupies within the item's byte size value. 283 /// This function will need to be called multiple times with 284 /// identical \a offset and \a item_byte_size values in order 285 /// to display multiple bitfield values that exist within the 286 /// same integer value. If the items being displayed are not 287 /// bitfields, this value should be zero. 288 /// 289 /// @return 290 /// The offset at which dumping ended. 291 //------------------------------------------------------------------ 292 lldb::offset_t 293 Dump(Stream *s, 294 lldb::offset_t offset, 295 lldb::Format item_format, 296 size_t item_byte_size, 297 size_t item_count, 298 size_t num_per_line, 299 uint64_t base_addr, 300 uint32_t item_bit_size, 301 uint32_t item_bit_offset, 302 ExecutionContextScope *exe_scope = nullptr) const; 303 304 //------------------------------------------------------------------ 305 /// Dump a UUID value at \a offset. 306 /// 307 /// Dump a UUID starting at \a offset bytes into this object's data. 308 /// If the stream \a s is nullptr, the output will be sent to Log(). 309 /// 310 /// @param[in] s 311 /// The stream to dump the output to. If nullptr the output will 312 /// be dumped to Log(). 313 /// 314 /// @param[in] offset 315 /// The offset into the data at which to extract and dump a 316 /// UUID value. 317 //------------------------------------------------------------------ 318 void 319 DumpUUID (Stream *s, lldb::offset_t offset) const; 320 321 //------------------------------------------------------------------ 322 /// Extract an arbitrary number of bytes in the specified byte 323 /// order. 324 /// 325 /// Attemps to extract \a length bytes starting at \a offset bytes 326 /// into this data in the requested byte order (\a dst_byte_order) 327 /// and place the results in \a dst. \a dst must be at least \a 328 /// length bytes long. 329 /// 330 /// @param[in] offset 331 /// The offset in bytes into the contained data at which to 332 /// start extracting. 333 /// 334 /// @param[in] length 335 /// The number of bytes to extract. 336 /// 337 /// @param[in] dst_byte_order 338 /// A byte order of the data that we want when the value in 339 /// copied to \a dst. 340 /// 341 /// @param[out] dst 342 /// The buffer that will receive the extracted value if there 343 /// are enough bytes available in the current data. 344 /// 345 /// @return 346 /// The number of bytes that were extracted which will be \a 347 /// length when the value is successfully extracted, or zero 348 /// if there aren't enough bytes at the specified offset. 349 //------------------------------------------------------------------ 350 size_t 351 ExtractBytes (lldb::offset_t offset, lldb::offset_t length, lldb::ByteOrder dst_byte_order, void *dst) const; 352 353 //------------------------------------------------------------------ 354 /// Extract an address from \a *offset_ptr. 355 /// 356 /// Extract a single address from the data and update the offset 357 /// pointed to by \a offset_ptr. The size of the extracted address 358 /// comes from the \a m_addr_size member variable and should be 359 /// set correctly prior to extracting any address values. 360 /// 361 /// @param[in,out] offset_ptr 362 /// A pointer to an offset within the data that will be advanced 363 /// by the appropriate number of bytes if the value is extracted 364 /// correctly. If the offset is out of bounds or there are not 365 /// enough bytes to extract this value, the offset will be left 366 /// unmodified. 367 /// 368 /// @return 369 /// The extracted address value. 370 //------------------------------------------------------------------ 371 uint64_t 372 GetAddress (lldb::offset_t *offset_ptr) const; 373 374 uint64_t 375 GetAddress_unchecked (lldb::offset_t *offset_ptr) const; 376 377 //------------------------------------------------------------------ 378 /// Get the current address size. 379 /// 380 /// Return the size in bytes of any address values this object will 381 /// extract. 382 /// 383 /// @return 384 /// The size in bytes of address values that will be extracted. 385 //------------------------------------------------------------------ 386 uint32_t 387 GetAddressByteSize () const 388 { 389 return m_addr_size; 390 } 391 392 //------------------------------------------------------------------ 393 /// Get the number of bytes contained in this object. 394 /// 395 /// @return 396 /// The total number of bytes of data this object refers to. 397 //------------------------------------------------------------------ 398 uint64_t 399 GetByteSize () const 400 { 401 return m_end - m_start; 402 } 403 404 //------------------------------------------------------------------ 405 /// Extract a C string from \a *offset_ptr. 406 /// 407 /// Returns a pointer to a C String from the data at the offset 408 /// pointed to by \a offset_ptr. A variable length NULL terminated C 409 /// string will be extracted and the \a offset_ptr will be 410 /// updated with the offset of the byte that follows the NULL 411 /// terminator byte. 412 /// 413 /// @param[in,out] offset_ptr 414 /// A pointer to an offset within the data that will be advanced 415 /// by the appropriate number of bytes if the value is extracted 416 /// correctly. If the offset is out of bounds or there are not 417 /// enough bytes to extract this value, the offset will be left 418 /// unmodified. 419 /// 420 /// @return 421 /// A pointer to the C string value in the data. If the offset 422 /// pointed to by \a offset_ptr is out of bounds, or if the 423 /// offset plus the length of the C string is out of bounds, 424 /// nullptr will be returned. 425 //------------------------------------------------------------------ 426 const char * 427 GetCStr (lldb::offset_t *offset_ptr) const; 428 429 //------------------------------------------------------------------ 430 /// Extract a C string from \a *offset_ptr with field size \a len. 431 /// 432 /// Returns a pointer to a C String from the data at the offset 433 /// pointed to by \a offset_ptr, with a field length of \a len. 434 /// A NULL terminated C string will be extracted and the \a offset_ptr 435 /// will be updated with the offset of the byte that follows the fixed 436 /// length field. 437 /// 438 /// @param[in,out] offset_ptr 439 /// A pointer to an offset within the data that will be advanced 440 /// by the appropriate number of bytes if the value is extracted 441 /// correctly. If the offset is out of bounds or there are not 442 /// enough bytes to extract this value, the offset will be left 443 /// unmodified. 444 /// 445 /// @return 446 /// A pointer to the C string value in the data. If the offset 447 /// pointed to by \a offset_ptr is out of bounds, or if the 448 /// offset plus the length of the field is out of bounds, or if 449 /// the field does not contain a NULL terminator byte, nullptr will 450 /// be returned. 451 const char * 452 GetCStr (lldb::offset_t *offset_ptr, lldb::offset_t len) const; 453 454 //------------------------------------------------------------------ 455 /// Extract \a length bytes from \a *offset_ptr. 456 /// 457 /// Returns a pointer to a bytes in this object's data at the offset 458 /// pointed to by \a offset_ptr. If \a length is zero or too large, 459 /// then the offset pointed to by \a offset_ptr will not be updated 460 /// and nullptr will be returned. 461 /// 462 /// @param[in,out] offset_ptr 463 /// A pointer to an offset within the data that will be advanced 464 /// by the appropriate number of bytes if the value is extracted 465 /// correctly. If the offset is out of bounds or there are not 466 /// enough bytes to extract this value, the offset will be left 467 /// unmodified. 468 /// 469 /// @param[in] length 470 /// The optional length of a string to extract. If the value is 471 /// zero, a NULL terminated C string will be extracted. 472 /// 473 /// @return 474 /// A pointer to the bytes in this object's data if the offset 475 /// and length are valid, or nullptr otherwise. 476 //------------------------------------------------------------------ 477 const void* 478 GetData (lldb::offset_t *offset_ptr, lldb::offset_t length) const 479 { 480 const uint8_t *ptr = PeekData (*offset_ptr, length); 481 if (ptr) 482 *offset_ptr += length; 483 return ptr; 484 } 485 486 //------------------------------------------------------------------ 487 /// Copy \a length bytes from \a *offset, without swapping bytes. 488 /// 489 /// @param[in] offset 490 /// The offset into this data from which to start copying 491 /// 492 /// @param[in] length 493 /// The length of the data to copy from this object 494 /// 495 /// @param[out] dst 496 /// The buffer to place the output data. 497 /// 498 /// @return 499 /// Returns the number of bytes that were copied, or zero if 500 /// anything goes wrong. 501 //------------------------------------------------------------------ 502 lldb::offset_t 503 CopyData (lldb::offset_t offset, 504 lldb::offset_t length, 505 void *dst) const; 506 507 //------------------------------------------------------------------ 508 /// Copy \a dst_len bytes from \a *offset_ptr and ensure the copied 509 /// data is treated as a value that can be swapped to match the 510 /// specified byte order. 511 /// 512 /// For values that are larger than the supported integer sizes, 513 /// this function can be used to extract data in a specified byte 514 /// order. It can also be used to copy a smaller integer value from 515 /// to a larger value. The extra bytes left over will be padded 516 /// correctly according to the byte order of this object and the 517 /// \a dst_byte_order. This can be very handy when say copying a 518 /// partial data value into a register. 519 /// 520 /// @param[in] src_offset 521 /// The offset into this data from which to start copying an 522 /// endian entity 523 /// 524 /// @param[in] src_len 525 /// The length of the endian data to copy from this object 526 /// into the \a dst object 527 /// 528 /// @param[out] dst 529 /// The buffer where to place the endian data. The data might 530 /// need to be byte swapped (and appropriately padded with 531 /// zeroes if \a src_len != \a dst_len) if \a dst_byte_order 532 /// does not match the byte order in this object. 533 /// 534 /// @param[in] dst_len 535 /// The length number of bytes that the endian value will 536 /// occupy is \a dst. 537 /// 538 /// @param[in] byte_order 539 /// The byte order that the endian value should be in the \a dst 540 /// buffer. 541 /// 542 /// @return 543 /// Returns the number of bytes that were copied, or zero if 544 /// anything goes wrong. 545 //------------------------------------------------------------------ 546 lldb::offset_t 547 CopyByteOrderedData (lldb::offset_t src_offset, 548 lldb::offset_t src_len, 549 void *dst, 550 lldb::offset_t dst_len, 551 lldb::ByteOrder dst_byte_order) const; 552 553 //------------------------------------------------------------------ 554 /// Get the data end pointer. 555 /// 556 /// @return 557 /// Returns a pointer to the next byte contained in this 558 /// object's data, or nullptr of there is no data in this object. 559 //------------------------------------------------------------------ 560 const uint8_t * 561 GetDataEnd () const 562 { 563 return m_end; 564 } 565 566 //------------------------------------------------------------------ 567 /// Get the shared data offset. 568 /// 569 /// Get the offset of the first byte of data in the shared data (if 570 /// any). 571 /// 572 /// @return 573 /// If this object contains shared data, this function returns 574 /// the offset in bytes into that shared data, zero otherwise. 575 //------------------------------------------------------------------ 576 size_t 577 GetSharedDataOffset () const; 578 579 //------------------------------------------------------------------ 580 /// Get the data start pointer. 581 /// 582 /// @return 583 /// Returns a pointer to the first byte contained in this 584 /// object's data, or nullptr of there is no data in this object. 585 //------------------------------------------------------------------ 586 const uint8_t * 587 GetDataStart () const 588 { 589 return m_start; 590 } 591 592 //------------------------------------------------------------------ 593 /// Extract a float from \a *offset_ptr. 594 /// 595 /// Extract a single float value. 596 /// 597 /// @param[in,out] offset_ptr 598 /// A pointer to an offset within the data that will be advanced 599 /// by the appropriate number of bytes if the value is extracted 600 /// correctly. If the offset is out of bounds or there are not 601 /// enough bytes to extract this value, the offset will be left 602 /// unmodified. 603 /// 604 /// @return 605 /// The floating value that was extracted, or zero on failure. 606 //------------------------------------------------------------------ 607 float 608 GetFloat (lldb::offset_t *offset_ptr) const; 609 610 double 611 GetDouble (lldb::offset_t *offset_ptr) const; 612 613 long double 614 GetLongDouble (lldb::offset_t *offset_ptr) const; 615 616 //------------------------------------------------------------------ 617 /// Extract a GNU encoded pointer value from \a *offset_ptr. 618 /// 619 /// @param[in,out] offset_ptr 620 /// A pointer to an offset within the data that will be advanced 621 /// by the appropriate number of bytes if the value is extracted 622 /// correctly. If the offset is out of bounds or there are not 623 /// enough bytes to extract this value, the offset will be left 624 /// unmodified. 625 /// 626 /// @param[in] eh_ptr_enc 627 /// The GNU pointer encoding type. 628 /// 629 /// @param[in] pc_rel_addr 630 /// The PC relative address to use when the encoding is 631 /// \c DW_GNU_EH_PE_pcrel. 632 /// 633 /// @param[in] text_addr 634 /// The text (code) relative address to use when the encoding is 635 /// \c DW_GNU_EH_PE_textrel. 636 /// 637 /// @param[in] data_addr 638 /// The data relative address to use when the encoding is 639 /// \c DW_GNU_EH_PE_datarel. 640 /// 641 /// @return 642 /// The extracted GNU encoded pointer value. 643 //------------------------------------------------------------------ 644 uint64_t 645 GetGNUEHPointer (lldb::offset_t *offset_ptr, 646 uint32_t eh_ptr_enc, 647 lldb::addr_t pc_rel_addr, 648 lldb::addr_t text_addr, 649 lldb::addr_t data_addr); 650 651 //------------------------------------------------------------------ 652 /// Extract an integer of size \a byte_size from \a *offset_ptr. 653 /// 654 /// Extract a single integer value and update the offset pointed to 655 /// by \a offset_ptr. The size of the extracted integer is specified 656 /// by the \a byte_size argument. \a byte_size should have a value 657 /// >= 1 and <= 4 since the return value is only 32 bits wide. Any 658 /// \a byte_size values less than 1 or greater than 4 will result in 659 /// nothing being extracted, and zero being returned. 660 /// 661 /// @param[in,out] offset_ptr 662 /// A pointer to an offset within the data that will be advanced 663 /// by the appropriate number of bytes if the value is extracted 664 /// correctly. If the offset is out of bounds or there are not 665 /// enough bytes to extract this value, the offset will be left 666 /// unmodified. 667 /// 668 /// @param[in] byte_size 669 /// The size in byte of the integer to extract. 670 /// 671 /// @return 672 /// The integer value that was extracted, or zero on failure. 673 //------------------------------------------------------------------ 674 uint32_t 675 GetMaxU32 (lldb::offset_t *offset_ptr, size_t byte_size) const; 676 677 //------------------------------------------------------------------ 678 /// Extract an unsigned integer of size \a byte_size from \a 679 /// *offset_ptr. 680 /// 681 /// Extract a single unsigned integer value and update the offset 682 /// pointed to by \a offset_ptr. The size of the extracted integer 683 /// is specified by the \a byte_size argument. \a byte_size should 684 /// have a value greater than or equal to one and less than or equal 685 /// to eight since the return value is 64 bits wide. Any 686 /// \a byte_size values less than 1 or greater than 8 will result in 687 /// nothing being extracted, and zero being returned. 688 /// 689 /// @param[in,out] offset_ptr 690 /// A pointer to an offset within the data that will be advanced 691 /// by the appropriate number of bytes if the value is extracted 692 /// correctly. If the offset is out of bounds or there are not 693 /// enough bytes to extract this value, the offset will be left 694 /// unmodified. 695 /// 696 /// @param[in] byte_size 697 /// The size in byte of the integer to extract. 698 /// 699 /// @return 700 /// The unsigned integer value that was extracted, or zero on 701 /// failure. 702 //------------------------------------------------------------------ 703 uint64_t 704 GetMaxU64 (lldb::offset_t *offset_ptr, size_t byte_size) const; 705 706 uint64_t 707 GetMaxU64_unchecked (lldb::offset_t *offset_ptr, size_t byte_size) const; 708 709 //------------------------------------------------------------------ 710 /// Extract an signed integer of size \a byte_size from \a *offset_ptr. 711 /// 712 /// Extract a single signed integer value (sign extending if required) 713 /// and update the offset pointed to by \a offset_ptr. The size of 714 /// the extracted integer is specified by the \a byte_size argument. 715 /// \a byte_size should have a value greater than or equal to one 716 /// and less than or equal to eight since the return value is 64 717 /// bits wide. Any \a byte_size values less than 1 or greater than 718 /// 8 will result in nothing being extracted, and zero being returned. 719 /// 720 /// @param[in,out] offset_ptr 721 /// A pointer to an offset within the data that will be advanced 722 /// by the appropriate number of bytes if the value is extracted 723 /// correctly. If the offset is out of bounds or there are not 724 /// enough bytes to extract this value, the offset will be left 725 /// unmodified. 726 /// 727 /// @param[in] byte_size 728 /// The size in byte of the integer to extract. 729 /// 730 /// @return 731 /// The sign extended signed integer value that was extracted, 732 /// or zero on failure. 733 //------------------------------------------------------------------ 734 int64_t 735 GetMaxS64 (lldb::offset_t *offset_ptr, size_t size) const; 736 737 //------------------------------------------------------------------ 738 /// Extract an unsigned integer of size \a byte_size from \a 739 /// *offset_ptr, then extract the bitfield from this value if 740 /// \a bitfield_bit_size is non-zero. 741 /// 742 /// Extract a single unsigned integer value and update the offset 743 /// pointed to by \a offset_ptr. The size of the extracted integer 744 /// is specified by the \a byte_size argument. \a byte_size should 745 /// have a value greater than or equal to one and less than or equal 746 /// to 8 since the return value is 64 bits wide. Any 747 /// \a byte_size values less than 1 or greater than 8 will result in 748 /// nothing being extracted, and zero being returned. 749 /// 750 /// @param[in,out] offset_ptr 751 /// A pointer to an offset within the data that will be advanced 752 /// by the appropriate number of bytes if the value is extracted 753 /// correctly. If the offset is out of bounds or there are not 754 /// enough bytes to extract this value, the offset will be left 755 /// unmodified. 756 /// 757 /// @param[in] byte_size 758 /// The size in byte of the integer to extract. 759 /// 760 /// @param[in] bitfield_bit_size 761 /// The size in bits of the bitfield value to extract, or zero 762 /// to just extract the entire integer value. 763 /// 764 /// @param[in] bitfield_bit_offset 765 /// The bit offset of the bitfield value in the extracted 766 /// integer (the number of bits to shift the integer to the 767 /// right). 768 /// 769 /// @return 770 /// The unsigned bitfield integer value that was extracted, or 771 /// zero on failure. 772 //------------------------------------------------------------------ 773 uint64_t 774 GetMaxU64Bitfield (lldb::offset_t *offset_ptr, 775 size_t size, 776 uint32_t bitfield_bit_size, 777 uint32_t bitfield_bit_offset) const; 778 779 //------------------------------------------------------------------ 780 /// Extract an signed integer of size \a byte_size from \a 781 /// *offset_ptr, then extract and signe extend the bitfield from 782 /// this value if \a bitfield_bit_size is non-zero. 783 /// 784 /// Extract a single signed integer value (sign extending if required) 785 /// and update the offset pointed to by \a offset_ptr. The size of 786 /// the extracted integer is specified by the \a byte_size argument. 787 /// \a byte_size should have a value greater than or equal to one 788 /// and less than or equal to eight since the return value is 64 789 /// bits wide. Any \a byte_size values less than 1 or greater than 790 /// 8 will result in nothing being extracted, and zero being returned. 791 /// 792 /// @param[in,out] offset_ptr 793 /// A pointer to an offset within the data that will be advanced 794 /// by the appropriate number of bytes if the value is extracted 795 /// correctly. If the offset is out of bounds or there are not 796 /// enough bytes to extract this value, the offset will be left 797 /// unmodified. 798 /// 799 /// @param[in] byte_size 800 /// The size in bytes of the integer to extract. 801 /// 802 /// @param[in] bitfield_bit_size 803 /// The size in bits of the bitfield value to extract, or zero 804 /// to just extract the entire integer value. 805 /// 806 /// @param[in] bitfield_bit_offset 807 /// The bit offset of the bitfield value in the extracted 808 /// integer (the number of bits to shift the integer to the 809 /// right). 810 /// 811 /// @return 812 /// The signed bitfield integer value that was extracted, or 813 /// zero on failure. 814 //------------------------------------------------------------------ 815 int64_t 816 GetMaxS64Bitfield (lldb::offset_t *offset_ptr, 817 size_t size, 818 uint32_t bitfield_bit_size, 819 uint32_t bitfield_bit_offset) const; 820 821 //------------------------------------------------------------------ 822 /// Extract an pointer from \a *offset_ptr. 823 /// 824 /// Extract a single pointer from the data and update the offset 825 /// pointed to by \a offset_ptr. The size of the extracted pointer 826 /// comes from the \a m_addr_size member variable and should be 827 /// set correctly prior to extracting any pointer values. 828 /// 829 /// @param[in,out] offset_ptr 830 /// A pointer to an offset within the data that will be advanced 831 /// by the appropriate number of bytes if the value is extracted 832 /// correctly. If the offset is out of bounds or there are not 833 /// enough bytes to extract this value, the offset will be left 834 /// unmodified. 835 /// 836 /// @return 837 /// The extracted pointer value as a 64 integer. 838 //------------------------------------------------------------------ 839 uint64_t 840 GetPointer (lldb::offset_t *offset_ptr) const; 841 842 //------------------------------------------------------------------ 843 /// Get the current byte order value. 844 /// 845 /// @return 846 /// The current byte order value from this object's internal 847 /// state. 848 //------------------------------------------------------------------ 849 lldb::ByteOrder 850 GetByteOrder() const 851 { 852 return m_byte_order; 853 } 854 855 //------------------------------------------------------------------ 856 /// Extract a uint8_t value from \a *offset_ptr. 857 /// 858 /// Extract a single uint8_t from the binary data at the offset 859 /// pointed to by \a offset_ptr, and advance the offset on success. 860 /// 861 /// @param[in,out] offset_ptr 862 /// A pointer to an offset within the data that will be advanced 863 /// by the appropriate number of bytes if the value is extracted 864 /// correctly. If the offset is out of bounds or there are not 865 /// enough bytes to extract this value, the offset will be left 866 /// unmodified. 867 /// 868 /// @return 869 /// The extracted uint8_t value. 870 //------------------------------------------------------------------ 871 uint8_t 872 GetU8 ( lldb::offset_t *offset_ptr) const; 873 874 uint8_t 875 GetU8_unchecked (lldb::offset_t *offset_ptr) const 876 { 877 uint8_t val = m_start[*offset_ptr]; 878 *offset_ptr += 1; 879 return val; 880 } 881 882 uint16_t 883 GetU16_unchecked (lldb::offset_t *offset_ptr) const; 884 885 uint32_t 886 GetU32_unchecked (lldb::offset_t *offset_ptr) const; 887 888 uint64_t 889 GetU64_unchecked (lldb::offset_t *offset_ptr) const; 890 //------------------------------------------------------------------ 891 /// Extract \a count uint8_t values from \a *offset_ptr. 892 /// 893 /// Extract \a count uint8_t values from the binary data at the 894 /// offset pointed to by \a offset_ptr, and advance the offset on 895 /// success. The extracted values are copied into \a dst. 896 /// 897 /// @param[in,out] offset_ptr 898 /// A pointer to an offset within the data that will be advanced 899 /// by the appropriate number of bytes if the value is extracted 900 /// correctly. If the offset is out of bounds or there are not 901 /// enough bytes to extract this value, the offset will be left 902 /// unmodified. 903 /// 904 /// @param[out] dst 905 /// A buffer to copy \a count uint8_t values into. \a dst must 906 /// be large enough to hold all requested data. 907 /// 908 /// @param[in] count 909 /// The number of uint8_t values to extract. 910 /// 911 /// @return 912 /// \a dst if all values were properly extracted and copied, 913 /// nullptr otherwise. 914 //------------------------------------------------------------------ 915 void * 916 GetU8 (lldb::offset_t *offset_ptr, void *dst, uint32_t count) const; 917 918 //------------------------------------------------------------------ 919 /// Extract a uint16_t value from \a *offset_ptr. 920 /// 921 /// Extract a single uint16_t from the binary data at the offset 922 /// pointed to by \a offset_ptr, and update the offset on success. 923 /// 924 /// @param[in,out] offset_ptr 925 /// A pointer to an offset within the data that will be advanced 926 /// by the appropriate number of bytes if the value is extracted 927 /// correctly. If the offset is out of bounds or there are not 928 /// enough bytes to extract this value, the offset will be left 929 /// unmodified. 930 /// 931 /// @return 932 /// The extracted uint16_t value. 933 //------------------------------------------------------------------ 934 uint16_t 935 GetU16 (lldb::offset_t *offset_ptr) const; 936 937 //------------------------------------------------------------------ 938 /// Extract \a count uint16_t values from \a *offset_ptr. 939 /// 940 /// Extract \a count uint16_t values from the binary data at the 941 /// offset pointed to by \a offset_ptr, and advance the offset on 942 /// success. The extracted values are copied into \a dst. 943 /// 944 /// @param[in,out] offset_ptr 945 /// A pointer to an offset within the data that will be advanced 946 /// by the appropriate number of bytes if the value is extracted 947 /// correctly. If the offset is out of bounds or there are not 948 /// enough bytes to extract this value, the offset will be left 949 /// unmodified. 950 /// 951 /// @param[out] dst 952 /// A buffer to copy \a count uint16_t values into. \a dst must 953 /// be large enough to hold all requested data. 954 /// 955 /// @param[in] count 956 /// The number of uint16_t values to extract. 957 /// 958 /// @return 959 /// \a dst if all values were properly extracted and copied, 960 /// nullptr otherwise. 961 //------------------------------------------------------------------ 962 void * 963 GetU16 (lldb::offset_t *offset_ptr, void *dst, uint32_t count) const; 964 965 //------------------------------------------------------------------ 966 /// Extract a uint32_t value from \a *offset_ptr. 967 /// 968 /// Extract a single uint32_t from the binary data at the offset 969 /// pointed to by \a offset_ptr, and update the offset on success. 970 /// 971 /// @param[in,out] offset_ptr 972 /// A pointer to an offset within the data that will be advanced 973 /// by the appropriate number of bytes if the value is extracted 974 /// correctly. If the offset is out of bounds or there are not 975 /// enough bytes to extract this value, the offset will be left 976 /// unmodified. 977 /// 978 /// @return 979 /// The extracted uint32_t value. 980 //------------------------------------------------------------------ 981 uint32_t 982 GetU32 (lldb::offset_t *offset_ptr) const; 983 984 //------------------------------------------------------------------ 985 /// Extract \a count uint32_t values from \a *offset_ptr. 986 /// 987 /// Extract \a count uint32_t values from the binary data at the 988 /// offset pointed to by \a offset_ptr, and advance the offset on 989 /// success. The extracted values are copied into \a dst. 990 /// 991 /// @param[in,out] offset_ptr 992 /// A pointer to an offset within the data that will be advanced 993 /// by the appropriate number of bytes if the value is extracted 994 /// correctly. If the offset is out of bounds or there are not 995 /// enough bytes to extract this value, the offset will be left 996 /// unmodified. 997 /// 998 /// @param[out] dst 999 /// A buffer to copy \a count uint32_t values into. \a dst must 1000 /// be large enough to hold all requested data. 1001 /// 1002 /// @param[in] count 1003 /// The number of uint32_t values to extract. 1004 /// 1005 /// @return 1006 /// \a dst if all values were properly extracted and copied, 1007 /// nullptr otherwise. 1008 //------------------------------------------------------------------ 1009 void * 1010 GetU32 (lldb::offset_t *offset_ptr, void *dst, uint32_t count) const; 1011 1012 //------------------------------------------------------------------ 1013 /// Extract a uint64_t value from \a *offset_ptr. 1014 /// 1015 /// Extract a single uint64_t from the binary data at the offset 1016 /// pointed to by \a offset_ptr, and update the offset on success. 1017 /// 1018 /// @param[in,out] offset_ptr 1019 /// A pointer to an offset within the data that will be advanced 1020 /// by the appropriate number of bytes if the value is extracted 1021 /// correctly. If the offset is out of bounds or there are not 1022 /// enough bytes to extract this value, the offset will be left 1023 /// unmodified. 1024 /// 1025 /// @return 1026 /// The extracted uint64_t value. 1027 //------------------------------------------------------------------ 1028 uint64_t 1029 GetU64 (lldb::offset_t *offset_ptr) const; 1030 1031 //------------------------------------------------------------------ 1032 /// Extract \a count uint64_t values from \a *offset_ptr. 1033 /// 1034 /// Extract \a count uint64_t values from the binary data at the 1035 /// offset pointed to by \a offset_ptr, and advance the offset on 1036 /// success. The extracted values are copied into \a dst. 1037 /// 1038 /// @param[in,out] offset_ptr 1039 /// A pointer to an offset within the data that will be advanced 1040 /// by the appropriate number of bytes if the value is extracted 1041 /// correctly. If the offset is out of bounds or there are not 1042 /// enough bytes to extract this value, the offset will be left 1043 /// unmodified. 1044 /// 1045 /// @param[out] dst 1046 /// A buffer to copy \a count uint64_t values into. \a dst must 1047 /// be large enough to hold all requested data. 1048 /// 1049 /// @param[in] count 1050 /// The number of uint64_t values to extract. 1051 /// 1052 /// @return 1053 /// \a dst if all values were properly extracted and copied, 1054 /// nullptr otherwise. 1055 //------------------------------------------------------------------ 1056 void * 1057 GetU64 ( lldb::offset_t *offset_ptr, void *dst, uint32_t count) const; 1058 1059 //------------------------------------------------------------------ 1060 /// Extract a signed LEB128 value from \a *offset_ptr. 1061 /// 1062 /// Extracts an signed LEB128 number from this object's data 1063 /// starting at the offset pointed to by \a offset_ptr. The offset 1064 /// pointed to by \a offset_ptr will be updated with the offset of 1065 /// the byte following the last extracted byte. 1066 /// 1067 /// @param[in,out] offset_ptr 1068 /// A pointer to an offset within the data that will be advanced 1069 /// by the appropriate number of bytes if the value is extracted 1070 /// correctly. If the offset is out of bounds or there are not 1071 /// enough bytes to extract this value, the offset will be left 1072 /// unmodified. 1073 /// 1074 /// @return 1075 /// The extracted signed integer value. 1076 //------------------------------------------------------------------ 1077 int64_t 1078 GetSLEB128 (lldb::offset_t *offset_ptr) const; 1079 1080 //------------------------------------------------------------------ 1081 /// Extract a unsigned LEB128 value from \a *offset_ptr. 1082 /// 1083 /// Extracts an unsigned LEB128 number from this object's data 1084 /// starting at the offset pointed to by \a offset_ptr. The offset 1085 /// pointed to by \a offset_ptr will be updated with the offset of 1086 /// the byte following the last extracted byte. 1087 /// 1088 /// @param[in,out] offset_ptr 1089 /// A pointer to an offset within the data that will be advanced 1090 /// by the appropriate number of bytes if the value is extracted 1091 /// correctly. If the offset is out of bounds or there are not 1092 /// enough bytes to extract this value, the offset will be left 1093 /// unmodified. 1094 /// 1095 /// @return 1096 /// The extracted unsigned integer value. 1097 //------------------------------------------------------------------ 1098 uint64_t 1099 GetULEB128 (lldb::offset_t *offset_ptr) const; 1100 1101 lldb::DataBufferSP & 1102 GetSharedDataBuffer () 1103 { 1104 return m_data_sp; 1105 } 1106 1107 //------------------------------------------------------------------ 1108 /// Peek at a C string at \a offset. 1109 /// 1110 /// Peeks at a string in the contained data. No verification is done 1111 /// to make sure the entire string lies within the bounds of this 1112 /// object's data, only \a offset is verified to be a valid offset. 1113 /// 1114 /// @param[in] offset 1115 /// An offset into the data. 1116 /// 1117 /// @return 1118 /// A non-nullptr C string pointer if \a offset is a valid offset, 1119 /// nullptr otherwise. 1120 //------------------------------------------------------------------ 1121 const char * 1122 PeekCStr (lldb::offset_t offset) const; 1123 1124 //------------------------------------------------------------------ 1125 /// Peek at a bytes at \a offset. 1126 /// 1127 /// Returns a pointer to \a length bytes at \a offset as long as 1128 /// there are \a length bytes available starting at \a offset. 1129 /// 1130 /// @return 1131 /// A non-nullptr data pointer if \a offset is a valid offset and 1132 /// there are \a length bytes available at that offset, nullptr 1133 /// otherwise. 1134 //------------------------------------------------------------------ 1135 const uint8_t* 1136 PeekData (lldb::offset_t offset, lldb::offset_t length) const 1137 { 1138 if (length > 0 && ValidOffsetForDataOfSize(offset, length)) 1139 return m_start + offset; 1140 return nullptr; 1141 } 1142 1143 //------------------------------------------------------------------ 1144 /// Set the address byte size. 1145 /// 1146 /// Set the size in bytes that will be used when extracting any 1147 /// address and pointer values from data contained in this object. 1148 /// 1149 /// @param[in] addr_size 1150 /// The size in bytes to use when extracting addresses. 1151 //------------------------------------------------------------------ 1152 void 1153 SetAddressByteSize (uint32_t addr_size) 1154 { 1155#ifdef LLDB_CONFIGURATION_DEBUG 1156 assert (addr_size == 4 || addr_size == 8); 1157#endif 1158 m_addr_size = addr_size; 1159 } 1160 1161 //------------------------------------------------------------------ 1162 /// Set data with a buffer that is caller owned. 1163 /// 1164 /// Use data that is owned by the caller when extracting values. 1165 /// The data must stay around as long as this object, or any object 1166 /// that copies a subset of this object's data, is valid. If \a 1167 /// bytes is nullptr, or \a length is zero, this object will contain 1168 /// no data. 1169 /// 1170 /// @param[in] bytes 1171 /// A pointer to caller owned data. 1172 /// 1173 /// @param[in] length 1174 /// The length in bytes of \a bytes. 1175 /// 1176 /// @param[in] byte_order 1177 /// A byte order of the data that we are extracting from. 1178 /// 1179 /// @return 1180 /// The number of bytes that this object now contains. 1181 //------------------------------------------------------------------ 1182 lldb::offset_t 1183 SetData (const void *bytes, lldb::offset_t length, lldb::ByteOrder byte_order); 1184 1185 //------------------------------------------------------------------ 1186 /// Adopt a subset of \a data. 1187 /// 1188 /// Set this object's data to be a subset of the data bytes in \a 1189 /// data. If \a data contains shared data, then a reference to the 1190 /// shared data will be added to ensure the shared data stays around 1191 /// as long as any objects have references to the shared data. The 1192 /// byte order and the address size settings are copied from \a 1193 /// data. If \a offset is not a valid offset in \a data, then no 1194 /// reference to the shared data will be added. If there are not 1195 /// \a length bytes available in \a data starting at \a offset, 1196 /// the length will be truncated to contains as many bytes as 1197 /// possible. 1198 /// 1199 /// @param[in] data 1200 /// Another DataExtractor object that contains data. 1201 /// 1202 /// @param[in] offset 1203 /// The offset into \a data at which the subset starts. 1204 /// 1205 /// @param[in] length 1206 /// The length in bytes of the subset of \a data. 1207 /// 1208 /// @return 1209 /// The number of bytes that this object now contains. 1210 //------------------------------------------------------------------ 1211 lldb::offset_t 1212 SetData (const DataExtractor& data, lldb::offset_t offset, lldb::offset_t length); 1213 1214 //------------------------------------------------------------------ 1215 /// Adopt a subset of shared data in \a data_sp. 1216 /// 1217 /// Copies the data shared pointer which adds a reference to the 1218 /// contained in \a data_sp. The shared data reference is reference 1219 /// counted to ensure the data lives as long as anyone still has a 1220 /// valid shared pointer to the data in \a data_sp. The byte order 1221 /// and address byte size settings remain the same. If 1222 /// \a offset is not a valid offset in \a data_sp, then no reference 1223 /// to the shared data will be added. If there are not \a length 1224 /// bytes available in \a data starting at \a offset, the length 1225 /// will be truncated to contains as many bytes as possible. 1226 /// 1227 /// @param[in] data_sp 1228 /// A shared pointer to data. 1229 /// 1230 /// @param[in] offset 1231 /// The offset into \a data_sp at which the subset starts. 1232 /// 1233 /// @param[in] length 1234 /// The length in bytes of the subset of \a data_sp. 1235 /// 1236 /// @return 1237 /// The number of bytes that this object now contains. 1238 //------------------------------------------------------------------ 1239 lldb::offset_t 1240 SetData (const lldb::DataBufferSP& data_sp, lldb::offset_t offset = 0, lldb::offset_t length = LLDB_INVALID_OFFSET); 1241 1242 //------------------------------------------------------------------ 1243 /// Set the byte_order value. 1244 /// 1245 /// Sets the byte order of the data to extract. Extracted values 1246 /// will be swapped if necessary when decoding. 1247 /// 1248 /// @param[in] byte_order 1249 /// The byte order value to use when extracting data. 1250 //------------------------------------------------------------------ 1251 void 1252 SetByteOrder (lldb::ByteOrder byte_order) 1253 { 1254 m_byte_order = byte_order; 1255 } 1256 1257 //------------------------------------------------------------------ 1258 /// Skip an LEB128 number at \a *offset_ptr. 1259 /// 1260 /// Skips a LEB128 number (signed or unsigned) from this object's 1261 /// data starting at the offset pointed to by \a offset_ptr. The 1262 /// offset pointed to by \a offset_ptr will be updated with the 1263 /// offset of the byte following the last extracted byte. 1264 /// 1265 /// @param[in,out] offset_ptr 1266 /// A pointer to an offset within the data that will be advanced 1267 /// by the appropriate number of bytes if the value is extracted 1268 /// correctly. If the offset is out of bounds or there are not 1269 /// enough bytes to extract this value, the offset will be left 1270 /// unmodified. 1271 /// 1272 /// @return 1273 // The number of bytes consumed during the extraction. 1274 //------------------------------------------------------------------ 1275 uint32_t 1276 Skip_LEB128 (lldb::offset_t *offset_ptr) const; 1277 1278 //------------------------------------------------------------------ 1279 /// Test the validity of \a offset. 1280 /// 1281 /// @return 1282 /// \b true if \a offset is a valid offset into the data in this 1283 /// object, \b false otherwise. 1284 //------------------------------------------------------------------ 1285 bool 1286 ValidOffset (lldb::offset_t offset) const 1287 { 1288 return offset < GetByteSize(); 1289 } 1290 1291 //------------------------------------------------------------------ 1292 /// Test the availability of \a length bytes of data from \a offset. 1293 /// 1294 /// @return 1295 /// \b true if \a offset is a valid offset and there are \a 1296 /// length bytes available at that offset, \b false otherwise. 1297 //------------------------------------------------------------------ 1298 bool 1299 ValidOffsetForDataOfSize (lldb::offset_t offset, lldb::offset_t length) const 1300 { 1301 return length <= BytesLeft (offset); 1302 } 1303 1304 size_t 1305 Copy (DataExtractor& dest_data) const; 1306 1307 bool 1308 Append (DataExtractor& rhs); 1309 1310 bool 1311 Append (void* bytes, lldb::offset_t length); 1312 1313 lldb::offset_t 1314 BytesLeft (lldb::offset_t offset) const 1315 { 1316 const lldb::offset_t size = GetByteSize(); 1317 if (size > offset) 1318 return size - offset; 1319 return 0; 1320 } 1321 1322 void 1323 Checksum (llvm::SmallVectorImpl<uint8_t> &dest, 1324 uint64_t max_data = 0); 1325 1326protected: 1327 //------------------------------------------------------------------ 1328 // Member variables 1329 //------------------------------------------------------------------ 1330 const uint8_t * m_start; ///< A pointer to the first byte of data. 1331 const uint8_t * m_end; ///< A pointer to the byte that is past the end of the data. 1332 lldb::ByteOrder m_byte_order; ///< The byte order of the data we are extracting from. 1333 uint32_t m_addr_size; ///< The address size to use when extracting pointers or addresses 1334 mutable lldb::DataBufferSP m_data_sp; ///< The shared pointer to data that can be shared among multiple instances 1335 const uint32_t m_target_byte_size; 1336}; 1337 1338} // namespace lldb_private 1339 1340#endif // liblldb_DataExtractor_h_ 1341