this repo has no description
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at fixPythonPipStalling 91 lines 3.4 kB view raw
1//===--- MemoryReaderInterface.h - Public reader interface ------*- C++ -*-===// 2// 3// This source file is part of the Swift.org open source project 4// 5// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors 6// Licensed under Apache License v2.0 with Runtime Library Exception 7// 8// See https://swift.org/LICENSE.txt for license information 9// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors 10// 11//===----------------------------------------------------------------------===// 12/// 13/// \file 14/// This header declares the MemoryReader interface struct, which is a 15/// a collection of function pointers to provide reading memory from external 16/// processes. 17/// 18//===----------------------------------------------------------------------===// 19 20#ifndef SWIFT_REFLECTION_MEMORYREADERINTERFACE_H 21#define SWIFT_REFLECTION_MEMORYREADERINTERFACE_H 22 23#include <stdint.h> 24 25#ifdef __cplusplus 26extern "C" { 27#endif 28 29// They would think the type 'addr_t' is defined in the standard library 30// because it has the same name format with the types in <cstdint>. In 31// addition, the definition conflicts in Cygwin which defines it differently 32// in the system library, so we use 'swift_addr_t'. 33typedef uint64_t swift_addr_t; 34 35typedef uint8_t (*PointerSizeFunction)(void *reader_context); 36typedef uint8_t (*SizeSizeFunction)(void *reader_context); 37typedef int (*ReadBytesFunction)(void *reader_context, swift_addr_t address, 38 void *dest, uint64_t size); 39typedef uint64_t (*GetStringLengthFunction)(void *reader_context, 40 swift_addr_t address); 41typedef swift_addr_t (*GetSymbolAddressFunction)(void *reader_context, 42 const char *name, 43 uint64_t name_length); 44 45typedef struct MemoryReaderImpl { 46 /// An opaque context that the implementor can specify to 47 /// be passed to each of the APIs below. 48 void *reader_context; 49 50 /// Get the size in bytes of the target's pointer type. 51 PointerSizeFunction getPointerSize; 52 53 /// Get the size in bytes of the target's size type. 54 SizeSizeFunction getSizeSize; 55 56 // FIXME: -Wdocumentation complains about \param and \returns on function pointers. 57#pragma clang diagnostic push 58#pragma clang diagnostic ignored "-Wdocumentation" 59 60 /// Read a sequence of bytes at an address in the target. 61 /// 62 /// \param address the address in the target address space 63 /// \param dest the caller-owned buffer into which to store the string 64 /// \param size the number of bytes to read 65 /// \returns true if the read was successful 66 ReadBytesFunction readBytes; 67 68 /// Get the string length at the given address. 69 /// 70 /// This scan always occurs in a read-only data section. If the scan 71 /// would go beyond the section boundary, a length of 0 should be 72 /// returned. 73 /// 74 /// \param address the address in the target address space 75 /// \returns The length of the string or 0 if the scan was unsuccessful. 76 GetStringLengthFunction getStringLength; 77 78 /// Get the address of a symbol in the target address space. 79 /// 80 /// \returns true if the lookup was successful. 81 GetSymbolAddressFunction getSymbolAddress; 82 83#pragma clang diagnostic pop 84 85} MemoryReaderImpl; 86 87#ifdef __cplusplus 88} // extern "C" 89#endif 90 91#endif //SWIFT_REFLECTION_MEMORYREADERINTERFACE_H