[PATCH] D147506: [DebugLine] save one debug line entry for empty prologue

David Blaikie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 19 14:01:56 PDT 2023


dblaikie added a comment.

In D147506#4279131 <https://reviews.llvm.org/D147506#4279131>, @shchenz wrote:

>> do other assemblers reproduce this information?
>
> I agree with you that some assembler, like GAS on Linux will generate zero-length ranges in the line table if no instructions between two `.loc`. I guess this can also be improved in these producers like what we did here in compiler?

My concern is that we should possibly have a more general solution in the compiler - this patch is touching specific prologue handling code, but I think we should fix this generally, so that we never produce zero length entries no matter where they come from. (with the exception that we /might/ need to preserve them when we're assembling from user assembly for consistency with GAS, for instance - maybe someone's relying on it - but for our own internal uses (when using LLVM's integrated assembler in... an integrated manner) we should skip zero length entries - or, maybe, even at a higher level - like we should ensure we don't emit zero length .loc directives even if we're emitting assembly - but again, I'd hope that would be a general solution, not finding the spots (like prologue emission) where we happen to be creating zero length entries today - that the solution should be more general/robust/lower level)

> And on AIX where this patch is motivated, the system assembler does not have pseudo like `.loc`, it can only get debug line info in the `.dwline` section, see case `llvm/test/DebugInfo/XCOFF/empty.ll`. So on AIX, I think the debug lines should be always generated by compiler in the assembly file.

I don't understand this, sorry. You mean on AIX the compiler produces the line table directly with the .byte directives, etc?Not sure how that relates to this issue..

>> Does anyone care if we preserve it or drop it?
>
> Hmm, at least DBX cares about the zero-length ranges since it assumes the addresses in the debug line entries are always incremental. And I also tested on GDB, seems no behavior change with/without this patch. Since this patch does some small optimization in the debug line section, so I think we should use this patch for all debuggers?

Yeah, I'm good with it being used for all tools/debuggers - but I think the solution should be more general, especially if your debugger has real trouble with these zero length entries - fixing each case of zero length entries as they're found seems not good, and we should have a general solution so it's not possible to create these zero length entries.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D147506/new/

https://reviews.llvm.org/D147506



More information about the llvm-commits mailing list