[PATCH] D38237: [dwarfdump] Add support for -debug-loc=OFFSET

Jonas Devlieghere via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 26 15:30:58 PDT 2017


JDevlieghere added a comment.

In https://reviews.llvm.org/D38237#880163, @dblaikie wrote:

> That test case looks really long... - could it be a bit more terse?


I've updated the test with the most minimal thing I could come up with, but let me know if you have an idea to further reduce it.

> Also is there a reasonable chance to modify the APIs here so only the loc contribution that's being dumped is parsed, rather than parsing them all and dumping one of them?

I have some code that uses `parseOneLocationList(DataExtractor Data, unsigned *Offset)` to do this. This is a good solution for valid offsets, but not so much for invalid offsets as it is incremented based on the previously parsed amount of bytes. I have a few concerns about this though:

- We currently prints errors when we can't parse the section. Would we display them conditionally? (e.g. during regular parsing but not during parsing for dumping)
- I don't know how likely this scenario is, but what if an invalid offset causes the data to be accidentally parsable?

If we move forward with this approach, I'd recommend doing it in in a separate differential as it will mostly build on top of the changes in this patch. (I'm thinking about the tests, the changes in dump method, and we could even keep the current approach as fallback)


Repository:
  rL LLVM

https://reviews.llvm.org/D38237





More information about the llvm-commits mailing list