From: "Luo, Ginger" <Ginger.Luo@amd.com>
To: "gdb@sourceware.org" <gdb@sourceware.org>
Subject: getenv always return NULL in GDB/DDD
Date: Fri, 26 Oct 2018 09:35:00 -0000 [thread overview]
Message-ID: <DM5PR12MB14176F534FE18CF4AA21AF8795F00@DM5PR12MB1417.namprd12.prod.outlook.com> (raw)
Hello, GDB experts
I try to call getenv in my C code, this can return correct env string in terminal, while it returns NULL in GDB/DDD.
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
void main() {
char * a = getenv("ANCHOR"); // ANCHOR exists in the terminal
if (strlen(a)>0)
printf("%s\n", a);
}
The GDB/DDD is started from the same terminal. Even I "show environment", this env exists.
Anyone any idea?
OS/Tools version info: RHEL Linux hostname1 2.6.32-754.3.5.el6.x86_64 #1 SMP Thu Aug 9 11:56:22 EDT 2018 x86_64 GNU/Linux
GNU gdb (GDB) 7.12
gcc (GCC) 6.3.0
SHELL is tcsh, DDD/GDB is using default settings.
Let me know if you need any further info.
Thanks!
G
next reply other threads:[~2018-10-26 9:35 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-26 9:35 Luo, Ginger [this message]
2018-10-26 14:21 ` Simon Marchi
2018-10-29 5:05 ` Luo, Ginger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=DM5PR12MB14176F534FE18CF4AA21AF8795F00@DM5PR12MB1417.namprd12.prod.outlook.com \
--to=ginger.luo@amd.com \
--cc=gdb@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox