From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf1-x12f.google.com (mail-lf1-x12f.google.com [IPv6:2a00:1450:4864:20::12f]) by sourceware.org (Postfix) with ESMTPS id 7F241385BF83 for ; Tue, 31 Mar 2020 23:55:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 7F241385BF83 Received: by mail-lf1-x12f.google.com with SMTP id t16so18021924lfl.2 for ; Tue, 31 Mar 2020 16:55:15 -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=wG6r7GJJhVgob7jiY3RGBJHVfy5jwq023WMGBBzckaE=; b=oBgR0CA+c6reC3KUTvnYTKeP1wBWw7bIVJqSs3tO6a4veYJsK1DNPTzClcyGufIWC/ qID/lPkDCwPuJ5YRS+j2xnSsxp2lWXbxtNcVzm+8f5YsmbfJnvD9tMZfoTims2G8o+qD /Hl6+EVnQciY8TcuIQ2abLGXtdFQ74lDYXN07T5A1E8br5Z/Ylxzx+guEOy6Cltfwl9s nwbd9MtGVxbcmDdoacwVTwHrX7Z72+WyFFtu7X/1osS3uIh8pS+GKNyS88onWYXsZooC IgXf/vta2fZz+pr2GjnYd85owLjzvjWGxSYRiKlSCc9NPJ/IoHCTHTN7XknEIxu6wt6i vv+g== X-Gm-Message-State: AGi0Pua+nIAOk5cZPECvSw5izRm1HL3G1r6foqRoYx+1A0EV9MgL9jF7 7uajAmZZOOWbDZoEC4C17YxPDfeLKIqYpm7vVOfsKv/gQJ8= X-Google-Smtp-Source: APiQypLFPUDqexx+hv5aHQ8/ioaLSInaUNcE24a6oPq8WVDfJVnyObJgeX4t62hMxTcAXvyh/AwEaNV8BBnkWBpIifQ= X-Received: by 2002:a19:ee09:: with SMTP id g9mr13143189lfb.11.1585698914294; Tue, 31 Mar 2020 16:55:14 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Andy Fan Date: Wed, 1 Apr 2020 07:53:40 +0800 Message-ID: Subject: Re: Detect uninitialized memory in gdb To: Christian Biesinger Cc: gdb@sourceware.org X-Spam-Status: No, score=-3.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, HTML_MESSAGE, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 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 23:55:16 -0000 On Wed, Apr 1, 2020 at 2:48 AM Christian Biesinger wrote: > 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. > > Thank you for your reply Christian. Just because I want to call gdb script after I know it is initialized, so Valgrind is not my option now. Best Regards Andy Fan