Take a look at raw/modules.log in the trace directory generated by drmemtrace. To convert a given trace_pc to (file, offset), the first step would be to find the entry where start <= trace_pc and trace_pc < end.
For example: for a trace pc 0x7f10e9c08f3d, it is the following entry #13.
$ cat modules.log
Module Table: version 5, count 29
Columns: id, containing_id, start, end, entry, offset, preferred_base, (custom fields), path
...
13, 12, 0x00007f10e9bee000, 0x00007f10e9c14000, 0x00007f10e9c08320, 0000000000001000, 0x0000000000001000, v#1,0, /usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2
The offset within the file can be computed as: offset + trace_pc - start. In the example, the offset would be 0x1000 + 0x7f10e9c08f3d - 0x7f10e9bee000 = 0x1BF3D in /usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2.
We don't have an API yet for this, but I imagine it would be useful. It can probably be added to module_mapper_t.
mvi->path and mvi->seg_offs + (trace_address - mvi->orig_seg_base) as the file, offset pair.
We welcome community contributions, so feel free to send a PR to add the new API to module_mapper_t. Let me know if this helps.
Abhinav