Use GDB to debug a C++ program called from a shell script
解决了我一个大问题!!!
http://stackoverflow.com/questions/5048112/use-gdb-to-debug-a-c-program-called-from-a-shell-script
There are two options that you can do:
1) invoke GDB directly within the shell script. This would imply that you don't have standard in and standard out redirected.
2) run the shell script and then attach the debugger to the already running c++ process like so: gdb progname 1234 where 1234 is the process ID of the running c++ process.
If you need to do things before the program starts running then option 1 would be the better choice, otherwise option 2 is the cleaner way.
if test -f $ASHA_HOME/bin/hasocket; then
#exec $ASHA_HOME/bin/hasocket $PRODUCT_HOME/bin/$EXE $*
echo "$PRODUCT_HOME/bin/$EXE $*"
gdb "$PRODUCT_HOME/bin/$EXE"
else
#exec $PRODUCT_HOME/bin/$EXE $*
echo "$PRODUCT_HOME/bin/$EXE $*"
gdb $PRODUCT_HOME/bin/$EXE
fi
Use GDB to debug a C++ program called from a shell script的更多相关文章
- shell script 的追踪与 debug
shell script 的追踪与 debug scripts 在运行之前,最怕的就是出现语法错误的问题了!那么我们如何 debug 呢?有没有办法不需要透过直接运行该 scripts 就可以来判断是 ...
- using gdb to debug c program
#include <stdio.h> static void display(int i, int *ptr); int main(void) { int x = 5; int *xptr ...
- gdb/valgrind/coredump to debug c/cpp program
gdb/valgrind/coredump 调试 1.gdb 调试 while/for 循环 ①如果在调试 while/for的时候,可以用until xxx(其中,xxx代表 行号)直接跳转到循环后 ...
- The Better Way to Debug Your JavaScript Program
Debugging JS program is not as easy as we do in Visual Studio or any other IDE. I usually us "a ...
- gdb远程debug A syntax error in expression, near `variable)'.
今天调试有个linux环境的应用时,gdb提示A syntax error in expression, near `variable)'.,最后经查,gdb版本过低(比如7.2)或者源代码不匹配所致 ...
- Using DTrace to Profile and Debug A C++ Program
http://www.oracle.com/technetwork/server-storage/solaris/dtrace-cc-138561.html
- Shell Script - 追踪与debug
[root@www ~]# sh [-nvx] scripts.sh 选项与参数: -n :不要运行 script,仅查询语法的问题: -v :再运行 sccript 前,先将 scripts 的内容 ...
- sublime使用
显示侧板的文件夹: View -> Side Bar 菜单[project]->add folder to project.把文件夹显示在左边的sidebar上. 安装插件: packa ...
- 学习shell script
摘要:概述.script的编写.test命令.[]判断符号.默认变量($1...).if...then条件判断式. 一.概述 [什么是shell script] 针对shell所写的脚本,将多个命令汇 ...
随机推荐
- 谈论linux同组多用户操作问题
同组多用户,最先起到什么作用这个我也是不明白的, 然后乱搞了一堆, 下面我做个笔记帮组日后分析. 一个用户组承载多个用户, 像这样 这是我原先的思路.然后就是chenglee用户和chenglee12 ...
- samtools can not find libbz2.so.1.0
Error: samtoolssamtools: error while loading shared libraries: libbz2.so.1.0: cannot open shared obj ...
- 题解——CF Manthan, Codefest 18 (rated, Div. 1 + Div. 2) T1(找规律)
就是找一下规律 但是奈何昨天晚上脑子抽 推错了一项QwQ 然后重新一想 A掉了QwQ #include <cstdio> #include <algorithm> #inclu ...
- (转)Introduction to Gradient Descent Algorithm (along with variants) in Machine Learning
Introduction Optimization is always the ultimate goal whether you are dealing with a real life probl ...
- Face Aging with Conditional Generative Adversarial Network 论文笔记
Face Aging with Conditional Generative Adversarial Network 论文笔记 2017.02.28 Motivation: 本文是要根据最新的条件产 ...
- 4-Four-Seeing hands
①Several cases have been reported in Russia recently of people who can read and detect colours wit ...
- Codeforces 884C.Bertown Subway ----判环,思路
The construction of subway in Bertown is almost finished! The President of Berland will visit this c ...
- spring 配置事务xml
<?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.spr ...
- 无法启动此程序,因为计算机中丢失api-ms-win-crt-runtime-|1-1-0.dll
今天想把自己电脑上的python2换成python3时,安装完python3后,命令行启动时需要出现了上述错误,在网上查了资料后应该是库文件遭到了破坏,于是我下了一个东西安装后就解决了,如果出现了此问 ...
- Centos6.5 搭建LAMP环境
1.Centos6.5 处于对安全的考虑,严格控制网络的进去.所以安装 Apache 或 MySQL 的时候,需要开放 80 或 3306 端口 首先,执行如下命令查看当前防火墙开放了哪些端口: [ ...