Re: how to install profiling libs? (2)

2010-05-28 Thread Sascha Wildner

Am 28.05.2010 00:09, schrieb Damian Weber:



On Thu, 27 May 2010, Sascha Wildner wrote:


Date: Thu, 27 May 2010 22:55:02 +0200
From: Sascha Wildners...@online.de
To: users@crater.dragonflybsd.org
Newsgroups: dragonfly.users
Subject: Re: how to install profiling libs? (2)

Am 27.05.2010 22:30, schrieb Damian Weber:

How to install libm_p.a?


Not that this is particularly helpful, but profiled libs (afaik) are in
/usr/lib/profile and it would be /usr/lib/profile/libm.a in this case.


I tried it and set a link to the library.

$ ls -l /usr/lib/libm_p.a
lrwxr-xr-x  1 root  wheel  23 May 27 23:48 /usr/lib/libm_p.a@ -  
/usr/lib/profile/libm.a

Compile now ok, but weird result, argv=0x0 ?!


Damian,

it's because of the optimization, see 
http://leaf.dragonflybsd.org/mailarchive/kernel/2010-04/msg00023.html.


Maybe Venkatesh found out more in the meantime and can chime in.

One would have to find out how to prevent optimization from setting 
argc/argv to 0. In the meantime you could set CFLAGS to -O0 -pipe (the 
default is -O -pipe) and recompile/-install libc.


Sascha

--
http://yoyodyne.ath.cx


Re: how to install profiling libs? (2)

2010-05-28 Thread Sascha Wildner

Am 28.05.2010 10:48, schrieb Sascha Wildner:

One would have to find out how to prevent optimization from setting
argc/argv to 0. In the meantime you could set CFLAGS to -O0 -pipe (the
default is -O -pipe) and recompile/-install libc.


Oops, I meant lib/csu there.

Sascha

--
http://yoyodyne.ath.cx


Re: how to install profiling libs? (2)

2010-05-27 Thread Sascha Wildner

Am 27.05.2010 22:30, schrieb Damian Weber:

How to install libm_p.a?


Not that this is particularly helpful, but profiled libs (afaik) are in 
/usr/lib/profile and it would be /usr/lib/profile/libm.a in this case.


Sascha

--
http://yoyodyne.ath.cx


Re: how to install profiling libs? (2)

2010-05-27 Thread Damian Weber


On Thu, 27 May 2010, Sascha Wildner wrote:

 Date: Thu, 27 May 2010 22:55:02 +0200
 From: Sascha Wildner s...@online.de
 To: users@crater.dragonflybsd.org
 Newsgroups: dragonfly.users
 Subject: Re: how to install profiling libs? (2)
 
 Am 27.05.2010 22:30, schrieb Damian Weber:
  How to install libm_p.a?
 
 Not that this is particularly helpful, but profiled libs (afaik) are in
 /usr/lib/profile and it would be /usr/lib/profile/libm.a in this case.

I tried it and set a link to the library.

$ ls -l /usr/lib/libm_p.a
lrwxr-xr-x  1 root  wheel  23 May 27 23:48 /usr/lib/libm_p.a@ - 
/usr/lib/profile/libm.a

Compile now ok, but weird result, argv=0x0 ?!
Modified source to access argv[0]:

$ cat test.c
#include stdio.h

int main(int argc, char **argv)
{
puts(argv[0]);
return 0;
}


$ g++ -g -pg -o test test.c
$ ./test
Segmentation fault: 11 (core dumped)
$ gdb test test.core
GNU gdb (GDB) 7.0
Copyright (C) 2009 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 i386-dragonfly.
For bug reporting instructions, please see:
http://bugs.dragonflybsd.org/...
Reading symbols from /home/dweber/src-DragonFly-i386/misc/test...done.
Reading symbols from /usr/lib/gcc41/libstdc++.so.9...(no debugging symbols 
found)...done.
Loaded symbols for /usr/lib/gcc41/libstdc++.so.9
Reading symbols from /usr/lib/libc.so.7...(no debugging symbols found)...done.
Loaded symbols for /usr/lib/libc.so.7
Reading symbols from /usr/lib/libm.so.3...(no debugging symbols found)...done.
Loaded symbols for /usr/lib/libm.so.3
Reading symbols from /usr/libexec/ld-elf.so.2...(no debugging symbols 
found)...done.
Loaded symbols for /usr/libexec/ld-elf.so.2
Core was generated by `test'.
Program terminated with signal 11, Segmentation fault.
#0  0x08048951 in main (argc=0, argv=0x0) at test.c:5
5   puts(argv[0]);

Maybe that was the wrong way to use the profiled version of the libs.

-- Damian