[Lldb-commits] [PATCH] D135648: [lldb] Add matching based on Python callbacks for data formatters.

Jorge Gorbe Moya via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Oct 14 18:00:28 PDT 2022


jgorbe marked 2 inline comments as done.
jgorbe added inline comments.


================
Comment at: lldb/source/Commands/CommandObjectType.cpp:2306
   if (type == eRegularSynth) {
-    if (category->AnyMatches(type_name, eFormatCategoryItemFilter, false)) {
+    // TODO: Get a suitable type object for type_name so we can create a
+    // complete FormattersMatchCandidate.
----------------
labath wrote:
> Is that even possible? Like, this command can be run before any binaries/debug info is loaded, right? Maybe we should just call that WAI?
You're right. I hadn't though of the case where we have no target yet. Changed the comments in this file and a similar one in lldb/include/lldb/DataFormatters/FormattersContainer.h to remove the TODO and indicate this is WAI. Thanks!


================
Comment at: lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp:2159-2167
+  // Default to false in case of error while running the callback.
+  bool result = false;
+  {
+    Locker py_lock(this,
+                   Locker::AcquireLock | Locker::InitSession | Locker::NoSTDIN);
+    result = LLDBSwigPythonFormatterCallbackFunction(
+        python_function_name, m_dictionary_name.c_str(), type_impl_sp);
----------------
labath wrote:
> I think we already had code like this somewhere, but these two versions are completely equivalent.
Done!


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

https://reviews.llvm.org/D135648



More information about the lldb-commits mailing list