https://bugs.llvm.org/show_bug.cgi?id=51778

            Bug ID: 51778
           Summary: Missing variables after InlinerPass at O2
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: DebugInfo
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected],
                    [email protected]

Upon calling a function from an external module, the variable i passed to it is
not visible from lldb. Using -opt-bisect-limit we discovered that the pass
causing the symbols disappear is "InlinerPass on SCC (main)".

$ cat a.c
void  a()
{
short l_55 = 0;
int l_59 = 3,  l_60 = 1,  l_63 = 0,  l_64 = 0,  l_93 = 1,  i = 0;
char l_113 = 3;
for (; i < 1; i++)
{
test_nop();
test_support_2993(l_55, l_59, l_60, l_63, l_64, l_93, l_113, i);
}
}
int main ()
{
a();
}

$ cat lib/test.c
#include <stdio.h>
#include <stdint.h>
#include "test.h"

void test_nop() {
    printf("\n");
}

void test_support_2993(int l_55, int l_59, int l_60, int l_63, int l_64, int
l_93, int l_113, int i) {
    printf("%d %d %d %d %d %d %d %d", l_55, l_59, l_60, l_63, l_64, l_93,
l_113, i);
}

$ cat lib/test.h
#pragma once

void test_nop();

void test_support_2993(int l_55, int l_59, int l_60, int l_63, int l_64, int
l_93, int l_113, int i);

$ clang -v
clang version 13.0.0
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7.5.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/8
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7.5.0
Candidate multilib: .;@m64
Selected multilib: .;@m64

$ lldb -v
lldb version 13.0.0

clang revision c2c977ce50597b0e5186afc342c5784bd0aa6973
lldb revision c2c977ce50597b0e5186afc342c5784bd0aa6973

$ clang -g -O2 -o opt lib/test.c a.c
$ lldb opt
(lldb) target create "opt"
Current executable set to '/home/cristianrichie/62/reduce/opt' (x86_64).
(lldb) b 8
Breakpoint 1: 2 locations.
(lldb) r
Process 1774 launched: '/home/cristianrichie/62/reduce/opt' (x86_64)
Process 1774 stopped
* thread #1, name = 'opt', stop reason = breakpoint 1.2
    frame #0: 0x0000000000401171 opt`main [inlined] a at a.c:8:1
   5    char l_113 = 3;
   6    for (; i < 1; i++)
   7    {
-> 8    test_nop();
   9    test_support_2993(l_55, l_59, l_60, l_63, l_64, l_93, l_113, i);
   10   }
   11   }
(lldb) frame var
(short) l_55 = 0
(int) l_59 = 3
(int) l_60 = 1
(int) l_63 = 0
(int) l_64 = 0
(int) l_93 = 1
(char) l_113 = '\x03'
(lldb) frame var i
error: no variable named 'i' found in this frame

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to