From: Andy Fan <zhihui.fan1213@gmail.com>
To: Christian Biesinger <cbiesinger@google.com>
Cc: gdb@sourceware.org
Subject: Re: Detect uninitialized memory in gdb
Date: Wed, 1 Apr 2020 07:53:40 +0800 [thread overview]
Message-ID: <CAKU4AWr=G6yOA9DAjKcTs9KOGhfzjjm9bQSEH=u=9aP3XNmfLQ@mail.gmail.com> (raw)
In-Reply-To: <CAPTJ0XEtZjsADcnXGXUb4Q5Q+xFg08yWbW2kH=wruDbapgJgbA@mail.gmail.com>
On Wed, Apr 1, 2020 at 2:48 AM Christian Biesinger <cbiesinger@google.com>
wrote:
> On Tue, Mar 31, 2020 at 1:08 AM Andy Fan via Gdb <gdb@sourceware.org>
> 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
prev parent reply other threads:[~2020-03-31 23:55 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-31 6:06 Andy Fan
2020-03-31 18:48 ` Christian Biesinger
2020-03-31 23:53 ` Andy Fan [this message]
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='CAKU4AWr=G6yOA9DAjKcTs9KOGhfzjjm9bQSEH=u=9aP3XNmfLQ@mail.gmail.com' \
--to=zhihui.fan1213@gmail.com \
--cc=cbiesinger@google.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