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所写的脚本,将多个命令汇 ...
随机推荐
- InstallShield.12完美使用
转载:http://www.360doc.com/content/13/0517/10/7918060_286039102.shtml 转载:http://jingyan.baidu.com/arti ...
- Git clone、git reset
一,git clone 1,git clone某一个分支 git clone -b <branch> <remote_repo> 2,.git 文件太大 :clone的时候,可 ...
- java利用poi生成excel文件后下载本地
1.该功能需要poi的jar包,链接: http://pan.baidu.com/s/1migAtNq 密码: 38fx. 2.首先新建一个实体类,用以存放单个数据 public class Test ...
- 我为什么选择Go语言(Golang)
作为一个以开发为生的程序员,在我心目中编程语言如同战士手里的武器,好与不好主要看使用的人是否趁手.是否适合,没有绝对的高低之分. 从2013年起,学习并使用Golang已经有4年时间了,我想叙述一下我 ...
- 2870: 最长道路tree
链接 https://www.lydsy.com/JudgeOnline/problem.php?id=2870 思路 先把树转化为二叉树 再链分治 %%yyb 代码 #include <ios ...
- (转)Shiro学习
(二期)13.权限框架shiro讲解 [课程13]自定义Realm.xmind36.8KB [课程13]用户授权流程.xmind0.2MB [课程13]shiro简介.xmind0.3MB [课程13 ...
- oracle 之 安装后pl/sql登录报ora-12154
这个问题一开始困扰了很久. 查的资料是复制一小段代码到tnsnames.ora中 SID名 = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = ...
- BZOJ 3707 圈地
闲扯 BZOJ权限题,没有权限,哭了 然后DBZ不知道怎么回事,\(O(n^3)\)直接压过去了... 备忘 叉积的计算公式\(x_1y_2\) 思路 n^3 暴力枚举显然 n^2 正解的思路有点神, ...
- 论文笔记:Show, Attend and Tell: Neural Image Caption Generation with Visual Attention
Show, Attend and Tell: Neural Image Caption Generation with Visual Attention 2018-08-10 10:15:06 Pap ...
- JQuery---高级类选择器
1.ContentFilters 1.1 语法:$('div:contains(edu)').css('backgroundColor','yellow'); 只看div 本身是否包含内容 1.2 语 ...