Re: Does gdb initialize uninitialized variables?
Ruslan Kabatsayev via Gdb <[email protected]>
| Newsgroups | gmane.comp.gdb.devel |
|---|---|
| Message-ID | <CAHEcG9720WghrUUrb69LOu=ZDg5VjrJmzu2AnetyXjvLBa2t8w@mail.gmail.com> |
Hi, On Mon, 21 Feb 2022 at 12:45, Edgar Mobile via Gdb <[email protected]> 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