<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [PowerPC] backtrace isn't complete"
   href="https://bugs.llvm.org/show_bug.cgi?id=35049">35049</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[PowerPC] backtrace isn't complete
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Other
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>new bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>eric.schweitz@pgroup.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>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
Continuing.

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 ?? ()
(gdb)

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>

__attribute__((noinline))
int bar()
{
   return 1;
}

__attribute__((noinline))
int foo()
{
   return bar() * 2;
}

int main()
{
   int i = 100;
   while (i > 0)
    {
        printf("result = %d\n", foo());
        i--;
    }
   return 0;
}
"""</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>