[Lldb-commits] [PATCH] D131086: [lldb/crashlog] Improve exception reporting for interactive mode

Jonas Devlieghere via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Aug 3 11:28:43 PDT 2022


JDevlieghere added inline comments.


================
Comment at: lldb/source/Plugins/Process/Utility/StopInfoMachException.cpp:525-542
+  case EXC_BAD_ACCESS:
+    return "EXC_BAD_ACCESS";
+  case EXC_BAD_INSTRUCTION:
+    return "EXC_BAD_INSTRUCTION";
+  case EXC_ARITHMETIC:
+    return "EXC_ARITHMETIC";
+  case EXC_EMULATION:
----------------
Just double checking: I assume these are always defined, even when `mach/exception.h` is not included?


================
Comment at: lldb/source/Plugins/Process/Utility/StopInfoMachException.cpp:567-568
+
+// Returns the exception code for a given exception name.
+// 0 is not a legit code, so we return that in the case of an error.
+uint32_t StopInfoMachException::MachException::ExceptionCode(const char *name) {
----------------



================
Comment at: lldb/source/Plugins/Process/Utility/StopInfoMachException.cpp:578-610
+  std::string name_str = name;
+  if (name_str == "BAD_ACCESS")
+    return EXC_BAD_ACCESS;
+  if (name_str == "BAD_INSTRUCTION")
+    return EXC_BAD_INSTRUCTION;
+  if (name_str == "ARITHMETIC")
+    return EXC_ARITHMETIC;
----------------
Seems like a good candidate for a StringSwitch: https://llvm.org/doxygen/classllvm_1_1StringSwitch.html


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D131086



More information about the lldb-commits mailing list