Go to file
Arnaldo Carvalho de Melo e97d952744 ctf_encoder: Convert DWARF functions to CTF
Finally we can use the Elf file already opened in dwarf_load, call
cu__for_each_cached_symtab_entry to iterate over the symtab entries,
this iterator will first call dwfl_module_getsymtab, that will do the
relocation that will allow us to go from the symtab address to the one
in the DWARF DW_TAG_subprogram tag DW_AT_low_pc attribute.

And voila, for a relatively complex single unit Linux kernel object
file, kernel/sched.o, we go from:

Just DWARF (gcc -g):

$ ls -la kernel/sched.o
1979011 kernel/sched.o

Then we run this to encode the CTF section:

$ pahole -Z kernel/sched.o

And get a file with both DWARF and CTF ELF sections:

$ ls -la kernel/sched.o
2019848 kernel/sched.o

We still need to encode the "OBJECTS", i.e. variables, but this
gets us from 1979011 (just DWARF) to:

$ strip--strip-debug kernel/sched.o
$ ls -la kernel/sched.o
-rw-rw-r-- 1 acme acme 507008 2009-03-30 23:01 kernel/sched.o

25% of the original size.

Of course we don't have inline expansion information, parameter names,
goto labels, etc, but should be good enough for most use cases.

See, without DWARF data, if we ask for it to use DWARF, nothing will be
printed, if we don't speficy the format, it will try first DWARF, it
will not find anything, it will try CTF:

$ pahole -F dwarf kernel/sched.o
$ pahole -C seq_operations kernel/sched.o
struct seq_operations {
	void *  (*start)(struct seq_file *, loff_t *);         /*   0  8 */
        void    (*stop)(struct seq_file *, void *);            /*   8  8 */
	void *  (*next)(struct seq_file *, void *, loff_t *);  /*  16  8 */
	int     (*show)(struct seq_file *, void *);            /*  24  8 */

	/* size: 32, cachelines: 1, members: 4 */
	/* last cacheline: 32 bytes */
};
$ $ pfunct -Vi -f schedule kernel/sched.o
void schedule(void);
{ /* low_pc=0xe01 */
}/* size: 83 */
$

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-03-30 22:54:29 -03:00
cmake/modules cmake: check if in RHEL and ask for the same packages as in fedora if so 2008-11-20 13:55:05 -02:00
lib [LICENSE]: Add COPYING file and add missing license info on some files 2007-12-17 14:15:42 -02:00
man-pages pahole: Remove a not needed "the" article in the man page. 2009-03-23 16:53:54 -03:00
ostra [OSTRA]: Change ostra-cg license to GPLv2 2007-12-24 12:25:17 -02:00
rpm/SPECS rpm: Own %{_datadir}/dwarves/ 2009-02-16 11:04:49 -03:00
CMakeLists.txt elf_symtab: Introduce elf_symtab 2009-03-24 16:58:44 -03:00
COPYING [LICENSE]: Add COPYING file and add missing license info on some files 2007-12-17 14:15:42 -02:00
MANIFEST pahole: finally the beginnings of a man page 2009-02-11 12:19:46 -02:00
NEWS [NEWS]: Update entry about the --separator new option 2007-05-23 16:27:33 -03:00
README [CMAKE]: Make the default install prefix be /usr/local 2007-04-19 18:01:47 -03:00
README.ctracer ctracer: update README.ctracer, f9 has the dwarves 2008-10-29 08:54:53 -02:00
codiff.c core: Rename {cus,dwarf,ctf}__load to {cus,dwarf,ctf}__load_file 2009-03-24 16:48:41 -03:00
config.h.cmake [DWARVES] Fixes a FIXME relating to a missing elf (libdw) symbol check. 2008-02-12 21:08:49 -02:00
ctf.h libctf: Use the same coding style as the dwarves 2008-09-25 16:01:26 -03:00
ctf_encoder.c ctf_encoder: Convert DWARF functions to CTF 2009-03-30 22:54:29 -03:00
ctf_encoder.h ctf: Include the initial implementation of a ctf encoder 2009-03-19 12:16:07 -03:00
ctf_loader.c ctf_loader: Load the function section 2009-03-30 22:52:37 -03:00
ctf_loader.h core: Rename {cus,dwarf,ctf}__load to {cus,dwarf,ctf}__load_file 2009-03-24 16:48:41 -03:00
ctfdwdiff ctf_encoder: Convert DWARF functions to CTF 2009-03-30 22:54:29 -03:00
ctracer.c core: Rename {cus,dwarf,ctf}__load to {cus,dwarf,ctf}__load_file 2009-03-24 16:48:41 -03:00
dtagnames.c coding style: remove trailing whitespaces, etc 2009-03-14 13:50:36 -03:00
dutil.c dutil: Move elf_section_by_name to dutil 2009-03-24 16:56:19 -03:00
dutil.h dutil: Move elf_section_by_name to dutil 2009-03-24 16:56:19 -03:00
dwarf_loader.c core: Allow reusing the symtab already loaded and relocated 2009-03-30 22:45:55 -03:00
dwarf_loader.h core: Rename {cus,dwarf,ctf}__load to {cus,dwarf,ctf}__load_file 2009-03-24 16:48:41 -03:00
dwarves.c pfunct: Introduce --no_parm_names 2009-03-30 21:47:59 -03:00
dwarves.h ctf_encoder: Convert DWARF functions to CTF 2009-03-30 22:54:29 -03:00
dwarves_emit.c cu: Rename cu__find_{type,tag}_by_id to cu__{type,tag} 2009-03-18 12:17:07 -03:00
dwarves_emit.h coding style: remove trailing whitespaces, etc 2009-03-14 13:50:36 -03:00
dwarves_reorganize.c cu: Rename cu__find_{type,tag}_by_id to cu__{type,tag} 2009-03-18 12:17:07 -03:00
dwarves_reorganize.h class_member: cache the byte size of the member 2009-03-17 14:31:18 -03:00
elf_symtab.c elf_symtab: Fix bogus elf_symtab__is_local_function 2009-03-28 19:27:00 -03:00
elf_symtab.h elf_symtab: Fix bogus elf_symtab__is_local_function 2009-03-28 19:27:00 -03:00
gobuffer.c gobuffer: Introduce gobuffer__allocate 2009-03-18 22:14:55 -03:00
gobuffer.h gobuffer: Introduce gobuffer__allocate 2009-03-18 22:14:55 -03:00
hash.h [DWARVES]: Use a hash table for the tags in a CU 2008-02-11 11:47:17 -02:00
libctf.c ctf_loader: Load the function section 2009-03-30 22:52:37 -03:00
libctf.h ctf_loader: Load the function section 2009-03-30 22:52:37 -03:00
list.h coding style: remove trailing whitespaces, etc 2009-03-14 13:50:36 -03:00
pahole.c pahole: Remove --dwarf_offset/-O option 2009-03-24 18:44:43 -03:00
pdwtags.c pfunct: Introduce --no_parm_names 2009-03-30 21:47:59 -03:00
pfunct.c pfunct: Introduce --no_parm_names 2009-03-30 21:47:59 -03:00
pglobal.c dwarves: the variable abstract_origin is resolved at load time too 2009-03-14 15:19:33 -03:00
prefcnt.c core: Add a per object file functions_table 2009-03-24 20:12:59 -03:00
strings.c strings: Allow calling strings__delete with a NULL pointer 2009-03-20 10:35:57 -03:00
strings.h coding style: remove trailing whitespaces, etc 2009-03-14 13:50:36 -03:00
syscse.c cu: Rename cu__find_{type,tag}_by_id to cu__{type,tag} 2009-03-18 12:17:07 -03:00

README

Build instructions:

1. install cmake
2. mkdir build
3. cd build
4. cmake -D__LIB=lib ..
5. make install

Default is to be installed on /usr/local, see rpm spec file for
installing on other places.

Known to work scenarios:

Mandriva Cooker:

cmake 2.4.5-1mdv2007.1
libelfutils1-devel 0.123-1mdv2007.1

Debian Unstable:

cmake 2.4.5-1
libdw-dev 0.123-2

Fedora Core 6:

cmake 2.4.5-2.fc6
elfutils-devel 0.126-1.fc6