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>
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>
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>
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>
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>
"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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>