OLD | NEW |
1 // Copyright (c) 2010 Google Inc. | 1 // Copyright (c) 2010 Google Inc. |
2 // All rights reserved. | 2 // All rights reserved. |
3 // | 3 // |
4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
5 // modification, are permitted provided that the following conditions are | 5 // modification, are permitted provided that the following conditions are |
6 // met: | 6 // met: |
7 // | 7 // |
8 // * Redistributions of source code must retain the above copyright | 8 // * Redistributions of source code must retain the above copyright |
9 // notice, this list of conditions and the following disclaimer. | 9 // notice, this list of conditions and the following disclaimer. |
10 // * Redistributions in binary form must reproduce the above | 10 // * Redistributions in binary form must reproduce the above |
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 // include argument types. | 377 // include argument types. |
378 const string *qualified_name = NULL; | 378 const string *qualified_name = NULL; |
379 if (!demangled_name_.empty()) { | 379 if (!demangled_name_.empty()) { |
380 // Found it is this DIE. | 380 // Found it is this DIE. |
381 qualified_name = &demangled_name_; | 381 qualified_name = &demangled_name_; |
382 } else if (specification_ && !specification_->qualified_name.empty()) { | 382 } else if (specification_ && !specification_->qualified_name.empty()) { |
383 // Found it on the specification. | 383 // Found it on the specification. |
384 qualified_name = &specification_->qualified_name; | 384 qualified_name = &specification_->qualified_name; |
385 } | 385 } |
386 | 386 |
387 const string *unqualified_name; | 387 const string *unqualified_name = NULL; |
388 const string *enclosing_name; | 388 const string *enclosing_name; |
389 if (!qualified_name) { | 389 if (!qualified_name) { |
390 // Find our unqualified name. If the DIE has its own DW_AT_name | 390 // Find the unqualified name. If the DIE has its own DW_AT_name |
391 // attribute, then use that; otherwise, check our specification. | 391 // attribute, then use that; otherwise, check the specification. |
392 if (name_attribute_.empty() && specification_) | 392 if (!name_attribute_.empty()) |
| 393 unqualified_name = &name_attribute_; |
| 394 else if (specification_) |
393 unqualified_name = &specification_->unqualified_name; | 395 unqualified_name = &specification_->unqualified_name; |
394 else | |
395 unqualified_name = &name_attribute_; | |
396 | 396 |
397 // Find the name of our enclosing context. If we have a | 397 // Find the name of the enclosing context. If this DIE has a |
398 // specification, it's the specification's enclosing context that | 398 // specification, it's the specification's enclosing context that |
399 // counts; otherwise, use this DIE's context. | 399 // counts; otherwise, use this DIE's context. |
400 if (specification_) | 400 if (specification_) |
401 enclosing_name = &specification_->enclosing_name; | 401 enclosing_name = &specification_->enclosing_name; |
402 else | 402 else |
403 enclosing_name = &parent_context_->name; | 403 enclosing_name = &parent_context_->name; |
404 } | 404 } |
405 | 405 |
406 // Prepare the return value before upcoming mutations possibly invalidate the | 406 // Prepare the return value before upcoming mutations possibly invalidate the |
407 // existing pointers. | 407 // existing pointers. |
408 string return_value; | 408 string return_value; |
409 if (qualified_name) { | 409 if (qualified_name) { |
410 return_value = *qualified_name; | 410 return_value = *qualified_name; |
411 } else { | 411 } else if (unqualified_name && enclosing_name) { |
412 // Combine the enclosing name and unqualified name to produce our | 412 // Combine the enclosing name and unqualified name to produce our |
413 // own fully-qualified name. | 413 // own fully-qualified name. |
414 return_value = cu_context_->language->MakeQualifiedName(*enclosing_name, | 414 return_value = cu_context_->language->MakeQualifiedName(*enclosing_name, |
415 *unqualified_name); | 415 *unqualified_name); |
416 } | 416 } |
417 | 417 |
418 // If this DIE was marked as a declaration, record its names in the | 418 // If this DIE was marked as a declaration, record its names in the |
419 // specification table. | 419 // specification table. |
420 if (declaration_) { | 420 if (declaration_ && qualified_name || (unqualified_name && enclosing_name)) { |
421 Specification spec; | 421 Specification spec; |
422 if (qualified_name) { | 422 if (qualified_name) { |
423 spec.qualified_name = *qualified_name; | 423 spec.qualified_name = *qualified_name; |
424 } else { | 424 } else { |
425 spec.enclosing_name = *enclosing_name; | 425 spec.enclosing_name = *enclosing_name; |
426 spec.unqualified_name = *unqualified_name; | 426 spec.unqualified_name = *unqualified_name; |
427 } | 427 } |
428 cu_context_->file_context->file_private_->specifications[offset_] = spec; | 428 cu_context_->file_context->file_private_->specifications[offset_] = spec; |
429 } | 429 } |
430 | 430 |
(...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1065 return dwarf_version >= 2; | 1065 return dwarf_version >= 2; |
1066 } | 1066 } |
1067 | 1067 |
1068 bool DwarfCUToModule::StartRootDIE(uint64 offset, enum DwarfTag tag) { | 1068 bool DwarfCUToModule::StartRootDIE(uint64 offset, enum DwarfTag tag) { |
1069 // We don't deal with partial compilation units (the only other tag | 1069 // We don't deal with partial compilation units (the only other tag |
1070 // likely to be used for root DIE). | 1070 // likely to be used for root DIE). |
1071 return tag == dwarf2reader::DW_TAG_compile_unit; | 1071 return tag == dwarf2reader::DW_TAG_compile_unit; |
1072 } | 1072 } |
1073 | 1073 |
1074 } // namespace google_breakpad | 1074 } // namespace google_breakpad |
OLD | NEW |