Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
dart::DisassembleToMemory Class Reference

#include <disassembler.h>

Inheritance diagram for dart::DisassembleToMemory:
dart::DisassemblyFormatter

Public Member Functions

 DisassembleToMemory (char *buffer, uintptr_t length)
 
 ~DisassembleToMemory ()
 
virtual void ConsumeInstruction (char *hex_buffer, intptr_t hex_size, char *human_buffer, intptr_t human_size, Object *object, uword pc)
 
virtual void Print (const char *format,...) PRINTF_ATTRIBUTE(2
 
- Public Member Functions inherited from dart::DisassemblyFormatter
 DisassemblyFormatter ()
 
virtual ~DisassemblyFormatter ()
 
virtual void ConsumeInstruction (char *hex_buffer, intptr_t hex_size, char *human_buffer, intptr_t human_size, Object *object, uword pc)=0
 
virtual void Print (const char *format,...) PRINTF_ATTRIBUTE(2
 

Detailed Description

Definition at line 91 of file disassembler.h.

Constructor & Destructor Documentation

◆ DisassembleToMemory()

dart::DisassembleToMemory::DisassembleToMemory ( char *  buffer,
uintptr_t  length 
)
inline

Definition at line 93 of file disassembler.h.

95 buffer_(buffer),
96 remaining_(length),
97 overflowed_(false) {}
size_t length
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified vm service A custom Dart VM Service port The default is to pick a randomly available open port disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode disable vm service Disable mDNS Dart VM Service publication Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set endless trace buffer
Definition: switches.h:126

◆ ~DisassembleToMemory()

dart::DisassembleToMemory::~DisassembleToMemory ( )
inline

Definition at line 98 of file disassembler.h.

98{}

Member Function Documentation

◆ ConsumeInstruction()

void dart::DisassembleToMemory::ConsumeInstruction ( char *  hex_buffer,
intptr_t  hex_size,
char *  human_buffer,
intptr_t  human_size,
Object object,
uword  pc 
)
virtual

Implements dart::DisassemblyFormatter.

Definition at line 65 of file disassembler.cc.

70 {
71 if (overflowed_) {
72 return;
73 }
74 intptr_t len;
75
76 // TODO(compiler): Update assembler tests for other architectures so there is
77 // coverage of encodings, not just mnemonics.
78#if defined(TARGET_ARCH_RISCV32) || defined(TARGET_ARCH_RISCV64) || \
79 defined(TARGET_ARCH_ARM)
80 len = strlen(hex_buffer);
81 if (remaining_ < len + 100) {
82 *buffer_++ = '.';
83 *buffer_++ = '.';
84 *buffer_++ = '.';
85 *buffer_++ = '\n';
86 *buffer_++ = '\0';
87 overflowed_ = true;
88 return;
89 }
90 memmove(buffer_, hex_buffer, len);
91 buffer_ += len;
92 remaining_ -= len;
93 *buffer_++ = ' ';
94 remaining_--;
95 *buffer_ = '\0';
96#endif
97
98 len = strlen(human_buffer);
99 if (remaining_ < len + 100) {
100 *buffer_++ = '.';
101 *buffer_++ = '.';
102 *buffer_++ = '.';
103 *buffer_++ = '\n';
104 *buffer_++ = '\0';
105 overflowed_ = true;
106 return;
107 }
108 memmove(buffer_, human_buffer, len);
109 buffer_ += len;
110 remaining_ -= len;
111 *buffer_++ = '\n';
112 remaining_--;
113 *buffer_ = '\0';
114}

◆ Print()

void dart::DisassembleToMemory::Print ( const char *  format,
  ... 
)
virtual

Reimplemented from dart::DisassemblyFormatter.

Definition at line 116 of file disassembler.cc.

116 {
117 if (overflowed_) {
118 return;
119 }
120 va_list measure_args;
121 va_start(measure_args, format);
122 intptr_t len = Utils::VSNPrint(nullptr, 0, format, measure_args);
123 va_end(measure_args);
124 if (remaining_ < len + 100) {
125 *buffer_++ = '.';
126 *buffer_++ = '.';
127 *buffer_++ = '.';
128 *buffer_++ = '\n';
129 *buffer_++ = '\0';
130 overflowed_ = true;
131 return;
132 }
133 va_list print_args;
134 va_start(print_args, format);
135 intptr_t len2 = Utils::VSNPrint(buffer_, len, format, print_args);
136 va_end(print_args);
137 ASSERT(len == len2);
138 buffer_ += len;
139 remaining_ -= len;
140 *buffer_++ = '\n';
141 remaining_--;
142 *buffer_ = '\0';
143}
static int static int VSNPrint(char *str, size_t size, const char *format, va_list args)
#define ASSERT(E)
uint32_t uint32_t * format
va_start(args, format)
va_end(args)

The documentation for this class was generated from the following files: