Better typed syx snapshot check result (#74)
* better typed snapshot check * edit compile_commands.json to use the real compiler
This commit is contained in:
parent
9f3e2399ee
commit
9d2197b73b
@ -59,6 +59,10 @@ typedef struct SyxSnapshotState {
|
|||||||
// Root
|
// Root
|
||||||
} SyxSnapshotState;
|
} SyxSnapshotState;
|
||||||
|
|
||||||
|
typedef struct SyxSnapshotCheckResult {
|
||||||
|
uint64_t nb_inconsistencies;
|
||||||
|
} SyxSnapshotCheckResult;
|
||||||
|
|
||||||
void syx_snapshot_init(bool cached_bdrvs);
|
void syx_snapshot_init(bool cached_bdrvs);
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -71,7 +75,7 @@ void syx_snapshot_free(SyxSnapshot *snapshot);
|
|||||||
|
|
||||||
void syx_snapshot_root_restore(SyxSnapshot *snapshot);
|
void syx_snapshot_root_restore(SyxSnapshot *snapshot);
|
||||||
|
|
||||||
uint64_t syx_snapshot_check_memory_consistency(SyxSnapshot *snapshot);
|
SyxSnapshotCheckResult syx_snapshot_check(SyxSnapshot* ref_snapshot);
|
||||||
|
|
||||||
// Push the current RAM state and saves it
|
// Push the current RAM state and saves it
|
||||||
void syx_snapshot_increment_push(SyxSnapshot *snapshot, DeviceSnapshotKind kind, char **devices);
|
void syx_snapshot_increment_push(SyxSnapshot *snapshot, DeviceSnapshotKind kind, char **devices);
|
||||||
|
@ -577,7 +577,6 @@ static void root_restore_check_memory_rb(gpointer rb_idstr_hash, gpointer rb_dir
|
|||||||
SyxSnapshot *snapshot = args->snapshot;
|
SyxSnapshot *snapshot = args->snapshot;
|
||||||
RAMBlock *rb = ramblock_lookup(rb_idstr_hash);
|
RAMBlock *rb = ramblock_lookup(rb_idstr_hash);
|
||||||
|
|
||||||
args->nb_inconsistent_pages = 0;
|
|
||||||
if (rb) {
|
if (rb) {
|
||||||
SYX_PRINTF("Checking memory consistency of %s... ", rb->idstr);
|
SYX_PRINTF("Checking memory consistency of %s... ", rb->idstr);
|
||||||
SyxSnapshotRAMBlock *rb_snapshot = g_hash_table_lookup(snapshot->root_snapshot->rbs_snapshot, rb_idstr_hash);
|
SyxSnapshotRAMBlock *rb_snapshot = g_hash_table_lookup(snapshot->root_snapshot->rbs_snapshot, rb_idstr_hash);
|
||||||
@ -610,12 +609,19 @@ static void root_restore_check_memory_rb(gpointer rb_idstr_hash, gpointer rb_dir
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t syx_snapshot_check_memory_consistency(SyxSnapshot *snapshot) {
|
SyxSnapshotCheckResult syx_snapshot_check(SyxSnapshot* ref_snapshot) {
|
||||||
struct rb_check_memory_args args = {
|
struct rb_check_memory_args args = {
|
||||||
.snapshot = snapshot
|
.snapshot = ref_snapshot,
|
||||||
|
.nb_inconsistent_pages = 0,
|
||||||
};
|
};
|
||||||
g_hash_table_foreach(snapshot->rbs_dirty_list, root_restore_check_memory_rb, &args);
|
|
||||||
return args.nb_inconsistent_pages;
|
g_hash_table_foreach(ref_snapshot->rbs_dirty_list, root_restore_check_memory_rb, &args);
|
||||||
|
|
||||||
|
struct SyxSnapshotCheckResult res = {
|
||||||
|
.nb_inconsistencies = args.nb_inconsistent_pages
|
||||||
|
};
|
||||||
|
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
void syx_snapshot_root_restore(SyxSnapshot *snapshot) {
|
void syx_snapshot_root_restore(SyxSnapshot *snapshot) {
|
||||||
|
@ -27,6 +27,19 @@ shared_library_pattern = r"^[^-].*/lib(.*)\.so(\.[0-9].*)?(?!rsp)$"
|
|||||||
rpath_pattern = r"^'.*,-rpath,(.*)'$"
|
rpath_pattern = r"^'.*,-rpath,(.*)'$"
|
||||||
rpath_link_pattern = r"^.*,-rpath-link,(.*)$"
|
rpath_link_pattern = r"^.*,-rpath-link,(.*)$"
|
||||||
|
|
||||||
|
linker_interceptor_pattern = r"(\": \")(.*linker_interceptor.py)( )"
|
||||||
|
linker_interceptorpp_pattern = r"(\": \")(.*linker_interceptor\+\+.py)( )"
|
||||||
|
|
||||||
|
def fix_compile_commands():
|
||||||
|
with open("compile_commands.json", 'r') as f:
|
||||||
|
compile_commands = f.read()
|
||||||
|
|
||||||
|
res = re.sub(linker_interceptor_pattern, rf"\g<1>{CC}\g<3>", compile_commands)
|
||||||
|
res = re.sub(linker_interceptorpp_pattern, rf"\g<1>{CXX}\g<3>", res)
|
||||||
|
|
||||||
|
with open("compile_commands.json", 'w') as f:
|
||||||
|
f.write(res)
|
||||||
|
|
||||||
def process_args(args):
|
def process_args(args):
|
||||||
global out_args, shareds, search, is_linking_qemu
|
global out_args, shareds, search, is_linking_qemu
|
||||||
prev_o = False
|
prev_o = False
|
||||||
@ -75,6 +88,8 @@ if is_linking_qemu:
|
|||||||
for entry in compile_commands:
|
for entry in compile_commands:
|
||||||
sources.append(entry["file"])
|
sources.append(entry["file"])
|
||||||
|
|
||||||
|
fix_compile_commands()
|
||||||
|
|
||||||
with open(OUT, 'w') as f:
|
with open(OUT, 'w') as f:
|
||||||
json.dump({
|
json.dump({
|
||||||
'cmd': out_args,
|
'cmd': out_args,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user