Re: [Dwarf-discuss] Request for clarification of handling stack-passed parameters

2024-06-18 Thread Sergey via Dwarf-discuss
I have created the appropriate issues in case anyone is interested:
clang not generating stack-passed parameters: 
https://github.com/llvm/llvm-project/issues/94986
clang skipping and intermingling parameters: 
https://github.com/llvm/llvm-project/issues/95645
GCC not generating stack-passed parameters: 
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115543
On Jun 14, 2024 at 9:37 PM +0300, Robinson, Paul , 
wrote:
> The spec does say they occur in the same order, which strongly implies that 
> there is a DW_TAG_call_site_parameter for each actual parameter. Although, 
> now that I say that, I have a memory of some discussion where a parameter 
> entry might be omitted entirely. I don’t remember the details, but Jakub 
> probably does. The spec does not clearly say that parameter entries can be 
> omitted, though.
> --paulr
>
> From: Sergey 
> Sent: Friday, June 14, 2024 1:12 PM
> To: dwarf-discuss@lists.dwarfstd.org; Robinson, Paul 
> Subject: RE: [Dwarf-discuss] Request for clarification of handling 
> stack-passed parameters
>
> In that case I shall create appropriate issues for the mentioned compilers in 
> order to discuss the matter with them.
>
> I think I have found another issue with clang. In some cases it does not 
> generate middle parameters: namely, it skipped the 2nd one yet included the 
> 3rd one.
> It believe it does not match the standard (p91 line 6-7): "Call site 
> parameter entries occur in the same order as the corresponding parameters in 
> the source.", does it?
> On Jun 14, 2024, 15:11 +0300, Robinson, Paul , wrote:
>
> > I believe this is an issue with the implementations, although it is a bit 
> > odd that both gcc and clang behave the same way. There should be a 
> > DW_TAG_call_site_parameter for each parameter. DW_AT_location should 
> > describe the stack slot where the parameter is passed. It should not be a 
> > problem for the compiler to do that, the location description would be 
> > evaluated in the context of the caller.
> > --paulr
> >
> > From: Dwarf-discuss 
> >  On Behalf 
> > Of Sergey via Dwarf-discuss
> > Sent: Wednesday, June 12, 2024 9:57 AM
> > To: dwarf-discuss@lists.dwarfstd.org
> > Subject: [Dwarf-discuss] Request for clarification of handling stack-passed 
> > parameters
> >
> > # Request for clarification of handling stack-passed parameters
> >
> > ## Background
> >
> > I came across this while parsing parameters of a variadic function in C. 
> > Formal parameters are not sufficient for my case, since all the variadic 
> > arguments are described with a single `DW_TAG_unspecified_parameters`, 
> > whereas reading `DW_TAG_call_site_parameter` allows to get their locations 
> > and values.
> >
> > ## Overview
> >
> > When generating a DWARF5 of a C function with **more than 6** parameters, 
> > the generated `DW_TAG_call_site` contains only **first 6** 
> > `DW_TAG_call_site_parameter`s (function's `DW_TAG_formal_parameter`s 
> > contain all of them).
> >
> > Something I have noticed is that the parameters, which do not get 
> > `DW_TAG_call_site_parameter` generated, are all **passed through 
> > stack**(whereas first 6 through registers), as evident by function's 
> > `DW_TAG_formal_parameter`'s `DW_AT_location` containing `DW_OP_fbreg`.
> >
> > ## Request for clarification
> >
> > It happens both with gcc and clang, however I was unable to find any 
> > information in the standard regarding generation of only registed-passed 
> > parameters.
> >
> > I request clarification on whether it is an issue with implementations, or 
> > is there something in the standard which justifies the described behaviour.
-- 
Dwarf-discuss mailing list
Dwarf-discuss@lists.dwarfstd.org
https://lists.dwarfstd.org/mailman/listinfo/dwarf-discuss


[Dwarf-discuss] Proposal for DW_AT_rnglists_base table F.1

2024-06-18 Thread David Anderson via Dwarf-discuss

BACKGROUND:
References are to DWARF5 unless otherwise indicated.

The basic issue is that .debug_rnglists is sometimes
mentioned as being part of a split-full compilation
unit and yet other places say that is incorrect.
In other words the standard conflicts with itself.

There is clarity in Sec 3.1.2 Skeleton Compil...
Page 66,67:
(lists a few attributes, not including
DW_AT_rnglists_base)
"All other attributes of a compilation unit
entry are placed in the split full compilation unit."
(comment: this makes Table F.1 incorrect)

Sec 3.1.3 says DW_AT_rnglists_base is inherited
from the skeleton. That is wrong and corrected
in DW6.

Table F.1
DW5 has no check mark for DW_AT_rnglists_base
in Skelton or Split Full
Wrong.

Table F.1
DW6 has check mark for DW_AT_rnglists_base
in Skeleton but not Split Full.
Wrong.


PROPOSAL:

Table F.1, for DW_AT_rnglists_base
should have:
No check-mark for Skeleton.
One check-mark for Split Full.
(the check-mark for Full & Partial
is correct in DW5 and DW6)



David Anderson
--
Dwarf-discuss mailing list
Dwarf-discuss@lists.dwarfstd.org
https://lists.dwarfstd.org/mailman/listinfo/dwarf-discuss


[Dwarf-discuss] Proposal: rnglists_base missing

2024-06-18 Thread David Anderson via Dwarf-discuss

BACKGROUND:
References are to DWARF5 unless otherwise indicated.


If a split-full CU uses DW_FORM_rnglistx
is a DW_AT_rnglists_base required?
Apparently not, though
in cases I have seen in object files are instances
of a single rnglist in .debug_rnglists.dwo .
The operative assumption is consumers will
simply assume zero as the (missing)
DW_AT_rnglists_base.

Seen in llvm and gcc.

The intent of this proposal is to get clarity.

An alternative version could state
If a Split Full Compilation Unit
refers to .debug_rnglists.dwo
with  DW_FORM_rnglistx
the CU DIE must have a DW_AT_rnglists_base
attribute.


PROPOSAL:

At the end Sec F.1 Overview just before
Table F.1:

If a Split Full Compilation Unit
refers to .debug_rnglists.dwo
with  DW_FORM_rnglistx
and the correct DW_AT_rnglists_base
would be zero, the DW_AT_rnglists_base
may be omitted.

David Anderson
--
Dwarf-discuss mailing list
Dwarf-discuss@lists.dwarfstd.org
https://lists.dwarfstd.org/mailman/listinfo/dwarf-discuss