summaryrefslogtreecommitdiffstats
path: root/lldb/tools/debugserver/source/DNBDataRef.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/tools/debugserver/source/DNBDataRef.cpp')
-rw-r--r--lldb/tools/debugserver/source/DNBDataRef.cpp30
1 files changed, 0 insertions, 30 deletions
diff --git a/lldb/tools/debugserver/source/DNBDataRef.cpp b/lldb/tools/debugserver/source/DNBDataRef.cpp
index 073591c8afe..f19c913f65d 100644
--- a/lldb/tools/debugserver/source/DNBDataRef.cpp
+++ b/lldb/tools/debugserver/source/DNBDataRef.cpp
@@ -16,33 +16,25 @@
#include <ctype.h>
#include <libkern/OSByteOrder.h>
-//----------------------------------------------------------------------
// Constructor
-//----------------------------------------------------------------------
DNBDataRef::DNBDataRef()
: m_start(NULL), m_end(NULL), m_swap(false), m_ptrSize(0),
m_addrPCRelative(INVALID_NUB_ADDRESS), m_addrTEXT(INVALID_NUB_ADDRESS),
m_addrDATA(INVALID_NUB_ADDRESS) {}
-//----------------------------------------------------------------------
// Constructor
-//----------------------------------------------------------------------
DNBDataRef::DNBDataRef(const uint8_t *start, size_t size, bool swap)
: m_start(start), m_end(start + size), m_swap(swap), m_ptrSize(0),
m_addrPCRelative(INVALID_NUB_ADDRESS), m_addrTEXT(INVALID_NUB_ADDRESS),
m_addrDATA(INVALID_NUB_ADDRESS) {}
-//----------------------------------------------------------------------
// Destructor
-//----------------------------------------------------------------------
DNBDataRef::~DNBDataRef() {}
-//----------------------------------------------------------------------
// Get8
-//----------------------------------------------------------------------
uint8_t DNBDataRef::Get8(offset_t *offset_ptr) const {
uint8_t val = 0;
if (ValidOffsetForDataOfSize(*offset_ptr, sizeof(val))) {
@@ -52,9 +44,7 @@ uint8_t DNBDataRef::Get8(offset_t *offset_ptr) const {
return val;
}
-//----------------------------------------------------------------------
// Get16
-//----------------------------------------------------------------------
uint16_t DNBDataRef::Get16(offset_t *offset_ptr) const {
uint16_t val = 0;
if (ValidOffsetForDataOfSize(*offset_ptr, sizeof(val))) {
@@ -70,9 +60,7 @@ uint16_t DNBDataRef::Get16(offset_t *offset_ptr) const {
return val;
}
-//----------------------------------------------------------------------
// Get32
-//----------------------------------------------------------------------
uint32_t DNBDataRef::Get32(offset_t *offset_ptr) const {
uint32_t val = 0;
if (ValidOffsetForDataOfSize(*offset_ptr, sizeof(val))) {
@@ -87,9 +75,7 @@ uint32_t DNBDataRef::Get32(offset_t *offset_ptr) const {
return val;
}
-//----------------------------------------------------------------------
// Get64
-//----------------------------------------------------------------------
uint64_t DNBDataRef::Get64(offset_t *offset_ptr) const {
uint64_t val = 0;
if (ValidOffsetForDataOfSize(*offset_ptr, sizeof(val))) {
@@ -104,12 +90,10 @@ uint64_t DNBDataRef::Get64(offset_t *offset_ptr) const {
return val;
}
-//----------------------------------------------------------------------
// GetMax32
//
// Used for calls when the size can vary. Fill in extra cases if they
// are ever needed.
-//----------------------------------------------------------------------
uint32_t DNBDataRef::GetMax32(offset_t *offset_ptr, uint32_t byte_size) const {
switch (byte_size) {
case 1:
@@ -128,12 +112,10 @@ uint32_t DNBDataRef::GetMax32(offset_t *offset_ptr, uint32_t byte_size) const {
return 0;
}
-//----------------------------------------------------------------------
// GetMax64
//
// Used for calls when the size can vary. Fill in extra cases if they
// are ever needed.
-//----------------------------------------------------------------------
uint64_t DNBDataRef::GetMax64(offset_t *offset_ptr, uint32_t size) const {
switch (size) {
case 1:
@@ -155,20 +137,16 @@ uint64_t DNBDataRef::GetMax64(offset_t *offset_ptr, uint32_t size) const {
return 0;
}
-//----------------------------------------------------------------------
// GetPointer
//
// Extract a pointer value from the buffer. The pointer size must be
// set prior to using this using one of the SetPointerSize functions.
-//----------------------------------------------------------------------
uint64_t DNBDataRef::GetPointer(offset_t *offset_ptr) const {
// Must set pointer size prior to using this call
assert(m_ptrSize != 0);
return GetMax64(offset_ptr, m_ptrSize);
}
-//----------------------------------------------------------------------
// GetCStr
-//----------------------------------------------------------------------
const char *DNBDataRef::GetCStr(offset_t *offset_ptr,
uint32_t fixed_length) const {
const char *s = NULL;
@@ -184,9 +162,7 @@ const char *DNBDataRef::GetCStr(offset_t *offset_ptr,
return s;
}
-//----------------------------------------------------------------------
// GetData
-//----------------------------------------------------------------------
const uint8_t *DNBDataRef::GetData(offset_t *offset_ptr,
uint32_t length) const {
const uint8_t *data = NULL;
@@ -197,9 +173,7 @@ const uint8_t *DNBDataRef::GetData(offset_t *offset_ptr,
return data;
}
-//----------------------------------------------------------------------
// Get_ULEB128
-//----------------------------------------------------------------------
uint64_t DNBDataRef::Get_ULEB128(offset_t *offset_ptr) const {
uint64_t result = 0;
if (m_start < m_end) {
@@ -222,9 +196,7 @@ uint64_t DNBDataRef::Get_ULEB128(offset_t *offset_ptr) const {
return result;
}
-//----------------------------------------------------------------------
// Get_SLEB128
-//----------------------------------------------------------------------
int64_t DNBDataRef::Get_SLEB128(offset_t *offset_ptr) const {
int64_t result = 0;
@@ -254,11 +226,9 @@ int64_t DNBDataRef::Get_SLEB128(offset_t *offset_ptr) const {
return result;
}
-//----------------------------------------------------------------------
// Skip_LEB128
//
// Skips past ULEB128 and SLEB128 numbers (just updates the offset)
-//----------------------------------------------------------------------
void DNBDataRef::Skip_LEB128(offset_t *offset_ptr) const {
if (m_start < m_end) {
const uint8_t *start = m_start + *offset_ptr;
OpenPOWER on IntegriCloud