Merge "More renaming."
diff --git a/bcinfo/Wrap/file_wrapper_output.cpp b/bcinfo/Wrap/file_wrapper_output.cpp
index 4cdc54e..53f433b 100644
--- a/bcinfo/Wrap/file_wrapper_output.cpp
+++ b/bcinfo/Wrap/file_wrapper_output.cpp
@@ -36,6 +36,10 @@
}
bool FileWrapperOutput::Write(const uint8_t* buffer, size_t buffer_size) {
+ if (!buffer) {
+ return false;
+ }
+
if (buffer_size > 0) {
return buffer_size == fwrite(buffer, 1, buffer_size, _file);
} else {
diff --git a/bcinfo/Wrap/in_memory_wrapper_input.cpp b/bcinfo/Wrap/in_memory_wrapper_input.cpp
index 3f91f01..2d45d9c 100644
--- a/bcinfo/Wrap/in_memory_wrapper_input.cpp
+++ b/bcinfo/Wrap/in_memory_wrapper_input.cpp
@@ -28,6 +28,11 @@
size_t InMemoryWrapperInput::Read(uint8_t* buffer, size_t wanted) {
size_t found = 0;
+
+ if (!buffer) {
+ return 0;
+ }
+
while (found < wanted) {
if (_pos >= _size) {
return found;
diff --git a/include/bcinfo/Wrap/BCHeaderField.h b/include/bcinfo/Wrap/BCHeaderField.h
index 8652d78..fd8d585 100644
--- a/include/bcinfo/Wrap/BCHeaderField.h
+++ b/include/bcinfo/Wrap/BCHeaderField.h
@@ -17,7 +17,6 @@
#ifndef LLVM_WRAP_BCHEADER_FIELD_H__
#define LLVM_WRAP_BCHEADER_FIELD_H__
-#include <limits>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
@@ -51,8 +50,9 @@
size_t pad_len = (4 - (fields_len & 3)) & 3;
// Ensure buffer is large enough and that length can be represented
// in 16 bits
+ const size_t max_uint16_t = 65535;
if (buf_len < fields_len + pad_len ||
- len_ > std::numeric_limits<FixedSubfield>::max()) return false;
+ len_ > max_uint16_t) return false;
WriteFixedSubfield(static_cast<FixedSubfield>(ID_), buf);
WriteFixedSubfield(static_cast<FixedSubfield>(len_),
diff --git a/lib/ExecutionEngine/MCCacheReader.cpp b/lib/ExecutionEngine/MCCacheReader.cpp
index 6005536..bf4fe47 100644
--- a/lib/ExecutionEngine/MCCacheReader.cpp
+++ b/lib/ExecutionEngine/MCCacheReader.cpp
@@ -466,6 +466,13 @@
mpResult->mCachedELFExecutable.size(),
&resolveSymbolAdapter, this);
+ // Point ELF section headers to location of executable code, otherwise
+ // execution through GDB stops unexpectedly as GDB translates breakpoints
+ // in JITted code incorrectly (and complains about being unable to insert
+ // breakpoint at an invalid address)
+ rsloaderUpdateSectionHeaders(mpResult->mRSExecutable,
+ (unsigned char*) mpResult->mCachedELFExecutable.begin());
+
return true;
}