From owner-freebsd-questions@freebsd.org Mon May 30 07:39:47 2016 Return-Path: Delivered-To: freebsd-questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A0A08B54DB8 for ; Mon, 30 May 2016 07:39:47 +0000 (UTC) (envelope-from ml@netfence.it) Received: from smtp205.alice.it (smtp205.alice.it [82.57.200.101]) by mx1.freebsd.org (Postfix) with ESMTP id 38531175D for ; Mon, 30 May 2016 07:39:46 +0000 (UTC) (envelope-from ml@netfence.it) Received: from soth.ventu (79.42.58.185) by smtp205.alice.it (8.6.060.28) (authenticated as acanedi@alice.it) id 572625A0087E5A3A for freebsd-questions@freebsd.org; Mon, 30 May 2016 09:39:34 +0200 Received: from alamar.ventu (alamar.local.netfence.it [10.1.2.18] (may be forged)) by soth.ventu (8.15.2/8.15.2) with ESMTP id u4U7dUsR073216 for ; Mon, 30 May 2016 09:39:32 +0200 (CEST) (envelope-from ml@netfence.it) X-Authentication-Warning: soth.ventu: Host alamar.local.netfence.it [10.1.2.18] (may be forged) claimed to be alamar.ventu From: Andrea Venturoli Subject: Some developer's questions To: "freebsd-questions@freebsd.org" Message-ID: Date: Mon, 30 May 2016 09:39:30 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD i386; rv:45.0) Gecko/20100101 Thunderbird/45.1.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 May 2016 07:39:47 -0000 Hello. I've been moving some of my boxes from 9.3 to 10.3: I'll have to upgrade them all by end of the year, since 9.3 will be unsupported by then. I'm a developer and I'm trying to understand how to cope with the shift from GCC to LLVM/CLang. The compiler itself is fine: I even tend to say I like it (possibly also because our GCC was quite obsolete). However, I still have some issues and I'd appreciate any suggestion or statement about the following. DEBUGGING If I understand correctly, LLVM has its own debugger, LLDB, but I find no such thing in our OS. Is it the official position that we should use GDB and that it's fully supported? While I'd like the answer to be positive (mainly because I would not need to learn a new synthax), there are some issues: _ since a long time I find base's GDB practically useless (due to crashes, missing features, etc...); this didn't change with 10.3, due to us still hanging to an obsolete version (I know the political reasons and I don't want to start a discussion or flame on this); _ so I've been installing 7.11 from ports, which works a bit better, but with the switch to clang we lost some functionality: e.g. "p v.size()" does not work anymore on C++ containers; is there a way to get this back? _ as I said, there is no LLDB in base, but it can be installed with devel/lldb37, devel/lldb38, or any devel/llvmXX. Is this (which one?) the way I shoudl go? _ Any change to get some Emacs integration then? _ Anything else/any other hint? PROFILING I need to know which part of my code is wasting CPU, but, even more, I need to know which lines are executed and which one are not even touched by a set of input data. Up to 9.3, I used to compile with "-pg --coverage" and link with "-pg -lgcov", but that does not work anymore on 10.3, giving: > /usr/bin/ld: undefined reference to symbol `__pthread_cxa_finalize@@FBSDprivate_1.0' (try adding -lthr) > //lib/libthr.so.3: could not read symbols: Bad value Adding "-lthr" doesn't solve, however, since I'll get tons of > undefined reference to `llvm_gcda_start_file' > undefined reference to `llvm_gcda_emit_function' > undefined reference to `llvm_gcda_emit_arcs' AFAICT we have no such things in our base libraries. Am I wrong? So I read I might be using an old way of profiling and that I should add "-fprofile-instr-generate" instead. This, however, leads to: > c++: error: unknown argument: '-fprofile-instr-generate' I tried "-fprofile-generate", but then I get: > c++: warning: argument unused during compilation: '-fprofile-generate' So I'm stuck: how should I do profiling? Do I need to switch to a newer compiler from ports? bye & Thanks av.