[Lldb-commits] [PATCH] D73303: [lldb/Target] Add Abort StackFrame Recognizer

Med Ismail Bennani via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Jan 24 08:15:09 PST 2020


mib marked 14 inline comments as done.
mib added inline comments.


================
Comment at: lldb/source/Target/AbortRecognizer.cpp:1
+//===-- AbortRecognizer.cpp -------------------------------------*- C++ -*-===//
+//
----------------
teemperor wrote:
> Please remove the `-*- C++ -*-` as that's only for header files.
I saw this on a bunch of source files (StopInfo.cpp / Breakpoint.cpp / SymbolContext.cpp ...). I'm not sure what you mean by that.


================
Comment at: lldb/source/Target/AbortRecognizer.cpp:25
+
+llvm::Optional<std::tuple<FileSpec, ConstString>>
+AbortRecognizerHandler::GetAbortLocation(Process *process) {
----------------
JDevlieghere wrote:
> Why does this need to return a `ConstString`? 
I use ConstString because StackFrameRecognizerManager::AddRecognizer takes a ConstString.

And also SymbolContext::GetFunctionName returns a ConstString.


================
Comment at: lldb/source/Target/AbortRecognizer.cpp:81
+    ThreadSP thread_sp, FileSpec module_spec, ConstString function_name) {
+  const uint32_t frames_to_fetch = 10;
+  StackFrameSP prev_frame_sp = nullptr;
----------------
JDevlieghere wrote:
> Magic value? Why 10?
Pretty much. In the beginning I was unwinding the entire stack. But if there is too much frames (i.e. recursion) this would take too much time. We agreed with @friss and @jingham to unwind up to 10 frames at most.

Can you think of a better way to do it ?


================
Comment at: lldb/source/Target/Process.cpp:543
+
+  RegisterAbortRecognizer(this);
 }
----------------
friss wrote:
> We need to find a better place to register this.
May be this could go in Target/LanguageRuntime.cpp or Target/SystemRuntime.cpp ?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73303/new/

https://reviews.llvm.org/D73303





More information about the lldb-commits mailing list