Skip to content

Commit

Permalink
Debug
Browse files Browse the repository at this point in the history
  • Loading branch information
chipshort committed Oct 30, 2024
1 parent 947b8b0 commit c3f0afd
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
3 changes: 2 additions & 1 deletion internal/api/lib.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,9 @@ func AnalyzeCode(cache Cache, checksum []byte) (*types.AnalysisReport, error) {
cs := makeView(checksum)
defer runtime.KeepAlive(checksum)
errmsg := uninitializedUnmanagedVector()
fmt.Printf("AnalyzeCode: %p (%v, %v, %p) %p", cache.ptr, cs.is_nil, cs.len, cs.ptr, &errmsg)
fmt.Printf("AnalyzeCode: %p (%v, %v, %p) %p\n", cache.ptr, cs.is_nil, cs.len, cs.ptr, &errmsg)
report, err := C.analyze_code(cache.ptr, cs, &errmsg)
fmt.Printf("analyze_code done")
if err != nil {
return nil, errorWithMessage(err, errmsg)
}
Expand Down
13 changes: 12 additions & 1 deletion libwasmvm/src/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,18 @@ pub extern "C" fn analyze_code(
}),
None => Err(Error::unset_arg(CACHE_ARG)),
};
handle_c_error_default(r, error_msg)
let result = handle_c_error_default(r, error_msg);

println!(
"result: {result:?}, {{ {:?}, {:?}, {:?}, ({}, {}) }}",
result.has_ibc_entry_points,
result.entrypoints.ptr,
result.required_capabilities.ptr,
result.contract_migrate_version.is_some,
result.contract_migrate_version.value,
);

result
}

fn do_analyze_code(
Expand Down
8 changes: 4 additions & 4 deletions libwasmvm/src/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,10 +204,10 @@ impl U8SliceView {
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub struct UnmanagedVector {
/// True if and only if this is None. If this is true, the other fields must be ignored.
is_none: bool,
ptr: *mut u8,
len: usize,
cap: usize,
pub is_none: bool,
pub ptr: *mut u8,
pub len: usize,
pub cap: usize,
}

impl UnmanagedVector {
Expand Down

0 comments on commit c3f0afd

Please sign in to comment.