This is almost a duplicate of C/C++: How to figure out the chain of header files for a given definition?, but the difference is that I do not use Visual Studio, in my case the platform is Unix-based and the tooling available are GCC and Clang toolchains.
Side notes. I think that this feature would require dynamic analysis of code - at least such a tool would need to know which conditional #ifdef-kind of macros to pick - but let's say I am able to provide these on the command line for example (or in a bash script) in the form of -DDEFINITIONS.
This is definitely possible if I deliberately make a mistake in the target include and rely on the compiler reporting an error to me of the form "in file A included form B, from C, .., from Z, there is a blabla-kind of mistake", but of course that would be an overkill if I need to use this feature fairly frequently.
Another side note. I am primarily interested in native Unix tools and those that are close to GCC or Clang toolchain. But if you know any other way, don't hesitate to suggest.