bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Some progress, Guix rumpdisk still crashes...


From: Sergey Bugaev
Subject: Re: Some progress, Guix rumpdisk still crashes...
Date: Thu, 18 May 2023 00:15:43 +0300

On Wed, May 17, 2023 at 9:25 PM Janneke Nieuwenhuizen <janneke@gnu.org> wrote:
> Hi!

Hi,

> Here are the
> last 24 (WTF, 1980 wants their screensize back!?) lines (I don't know
> how to get the full log from QEMU):
>
> --8<---------------cut here---------------start------------->8---
> --8<---------------cut here---------------end--------------->8---
>
> Again, any help or insights higly appreciated!

I've recently been doing this kind of debugging early boot-up process
*a lot*, so maybe I could provide some tips indeed. For getting more
lines of output, try console=com0 on gnumach cmdline, and run qemu
with -nographic -serial stdio or something like that.

Other than that, just attach gdb and see what it crashes on? Like this:

$ gdb /path/to/gnumach
(gdb) tar rem :1234
(gdb) b i386_exception
(gdb) b task_terminate
(gdb) b Panic
(gdb) add-symbol-file /path/to/rumpdisk.static
blah-blah (y/n?) y
(gdb) c

This is *so much* easier to do with statically linked non-PIE binaries
loaded by gnumach/GRUB at startup compared to hunting for shared
library .text addresses and single-stepping through code pages getting
paged in upon first access (can't place a breakpoint before the page
gets paged in!), so enjoy it while it lasts :)

If you do hit i386_exception, you can look at
active_threads[0]->task->name to understand what task it is (though
it's likely to be just the rumpdisk in your case). If you step up
several frames (perhaps just one), you'll find a 'regs' argument being
passed to a function; from there you can extract the faulting %eip,
and then can disas around it to see what it is (again, much easier
with symbols!).

The trick I like to use is I, upon hitting an exception, re-set all
the registers to the values described by 'regs', just like this:

(gdb) set $rsp = $2.uesp
(gdb) set $rip = $2.eip
...and so on

(don't forget to switch back to the topmost frame first, with 'down'
or 'select-frame') and that basically rewinds time to when the fault
has happened, and from there you can see the userland backtrace and
inspect the full state at the time of the fault.

Sergey



reply via email to

[Prev in Thread] Current Thread [Next in Thread]