How to use gdb

From Netatalk Wiki
Revision as of 20:27, 28 February 2010 by Franklahm (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

You can use gdb to detect where and possibly why an afpd process crashes. The following assumes, that you can login and get the volume list displayed successfully. If afpd crahes before that, things are a little more complicated.

Steps to trace problem:

  1. Connect to the server, login and wait for the volume list to show up, but do not select a volume yet.
  2. Open a console on the server as root and get the process list with ps. Look for an afpd process, where the uid matches the user you just logged in with (test1 in this example).
server:# ps -ef
UID        PID  PPID  C STIME TTY          TIME CMD
...
root      2396     1  0 12:39 ?        00:00:00 /usr/local/sbin/afpd ...
test1     2398  2396  0 12:45 ?        00:00:00 /usr/local/sbin/afpd ...
...

Now fire up gdb and tell it to connect to the afpd process, use the afpd path and pid as shown by ps

server:# gdb /usr/local/sbin/afpd 2398
GNU gdb 5.3
Copyright 2002 Free Software Foundation, Inc.
...
0x40216242 in read () from /lib/libc.so.6
(gdb)
simply type
(gdb) c

...and press enter.

Now go back to your Mac client and open a volume. When the afpd process crashes, you should get something similar to this from gdb

Program received signal SIGSEGV, Segmentation fault.
0x400c56b2 in memmove (dest=0x4016e2e5, src=0x4016e24c, len=515187639)
   at ../sysdeps/generic/memmove.c:98
98      ../sysdeps/generic/memmove.c: No such file or directory.
       in ../sysdeps/generic/memmove.c

Please copy this message and the type

(gdb) bt

... and press enter. This should produce something like this:

(gdb) bt
#0  0x400c56b2 in memmove (dest=0x4016e2e5, src=0x4016e24c, len=515187639)
   at ../sysdeps/generic/memmove.c:98
#1  0x08049c2a in ad_v1tov2 (ad=0xbfffc260, path=0x8054da0 ".AppleDouble/test") at ad_open.c:397
#2  0x0804ac88 in ad_open (path=0x8061853 "14", adflags=2, oflags=2, mode=0, ad=0xbfffc260) at ad_open.c:1089
#3  0x08049466 in descend (dp=0x8061748) at adv1tov2.c:95
#4  0x08049428 in descend (dp=0x8060710) at adv1tov2.c:89
#5  0x08049428 in descend (dp=0x805f6d8) at adv1tov2.c:89
#6  0x08049428 in descend (dp=0x805be88) at adv1tov2.c:89
#7  0x08049428 in descend (dp=0x805ae50) at adv1tov2.c:89
#8  0x08049428 in descend (dp=0x805d030) at adv1tov2.c:89
#9  0x08049428 in descend (dp=0x8059e18) at adv1tov2.c:89
#10 0x08049428 in descend (dp=0x8058de0) at adv1tov2.c:89
#11 0x08049428 in descend (dp=0x8057da8) at adv1tov2.c:89
#12 0x0804958b in main (argc=2, argv=0xbffffb14) at adv1tov2.c:132 #13 0x4005a177 in __libc_start_main (main=0x80494e0 <main>, argc=2,
   ubp_av=0xbffffb14, init=0x8048d40 <_init>, fini=0x804dbe0 <_fini>,
   rtld_fini=0x4000e184 <_dl_fini>, stack_end=0xbffffb0c)
   at ../sysdeps/generic/libc-start.c:129
(gdb)

Copy this as well and mail it to the netatalk-devel mailing list.

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox