[PATCH] [compiler-rt] Symbolizer refactoring: Turn FillAddressAndModuleInfo into FillModuleInfo
Kuba Brecka
kuba.brecka at gmail.com
Mon Mar 2 15:45:19 PST 2015
Part of http://reviews.llvm.org/D7827. We no longer need to set the `addr` field in `FillAddressAndModuleInfo`, because it's now always used right after creating the struct with the address already set.
http://reviews.llvm.org/D8020
Files:
lib/sanitizer_common/sanitizer_symbolizer.cc
lib/sanitizer_common/sanitizer_symbolizer.h
lib/sanitizer_common/sanitizer_symbolizer_libbacktrace.cc
lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cc
lib/sanitizer_common/sanitizer_symbolizer_win.cc
Index: lib/sanitizer_common/sanitizer_symbolizer.cc
===================================================================
--- lib/sanitizer_common/sanitizer_symbolizer.cc
+++ lib/sanitizer_common/sanitizer_symbolizer.cc
@@ -33,9 +33,7 @@
function_offset = kUnknown;
}
-void AddressInfo::FillAddressAndModuleInfo(uptr addr, const char *mod_name,
- uptr mod_offset) {
- address = addr;
+void AddressInfo::FillModuleInfo(const char *mod_name, uptr mod_offset) {
module = internal_strdup(mod_name);
module_offset = mod_offset;
}
Index: lib/sanitizer_common/sanitizer_symbolizer.h
===================================================================
--- lib/sanitizer_common/sanitizer_symbolizer.h
+++ lib/sanitizer_common/sanitizer_symbolizer.h
@@ -43,8 +43,7 @@
AddressInfo();
// Deletes all strings and resets all fields.
void Clear();
- void FillAddressAndModuleInfo(uptr addr, const char *mod_name,
- uptr mod_offset);
+ void FillModuleInfo(const char *mod_name, uptr mod_offset);
};
// Linked list of symbolized frames (each frame is described by AddressInfo).
Index: lib/sanitizer_common/sanitizer_symbolizer_libbacktrace.cc
===================================================================
--- lib/sanitizer_common/sanitizer_symbolizer_libbacktrace.cc
+++ lib/sanitizer_common/sanitizer_symbolizer_libbacktrace.cc
@@ -95,8 +95,7 @@
if (frames_symbolized > 0) {
SymbolizedStack *cur = SymbolizedStack::New(addr);
AddressInfo *info = &cur->info;
- info->FillAddressAndModuleInfo(addr, first->info.module,
- first->info.module_offset);
+ info->FillModuleInfo(first->info.module, first->info.module_offset);
last->next = cur;
last = cur;
}
Index: lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cc
===================================================================
--- lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cc
+++ lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cc
@@ -74,8 +74,7 @@
top_frame = false;
} else {
cur = SymbolizedStack::New(res->info.address);
- cur->info.FillAddressAndModuleInfo(res->info.address, res->info.module,
- res->info.module_offset);
+ cur->info.FillModuleInfo(res->info.module, res->info.module_offset);
last->next = cur;
last = cur;
}
@@ -363,7 +362,7 @@
if (!FindModuleNameAndOffsetForAddress(addr, &module_name, &module_offset))
return res;
// Always fill data about module name and offset.
- res->info.FillAddressAndModuleInfo(addr, module_name, module_offset);
+ res->info.FillModuleInfo(module_name, module_offset);
// First, try to use libbacktrace symbolizer (if it's available).
if (libbacktrace_symbolizer_ != 0) {
mu_.CheckLocked();
Index: lib/sanitizer_common/sanitizer_symbolizer_win.cc
===================================================================
--- lib/sanitizer_common/sanitizer_symbolizer_win.cc
+++ lib/sanitizer_common/sanitizer_symbolizer_win.cc
@@ -59,8 +59,8 @@
internal_memset(&mod_info, 0, sizeof(mod_info));
mod_info.SizeOfStruct = sizeof(mod_info);
if (SymGetModuleInfo64(GetCurrentProcess(), addr, &mod_info))
- frame->info.FillAddressAndModuleInfo(addr, mod_info.ImageName,
- addr - (uptr)mod_info.BaseOfImage);
+ frame->info.FillModuleInfo(mod_info.ImageName,
+ addr - (uptr)mod_info.BaseOfImage);
return frame;
}
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D8020.21054.patch
Type: text/x-patch
Size: 3634 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150302/a5e9a8af/attachment.bin>
More information about the llvm-commits
mailing list