[Lldb-commits] [PATCH] D151002: [lldb] Fix process pid parsing issue
Med Ismail Bennani via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Fri May 19 15:19:08 PDT 2023
mib created this revision.
mib added reviewers: JDevlieghere, bulbazord.
mib added a project: LLDB.
Herald added a project: All.
mib requested review of this revision.
Herald added a subscriber: lldb-commits.
This patch should fix an issue when parsing the process pid and setting
it in the scripted process.
It can happen that the `crashlog.process_id` attribute is sometimes
parsed as a string. That would cause the scripted process to pick the
default value (0).
To address that, this patch makes sure that the parsed attributed is
converted to the integer type before passing it to the scripted process.
Signed-off-by: Med Ismail Bennani <ismail at bennani.ma>
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D151002
Files:
lldb/examples/python/scripted_process/crashlog_scripted_process.py
Index: lldb/examples/python/scripted_process/crashlog_scripted_process.py
===================================================================
--- lldb/examples/python/scripted_process/crashlog_scripted_process.py
+++ lldb/examples/python/scripted_process/crashlog_scripted_process.py
@@ -11,7 +11,13 @@
class CrashLogScriptedProcess(ScriptedProcess):
def set_crashlog(self, crashlog):
self.crashlog = crashlog
- self.pid = self.crashlog.process_id
+ if self.crashlog.process_id:
+ if type(self.crashlog.process_id) is int:
+ self.pid = self.crashlog.process_id
+ elif type(self.crashlog.process_id) is str:
+ self.pid = int(self.crashlog.process_id, 0)
+ else:
+ self.pid = super().get_process_id()
self.addr_mask = self.crashlog.addr_mask
self.crashed_thread_idx = self.crashlog.crashed_thread_idx
self.loaded_images = []
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D151002.523949.patch
Type: text/x-patch
Size: 957 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20230519/a1c581ba/attachment.bin>
More information about the lldb-commits
mailing list