Bug 23223 - Gdb prints the wrong address for local variables, in 32 bit mode
Summary: Gdb prints the wrong address for local variables, in 32 bit mode
Status: RESOLVED DUPLICATE of bug 23220
Alias: None
Product: gdb
Classification: Unclassified
Component: exp (show other bugs)
Version: 7.11.1
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-05-23 17:32 UTC by kkireeva
Modified: 2018-05-23 20:27 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description kkireeva 2018-05-23 17:32:59 UTC
I didn't compile the binary myself.
It has no stack protections

#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>

int main(int argc, char **argv)
{
  volatile int modified;
  char buffer[64];

  modified = 0;
  gets(buffer);

  if(modified != 0) {
      printf("you have changed the 'modified' variable\n");
  } else {
      printf("Try again?\n");
  }
}

The addresses of modified and buffer are printed above argv, which is nonsense.
Also their true location is different, as evidenced by what strcpy modifies. 
print &modified
$1 = (volatile int*) 0xffffcf3c
print &argv
$2 = (char***) 0xffffcf64
Comment 1 Andreas Schwab 2018-05-23 20:27:50 UTC
.

*** This bug has been marked as a duplicate of bug 23220 ***