[PATCH] [ASan/Win] Unify handling of loaded modules between POSIX and Windows
Alexey Samsonov
vonosmas at gmail.com
Fri Apr 3 15:32:51 PDT 2015
Cool, I believe it's a step in right direction. Feel free to submit after fixing a few comments below.
================
Comment at: sanitizer_linux_libcdep.cc:439
@@ -438,4 +438,3 @@
return 0;
- void *mem = &data->modules[data->current_n];
- LoadedModule *cur_module = new(mem) LoadedModule(module_name.data(),
- info->dlpi_addr);
+ LoadedModule &cur_module = data->modules[data->current_n];
+ cur_module.set(module_name.data(), info->dlpi_addr);
----------------
Nit: we don't usually use non-const references. Can you change it to pointer?
================
Comment at: sanitizer_procmaps_common.cc:145
@@ -145,3 +144,3 @@
uptr base_address = (i ? cur_beg : 0) - cur_offset;
- LoadedModule *cur_module = new(mem) LoadedModule(cur_name, base_address);
- cur_module->addAddressRange(cur_beg, cur_end, prot & kProtectionExecute);
+ LoadedModule &cur_module = modules[n_modules];
+ cur_module.set(cur_name, base_address);
----------------
Ditto
================
Comment at: sanitizer_procmaps_mac.cc:174
@@ -173,3 +173,3 @@
continue;
LoadedModule *cur_module = 0;
if (n_modules > 0 &&
----------------
nullptr
================
Comment at: sanitizer_symbolizer.h:143
@@ +142,3 @@
+ LoadedModule *FindModuleForAddress(uptr address);
+ virtual uptr PlatformGetListOfModules(LoadedModule *modules,
+ uptr max_modules) {
----------------
You don't need this function - it just calls ::GetListOfModules() in both implementations. Please delete it.
================
Comment at: sanitizer_win.cc:363
@@ +362,3 @@
+ uptr end_address = (uptr)mi.lpBaseOfDll + mi.SizeOfImage;
+ LoadedModule &cur_module = modules[count];
+ cur_module.set(module_name, base_address);
----------------
See comment about non-const reference above.
http://reviews.llvm.org/D8805
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
More information about the llvm-commits
mailing list