tech-kern archive

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

Re: gcc: optimizations, and stack traces



Two things come to mind:

- was this the innermost (newest) frame?  If it wasn't something
earlier could be the problem
- is the dwarf debug info being used, or is it relying on heuristics
(annoyingly I can't spot an easy way to tell)

and when this happens, 'info frame' may help diagnose things.

Looking at:

>
>     void
>     kernfs_get_rrootdev(void)
>     {
>             static int tried = 0;
>
>             if (tried) {
>                     /* Already did it once. */
>                     return;
>             }
>             tried = 1;
>
>             if (rootdev == NODEV)
>                     return;
>             rrootdev = devsw_blk2chr(rootdev);
>             if (rrootdev != NODEV)
>                     return;
>             rrootdev = NODEV;
>             printf("kernfs_get_rrootdev: no raw root device\n");
>     }

I get:

000000000000043c <kernfs_get_rrootdev>:
 43c:   8b 05 00 00 00 00       mov    0x0(%rip),%eax        # 442
<kernfs_get_rrootdev+0x6>
 442:   85 c0                   test   %eax,%eax
 444:   75 2e                   jne    474 <kernfs_get_rrootdev+0x38>
 446:   c7 05 00 00 00 00 01    movl   $0x1,0x0(%rip)        # 450
<kernfs_get_rrootdev+0x14>
 44d:   00 00 00
 450:   48 8b 3d 00 00 00 00    mov    0x0(%rip),%rdi        # 457
<kernfs_get_rrootdev+0x1b>
 457:   48 83 ff ff             cmp    $0xffffffffffffffff,%rdi
 45b:   74 17                   je     474 <kernfs_get_rrootdev+0x38>
 45d:   55                      push   %rbp
 45e:   48 89 e5                mov    %rsp,%rbp
 ...

and has CFI (readelf --debug-dump=frames-interp
amd64/sys/arch/amd64/compile/GENERIC/kernfs_vfsops.o):

000001a4 0000000000000028 000001a8 FDE cie=00000000
pc=000000000000043c..0000000000000484
   LOC           CFA      rbp   ra
000000000000043c rsp+8    u     c-8
000000000000045e rsp+16   c-16  c-8
...

so, until the push, the CFI has't specified RBP, but a reasonable
interpretation s current value.  So this, to me looks ok.


Home | Main Index | Thread Index | Old Index