ChanServ changed the topic of #zig to: zig programming language | ziglang.org | be excellent to each other | channel logs: https://irclog.whitequark.org/zig/
steveno has joined #zig
<daurnimator> andrewrk: a quick search didn't find it, do you know what issue #?
suirad has quit [Ping timeout: 256 seconds]
suirad has joined #zig
steveno has quit [Remote host closed the connection]
steveno has joined #zig
porky11 has quit [Quit: Leaving]
steveno has quit [Remote host closed the connection]
<vegecode> Is it possible to generate a debug binary with the `zig test` command to run with gdb?
<vegecode> So I can debug my tests?
benjikun has quit [Quit: Lost terminal]
<andrewrk> vegecode, yes
<andrewrk> zig test leaves the test binary there
<andrewrk> zig-cache/test[.exe]
<andrewrk> also if your test crashes it prints the path to it
<daurnimator> andrewrk: thanks
<daurnimator> andrewrk: otherwise, any interesting progress?
<vegecode> andrewrk, thanks I never noticed it
<andrewrk> daurnimator, worked on copy elision today, made progress towards hello world working
<hryx> Speaking of cache, what's the difference between the project-local `zig-cache` directory and the one at ~/.local/share/zig ?
<andrewrk> the global one has compiler_rt.a, builtin.a, builtin.zig, the compiler hash, any binaries from `zig run`, and any binaries from `zig build`
<andrewrk> or anything you use `--cache on`
<andrewrk> the local one only has .o files and `zig test` output. the .o files are purposefully left in the local dir, notably, so that on macos stack traces can work
<andrewrk> zig test output is left there so that you can use a debugger on it, like vegecode mentioned
<andrewrk> I actually had completely removed the local one when I was working on the global cache stuff, but then realized certain things were better with the local one.
<hryx> fascinating. what's up with macos? is that an rpath thing?
<andrewrk> the binary in memory, maps addresses to .o files. then you go find the .o files and read the debug info
<hryx> dope, thanks for the 'splanation
<andrewrk> so you can try this experiment, have `zig test` call @panic on macos, look at the stack trace, then rm the *.o file and run it again
<andrewrk> and you won't get a stack trace
<hryx> I think I'll try that out now
reductum has joined #zig
IntoxicatedHippo has joined #zig
<reductum> Is there a way to cast something from type [n]u8 to []u8, where n is some number? I want to return a string literal from a function.
<MajorLag> var my_slice = my_array[s..e]; where s and e are the start and end indexes.
<MajorLag> or var my_slice = my_array[0..]; to slice the entire array
<reductum> Thank you
fsateler has quit [Ping timeout: 250 seconds]
fsateler has joined #zig
suirad has quit [Ping timeout: 256 seconds]
suirad has joined #zig
reductum has quit [Quit: WeeChat 2.3]
Zaab1t has joined #zig
Zaab1t has quit [Remote host closed the connection]
basro has quit [Disconnected by services]
basro_ has joined #zig
basro_ is now known as basro
forgot-password has joined #zig
porky11 has joined #zig
noonien has quit [Quit: Connection closed for inactivity]
IntoxicatedHippo has quit [Remote host closed the connection]
meheleventyone has joined #zig
forgot-password has quit [Ping timeout: 268 seconds]
<sjums> About debugging. How do you debug? What tools do you guys prefer?
lorenzzzo has joined #zig
Hejsil has joined #zig
<Hejsil> sjums, I use gdb with the kdbg UI
<sjums> Gonna be a tough one on windows ;)
<Hejsil> When I use Windows, i used Visual studio
<sjums> I've used visual studio when everything's on fire
<sjums> But it's not the best tool for the job!
<Hejsil> debug.warn is pretty good too
<lorenzzzo> If I want to crosscompile Zig for freestading RISCV, what should I do?
<Hejsil> lorenzzzo, have you seen the --target-arch, --target-environ and --target-os compiler flags?
<Hejsil> I think thats a good starting pount
<Hejsil> point*
<lorenzzzo> Oh ,i did target-arch but forgot the others
Hejsil has quit [Quit: Page closed]
Hejsil has joined #zig
forgot-password has joined #zig
forgot-password has quit [Ping timeout: 240 seconds]
forgot-password has joined #zig
meheleventyone has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<vegecode> /exit
vegecode has quit [Quit: WeeChat 2.2]
Zaab1t has joined #zig
Hejsil has quit [Quit: Page closed]
forgot-password has quit [Quit: Lost terminal]
ofelas has quit [Remote host closed the connection]
porky11 has quit [Ping timeout: 268 seconds]
porky11 has joined #zig
Zaab1t has quit [Ping timeout: 268 seconds]
Zaab1t has joined #zig
wootehfoot has joined #zig
reductum has joined #zig
<sjums> error: expected type '[]u8', found '[]const u8'
<sjums> .logLine = it.rest(),
<sjums> I think I heard something about pointers, but adding an & before it.rest() obv. doesn't work
<andrewrk> sjums, consider the meaning of the error message
<andrewrk> why won't it let you do it?
<andrewrk> what is the error protecting you against?
<sjums> I can modify the .logline, but the rest of the iterator is immutable, so adding a mutable reference to it though .logline would be bollocks
<sjums> (am I right?)
<andrewrk> correct
<andrewrk> perhaps could your logLine field be marked constant?
<sjums> In this case yes. If I wanted the []const u8 to be a []u8, would I then have to allocate a new ArrayList, use std.mem.copy and slice the arraylist ?
<andrewrk> the idea of iterating over a slice of bytes and mutating it at the same time is inherently tricky
<andrewrk> and probably best be done manually rather than with a split iterator API
<andrewrk> I doubt that's what you need to do though
<sjums> If it calms you I come from C#, where it's impossible to modify the collection you are currently looping with a foreach loop.
<sjums> So I'd never even attempt it in Zig :b
<sjums> Though, C# only gives runtime errors for that. I can only expect zig to throw errors at compile time in such a case!
porky11 has quit [Ping timeout: 250 seconds]
<sjums> Can I access struct members from inside the struct?
<sjums> const c = struct{ .a = 123, .b = .a };
<sjums> where c.b would be 123
<andrewrk> no
porky11 has joined #zig
Zaab1t has quit [Quit: bye bye friends]
porky11 has quit [Ping timeout: 268 seconds]
wootehfoot has quit [Read error: Connection reset by peer]
reductum has quit [Quit: WeeChat 2.3]
SimonNa has joined #zig
noonien has joined #zig
<nbjoerg> pff. kernel debugging with a video device. how boring :)
<nbjoerg> back in my days, all we had was a pc speaker and a busy loop...
<andrewrk> nbjoerg, video device? what video device? this is stack traces over serial
<andrewrk> this code doesn't even have a bootloader or a file system, let alone video driver
<nbjoerg> andrewrk: serial console counts as video device :)
* andrewrk rolls eyes :)
<nbjoerg> but it's been a couple of years since I had to do pc speaker debugging
<andrewrk> seems like the first step would be to encode text as sound and decode on another computer
<nbjoerg> I think there was a patch for NetBSD's ddb somewhere to write panic messages via the keyboard leds
<nbjoerg> using morse code
<andrewrk> better than nothing
<nbjoerg> in my case it was debugging acpi wake-up code
<nbjoerg> so the primary concern was "which f**king instruction triggered the triple fault this time"...
<nbjoerg> x86 is so much fun for debugging
<nbjoerg> when I have 6 month of time with nothing to do, I want to try creating a bi-endian arm kernel
<nbjoerg> that is a kernel for arm that can run natively both little and big endian binaries
<bbrittain> we're talking about your post in our offtopic work channel
<bbrittain> some of my coworkers have watched your videos
<bbrittain> we're talking about how you really care about OOMs :P
<andrewrk> bbrittain, in particular, I think that the idea of an OOM killer is an inadequate solution
<andrewrk> it's inherently heuristics based
porky11 has joined #zig
emekoi has joined #zig
<emekoi> if a value is know at compile time (builtin.os) does zig optimize away branching on that value?
mgxm has joined #zig