public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Getting DWARF codes from RTX
@ 2011-10-20  5:43 Iyer, Balaji V
  2011-10-20  8:13 ` Ian Lance Taylor
  0 siblings, 1 reply; 7+ messages in thread
From: Iyer, Balaji V @ 2011-10-20  5:43 UTC (permalink / raw)
  To: 'gcc@gcc.gnu.org'

Hello Everyone,
	Is there a function (or a series of functions) in GCC using which I can convert a register number (either in RTX or int) to DWARF code?

	Any help is greatly appreciated!


Thanks,

Balaji V. Iyer.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Getting DWARF codes from RTX
  2011-10-20  5:43 Getting DWARF codes from RTX Iyer, Balaji V
@ 2011-10-20  8:13 ` Ian Lance Taylor
  2011-10-20 14:41   ` Iyer, Balaji V
  0 siblings, 1 reply; 7+ messages in thread
From: Ian Lance Taylor @ 2011-10-20  8:13 UTC (permalink / raw)
  To: Iyer, Balaji V; +Cc: 'gcc@gcc.gnu.org'

"Iyer, Balaji V" <balaji.v.iyer@intel.com> writes:

> 	Is there a function (or a series of functions) in GCC using which I can convert a register number (either in RTX or int) to DWARF code?

Are you looking for DWARF_FRAME_REGNUM?

If not, what do you mean by DWARF code?  Do you mean inside gcc, or in
code compiled by gcc?  Please give an example.

Ian

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: Getting DWARF codes from RTX
  2011-10-20  8:13 ` Ian Lance Taylor
@ 2011-10-20 14:41   ` Iyer, Balaji V
  2011-10-20 18:59     ` Michael Eager
  2011-10-20 21:11     ` Ian Lance Taylor
  0 siblings, 2 replies; 7+ messages in thread
From: Iyer, Balaji V @ 2011-10-20 14:41 UTC (permalink / raw)
  To: Ian Lance Taylor; +Cc: 'gcc@gcc.gnu.org'

Hi Ian,
	What I want to do is to look at certain function calls and mark them with a special label and then create a table  with a specialized section with contains the label name, the function name (as ascii string) and then the dwarf code of the register (assuming the parameters can be passed in through registers, otherwise the stack address location) in which the parameters for the function is stored. (Please note that this is something that is customized for another package and I don't have much leeway on how to store this information)

Eg.

If you have:   
some_func_call (x, y, z)

We will have an assembly like this

	Set R1, x
	Set R2, y
	Set R3, z
LABEL_X:                        <=== SOMETHING I PUT IN
	Call some_func_call


In my data section I would have something like this:

LABEL_X 
some_func_call
DW_OP_REG1, DW_OP_REG2, DW_OP_REG3


So, I need the equivalent dwarf code (in hex) for DW_OP_REG1, DW_OP_REG2 and DW_OP_REG3, so that a dwarf decoder can decode it correctly.


Thanks,

Balaji V. Iyer.



-----Original Message-----
From: Ian Lance Taylor [mailto:iant@google.com] 
Sent: Thursday, October 20, 2011 2:03 AM
To: Iyer, Balaji V
Cc: 'gcc@gcc.gnu.org'
Subject: Re: Getting DWARF codes from RTX

"Iyer, Balaji V" <balaji.v.iyer@intel.com> writes:

> 	Is there a function (or a series of functions) in GCC using which I can convert a register number (either in RTX or int) to DWARF code?

Are you looking for DWARF_FRAME_REGNUM?

If not, what do you mean by DWARF code?  Do you mean inside gcc, or in code compiled by gcc?  Please give an example.

Ian

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Getting DWARF codes from RTX
  2011-10-20 14:41   ` Iyer, Balaji V
@ 2011-10-20 18:59     ` Michael Eager
  2011-10-20 21:11     ` Ian Lance Taylor
  1 sibling, 0 replies; 7+ messages in thread
From: Michael Eager @ 2011-10-20 18:59 UTC (permalink / raw)
  To: gcc

On 10/20/2011 06:53 AM, Iyer, Balaji V wrote:

> So, I need the equivalent dwarf code (in hex) for DW_OP_REG1, DW_OP_REG2 and DW_OP_REG3, so that a dwarf decoder can decode it correctly.

It's not clear what you mean by the dwarf code for DW_OP_REG1, etc.
Encoding for DW_OP_REG1, etc., is described in the Dwarf Standard on page 166.
See http://dwarfstd.org.

If you are looking for translation between gcc register numbers
and the Dwarf register numbers, look in dwarf2out.c.  Search for DBX_REGISTER_NUMBER.

-- 
Michael Eager	 eager@eagercon.com
1960 Park Blvd., Palo Alto, CA 94306  650-325-8077

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Getting DWARF codes from RTX
  2011-10-20 14:41   ` Iyer, Balaji V
  2011-10-20 18:59     ` Michael Eager
@ 2011-10-20 21:11     ` Ian Lance Taylor
  2011-10-20 22:46       ` Iyer, Balaji V
  1 sibling, 1 reply; 7+ messages in thread
From: Ian Lance Taylor @ 2011-10-20 21:11 UTC (permalink / raw)
  To: Iyer, Balaji V; +Cc: 'gcc@gcc.gnu.org'

"Iyer, Balaji V" <balaji.v.iyer@intel.com> writes:

> 	What I want to do is to look at certain function calls and mark them with a special label and then create a table  with a specialized section with contains the label name, the function name (as ascii string) and then the dwarf code of the register (assuming the parameters can be passed in through registers, otherwise the stack address location) in which the parameters for the function is stored. (Please note that this is something that is customized for another package and I don't have much leeway on how to store this information)
>
> Eg.
>
> If you have:   
> some_func_call (x, y, z)
>
> We will have an assembly like this
>
> 	Set R1, x
> 	Set R2, y
> 	Set R3, z
> LABEL_X:                        <=== SOMETHING I PUT IN
> 	Call some_func_call
>
>
> In my data section I would have something like this:
>
> LABEL_X 
> some_func_call
> DW_OP_REG1, DW_OP_REG2, DW_OP_REG3

OK, I think I mostly understand all that.

> So, I need the equivalent dwarf code (in hex) for DW_OP_REG1, DW_OP_REG2 and DW_OP_REG3, so that a dwarf decoder can decode it correctly.

I'm not sure I understand that.  The code for DW_OP_reg1 is 0x51, as you
can see in include/dwarf2.h.  But I don't think that is what you mean.

It sounds like you might be asking for a way to get the DWARF
representation of the argument locations of the function call.  See
loc_descriptor in gcc/dwarf2out.c.

Ian

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: Getting DWARF codes from RTX
  2011-10-20 21:11     ` Ian Lance Taylor
@ 2011-10-20 22:46       ` Iyer, Balaji V
  2011-10-21  6:09         ` Ian Lance Taylor
  0 siblings, 1 reply; 7+ messages in thread
From: Iyer, Balaji V @ 2011-10-20 22:46 UTC (permalink / raw)
  To: Ian Lance Taylor; +Cc: 'gcc@gcc.gnu.org'

Please see my comments embedded with "BVI>"

-----Original Message-----
From: Ian Lance Taylor [mailto:iant@google.com] 
Sent: Thursday, October 20, 2011 2:18 PM
To: Iyer, Balaji V
Cc: 'gcc@gcc.gnu.org'
Subject: Re: Getting DWARF codes from RTX

"Iyer, Balaji V" <balaji.v.iyer@intel.com> writes:

> 	What I want to do is to look at certain function calls and mark them 
> with a special label and then create a table  with a specialized 
> section with contains the label name, the function name (as ascii 
> string) and then the dwarf code of the register (assuming the 
> parameters can be passed in through registers, otherwise the stack 
> address location) in which the parameters for the function is stored. 
> (Please note that this is something that is customized for another 
> package and I don't have much leeway on how to store this information)
>
> Eg.
>
> If you have:   
> some_func_call (x, y, z)
>
> We will have an assembly like this
>
> 	Set R1, x
> 	Set R2, y
> 	Set R3, z
> LABEL_X:                        <=== SOMETHING I PUT IN
> 	Call some_func_call
>
>
> In my data section I would have something like this:
>
> LABEL_X
> some_func_call
> DW_OP_REG1, DW_OP_REG2, DW_OP_REG3

OK, I think I mostly understand all that.

> So, I need the equivalent dwarf code (in hex) for DW_OP_REG1, DW_OP_REG2 and DW_OP_REG3, so that a dwarf decoder can decode it correctly.

I'm not sure I understand that.  The code for DW_OP_reg1 is 0x51, as you can see in include/dwarf2.h.  But I don't think that is what you mean.

BVI> Actually what I want is to have a way to go from the rtx value e.g (REG: SI 1 di) to 0x51

It sounds like you might be asking for a way to get the DWARF representation of the argument locations of the function call.  See loc_descriptor in gcc/dwarf2out.c.

BVI> I will look into the loc descriptor. Thank you!

Ian

Thanks,

Balaji V. Iyer.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Getting DWARF codes from RTX
  2011-10-20 22:46       ` Iyer, Balaji V
@ 2011-10-21  6:09         ` Ian Lance Taylor
  0 siblings, 0 replies; 7+ messages in thread
From: Ian Lance Taylor @ 2011-10-21  6:09 UTC (permalink / raw)
  To: Iyer, Balaji V; +Cc: 'gcc@gcc.gnu.org'

"Iyer, Balaji V" <balaji.v.iyer@intel.com> writes:

> BVI> Actually what I want is to have a way to go from the rtx value e.g (REG: SI 1 di) to 0x51

That's just DW_OP_reg0 + DWARF_FRAME_REGNUM (REGNO (rtx)).  Assuming
REGNO (rtx) <= 31.

Ian

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2011-10-20 18:59 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-20  5:43 Getting DWARF codes from RTX Iyer, Balaji V
2011-10-20  8:13 ` Ian Lance Taylor
2011-10-20 14:41   ` Iyer, Balaji V
2011-10-20 18:59     ` Michael Eager
2011-10-20 21:11     ` Ian Lance Taylor
2011-10-20 22:46       ` Iyer, Balaji V
2011-10-21  6:09         ` Ian Lance Taylor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).