为什么GDB启动新的外壳,以及如何禁用此行为? [英] Why does GDB start a new shell and how to disable this behaviour?

查看:226
本文介绍了为什么GDB启动新的外壳,以及如何禁用此行为?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我搞清楚开始从GDB产生一个符号查找错误应用程序的问题,但是从shell工作启动它。

I was figuring out a problem where starting the application from GDB results in a symbol lookup error, but starting it from the shell works.

原来,每当你从GDB启动程序将启动一个新的外壳,从而覆盖我开始GDB之前已设置所有环境变量(如 LD_LIBRARY_PATH

It turns out that whenever you start a program from within GDB it will start a new shell and thus override all environment variables I had set before starting GDB (like LD_LIBRARY_PATH).

这是不是真的我想要的行为。有人可以解释这样做的理由,或者告诉我怎样可以关闭此功能?

This is not really the behavior I want. Can someone explain the rationale behind this, or tell me how I can turn this off?

推荐答案

我猜测你的无条件的设置 LD_LIBRARY_PATH 〜/ .cshrc中等。所以,如果从shell提示你这样做:

I am guessing that you unconditionally set LD_LIBRARY_PATH in your ~/.cshrc or the like. So if from a shell prompt you do this:

export LD_LIBRARY_PATH=foo  # or for csh:
setenv LD_LIBRARY_PATH foo
$SHELL -c 'echo $LD_LIBRARY_PATH'

结果比以外的东西。不要做的

the result is something other than foo. Don't do that.

这通常发生在CSH用户,谁忽视了保护自己的〜/ .cshrc中对非交互shell。它也可能发生在BASH谁设置用户在他们的 BASH_ENV

Usually this happens to CSH users, who neglected to protect their ~/.cshrc against non-interactive shells. It could also happen to BASH users who set their BASH_ENV.

这篇关于为什么GDB启动新的外壳,以及如何禁用此行为?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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