<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/88761>88761</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
__xray_log_select_mode typo and deserialize tool
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
yunhuali
</td>
</tr>
</table>
<pre>
1. Apparently, this is a typo in [xray_profiling.cpp](https://github.com/llvm/llvm-project/blob/4e85e1ffcaf161736e27a24c291c1177be865976/compiler-rt/lib/xray/xray_profiling.cpp#L512)
which causing a bug, and xray-profiling mode is won't initilized correctly.
<img width="651" alt="Screen Shot 2024-04-15 at 9 22 39 AM" src="https://github.com/llvm/llvm-project/assets/79297823/740b4b45-8671-4083-8aaa-ddf23e0f68e1">
to reproduce, just run:
`XRAY_OPTIONS="patch_premain=true xray_mode=xray-profiling ./sample`
2. other xray_mode, such as xray-basic, will also call
`__xray_log_init_mode` automatically, but [xray_profiling.cpp](https://github.com/llvm/llvm-project/blob/4e85e1ffcaf161736e27a24c291c1177be865976/compiler-rt/lib/xray/xray_profiling.cpp#L512) doesn't. I'm not sure if this is intentional or just a minor miss. but it is not consistent compare with other mode, which will cause confuse.
to overcome this, I had to call `__xray_log_init_mode` in my main function.
```c
extern "C" {
extern int __xray_log_init_mode(const char *Mode, const char *Config);
}
int main() {
if ( // xray_mode is xray-profiling) {
__xray_log_init_mode("xray-profiling", "");
}
}
```
3. with those fix, I can generate the profiling output file, but seems current llvm/tools/llvm-xray is not able to decode the profiling output. I'm not sure is there any branch support it/developing on going. or I need write my own. thanks.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzUVc2O4zYTfBr60rAgNSVLPvjgHX8GBvg2G2RzSE4GRbUsbmhSIKn1Ok8ftDSev2wC7DHAYPRjVbO6q4pUMZqzI9qJ6oOoDis1pcGH3W1yw6SsWbW-u-2KDPbjqA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