[PATCH] D105469: [Debug-Info] [llvm-dwarfdump] Don't treat DW_FORM_data4/8 to be section offsets in DWARF3.

ChenZheng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 7 01:54:51 PDT 2021


shchenz added a comment.

> This means that DW_AT_byte_size can never point to a location list, and it was a bug to have it say it could (similarly for at least DW_AT_bit_size, and we probably should re-review the entire list). I suppose as an extension it could point to a location list, which would allow different size values based on the current execution address, although the only case I'm familiar with would derive the size from a variable, and so not have to have an actual location list.

`DW_AT_byte_size` can not be a pointer to a location list, but it could be a `exprloc`/`block` kind location, so I guess it is ok to return true for `DW_AT_byte_size` in function `mayHaveLocationDescription()`. That function seems check for location descriptions for both `exprloc`/`block` kind location and also a location in `.debug_loc` section. See the function `dumpLocation()` when `mayHaveLocationDescription()` returns true.

Maybe a more clear way is to add a new function to check `loclistptr` related attributes and a new function to dump locations related to `loclistptr`?

> DW_AT_data_member_location is another story; FORM_data4/data8 are supposed to be interpreted as location-list pointers in DWARF 2 and 3. I think the post-commit comments in D58698 <https://reviews.llvm.org/D58698> suggest that we could always have a version, and I doubt we'll get this completely sorted out until DWARFFormValue requires it.

For `DW_AT_data_member_location` at DWARF3(default DWARF version for XCOFF), seems now we can not tell if the FORM_data4/data8 are for `loclistptr` or for `constant`. for the test case `formclass3-atmemloc.s`, it is a constant, so making it as location offset to the `.debug_loc` causes `llvm-dwarfdump` emit error message, I think we need to fix this. But if we always treat it as constant will also cause issue if the value is indeed an offset to `.debug_loc`. Maybe we have to find a way to differentiate FORM_data4/data8 for `loclistptr` and FORM_data4/data8 for `constant`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D105469



More information about the llvm-commits mailing list