[PATCH] D120660: [llvm-symbolizer] Add --approximate-missing-line-numbers Command Line Option

Paul Robinson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 4 07:21:53 PST 2022


probinson added a comment.

I think the encoding of the line table may make it infeasible to walk backwards.  But perhaps the code that does interpret the line table could keep track of the most-recent-nonzero-line and return that in addition to (or instead of) zero, when the requested address does resolve to zero? If it's instead-of, the API would have to return an indication that it was approximated, so this could be displayed appropriately.

Adding to the argument for displaying an indication that the nonzero line is not exact:  When you're not looking at stack traces, but arbitrary addresses (e.g. the instruction that caused a trap, or something) it's also not implausible that the instruction is at the top of a basic block that starts off with line 0, and you don't actually know whether control flowed in from the previous block or there was a jump to it from somewhere else.  That makes the visible indication pretty important.

Re stack tracers should subtract one:  The failure to do this is exactly why PS4 (and we're not the only ones) set TrapUnreachable, to (for example) make sure there is an instruction after a `noreturn` call that happens to be laid out as the last block in a function, and that the "return address" of that `noreturn` function is not the first instruction of the physically next function.  Yes we could make this change in our own code, but we don't own all the code that does this kind of thing, so we choose to guarantee that the return address is at least symbolized into the correct function.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D120660



More information about the llvm-commits mailing list