https://bugs.llvm.org/show_bug.cgi?id=40189
Bug ID: 40189
Summary: LLDB expressions always error if a C++ local variable
is named after a keyword
Product: lldb
Version: 7.0
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: All Bugs
Assignee: lldb-dev@lists.llvm.org
Reporter: jacobly....@gmail.com
CC: llvm-b...@lists.llvm.org
This is only triggered by the debug info produced by gcc, not by clang. It
seems that uses of e.g. __func__ and __PRETTY_FUNCTION__ cause gcc to emit
debug info for a local variable named after the corresponding keyword, where
clang does not emit anything. I have confirmed this happens with g++ 8.2.0 and
lldb 7.0.0, 7.0.1, and trunk.
Quick repro:
$ echo 'int main(int argc){__func__;}' | g++ -g -x c++ - && lldb -o 'br s -n
main' -o 'pr la' -o 'expr argc' a.out
which produces
error: expected unqualified-id
which occurs because of a syntax error on the line
using $__lldb_local_vars::__func__;
Note that C programs don't generate such using lines, and therefore don't
exhibit this bug. I encountered this bug while debugging llvm (accidentally
compiled with gcc) in any function that uses assert, e.g. compileModule in
tools/llc/llc.cpp.
I confirmed that a workaround is to add hardcoded exceptions to
AddLocalVariableDecls in tools/lldb/source/Expression/ExpressionSourceCode.cpp,
but I'm not sure if that is the correct way to fix this.
--
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
lldb-dev mailing list
lldb-dev@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev