gdb debugging and manipulating environment variables for same address [duplicate]
I was understanding how environment variables affect the memory layout of a program, and as such wanted to replicate the same address within and outside GDB. So the address displayed in GDB always remains constant whereas the address of the program binary being executed constantly keeps changing. Objective: obtain same address values inside and outside gdb Exact code of program: #include <stdio.h> void bar(int num_args) { int arr[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; printf("DEBUG: Array arr is at address %p\n", (void *)arr); printf("You passed bar %d parameters :o\n", num_args); arr[num_args]
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.