debug information for functions

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

debug information for functions

vasudev
Suppose I have fun.h as:

 

static  void fun() {

  int a =10;

}

 

Now I have two files foo.c and goo.c as

foo.c :

#include "fun.h"

void foo()

{

  fun();

}

 

goo.c:

#include "fun.h"

void goo()

{

  fun();

}

 

I get .bc files for foo.c and foo.bc through clang. Now I run llvm-ld
with -disable-opt for foo.bc and goo.bc. In the resulting .bc files, one
of the two functions fun, is renamed to fun<number>. There are two
llvm.dbg.subprogram descriptors created for the two fun functions. Both
have name foo . So there is no way to know which descriptor represents
which function. I am trying to get this information in assembly printer.

 


Proposed solution :  llvm.dbg.subprogram.type should have a reference to
function is represents. This is in the same way as
llvm.dbg.global_variable.type has a reference to global variable it
represents.

 

Thanks

Vasudev


_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

winmail.dat (7K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: debug information for functions

Alireza.Moshtaghi

I would assume this is similar to the problem of dealing with structure tags, and I guess your proposal is along lines of the same solution right?

 

A.

 


From: [hidden email] [mailto:[hidden email]] On Behalf Of [hidden email]
Sent: Monday, June 08, 2009 3:25 AM
To: [hidden email]
Subject: debug information for functions

 

Suppose I have fun.h as:

 

static  void fun() {

  int a =10;

}

 

Now I have two files foo.c and goo.c as

foo.c :

#include “fun.h”

void foo()

{

  fun();

}

 

goo.c:

#include “fun.h”

void goo()

{

  fun();

}

 

I get .bc files for foo.c and foo.bc through clang. Now I run llvm-ld with –disable-opt for foo.bc and goo.bc. In the resulting .bc files, one of the two functions fun, is renamed to fun<number>. There are two llvm.dbg.subprogram descriptors created for the two fun functions. Both have name foo . So there is no way to know which descriptor represents which function. I am trying to get this information in assembly printer.

                                                                                                                          

Proposed solution :  llvm.dbg.subprogram.type should have a reference to function is represents. This is in the same way as llvm.dbg.global_variable.type has a reference to global variable it represents.

 

Thanks

Vasudev


_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: debug information for functions

Devang Patel-2
In reply to this post by vasudev
On Mon, Jun 8, 2009 at 3:25 AM, <[hidden email]> wrote:
>
> I get .bc files for foo.c and foo.bc through clang. Now I run llvm-ld
> with -disable-opt for foo.bc and goo.bc. In the resulting .bc files, one
> of the two functions fun, is renamed to fun<number>. There are two
> llvm.dbg.subprogram descriptors created for the two fun functions. Both
> have name foo . So there is no way to know which descriptor represents
> which function. I am trying to get this information in assembly printer.

What is the use of this info ? The descriptor includes enough location
info (thru func.start) and the display name for static functions.

-
Devang
_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: debug information for functions

vasudev
-----Original Message-----
From: [hidden email] [mailto:[hidden email]]
On Behalf Of Devang Patel
Sent: Monday, June 08, 2009 11:03 PM
To: LLVM Developers Mailing List
Subject: Re: [LLVMdev] debug information for functions

On Mon, Jun 8, 2009 at 3:25 AM, <[hidden email]> wrote:
>
> I get .bc files for foo.c and foo.bc through clang. Now I run llvm-ld
> with -disable-opt for foo.bc and goo.bc. In the resulting .bc files,
one
> of the two functions fun, is renamed to fun<number>. There are two
> llvm.dbg.subprogram descriptors created for the two fun functions.
Both
> have name foo . So there is no way to know which descriptor represents
> which function. I am trying to get this information in assembly
printer.

What is the use of this info ? The descriptor includes enough location
info (thru func.start) and the display name for static functions.

-
Devang

We are not using Dwarf writer. We are emitting debug info in coff
format. I need the file in which function is defined to emit .file
directive. MachineFunction has DefaultDebugLoc but it gets set only in
the case of -O0.
I can get the DebugLoc from machine instruction but that will be an ugly
way to do it.



_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev