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

Unified Diff: util/win/process_info.h

Issue 1372183002: win: Add memory map range intersection helper (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: . Created 5 years, 3 months 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 side-by-side diff with in-line comments
Download patch
Index: util/win/process_info.h
diff --git a/util/win/process_info.h b/util/win/process_info.h
index 5af28bd762bddabcc62f2f8be5e7cb88150f7ff0..37bad539a3985d1b55c7211e6f679c0026a99984 100644
--- a/util/win/process_info.h
+++ b/util/win/process_info.h
@@ -23,6 +23,7 @@
#include "base/basictypes.h"
#include "util/misc/initialization_state_dcheck.h"
+#include "util/numeric/checked_range.h"
#include "util/win/address_types.h"
namespace crashpad {
@@ -52,6 +53,7 @@ class ProcessInfo {
// \brief Contains information about a range of pages in the virtual address
// space of a process.
struct MemoryInfo {
+ MemoryInfo();
explicit MemoryInfo(const MEMORY_BASIC_INFORMATION& mbi);
~MemoryInfo();
@@ -157,6 +159,23 @@ class ProcessInfo {
DISALLOW_COPY_AND_ASSIGN(ProcessInfo);
};
+//! \brief Given a process memory map, gets a set of regions that correspond to
Mark Mentovai 2015/09/29 21:35:50 “set” is slightly confusing when this returns a ve
scottmg 2015/09/30 17:40:26 Done.
+//! the readable regions (that are not `MEM_FREE`).
+//!
+//! \param[in] address The base address of the range being identified
+//! \param[in] size The size of the range being identified.
+//! \param[in] memory_info Memory map of a process, normally retrieved from
+//! ProcessInfo::MemoryInformation().
Mark Mentovai 2015/09/29 21:35:50 Since you mention MemoryInformation() and otherwis
scottmg 2015/09/30 17:40:26 After renaming the function, I tried to rephrase t
+//!
+//! \return A list of ranges corresponding to the portion of the range
Mark Mentovai 2015/09/29 21:35:50 If the first mapping starts lower than address, wi
scottmg 2015/09/30 17:40:26 I think this is addressed by the rename/descriptio
+//! identified by \a address and \a size that are readable based on the
+//! memory map.
+std::vector<CheckedRange<WinVMAddress, WinVMSize>>
Mark Mentovai 2015/09/29 21:35:50 I’m definitely cool with CheckedRange in the imple
scottmg 2015/09/30 17:40:26 The main reason is that I don't like pair.first/.s
Mark Mentovai 2015/10/01 17:38:58 scottmg wrote:
+GetAccessibleRangesInMemoryMap(
Mark Mentovai 2015/09/29 21:35:50 Accessible → Readable? Based on the documentation
scottmg 2015/09/30 17:40:26 Renamed.
+ WinVMAddress address,
+ WinVMSize size,
+ const std::vector<ProcessInfo::MemoryInfo>& memory_info);
Mark Mentovai 2015/09/29 21:35:50 It’s quirky for this to be a loose function that t
scottmg 2015/09/30 17:40:26 Yes, it was primarily for testing. Added a member
+
} // namespace crashpad
#endif // CRASHPAD_UTIL_WIN_PROCESS_INFO_H_
« no previous file with comments | « util/numeric/checked_range.h ('k') | util/win/process_info.cc » ('j') | util/win/process_info.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698