Re: dwarf_block_to_fb_offset() and 64-bit host

Mark Kettenis <[email protected]>
Newsgroups gmane.comp.gdb.devel
Message-ID <[email protected]>
> Date: Sun, 25 Jan 2015 09:32:41 +0100
> From: Jan Kratochvil <[email protected]>
> 
> On Sun, 25 Jan 2015 08:58:13 +0100, Doug Evans wrote:
> > I guess the first question is: Is an fb_offset of -28 valid?
> > i.e., is a negative value valid?
> 
> It should not be for decreasing-sp archs (like x86*):
> 
> gdb.arch/amd64-entry-value:
>  <3><a90>: Abbrev Number: 8 (DW_TAG_GNU_call_site_parameter)
>     <a91>   DW_AT_location    : 2 byte block: 77 0      (DW_OP_breg7 (rsp): 0)
>                                                                             ^
>     <a94>   DW_AT_GNU_call_site_value: 1 byte block: 3b         (DW_OP_lit11)
>  <3><a96>: Abbrev Number: 8 (DW_TAG_GNU_call_site_parameter)
>     <a97>   DW_AT_location    : 2 byte block: 77 8      (DW_OP_breg7 (rsp): 8)
>                                                                             ^
>     <a9a>   DW_AT_GNU_call_site_value: 1 byte block: 3c         (DW_OP_lit12)
>  <3><a9c>: Abbrev Number: 8 (DW_TAG_GNU_call_site_parameter)
>     <a9d>   DW_AT_location    : 2 byte block: 77 10     (DW_OP_breg7 (rsp): 16)
>                                                                             ^^
>     <aa0>   DW_AT_GNU_call_site_value: 11 byte block: f4 31 8 0 0 0 0 0 0 27 40         (DW_OP_GNU_const_type: <0x31>  8 byte block: 0 0 0 0 0 0 27 40 )
>  <3><aac>: Abbrev Number: 8 (DW_TAG_GNU_call_site_parameter)
>     <aad>   DW_AT_location    : 2 byte block: 77 18     (DW_OP_breg7 (rsp): 24)
>                                                                             ^^
>     <ab0>   DW_AT_GNU_call_site_value: 11 byte block: f4 31 8 0 0 0 0 0 0 29 40         (DW_OP_GNU_const_type: <0x31>  8 byte block: 0 0 0 0 0 0 29 40 )
> 
> Despite its 'fb_offset' name it is an offset from SP so parameters should not
> be stored in the to-be-rewritten area under SP.

Well, some architectures (including amd64) reserve an area "beyond"
the stack pointer that can be used for temporary data (the "red zone"
on amd64).  Now the amd64 "red zone" might not be used for storing
entry values, but for leaf frames it could.  So I'd fb_offset should
be LONGEST instead of CORE_ADDR.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.