2006-12-20 15:16:16 +01:00
|
|
|
/*
|
|
|
|
Copyright (C) 2006 Mandriva Conectiva S.A.
|
|
|
|
Copyright (C) 2006 Arnaldo Carvalho de Melo <acme@mandriva.com>
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it
|
|
|
|
under the terms of version 2 of the GNU General Public License as
|
|
|
|
published by the Free Software Foundation.
|
|
|
|
*/
|
|
|
|
|
2007-03-30 16:16:50 +02:00
|
|
|
#include <argp.h>
|
2006-12-27 17:59:17 +01:00
|
|
|
#include <limits.h>
|
2007-01-13 17:56:16 +01:00
|
|
|
#include <search.h>
|
2006-12-20 15:16:16 +01:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
2007-01-13 17:56:16 +01:00
|
|
|
#include <string.h>
|
2006-12-27 17:59:17 +01:00
|
|
|
#include <sys/types.h>
|
2006-12-20 15:16:16 +01:00
|
|
|
|
2007-05-07 05:30:02 +02:00
|
|
|
#include "dwarves_reorganize.h"
|
2007-05-06 19:50:28 +02:00
|
|
|
#include "dwarves_emit.h"
|
2007-01-11 19:07:05 +01:00
|
|
|
#include "dwarves.h"
|
2006-12-20 15:16:16 +01:00
|
|
|
|
2007-01-20 14:25:50 +01:00
|
|
|
/*
|
|
|
|
* List of compilation units being looked for functions with
|
|
|
|
* pointers to the specified struct.
|
|
|
|
*/
|
|
|
|
static struct cus *methods_cus;
|
|
|
|
|
[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 18:15:27 +01:00
|
|
|
/**
|
|
|
|
* Mini class, the subset of the traced class that is collected at the probes
|
|
|
|
*/
|
|
|
|
|
|
|
|
static struct class *mini_class;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Directory where to generate source files
|
|
|
|
*/
|
|
|
|
static const char *src_dir = ".";
|
|
|
|
|
|
|
|
/*
|
2007-11-11 19:39:03 +01:00
|
|
|
* Where to print the ctracer_methods.stp file
|
[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 18:15:27 +01:00
|
|
|
*/
|
|
|
|
static FILE *fp_methods;
|
|
|
|
|
2007-11-11 19:39:03 +01:00
|
|
|
/*
|
|
|
|
* Where to print the ctracer_collector.c file
|
|
|
|
*/
|
|
|
|
static FILE *fp_collector;
|
|
|
|
|
2007-01-20 14:25:50 +01:00
|
|
|
/*
|
|
|
|
* List of definitions and forward declarations already emitted for
|
2007-11-11 19:39:03 +01:00
|
|
|
* methods_cus, to avoid duplication.
|
2007-01-20 14:25:50 +01:00
|
|
|
*/
|
2006-12-27 17:59:17 +01:00
|
|
|
static LIST_HEAD(cus__definitions);
|
|
|
|
static LIST_HEAD(cus__fwd_decls);
|
2006-12-23 22:29:27 +01:00
|
|
|
|
2007-01-20 14:25:50 +01:00
|
|
|
/*
|
2007-11-11 19:39:03 +01:00
|
|
|
* List of probes and kretprobes already emitted, this is a hack to cope with
|
2007-01-20 14:25:50 +01:00
|
|
|
* name space collisions, a better solution would be to in these cases to use the
|
|
|
|
* compilation unit name (net/ipv4/tcp.o, for instance) as a prefix when a
|
|
|
|
* static function has the same name in multiple compilation units (aka object
|
|
|
|
* files).
|
|
|
|
*/
|
2007-11-11 19:39:03 +01:00
|
|
|
static void *probes_emitted;
|
2007-01-13 17:56:16 +01:00
|
|
|
|
|
|
|
static int methods__compare(const void *a, const void *b)
|
|
|
|
{
|
|
|
|
return strcmp(a, b);
|
|
|
|
}
|
|
|
|
|
2007-01-20 14:25:50 +01:00
|
|
|
/*
|
2007-11-11 19:39:03 +01:00
|
|
|
* Add a method to probes_emitted, see comment above.
|
2007-01-20 14:25:50 +01:00
|
|
|
*/
|
2007-01-13 17:56:16 +01:00
|
|
|
static int methods__add(void **table, const char *str)
|
|
|
|
{
|
|
|
|
char **s = tsearch(str, table, methods__compare);
|
|
|
|
|
|
|
|
if (s != NULL) {
|
|
|
|
if (*s == str) {
|
|
|
|
char *dup = strdup(str);
|
|
|
|
if (dup != NULL)
|
|
|
|
*s = dup;
|
|
|
|
else {
|
|
|
|
tdelete(str, table, methods__compare);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
} else
|
|
|
|
return -1;
|
|
|
|
} else
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2006-12-20 15:16:16 +01:00
|
|
|
static void method__add(struct cu *cu, struct function *function)
|
|
|
|
{
|
|
|
|
list_add(&function->tool_node, &cu->tool_list);
|
|
|
|
}
|
|
|
|
|
2007-01-20 14:25:50 +01:00
|
|
|
/*
|
|
|
|
* We want just the DW_TAG_subprogram tags that have as one of its parameters
|
|
|
|
* a pointer to the specified "class" (a struct, unions can be added later).
|
|
|
|
*/
|
2007-01-04 00:29:24 +01:00
|
|
|
static struct tag *function__filter(struct tag *tag, struct cu *cu, void *cookie)
|
2006-12-20 15:16:16 +01:00
|
|
|
{
|
2007-01-04 00:29:24 +01:00
|
|
|
struct function *function;
|
|
|
|
|
|
|
|
if (tag->tag != DW_TAG_subprogram)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
function = tag__function(tag);
|
2006-12-20 16:10:31 +01:00
|
|
|
if (function__inlined(function) ||
|
2007-01-09 17:26:07 +01:00
|
|
|
function->abstract_origin != 0 ||
|
2007-01-04 00:29:24 +01:00
|
|
|
!ftype__has_parm_of_type(&function->proto, cookie, cu))
|
2006-12-20 15:16:16 +01:00
|
|
|
return NULL;
|
|
|
|
|
2007-01-04 00:29:24 +01:00
|
|
|
return tag;
|
2006-12-20 15:16:16 +01:00
|
|
|
}
|
|
|
|
|
2007-01-20 14:25:50 +01:00
|
|
|
/*
|
|
|
|
* Add the function to the list of methods since it matches function__filter
|
|
|
|
* criteria.
|
|
|
|
*/
|
2007-01-29 13:42:03 +01:00
|
|
|
static int find_methods_iterator(struct tag *tag, struct cu *cu,
|
|
|
|
void *cookie __unused)
|
2006-12-20 15:16:16 +01:00
|
|
|
{
|
2007-01-20 14:25:50 +01:00
|
|
|
struct function *function = tag__function(tag);
|
|
|
|
method__add(cu, function);
|
2006-12-20 15:16:16 +01:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2007-01-20 14:25:50 +01:00
|
|
|
/*
|
|
|
|
* Iterate thru all the tags in the compilation unit, looking just for the
|
|
|
|
* DW_TAG_subprogram tags that have as one of its parameters a pointer to
|
|
|
|
* the specified "class" (struct).
|
|
|
|
*/
|
2006-12-20 15:16:16 +01:00
|
|
|
static int cu_find_methods_iterator(struct cu *cu, void *cookie)
|
|
|
|
{
|
2007-01-07 16:11:20 +01:00
|
|
|
struct tag *target = cu__find_struct_by_name(cu, cookie);
|
2006-12-20 15:16:16 +01:00
|
|
|
|
|
|
|
if (target == NULL)
|
|
|
|
return 0;
|
|
|
|
|
2007-01-04 00:29:24 +01:00
|
|
|
return cu__for_each_tag(cu, find_methods_iterator, target, function__filter);
|
2006-12-20 15:16:16 +01:00
|
|
|
}
|
|
|
|
|
[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 18:15:27 +01:00
|
|
|
static void class__remove_member(struct class *self, const struct cu *cu,
|
|
|
|
struct class_member *member)
|
|
|
|
{
|
2007-11-11 19:39:03 +01:00
|
|
|
size_t size = class_member__size(member, cu);
|
[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 18:15:27 +01:00
|
|
|
/*
|
|
|
|
* Is this the first member?
|
|
|
|
*/
|
2007-05-24 17:07:41 +02:00
|
|
|
if (member->tag.node.prev == class__tags(self)) {
|
2007-11-11 19:39:03 +01:00
|
|
|
self->type.size -= size + member->hole;
|
|
|
|
class__subtract_offsets_from(self, cu, member,
|
|
|
|
size + member->hole);
|
|
|
|
/*
|
|
|
|
* Is this the last member?
|
|
|
|
*/
|
|
|
|
} else if (member->tag.node.next == class__tags(self)) {
|
|
|
|
if (size + self->padding >= cu->addr_size) {
|
|
|
|
self->type.size -= size + self->padding;
|
|
|
|
self->padding = 0;
|
|
|
|
} else
|
|
|
|
self->padding += size;
|
[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 18:15:27 +01:00
|
|
|
} else {
|
2007-11-11 19:39:03 +01:00
|
|
|
if (size + member->hole >= cu->addr_size) {
|
[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 18:15:27 +01:00
|
|
|
self->type.size -= size + member->hole;
|
|
|
|
class__subtract_offsets_from(self, cu, member,
|
|
|
|
size + member->hole);
|
2007-11-11 19:39:03 +01:00
|
|
|
} else {
|
|
|
|
struct class_member *from_prev =
|
|
|
|
list_entry(member->tag.node.prev,
|
|
|
|
struct class_member,
|
|
|
|
tag.node);
|
|
|
|
if (from_prev->hole == 0)
|
|
|
|
self->nr_holes++;
|
[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 18:15:27 +01:00
|
|
|
from_prev->hole += size + member->hole;
|
2007-11-11 19:39:03 +01:00
|
|
|
}
|
[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 18:15:27 +01:00
|
|
|
}
|
|
|
|
if (member->hole != 0)
|
|
|
|
self->nr_holes--;
|
|
|
|
list_del(&member->tag.node);
|
|
|
|
class_member__delete(member);
|
|
|
|
}
|
|
|
|
|
|
|
|
static size_t class__find_biggest_member_name(const struct class *self)
|
|
|
|
{
|
|
|
|
struct class_member *pos;
|
|
|
|
size_t biggest_name_len = 0;
|
|
|
|
|
2007-05-29 19:06:33 +02:00
|
|
|
type__for_each_data_member(&self->type, pos) {
|
[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 18:15:27 +01:00
|
|
|
const size_t len = strlen(pos->name);
|
|
|
|
|
|
|
|
if (len > biggest_name_len)
|
|
|
|
biggest_name_len = len;
|
|
|
|
}
|
|
|
|
|
|
|
|
return biggest_name_len;
|
|
|
|
}
|
|
|
|
|
2007-05-24 23:45:34 +02:00
|
|
|
static void class__emit_class_state_collector(struct class *self,
|
|
|
|
struct class *clone,
|
|
|
|
const struct cu *cu)
|
[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 18:15:27 +01:00
|
|
|
{
|
|
|
|
struct class_member *pos;
|
2007-03-28 16:38:32 +02:00
|
|
|
int len = class__find_biggest_member_name(clone);
|
[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 18:15:27 +01:00
|
|
|
|
2007-11-11 19:39:03 +01:00
|
|
|
fprintf(fp_collector,
|
[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 18:15:27 +01:00
|
|
|
"void ctracer__class_state(const void *from, void *to)\n"
|
|
|
|
"{\n"
|
|
|
|
"\tconst struct %s *obj = from;\n"
|
|
|
|
"\tstruct %s *mini_obj = to;\n\n",
|
2007-05-24 23:45:34 +02:00
|
|
|
class__name(self, cu), class__name(clone, cu));
|
2007-05-29 19:06:33 +02:00
|
|
|
type__for_each_data_member(&clone->type, pos)
|
2007-11-11 19:39:03 +01:00
|
|
|
fprintf(fp_collector, "\tmini_obj->%-*s = obj->%s;\n",
|
[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 18:15:27 +01:00
|
|
|
len, pos->name, pos->name);
|
2007-11-11 19:39:03 +01:00
|
|
|
fputs("}\n\n", fp_collector);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void class__add_offsets_from(struct class *self, struct class_member *from,
|
|
|
|
const uint16_t size)
|
|
|
|
{
|
|
|
|
struct class_member *member =
|
|
|
|
list_prepare_entry(from, class__tags(self), tag.node);
|
|
|
|
|
|
|
|
list_for_each_entry_continue(member, class__tags(self), tag.node)
|
|
|
|
if (member->tag.tag == DW_TAG_member)
|
|
|
|
member->offset += size;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* XXX: Check this more thoroughly. Right now it is used because I was
|
|
|
|
* to lazy to do class__remove_member properly, adjusting alignments and
|
|
|
|
* holes as we go removing fields. Ditto for class__add_offsets_from.
|
|
|
|
*/
|
|
|
|
static void class__fixup_alignment(struct class *self, const struct cu *cu)
|
|
|
|
{
|
|
|
|
struct class_member *pos, *last_member = NULL;
|
|
|
|
size_t power2;
|
|
|
|
|
|
|
|
type__for_each_data_member(&self->type, pos) {
|
|
|
|
size_t member_size = class_member__size(pos, cu);
|
|
|
|
|
|
|
|
if (last_member == NULL && pos->offset != 0) { /* paranoid! */
|
|
|
|
class__subtract_offsets_from(self, cu, pos,
|
|
|
|
pos->offset - member_size);
|
|
|
|
pos->offset = 0;
|
|
|
|
} else for (power2 = 2; power2 <= cu->addr_size; power2 *= 2) {
|
|
|
|
const size_t remainder = pos->offset % power2;
|
|
|
|
|
|
|
|
if (member_size == power2 && remainder != 0) {
|
|
|
|
if (last_member->hole >= remainder) {
|
|
|
|
last_member->hole -= remainder;
|
|
|
|
if (last_member->hole == 0)
|
|
|
|
--self->nr_holes;
|
|
|
|
pos->offset -= remainder;
|
|
|
|
class__subtract_offsets_from(self, cu, pos, remainder);
|
|
|
|
} else {
|
|
|
|
if (last_member->hole == 0)
|
|
|
|
++self->nr_holes;
|
|
|
|
last_member->hole += 2 - remainder;
|
|
|
|
pos->offset += 2 - remainder;
|
|
|
|
class__add_offsets_from(self, pos, 2 - remainder);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
last_member = pos;
|
|
|
|
}
|
[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 18:15:27 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static struct class *class__clone_base_types(const struct tag *tag_self,
|
|
|
|
const struct cu *cu,
|
|
|
|
const char *new_class_name)
|
|
|
|
{
|
|
|
|
struct class *self = tag__class(tag_self);
|
|
|
|
struct class_member *pos, *next;
|
|
|
|
struct class *clone = class__clone(self, new_class_name);
|
|
|
|
|
|
|
|
if (clone == NULL)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
class__find_holes(clone, cu);
|
|
|
|
|
2007-05-29 19:06:33 +02:00
|
|
|
type__for_each_data_member_safe(&clone->type, pos, next) {
|
[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 18:15:27 +01:00
|
|
|
struct tag *member_type = cu__find_tag_by_id(cu, pos->tag.type);
|
|
|
|
|
|
|
|
if (member_type->tag != DW_TAG_base_type)
|
|
|
|
class__remove_member(clone, cu, pos);
|
|
|
|
}
|
2007-11-11 19:39:03 +01:00
|
|
|
class__find_holes(clone, cu);
|
|
|
|
class__fixup_alignment(clone, cu);
|
[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 18:15:27 +01:00
|
|
|
class__reorganize(clone, cu, 0, NULL);
|
|
|
|
return clone;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Converter to the legacy ostra tables, will be much improved in the future.
|
|
|
|
*/
|
|
|
|
static void emit_struct_member_table_entry(FILE *fp,
|
|
|
|
int field, const char *name,
|
|
|
|
int traced, const char *hooks)
|
|
|
|
{
|
|
|
|
fprintf(fp, "%u:%s:", field, name);
|
|
|
|
if (traced)
|
|
|
|
fprintf(fp, "yes:%%object->%s:u:%s:none\n", name, hooks);
|
|
|
|
else
|
|
|
|
fprintf(fp, "no:None:None:%s:dev_null\n", hooks);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Generates a converter to the ostra lebacy tables format, needef by
|
|
|
|
* ostra-cg to preprocess the raw data collected from the debugfs/relay
|
|
|
|
* channel.
|
|
|
|
*/
|
2007-05-24 23:45:34 +02:00
|
|
|
static int class__emit_ostra_converter(struct tag *tag_self,
|
[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 18:15:27 +01:00
|
|
|
const struct cu *cu)
|
|
|
|
{
|
2007-05-24 23:45:34 +02:00
|
|
|
struct class *self = tag__class(tag_self);
|
[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 18:15:27 +01:00
|
|
|
struct class_member *pos;
|
|
|
|
struct type *type = &mini_class->type;
|
|
|
|
int field = 0, first = 1;
|
|
|
|
char filename[128];
|
|
|
|
char parm_list[1024];
|
|
|
|
char *p = parm_list;
|
|
|
|
size_t n;
|
|
|
|
size_t plen = sizeof(parm_list);
|
|
|
|
FILE *fp_fields, *fp_converter;
|
2007-11-12 16:20:22 +01:00
|
|
|
const char *name = class__name(self, cu);
|
[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 18:15:27 +01:00
|
|
|
|
2007-11-12 16:20:22 +01:00
|
|
|
snprintf(filename, sizeof(filename), "%s/%s.fields", src_dir, name);
|
[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 18:15:27 +01:00
|
|
|
fp_fields = fopen(filename, "w");
|
|
|
|
if (fp_fields == NULL) {
|
|
|
|
fprintf(stderr, "ctracer: couldn't create %s\n", filename);
|
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
}
|
|
|
|
|
|
|
|
snprintf(filename, sizeof(filename), "%s/ctracer2ostra.c", src_dir);
|
|
|
|
|
|
|
|
fp_converter = fopen(filename, "w");
|
|
|
|
if (fp_converter == NULL) {
|
|
|
|
fprintf(stderr, "ctracer: couldn't create %s\n", filename);
|
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
}
|
|
|
|
|
|
|
|
fputs("#include <stdio.h>\n"
|
|
|
|
"#include <string.h>\n"
|
|
|
|
"#include \"ctracer_relay.h\"\n\n", fp_converter);
|
2007-04-28 21:13:35 +02:00
|
|
|
class__fprintf(mini_class, cu, NULL, fp_converter);
|
2007-11-11 19:39:03 +01:00
|
|
|
fputs(";\n\n", fp_converter);
|
[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 18:15:27 +01:00
|
|
|
emit_struct_member_table_entry(fp_fields, field++, "action", 0,
|
|
|
|
"entry,exit");
|
|
|
|
emit_struct_member_table_entry(fp_fields, field++, "function_id", 0,
|
|
|
|
"entry,exit");
|
|
|
|
emit_struct_member_table_entry(fp_fields, field++, "object", 1,
|
|
|
|
"entry,exit");
|
|
|
|
|
2007-11-12 16:20:22 +01:00
|
|
|
fprintf(fp_converter, "\n"
|
[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 18:15:27 +01:00
|
|
|
"int main(void)\n"
|
|
|
|
"{\n"
|
|
|
|
"\twhile (1) {\n"
|
|
|
|
"\t\tstruct trace_entry hdr;\n"
|
2007-11-12 16:20:22 +01:00
|
|
|
"\t\tstruct ctracer__mini_%s obj;\n"
|
[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 18:15:27 +01:00
|
|
|
"\n"
|
|
|
|
"\t\tif (read(0, &hdr, sizeof(hdr)) != sizeof(hdr))\n"
|
|
|
|
"\t\t\tbreak;\n"
|
|
|
|
"\n"
|
2007-11-12 17:06:16 +01:00
|
|
|
"\t\tfprintf(stdout, \"%%llu %%c:%%llu:%%p\",\n"
|
2007-11-11 19:39:03 +01:00
|
|
|
"\t\t\thdr.nsec,\n"
|
[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 18:15:27 +01:00
|
|
|
"\t\t\thdr.probe_type ? 'o' : 'i',\n"
|
|
|
|
"\t\t\thdr.function_id,\n"
|
|
|
|
"\t\t\thdr.object);\n"
|
|
|
|
"\n"
|
|
|
|
"\t\tif (read(0, &obj, sizeof(obj)) != sizeof(obj))\n"
|
|
|
|
"\t\t\tbreak;\n"
|
|
|
|
"\t\tfprintf(stdout,\n"
|
2007-11-12 16:20:22 +01:00
|
|
|
"\t\t\t\":", name);
|
[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 18:15:27 +01:00
|
|
|
|
2007-05-29 19:06:33 +02:00
|
|
|
type__for_each_data_member(type, pos) {
|
[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 18:15:27 +01:00
|
|
|
if (first)
|
|
|
|
first = 0;
|
|
|
|
else {
|
|
|
|
fputc(':', fp_converter);
|
|
|
|
n = snprintf(p, plen, ",\n\t\t\t ");
|
|
|
|
plen -= n; p += n;
|
|
|
|
}
|
|
|
|
fprintf(fp_converter, "%%u");
|
|
|
|
n = snprintf(p, plen, "obj.%s", pos->name);
|
|
|
|
plen -= n; p += n;
|
|
|
|
emit_struct_member_table_entry(fp_fields, field++,
|
2007-11-11 19:39:03 +01:00
|
|
|
pos->name, 1, "entry,exit");
|
[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 18:15:27 +01:00
|
|
|
}
|
|
|
|
fprintf(fp_converter,
|
|
|
|
"\\n\",\n\t\t\t %s);\n"
|
|
|
|
"\t}\n"
|
|
|
|
"\treturn 0;\n"
|
|
|
|
"}\n", parm_list);
|
|
|
|
fclose(fp_fields);
|
|
|
|
fclose(fp_converter);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2007-05-24 23:45:34 +02:00
|
|
|
static int class__emit_subset(struct tag *tag_self, const struct cu *cu)
|
[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 18:15:27 +01:00
|
|
|
{
|
|
|
|
struct class *self = tag__class(tag_self);
|
|
|
|
int err = -1;
|
|
|
|
char mini_class_name[128];
|
|
|
|
|
|
|
|
snprintf(mini_class_name, sizeof(mini_class_name), "ctracer__mini_%s",
|
2007-05-24 23:45:34 +02:00
|
|
|
class__name(self, cu));
|
[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 18:15:27 +01:00
|
|
|
|
|
|
|
mini_class = class__clone_base_types(tag_self, cu, mini_class_name);
|
|
|
|
if (mini_class == NULL)
|
|
|
|
goto out;
|
|
|
|
|
2007-11-11 19:39:03 +01:00
|
|
|
class__fprintf(mini_class, cu, NULL, fp_collector);
|
|
|
|
fputs(";\n\n", fp_collector);
|
2007-05-24 23:45:34 +02:00
|
|
|
class__emit_class_state_collector(self, mini_class, cu);
|
[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 18:15:27 +01:00
|
|
|
err = 0;
|
|
|
|
out:
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
2007-01-20 14:25:50 +01:00
|
|
|
/*
|
|
|
|
* Emit the kprobes routine for one of the selected "methods", later we'll
|
|
|
|
* put this into the 'kprobes' table, in cu_emit_kprobes_table_iterator.
|
|
|
|
*
|
|
|
|
* This marks the function entry, function__emit_kretprobes will emit the
|
|
|
|
* probe for the function exit.
|
|
|
|
*/
|
2007-11-11 19:39:03 +01:00
|
|
|
static int function__emit_probes(struct function *self, const struct cu *cu,
|
|
|
|
const struct tag *target, int probe_type)
|
2006-12-20 15:16:16 +01:00
|
|
|
{
|
2006-12-20 23:09:49 +01:00
|
|
|
struct parameter *pos;
|
2007-01-07 20:13:39 +01:00
|
|
|
const char *name = function__name(self, cu);
|
2006-12-20 15:16:16 +01:00
|
|
|
|
2007-11-11 19:39:03 +01:00
|
|
|
fprintf(fp_methods, "probe %s%s = kernel.function(\"%s\")%s\n"
|
|
|
|
"{\n"
|
|
|
|
"}\n\n"
|
|
|
|
"probe %s%s\n"
|
|
|
|
"{\n", name,
|
|
|
|
probe_type == 0 ? "" : "__return",
|
|
|
|
name,
|
|
|
|
probe_type == 0 ? "" : ".return",
|
|
|
|
name,
|
|
|
|
probe_type == 0 ? "" : "__return");
|
2006-12-20 15:16:16 +01:00
|
|
|
|
2006-12-30 19:34:20 +01:00
|
|
|
list_for_each_entry(pos, &self->proto.parms, tag.node) {
|
2007-01-09 16:34:15 +01:00
|
|
|
struct tag *type = cu__find_tag_by_id(cu, pos->tag.type);
|
2006-12-20 15:16:16 +01:00
|
|
|
|
2006-12-29 18:28:58 +01:00
|
|
|
if (type->tag != DW_TAG_pointer_type)
|
2006-12-20 15:16:16 +01:00
|
|
|
continue;
|
|
|
|
|
2007-01-04 00:57:35 +01:00
|
|
|
type = cu__find_tag_by_id(cu, type->type);
|
2006-12-29 18:28:58 +01:00
|
|
|
if (type == NULL || type->id != target->id)
|
2006-12-20 15:16:16 +01:00
|
|
|
continue;
|
|
|
|
|
[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 18:15:27 +01:00
|
|
|
fprintf(fp_methods,
|
2007-11-11 19:39:03 +01:00
|
|
|
"\tctracer__method_hook(%d, %#llx, $%s, %zd);\n",
|
|
|
|
probe_type,
|
2007-03-28 16:38:32 +02:00
|
|
|
(unsigned long long)self->proto.tag.id, pos->name,
|
[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 18:15:27 +01:00
|
|
|
class__size(mini_class));
|
|
|
|
break;
|
2006-12-20 15:16:16 +01:00
|
|
|
}
|
2007-01-09 16:34:15 +01:00
|
|
|
|
2007-11-11 19:39:03 +01:00
|
|
|
fputs("}\n\n", fp_methods);
|
2007-01-09 16:34:15 +01:00
|
|
|
|
2006-12-20 15:16:16 +01:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2007-01-20 14:25:50 +01:00
|
|
|
/*
|
|
|
|
* Iterate thru the list of methods previously collected by
|
|
|
|
* cu_find_methods_iterator, emitting the probes for function entry.
|
|
|
|
*/
|
2007-11-11 19:39:03 +01:00
|
|
|
static int cu_emit_probes_iterator(struct cu *cu, void *cookie)
|
2006-12-20 15:16:16 +01:00
|
|
|
{
|
2007-01-07 16:11:20 +01:00
|
|
|
struct tag *target = cu__find_struct_by_name(cu, cookie);
|
2006-12-20 15:16:16 +01:00
|
|
|
struct function *pos;
|
|
|
|
|
2006-12-20 17:27:28 +01:00
|
|
|
list_for_each_entry(pos, &cu->tool_list, tool_node) {
|
2007-11-11 19:39:03 +01:00
|
|
|
if (methods__add(&probes_emitted, function__name(pos, cu)) != 0)
|
2007-01-13 17:56:16 +01:00
|
|
|
continue;
|
|
|
|
pos->priv = (void *)1; /* Mark as visited, for the table iterator */
|
2007-11-11 19:39:03 +01:00
|
|
|
function__emit_probes(pos, cu, target, 0); /* entry */
|
|
|
|
function__emit_probes(pos, cu, target, 1); /* exit */
|
2007-01-13 17:56:16 +01:00
|
|
|
}
|
2006-12-24 02:42:39 +01:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2007-01-20 14:25:50 +01:00
|
|
|
/*
|
|
|
|
* Iterate thru the list of methods previously collected by
|
2007-11-11 19:39:03 +01:00
|
|
|
* cu_find_methods_iterator, creating the functions table that will
|
|
|
|
* be used by ostra-cg
|
2007-01-20 14:25:50 +01:00
|
|
|
*/
|
2007-11-11 19:39:03 +01:00
|
|
|
static int cu_emit_functions_table(struct cu *cu, void *fp)
|
2006-12-24 16:36:13 +01:00
|
|
|
{
|
2007-11-11 19:39:03 +01:00
|
|
|
struct function *pos;
|
[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 18:15:27 +01:00
|
|
|
|
2007-11-11 19:39:03 +01:00
|
|
|
list_for_each_entry(pos, &cu->tool_list, tool_node)
|
|
|
|
if (pos->priv != NULL)
|
|
|
|
fprintf(fp, "%llu:%s\n",
|
|
|
|
(unsigned long long)pos->proto.tag.id,
|
|
|
|
function__name(pos, cu));
|
2006-12-24 16:36:13 +01:00
|
|
|
|
2007-11-11 19:39:03 +01:00
|
|
|
return 0;
|
2006-12-20 15:16:16 +01:00
|
|
|
}
|
|
|
|
|
2007-03-30 16:16:50 +02:00
|
|
|
static const struct argp_option ctracer__options[] = {
|
|
|
|
{
|
|
|
|
.key = 'd',
|
|
|
|
.name = "src_dir",
|
2007-04-28 21:15:34 +02:00
|
|
|
.arg = "SRC_DIR",
|
2007-03-30 16:16:50 +02:00
|
|
|
.doc = "generate source files in this directory",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.key = 'D',
|
|
|
|
.name = "dir",
|
2007-04-28 21:15:34 +02:00
|
|
|
.arg = "DIR",
|
2007-03-30 16:16:50 +02:00
|
|
|
.doc = "load files in this directory",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.key = 'g',
|
|
|
|
.name = "glob",
|
2007-04-28 21:15:34 +02:00
|
|
|
.arg = "GLOB",
|
2007-03-30 16:16:50 +02:00
|
|
|
.doc = "file mask to load",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.key = 'r',
|
|
|
|
.name = "recursive",
|
|
|
|
.doc = "recursively load files",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.name = NULL,
|
|
|
|
}
|
2006-12-20 15:16:16 +01:00
|
|
|
};
|
|
|
|
|
2007-11-11 19:39:03 +01:00
|
|
|
static const char *dirname, *glob;
|
2007-03-30 16:16:50 +02:00
|
|
|
static char *class_name;
|
|
|
|
static int recursive;
|
|
|
|
|
|
|
|
static error_t ctracer__options_parser(int key, char *arg,
|
|
|
|
struct argp_state *state __unused)
|
2006-12-20 15:16:16 +01:00
|
|
|
{
|
2007-03-30 16:16:50 +02:00
|
|
|
switch (key) {
|
|
|
|
case 'd': src_dir = arg; break;
|
|
|
|
case 'D': dirname = arg; break;
|
|
|
|
case 'g': glob = arg; break;
|
|
|
|
case 'r': recursive = 1; break;
|
|
|
|
default: return ARGP_ERR_UNKNOWN;
|
|
|
|
}
|
|
|
|
return 0;
|
2006-12-20 15:16:16 +01:00
|
|
|
}
|
|
|
|
|
2007-03-30 16:16:50 +02:00
|
|
|
static const char ctracer__args_doc[] = "[FILE] [CLASS]";
|
|
|
|
|
|
|
|
static struct argp ctracer__argp = {
|
|
|
|
.options = ctracer__options,
|
|
|
|
.parser = ctracer__options_parser,
|
|
|
|
.args_doc = ctracer__args_doc,
|
|
|
|
};
|
|
|
|
|
2006-12-20 15:16:16 +01:00
|
|
|
int main(int argc, char *argv[])
|
|
|
|
{
|
2007-03-30 16:16:50 +02:00
|
|
|
int remaining, err;
|
2007-01-27 12:03:40 +01:00
|
|
|
struct tag *class;
|
|
|
|
struct cu *cu;
|
2007-03-30 16:16:50 +02:00
|
|
|
const char *filename;
|
[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 18:15:27 +01:00
|
|
|
char functions_filename[PATH_MAX];
|
|
|
|
char methods_filename[PATH_MAX];
|
2007-11-11 19:39:03 +01:00
|
|
|
char collector_filename[PATH_MAX];
|
|
|
|
FILE *fp_functions;
|
2006-12-20 15:16:16 +01:00
|
|
|
|
2007-03-30 16:16:50 +02:00
|
|
|
argp_parse(&ctracer__argp, argc, argv, 0, &remaining, NULL);
|
2006-12-20 15:16:16 +01:00
|
|
|
|
2007-03-30 16:16:50 +02:00
|
|
|
if (remaining < argc) {
|
|
|
|
switch (argc - remaining) {
|
2007-11-11 19:39:03 +01:00
|
|
|
case 1: goto failure;
|
2007-03-30 16:16:50 +02:00
|
|
|
case 2: filename = argv[remaining++];
|
|
|
|
class_name = argv[remaining++]; break;
|
|
|
|
default: goto failure;
|
2006-12-20 15:16:16 +01:00
|
|
|
}
|
|
|
|
} else {
|
2007-03-30 16:16:50 +02:00
|
|
|
failure:
|
|
|
|
argp_help(&ctracer__argp, stderr, ARGP_HELP_SEE, "ctracer");
|
2006-12-20 15:16:16 +01:00
|
|
|
return EXIT_FAILURE;
|
|
|
|
}
|
|
|
|
|
2007-01-20 14:25:50 +01:00
|
|
|
/*
|
|
|
|
* Initialize libdwarves, for now just to get the machine L1 cacheline
|
|
|
|
* size, in the future may do more stuff.
|
|
|
|
*/
|
2007-01-19 00:41:25 +01:00
|
|
|
dwarves__init(0);
|
|
|
|
|
2007-01-20 14:25:50 +01:00
|
|
|
/*
|
|
|
|
* Create the methods_cus (Compilation Units) object where we will
|
|
|
|
* load the objects where we'll look for functions pointers to the
|
|
|
|
* specified class, i.e. to find its "methods", where we'll insert
|
|
|
|
* the entry and exit hooks.
|
|
|
|
*/
|
|
|
|
methods_cus = cus__new(&cus__definitions, &cus__fwd_decls);
|
|
|
|
if (methods_cus == NULL) {
|
2006-12-20 15:16:16 +01:00
|
|
|
fputs("ctracer: insufficient memory\n", stderr);
|
|
|
|
return EXIT_FAILURE;
|
|
|
|
}
|
2006-12-27 17:59:17 +01:00
|
|
|
|
2007-01-20 14:25:50 +01:00
|
|
|
/*
|
|
|
|
* if --dir/-D was specified, recursively traverse the path looking for
|
|
|
|
* object files (compilation units) that match the glob specified (*.ko)
|
|
|
|
* for kernel modules, but could be "*.o" in the future when we support
|
|
|
|
* uprobes for user space tracing.
|
|
|
|
*/
|
|
|
|
if (dirname != NULL && cus__load_dir(methods_cus, dirname, glob,
|
2006-12-27 17:59:17 +01:00
|
|
|
recursive) != 0) {
|
|
|
|
fprintf(stderr, "ctracer: couldn't load DWARF info "
|
|
|
|
"from %s dir with glob %s\n",
|
|
|
|
dirname, glob);
|
|
|
|
return EXIT_FAILURE;
|
|
|
|
}
|
2006-12-20 15:16:16 +01:00
|
|
|
|
2007-01-20 14:25:50 +01:00
|
|
|
/*
|
|
|
|
* If a filename was specified, for instance "vmlinux", load it too.
|
|
|
|
*/
|
2007-03-28 17:54:46 +02:00
|
|
|
if (filename != NULL) {
|
|
|
|
err = cus__load(methods_cus, filename);
|
|
|
|
if (err != 0) {
|
|
|
|
cus__print_error_msg("ctracer", filename, err);
|
|
|
|
return EXIT_FAILURE;
|
|
|
|
}
|
2006-12-20 15:16:16 +01:00
|
|
|
}
|
|
|
|
|
2007-01-27 12:03:40 +01:00
|
|
|
/*
|
|
|
|
* See if the specified struct exists:
|
|
|
|
*/
|
|
|
|
class = cus__find_struct_by_name(methods_cus, &cu, class_name);
|
|
|
|
if (class == NULL) {
|
|
|
|
fprintf(stderr, "ctracer: struct %s not found!\n", class_name);
|
|
|
|
return EXIT_FAILURE;
|
|
|
|
}
|
|
|
|
|
[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 18:15:27 +01:00
|
|
|
snprintf(functions_filename, sizeof(functions_filename),
|
2007-05-24 23:45:34 +02:00
|
|
|
"%s/%s.functions", src_dir,
|
|
|
|
class__name(tag__class(class), cu));
|
2007-11-11 19:39:03 +01:00
|
|
|
fp_functions = fopen(functions_filename, "w");
|
|
|
|
if (fp_functions == NULL) {
|
[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 18:15:27 +01:00
|
|
|
fprintf(stderr, "ctracer: couldn't create %s\n",
|
|
|
|
functions_filename);
|
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
}
|
|
|
|
|
|
|
|
snprintf(methods_filename, sizeof(methods_filename),
|
2007-11-11 19:39:03 +01:00
|
|
|
"%s/ctracer_methods.stp", src_dir);
|
[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 18:15:27 +01:00
|
|
|
fp_methods = fopen(methods_filename, "w");
|
|
|
|
if (fp_methods == NULL) {
|
|
|
|
fprintf(stderr, "ctracer: couldn't create %s\n",
|
|
|
|
methods_filename);
|
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
}
|
|
|
|
|
2007-11-11 19:39:03 +01:00
|
|
|
snprintf(collector_filename, sizeof(collector_filename),
|
|
|
|
"%s/ctracer_collector.c", src_dir);
|
|
|
|
fp_collector = fopen(collector_filename, "w");
|
|
|
|
if (fp_collector == NULL) {
|
|
|
|
fprintf(stderr, "ctracer: couldn't create %s\n",
|
|
|
|
collector_filename);
|
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
}
|
[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 18:15:27 +01:00
|
|
|
|
2007-11-11 19:39:03 +01:00
|
|
|
fputs("%{\n"
|
|
|
|
"#include </home/acme/git/pahole/lib/ctracer_relay.h>\n"
|
|
|
|
"%}\n"
|
|
|
|
"function ctracer__method_hook(probe_type, func, object, state_len)\n"
|
|
|
|
"%{\n"
|
|
|
|
"\tctracer__method_hook(_stp_gettimeofday_ns(), THIS->probe_type, THIS->func, (void *)THIS->object, THIS->state_len);\n"
|
|
|
|
"%}\n\n", fp_methods);
|
|
|
|
|
|
|
|
cus__emit_type_definitions(methods_cus, cu, class, fp_collector);
|
|
|
|
type__emit(class, cu, NULL, NULL, fp_collector);
|
|
|
|
fputc('\n', fp_collector);
|
[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 18:15:27 +01:00
|
|
|
class__emit_subset(class, cu);
|
2007-11-11 19:39:03 +01:00
|
|
|
|
[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 18:15:27 +01:00
|
|
|
class__emit_ostra_converter(class, cu);
|
2007-11-11 19:39:03 +01:00
|
|
|
|
2007-01-20 14:25:50 +01:00
|
|
|
cus__for_each_cu(methods_cus, cu_find_methods_iterator,
|
|
|
|
class_name, NULL);
|
2007-11-11 19:39:03 +01:00
|
|
|
cus__for_each_cu(methods_cus, cu_emit_probes_iterator,
|
2007-01-20 14:25:50 +01:00
|
|
|
class_name, NULL);
|
2007-11-11 19:39:03 +01:00
|
|
|
|
|
|
|
cus__for_each_cu(methods_cus, cu_emit_functions_table, fp_functions, NULL);
|
|
|
|
fclose(fp_methods);
|
|
|
|
fclose(fp_collector);
|
|
|
|
fclose(fp_functions);
|
2006-12-20 15:16:16 +01:00
|
|
|
|
|
|
|
return EXIT_SUCCESS;
|
|
|
|
}
|