From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 58292 invoked by alias); 26 Oct 2018 09:35:20 -0000 Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org Received: (qmail 58239 invoked by uid 89); 26 Oct 2018 09:35:17 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=DDD, Hx-languages-length:1423, H*c:alternative, H*c:HHH X-HELO: NAM02-BL2-obe.outbound.protection.outlook.com Received: from mail-bl2nam02on0089.outbound.protection.outlook.com (HELO NAM02-BL2-obe.outbound.protection.outlook.com) (104.47.38.89) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 26 Oct 2018 09:35:15 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=rpMCEEACd5ThmJh9aR0FgTtlULw03RsWX5aWCt3hxns=; b=peDbfE5dBec4Nx7Y84RKrciGgy0i2PQRPAkCRh/hgV8Jgm0cUJJOsT7AhEDEiFBRCvg0hKCkJv9CBtcal1hlDg427P+R/WP9Z4X4gFTmKlwagJSqvgqVpvujb5jxLInxmm6p2oRbhrvbDNVbLS6AKqXs5bn7gVstouzWainIkiE= Received: from DM5PR12MB1417.namprd12.prod.outlook.com (10.168.238.144) by DM5PR12MB1916.namprd12.prod.outlook.com (10.175.88.148) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1273.18; Fri, 26 Oct 2018 09:35:12 +0000 Received: from DM5PR12MB1417.namprd12.prod.outlook.com ([fe80::28e2:65d9:6893:2729]) by DM5PR12MB1417.namprd12.prod.outlook.com ([fe80::28e2:65d9:6893:2729%4]) with mapi id 15.20.1273.019; Fri, 26 Oct 2018 09:35:12 +0000 From: "Luo, Ginger" To: "gdb@sourceware.org" Subject: getenv always return NULL in GDB/DDD Date: Fri, 26 Oct 2018 09:35:00 -0000 Message-ID: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Ginger.Luo@amd.com; received-spf: None (protection.outlook.com: amd.com does not designate permitted sender hosts) MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-SW-Source: 2018-10/txt/msg00051.txt.bz2 Hello, GDB experts I try to call getenv in my C code, this can return correct env string in te= rminal, while it returns NULL in GDB/DDD. #include #include #include void main() { char * a =3D 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", t= his env exists. Anyone any idea? OS/Tools version info: RHEL Linux hostname1 2.6.32-754.3.5.el6.x86_64 #1 SM= P 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