[Lldb-commits] [PATCH] D70745: [LLDB] [PECOFF] Look for the truncated ".eh_fram" section name

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Nov 27 01:37:19 PST 2019


labath added a comment.

In D70745#1761392 <https://reviews.llvm.org/D70745#1761392>, @mstorsjo wrote:

> > As for the long if-else cascade, the equivalent elf code was recently refactored to use llvm::StringSwitch. Doing the same here would be nice.
>
> A StringSwitch sounds nice. Some of the cases come with extra conditions (header flags and checking section sizes) though - is it best to keep that as is, if the StringSwitch didn't match anything?


I don't really know what are the conventions in the COFF world (you probably know that better), but I would tend to trust the section flags *more* than any name-based deductions. So I'd try to factor this such (and this is what I've done in the elf case) to do the section flag checks first, and only then fall back to the section names. The checks for the size 0 in data vs. bss sections looks weird to me, and I don't know if its really needed, but if you think it is, then it's probably best to pull that those cases out separately.

> As for @amccarth's suggestion on generically checking for truncated forms, I guess that's not doable with a StringSwitch, but would require e.g. creating more of an ad-hoc table, that we could iterate over, checking for both full and truncated matches? Does that sound sensible to you?

If you think it's good to check the truncated name on all sections, then yes, some kind of a table would probably be nice. If it's just one or two cases, then you can just spell out both forms in the StringSwitch (`.Cases(".eh_frame", ".eh_fram", eSectionTypeEHFrame)`


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70745





More information about the lldb-commits mailing list