[llvm-bugs] [Bug 35049] New: [PowerPC] backtrace isn't complete

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Oct 23 20:57:02 PDT 2017


            Bug ID: 35049
           Summary: [PowerPC] backtrace isn't complete
           Product: new-bugs
           Version: trunk
          Hardware: Other
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: eric.schweitz at pgroup.com
                CC: llvm-bugs at lists.llvm.org

If we take a rather simple program like the following and compile it with
"clang -g -O0 prgm.c", we don't appear to get debug stack frame information
that covers all instructions.

% gdb a.out
Reading symbols from a.out...done.
(gdb) b foo
Breakpoint 1 at 0x1000062c: file backtrace.c, line 12.
(gdb) r
Starting program: ./a.out 

Breakpoint 1, foo () at backtrace.c:12
12         return bar() * 2;
(gdb) disas
Dump of assembler code for function foo:
   0x0000000010000610 <+0>:     lis     r2,4099
   0x0000000010000614 <+4>:     addi    r2,r2,-32512
   0x0000000010000618 <+8>:     mflr    r0
   0x000000001000061c <+12>:    std     r31,-8(r1)
   0x0000000010000620 <+16>:    std     r0,16(r1)
   0x0000000010000624 <+20>:    stdu    r1,-112(r1)
   0x0000000010000628 <+24>:    mr      r31,r1
=> 0x000000001000062c <+28>:    bl      0x100005f0 <bar>
   0x0000000010000630 <+32>:    nop
   0x0000000010000634 <+36>:    li      r4,1
   0x0000000010000638 <+40>:    slw     r3,r3,r4
   0x000000001000063c <+44>:    extsw   r3,r3
   0x0000000010000640 <+48>:    addi    r1,r1,112
   0x0000000010000644 <+52>:    ld      r0,16(r1)
   0x0000000010000648 <+56>:    ld      r31,-8(r1)
   0x000000001000064c <+60>:    mtlr    r0
   0x0000000010000650 <+64>:    blr
   0x0000000010000654 <+68>:    .long 0x0
   0x0000000010000658 <+72>:    .long 0x0
   0x000000001000065c <+76>:    .long 0x0
End of assembler dump.
(gdb) b *0x000000001000064c
Breakpoint 2 at 0x1000064c: file backtrace.c, line 12.
(gdb) bt
#0  foo () at backtrace.c:12
#1  0x000000001000069c in main () at backtrace.c:20
(gdb) cont

Breakpoint 2, 0x000000001000064c in foo () at backtrace.c:12
12         return bar() * 2;
(gdb) bt
#0  0x000000001000064c in foo () at backtrace.c:12
#1  0x00001000000a4700 in generic_start_main.isra () from /lib64/libc.so.6
#2  0x00001000000a48f4 in __libc_start_main () from /lib64/libc.so.6
#3  0x0000000000000000 in ?? ()

As can be seen in the above cut-and-paste, the backtrace for breakpoint 1 and
the backtrace fro breakpoint 2 are different even though they are in the same
function, foo().

Here is an example program:
#include <stdio.h>

int bar()
   return 1;

int foo()
   return bar() * 2;

int main()
   int i = 100;
   while (i > 0)
        printf("result = %d\n", foo());
   return 0;

You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20171024/67afd762/attachment.html>

More information about the llvm-bugs mailing list