Skip to content

Commit

Permalink
adding debug symbols option
Browse files Browse the repository at this point in the history
  • Loading branch information
Kbz-8 committed Jul 20, 2024
1 parent 7921598 commit 687e8ec
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 18 deletions.
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
all :
@zig build

debug:
@zig build -Ddebug=true

run : fclean
@zig build run

run-debug : fclean
@zig build run-debug
@zig build run-debug -Ddebug=true

clean:

Expand Down
6 changes: 4 additions & 2 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,18 @@ const std = @import("std");

pub fn build(b: *std.Build) void
{
const debug_symbols = b.option(bool, "debug", "Add debug symbols") orelse false;

const kernel = b.addExecutable(.{
.name = "kernel.elf",
.root_source_file = .{ .src_path = .{ .owner = b, .sub_path = "sources/kernel/kmain.zig" } },
.target = b.resolveTargetQuery(.{
.cpu_arch = .x86,
.abi = .gnu,
.abi = .none,
.os_tag = .freestanding,
}),
.optimize = .Debug,
//.strip = true,
.strip = !debug_symbols,
.code_model = .kernel,
.pic = false,
});
Expand Down
15 changes: 0 additions & 15 deletions linker.ld
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,6 @@ SECTIONS
.rodata : ALIGN(4K)
{
*(.rodata)
__debug_info_start = .;
KEEP(*(.debug_info))
__debug_info_end = .;
__debug_abbrev_start = .;
KEEP(*(.debug_abbrev))
__debug_abbrev_end = .;
__debug_str_start = .;
KEEP(*(.debug_str))
__debug_str_end = .;
__debug_line_start = .;
KEEP(*(.debug_line))
__debug_line_end = .;
__debug_ranges_start = .;
KEEP(*(.debug_ranges))
__debug_ranges_end = .;
}

.data : ALIGN(4K)
Expand Down
1 change: 1 addition & 0 deletions sources/drivers/vga/vga.zig
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ pub fn init(title : []const u8, title_color : u8, navbar_color : u8, triggered_c
updateCursor();
updateNavbar();
kernel.logs.klogln("[VGA Driver] loaded");
kernel.stk.stackTrace(42);
}

fn putEntry(c: u8, color: u8, x: usize, y: usize) void
Expand Down

0 comments on commit 687e8ec

Please sign in to comment.