Commit Graph

55 Commits

Author SHA1 Message Date
Arnaldo Carvalho de Melo dae032ea3f dwarves fprintf: Add extra GNU tags
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2010-11-20 22:23:14 -02:00
Arnaldo Carvalho de Melo 3a0f0df2e5 cmake: Add ${ELF_LIBRARY} to ctracer, scncopy and pfunct
Noticed on fedora 14, probably we were getting this indirectly, go figure.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2010-11-20 15:18:01 -02:00
Arnaldo Carvalho de Melo dfbb7dd53d cmake: fix DWARVES_VERSION definition, should be 1.8
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2010-04-13 18:02:24 -03:00
Peter Jones c9d1352dfe Add scncopy to CMakeLists.txt
Add scncopy to the build.

Signed-off-by: Peter Jones <pjones@redhat.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2010-01-12 14:23:54 -02:00
Herton Ronaldo Krzesinski 7bc0b0c656 cmake: Avoid uneeded linking/unused libraries in some dwarves libraries and executables
currently mandriva has a packaging script which checks for uneeded linking in
package built files. For dwarves, it displays:

Warning: unused libraries in /usr/lib64/libdwarves_reorganize.so.1.0.0: libdw.so.1
 libelf.so.1
 libz.so.1

Warning: unused libraries in /usr/lib64/libdwarves_emit.so.1.0.0: libdw.so.1
 libelf.so.1
 libz.so.1

Warning: unused libraries in /usr/bin/ctracer: libz.so.1
 libdw.so.1

Warning: unused libraries in /usr/bin/syscse: libdw.so.1
 libelf.so.1
 libz.so.1

Warning: unused libraries in /usr/bin/pglobal: libdw.so.1
 libelf.so.1
 libz.so.1

Warning: unused libraries in /usr/bin/pdwtags: libdw.so.1
 libelf.so.1
 libz.so.1

Warning: unused libraries in /usr/bin/prefcnt: libdw.so.1
 libelf.so.1
 libz.so.1

Warning: unused libraries in /usr/bin/pfunct: libz.so.1
 libdw.so.1

Warning: unused libraries in /usr/bin/pahole: libz.so.1
 libdw.so.1
 libelf.so.1

Warning: unused libraries in /usr/bin/dtagnames: libdw.so.1
 libelf.so.1
 libz.so.1

Warning: unused libraries in /usr/bin/codiff: libdw.so.1
 libelf.so.1
 libz.so.1

The patch below fixes the issue (removing uneeded specified libraries and using
LINK_INTERFACE_LIBRARIES property, see
http://www.cmake.org/Wiki/CMake_FAQ#Why_are_libraries_linked_to_my_shared_library_included_when_something_links_to_it.3F)

Signed-off-by: Herton Ronaldo Krzesinski <herton@mandriva.com.br>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-12-17 15:20:27 -02:00
Arnaldo Carvalho de Melo ba928a23ee cmake: set policy for escaping preprocessor definitions to NEW
CMP0005

       Preprocessor definition values are now escaped automatically.
This policy determines whether or not CMake should generate escaped
preprocessor definition values added via add_definitions.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-06-17 13:05:44 -03:00
Arnaldo Carvalho de Melo e429f8efbb dwarves: Add an rbtree for the functions in a cu
That is used by cus__find_function_by_addr & cu__func_function_by_addr.

First user is pfunct --addr, but this is really for pfunct --annotate, that
will process a perf.data file generated by 'perf report', load the debugging
info and regenerate the functions (pfunct -TVi like) that had hits, using
libdisasm to show the assembly code, etc.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-06-04 14:56:44 -03:00
Arnaldo Carvalho de Melo a693b7fde9 cmake: move headers to /usr/include/dwarves/ and tag 1.8pre1
In reponse to https://bugzilla.redhat.com/show_bug.cgi?id=497285 I
included the header files that are needed by the dwarves*.h files
and moved them to /usr/include/dwarves.h.

The CTF work is not completed yet, but the non-CTF related improvements
(progressive loading of CUs, etc) are worth a release till I can get back to
dedicate solid time for developing these tools again.

Reported-by: Masatake YAMATO <yamato@redhat.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-04-23 15:13:50 -03:00
Arnaldo Carvalho de Melo f84bf73d54 dwarves: Move the fprintf code to a new source file.
$ wc -l dwarves.c dwarves_fprintf.c
 1468 dwarves.c
 1554 dwarves_fprintf.c
 3022 total
$

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-04-19 13:48:51 -03:00
Arnaldo Carvalho de Melo 0954d75152 elf_symtab: Introduce elf_symtab
We will need this when encoding the CTF functions section.  Things like lookup
a function by its address when converting from a DW_TAG_subprogram to a CTF
function, for instance.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-03-24 16:58:44 -03:00
Arnaldo Carvalho de Melo feab8aa5e3 ctf: Include the initial implementation of a ctf encoder
"pahole -Z foo" will create foo.SUNW_ctf, that if objcopy
--add-section'ed to the right word-sized object will work, sans VARARGS,
that will get fixed soon (as in, probably, tomorrow).

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-03-19 12:16:07 -03:00
Arnaldo Carvalho de Melo ccc808b88e dutil: Move zalloc to dutil
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-03-18 11:08:23 -03:00
Arnaldo Carvalho de Melo 56be29c649 all: Add the --version
Using the argp tricks.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-02-13 10:57:23 -02:00
Arnaldo Carvalho de Melo 7b6c135e7c pahole: finally the beginnings of a man page
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-02-11 12:19:46 -02:00
Arnaldo Carvalho de Melo d2a128b810 cmake: 2.4.8 is enough
Tested in RHEL5.2

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2008-11-20 13:54:39 -02:00
Arnaldo Carvalho de Melo 46a3bc4626 cmake: Add cmake_minimum_required
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2008-10-24 10:44:26 -02:00
Arnaldo Carvalho de Melo be30be91f5 gobuffer: Move the non string specific bits
Will be used while encoding the CTF sections.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2008-10-02 17:06:01 -03:00
Arnaldo Carvalho de Melo 212b994ab5 strings: Introduce the strings class
And make the dwarves use it, so that we can remove duplicate strings in
a multi-CU file (vmlinux anyone?) and have it ready for insertion in a
compressed DWARF format with just the types, or better, CTF or some new
compressed debugging info format.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2008-10-02 14:34:42 -03:00
Arnaldo Carvalho de Melo 993bcbde35 pfunct: Implement --expand_types
So that one can get an skeleton from where a function can be
reimplemented, or a probe can be written to attach to a tracepoint.

Right now it will only expand the types for
struct/union/typedef/enumeration types, but it is a good start.

[acme@doppio pahole]$ pfunct --expand_types --function inet6_ioctl ipv6.ko > a.c
[acme@doppio pahole]$ echo "int main(void) { return 0; }" >> a.c
[acme@doppio pahole]$ gcc -Wall -g a.c -o a
[acme@doppio pahole]$ grep ^#include a.c
[acme@doppio pahole]$

No errors, no includes.

This is present in ctracer, where we don't want to _require_ any header
files, just the object file with the function we want to probe. From
there we get the function signature, and reconstruct the types needed to
access members of structs passed as parameters.

We still need to add padding to reconstruct __attribute__ alignment
effects.

Also, if we can detect what are the exact members accessed in the probe,
we can reconstruct just what is needed to access those members,
hopefully reducing the time needed for gcc to digest the resulting
source code. And also reducing the size of the output, which can
hopefully be interesting to help focus on what the probe is doing.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2008-09-30 17:30:42 -03:00
Arnaldo Carvalho de Melo 2dfa5fe6ea [DWARVES]: Initial CTF support
Using a library written by David S. Miller.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2008-03-04 15:37:02 -03:00
Arnaldo Carvalho de Melo b3489e14eb [DWARVES]: Move all the DWARF specific loading routines to dwarf_loader.c
In libdwarves.so well continue using DW_TAG_ entries and types for now, but its
becoming non-DWARF specific as will be demonstrated with the introduction of
ctf_loader.c in the upcoming csets.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2008-03-03 13:50:44 -03:00
Arnaldo Carvalho de Melo 5444ebab1b [CMAKE]: Remove last reference to dwdb
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2007-12-27 23:00:07 -02:00
Arnaldo Carvalho de Melo 8ca5113571 [CMAKEFILE]: Remove references to sqlite3
Not yet ready, thanks to Otavio for pointing out my mistake.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2007-12-26 15:43:07 -02:00
Arnaldo Carvalho de Melo f7b1128d6f [CODIFF]: Show changes to a struct only on the first object file it appears
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2007-12-17 11:27:24 -02:00
Arnaldo Carvalho de Melo 66b7191c18 [DUTIL]: Generalise fstrlist
Now at creation time we specify if the strings must be allocated or if using
the pointer directly.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2007-12-16 14:55:50 -02:00
Arnaldo Carvalho de Melo 2c01420b51 [CMAKE]: Add linux.blacklist.cu to the install targets
Also updating the manifest and lib/Makefile to find it in
/usr/share/dwarves/runtime.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2007-12-06 17:43:20 -02:00
Daniel Gollub 023733eb39 [CMAKE]: CMake Build Env patches for pahole/dwarves
This is used to let cmake know that's only C project, and it shouldn't check
for C++ compiler - shrinks the build requirements ;)

+INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR} )

This one allows to make out of sourcetree builds...

Signed-off-by: Daniel Gollub <dgollub@suse.de>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2007-12-03 14:43:49 -02:00
Arnaldo Carvalho de Melo 390e2c64f4 [CTRACER]: Implement support for blacklisting CUs
In the Linux kernel, currently the only target, we can't probe the
functions in kernel/{kprobe,relay}.c.

When systemtap starts supporting uprobes, there may be other cases that
require blacklisting CUs.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2007-11-17 18:10:58 -02:00
Eduardo Habkost 15c6f261b6 [CMAKE] Define _GNU_SOURCE on CMakeLists.txt
The latest elfutils-libelf headers won't compile without _LARGEFILE64_SOURCE
(that is implied by _GNU_SOURCE).

Some .c files don't have a #define _GNU_SOURCE line. Instead of adding the line
to all .c files, define it globally on CMakeLists.txt.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
2007-10-26 13:21:31 -02:00
Ademar de Souza Reis Jr 7657ad696d [CMAKE]: fix ostra-cg install mode
ostra-cg is a script and should be installed as
PROGRAM, otherwise it doesn't receive the exec bits.

Signed-off-by: Ademar de Souza Reis Jr <ademar@mandriva.com.br>
Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
2007-08-14 11:33:54 -03:00
Arnaldo Carvalho de Melo 1d53d3640f [CMAKE]: Remove the Sqlite requirement
It'll only be needed when szhist gets merged.

Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
2007-06-13 09:12:44 -03:00
Arnaldo Carvalho de Melo 1382ee83da [SYSCSE]: System Call Sign Extender
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2007-06-12 15:53:46 -03:00
Arnaldo Carvalho de Melo 53f1dc9860 [RPM]: 1.0, finally!
Fixing problems found in the fedora packaging review. There are still problems,
but lets get what works out of the door so that it gets into a distro and we
can see what is more important to work on from now on.

The OLS paper will be included as soon as it is published by the OLS organizers.

Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
2007-05-22 13:51:58 -03:00
Arnaldo Carvalho de Melo fbb50fc851 [LIB]: Move class__reorganize & friends to a new lib: libdwarves_reorganize
Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
2007-05-07 00:30:02 -03:00
Arnaldo Carvalho de Melo 05351ece16 [LIB]: Move the __emit functions to a separate library, libdwarves_emit
To isolate functionality only used in utilities such as ctracer.

Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
2007-05-06 14:50:28 -03:00
Arnaldo Carvalho de Melo ee12d416f3 [CMAKE]: Allow specifying CMAKE_BUILD_TYPE
Defaults to "Debug", but the rpm will use "MinSizeRel"

Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
2007-04-26 11:02:20 -03:00
Arnaldo Carvalho de Melo 19ca955ec6 [CMAKE]: Make the default install prefix be /usr/local
Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
2007-04-19 18:01:47 -03:00
Diego "Flameeyes" Pettenò c8054ae5e8 [CMAKE]: Link libdwarves only to libdw
And let the final binaries get it from that. Fixes building with
-Wl,--as-needed

Signed-off-by: Diego "Flameeyes" Pettenò <flameeyes@gmail.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
2007-03-28 10:18:57 -03:00
Arnaldo Carvalho de Melo 0a65e24cae [CMAKE]: Just convert the commands to lowercase
Its case insensitive, so why have it screaming? :)

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2007-02-25 16:43:59 -03:00
Arnaldo Carvalho de Melo ce9d7e11fe [CTRACER]: Lots of improvements
1. We now use relayfs
2. ostra-cg is shipped and used in the Makefile
3. README.ctracer has all the details

I followed README.ctracer and the result, in my workstation, was this one:
http://oops.ghostprotocols.net:81/acme/dwarves/callgraphs/acme_eating_his_dog_food/6.html

I've started on the 6th page as it is more interesting, having tcp and netlink
callchains, don't be disappointed by some pages having just one level of
nesting, that is just the lack of containers and aliases (to follow tcp_sock,
skb->sk, etc) from the OSTRA days, but it's getting there! :-)

Ah, it is collecting all the base types in the specified struct by doing a
struct "view", i.e. trimming the struct to have just members that are
"reducible" to basic types (int, long, char, signed and unsigned), then
reorganizing it with the code introduced in pahole --reorganize to get it to
the best layout possible, reducing the size of the entry probe points trace
entries.

Updated rpms are available at the usual place:

http://oops.ghostprotocols.net:81/acme/dwarves/rpm/

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2007-02-02 15:15:27 -02:00
Arnaldo Carvalho de Melo b7cad1782d [RPM]: Release 13
Adding pglobal and the latest advancements in pahole --reorganize.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2007-02-02 12:30:56 -02:00
Davi Arnaut 4ab3403e3b [LIB]: Add initial support for DW_AT_location, in variables
And use it in a new tool, pglobal, that shows global variables and functions.

Signed-off-by: Davi Arnaut <davi@haxent.com.br>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2007-02-02 11:56:53 -02:00
Arnaldo Carvalho de Melo 26c1474b61 [CMAKE/RPM]: Fix build for x86-64
RPMS for FC6 x86-64 are available at:

http://oops.ghostprotocols.net:81/acme/dwarves/rpm/x86-64/

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2007-01-30 19:07:28 -02:00
Arnaldo Carvalho de Melo 9555603666 [RPM]: 9th release
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2007-01-27 19:42:54 -02:00
Arnaldo Carvalho de Melo fab0db03ea [PDWTAGS]: New tool
Pretty prints all of the tags, still needs a bit more work.

Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
2007-01-18 21:13:56 -02:00
Arnaldo Carvalho de Melo c916ae4a99 [CMAKE]: Add the INSTALL rules
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
2007-01-11 16:41:54 -02:00
Arnaldo Carvalho de Melo 30b6aa2f73 [LIB]: Rename classes.[ch] to dwarves.[ch]
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
2007-01-11 16:07:05 -02:00
Arnaldo Carvalho de Melo 7339f61868 [CMAKE]: Set a SONAME for libdwarves
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
2007-01-11 16:04:22 -02:00
Arnaldo Carvalho de Melo 24842ef908 [CMAKE]: Rerename the library, this time to libdwarves
To avoid a problem in CMakeLists.txt where the lib and the pahole binary
targets had the same name, leading to the binary not being built, and its a
much cooler name anyway.

Thanks to Leonardo Chiquitto for the suggestion he gave on the #dwarves
channel!

Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
2007-01-11 15:28:08 -02:00
Arnaldo Carvalho de Melo 56f8ddb318 [CMAKE]: Rename libsoname.so to libpahole.so
Next cset will specify a soname, then a rpm specfile will be added.

Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
2007-01-11 13:41:28 -02:00