This is the mail archive of the binutils@sources.redhat.com 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: using libbfd for reading procedure information and hidden data in the text segment


Hi,

On 7/5/05, Kugan Vivekanandarajah <kuganv@gmail.com> wrote:
> For my research, I need to construct control flow graph (CFG) from the
> executable; separately for each procedure in the executable
> (executable is compiled with gcc and I can compile the code with all
> the necessary compilation switches).
> 
> I am using libbfd for reading the code sections and the symbols. Is
> there any way I can do the following with the information provided by
> the libbfd.

For my undergraduate project LIZARD (lizard.sourceforge.net/) we too
needed to build the CFG from a GCC compiled ELF executable. I wrote a
small script which used the output of readelf and objdump to build the
CFG. You could probably do your CFG-building in the same way.

On 7/5/05, Kugan Vivekanandarajah <kuganv@gmail.com> wrote:
> 1.      By reading the symbol information can I tell whether it is a
> function or not. That is, can I find out the procedures and its
> starting and end addresses.

Readelf -s gives the symbol type to be FUNC if it's a function. It
also gives the starting address and the size which you could use to
build your CFG.

> 2.      Also, the compilers seem to be inserting data inside the text
> section. For example, for switch statements are some time handled with
> the jump table. Is there anyway I can find out the start address and
> the end address of these data inside the code section.

We hadn't been able to solve this either, maybe someone could help
both of us with this.

Cheers,
-- 
Ravi Ramaseshan
http://www.geocities.com/ramaseshan_ravi/

" All man's miseries derive from not being able to sit in a room alone. "
- Blaise Pascal


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