您在Linux上使用什么工具来开发C ++应用程序? [英] What tools do you use to develop C++ applications on Linux?

查看:111
本文介绍了您在Linux上使用什么工具来开发C ++应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Linux环境中开发C ++应用程序。我每天使用的工具包括带有CDT插件的Eclipse,gdb和valgrind。

其他人使用哪些工具?有没有什么可以在Linux上与Microsoft Visual Studio的光滑相媲美?

解决方案

我使用了一堆终端窗口。我有vim运行有趣的源文件,make和g ++输出另一个编译器错误或gdb会话的运行时错误。如果我需要帮助查找定义,我运行cscope并使用vim的cscope支持来跳转。



Eclipse CDT是我的第二选择。与vim相比,这是一个很好但又非常缓慢和缓慢的程序。



使用终端窗口和vim非常灵活,因为我不需要随身携带400 MB的Java可以从任何地方使用SSH会话。



当我需要找到内存问题时,我使用valgrind。



我使用 strace 来观看我的软件在系统调用级别上的功能。这让我清理了连续四次调用 time(0)的真正愚蠢的代码,或者调用太多调用 poll()或非阻塞 read()或者在套接字上调用 read()来读取1一个字节。 (这是超级无效和懒惰!)



我使用 objdump -d 检查机器代码,特别是对于性能敏感的内部循环。这就是我使用oprofile尝试找到优化代码中的热点,我如何找到像使用迭代器的字符串数组索引运算符的缓慢的东西。



发现它通常比gprof好一点,它可以做诸如查找数据和指令高速缓存未命中的事情。这可以告诉你在哪里可以使用GCC的 __ builtin_prefetch 删除一些有用的预取提示。我试图用它来找到热门的错误预测的分支,但是不能让它为我工作。



更新:我发现perf工程方式比oprofile好。至少在Linux上。学习使用perf,并像我一样喜欢它。


I develop C++ applications in a Linux environment. The tools I use every day include Eclipse with the CDT plugin, gdb and valgrind.
What tools do other people use? Is there anything out there for Linux that rivals the slickness of Microsoft Visual Studio?

解决方案

I use a bunch of terminal windows. I have vim running on interesting source files, make and g++ output on another for compiler errors or a gdb session for runtime errors. If I need help finding definitions I run cscope and use vim's cscope support to jump around.

Eclipse CDT is my second choice. It's nice but huge, ungainly and slow compared to vim.

Using terminal windows and vim is very flexible because I do not need to carry 400 MB of Java around with me I can use SSH sessions from anywhere.

I use valgrind when I need to find a memory issue.

I use strace to watch what my software is doing on a system call level. This lets me clean up really stupid code that calls time(0) four times in a row or makes too many calls to poll() or non-blocking read() or things like calling read() on a socket to read 1 byte at a time. (That is super inefficient and lazy!)

I use objdump -d to inspect the machine code, especially for performance sensitive inner loops. That is how I find things like the slowness of the array index operator on strings compared to using iterators.

I use oprofile to try to find hot spots in optimized code, I find that it often works a little better than gprof, and it can do things like look for data and instruction cache misses. That can show you where to drop some helpful prefetch hints using GCC's __builtin_prefetch. I tried to use it to find hot mis-predicted branches as well, but couldn't get that to work for me.

Update: I've found that perf works way better than oprofile. At least on Linux. Learn to use perf and love it as I do.

这篇关于您在Linux上使用什么工具来开发C ++应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆