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 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
503 MappingInfo* mapping = mappings_[i]; | 503 MappingInfo* mapping = mappings_[i]; |
504 if (!(mapping->exec && mapping->name[0] == '/')) { | 504 if (!(mapping->exec && mapping->name[0] == '/')) { |
505 continue; | 505 continue; |
506 } | 506 } |
507 ElfW(Ehdr) ehdr; | 507 ElfW(Ehdr) ehdr; |
508 if (!GetLoadedElfHeader(mapping->start_addr, &ehdr)) { | 508 if (!GetLoadedElfHeader(mapping->start_addr, &ehdr)) { |
509 continue; | 509 continue; |
510 } | 510 } |
511 if (ehdr.e_type == ET_DYN) { | 511 if (ehdr.e_type == ET_DYN) { |
512 // Compute the effective load bias for this mapped library, and update | 512 // Compute the effective load bias for this mapped library, and update |
513 // the mapping to hold that rather than |start_addr|. Where the library | 513 // the mapping to hold that rather than |start_addr|, at the same time |
514 // does not contain Android packed relocations, GetEffectiveLoadBias() | 514 // adjusting |size| to account for the change in |start_addr|. Where |
515 // returns |start_addr| and the mapping entry is not changed. | 515 // the library does not contain Android packed relocations, |
516 mapping->start_addr = GetEffectiveLoadBias(&ehdr, mapping->start_addr); | 516 // GetEffectiveLoadBias() returns |start_addr| and the mapping entry |
517 // is not changed. | |
518 const uintptr_t load_bias = GetEffectiveLoadBias(&ehdr, | |
519 mapping->start_addr); | |
520 mapping->size += mapping->start_addr - load_bias; | |
Primiano Tucci (use gerrit)
2015/06/25 14:44:01
can load_bias ever be > start_addr (maybe by mista
simonb (inactive)
2015/06/25 15:14:35
From coding errors in the proc/$$/maps or ELF data
| |
521 mapping->start_addr = load_bias; | |
517 } | 522 } |
518 } | 523 } |
519 } | 524 } |
520 | 525 |
521 #endif // __ANDROID__ | 526 #endif // __ANDROID__ |
522 | 527 |
523 // Get information about the stack, given the stack pointer. We don't try to | 528 // Get information about the stack, given the stack pointer. We don't try to |
524 // walk the stack since we might not have all the information needed to do | 529 // walk the stack since we might not have all the information needed to do |
525 // unwind. So we just grab, up to, 32k of stack. | 530 // unwind. So we just grab, up to, 32k of stack. |
526 bool LinuxDumper::GetStackInfo(const void** stack, size_t* stack_len, | 531 bool LinuxDumper::GetStackInfo(const void** stack, size_t* stack_len, |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
591 exe_stat.st_dev == new_path_stat.st_dev && | 596 exe_stat.st_dev == new_path_stat.st_dev && |
592 exe_stat.st_ino == new_path_stat.st_ino) { | 597 exe_stat.st_ino == new_path_stat.st_ino) { |
593 return false; | 598 return false; |
594 } | 599 } |
595 | 600 |
596 my_memcpy(path, exe_link, NAME_MAX); | 601 my_memcpy(path, exe_link, NAME_MAX); |
597 return true; | 602 return true; |
598 } | 603 } |
599 | 604 |
600 } // namespace google_breakpad | 605 } // namespace google_breakpad |
OLD | NEW |