Just wanted to say how I solved this in case other people find it useful.
I had to modify the xhprof source in the end, but it was a small change.
In xhprof.c, find a function called *hp_get_function_name and add the following to the list of variables right at the beginning after "int len;" :
char *finalName = NULL;
int finalLen;
Then right at the end of that function, swap the line that says "return ret;" for
finalLen = strlen(ret) + strlen(ops->filename) + 10;
finalName = (char*)emalloc(finalLen);
snprintf(finalName, finalLen, "%s|%s", ops->filename, ret);
return finalName;
This will prepend the file path followed by a pipe ( | ) to each function name, for example /path/to/foo.php|foo==>bar (without this modification xhprof would output just foo==>bar).
It's been a while since I've done C programming so there might be a better way of doing this, but it did the job for me.
It's easy to then parse this output in your implementation of iXHProfRuns - you just need to explode the string by | to get the file path and function names separately.
Hope this helps!