ZFS vs Samba Debugging Results ... Need Help.

Pascal Hofstee caelian at gmail.com
Tue Jul 3 20:59:24 UTC 2007


On 7/3/07, Pascal Hofstee <caelian at gmail.com> wrote:
> I include the function implementation in question for convenience here:
>
> char *vfs_readdirname(connection_struct *conn, void *p)
> {
>         SMB_STRUCT_DIRENT *ptr= NULL;
>         char *dname;
>
>         if (!p)
>                 return(NULL);
>
>         ptr = SMB_VFS_READDIR(conn, (DIR *)p);
>         if (!ptr)
>                 return(NULL);
>
>         dname = ptr->d_name;
>
> #ifdef NEXT2
>         if (telldir(p) < 0)
>                 return(NULL);
> #endif
>
> #ifdef HAVE_BROKEN_READDIR_NAME
>         /* using /usr/ucb/cc is BAD */
>         dname = dname - 2;
> #endif
>
>         return(dname);
> }

I hate following up on my own posts especially several minutes after
the original.
I just realised that i overlooked one detail in my original debugging
session which entirely explains what's happening ...

Below is a walk-through of my debugging session:

Breakpoint 1, vfs_readdirname (conn=0x20a25030, p=0x20a0e000) at smbd/vfs.c:628
628             if (!p)
(gdb) next
631             ptr = SMB_VFS_READDIR(conn, (DIR *)p);
(gdb)
632             if (!ptr)
(gdb) print ptr
$3 = (struct dirent *) 0x20a0e014
(gdb) print dname
$4 = 0x20a0e014 "\003"
(gdb) next
647             return(dname);


It looks like somehow gcc optimized out the actual assignment of dname !

With kind regards,
-- 
  Pascal Hofstee


More information about the freebsd-current mailing list