This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug gdb/20405] New: all variables are optimized out when using -gsplit-dwarf -O -fPIC


https://sourceware.org/bugzilla/show_bug.cgi?id=20405

            Bug ID: 20405
           Summary: all variables are optimized out when using
                    -gsplit-dwarf -O -fPIC
           Product: gdb
           Version: 7.11
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: gdb
          Assignee: unassigned at sourceware dot org
          Reporter: kmenc15 at gmail dot com
  Target Milestone: ---

a.c:
int func2(int x) { return x; }
int func(int);
int main() {
    return func(5);
}

b.c:
int func2(int);
int func(int x) {
    int y = x+1;
    return func2(y);
}

$ gcc -g -gsplit-dwarf -fPIC -O b.c -shared -o libb.so
$ gcc a.c -lb -L.
$ gdb -nx a.out -ex "set breakpoint pending on" -ex "b b.c:3" -ex run -ex
"print x" -ex cont -ex quit
GNU gdb (GDB) 7.10
[...]
Breakpoint 1, func (x=<optimized out>) at b.c:3
3           int y = x+1;
$1 = <optimized out>
Continuing.
[Inferior 1 (process 9412) exited with code 06]


Without -gsplit-dwarf:

$ gcc -g -fPIC -O b.c -shared -o libb.so
$ gcc a.c -lb -L.
$ gdb -nx a.out -ex "set breakpoint pending on" -ex "b b.c:3" -ex run -ex
"print x" -ex cont -ex quit
GNU gdb (GDB) 7.10
[...]
Breakpoint 1, func (x=5) at b.c:3
3           int y = x+1;
$1 = 5
Continuing.
[Inferior 1 (process 8172) exited with code 06]

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]