[llvm-dev] Debug Info is not generated for extern variables .

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

[llvm-dev] Debug Info is not generated for extern variables .

Finkel, Hal J. via llvm-dev
Hi All,

for the below case :
$cat test.c
extern void sharedLibTestLibRtn (int arg);
extern int testExt;
int main (void)
    {
    testExt++;
    sharedLibTestLibRtn (5);

    return 0;
    }
we don't see the debug-info for "testExt" i.e no DW_AT_type  entry for
extern symbol ,where gcc has the same .

we are  fixing  the same in clang as compatibility with gcc .

before we start our analysis on DIBuilder in clang ,any inputs here
will be appreciated .

Thank you
~Umesh
_______________________________________________
LLVM Developers mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
Reply | Threaded
Open this post in threaded view
|

Re: [llvm-dev] Debug Info is not generated for extern variables .

Finkel, Hal J. via llvm-dev
Any idea why this is important compared to function declarations that I don't think any compiler emits (declarations of called but not defined non-member functions)?

I imagine in the function case, it's assumed that the function is defined elsewhere and the debug info for that definition will be available.

Why not the same with variables?

(admittedly, when we employ the "debug info is in another file" assumption, that should be done under -fno-standalone-debug - but I'm not sure how far we should take that assumption. Should we have debug info for declarations of functions?)

There's currently at least some code that supports emitting function declarations (for member functions) but not for variables (static member variables are 'members' rather than 'variables')

On Fri, May 17, 2019 at 9:21 AM Umesh Kalappa via llvm-dev <[hidden email]> wrote:
Hi All,

for the below case :
$cat test.c
extern void sharedLibTestLibRtn (int arg);
extern int testExt;
int main (void)
    {
    testExt++;
    sharedLibTestLibRtn (5);

    return 0;
    }
we don't see the debug-info for "testExt" i.e no DW_AT_type  entry for
extern symbol ,where gcc has the same .

we are  fixing  the same in clang as compatibility with gcc .

before we start our analysis on DIBuilder in clang ,any inputs here
will be appreciated .

Thank you
~Umesh
_______________________________________________
LLVM Developers mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev

_______________________________________________
LLVM Developers mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
Reply | Threaded
Open this post in threaded view
|

Re: [llvm-dev] Debug Info is not generated for extern variables .

Finkel, Hal J. via llvm-dev

I think emitting "testExt" as an external declaration (what gcc does) doesn't do much for the debugger; being a declaration, it has no location, and so you can't do things like examine its value, unless you find the symbol in the defining CU first.

 

I don't see a real "compatibility with gcc" argument here.  Is there some behavior of some consumer that is affected by this?

--paulr

 

From: David Blaikie [mailto:[hidden email]]
Sent: Friday, May 17, 2019 1:14 PM
To: Umesh Kalappa; Robinson, Paul; Adrian Prantl; Jonas Devlieghere
Cc: LLVM Developers Mailing List; [hidden email] Developers
Subject: Re: [llvm-dev] Debug Info is not generated for extern variables .

 

Any idea why this is important compared to function declarations that I don't think any compiler emits (declarations of called but not defined non-member functions)?

I imagine in the function case, it's assumed that the function is defined elsewhere and the debug info for that definition will be available.

Why not the same with variables?

(admittedly, when we employ the "debug info is in another file" assumption, that should be done under -fno-standalone-debug - but I'm not sure how far we should take that assumption. Should we have debug info for declarations of functions?)

There's currently at least some code that supports emitting function declarations (for member functions) but not for variables (static member variables are 'members' rather than 'variables')

 

On Fri, May 17, 2019 at 9:21 AM Umesh Kalappa via llvm-dev <[hidden email]> wrote:

Hi All,

for the below case :
$cat test.c
extern void sharedLibTestLibRtn (int arg);
extern int testExt;
int main (void)
    {
    testExt++;
    sharedLibTestLibRtn (5);

    return 0;
    }
we don't see the debug-info for "testExt" i.e no DW_AT_type  entry for
extern symbol ,where gcc has the same .

we are  fixing  the same in clang as compatibility with gcc .

before we start our analysis on DIBuilder in clang ,any inputs here
will be appreciated .

Thank you
~Umesh
_______________________________________________
LLVM Developers mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev


_______________________________________________
LLVM Developers mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
Reply | Threaded
Open this post in threaded view
|

Re: [llvm-dev] Debug Info is not generated for extern variables .

Finkel, Hal J. via llvm-dev
Paul,
We have the problem with gdb ,where testExt is defined in shared library and break in main and try "pt testExt" it say no debug info found.

~Umesh

_______________________________________________
LLVM Developers mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
Reply | Threaded
Open this post in threaded view
|

Re: [llvm-dev] Debug Info is not generated for extern variables .

Finkel, Hal J. via llvm-dev
Is there much value in being able to print the type of a variable without being able to otherwise interact with it?

On Fri, May 17, 2019 at 10:56 AM Umesh Kalappa <[hidden email]> wrote:
Paul,
We have the problem with gdb ,where testExt is defined in shared library and break in main and try "pt testExt" it say no debug info found.

~Umesh

_______________________________________________
LLVM Developers mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev