This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: GNU Assembler Start of Function & basic block


On 10/06/2010 02:10 PM, EmÃlio Wuerges wrote:
> I need to know the start and end address of each basic block.
> 
> I'm planning to hack GCC to include comments in the beginning of each BB
> and then later use the assembler to find these addresses.
> 
> I think I'm good with the GCC part, but I'm lost with assembler part.
> Can someone point me where should I hook my hack?

If you do the right bit in gcc you don't need to hack the assembler at all.

        .loc  FILENO LINENO [COLUMN] [basic_block] [prologue_end] \
              [epilogue_begin] [is_stmt VALUE] [isa VALUE] \
              [discriminator VALUE]

What you need to do is hack gcc dwarf2 debug output to mark the
basic blocks via the extensions to the .loc directive.  At which
point you'll be able to find your basic block boundaries by 
reading the information stored in the .debug_line section and
documented in the dwarf specifications.


r~


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]