[WTF] Move JSC tools/StackTrace to WTF and unify stack trace dump code
https://bugs.webkit.org/show_bug.cgi?id=171199
Reviewed by Mark Lam.
Source/JavaScriptCore:
This patch adds a utility method to produce demangled names with dladdr.
It fixes several memory leaks because the result of abi::cxa_demangle()
needs to be free
-ed.
- CMakeLists.txt:
- JavaScriptCore.xcodeproj/project.pbxproj:
- inspector/JSGlobalObjectInspectorController.cpp:
(Inspector::JSGlobalObjectInspectorController::appendAPIBacktrace):
- runtime/SamplingProfiler.cpp:
(JSC::SamplingProfiler::StackFrame::displayName):
- tools/CellProfile.h:
- tools/CodeProfile.cpp:
(JSC::CodeProfile::report):
(JSC::symbolName): Deleted.
Source/WTF:
JSC tools/StackTrace's dump code is almost identical to WTF Assertions'
stack trace dump code. This patch moves tools/StackTrace to WTF and use
it in Assertions. It unifies the two duplicate implementations into one.
- WTF.xcodeproj/project.pbxproj:
- wtf/Assertions.cpp:
- wtf/CMakeLists.txt:
- wtf/Platform.h:
- wtf/StackTrace.cpp: Renamed from Source/JavaScriptCore/tools/StackTrace.cpp.
(WTF::StackTrace::captureStackTrace):
(WTF::StackTrace::dump):
- wtf/StackTrace.h: Copied from Source/JavaScriptCore/tools/StackTrace.h.
(WTF::StackTrace::StackTrace):
(WTF::StackTrace::stack):
(WTF::StackTrace::DemangleEntry::mangledName):
(WTF::StackTrace::DemangleEntry::demangledName):
(WTF::StackTrace::DemangleEntry::DemangleEntry):
- wtf/SystemFree.h: Renamed from Source/JavaScriptCore/tools/StackTrace.h.
(WTF::SystemFree::operator()):