On Tue, Mar 21, 2023 at 1:28 PM Sergey Bugaev <buga...@gmail.com> wrote: > > On Tue, Mar 21, 2023 at 12:48 PM Luca <l...@orpolo.org> wrote: > > Great! if you still have issues with the long mode, you could try to > > hack gnumach to wait at some point (e.g. user_bootstrap() or > > setup_main()), attach with gdb and then continue. Either with some delay > > or polling a flag that you flip from gdb once attached. In this way you > > should be able to set a breakpoint in userspace. > > OK, but how do I actually get the task to start / run? :D > I can't debug it if it's not run...
OK, I was able to attach GDB prior to bootscript parsing thanks to your suggestion (volatile flag that I flip from gdb). It seems to parse the bootscript correctly. It starts the initial thread, which loads the ELF and then hangs right here (on printf???): (gdb) s 83 if (ph->p_flags & PF_R) type |= EXEC_SECTYPE_READ; (gdb) bt #0 exec_load (read=read@entry=0xffffffff8104a5a0 <boot_read>, read_exec=read_exec@entry=0xffffffff8104a650 <read_exec>, handle=0xffffffffbf11bf20, out_info=out_info@entry=0xffffffffbf112f78) at ../kern/elf-load.c:83 #1 0xffffffff8104ad5e in user_bootstrap () at ../kern/bootstrap.c:810 #2 0x0000000000000000 in ?? () (gdb) finish Run till exit from #0 exec_load (read=read@entry=0xffffffff8104a5a0 <boot_read>, read_exec=read_exec@entry=0xffffffff8104a650 <read_exec>, handle=0xffffffffbf11bf20, out_info=out_info@entry=0xffffffffbf112f78) at ../kern/elf-load.c:83 user_bootstrap () at ../kern/bootstrap.c:811 811 if (err) Value returned is $61 = 0 (gdb) s 815 printf ("task loaded:"); (gdb) n Does that ring any bells? Sergey