Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 1 | //===-- Block.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/Symbol/Block.h" |
| 11 | #include "lldb/Symbol/Function.h" |
| 12 | #include "lldb/Core/Module.h" |
| 13 | #include "lldb/Core/Section.h" |
| 14 | #include "lldb/Symbol/SymbolVendor.h" |
| 15 | #include "lldb/Symbol/VariableList.h" |
| 16 | |
| 17 | using namespace lldb; |
| 18 | using namespace lldb_private; |
| 19 | |
Greg Clayton | 75ccf50 | 2010-08-21 02:22:51 +0000 | [diff] [blame] | 20 | Block::Block(lldb::user_id_t uid) : |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 21 | UserID(uid), |
Greg Clayton | 75ccf50 | 2010-08-21 02:22:51 +0000 | [diff] [blame] | 22 | m_parent_scope (NULL), |
| 23 | m_sibling (NULL), |
| 24 | m_children (), |
| 25 | m_ranges (), |
| 26 | m_inlineInfoSP (), |
Greg Clayton | b04e7a8 | 2010-08-24 21:05:24 +0000 | [diff] [blame] | 27 | m_variable_list_sp (), |
Greg Clayton | 75ccf50 | 2010-08-21 02:22:51 +0000 | [diff] [blame] | 28 | m_parsed_block_info (false), |
| 29 | m_parsed_block_variables (false), |
| 30 | m_parsed_child_blocks (false) |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 31 | { |
| 32 | } |
| 33 | |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 34 | Block::~Block () |
| 35 | { |
| 36 | } |
| 37 | |
| 38 | void |
Greg Clayton | 75ccf50 | 2010-08-21 02:22:51 +0000 | [diff] [blame] | 39 | Block::GetDescription(Stream *s, Function *function, lldb::DescriptionLevel level, Process *process) const |
Greg Clayton | 12bec71 | 2010-06-28 21:30:43 +0000 | [diff] [blame] | 40 | { |
| 41 | size_t num_ranges = m_ranges.size(); |
| 42 | if (num_ranges) |
| 43 | { |
| 44 | |
| 45 | addr_t base_addr = LLDB_INVALID_ADDRESS; |
| 46 | if (process) |
Greg Clayton | 75ccf50 | 2010-08-21 02:22:51 +0000 | [diff] [blame] | 47 | base_addr = function->GetAddressRange().GetBaseAddress().GetLoadAddress(process); |
Greg Clayton | 12bec71 | 2010-06-28 21:30:43 +0000 | [diff] [blame] | 48 | if (base_addr == LLDB_INVALID_ADDRESS) |
Greg Clayton | 75ccf50 | 2010-08-21 02:22:51 +0000 | [diff] [blame] | 49 | base_addr = function->GetAddressRange().GetBaseAddress().GetFileAddress(); |
Greg Clayton | 12bec71 | 2010-06-28 21:30:43 +0000 | [diff] [blame] | 50 | |
| 51 | s->Printf("range%s = ", num_ranges > 1 ? "s" : ""); |
| 52 | std::vector<VMRange>::const_iterator pos, end = m_ranges.end(); |
| 53 | for (pos = m_ranges.begin(); pos != end; ++pos) |
| 54 | pos->Dump(s, base_addr, 4); |
| 55 | } |
| 56 | *s << ", id = " << ((const UserID&)*this); |
| 57 | |
| 58 | if (m_inlineInfoSP.get() != NULL) |
| 59 | m_inlineInfoSP->Dump(s); |
| 60 | } |
| 61 | |
| 62 | void |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 63 | Block::Dump(Stream *s, addr_t base_addr, int32_t depth, bool show_context) const |
| 64 | { |
| 65 | if (depth < 0) |
| 66 | { |
Greg Clayton | 75ccf50 | 2010-08-21 02:22:51 +0000 | [diff] [blame] | 67 | Block *parent = GetParent(); |
| 68 | if (parent) |
| 69 | { |
| 70 | // We have a depth that is less than zero, print our parent blocks |
| 71 | // first |
| 72 | parent->Dump(s, base_addr, depth + 1, show_context); |
| 73 | } |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 74 | } |
| 75 | |
| 76 | s->Printf("%.*p: ", (int)sizeof(void*) * 2, this); |
| 77 | s->Indent(); |
| 78 | *s << "Block" << ((const UserID&)*this); |
Greg Clayton | 12bec71 | 2010-06-28 21:30:43 +0000 | [diff] [blame] | 79 | const Block* parent_block = GetParent(); |
| 80 | if (parent_block) |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 81 | { |
Greg Clayton | 12bec71 | 2010-06-28 21:30:43 +0000 | [diff] [blame] | 82 | s->Printf(", parent = {0x%8.8x}", parent_block->GetID()); |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 83 | } |
| 84 | if (m_inlineInfoSP.get() != NULL) |
| 85 | m_inlineInfoSP->Dump(s); |
| 86 | |
| 87 | if (!m_ranges.empty()) |
| 88 | { |
| 89 | *s << ", ranges ="; |
| 90 | std::vector<VMRange>::const_iterator pos; |
| 91 | std::vector<VMRange>::const_iterator end = m_ranges.end(); |
| 92 | for (pos = m_ranges.begin(); pos != end; ++pos) |
| 93 | { |
| 94 | if (parent_block != NULL && parent_block->Contains(*pos) == false) |
| 95 | *s << '!'; |
| 96 | else |
| 97 | *s << ' '; |
| 98 | pos->Dump(s, base_addr); |
| 99 | } |
| 100 | } |
| 101 | s->EOL(); |
| 102 | |
| 103 | if (depth > 0) |
| 104 | { |
| 105 | s->IndentMore(); |
| 106 | |
Greg Clayton | b04e7a8 | 2010-08-24 21:05:24 +0000 | [diff] [blame] | 107 | if (m_variable_list_sp.get()) |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 108 | { |
Greg Clayton | b04e7a8 | 2010-08-24 21:05:24 +0000 | [diff] [blame] | 109 | m_variable_list_sp->Dump(s, show_context); |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 110 | } |
| 111 | |
Greg Clayton | 75ccf50 | 2010-08-21 02:22:51 +0000 | [diff] [blame] | 112 | for (Block *child_block = GetFirstChild(); child_block != NULL; child_block = child_block->GetSibling()) |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 113 | { |
Greg Clayton | 75ccf50 | 2010-08-21 02:22:51 +0000 | [diff] [blame] | 114 | child_block->Dump(s, base_addr, depth - 1, show_context); |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 115 | } |
| 116 | |
| 117 | s->IndentLess(); |
| 118 | } |
| 119 | |
| 120 | } |
| 121 | |
| 122 | |
Greg Clayton | 75ccf50 | 2010-08-21 02:22:51 +0000 | [diff] [blame] | 123 | Block * |
| 124 | Block::FindBlockByID (user_id_t block_id) |
| 125 | { |
| 126 | if (block_id == GetID()) |
| 127 | return this; |
| 128 | |
| 129 | Block *matching_block = NULL; |
| 130 | for (Block *child_block = GetFirstChild(); child_block != NULL; child_block = child_block->GetSibling()) |
| 131 | { |
| 132 | matching_block = child_block->FindBlockByID (block_id); |
| 133 | if (matching_block) |
| 134 | break; |
| 135 | } |
| 136 | return matching_block; |
| 137 | } |
| 138 | |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 139 | void |
Greg Clayton | b04e7a8 | 2010-08-24 21:05:24 +0000 | [diff] [blame] | 140 | Block::CalculateSymbolContext (SymbolContext* sc) |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 141 | { |
Greg Clayton | 75ccf50 | 2010-08-21 02:22:51 +0000 | [diff] [blame] | 142 | if (m_parent_scope) |
| 143 | m_parent_scope->CalculateSymbolContext(sc); |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 144 | sc->block = this; |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 145 | } |
| 146 | |
| 147 | void |
| 148 | Block::DumpStopContext (Stream *s, const SymbolContext *sc) |
| 149 | { |
Greg Clayton | 12bec71 | 2010-06-28 21:30:43 +0000 | [diff] [blame] | 150 | Block* parent_block = GetParent(); |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 151 | |
Greg Clayton | b04e7a8 | 2010-08-24 21:05:24 +0000 | [diff] [blame] | 152 | const InlineFunctionInfo* inline_info = InlinedFunctionInfo (); |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 153 | if (inline_info) |
| 154 | { |
| 155 | const Declaration &call_site = inline_info->GetCallSite(); |
| 156 | if (sc) |
| 157 | { |
| 158 | // First frame, dump the first inline call site |
| 159 | // if (call_site.IsValid()) |
| 160 | // { |
| 161 | // s->PutCString(" at "); |
| 162 | // call_site.DumpStopContext (s); |
| 163 | // } |
| 164 | s->PutCString (" [inlined]"); |
| 165 | } |
| 166 | s->EOL(); |
| 167 | inline_info->DumpStopContext (s); |
| 168 | if (sc == NULL) |
| 169 | { |
| 170 | if (call_site.IsValid()) |
| 171 | { |
| 172 | s->PutCString(" at "); |
| 173 | call_site.DumpStopContext (s); |
| 174 | } |
| 175 | } |
| 176 | } |
| 177 | |
| 178 | if (sc) |
| 179 | { |
| 180 | // If we have any inlined functions, this will be the deepest most |
| 181 | // inlined location |
| 182 | if (sc->line_entry.IsValid()) |
| 183 | { |
| 184 | s->PutCString(" at "); |
| 185 | sc->line_entry.DumpStopContext (s); |
| 186 | } |
| 187 | } |
| 188 | if (parent_block) |
| 189 | parent_block->Block::DumpStopContext (s, NULL); |
| 190 | } |
| 191 | |
| 192 | |
| 193 | void |
| 194 | Block::DumpSymbolContext(Stream *s) |
| 195 | { |
Greg Clayton | 75ccf50 | 2010-08-21 02:22:51 +0000 | [diff] [blame] | 196 | SymbolContext sc; |
| 197 | CalculateSymbolContext(&sc); |
| 198 | if (sc.function) |
| 199 | sc.function->DumpSymbolContext(s); |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 200 | s->Printf(", Block{0x%8.8x}", GetID()); |
| 201 | } |
| 202 | |
| 203 | bool |
| 204 | Block::Contains (addr_t range_offset) const |
| 205 | { |
| 206 | return VMRange::ContainsValue(m_ranges, range_offset); |
| 207 | } |
| 208 | |
| 209 | bool |
| 210 | Block::Contains (const VMRange& range) const |
| 211 | { |
| 212 | return VMRange::ContainsRange(m_ranges, range); |
| 213 | } |
| 214 | |
Greg Clayton | 75ccf50 | 2010-08-21 02:22:51 +0000 | [diff] [blame] | 215 | Block * |
| 216 | Block::GetParent () const |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 217 | { |
Greg Clayton | 75ccf50 | 2010-08-21 02:22:51 +0000 | [diff] [blame] | 218 | if (m_parent_scope) |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 219 | { |
Greg Clayton | 75ccf50 | 2010-08-21 02:22:51 +0000 | [diff] [blame] | 220 | SymbolContext sc; |
| 221 | m_parent_scope->CalculateSymbolContext(&sc); |
| 222 | if (sc.block) |
| 223 | return sc.block; |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 224 | } |
Greg Clayton | 75ccf50 | 2010-08-21 02:22:51 +0000 | [diff] [blame] | 225 | return NULL; |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 226 | } |
| 227 | |
Greg Clayton | 33ed170 | 2010-08-24 00:45:41 +0000 | [diff] [blame] | 228 | Block * |
Greg Clayton | b04e7a8 | 2010-08-24 21:05:24 +0000 | [diff] [blame] | 229 | Block::GetContainingInlinedBlock () |
| 230 | { |
| 231 | if (InlinedFunctionInfo()) |
| 232 | return this; |
| 233 | return GetInlinedParent (); |
| 234 | } |
| 235 | |
| 236 | Block * |
| 237 | Block::GetInlinedParent () |
Greg Clayton | 33ed170 | 2010-08-24 00:45:41 +0000 | [diff] [blame] | 238 | { |
| 239 | Block *parent_block = GetParent (); |
| 240 | if (parent_block) |
| 241 | { |
| 242 | if (parent_block->InlinedFunctionInfo()) |
| 243 | return parent_block; |
| 244 | else |
| 245 | return parent_block->GetInlinedParent(); |
| 246 | } |
| 247 | return NULL; |
| 248 | } |
| 249 | |
| 250 | |
| 251 | bool |
Greg Clayton | b04e7a8 | 2010-08-24 21:05:24 +0000 | [diff] [blame] | 252 | Block::GetRangeContainingOffset (const addr_t offset, VMRange &range) |
| 253 | { |
| 254 | uint32_t range_idx = VMRange::FindRangeIndexThatContainsValue (m_ranges, offset); |
| 255 | if (range_idx < m_ranges.size()) |
| 256 | { |
| 257 | range = m_ranges[range_idx]; |
| 258 | return true; |
| 259 | } |
| 260 | range.Clear(); |
| 261 | return false; |
| 262 | } |
| 263 | |
| 264 | |
| 265 | bool |
Greg Clayton | 33ed170 | 2010-08-24 00:45:41 +0000 | [diff] [blame] | 266 | Block::GetRangeContainingAddress (const Address& addr, AddressRange &range) |
| 267 | { |
| 268 | SymbolContext sc; |
| 269 | CalculateSymbolContext(&sc); |
| 270 | if (sc.function) |
| 271 | { |
| 272 | const AddressRange &func_range = sc.function->GetAddressRange(); |
| 273 | if (addr.GetSection() == func_range.GetBaseAddress().GetSection()) |
| 274 | { |
| 275 | const addr_t addr_offset = addr.GetOffset(); |
| 276 | const addr_t func_offset = func_range.GetBaseAddress().GetOffset(); |
| 277 | if (addr_offset >= func_offset && addr_offset < func_offset + func_range.GetByteSize()) |
| 278 | { |
| 279 | addr_t offset = addr_offset - func_offset; |
| 280 | |
| 281 | uint32_t range_idx = VMRange::FindRangeIndexThatContainsValue (m_ranges, offset); |
| 282 | if (range_idx < m_ranges.size()) |
| 283 | { |
| 284 | range.GetBaseAddress() = func_range.GetBaseAddress(); |
| 285 | range.GetBaseAddress().SetOffset(func_offset + m_ranges[range_idx].GetBaseAddress()); |
| 286 | range.SetByteSize(m_ranges[range_idx].GetByteSize()); |
| 287 | return true; |
| 288 | } |
| 289 | } |
| 290 | } |
| 291 | } |
| 292 | range.Clear(); |
| 293 | return false; |
| 294 | } |
| 295 | |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 296 | void |
| 297 | Block::AddRange(addr_t start_offset, addr_t end_offset) |
| 298 | { |
| 299 | m_ranges.resize(m_ranges.size()+1); |
| 300 | m_ranges.back().Reset(start_offset, end_offset); |
| 301 | } |
| 302 | |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 303 | // Return the current number of bytes that this object occupies in memory |
| 304 | size_t |
| 305 | Block::MemorySize() const |
| 306 | { |
| 307 | size_t mem_size = sizeof(Block) + m_ranges.size() * sizeof(VMRange); |
| 308 | if (m_inlineInfoSP.get()) |
| 309 | mem_size += m_inlineInfoSP->MemorySize(); |
Greg Clayton | b04e7a8 | 2010-08-24 21:05:24 +0000 | [diff] [blame] | 310 | if (m_variable_list_sp.get()) |
| 311 | mem_size += m_variable_list_sp->MemorySize(); |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 312 | return mem_size; |
| 313 | |
| 314 | } |
| 315 | |
Greg Clayton | 75ccf50 | 2010-08-21 02:22:51 +0000 | [diff] [blame] | 316 | void |
| 317 | Block::AddChild(const BlockSP &child_block_sp) |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 318 | { |
Greg Clayton | 75ccf50 | 2010-08-21 02:22:51 +0000 | [diff] [blame] | 319 | if (child_block_sp) |
| 320 | { |
| 321 | Block *block_needs_sibling = NULL; |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 322 | |
Greg Clayton | 75ccf50 | 2010-08-21 02:22:51 +0000 | [diff] [blame] | 323 | if (!m_children.empty()) |
| 324 | block_needs_sibling = m_children.back().get(); |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 325 | |
Greg Clayton | 75ccf50 | 2010-08-21 02:22:51 +0000 | [diff] [blame] | 326 | child_block_sp->SetParentScope (this); |
| 327 | m_children.push_back (child_block_sp); |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 328 | |
Greg Clayton | 75ccf50 | 2010-08-21 02:22:51 +0000 | [diff] [blame] | 329 | if (block_needs_sibling) |
| 330 | block_needs_sibling->SetSibling (child_block_sp.get()); |
| 331 | } |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 332 | } |
| 333 | |
| 334 | void |
| 335 | Block::SetInlinedFunctionInfo(const char *name, const char *mangled, const Declaration *decl_ptr, const Declaration *call_decl_ptr) |
| 336 | { |
| 337 | m_inlineInfoSP.reset(new InlineFunctionInfo(name, mangled, decl_ptr, call_decl_ptr)); |
| 338 | } |
| 339 | |
Jim Ingham | 7382a53 | 2010-08-18 19:29:16 +0000 | [diff] [blame] | 340 | |
| 341 | |
| 342 | VariableListSP |
| 343 | Block::GetVariableList (bool get_child_variables, bool can_create) |
| 344 | { |
| 345 | VariableListSP variable_list_sp; |
Greg Clayton | 75ccf50 | 2010-08-21 02:22:51 +0000 | [diff] [blame] | 346 | if (m_parsed_block_variables == false) |
Jim Ingham | 7382a53 | 2010-08-18 19:29:16 +0000 | [diff] [blame] | 347 | { |
Greg Clayton | b04e7a8 | 2010-08-24 21:05:24 +0000 | [diff] [blame] | 348 | if (m_variable_list_sp.get() == NULL && can_create) |
Greg Clayton | 75ccf50 | 2010-08-21 02:22:51 +0000 | [diff] [blame] | 349 | { |
| 350 | m_parsed_block_variables = true; |
| 351 | SymbolContext sc; |
| 352 | CalculateSymbolContext(&sc); |
| 353 | assert(sc.module_sp); |
| 354 | sc.module_sp->GetSymbolVendor()->ParseVariablesForContext(sc); |
| 355 | } |
Jim Ingham | 7382a53 | 2010-08-18 19:29:16 +0000 | [diff] [blame] | 356 | } |
| 357 | |
Greg Clayton | b04e7a8 | 2010-08-24 21:05:24 +0000 | [diff] [blame] | 358 | if (m_variable_list_sp.get()) |
Jim Ingham | 7382a53 | 2010-08-18 19:29:16 +0000 | [diff] [blame] | 359 | { |
| 360 | variable_list_sp.reset(new VariableList()); |
| 361 | if (variable_list_sp.get()) |
Greg Clayton | b04e7a8 | 2010-08-24 21:05:24 +0000 | [diff] [blame] | 362 | variable_list_sp->AddVariables(m_variable_list_sp.get()); |
Jim Ingham | 7382a53 | 2010-08-18 19:29:16 +0000 | [diff] [blame] | 363 | |
| 364 | if (get_child_variables) |
| 365 | { |
| 366 | Block *child_block = GetFirstChild(); |
| 367 | while (child_block) |
| 368 | { |
| 369 | VariableListSP child_block_variable_list(child_block->GetVariableList(get_child_variables, can_create)); |
| 370 | if (child_block_variable_list.get()) |
| 371 | variable_list_sp->AddVariables(child_block_variable_list.get()); |
| 372 | child_block = child_block->GetSibling(); |
| 373 | } |
| 374 | } |
| 375 | } |
| 376 | |
| 377 | return variable_list_sp; |
| 378 | } |
| 379 | |
| 380 | uint32_t |
Greg Clayton | 33ed170 | 2010-08-24 00:45:41 +0000 | [diff] [blame] | 381 | Block::AppendVariables |
| 382 | ( |
| 383 | bool can_create, |
| 384 | bool get_parent_variables, |
| 385 | bool stop_if_block_is_inlined_function, |
| 386 | VariableList *variable_list |
| 387 | ) |
Jim Ingham | 7382a53 | 2010-08-18 19:29:16 +0000 | [diff] [blame] | 388 | { |
| 389 | uint32_t num_variables_added = 0; |
| 390 | VariableListSP variable_list_sp(GetVariableList(false, can_create)); |
| 391 | |
Greg Clayton | 33ed170 | 2010-08-24 00:45:41 +0000 | [diff] [blame] | 392 | bool is_inlined_function = InlinedFunctionInfo() != NULL; |
Jim Ingham | 7382a53 | 2010-08-18 19:29:16 +0000 | [diff] [blame] | 393 | if (variable_list_sp.get()) |
| 394 | { |
| 395 | num_variables_added = variable_list_sp->GetSize(); |
| 396 | variable_list->AddVariables(variable_list_sp.get()); |
| 397 | } |
Greg Clayton | 33ed170 | 2010-08-24 00:45:41 +0000 | [diff] [blame] | 398 | |
Jim Ingham | 7382a53 | 2010-08-18 19:29:16 +0000 | [diff] [blame] | 399 | if (get_parent_variables) |
| 400 | { |
Greg Clayton | 33ed170 | 2010-08-24 00:45:41 +0000 | [diff] [blame] | 401 | if (stop_if_block_is_inlined_function && is_inlined_function) |
| 402 | return num_variables_added; |
| 403 | |
Jim Ingham | 7382a53 | 2010-08-18 19:29:16 +0000 | [diff] [blame] | 404 | Block* parent_block = GetParent(); |
| 405 | if (parent_block) |
Greg Clayton | 33ed170 | 2010-08-24 00:45:41 +0000 | [diff] [blame] | 406 | num_variables_added += parent_block->AppendVariables (can_create, get_parent_variables, stop_if_block_is_inlined_function, variable_list); |
Jim Ingham | 7382a53 | 2010-08-18 19:29:16 +0000 | [diff] [blame] | 407 | } |
| 408 | return num_variables_added; |
| 409 | } |
| 410 | |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 411 | void |
Greg Clayton | 75ccf50 | 2010-08-21 02:22:51 +0000 | [diff] [blame] | 412 | Block::SetBlockInfoHasBeenParsed (bool b, bool set_children) |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 413 | { |
Greg Clayton | 75ccf50 | 2010-08-21 02:22:51 +0000 | [diff] [blame] | 414 | m_parsed_block_info = b; |
| 415 | if (set_children) |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 416 | { |
Greg Clayton | 75ccf50 | 2010-08-21 02:22:51 +0000 | [diff] [blame] | 417 | m_parsed_child_blocks = true; |
| 418 | for (Block *child_block = GetFirstChild(); child_block != NULL; child_block = child_block->GetSibling()) |
| 419 | child_block->SetBlockInfoHasBeenParsed (b, true); |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 420 | } |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 421 | } |