adding gdb utils

This commit is contained in:
2025-11-16 15:28:12 +01:00
parent b8c7a6e41e
commit c74bc7fb15
3 changed files with 13 additions and 7 deletions

View File

@@ -94,18 +94,25 @@ pub fn build(b: *std.Build) !void {
}); });
const c_test_exe_install = b.addInstallArtifact(c_test_exe, .{}); const c_test_exe_install = b.addInstallArtifact(c_test_exe, .{});
c_test_exe_install.step.dependOn(&lib_install.step);
try targets.append(b.allocator, lib); try targets.append(b.allocator, lib);
try targets.append(b.allocator, c_test_exe); try targets.append(b.allocator, c_test_exe);
_ = zcc.createStep(b, "cdb", try targets.toOwnedSlice(b.allocator)); _ = zcc.createStep(b, "cdb", try targets.toOwnedSlice(b.allocator));
const run_c_test = b.addRunArtifact(c_test_exe); const run_c_test_exe = b.addRunArtifact(c_test_exe);
run_c_test.step.dependOn(&lib_install.step); run_c_test_exe.step.dependOn(&c_test_exe_install.step);
run_c_test.step.dependOn(&c_test_exe_install.step);
const test_c_step = b.step(b.fmt("test-c-{s}", .{impl.name}), b.fmt("Run lib{s} C test", .{impl.name})); const run_c_test_step = b.step(b.fmt("test-c-{s}", .{impl.name}), b.fmt("Run lib{s} C test", .{impl.name}));
test_c_step.dependOn(&run_c_test.step); run_c_test_step.dependOn(&run_c_test_exe.step);
const run_c_test_gdb_exe = b.addRunArtifact(c_test_exe);
try run_c_test_gdb_exe.argv.insert(b.allocator, 0, .{ .bytes = b.fmt("gdb", .{}) }); // Hacky
run_c_test_gdb_exe.step.dependOn(&c_test_exe_install.step);
const run_c_test_gdb_step = b.step(b.fmt("test-c-{s}-gdb", .{impl.name}), b.fmt("Run lib{s} C test within gdb", .{impl.name}));
run_c_test_gdb_step.dependOn(&run_c_test_gdb_exe.step);
} }
const autodoc_test = b.addObject(.{ const autodoc_test = b.addObject(.{

View File

@@ -25,6 +25,5 @@ pub fn init(device: *Device, allocator: std.mem.Allocator, info: *const vk.Comma
} }
pub inline fn destroy(self: *Self, allocator: std.mem.Allocator) void { pub inline fn destroy(self: *Self, allocator: std.mem.Allocator) void {
std.debug.print("{any}\n", .{self});
self.vtable.destroy(self, allocator); self.vtable.destroy(self, allocator);
} }

View File

@@ -51,7 +51,7 @@ pub fn init(device: *Device, allocator: std.mem.Allocator, info: *const vk.Comma
pub fn allocateCommandBuffers(self: *Self, info: *const vk.CommandBufferAllocateInfo) VkError![]*NonDispatchable(CommandBuffer) { pub fn allocateCommandBuffers(self: *Self, info: *const vk.CommandBufferAllocateInfo) VkError![]*NonDispatchable(CommandBuffer) {
const allocator = self.host_allocator.allocator(); const allocator = self.host_allocator.allocator();
if (self.buffers.items.len < info.command_buffer_count or self.first_free_buffer_index + info.command_buffer_count > self.buffers.items.len) { if (self.buffers.items.len < self.first_free_buffer_index + info.command_buffer_count) {
while (self.buffers.capacity < self.buffers.items.len + info.command_buffer_count) { while (self.buffers.capacity < self.buffers.items.len + info.command_buffer_count) {
self.buffers.ensureUnusedCapacity(allocator, BUFFER_POOL_BASE_CAPACITY) catch return VkError.OutOfHostMemory; self.buffers.ensureUnusedCapacity(allocator, BUFFER_POOL_BASE_CAPACITY) catch return VkError.OutOfHostMemory;
} }