This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: GNU Assembler Start of Function & basic block
- From: Richard Henderson <rth at redhat dot com>
- To: EmÃlio Wuerges <wuerges at gmail dot com>
- Cc: binutils at sourceware dot org
- Date: Wed, 06 Oct 2010 16:05:46 -0700
- Subject: Re: GNU Assembler Start of Function & basic block
- References: <AANLkTinO2autMAheW_LYchLgMKuV6w5mUzp0V3dythTJ@mail.gmail.com>
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~