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所写的脚本,将多个命令汇 ...
随机推荐
- openstack tap complete
$ openstack complete > /etc/bash_completion.d/osc.bash_completion re-login and bash
- win7安装mysql-8.0.13-winx64
这里展示一下,由于需要安装一个版本测试一下数据,其实就是超简单的啦. 下包 注:https://dev.mysql.com/downloads/mysql/ 解压与配置 [mysqld] basedi ...
- Lottie的json动画
我们的设计如是说: Lottie的json动画,优缺点有 优点: 1.开发成本低,动画的还原度高.设计师导出 json 文件后,交付开发.原本要1天甚至更久的动画实现,现在只要不到一小时甚至更少时间了 ...
- Access导出excel
SELECT * INTO [excel .xls].Sheet1 FROM tableName
- topcoder srm 300 div1
problem1 link 直接模拟即可. import java.util.*; import java.math.*; import static java.lang.Math.*; public ...
- 三元运算符代替if-else
main(List<String> args) { int age = 60; String status = age < 50 ? "Still young" ...
- Git 命令收集
目录 1.清理恢复 2.回滚,reset与revert的区别 3.merge,rebase,cherry-pick区别 4.删除不存在对应远程分支的本地分支 5.git pull,git push 报 ...
- linux下gzip的压缩详解
Linux压缩保留源文件的方法: gzip -c filename > filename.gz Linux解压缩保留源文件的方法: gunzip -c filename.gz > file ...
- 简单数论总结1——gcd与lcm
并不重要的前言 最近学习了一些数论知识,但是自己都不懂自己到底学了些什么qwq,在这里把知识一并总结起来. 也不是很难的gcd和lcm 显而易见的结论: 为什么呢? 根据唯一分解定理: a和b都可被分 ...
- 深度学习课程笔记(十)Q-learning (Continuous Action)
深度学习课程笔记(十)Q-learning (Continuous Action) 2018-07-10 22:40:28 reference:https://www.youtube.com/watc ...