blob: 8b826df7e69bd5ce2af3c18e585007faf175e9d3 [file] [log] [blame]
Sean Callananc0492742011-05-23 21:40:23 +00001//===-- ProcessDataAllocator.cpp --------------------------------*- 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#include "lldb/Core/DataBufferHeap.h"
11#include "lldb/Core/DataExtractor.h"
12#include "lldb/Expression/ProcessDataAllocator.h"
13
14using namespace lldb_private;
15
16void
17ProcessDataAllocator::Dump(Stream &stream)
18{
19 size_t data_size = m_stream_string.GetSize();
20
21 if (!m_allocation)
22 return;
23
24 lldb::DataBufferSP data(new DataBufferHeap(data_size, 0));
25
26 Error error;
27 if (m_process.ReadMemory (m_allocation, data->GetBytes(), data_size, error) != data_size)
28 return;
29
30 DataExtractor extractor(data, m_process.GetByteOrder(), m_process.GetAddressByteSize());
31
32 extractor.Dump(&stream, // stream
33 0, // offset
34 lldb::eFormatBytesWithASCII, // format
35 1, // byte size of individual entries
36 data_size, // number of entries
37 16, // entries per line
38 m_allocation, // address to print
39 0, // bit size (bitfields only; 0 means ignore)
40 0); // bit alignment (bitfields only; 0 means ignore)
41
42 stream.PutChar('\n');
43}