#332 gdb can't find local variables in unoptimized main

LTS/20120406
open
nobody
gdb (2)
5
2012-09-10
2012-09-03
No

It seems like GDB is using a wrong offset when it shows variables in main().

Discussion

  • Soren Petersen

    Soren Petersen - 2012-09-03

    Source code using 5 variables in main

     
  • Soren Petersen

    Soren Petersen - 2012-09-03

    This is the compiled and linked elf file

     
  • Soren Petersen

    Soren Petersen - 2012-09-03

    This is what I see when I print the variables in GDB
    Stopping execution at line "a=b+c" gives me the following values for the
    variables.
    a=0; b=1;c=2;d=3;e=4;
    Stopping execution at line "return 0" gives me the following values for the
    variables.
    a=0;b=5;c=2;d=9;e=7;
    When I dump the memory I see the correct values (at line "return 0")
    a=5;b=2;c=9;d=7;e=5;

     
  • Peter A. Bigot

    Peter A. Bigot - 2012-09-10

    Reproducible with -ggdb, no optimization. Generated dwarf code appears correct. Problem deferred to msp430-gdb maintainer (there is none currently).

     
  • Peter A. Bigot

    Peter A. Bigot - 2012-09-10
    • labels: 1495978 --> gdb
    • assigned_to: pabigot --> nobody
     
  • michal

    michal - 2012-12-06

    I see this too. It looks as though only -fomit-frame-pointer is needed though to solve the problem.

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks