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

Unified Diff: syzygy/refinery/process_state/process_state_util.cc

Issue 1475083002: [Refinery] Introduce TypePropagatorAnalyzer - pointer types. (Closed) Base URL: https://github.com/google/syzygy.git@master
Patch Set: Final nit Created 5 years, 1 month 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: syzygy/refinery/process_state/process_state_util.cc
diff --git a/syzygy/refinery/process_state/process_state_util.cc b/syzygy/refinery/process_state/process_state_util.cc
index 4e5ccb0eceb7836306dfef74400e85c6ce9d8dfb..b307724bb43d2734144cdddbf753f0f2abf39afd 100644
--- a/syzygy/refinery/process_state/process_state_util.cc
+++ b/syzygy/refinery/process_state/process_state_util.cc
@@ -72,10 +72,8 @@ bool ModuleLayerAccessor::GetModuleSignature(const Address va,
return false;
// Retrieve the signature.
- ModuleLayerPtr layer;
- process_state_->FindOrCreateLayer(&layer);
const Module& module = module_record->data();
- if (!layer->mutable_data()->Find(module.module_id(), signature))
+ if (!GetModuleSignature(module.module_id(), signature))
return false;
// Set the signature's address.
@@ -91,9 +89,34 @@ bool ModuleLayerAccessor::GetModuleSignature(const Address va,
return true;
}
+bool ModuleLayerAccessor::GetModuleSignature(const ModuleId id,
+ pe::PEFile::Signature* signature) {
+ DCHECK_NE(kNoModuleId, id);
+ DCHECK(signature);
+
+ ModuleLayerPtr layer;
+ process_state_->FindOrCreateLayer(&layer);
+ return layer->data().Find(id, signature);
+}
+
+ModuleId ModuleLayerAccessor::GetModuleId(const Address va) {
+ ModuleRecordPtr module_record;
+ if (!process_state_->FindSingleRecord(va, &module_record))
+ return kNoModuleId;
+ return module_record->data().module_id();
+}
+
+ModuleId ModuleLayerAccessor::GetModuleId(
+ const pe::PEFile::Signature& signature) {
+ ModuleLayerPtr layer;
+ process_state_->FindOrCreateLayer(&layer);
+ return layer->data().Find(signature);
+}
+
bool AddTypedBlockRecord(const AddressRange& range,
base::StringPiece16 data_name,
- base::StringPiece16 type_name,
+ ModuleId module_id,
+ TypeId type_id,
ProcessState* process_state) {
DCHECK(range.IsValid());
DCHECK(process_state);
@@ -105,10 +128,8 @@ bool AddTypedBlockRecord(const AddressRange& range,
return false;
typedblock_proto->set_data_name(data_name_narrow);
- std::string type_name_narrow;
- if (!base::UTF16ToUTF8(type_name.data(), type_name.size(), &type_name_narrow))
- return false;
- typedblock_proto->set_type_name(type_name_narrow);
+ typedblock_proto->set_module_id(module_id);
+ typedblock_proto->set_type_id(type_id);
return true;
}
« no previous file with comments | « syzygy/refinery/process_state/process_state_util.h ('k') | syzygy/refinery/process_state/process_state_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698