Skip to content

Commit 2931eda

Browse files
committed
[lldb] Fix process pid parsing issue
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. Differential Revision: https://reviews.llvm.org/D151002 Signed-off-by: Med Ismail Bennani <[email protected]>
1 parent 5dba078 commit 2931eda

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lldb/examples/python/scripted_process/crashlog_scripted_process.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,13 @@
1111
class CrashLogScriptedProcess(ScriptedProcess):
1212
def set_crashlog(self, crashlog):
1313
self.crashlog = crashlog
14-
self.pid = self.crashlog.process_id
14+
if self.crashlog.process_id:
15+
if type(self.crashlog.process_id) is int:
16+
self.pid = self.crashlog.process_id
17+
elif type(self.crashlog.process_id) is str:
18+
self.pid = int(self.crashlog.process_id, 0)
19+
else:
20+
self.pid = super().get_process_id()
1521
self.addr_mask = self.crashlog.addr_mask
1622
self.crashed_thread_idx = self.crashlog.crashed_thread_idx
1723
self.loaded_images = []

0 commit comments

Comments
 (0)