From 518b868249eb785eb55e0fc9278c1b77825a06d5 Mon Sep 17 00:00:00 2001 From: Rekai Musuka Date: Sun, 29 Jan 2023 07:06:06 -0600 Subject: [PATCH] feat: respond to API changes for software bkpts --- lib/zba-gdbstub | 2 +- src/core/emu.zig | 5 +++-- src/main.zig | 5 +++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/zba-gdbstub b/lib/zba-gdbstub index 81ff227..d7b8d7a 160000 --- a/lib/zba-gdbstub +++ b/lib/zba-gdbstub @@ -1 +1 @@ -Subproject commit 81ff227ea76d5b44a89e422e380e0fe15aec02aa +Subproject commit d7b8d7acb15ce3518480c59218bf2c0a17fa529f diff --git a/src/core/emu.zig b/src/core/emu.zig index 6226d71..1dc1d1e 100644 --- a/src/core/emu.zig +++ b/src/core/emu.zig @@ -166,6 +166,7 @@ fn spinLoop(timer: *Timer, wake_time: u64) void { pub const EmuThing = struct { const Self = @This(); const Interface = @import("gdbstub").Emulator; + const Allocator = std.mem.Allocator; cpu: *Arm7tdmi, scheduler: *Scheduler, @@ -174,8 +175,8 @@ pub const EmuThing = struct { return .{ .cpu = cpu, .scheduler = scheduler }; } - pub fn interface(self: *Self) Interface { - return Interface.init(self); + pub fn interface(self: *Self, allocator: Allocator) Interface { + return Interface.init(allocator, self); } pub fn read(self: *const Self, addr: u32) u8 { diff --git a/src/main.zig b/src/main.zig index cc89a24..6b8ef0c 100644 --- a/src/main.zig +++ b/src/main.zig @@ -92,8 +92,9 @@ pub fn main() void { const Server = @import("gdbstub").Server; const EmuThing = @import("core/emu.zig").EmuThing; - var emu_thing = EmuThing.init(&cpu, &scheduler); - const emulator = emu_thing.interface(); + var wrapper = EmuThing.init(&cpu, &scheduler); + var emulator = wrapper.interface(allocator); + defer emulator.deinit(); { const frames_per_second: usize = 60;