1254721Semaste//===-- Stream.h ------------------------------------------------*- C++ -*-===//
2254721Semaste//
3254721Semaste//                     The LLVM Compiler Infrastructure
4254721Semaste//
5254721Semaste// This file is distributed under the University of Illinois Open Source
6254721Semaste// License. See LICENSE.TXT for details.
7254721Semaste//
8254721Semaste//===----------------------------------------------------------------------===//
9254721Semaste
10254721Semaste#ifndef liblldb_Stream_h_
11254721Semaste#define liblldb_Stream_h_
12254721Semaste
13296417Sdim// C Includes
14296417Sdim#include <stdarg.h>
15296417Sdim
16296417Sdim// C++ Includes
17296417Sdim// Other libraries and framework includes
18296417Sdim// Project includes
19254721Semaste#include "lldb/lldb-private.h"
20254721Semaste#include "lldb/Core/Flags.h"
21254721Semaste
22254721Semastenamespace lldb_private {
23254721Semaste
24254721Semaste//----------------------------------------------------------------------
25254721Semaste/// @class Stream Stream.h "lldb/Core/Stream.h"
26254721Semaste/// @brief A stream class that can stream formatted output to a file.
27254721Semaste//----------------------------------------------------------------------
28254721Semasteclass Stream
29254721Semaste{
30254721Semastepublic:
31254721Semaste    //------------------------------------------------------------------
32254721Semaste    /// \a m_flags bit values.
33254721Semaste    //------------------------------------------------------------------
34254721Semaste    enum
35254721Semaste    {
36254721Semaste        eVerbose    = (1 << 0), ///< If set, verbose logging is enabled
37254721Semaste        eDebug      = (1 << 1), ///< If set, debug logging is enabled
38254721Semaste        eAddPrefix  = (1 << 2), ///< Add number prefixes for binary, octal and hex when eBinary is clear
39254721Semaste        eBinary     = (1 << 3)  ///< Get and put data as binary instead of as the default string mode.
40254721Semaste    };
41254721Semaste
42254721Semaste    //------------------------------------------------------------------
43254721Semaste    /// Construct with flags and address size and byte order.
44254721Semaste    ///
45254721Semaste    /// Construct with dump flags \a flags and the default address
46254721Semaste    /// size. \a flags can be any of the above enumeration logical OR'ed
47254721Semaste    /// together.
48254721Semaste    //------------------------------------------------------------------
49254721Semaste    Stream (uint32_t flags,
50254721Semaste            uint32_t addr_size,
51254721Semaste            lldb::ByteOrder byte_order);
52254721Semaste
53254721Semaste    //------------------------------------------------------------------
54254721Semaste    /// Construct a default Stream, not binary, host byte order and
55254721Semaste    /// host addr size.
56254721Semaste    ///
57254721Semaste    //------------------------------------------------------------------
58254721Semaste    Stream ();
59254721Semaste
60254721Semaste    //------------------------------------------------------------------
61254721Semaste    /// Destructor
62254721Semaste    //------------------------------------------------------------------
63254721Semaste    virtual
64254721Semaste    ~Stream ();
65254721Semaste
66254721Semaste    //------------------------------------------------------------------
67254721Semaste    // Subclasses must override these methods
68254721Semaste    //------------------------------------------------------------------
69254721Semaste
70254721Semaste    //------------------------------------------------------------------
71254721Semaste    /// Flush the stream.
72254721Semaste    ///
73254721Semaste    /// Subclasses should flush the stream to make any output appear
74254721Semaste    /// if the stream has any buffering.
75254721Semaste    //------------------------------------------------------------------
76254721Semaste    virtual void
77254721Semaste    Flush () = 0;
78254721Semaste
79254721Semaste    //------------------------------------------------------------------
80254721Semaste    /// Output character bytes to the stream.
81254721Semaste    ///
82254721Semaste    /// Appends \a src_len characters from the buffer \a src to the
83254721Semaste    /// stream.
84254721Semaste    ///
85254721Semaste    /// @param[in] src
86254721Semaste    ///     A buffer containing at least \a src_len bytes of data.
87254721Semaste    ///
88254721Semaste    /// @param[in] src_len
89254721Semaste    ///     A number of bytes to append to the stream.
90254721Semaste    ///
91254721Semaste    /// @return
92254721Semaste    ///     The number of bytes that were appended to the stream.
93254721Semaste    //------------------------------------------------------------------
94254721Semaste    virtual size_t
95254721Semaste    Write (const void *src, size_t src_len) = 0;
96254721Semaste
97254721Semaste    //------------------------------------------------------------------
98254721Semaste    // Member functions
99254721Semaste    //------------------------------------------------------------------
100254721Semaste    size_t
101254721Semaste    PutChar (char ch);
102254721Semaste
103254721Semaste    //------------------------------------------------------------------
104254721Semaste    /// Set the byte_order value.
105254721Semaste    ///
106254721Semaste    /// Sets the byte order of the data to extract. Extracted values
107254721Semaste    /// will be swapped if necessary when decoding.
108254721Semaste    ///
109254721Semaste    /// @param[in] byte_order
110254721Semaste    ///     The byte order value to use when extracting data.
111254721Semaste    ///
112254721Semaste    /// @return
113254721Semaste    ///     The old byte order value.
114254721Semaste    //------------------------------------------------------------------
115254721Semaste    lldb::ByteOrder
116254721Semaste    SetByteOrder (lldb::ByteOrder byte_order);
117254721Semaste
118254721Semaste    //------------------------------------------------------------------
119254721Semaste    /// Format a C string from a printf style format and variable
120254721Semaste    /// arguments and encode and append the resulting C string as hex
121254721Semaste    /// bytes.
122254721Semaste    ///
123254721Semaste    /// @param[in] format
124254721Semaste    ///     A printf style format string.
125254721Semaste    ///
126254721Semaste    /// @param[in] ...
127254721Semaste    ///     Any additional arguments needed for the printf format string.
128254721Semaste    ///
129254721Semaste    /// @return
130254721Semaste    ///     The number of bytes that were appended to the stream.
131254721Semaste    //------------------------------------------------------------------
132254721Semaste    size_t
133254721Semaste    PrintfAsRawHex8 (const char *format, ...)  __attribute__ ((format (printf, 2, 3)));
134254721Semaste
135254721Semaste    //------------------------------------------------------------------
136254721Semaste    /// Format a C string from a printf style format and variable
137254721Semaste    /// arguments and encode and append the resulting C string as hex
138254721Semaste    /// bytes.
139254721Semaste    ///
140254721Semaste    /// @param[in] format
141254721Semaste    ///     A printf style format string.
142254721Semaste    ///
143254721Semaste    /// @param[in] ...
144254721Semaste    ///     Any additional arguments needed for the printf format string.
145254721Semaste    ///
146254721Semaste    /// @return
147254721Semaste    ///     The number of bytes that were appended to the stream.
148254721Semaste    //------------------------------------------------------------------
149254721Semaste    size_t
150254721Semaste    PutHex8 (uint8_t uvalue);
151254721Semaste
152254721Semaste    size_t
153254721Semaste    PutNHex8 (size_t n, uint8_t uvalue);
154254721Semaste
155254721Semaste    size_t
156254721Semaste    PutHex16 (uint16_t uvalue,
157254721Semaste              lldb::ByteOrder byte_order = lldb::eByteOrderInvalid);
158254721Semaste
159254721Semaste    size_t
160254721Semaste    PutHex32 (uint32_t uvalue,
161254721Semaste              lldb::ByteOrder byte_order = lldb::eByteOrderInvalid);
162254721Semaste
163254721Semaste    size_t
164254721Semaste    PutHex64 (uint64_t uvalue,
165254721Semaste              lldb::ByteOrder byte_order = lldb::eByteOrderInvalid);
166254721Semaste
167254721Semaste    size_t
168254721Semaste    PutMaxHex64 (uint64_t uvalue,
169254721Semaste                 size_t byte_size,
170254721Semaste                 lldb::ByteOrder byte_order = lldb::eByteOrderInvalid);
171254721Semaste    size_t
172254721Semaste    PutFloat (float f,
173254721Semaste              lldb::ByteOrder byte_order = lldb::eByteOrderInvalid);
174254721Semaste
175254721Semaste    size_t
176254721Semaste    PutDouble (double d,
177254721Semaste               lldb::ByteOrder byte_order = lldb::eByteOrderInvalid);
178254721Semaste
179254721Semaste    size_t
180254721Semaste    PutLongDouble (long double ld,
181254721Semaste                   lldb::ByteOrder byte_order = lldb::eByteOrderInvalid);
182254721Semaste
183254721Semaste    size_t
184254721Semaste    PutPointer (void *ptr);
185254721Semaste
186254721Semaste    // Append \a src_len bytes from \a src to the stream as hex characters
187254721Semaste    // (two ascii characters per byte of input data)
188254721Semaste    size_t
189254721Semaste    PutBytesAsRawHex8 (const void *src,
190254721Semaste                       size_t src_len,
191254721Semaste                       lldb::ByteOrder src_byte_order = lldb::eByteOrderInvalid,
192254721Semaste                       lldb::ByteOrder dst_byte_order = lldb::eByteOrderInvalid);
193254721Semaste
194254721Semaste    // Append \a src_len bytes from \a s to the stream as binary data.
195254721Semaste    size_t
196254721Semaste    PutRawBytes (const void *s,
197254721Semaste                 size_t src_len,
198254721Semaste                 lldb::ByteOrder src_byte_order = lldb::eByteOrderInvalid,
199254721Semaste                 lldb::ByteOrder dst_byte_order = lldb::eByteOrderInvalid);
200254721Semaste
201254721Semaste    size_t
202254721Semaste    PutCStringAsRawHex8 (const char *s);
203254721Semaste
204254721Semaste    //------------------------------------------------------------------
205254721Semaste    /// Output a NULL terminated C string \a cstr to the stream \a s.
206254721Semaste    ///
207254721Semaste    /// @param[in] cstr
208254721Semaste    ///     A NULL terminated C string.
209254721Semaste    ///
210254721Semaste    /// @return
211254721Semaste    ///     A reference to this class so multiple things can be streamed
212254721Semaste    ///     in one statement.
213254721Semaste    //------------------------------------------------------------------
214254721Semaste    Stream&
215254721Semaste    operator<< (const char *cstr);
216254721Semaste
217254721Semaste    //------------------------------------------------------------------
218254721Semaste    /// Output a pointer value \a p to the stream \a s.
219254721Semaste    ///
220254721Semaste    /// @param[in] p
221254721Semaste    ///     A void pointer.
222254721Semaste    ///
223254721Semaste    /// @return
224254721Semaste    ///     A reference to this class so multiple things can be streamed
225254721Semaste    ///     in one statement.
226254721Semaste    //------------------------------------------------------------------
227254721Semaste    Stream&
228296417Sdim    operator<< (const void *p);
229254721Semaste
230254721Semaste    //------------------------------------------------------------------
231254721Semaste    /// Output a character \a ch to the stream \a s.
232254721Semaste    ///
233254721Semaste    /// @param[in] ch
234254721Semaste    ///     A printable character value.
235254721Semaste    ///
236254721Semaste    /// @return
237254721Semaste    ///     A reference to this class so multiple things can be streamed
238254721Semaste    ///     in one statement.
239254721Semaste    //------------------------------------------------------------------
240254721Semaste    Stream&
241254721Semaste    operator<< (char ch);
242254721Semaste
243254721Semaste    //------------------------------------------------------------------
244254721Semaste    /// Output a uint8_t \a uval to the stream \a s.
245254721Semaste    ///
246254721Semaste    /// @param[in] uval
247254721Semaste    ///     A uint8_t value.
248254721Semaste    ///
249254721Semaste    /// @return
250254721Semaste    ///     A reference to this class so multiple things can be streamed
251254721Semaste    ///     in one statement.
252254721Semaste    //------------------------------------------------------------------
253254721Semaste    Stream&
254254721Semaste    operator<< (uint8_t uval);
255254721Semaste
256254721Semaste    //------------------------------------------------------------------
257254721Semaste    /// Output a uint16_t \a uval to the stream \a s.
258254721Semaste    ///
259254721Semaste    /// @param[in] uval
260254721Semaste    ///     A uint16_t value.
261254721Semaste    ///
262254721Semaste    /// @return
263254721Semaste    ///     A reference to this class so multiple things can be streamed
264254721Semaste    ///     in one statement.
265254721Semaste    //------------------------------------------------------------------
266254721Semaste    Stream&
267254721Semaste    operator<< (uint16_t uval);
268254721Semaste
269254721Semaste    //------------------------------------------------------------------
270254721Semaste    /// Output a uint32_t \a uval to the stream \a s.
271254721Semaste    ///
272254721Semaste    /// @param[in] uval
273254721Semaste    ///     A uint32_t value.
274254721Semaste    ///
275254721Semaste    /// @return
276254721Semaste    ///     A reference to this class so multiple things can be streamed
277254721Semaste    ///     in one statement.
278254721Semaste    //------------------------------------------------------------------
279254721Semaste    Stream&
280254721Semaste    operator<< (uint32_t uval);
281254721Semaste
282254721Semaste    //------------------------------------------------------------------
283254721Semaste    /// Output a uint64_t \a uval to the stream \a s.
284254721Semaste    ///
285254721Semaste    /// @param[in] uval
286254721Semaste    ///     A uint64_t value.
287254721Semaste    ///
288254721Semaste    /// @return
289254721Semaste    ///     A reference to this class so multiple things can be streamed
290254721Semaste    ///     in one statement.
291254721Semaste    //------------------------------------------------------------------
292254721Semaste    Stream&
293254721Semaste    operator<< (uint64_t uval);
294254721Semaste
295254721Semaste    //------------------------------------------------------------------
296254721Semaste    /// Output a int8_t \a sval to the stream \a s.
297254721Semaste    ///
298254721Semaste    /// @param[in] sval
299254721Semaste    ///     A int8_t value.
300254721Semaste    ///
301254721Semaste    /// @return
302254721Semaste    ///     A reference to this class so multiple things can be streamed
303254721Semaste    ///     in one statement.
304254721Semaste    //------------------------------------------------------------------
305254721Semaste    Stream&
306254721Semaste    operator<< (int8_t sval);
307254721Semaste
308254721Semaste    //------------------------------------------------------------------
309254721Semaste    /// Output a int16_t \a sval to the stream \a s.
310254721Semaste    ///
311254721Semaste    /// @param[in] sval
312254721Semaste    ///     A int16_t value.
313254721Semaste    ///
314254721Semaste    /// @return
315254721Semaste    ///     A reference to this class so multiple things can be streamed
316254721Semaste    ///     in one statement.
317254721Semaste    //------------------------------------------------------------------
318254721Semaste    Stream&
319254721Semaste    operator<< (int16_t sval);
320254721Semaste
321254721Semaste    //------------------------------------------------------------------
322254721Semaste    /// Output a int32_t \a sval to the stream \a s.
323254721Semaste    ///
324254721Semaste    /// @param[in] sval
325254721Semaste    ///     A int32_t value.
326254721Semaste    ///
327254721Semaste    /// @return
328254721Semaste    ///     A reference to this class so multiple things can be streamed
329254721Semaste    ///     in one statement.
330254721Semaste    //------------------------------------------------------------------
331254721Semaste    Stream&
332254721Semaste    operator<< (int32_t sval);
333254721Semaste
334254721Semaste    //------------------------------------------------------------------
335254721Semaste    /// Output a int64_t \a sval to the stream \a s.
336254721Semaste    ///
337254721Semaste    /// @param[in] sval
338254721Semaste    ///     A int64_t value.
339254721Semaste    ///
340254721Semaste    /// @return
341254721Semaste    ///     A reference to this class so multiple things can be streamed
342254721Semaste    ///     in one statement.
343254721Semaste    //------------------------------------------------------------------
344254721Semaste    Stream&
345254721Semaste    operator<< (int64_t sval);
346254721Semaste
347254721Semaste    //------------------------------------------------------------------
348254721Semaste    /// Output an address value to this stream.
349254721Semaste    ///
350254721Semaste    /// Put an address \a addr out to the stream with optional \a prefix
351254721Semaste    /// and \a suffix strings.
352254721Semaste    ///
353254721Semaste    /// @param[in] addr
354254721Semaste    ///     An address value.
355254721Semaste    ///
356254721Semaste    /// @param[in] addr_size
357254721Semaste    ///     Size in bytes of the address, used for formatting.
358254721Semaste    ///
359254721Semaste    /// @param[in] prefix
360296417Sdim    ///     A prefix C string. If nullptr, no prefix will be output.
361254721Semaste    ///
362254721Semaste    /// @param[in] suffix
363296417Sdim    ///     A suffix C string. If nullptr, no suffix will be output.
364254721Semaste    //------------------------------------------------------------------
365254721Semaste    void
366296417Sdim    Address(uint64_t addr, uint32_t addr_size, const char *prefix = nullptr, const char *suffix = nullptr);
367254721Semaste
368254721Semaste    //------------------------------------------------------------------
369254721Semaste    /// Output an address range to this stream.
370254721Semaste    ///
371254721Semaste    /// Put an address range \a lo_addr - \a hi_addr out to the stream
372254721Semaste    /// with optional \a prefix and \a suffix strings.
373254721Semaste    ///
374254721Semaste    /// @param[in] lo_addr
375254721Semaste    ///     The start address of the address range.
376254721Semaste    ///
377254721Semaste    /// @param[in] hi_addr
378254721Semaste    ///     The end address of the address range.
379254721Semaste    ///
380254721Semaste    /// @param[in] addr_size
381254721Semaste    ///     Size in bytes of the address, used for formatting.
382254721Semaste    ///
383254721Semaste    /// @param[in] prefix
384296417Sdim    ///     A prefix C string. If nullptr, no prefix will be output.
385254721Semaste    ///
386254721Semaste    /// @param[in] suffix
387296417Sdim    ///     A suffix C string. If nullptr, no suffix will be output.
388254721Semaste    //------------------------------------------------------------------
389254721Semaste    void
390296417Sdim    AddressRange(uint64_t lo_addr, uint64_t hi_addr, uint32_t addr_size, const char *prefix = nullptr, const char *suffix = nullptr);
391254721Semaste
392254721Semaste    //------------------------------------------------------------------
393254721Semaste    /// Output a C string to the stream.
394254721Semaste    ///
395254721Semaste    /// Print a C string \a cstr to the stream.
396254721Semaste    ///
397254721Semaste    /// @param[in] cstr
398254721Semaste    ///     The string to be output to the stream.
399254721Semaste    //------------------------------------------------------------------
400254721Semaste    size_t
401254721Semaste    PutCString (const char *cstr);
402254721Semaste
403254721Semaste    //------------------------------------------------------------------
404254721Semaste    /// Output and End of Line character to the stream.
405254721Semaste    //------------------------------------------------------------------
406254721Semaste    size_t
407254721Semaste    EOL();
408254721Semaste
409254721Semaste    //------------------------------------------------------------------
410254721Semaste    /// Get the address size in bytes.
411254721Semaste    ///
412254721Semaste    /// @return
413254721Semaste    ///     The size of an address in bytes that is used when outputting
414254721Semaste    ///     address and pointer values to the stream.
415254721Semaste    //------------------------------------------------------------------
416254721Semaste    uint32_t
417254721Semaste    GetAddressByteSize () const;
418254721Semaste
419254721Semaste    //------------------------------------------------------------------
420254721Semaste    /// Test if debug logging is enabled.
421254721Semaste    ///
422254721Semaste    /// @return
423254721Semaste    //      \b true if the debug flag bit is set in this stream, \b
424254721Semaste    //      false otherwise.
425254721Semaste    //------------------------------------------------------------------
426254721Semaste    bool
427254721Semaste    GetDebug() const;
428254721Semaste
429254721Semaste    //------------------------------------------------------------------
430254721Semaste    /// The flags accessor.
431254721Semaste    ///
432254721Semaste    /// @return
433254721Semaste    ///     A reference to the Flags member variable.
434254721Semaste    //------------------------------------------------------------------
435254721Semaste    Flags&
436254721Semaste    GetFlags();
437254721Semaste
438254721Semaste    //------------------------------------------------------------------
439254721Semaste    /// The flags const accessor.
440254721Semaste    ///
441254721Semaste    /// @return
442254721Semaste    ///     A const reference to the Flags member variable.
443254721Semaste    //------------------------------------------------------------------
444254721Semaste    const Flags&
445254721Semaste    GetFlags() const;
446254721Semaste
447254721Semaste    //------------------------------------------------------------------
448254721Semaste    //// The byte order accessor.
449254721Semaste    ////
450254721Semaste    //// @return
451254721Semaste    ////     The byte order.
452254721Semaste    //------------------------------------------------------------------
453254721Semaste    lldb::ByteOrder
454254721Semaste    GetByteOrder() const;
455254721Semaste
456254721Semaste    //------------------------------------------------------------------
457254721Semaste    /// Get the current indentation level.
458254721Semaste    ///
459254721Semaste    /// @return
460254721Semaste    ///     The current indentation level as an integer.
461254721Semaste    //------------------------------------------------------------------
462254721Semaste    int
463254721Semaste    GetIndentLevel () const;
464254721Semaste
465254721Semaste    //------------------------------------------------------------------
466254721Semaste    /// Test if verbose logging is enabled.
467254721Semaste    ///
468254721Semaste    /// @return
469254721Semaste    //      \b true if the verbose flag bit is set in this stream, \b
470254721Semaste    //      false otherwise.
471254721Semaste    //------------------------------------------------------------------
472254721Semaste    bool
473254721Semaste    GetVerbose() const;
474254721Semaste
475254721Semaste    //------------------------------------------------------------------
476254721Semaste    /// Indent the current line in the stream.
477254721Semaste    ///
478254721Semaste    /// Indent the current line using the current indentation level and
479276479Sdim    /// print an optional string following the indentation spaces.
480254721Semaste    ///
481254721Semaste    /// @param[in] s
482296417Sdim    ///     A C string to print following the indentation. If nullptr, just
483254721Semaste    ///     output the indentation characters.
484254721Semaste    //------------------------------------------------------------------
485254721Semaste    size_t
486296417Sdim    Indent(const char *s = nullptr);
487254721Semaste
488254721Semaste    //------------------------------------------------------------------
489254721Semaste    /// Decrement the current indentation level.
490254721Semaste    //------------------------------------------------------------------
491254721Semaste    void
492254721Semaste    IndentLess (int amount = 2);
493254721Semaste
494254721Semaste    //------------------------------------------------------------------
495254721Semaste    /// Increment the current indentation level.
496254721Semaste    //------------------------------------------------------------------
497254721Semaste    void
498254721Semaste    IndentMore (int amount = 2);
499254721Semaste
500254721Semaste    //------------------------------------------------------------------
501254721Semaste    /// Output an offset value.
502254721Semaste    ///
503254721Semaste    /// Put an offset \a uval out to the stream using the printf format
504254721Semaste    /// in \a format.
505254721Semaste    ///
506254721Semaste    /// @param[in] offset
507254721Semaste    ///     The offset value.
508254721Semaste    ///
509254721Semaste    /// @param[in] format
510254721Semaste    ///     The printf style format to use when outputting the offset.
511254721Semaste    //------------------------------------------------------------------
512254721Semaste    void
513254721Semaste    Offset (uint32_t offset, const char *format = "0x%8.8x: ");
514254721Semaste
515254721Semaste    //------------------------------------------------------------------
516254721Semaste    /// Output printf formatted output to the stream.
517254721Semaste    ///
518254721Semaste    /// Print some formatted output to the stream.
519254721Semaste    ///
520254721Semaste    /// @param[in] format
521254721Semaste    ///     A printf style format string.
522254721Semaste    ///
523254721Semaste    /// @param[in] ...
524254721Semaste    ///     Variable arguments that are needed for the printf style
525254721Semaste    ///     format string \a format.
526254721Semaste    //------------------------------------------------------------------
527254721Semaste    size_t
528254721Semaste    Printf (const char *format, ...)  __attribute__ ((format (printf, 2, 3)));
529254721Semaste
530254721Semaste    size_t
531254721Semaste    PrintfVarArg(const char *format, va_list args);
532254721Semaste
533254721Semaste    //------------------------------------------------------------------
534254721Semaste    /// Output a quoted C string value to the stream.
535254721Semaste    ///
536254721Semaste    /// Print a double quoted NULL terminated C string to the stream
537254721Semaste    /// using the printf format in \a format.
538254721Semaste    ///
539254721Semaste    /// @param[in] cstr
540254721Semaste    ///     A NULL terminated C string value.
541254721Semaste    ///
542254721Semaste    /// @param[in] format
543254721Semaste    ///     The optional C string format that can be overridden.
544254721Semaste    //------------------------------------------------------------------
545254721Semaste    void
546254721Semaste    QuotedCString (const char *cstr, const char *format = "\"%s\"");
547254721Semaste
548254721Semaste    //------------------------------------------------------------------
549254721Semaste    /// Set the address size in bytes.
550254721Semaste    ///
551254721Semaste    /// @param[in] addr_size
552254721Semaste    ///     The new size in bytes of an address to use when outputting
553254721Semaste    ///     address and pointer values.
554254721Semaste    //------------------------------------------------------------------
555254721Semaste    void
556254721Semaste    SetAddressByteSize (uint32_t addr_size);
557254721Semaste
558254721Semaste    //------------------------------------------------------------------
559254721Semaste    /// Set the current indentation level.
560254721Semaste    ///
561254721Semaste    /// @param[in] level
562254721Semaste    ///     The new indentation level.
563254721Semaste    //------------------------------------------------------------------
564254721Semaste    void
565254721Semaste    SetIndentLevel (int level);
566254721Semaste
567254721Semaste    //------------------------------------------------------------------
568254721Semaste    /// Output a SLEB128 number to the stream.
569254721Semaste    ///
570254721Semaste    /// Put an SLEB128 \a uval out to the stream using the printf format
571254721Semaste    /// in \a format.
572254721Semaste    ///
573254721Semaste    /// @param[in] uval
574254721Semaste    ///     A uint64_t value that was extracted as a SLEB128 value.
575254721Semaste    ///
576254721Semaste    /// @param[in] format
577254721Semaste    ///     The optional printf format that can be overridden.
578254721Semaste    //------------------------------------------------------------------
579254721Semaste    size_t
580254721Semaste    PutSLEB128 (int64_t uval);
581254721Semaste
582254721Semaste    //------------------------------------------------------------------
583254721Semaste    /// Output a ULEB128 number to the stream.
584254721Semaste    ///
585254721Semaste    /// Put an ULEB128 \a uval out to the stream using the printf format
586254721Semaste    /// in \a format.
587254721Semaste    ///
588254721Semaste    /// @param[in] uval
589254721Semaste    ///     A uint64_t value that was extracted as a ULEB128 value.
590254721Semaste    ///
591254721Semaste    /// @param[in] format
592254721Semaste    ///     The optional printf format that can be overridden.
593254721Semaste    //------------------------------------------------------------------
594254721Semaste    size_t
595254721Semaste    PutULEB128 (uint64_t uval);
596254721Semaste
597254721Semaste    static void
598254721Semaste    UnitTest(Stream *s);
599254721Semaste
600254721Semasteprotected:
601254721Semaste    //------------------------------------------------------------------
602254721Semaste    // Member variables
603254721Semaste    //------------------------------------------------------------------
604254721Semaste    Flags m_flags;                  ///< Dump flags.
605254721Semaste    uint32_t m_addr_size;           ///< Size of an address in bytes.
606254721Semaste    lldb::ByteOrder m_byte_order;   ///< Byte order to use when encoding scalar types.
607254721Semaste    int m_indent_level;             ///< Indention level.
608254721Semaste
609254721Semaste    size_t _PutHex8 (uint8_t uvalue, bool add_prefix);
610254721Semaste};
611254721Semaste
612254721Semaste} // namespace lldb_private
613254721Semaste
614254721Semaste#endif  // liblldb_Stream_h_
615