Am Mittwoch, den 04.07.2012, 11:21 +0200 schrieb Gergely Nagy:
> Paul Menzel writes:
> 
> > Especially since I failed to build the package `klogd` with debugging 
> > symbols.
> >
> >         $ debcheckout klogd
> >         $ apt-get source klogd
> >         $ cd sysklogd-1.5/
> >         $ less debian/rules
> >         $ export DEB_BUILD_OPTIONS="debug"
> >         $ dpkg-buildpackage -us -uc -B
> >         $ sudo dpkg -i ../klogd_1.5-6.2_i386.deb
> 
> You want DEB_BUILD_OPTIONS="nostrip", see policy[1].

Thanks. It still failed for me though. I executed the following
commands.

        $ apt-get source klogd
        $ cd sysklogd-1.5/
        $ export DEB_BUILD_OPTIONS="nostrip"
        $ dpkg-buildpackage -us -uc -B
        $ sudo dpkg -i ../klogd_1.5-6.2_i386.deb 
        $ sudo dpkg -i ../sysklogd_1.5-6.2_i386.deb

GDB still says it cannot find any symbols.

        $ sudo gdb --pid 14869
        GNU gdb (GDB) 7.4.1-debian
        Copyright (C) 2012 Free Software Foundation, Inc.
        License GPLv3+: GNU GPL version 3 or later 
<http://gnu.org/licenses/gpl.html>
        This is free software: you are free to change and redistribute it.
        There is NO WARRANTY, to the extent permitted by law.  Type "show 
copying"
        and "show warranty" for details.
        This GDB was configured as "i486-linux-gnu".
        For bug reporting instructions, please see:
        <http://www.gnu.org/software/gdb/bugs/>.
        Attaching to process 14869
        Reading symbols from /sbin/klogd...(no debugging symbols found)...done.
        Reading symbols from /lib/i386-linux-gnu/i686/cmov/libc.so.6...Reading 
symbols from /usr/lib/debug/lib/i386-linux-gnu/i686/cmov/libc-2.13.so...done.
        done.
        Loaded symbols for /lib/i386-linux-gnu/i686/cmov/libc.so.6
        Reading symbols from /lib/ld-linux.so.2...(no debugging symbols 
found)...done.
        Loaded symbols for /lib/ld-linux.so.2
        0xffffe424 in __kernel_vsyscall ()
        (gdb) t a a bt full
        
        Thread 1 (process 14869):
        #0  0xffffe424 in __kernel_vsyscall ()
        No symbol table info available.
        #1  0xb76a1f53 in __read_nocancel () at 
../sysdeps/unix/syscall-template.S:82
        No locals.
        #2  0x0804a494 in LogProcLine ()
        No symbol table info available.
        #3  0x080496a5 in main ()
        No symbol table info available.

Although something must have worked since it knows about `LogProcLine`
now. Oh, so this is due to optimized out symbols by using `-O2` for the
compiler. So both `nostrip` and `debug` are needed.

        $ export DEB_BUILD_OPTIONS="nostrip debug"
        $ dpkg-buildpackage -us -uc -B
        $ sudo dpkg -i ../klogd_1.5-6.2_i386.deb ../sysklogd_1.5-6.2_i386.deb
        $ sudo gdb --pid 19173
        GNU gdb (GDB) 7.4.1-debian
        Copyright (C) 2012 Free Software Foundation, Inc.
        License GPLv3+: GNU GPL version 3 or later 
<http://gnu.org/licenses/gpl.html>
        This is free software: you are free to change and redistribute it.
        There is NO WARRANTY, to the extent permitted by law.  Type "show 
copying"
        and "show warranty" for details.
        This GDB was configured as "i486-linux-gnu".
        For bug reporting instructions, please see:
        <http://www.gnu.org/software/gdb/bugs/>.
        Attaching to process 19173
        Reading symbols from /sbin/klogd...done.
        Reading symbols from /lib/i386-linux-gnu/i686/cmov/libc.so.6...Reading 
symbols from /usr/lib/debug/lib/i386-linux-gnu/i686/cmov/libc-2.13.so...done.
        done.
        Loaded symbols for /lib/i386-linux-gnu/i686/cmov/libc.so.6
        Reading symbols from /lib/ld-linux.so.2...(no debugging symbols 
found)...done.
        Loaded symbols for /lib/ld-linux.so.2
        0xffffe424 in __kernel_vsyscall ()
        (gdb) t a a bt full
        
        Thread 1 (process 19173):
        #0  0xffffe424 in __kernel_vsyscall ()
        No symbol table info available.
        #1  0xb7679f53 in __read_nocancel () at 
../sysdeps/unix/syscall-template.S:82
        No locals.
        #2  0x0804a494 in LogProcLine () at klogd.c:988
                rdcnt = <optimized out>
        #3  0x080496a5 in main (argc=3, argv=0xbfc8dc74) at klogd.c:1219
                ch = 65
                use_output = 0
                log_level = <optimized out>
                output = 0x0
                ppid = 19172

Now it works. A package would be easier though for users like me. ;-)


Thanks,

Paul


>  [1]: 
> http://www.debian.org/doc/debian-policy/ch-source.html#s-debianrules-options

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to