From gingold@adacore.com  Tue Mar  1 09:21:31 2011
From: gingold@adacore.com (Tristan Gingold)
Date: Tue, 1 Mar 2011 10:21:31 +0100
Subject: [Dwarf-Discuss] OP_fbreg within AT_frame_base, static or dynamic ?
Message-ID: <FD79281F-2D73-4854-987D-5A01A6B005C3@adacore.com>

Hi,

The DW_OP_fbreg has a meaning only within the context of DW_AT_frame_base.

My question is about the semantic on the 'within' (which doesn't appear in the standard): it is static or
dynamic.

Ie, is this dwarf CU valid ?
Note that the node <113> which uses OP_deref is not a child or a grand-child of node <74> which has the AT_frame_base.
Some debuggers only allow static imbrication, while some others allow dynamic one.

 <0><b>: Abbrev Number: 1 (DW_TAG_compile_unit)
    ...
 <1><74>: Abbrev Number: 2 (DW_TAG_subprogram)
    ...
    <92>   DW_AT_frame_base  : 0x0	(location list)
    ...
 <2><9a>: Abbrev Number: 3 (DW_TAG_formal_parameter)
    ...
 <2><a6>: Abbrev Number: 3 (DW_TAG_formal_parameter)
    ...
 <2><b2>: Abbrev Number: 4 (DW_TAG_variable)
    <b3>   DW_AT_name        : b	
    <b5>   DW_AT_decl_file   : 1	
    <b6>   DW_AT_decl_line   : 3	
    <b7>   DW_AT_type        : <0x10a>	
    <bb>   DW_AT_location    : 3 byte block: 91 50 6 	(DW_OP_fbreg: -48; DW_OP_deref)

 <1><102>: Abbrev Number: 9 (DW_TAG_base_type)
    <103>   DW_AT_byte_size   : 1	
    <104>   DW_AT_encoding    : 6	(signed char)
    <105>   DW_AT_name        : char	
 <1><10a>: Abbrev Number: 11 (DW_TAG_array_type)
    <10b>   DW_AT_type        : <0x102>	
 <2><113>: Abbrev Number: 12 (DW_TAG_subrange_type)
    <114>   DW_AT_type        : <0x11d>	
    <118>   DW_AT_upper_bound : 3 byte block: 91 58 6 	(DW_OP_fbreg: -40; DW_OP_deref) [without DW_AT_frame_base]
 <1><11d>: Abbrev Number: 9 (DW_TAG_base_type)
    <11e>   DW_AT_byte_size   : 8	
    <11f>   DW_AT_encoding    : 7	(unsigned)
    <120>   DW_AT_name        : long unsigned int	

(Maybe this question was already asked but I wasn't able to find the answer in the ml archives).

Regards,
Tristan.




From gingold@adacore.com  Tue Mar  1 09:23:39 2011
From: gingold@adacore.com (Tristan Gingold)
Date: Tue, 1 Mar 2011 10:23:39 +0100
Subject: [Dwarf-Discuss] OP_fbreg within AT_frame_base,
	static or dynamic ?
In-Reply-To: <FD79281F-2D73-4854-987D-5A01A6B005C3@adacore.com>
References: <FD79281F-2D73-4854-987D-5A01A6B005C3@adacore.com>
Message-ID: <32D030F7-1B4E-48C5-86B7-DB7C0A35775B@adacore.com>


On Mar 1, 2011, at 10:21 AM, Tristan Gingold wrote:

> Hi,
> 
> The DW_OP_fbreg has a meaning only within the context of DW_AT_frame_base.
> 
> My question is about the semantic on the 'within' (which doesn't appear in the standard): it is static or
> dynamic.
> 
> Ie, is this dwarf CU valid ?
> Note that the node <113> which uses OP_deref is not a child or a grand-child of node <74> which has the AT_frame_base.

Argh, typo:                           ****** OP_fbreg.
(sorry)

> Some debuggers only allow static imbrication, while some others allow dynamic one.
> 
> <0><b>: Abbrev Number: 1 (DW_TAG_compile_unit)
>    ...
> <1><74>: Abbrev Number: 2 (DW_TAG_subprogram)
>    ...
>    <92>   DW_AT_frame_base  : 0x0	(location list)
>    ...
> <2><9a>: Abbrev Number: 3 (DW_TAG_formal_parameter)
>    ...
> <2><a6>: Abbrev Number: 3 (DW_TAG_formal_parameter)
>    ...
> <2><b2>: Abbrev Number: 4 (DW_TAG_variable)
>    <b3>   DW_AT_name        : b	
>    <b5>   DW_AT_decl_file   : 1	
>    <b6>   DW_AT_decl_line   : 3	
>    <b7>   DW_AT_type        : <0x10a>	
>    <bb>   DW_AT_location    : 3 byte block: 91 50 6 	(DW_OP_fbreg: -48; DW_OP_deref)
> 
> <1><102>: Abbrev Number: 9 (DW_TAG_base_type)
>    <103>   DW_AT_byte_size   : 1	
>    <104>   DW_AT_encoding    : 6	(signed char)
>    <105>   DW_AT_name        : char	
> <1><10a>: Abbrev Number: 11 (DW_TAG_array_type)
>    <10b>   DW_AT_type        : <0x102>	
> <2><113>: Abbrev Number: 12 (DW_TAG_subrange_type)
>    <114>   DW_AT_type        : <0x11d>	
>    <118>   DW_AT_upper_bound : 3 byte block: 91 58 6 	(DW_OP_fbreg: -40; DW_OP_deref) [without DW_AT_frame_base]
> <1><11d>: Abbrev Number: 9 (DW_TAG_base_type)
>    <11e>   DW_AT_byte_size   : 8	
>    <11f>   DW_AT_encoding    : 7	(unsigned)
>    <120>   DW_AT_name        : long unsigned int	
> 
> (Maybe this question was already asked but I wasn't able to find the answer in the ml archives).
> 
> Regards,
> Tristan.




From roland@redhat.com  Tue Mar  1 16:55:22 2011
From: roland@redhat.com (Roland McGrath)
Date: Tue,  1 Mar 2011 08:55:22 -0800 (PST)
Subject: [Dwarf-Discuss] OP_fbreg within AT_frame_base,
	static or dynamic ?
In-Reply-To: Tristan Gingold's message of  Tuesday, 1 March 2011 10:21:31 +0100
	<FD79281F-2D73-4854-987D-5A01A6B005C3@adacore.com>
References: <FD79281F-2D73-4854-987D-5A01A6B005C3@adacore.com>
Message-ID: <20110301165522.B0AC8182FC2@magilla.sf.frob.com>

DWARF in general is not so narrowly specified that this kind of issue falls
into a "clearly valid" or "clearly invalid" category.  I think it is
adequately unambiguous what that construct means, and that is usually good
enough in the DWARF world.

A type is used in a particular context.  That is, it's the type of some
object like a variable, and that object description exists in a context
such as being local to a function.  When you use the type, you are using it
in a specific context such as a given call frame.  A type such as this has
details that are dependent on its call frame context, so it would be a
dynamic error to attempt to use it without an associated call frame.
Since it uses DW_OP_fbreg, it can only be used in the context of a call
frame where DW_AT_frame_base is defined.


Thanks,
Roland



From gingold@adacore.com  Wed Mar  2 09:09:55 2011
From: gingold@adacore.com (Tristan Gingold)
Date: Wed, 2 Mar 2011 10:09:55 +0100
Subject: [Dwarf-Discuss] OP_fbreg within AT_frame_base,
	static or dynamic ?
In-Reply-To: <20110301165522.B0AC8182FC2@magilla.sf.frob.com>
References: <FD79281F-2D73-4854-987D-5A01A6B005C3@adacore.com>
	<20110301165522.B0AC8182FC2@magilla.sf.frob.com>
Message-ID: <31268E73-A380-432F-94B2-8DB7F0ED87DF@adacore.com>


On Mar 1, 2011, at 5:55 PM, Roland McGrath wrote:

> DWARF in general is not so narrowly specified that this kind of issue falls
> into a "clearly valid" or "clearly invalid" category.  I think it is
> adequately unambiguous what that construct means, and that is usually good
> enough in the DWARF world.

Great, but these kinds of ambiguous meanings lead to incompatible tools.
(and in this particular case, this is easily fixable.  Maybe I can propose
 a change ?)

> A type is used in a particular context.  That is, it's the type of some
> object like a variable, and that object description exists in a context
> such as being local to a function.  When you use the type, you are using it
> in a specific context such as a given call frame.  A type such as this has
> details that are dependent on its call frame context, so it would be a
> dynamic error to attempt to use it without an associated call frame.
> Since it uses DW_OP_fbreg, it can only be used in the context of a call
> frame where DW_AT_frame_base is defined.

So, you agree to allow non-static context.

Thanks,
Tristan.




From eager@eagercon.com  Wed Mar  2 15:47:12 2011
From: eager@eagercon.com (Michael Eager)
Date: Wed, 02 Mar 2011 07:47:12 -0800
Subject: [Dwarf-Discuss] OP_fbreg within AT_frame_base,
 static or dynamic ?
In-Reply-To: <31268E73-A380-432F-94B2-8DB7F0ED87DF@adacore.com>
References: <FD79281F-2D73-4854-987D-5A01A6B005C3@adacore.com>	<20110301165522.B0AC8182FC2@magilla.sf.frob.com>
	<31268E73-A380-432F-94B2-8DB7F0ED87DF@adacore.com>
Message-ID: <4D6E6680.2010806@eagercon.com>

Tristan Gingold wrote:
> On Mar 1, 2011, at 5:55 PM, Roland McGrath wrote:
> 
>> DWARF in general is not so narrowly specified that this kind of issue falls
>> into a "clearly valid" or "clearly invalid" category.  I think it is
>> adequately unambiguous what that construct means, and that is usually good
>> enough in the DWARF world.
> 
> Great, but these kinds of ambiguous meanings lead to incompatible tools.
> (and in this particular case, this is easily fixable.  Maybe I can propose
>  a change ?)

Please submit any proposed changes at http://dwarfstd.org/Comment.php.


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



