Commit 1cf38879 authored by Cyrill Gorcunov's avatar Cyrill Gorcunov

restorer: More readable tracepoints

And a pause at the end.
Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@gmail.com>
parent 3c88046a
...@@ -37,6 +37,11 @@ ...@@ -37,6 +37,11 @@
c += 'a' - 10; \ c += 'a' - 10; \
} while (0) } while (0)
static void always_inline write_char(char c)
{
sys_write(1, &c, 1);
}
static void always_inline write_string(char *str) static void always_inline write_string(char *str)
{ {
int len = 0; int len = 0;
...@@ -157,17 +162,17 @@ self_len_end: ...@@ -157,17 +162,17 @@ self_len_end:
if (ret != sizeof(vma_entry)) if (ret != sizeof(vma_entry))
goto core_restore_end; goto core_restore_end;
write_hex_n(__LINE__);
if (!(vma_entry.status & VMA_AREA_REGULAR)) if (!(vma_entry.status & VMA_AREA_REGULAR))
continue; continue;
write_hex_n(__LINE__);
write_hex_n(vma_entry.start); write_hex_n(vma_entry.start);
if (sys_munmap((void *)vma_entry.start, if (sys_munmap((void *)vma_entry.start,
vma_entry.end - vma_entry.start)) vma_entry.end - vma_entry.start))
goto core_restore_end; goto core_restore_end;
write_hex_n(__LINE__); write_hex_n(__LINE__);
write_char('\n');
} }
sys_close(fd_self_vmas); sys_close(fd_self_vmas);
...@@ -186,11 +191,10 @@ self_len_end: ...@@ -186,11 +191,10 @@ self_len_end:
if (!vma_entry.start) if (!vma_entry.start)
break; break;
write_hex_n(__LINE__);
if (!(vma_entry.status & VMA_AREA_REGULAR)) if (!(vma_entry.status & VMA_AREA_REGULAR))
continue; continue;
write_hex_n(__LINE__);
write_hex_n(vma_entry.start); write_hex_n(vma_entry.start);
vma_entry.fd = 0; /* for a while */ vma_entry.fd = 0; /* for a while */
...@@ -208,6 +212,7 @@ self_len_end: ...@@ -208,6 +212,7 @@ self_len_end:
} }
write_hex_n(__LINE__); write_hex_n(__LINE__);
write_char('\n');
} }
/* /*
...@@ -229,19 +234,19 @@ self_len_end: ...@@ -229,19 +234,19 @@ self_len_end:
goto core_restore_end; goto core_restore_end;
write_hex_n(__LINE__); write_hex_n(__LINE__);
write_char('\n');
} }
sys_close(fd_core); sys_close(fd_core);
for (;;)
asm volatile("pause");
goto core_restore_end; goto core_restore_end;
/* Finally call for sigreturn */ /* Finally call for sigreturn */
sys_rt_sigreturn(); sys_rt_sigreturn();
core_restore_end: core_restore_end:
for (;;)
asm volatile("pause");
sys_exit(0); sys_exit(0);
} }
break; break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment