mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-02-14 14:56:47 +00:00
[PR] Instrumentation: Sync file on dump
Summary: Sync the file with storage device on data dump to stabilize instrumentation testing Vladislav Khmelevsky, Advanced Software Technology Lab, Huawei (cherry picked from FBD31738021)
This commit is contained in:
parent
2d431eefbf
commit
dcdd37fdc2
@ -443,6 +443,16 @@ int __kill(uint64_t pid, int sig) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
int __fsync(int fd) {
|
||||
int ret;
|
||||
__asm__ __volatile__("movq $74, %%rax\n"
|
||||
"syscall\n"
|
||||
: "=a"(ret)
|
||||
: "D"(fd)
|
||||
: "cc", "rcx", "r11", "memory");
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void reportError(const char *Msg, uint64_t Size) {
|
||||
|
@ -1485,6 +1485,7 @@ __bolt_instr_data_dump() {
|
||||
writeIndirectCallProfile(FD, Ctx);
|
||||
Ctx.CallFlowTable->forEachElement(visitCallFlowEntry, FD, &Ctx);
|
||||
|
||||
__fsync(FD);
|
||||
__close(FD);
|
||||
__munmap(Ctx.MMapPtr, Ctx.MMapSize);
|
||||
__close(Ctx.FileDesc);
|
||||
@ -1509,6 +1510,7 @@ void watchProcess() {
|
||||
ppid = __getppid();
|
||||
if (ppid == 1) {
|
||||
// Parent already dead
|
||||
__bolt_instr_data_dump();
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user