Skip to content

Instantly share code, notes, and snippets.

View SamTebbs33's full-sized avatar

Sam Tebbs SamTebbs33

  • United Kingdom
  • 08:58 (UTC +01:00)
View GitHub Profile
ld $r15, #tsk1
ld $r13, 1
thr $r13
sch $r13
esw
tsk0:
in $r0, 0
out 0, $r0
jmp #tsk0
diff --git a/src/ir.c b/src/ir.c
index 0dc2a53..b779e3c 100644
--- a/src/ir.c
+++ b/src/ir.c
@@ -1236,7 +1236,7 @@ void ssa_search_definers(struct ir_var* var, struct ir_basic_block* original_bb,
struct ir_basic_block* parent = parent_node->val;
// We make sure we haven't already checked this parent to avoud infinite recursion
// We also make sure that we only check parents that come before the original basic block in the control flow to avoid checking siblings
- if (!list_contains(checked, &parent->id, ir_equal_bb_id) && parent->id <= original_bb->id)
+ if (!list_contains(checked, &parent->id, ir_equal_bb_id))
const std = @import("std");
const ChildProcess = std.ChildProcess;
const File = std.fs.File;
pub fn main() !void {
const args = std.os.argv;
if (args.len != 3) {
std.debug.warn("Usage: {} <elf file> <map file>\n", args[0][0..strlen(args[0])]);
return;
}
const std = @import("std");
var f: std.fs.File = undefined;
pub fn main() !void {
f = try std.fs.File.openRead("zig-cache/bin/iso/boot/pluto.elf");
const S = struct {
const SStream = std.io.SeekableStream(anyerror, anyerror);
const IStream = std.io.InStream(anyerror);
var sstream = SStream{
pluto.elf.big: file format ELF32-i386
architecture: i386
start address: 0x00102000
Sections:
Idx Name Size VMA LMA Type
0 00000000 0000000000000000 0000000000000000
1 .rodata.boot 00002000 0000000000100000 0000000000100000 DATA
pluto.elf.small: file format ELF32-i386
architecture: i386
start address: 0x00102000
Sections:
Idx Name Size VMA LMA Type
0 00000000 0000000000000000 0000000000000000
1 .rodata.boot 00002000 0000000000100000 0000000000100000 DATA
const std = @import("std");
const fmt = std.fmt;
const Parser = struct {
input: []const u8,
ch: u8,
len: usize,
fn parse_factor(self: *Parser) !f64 {
if (self.ch == '1')
→ /snap/bin/zig build (feature/paging | ~2)
error: FileNotFound
/snap/zig/425/lib/zig/std/os.zig:1276:25: 0x236d16 in ??? (build)
posix.EEXIST => return error.PathAlreadyExists,
^
/snap/zig/425/lib/zig/std/os.zig:1292:5: 0x236c38 in ??? (build)
return makeDirPosixC(&dir_path_c);
^
/snap/zig/425/lib/zig/std/os.zig:1252:9: 0x2355c4 in ??? (build)
return makeDirPosix(dir_path);
@SamTebbs33
SamTebbs33 / trace.py
Last active June 25, 2019 21:15
This file shows the execution trail of a gdb backtrace, as well as the relevant lines in the source file. Run with python 3.
import sys
import re
# Usage: python3 trace.py <path to gdb backtrace> <function to start analysing from>
# The function to start analysing from can be any function name that appears in the backtrace, such as "assert" or "std.special.panic"
trace_path = sys.argv[1]
start_func = sys.argv[2]
regex = r"#\d+\s+0x[a-f0-9]+ in ([a-zA-Z0-9_.(,)]+) \(([a-zA-Z0-9_]+=.+)*\) at ([\/a-zA-Z0-9_\.]+):(\d+)"
// build.zig
const Builder = @import("std").build.Builder;
pub fn build(b: *Builder) void {
const exe = b.addExecutable("exe", "import-build.zig");
b.default_step.dependOn(&exe.step);
}
//import-build.zig
const build = @import("@build");