It is demonstrated that x-ray waveguide structures can be used for depth profiling of a marker layer inside the guiding layer with an accuracy of better than 0.2 nm. A combination of x-ray fluorescence and x-ray reflectivity measurements can provide detailed information about the structure of the guiding layer. The position and thickness of the marker layer affect different aspects of the angle-dependent x-ray fluorescence pattern, thus making it possible to determine the structure of the marker layer in an unambiguous manner. As an example, effects of swift heavy ion irradiation on a Si/ M / Si trilayer ͑M = Fe, W͒, forming the cavity of the waveguide structure, have been studied. It is found that in accordance with the prediction of thermal spike model, Fe is much more sensitive to swift heavy ion induced modifications as compared to W, even in thin film form. However, a clear evidence of movement of the Fe marker layer towards the surface is observed after irradiation, which cannot be understood in terms of the thermal spike model alone.