I was the author of the original proposal for DWARF source text
embedding, and my use case was OpenCL kernel code, which is often
generated at runtime. For debugging, this generated source needs to be
embedded in the binary in many cases since you may not have a writeable
file system, or a file system at all (this may seem like a niche case,
but is actually common in embedded and mobile OpenCL environments).
FWIW I'm happy to get behind this new proposal since there's already an
LLVM implementation and it seems to cover my use-cases.
On 14/02/18 00:45, Michael Eager wrote:
On 02/13/18 09:37, sc...@scottlinder.com wrote:
In the current proposal, it is not an error to have any value
empty string) in the _source attribute when the _has_source flag is
allows for embedding an empty source string.
After seeing more feedback on this point, I think you are right that
flag is unnecessary. Looking at similar attributes like MD5 and how
handled I think it would be best to modify the proposal to remove the
require the source be present on all files in the same line table if the
attribute is present in the prologue. I still think we should have
which indicates an empty string is still a valid value for embedded
should not be interpreted as indicating the absence of embedded
that file. This is analogous to the current MD5 attribute, as even 16
bytes is a valid MD5. What are your thoughts on this approach?
Are you saying that if any source file in embedded, that all need to be?
Including both ephemeral generated source as well as fixed include
What does it mean to have embedded source which is an empty string?
How is that different from saying that embedded source is absent?
I can imagine situations where embedding ephemeral generated source in a
DWARF debug entry can make sense. But I have the feeling that there is
more to this in your environment than what I imagine. Can you give a
description of the use case in which this might be used?
On 2018-02-01 17:20, Michael Eager wrote:
On 02/01/2018 12:01 PM, sc...@scottlinder.com wrote:
My intention was to support an empty source string; I want to be
explicit about the presence of embedded source for each file.
I'm not fond of the belt and suspenders approach. If there is one
specifier for an attribute, there's no need for a second to say that
it's valid. There's always the issue of what it means when the two
attributes disagree, such as when you have a flag saying that there
is embedded source, but the source string is empty. Is that an error?
When reading the spec I did notice places where an empty string can
indicate the absence of the attribute (e.g. DW_AT_name), but I
would prefer to be explicit here.
On 2018-02-01 11:19, paul.robin...@sony.com wrote:
Behalf Of sc...@scottlinder.com
Sent: Wednesday, January 31, 2018 2:05 PM
Subject: [Dwarf-Discuss] DWARF and source text embedding
I am a compiler engineer at AMD, working on tools for debugging
programs. The problem I am attempting to solve was brought up
DWARF Standard issue 161018.1 titled "DWARF-embedded source for
programs", and is the result of runtimes like OpenCL doing online
in an environment where it is not desireable (or even feasible)
sources to disk. In these cases, it would be useful to support
source directly in the resulting DWARF. I would like to propose a
solution to the one outlined in the above issue, but without
to the specification.
Add two new optional fields to the file_names prologue of the line
Add two bullets after "5. DW_LNCT_MD5"
DW_LNCT_has_source indicates that the value is a boolean which
interpretation of an accompanying DW_LNCT_source value. When
must be an accompanying DW_LNCT_source value. When true,
the embedded source instead of attempting to discover the
When false, consumers will ignore the DW_LNCT_source value.
is always paired with a flag form (e.g. DW_FORM_flag or
DW_LNCT_source indicates that the value is a null-terminated
is the original source text of the file. When present there
accompanying DW_LNCT_has_source value. The string will
encoded source text with '\n' line endings. When the
DW_LNCT_has_source value is false, the value of
empty string. This code point is always paired with a string
DW_FORM_string, DW_FORM_line_strp, DW_FORM_strp).
Would a zero-length string indicate something other than
If not, then a separate has_source flag seems redundant.
New type codes can be allocated for them in a
codes for these new content types can be added in the range of
[DW_LNCT_lo_user, DW_LNCT_hi_user] to avoid changing the spec
Add DW_LNCT_has_source 0x6
Add DW_LNCT_source 0x7
Any DWARFv5 consumer which is unaware of this extension would
operate as before, ignoring the new fields. Any consumer which is
extension would know to check DW_LNCT_has_source for each file_name
order to determine whether the embedded source field
the source text of the corresponding file.
My team and I believe this simplifies the design by removing the
changes to the compile unit sections, and by avoiding the
file_name_entry_formats in a single program, all without
information. We have a preliminary implementation in LLVM/Clang,
embedding source (clang -gdwarf-5 -gembed-source) and inspecting
llvm-dwarfdump and llvm-objdump (with the -source flag). The
available at https://reviews.llvm.org/D42765 (LLVM) and
I would like any and all feedback on the design, and want to see
possibility of adding the new content type codes outside of the
(i.e. adding new entries for them in Table 7.27) in the next
Dwarf-Discuss mailing list
Dwarf-Discuss mailing list
Senior Software Engineer, GPGPU Toolchains
Codeplay Software Ltd
Level C, Argyle House, 3 Lady Lawson St, Edinburgh, EH3 9DR
Tel: 0131 466 0503
Fax: 0131 557 6600
This email and any attachments may contain confidential and /or privileged
information and is for use by the addressee only. If you are not the intended
recipient, please notify Codeplay Software Ltd immediately and delete the
message from your computer. You may not copy or forward it, or use or disclose
its contents to any other person. Any views or other information in this
message which do not relate to our business are not authorized by Codeplay
software Ltd, nor does this message form part of any contract unless so stated.
As internet communications are capable of data corruption Codeplay Software Ltd
does not accept any responsibility for any changes made to this message after
it was sent. Please note that Codeplay Software Ltd does not accept any
liability or responsibility for viruses and it is your responsibility to scan
Company registered in England and Wales, number: 04567874
Registered office: Regent House, 316 Beulah Hill, London, United Kingdom, SE19
Dwarf-Discuss mailing list