|
@@ -223,6 +223,8 @@ def _process_symbolicator_results(profile: Profile, stacktraces: List[Any]) -> N
|
|
|
|
|
|
if profile["platform"] == "rust":
|
|
if profile["platform"] == "rust":
|
|
_process_symbolicator_results_for_rust(profile, stacktraces)
|
|
_process_symbolicator_results_for_rust(profile, stacktraces)
|
|
|
|
+ elif profile["platform"] == "cocoa":
|
|
|
|
+ _process_symbolicator_results_for_cocoa(profile, stacktraces)
|
|
|
|
|
|
# rename the profile key to suggest it has been processed
|
|
# rename the profile key to suggest it has been processed
|
|
profile["profile"] = profile.pop("sampled_profile")
|
|
profile["profile"] = profile.pop("sampled_profile")
|
|
@@ -265,6 +267,7 @@ def _process_symbolicator_results_for_sample(profile: Profile, stacktraces: List
|
|
stack = profile["profile"]["stacks"][stack_id]
|
|
stack = profile["profile"]["stacks"][stack_id]
|
|
|
|
|
|
if len(stack) < 2:
|
|
if len(stack) < 2:
|
|
|
|
+ profile["profile"]["stacks"] = stack
|
|
continue
|
|
continue
|
|
|
|
|
|
# truncate some unneeded frames in the stack (related to the profiler itself or impossible to symbolicate)
|
|
# truncate some unneeded frames in the stack (related to the profiler itself or impossible to symbolicate)
|
|
@@ -273,6 +276,18 @@ def _process_symbolicator_results_for_sample(profile: Profile, stacktraces: List
|
|
)
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
+def _process_symbolicator_results_for_cocoa(profile: Profile, stacktraces: List[Any]) -> None:
|
|
|
|
+ for original, symbolicated in zip(profile["sampled_profile"]["samples"], stacktraces):
|
|
|
|
+ # remove bottom frames we can't symbolicate
|
|
|
|
+ if (
|
|
|
|
+ len(symbolicated["frames"]) > 1
|
|
|
|
+ and symbolicated["frames"][-1].get("instruction_addr", "") == "0xffffffffc"
|
|
|
|
+ ):
|
|
|
|
+ original["frames"] = symbolicated["frames"][:-2]
|
|
|
|
+ else:
|
|
|
|
+ original["frames"] = symbolicated["frames"]
|
|
|
|
+
|
|
|
|
+
|
|
def _process_symbolicator_results_for_rust(profile: Profile, stacktraces: List[Any]) -> None:
|
|
def _process_symbolicator_results_for_rust(profile: Profile, stacktraces: List[Any]) -> None:
|
|
for original, symbolicated in zip(profile["sampled_profile"]["samples"], stacktraces):
|
|
for original, symbolicated in zip(profile["sampled_profile"]["samples"], stacktraces):
|
|
for frame in symbolicated["frames"]:
|
|
for frame in symbolicated["frames"]:
|
|
@@ -280,11 +295,11 @@ def _process_symbolicator_results_for_rust(profile: Profile, stacktraces: List[A
|
|
frame.pop("context_line", None)
|
|
frame.pop("context_line", None)
|
|
frame.pop("post_context", None)
|
|
frame.pop("post_context", None)
|
|
|
|
|
|
- if len(symbolicated["frames"]) < 2:
|
|
|
|
- continue
|
|
|
|
-
|
|
|
|
# exclude the top frames of the stack as it's related to the profiler itself and we don't want them.
|
|
# exclude the top frames of the stack as it's related to the profiler itself and we don't want them.
|
|
- if symbolicated["frames"][0].get("function", "") == "perf_signal_handler":
|
|
|
|
|
|
+ if (
|
|
|
|
+ len(symbolicated["frames"]) > 1
|
|
|
|
+ and symbolicated["frames"][0].get("function", "") == "perf_signal_handler"
|
|
|
|
+ ):
|
|
original["frames"] = symbolicated["frames"][2:]
|
|
original["frames"] = symbolicated["frames"][2:]
|
|
else:
|
|
else:
|
|
original["frames"] = symbolicated["frames"]
|
|
original["frames"] = symbolicated["frames"]
|