Include DexFile::GetLocation() in DexFile [D]CHECKs
Change-Id: I9abe2aa1cfdcb34e40ba1edc5ba5bf9a44207422
diff --git a/src/dex_file.cc b/src/dex_file.cc
index 01bb6d5..59b92d6 100644
--- a/src/dex_file.cc
+++ b/src/dex_file.cc
@@ -398,7 +398,7 @@
}
bool DexFile::CheckMagic(const byte* magic) {
- CHECK(magic != NULL);
+ CHECK(magic != NULL) << GetLocation();
if (memcmp(magic, kDexMagic, sizeof(kDexMagic)) != 0) {
LOG(ERROR) << "Unrecognized magic number:"
<< " " << magic[0]
@@ -431,14 +431,14 @@
// Returns a pointer to the UTF-8 string data referred to by the given string_id.
const char* DexFile::GetStringDataAndLength(const StringId& string_id, int32_t* length) const {
- CHECK(length != NULL);
+ CHECK(length != NULL) << GetLocation();
const byte* ptr = base_ + string_id.string_data_off_;
*length = DecodeUnsignedLeb128(&ptr);
return reinterpret_cast<const char*>(ptr);
}
void DexFile::InitIndex() {
- CHECK_EQ(index_.size(), 0U);
+ CHECK_EQ(index_.size(), 0U) << GetLocation();
for (size_t i = 0; i < NumClassDefs(); ++i) {
const ClassDef& class_def = GetClassDef(i);
const char* descriptor = GetClassDescriptor(class_def);
@@ -700,7 +700,7 @@
}
const CodeItem* code_item = GetCodeItem(method->GetCodeItemOffset());
- DCHECK(code_item != NULL);
+ DCHECK(code_item != NULL) << GetLocation();
// A method with no line number info should return -1
LineNumFromPcContext context(rel_pc, -1);