| OLD | NEW |
| 1 // Copyright 2015 The Crashpad Authors. All rights reserved. | 1 // Copyright 2015 The Crashpad Authors. 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 571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 582 *peb_address = peb_address_; | 582 *peb_address = peb_address_; |
| 583 *peb_size = peb_size_; | 583 *peb_size = peb_size_; |
| 584 } | 584 } |
| 585 | 585 |
| 586 bool ProcessInfo::Modules(std::vector<Module>* modules) const { | 586 bool ProcessInfo::Modules(std::vector<Module>* modules) const { |
| 587 INITIALIZATION_STATE_DCHECK_VALID(initialized_); | 587 INITIALIZATION_STATE_DCHECK_VALID(initialized_); |
| 588 *modules = modules_; | 588 *modules = modules_; |
| 589 return true; | 589 return true; |
| 590 } | 590 } |
| 591 | 591 |
| 592 const std::vector<MEMORY_BASIC_INFORMATION64>& ProcessInfo::MemoryInfo() const { | 592 const ProcessInfo::MemoryBasicInformation64Vector& ProcessInfo::MemoryInfo() |
| 593 const { |
| 593 INITIALIZATION_STATE_DCHECK_VALID(initialized_); | 594 INITIALIZATION_STATE_DCHECK_VALID(initialized_); |
| 594 return memory_info_; | 595 return memory_info_; |
| 595 } | 596 } |
| 596 | 597 |
| 597 std::vector<CheckedRange<WinVMAddress, WinVMSize>> | 598 std::vector<CheckedRange<WinVMAddress, WinVMSize>> |
| 598 ProcessInfo::GetReadableRanges( | 599 ProcessInfo::GetReadableRanges( |
| 599 const CheckedRange<WinVMAddress, WinVMSize>& range) const { | 600 const CheckedRange<WinVMAddress, WinVMSize>& range) const { |
| 600 return GetReadableRangesOfMemoryMap(range, MemoryInfo()); | 601 return GetReadableRangesOfMemoryMap(range, MemoryInfo()); |
| 601 } | 602 } |
| 602 | 603 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 622 | 623 |
| 623 const std::vector<ProcessInfo::Handle>& ProcessInfo::Handles() const { | 624 const std::vector<ProcessInfo::Handle>& ProcessInfo::Handles() const { |
| 624 INITIALIZATION_STATE_DCHECK_VALID(initialized_); | 625 INITIALIZATION_STATE_DCHECK_VALID(initialized_); |
| 625 if (handles_.empty()) | 626 if (handles_.empty()) |
| 626 handles_ = BuildHandleVector(process_); | 627 handles_ = BuildHandleVector(process_); |
| 627 return handles_; | 628 return handles_; |
| 628 } | 629 } |
| 629 | 630 |
| 630 std::vector<CheckedRange<WinVMAddress, WinVMSize>> GetReadableRangesOfMemoryMap( | 631 std::vector<CheckedRange<WinVMAddress, WinVMSize>> GetReadableRangesOfMemoryMap( |
| 631 const CheckedRange<WinVMAddress, WinVMSize>& range, | 632 const CheckedRange<WinVMAddress, WinVMSize>& range, |
| 632 const std::vector<MEMORY_BASIC_INFORMATION64>& memory_info) { | 633 const ProcessInfo::MemoryBasicInformation64Vector& memory_info) { |
| 633 using Range = CheckedRange<WinVMAddress, WinVMSize>; | 634 using Range = CheckedRange<WinVMAddress, WinVMSize>; |
| 634 | 635 |
| 635 // Find all the ranges that overlap the target range, maintaining their order. | 636 // Find all the ranges that overlap the target range, maintaining their order. |
| 636 std::vector<MEMORY_BASIC_INFORMATION64> overlapping; | 637 ProcessInfo::MemoryBasicInformation64Vector overlapping; |
| 637 for (const auto& mi : memory_info) { | 638 for (const auto& mi : memory_info) { |
| 638 static_assert(base::is_same<decltype(mi.BaseAddress), WinVMAddress>::value, | 639 static_assert(base::is_same<decltype(mi.BaseAddress), WinVMAddress>::value, |
| 639 "expected range address to be WinVMAddress"); | 640 "expected range address to be WinVMAddress"); |
| 640 static_assert(base::is_same<decltype(mi.RegionSize), WinVMSize>::value, | 641 static_assert(base::is_same<decltype(mi.RegionSize), WinVMSize>::value, |
| 641 "expected range size to be WinVMSize"); | 642 "expected range size to be WinVMSize"); |
| 642 if (range.OverlapsRange(Range(mi.BaseAddress, mi.RegionSize))) | 643 if (range.OverlapsRange(Range(mi.BaseAddress, mi.RegionSize))) |
| 643 overlapping.push_back(mi); | 644 overlapping.push_back(mi); |
| 644 } | 645 } |
| 645 if (overlapping.empty()) | 646 if (overlapping.empty()) |
| 646 return std::vector<Range>(); | 647 return std::vector<Range>(); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 683 } else { | 684 } else { |
| 684 result.push_back(as_ranges[i]); | 685 result.push_back(as_ranges[i]); |
| 685 } | 686 } |
| 686 DCHECK(result.back().IsValid()); | 687 DCHECK(result.back().IsValid()); |
| 687 } | 688 } |
| 688 | 689 |
| 689 return result; | 690 return result; |
| 690 } | 691 } |
| 691 | 692 |
| 692 } // namespace crashpad | 693 } // namespace crashpad |
| OLD | NEW |