From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from cp165172.hpdns.net (cp165172.hpdns.net [91.238.165.172]) by sourceware.org (Postfix) with ESMTPS id 8F5943858406 for ; Tue, 22 Feb 2022 22:20:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 8F5943858406 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=dyxyl.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=dyxyl.com DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=dyxyl.com; s=default; h=Content-Type:MIME-Version:Message-ID:Date:References:In-Reply-To :Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=m61Q1mec2OmV4zjEAgLzjAcXD4F9fziEr8/0gb0n40M=; b=VUQN7W9TkO6xX7JWEWv6HQtPb8 ZgYJskrORVqyBH40rd+bT3o6+yF//qYJdi6Nr5aLDQLl6GwQFzssGzu3hwkltwypsQHk4qBj7hdwe KhD7qTwbzodgqvxxH7xUZj81CZInT7DeLIFEEyCWDpN2rAEtO9gdIyCNfgyYzCHZ1aTI=; Received: from cpc92880-cmbg19-2-0-cust615.5-4.cable.virginm.net ([82.27.106.104]:48614 helo=localhost.localdomain) by cp165172.hpdns.net with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1nMdVw-006qm4-JE; Tue, 22 Feb 2022 22:20:07 +0000 Received: by localhost.localdomain (Postfix, from userid 597) id 26FB26050E; Tue, 22 Feb 2022 22:20:07 +0000 (GMT) From: Martin Simmons To: Edgar Mobile Cc: b7.10110111@gmail.com,gdb@sourceware.org Subject: Re: Does gdb initialize uninitialized variables? In-Reply-To: (message from Edgar Mobile via Gdb on Tue, 22 Feb 2022 21:30:26 +0000) References: Date: Tue, 22 Feb 2022 22:20:07 +0000 Message-ID: MIME-Version: 1.0 Content-Type: text/plain X-cPanel-MailScanner-Information: Please contact the ISP for more information X-cPanel-MailScanner-ID: 1nMdVw-006qm4-JE X-cPanel-MailScanner: Found to be clean X-cPanel-MailScanner-SpamCheck: X-cPanel-MailScanner-From: qqxnjvamvxwx@dyxyl.com X-Spam-Status: No, score=-0.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, HK_RANDOM_ENVFROM, HK_RANDOM_FROM, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.4 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - cp165172.hpdns.net X-AntiAbuse: Original Domain - sourceware.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - dyxyl.com X-Get-Message-Sender-Via: cp165172.hpdns.net: authenticated_id: dyxyl/from_h X-Authenticated-Sender: cp165172.hpdns.net: qqxnjvamvxwx@dyxyl.com X-Source: X-Source-Args: X-Source-Dir: X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gdb@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Feb 2022 22:20:13 -0000 I've sometimes seen different layout of the stack when running under gdb because it changes the environment and converts argv[0] to an absolute path. You could try running the program without gdb and then attach gdb to it from a different shell. If the program crashes before you have time to attach gdb, then try adding a call to sleep() in main() to delay it. __Martin >>>>> On Tue, 22 Feb 2022 21:30:26 +0000, Edgar Mobile via Gdb said: > > I tried it as the very first command even before run. Any more ideas? (tx already) > > ________________________________ > From: Ruslan Kabatsayev > Sent: Monday, February 21, 2022 5:33 PM > To: Edgar Mobile > Cc: gdb@sourceware.org > Subject: Re: Does gdb initialize uninitialized variables? > > Hi, > > On Mon, 21 Feb 2022 at 12:45, Edgar Mobile via Gdb wrote: > > > > Greetings, > > > > I currently try to find a bug that might be caused by uninitialized variables/memory. But it never appears when I use gdb. Does gdb change how memory is initialized in any way, be it on stack or via new/malloc? > > Memory-related bugs that don't happen when using GDB but do without > GDB are often caused by GDB disabling ASLR. This is usually useful for > reproducibility of debugging sessions, but may indeed make address > space layout too predictable and fail to reproduce a bug. Try using > the GDB command "set disable-randomization off" (without quotes) to > undo this behavior and thus start your program in a normal, > randomized, environment. > > Besides, if your problem is indeed with uninitialized variables, you > might find Valgrind memory checker more useful than a debugger. > > > > > Regards > > Regards, > Ruslan >