Commit Graph

24 Commits

Author SHA1 Message Date
Arnaldo Carvalho de Melo 7e57db18d7 [LIB]: Add support for DW_AT_specification in DW_TAG_subprogram
C++ feature, we have to look for the id, then abstract_origin and then
specification.

Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
2007-01-13 11:37:41 -02:00
Arnaldo Carvalho de Melo 5dcd02daa3 [LIB]: Print the cu offset in tag__print_decl_info
To locate the entry in the readelf output when looking for problems.

Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
2007-01-13 10:58:58 -02:00
Arnaldo Carvalho de Melo f6718f5721 [LIB]: Export lexblock__print
tag__print on a DW_TAG_subprogram tag prints just the function prototype,
without the ending ";\", so if a user wants to print the whole function its
just a matter of calling tag__print + lexblock__(tag__function(tag), cu,
indent).

Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
2007-01-13 10:57:19 -02:00
Arnaldo Carvalho de Melo 777a21fad0 [LIB]: Replace ntabs with indent, for consistency
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
2007-01-13 10:40:33 -02:00
Arnaldo Carvalho de Melo aa961db9b9 [LIB]: Reintroduce union__print, this time being called by tag__print
And will be used by a new dwarf, that is about to be merged.

Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
2007-01-12 18:00:32 -02:00
Arnaldo Carvalho de Melo de345d7d29 [LIB]: Leave to the callers of enumeration__print to add or not the ; and newline
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
2007-01-12 17:40:12 -02:00
Arnaldo Carvalho de Melo ef329ecd49 [LIB]: Leave to callers of typedef__print to add or not the ; and newline
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
2007-01-12 17:23:14 -02:00
Arnaldo Carvalho de Melo 49ca9c8a0b [LIB]: Make ftype__snprintf check for types not found
Again, due to some tags not being collected in the C++ case.

Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
2007-01-12 16:34:53 -02:00
Arnaldo Carvalho de Melo ed2d124a0e [LIB]: Make typedef__print check if the type was not found
This should not happen, but right now happens as we don't support all the C++
tags, so some types are not being collected when inside DW_TAG_namespace dies.

Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
2007-01-12 16:29:53 -02:00
Arnaldo Carvalho de Melo 16c0586602 [LIB]: Make all callers of function__print use tag__print instead
And since there are no external users now, just unexport it, ditto
for tag__print_decl_info.

Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
2007-01-12 16:25:20 -02:00
Arnaldo Carvalho de Melo 907831071f [LIB]: Make tag__print support DW_TAG_subprogram
Calling function__print.

Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
2007-01-12 16:19:13 -02:00
Arnaldo Carvalho de Melo 26747d0053 [LIB]: Don't print the decl info in function__print
Its up to its callers, that will be moot soon as tag__print will call
function__print and as it already prints the decl info it'll be just a matter
of making all the function__print callers call tag__print instead and then
function__print will be unexported.

Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
2007-01-12 16:17:53 -02:00
Arnaldo Carvalho de Melo df1832ac4f [LIB]: Introduce tag__print_decl_info
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
2007-01-12 16:11:37 -02:00
Arnaldo Carvalho de Melo c1f96237b3 [LIB]: Remove unused variables in function__print
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
2007-01-12 16:03:38 -02:00
Arnaldo Carvalho de Melo 3fe4f09a27 [LIB]: Move the stats printing bits out of function__print
Moving them to a new function, function__print_stats.

Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
2007-01-12 16:00:07 -02:00
Arnaldo Carvalho de Melo d385563a53 [LIB]: Make the function methods return and receive a struct tag
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
2007-01-12 15:47:26 -02:00
Arnaldo Carvalho de Melo 458e7d6867 [LIB]: Call enumeration__print in tag__print
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
2007-01-12 15:24:41 -02:00
Arnaldo Carvalho de Melo 18703f8d3c [LIB]: Call typedef__print in tag__print
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
2007-01-12 15:13:38 -02:00
Arnaldo Carvalho de Melo bc58353565 [LIB]: Pass prefix and suffix to class__snprintf in class__print
Fixing a regression introduced when doing the class__snprintf introduction out
of class__print, namely this one:

--- ctracer_sock.c.old  2007-01-12 14:57:56.000000000 -0200
+++ ctracer.c   2007-01-12 15:00:21.000000000 -0200
@@ -1668,7 +1668,7 @@
 };

   /* /pub/scm/linux/kernel/git/acme/linux-2.6/include/linux/fs.h:1050 */
  -struct {
  +typedef struct {
          size_t              written;     /*     0     4 */
          size_t              count;       /*     4     4 */
          union {
  @@ -1676,7 +1676,7 @@
                  void *      data;        /*           4 */
          } arg;                           /*     8     4 */
          int                 error;       /*    12     4 */
  -}; /* size: 16, cachelines: 1 */
  +} read_descriptor_t; /* size: 16, cachelines: 1 */
      /* last cacheline: 16 bytes */

   typedef int (*sk_read_actor_t)(read_descriptor_t *, struct sk_buff *, unsigned int, size_t);

Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
2007-01-12 15:03:59 -02:00
Arnaldo Carvalho de Melo 0661f26f9f [LIB]: Call cus__emit_ftype_definitions for DW_TAG_subroutine_type in cus__emit_tag_definitions
Thus emitting definitions/forward declarations for the types of function
pointers, not just for the return type of the function pointer.

Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
2007-01-12 14:39:26 -02:00
Arnaldo Carvalho de Melo 0905197862 [LIB]: Create typedef__print out of cus__emit_typedef_definitions
This way cus__emit_typedef_definitions first looks for definitions in the
typedef that will be emitted, emits those definitions, then prints the typedef.

With this it'll be possible to make tag__print to print typedefs, when we know
that the definitions it needs were already previously emitted/printed.

Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
2007-01-12 13:04:05 -02:00
Arnaldo Carvalho de Melo a1f5422656 [LIB]: Add support for DW_TAG_reference_type
One more C++ feature supported:

[acme@newtoy examples]$ pahole qsettings.o QConfFileSettingsPrivate
/* io/qsettings_p.h:233 */
struct QConfFileSettingsPrivate {
        struct QSettingsPrivate (null);               /*     0    76 */
        /* --- cacheline 2 boundary (64 bytes) was 12 bytes ago --- */
        class QConfFile *       confFiles[4];         /*    76    16 */
        enum Format             format;               /*    92     4 */
        /* --- cacheline 3 boundary (96 bytes) --- */
        bool                    (*readFunc)(class QIODevice &, class QMap<QString,QVariant> &); /*    96     4 */
        bool                    (*writeFunc)(class QIODevice &, const class QMap<QString,QVariant>  &); /*   100     4 */
        struct QString          extension;            /*   104     4 */
        >>>ERROR: type for caseSensitivity not found!
}; /* size: 112, cachelines: 4 */
   /* padding: 5 */
   /* last cacheline: 16 bytes */

/* BRAIN FART ALERT! 112 != 108 + 0(holes), diff = 4 */

[acme@newtoy examples]$

Now to see the problem with caseSensitivity type, probably was defined inside
some DW_TAG_namespace, that is not yet supported.

Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
2007-01-12 11:06:59 -02:00
Arnaldo Carvalho de Melo 0ad467a321 [LIB]: Replace type not found asserts by an error message
So that we can continue and see what was the problem, investigate using readelf
-wi and proceed to fix it, normally its just references to not yet supported
tags, so far the ones I know are not supported are DW_TAG_reference_type &
DW_TAG_namespace, i.e. tags not present in the C language, only on C++ and
other object oriented routines with such concepts.

Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
2007-01-11 23:09:06 -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