Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

map memory addresses to line numbers using DWARF information

I have an application that traces program execution through memory. I tried to use readelf --debug-dump=decodedline to get memory address / line # information, but the memory addresses I see don't match up often with the ones given by that dump. I wrote something to match up each address with the "most recent" one appearing in the DWARF data -- this seemed to clean some things up but I'm not sure if that's the "official" way to interpret this data.

Can someone explain the exact process to map a program address to line number using DWARF?

like image 779
wickedchicken Avatar asked Oct 10 '22 16:10

wickedchicken


1 Answers

Have a look at the program addr2line. It can probably give you some guidance on how to do this, if not solving your problem entirely (e.g. by shelling out to it, or linking its functionality in).

like image 182
Phil Miller Avatar answered Jan 01 '23 10:01

Phil Miller