Hi I was wondering whether there are any methods to know what part of the target binary is code. I have some ideas and hope to get your comments. I would like to use LLVM's source level debugging information to extract the source lines belonging to every functions. Then use the dwarf mapping table to transfer the source level information to binary address. Are there any better methods? Besides, is the address listed inside dwarf line mapping table must be code rather than data? Regards Muhui -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180625/9ea49a2a/attachment.html>
The main DWARF info should provide the code address ranges for each function, as well as the starting source location. You could then use the line table to map code ranges to individual source lines. That could give you a reasonable grasp of the source range for each function. All addresses in the DWARF line table will be instruction addresses. And in fact, all instructions should be described in the line table (assuming all source was compiled with debug info). --paulr From: llvm-dev [mailto:llvm-dev-bounces at lists.llvm.org] On Behalf Of Muhui Jiang via llvm-dev Sent: Monday, June 25, 2018 11:36 AM To: llvm-dev Subject: [llvm-dev] Instruction boundaries Hi I was wondering whether there are any methods to know what part of the target binary is code. I have some ideas and hope to get your comments. I would like to use LLVM's source level debugging information to extract the source lines belonging to every functions. Then use the dwarf mapping table to transfer the source level information to binary address. Are there any better methods? Besides, is the address listed inside dwarf line mapping table must be code rather than data? Regards Muhui -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180625/528bd340/attachment.html>
Hi paulr Thanks for your reply. Though DWARF info give me the code address ranges, there might be inline data. If so, how to handle this case? As for the dwarf line table. Sometimes, the source line might be zero. Do you know why? If all instructions should be describe in the line table, I think analyzing Dwarf line table is enough to get all the instructions addresses. Do you agree? I would also cc my supervisor for the discussion. Regards Muhui <paul.robinson at sony.com>于2018年6月26日 周二上午2:38写道:> The main DWARF info should provide the code address ranges for each > function, as well as the starting source location. You could then use the > line table to map code ranges to individual source lines. That could give > you a reasonable grasp of the source range for each function. > > All addresses in the DWARF line table will be instruction addresses. And > in fact, all instructions should be described in the line table (assuming > all source was compiled with debug info). > > --paulr > > > > *From:* llvm-dev [mailto:llvm-dev-bounces at lists.llvm.org] *On Behalf Of *Muhui > Jiang via llvm-dev > *Sent:* Monday, June 25, 2018 11:36 AM > *To:* llvm-dev > *Subject:* [llvm-dev] Instruction boundaries > > > > Hi > > > > I was wondering whether there are any methods to know what part of the > target binary is code. > > > > I have some ideas and hope to get your comments. > > > > I would like to use LLVM's source level debugging information to extract > the source lines belonging to every functions. Then use the dwarf mapping > table to transfer the source level information to binary address. Are > there any better methods? > > > > Besides, is the address listed inside dwarf line mapping table must be > code rather than data? > > > > Regards > > Muhui >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180626/f5e19dc7/attachment.html>