Skip to content

Commit f47ce82

Browse files
committed
Debug analyze_code
1 parent 2b79acd commit f47ce82

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

internal/api/lib.go

+1
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ func AnalyzeCode(cache Cache, checksum []byte) (*types.AnalysisReport, error) {
156156
cs := makeView(checksum)
157157
defer runtime.KeepAlive(checksum)
158158
errmsg := uninitializedUnmanagedVector()
159+
fmt.Printf("AnalyzeCode: %p (%v, %v, %p) %p", cache.ptr, cs.is_nil, cs.len, cs.ptr, &errmsg)
159160
report, err := C.analyze_code(cache.ptr, cs, &errmsg)
160161
if err != nil {
161162
return nil, errorWithMessage(err, errmsg)

libwasmvm/src/cache.rs

+8-1
Original file line numberDiff line numberDiff line change
@@ -280,8 +280,15 @@ fn set_to_csv(set: BTreeSet<impl AsRef<str>>) -> String {
280280
pub extern "C" fn analyze_code(
281281
cache: *mut cache_t,
282282
checksum: ByteSliceView,
283-
error_msg: Option<&mut UnmanagedVector>,
283+
mut error_msg: Option<&mut UnmanagedVector>,
284284
) -> AnalysisReport {
285+
println!(
286+
"analyze_code: {cache:?} ({}, {}, {:?}) {:?}",
287+
checksum.is_nil,
288+
checksum.len,
289+
checksum.ptr,
290+
error_msg.as_mut().map(|e| *e as *mut UnmanagedVector)
291+
);
285292
let r = match to_cache(cache) {
286293
Some(c) => catch_unwind(AssertUnwindSafe(move || do_analyze_code(c, checksum)))
287294
.unwrap_or_else(|err| {

libwasmvm/src/memory.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ use std::slice;
1010
#[derive(Debug)]
1111
pub struct ByteSliceView {
1212
/// True if and only if the byte slice is nil in Go. If this is true, the other fields must be ignored.
13-
is_nil: bool,
14-
ptr: *const u8,
15-
len: usize,
13+
pub is_nil: bool,
14+
pub ptr: *const u8,
15+
pub len: usize,
1616
}
1717

1818
impl ByteSliceView {

0 commit comments

Comments
 (0)