From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qk1-x72b.google.com (mail-qk1-x72b.google.com [IPv6:2607:f8b0:4864:20::72b]) by sourceware.org (Postfix) with ESMTPS id 26D1B385DC00 for ; Tue, 31 Mar 2020 18:48:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 26D1B385DC00 Received: by mail-qk1-x72b.google.com with SMTP id j4so24164555qkc.11 for ; Tue, 31 Mar 2020 11:48:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=33vJuFmZ48RvSP8YJV8KhTCU9O8qvu3CwZh2624bZ7s=; b=nkyTaTr+J+0fR8SCcAZZt829cKIZ8ZwtghjqaOJFsR5eSGWctTogjP+fQCnVhqHPLZ Vm1H+n5s7BH6Xp8DKxW2uvzh+CO0XPPrdZY0EH6LwtzUJ+Hu1ty/dXpyo7MqtxtFnjAe WixmGrxsBijDX5j2hCM+8HaC848q73NibJ4zvrvfm7zJRHQvgCxRXr7pn6fJYa2mXLfM eE8sPJgCvpQuilYBSkNOaygBv3peBACz20i1mjpVsiW98llKiU7NQOhMs4/vm6p1Wfwz cHGV8PYklcgztbF7EiaaEMB5AWgnaYnbei2LI8ExdLZfRxILk2OHQGgn2/uCdZx3+asl e9kw== X-Gm-Message-State: ANhLgQ2Y4eM4ixXgLhRnMtzPR2J4vTt5CyR1AH8CvRsB8aHN0DGBqdXv 049oJZs6eEKzC4/xKWH/0W+6y8MzTxrm3BGaaDNjc36a X-Google-Smtp-Source: ADFU+vvfJMKJYRH66ff7TAOAkKc/gOiodEqWT7juMpp+KlRCBNHy4e9w0PR/nkjBGTc5UIN4TPBdhnoP216GsuiytzE= X-Received: by 2002:a05:620a:1256:: with SMTP id a22mr6139232qkl.439.1585680533379; Tue, 31 Mar 2020 11:48:53 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Christian Biesinger Date: Tue, 31 Mar 2020 13:48:16 -0500 Message-ID: Subject: Re: Detect uninitialized memory in gdb To: Andy Fan Cc: gdb@sourceware.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-21.6 required=5.0 tests=BAYES_00, DKIMWL_WL_MED, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, USER_IN_DEF_DKIM_WL, USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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, 31 Mar 2020 18:48:55 -0000 On Tue, Mar 31, 2020 at 1:08 AM Andy Fan via Gdb wrote: > > Greetings. > > Suppose I have the following codes: > > struct X { ... }; > > void g(struct X *x_p); > > void f() > { > struct X x_var; > g(&x_var); > } > > In the function of g, I want to check the data where x_p point to, > however it is possible that it is not initialized like above code. So > do we have a way to detect that the memory x_p point to is not > initialized or not in gdb? No, it's not really possible with GDB. You want a tool like Valgrind or Address Sanitizer. Christian