On Wed, Nov 15, 2017 at 05:05:36AM -0200, Alexandre Oliva wrote: > debug info: partial noentry functions: infra > > This is the first patch of a set that addresses two different but > somewhat related issues. > > On the one hand, after partial inlining, the non-inlined function > fragment is output in a way that debug info consumers can't distinguish > from the entire function: debug info lists the entire function as > abstract origin for the fragment, but nothing that indicates the > fragment does not stand for the entire function. So, if a debugger is > asked to set a breakpoint at the entry point of the function, it might > very well set one at the entry point of the fragment, which is likely > not where users expect to stop. > > On the other hand, OpenMP blocks are split out into artificial functions > that do not indicate their executable code is part of another function. > The artificial functions are nested within the original function, but > that's hardly enough: ideally, debug info consumers should be able to > tell that, if they stop within one of these functions, they're > abstractly within the original function. > > This patch introduces a new DWARF attribute to indicate that a function > is a partial copy of its abstract origin, specifically, that its entry > point does not correspond to the entry point of the abstract origin. > This attribute can then be used to mark the out-of-line portion of > partial inlines, and OpenMP blocks split out into artificial functions.
I'm not sure I like the attribute name too much, and more importantly, as I said before, I think the attribute should not be a flag, but a number which tells not just that it is an outlined portion of the original subprogram, but also what kind of outlining it is and its purpose. For the name, I wonder if instead of DW_AT_GNU_partial_noentry it wouldn't be better to use e.g. one of: DW_AT_GNU_partial DW_AT_GNU_partial_subprogram DW_AT_GNU_fragment DW_AT_GNU_subprogram_fragment As for the values I'd like to see (see e.g. DW_AT_calling_convention and corresponding DW_CC_* values and many other examples): 1) 0 value representing a default false, that the DW_TAG_subprogram is not any kind of subprogram fragment 2) some value for partial inlining, perhaps two if we want to mark both fragments of the inline created by partial inlining - the entry fragment and the outlined rest of the function 3) OpenMP outlined parallel region 4) OpenMP outlined task region 5) OpenMP outlined target region 6) OpenACC outlined kernels region 7) OpenACC outlined parallel region Thus we would have DW_GNU_PARTIAL_* constants in some enum that we'd use here. Of course, the single DECL_FUNCTION_PARTIAL_COPY bit wouldn't be enough to cover these cases, but I guess we could add an attribute with a space in the name if this bit is set to say which of those it is (or just use the attribute unconditionally and don't reserve a bit for that)? The advantage of having more details is that the debug info consumer can then decide how to handle, say talk to OMPD to find out the parent thread, or look it up inside of libgomp (say through infinity notes), whatever. And we could in the future add other kinds if we start outlining for other reasons. Jakub