Re: [ecasound] Re: report after compile.

New Message Reply About this list Date view Thread view Subject view Author view Other groups

Subject: Re: [ecasound] Re: report after compile.
From: raoul.megelas (raoul.megelas_AT_libertysurf.fr)
Date: Mon Jun 17 2002 - 12:24:36 EEST


On Sun, Jun 16, 2002 at 09:45:49PM +0300, you wrote:
> On Thu, 13 Jun 2002, raoul.megelas wrote:
>
> > ... segmentation fault, core dump.

> Could you issue the 'bt' command in gdb (to get the backtrace) and
> the send the output to me? From that I can see the call tree before
> reaching strncmp().

GNU gdb 4.18
(no debugging symbols found)...
Core was generated by `ecasound'.
Program terminated with signal 11, Segmentation fault.
Reading symbols from /usr/lib/libncurses.so.5...(no debugging symbols found)...
done.
Reading symbols from /usr/local/lib/libecasound.so.7...
(no debugging symbols found)...done.
Reading symbols from /usr/local/lib/libkvutils.so.2...
(no debugging symbols found)...done.
Reading symbols from /usr/lib/libhistory.so.4...(no debugging symbols found)...
done.
Reading symbols from /usr/lib/libreadline.so.4...
(no debugging symbols found)...done.
Reading symbols from /usr/lib/compat/libdl.so.2...done.
Reading symbols from /usr/lib/libstdc++.so.3...done.
Reading symbols from /usr/lib/libm.so.2...done.
Reading symbols from /usr/lib/libc_r.so.4...done.
Reading symbols from /usr/lib/libc.so.6...done.
Reading symbols from /usr/lib/ld-linux.so.2...done.
Reading symbols from /usr/libexec/ld-elf.so.1...done.
#0 0x283739d3 in strncmp () from /usr/lib/libc_r.so.4
(gdb)
(gdb) bt
#0 0x283739d3 in strncmp () from /usr/lib/libc_r.so.4
#1 0x284ac48c in __DTOR_END__ () from /usr/lib/libc.so.6
#2 0x283d5ffa in _init (arg=0x280667ac)
    at ../sysdeps/unix/sysv/linux/init-first.c:87
#3 0x28057a57 in find_symdef () from /usr/libexec/ld-elf.so.1
#4 0x28056910 in _rtld () from /usr/libexec/ld-elf.so.1
(gdb)

        this happen on a box even with v2.04 from the port collection from
anarcat (which compiles quite well);
on another box, the cvs version produce the same behaviour and v2.04 no.

========================================

> Hmm, could you send the FBSD atomic.h file to me so I can have a look at
> it. It might have a completely different API than the Linux version. Even
> on Linux, use of 'asm/atomic.h' is not recommended, but it's the easiest
> way of getting atomic locking primivites for various platforms that Linux
> runs on. But as it isn't guaranteed to work, ecasound provides a
> pthread-based fallback.

No problem, but I take it in the source tree, because as you can see
there is two versions: one for alpha and one for i386.

Thanks for all your help.
        raoul
        raoul.megelas_AT_libertysurf.fr

========================================
src/sys/alpha/include/atomic.h
========================================

/*-
 * Copyright (c) 1998 Doug Rabson
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 * notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 * notice, this list of conditions and the following disclaimer in the
 * documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 *
 * $FreeBSD: src/sys/alpha/include/atomic.h,v 1.2 1999/08/28 00:38:40 peter Exp $
 */

#ifndef _MACHINE_ATOMIC_H_
#define _MACHINE_ATOMIC_H_

/*
 * Various simple arithmetic on memory which is atomic in the presence
 * of interrupts and SMP safe.
 */

void atomic_set_8(u_int8_t *, u_int8_t);
void atomic_clear_8(u_int8_t *, u_int8_t);
void atomic_add_8(u_int8_t *, u_int8_t);
void atomic_subtract_8(u_int8_t *, u_int8_t);

void atomic_set_16(u_int16_t *, u_int16_t);
void atomic_clear_16(u_int16_t *, u_int16_t);
void atomic_add_16(u_int16_t *, u_int16_t);
void atomic_subtract_16(u_int16_t *, u_int16_t);

void atomic_set_32(u_int32_t *, u_int32_t);
void atomic_clear_32(u_int32_t *, u_int32_t);
void atomic_add_32(u_int32_t *, u_int32_t);
void atomic_subtract_32(u_int32_t *, u_int32_t);

void atomic_set_64(u_int64_t *, u_int64_t);
void atomic_clear_64(u_int64_t *, u_int64_t);
void atomic_add_64(u_int64_t *, u_int64_t);
void atomic_subtract_64(u_int64_t *, u_int64_t);

#define atomic_set_char atomic_set_8
#define atomic_clear_char atomic_clear_8
#define atomic_add_char atomic_add_8
#define atomic_subtract_char atomic_subtract_8

#define atomic_set_short atomic_set_16
#define atomic_clear_short atomic_clear_16
#define atomic_add_short atomic_add_16
#define atomic_subtract_short atomic_subtract_16

#define atomic_set_int atomic_set_32
#define atomic_clear_int atomic_clear_32
#define atomic_add_int atomic_add_32
#define atomic_subtract_int atomic_subtract_32

#define atomic_set_long atomic_set_64
#define atomic_clear_long atomic_clear_64
#define atomic_add_long atomic_add_64
#define atomic_subtract_long atomic_subtract_64

#endif /* ! _MACHINE_ATOMIC_H_ */
========================================
src/sys/i386/include/atomic.h

/*-
 * Copyright (c) 1998 Doug Rabson
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 * notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 * notice, this list of conditions and the following disclaimer in the
 * documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 *
 * $FreeBSD: src/sys/i386/include/atomic.h,v 1.9.2.1 2000/07/07 00:38:47 obrien Exp $
 */
#ifndef _MACHINE_ATOMIC_H_
#define _MACHINE_ATOMIC_H_

/*
 * Various simple arithmetic on memory which is atomic in the presence
 * of interrupts and multiple processors.
 *
 * atomic_set_char(P, V) (*(u_char*)(P) |= (V))
 * atomic_clear_char(P, V) (*(u_char*)(P) &= ~(V))
 * atomic_add_char(P, V) (*(u_char*)(P) += (V))
 * atomic_subtract_char(P, V) (*(u_char*)(P) -= (V))
 *
 * atomic_set_short(P, V) (*(u_short*)(P) |= (V))
 * atomic_clear_short(P, V) (*(u_short*)(P) &= ~(V))
 * atomic_add_short(P, V) (*(u_short*)(P) += (V))
 * atomic_subtract_short(P, V) (*(u_short*)(P) -= (V))
 *
 * atomic_set_int(P, V) (*(u_int*)(P) |= (V))
 * atomic_clear_int(P, V) (*(u_int*)(P) &= ~(V))
 * atomic_add_int(P, V) (*(u_int*)(P) += (V))
 * atomic_subtract_int(P, V) (*(u_int*)(P) -= (V))
 *
 * atomic_set_long(P, V) (*(u_long*)(P) |= (V))
 * atomic_clear_long(P, V) (*(u_long*)(P) &= ~(V))
 * atomic_add_long(P, V) (*(u_long*)(P) += (V))
 * atomic_subtract_long(P, V) (*(u_long*)(P) -= (V))
 */

/*
 * The above functions are expanded inline in the statically-linked
 * kernel. Lock prefixes are generated if an SMP kernel is being
 * built.
 *
 * Kernel modules call real functions which are built into the kernel.
 * This allows kernel modules to be portable between UP and SMP systems.
 */
#if defined(KLD_MODULE)
#define ATOMIC_ASM(NAME, TYPE, OP, V) \
        extern void atomic_##NAME##_##TYPE(volatile u_##TYPE *p, u_##TYPE v);

#else /* !KLD_MODULE */
#if defined(SMP)
#define MPLOCKED "lock ; "
#else
#define MPLOCKED
#endif

/*
 * The assembly is volatilized to demark potential before-and-after side
 * effects if an interrupt or SMP collision were to occur.
 */
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 9)
/* egcs 1.1.2+ version */
#define ATOMIC_ASM(NAME, TYPE, OP, V) \
static __inline void \
atomic_##NAME##_##TYPE(volatile u_##TYPE *p, u_##TYPE v)\
{ \
        __asm __volatile(MPLOCKED OP \
                         : "=m" (*p) \
                         : "0" (*p), "ir" (V)); \
}

#else
/* gcc <= 2.8 version */
#define ATOMIC_ASM(NAME, TYPE, OP, V) \
static __inline void \
atomic_##NAME##_##TYPE(volatile u_##TYPE *p, u_##TYPE v)\
{ \
        __asm __volatile(MPLOCKED OP \
                         : "=m" (*p) \
                         : "ir" (V)); \
}
#endif
#endif /* KLD_MODULE */

#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 9)

/* egcs 1.1.2+ version */
ATOMIC_ASM(set, char, "orb %b2,%0", v)
ATOMIC_ASM(clear, char, "andb %b2,%0", ~v)
ATOMIC_ASM(add, char, "addb %b2,%0", v)
ATOMIC_ASM(subtract, char, "subb %b2,%0", v)

ATOMIC_ASM(set, short, "orw %w2,%0", v)
ATOMIC_ASM(clear, short, "andw %w2,%0", ~v)
ATOMIC_ASM(add, short, "addw %w2,%0", v)
ATOMIC_ASM(subtract, short, "subw %w2,%0", v)

ATOMIC_ASM(set, int, "orl %2,%0", v)
ATOMIC_ASM(clear, int, "andl %2,%0", ~v)
ATOMIC_ASM(add, int, "addl %2,%0", v)
ATOMIC_ASM(subtract, int, "subl %2,%0", v)

ATOMIC_ASM(set, long, "orl %2,%0", v)
ATOMIC_ASM(clear, long, "andl %2,%0", ~v)
ATOMIC_ASM(add, long, "addl %2,%0", v)
ATOMIC_ASM(subtract, long, "subl %2,%0", v)

#else

/* gcc <= 2.8 version */
ATOMIC_ASM(set, char, "orb %1,%0", v)
ATOMIC_ASM(clear, char, "andb %1,%0", ~v)
ATOMIC_ASM(add, char, "addb %1,%0", v)
ATOMIC_ASM(subtract, char, "subb %1,%0", v)

ATOMIC_ASM(set, short, "orw %1,%0", v)
ATOMIC_ASM(clear, short, "andw %1,%0", ~v)
ATOMIC_ASM(add, short, "addw %1,%0", v)
ATOMIC_ASM(subtract, short, "subw %1,%0", v)

ATOMIC_ASM(set, int, "orl %1,%0", v)
ATOMIC_ASM(clear, int, "andl %1,%0", ~v)
ATOMIC_ASM(add, int, "addl %1,%0", v)
ATOMIC_ASM(subtract, int, "subl %1,%0", v)

ATOMIC_ASM(set, long, "orl %1,%0", v)
ATOMIC_ASM(clear, long, "andl %1,%0", ~v)
ATOMIC_ASM(add, long, "addl %1,%0", v)
ATOMIC_ASM(subtract, long, "subl %1,%0", v)

#endif

#endif /* ! _MACHINE_ATOMIC_H_ */

--
To unsubscribe send message 'unsubscribe' in the body of the
message to <ecasound-list-request_AT_wakkanet.fi>.


New Message Reply About this list Date view Thread view Subject view Author view Other groups

This archive was generated by hypermail 2b28 : Mon Jun 17 2002 - 12:27:15 EEST