[Lldb-commits] [PATCH] D138248: [lldb/Python] Make use of PythonObject and PythonFormat in callbacks (NFC)

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Nov 17 22:46:07 PST 2022


labath accepted this revision.
labath added a comment.
This revision is now accepted and ready to land.

Cool. Thanks for doing that.



================
Comment at: lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h:191-194
+template <> struct PythonFormat<char *> {
+  static constexpr char format = 's';
+  static auto get(char *value) { return value; }
+};
----------------
Maybe something like:
```
template<typename T, char F> struct PassthroughFormat {
  static constexpr char format = F;
  static constexpr T get(T t) { return t; }
};

template<> struct PythonFormat<char *> : PassthroughFormat<char *, 's'>;
// etc.
```


================
Comment at: lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp:1521
+  if (!expected_py_return)
+    return {};
 
----------------
You need to do something with the error inside here. Log it perhaps (we have LLDB_LOG_ERROR for that)?


================
Comment at: lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp:1552
+  if (!expected_py_return)
+    return {};
 
----------------
same here (and elsewhere)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D138248



More information about the lldb-commits mailing list