[llvm-dev] [debug-info] Stack pointer based variable locations

via llvm-dev llvm-dev at lists.llvm.org
Fri May 7 05:23:28 PDT 2021


Orlando said:
> David said:
> > Looks like GCC manages to use DW_OP_fbreg for the example given, which
> > looks like it works/is correct despite the the pushes/pops (because
> > it's rbp, I guess - base pointer rather than stack pointer). Perhaps
> > we could do something like that too, in cases like this?
> 
> RBP isn't used as a frame pointer in 'example' when building with gcc
> (7.5.0) or clang
> (71597d40e878). It looks like gcc is able to use DW_OP_fbreg because it
> sets DW_AT_frame_base in the
> parent DIE to DW_OP_call_frame_cfa. Is there anything stopping us from
> doing the same?

If there is debug info, there is a .debug_frame/.eh_frame, so we should
be able to use that.  The frame section already accounts for stack pointer
adjustments so it should Just Work.  Give it a go!

Pawel said:
> If its really so, if i could, id vote for implementing full debuginfo
> as default and maybe left optimized path as optional. If that matters
> to anyone. It will help in tracking locals while debugging.

Improving debug info for optimized code is an explicit goal, at least
for Sony, and I believe for others.  Any situation where you have code
handling real-time (which includes video games, embedded software, and
others) it is frequently impractical to compile un-optimized and have
the code still meet its real-time requirements.  Obviously once you 
have hit a breakpoint, you have left the real-time world, but it's
commonly the case that you have to meet real-time requirements until
you get to that breakpoint.

--paulr



More information about the llvm-dev mailing list