[PATCH] D70696: [DebugInfo] Support to emit debugInfo for extern variables

Paul Robinson via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 2 12:09:28 PST 2019


probinson added a comment.

In D70696#1765671 <https://reviews.llvm.org/D70696#1765671>, @dblaikie wrote:

> In D70696#1765637 <https://reviews.llvm.org/D70696#1765637>, @probinson wrote:
>
> > For the case:
> >
> >   cat ref.c
> >       extern int global_var;
> >       int main() { return global_var; }
> >
> >
> > I *do* expect to see debug info for the declaration of global_var.
>
>
> FWIW I'd only expect it there with -fstandalone-debug - with -fno-standalone-debug I'd expect this code to rely on the assumption that def.c is also compiled with debug info.


When global_var is defined in a separate .so, you might not have the symbol at all.  It's helpful to be able to report "that symbol is defined outside this executable" (and IIRC, gdb can look it up by mangled name and actually show it to you anyway).  Without even the declaration, you get "that symbol that you can see right there in your source? It doesn't exist, haha."  So, I would definitely rather see a declaration for a referenced global.
Even if we currently don't do that.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D70696/new/

https://reviews.llvm.org/D70696





More information about the cfe-commits mailing list