[PATCH] [compiler-rt] Symbolizer refactoring: Make LibbacktraceSymbolizer adopt the SymbolizerTool interface
Alexey Samsonov
vonosmas at gmail.com
Mon Mar 2 12:04:20 PST 2015
On a related note, let me know if you want to replace `AddressInfo::FillAddressAndModuleInfo` with `AddressInfo::FillModuleInfo`, or I should do it myself.
================
Comment at: lib/sanitizer_common/sanitizer_symbolizer_libbacktrace.cc:94
@@ -92,3 +93,3 @@
void append(SymbolizedStack *f) {
if (last != nullptr) {
last->next = f;
----------------
last can't be `nullptr` now, perhaps you can add a CHECK. Or, better, as this function is only used once, you just inline it in `get_new_frame`
================
Comment at: lib/sanitizer_common/sanitizer_symbolizer_libbacktrace.cc:104
@@ +103,3 @@
+ AddressInfo *get_new_frame(uintptr_t addr) {
+ SymbolizedStack *cur = last;
+ if (frames_symbolized > 0) {
----------------
I'd prefer to have
CHECK(last);
if (frames_symbolized > 0) {
SymbolizedStack *cur = SymbolizedStack::New(addr);
/.../
last->next = cur;
last = cur;
}
CHECK_EQ(addr, last->info.address);
return &last->info;
================
Comment at: lib/sanitizer_common/sanitizer_symbolizer_libbacktrace.cc:179
@@ -172,3 +178,3 @@
ErrorCallback, &data);
- return data.first;
+ return true;
}
----------------
Shouldn't you return false if data.frames_symbolized is zero?
================
Comment at: lib/sanitizer_common/sanitizer_symbolizer_libbacktrace.cc:205
@@ -200,3 +204,3 @@
-char *LibbacktraceSymbolizer::Demangle(const char *name, bool always_alloc) {
+char *DemangleAlloc(const char *name, bool always_alloc) {
#if SANITIZER_LIBBACKTRACE && SANITIZER_CP_DEMANGLE
----------------
Make it a static function.
================
Comment at: lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cc:570
@@ -569,3 +569,3 @@
uptr module_offset;
if (!FindModuleNameAndOffsetForAddress(addr, &module_name, &module_offset))
return SymbolizedStack::New(addr);
----------------
Looks like you can rewrite it now:
SymbolizeStack *res = SymbolizedStack::New(addr);
if (!FindModuleNameAndOffset(...))
return res;
res->info.FillAddressAndModuleInfo(addr, module_name, module_offset);
<...>
http://reviews.llvm.org/D7971
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
More information about the llvm-commits
mailing list