[lldb/crashlog] Remove tempfile prefix from inlined symbol object file

This patch changes the way we generate the ObjectFileJSON files
containing the inlined symbols from the crash report to remove the
tempfile prefix from the object file name.

To do so, instead of creating a new tempfile for each module, we create a
temporary directory that contains each module object file with the same
name as the module.

This makes the backtraces only contain the module name without the
temfile prefix which makes it look like a regular stackframe.

Differential Revision: https://reviews.llvm.org/D151045

Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
This commit is contained in:
Med Ismail Bennani
2023-05-22 15:51:43 -07:00
parent 273a2d337f
commit abba5de724
3 changed files with 27 additions and 19 deletions

View File

@@ -1,4 +1,4 @@
import os,json,struct,signal,uuid
import os, json, struct, signal, uuid, tempfile
from typing import Any, Dict
@@ -38,16 +38,17 @@ class CrashLogScriptedProcess(ScriptedProcess):
for image in self.crashlog.find_images_with_identifier(ident):
image.resolve = True
for image in self.crashlog.images:
if image not in self.loaded_images:
if image.uuid == uuid.UUID(int=0):
continue
err = image.add_module(self.target)
if err:
# Append to SBCommandReturnObject
print(err)
else:
self.loaded_images.append(image)
with tempfile.TemporaryDirectory() as obj_dir:
for image in self.crashlog.images:
if image not in self.loaded_images:
if image.uuid == uuid.UUID(int=0):
continue
err = image.add_module(self.target, obj_dir)
if err:
# Append to SBCommandReturnObject
print(err)
else:
self.loaded_images.append(image)
for thread in self.crashlog.threads:
if hasattr(thread, 'app_specific_backtrace') and thread.app_specific_backtrace: