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所写的脚本,将多个命令汇 ...
随机推荐
- 2018-2019-1 20189206 vim.c插件安装
vim插件安装 vim插件安装 由于今天在安装vim.c插件耗费了很多时间,配置文件一直不生效,特此记录以下安装插件的方法. 安装vim.c按照博客的方法 第一步:创建目录~/.vim 这个目录是用来 ...
- 一图解释PHPstorm代码片段设置---附官方文档(转)
参考:https://blog.csdn.net/thinkthewill/article/details/81145106 资料 设置片段[官方设置教程] 设置变量对话框[官方设置教程] phpst ...
- poj 2942 Knights of the Round Table - Tarjan
Being a knight is a very attractive career: searching for the Holy Grail, saving damsels in distress ...
- 尚硅谷面试第一季-14Redis持久化类型及其区别
课堂重点: Redis提供了两种不同形式的持久化方案,分别是RDB和AOF. RDB使用Snapshot快照做全量的存储. RDB优缺点: AOF 以日志的方式记录每个写操作,只最佳,不该写文件.增量 ...
- CentOS 安装 MongoDB
一.安装mongodb 本文介绍的安装方式是以二进制方式离线安装,相当于windows"绿色"安装版本的概念. 下载mongodb: # https://www.mongodb.c ...
- Linux lvm 分区知识笔记
盘面上可以细分出扇区(Sector)与柱面(Cylinder)两种单位,其中扇区每个为512bytes那么大. 通常所说的"硬盘分区"就是指修改磁盘分区表,它定义了"第n ...
- Smartmontools硬盘检测工具
安装: 下载 命令使用: 查看驱动器信息: $ smartctl -i D: smartctl 6.6 2017-11-05 r4594 [x86_64-w64-mingw32-w10-b17134] ...
- 三部排序|2013年蓝桥杯B组题解析第六题-fishers
三部排序| 一般的排序有许多经典算法,如快速排序.希尔排序等. 但实际应用时,经常会或多或少有一些特殊的要求.我们没必要套用那些经典算法,可以根据实际情况建立更好的解法. 比如,对一个整型数组中的数字 ...
- 外观模式Facade pattern
http://www.runoob.com/design-pattern/facade-pattern.html 外观模式 外观模式(Facade Pattern)隐藏系统的复杂性,并向客户端提供了一 ...
- ps2016新功能
1 内容识别缩放(alt ctrl shift c) 2 内容感知移动 3 画笔大小和画笔硬度调整 alt + 鼠标右键:上下为硬度 ...