I tracked into the program and found the segmentation fault happened at:

in pfmon.c
pfmon_initialize()->pfm_get_max_event_name_len(&len)

then it jumped into pfmlib_common.c

pfm_get_max_event_name_len (len=0xbffd9460) at pfmlib_common.c:907
907        if (PFMLIB_INITIALIZED() == 0)
(gdb) n
909        if (len == NULL)
(gdb) n
912        for(i=0; i < pfm_current->pme_count; i++) {
(gdb) n
913            str = pfm_current->get_event_name(i);
(gdb) n
914            if (!str)
(gdb) n
916            l = strlen(str);
(gdb) n

Program received signal SIGSEGV, Segmentation fault.
0xb7ef5613 in strlen () from /lib/tls/i686/cmov/libc.so.6

Here is the backtrace:

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xb7e7a8d0 (LWP 5257)]
0xb7ef2613 in strlen () from /lib/tls/i686/cmov/libc.so.6
(gdb) backtrace
#0  0xb7ef2613 in strlen () from /lib/tls/i686/cmov/libc.so.6
#1  0xb7fed411 in pfm_get_max_event_name_len (len=0xbf8d5d60)
    at pfmlib_common.c:916
#2  0x0804dd45 in pfmon_initialize (argv=0xbf8d5e64) at pfmon.c:1469
#3  0x0804eadf in main (argc=1, argv=0xbf8d5e64) at pfmon.c:1900
(gdb)

On Thu, Sep 24, 2009 at 3:25 AM, stephane eranian <eranian@googlemail.com> wrote:
What does ldd pfmon say?


On Thu, Sep 24, 2009 at 9:01 AM, Qingyuan Deng <ddqqyy@gmail.com> wrote:
> Hello,
>
> I patched the kernel and installed both libpfm and perfmon, however I got
> segmentation fault while I tried running command: "pfmon --help'. Could
> anyone help me to figure it out please?
>
> I am running Ubuntu 9.04 on kernel 2.6.29. I downloaded the latest version
> of libpfm, perfmon, and the base system patch from the sourceforge page. My
> processor is Intel core i7 920 and I adjusted related configuration when I
> configured the kernel.  Following is the debug message from gdb:
>
>
> qdeng@qdeng-desktop:~/pmu/perfmon2/pfmon-3.9$ sudo make install
> [sudo] password for qdeng:
> make[1]: Entering directory `/home/qdeng/pmu/perfmon2/pfmon-3.9/pfmon'
> make[2]: Entering directory
> `/home/qdeng/pmu/perfmon2/pfmon-3.9/pfmon/smpl_mod'
> make[2]: Nothing to be done for `all'.
> make[2]: Leaving directory
> `/home/qdeng/pmu/perfmon2/pfmon-3.9/pfmon/smpl_mod'
> cc -o pfmon pfmon.o pfmon_smpl.o pfmon_util.o pfmon_system.o pfmon_task.o
> pfmon_symbols.o pfmon_results.o pfmon_hash.o pfmon_smpl_dfl.o pfmon_os.o
> pfmon_os_v2x.o pfmon_util_x86.o pfmon_i386_p6.o pfmon_gen_ia32.o
> pfmon_amd64.o pfmon_core.o pfmon_intel_atom.o pfmon_intel_nhm.o
> pfmon_pentium4.o  -g -ggdb -Wall -Werror -D_REENTRANT -I/usr/local/include
> -DCONFIG_PFMON_I386 -DPFMON_DEBUG -DDATADIR=\"/usr/local/share/pfmon\" -I.
> -I/usr/include/libelf -D_GNU_SOURCE -DPFMON_DEBUG -g  smpl_mod/libsmplfmt.a
> -lpthread -lm -lrt -Wl,-Bstatic -lelf -Wl,-Bdynamic -L/usr/local/lib -lpfm
> mkdir -p /usr/local/bin
> install -m 755 pfmon /usr/local/bin/pfmon
> ln -sf /usr/local/bin/pfmon /usr/local/bin/pfmon_gen
> make[1]: Leaving directory `/home/qdeng/pmu/perfmon2/pfmon-3.9/pfmon'
> make[1]: Entering directory `/home/qdeng/pmu/perfmon2/pfmon-3.9/tests'
> mkdir -p /usr/local/bin
> install -m 755 pfdbg /usr/local/bin/pfdbg
> make[1]: Leaving directory `/home/qdeng/pmu/perfmon2/pfmon-3.9/tests'
> make[1]: Entering directory `/home/qdeng/pmu/perfmon2/pfmon-3.9/docs'
> mkdir -p /usr/local/share/man/man1
> install -m 644 pfmon.1 /usr/local/share/man/man1
> make[1]: Leaving directory `/home/qdeng/pmu/perfmon2/pfmon-3.9/docs'
> qdeng@qdeng-desktop:~/pmu/perfmon2/pfmon-3.9$ pfmon --help
> Segmentation fault
> qdeng@qdeng-desktop:~/pmu/perfmon2/pfmon-3.9$ gdb pfmon
> GNU gdb 6.8-debian
> Copyright (C) 2008 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"...
> (gdb) run --help
> Starting program: /usr/local/bin/pfmon --help
> [Thread debugging using libthread_db enabled]
> [New Thread 0xb7e598d0 (LWP 4437)]
>
> Program received signal SIGSEGV, Segmentation fault.
> [Switching to Thread 0xb7e598d0 (LWP 4437)]
> 0xb7ed1613 in strlen () from /lib/tls/i686/cmov/libc.so.6
> (gdb)
>
> Thanks!
> Qingyuan
>
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart your
> developing skills, take BlackBerry mobile applications to market and stay
> ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
> http://p.sf.net/sfu/devconf
> _______________________________________________
> perfmon2-devel mailing list
> perfmon2-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/perfmon2-devel
>
>