Im having an issue with uninitialized memory. I am making a trie and they all have a parent node. As far as I can tell, all memory should be initalized. But when I traverse the nodes backwards (from any node except root towards root) I get a
*main.Trie@aaaaaaaaaaaaaaaa, , 12297829382473034410, false
General protection exception (no address available)
/home/segfault-enjoyer/hangman-solver/src/main.zig:162:27: 0x103cb9e in next (hangman-solver)
while (current.parent) |parent| : (current = parent) {
^
/home/segfault-enjoyer/hangman-solver/src/main.zig:65:23: 0x103df67 in main (hangman-solver)
while (try it.next(allocator)) |word| {
^
/home/segfault-enjoyer/.bin/lib/std/start.zig:524:37: 0x1039141 in posixCallMainAndExit (hangman-solver)
const result = root.main() catch |err| {
^
/home/segfault-enjoyer/.bin/lib/std/start.zig:266:5: 0x1038c81 in _start (hangman-solver)
asm volatile (switch (native_arch) {
^
???:?:?: 0x0 in ??? (???)
run
The Line above the general protection exception being the broken node.
Now I want to find out where this node has been allocated, is there a way to do this via the allocators api? Or is there some other idea of how to find the issue, I have never used a debugger before but id be willing to try gdb.
segfault-enjoyer/hangman-solver: Basically a follow-up to my older hangman-cheat. The goal is to play around with trees and tries - Codeberg.org This is the repository. WATCH OUT: theres an @breakpoint
in there, dont be surprised if it just stops if its removed