tech-toolchain archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: -pg problem on -current



On Mon, 8 Nov 2021, Thomas Klausner wrote:

I'm trying to profile https://github.com/nih-at/ckmame/ on NetBSD 9.99.92/amd64.

I do:
pkgin in libzip
git clone https://github.com/nih-at/ckmame.git
cd ckmame
mkdir build
cd build
CFLAGS=-pg CXXFLAGS=-pg cmake ..
make

The build breaks when a binary that is built is run to generate test data.

# gdb src/ckmame
GNU gdb (GDB) 11.0.50.20200914-git
Copyright (C) 2020 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 "x86_64--netbsd".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
   <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from src/ckmame...
(gdb) r
Starting program: /home/wiz/Projects/nih/ckmame/a/ckmame/build/src/ckmame

Program received signal SIGSEGV, Segmentation fault.
0x0000000000495432 in dl_iterate_phdr ()
(gdb) bt
#0  0x0000000000495432 in dl_iterate_phdr ()
#1  0x0000000000496da6 in __libc_static_tls_setup ()
#2  0x0000000000586e47 in _libc_init ()
#3  0x00007f7ff5e02d2d in _rtld_call_function_void (addr=5795328, obj=0x789df0963c00) at /disk/6/archive/foreign/src/libexec/ld.elf_so/rtld.h:514
#4  _rtld_call_initfini_function (mask=0x7f7fff397980, func=5795328, obj=0x789df0963c00) at /disk/6/archive/foreign/src/libexec/ld.elf_so/rtld.c:143
#5  _rtld_call_init_function (cur_objgen=<optimized out>, mask=<optimized out>, obj=<optimized out>)
   at /disk/6/archive/foreign/src/libexec/ld.elf_so/rtld.c:258
#6  _rtld_call_init_function (obj=0x789df0963c00, mask=0x7f7fff397980, cur_objgen=1) at /disk/6/archive/foreign/src/libexec/ld.elf_so/rtld.c:232
#7  0x00007f7ff5e02fee in _rtld_call_init_functions (mask=mask@entry=0x7f7fff397980) at /disk/6/archive/foreign/src/libexec/ld.elf_so/rtld.c:316
#8  0x00007f7ff5e03a21 in _rtld (sp=<optimized out>, relocbase=<optimized out>) at /disk/6/archive/foreign/src/libexec/ld.elf_so/rtld.c:784
#9  0x00007f7ff5e00803 in rtld_start () from /usr/libexec/ld.elf_so
#10 0x0000000000000000 in ?? ()
(gdb)


-pg still works for me on C programs and a minimal "int main()[]" c++
program.  Am I doing something wrong here or is there a bug in the
toolchain?

Perhaps there are better ways to profile programs nowadays, let me
know too.
Thomas


See PR #56031

Profiling needs -static.

-RVP


Home | Main Index | Thread Index | Old Index