On Wed, Feb 28, 2024 at 4:54 PM Jakub Jelinek <ja...@redhat.com> wrote: > > Hi! > > Adding Hongtao and Honza into the loop as the ones who acked the original > patch. > > The no_callee_saved_registers by default for noreturn functions change can > break in-process backtrace(3) or backtraces from debugger or other process > (quite often, any time the noreturn function decides to use the bp register > and any of the parent frames uses a frame pointer; the unwinder just crashes > in the libgcc unwinder case, gdb prints stack corrupted message), so I'd > like to save bp register in that case: > > https://gcc.gnu.org/pipermail/gcc-patches/2024-February/646591.html I think this patch makes sense and LGTM, we save and restore frame pointer for noreturn. > > and additionally the no_callee_saved_registers by default for noreturn > functions change can make debugging harder, again not localized to the > noreturn function, but any of its callers. So, if say glibc abort function > implementation needs a lot of normally callee-saved registers, no matter how > users recompile their apps, they will see garbage or optimized out > vars/parameters in their code unless they rebuild their glibc with -O0. > So, I think we should guard that by a non-default option: > > https://gcc.gnu.org/pipermail/gcc-patches/2024-February/646649.html So it turns off the optimization for noreturn functions by default, I'm not sure about this. Any comments, H.J? > > Plus we need to somehow make sure to emit DW_CFA_undefined for the modified > but not saved normally callee-saved registers, so that we at least don't get > garbage in debug info. H.J. posted some patches for that, so far I wasn't > happy about the implementation but the actual change is desirable. > > Your thoughts on this? > > Jakub >
-- BR, Hongtao