I'll took an example to try to be clearer. Let's say that I devtool modify the glib-2.0 package. Without any configuration, sources will be extracted in ${BDIR}/workspace/sources/glib-2.0. Build directory is set by externalsrc.bbclass to ${BDIR}/tmp/work/${arch}-${distro}/glib-2.0/${PN}/${EXTENDPE}${PV}-${PR}/${BPN}/${BPN}-${PV} (the real path doesn't matter, what is matter is that B is not under devtool spaces).
This lead to have pretty long relative path in gcc compilation line (sotheming like -c ../../../../../../../../worspace/sources/glib-2.0/glib/gmain.c for example). Hence the debug-prefix-map could not be appplied. After the compilation stage, package.bbclass (via splitdebuginfo), there is an extraction of sources path via dwarf format parsing. We ended up parsing something like
I patch externalsrc.bbclass to dynamically caculate correct debug-prefix-map and prepend to DEBUG_PREFIX_MAP variable, I also patch the package.bbclass to add a condition when EXTERNALSRC is defined to change the way the sources are found and copied to packages-split/${pkg}-src.
I would greatly appreciate if there is a yocto guru around there to tell me what he thinks about all of this (bug or wrong configuration ?) and if my assumptions are correct (I assume this was a compiling/packaging problem instead of a pure devtool one)