Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(729)

Side by Side Diff: syzygy/agent/asan/error_info_unittest.cc

Issue 2508333002: Remove the is_nested bit from the BlockInfo structure. (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 Google Inc. All Rights Reserved. 1 // Copyright 2014 Google Inc. All Rights Reserved.
2 // 2 //
3 // Licensed under the Apache License, Version 2.0 (the "License"); 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License. 4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at 5 // You may obtain a copy of the License at
6 // 6 //
7 // http://www.apache.org/licenses/LICENSE-2.0 7 // http://www.apache.org/licenses/LICENSE-2.0
8 // 8 //
9 // Unless required by applicable law or agreed to in writing, software 9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS, 10 // distributed under the License is distributed on an "AS IS" BASIS,
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 Super::TearDown(); 46 Super::TearDown();
47 } 47 }
48 48
49 void InitAsanBlockInfo(AsanBlockInfo* block_info) { 49 void InitAsanBlockInfo(AsanBlockInfo* block_info) {
50 if (dummy_block_data_.empty()) { 50 if (dummy_block_data_.empty()) {
51 // Create a dummy block to physically back the report. 51 // Create a dummy block to physically back the report.
52 BlockLayout layout = {}; 52 BlockLayout layout = {};
53 BlockPlanLayout(kShadowRatio, kShadowRatio, 8, 0, 0, &layout); 53 BlockPlanLayout(kShadowRatio, kShadowRatio, 8, 0, 0, &layout);
54 dummy_block_data_.resize(layout.block_size); 54 dummy_block_data_.resize(layout.block_size);
55 BlockInfo info = {}; 55 BlockInfo info = {};
56 BlockInitialize(layout, &dummy_block_data_.at(0), false, &info); 56 BlockInitialize(layout, &dummy_block_data_.at(0), &info);
57 runtime_->shadow()->PoisonAllocatedBlock(info); 57 runtime_->shadow()->PoisonAllocatedBlock(info);
58 58
59 // Normalize a handful of fields to make the comparison simpler. 59 // Normalize a handful of fields to make the comparison simpler.
60 info.trailer->alloc_ticks = 0; 60 info.trailer->alloc_ticks = 0;
61 info.trailer->alloc_tid = 0; 61 info.trailer->alloc_tid = 0;
62 } 62 }
63 63
64 block_info->header = &dummy_block_data_.at(0); 64 block_info->header = &dummy_block_data_.at(0);
65 block_info->user_size = 8; 65 block_info->user_size = 8;
66 block_info->state = ALLOCATED_BLOCK; 66 block_info->state = ALLOCATED_BLOCK;
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 149
150 // Initializes the inner block. 150 // Initializes the inner block.
151 BlockLayout inner_block_layout = {}; 151 BlockLayout inner_block_layout = {};
152 EXPECT_TRUE(BlockPlanLayout(kShadowRatio, 152 EXPECT_TRUE(BlockPlanLayout(kShadowRatio,
153 kShadowRatio, 153 kShadowRatio,
154 kInnerBlockAllocSize, 154 kInnerBlockAllocSize,
155 0, 155 0,
156 0, 156 0,
157 &inner_block_layout)); 157 &inner_block_layout));
158 BlockInfo inner_block_info = {}; 158 BlockInfo inner_block_info = {};
159 BlockInitialize(inner_block_layout, fake_block.block_info.body, true, 159 BlockInitialize(inner_block_layout, fake_block.block_info.body,
160 &inner_block_info); 160 &inner_block_info);
161 ASSERT_NE(reinterpret_cast<void*>(NULL), inner_block_info.body); 161 ASSERT_NE(reinterpret_cast<void*>(NULL), inner_block_info.body);
162 runtime_->shadow()->PoisonAllocatedBlock(inner_block_info); 162 runtime_->shadow()->PoisonAllocatedBlock(inner_block_info);
163 inner_block_info.header->alloc_stack = 163 inner_block_info.header->alloc_stack =
164 runtime_->stack_cache()->SaveStackTrace(stack); 164 runtime_->stack_cache()->SaveStackTrace(stack);
165 BlockHeader* inner_header = inner_block_info.header; 165 BlockHeader* inner_header = inner_block_info.header;
166 BlockHeader* outer_header = reinterpret_cast<BlockHeader*>( 166 BlockHeader* outer_header = reinterpret_cast<BlockHeader*>(
167 fake_block.buffer_align_begin); 167 fake_block.buffer_align_begin);
168 168
169 AsanErrorInfo error_info = {}; 169 AsanErrorInfo error_info = {};
(...skipping 784 matching lines...) Expand 10 before | Expand all | Expand 10 after
954 EXPECT_EQ(block_info.state, error_info_from_proto.block_info.state); 954 EXPECT_EQ(block_info.state, error_info_from_proto.block_info.state);
955 EXPECT_EQ(block_info.heap_type, error_info_from_proto.block_info.heap_type); 955 EXPECT_EQ(block_info.heap_type, error_info_from_proto.block_info.heap_type);
956 EXPECT_EQ(block_info.alloc_tid, error_info_from_proto.block_info.alloc_tid); 956 EXPECT_EQ(block_info.alloc_tid, error_info_from_proto.block_info.alloc_tid);
957 EXPECT_EQ(block_info.free_tid, error_info_from_proto.block_info.free_tid); 957 EXPECT_EQ(block_info.free_tid, error_info_from_proto.block_info.free_tid);
958 EXPECT_EQ(block_info.milliseconds_since_free, 958 EXPECT_EQ(block_info.milliseconds_since_free,
959 error_info_from_proto.block_info.milliseconds_since_free); 959 error_info_from_proto.block_info.milliseconds_since_free);
960 } 960 }
961 961
962 } // namespace asan 962 } // namespace asan
963 } // namespace agent 963 } // namespace agent
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698