[Lldb-commits] [PATCH] D146765: [lldb/crashlog] Load inlined symbol into interactive crashlog

Jonas Devlieghere via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Mar 24 10:16:55 PDT 2023


JDevlieghere added inline comments.


================
Comment at: lldb/examples/python/crashlog.py:1187-1192
+        symbol_file = os.path.join(tmp_dir.name, module.GetUUIDString() + ".json")
+        with open(symbol_file, 'w') as f:
+            f.write(json.dumps(symbol_data))
+
+        ci.HandleCommand("target symbols add -s '%s' %s" %
+                         (module.GetFileSpec().fullpath, symbol_file), result)
----------------
We shouldn't keep those temp files around once they've been loaded by LLDB. We should use a `tempfile.NamedTemporaryFile` for this with the UUID as part of its name pattern.


================
Comment at: lldb/include/lldb/API/SBModuleSpec.h:78
 
+  bool SetUUIDFromString(const char *uuid, size_t uuid_len);
+
----------------
We don't need the `uuid_len`, the string should be NULL terminated. That matches other `FromString` SB APIs.


================
Comment at: lldb/source/API/SBModuleSpec.cpp:136
+bool SBModuleSpec::SetUUIDFromString(const char *uuid, size_t uuid_len) {
+  LLDB_INSTRUMENT_VA(this, uuid, uuid_len)
+  m_opaque_up->GetUUID().SetFromStringRef(llvm::StringRef(uuid, uuid_len));
----------------
newline after LLDB_INSTRUMENT


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D146765



More information about the lldb-commits mailing list