This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Indicating function exit points in debug data
* Justin Paston-Cooper:
> On Tue, 19 Mar 2019 at 21:52, Florian Weimer <fw@deneb.enyo.de> wrote:
>>
>> * Justin Paston-Cooper:
>>
>> > On Tue, 19 Mar 2019 at 21:29, Florian Weimer <fw@deneb.enyo.de> wrote:
>> >>
>> >> * Justin Paston-Cooper:
>> >>
>> >> > Tom Tromey suggested in that thread that this would be quite easy on
>> >> > gdb's side if gcc indicates exit locations in the DWARF data, for
>> >> > instance in the C case, it would indicate the locations of return
>> >> > statements. On a related note, he mentions that the "finish" command
>> >> > does not work for inlined functions because the compiler does not emit
>> >> > the required information.
>> >>
>> >> What about calls to noreturn functions? I assume they would need
>> >> breakpoints as well. It could be tricky if those are only called
>> >> indirectly, I assume.
>> >
>> > Couldn't the brace following the final line of an inlined noreturn
>> > function be viewed as its exit point and be indicated in the DWARF
>> > information accordingly?
>>
>> That breakpoint would never be reached.
>
> Then if the break on exit command would break on return statements of
> functions which return, then it could break on the final statement of
> a noreturn?
There's no final statement in a noreturn function because it will
never return. It either has an endless loop, or it calls another
noreturn function (which is at a certain point opaque to the compiler)
which never returns.
Sorry, I have a fealing we are talking past each other. With
“noreturn function”, I mean a function that is annotated with the
noreturn attribute:
<https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-noreturn-function-attribute>