Discussion:
Some developer's questions
(too old to reply)
Andrea Venturoli
2016-05-30 07:39:30 UTC
Permalink
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
//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.
c++: error: unknown argument: '-fprofile-instr-generate'
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.
Kevin P. Neal
2016-05-30 20:47:25 UTC
Permalink
Post by Andrea Venturoli
Do I need to switch to a newer compiler from ports?
Short answer: yes

The version of clang in 10.x is I believe the last version that can be
bootstrapped with a pre-C++11 compiler. But it is several years old at
this point. You'll probably have much better luck with a current version,
and if you don't you'll have better luck getting fixes with a current
version.
--
Kevin P. Neal http://www.pobox.com/~kpn/

"A pig's gotta fly." - Crimson Pig
Loading...