Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

std.valgrind: fix regressions that are causing compile errors #21271

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/std/valgrind.zig
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ pub fn discardTranslations(qzz: []const u8) void {
}

pub fn innerThreads(qzz: [*]u8) void {
doClientRequestStmt(.InnerThreads, qzz, 0, 0, 0, 0);
doClientRequestStmt(.InnerThreads, @intFromPtr(qzz), 0, 0, 0, 0);
}

pub fn nonSimdCall0(func: fn (usize) usize) usize {
Expand Down Expand Up @@ -273,7 +273,7 @@ pub fn enableErrorReporting() void {
/// If no connection is opened, output will go to the log output.
/// Returns 1 if command not recognised, 0 otherwise.
pub fn monitorCommand(command: [*]u8) bool {
return doClientRequestExpr(0, .GdbMonitorCommand, @intFromPtr(command.ptr), 0, 0, 0, 0) != 0;
return doClientRequestExpr(0, .GdbMonitorCommand, @intFromPtr(command), 0, 0, 0, 0) != 0;
}

pub const memcheck = @import("valgrind/memcheck.zig");
Expand Down
12 changes: 6 additions & 6 deletions lib/std/valgrind/memcheck.zig
Original file line number Diff line number Diff line change
Expand Up @@ -90,26 +90,26 @@ pub fn checkMemIsDefined(qzz: []const u8) usize {

/// Do a full memory leak check (like --leak-check=full) mid-execution.
pub fn doLeakCheck() void {
doClientRequestStmt(.DO_LEAK_CHECK, 0, 0, 0, 0, 0);
doClientRequestStmt(.DoLeakCheck, 0, 0, 0, 0, 0);
}

/// Same as doLeakCheck() but only showing the entries for
/// which there was an increase in leaked bytes or leaked nr of blocks
/// since the previous leak search.
pub fn doAddedLeakCheck() void {
doClientRequestStmt(.DO_LEAK_CHECK, 0, 1, 0, 0, 0);
doClientRequestStmt(.DoLeakCheck, 0, 1, 0, 0, 0);
}

/// Same as doAddedLeakCheck() but showing entries with
/// increased or decreased leaked bytes/blocks since previous leak
/// search.
pub fn doChangedLeakCheck() void {
doClientRequestStmt(.DO_LEAK_CHECK, 0, 2, 0, 0, 0);
doClientRequestStmt(.DoLeakCheck, 0, 2, 0, 0, 0);
}

/// Do a summary memory leak check (like --leak-check=summary) mid-execution.
pub fn doQuickLeakCheck() void {
doClientRequestStmt(.DO_LEAK_CHECK, 1, 0, 0, 0, 0);
doClientRequestStmt(.DoLeakCheck, 1, 0, 0, 0, 0);
}

/// Return number of leaked, dubious, reachable and suppressed bytes found by
Expand Down Expand Up @@ -191,7 +191,7 @@ test countLeakBlocks {
/// impossible to segfault your system by using this call.
pub fn getVbits(zza: []u8, zzvbits: []u8) u2 {
std.debug.assert(zzvbits.len >= zza.len / 8);
return @as(u2, @intCast(doClientRequestExpr(0, .GetVbits, @intFromPtr(zza.ptr), @intFromPtr(zzvbits), zza.len, 0, 0)));
return @as(u2, @intCast(doClientRequestExpr(0, .GetVbits, @intFromPtr(zza.ptr), @intFromPtr(zzvbits.ptr), zza.len, 0, 0)));
}

/// Set the validity data for addresses zza, copying it
Expand All @@ -204,7 +204,7 @@ pub fn getVbits(zza: []u8, zzvbits: []u8) u2 {
/// impossible to segfault your system by using this call.
pub fn setVbits(zzvbits: []u8, zza: []u8) u2 {
std.debug.assert(zzvbits.len >= zza.len / 8);
return @as(u2, @intCast(doClientRequestExpr(0, .SetVbits, @intFromPtr(zza.ptr), @intFromPtr(zzvbits), zza.len, 0, 0)));
return @as(u2, @intCast(doClientRequestExpr(0, .SetVbits, @intFromPtr(zza.ptr), @intFromPtr(zzvbits.ptr), zza.len, 0, 0)));
}

/// Disable and re-enable reporting of addressing errors in the
Expand Down